diff --git a/src/alphalib/types/assembliesGet.ts b/src/alphalib/types/assembliesGet.ts new file mode 100644 index 00000000..17633b1c --- /dev/null +++ b/src/alphalib/types/assembliesGet.ts @@ -0,0 +1,42 @@ +import z from 'zod' + +import { assemblyAuthInstructionsSchema } from './template.ts' + +export const assembliesGetSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + page: z + .number() + .int() + .default(1) + .describe('Specifies the current page, within the current pagination'), + pagesize: z + .number() + .int() + .min(1) + .max(5000) + .default(50) + .describe( + 'Specifies how many Assemblies to be received per API request, which is useful for pagination.', + ), + type: z + .enum(['all', 'uploading', 'executing', 'canceled', 'completed', 'failed', 'request_aborted']) + .describe('Specifies the types of Assemblies to be retrieved.'), + fromdate: z + .string() + .describe( + 'Specifies the minimum Assembly UTC creation date/time. Only Assemblies after this time will be retrieved. Use the format `Y-m-d H:i:s`.', + ), + todate: z + .string() + .default('NOW()') + .describe( + 'Specifies the maximum Assembly UTC creation date/time. Only Assemblies before this time will be retrieved. Use the format `Y-m-d H:i:s`.', + ), + keywords: z + .array(z.string()) + .describe( + 'Specifies keywords to be matched in the Assembly Status. The Assembly fields checked include the `id`, `redirect_url`, `fields`, and `notify_url`, as well as error messages and files used.', + ), + }) + .strict() diff --git a/src/alphalib/types/assemblyReplay.ts b/src/alphalib/types/assemblyReplay.ts new file mode 100644 index 00000000..0a2d5e44 --- /dev/null +++ b/src/alphalib/types/assemblyReplay.ts @@ -0,0 +1,24 @@ +import { z } from 'zod' + +import { + assemblyAuthInstructionsSchema, + fieldsSchema, + notifyUrlSchema, + optionalStepsSchema, + templateIdSchema, +} from './template.ts' + +export const assemblyReplaySchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + steps: optionalStepsSchema as typeof optionalStepsSchema, + template_id: templateIdSchema, + notify_url: notifyUrlSchema, + fields: fieldsSchema, + reparse_template: z + .union([z.literal(0), z.literal(1)]) + .describe( + 'Specify `1` to reparse the Template used in your Assembly (useful if the Template changed in the meantime). Alternatively, `0` replays the identical Steps used in the Assembly.', + ), + }) + .strict() diff --git a/src/alphalib/types/assemblyReplayNotification.ts b/src/alphalib/types/assemblyReplayNotification.ts new file mode 100644 index 00000000..ce8ee098 --- /dev/null +++ b/src/alphalib/types/assemblyReplayNotification.ts @@ -0,0 +1,16 @@ +import { z } from 'zod' + +import { assemblyAuthInstructionsSchema, optionalStepsSchema } from './template.ts' + +export const assemblyReplayNotificationSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + steps: optionalStepsSchema as typeof optionalStepsSchema, + wait: z + .boolean() + .default(true) + .describe( + 'If it is provided with the value `false`, then the API request will return immediately even though the Notification is still in progress. This can be useful if your server takes some time to respond, but you do not want the replay API request to hang.', + ), + }) + .strict() diff --git a/src/alphalib/types/bill.ts b/src/alphalib/types/bill.ts new file mode 100644 index 00000000..e8e08099 --- /dev/null +++ b/src/alphalib/types/bill.ts @@ -0,0 +1,9 @@ +import { z } from 'zod' + +import { assemblyAuthInstructionsSchema } from './template.ts' + +export const billSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + }) + .strict() diff --git a/src/alphalib/types/robots/_index.ts b/src/alphalib/types/robots/_index.ts index c7bf606f..aac0688d 100644 --- a/src/alphalib/types/robots/_index.ts +++ b/src/alphalib/types/robots/_index.ts @@ -686,3 +686,415 @@ export const robotsMeta = { wasabiStoreMeta, youtubeStoreMeta, } + +export type { InterpolatableRobotAssemblySavejsonInstructions } from './assembly-savejson.ts' +export type { + InterpolatableRobotAudioArtworkInstructions, + InterpolatableRobotAudioArtworkInstructionsWithHiddenFields, + InterpolatableRobotAudioArtworkInstructionsWithHiddenFieldsInput, +} from './audio-artwork.ts' +export type { + InterpolatableRobotAudioConcatInstructions, + InterpolatableRobotAudioConcatInstructionsWithHiddenFields, + InterpolatableRobotAudioConcatInstructionsWithHiddenFieldsInput, +} from './audio-concat.ts' +export type { + InterpolatableRobotAudioEncodeInstructions, + InterpolatableRobotAudioEncodeInstructionsWithHiddenFields, + InterpolatableRobotAudioEncodeInstructionsWithHiddenFieldsInput, +} from './audio-encode.ts' +export type { + InterpolatableRobotAudioLoopInstructions, + InterpolatableRobotAudioLoopInstructionsWithHiddenFields, + InterpolatableRobotAudioLoopInstructionsWithHiddenFieldsInput, +} from './audio-loop.ts' +export type { + InterpolatableRobotAudioMergeInstructions, + InterpolatableRobotAudioMergeInstructionsWithHiddenFields, + InterpolatableRobotAudioMergeInstructionsWithHiddenFieldsInput, +} from './audio-merge.ts' +export type { + InterpolatableRobotAudioWaveformInstructions, + InterpolatableRobotAudioWaveformInstructionsWithHiddenFields, + InterpolatableRobotAudioWaveformInstructionsWithHiddenFieldsInput, +} from './audio-waveform.ts' +export type { + InterpolatableRobotAzureImportInstructions, + InterpolatableRobotAzureImportInstructionsWithHiddenFields, + InterpolatableRobotAzureImportInstructionsWithHiddenFieldsInput, +} from './azure-import.ts' +export type { + InterpolatableRobotAzureStoreInstructions, + InterpolatableRobotAzureStoreInstructionsWithHiddenFields, + InterpolatableRobotAzureStoreInstructionsWithHiddenFieldsInput, +} from './azure-store.ts' +export type { + InterpolatableRobotBackblazeImportInstructions, + InterpolatableRobotBackblazeImportInstructionsWithHiddenFields, + InterpolatableRobotBackblazeImportInstructionsWithHiddenFieldsInput, +} from './backblaze-import.ts' +export type { + InterpolatableRobotBackblazeStoreInstructions, + InterpolatableRobotBackblazeStoreInstructionsWithHiddenFields, + InterpolatableRobotBackblazeStoreInstructionsWithHiddenFieldsInput, +} from './backblaze-store.ts' +export type { + InterpolatableRobotCloudfilesImportInstructions, + InterpolatableRobotCloudfilesImportInstructionsWithHiddenFields, + InterpolatableRobotCloudfilesImportInstructionsWithHiddenFieldsInput, +} from './cloudfiles-import.ts' +export type { + InterpolatableRobotCloudfilesStoreInstructions, + InterpolatableRobotCloudfilesStoreInstructionsWithHiddenFields, + InterpolatableRobotCloudfilesStoreInstructionsWithHiddenFieldsInput, +} from './cloudfiles-store.ts' +export type { + InterpolatableRobotCloudflareImportInstructions, + InterpolatableRobotCloudflareImportInstructionsWithHiddenFields, + InterpolatableRobotCloudflareImportInstructionsWithHiddenFieldsInput, +} from './cloudflare-import.ts' +export type { + InterpolatableRobotCloudflareStoreInstructions, + InterpolatableRobotCloudflareStoreInstructionsWithHiddenFields, + InterpolatableRobotCloudflareStoreInstructionsWithHiddenFieldsInput, +} from './cloudflare-store.ts' +export type { + InterpolatableRobotDigitaloceanImportInstructions, + InterpolatableRobotDigitaloceanImportInstructionsWithHiddenFields, + InterpolatableRobotDigitaloceanImportInstructionsWithHiddenFieldsInput, +} from './digitalocean-import.ts' +export type { + InterpolatableRobotDigitaloceanStoreInstructions, + InterpolatableRobotDigitaloceanStoreInstructionsWithHiddenFields, + InterpolatableRobotDigitaloceanStoreInstructionsWithHiddenFieldsInput, +} from './digitalocean-store.ts' +export type { + InterpolatableRobotDocumentAutorotateInstructions, + InterpolatableRobotDocumentAutorotateInstructionsWithHiddenFields, + InterpolatableRobotDocumentAutorotateInstructionsWithHiddenFieldsInput, +} from './document-autorotate.ts' +export type { + InterpolatableRobotDocumentConvertInstructions, + InterpolatableRobotDocumentConvertInstructionsWithHiddenFields, + InterpolatableRobotDocumentConvertInstructionsWithHiddenFieldsInput, +} from './document-convert.ts' +export type { + InterpolatableRobotDocumentMergeInstructions, + InterpolatableRobotDocumentMergeInstructionsWithHiddenFields, + InterpolatableRobotDocumentMergeInstructionsWithHiddenFieldsInput, +} from './document-merge.ts' +export type { + InterpolatableRobotDocumentOcrInstructions, + InterpolatableRobotDocumentOcrInstructionsWithHiddenFields, + InterpolatableRobotDocumentOcrInstructionsWithHiddenFieldsInput, +} from './document-ocr.ts' +export type { + InterpolatableRobotDocumentSplitInstructions, + InterpolatableRobotDocumentSplitInstructionsWithHiddenFields, + InterpolatableRobotDocumentSplitInstructionsWithHiddenFieldsInput, +} from './document-split.ts' +export type { + InterpolatableRobotDocumentThumbsInstructions, + InterpolatableRobotDocumentThumbsInstructionsWithHiddenFields, + InterpolatableRobotDocumentThumbsInstructionsWithHiddenFieldsInput, +} from './document-thumbs.ts' +export type { + InterpolatableRobotDropboxImportInstructions, + InterpolatableRobotDropboxImportInstructionsWithHiddenFields, + InterpolatableRobotDropboxImportInstructionsWithHiddenFieldsInput, +} from './dropbox-import.ts' +export type { + InterpolatableRobotDropboxStoreInstructions, + InterpolatableRobotDropboxStoreInstructionsWithHiddenFields, + InterpolatableRobotDropboxStoreInstructionsWithHiddenFieldsInput, +} from './dropbox-store.ts' +export type { + InterpolatableRobotEdglyDeliverInstructions, + InterpolatableRobotEdglyDeliverInstructionsWithHiddenFields, + InterpolatableRobotEdglyDeliverInstructionsWithHiddenFieldsInput, +} from './edgly-deliver.ts' +export type { + InterpolatableRobotFileCompressInstructions, + InterpolatableRobotFileCompressInstructionsWithHiddenFields, + InterpolatableRobotFileCompressInstructionsWithHiddenFieldsInput, +} from './file-compress.ts' +export type { + InterpolatableRobotFileDecompressInstructions, + InterpolatableRobotFileDecompressInstructionsWithHiddenFields, + InterpolatableRobotFileDecompressInstructionsWithHiddenFieldsInput, +} from './file-decompress.ts' +export type { + InterpolatableRobotFileFilterInstructions, + InterpolatableRobotFileFilterInstructionsWithHiddenFields, + InterpolatableRobotFileFilterInstructionsWithHiddenFieldsInput, +} from './file-filter.ts' +export type { + InterpolatableRobotFileHashInstructions, + InterpolatableRobotFileHashInstructionsWithHiddenFields, + InterpolatableRobotFileHashInstructionsWithHiddenFieldsInput, +} from './file-hash.ts' +export type { + InterpolatableRobotFilePreviewInstructions, + InterpolatableRobotFilePreviewInstructionsWithHiddenFields, + InterpolatableRobotFilePreviewInstructionsWithHiddenFieldsInput, +} from './file-preview.ts' +export type { + InterpolatableRobotFileReadInstructions, + InterpolatableRobotFileReadInstructionsWithHiddenFields, + InterpolatableRobotFileReadInstructionsWithHiddenFieldsInput, +} from './file-read.ts' +export type { + InterpolatableRobotFileServeInstructions, + InterpolatableRobotFileServeInstructionsWithHiddenFields, + InterpolatableRobotFileServeInstructionsWithHiddenFieldsInput, +} from './file-serve.ts' +export type { + InterpolatableRobotFileVerifyInstructions, + InterpolatableRobotFileVerifyInstructionsWithHiddenFields, + InterpolatableRobotFileVerifyInstructionsWithHiddenFieldsInput, +} from './file-verify.ts' +export type { + InterpolatableRobotFileVirusscanInstructions, + InterpolatableRobotFileVirusscanInstructionsWithHiddenFields, + InterpolatableRobotFileVirusscanInstructionsWithHiddenFieldsInput, +} from './file-virusscan.ts' +export type { + InterpolatableRobotFileWatermarkInstructions, + InterpolatableRobotFileWatermarkInstructionsWithHiddenFields, + InterpolatableRobotFileWatermarkInstructionsWithHiddenFieldsInput, +} from './file-watermark.ts' +export type { + InterpolatableRobotFtpImportInstructions, + InterpolatableRobotFtpImportInstructionsWithHiddenFields, + InterpolatableRobotFtpImportInstructionsWithHiddenFieldsInput, +} from './ftp-import.ts' +export type { + InterpolatableRobotFtpStoreInstructions, + InterpolatableRobotFtpStoreInstructionsWithHiddenFields, + InterpolatableRobotFtpStoreInstructionsWithHiddenFieldsInput, +} from './ftp-store.ts' +export type { + InterpolatableRobotGoogleImportInstructions, + InterpolatableRobotGoogleImportInstructionsWithHiddenFields, + InterpolatableRobotGoogleImportInstructionsWithHiddenFieldsInput, +} from './google-import.ts' +export type { + InterpolatableRobotGoogleStoreInstructions, + InterpolatableRobotGoogleStoreInstructionsWithHiddenFields, + InterpolatableRobotGoogleStoreInstructionsWithHiddenFieldsInput, +} from './google-store.ts' +export type { + InterpolatableRobotHtmlConvertInstructions, + InterpolatableRobotHtmlConvertInstructionsWithHiddenFields, + InterpolatableRobotHtmlConvertInstructionsWithHiddenFieldsInput, +} from './html-convert.ts' +export type { + InterpolatableRobotHttpImportInstructions, + InterpolatableRobotHttpImportInstructionsWithHiddenFields, + InterpolatableRobotHttpImportInstructionsWithHiddenFieldsInput, +} from './http-import.ts' +export type { + InterpolatableRobotImageBgremoveInstructions, + InterpolatableRobotImageBgremoveInstructionsWithHiddenFields, + InterpolatableRobotImageBgremoveInstructionsWithHiddenFieldsInput, +} from './image-bgremove.ts' +export type { + InterpolatableRobotImageDescribeInstructions, + InterpolatableRobotImageDescribeInstructionsWithHiddenFields, + InterpolatableRobotImageDescribeInstructionsWithHiddenFieldsInput, +} from './image-describe.ts' +export type { + InterpolatableRobotImageFacedetectInstructions, + InterpolatableRobotImageFacedetectInstructionsWithHiddenFields, + InterpolatableRobotImageFacedetectInstructionsWithHiddenFieldsInput, +} from './image-facedetect.ts' +export type { + InterpolatableRobotImageGenerateInstructions, + InterpolatableRobotImageGenerateInstructionsWithHiddenFields, + InterpolatableRobotImageGenerateInstructionsWithHiddenFieldsInput, +} from './image-generate.ts' +export type { + InterpolatableRobotImageMergeInstructions, + InterpolatableRobotImageMergeInstructionsWithHiddenFields, + InterpolatableRobotImageMergeInstructionsWithHiddenFieldsInput, +} from './image-merge.ts' +export type { + InterpolatableRobotImageOcrInstructions, + InterpolatableRobotImageOcrInstructionsWithHiddenFields, + InterpolatableRobotImageOcrInstructionsWithHiddenFieldsInput, +} from './image-ocr.ts' +export type { + InterpolatableRobotImageOptimizeInstructions, + InterpolatableRobotImageOptimizeInstructionsWithHiddenFields, + InterpolatableRobotImageOptimizeInstructionsWithHiddenFieldsInput, +} from './image-optimize.ts' +export type { + InterpolatableRobotImageResizeInstructions, + InterpolatableRobotImageResizeInstructionsWithHiddenFields, + InterpolatableRobotImageResizeInstructionsWithHiddenFieldsInput, +} from './image-resize.ts' +export type { + InterpolatableRobotMetaReadInstructions, + InterpolatableRobotMetaReadInstructionsWithHiddenFields, +} from './meta-read.ts' +export type { + InterpolatableRobotMetaWriteInstructions, + InterpolatableRobotMetaWriteInstructionsWithHiddenFields, + InterpolatableRobotMetaWriteInstructionsWithHiddenFieldsInput, +} from './meta-write.ts' +export type { + InterpolatableRobotMinioImportInstructions, + InterpolatableRobotMinioImportInstructionsWithHiddenFields, + InterpolatableRobotMinioImportInstructionsWithHiddenFieldsInput, +} from './minio-import.ts' +export type { + InterpolatableRobotMinioStoreInstructions, + InterpolatableRobotMinioStoreInstructionsWithHiddenFields, + InterpolatableRobotMinioStoreInstructionsWithHiddenFieldsInput, +} from './minio-store.ts' +export type { InterpolatableRobotProgressSimulateInstructions } from './progress-simulate.ts' +export type { + InterpolatableRobotS3ImportInstructions, + InterpolatableRobotS3ImportInstructionsWithHiddenFields, + InterpolatableRobotS3ImportInstructionsWithHiddenFieldsInput, +} from './s3-import.ts' +export type { + InterpolatableRobotS3StoreInstructions, + InterpolatableRobotS3StoreInstructionsWithHiddenFields, + InterpolatableRobotS3StoreInstructionsWithHiddenFieldsInput, +} from './s3-store.ts' +export type { + InterpolatableRobotScriptRunInstructions, + InterpolatableRobotScriptRunInstructionsWithHiddenFields, + InterpolatableRobotScriptRunInstructionsWithHiddenFieldsInput, +} from './script-run.ts' +export type { + InterpolatableRobotSftpImportInstructions, + InterpolatableRobotSftpImportInstructionsWithHiddenFields, + InterpolatableRobotSftpImportInstructionsWithHiddenFieldsInput, +} from './sftp-import.ts' +export type { + InterpolatableRobotSftpStoreInstructions, + InterpolatableRobotSftpStoreInstructionsWithHiddenFields, + InterpolatableRobotSftpStoreInstructionsWithHiddenFieldsInput, +} from './sftp-store.ts' +export type { + InterpolatableRobotSpeechTranscribeInstructions, + InterpolatableRobotSpeechTranscribeInstructionsWithHiddenFields, + InterpolatableRobotSpeechTranscribeInstructionsWithHiddenFieldsInput, +} from './speech-transcribe.ts' +export type { + InterpolatableRobotSupabaseImportInstructions, + InterpolatableRobotSupabaseImportInstructionsWithHiddenFields, + InterpolatableRobotSupabaseImportInstructionsWithHiddenFieldsInput, +} from './supabase-import.ts' +export type { + InterpolatableRobotSupabaseStoreInstructions, + InterpolatableRobotSupabaseStoreInstructionsWithHiddenFields, + InterpolatableRobotSupabaseStoreInstructionsWithHiddenFieldsInput, +} from './supabase-store.ts' +export type { + InterpolatableRobotSwiftImportInstructions, + InterpolatableRobotSwiftImportInstructionsWithHiddenFields, + InterpolatableRobotSwiftImportInstructionsWithHiddenFieldsInput, +} from './swift-import.ts' +export type { + InterpolatableRobotSwiftStoreInstructions, + InterpolatableRobotSwiftStoreInstructionsWithHiddenFields, + InterpolatableRobotSwiftStoreInstructionsWithHiddenFieldsInput, +} from './swift-store.ts' +export type { + InterpolatableRobotTextSpeakInstructions, + InterpolatableRobotTextSpeakInstructionsWithHiddenFields, + InterpolatableRobotTextSpeakInstructionsWithHiddenFieldsInput, +} from './text-speak.ts' +export type { + InterpolatableRobotTextTranslateInstructions, + InterpolatableRobotTextTranslateInstructionsWithHiddenFields, + InterpolatableRobotTextTranslateInstructionsWithHiddenFieldsInput, +} from './text-translate.ts' +export type { + InterpolatableRobotTigrisImportInstructions, + InterpolatableRobotTigrisImportInstructionsWithHiddenFields, + InterpolatableRobotTigrisImportInstructionsWithHiddenFieldsInput, +} from './tigris-import.ts' +export type { + InterpolatableRobotTigrisStoreInstructions, + InterpolatableRobotTigrisStoreInstructionsWithHiddenFields, + InterpolatableRobotTigrisStoreInstructionsWithHiddenFieldsInput, +} from './tigris-store.ts' +export type { + InterpolatableRobotTlcdnDeliverInstructions, + InterpolatableRobotTlcdnDeliverInstructionsWithHiddenFields, + InterpolatableRobotTlcdnDeliverInstructionsWithHiddenFieldsInput, +} from './tlcdn-deliver.ts' +export type { + InterpolatableRobotTusStoreInstructions, + InterpolatableRobotTusStoreInstructionsWithHiddenFields, + InterpolatableRobotTusStoreInstructionsWithHiddenFieldsInput, +} from './tus-store.ts' +export type { + InterpolatableRobotUploadHandleInstructions, + InterpolatableRobotUploadHandleInstructionsWithHiddenFields, + InterpolatableRobotUploadHandleInstructionsWithHiddenFieldsInput, +} from './upload-handle.ts' +export type { + InterpolatableRobotVideoAdaptiveInstructions, + InterpolatableRobotVideoAdaptiveInstructionsWithHiddenFields, + InterpolatableRobotVideoAdaptiveInstructionsWithHiddenFieldsInput, +} from './video-adaptive.ts' +export type { + InterpolatableRobotVideoConcatInstructions, + InterpolatableRobotVideoConcatInstructionsWithHiddenFields, + InterpolatableRobotVideoConcatInstructionsWithHiddenFieldsInput, +} from './video-concat.ts' +export type { + InterpolatableRobotVideoEncodeInstructions, + InterpolatableRobotVideoEncodeInstructionsWithHiddenFields, + InterpolatableRobotVideoEncodeInstructionsWithHiddenFieldsInput, +} from './video-encode.ts' +export type { + InterpolatableRobotVideoMergeInstructions, + InterpolatableRobotVideoMergeInstructionsWithHiddenFields, + InterpolatableRobotVideoMergeInstructionsWithHiddenFieldsInput, +} from './video-merge.ts' +export type { + InterpolatableRobotVideoOndemandInstructions, + InterpolatableRobotVideoOndemandInstructionsWithHiddenFields, + InterpolatableRobotVideoOndemandInstructionsWithHiddenFieldsInput, +} from './video-ondemand.ts' +export type { + InterpolatableRobotVideoSubtitleInstructions, + InterpolatableRobotVideoSubtitleInstructionsWithHiddenFields, + InterpolatableRobotVideoSubtitleInstructionsWithHiddenFieldsInput, +} from './video-subtitle.ts' +export type { + InterpolatableRobotVideoThumbsInstructions, + InterpolatableRobotVideoThumbsInstructionsWithHiddenFields, + InterpolatableRobotVideoThumbsInstructionsWithHiddenFieldsInput, +} from './video-thumbs.ts' +export type { + InterpolatableRobotVimeoImportInstructions, + InterpolatableRobotVimeoImportInstructionsWithHiddenFields, + InterpolatableRobotVimeoImportInstructionsWithHiddenFieldsInput, +} from './vimeo-import.ts' +export type { + InterpolatableRobotVimeoStoreInstructions, + InterpolatableRobotVimeoStoreInstructionsWithHiddenFields, + InterpolatableRobotVimeoStoreInstructionsWithHiddenFieldsInput, +} from './vimeo-store.ts' +export type { + InterpolatableRobotWasabiImportInstructions, + InterpolatableRobotWasabiImportInstructionsWithHiddenFields, + InterpolatableRobotWasabiImportInstructionsWithHiddenFieldsInput, +} from './wasabi-import.ts' +export type { + InterpolatableRobotWasabiStoreInstructions, + InterpolatableRobotWasabiStoreInstructionsWithHiddenFields, + InterpolatableRobotWasabiStoreInstructionsWithHiddenFieldsInput, +} from './wasabi-store.ts' +export type { + InterpolatableRobotYoutubeStoreInstructions, + InterpolatableRobotYoutubeStoreInstructionsWithHiddenFields, + InterpolatableRobotYoutubeStoreInstructionsWithHiddenFieldsInput, +} from './youtube-store.ts' diff --git a/src/alphalib/types/template.ts b/src/alphalib/types/template.ts index cfa3b43c..0c339b0b 100644 --- a/src/alphalib/types/template.ts +++ b/src/alphalib/types/template.ts @@ -6,7 +6,9 @@ import type { RobotUse } from './robots/_instructions-primitives.ts' export const stepSchema = z .object({ // This is a hack to get nicer robot hover messages in editors. - robot: z.string().describe('The [robot](https://transloadit.com/docs/robots/) to use'), + robot: z + .string() + .describe('Identifier of the [robot](https://transloadit.com/docs/robots/) to execute'), }) .and(robotsSchema) export const stepsSchema = z.record(stepSchema).describe('Contains Assembly Instructions.') @@ -15,12 +17,14 @@ export type StepInput = z.input export type StepInputWithUse = StepInput & RobotUse export type Steps = z.infer export type StepsInput = z.input -const optionalStepsSchema = stepsSchema.optional() +export const optionalStepsSchema = stepsSchema.optional() export const stepSchemaWithHiddenFields = z .object({ // This is a hack to get nicer robot hover messages in editors. - robot: z.string().describe('The [robot](https://transloadit.com/docs/robots/) to use'), + robot: z + .string() + .describe('Identifier of the [robot](https://transloadit.com/docs/robots/) to execute'), }) .and(robotsWithHiddenBotsAndFieldsSchema) export const stepsSchemaWithHiddenFields = z @@ -32,34 +36,85 @@ export type StepsWithHiddenFields = z.infer export type StepsWithHiddenFieldsInput = z.input const optionalStepsWithHiddenFieldsSchema = stepsSchemaWithHiddenFields.optional() -export const assemblyAuthInstructionsSchema = z.object({ - key: z.string().describe('The Transloadit API key to use'), - secret: z.string().optional().describe('The Transloadit API secret to use'), - expires: z.string().optional().describe('The Transloadit API expires to use'), - max_size: z.number().optional().describe('The Transloadit API max_size to use'), -}) +export const fieldsSchema = z + .record(z.any()) + .optional() + .describe( + 'An object of string keyed values (name -> value) that can be used as Assembly Variables, just like additional form fields can. You can use anything that is JSON stringifyable as a value', + ) -export const assemblyInstructionsSchema = z.object({ - auth: assemblyAuthInstructionsSchema.optional(), +export const notifyUrlSchema = z + .string() + .optional() + .nullable() + .describe( + 'Transloadit can send a Pingback to your server when the Assembly is completed. We’ll send the Assembly status in a form url-encoded JSON string inside of a transloadit field in a multipart POST request to the URL supplied here.', + ) + +export const templateIdSchema = z + .string() + .optional() + .describe( + 'The ID of the Template that contains your Assembly Instructions. If you set `allow_steps_override` to `false` in your Template, then `steps` and `template_id` will be mutually exclusive — you may supply only one of these parameters.', + ) + +export const assemblyAuthInstructionsSchema = z + .object({ + key: z.string().describe('Transloadit API key used to authenticate requests'), + secret: z.string().optional().describe('Transloadit API secret used to sign requests'), + expires: z + .string() + .optional() + .describe('ISO 8601 expiration timestamp for signature authentication'), + max_size: z.number().optional().describe('Maximum allowed upload size in bytes'), + nonce: z.string().optional().describe('Unique, random nonce for this request'), + referer: z + .string() + .optional() + .describe('Regular expression matched against the HTTP Referer to restrict upload origin'), + }) + .describe(`Contains at least your Transloadit Auth Key in the \`key\` property. + +If you enable Signature Authentication, you must also set an expiry date for the request in the expires property: + +\`\`\`jsonc +{ + "key": "23c96d084c744219a2ce156772ec3211", + "expires": "2009-08-28T01:02:03.000Z" +} +\`\`\` + +We strongly recommend including the \`nonce\` property — a randomly generated, unique value per request that prevents duplicate processing upon retries, can aid in debugging, and avoids attack vectors such as signature key reuse: + +\`\`\`jsonc +{ + // … + "nonce": "04ac6cb6-df43-41fb-a7fd-e5dd711a64e1" +} +\`\`\` + +The \`referer\` property is a regular expression to match against the HTTP referer of this upload, such as \`"example\\.org"\`. Specify this key to make sure that uploads only come from your domain. + +Uploads without a referer will always pass (as they are turned off for some browsers) making this useful in just a handful of use cases. For details about regular expressions, see [Mozilla's RegExp documentation](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp). + +The \`max_size\` property can be used to set a maximum size that an upload can have in bytes, such as \`1048576\` (1 MB). Specify this to prevent users from uploading excessively large files. + +This can be set as part of the Assembly request or as part of the Template. + +The file size is checked as soon as the upload is started and if it exceeds the maximum size, the entire upload process is canceled and the Assembly will error out, even if it contains files that do not exceed the \`max_size\` limitation. + +If you want to just ignore the files that exceed a certain size, but process all others, then please use [🤖/file/filter](https://transloadit.com/docs/robots/file-filter/). +`) + +const assemblyInstructionsSharedShape = { allow_steps_override: z .boolean() .optional() .describe( 'Set this to false to disallow Overruling Templates at Runtime. If you set this to false then template_id and steps will be mutually exclusive and you may only supply one of those parameters. Recommended when deploying Transloadit in untrusted environments. This makes sense to set as part of a Template, rather than on the Assembly itself when creating it.', ), - notify_url: z - .string() - .nullable() - .optional() - .describe( - 'Transloadit can send a Pingback to your server when the Assembly is completed. We’ll send the Assembly status in a form url-encoded JSON string inside of a transloadit field in a multipart POST request to the URL supplied here.', - ), - fields: z - .record(z.any()) - .optional() - .describe( - 'An object of string keyed values (name -> value) that can be used as Assembly Variables, just like additional form fields can. You can use anything that is JSON stringifyable as a value', - ), + notify_url: notifyUrlSchema, + fields: fieldsSchema, quiet: z .boolean() .optional() @@ -68,11 +123,108 @@ export const assemblyInstructionsSchema = z.object({ ), // This is done to avoid heavy inference cost steps: optionalStepsSchema as typeof optionalStepsSchema, - template_id: z.string().optional().describe('The Template ID to use'), + template_id: templateIdSchema, +} as const + +export const assemblyInstructionsSchema = z.object({ + auth: assemblyAuthInstructionsSchema.optional(), + ...assemblyInstructionsSharedShape, +}) + +export const assemblyInstructionsSchemaWithRequiredAuth = z.object({ + auth: assemblyAuthInstructionsSchema, + ...assemblyInstructionsSharedShape, }) export type AssemblyInstructions = z.infer export type AssemblyInstructionsInput = z.input +export type AssemblyAuthInstructionsInput = z.input +export type AssemblyAuthInstructionsPartialInput = Partial< + z.input +> + +export const templateParamsSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + name: z + .string() + .min(5) + .max(40) + .regex(/^[a-z-]+$/) + .describe( + 'Name of this Template. Must be between 5-40 symbols (inclusive), lowercase, can only contain dashes and latin letters.', + ), + template: z + .string() + .describe(`All the [Assembly Instructions](/docs/topics/assembly-instructions/) and [Template options](/docs/topics/templates/#template-options) as a JSON encoded string. + +Example value: + +\`\`\`json +"{\\"allow_steps_override\\": false, \\"steps\\": { ... }}" +\`\`\` +`), + require_signature_auth: z + .union([z.literal(0), z.literal(1)]) + .default(0) + .describe( + 'Use `1` to deny requests that do not include a signature. With [Signature Authentication](/docs/api/authentication/) you can ensure no one else is sending requests on your behalf.', + ), + }) + .strict() + +export const templateGetParamsSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + }) + .strict() + +export const templateListParamsSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + page: z + .number() + .int() + .default(1) + .describe('Specifies the current page, within the current pagination'), + pagesize: z + .number() + .int() + .min(1) + .max(5000) + .default(50) + .describe( + 'Specifies how many Templates to be received per API request, which is useful for pagination.', + ), + sort: z + .enum(['id', 'name', 'created', 'modified']) + .default('created') + .describe('The field to sort by.'), + order: z + .enum(['asc', 'desc']) + .default('desc') + .describe( + 'The sort direction. Can be `"desc"` for descending (default) or `"asc"` for ascending.', + ), + fromdate: z + .string() + .describe( + 'Specifies the minimum Assembly UTC creation date/time. Only Templates after this time will be retrieved. Use the format `Y-m-d H:i:s`.', + ), + todate: z + .string() + .default('NOW()') + .describe( + 'Specifies the maximum Assembly UTC creation date/time. Only Templates before this time will be retrieved. Use the format `Y-m-d H:i:s`.', + ), + keywords: z + .array(z.string()) + .default([]) + .describe( + 'Specifies keywords to be matched in the Assembly Status. The Assembly fields checked include the `id`, `redirect_url`, `fields`, and `notify_url`, as well as error messages and files used.', + ), + }) + .strict() // These are used in system tests, but not exposed to the public right now // Meaning we do not want to document them, do not want to offer auto complete on them diff --git a/src/alphalib/types/templateCredential.ts b/src/alphalib/types/templateCredential.ts new file mode 100644 index 00000000..12947434 --- /dev/null +++ b/src/alphalib/types/templateCredential.ts @@ -0,0 +1,60 @@ +import { z } from 'zod' + +import { assemblyAuthInstructionsSchema } from './template.ts' + +export const retrieveTemplateCredentialsParamsSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + }) + .strict() + +export const templateCredentialsSchema = z + .object({ + auth: assemblyAuthInstructionsSchema, + name: z + .string() + .min(4) + .regex(/^[a-zA-Z-]+$/) + .describe( + 'Name of the Template Credentials. Must be longer than 3 characters, can only contain dashes and latin letters.', + ), + type: z + .enum([ + 'azure', + 'backblaze', + 'cloudflare', + 'companion', + 'digitalocean', + 'dropbox', + 'ftp', + 'google', + 'http', + 'minio', + 'rackspace', + 's3', + 'sftp', + 'supabase', + 'swift', + 'tigris', + 'vimeo', + 'wasabi', + 'youtube', + ]) + .describe('The service to create credentials for.'), + content: z + .object({}) + .describe(`Key and value pairs which fill in the details of the Template Credentials. For example, for an S3 bucket, this would be a valid content object to send: + +\`\`\`jsonc +{ + "content": { + "key": "xyxy", + "secret": "xyxyxyxy", + "bucket" : "mybucket.example.com", + "bucket_region": "us-east-1" + } +} +\`\`\` +`), + }) + .strict()