@transloadit/node 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +701 -0
- package/dist/ApiError.d.ts +22 -0
- package/dist/ApiError.d.ts.map +1 -0
- package/dist/ApiError.js +33 -0
- package/dist/ApiError.js.map +1 -0
- package/dist/InconsistentResponseError.d.ts +4 -0
- package/dist/InconsistentResponseError.d.ts.map +1 -0
- package/dist/InconsistentResponseError.js +4 -0
- package/dist/InconsistentResponseError.js.map +1 -0
- package/dist/PaginationStream.d.ts +14 -0
- package/dist/PaginationStream.d.ts.map +1 -0
- package/dist/PaginationStream.js +36 -0
- package/dist/PaginationStream.js.map +1 -0
- package/dist/PollingTimeoutError.d.ts +5 -0
- package/dist/PollingTimeoutError.d.ts.map +1 -0
- package/dist/PollingTimeoutError.js +5 -0
- package/dist/PollingTimeoutError.js.map +1 -0
- package/dist/Transloadit.d.ts +250 -0
- package/dist/Transloadit.d.ts.map +1 -0
- package/dist/Transloadit.js +661 -0
- package/dist/Transloadit.js.map +1 -0
- package/dist/alphalib/lib/nativeGlobby.d.ts +14 -0
- package/dist/alphalib/lib/nativeGlobby.d.ts.map +1 -0
- package/dist/alphalib/lib/nativeGlobby.js +181 -0
- package/dist/alphalib/lib/nativeGlobby.js.map +1 -0
- package/dist/alphalib/mcache.d.ts +65 -0
- package/dist/alphalib/mcache.d.ts.map +1 -0
- package/dist/alphalib/mcache.js +135 -0
- package/dist/alphalib/mcache.js.map +1 -0
- package/dist/alphalib/tryCatch.d.ts +21 -0
- package/dist/alphalib/tryCatch.d.ts.map +1 -0
- package/dist/alphalib/tryCatch.js +17 -0
- package/dist/alphalib/tryCatch.js.map +1 -0
- package/dist/alphalib/types/assembliesGet.d.ts +62 -0
- package/dist/alphalib/types/assembliesGet.d.ts.map +1 -0
- package/dist/alphalib/types/assembliesGet.js +33 -0
- package/dist/alphalib/types/assembliesGet.js.map +1 -0
- package/dist/alphalib/types/assemblyReplay.d.ts +7858 -0
- package/dist/alphalib/types/assemblyReplay.d.ts.map +1 -0
- package/dist/alphalib/types/assemblyReplay.js +15 -0
- package/dist/alphalib/types/assemblyReplay.js.map +1 -0
- package/dist/alphalib/types/assemblyReplayNotification.d.ts +7849 -0
- package/dist/alphalib/types/assemblyReplayNotification.d.ts.map +1 -0
- package/dist/alphalib/types/assemblyReplayNotification.js +13 -0
- package/dist/alphalib/types/assemblyReplayNotification.js.map +1 -0
- package/dist/alphalib/types/assemblyStatus.d.ts +71084 -0
- package/dist/alphalib/types/assemblyStatus.d.ts.map +1 -0
- package/dist/alphalib/types/assemblyStatus.js +710 -0
- package/dist/alphalib/types/assemblyStatus.js.map +1 -0
- package/dist/alphalib/types/bill.d.ts +44 -0
- package/dist/alphalib/types/bill.d.ts.map +1 -0
- package/dist/alphalib/types/bill.js +8 -0
- package/dist/alphalib/types/bill.js.map +1 -0
- package/dist/alphalib/types/robots/_index.d.ts +76306 -0
- package/dist/alphalib/types/robots/_index.d.ts.map +1 -0
- package/dist/alphalib/types/robots/_index.js +354 -0
- package/dist/alphalib/types/robots/_index.js.map +1 -0
- package/dist/alphalib/types/robots/_instructions-primitives.d.ts +3533 -0
- package/dist/alphalib/types/robots/_instructions-primitives.d.ts.map +1 -0
- package/dist/alphalib/types/robots/_instructions-primitives.js +1491 -0
- package/dist/alphalib/types/robots/_instructions-primitives.js.map +1 -0
- package/dist/alphalib/types/robots/ai-chat.d.ts +2096 -0
- package/dist/alphalib/types/robots/ai-chat.d.ts.map +1 -0
- package/dist/alphalib/types/robots/ai-chat.js +223 -0
- package/dist/alphalib/types/robots/ai-chat.js.map +1 -0
- package/dist/alphalib/types/robots/assembly-savejson.d.ts +52 -0
- package/dist/alphalib/types/robots/assembly-savejson.d.ts.map +1 -0
- package/dist/alphalib/types/robots/assembly-savejson.js +22 -0
- package/dist/alphalib/types/robots/assembly-savejson.js.map +1 -0
- package/dist/alphalib/types/robots/audio-artwork.d.ts +2867 -0
- package/dist/alphalib/types/robots/audio-artwork.d.ts.map +1 -0
- package/dist/alphalib/types/robots/audio-artwork.js +73 -0
- package/dist/alphalib/types/robots/audio-artwork.js.map +1 -0
- package/dist/alphalib/types/robots/audio-concat.d.ts +2916 -0
- package/dist/alphalib/types/robots/audio-concat.d.ts.map +1 -0
- package/dist/alphalib/types/robots/audio-concat.js +106 -0
- package/dist/alphalib/types/robots/audio-concat.js.map +1 -0
- package/dist/alphalib/types/robots/audio-encode.d.ts +2864 -0
- package/dist/alphalib/types/robots/audio-encode.d.ts.map +1 -0
- package/dist/alphalib/types/robots/audio-encode.js +67 -0
- package/dist/alphalib/types/robots/audio-encode.js.map +1 -0
- package/dist/alphalib/types/robots/audio-loop.d.ts +2879 -0
- package/dist/alphalib/types/robots/audio-loop.d.ts.map +1 -0
- package/dist/alphalib/types/robots/audio-loop.js +67 -0
- package/dist/alphalib/types/robots/audio-loop.js.map +1 -0
- package/dist/alphalib/types/robots/audio-merge.d.ts +2931 -0
- package/dist/alphalib/types/robots/audio-merge.d.ts.map +1 -0
- package/dist/alphalib/types/robots/audio-merge.js +101 -0
- package/dist/alphalib/types/robots/audio-merge.js.map +1 -0
- package/dist/alphalib/types/robots/audio-waveform.d.ts +3131 -0
- package/dist/alphalib/types/robots/audio-waveform.d.ts.map +1 -0
- package/dist/alphalib/types/robots/audio-waveform.js +238 -0
- package/dist/alphalib/types/robots/audio-waveform.js.map +1 -0
- package/dist/alphalib/types/robots/azure-import.d.ts +210 -0
- package/dist/alphalib/types/robots/azure-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/azure-import.js +73 -0
- package/dist/alphalib/types/robots/azure-import.js.map +1 -0
- package/dist/alphalib/types/robots/azure-store.d.ts +562 -0
- package/dist/alphalib/types/robots/azure-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/azure-store.js +115 -0
- package/dist/alphalib/types/robots/azure-store.js.map +1 -0
- package/dist/alphalib/types/robots/backblaze-import.d.ts +210 -0
- package/dist/alphalib/types/robots/backblaze-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/backblaze-import.js +81 -0
- package/dist/alphalib/types/robots/backblaze-import.js.map +1 -0
- package/dist/alphalib/types/robots/backblaze-store.d.ts +478 -0
- package/dist/alphalib/types/robots/backblaze-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/backblaze-store.js +76 -0
- package/dist/alphalib/types/robots/backblaze-store.js.map +1 -0
- package/dist/alphalib/types/robots/cloudfiles-import.d.ts +234 -0
- package/dist/alphalib/types/robots/cloudfiles-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/cloudfiles-import.js +80 -0
- package/dist/alphalib/types/robots/cloudfiles-import.js.map +1 -0
- package/dist/alphalib/types/robots/cloudfiles-store.d.ts +490 -0
- package/dist/alphalib/types/robots/cloudfiles-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/cloudfiles-store.js +70 -0
- package/dist/alphalib/types/robots/cloudfiles-store.js.map +1 -0
- package/dist/alphalib/types/robots/cloudflare-import.d.ts +234 -0
- package/dist/alphalib/types/robots/cloudflare-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/cloudflare-import.js +81 -0
- package/dist/alphalib/types/robots/cloudflare-import.js.map +1 -0
- package/dist/alphalib/types/robots/cloudflare-store.d.ts +514 -0
- package/dist/alphalib/types/robots/cloudflare-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/cloudflare-store.js +86 -0
- package/dist/alphalib/types/robots/cloudflare-store.js.map +1 -0
- package/dist/alphalib/types/robots/digitalocean-import.d.ts +234 -0
- package/dist/alphalib/types/robots/digitalocean-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/digitalocean-import.js +78 -0
- package/dist/alphalib/types/robots/digitalocean-import.js.map +1 -0
- package/dist/alphalib/types/robots/digitalocean-store.d.ts +526 -0
- package/dist/alphalib/types/robots/digitalocean-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/digitalocean-store.js +91 -0
- package/dist/alphalib/types/robots/digitalocean-store.js.map +1 -0
- package/dist/alphalib/types/robots/document-autorotate.d.ts +405 -0
- package/dist/alphalib/types/robots/document-autorotate.d.ts.map +1 -0
- package/dist/alphalib/types/robots/document-autorotate.js +44 -0
- package/dist/alphalib/types/robots/document-autorotate.js.map +1 -0
- package/dist/alphalib/types/robots/document-convert.d.ts +513 -0
- package/dist/alphalib/types/robots/document-convert.d.ts.map +1 -0
- package/dist/alphalib/types/robots/document-convert.js +273 -0
- package/dist/alphalib/types/robots/document-convert.js.map +1 -0
- package/dist/alphalib/types/robots/document-merge.d.ts +429 -0
- package/dist/alphalib/types/robots/document-merge.d.ts.map +1 -0
- package/dist/alphalib/types/robots/document-merge.js +86 -0
- package/dist/alphalib/types/robots/document-merge.js.map +1 -0
- package/dist/alphalib/types/robots/document-ocr.d.ts +441 -0
- package/dist/alphalib/types/robots/document-ocr.d.ts.map +1 -0
- package/dist/alphalib/types/robots/document-ocr.js +86 -0
- package/dist/alphalib/types/robots/document-ocr.js.map +1 -0
- package/dist/alphalib/types/robots/document-split.d.ts +417 -0
- package/dist/alphalib/types/robots/document-split.d.ts.map +1 -0
- package/dist/alphalib/types/robots/document-split.js +48 -0
- package/dist/alphalib/types/robots/document-split.js.map +1 -0
- package/dist/alphalib/types/robots/document-thumbs.d.ts +592 -0
- package/dist/alphalib/types/robots/document-thumbs.d.ts.map +1 -0
- package/dist/alphalib/types/robots/document-thumbs.js +196 -0
- package/dist/alphalib/types/robots/document-thumbs.js.map +1 -0
- package/dist/alphalib/types/robots/dropbox-import.d.ts +144 -0
- package/dist/alphalib/types/robots/dropbox-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/dropbox-import.js +65 -0
- package/dist/alphalib/types/robots/dropbox-import.js.map +1 -0
- package/dist/alphalib/types/robots/dropbox-store.d.ts +449 -0
- package/dist/alphalib/types/robots/dropbox-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/dropbox-store.js +68 -0
- package/dist/alphalib/types/robots/dropbox-store.js.map +1 -0
- package/dist/alphalib/types/robots/edgly-deliver.d.ts +100 -0
- package/dist/alphalib/types/robots/edgly-deliver.d.ts.map +1 -0
- package/dist/alphalib/types/robots/edgly-deliver.js +46 -0
- package/dist/alphalib/types/robots/edgly-deliver.js.map +1 -0
- package/dist/alphalib/types/robots/file-compress.d.ts +477 -0
- package/dist/alphalib/types/robots/file-compress.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-compress.js +139 -0
- package/dist/alphalib/types/robots/file-compress.js.map +1 -0
- package/dist/alphalib/types/robots/file-decompress.d.ts +404 -0
- package/dist/alphalib/types/robots/file-decompress.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-decompress.js +94 -0
- package/dist/alphalib/types/robots/file-decompress.js.map +1 -0
- package/dist/alphalib/types/robots/file-filter.d.ts +465 -0
- package/dist/alphalib/types/robots/file-filter.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-filter.js +136 -0
- package/dist/alphalib/types/robots/file-filter.js.map +1 -0
- package/dist/alphalib/types/robots/file-hash.d.ts +417 -0
- package/dist/alphalib/types/robots/file-hash.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-hash.js +59 -0
- package/dist/alphalib/types/robots/file-hash.js.map +1 -0
- package/dist/alphalib/types/robots/file-preview.d.ts +854 -0
- package/dist/alphalib/types/robots/file-preview.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-preview.js +221 -0
- package/dist/alphalib/types/robots/file-preview.js.map +1 -0
- package/dist/alphalib/types/robots/file-read.d.ts +405 -0
- package/dist/alphalib/types/robots/file-read.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-read.js +44 -0
- package/dist/alphalib/types/robots/file-read.js.map +1 -0
- package/dist/alphalib/types/robots/file-serve.d.ts +418 -0
- package/dist/alphalib/types/robots/file-serve.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-serve.js +99 -0
- package/dist/alphalib/types/robots/file-serve.js.map +1 -0
- package/dist/alphalib/types/robots/file-verify.d.ts +441 -0
- package/dist/alphalib/types/robots/file-verify.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-verify.js +73 -0
- package/dist/alphalib/types/robots/file-verify.js.map +1 -0
- package/dist/alphalib/types/robots/file-virusscan.d.ts +435 -0
- package/dist/alphalib/types/robots/file-virusscan.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-virusscan.js +82 -0
- package/dist/alphalib/types/robots/file-virusscan.js.map +1 -0
- package/dist/alphalib/types/robots/file-watermark.d.ts +417 -0
- package/dist/alphalib/types/robots/file-watermark.d.ts.map +1 -0
- package/dist/alphalib/types/robots/file-watermark.js +28 -0
- package/dist/alphalib/types/robots/file-watermark.js.map +1 -0
- package/dist/alphalib/types/robots/ftp-import.d.ts +198 -0
- package/dist/alphalib/types/robots/ftp-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/ftp-import.js +60 -0
- package/dist/alphalib/types/robots/ftp-import.js.map +1 -0
- package/dist/alphalib/types/robots/ftp-store.d.ts +532 -0
- package/dist/alphalib/types/robots/ftp-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/ftp-store.js +91 -0
- package/dist/alphalib/types/robots/ftp-store.js.map +1 -0
- package/dist/alphalib/types/robots/google-import.d.ts +174 -0
- package/dist/alphalib/types/robots/google-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/google-import.js +77 -0
- package/dist/alphalib/types/robots/google-import.js.map +1 -0
- package/dist/alphalib/types/robots/google-store.d.ts +476 -0
- package/dist/alphalib/types/robots/google-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/google-store.js +111 -0
- package/dist/alphalib/types/robots/google-store.js.map +1 -0
- package/dist/alphalib/types/robots/html-convert.d.ts +531 -0
- package/dist/alphalib/types/robots/html-convert.d.ts.map +1 -0
- package/dist/alphalib/types/robots/html-convert.js +137 -0
- package/dist/alphalib/types/robots/html-convert.js.map +1 -0
- package/dist/alphalib/types/robots/http-import.d.ts +215 -0
- package/dist/alphalib/types/robots/http-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/http-import.js +135 -0
- package/dist/alphalib/types/robots/http-import.js.map +1 -0
- package/dist/alphalib/types/robots/image-bgremove.d.ts +453 -0
- package/dist/alphalib/types/robots/image-bgremove.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-bgremove.js +65 -0
- package/dist/alphalib/types/robots/image-bgremove.js.map +1 -0
- package/dist/alphalib/types/robots/image-describe.d.ts +453 -0
- package/dist/alphalib/types/robots/image-describe.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-describe.js +86 -0
- package/dist/alphalib/types/robots/image-describe.js.map +1 -0
- package/dist/alphalib/types/robots/image-facedetect.d.ts +477 -0
- package/dist/alphalib/types/robots/image-facedetect.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-facedetect.js +151 -0
- package/dist/alphalib/types/robots/image-facedetect.js.map +1 -0
- package/dist/alphalib/types/robots/image-generate.d.ts +522 -0
- package/dist/alphalib/types/robots/image-generate.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-generate.js +64 -0
- package/dist/alphalib/types/robots/image-generate.js.map +1 -0
- package/dist/alphalib/types/robots/image-merge.d.ts +477 -0
- package/dist/alphalib/types/robots/image-merge.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-merge.js +92 -0
- package/dist/alphalib/types/robots/image-merge.js.map +1 -0
- package/dist/alphalib/types/robots/image-ocr.d.ts +441 -0
- package/dist/alphalib/types/robots/image-ocr.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-ocr.js +79 -0
- package/dist/alphalib/types/robots/image-ocr.js.map +1 -0
- package/dist/alphalib/types/robots/image-optimize.d.ts +453 -0
- package/dist/alphalib/types/robots/image-optimize.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-optimize.js +81 -0
- package/dist/alphalib/types/robots/image-optimize.js.map +1 -0
- package/dist/alphalib/types/robots/image-resize.d.ts +1758 -0
- package/dist/alphalib/types/robots/image-resize.d.ts.map +1 -0
- package/dist/alphalib/types/robots/image-resize.js +602 -0
- package/dist/alphalib/types/robots/image-resize.js.map +1 -0
- package/dist/alphalib/types/robots/meta-read.d.ts +98 -0
- package/dist/alphalib/types/robots/meta-read.d.ts.map +1 -0
- package/dist/alphalib/types/robots/meta-read.js +24 -0
- package/dist/alphalib/types/robots/meta-read.js.map +1 -0
- package/dist/alphalib/types/robots/meta-write.d.ts +2842 -0
- package/dist/alphalib/types/robots/meta-write.d.ts.map +1 -0
- package/dist/alphalib/types/robots/meta-write.js +66 -0
- package/dist/alphalib/types/robots/meta-write.js.map +1 -0
- package/dist/alphalib/types/robots/minio-import.d.ts +234 -0
- package/dist/alphalib/types/robots/minio-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/minio-import.js +81 -0
- package/dist/alphalib/types/robots/minio-import.js.map +1 -0
- package/dist/alphalib/types/robots/minio-store.d.ts +514 -0
- package/dist/alphalib/types/robots/minio-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/minio-store.js +87 -0
- package/dist/alphalib/types/robots/minio-store.js.map +1 -0
- package/dist/alphalib/types/robots/progress-simulate.d.ts +229 -0
- package/dist/alphalib/types/robots/progress-simulate.d.ts.map +1 -0
- package/dist/alphalib/types/robots/progress-simulate.js +25 -0
- package/dist/alphalib/types/robots/progress-simulate.js.map +1 -0
- package/dist/alphalib/types/robots/s3-import.d.ts +246 -0
- package/dist/alphalib/types/robots/s3-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/s3-import.js +137 -0
- package/dist/alphalib/types/robots/s3-import.js.map +1 -0
- package/dist/alphalib/types/robots/s3-store.d.ts +593 -0
- package/dist/alphalib/types/robots/s3-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/s3-store.js +169 -0
- package/dist/alphalib/types/robots/s3-store.js.map +1 -0
- package/dist/alphalib/types/robots/script-run.d.ts +423 -0
- package/dist/alphalib/types/robots/script-run.d.ts.map +1 -0
- package/dist/alphalib/types/robots/script-run.js +95 -0
- package/dist/alphalib/types/robots/script-run.js.map +1 -0
- package/dist/alphalib/types/robots/sftp-import.d.ts +192 -0
- package/dist/alphalib/types/robots/sftp-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/sftp-import.js +62 -0
- package/dist/alphalib/types/robots/sftp-import.js.map +1 -0
- package/dist/alphalib/types/robots/sftp-store.d.ts +520 -0
- package/dist/alphalib/types/robots/sftp-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/sftp-store.js +83 -0
- package/dist/alphalib/types/robots/sftp-store.js.map +1 -0
- package/dist/alphalib/types/robots/speech-transcribe.d.ts +465 -0
- package/dist/alphalib/types/robots/speech-transcribe.d.ts.map +1 -0
- package/dist/alphalib/types/robots/speech-transcribe.js +103 -0
- package/dist/alphalib/types/robots/speech-transcribe.js.map +1 -0
- package/dist/alphalib/types/robots/supabase-import.d.ts +246 -0
- package/dist/alphalib/types/robots/supabase-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/supabase-import.js +83 -0
- package/dist/alphalib/types/robots/supabase-import.js.map +1 -0
- package/dist/alphalib/types/robots/supabase-store.d.ts +514 -0
- package/dist/alphalib/types/robots/supabase-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/supabase-store.js +77 -0
- package/dist/alphalib/types/robots/supabase-store.js.map +1 -0
- package/dist/alphalib/types/robots/swift-import.d.ts +246 -0
- package/dist/alphalib/types/robots/swift-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/swift-import.js +81 -0
- package/dist/alphalib/types/robots/swift-import.js.map +1 -0
- package/dist/alphalib/types/robots/swift-store.d.ts +526 -0
- package/dist/alphalib/types/robots/swift-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/swift-store.js +84 -0
- package/dist/alphalib/types/robots/swift-store.js.map +1 -0
- package/dist/alphalib/types/robots/text-speak.d.ts +465 -0
- package/dist/alphalib/types/robots/text-speak.d.ts.map +1 -0
- package/dist/alphalib/types/robots/text-speak.js +119 -0
- package/dist/alphalib/types/robots/text-speak.js.map +1 -0
- package/dist/alphalib/types/robots/text-translate.d.ts +441 -0
- package/dist/alphalib/types/robots/text-translate.d.ts.map +1 -0
- package/dist/alphalib/types/robots/text-translate.js +211 -0
- package/dist/alphalib/types/robots/text-translate.js.map +1 -0
- package/dist/alphalib/types/robots/tigris-import.d.ts +244 -0
- package/dist/alphalib/types/robots/tigris-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/tigris-import.js +85 -0
- package/dist/alphalib/types/robots/tigris-import.js.map +1 -0
- package/dist/alphalib/types/robots/tigris-store.d.ts +524 -0
- package/dist/alphalib/types/robots/tigris-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/tigris-store.js +91 -0
- package/dist/alphalib/types/robots/tigris-store.js.map +1 -0
- package/dist/alphalib/types/robots/tlcdn-deliver.d.ts +100 -0
- package/dist/alphalib/types/robots/tlcdn-deliver.d.ts.map +1 -0
- package/dist/alphalib/types/robots/tlcdn-deliver.js +46 -0
- package/dist/alphalib/types/robots/tlcdn-deliver.js.map +1 -0
- package/dist/alphalib/types/robots/tus-store.d.ts +477 -0
- package/dist/alphalib/types/robots/tus-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/tus-store.js +102 -0
- package/dist/alphalib/types/robots/tus-store.js.map +1 -0
- package/dist/alphalib/types/robots/upload-handle.d.ts +100 -0
- package/dist/alphalib/types/robots/upload-handle.d.ts.map +1 -0
- package/dist/alphalib/types/robots/upload-handle.js +66 -0
- package/dist/alphalib/types/robots/upload-handle.js.map +1 -0
- package/dist/alphalib/types/robots/video-adaptive.d.ts +2915 -0
- package/dist/alphalib/types/robots/video-adaptive.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-adaptive.js +144 -0
- package/dist/alphalib/types/robots/video-adaptive.js.map +1 -0
- package/dist/alphalib/types/robots/video-concat.d.ts +2891 -0
- package/dist/alphalib/types/robots/video-concat.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-concat.js +96 -0
- package/dist/alphalib/types/robots/video-concat.js.map +1 -0
- package/dist/alphalib/types/robots/video-encode.d.ts +3280 -0
- package/dist/alphalib/types/robots/video-encode.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-encode.js +107 -0
- package/dist/alphalib/types/robots/video-encode.js.map +1 -0
- package/dist/alphalib/types/robots/video-merge.d.ts +2987 -0
- package/dist/alphalib/types/robots/video-merge.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-merge.js +102 -0
- package/dist/alphalib/types/robots/video-merge.js.map +1 -0
- package/dist/alphalib/types/robots/video-ondemand.d.ts +4553 -0
- package/dist/alphalib/types/robots/video-ondemand.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-ondemand.js +112 -0
- package/dist/alphalib/types/robots/video-ondemand.js.map +1 -0
- package/dist/alphalib/types/robots/video-subtitle.d.ts +2975 -0
- package/dist/alphalib/types/robots/video-subtitle.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-subtitle.js +122 -0
- package/dist/alphalib/types/robots/video-subtitle.js.map +1 -0
- package/dist/alphalib/types/robots/video-thumbs.d.ts +2938 -0
- package/dist/alphalib/types/robots/video-thumbs.d.ts.map +1 -0
- package/dist/alphalib/types/robots/video-thumbs.js +122 -0
- package/dist/alphalib/types/robots/video-thumbs.js.map +1 -0
- package/dist/alphalib/types/robots/vimeo-import.d.ts +189 -0
- package/dist/alphalib/types/robots/vimeo-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/vimeo-import.js +92 -0
- package/dist/alphalib/types/robots/vimeo-import.js.map +1 -0
- package/dist/alphalib/types/robots/vimeo-store.d.ts +520 -0
- package/dist/alphalib/types/robots/vimeo-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/vimeo-store.js +115 -0
- package/dist/alphalib/types/robots/vimeo-store.js.map +1 -0
- package/dist/alphalib/types/robots/wasabi-import.d.ts +244 -0
- package/dist/alphalib/types/robots/wasabi-import.d.ts.map +1 -0
- package/dist/alphalib/types/robots/wasabi-import.js +85 -0
- package/dist/alphalib/types/robots/wasabi-import.js.map +1 -0
- package/dist/alphalib/types/robots/wasabi-store.d.ts +526 -0
- package/dist/alphalib/types/robots/wasabi-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/wasabi-store.js +85 -0
- package/dist/alphalib/types/robots/wasabi-store.js.map +1 -0
- package/dist/alphalib/types/robots/youtube-store.d.ts +477 -0
- package/dist/alphalib/types/robots/youtube-store.d.ts.map +1 -0
- package/dist/alphalib/types/robots/youtube-store.js +122 -0
- package/dist/alphalib/types/robots/youtube-store.js.map +1 -0
- package/dist/alphalib/types/stackVersions.d.ts +13 -0
- package/dist/alphalib/types/stackVersions.d.ts.map +1 -0
- package/dist/alphalib/types/stackVersions.js +13 -0
- package/dist/alphalib/types/stackVersions.js.map +1 -0
- package/dist/alphalib/types/template.d.ts +131710 -0
- package/dist/alphalib/types/template.d.ts.map +1 -0
- package/dist/alphalib/types/template.js +218 -0
- package/dist/alphalib/types/template.js.map +1 -0
- package/dist/alphalib/types/templateCredential.d.ts +95 -0
- package/dist/alphalib/types/templateCredential.d.ts.map +1 -0
- package/dist/alphalib/types/templateCredential.js +57 -0
- package/dist/alphalib/types/templateCredential.js.map +1 -0
- package/dist/alphalib/zodParseWithContext.d.ts +17 -0
- package/dist/alphalib/zodParseWithContext.d.ts.map +1 -0
- package/dist/alphalib/zodParseWithContext.js +248 -0
- package/dist/alphalib/zodParseWithContext.js.map +1 -0
- package/dist/apiTypes.d.ts +112 -0
- package/dist/apiTypes.d.ts.map +1 -0
- package/dist/apiTypes.js +3 -0
- package/dist/apiTypes.js.map +1 -0
- package/dist/cli/OutputCtl.d.ts +47 -0
- package/dist/cli/OutputCtl.d.ts.map +1 -0
- package/dist/cli/OutputCtl.js +85 -0
- package/dist/cli/OutputCtl.js.map +1 -0
- package/dist/cli/commands/BaseCommand.d.ts +24 -0
- package/dist/cli/commands/BaseCommand.d.ts.map +1 -0
- package/dist/cli/commands/BaseCommand.js +52 -0
- package/dist/cli/commands/BaseCommand.js.map +1 -0
- package/dist/cli/commands/assemblies.d.ts +93 -0
- package/dist/cli/commands/assemblies.d.ts.map +1 -0
- package/dist/cli/commands/assemblies.js +1021 -0
- package/dist/cli/commands/assemblies.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +28 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +280 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/bills.d.ts +14 -0
- package/dist/cli/commands/bills.d.ts.map +1 -0
- package/dist/cli/commands/bills.js +69 -0
- package/dist/cli/commands/bills.js.map +1 -0
- package/dist/cli/commands/index.d.ts +3 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +39 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/notifications.d.ts +9 -0
- package/dist/cli/commands/notifications.d.ts.map +1 -0
- package/dist/cli/commands/notifications.js +44 -0
- package/dist/cli/commands/notifications.js.map +1 -0
- package/dist/cli/commands/templates.d.ts +73 -0
- package/dist/cli/commands/templates.d.ts.map +1 -0
- package/dist/cli/commands/templates.js +428 -0
- package/dist/cli/commands/templates.js.map +1 -0
- package/dist/cli/helpers.d.ts +13 -0
- package/dist/cli/helpers.d.ts.map +1 -0
- package/dist/cli/helpers.js +39 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/cli/template-last-modified.d.ts +10 -0
- package/dist/cli/template-last-modified.d.ts.map +1 -0
- package/dist/cli/template-last-modified.js +134 -0
- package/dist/cli/template-last-modified.js.map +1 -0
- package/dist/cli/types.d.ts +78 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +49 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +41 -0
- package/dist/cli.js.map +1 -0
- package/dist/tus.d.ts +18 -0
- package/dist/tus.d.ts.map +1 -0
- package/dist/tus.js +122 -0
- package/dist/tus.js.map +1 -0
- package/package.json +92 -0
- package/src/ApiError.ts +49 -0
- package/src/InconsistentResponseError.ts +3 -0
- package/src/PaginationStream.ts +54 -0
- package/src/PollingTimeoutError.ts +5 -0
- package/src/Transloadit.ts +980 -0
- package/src/alphalib/lib/nativeGlobby.ts +244 -0
- package/src/alphalib/mcache.ts +184 -0
- package/src/alphalib/tryCatch.ts +30 -0
- package/src/alphalib/types/assembliesGet.ts +42 -0
- package/src/alphalib/types/assemblyReplay.ts +24 -0
- package/src/alphalib/types/assemblyReplayNotification.ts +16 -0
- package/src/alphalib/types/assemblyStatus.ts +794 -0
- package/src/alphalib/types/bill.ts +9 -0
- package/src/alphalib/types/robots/_index.ts +1201 -0
- package/src/alphalib/types/robots/_instructions-primitives.ts +1770 -0
- package/src/alphalib/types/robots/ai-chat.ts +278 -0
- package/src/alphalib/types/robots/assembly-savejson.ts +37 -0
- package/src/alphalib/types/robots/audio-artwork.ts +107 -0
- package/src/alphalib/types/robots/audio-concat.ts +142 -0
- package/src/alphalib/types/robots/audio-encode.ts +103 -0
- package/src/alphalib/types/robots/audio-loop.ts +102 -0
- package/src/alphalib/types/robots/audio-merge.ts +137 -0
- package/src/alphalib/types/robots/audio-waveform.ts +280 -0
- package/src/alphalib/types/robots/azure-import.ts +111 -0
- package/src/alphalib/types/robots/azure-store.ts +143 -0
- package/src/alphalib/types/robots/backblaze-import.ts +119 -0
- package/src/alphalib/types/robots/backblaze-store.ts +104 -0
- package/src/alphalib/types/robots/cloudfiles-import.ts +118 -0
- package/src/alphalib/types/robots/cloudfiles-store.ts +104 -0
- package/src/alphalib/types/robots/cloudflare-import.ts +121 -0
- package/src/alphalib/types/robots/cloudflare-store.ts +120 -0
- package/src/alphalib/types/robots/digitalocean-import.ts +118 -0
- package/src/alphalib/types/robots/digitalocean-store.ts +125 -0
- package/src/alphalib/types/robots/document-autorotate.ts +74 -0
- package/src/alphalib/types/robots/document-convert.ts +302 -0
- package/src/alphalib/types/robots/document-merge.ts +114 -0
- package/src/alphalib/types/robots/document-ocr.ts +120 -0
- package/src/alphalib/types/robots/document-split.ts +78 -0
- package/src/alphalib/types/robots/document-thumbs.ts +231 -0
- package/src/alphalib/types/robots/dropbox-import.ts +100 -0
- package/src/alphalib/types/robots/dropbox-store.ts +97 -0
- package/src/alphalib/types/robots/edgly-deliver.ts +73 -0
- package/src/alphalib/types/robots/file-compress.ts +167 -0
- package/src/alphalib/types/robots/file-decompress.ts +125 -0
- package/src/alphalib/types/robots/file-filter.ts +173 -0
- package/src/alphalib/types/robots/file-hash.ts +86 -0
- package/src/alphalib/types/robots/file-preview.ts +260 -0
- package/src/alphalib/types/robots/file-read.ts +71 -0
- package/src/alphalib/types/robots/file-serve.ts +128 -0
- package/src/alphalib/types/robots/file-verify.ts +102 -0
- package/src/alphalib/types/robots/file-virusscan.ts +113 -0
- package/src/alphalib/types/robots/file-watermark.ts +56 -0
- package/src/alphalib/types/robots/ftp-import.ts +95 -0
- package/src/alphalib/types/robots/ftp-store.ts +119 -0
- package/src/alphalib/types/robots/google-import.ts +115 -0
- package/src/alphalib/types/robots/google-store.ts +139 -0
- package/src/alphalib/types/robots/html-convert.ts +165 -0
- package/src/alphalib/types/robots/http-import.ts +168 -0
- package/src/alphalib/types/robots/image-bgremove.ts +95 -0
- package/src/alphalib/types/robots/image-describe.ts +121 -0
- package/src/alphalib/types/robots/image-facedetect.ts +187 -0
- package/src/alphalib/types/robots/image-generate.ts +92 -0
- package/src/alphalib/types/robots/image-merge.ts +127 -0
- package/src/alphalib/types/robots/image-ocr.ts +112 -0
- package/src/alphalib/types/robots/image-optimize.ts +114 -0
- package/src/alphalib/types/robots/image-resize.ts +653 -0
- package/src/alphalib/types/robots/meta-read.ts +44 -0
- package/src/alphalib/types/robots/meta-write.ts +93 -0
- package/src/alphalib/types/robots/minio-import.ts +120 -0
- package/src/alphalib/types/robots/minio-store.ts +115 -0
- package/src/alphalib/types/robots/progress-simulate.ts +40 -0
- package/src/alphalib/types/robots/s3-import.ts +175 -0
- package/src/alphalib/types/robots/s3-store.ts +198 -0
- package/src/alphalib/types/robots/script-run.ts +122 -0
- package/src/alphalib/types/robots/sftp-import.ts +92 -0
- package/src/alphalib/types/robots/sftp-store.ts +110 -0
- package/src/alphalib/types/robots/speech-transcribe.ts +139 -0
- package/src/alphalib/types/robots/supabase-import.ts +122 -0
- package/src/alphalib/types/robots/supabase-store.ts +105 -0
- package/src/alphalib/types/robots/swift-import.ts +120 -0
- package/src/alphalib/types/robots/swift-store.ts +112 -0
- package/src/alphalib/types/robots/text-speak.ts +152 -0
- package/src/alphalib/types/robots/text-translate.ts +245 -0
- package/src/alphalib/types/robots/tigris-import.ts +124 -0
- package/src/alphalib/types/robots/tigris-store.ts +119 -0
- package/src/alphalib/types/robots/tlcdn-deliver.ts +73 -0
- package/src/alphalib/types/robots/tus-store.ts +129 -0
- package/src/alphalib/types/robots/upload-handle.ts +95 -0
- package/src/alphalib/types/robots/video-adaptive.ts +179 -0
- package/src/alphalib/types/robots/video-concat.ts +130 -0
- package/src/alphalib/types/robots/video-encode.ts +141 -0
- package/src/alphalib/types/robots/video-merge.ts +138 -0
- package/src/alphalib/types/robots/video-ondemand.ts +161 -0
- package/src/alphalib/types/robots/video-subtitle.ts +159 -0
- package/src/alphalib/types/robots/video-thumbs.ts +158 -0
- package/src/alphalib/types/robots/vimeo-import.ts +126 -0
- package/src/alphalib/types/robots/vimeo-store.ts +143 -0
- package/src/alphalib/types/robots/wasabi-import.ts +124 -0
- package/src/alphalib/types/robots/wasabi-store.ts +113 -0
- package/src/alphalib/types/robots/youtube-store.ts +153 -0
- package/src/alphalib/types/stackVersions.ts +12 -0
- package/src/alphalib/types/template.ts +277 -0
- package/src/alphalib/types/templateCredential.ts +61 -0
- package/src/alphalib/zodParseWithContext.ts +306 -0
- package/src/apiTypes.ts +154 -0
- package/src/cli/OutputCtl.ts +115 -0
- package/src/cli/commands/BaseCommand.ts +71 -0
- package/src/cli/commands/assemblies.ts +1373 -0
- package/src/cli/commands/auth.ts +354 -0
- package/src/cli/commands/bills.ts +91 -0
- package/src/cli/commands/index.ts +65 -0
- package/src/cli/commands/notifications.ts +63 -0
- package/src/cli/commands/templates.ts +556 -0
- package/src/cli/helpers.ts +50 -0
- package/src/cli/template-last-modified.ts +156 -0
- package/src/cli/types.ts +70 -0
- package/src/cli.ts +44 -0
- package/src/tus.ts +168 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import { robotsSchema, robotsWithHiddenBotsAndFieldsSchema } from './robots/_index.ts'
|
|
4
|
+
import type { RobotUse } from './robots/_instructions-primitives.ts'
|
|
5
|
+
|
|
6
|
+
export const stepSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
// This is a hack to get nicer robot hover messages in editors.
|
|
9
|
+
robot: z
|
|
10
|
+
.string()
|
|
11
|
+
.describe('Identifier of the [robot](https://transloadit.com/docs/robots/) to execute'),
|
|
12
|
+
})
|
|
13
|
+
.and(robotsSchema)
|
|
14
|
+
export const stepsSchema = z.record(stepSchema).describe('Contains Assembly Instructions.')
|
|
15
|
+
export type Step = z.infer<typeof stepSchema>
|
|
16
|
+
export type StepInput = z.input<typeof stepSchema>
|
|
17
|
+
export type StepInputWithUse = StepInput & RobotUse
|
|
18
|
+
export type Steps = z.infer<typeof stepsSchema>
|
|
19
|
+
export type StepsInput = z.input<typeof stepsSchema>
|
|
20
|
+
export const optionalStepsSchema = stepsSchema.optional()
|
|
21
|
+
|
|
22
|
+
export const stepSchemaWithHiddenFields = z
|
|
23
|
+
.object({
|
|
24
|
+
// This is a hack to get nicer robot hover messages in editors.
|
|
25
|
+
robot: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe('Identifier of the [robot](https://transloadit.com/docs/robots/) to execute'),
|
|
28
|
+
})
|
|
29
|
+
.and(robotsWithHiddenBotsAndFieldsSchema)
|
|
30
|
+
export const stepsSchemaWithHiddenFields = z
|
|
31
|
+
.record(stepSchemaWithHiddenFields)
|
|
32
|
+
.describe('Contains Assembly Instructions.')
|
|
33
|
+
export type StepWithHiddenFields = z.infer<typeof stepSchemaWithHiddenFields>
|
|
34
|
+
export type StepWithHiddenFieldsInput = z.input<typeof stepSchemaWithHiddenFields>
|
|
35
|
+
export type StepsWithHiddenFields = z.infer<typeof stepsSchemaWithHiddenFields>
|
|
36
|
+
export type StepsWithHiddenFieldsInput = z.input<typeof stepsSchemaWithHiddenFields>
|
|
37
|
+
const optionalStepsWithHiddenFieldsSchema = stepsSchemaWithHiddenFields.optional()
|
|
38
|
+
|
|
39
|
+
export const fieldsSchema = z
|
|
40
|
+
.record(z.any())
|
|
41
|
+
.optional()
|
|
42
|
+
.describe(
|
|
43
|
+
'An object of string keyed values (name -> value) that can be used as Assembly Variables, just like additional form fields can. You can use anything that is JSON stringifyable as a value',
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export const notifyUrlSchema = z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.nullable()
|
|
50
|
+
.describe(
|
|
51
|
+
'Transloadit can send a Pingback to your server when the Assembly is completed. We’ll send the Assembly status in a form url-encoded JSON string inside of a transloadit field in a multipart POST request to the URL supplied here.',
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
export const templateIdSchema = z
|
|
55
|
+
.string()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe(
|
|
58
|
+
'The ID of the Template that contains your Assembly Instructions. If you set `allow_steps_override` to `false` in your Template, then `steps` and `template_id` will be mutually exclusive — you may supply only one of these parameters.',
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
export const assemblyAuthInstructionsSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
key: z.string().describe('Transloadit API key used to authenticate requests'),
|
|
64
|
+
secret: z.string().optional().describe('Transloadit API secret used to sign requests'),
|
|
65
|
+
expires: z
|
|
66
|
+
.string()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe('ISO 8601 expiration timestamp for signature authentication'),
|
|
69
|
+
max_size: z.number().optional().describe('Maximum allowed upload size in bytes'),
|
|
70
|
+
nonce: z.string().optional().describe('Unique, random nonce for this request'),
|
|
71
|
+
referer: z
|
|
72
|
+
.string()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe('Regular expression matched against the HTTP Referer to restrict upload origin'),
|
|
75
|
+
})
|
|
76
|
+
.describe(`Contains at least your Transloadit Auth Key in the \`key\` property.
|
|
77
|
+
|
|
78
|
+
If you enable Signature Authentication, you must also set an expiry date for the request in the expires property:
|
|
79
|
+
|
|
80
|
+
\`\`\`jsonc
|
|
81
|
+
{
|
|
82
|
+
"key": "23c96d084c744219a2ce156772ec3211",
|
|
83
|
+
"expires": "2009-08-28T01:02:03.000Z"
|
|
84
|
+
}
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
We strongly recommend including the \`nonce\` property — a randomly generated, unique value per request that prevents duplicate processing upon retries, can aid in debugging, and avoids attack vectors such as signature key reuse:
|
|
88
|
+
|
|
89
|
+
\`\`\`jsonc
|
|
90
|
+
{
|
|
91
|
+
// …
|
|
92
|
+
"nonce": "04ac6cb6-df43-41fb-a7fd-e5dd711a64e1"
|
|
93
|
+
}
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
The \`referer\` property is a regular expression to match against the HTTP referer of this upload, such as \`"example\\.org"\`. Specify this key to make sure that uploads only come from your domain.
|
|
97
|
+
|
|
98
|
+
Uploads without a referer will always pass (as they are turned off for some browsers) making this useful in just a handful of use cases. For details about regular expressions, see [Mozilla's RegExp documentation](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp).
|
|
99
|
+
|
|
100
|
+
The \`max_size\` property can be used to set a maximum size that an upload can have in bytes, such as \`1048576\` (1 MB). Specify this to prevent users from uploading excessively large files.
|
|
101
|
+
|
|
102
|
+
This can be set as part of the Assembly request or as part of the Template.
|
|
103
|
+
|
|
104
|
+
The file size is checked as soon as the upload is started and if it exceeds the maximum size, the entire upload process is canceled and the Assembly will error out, even if it contains files that do not exceed the \`max_size\` limitation.
|
|
105
|
+
|
|
106
|
+
If you want to just ignore the files that exceed a certain size, but process all others, then please use [🤖/file/filter](https://transloadit.com/docs/robots/file-filter/).
|
|
107
|
+
`)
|
|
108
|
+
|
|
109
|
+
const assemblyInstructionsSharedShape = {
|
|
110
|
+
allow_steps_override: z
|
|
111
|
+
.boolean()
|
|
112
|
+
.optional()
|
|
113
|
+
.describe(
|
|
114
|
+
'Set this to false to disallow Overruling Templates at Runtime. If you set this to false then template_id and steps will be mutually exclusive and you may only supply one of those parameters. Recommended when deploying Transloadit in untrusted environments. This makes sense to set as part of a Template, rather than on the Assembly itself when creating it.',
|
|
115
|
+
),
|
|
116
|
+
notify_url: notifyUrlSchema,
|
|
117
|
+
fields: fieldsSchema,
|
|
118
|
+
quiet: z
|
|
119
|
+
.boolean()
|
|
120
|
+
.optional()
|
|
121
|
+
.describe(
|
|
122
|
+
'Set this to true to reduce the response from an Assembly POST request to only the necessary fields. This prevents any potentially confidential information being leaked to the end user who is making the Assembly request. A successful Assembly will only include the ok and assembly_id fields. An erroneous Assembly will only include the error, http_code, message and assembly_id fields. The full Assembly Status will then still be sent to the notify_url if one was specified.',
|
|
123
|
+
),
|
|
124
|
+
// This is done to avoid heavy inference cost
|
|
125
|
+
steps: optionalStepsSchema as typeof optionalStepsSchema,
|
|
126
|
+
template_id: templateIdSchema,
|
|
127
|
+
} as const
|
|
128
|
+
|
|
129
|
+
export const assemblyInstructionsSchema = z.object({
|
|
130
|
+
auth: assemblyAuthInstructionsSchema.optional(),
|
|
131
|
+
...assemblyInstructionsSharedShape,
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
export const assemblyInstructionsSchemaWithRequiredAuth = z.object({
|
|
135
|
+
auth: assemblyAuthInstructionsSchema,
|
|
136
|
+
...assemblyInstructionsSharedShape,
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
export type AssemblyInstructions = z.infer<typeof assemblyInstructionsSchema>
|
|
140
|
+
export type AssemblyInstructionsInput = z.input<typeof assemblyInstructionsSchema>
|
|
141
|
+
export type AssemblyAuthInstructionsInput = z.input<typeof assemblyAuthInstructionsSchema>
|
|
142
|
+
export type AssemblyAuthInstructionsPartialInput = Partial<
|
|
143
|
+
z.input<typeof assemblyAuthInstructionsSchema>
|
|
144
|
+
>
|
|
145
|
+
|
|
146
|
+
export const templateParamsSchema = z
|
|
147
|
+
.object({
|
|
148
|
+
auth: assemblyAuthInstructionsSchema,
|
|
149
|
+
name: z
|
|
150
|
+
.string()
|
|
151
|
+
.min(5)
|
|
152
|
+
.max(40)
|
|
153
|
+
.regex(/^[a-z-]+$/)
|
|
154
|
+
.describe(
|
|
155
|
+
'Name of this Template. Must be between 5-40 symbols (inclusive), lowercase, can only contain dashes and latin letters.',
|
|
156
|
+
),
|
|
157
|
+
template: z
|
|
158
|
+
.string()
|
|
159
|
+
.describe(`All the [Assembly Instructions](/docs/topics/assembly-instructions/) and [Template options](/docs/topics/templates/#template-options) as a JSON encoded string.
|
|
160
|
+
|
|
161
|
+
Example value:
|
|
162
|
+
|
|
163
|
+
\`\`\`json
|
|
164
|
+
"{\\"allow_steps_override\\": false, \\"steps\\": { ... }}"
|
|
165
|
+
\`\`\`
|
|
166
|
+
`),
|
|
167
|
+
require_signature_auth: z
|
|
168
|
+
.union([z.literal(0), z.literal(1)])
|
|
169
|
+
.default(0)
|
|
170
|
+
.describe(
|
|
171
|
+
'Use `1` to deny requests that do not include a signature. With [Signature Authentication](/docs/api/authentication/) you can ensure no one else is sending requests on your behalf.',
|
|
172
|
+
),
|
|
173
|
+
})
|
|
174
|
+
.strict()
|
|
175
|
+
|
|
176
|
+
export const templateGetParamsSchema = z
|
|
177
|
+
.object({
|
|
178
|
+
auth: assemblyAuthInstructionsSchema,
|
|
179
|
+
})
|
|
180
|
+
.strict()
|
|
181
|
+
|
|
182
|
+
export const templateListParamsSchema = z
|
|
183
|
+
.object({
|
|
184
|
+
auth: assemblyAuthInstructionsSchema,
|
|
185
|
+
page: z
|
|
186
|
+
.number()
|
|
187
|
+
.int()
|
|
188
|
+
.default(1)
|
|
189
|
+
.describe('Specifies the current page, within the current pagination'),
|
|
190
|
+
pagesize: z
|
|
191
|
+
.number()
|
|
192
|
+
.int()
|
|
193
|
+
.min(1)
|
|
194
|
+
.max(5000)
|
|
195
|
+
.default(50)
|
|
196
|
+
.describe(
|
|
197
|
+
'Specifies how many Templates to be received per API request, which is useful for pagination.',
|
|
198
|
+
),
|
|
199
|
+
sort: z
|
|
200
|
+
.enum(['id', 'name', 'created', 'modified'])
|
|
201
|
+
.default('created')
|
|
202
|
+
.describe('The field to sort by.'),
|
|
203
|
+
order: z
|
|
204
|
+
.enum(['asc', 'desc'])
|
|
205
|
+
.default('desc')
|
|
206
|
+
.describe(
|
|
207
|
+
'The sort direction. Can be `"desc"` for descending (default) or `"asc"` for ascending.',
|
|
208
|
+
),
|
|
209
|
+
fromdate: z
|
|
210
|
+
.string()
|
|
211
|
+
.describe(
|
|
212
|
+
'Specifies the minimum Assembly UTC creation date/time. Only Templates after this time will be retrieved. Use the format `Y-m-d H:i:s`.',
|
|
213
|
+
),
|
|
214
|
+
todate: z
|
|
215
|
+
.string()
|
|
216
|
+
.default('NOW()')
|
|
217
|
+
.describe(
|
|
218
|
+
'Specifies the maximum Assembly UTC creation date/time. Only Templates before this time will be retrieved. Use the format `Y-m-d H:i:s`.',
|
|
219
|
+
),
|
|
220
|
+
keywords: z
|
|
221
|
+
.array(z.string())
|
|
222
|
+
.default([])
|
|
223
|
+
.describe(
|
|
224
|
+
'Specifies keywords to be matched in the Assembly Status. The Assembly fields checked include the `id`, `redirect_url`, `fields`, and `notify_url`, as well as error messages and files used.',
|
|
225
|
+
),
|
|
226
|
+
})
|
|
227
|
+
.strict()
|
|
228
|
+
|
|
229
|
+
// These are used in system tests, but not exposed to the public right now
|
|
230
|
+
// Meaning we do not want to document them, do not want to offer auto complete on them
|
|
231
|
+
// if customers use them, they will have to surpress a typescript error
|
|
232
|
+
// however when they do, our runtime schema validation will not blow up on it
|
|
233
|
+
// because we are using this version of the schema in our actual API
|
|
234
|
+
// so that tests can also use them:
|
|
235
|
+
export const assemblyInstructionsWithHiddenSchema = assemblyInstructionsSchema.extend({
|
|
236
|
+
steps: optionalStepsWithHiddenFieldsSchema as typeof optionalStepsWithHiddenFieldsSchema,
|
|
237
|
+
imagemagick_stack: z.string().optional(),
|
|
238
|
+
exiftool_stack: z.string().optional(),
|
|
239
|
+
mplayer_stack: z.string().optional(),
|
|
240
|
+
mediainfo_stack: z.string().optional(),
|
|
241
|
+
ffmpeg_stack: z.string().optional(),
|
|
242
|
+
usage_tags: z.string().optional(),
|
|
243
|
+
response_headers: z
|
|
244
|
+
.object({
|
|
245
|
+
cors: z
|
|
246
|
+
.object({
|
|
247
|
+
'Access-Control-Allow-Methods': z.string(),
|
|
248
|
+
'Access-Control-Allow-Origin': z.string(),
|
|
249
|
+
'Access-Control-Allow-Headers': z.string(),
|
|
250
|
+
'Access-Control-Expose-Headers': z.string(),
|
|
251
|
+
'Access-Control-Allow-Credentials': z.boolean(),
|
|
252
|
+
'Access-Control-Max-Age': z.number(),
|
|
253
|
+
'Access-Control-Allow-Private-Network': z.boolean(),
|
|
254
|
+
'Access-Control-Allow-Public-Network': z.boolean(),
|
|
255
|
+
})
|
|
256
|
+
.optional(),
|
|
257
|
+
})
|
|
258
|
+
.optional(),
|
|
259
|
+
randomize_watermarks: z.boolean().optional(),
|
|
260
|
+
await: z
|
|
261
|
+
.union([
|
|
262
|
+
z.boolean(),
|
|
263
|
+
z.literal('notification'),
|
|
264
|
+
z.literal('persisting'),
|
|
265
|
+
z.literal('transcoding'),
|
|
266
|
+
])
|
|
267
|
+
.optional(),
|
|
268
|
+
blocking: z.boolean().optional(),
|
|
269
|
+
reparse_template: z.union([z.literal(1), z.boolean()]).optional(),
|
|
270
|
+
ignore_upload_meta_data_errors: z.boolean().optional(),
|
|
271
|
+
emit_execution_progress: z.boolean().optional(),
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
export type AssemblyInstructionsWithHidden = z.infer<typeof assemblyInstructionsWithHiddenSchema>
|
|
275
|
+
export type AssemblyInstructionsWithHiddenInput = z.input<
|
|
276
|
+
typeof assemblyInstructionsWithHiddenSchema
|
|
277
|
+
>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import { assemblyAuthInstructionsSchema } from './template.ts'
|
|
4
|
+
|
|
5
|
+
export const retrieveTemplateCredentialsParamsSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
auth: assemblyAuthInstructionsSchema,
|
|
8
|
+
})
|
|
9
|
+
.strict()
|
|
10
|
+
|
|
11
|
+
export const templateCredentialsSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
auth: assemblyAuthInstructionsSchema,
|
|
14
|
+
name: z
|
|
15
|
+
.string()
|
|
16
|
+
.min(4)
|
|
17
|
+
.regex(/^[a-zA-Z-]+$/)
|
|
18
|
+
.describe(
|
|
19
|
+
'Name of the Template Credentials. Must be longer than 3 characters, can only contain dashes and latin letters.',
|
|
20
|
+
),
|
|
21
|
+
type: z
|
|
22
|
+
.enum([
|
|
23
|
+
'ai',
|
|
24
|
+
'azure',
|
|
25
|
+
'backblaze',
|
|
26
|
+
'cloudflare',
|
|
27
|
+
'companion',
|
|
28
|
+
'digitalocean',
|
|
29
|
+
'dropbox',
|
|
30
|
+
'ftp',
|
|
31
|
+
'google',
|
|
32
|
+
'http',
|
|
33
|
+
'minio',
|
|
34
|
+
'rackspace',
|
|
35
|
+
's3',
|
|
36
|
+
'sftp',
|
|
37
|
+
'supabase',
|
|
38
|
+
'swift',
|
|
39
|
+
'tigris',
|
|
40
|
+
'vimeo',
|
|
41
|
+
'wasabi',
|
|
42
|
+
'youtube',
|
|
43
|
+
])
|
|
44
|
+
.describe('The service to create credentials for.'),
|
|
45
|
+
content: z
|
|
46
|
+
.object({})
|
|
47
|
+
.describe(`Key and value pairs which fill in the details of the Template Credentials. For example, for an S3 bucket, this would be a valid content object to send:
|
|
48
|
+
|
|
49
|
+
\`\`\`jsonc
|
|
50
|
+
{
|
|
51
|
+
"content": {
|
|
52
|
+
"key": "xyxy",
|
|
53
|
+
"secret": "xyxyxyxy",
|
|
54
|
+
"bucket" : "mybucket.example.com",
|
|
55
|
+
"bucket_region": "us-east-1"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
\`\`\`
|
|
59
|
+
`),
|
|
60
|
+
})
|
|
61
|
+
.strict()
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import type { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export type ZodIssueWithContext = z.ZodIssue & {
|
|
4
|
+
parentObj: unknown
|
|
5
|
+
humanReadable: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function getByPath(obj: unknown, path: string): unknown {
|
|
9
|
+
if (!path) return obj
|
|
10
|
+
const parts = path.split('.')
|
|
11
|
+
let current = obj
|
|
12
|
+
for (const part of parts) {
|
|
13
|
+
if (current == null || typeof current !== 'object') return undefined
|
|
14
|
+
current = (current as Record<string, unknown>)[part]
|
|
15
|
+
}
|
|
16
|
+
return current
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ZodParseWithContextResult<T extends z.ZodType> = {
|
|
20
|
+
errors: ZodIssueWithContext[]
|
|
21
|
+
humanReadable: string
|
|
22
|
+
} & (
|
|
23
|
+
| {
|
|
24
|
+
success: true
|
|
25
|
+
safe: z.infer<T>
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
success: false
|
|
29
|
+
safe?: never
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
export function zodParseWithContext<T extends z.ZodType>(
|
|
34
|
+
schema: T,
|
|
35
|
+
obj: unknown,
|
|
36
|
+
): ZodParseWithContextResult<T> {
|
|
37
|
+
const zodRes = schema.safeParse(obj)
|
|
38
|
+
if (!zodRes.success) {
|
|
39
|
+
// Check for empty object input causing a general union failure
|
|
40
|
+
if (
|
|
41
|
+
typeof obj === 'object' &&
|
|
42
|
+
obj !== null &&
|
|
43
|
+
Object.keys(obj).length === 0 &&
|
|
44
|
+
zodRes.error.errors.length > 0
|
|
45
|
+
) {
|
|
46
|
+
// console.log('[zodParseWithContext] Empty object detected, Zod errors:', JSON.stringify(zodRes.error.errors, null, 2));
|
|
47
|
+
|
|
48
|
+
const firstError = zodRes.error.errors[0]
|
|
49
|
+
if (
|
|
50
|
+
zodRes.error.errors.length === 1 &&
|
|
51
|
+
firstError &&
|
|
52
|
+
firstError.code === 'invalid_union' &&
|
|
53
|
+
firstError.path.length === 0 &&
|
|
54
|
+
Array.isArray((firstError as z.ZodInvalidUnionIssue).unionErrors) &&
|
|
55
|
+
(firstError as z.ZodInvalidUnionIssue).unionErrors.length > 0
|
|
56
|
+
) {
|
|
57
|
+
const humanReadable =
|
|
58
|
+
'Validation failed: Input object is empty or missing key fields required to determine its type, ' +
|
|
59
|
+
'and does not match any variant of the expected schema. Please provide a valid object.'
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
// For this specific summarized error, we might not need to map all detailed ZodIssueWithContext
|
|
63
|
+
// or we can provide a simplified single error entry reflecting this summary.
|
|
64
|
+
// For now, let's return the original errors but with the new top-level humanReadable.
|
|
65
|
+
errors: zodRes.error.errors.map((e) => ({
|
|
66
|
+
...e,
|
|
67
|
+
parentObj: obj,
|
|
68
|
+
humanReadable: e.message,
|
|
69
|
+
})),
|
|
70
|
+
humanReadable,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const zodIssuesWithContext: ZodIssueWithContext[] = []
|
|
76
|
+
const badPaths = new Map<string, string[]>()
|
|
77
|
+
|
|
78
|
+
for (const zodIssue of zodRes.error.errors) {
|
|
79
|
+
const lastPath = zodIssue.path
|
|
80
|
+
let parentObj: unknown = {}
|
|
81
|
+
|
|
82
|
+
if (lastPath) {
|
|
83
|
+
const strPath = lastPath.slice(0, -1).join('.')
|
|
84
|
+
parentObj = getByPath(obj, strPath) ?? {}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const path = zodIssue.path
|
|
88
|
+
.map((p) => (typeof p === 'string' ? p.replaceAll('.', '\\.') : p))
|
|
89
|
+
.join('.')
|
|
90
|
+
if (!badPaths.has(path)) {
|
|
91
|
+
badPaths.set(path, [])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const messages: string[] = []
|
|
95
|
+
|
|
96
|
+
// --- Handle specific high-priority codes BEFORE union/switch ---
|
|
97
|
+
if (zodIssue.code === 'unrecognized_keys') {
|
|
98
|
+
const maxKeysToShow = 3
|
|
99
|
+
const { keys } = zodIssue
|
|
100
|
+
const truncatedKeys = keys.slice(0, maxKeysToShow)
|
|
101
|
+
const ellipsis = keys.length > maxKeysToShow ? '...' : ''
|
|
102
|
+
let message = `has unrecognized keys: ${truncatedKeys.map((k) => `\`${k}\``).join(', ')}${ellipsis}`
|
|
103
|
+
// Add hint for root-level unrecognized keys, likely from union .strict() failures
|
|
104
|
+
if (zodIssue.path.length === 0) {
|
|
105
|
+
message +=
|
|
106
|
+
' (Hint: No union variant matched. Check for extra keys or type mismatches in variants.)'
|
|
107
|
+
}
|
|
108
|
+
messages.push(message)
|
|
109
|
+
}
|
|
110
|
+
// --- End high-priority handling ---
|
|
111
|
+
|
|
112
|
+
// Handle union type validation errors (only if not handled above)
|
|
113
|
+
else if ('unionErrors' in zodIssue && zodIssue.unionErrors) {
|
|
114
|
+
// --- Moved initialization out of the loop ---
|
|
115
|
+
const collectedLiterals: Record<string, (string | number | boolean)[]> = {}
|
|
116
|
+
const collectedMessages: Record<string, Set<string>> = {}
|
|
117
|
+
|
|
118
|
+
// Process nested issues within the union
|
|
119
|
+
for (const unionError of zodIssue.unionErrors) {
|
|
120
|
+
for (const issue of unionError.issues) {
|
|
121
|
+
// console.log('---- Zod Union Issue ----\\n', JSON.stringify(issue, null, 2))
|
|
122
|
+
const nestedPath = issue.path.join('.')
|
|
123
|
+
|
|
124
|
+
// Ensure paths exist in collection maps
|
|
125
|
+
if (!collectedLiterals[nestedPath]) collectedLiterals[nestedPath] = []
|
|
126
|
+
if (!collectedMessages[nestedPath]) collectedMessages[nestedPath] = new Set()
|
|
127
|
+
|
|
128
|
+
if (issue.code === 'custom' && issue.message.includes('interpolation string')) {
|
|
129
|
+
continue
|
|
130
|
+
}
|
|
131
|
+
if (issue.code === 'invalid_literal') {
|
|
132
|
+
const { expected } = issue
|
|
133
|
+
if (
|
|
134
|
+
expected !== undefined &&
|
|
135
|
+
expected !== null &&
|
|
136
|
+
(typeof expected === 'string' ||
|
|
137
|
+
typeof expected === 'number' ||
|
|
138
|
+
typeof expected === 'boolean')
|
|
139
|
+
) {
|
|
140
|
+
collectedLiterals[nestedPath].push(expected)
|
|
141
|
+
}
|
|
142
|
+
// Still add the raw message for fallback
|
|
143
|
+
collectedMessages[nestedPath].add(issue.message)
|
|
144
|
+
}
|
|
145
|
+
// Keep existing enum handling if needed, but literal should cover most cases
|
|
146
|
+
else if (issue.code === 'invalid_enum_value') {
|
|
147
|
+
const { options } = issue
|
|
148
|
+
if (options && options.length > 0) {
|
|
149
|
+
collectedLiterals[nestedPath].push(...options.map(String)) // Assuming options are compatible
|
|
150
|
+
}
|
|
151
|
+
collectedMessages[nestedPath].add(issue.message)
|
|
152
|
+
}
|
|
153
|
+
// Keep existing unrecognized keys handling
|
|
154
|
+
else if (issue.code === 'unrecognized_keys') {
|
|
155
|
+
const maxKeysToShow = 3
|
|
156
|
+
const { keys } = issue
|
|
157
|
+
const truncatedKeys = keys.slice(0, maxKeysToShow)
|
|
158
|
+
const ellipsis = keys.length > maxKeysToShow ? '...' : ''
|
|
159
|
+
collectedMessages[nestedPath].add(
|
|
160
|
+
`has unrecognized keys: ${truncatedKeys.map((k) => `\`${k}\``).join(', ')}${ellipsis}`,
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
// <-- Add handling for invalid_type here -->
|
|
164
|
+
else if (issue.code === 'invalid_type') {
|
|
165
|
+
const received = issue.received === 'undefined' ? 'missing' : issue.received
|
|
166
|
+
const actualValue = getByPath(parentObj, nestedPath)
|
|
167
|
+
const actualValueStr =
|
|
168
|
+
typeof actualValue === 'object' && actualValue !== null
|
|
169
|
+
? JSON.stringify(actualValue)
|
|
170
|
+
: String(actualValue)
|
|
171
|
+
|
|
172
|
+
let expectedOutput = String(issue.expected)
|
|
173
|
+
const MAX_EXPECTED_TO_SHOW = 3
|
|
174
|
+
if (typeof issue.expected === 'string' && issue.expected.includes(' | ')) {
|
|
175
|
+
const expectedValues = issue.expected.split(' | ')
|
|
176
|
+
if (expectedValues.length > MAX_EXPECTED_TO_SHOW) {
|
|
177
|
+
const shownValues = expectedValues.slice(0, MAX_EXPECTED_TO_SHOW).join(' | ')
|
|
178
|
+
const remainingCount = expectedValues.length - MAX_EXPECTED_TO_SHOW
|
|
179
|
+
expectedOutput = `${shownValues} | .. or ${remainingCount} others ..`
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
collectedMessages[nestedPath].add(
|
|
184
|
+
`got invalid type: ${received} (value: \`${actualValueStr}\`, expected: ${expectedOutput})`,
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
// <-- End added handling -->
|
|
188
|
+
else {
|
|
189
|
+
collectedMessages[nestedPath].add(issue.message) // Handle other nested codes
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// --- Moved processing logic here ---
|
|
195
|
+
// Now, add messages to badPaths based on collected info AFTER processing ALL union errors
|
|
196
|
+
for (const nestedPath in collectedMessages) {
|
|
197
|
+
if (!badPaths.has(nestedPath)) {
|
|
198
|
+
badPaths.set(nestedPath, [])
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const targetMessages = badPaths.get(nestedPath)
|
|
202
|
+
if (!targetMessages) {
|
|
203
|
+
continue
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Prioritize more specific messages (like invalid type with details)
|
|
207
|
+
const invalidTypeMessages = Array.from(collectedMessages[nestedPath]).filter((m) =>
|
|
208
|
+
m.startsWith('got invalid type:'),
|
|
209
|
+
)
|
|
210
|
+
const unrecognizedKeyMessages = Array.from(collectedMessages[nestedPath]).filter((m) =>
|
|
211
|
+
m.startsWith('has unrecognized keys:'),
|
|
212
|
+
)
|
|
213
|
+
const literalMessages = collectedLiterals[nestedPath] ?? []
|
|
214
|
+
|
|
215
|
+
if (invalidTypeMessages.length > 0) {
|
|
216
|
+
targetMessages.push(...invalidTypeMessages)
|
|
217
|
+
} else if (unrecognizedKeyMessages.length > 0) {
|
|
218
|
+
targetMessages.push(...unrecognizedKeyMessages)
|
|
219
|
+
} else if (literalMessages.length > 0) {
|
|
220
|
+
const uniqueLiterals = [...new Set(literalMessages)]
|
|
221
|
+
targetMessages.push(`should be one of: \`${uniqueLiterals.join('`, `')}\``)
|
|
222
|
+
} else {
|
|
223
|
+
// Fallback to joining the collected raw messages for this path
|
|
224
|
+
targetMessages.push(...collectedMessages[nestedPath])
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// Handle other specific error codes (only if not handled above)
|
|
229
|
+
else {
|
|
230
|
+
// Handle specific error codes for better messages
|
|
231
|
+
let received: string
|
|
232
|
+
let type: string
|
|
233
|
+
let bigType: string
|
|
234
|
+
|
|
235
|
+
switch (zodIssue.code) {
|
|
236
|
+
case 'invalid_type': {
|
|
237
|
+
received = zodIssue.received === 'undefined' ? 'missing' : zodIssue.received
|
|
238
|
+
const actualValue = getByPath(obj, path)
|
|
239
|
+
const actualValueStr =
|
|
240
|
+
typeof actualValue === 'object' && actualValue !== null
|
|
241
|
+
? JSON.stringify(actualValue)
|
|
242
|
+
: String(actualValue) // Use String() for null/primitives
|
|
243
|
+
|
|
244
|
+
// Simple message not relying on zodIssue.expected
|
|
245
|
+
messages.push(`got invalid type: ${received} (value: \`${actualValueStr}\`)`)
|
|
246
|
+
break
|
|
247
|
+
}
|
|
248
|
+
case 'invalid_string':
|
|
249
|
+
if (zodIssue.validation === 'email') {
|
|
250
|
+
messages.push('should be a valid email address')
|
|
251
|
+
} else if (zodIssue.validation === 'url') {
|
|
252
|
+
messages.push('should be a valid URL')
|
|
253
|
+
} else {
|
|
254
|
+
messages.push(zodIssue.message)
|
|
255
|
+
}
|
|
256
|
+
break
|
|
257
|
+
case 'too_small':
|
|
258
|
+
type = zodIssue.type === 'string' ? 'characters' : 'items'
|
|
259
|
+
messages.push(`should have at least ${zodIssue.minimum} ${type}`)
|
|
260
|
+
break
|
|
261
|
+
case 'too_big':
|
|
262
|
+
bigType = zodIssue.type === 'string' ? 'characters' : 'items'
|
|
263
|
+
messages.push(`should have at most ${zodIssue.maximum} ${bigType}`)
|
|
264
|
+
break
|
|
265
|
+
case 'custom':
|
|
266
|
+
messages.push(zodIssue.message)
|
|
267
|
+
break
|
|
268
|
+
default:
|
|
269
|
+
messages.push(zodIssue.message)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Ensure messages collected directly in the `messages` array (e.g., from the switch)
|
|
274
|
+
// are added to the correct path in badPaths.
|
|
275
|
+
if (messages.length > 0) {
|
|
276
|
+
badPaths.get(path)?.push(...messages)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const field = path || 'Input'
|
|
280
|
+
// Ensure humanReadable for the individual ZodIssueWithContext is still generated correctly
|
|
281
|
+
// even if messages array is empty because handled via badPaths/nested issues.
|
|
282
|
+
const issueSpecificMessages = badPaths.get(path) ?? messages
|
|
283
|
+
const humanReadable = `Path \`${field}\` ${issueSpecificMessages.join(', ')}`
|
|
284
|
+
|
|
285
|
+
zodIssuesWithContext.push({
|
|
286
|
+
...zodIssue,
|
|
287
|
+
parentObj,
|
|
288
|
+
humanReadable,
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Improved formatting for the top-level humanReadable string
|
|
293
|
+
const errorList = Array.from(badPaths.entries())
|
|
294
|
+
.map(([path, messages]) => {
|
|
295
|
+
const field = path || 'Input'
|
|
296
|
+
return ` - \`${field}\`: ${messages.join(', ')}` // Format as list item
|
|
297
|
+
})
|
|
298
|
+
.join('\n')
|
|
299
|
+
|
|
300
|
+
const humanReadable = `Validation failed for the following fields:\n${errorList}` // Add header
|
|
301
|
+
|
|
302
|
+
return { success: false, errors: zodIssuesWithContext, humanReadable }
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return { success: true, safe: zodRes.data, errors: [], humanReadable: '' }
|
|
306
|
+
}
|