diff --git a/.cursor/rules/general.mdc b/.cursor/rules/general.mdc index af795b3c..72d7c086 100644 --- a/.cursor/rules/general.mdc +++ b/.cursor/rules/general.mdc @@ -11,3 +11,4 @@ General: - Avoid blocking the conversation with terminal commands. For example: A) most of my git commands run through pagers, so pipe their output to `cat` to avoid blocking the terminal. B) You can use `tail` for logs, but be smart and use `-n` instead of `-f`, or the conversation will block - Use the `gh` tool to interact with GitHub (search/view an Issue, create a PR). +- All new files are to be in TypeScript. Even if someone suggests: make this new foo3 feature, model it after `foo1.js`, create: `foo3.ts`. Chances are, a `foo2.ts` already exist that you can take a look at also for inspiration. diff --git a/TS7056.md b/TS7056.md new file mode 100644 index 00000000..8b38c934 --- /dev/null +++ b/TS7056.md @@ -0,0 +1,44 @@ +### TS7056 ("type exceeds maximum length") + +The TS7056 error occurs when TypeScript's type inference system encounters types that are too complex to serialize during declaration file generation. This happens with our large discriminated unions in the robot schemas. + +#### Current Solution: Patch-based declaration generation + +We use a custom build process that temporarily patches the source files with type annotations during declaration generation, then restores the original files. This approach: + +1. Keeps the source code clean and compatible with both repos +2. Applies minimal type annotations only during the build process +3. Generates proper declaration files without TS7056 errors +4. Maintains full type safety and discriminated union functionality + +#### Implementation Details + +The solution consists of two scripts: + +1. `scripts/build.ts` - Main build script that: + + - Compiles TypeScript to JavaScript + - Calls the type generation script + +2. `scripts/generate-types.ts` - Type generation script that: + - Creates backups of problematic files + - Applies temporary type annotations to avoid TS7056 + - Generates declaration files using TypeScript compiler + - Restores original files + +The patches add generic type annotations like `z.ZodType` or `z.ZodDiscriminatedUnion<"robot", z.ZodDiscriminatedUnionOption<"robot">[]>` to the problematic schemas, which prevents TypeScript from trying to serialize the entire union structure. + +#### Why this approach works + +- The source files remain unchanged, so the code works identically in both `node-sdk` and `content` repos +- The type annotations are only applied temporarily during build, avoiding any runtime impact +- The generated declaration files are properly typed without hitting serialization limits +- The discriminated union structure is preserved, maintaining compatibility with code that accesses internal properties + +#### Alternative approaches considered + +1. **Facade types** - Would have solved TS7056 but broke compatibility with code accessing internal union properties +2. **d.ts bundlers** (rollup-dts, dts-bundle-generator, API Extractor) - These tools also hit the same TS7056 errors when processing the complex types +3. **Permanent type annotations** - Would require `any` types and eslint-disable comments, making the code less clean + +The patch-based approach provides the best balance of maintainability, compatibility, and type safety. diff --git a/package.json b/package.json index 035ccf02..b1bf6ab8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "mp3" ], "author": "Tim Koschuetzki ", - "packageManager": "yarn@4.9.1", + "packageManager": "yarn@4.9.2", "engines": { "node": ">= 20" }, @@ -25,10 +25,10 @@ "into-stream": "^8.0.1", "is-stream": "^4.0.1", "p-map": "^7.0.3", - "tsx": "^4.20.1", + "tsx": "^4.20.3", "tus-js-client": "^4.3.1", "type-fest": "^4.41.0", - "zod": "^3.25.61" + "zod": "^3.25.76" }, "devDependencies": { "@babel/core": "^7.26.10", @@ -75,7 +75,7 @@ "lint": "npm-run-all --parallel 'lint:*'", "fix": "npm-run-all --serial 'fix:*'", "next:update": "next-update --keep true --tldr", - "prepack": "tsc --build tsconfig.build.json", + "prepack": "tsx scripts/build.ts", "test:unit": "vitest run --coverage ./test/unit", "test:integration": "vitest run ./test/integration", "test:all": "vitest run --coverage", diff --git a/scripts/build.ts b/scripts/build.ts new file mode 100755 index 00000000..e57bb9cf --- /dev/null +++ b/scripts/build.ts @@ -0,0 +1,32 @@ +#!/usr/bin/env tsx +/* eslint-disable no-console */ + +import { execSync } from 'node:child_process' +import { existsSync, mkdirSync } from 'node:fs' + +console.log('Building Transloadit SDK...') + +// Ensure dist directory exists +if (!existsSync('dist')) { + mkdirSync('dist') +} + +// Step 1: Compile TypeScript files without declarations +console.log('Compiling TypeScript...') +try { + execSync('tsc --project tsconfig.json', { stdio: 'inherit' }) +} catch { + console.error('TypeScript compilation failed') + process.exit(1) +} + +// Step 2: Generate declaration files using our custom script +console.log('Generating declaration files...') +try { + execSync('tsx scripts/generate-types.ts', { stdio: 'inherit' }) +} catch { + console.error('Declaration file generation failed') + process.exit(1) +} + +console.log('Build completed successfully!') diff --git a/scripts/generate-types.ts b/scripts/generate-types.ts new file mode 100755 index 00000000..7b3afe4d --- /dev/null +++ b/scripts/generate-types.ts @@ -0,0 +1,63 @@ +#!/usr/bin/env tsx +/* eslint-disable no-console */ + +import { execSync } from 'node:child_process' +import { readFileSync, writeFileSync } from 'node:fs' +import { join } from 'node:path' + +// This script generates TypeScript declaration files while working around TS7056 errors + +const ROBOT_INDEX_PATH = join('src', 'alphalib', 'types', 'robots', '_index.ts') +const TEMPLATE_PATH = join('src', 'alphalib', 'types', 'template.ts') + +// Step 1: Create backup of original files +const robotIndexOriginal = readFileSync(ROBOT_INDEX_PATH, 'utf-8') +const templateOriginal = readFileSync(TEMPLATE_PATH, 'utf-8') + +// Step 2: Apply temporary patches to avoid TS7056 +const robotIndexPatched = robotIndexOriginal + .replace( + 'export const robotsSchema = z.discriminatedUnion', + 'export const robotsSchema: z.ZodDiscriminatedUnion<"robot", z.ZodDiscriminatedUnionOption<"robot">[]> = z.discriminatedUnion' + ) + .replace( + 'export const robotsWithHiddenFieldsSchema = z.discriminatedUnion', + 'export const robotsWithHiddenFieldsSchema: z.ZodDiscriminatedUnion<"robot", z.ZodDiscriminatedUnionOption<"robot">[]> = z.discriminatedUnion' + ) + .replace( + 'export const robotsWithHiddenBotsSchema = z.discriminatedUnion', + 'export const robotsWithHiddenBotsSchema: z.ZodDiscriminatedUnion<"robot", z.ZodDiscriminatedUnionOption<"robot">[]> = z.discriminatedUnion' + ) + .replace( + 'export const robotsWithHiddenBotsAndFieldsSchema = z.discriminatedUnion', + 'export const robotsWithHiddenBotsAndFieldsSchema: z.ZodDiscriminatedUnion<"robot", z.ZodDiscriminatedUnionOption<"robot">[]> = z.discriminatedUnion' + ) + +const templatePatched = templateOriginal + .replace('export const stepSchema = z', 'export const stepSchema: z.ZodType = z') + .replace('export const stepsSchema = z.record', 'export const stepsSchema: z.ZodType = z.record') + .replace( + 'const optionalStepsSchema = stepsSchema.optional()', + 'const optionalStepsSchema: z.ZodType = stepsSchema.optional()' + ) + +// Step 3: Write patched files +writeFileSync(ROBOT_INDEX_PATH, robotIndexPatched) +writeFileSync(TEMPLATE_PATH, templatePatched) + +try { + // Step 4: Generate declarations + console.log('Generating TypeScript declarations...') + execSync('tsc --project tsconfig.json --declaration --emitDeclarationOnly', { + stdio: 'inherit', + }) + console.log('Declaration generation successful!') +} catch (error) { + console.error('Declaration generation failed') + throw error +} finally { + // Step 5: Restore original files + writeFileSync(ROBOT_INDEX_PATH, robotIndexOriginal) + writeFileSync(TEMPLATE_PATH, templateOriginal) + console.log('Original files restored') +} diff --git a/src/alphalib/types/robots/_instructions-primitives.ts b/src/alphalib/types/robots/_instructions-primitives.ts index a714785f..76e3fd7c 100644 --- a/src/alphalib/types/robots/_instructions-primitives.ts +++ b/src/alphalib/types/robots/_instructions-primitives.ts @@ -2,94 +2,213 @@ import type { Replace } from 'type-fest' import { z } from 'zod' import { stackVersions } from '../stackVersions.ts' -import type { assemblyInstructionsSchema } from '../template.ts' - -export interface RobotMeta { - allowed_for_url_transform: boolean - bytescount: number - description?: string - discount_factor: number - discount_pct: number - example_code?: z.input - example_code_description?: string - extended_description?: string - has_small_icon?: true - minimum_charge: number - minimum_charge_usd?: number | Record - minimum_charge_usd_note?: string - ogimage?: string - marketing_intro?: string - output_factor: number - override_lvl1?: string - purpose_sentence: string - purpose_verb: - | 'auto-rotate' - | 'cache & deliver' - | 'compress' - | 'concatenate' - | 'concatenate' - | 'convert' - | 'decompress' - | 'detect' - | 'encode' - | 'export' - | 'extract' - | 'filter' - | 'generate' - | 'handle' - | 'hash' - | 'import' - | 'loop' - | 'merge' - | 'optimize' - | 'read' - | 'recognize' - | 'run' - | 'scan' - | 'serve' - | 'speak' - | 'subtitle' - | 'take' - | 'transcode' - | 'transcribe' - | 'translate' - | 'verify' - | 'remove' - | 'write' - | 'stream' - - purpose_word: string - purpose_words: string - requires_credentials?: true - service_slug: - | 'artificial-intelligence' - | 'audio-encoding' - | 'code-evaluation' - | 'content-delivery' - | 'document-processing' - | 'file-compressing' - | 'file-exporting' - | 'file-filtering' - | 'file-importing' - | 'handling-uploads' - | 'image-manipulation' - | 'media-cataloging' - | 'video-encoding' - - slot_count: number - title: string - typical_file_size_mb: number - typical_file_type: - | 'audio file' - | 'audio or video file' - | 'document' - | 'file' - | 'image' - | 'video' - | 'webpage' - - uses_tools?: ('ffmpeg' | 'imagemagick')[] -} + +export const robotNames = z.enum([ + 'UploadHandleRobot', + 'FileServeRobot', + 'FileWatermarkRobot', + 'FileVerifyRobot', + 'EdglyDeliverRobot', + 'TlcdnDeliverRobot', + 'VideoSubtitleRobot', + 'VideoEncodeRobot', + 'VideoAdaptiveRobot', + 'VideoMergeRobot', + 'VideoConcatRobot', + 'AudioWaveformRobot', + 'AudioEncodeRobot', + 'AudioLoopRobot', + 'AudioConcatRobot', + 'AudioMergeRobot', + 'AudioArtworkRobot', + 'ImageFacedetectRobot', + 'ImageDescribeRobot', + 'ImageOcrRobot', + 'ImageBgremoveRobot', + 'ImageGenerateRobot', + 'DocumentOcrRobot', + 'SpeechTranscribeRobot', + 'VideoThumbsRobot', + 'FileVirusscanRobot', + 'ImageOptimizeRobot', + 'FileCompressRobot', + 'MetaReadRobot', + 'FileDecompressRobot', + 'MetaWriteRobot', + 'DocumentThumbsRobot', + 'DocumentConvertRobot', + 'DocumentMergeRobot', + 'DocumentSplitRobot', + 'DocumentAutorotateRobot', + 'HtmlConvertRobot', + 'ImageResizeRobot', + 'ImageMergeRobot', + 'S3ImportRobot', + 'S3StoreRobot', + 'DigitalOceanImportRobot', + 'DigitalOceanStoreRobot', + 'BackblazeImportRobot', + 'BackblazeStoreRobot', + 'MinioImportRobot', + 'TigrisImportRobot', + 'CloudflareImportRobot', + 'SupabaseImportRobot', + 'MinioStoreRobot', + 'TigrisStoreRobot', + 'CloudflareStoreRobot', + 'SupabaseStoreRobot', + 'WasabiImportRobot', + 'WasabiStoreRobot', + 'SwiftImportRobot', + 'SwiftStoreRobot', + 'GoogleImportRobot', + 'GoogleStoreRobot', + 'DropboxImportRobot', + 'DropboxStoreRobot', + 'HttpImportRobot', + 'SftpImportRobot', + 'SftpStoreRobot', + 'FtpImportRobot', + 'FtpStoreRobot', + 'CloudfilesImportRobot', + 'CloudfilesStoreRobot', + 'AzureImportRobot', + 'AzureStoreRobot', + 'YoutubeStoreRobot', + 'VimeoStoreRobot', + 'AssemblySavejsonRobot', + 'ScriptRunRobot', + 'FileHashRobot', + 'FileReadRobot', + 'VideoOndemandRobot', + 'FileFilterRobot', + 'TextSpeakRobot', + 'TextTranslateRobot', + 'FilePreviewRobot', + 'TusStoreRobot', + 'ProgressSimulateRobot', +]) + +export const robotMetaSchema = z.object({ + // Added keys from api2/lib/config.ts: + name: robotNames, + priceFactor: z.number(), + queueSlotCount: z.number(), + downloadInputFiles: z.boolean().optional(), + preserveInputFileUrls: z.boolean().optional(), + minimumCharge: z.number().optional(), + minimumChargeUsd: z.number().optional(), + minimumChargeUsdPerSpeechTranscribeMinute: z + .object({ + aws: z.number(), + gcp: z.number(), + }) + .optional(), + minimumChargeUsdPerDocumentOcrPage: z + .object({ + aws: z.number(), + gcp: z.number(), + }) + .optional(), + isAllowedForUrlTransform: z.boolean(), + removeJobResultFilesFromDiskRightAfterStoringOnS3: z.boolean(), + lazyLoad: z.boolean().optional(), + installVersionFile: z.string().optional(), + trackOutputFileSize: z.boolean().optional(), + isInternal: z.boolean(), + numDaemons: z.number().optional(), + importRanges: z.array(z.string()).optional(), + extraChargeForImageResize: z.number().optional(), + + // Original keys from content repo: + allowed_for_url_transform: z.boolean(), + bytescount: z.number(), + description: z.string().optional(), + discount_factor: z.number(), + discount_pct: z.number(), + // To avoid a cycling dependency back to template.ts, we'll use any for now: + // example_code: assemblyInstructionsSchema.optional(), + example_code: z.any().optional(), + example_code_description: z.string().optional(), + extended_description: z.string().optional(), + has_small_icon: z.literal(true).optional(), + minimum_charge: z.number(), + minimum_charge_usd: z.union([z.number(), z.record(z.string(), z.number())]).optional(), + minimum_charge_usd_note: z.string().optional(), + ogimage: z.string().optional(), + marketing_intro: z.string().optional(), + output_factor: z.number(), + override_lvl1: z.string().optional(), + purpose_sentence: z.string(), + purpose_verb: z.enum([ + 'auto-rotate', + 'cache & deliver', + 'compress', + 'concatenate', + 'convert', + 'decompress', + 'detect', + 'encode', + 'export', + 'extract', + 'filter', + 'generate', + 'handle', + 'hash', + 'import', + 'loop', + 'merge', + 'optimize', + 'read', + 'recognize', + 'run', + 'scan', + 'serve', + 'speak', + 'subtitle', + 'take', + 'transcode', + 'transcribe', + 'translate', + 'verify', + 'remove', + 'write', + 'stream', + ]), + purpose_word: z.string(), + purpose_words: z.string(), + requires_credentials: z.literal(true).optional(), + service_slug: z.enum([ + 'artificial-intelligence', + 'audio-encoding', + 'code-evaluation', + 'content-delivery', + 'document-processing', + 'file-compressing', + 'file-exporting', + 'file-filtering', + 'file-importing', + 'handling-uploads', + 'image-manipulation', + 'media-cataloging', + 'video-encoding', + ]), + slot_count: z.number(), + title: z.string(), + typical_file_size_mb: z.number(), + typical_file_type: z.enum([ + 'audio file', + 'audio or video file', + 'document', + 'file', + 'image', + 'video', + 'webpage', + ]), + uses_tools: z.array(z.enum(['ffmpeg', 'imagemagick'])).optional(), +}) + +export type RobotMetaInput = z.input export const interpolationSchemaFull = z .string() @@ -176,23 +295,31 @@ export function interpolateRecursive( return z.union([interpolationSchemaFull, replacement]) as InterpolatableSchema } - case z.ZodFirstPartyTypeKind.ZodDefault: - return (interpolateRecursive(def.innerType) as InterpolatableSchema).default( - def.defaultValue(), + case z.ZodFirstPartyTypeKind.ZodDefault: { + const replacement = ( + interpolateRecursive(def.innerType) as InterpolatableSchema + ).default(def.defaultValue()) + + return ( + def.description ? replacement.describe(def.description) : replacement ) as InterpolatableSchema + } case z.ZodFirstPartyTypeKind.ZodEffects: case z.ZodFirstPartyTypeKind.ZodEnum: case z.ZodFirstPartyTypeKind.ZodLiteral: - return z.union([interpolationSchemaFull, schema]) as InterpolatableSchema + return z.union([interpolationSchemaFull, schema], def) as InterpolatableSchema case z.ZodFirstPartyTypeKind.ZodNumber: - return z.union([ - z - .string() - .regex(/^\d+(\.\d+)?$/) - .transform((value) => Number(value)), - interpolationSchemaFull, - schema, - ]) as InterpolatableSchema + return z.union( + [ + z + .string() + .regex(/^\d+(\.\d+)?$/) + .transform((value) => Number(value)), + interpolationSchemaFull, + schema, + ], + def, + ) as InterpolatableSchema case z.ZodFirstPartyTypeKind.ZodNullable: return interpolateRecursive(def.innerType).nullable() as InterpolatableSchema case z.ZodFirstPartyTypeKind.ZodObject: { @@ -223,7 +350,7 @@ export function interpolateRecursive( def, ) as InterpolatableSchema case z.ZodFirstPartyTypeKind.ZodString: - return z.union([interpolationSchemaPartial, schema]) as InterpolatableSchema + return z.union([interpolationSchemaPartial, schema], def) as InterpolatableSchema case z.ZodFirstPartyTypeKind.ZodTuple: { const tuple = z.tuple(def.items.map(interpolateRecursive)) @@ -308,6 +435,17 @@ You can also set this to \`false\` to skip metadata extraction and speed up tran .describe( `Setting the queue to 'batch', manually downgrades the priority of jobs for this step to avoid consuming Priority job slots for jobs that don't need zero queue waiting times`, ), + + force_accept: z.boolean().default(false).describe(` + Force a Robot to accept a file type it would have ignored. + +By default Robots ignore files they are not familiar with. +[🤖/video/encode](https://transloadit.com/docs/robots/video-encode/), for +example, will happily ignore input images. + +With the force_accept parameter set to true you can force Robots to accept all files thrown at them. +This will typically lead to errors and should only be used for debugging or combatting edge cases. +`), }) .strict() @@ -621,7 +759,7 @@ Performs conversion using pre-configured settings. If you specify your own FFmpeg parameters using the Robot's \`ffmpeg\` parameter and you have not specified a preset, then the default \`mp3\` preset is not applied. This is to prevent you from having to override each of the MP3 preset's values manually. -For a list of audio presets, see [audio presets](/docs/transcoding/audio-encoding/audio-presets/). +For a list of audio presets, see [audio presets](/docs/presets/audio/). `), }) .strict() @@ -635,12 +773,12 @@ export const robotFFmpegVideo = robotFFmpeg width: z.number().int().min(1).nullish().describe(` Width of the new video, in pixels. -If the value is not specified and the \`preset\` parameter is available, the \`preset\`'s [supplied width](/docs/transcoding/video-encoding/video-presets/) will be implemented. +If the value is not specified and the \`preset\` parameter is available, the \`preset\`'s [supplied width](/docs/presets/video/) will be implemented. `), height: z.number().int().min(1).nullish().describe(` Height of the new video, in pixels. -If the value is not specified and the \`preset\` parameter is available, the \`preset\`'s [supplied height](/docs/transcoding/video-encoding/video-presets/) will be implemented. +If the value is not specified and the \`preset\` parameter is available, the \`preset\`'s [supplied height](/docs/presets/video/) will be implemented. `), preset: z .enum([ @@ -741,7 +879,7 @@ If the value is not specified and the \`preset\` parameter is available, the \`p ]) .transform(transformPreset) .optional().describe(` -Converts a video according to [pre-configured settings](/docs/transcoding/video-encoding/video-presets/). +Converts a video according to [pre-configured settings](/docs/presets/video/). If you specify your own FFmpeg parameters using the Robot's and/or do not not want Transloadit to set any encoding setting, starting \`ffmpeg_stack: "${stackVersions.ffmpeg.recommendedVersion}"\`, you can use the value \`'empty'\` here. `), @@ -877,7 +1015,7 @@ export const colorspaceSchema = z.enum([ // TODO: add before and after images to the description. export const imageQualitySchema = z.number().int().min(1).max(100).default(92).describe(` -Controls the image compression for JPG and PNG images. Please also take a look at [🤖/image/optimize](/docs/transcoding/image-manipulation/image-optimize/). +Controls the image compression for JPG and PNG images. Please also take a look at [🤖/image/optimize](/docs/robots/image-optimize/). `) export const aiProviderSchema = z.enum(['aws', 'gcp', 'replicate', 'fal', 'transloadit']) @@ -1190,10 +1328,10 @@ export const filterCondition = z.union([ export const videoEncodeSpecificInstructionsSchema = robotFFmpegVideo .extend({ resize_strategy: resize_strategy.describe(` -See the [available resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +See the [available resize strategies](/docs/robots/image-resize/#resize-strategies). `), zoom: z.boolean().default(true).describe(` -If this is set to \`false\`, smaller videos will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +If this is set to \`false\`, smaller videos will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies). `), crop: unsafeCoordinatesSchema.optional().describe(` Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original video(s). Values can be integers for absolute pixel values or strings for percentage based values. @@ -1242,7 +1380,7 @@ Splits the video into multiple chunks so that each chunk can be encoded in paral Allows you to specify the duration of each chunk when \`turbo\` is set to \`true\`. This means you can take advantage of that feature while using fewer Priority Job Slots. For instance, the longer each chunk is, the fewer Encoding Jobs will need to be used. `), watermark_url: z.string().default('').describe(` -A URL indicating a PNG image to be overlaid above this image. You can also [supply the watermark via another Assembly Step](/docs/transcoding/video-encoding/video-encode/#watermark-parameters-video-encode). +A URL indicating a PNG image to be overlaid above this image. You can also [supply the watermark via another Assembly Step](/docs/robots/video-encode/#watermark-parameters-video-encode). `), watermark_position: z.union([positionSchema, z.array(positionSchema)]).default('center') .describe(` diff --git a/src/alphalib/types/robots/assembly-savejson.ts b/src/alphalib/types/robots/assembly-savejson.ts new file mode 100644 index 00000000..4baede07 --- /dev/null +++ b/src/alphalib/types/robots/assembly-savejson.ts @@ -0,0 +1,33 @@ +import { z } from 'zod' + +import { interpolateRobot, robotBase, type RobotMetaInput } from './_instructions-primitives.ts' + +// @ts-expect-error - AssemblySavejsonRobot is not ready yet @TODO please supply missing keys +export const meta: RobotMetaInput = { + name: 'AssemblySavejsonRobot', + priceFactor: 0, + queueSlotCount: 5, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: true, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, +} + +export const robotAssemblySavejsonInstructionsSchema = robotBase + .extend({ + robot: z.literal('/assembly/savejson').describe(` +TODO: Add robot description here +`), + }) + .strict() + +export type RobotAssemblySavejsonInstructions = z.infer< + typeof robotAssemblySavejsonInstructionsSchema +> + +export const interpolatableRobotAssemblySavejsonInstructionsSchema = interpolateRobot( + robotAssemblySavejsonInstructionsSchema, +) +export type InterpolatableRobotAssemblySavejsonInstructions = z.input< + typeof interpolatableRobotAssemblySavejsonInstructionsSchema +> diff --git a/src/alphalib/types/robots/audio-artwork.ts b/src/alphalib/types/robots/audio-artwork.ts index bc698fda..49661db1 100644 --- a/src/alphalib/types/robots/audio-artwork.ts +++ b/src/alphalib/types/robots/audio-artwork.ts @@ -6,10 +6,10 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -38,6 +38,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 3.8, typical_file_type: 'audio file', uses_tools: ['ffmpeg'], + name: 'AudioArtworkRobot', + priceFactor: 1, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAudioArtworkInstructionsSchema = robotBase @@ -47,7 +54,7 @@ export const robotAudioArtworkInstructionsSchema = robotBase robot: z.literal('/audio/artwork').describe(` For extraction, this Robot uses the image format embedded within the audio file — most often, this is JPEG. -If you need the image in a different format, pipe the result of this Robot into [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/). +If you need the image in a different format, pipe the result of this Robot into [🤖/image/resize](/docs/robots/image-resize/). The \`method\` parameter determines whether to extract or insert. `), diff --git a/src/alphalib/types/robots/audio-concat.ts b/src/alphalib/types/robots/audio-concat.ts index 094c3846..6cbd7dfc 100644 --- a/src/alphalib/types/robots/audio-concat.ts +++ b/src/alphalib/types/robots/audio-concat.ts @@ -8,10 +8,10 @@ import { robotFFmpegAudio, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 4, discount_factor: 0.25, @@ -22,17 +22,28 @@ export const meta: RobotMeta = { robot: '/audio/concat', use: { steps: [ - { name: ':original', fields: 'first_audio_file', as: 'audio_1' }, - { name: ':original', fields: 'second_audio_file', as: 'audio_2' }, - { name: ':original', fields: 'third_audio_file', as: 'audio_3' }, + { + name: ':original', + fields: 'first_audio_file', + as: 'audio_1', + }, + { + name: ':original', + fields: 'second_audio_file', + as: 'audio_2', + }, + { + name: ':original', + fields: 'third_audio_file', + as: 'audio_3', + }, ], }, ffmpeg_stack: stackVersions.ffmpeg.recommendedVersion, }, }, }, - example_code_description: - 'If you have a form with 3 file input fields and want to concatenate the uploaded audios in a specific order, instruct Transloadit using the `name` attribute of each input field. Use this attribute as the value for the `fields` key in the JSON, and set `as` to `audio_[[index]]`. Transloadit will concatenate the files based on the ascending index order:', + example_code_description: `If you have a form with 3 file input fields and want to concatenate the uploaded audios in a specific order, instruct Transloadit using the \`name\` attribute of each input field. Use this attribute as the value for the \`fields\` key in the JSON, and set \`as\` to \`audio_[[index]]\`. Transloadit will concatenate the files based on the ascending index order:`, minimum_charge: 0, output_factor: 0.8, override_lvl1: 'Audio Encoding', @@ -46,6 +57,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 3.8, typical_file_type: 'audio file', uses_tools: ['ffmpeg'], + name: 'AudioConcatRobot', + priceFactor: 4, + queueSlotCount: 20, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAudioConcatInstructionsSchema = robotBase @@ -68,7 +86,7 @@ Sample rate of the resulting audio file, in Hertz. If not specified will default audio_fade_seconds: z.number().default(1).describe(` When used this adds an audio fade in and out effect between each section of your concatenated audio file. The float value is used, so if you want an audio delay effect of 500 milliseconds between each video section, you would select 0.5. Integer values can also be represented. -This parameter does not add an audio fade effect at the beginning or end of your result audio file. If you want to do so, create an additional [🤖/audio/encode](/docs/transcoding/audio-encoding/audio-encode/) Step and use our \`ffmpeg\` parameter as shown in this [demo](/demos/audio-encoding/ffmpeg-fade-in-and-out/). +This parameter does not add an audio fade effect at the beginning or end of your result audio file. If you want to do so, create an additional [🤖/audio/encode](/docs/robots/audio-encode/) Step and use our \`ffmpeg\` parameter as shown in this [demo](/demos/audio-encoding/ffmpeg-fade-in-and-out/). `), }) .strict() diff --git a/src/alphalib/types/robots/audio-encode.ts b/src/alphalib/types/robots/audio-encode.ts index d4015782..98d68dac 100644 --- a/src/alphalib/types/robots/audio-encode.ts +++ b/src/alphalib/types/robots/audio-encode.ts @@ -8,10 +8,10 @@ import { sampleRateSchema, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 4, discount_factor: 0.25, @@ -42,6 +42,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 3.8, typical_file_type: 'audio file', uses_tools: ['ffmpeg'], + name: 'AudioEncodeRobot', + priceFactor: 4, + queueSlotCount: 20, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAudioEncodeInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/audio-loop.ts b/src/alphalib/types/robots/audio-loop.ts index 2043d9ee..f27af9f5 100644 --- a/src/alphalib/types/robots/audio-loop.ts +++ b/src/alphalib/types/robots/audio-loop.ts @@ -8,10 +8,10 @@ import { sampleRateSchema, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 4, discount_factor: 0.25, @@ -28,7 +28,7 @@ export const meta: RobotMeta = { }, example_code_description: 'Loop uploaded audio to achieve a target duration of 300 seconds:', marketing_intro: - 'Whether you’re producing beats, white-noise, or just empty segments as fillers between audio tracks that you’re to stringing together with [🤖/audio/concat](/docs/transcoding/audio-encoding/audio-concat/), [🤖/audio/loop](/docs/transcoding/audio-encoding/audio-loop/) has got your back.', + 'Whether you’re producing beats, white-noise, or just empty segments as fillers between audio tracks that you’re to stringing together with [🤖/audio/concat](/docs/robots/audio-concat/), [🤖/audio/loop](/docs/robots/audio-loop/) has got your back.', minimum_charge: 0, output_factor: 0.8, override_lvl1: 'Audio Encoding', @@ -42,6 +42,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 3.8, typical_file_type: 'audio file', uses_tools: ['ffmpeg'], + name: 'AudioLoopRobot', + priceFactor: 4, + queueSlotCount: 20, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAudioLoopInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/audio-merge.ts b/src/alphalib/types/robots/audio-merge.ts index 73e3c155..bb6817a4 100644 --- a/src/alphalib/types/robots/audio-merge.ts +++ b/src/alphalib/types/robots/audio-merge.ts @@ -8,10 +8,10 @@ import { sampleRateSchema, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 4, discount_factor: 0.25, @@ -23,17 +23,28 @@ export const meta: RobotMeta = { preset: 'mp3', use: { steps: [ - { name: ':original', fields: 'first_audio_file', as: 'audio' }, - { name: ':original', fields: 'second_audio_file', as: 'audio' }, - { name: ':original', fields: 'third_audio_file', as: 'audio' }, + { + name: ':original', + fields: 'first_audio_file', + as: 'audio', + }, + { + name: ':original', + fields: 'second_audio_file', + as: 'audio', + }, + { + name: ':original', + fields: 'third_audio_file', + as: 'audio', + }, ], }, ffmpeg_stack: stackVersions.ffmpeg.recommendedVersion, }, }, }, - example_code_description: - 'If you have a form with 3 file input fields and wish to overlay the uploaded audios, instruct Transloadit using the `name` attribute of each input field. Use this attribute as the value for the `fields` key in the JSON, and set `as` to `audio`:', + example_code_description: `If you have a form with 3 file input fields and wish to overlay the uploaded audios, instruct Transloadit using the \`name\` attribute of each input field. Use this attribute as the value for the \`fields\` key in the JSON, and set \`as\` to \`audio\`:`, minimum_charge: 0, output_factor: 0.8, override_lvl1: 'Audio Encoding', @@ -47,6 +58,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 3.8, typical_file_type: 'audio file', uses_tools: ['ffmpeg'], + name: 'AudioMergeRobot', + priceFactor: 4, + queueSlotCount: 20, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAudioMergeInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/audio-waveform.ts b/src/alphalib/types/robots/audio-waveform.ts index fc6aaade..6c61efff 100644 --- a/src/alphalib/types/robots/audio-waveform.ts +++ b/src/alphalib/types/robots/audio-waveform.ts @@ -7,9 +7,9 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 1, discount_factor: 1, @@ -26,8 +26,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Generate a 400×200 waveform in `#0099cc` color from an uploaded audio file:', + example_code_description: `Generate a 400×200 waveform in \`#0099cc\` color from an uploaded audio file:`, extended_description: ` Here is an example waveform image: @@ -48,6 +47,14 @@ Here is an example waveform image: title: 'Generate waveform images from audio', typical_file_size_mb: 3.8, typical_file_type: 'audio file', + name: 'AudioWaveformRobot', + priceFactor: 1, + queueSlotCount: 20, + minimumCharge: 1048576, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAudioWaveformInstructionsSchema = robotBase @@ -55,9 +62,9 @@ export const robotAudioWaveformInstructionsSchema = robotBase .merge(robotFFmpeg) .extend({ robot: z.literal('/audio/waveform').describe(` -We recommend that you use an [🤖/audio/encode](/docs/transcoding/audio-encoding/audio-encode/) Step prior to your waveform Step to convert audio files to MP3. This way it is guaranteed that [🤖/audio/waveform](/docs/transcoding/audio-encoding/audio-waveform/) accepts your audio file and you can also down-sample large audio files and save some money. +We recommend that you use an [🤖/audio/encode](/docs/robots/audio-encode/) Step prior to your waveform Step to convert audio files to MP3. This way it is guaranteed that [🤖/audio/waveform](/docs/robots/audio-waveform/) accepts your audio file and you can also down-sample large audio files and save some money. -Similarly, if you need the output image in a different format, please pipe the result of this Robot into [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/). +Similarly, if you need the output image in a different format, please pipe the result of this Robot into [🤖/image/resize](/docs/robots/image-resize/). `), format: z.enum(['image', 'json']).default('image').describe(` The format of the result file. Can be \`"image"\` or \`"json"\`. If \`"image"\` is supplied, a PNG image will be created, otherwise a JSON file. diff --git a/src/alphalib/types/robots/azure-import.ts b/src/alphalib/types/robots/azure-import.ts index 61238cc6..5e48cd40 100644 --- a/src/alphalib/types/robots/azure-import.ts +++ b/src/alphalib/types/robots/azure-import.ts @@ -6,12 +6,13 @@ import { robotImport, next_page_token, path, + recursive, robotBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -25,8 +26,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -41,6 +41,13 @@ export const meta: RobotMeta = { title: 'Import files from Azure', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'AzureImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotAzureImportInstructionsSchema = robotBase @@ -57,11 +64,14 @@ If you want to import all files from the root directory, please use \`/\` as the You can also use an array of path strings here to import multiple paths in the same Robot's Step. `), + recursive: recursive.describe(` + Setting this to \`true\` will enable importing files from subdirectories and sub-subdirectories (etc.) of the given path. + `), next_page_token: next_page_token.describe(` A string token used for pagination. The returned files of one paginated call have the next page token inside of their meta data, which needs to be used for the subsequent paging call. `), files_per_page: files_per_page.describe(` -The pagination page size. This only works when recursive is \`true\` for now, in order to not break backwards compatibility in non-recursive imports. +The pagination page size. `), }) .strict() diff --git a/src/alphalib/types/robots/azure-store.ts b/src/alphalib/types/robots/azure-store.ts index 7e5ef77d..7506eef7 100644 --- a/src/alphalib/types/robots/azure-store.ts +++ b/src/alphalib/types/robots/azure-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { azureBase, interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Azure:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Azure:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to Microsoft Azure', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'AzureStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotAzureStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/backblaze-import.ts b/src/alphalib/types/robots/backblaze-import.ts index 922675c6..5b792e39 100644 --- a/src/alphalib/types/robots/backblaze-import.ts +++ b/src/alphalib/types/robots/backblaze-import.ts @@ -9,9 +9,9 @@ import { robotBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -26,8 +26,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -42,6 +41,13 @@ export const meta: RobotMeta = { title: 'Import files from Backblaze', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'BackblazeImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotBackblazeImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/backblaze-store.ts b/src/alphalib/types/robots/backblaze-store.ts index e2bfa245..61f2a533 100644 --- a/src/alphalib/types/robots/backblaze-store.ts +++ b/src/alphalib/types/robots/backblaze-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { backblazeBase, interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Backblaze:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Backblaze:`, extended_description: ` ## Access @@ -37,6 +37,13 @@ Your Backblaze buckets need to have the \`listBuckets\` (to obtain a bucket ID f title: 'Export files to Backblaze', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'BackblazeStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotBackblazeStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/cloudfiles-import.ts b/src/alphalib/types/robots/cloudfiles-import.ts index fa852011..fbb2bf31 100644 --- a/src/alphalib/types/robots/cloudfiles-import.ts +++ b/src/alphalib/types/robots/cloudfiles-import.ts @@ -9,9 +9,9 @@ import { robotBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -26,8 +26,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, minimum_charge: 0, output_factor: 1, override_lvl1: 'File Importing', @@ -41,6 +40,13 @@ export const meta: RobotMeta = { title: 'Import files from Rackspace Cloud Files', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'CloudfilesImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotCloudfilesImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/cloudfiles-store.ts b/src/alphalib/types/robots/cloudfiles-store.ts index 11e48d81..704cbc6f 100644 --- a/src/alphalib/types/robots/cloudfiles-store.ts +++ b/src/alphalib/types/robots/cloudfiles-store.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -23,7 +23,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Rackspace Cloud Files:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Rackspace Cloud Files:`, extended_description: ` @@ -46,6 +46,13 @@ The storage container URL for this file is always available via \`file.meta.stor title: 'Export files to Rackspace Cloud Files', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'CloudfilesStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotCloudfilesStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/cloudflare-import.ts b/src/alphalib/types/robots/cloudflare-import.ts index b4c9606d..a8ca1a75 100644 --- a/src/alphalib/types/robots/cloudflare-import.ts +++ b/src/alphalib/types/robots/cloudflare-import.ts @@ -11,9 +11,9 @@ import { robotBase, return_file_stubs, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from Cloudflare R2', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'CloudflareImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotCloudflareImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/cloudflare-store.ts b/src/alphalib/types/robots/cloudflare-store.ts index 09f0acdd..1229869e 100644 --- a/src/alphalib/types/robots/cloudflare-store.ts +++ b/src/alphalib/types/robots/cloudflare-store.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -23,7 +23,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on cloudflare R2:', + example_code_description: `Export uploaded files to \`my_target_folder\` on cloudflare R2:`, extended_description: ` The URL to the result file will be returned in the Assembly Status JSON. `, @@ -40,6 +40,13 @@ The URL to the result file will be returned in the Assembly Status JSON [!Note] -> This Robot can convert files to PDF, but cannot convert PDFs to different formats. If you want to convert PDFs to say, JPEG or TIFF, use [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/). If you want to turn them into text files or recognize (OCR) them to make them searchable, reach out, as we have a new Robot in the works for this. +> This Robot can convert files to PDF, but cannot convert PDFs to different formats. If you want to convert PDFs to say, JPEG or TIFF, use [🤖/image/resize](/docs/robots/image-resize/). If you want to turn them into text files or recognize (OCR) them to make them searchable, reach out, as we have a new Robot in the works for this. Sometimes, a certain file type might not support what you are trying to accomplish. Perhaps your company is trying to automate document formatting, but it only works with docx, so all your docs need to be converted. Or maybe your stored jpg files are taking up too much space and you want a lighter format. Whatever the case, we have you covered. @@ -75,6 +75,22 @@ The following file formats can be converted from: title: 'Convert documents into different formats', typical_file_size_mb: 0.8, typical_file_type: 'document', + name: 'DocumentConvertRobot', + priceFactor: 1, + // This slot count needs to be unique, because unoconv can only process one document at a time, + // and is also only included in WorkerSlotCalculator::slotsThatFit() when + // we have enough idle unoconv daemons. + // We do not want a queue of this Robot to block any other Robot's jobs. + queueSlotCount: 32, + minimumCharge: 1048576, + lazyLoad: true, + installVersionFile: process.env.API2_UNOCONV_INSTALL_VERSION_FILE || '', + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + // we cannot use coreConfig.numUnoconvDaemons, because it does not live in alphalib + numDaemons: 8, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotDocumentConvertInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/document-merge.ts b/src/alphalib/types/robots/document-merge.ts index 6ffe5702..24a881d7 100644 --- a/src/alphalib/types/robots/document-merge.ts +++ b/src/alphalib/types/robots/document-merge.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -47,6 +47,14 @@ Input files are sorted alphanumerically unless you provide the as-syntax in the title: 'Merge documents into one', typical_file_size_mb: 0.8, typical_file_type: 'document', + name: 'DocumentMergeRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumCharge: 1048576, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotDocumentMergeInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/document-ocr.ts b/src/alphalib/types/robots/document-ocr.ts index e1b6431a..b11dd602 100644 --- a/src/alphalib/types/robots/document-ocr.ts +++ b/src/alphalib/types/robots/document-ocr.ts @@ -7,9 +7,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -29,7 +29,7 @@ export const meta: RobotMeta = { > Transloadit aims to be deterministic, but this Robot uses third-party AI services. The providers (AWS, GCP) will evolve their models over time, giving different responses for the same input PDFs. Avoid relying on exact responses in your tests and application. > [!Note] -> Currently, this Robot only supports character recognition for PDFs. To use this Robot with other document formats, use [/document/convert](/docs/transcoding/document-processing/document-convert/) first to convert the document into a PDF. +> Currently, this Robot only supports character recognition for PDFs. To use this Robot with other document formats, use [/document/convert](/docs/robots/document-convert/) first to convert the document into a PDF. `, minimum_charge: 1048576, output_factor: 1, @@ -43,6 +43,17 @@ export const meta: RobotMeta = { title: 'Recognize text in documents', typical_file_size_mb: 0.8, typical_file_type: 'document', + name: 'DocumentOcrRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsdPerDocumentOcrPage: { + aws: 0.02, + gcp: 0.015, + }, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotDocumentOcrInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/document-split.ts b/src/alphalib/types/robots/document-split.ts index 7307c0c0..d1551dcb 100644 --- a/src/alphalib/types/robots/document-split.ts +++ b/src/alphalib/types/robots/document-split.ts @@ -1,9 +1,9 @@ import { z } from 'zod' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -21,6 +21,14 @@ export const meta: RobotMeta = { title: 'Extract pages from a document', typical_file_size_mb: 0.8, typical_file_type: 'document', + name: 'DocumentSplitRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumCharge: 1048576, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotDocumentSplitInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/document-thumbs.ts b/src/alphalib/types/robots/document-thumbs.ts index 6590f573..7667ba88 100644 --- a/src/alphalib/types/robots/document-thumbs.ts +++ b/src/alphalib/types/robots/document-thumbs.ts @@ -7,9 +7,9 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -40,6 +40,14 @@ export const meta: RobotMeta = { typical_file_size_mb: 0.8, typical_file_type: 'document', uses_tools: ['imagemagick'], + name: 'DocumentThumbsRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumCharge: 524288, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotDocumentThumbsInstructionsSchema = robotBase @@ -73,7 +81,7 @@ Height of the new image, in pixels. If not specified, will default to the height `), resize_strategy: z.enum(['crop', 'fillcrop', 'fit', 'min_fit', 'pad', 'stretch']).default('pad') .describe(` -One of the [available resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +One of the [available resize strategies](/docs/robots/image-resize/#resize-strategies). `), // TODO: Determine the allowed colors background: z.string().default('#FFFFFF').describe(` diff --git a/src/alphalib/types/robots/dropbox-import.ts b/src/alphalib/types/robots/dropbox-import.ts index ad5d465a..0cca98f5 100644 --- a/src/alphalib/types/robots/dropbox-import.ts +++ b/src/alphalib/types/robots/dropbox-import.ts @@ -7,9 +7,9 @@ import { robotBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -23,8 +23,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -39,6 +38,13 @@ export const meta: RobotMeta = { title: 'Import files from Dropbox', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'DropboxImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotDropboxImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/dropbox-store.ts b/src/alphalib/types/robots/dropbox-store.ts index 2414436f..b6c30215 100644 --- a/src/alphalib/types/robots/dropbox-store.ts +++ b/src/alphalib/types/robots/dropbox-store.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -23,7 +23,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Dropbox:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Dropbox:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -37,6 +37,13 @@ export const meta: RobotMeta = { title: 'Export files to Dropbox', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'DropboxStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotDropboxStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/edgly-deliver.ts b/src/alphalib/types/robots/edgly-deliver.ts index 7eb982cf..fcc5a0ea 100644 --- a/src/alphalib/types/robots/edgly-deliver.ts +++ b/src/alphalib/types/robots/edgly-deliver.ts @@ -1,8 +1,8 @@ import { z } from 'zod' -import { interpolateRobot, robotBase, type RobotMeta } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase, type RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 20, discount_factor: 0.05, @@ -19,6 +19,16 @@ export const meta: RobotMeta = { title: 'Cache and deliver files globally', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'EdglyDeliverRobot', + priceFactor: 20, + queueSlotCount: 0, + minimumCharge: 102400, + downloadInputFiles: false, + preserveInputFileUrls: true, + isAllowedForUrlTransform: false, + trackOutputFileSize: false, + isInternal: true, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotEdglyDeliverInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-compress.ts b/src/alphalib/types/robots/file-compress.ts index 1b738841..20241944 100644 --- a/src/alphalib/types/robots/file-compress.ts +++ b/src/alphalib/types/robots/file-compress.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 1, discount_factor: 1, @@ -36,7 +36,7 @@ To achieve all this, we have created the following archive file structure. - There is a subfolder for each Step name that has result files in the archive. - Files are named according to the first two letters of the unique original prefix + "_" + the first two letters of the unique prefix + "_" + the original file name. If you do not know what the original prefixes are, please check [our available Assembly variables](/docs/topics/assembly-instructions/#assembly-variables) and look for \`\${unique_original_prefix}\` and \`\${unique_prefix}\`. - Files that belong to the \`:original\` Step (originally uploaded files) do **not** include the first two letters of the \`unique_original_prefix\`. -- If you are dealing with thumbnails from [🤖/video/thumbs](/docs/transcoding/video-encoding/video-thumbs/), there is an additional digit representing the order in the file name. +- If you are dealing with thumbnails from [🤖/video/thumbs](/docs/robots/video-thumbs/), there is an additional digit representing the order in the file name. Here is an example: @@ -69,6 +69,13 @@ Here is an example: title: 'Compress files', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileCompressRobot', + priceFactor: 1, + queueSlotCount: 15, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileCompressInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-decompress.ts b/src/alphalib/types/robots/file-decompress.ts index 3eedc70a..7bf69012 100644 --- a/src/alphalib/types/robots/file-decompress.ts +++ b/src/alphalib/types/robots/file-decompress.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 0.8, @@ -30,6 +30,13 @@ export const meta: RobotMeta = { title: 'Decompress archives', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileDecompressRobot', + priceFactor: 1.25, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotFileDecompressInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-filter.ts b/src/alphalib/types/robots/file-filter.ts index 31e064ff..f59a4386 100644 --- a/src/alphalib/types/robots/file-filter.ts +++ b/src/alphalib/types/robots/file-filter.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 0, discount_factor: 0, @@ -37,6 +37,15 @@ export const meta: RobotMeta = { title: 'Filter files', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileFilterRobot', + priceFactor: 100, + queueSlotCount: 0, + downloadInputFiles: false, + preserveInputFileUrls: true, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileFilterInstructionsSchema = robotBase @@ -50,7 +59,7 @@ The Robot has two modes of operation: - Constructing conditions out of arrays with 3 members each. For example, \`["\${file.size}", "<=", "720"]\` - Writing conditions in JavaScript. For example, \`\${file.size <= 720}\`. See also [Dynamic Evaluation](/docs/topics/dynamic-evaluation/). -Passing JavaScript allows you to implement logic as complex as you wish, however it’s slower than combining arrays of conditions, and will be charged for per invocation via [🤖/script/run](/docs/transcoding/code-evaluation/script-run/). +Passing JavaScript allows you to implement logic as complex as you wish, however it’s slower than combining arrays of conditions, and will be charged for per invocation via [🤖/script/run](/docs/robots/script-run/). ### Conditions as arrays @@ -81,7 +90,7 @@ Examples: - \`\${/image/.test(file.mime)}\` - \`\${Math.max(file.meta.width, file.meta.height) > 100}\` -As indicated, we charge for this via [🤖/script/run](/docs/transcoding/code-evaluation/script-run/). See also [Dynamic Evaluation](/docs/topics/dynamic-evaluation/) for more details on allowed syntax and behavior. +As indicated, we charge for this via [🤖/script/run](/docs/robots/script-run/). See also [Dynamic Evaluation](/docs/topics/dynamic-evaluation/) for more details on allowed syntax and behavior. `), accepts: filterCondition .describe( diff --git a/src/alphalib/types/robots/file-hash.ts b/src/alphalib/types/robots/file-hash.ts index aeef0a40..fd7a5f50 100644 --- a/src/alphalib/types/robots/file-hash.ts +++ b/src/alphalib/types/robots/file-hash.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 5, discount_factor: 0.2, @@ -30,6 +30,12 @@ export const meta: RobotMeta = { title: 'Hash Files', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileHashRobot', + priceFactor: 5, + queueSlotCount: 60, + isAllowedForUrlTransform: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileHashInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-preview.ts b/src/alphalib/types/robots/file-preview.ts index 1e86664f..681a5910 100644 --- a/src/alphalib/types/robots/file-preview.ts +++ b/src/alphalib/types/robots/file-preview.ts @@ -10,9 +10,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -42,6 +42,15 @@ export const meta: RobotMeta = { title: 'Generate a preview thumbnail', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FilePreviewRobot', + priceFactor: 1, + queueSlotCount: 15, + minimumCharge: 1048576, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + importRanges: ['0-19999999', '-1000000'], + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFilePreviewInstructionsSchema = robotBase @@ -66,7 +75,7 @@ Height of the thumbnail, in pixels. resize_strategy: resize_strategy.describe(` To achieve the desired dimensions of the preview thumbnail, the Robot might have to resize the generated image. This happens, for example, when the dimensions of a frame extracted from a video do not match the chosen \`width\` and \`height\` parameters. -See the list of available [resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies) for more details. +See the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies) for more details. `), background: color_with_alpha.default('#ffffffff').describe(` The hexadecimal code of the color used to fill the background (only used for the pad resize strategy). The format is \`#rrggbb[aa]\` (red, green, blue, alpha). Use \`#00000000\` for a transparent padding. @@ -131,13 +140,13 @@ The font family of the text used in the icon. Only used if the \`icon\` strategy The content of the text box in generated icons. Only used if the \`icon_style\` parameter is set to \`with-text\`. The default value, \`extension\`, adds the file extension (e.g. MP4, JPEG) to the icon. The value \`none\` can be used to render an empty text box, which is useful if no text should not be included in the raster image, but some place should be reserved in the image for later overlaying custom text over the image using HTML etc. `), optimize: z.boolean().default(true).describe(` -Specifies whether the generated preview image should be optimized to reduce the image's file size while keeping their quaility. If enabled, the images will be optimized using [🤖/image/optimize](/docs/transcoding/image-manipulation/image-optimize/). +Specifies whether the generated preview image should be optimized to reduce the image's file size while keeping their quaility. If enabled, the images will be optimized using [🤖/image/optimize](/docs/robots/image-optimize/). `), optimize_priority: optimize_priority.describe(` -Specifies whether conversion speed or compression ratio is prioritized when optimizing images. Only used if \`optimize\` is enabled. Please see the [🤖/image/optimize documentation](/docs/transcoding/image-manipulation/image-optimize/#param-priority) for more details. +Specifies whether conversion speed or compression ratio is prioritized when optimizing images. Only used if \`optimize\` is enabled. Please see the [🤖/image/optimize documentation](/docs/robots/image-optimize/#param-priority) for more details. `), optimize_progressive: z.boolean().default(false).describe(` -Specifies whether images should be interlaced, which makes the result image load progressively in browsers. Only used if \`optimize\` is enabled. Please see the [🤖/image/optimize documentation](/docs/transcoding/image-manipulation/image-optimize/#param-progressive) for more details. +Specifies whether images should be interlaced, which makes the result image load progressively in browsers. Only used if \`optimize\` is enabled. Please see the [🤖/image/optimize documentation](/docs/robots/image-optimize/#param-progressive) for more details. `), clip_format: z.enum(['apng', 'avif', 'gif', 'webp']).default('webp').describe(` The animated image format for the generated video clip. Only used if the \`clip\` strategy for video files is applied. diff --git a/src/alphalib/types/robots/file-read.ts b/src/alphalib/types/robots/file-read.ts index 5329f3c3..392351ec 100644 --- a/src/alphalib/types/robots/file-read.ts +++ b/src/alphalib/types/robots/file-read.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 5, discount_factor: 0.2, @@ -20,6 +20,13 @@ export const meta: RobotMeta = { title: 'Read file contents', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileReadRobot', + priceFactor: 5, + queueSlotCount: 5, + minimumCharge: 512000, + isAllowedForUrlTransform: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileReadInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-serve.ts b/src/alphalib/types/robots/file-serve.ts index 91b480c3..5ed5967e 100644 --- a/src/alphalib/types/robots/file-serve.ts +++ b/src/alphalib/types/robots/file-serve.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 4, discount_factor: 0.25, @@ -19,6 +19,15 @@ export const meta: RobotMeta = { title: 'Serve files to web browsers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileServeRobot', + priceFactor: 4, + queueSlotCount: 0, + downloadInputFiles: false, + preserveInputFileUrls: true, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileServeInstructionsSchema = robotBase @@ -29,15 +38,15 @@ When you want Transloadit to tranform files on the fly, you can use this Ro 🤖/file/serve merely acts as the glue layer between our Assembly engine and serving files over HTTP. It let's you pick the proper result of a series of Steps via the \`use\` parameter and configure headers on the original content. That is where its responsibilies end, and 🤖/tlcdn/deliver, then takes over to globally distribute this original content across the globe, and make sure that is cached close to your end-users, when they make requests such as , another. 🤖/tlcdn/deliver is not a part of your Assembly Instructions, but it may appear on your invoices as bandwidth charges incur when distributing the cached copies. 🤖/file/serve only charges when the CDN does not have a cached copy and requests to regenerate the original content, which depending on your caching settings could be just once a month, or year, per file/transformation. -While theoretically possible, you could use [🤖/file/serve](/docs/transcoding/content-delivery/file-serve/) directly in HTML files, but we strongly recommend against this, because if your site gets popular and the media URL that /file/serve is handling gets hit one million times, that is one million new image resizes. Wrapping it with a CDN (and thanks to the caching that comes with it) makes sure encoding charges stay low, as well as latencies. +While theoretically possible, you could use [🤖/file/serve](/docs/robots/file-serve/) directly in HTML files, but we strongly recommend against this, because if your site gets popular and the media URL that /file/serve is handling gets hit one million times, that is one million new image resizes. Wrapping it with a CDN (and thanks to the caching that comes with it) makes sure encoding charges stay low, as well as latencies. Also consider configuring caching headers and cache-control directives to control how content is cached and invalidated on the CDN edge servers, balancing between freshness and efficiency. More information on: - [Content Delivery](/services/content-delivery/). -- [🤖/file/serve](/docs/transcoding/content-delivery/file-serve/) pricing. -- [🤖/tlcdn/deliver](/docs/transcoding/content-delivery/tlcdn-deliver/) pricing. +- [🤖/file/serve](/docs/robots/file-serve/) pricing. +- [🤖/tlcdn/deliver](/docs/robots/tlcdn-deliver/) pricing. - [File Preview Feature](/blog/2024/06/file-preview-with-smart-cdn/) blog post. `), headers: z.record(z.string()).default({ diff --git a/src/alphalib/types/robots/file-verify.ts b/src/alphalib/types/robots/file-verify.ts index 320ae60c..2416de21 100644 --- a/src/alphalib/types/robots/file-verify.ts +++ b/src/alphalib/types/robots/file-verify.ts @@ -1,13 +1,12 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 4, - description: - '/file/verify is a simple Robot that helps ensure that the files you upload are of the type you initially intended. This is especially useful when handling user-generated content, where you may not want to run certain Steps in your Template if the user hasn’t uploaded a file of the correct type. Another use case for /file/verify is when a user uploads a ZIP file, but we find that it has a few damaged files inside when we extract it. Perhaps you don’t want to error out, but only send the good files to a next processing step. With /file/verify, you can do exactly that (assuming the default of `error_on_decline`: `true`).', + description: `/file/verify is a simple Robot that helps ensure that the files you upload are of the type you initially intended. This is especially useful when handling user-generated content, where you may not want to run certain Steps in your Template if the user hasn’t uploaded a file of the correct type. Another use case for /file/verify is when a user uploads a ZIP file, but we find that it has a few damaged files inside when we extract it. Perhaps you don’t want to error out, but only send the good files to a next processing step. With /file/verify, you can do exactly that (assuming the default of \`error_on_decline\`: \`true\`).`, discount_factor: 0.25, discount_pct: 75, example_code: { @@ -34,6 +33,13 @@ export const meta: RobotMeta = { title: 'Verify the file type', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileVerifyRobot', + priceFactor: 4, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileVerifyInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-virusscan.ts b/src/alphalib/types/robots/file-virusscan.ts index 56edda88..7f1ae0ae 100644 --- a/src/alphalib/types/robots/file-virusscan.ts +++ b/src/alphalib/types/robots/file-virusscan.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 1, description: @@ -36,6 +36,16 @@ export const meta: RobotMeta = { title: 'Scan files for viruses', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FileVirusscanRobot', + priceFactor: 1, + queueSlotCount: 38, + minimumCharge: 1048576, + lazyLoad: true, + installVersionFile: process.env.API2_CLAMD_INSTALL_VERSION_FILE || '', + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFileVirusscanInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/file-watermark.ts b/src/alphalib/types/robots/file-watermark.ts index 48002de5..9fe2d848 100644 --- a/src/alphalib/types/robots/file-watermark.ts +++ b/src/alphalib/types/robots/file-watermark.ts @@ -1,6 +1,18 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' + +// @ts-expect-error - FileWatermarkRobot is not ready yet @TODO please supply missing keys +export const meta: RobotMetaInput = { + name: 'FileWatermarkRobot', + priceFactor: 4, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, +} export const robotFileWatermarkInstructionsSchema = robotBase .merge(robotUse) diff --git a/src/alphalib/types/robots/ftp-import.ts b/src/alphalib/types/robots/ftp-import.ts index bacc6f0b..cb43ddb6 100644 --- a/src/alphalib/types/robots/ftp-import.ts +++ b/src/alphalib/types/robots/ftp-import.ts @@ -7,9 +7,9 @@ import { robotBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -23,8 +23,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, minimum_charge: 0, output_factor: 1, override_lvl1: 'File Importing', @@ -38,6 +37,13 @@ export const meta: RobotMeta = { title: 'Import files from FTP servers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FtpImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotFtpImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/ftp-store.ts b/src/alphalib/types/robots/ftp-store.ts index 69cff55b..5dd7b5e7 100644 --- a/src/alphalib/types/robots/ftp-store.ts +++ b/src/alphalib/types/robots/ftp-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { ftpBase, interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on an FTP server:', + example_code_description: `Export uploaded files to \`my_target_folder\` on an FTP server:`, minimum_charge: 0, output_factor: 1, override_lvl1: 'File Exporting', @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to FTP servers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'FtpStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotFtpStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/google-import.ts b/src/alphalib/types/robots/google-import.ts index 834193cd..67df7a55 100644 --- a/src/alphalib/types/robots/google-import.ts +++ b/src/alphalib/types/robots/google-import.ts @@ -10,9 +10,9 @@ import { robotBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -27,8 +27,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -42,6 +41,13 @@ export const meta: RobotMeta = { title: 'Import files from Google Storage', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'GoogleImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotGoogleImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/google-store.ts b/src/alphalib/types/robots/google-store.ts index 076e5ef0..dd2e3c4a 100644 --- a/src/alphalib/types/robots/google-store.ts +++ b/src/alphalib/types/robots/google-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { googleBase, interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Google Storage:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Google Storage:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to Google Storage', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'GoogleStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotGoogleStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/html-convert.ts b/src/alphalib/types/robots/html-convert.ts index a685210d..36a93bdb 100644 --- a/src/alphalib/types/robots/html-convert.ts +++ b/src/alphalib/types/robots/html-convert.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -36,6 +36,14 @@ export const meta: RobotMeta = { title: 'Take screenshots of webpages or uploaded HTML files', typical_file_size_mb: 0.6, typical_file_type: 'webpage', + name: 'HtmlConvertRobot', + priceFactor: 1, + queueSlotCount: 30, + minimumCharge: 1048576, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotHtmlConvertInstructionsSchema = robotBase @@ -44,7 +52,7 @@ export const robotHtmlConvertInstructionsSchema = robotBase robot: z.literal('/html/convert').describe(` A URL can be provided instead of an input HTML file, to capture a screenshot from the website referenced by the URL. -Use [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/) to resize or crop the screenshot as needed. +Use [🤖/image/resize](/docs/robots/image-resize/) to resize or crop the screenshot as needed. `), url: z.string().nullable().default(null).describe(` The URL of the web page to be converted. Optional, as you can also upload/import HTML files and pass it to this Robot. @@ -77,6 +85,12 @@ The delay (in milliseconds) applied to allow the page and all of its JavaScript `), headers: z.record(z.string()).optional().describe(` An object containing optional headers that will be passed along with the original request to the website. For example, this parameter can be used to pass along an authorization token along with the request. +`), + wait_until: z.enum(['domcontentloaded', 'load', 'networkidle', 'commit']).default('networkidle') + .describe(` +The event to wait for before taking the screenshot. Used for loading Javascript, and images. + +See [Playwright's documentation](https://playwright.dev/docs/api/class-page#page-wait-for-load-state) for more information. `), }) .strict() diff --git a/src/alphalib/types/robots/http-import.ts b/src/alphalib/types/robots/http-import.ts index d975fbc9..ef486014 100644 --- a/src/alphalib/types/robots/http-import.ts +++ b/src/alphalib/types/robots/http-import.ts @@ -6,9 +6,9 @@ import { robotBase, return_file_stubs, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -34,6 +34,13 @@ export const meta: RobotMeta = { title: 'Import files from web servers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'HttpImportRobot', + priceFactor: 10, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotHttpImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/image-bgremove.ts b/src/alphalib/types/robots/image-bgremove.ts index e8d1fe2a..e6e4818c 100644 --- a/src/alphalib/types/robots/image-bgremove.ts +++ b/src/alphalib/types/robots/image-bgremove.ts @@ -1,9 +1,9 @@ import { z } from 'zod' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, discount_factor: 1, bytescount: 1, @@ -29,6 +29,14 @@ export const meta: RobotMeta = { title: 'Remove the background from images', typical_file_size_mb: 0.8, typical_file_type: 'image', + name: 'ImageBgremoveRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsd: 0.006, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageBgremoveInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/image-describe.ts b/src/alphalib/types/robots/image-describe.ts index c71acfb5..9ac52939 100644 --- a/src/alphalib/types/robots/image-describe.ts +++ b/src/alphalib/types/robots/image-describe.ts @@ -7,9 +7,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -41,6 +41,14 @@ export const meta: RobotMeta = { title: 'Recognize objects in images', typical_file_size_mb: 0.8, typical_file_type: 'image', + name: 'ImageDescribeRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsd: 0.0013, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageDescribeInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/image-facedetect.ts b/src/alphalib/types/robots/image-facedetect.ts index 92d31db8..1469593b 100644 --- a/src/alphalib/types/robots/image-facedetect.ts +++ b/src/alphalib/types/robots/image-facedetect.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -39,6 +39,14 @@ export const meta: RobotMeta = { title: 'Detect faces in images', typical_file_size_mb: 0.8, typical_file_type: 'image', + name: 'ImageFacedetectRobot', + priceFactor: 1, + queueSlotCount: 20, + minimumChargeUsd: 0.0013, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageFacedetectInstructionsSchema = robotBase @@ -47,7 +55,7 @@ export const robotImageFacedetectInstructionsSchema = robotBase robot: z.literal('/image/facedetect').describe(` You can specify padding around the extracted faces, tailoring the output for your needs. -This Robot works well together with [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/) to bring the full power of resized and optimized images to your website or app. +This Robot works well together with [🤖/image/resize](/docs/robots/image-resize/) to bring the full power of resized and optimized images to your website or app.
diff --git a/src/alphalib/types/robots/image-generate.ts b/src/alphalib/types/robots/image-generate.ts index e21382fb..bc8324b6 100644 --- a/src/alphalib/types/robots/image-generate.ts +++ b/src/alphalib/types/robots/image-generate.ts @@ -1,9 +1,9 @@ import { z } from 'zod' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -19,6 +19,14 @@ export const meta: RobotMeta = { title: 'Generate images from text prompts', typical_file_size_mb: 1.2, typical_file_type: 'image', + name: 'ImageGenerateRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsd: 0.06, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageGenerateInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/image-merge.ts b/src/alphalib/types/robots/image-merge.ts index 89355602..aaed1d7b 100644 --- a/src/alphalib/types/robots/image-merge.ts +++ b/src/alphalib/types/robots/image-merge.ts @@ -7,9 +7,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -40,6 +40,12 @@ export const meta: RobotMeta = { title: 'Merge several images into a single image', typical_file_size_mb: 0.8, typical_file_type: 'image', + name: 'ImageMergeRobot', + priceFactor: 1, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageMergeInstructionsSchema = robotBase @@ -49,7 +55,7 @@ export const robotImageMergeInstructionsSchema = robotBase The final result will be a spritesheet, with the images displayed horizontally or vertically. It's recommended to use this Robot with -[🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/) so your images are of a +[🤖/image/resize](/docs/robots/image-resize/) so your images are of a similar size before merging them. `), format: z diff --git a/src/alphalib/types/robots/image-ocr.ts b/src/alphalib/types/robots/image-ocr.ts index e0ef2a43..8203eee5 100644 --- a/src/alphalib/types/robots/image-ocr.ts +++ b/src/alphalib/types/robots/image-ocr.ts @@ -7,9 +7,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -41,6 +41,14 @@ export const meta: RobotMeta = { title: 'Recognize text in images', typical_file_size_mb: 0.8, typical_file_type: 'image', + name: 'ImageOcrRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsd: 0.0013, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageOcrInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/image-optimize.ts b/src/alphalib/types/robots/image-optimize.ts index ed4b8b39..7c9f3f51 100644 --- a/src/alphalib/types/robots/image-optimize.ts +++ b/src/alphalib/types/robots/image-optimize.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -34,6 +34,13 @@ export const meta: RobotMeta = { title: 'Optimize images without quality loss', typical_file_size_mb: 0.8, typical_file_type: 'image', + name: 'ImageOptimizeRobot', + priceFactor: 1, + queueSlotCount: 15, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageOptimizeInstructionsSchema = robotBase @@ -44,10 +51,10 @@ With this Robot it's possible to reduce the file size of your JPEG, P This Robot enables you to lower your storage and bandwidth costs, and improves your user experience and monetization by reducing the load time of image-intensive web pages. -It works well together with [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/) to bring the full power of resized and optimized images to your website or app. +It works well together with [🤖/image/resize](/docs/robots/image-resize/) to bring the full power of resized and optimized images to your website or app. > [!Note] -> This Robot accepts all image types and will just pass on unsupported image types unoptimized. Hence, there is no need to set up [🤖/file/filter](/docs/transcoding/file-filtering/file-filter/) workflows for this. +> This Robot accepts all image types and will just pass on unsupported image types unoptimized. Hence, there is no need to set up [🤖/file/filter](/docs/robots/file-filter/) workflows for this. `), priority: optimize_priority.describe(` Provides different algorithms for better or worse compression for your images, but that run slower or faster. The value \`"conversion-speed"\` will result in an average compression ratio of 18%. \`"compression-ratio"\` will result in an average compression ratio of 31%. diff --git a/src/alphalib/types/robots/image-resize.ts b/src/alphalib/types/robots/image-resize.ts index b21b3e96..d52bb182 100644 --- a/src/alphalib/types/robots/image-resize.ts +++ b/src/alphalib/types/robots/image-resize.ts @@ -1,6 +1,6 @@ import { z } from 'zod' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { color_without_alpha, colorspaceSchema, @@ -16,7 +16,7 @@ import { interpolateRobot, } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -46,6 +46,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 0.8, typical_file_type: 'image', uses_tools: ['imagemagick'], + name: 'ImageResizeRobot', + priceFactor: 1, + queueSlotCount: 5, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotImageResizeInstructionsSchema = robotBase @@ -61,7 +68,7 @@ Some of the most important available formats are \`"jpg"\`, \`"png"\`, \`"gif"\` If \`null\` (default), then the input image's format will be used as the output format. -If you wish to convert to \`"pdf"\`, please consider [🤖/document/convert](/docs/transcoding/document-processing/document-convert/) instead. +If you wish to convert to \`"pdf"\`, please consider [🤖/document/convert](/docs/robots/document-convert/) instead. `), width: complexWidthSchema.optional().describe(` Width of the result in pixels. If not specified, will default to the width of the original. @@ -74,7 +81,7 @@ Height of the new image, in pixels. If not specified, will default to the height z.literal('crop') .describe(`Cuts an area out of an image, discarding any overlapping parts. If the source image is smaller than the crop frame, it will be zoomed. This strategy is implied when you specify coordinates in the \`crop\` parameter, and cannot be used without it. -To crop around human faces, see [🤖/image/facedetect](https://transloadit.com/docs/transcoding/artificial-intelligence/image-facedetect/) instead.`), +To crop around human faces, see [🤖/image/facedetect](https://transloadit.com/docs/robots/image-facedetect/) instead.`), z.literal('fillcrop') .describe(`Scales the image to fit into our 100×100 target while preserving aspect ratio, while trimming away any excess surface. This means both sides will become exactly 100 pixels, at the tradeoff of destroying parts of the image. @@ -98,10 +105,10 @@ In this example, the background color is determined by the [Assembly Variable](h ), ]) .default('fit').describe(` -See the list of available [resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +See the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies). `), zoom: z.boolean().default(true).describe(` -If this is set to \`false\`, smaller images will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +If this is set to \`false\`, smaller images will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies). `), crop: unsafeCoordinatesSchema.optional().describe(` Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). The coordinate system is rooted in the top left corner of the image. Values can be integers for absolute pixel values or strings for percentage based values. @@ -125,7 +132,7 @@ You can also use a JSON string of such an object with coordinates in similar fas "{"x1": , "y1": , "x2": , "y2": }" \`\`\` -To crop around human faces, see [🤖/image/facedetect](/docs/transcoding/artificial-intelligence/image-facedetect/). +To crop around human faces, see [🤖/image/facedetect](/docs/robots/image-facedetect/). `), gravity: positionSchema.default('center').describe(` The direction from which the image is to be cropped, when \`"resize_strategy"\` is set to \`"crop"\`, but no crop coordinates are defined. @@ -223,7 +230,7 @@ Determines whether the image should be rotated. Use integers to specify the rota .default(null).describe(` Specifies pixel compression for when the image is written. Compression is disabled by default. -Please also take a look at [🤖/image/optimize](/docs/transcoding/image-manipulation/image-optimize/). +Please also take a look at [🤖/image/optimize](/docs/robots/image-optimize/). `), blur: z .string() @@ -258,7 +265,7 @@ Increases or decreases the saturation of the image by using a multiplier. For ex Changes the hue by rotating the color of the image. The value \`100\` would produce no change whereas \`0\` and \`200\` will negate the colors in the image. `), watermark_url: z.string().optional().describe(` -A URL indicating a PNG image to be overlaid above this image. Please note that you can also [supply the watermark via another Assembly Step](/docs/transcoding/image-manipulation/image-resize/#image-resize-supply-watermark-via-assembly-step). With watermarking you can add an image onto another image. This is usually used for logos. +A URL indicating a PNG image to be overlaid above this image. Please note that you can also [supply the watermark via another Assembly Step](/docs/robots/image-resize/#image-resize-supply-watermark-via-assembly-step). With watermarking you can add an image onto another image. This is usually used for logos. `), watermark_position: z.union([positionSchema, z.array(positionSchema)]).default('center') .describe(` diff --git a/src/alphalib/types/robots/meta-read.ts b/src/alphalib/types/robots/meta-read.ts new file mode 100644 index 00000000..1a7a93ef --- /dev/null +++ b/src/alphalib/types/robots/meta-read.ts @@ -0,0 +1,29 @@ +import { z } from 'zod' + +import { interpolateRobot, robotBase, type RobotMetaInput } from './_instructions-primitives.ts' + +// @ts-expect-error - MetaReadRobot is not ready yet @TODO please supply missing keys +export const meta: RobotMetaInput = { + name: 'MetaReadRobot', + priceFactor: 0, + queueSlotCount: 15, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: true, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, +} + +export const robotMetaReadInstructionsSchema = robotBase + .extend({ + robot: z.literal('/meta/read').describe(`Reads metadata from a file.`), + }) + .strict() + +export type RobotMetaReadInstructions = z.infer + +export const interpolatableRobotMetaReadInstructionsSchema = interpolateRobot( + robotMetaReadInstructionsSchema, +) +export type InterpolatableRobotMetaReadInstructions = z.input< + typeof interpolatableRobotMetaReadInstructionsSchema +> diff --git a/src/alphalib/types/robots/meta-write.ts b/src/alphalib/types/robots/meta-write.ts index 46dcb5c5..ec77baba 100644 --- a/src/alphalib/types/robots/meta-write.ts +++ b/src/alphalib/types/robots/meta-write.ts @@ -1,10 +1,10 @@ import { z } from 'zod' import { robotFFmpeg, robotBase, robotUse, interpolateRobot } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -35,6 +35,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 1.2, typical_file_type: 'file', uses_tools: ['ffmpeg'], + name: 'MetaWriteRobot', + priceFactor: 1, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotMetaWriteInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/minio-import.ts b/src/alphalib/types/robots/minio-import.ts index 8be34b01..1ac3f6a0 100644 --- a/src/alphalib/types/robots/minio-import.ts +++ b/src/alphalib/types/robots/minio-import.ts @@ -11,9 +11,9 @@ import { robotBase, return_file_stubs, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from MinIO', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'MinioImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotMinioImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/minio-store.ts b/src/alphalib/types/robots/minio-store.ts index 58f8a1eb..edc24fc3 100644 --- a/src/alphalib/types/robots/minio-store.ts +++ b/src/alphalib/types/robots/minio-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, minioBase, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on MinIO:', + example_code_description: `Export uploaded files to \`my_target_folder\` on MinIO:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to MinIO', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'MinioStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotMinioStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/progress-simulate.ts b/src/alphalib/types/robots/progress-simulate.ts index b6d83a85..2ab87b80 100644 --- a/src/alphalib/types/robots/progress-simulate.ts +++ b/src/alphalib/types/robots/progress-simulate.ts @@ -1,6 +1,18 @@ import { z } from 'zod' import { interpolateRobot, robotBase } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' + +// @ts-expect-error - ProgressSimulateRobot is not ready yet @TODO please supply missing keys +export const meta: RobotMetaInput = { + name: 'ProgressSimulateRobot', + priceFactor: 1, + queueSlotCount: 20, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: true, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, +} export const robotProgressSimulateInstructionsSchema = robotBase .extend({ diff --git a/src/alphalib/types/robots/s3-import.ts b/src/alphalib/types/robots/s3-import.ts index 14e950ba..f6cdbf11 100644 --- a/src/alphalib/types/robots/s3-import.ts +++ b/src/alphalib/types/robots/s3-import.ts @@ -11,9 +11,9 @@ import { return_file_stubs, s3Base, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from Amazon S3', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'S3ImportRobot', + priceFactor: 10, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotS3ImportInstructionsSchema = robotBase @@ -58,7 +64,7 @@ The URL to the result file in your S3 bucket will be returned in the Assemb > [!Warning] > **Use DNS-compliant bucket names**. Your bucket name [must be DNS-compliant](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) and must not contain uppercase letters. Any non-alphanumeric characters in the file names will be replaced with an underscore, and spaces will be replaced with dashes. If your existing S3 bucket contains uppercase letters or is otherwise not DNS-compliant, rewrite the result URLs using the Robot’s \`url_prefix\` parameter. - + ## Limit access diff --git a/src/alphalib/types/robots/s3-store.ts b/src/alphalib/types/robots/s3-store.ts index 1053b541..7cea97ee 100644 --- a/src/alphalib/types/robots/s3-store.ts +++ b/src/alphalib/types/robots/s3-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse, s3Base } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` in an S3 bucket:', + example_code_description: `Export uploaded files to \`my_target_folder\` in an S3 bucket:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to Amazon S3', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'S3StoreRobot', + priceFactor: 10, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotS3StoreInstructionsSchema = robotBase @@ -49,7 +56,7 @@ The URL to the result file in your S3 bucket will be returned in the Assemb > [!Warning] > **Use DNS-compliant bucket names.** Your bucket name [must be DNS-compliant](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) and must not contain uppercase letters. Any non-alphanumeric characters in the file names will be replaced with an underscore, and spaces will be replaced with dashes. If your existing S3 bucket contains uppercase letters or is otherwise not DNS-compliant, rewrite the result URLs using the Robot’s \`url_prefix\` parameter. - + ## Limit access diff --git a/src/alphalib/types/robots/script-run.ts b/src/alphalib/types/robots/script-run.ts index 34d1417e..2f358a6f 100644 --- a/src/alphalib/types/robots/script-run.ts +++ b/src/alphalib/types/robots/script-run.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -20,6 +20,13 @@ export const meta: RobotMeta = { title: 'Run Scripts', typical_file_size_mb: 0.0001, typical_file_type: 'file', + name: 'ScriptRunRobot', + priceFactor: 10, + queueSlotCount: 5, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotScriptRunInstructionsSchema = robotBase @@ -71,7 +78,7 @@ A string of JavaScript to evaluate. It has access to all JavaScript features ava The script is expected to return a \`JSON.stringify\`-able value in the same tick, so no \`await\` or callbacks are allowed (yet). -If the script does not finish within 1000ms it times out with an error. The return value or error is exported as \`file.meta.result\`. If there was an error, \`file.meta.isError\` is \`true\`. Note that the Assembly will not crash in this case. If you need it to crash, you can check this value with a [🤖/file/filter](/docs/transcoding/file-filtering/file-filter/) Step, setting \`error_on_decline\` to \`true\`. +If the script does not finish within 1000ms it times out with an error. The return value or error is exported as \`file.meta.result\`. If there was an error, \`file.meta.isError\` is \`true\`. Note that the Assembly will not crash in this case. If you need it to crash, you can check this value with a [🤖/file/filter](/docs/robots/file-filter/) Step, setting \`error_on_decline\` to \`true\`. You can check whether evaluating this script was free by inspecting \`file.meta.isFree\`. It is recommended to do this during development as to not see sudden unexpected costs in production. `), diff --git a/src/alphalib/types/robots/sftp-import.ts b/src/alphalib/types/robots/sftp-import.ts index 416f7e93..2aad8a6a 100644 --- a/src/alphalib/types/robots/sftp-import.ts +++ b/src/alphalib/types/robots/sftp-import.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { robotImport, robotBase, sftpBase, interpolateRobot } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -17,8 +17,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, minimum_charge: 0, output_factor: 1, override_lvl1: 'File Importing', @@ -32,6 +31,13 @@ export const meta: RobotMeta = { title: 'Import files from SFTP servers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'SftpImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotSftpImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/sftp-store.ts b/src/alphalib/types/robots/sftp-store.ts index 82dedff2..670f3066 100644 --- a/src/alphalib/types/robots/sftp-store.ts +++ b/src/alphalib/types/robots/sftp-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse, sftpBase } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on an SFTP server:', + example_code_description: `Export uploaded files to \`my_target_folder\` on an SFTP server:`, minimum_charge: 0, output_factor: 1, override_lvl1: 'File Exporting', @@ -31,6 +31,13 @@ export const meta: RobotMeta = { title: 'Export files to SFTP servers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'SftpStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotSftpStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/speech-transcribe.ts b/src/alphalib/types/robots/speech-transcribe.ts index 8a635cda..d65b21f0 100644 --- a/src/alphalib/types/robots/speech-transcribe.ts +++ b/src/alphalib/types/robots/speech-transcribe.ts @@ -7,9 +7,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -43,6 +43,17 @@ export const meta: RobotMeta = { title: 'Transcribe speech in audio or video files', typical_file_size_mb: 2.4, typical_file_type: 'audio or video file', + name: 'SpeechTranscribeRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsdPerSpeechTranscribeMinute: { + aws: 0.024, + gcp: 0.016, + }, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotSpeechTranscribeInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/supabase-import.ts b/src/alphalib/types/robots/supabase-import.ts index 7ff80bb8..3e83227b 100644 --- a/src/alphalib/types/robots/supabase-import.ts +++ b/src/alphalib/types/robots/supabase-import.ts @@ -11,9 +11,9 @@ import { supabaseBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from Supabase', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'SupabaseImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotSupabaseImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/supabase-store.ts b/src/alphalib/types/robots/supabase-store.ts index c09134e6..fa3e955f 100644 --- a/src/alphalib/types/robots/supabase-store.ts +++ b/src/alphalib/types/robots/supabase-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse, supabaseBase } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on supabase R2:', + example_code_description: `Export uploaded files to \`my_target_folder\` on supabase R2:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to Supabase', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'SupabaseStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, + isInternal: false, } export const robotSupabaseStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/swift-import.ts b/src/alphalib/types/robots/swift-import.ts index 38ac9a7d..bdcf9a08 100644 --- a/src/alphalib/types/robots/swift-import.ts +++ b/src/alphalib/types/robots/swift-import.ts @@ -11,9 +11,9 @@ import { swiftBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from Openstack/Swift', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'SwiftImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotSwiftImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/swift-store.ts b/src/alphalib/types/robots/swift-store.ts index be1a3b6e..b678d7f6 100644 --- a/src/alphalib/types/robots/swift-store.ts +++ b/src/alphalib/types/robots/swift-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse, swiftBase } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Swift:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Swift:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to OpenStack Swift Spaces', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'SwiftStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotSwiftStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/text-speak.ts b/src/alphalib/types/robots/text-speak.ts index a382caca..384e3037 100644 --- a/src/alphalib/types/robots/text-speak.ts +++ b/src/alphalib/types/robots/text-speak.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -66,6 +66,14 @@ export const meta: RobotMeta = { title: 'Speak text', typical_file_size_mb: 1, typical_file_type: 'document', + name: 'TextSpeakRobot', + priceFactor: 1, + queueSlotCount: 10, + minimumChargeUsd: 0.05, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotTextSpeakInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/text-translate.ts b/src/alphalib/types/robots/text-translate.ts index 86cf5fb6..2356ddd1 100644 --- a/src/alphalib/types/robots/text-translate.ts +++ b/src/alphalib/types/robots/text-translate.ts @@ -6,9 +6,9 @@ import { robotBase, robotUse, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 1, discount_factor: 1, @@ -53,6 +53,13 @@ export const meta: RobotMeta = { title: 'Translate text', typical_file_size_mb: 1, typical_file_type: 'document', + name: 'TextTranslateRobot', + priceFactor: 0.00008, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } const translatableLanguages = z @@ -181,7 +188,7 @@ export const robotTextTranslateInstructionsSchema = robotBase You can use the text that we return in your application, or you can pass the text down to other Robots to add a translated subtitle track to a video for example. > [!Note] -> **This Robot accepts only files with a \`text/*\` MIME-type,** including plain text and Markdown. For documents in other formats, use [🤖/document/convert](/docs/transcoding/document-processing/document-convert/) to first convert them into a compatible text format before proceeding. +> **This Robot accepts only files with a \`text/*\` MIME-type,** including plain text and Markdown. For documents in other formats, use [🤖/document/convert](/docs/robots/document-convert/) to first convert them into a compatible text format before proceeding. `), provider: aiProviderSchema.describe(` Which AI provider to leverage. Valid values are \`"aws"\` (Amazon Web Services) and \`"gcp"\` (Google Cloud Platform). diff --git a/src/alphalib/types/robots/tigris-import.ts b/src/alphalib/types/robots/tigris-import.ts index 323659bc..b150aab5 100644 --- a/src/alphalib/types/robots/tigris-import.ts +++ b/src/alphalib/types/robots/tigris-import.ts @@ -11,9 +11,9 @@ import { robotImport, tigrisBase, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from Tigris', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'TigrisImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotTigrisImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/tigris-store.ts b/src/alphalib/types/robots/tigris-store.ts index a144c22b..b1809a98 100644 --- a/src/alphalib/types/robots/tigris-store.ts +++ b/src/alphalib/types/robots/tigris-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse, tigrisBase } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Tigris:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Tigris:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to Tigris', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'TigrisStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotTigrisStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/tlcdn-deliver.ts b/src/alphalib/types/robots/tlcdn-deliver.ts index 5ee03e58..366c0901 100644 --- a/src/alphalib/types/robots/tlcdn-deliver.ts +++ b/src/alphalib/types/robots/tlcdn-deliver.ts @@ -1,8 +1,8 @@ import { z } from 'zod' -import { interpolateRobot, robotBase, type RobotMeta } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase, type RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 20, discount_factor: 0.05, @@ -19,6 +19,16 @@ export const meta: RobotMeta = { title: 'Cache and deliver files globally', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'TlcdnDeliverRobot', + priceFactor: 20, + queueSlotCount: 0, + minimumCharge: 102400, + downloadInputFiles: false, + preserveInputFileUrls: true, + isAllowedForUrlTransform: false, + trackOutputFileSize: false, + isInternal: true, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotTlcdnDeliverInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/tus-store.ts b/src/alphalib/types/robots/tus-store.ts index 40a77c68..ce579655 100644 --- a/src/alphalib/types/robots/tus-store.ts +++ b/src/alphalib/types/robots/tus-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -30,6 +30,13 @@ export const meta: RobotMeta = { title: 'Export files to Tus-compatible servers', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'TusStoreRobot', + priceFactor: 10, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotTusStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/upload-handle.ts b/src/alphalib/types/robots/upload-handle.ts index 3465ed17..64d56b51 100644 --- a/src/alphalib/types/robots/upload-handle.ts +++ b/src/alphalib/types/robots/upload-handle.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 10, discount_factor: 0.1, @@ -34,6 +34,15 @@ export const meta: RobotMeta = { title: 'Handle uploads', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'UploadHandleRobot', + priceFactor: 10, + queueSlotCount: 0, + downloadInputFiles: false, + preserveInputFileUrls: true, + isAllowedForUrlTransform: false, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotUploadHandleInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/video-adaptive.ts b/src/alphalib/types/robots/video-adaptive.ts index f00aa6df..925061e8 100644 --- a/src/alphalib/types/robots/video-adaptive.ts +++ b/src/alphalib/types/robots/video-adaptive.ts @@ -6,10 +6,10 @@ import { robotFFmpegVideo, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: Infinity, discount_factor: 1, @@ -63,6 +63,13 @@ export const meta: RobotMeta = { title: 'Convert videos to HLS and MPEG-Dash', typical_file_size_mb: 80, typical_file_type: 'video', + name: 'VideoAdaptiveRobot', + priceFactor: 1, + queueSlotCount: 60, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoAdaptiveInstructionsSchema = robotBase @@ -72,7 +79,7 @@ export const robotVideoAdaptiveInstructionsSchema = robotBase robot: z.literal('/video/adaptive').describe(` This Robot accepts all types of video files and audio files. Do not forget to use Step bundling in your \`use\` parameter to make the Robot work on several input files at once. -This Robot is normally used in combination with [🤖/video/encode](/docs/transcoding/video-encoding/video-encode/). We have implemented video and audio encoding presets specifically for MPEG-Dash and HTTP Live Streaming support. These presets are prefixed with \`"dash/"\` and \`"hls/"\`. [View a HTTP Live Streaming demo here](/demos/video-encoding/implement-http-live-streaming/). +This Robot is normally used in combination with [🤖/video/encode](/docs/robots/video-encode/). We have implemented video and audio encoding presets specifically for MPEG-Dash and HTTP Live Streaming support. These presets are prefixed with \`"dash/"\` and \`"hls/"\`. [View a HTTP Live Streaming demo here](/demos/video-encoding/implement-http-live-streaming/). ### Required CORS settings for MPEG-Dash and HTTP Live Streaming diff --git a/src/alphalib/types/robots/video-concat.ts b/src/alphalib/types/robots/video-concat.ts index 50449f24..a3db6fab 100644 --- a/src/alphalib/types/robots/video-concat.ts +++ b/src/alphalib/types/robots/video-concat.ts @@ -6,9 +6,9 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 4, discount_factor: 0.25, @@ -19,16 +19,27 @@ export const meta: RobotMeta = { robot: '/video/concat', use: { steps: [ - { name: ':original', fields: 'first_video_file', as: 'video_1' }, - { name: ':original', fields: 'second_video_file', as: 'video_2' }, - { name: ':original', fields: 'third_video_file', as: 'video_3' }, + { + name: ':original', + fields: 'first_video_file', + as: 'video_1', + }, + { + name: ':original', + fields: 'second_video_file', + as: 'video_2', + }, + { + name: ':original', + fields: 'third_video_file', + as: 'video_3', + }, ], }, }, }, }, - example_code_description: - 'If you have a form with 3 file input fields and want to concatenate the uploaded videos in a specific order, instruct Transloadit using the `name` attribute of each input field. Use this attribute as the value for the `fields` key in the JSON, and set `as` to `video_[[index]]`. Transloadit will concatenate the files based on the ascending index order:', + example_code_description: `If you have a form with 3 file input fields and want to concatenate the uploaded videos in a specific order, instruct Transloadit using the \`name\` attribute of each input field. Use this attribute as the value for the \`fields\` key in the JSON, and set \`as\` to \`video_[[index]]\`. Transloadit will concatenate the files based on the ascending index order:`, minimum_charge: 0, output_factor: 0.6, override_lvl1: 'Video Encoding', @@ -42,6 +53,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 80, typical_file_type: 'video', uses_tools: ['ffmpeg'], + name: 'VideoConcatRobot', + priceFactor: 4, + queueSlotCount: 60, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoConcatInstructionsSchema = robotBase @@ -49,22 +67,22 @@ export const robotVideoConcatInstructionsSchema = robotBase .merge(robotFFmpegVideo) .extend({ robot: z.literal('/video/concat').describe(` -> [!Warning] -> All videos you concatenate must have the same dimensions (width and height) and the same streams (audio and video streams), otherwise you will run into errors. If your videos donʼt have the desired dimensions when passing them to [🤖/video/concat](/docs/transcoding/video-encoding/video-concat/), encode them first with [🤖/video/encode](/docs/transcoding/video-encoding/video-encode/). +> [!Note] +> Input videos may have differing dimensions and streams - the Robot can handle this fine. It will pre-transcode the input videos if necessary before concatenation at no additional cost. -Itʼs possible to concatenate a virtually infinite number of video files using [🤖/video/concat](/docs/transcoding/video-encoding/video-concat/). +Itʼs possible to concatenate a virtually infinite number of video files using [🤖/video/concat](/docs/robots/video-concat/). `), video_fade_seconds: z.number().default(1).describe(` When used this adds a video fade in and out effect between each section of your concatenated video. The float value is used so if you want a video delay effect of 500 milliseconds between each video section you would select \`0.5\`, however, integer values can also be represented. -This parameter does not add a video fade effect at the beginning or end of your video. If you want to do so, create an additional [🤖/video/encode](/docs/transcoding/video-encoding/video-presets/) Step and use our \`ffmpeg\` parameter as shown in this [demo](/demos/video-encoding/concatenate-fade-effect/). +This parameter does not add a video fade effect at the beginning or end of your video. If you want to do so, create an additional [🤖/video/encode](/docs/robots/video-encode/) Step and use our \`ffmpeg\` parameter as shown in this [demo](/demos/video-encoding/concatenate-fade-effect/). Please note this parameter is independent of adding audio fades between sections. `), audio_fade_seconds: z.number().default(1).describe(` When used this adds an audio fade in and out effect between each section of your concatenated video. The float value is used so if you want an audio delay effect of 500 milliseconds between each video section you would select \`0.5\`, however, integer values can also be represented. -This parameter does not add an audio fade effect at the beginning or end of your video. If you want to do so, create an additional [🤖/video/encode](/docs/transcoding/video-encoding/video-presets/) Step and use our \`ffmpeg\` parameter as shown in this [demo](/demos/audio-encoding/ffmpeg-fade-in-and-out/). +This parameter does not add an audio fade effect at the beginning or end of your video. If you want to do so, create an additional [🤖/video/encode](/docs/robots/video-encode/] Step and use our \`ffmpeg\` parameter as shown in this [demo](/demos/audio-encoding/ffmpeg-fade-in-and-out/). Please note this parameter is independent of adding video fades between sections. `), diff --git a/src/alphalib/types/robots/video-encode.ts b/src/alphalib/types/robots/video-encode.ts index 45316b1a..92d9a210 100644 --- a/src/alphalib/types/robots/video-encode.ts +++ b/src/alphalib/types/robots/video-encode.ts @@ -6,9 +6,9 @@ import { interpolateRobot, videoEncodeSpecificInstructionsSchema, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 1, discount_factor: 1, @@ -37,6 +37,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 80, typical_file_type: 'video', uses_tools: ['ffmpeg'], + name: 'VideoEncodeRobot', + priceFactor: 1, + queueSlotCount: 60, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoEncodeInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/video-merge.ts b/src/alphalib/types/robots/video-merge.ts index 805893e6..121b4a12 100644 --- a/src/alphalib/types/robots/video-merge.ts +++ b/src/alphalib/types/robots/video-merge.ts @@ -8,9 +8,9 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 1, discount_factor: 1, @@ -29,6 +29,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 80, typical_file_type: 'video', uses_tools: ['ffmpeg'], + name: 'VideoMergeRobot', + priceFactor: 1, + queueSlotCount: 60, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoMergeInstructionsSchema = robotBase @@ -37,7 +44,7 @@ export const robotVideoMergeInstructionsSchema = robotBase .extend({ robot: z.literal('/video/merge'), resize_strategy: resize_strategy.describe(` -If the given width/height parameters are bigger than the input image's dimensions, then the \`resize_strategy\` determines how the image will be resized to match the provided width/height. See the [available resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +If the given width/height parameters are bigger than the input image's dimensions, then the \`resize_strategy\` determines how the image will be resized to match the provided width/height. See the [available resize strategies](/docs/robots/image-resize/#resize-strategies). `), background: color_with_alpha.default('#00000000').describe(` The background color of the resulting video the \`"rrggbbaa"\` format (red, green, blue, alpha) when used with the \`"pad"\` resize strategy. The default color is black. @@ -66,7 +73,7 @@ When merging a video and an audio file, and when merging images and an audio fil Determines whether the audio of the video should be replaced with a provided audio file. `), vstack: z.boolean().default(false).describe(` -Stacks the input media vertically. All streams need to have the same pixel format and width - so consider using a [/video/encode](/docs/transcoding/video-encoding/video-encode/) Step before using this parameter to enforce this. +Stacks the input media vertically. All streams need to have the same pixel format and width - so consider using a [/video/encode](/docs/robots/video-encode/) Step before using this parameter to enforce this. `), }) .strict() diff --git a/src/alphalib/types/robots/video-ondemand.ts b/src/alphalib/types/robots/video-ondemand.ts index d75004aa..76094377 100644 --- a/src/alphalib/types/robots/video-ondemand.ts +++ b/src/alphalib/types/robots/video-ondemand.ts @@ -1,6 +1,6 @@ import { z } from 'zod' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { interpolateRobot, robotBase, @@ -8,7 +8,7 @@ import { videoEncodeSpecificInstructionsSchema, } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, discount_factor: 1, discount_pct: 0, @@ -60,6 +60,14 @@ export const meta: RobotMeta = { title: 'Stream videos with on-demand encoding', typical_file_size_mb: 300, typical_file_type: 'video', + name: 'VideoOndemandRobot', + priceFactor: 1, + queueSlotCount: 60, + downloadInputFiles: false, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoOndemandInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/video-subtitle.ts b/src/alphalib/types/robots/video-subtitle.ts index da1b88db..94dc2b0d 100644 --- a/src/alphalib/types/robots/video-subtitle.ts +++ b/src/alphalib/types/robots/video-subtitle.ts @@ -9,10 +9,10 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 1, discount_factor: 1, @@ -23,16 +23,23 @@ export const meta: RobotMeta = { robot: '/video/subtitle', use: { steps: [ - { name: ':original', fields: 'input_video', as: 'video' }, - { name: ':original', fields: 'input_srt', as: 'subtitles' }, + { + name: ':original', + fields: 'input_video', + as: 'video', + }, + { + name: ':original', + fields: 'input_srt', + as: 'subtitles', + }, ], }, ffmpeg_stack: stackVersions.ffmpeg.recommendedVersion, }, }, }, - example_code_description: - 'If you have two file input fields in a form — one for a video and another for an SRT or VTT subtitle, named `input_video` and `input_srt` respectively (with the HTML `name` attribute), hereʼs how to embed the subtitles into the video with Transloadit:', + example_code_description: `If you have two file input fields in a form — one for a video and another for an SRT or VTT subtitle, named \`input_video\` and \`input_srt\` respectively (with the HTML \`name\` attribute), hereʼs how to embed the subtitles into the video with Transloadit:`, minimum_charge: 0, output_factor: 0.6, override_lvl1: 'Video Encoding', @@ -46,6 +53,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 80, typical_file_type: 'video', uses_tools: ['ffmpeg'], + name: 'VideoSubtitleRobot', + priceFactor: 1, + queueSlotCount: 60, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoSubtitleInstructionsSchema = robotBase @@ -81,6 +95,12 @@ Specifies the size of the text. `), position: positionSchema.default('bottom').describe(` Specifies the position of the subtitles. +`), + language: z.string().optional().nullable().describe(` +Specifies the language of the subtitles. Only used if the subtitles are external. +`), + keep_subtitles: z.boolean().default(false).describe(` +Specifies if existing subtitles in the input file should be kept or be replaced by the new subtitle. Only used if the subtitles are external. `), }) .strict() diff --git a/src/alphalib/types/robots/video-thumbs.ts b/src/alphalib/types/robots/video-thumbs.ts index 261ce346..3c10ca5b 100644 --- a/src/alphalib/types/robots/video-thumbs.ts +++ b/src/alphalib/types/robots/video-thumbs.ts @@ -9,10 +9,10 @@ import { robotUse, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' import { stackVersions } from '../stackVersions.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: false, bytescount: 10, discount_factor: 0.1, @@ -41,6 +41,13 @@ export const meta: RobotMeta = { typical_file_size_mb: 80, typical_file_type: 'video', uses_tools: ['ffmpeg'], + name: 'VideoThumbsRobot', + priceFactor: 10, + queueSlotCount: 15, + isAllowedForUrlTransform: false, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVideoThumbsInstructionsSchema = robotBase @@ -73,7 +80,7 @@ The width of the thumbnail, in pixels. Defaults to the original width of the vid The height of the thumbnail, in pixels. Defaults to the original height of the video. `), resize_strategy: resize_strategy.describe(` -One of the [available resize strategies](/docs/transcoding/image-manipulation/image-resize/#resize-strategies). +One of the [available resize strategies](/docs/robots/image-resize/#resize-strategies). `), background: color_with_alpha.default('#00000000').describe(` The background color of the resulting thumbnails in the \`"rrggbbaa"\` format (red, green, blue, alpha) when used with the \`"pad"\` resize strategy. The default color is black. diff --git a/src/alphalib/types/robots/vimeo-store.ts b/src/alphalib/types/robots/vimeo-store.ts index 7b5961ec..47e15a8b 100644 --- a/src/alphalib/types/robots/vimeo-store.ts +++ b/src/alphalib/types/robots/vimeo-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -33,6 +33,13 @@ export const meta: RobotMeta = { title: 'Export files to Vimeo', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'VimeoStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotVimeoStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/wasabi-import.ts b/src/alphalib/types/robots/wasabi-import.ts index 2383503f..9c8c9d08 100644 --- a/src/alphalib/types/robots/wasabi-import.ts +++ b/src/alphalib/types/robots/wasabi-import.ts @@ -11,9 +11,9 @@ import { wasabiBase, interpolateRobot, } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 10, discount_factor: 0.1, @@ -28,8 +28,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: - 'Import files from the `path/to/files` directory and its subdirectories:', + example_code_description: `Import files from the \`path/to/files\` directory and its subdirectories:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -44,6 +43,13 @@ export const meta: RobotMeta = { title: 'Import files from Wasabi', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'WasabiImportRobot', + priceFactor: 6.6666, + queueSlotCount: 20, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: true, } export const robotWasabiImportInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/wasabi-store.ts b/src/alphalib/types/robots/wasabi-store.ts index a7052a31..ab3fc4dc 100644 --- a/src/alphalib/types/robots/wasabi-store.ts +++ b/src/alphalib/types/robots/wasabi-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse, wasabiBase } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -18,7 +18,7 @@ export const meta: RobotMeta = { }, }, }, - example_code_description: 'Export uploaded files to `my_target_folder` on Wasabi:', + example_code_description: `Export uploaded files to \`my_target_folder\` on Wasabi:`, has_small_icon: true, minimum_charge: 0, output_factor: 1, @@ -32,6 +32,13 @@ export const meta: RobotMeta = { title: 'Export files to Wasabi', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'WasabiStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotWasabiStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/robots/youtube-store.ts b/src/alphalib/types/robots/youtube-store.ts index e87e3bc3..2f137eef 100644 --- a/src/alphalib/types/robots/youtube-store.ts +++ b/src/alphalib/types/robots/youtube-store.ts @@ -1,9 +1,9 @@ import { z } from 'zod' import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' -import type { RobotMeta } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' -export const meta: RobotMeta = { +export const meta: RobotMetaInput = { allowed_for_url_transform: true, bytescount: 6, discount_factor: 0.15000150001500018, @@ -35,6 +35,13 @@ export const meta: RobotMeta = { title: 'Export files to YouTube', typical_file_size_mb: 1.2, typical_file_type: 'file', + name: 'YoutubeStoreRobot', + priceFactor: 6.6666, + queueSlotCount: 10, + isAllowedForUrlTransform: true, + trackOutputFileSize: false, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, } export const robotYoutubeStoreInstructionsSchema = robotBase diff --git a/src/alphalib/types/template.ts b/src/alphalib/types/template.ts index 4e585d6d..d60b5e51 100644 --- a/src/alphalib/types/template.ts +++ b/src/alphalib/types/template.ts @@ -6,7 +6,7 @@ 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/transcoding/) to use'), + robot: z.string().describe('The [robot](https://transloadit.com/docs/robots/) to use'), }) .and(robotsSchema) export const stepsSchema = z.record(stepSchema).describe('Contains Assembly Instructions.') @@ -20,7 +20,7 @@ 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/transcoding/) to use'), + robot: z.string().describe('The [robot](https://transloadit.com/docs/robots/) to use'), }) .and(robotsWithHiddenBotsAndFieldsSchema) export const stepsSchemaWithHiddenFields = z diff --git a/tsconfig.build.json b/tsconfig.build.json index d1fcfedb..3a420fc0 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -2,9 +2,9 @@ "include": ["src"], "exclude": ["test", "coverage", "dist", "examples"], "compilerOptions": { - "composite": true, - "declaration": true, - "declarationMap": true, + "declaration": false, + "declarationMap": false, + "noEmit": true, "erasableSyntaxOnly": true, "isolatedModules": true, "module": "NodeNext", @@ -15,6 +15,9 @@ "resolveJsonModule": true, "rootDir": "src", "sourceMap": true, - "strict": true + "strict": true, + "skipLibCheck": true, + "allowJs": true, + "noUnusedLocals": true } } diff --git a/tsconfig.json b/tsconfig.json index 9bfcae0b..0ed9af2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,10 @@ { - "exclude": ["dist", "src", "coverage"], - "references": [{ "path": "./tsconfig.build.json" }], + "extends": "./tsconfig.build.json", + "include": ["src", "test", "examples"], "compilerOptions": { - "checkJs": true, - "erasableSyntaxOnly": true, - "isolatedModules": true, - "module": "NodeNext", - "noImplicitOverride": true, - "rewriteRelativeImportExtensions": true, - "noEmit": true, - "resolveJsonModule": true, - "strict": true, - "types": ["vitest/globals"] + "noEmit": false, + "declaration": false, + "outDir": "dist", + "rootDir": "src" } } diff --git a/yarn.lock b/yarn.lock index 710f9cfe..e76b6265 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6852,12 +6852,12 @@ __metadata: p-retry: "npm:^6.2.1" prettier: "npm:^3.5.3" temp: "npm:^0.9.4" - tsx: "npm:^4.20.1" + tsx: "npm:^4.20.3" tus-js-client: "npm:^4.3.1" type-fest: "npm:^4.41.0" typescript: "npm:^5.8.3" vitest: "npm:^3.1.3" - zod: "npm:^3.25.61" + zod: "npm:^3.25.76" languageName: unknown linkType: soft @@ -6889,9 +6889,9 @@ __metadata: languageName: node linkType: hard -"tsx@npm:^4.20.1": - version: 4.20.1 - resolution: "tsx@npm:4.20.1" +"tsx@npm:^4.20.3": + version: 4.20.3 + resolution: "tsx@npm:4.20.3" dependencies: esbuild: "npm:~0.25.0" fsevents: "npm:~2.3.3" @@ -6901,7 +6901,7 @@ __metadata: optional: true bin: tsx: dist/cli.mjs - checksum: 10c0/10f861c66d13fcdcae1d4203f06c682d4c4beadb915d644aa198dfac49be18496e6e26daf5f693be87cf2776c1a883abb21e811f77ffd5b0a5cdd41d49c8cd52 + checksum: 10c0/6ff0d91ed046ec743fac7ed60a07f3c025e5b71a5aaf58f3d2a6b45e4db114c83e59ebbb078c8e079e48d3730b944a02bc0de87695088aef4ec8bbc705dc791b languageName: node linkType: hard @@ -7413,9 +7413,9 @@ __metadata: languageName: node linkType: hard -"zod@npm:^3.25.61": - version: 3.25.61 - resolution: "zod@npm:3.25.61" - checksum: 10c0/45386e88c52b5946dbe22c95fe45f3e7c1c90c4fba8cd7b8ce4e6cf0a79c987026990cbb082c54bb2926be35ed49947f351f05b35d6507aa17c23c088a5f4667 +"zod@npm:^3.25.76": + version: 3.25.76 + resolution: "zod@npm:3.25.76" + checksum: 10c0/5718ec35e3c40b600316c5b4c5e4976f7fee68151bc8f8d90ec18a469be9571f072e1bbaace10f1e85cf8892ea12d90821b200e980ab46916a6166a4260a983c languageName: node linkType: hard