@transloadit/node 4.1.3 → 4.1.5
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/dist/alphalib/types/assemblyReplay.d.ts +2 -0
- package/dist/alphalib/types/assemblyReplay.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyReplayNotification.d.ts +2 -0
- package/dist/alphalib/types/assemblyReplayNotification.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyStatus.d.ts +50 -14
- package/dist/alphalib/types/assemblyStatus.d.ts.map +1 -1
- package/dist/alphalib/types/assemblyStatus.js +60 -1
- package/dist/alphalib/types/assemblyStatus.js.map +1 -1
- package/dist/alphalib/types/robots/_index.d.ts +12 -0
- package/dist/alphalib/types/robots/_index.d.ts.map +1 -1
- package/dist/alphalib/types/robots/ai-chat.d.ts +14 -2
- package/dist/alphalib/types/robots/ai-chat.d.ts.map +1 -1
- package/dist/alphalib/types/robots/ai-chat.js +18 -25
- package/dist/alphalib/types/robots/ai-chat.js.map +1 -1
- package/dist/alphalib/types/robots/file-filter.d.ts.map +1 -1
- package/dist/alphalib/types/robots/file-filter.js +3 -1
- package/dist/alphalib/types/robots/file-filter.js.map +1 -1
- package/dist/alphalib/types/template.d.ts +24 -0
- package/dist/alphalib/types/template.d.ts.map +1 -1
- package/dist/alphalib/types/templateCredential.d.ts +2 -2
- package/dist/cli.js +0 -0
- package/package.json +1 -1
- package/src/alphalib/types/assemblyStatus.ts +79 -1
- package/src/alphalib/types/robots/ai-chat.ts +22 -34
- package/src/alphalib/types/robots/file-filter.ts +3 -1
|
@@ -76,7 +76,7 @@ export declare const templateCredentialsSchema: z.ZodObject<{
|
|
|
76
76
|
max_size?: number | undefined;
|
|
77
77
|
nonce?: string | undefined;
|
|
78
78
|
};
|
|
79
|
-
type: "http" | "
|
|
79
|
+
type: "http" | "cloudflare" | "ai" | "vimeo" | "azure" | "backblaze" | "companion" | "digitalocean" | "dropbox" | "ftp" | "google" | "minio" | "rackspace" | "s3" | "sftp" | "supabase" | "swift" | "tigris" | "wasabi" | "youtube";
|
|
80
80
|
name: string;
|
|
81
81
|
content: {};
|
|
82
82
|
}, {
|
|
@@ -88,7 +88,7 @@ export declare const templateCredentialsSchema: z.ZodObject<{
|
|
|
88
88
|
max_size?: number | undefined;
|
|
89
89
|
nonce?: string | undefined;
|
|
90
90
|
};
|
|
91
|
-
type: "http" | "
|
|
91
|
+
type: "http" | "cloudflare" | "ai" | "vimeo" | "azure" | "backblaze" | "companion" | "digitalocean" | "dropbox" | "ftp" | "google" | "minio" | "rackspace" | "s3" | "sftp" | "supabase" | "swift" | "tigris" | "wasabi" | "youtube";
|
|
92
92
|
name: string;
|
|
93
93
|
content: {};
|
|
94
94
|
}>;
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
|
-
export const assemblyBusyCodeSchema = z.enum([
|
|
3
|
+
export const assemblyBusyCodeSchema = z.enum([
|
|
4
|
+
'ASSEMBLY_UPLOADING',
|
|
5
|
+
'ASSEMBLY_EXECUTING',
|
|
6
|
+
'ASSEMBLY_REPLAYING',
|
|
7
|
+
])
|
|
4
8
|
|
|
5
9
|
export const assemblyStatusOkCodeSchema = z.enum([
|
|
6
10
|
'ASSEMBLY_CANCELED',
|
|
@@ -50,6 +54,7 @@ export const assemblyStatusErrCodeSchema = z.enum([
|
|
|
50
54
|
'ASSEMBLY_STEP_NO_ROBOT',
|
|
51
55
|
'ASSEMBLY_STEP_UNKNOWN_ROBOT',
|
|
52
56
|
'ASSEMBLY_STEP_UNKNOWN_USE',
|
|
57
|
+
'AI_CHAT_VALIDATION',
|
|
53
58
|
'ASSEMBLY_URL_TRANSFORM_MISSING',
|
|
54
59
|
'AUTH_EXPIRED',
|
|
55
60
|
'AUTH_KEY_SCOPES_NOT_FOUND',
|
|
@@ -732,6 +737,79 @@ export function getOk(assembly: AssemblyStatus | undefined | null): string | und
|
|
|
732
737
|
: undefined
|
|
733
738
|
}
|
|
734
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Type guard to check if a status string is a busy (in-progress) state.
|
|
742
|
+
*/
|
|
743
|
+
export function isAssemblyBusyStatus(
|
|
744
|
+
status: string | undefined | null,
|
|
745
|
+
): status is z.infer<typeof assemblyBusyCodeSchema> {
|
|
746
|
+
return Boolean(status) && assemblyBusyCodeSchema.safeParse(status).success
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Type guard to check if a status string is an ok (non-error) state.
|
|
751
|
+
*/
|
|
752
|
+
export function isAssemblyOkStatus(
|
|
753
|
+
status: string | undefined | null,
|
|
754
|
+
): status is z.infer<typeof assemblyStatusOkCodeSchema> {
|
|
755
|
+
return Boolean(status) && assemblyStatusOkCodeSchema.safeParse(status).success
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Type guard to check if a status string is an error state.
|
|
760
|
+
*/
|
|
761
|
+
export function isAssemblyErrorStatus(
|
|
762
|
+
status: string | undefined | null,
|
|
763
|
+
): status is z.infer<typeof assemblyStatusErrCodeSchema> {
|
|
764
|
+
return Boolean(status) && assemblyStatusErrCodeSchema.safeParse(status).success
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Type guard to check if an assembly matches the system error shape.
|
|
769
|
+
*/
|
|
770
|
+
export function isAssemblySysError(
|
|
771
|
+
assembly: AssemblyStatus | undefined | null,
|
|
772
|
+
): assembly is z.infer<typeof assemblyStatusSysErrSchema> {
|
|
773
|
+
return Boolean(assembly) && assemblyStatusSysErrSchema.safeParse(assembly).success
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Type guard to check if a status string is terminal (ok, but not busy).
|
|
778
|
+
*/
|
|
779
|
+
export function isAssemblyTerminalOkStatus(
|
|
780
|
+
status: string | undefined | null,
|
|
781
|
+
): status is z.infer<typeof assemblyStatusOkCodeSchema> {
|
|
782
|
+
return isAssemblyOkStatus(status) && !isAssemblyBusyStatus(status)
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Returns true if the assembly is in a busy (in-progress) state.
|
|
787
|
+
*/
|
|
788
|
+
export function isAssemblyBusy(assembly: AssemblyStatus | undefined | null): boolean {
|
|
789
|
+
return isAssemblyBusyStatus(getOk(assembly))
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Returns true if the assembly is in a terminal ok state.
|
|
794
|
+
*/
|
|
795
|
+
export function isAssemblyTerminalOk(assembly: AssemblyStatus | undefined | null): boolean {
|
|
796
|
+
return isAssemblyTerminalOkStatus(getOk(assembly))
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Returns true if the assembly has a terminal error state.
|
|
801
|
+
*/
|
|
802
|
+
export function isAssemblyTerminalError(assembly: AssemblyStatus | undefined | null): boolean {
|
|
803
|
+
return isAssemblyErrorStatus(getError(assembly)) || isAssemblySysError(assembly)
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Returns true if the assembly is terminal (ok or error).
|
|
808
|
+
*/
|
|
809
|
+
export function isAssemblyTerminal(assembly: AssemblyStatus | undefined | null): boolean {
|
|
810
|
+
return isAssemblyTerminalOk(assembly) || isAssemblyTerminalError(assembly)
|
|
811
|
+
}
|
|
812
|
+
|
|
735
813
|
/**
|
|
736
814
|
* This type and these functions below are compatibility helpers for
|
|
737
815
|
* working with partial assembly status objects during the transition
|
|
@@ -141,39 +141,6 @@ export const meta: RobotMetaInput = {
|
|
|
141
141
|
stage: 'alpha',
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
export const vendorModelSchema = z
|
|
145
|
-
.string()
|
|
146
|
-
.regex(/^[a-z]+\/[a-z0-9.-]+$/, 'Must be in format "vendor/model"')
|
|
147
|
-
.refine(
|
|
148
|
-
(val) => {
|
|
149
|
-
const [vendor, model] = val.split('/')
|
|
150
|
-
if (vendor === 'anthropic') {
|
|
151
|
-
return model === 'claude-4-sonnet-20250514' || model === 'claude-4-opus-20250514'
|
|
152
|
-
}
|
|
153
|
-
if (vendor === 'openai') {
|
|
154
|
-
return (
|
|
155
|
-
model === 'gpt-4.1-2025-04-14' ||
|
|
156
|
-
model === 'chatgpt-4o-latest' ||
|
|
157
|
-
model === 'o3-2025-04-16' ||
|
|
158
|
-
model === 'gpt-4o-audio-preview'
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
if (vendor === 'google') {
|
|
162
|
-
return model === 'gemini-2.5-pro'
|
|
163
|
-
}
|
|
164
|
-
if (vendor === 'moonshot') {
|
|
165
|
-
return model === 'kimi-k2'
|
|
166
|
-
}
|
|
167
|
-
return false
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
message:
|
|
171
|
-
'Invalid vendor/model combination. Supported: anthropic/claude-4-sonnet-20250514, anthropic/claude-4-opus-20250514, openai/gpt-4.1-2025-04-14, openai/chatgpt-4o-latest, openai/o3-2025-04-16, openai/gpt-4o-audio-preview, google/gemini-2.5-pro, moonshot/kimi-k2',
|
|
172
|
-
},
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
export type VendorModel = z.infer<typeof vendorModelSchema>
|
|
176
|
-
|
|
177
144
|
/**
|
|
178
145
|
* Model capabilities for /ai/chat. This centralizes which models support which input types.
|
|
179
146
|
* Key format: 'vendor/model'
|
|
@@ -181,14 +148,31 @@ export type VendorModel = z.infer<typeof vendorModelSchema>
|
|
|
181
148
|
export const MODEL_CAPABILITIES: Record<string, { pdf: boolean; image: boolean }> = {
|
|
182
149
|
'anthropic/claude-4-sonnet-20250514': { pdf: true, image: true },
|
|
183
150
|
'anthropic/claude-4-opus-20250514': { pdf: true, image: true },
|
|
184
|
-
'
|
|
151
|
+
'anthropic/claude-sonnet-4-5': { pdf: true, image: true },
|
|
152
|
+
'anthropic/claude-opus-4-5': { pdf: true, image: true },
|
|
185
153
|
'openai/gpt-4.1-2025-04-14': { pdf: false, image: true },
|
|
186
154
|
'openai/chatgpt-4o-latest': { pdf: false, image: true },
|
|
187
155
|
'openai/o3-2025-04-16': { pdf: false, image: true },
|
|
188
156
|
'openai/gpt-4o-audio-preview': { pdf: false, image: false },
|
|
157
|
+
'openai/gpt-5.2': { pdf: false, image: true },
|
|
158
|
+
'openai/gpt-5.2-2025-12-11': { pdf: false, image: true },
|
|
159
|
+
'openai/gpt-5.2-chat-latest': { pdf: false, image: true },
|
|
160
|
+
'openai/gpt-5.2-pro': { pdf: false, image: true },
|
|
161
|
+
'google/gemini-2.5-pro': { pdf: true, image: true },
|
|
189
162
|
'moonshot/kimi-k2': { pdf: false, image: false },
|
|
190
163
|
}
|
|
191
164
|
|
|
165
|
+
const supportedModelsList = Object.keys(MODEL_CAPABILITIES)
|
|
166
|
+
|
|
167
|
+
export const vendorModelSchema = z
|
|
168
|
+
.string()
|
|
169
|
+
.regex(/^[a-z]+\/[a-z0-9.-]+$/, 'Must be in format "vendor/model"')
|
|
170
|
+
.refine((val) => Object.hasOwn(MODEL_CAPABILITIES, val), {
|
|
171
|
+
message: `Invalid vendor/model combination. Supported: ${supportedModelsList.join(', ')}`,
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
export type VendorModel = z.infer<typeof vendorModelSchema>
|
|
175
|
+
|
|
192
176
|
export const robotAiChatInstructionsSchema = robotBase
|
|
193
177
|
.merge(robotUse)
|
|
194
178
|
.extend({
|
|
@@ -214,6 +198,10 @@ export const robotAiChatInstructionsSchema = robotBase
|
|
|
214
198
|
.union([z.string(), z.array(z.string())])
|
|
215
199
|
.optional()
|
|
216
200
|
.describe('Names of template credentials to make available to the robot.'),
|
|
201
|
+
test_credentials: z
|
|
202
|
+
.boolean()
|
|
203
|
+
.optional()
|
|
204
|
+
.describe('Use Transloadit-provided credentials for testing.'),
|
|
217
205
|
mcp_servers: z
|
|
218
206
|
.array(
|
|
219
207
|
z.object({
|
|
@@ -67,7 +67,7 @@ Passing JavaScript allows you to implement logic as complex as you wish, however
|
|
|
67
67
|
The \`accepts\` and \`declines\` parameters can each be set to an array of arrays with three members:
|
|
68
68
|
|
|
69
69
|
1. A value or job variable, such as \`\${file.mime}\`
|
|
70
|
-
2. One of the following operators: \`==\`, \`===\`, \`<\`, \`>\`, \`<=\`, \`>=\`, \`!=\`, \`!==\`, \`regex\`, \`!regex\`
|
|
70
|
+
2. One of the following operators: \`==\`, \`===\`, \`<\`, \`>\`, \`<=\`, \`>=\`, \`!=\`, \`!==\`, \`regex\`, \`!regex\`, \`includes\`, \`!includes\`
|
|
71
71
|
3. A value or job variable, such as \`50\` or \`"foo"\`
|
|
72
72
|
|
|
73
73
|
Examples:
|
|
@@ -77,6 +77,8 @@ Examples:
|
|
|
77
77
|
- \`[["720", ">=", "\${file.size}"]]\`
|
|
78
78
|
- \`[["\${file.mime}", "regex", "image"]]\`
|
|
79
79
|
|
|
80
|
+
The \`includes\` and \`!includes\` operators work with arrays or strings (strings use substring checks).
|
|
81
|
+
|
|
80
82
|
> [!Warning]
|
|
81
83
|
> If you would like to match against a \`null\` value or a value that is not present (like an audio file does not have a \`video_codec\` property in its metadata), match against \`""\` (an empty string) instead. We’ll support proper matching against \`null\` in the future, but we cannot easily do so right now without breaking backwards compatibility.
|
|
82
84
|
|