From cac180c715da94398e53d4558ebaf4a1223d8ff9 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Tue, 30 Sep 2025 17:51:08 +0200 Subject: [PATCH] w --- package.json | 2 +- .../types/robots/assembly-savejson.ts | 4 +- src/alphalib/types/robots/audio-concat.ts | 5 +- src/alphalib/types/robots/audio-encode.ts | 2 +- src/alphalib/types/robots/audio-merge.ts | 3 +- src/alphalib/types/robots/audio-waveform.ts | 3 +- src/alphalib/types/robots/azure-import.ts | 3 +- src/alphalib/types/robots/azure-store.ts | 2 +- src/alphalib/types/robots/backblaze-import.ts | 3 +- src/alphalib/types/robots/backblaze-store.ts | 2 +- .../types/robots/cloudfiles-import.ts | 3 +- src/alphalib/types/robots/cloudfiles-store.ts | 2 +- .../types/robots/cloudflare-import.ts | 3 +- src/alphalib/types/robots/cloudflare-store.ts | 2 +- .../types/robots/digitalocean-import.ts | 3 +- .../types/robots/digitalocean-store.ts | 2 +- src/alphalib/types/robots/dropbox-import.ts | 3 +- src/alphalib/types/robots/dropbox-store.ts | 2 +- src/alphalib/types/robots/edgly-deliver.ts | 4 +- src/alphalib/types/robots/file-decompress.ts | 9 ++ src/alphalib/types/robots/file-verify.ts | 3 +- src/alphalib/types/robots/ftp-import.ts | 3 +- src/alphalib/types/robots/ftp-store.ts | 2 +- src/alphalib/types/robots/google-import.ts | 3 +- src/alphalib/types/robots/google-store.ts | 4 +- src/alphalib/types/robots/meta-read.ts | 6 +- src/alphalib/types/robots/minio-import.ts | 3 +- src/alphalib/types/robots/minio-store.ts | 2 +- src/alphalib/types/robots/s3-import.ts | 3 +- src/alphalib/types/robots/s3-store.ts | 2 +- src/alphalib/types/robots/sftp-import.ts | 3 +- src/alphalib/types/robots/sftp-store.ts | 2 +- src/alphalib/types/robots/supabase-import.ts | 3 +- src/alphalib/types/robots/supabase-store.ts | 2 +- src/alphalib/types/robots/swift-import.ts | 3 +- src/alphalib/types/robots/swift-store.ts | 2 +- src/alphalib/types/robots/tigris-import.ts | 5 +- src/alphalib/types/robots/tigris-store.ts | 4 +- src/alphalib/types/robots/tlcdn-deliver.ts | 4 +- src/alphalib/types/robots/video-concat.ts | 3 +- src/alphalib/types/robots/video-encode.ts | 50 +++++++++- src/alphalib/types/robots/video-subtitle.ts | 3 +- src/alphalib/types/robots/vimeo-import.ts | 2 +- src/alphalib/types/robots/wasabi-import.ts | 5 +- src/alphalib/types/robots/wasabi-store.ts | 2 +- src/alphalib/zodParseWithContext.ts | 8 +- yarn.lock | 98 ++----------------- 47 files changed, 145 insertions(+), 147 deletions(-) diff --git a/package.json b/package.json index 0b6c6e09..f0252030 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "mp3" ], "author": "Tim Koschuetzki ", - "packageManager": "yarn@4.9.4", + "packageManager": "yarn@4.10.3", "engines": { "node": ">= 20" }, diff --git a/src/alphalib/types/robots/assembly-savejson.ts b/src/alphalib/types/robots/assembly-savejson.ts index f4641f67..59c9038b 100644 --- a/src/alphalib/types/robots/assembly-savejson.ts +++ b/src/alphalib/types/robots/assembly-savejson.ts @@ -1,6 +1,6 @@ import { z } from 'zod' - -import { interpolateRobot, type RobotMetaInput, robotBase } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase } from './_instructions-primitives.ts' // @ts-expect-error - AssemblySavejsonRobot is not ready yet @TODO please supply missing keys export const meta: RobotMetaInput = { diff --git a/src/alphalib/types/robots/audio-concat.ts b/src/alphalib/types/robots/audio-concat.ts index 91e3cc39..7512573f 100644 --- a/src/alphalib/types/robots/audio-concat.ts +++ b/src/alphalib/types/robots/audio-concat.ts @@ -44,7 +44,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', @@ -74,7 +75,7 @@ export const robotAudioConcatInstructionsSchema = robotBase result: z .boolean() .optional() - .describe(`Whether the results of this Step should be present in the Assembly Status JSON`), + .describe('Whether the results of this Step should be present in the Assembly Status JSON'), robot: z.literal('/audio/concat').describe(` This Robot can concatenate an almost infinite number of audio files. `), diff --git a/src/alphalib/types/robots/audio-encode.ts b/src/alphalib/types/robots/audio-encode.ts index 1f7f6013..a037daa2 100644 --- a/src/alphalib/types/robots/audio-encode.ts +++ b/src/alphalib/types/robots/audio-encode.ts @@ -58,7 +58,7 @@ export const robotAudioEncodeInstructionsSchema = robotBase result: z .boolean() .optional() - .describe(`Whether the results of this Step should be present in the Assembly Status JSON`), + .describe('Whether the results of this Step should be present in the Assembly Status JSON'), robot: z.literal('/audio/encode'), bitrate: bitrateSchema.optional().describe(` Bit rate of the resulting audio file, in bits per second. If not specified will default to the bit rate of the input audio file. diff --git a/src/alphalib/types/robots/audio-merge.ts b/src/alphalib/types/robots/audio-merge.ts index 51921ff9..6be7fd86 100644 --- a/src/alphalib/types/robots/audio-merge.ts +++ b/src/alphalib/types/robots/audio-merge.ts @@ -45,7 +45,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/audio-waveform.ts b/src/alphalib/types/robots/audio-waveform.ts index 170ae1a0..f5de78f9 100644 --- a/src/alphalib/types/robots/audio-waveform.ts +++ b/src/alphalib/types/robots/audio-waveform.ts @@ -26,7 +26,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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: diff --git a/src/alphalib/types/robots/azure-import.ts b/src/alphalib/types/robots/azure-import.ts index 5e75461f..197a6155 100644 --- a/src/alphalib/types/robots/azure-import.ts +++ b/src/alphalib/types/robots/azure-import.ts @@ -26,7 +26,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/azure-store.ts b/src/alphalib/types/robots/azure-store.ts index 8e6d685d..25788c0c 100644 --- a/src/alphalib/types/robots/azure-store.ts +++ b/src/alphalib/types/robots/azure-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/backblaze-import.ts b/src/alphalib/types/robots/backblaze-import.ts index 19667c30..6225053e 100644 --- a/src/alphalib/types/robots/backblaze-import.ts +++ b/src/alphalib/types/robots/backblaze-import.ts @@ -26,7 +26,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/backblaze-store.ts b/src/alphalib/types/robots/backblaze-store.ts index c1b908de..c1a3a9a2 100644 --- a/src/alphalib/types/robots/backblaze-store.ts +++ b/src/alphalib/types/robots/backblaze-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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 diff --git a/src/alphalib/types/robots/cloudfiles-import.ts b/src/alphalib/types/robots/cloudfiles-import.ts index 2132beb7..e5d9efa8 100644 --- a/src/alphalib/types/robots/cloudfiles-import.ts +++ b/src/alphalib/types/robots/cloudfiles-import.ts @@ -26,7 +26,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/cloudfiles-store.ts b/src/alphalib/types/robots/cloudfiles-store.ts index 4ba26be7..384ee17c 100644 --- a/src/alphalib/types/robots/cloudfiles-store.ts +++ b/src/alphalib/types/robots/cloudfiles-store.ts @@ -23,7 +23,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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: ` diff --git a/src/alphalib/types/robots/cloudflare-import.ts b/src/alphalib/types/robots/cloudflare-import.ts index 36dfa806..73626b9d 100644 --- a/src/alphalib/types/robots/cloudflare-import.ts +++ b/src/alphalib/types/robots/cloudflare-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/cloudflare-store.ts b/src/alphalib/types/robots/cloudflare-store.ts index 839a267d..8268830c 100644 --- a/src/alphalib/types/robots/cloudflare-store.ts +++ b/src/alphalib/types/robots/cloudflare-store.ts @@ -23,7 +23,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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. `, diff --git a/src/alphalib/types/robots/digitalocean-import.ts b/src/alphalib/types/robots/digitalocean-import.ts index 59fcb43f..5126f34f 100644 --- a/src/alphalib/types/robots/digitalocean-import.ts +++ b/src/alphalib/types/robots/digitalocean-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/digitalocean-store.ts b/src/alphalib/types/robots/digitalocean-store.ts index 82fa0be3..6d8d92b3 100644 --- a/src/alphalib/types/robots/digitalocean-store.ts +++ b/src/alphalib/types/robots/digitalocean-store.ts @@ -23,7 +23,7 @@ export const meta: RobotMetaInput = { }, }, }, - example_code_description: `Export uploaded files to \`my_target_folder\` on DigitalOcean Spaces:`, + example_code_description: 'Export uploaded files to `my_target_folder` on DigitalOcean Spaces:', has_small_icon: true, minimum_charge: 0, output_factor: 1, diff --git a/src/alphalib/types/robots/dropbox-import.ts b/src/alphalib/types/robots/dropbox-import.ts index 79f0927b..cb3e4582 100644 --- a/src/alphalib/types/robots/dropbox-import.ts +++ b/src/alphalib/types/robots/dropbox-import.ts @@ -23,7 +23,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/dropbox-store.ts b/src/alphalib/types/robots/dropbox-store.ts index 9267e286..9f74724b 100644 --- a/src/alphalib/types/robots/dropbox-store.ts +++ b/src/alphalib/types/robots/dropbox-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/edgly-deliver.ts b/src/alphalib/types/robots/edgly-deliver.ts index 62e98ab6..a3842034 100644 --- a/src/alphalib/types/robots/edgly-deliver.ts +++ b/src/alphalib/types/robots/edgly-deliver.ts @@ -1,6 +1,6 @@ import { z } from 'zod' - -import { interpolateRobot, type RobotMetaInput, robotBase } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase } from './_instructions-primitives.ts' export const meta: RobotMetaInput = { allowed_for_url_transform: false, diff --git a/src/alphalib/types/robots/file-decompress.ts b/src/alphalib/types/robots/file-decompress.ts index b1c47c7f..33592aac 100644 --- a/src/alphalib/types/robots/file-decompress.ts +++ b/src/alphalib/types/robots/file-decompress.ts @@ -87,6 +87,15 @@ A possible array member is only \`"meta"\`. You might see an error when trying to extract metadata from the files inside your archive. This happens, for example, for files with a size of zero bytes. Setting this to \`true\` will cause the Robot to not stop the file decompression (and the entire Assembly) when that happens. To keep backwards compatibility, setting this parameter to \`true\` will set it to \`["meta"]\` internally. +`), + stack: z + .enum(['v1', 'v2']) + .default('v1') + .describe(` +Temporary parameter for backwards compatibility while we roll out new underlying tooling for the robot. + +- \`v1\` uses the old decompression. +- \`v2\` uses the new decompression with better support for unicode and nested archives. `), }) .strict() diff --git a/src/alphalib/types/robots/file-verify.ts b/src/alphalib/types/robots/file-verify.ts index ab425085..aa6d64eb 100644 --- a/src/alphalib/types/robots/file-verify.ts +++ b/src/alphalib/types/robots/file-verify.ts @@ -6,7 +6,8 @@ import { interpolateRobot, robotBase, robotUse } from './_instructions-primitive 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: { diff --git a/src/alphalib/types/robots/ftp-import.ts b/src/alphalib/types/robots/ftp-import.ts index 1335ae40..56b515ec 100644 --- a/src/alphalib/types/robots/ftp-import.ts +++ b/src/alphalib/types/robots/ftp-import.ts @@ -23,7 +23,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/ftp-store.ts b/src/alphalib/types/robots/ftp-store.ts index 42f2521d..5bcf26e3 100644 --- a/src/alphalib/types/robots/ftp-store.ts +++ b/src/alphalib/types/robots/ftp-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/google-import.ts b/src/alphalib/types/robots/google-import.ts index 9caea3ac..5661ce1b 100644 --- a/src/alphalib/types/robots/google-import.ts +++ b/src/alphalib/types/robots/google-import.ts @@ -27,7 +27,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/google-store.ts b/src/alphalib/types/robots/google-store.ts index 0c82e225..8a323bbf 100644 --- a/src/alphalib/types/robots/google-store.ts +++ b/src/alphalib/types/robots/google-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, @@ -51,7 +51,7 @@ The URL to the exported file in your Google bucket will be presented in the Tran result: z .boolean() .optional() - .describe(`Whether the results of this Step should be present in the Assembly Status JSON`), + .describe('Whether the results of this Step should be present in the Assembly Status JSON'), credentials: z.string().describe(` Create a new [Google service account](https://cloud.google.com/storage/docs/authentication). Set its role to "Storage Object Creator". Choose "JSON" for the key file format and download it to your computer. You will need to upload this file when creating your Template Credentials. diff --git a/src/alphalib/types/robots/meta-read.ts b/src/alphalib/types/robots/meta-read.ts index 035e703b..3de1dcdb 100644 --- a/src/alphalib/types/robots/meta-read.ts +++ b/src/alphalib/types/robots/meta-read.ts @@ -1,6 +1,6 @@ import { z } from 'zod' - -import { interpolateRobot, type RobotMetaInput, robotBase } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase } from './_instructions-primitives.ts' // @ts-expect-error - MetaReadRobot is not ready yet @TODO please supply missing keys export const meta: RobotMetaInput = { @@ -15,7 +15,7 @@ export const meta: RobotMetaInput = { export const robotMetaReadInstructionsSchema = robotBase .extend({ - robot: z.literal('/meta/read').describe(`Reads metadata from a file.`), + robot: z.literal('/meta/read').describe('Reads metadata from a file.'), }) .strict() diff --git a/src/alphalib/types/robots/minio-import.ts b/src/alphalib/types/robots/minio-import.ts index e3a94bd1..58d0fd5b 100644 --- a/src/alphalib/types/robots/minio-import.ts +++ b/src/alphalib/types/robots/minio-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/minio-store.ts b/src/alphalib/types/robots/minio-store.ts index 87bf365e..5e05a718 100644 --- a/src/alphalib/types/robots/minio-store.ts +++ b/src/alphalib/types/robots/minio-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/s3-import.ts b/src/alphalib/types/robots/s3-import.ts index 25ef7fd0..4d78e4a4 100644 --- a/src/alphalib/types/robots/s3-import.ts +++ b/src/alphalib/types/robots/s3-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/s3-store.ts b/src/alphalib/types/robots/s3-store.ts index 4ccdde08..ae75c685 100644 --- a/src/alphalib/types/robots/s3-store.ts +++ b/src/alphalib/types/robots/s3-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/sftp-import.ts b/src/alphalib/types/robots/sftp-import.ts index a71cae20..9fbfaaea 100644 --- a/src/alphalib/types/robots/sftp-import.ts +++ b/src/alphalib/types/robots/sftp-import.ts @@ -17,7 +17,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/sftp-store.ts b/src/alphalib/types/robots/sftp-store.ts index cf364a35..d6614a3f 100644 --- a/src/alphalib/types/robots/sftp-store.ts +++ b/src/alphalib/types/robots/sftp-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/supabase-import.ts b/src/alphalib/types/robots/supabase-import.ts index a6bd3ee9..44886308 100644 --- a/src/alphalib/types/robots/supabase-import.ts +++ b/src/alphalib/types/robots/supabase-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/supabase-store.ts b/src/alphalib/types/robots/supabase-store.ts index c74ccaad..e47d3455 100644 --- a/src/alphalib/types/robots/supabase-store.ts +++ b/src/alphalib/types/robots/supabase-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/swift-import.ts b/src/alphalib/types/robots/swift-import.ts index eaed3359..aea698c5 100644 --- a/src/alphalib/types/robots/swift-import.ts +++ b/src/alphalib/types/robots/swift-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/swift-store.ts b/src/alphalib/types/robots/swift-store.ts index 1cc3beb1..befc9084 100644 --- a/src/alphalib/types/robots/swift-store.ts +++ b/src/alphalib/types/robots/swift-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/types/robots/tigris-import.ts b/src/alphalib/types/robots/tigris-import.ts index ee9f824f..50176f3c 100644 --- a/src/alphalib/types/robots/tigris-import.ts +++ b/src/alphalib/types/robots/tigris-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, @@ -85,7 +86,7 @@ The pagination page size. This only works when recursive is \`true\` for now, in bucket_region: z .string() .optional() - .describe(`The region of your Tigris bucket. This is optional as it can often be derived.`), + .describe('The region of your Tigris bucket. This is optional as it can often be derived.'), }) .strict() diff --git a/src/alphalib/types/robots/tigris-store.ts b/src/alphalib/types/robots/tigris-store.ts index b42731d3..f6dbd140 100644 --- a/src/alphalib/types/robots/tigris-store.ts +++ b/src/alphalib/types/robots/tigris-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, @@ -81,7 +81,7 @@ If this parameter is not used, no URL signing is done. bucket_region: z .string() .optional() - .describe(`The region of your Tigris bucket. This is optional as it can often be derived.`), + .describe('The region of your Tigris bucket. This is optional as it can often be derived.'), }) .strict() diff --git a/src/alphalib/types/robots/tlcdn-deliver.ts b/src/alphalib/types/robots/tlcdn-deliver.ts index 679e283a..fe4b6833 100644 --- a/src/alphalib/types/robots/tlcdn-deliver.ts +++ b/src/alphalib/types/robots/tlcdn-deliver.ts @@ -1,6 +1,6 @@ import { z } from 'zod' - -import { interpolateRobot, type RobotMetaInput, robotBase } from './_instructions-primitives.ts' +import type { RobotMetaInput } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase } from './_instructions-primitives.ts' export const meta: RobotMetaInput = { allowed_for_url_transform: false, diff --git a/src/alphalib/types/robots/video-concat.ts b/src/alphalib/types/robots/video-concat.ts index eef59f9e..f919c52e 100644 --- a/src/alphalib/types/robots/video-concat.ts +++ b/src/alphalib/types/robots/video-concat.ts @@ -39,7 +39,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/video-encode.ts b/src/alphalib/types/robots/video-encode.ts index d2e75374..2e3be2b0 100644 --- a/src/alphalib/types/robots/video-encode.ts +++ b/src/alphalib/types/robots/video-encode.ts @@ -50,7 +50,55 @@ export const robotVideoEncodeInstructionsSchema = robotBase .merge(robotUse) .merge(videoEncodeSpecificInstructionsSchema) .extend({ - robot: z.literal('/video/encode'), + robot: z.literal('/video/encode').describe(` +The /video/encode Robot is a versatile tool for video processing that handles transcoding, resizing, and watermarking. It supports various formats including modern standards like HEVC (H.265), and provides features such as presets for common devices, custom FFmpeg parameters for powerusers, watermark positioning, and more. + +## Adding text overlays with FFmpeg + +You can add text overlays to videos using FFmpeg's \`drawtext\` filter through this Robot's \`ffmpeg\` parameter. Here are two examples — one with the default font and one with a custom font family name: + +\`\`\`json +{ + "steps": { + ":original": { + "robot": "/upload/handle" + }, + "text_overlay_default": { + "use": ":original", + "robot": "/video/encode", + "preset": "empty", + "ffmpeg_stack": "{{stacks.ffmpeg.recommended_version}}", + "ffmpeg": { + "codec:a": "copy", + "vf": "drawtext=text='My text overlay':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" + }, + "result": true + }, + "text_overlay_custom": { + "use": ":original", + "robot": "/video/encode", + "preset": "empty", + "ffmpeg_stack": "{{stacks.ffmpeg.recommended_version}}", + "ffmpeg": { + "codec:a": "copy", + "vf": "drawtext=font='Times New Roman':text='My text overlay':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" + }, + "result": true + } + } +} +\`\`\` + +**Notes:** + +- Use the \`font\` attribute to reference a font by family name with FFmpeg's \`drawtext\` +- FFmpeg font family names typically do not contain dashes (e.g. \`Times New Roman\`), while + ImageMagick uses dashed names (e.g. \`Times-New-Roman\`). +- Preserve the source audio by setting \`"codec:a": "copy"\`. +- Position text with the \`x\` and \`y\` expressions. The example above centers the text. + +See the live demo [here](/demos/video-encoding/add-text-overlay/). +`), font_size: z.number().optional(), font_color: z.string().optional(), text_background_color: z.string().optional(), diff --git a/src/alphalib/types/robots/video-subtitle.ts b/src/alphalib/types/robots/video-subtitle.ts index 8265ceb6..1e32a863 100644 --- a/src/alphalib/types/robots/video-subtitle.ts +++ b/src/alphalib/types/robots/video-subtitle.ts @@ -39,7 +39,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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', diff --git a/src/alphalib/types/robots/vimeo-import.ts b/src/alphalib/types/robots/vimeo-import.ts index 682d4504..3f139848 100644 --- a/src/alphalib/types/robots/vimeo-import.ts +++ b/src/alphalib/types/robots/vimeo-import.ts @@ -83,7 +83,7 @@ You can also use an array of path strings here to import multiple paths in the s rendition: z .enum(['240p', '360p', '540p', '720p', '1080p', 'source']) .default('720p') - .describe(`The quality of the video to import.`), + .describe('The quality of the video to import.'), }) .strict() diff --git a/src/alphalib/types/robots/wasabi-import.ts b/src/alphalib/types/robots/wasabi-import.ts index 16ec069e..87a9eb86 100644 --- a/src/alphalib/types/robots/wasabi-import.ts +++ b/src/alphalib/types/robots/wasabi-import.ts @@ -28,7 +28,8 @@ export const meta: RobotMetaInput = { }, }, }, - 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, @@ -59,7 +60,7 @@ export const robotWasabiImportInstructionsSchema = robotBase result: z .boolean() .optional() - .describe(`Whether the results of this Step should be present in the Assembly Status JSON`), + .describe('Whether the results of this Step should be present in the Assembly Status JSON'), robot: z.literal('/wasabi/import'), path: path.describe(` The path in your bucket to the specific file or directory. If the path points to a file, only this file will be imported. For example: \`images/avatar.jpg\`. diff --git a/src/alphalib/types/robots/wasabi-store.ts b/src/alphalib/types/robots/wasabi-store.ts index 8911e97c..8f45ad2d 100644 --- a/src/alphalib/types/robots/wasabi-store.ts +++ b/src/alphalib/types/robots/wasabi-store.ts @@ -18,7 +18,7 @@ export const meta: RobotMetaInput = { }, }, }, - 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, diff --git a/src/alphalib/zodParseWithContext.ts b/src/alphalib/zodParseWithContext.ts index ec4f6e6b..ac3e09ee 100644 --- a/src/alphalib/zodParseWithContext.ts +++ b/src/alphalib/zodParseWithContext.ts @@ -194,7 +194,11 @@ export function zodParseWithContext( if (!badPaths.has(nestedPath)) { badPaths.set(nestedPath, []) } - const targetMessages = badPaths.get(nestedPath)! + + const targetMessages = badPaths.get(nestedPath) + if (!targetMessages) { + continue + } // Prioritize more specific messages (like invalid type with details) const invalidTypeMessages = collectedMessages[nestedPath].filter((m) => @@ -231,7 +235,7 @@ export function zodParseWithContext( switch (zodIssue.code) { case 'invalid_type': { received = zodIssue.received === 'undefined' ? 'missing' : zodIssue.received - const actualValue = getByPath(obj, path) as any + const actualValue = getByPath(obj, path) const actualValueStr = typeof actualValue === 'object' && actualValue !== null ? JSON.stringify(actualValue) diff --git a/yarn.lock b/yarn.lock index 0f0b6121..c2093dca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -597,7 +597,7 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/types@npm:3.887.0": +"@aws-sdk/types@npm:3.887.0, @aws-sdk/types@npm:^3.222.0": version: 3.887.0 resolution: "@aws-sdk/types@npm:3.887.0" dependencies: @@ -607,16 +607,6 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/types@npm:^3.222.0": - version: 3.804.0 - resolution: "@aws-sdk/types@npm:3.804.0" - dependencies: - "@smithy/types": "npm:^4.2.0" - tslib: "npm:^2.6.2" - checksum: 10c0/cdda6d77466ed34de1ca0e23b9df5c576e7d67dc87cfda2a2d024a9c5f4180fe77ebaf57194a4cf034ee5edfbcd8efdeca458e9b61b1f364b261284b4a141ae5 - languageName: node - linkType: hard - "@aws-sdk/util-arn-parser@npm:3.873.0": version: 3.873.0 resolution: "@aws-sdk/util-arn-parser@npm:3.873.0" @@ -1084,17 +1074,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.23, @jridgewell/trace-mapping@npm:^0.3.24": - version: 0.3.25 - resolution: "@jridgewell/trace-mapping@npm:0.3.25" - dependencies: - "@jridgewell/resolve-uri": "npm:^3.1.0" - "@jridgewell/sourcemap-codec": "npm:^1.4.14" - checksum: 10c0/3d1ce6ebc69df9682a5a8896b414c6537e428a1d68b02fcc8363b04284a8ca0df04d0ee3013132252ab14f2527bc13bea6526a912ecb5658f0e39fd2860b4df4 - languageName: node - linkType: hard - -"@jridgewell/trace-mapping@npm:^0.3.30": +"@jridgewell/trace-mapping@npm:^0.3.23, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.30": version: 0.3.31 resolution: "@jridgewell/trace-mapping@npm:0.3.31" dependencies: @@ -1737,15 +1717,6 @@ __metadata: languageName: node linkType: hard -"@smithy/types@npm:^4.2.0": - version: 4.3.0 - resolution: "@smithy/types@npm:4.3.0" - dependencies: - tslib: "npm:^2.6.2" - checksum: 10c0/364393b18aa76ba21258c18f0c0109770332058cdeb143f0c556770078376a8fa861e411408b280ebf57d92aff5f7de9543e22ef30a63204f5101919f820010d - languageName: node - linkType: hard - "@smithy/types@npm:^4.5.0": version: 4.5.0 resolution: "@smithy/types@npm:4.5.0" @@ -1983,20 +1954,13 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:1.0.8": +"@types/estree@npm:1.0.8, @types/estree@npm:^1.0.0": version: 1.0.8 resolution: "@types/estree@npm:1.0.8" checksum: 10c0/39d34d1afaa338ab9763f37ad6066e3f349444f9052b9676a7cc0252ef9485a41c6d81c9c4e0d26e9077993354edf25efc853f3224dd4b447175ef62bdcc86a5 languageName: node linkType: hard -"@types/estree@npm:^1.0.0": - version: 1.0.7 - resolution: "@types/estree@npm:1.0.7" - checksum: 10c0/be815254316882f7c40847336cd484c3bc1c3e34f710d197160d455dc9d6d050ffbf4c3bc76585dba86f737f020ab20bdb137ebe0e9116b0c86c7c0342221b8c - languageName: node - linkType: hard - "@types/http-cache-semantics@npm:^4.0.4": version: 4.0.4 resolution: "@types/http-cache-semantics@npm:4.0.4" @@ -2608,19 +2572,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.1.1, debug@npm:^4.3.4": - version: 4.4.1 - resolution: "debug@npm:4.4.1" - dependencies: - ms: "npm:^2.1.3" - peerDependenciesMeta: - supports-color: - optional: true - checksum: 10c0/d2b44bc1afd912b49bb7ebb0d50a860dc93a4dd7d946e8de94abc957bb63726b7dd5aa48c18c2386c379ec024c46692e15ed3ed97d481729f929201e671fcd55 - languageName: node - linkType: hard - -"debug@npm:^4.4.1, debug@npm:^4.4.3": +"debug@npm:4, debug@npm:^4.1.1, debug@npm:^4.3.4, debug@npm:^4.4.1, debug@npm:^4.4.3": version: 4.4.3 resolution: "debug@npm:4.4.3" dependencies: @@ -3017,18 +2969,6 @@ __metadata: languageName: node linkType: hard -"fdir@npm:^6.4.4": - version: 6.4.4 - resolution: "fdir@npm:6.4.4" - peerDependencies: - picomatch: ^3 || ^4 - peerDependenciesMeta: - picomatch: - optional: true - checksum: 10c0/6ccc33be16945ee7bc841e1b4178c0b4cf18d3804894cb482aa514651c962a162f96da7ffc6ebfaf0df311689fb70091b04dd6caffe28d56b9ebdc0e7ccadfdd - languageName: node - linkType: hard - "fdir@npm:^6.5.0": version: 6.5.0 resolution: "fdir@npm:6.5.0" @@ -3926,14 +3866,7 @@ __metadata: languageName: node linkType: hard -"loupe@npm:^3.1.0": - version: 3.1.3 - resolution: "loupe@npm:3.1.3" - checksum: 10c0/f5dab4144254677de83a35285be1b8aba58b3861439ce4ba65875d0d5f3445a4a496daef63100ccf02b2dbc25bf58c6db84c9cb0b96d6435331e9d0a33b48541 - languageName: node - linkType: hard - -"loupe@npm:^3.1.4": +"loupe@npm:^3.1.0, loupe@npm:^3.1.4": version: 3.2.1 resolution: "loupe@npm:3.2.1" checksum: 10c0/910c872cba291309664c2d094368d31a68907b6f5913e989d301b5c25f30e97d76d77f23ab3bf3b46d0f601ff0b6af8810c10c31b91d2c6b2f132809ca2cc705 @@ -4466,14 +4399,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^4.0.2": - version: 4.0.2 - resolution: "picomatch@npm:4.0.2" - checksum: 10c0/7c51f3ad2bb42c776f49ebf964c644958158be30d0a510efd5a395e8d49cb5acfed5b82c0c5b365523ce18e6ab85013c9ebe574f60305892ec3fa8eee8304ccc - languageName: node - linkType: hard - -"picomatch@npm:^4.0.3": +"picomatch@npm:^4.0.2, picomatch@npm:^4.0.3": version: 4.0.3 resolution: "picomatch@npm:4.0.3" checksum: 10c0/9582c951e95eebee5434f59e426cddd228a7b97a0161a375aed4be244bd3fe8e3a31b846808ea14ef2c8a2527a6eeab7b3946a67d5979e81694654f939473ae2 @@ -5269,17 +5195,7 @@ __metadata: languageName: node linkType: hard -"tinyglobby@npm:^0.2.12": - version: 0.2.14 - resolution: "tinyglobby@npm:0.2.14" - dependencies: - fdir: "npm:^6.4.4" - picomatch: "npm:^4.0.2" - checksum: 10c0/f789ed6c924287a9b7d3612056ed0cda67306cd2c80c249fd280cf1504742b12583a2089b61f4abbd24605f390809017240e250241f09938054c9b363e51c0a6 - languageName: node - linkType: hard - -"tinyglobby@npm:^0.2.14, tinyglobby@npm:^0.2.15": +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.14, tinyglobby@npm:^0.2.15": version: 0.2.15 resolution: "tinyglobby@npm:0.2.15" dependencies: