@trigger.dev/core 4.5.0-rc.2 → 4.5.0-rc.4
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/commonjs/v3/errors.js +1 -0
- package/dist/commonjs/v3/errors.js.map +1 -1
- package/dist/commonjs/v3/otel/tracingSDK.d.ts +9 -0
- package/dist/commonjs/v3/otel/tracingSDK.js +32 -33
- package/dist/commonjs/v3/otel/tracingSDK.js.map +1 -1
- package/dist/commonjs/v3/schemas/api.d.ts +203 -22
- package/dist/commonjs/v3/schemas/api.js +16 -4
- package/dist/commonjs/v3/schemas/api.js.map +1 -1
- package/dist/commonjs/v3/schemas/batchItemNDJSON.test.d.ts +1 -0
- package/dist/commonjs/v3/schemas/batchItemNDJSON.test.js +79 -0
- package/dist/commonjs/v3/schemas/batchItemNDJSON.test.js.map +1 -0
- package/dist/commonjs/v3/utils/flattenAttributes.js +8 -4
- package/dist/commonjs/v3/utils/flattenAttributes.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/errors.js +1 -0
- package/dist/esm/v3/errors.js.map +1 -1
- package/dist/esm/v3/otel/tracingSDK.d.ts +9 -0
- package/dist/esm/v3/otel/tracingSDK.js +31 -33
- package/dist/esm/v3/otel/tracingSDK.js.map +1 -1
- package/dist/esm/v3/schemas/api.d.ts +203 -22
- package/dist/esm/v3/schemas/api.js +16 -4
- package/dist/esm/v3/schemas/api.js.map +1 -1
- package/dist/esm/v3/schemas/batchItemNDJSON.test.d.ts +1 -0
- package/dist/esm/v3/schemas/batchItemNDJSON.test.js +77 -0
- package/dist/esm/v3/schemas/batchItemNDJSON.test.js.map +1 -0
- package/dist/esm/v3/utils/flattenAttributes.js +8 -4
- package/dist/esm/v3/utils/flattenAttributes.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +2 -2
|
@@ -891,7 +891,7 @@ export declare const TriggerTaskRequestBody: z.ZodObject<{
|
|
|
891
891
|
name: string;
|
|
892
892
|
concurrencyLimit?: number | undefined;
|
|
893
893
|
}>>;
|
|
894
|
-
concurrencyKey: z.ZodOptional<z.ZodString
|
|
894
|
+
concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
|
|
895
895
|
delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
896
896
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
897
897
|
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
@@ -988,7 +988,7 @@ export declare const TriggerTaskRequestBody: z.ZodObject<{
|
|
|
988
988
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
989
989
|
delay?: string | Date | undefined;
|
|
990
990
|
idempotencyKeyTTL?: string | undefined;
|
|
991
|
-
concurrencyKey?: string | undefined;
|
|
991
|
+
concurrencyKey?: string | number | undefined;
|
|
992
992
|
ttl?: string | number | undefined;
|
|
993
993
|
debounce?: {
|
|
994
994
|
key: string;
|
|
@@ -1070,7 +1070,7 @@ export declare const TriggerTaskRequestBody: z.ZodObject<{
|
|
|
1070
1070
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1071
1071
|
delay?: string | Date | undefined;
|
|
1072
1072
|
idempotencyKeyTTL?: string | undefined;
|
|
1073
|
-
concurrencyKey?: string | undefined;
|
|
1073
|
+
concurrencyKey?: string | number | undefined;
|
|
1074
1074
|
ttl?: string | number | undefined;
|
|
1075
1075
|
debounce?: {
|
|
1076
1076
|
key: string;
|
|
@@ -1148,7 +1148,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
|
|
|
1148
1148
|
name: string;
|
|
1149
1149
|
concurrencyLimit?: number | undefined;
|
|
1150
1150
|
}>>;
|
|
1151
|
-
concurrencyKey: z.ZodOptional<z.ZodString
|
|
1151
|
+
concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
|
|
1152
1152
|
delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
1153
1153
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
1154
1154
|
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
@@ -1245,7 +1245,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
|
|
|
1245
1245
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1246
1246
|
delay?: string | Date | undefined;
|
|
1247
1247
|
idempotencyKeyTTL?: string | undefined;
|
|
1248
|
-
concurrencyKey?: string | undefined;
|
|
1248
|
+
concurrencyKey?: string | number | undefined;
|
|
1249
1249
|
ttl?: string | number | undefined;
|
|
1250
1250
|
debounce?: {
|
|
1251
1251
|
key: string;
|
|
@@ -1327,7 +1327,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
|
|
|
1327
1327
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1328
1328
|
delay?: string | Date | undefined;
|
|
1329
1329
|
idempotencyKeyTTL?: string | undefined;
|
|
1330
|
-
concurrencyKey?: string | undefined;
|
|
1330
|
+
concurrencyKey?: string | number | undefined;
|
|
1331
1331
|
ttl?: string | number | undefined;
|
|
1332
1332
|
debounce?: {
|
|
1333
1333
|
key: string;
|
|
@@ -1417,7 +1417,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
|
|
|
1417
1417
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1418
1418
|
delay?: string | Date | undefined;
|
|
1419
1419
|
idempotencyKeyTTL?: string | undefined;
|
|
1420
|
-
concurrencyKey?: string | undefined;
|
|
1420
|
+
concurrencyKey?: string | number | undefined;
|
|
1421
1421
|
ttl?: string | number | undefined;
|
|
1422
1422
|
debounce?: {
|
|
1423
1423
|
key: string;
|
|
@@ -1451,7 +1451,7 @@ export declare const BatchTriggerTaskItem: z.ZodObject<{
|
|
|
1451
1451
|
payload: z.ZodAny;
|
|
1452
1452
|
context: z.ZodAny;
|
|
1453
1453
|
options: z.ZodOptional<z.ZodObject<{
|
|
1454
|
-
concurrencyKey: z.ZodOptional<z.ZodString
|
|
1454
|
+
concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
|
|
1455
1455
|
delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
1456
1456
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
1457
1457
|
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
@@ -1548,7 +1548,7 @@ export declare const BatchTriggerTaskItem: z.ZodObject<{
|
|
|
1548
1548
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1549
1549
|
delay?: string | Date | undefined;
|
|
1550
1550
|
idempotencyKeyTTL?: string | undefined;
|
|
1551
|
-
concurrencyKey?: string | undefined;
|
|
1551
|
+
concurrencyKey?: string | number | undefined;
|
|
1552
1552
|
ttl?: string | number | undefined;
|
|
1553
1553
|
debounce?: {
|
|
1554
1554
|
key: string;
|
|
@@ -1618,7 +1618,7 @@ export declare const BatchTriggerTaskItem: z.ZodObject<{
|
|
|
1618
1618
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1619
1619
|
delay?: string | Date | undefined;
|
|
1620
1620
|
idempotencyKeyTTL?: string | undefined;
|
|
1621
|
-
concurrencyKey?: string | undefined;
|
|
1621
|
+
concurrencyKey?: string | number | undefined;
|
|
1622
1622
|
ttl?: string | number | undefined;
|
|
1623
1623
|
debounce?: {
|
|
1624
1624
|
key: string;
|
|
@@ -1645,7 +1645,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
|
|
|
1645
1645
|
payload: z.ZodAny;
|
|
1646
1646
|
context: z.ZodAny;
|
|
1647
1647
|
options: z.ZodOptional<z.ZodObject<{
|
|
1648
|
-
concurrencyKey: z.ZodOptional<z.ZodString
|
|
1648
|
+
concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
|
|
1649
1649
|
delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
1650
1650
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
1651
1651
|
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
@@ -1742,7 +1742,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
|
|
|
1742
1742
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1743
1743
|
delay?: string | Date | undefined;
|
|
1744
1744
|
idempotencyKeyTTL?: string | undefined;
|
|
1745
|
-
concurrencyKey?: string | undefined;
|
|
1745
|
+
concurrencyKey?: string | number | undefined;
|
|
1746
1746
|
ttl?: string | number | undefined;
|
|
1747
1747
|
debounce?: {
|
|
1748
1748
|
key: string;
|
|
@@ -1812,7 +1812,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
|
|
|
1812
1812
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1813
1813
|
delay?: string | Date | undefined;
|
|
1814
1814
|
idempotencyKeyTTL?: string | undefined;
|
|
1815
|
-
concurrencyKey?: string | undefined;
|
|
1815
|
+
concurrencyKey?: string | number | undefined;
|
|
1816
1816
|
ttl?: string | number | undefined;
|
|
1817
1817
|
debounce?: {
|
|
1818
1818
|
key: string;
|
|
@@ -1903,7 +1903,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
|
|
|
1903
1903
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
1904
1904
|
delay?: string | Date | undefined;
|
|
1905
1905
|
idempotencyKeyTTL?: string | undefined;
|
|
1906
|
-
concurrencyKey?: string | undefined;
|
|
1906
|
+
concurrencyKey?: string | number | undefined;
|
|
1907
1907
|
ttl?: string | number | undefined;
|
|
1908
1908
|
debounce?: {
|
|
1909
1909
|
key: string;
|
|
@@ -1976,7 +1976,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
|
|
|
1976
1976
|
payload: z.ZodAny;
|
|
1977
1977
|
context: z.ZodAny;
|
|
1978
1978
|
options: z.ZodOptional<z.ZodObject<{
|
|
1979
|
-
concurrencyKey: z.ZodOptional<z.ZodString
|
|
1979
|
+
concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
|
|
1980
1980
|
delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
1981
1981
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
1982
1982
|
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
@@ -2073,7 +2073,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
|
|
|
2073
2073
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2074
2074
|
delay?: string | Date | undefined;
|
|
2075
2075
|
idempotencyKeyTTL?: string | undefined;
|
|
2076
|
-
concurrencyKey?: string | undefined;
|
|
2076
|
+
concurrencyKey?: string | number | undefined;
|
|
2077
2077
|
ttl?: string | number | undefined;
|
|
2078
2078
|
debounce?: {
|
|
2079
2079
|
key: string;
|
|
@@ -2143,7 +2143,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
|
|
|
2143
2143
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2144
2144
|
delay?: string | Date | undefined;
|
|
2145
2145
|
idempotencyKeyTTL?: string | undefined;
|
|
2146
|
-
concurrencyKey?: string | undefined;
|
|
2146
|
+
concurrencyKey?: string | number | undefined;
|
|
2147
2147
|
ttl?: string | number | undefined;
|
|
2148
2148
|
debounce?: {
|
|
2149
2149
|
key: string;
|
|
@@ -2231,7 +2231,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
|
|
|
2231
2231
|
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2232
2232
|
delay?: string | Date | undefined;
|
|
2233
2233
|
idempotencyKeyTTL?: string | undefined;
|
|
2234
|
-
concurrencyKey?: string | undefined;
|
|
2234
|
+
concurrencyKey?: string | number | undefined;
|
|
2235
2235
|
ttl?: string | number | undefined;
|
|
2236
2236
|
debounce?: {
|
|
2237
2237
|
key: string;
|
|
@@ -2336,7 +2336,12 @@ export declare const CreateBatchResponse: z.ZodObject<{
|
|
|
2336
2336
|
export type CreateBatchResponse = z.infer<typeof CreateBatchResponse>;
|
|
2337
2337
|
/**
|
|
2338
2338
|
* Phase 2: Individual item in the NDJSON stream
|
|
2339
|
-
* Each line in the NDJSON body should match this schema
|
|
2339
|
+
* Each line in the NDJSON body should match this schema.
|
|
2340
|
+
*
|
|
2341
|
+
* `options` reuses the strict shape from BatchTriggerTaskItem so that the
|
|
2342
|
+
* Phase-2 streaming path validates option fields identically to the V2/V3
|
|
2343
|
+
* batch trigger endpoints — historically this used z.record(z.unknown()) and
|
|
2344
|
+
* let invalid values (e.g. numeric concurrencyKey) reach Prisma.
|
|
2340
2345
|
*/
|
|
2341
2346
|
export declare const BatchItemNDJSON: z.ZodObject<{
|
|
2342
2347
|
/** Zero-based index of this item (used for idempotency and ordering) */
|
|
@@ -2346,16 +2351,192 @@ export declare const BatchItemNDJSON: z.ZodObject<{
|
|
|
2346
2351
|
/** The payload for this task run */
|
|
2347
2352
|
payload: z.ZodOptional<z.ZodUnknown>;
|
|
2348
2353
|
/** Options for this specific item */
|
|
2349
|
-
options: z.ZodOptional<z.
|
|
2354
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
2355
|
+
concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
|
|
2356
|
+
delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
2357
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
2358
|
+
idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
|
|
2359
|
+
/** The original user-provided idempotency key and scope */
|
|
2360
|
+
idempotencyKeyOptions: z.ZodOptional<z.ZodObject<{
|
|
2361
|
+
key: z.ZodString;
|
|
2362
|
+
scope: z.ZodEnum<["run", "attempt", "global"]>;
|
|
2363
|
+
}, "strip", z.ZodTypeAny, {
|
|
2364
|
+
key: string;
|
|
2365
|
+
scope: "run" | "attempt" | "global";
|
|
2366
|
+
}, {
|
|
2367
|
+
key: string;
|
|
2368
|
+
scope: "run" | "attempt" | "global";
|
|
2369
|
+
}>>;
|
|
2370
|
+
lockToVersion: z.ZodOptional<z.ZodString>;
|
|
2371
|
+
machine: z.ZodOptional<z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>>;
|
|
2372
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
2373
|
+
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
2374
|
+
metadata: z.ZodAny;
|
|
2375
|
+
metadataType: z.ZodOptional<z.ZodString>;
|
|
2376
|
+
parentAttempt: z.ZodOptional<z.ZodString>;
|
|
2377
|
+
payloadType: z.ZodOptional<z.ZodString>;
|
|
2378
|
+
queue: z.ZodOptional<z.ZodObject<{
|
|
2379
|
+
name: z.ZodString;
|
|
2380
|
+
}, "strip", z.ZodTypeAny, {
|
|
2381
|
+
name: string;
|
|
2382
|
+
}, {
|
|
2383
|
+
name: string;
|
|
2384
|
+
}>>;
|
|
2385
|
+
tags: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2386
|
+
test: z.ZodOptional<z.ZodBoolean>;
|
|
2387
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
2388
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
2389
|
+
region: z.ZodOptional<z.ZodString>;
|
|
2390
|
+
debounce: z.ZodOptional<z.ZodObject<{
|
|
2391
|
+
key: z.ZodString;
|
|
2392
|
+
delay: z.ZodString;
|
|
2393
|
+
mode: z.ZodOptional<z.ZodEnum<["leading", "trailing"]>>;
|
|
2394
|
+
maxDelay: z.ZodOptional<z.ZodString>;
|
|
2395
|
+
}, "strip", z.ZodTypeAny, {
|
|
2396
|
+
key: string;
|
|
2397
|
+
delay: string;
|
|
2398
|
+
mode?: "leading" | "trailing" | undefined;
|
|
2399
|
+
maxDelay?: string | undefined;
|
|
2400
|
+
}, {
|
|
2401
|
+
key: string;
|
|
2402
|
+
delay: string;
|
|
2403
|
+
mode?: "leading" | "trailing" | undefined;
|
|
2404
|
+
maxDelay?: string | undefined;
|
|
2405
|
+
}>>;
|
|
2406
|
+
}, "strip", z.ZodTypeAny, {
|
|
2407
|
+
metadata?: any;
|
|
2408
|
+
payloadType?: string | undefined;
|
|
2409
|
+
tags?: string | string[] | undefined;
|
|
2410
|
+
idempotencyKey?: string | undefined;
|
|
2411
|
+
maxAttempts?: number | undefined;
|
|
2412
|
+
maxDuration?: number | undefined;
|
|
2413
|
+
priority?: number | undefined;
|
|
2414
|
+
region?: string | undefined;
|
|
2415
|
+
queue?: {
|
|
2416
|
+
name: string;
|
|
2417
|
+
} | undefined;
|
|
2418
|
+
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2419
|
+
delay?: string | Date | undefined;
|
|
2420
|
+
idempotencyKeyTTL?: string | undefined;
|
|
2421
|
+
concurrencyKey?: string | undefined;
|
|
2422
|
+
ttl?: string | number | undefined;
|
|
2423
|
+
debounce?: {
|
|
2424
|
+
key: string;
|
|
2425
|
+
delay: string;
|
|
2426
|
+
mode?: "leading" | "trailing" | undefined;
|
|
2427
|
+
maxDelay?: string | undefined;
|
|
2428
|
+
} | undefined;
|
|
2429
|
+
test?: boolean | undefined;
|
|
2430
|
+
parentAttempt?: string | undefined;
|
|
2431
|
+
lockToVersion?: string | undefined;
|
|
2432
|
+
idempotencyKeyOptions?: {
|
|
2433
|
+
key: string;
|
|
2434
|
+
scope: "run" | "attempt" | "global";
|
|
2435
|
+
} | undefined;
|
|
2436
|
+
metadataType?: string | undefined;
|
|
2437
|
+
}, {
|
|
2438
|
+
metadata?: any;
|
|
2439
|
+
payloadType?: string | undefined;
|
|
2440
|
+
tags?: string | string[] | undefined;
|
|
2441
|
+
idempotencyKey?: string | undefined;
|
|
2442
|
+
maxAttempts?: number | undefined;
|
|
2443
|
+
maxDuration?: number | undefined;
|
|
2444
|
+
priority?: number | undefined;
|
|
2445
|
+
region?: string | undefined;
|
|
2446
|
+
queue?: {
|
|
2447
|
+
name: string;
|
|
2448
|
+
} | undefined;
|
|
2449
|
+
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2450
|
+
delay?: string | Date | undefined;
|
|
2451
|
+
idempotencyKeyTTL?: string | undefined;
|
|
2452
|
+
concurrencyKey?: string | number | undefined;
|
|
2453
|
+
ttl?: string | number | undefined;
|
|
2454
|
+
debounce?: {
|
|
2455
|
+
key: string;
|
|
2456
|
+
delay: string;
|
|
2457
|
+
mode?: "leading" | "trailing" | undefined;
|
|
2458
|
+
maxDelay?: string | undefined;
|
|
2459
|
+
} | undefined;
|
|
2460
|
+
test?: boolean | undefined;
|
|
2461
|
+
parentAttempt?: string | undefined;
|
|
2462
|
+
lockToVersion?: string | undefined;
|
|
2463
|
+
idempotencyKeyOptions?: {
|
|
2464
|
+
key: string;
|
|
2465
|
+
scope: "run" | "attempt" | "global";
|
|
2466
|
+
} | undefined;
|
|
2467
|
+
metadataType?: string | undefined;
|
|
2468
|
+
}>>;
|
|
2350
2469
|
}, "strip", z.ZodTypeAny, {
|
|
2351
2470
|
task: string;
|
|
2352
2471
|
index: number;
|
|
2353
|
-
options?:
|
|
2472
|
+
options?: {
|
|
2473
|
+
metadata?: any;
|
|
2474
|
+
payloadType?: string | undefined;
|
|
2475
|
+
tags?: string | string[] | undefined;
|
|
2476
|
+
idempotencyKey?: string | undefined;
|
|
2477
|
+
maxAttempts?: number | undefined;
|
|
2478
|
+
maxDuration?: number | undefined;
|
|
2479
|
+
priority?: number | undefined;
|
|
2480
|
+
region?: string | undefined;
|
|
2481
|
+
queue?: {
|
|
2482
|
+
name: string;
|
|
2483
|
+
} | undefined;
|
|
2484
|
+
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2485
|
+
delay?: string | Date | undefined;
|
|
2486
|
+
idempotencyKeyTTL?: string | undefined;
|
|
2487
|
+
concurrencyKey?: string | undefined;
|
|
2488
|
+
ttl?: string | number | undefined;
|
|
2489
|
+
debounce?: {
|
|
2490
|
+
key: string;
|
|
2491
|
+
delay: string;
|
|
2492
|
+
mode?: "leading" | "trailing" | undefined;
|
|
2493
|
+
maxDelay?: string | undefined;
|
|
2494
|
+
} | undefined;
|
|
2495
|
+
test?: boolean | undefined;
|
|
2496
|
+
parentAttempt?: string | undefined;
|
|
2497
|
+
lockToVersion?: string | undefined;
|
|
2498
|
+
idempotencyKeyOptions?: {
|
|
2499
|
+
key: string;
|
|
2500
|
+
scope: "run" | "attempt" | "global";
|
|
2501
|
+
} | undefined;
|
|
2502
|
+
metadataType?: string | undefined;
|
|
2503
|
+
} | undefined;
|
|
2354
2504
|
payload?: unknown;
|
|
2355
2505
|
}, {
|
|
2356
2506
|
task: string;
|
|
2357
2507
|
index: number;
|
|
2358
|
-
options?:
|
|
2508
|
+
options?: {
|
|
2509
|
+
metadata?: any;
|
|
2510
|
+
payloadType?: string | undefined;
|
|
2511
|
+
tags?: string | string[] | undefined;
|
|
2512
|
+
idempotencyKey?: string | undefined;
|
|
2513
|
+
maxAttempts?: number | undefined;
|
|
2514
|
+
maxDuration?: number | undefined;
|
|
2515
|
+
priority?: number | undefined;
|
|
2516
|
+
region?: string | undefined;
|
|
2517
|
+
queue?: {
|
|
2518
|
+
name: string;
|
|
2519
|
+
} | undefined;
|
|
2520
|
+
machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
|
|
2521
|
+
delay?: string | Date | undefined;
|
|
2522
|
+
idempotencyKeyTTL?: string | undefined;
|
|
2523
|
+
concurrencyKey?: string | number | undefined;
|
|
2524
|
+
ttl?: string | number | undefined;
|
|
2525
|
+
debounce?: {
|
|
2526
|
+
key: string;
|
|
2527
|
+
delay: string;
|
|
2528
|
+
mode?: "leading" | "trailing" | undefined;
|
|
2529
|
+
maxDelay?: string | undefined;
|
|
2530
|
+
} | undefined;
|
|
2531
|
+
test?: boolean | undefined;
|
|
2532
|
+
parentAttempt?: string | undefined;
|
|
2533
|
+
lockToVersion?: string | undefined;
|
|
2534
|
+
idempotencyKeyOptions?: {
|
|
2535
|
+
key: string;
|
|
2536
|
+
scope: "run" | "attempt" | "global";
|
|
2537
|
+
} | undefined;
|
|
2538
|
+
metadataType?: string | undefined;
|
|
2539
|
+
} | undefined;
|
|
2359
2540
|
payload?: unknown;
|
|
2360
2541
|
}>;
|
|
2361
2542
|
export type BatchItemNDJSON = z.infer<typeof BatchItemNDJSON>;
|
|
@@ -113,6 +113,13 @@ exports.IdempotencyKeyOptionsSchema = zod_1.z.object({
|
|
|
113
113
|
key: zod_1.z.string(),
|
|
114
114
|
scope: zod_1.z.enum(["run", "attempt", "global"]),
|
|
115
115
|
});
|
|
116
|
+
// Coerces user-supplied concurrencyKey values to string. The downstream Prisma
|
|
117
|
+
// column is String?, so passing a number (a common foot-gun when callers do
|
|
118
|
+
// `concurrencyKey: payload.userId`) used to fail at `prisma.taskRun.create`
|
|
119
|
+
// with PrismaClientValidationError. Accept the intent and stringify here.
|
|
120
|
+
const ConcurrencyKeySchema = zod_1.z
|
|
121
|
+
.union([zod_1.z.string(), zod_1.z.number()])
|
|
122
|
+
.transform((value) => String(value));
|
|
116
123
|
exports.TriggerTaskRequestBody = zod_1.z.object({
|
|
117
124
|
payload: zod_1.z.any(),
|
|
118
125
|
context: zod_1.z.any(),
|
|
@@ -150,7 +157,7 @@ exports.TriggerTaskRequestBody = zod_1.z.object({
|
|
|
150
157
|
concurrencyLimit: zod_1.z.number().int().optional(),
|
|
151
158
|
})
|
|
152
159
|
.optional(),
|
|
153
|
-
concurrencyKey:
|
|
160
|
+
concurrencyKey: ConcurrencyKeySchema.optional(),
|
|
154
161
|
delay: zod_1.z.string().or(zod_1.z.coerce.date()).optional(),
|
|
155
162
|
idempotencyKey: zod_1.z
|
|
156
163
|
.string()
|
|
@@ -199,7 +206,7 @@ exports.BatchTriggerTaskItem = zod_1.z.object({
|
|
|
199
206
|
context: zod_1.z.any(),
|
|
200
207
|
options: zod_1.z
|
|
201
208
|
.object({
|
|
202
|
-
concurrencyKey:
|
|
209
|
+
concurrencyKey: ConcurrencyKeySchema.optional(),
|
|
203
210
|
delay: zod_1.z.string().or(zod_1.z.coerce.date()).optional(),
|
|
204
211
|
idempotencyKey: zod_1.z
|
|
205
212
|
.string()
|
|
@@ -323,7 +330,12 @@ exports.CreateBatchResponse = zod_1.z.object({
|
|
|
323
330
|
});
|
|
324
331
|
/**
|
|
325
332
|
* Phase 2: Individual item in the NDJSON stream
|
|
326
|
-
* Each line in the NDJSON body should match this schema
|
|
333
|
+
* Each line in the NDJSON body should match this schema.
|
|
334
|
+
*
|
|
335
|
+
* `options` reuses the strict shape from BatchTriggerTaskItem so that the
|
|
336
|
+
* Phase-2 streaming path validates option fields identically to the V2/V3
|
|
337
|
+
* batch trigger endpoints — historically this used z.record(z.unknown()) and
|
|
338
|
+
* let invalid values (e.g. numeric concurrencyKey) reach Prisma.
|
|
327
339
|
*/
|
|
328
340
|
exports.BatchItemNDJSON = zod_1.z.object({
|
|
329
341
|
/** Zero-based index of this item (used for idempotency and ordering) */
|
|
@@ -333,7 +345,7 @@ exports.BatchItemNDJSON = zod_1.z.object({
|
|
|
333
345
|
/** The payload for this task run */
|
|
334
346
|
payload: zod_1.z.unknown().optional(),
|
|
335
347
|
/** Options for this specific item */
|
|
336
|
-
options:
|
|
348
|
+
options: exports.BatchTriggerTaskItem.shape.options,
|
|
337
349
|
});
|
|
338
350
|
/**
|
|
339
351
|
* Phase 2: Stream items response
|