@trigger.dev/core 4.5.0-rc.3 → 4.5.0-rc.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.
Files changed (59) hide show
  1. package/dist/commonjs/v3/apiClient/types.d.ts +4 -0
  2. package/dist/commonjs/v3/otel/tracingSDK.js +6 -0
  3. package/dist/commonjs/v3/otel/tracingSDK.js.map +1 -1
  4. package/dist/commonjs/v3/runEngineWorker/supervisor/consumerPool.d.ts +7 -0
  5. package/dist/commonjs/v3/runEngineWorker/supervisor/consumerPool.js +11 -0
  6. package/dist/commonjs/v3/runEngineWorker/supervisor/consumerPool.js.map +1 -1
  7. package/dist/commonjs/v3/runEngineWorker/supervisor/consumerPool.test.js +55 -0
  8. package/dist/commonjs/v3/runEngineWorker/supervisor/consumerPool.test.js.map +1 -1
  9. package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.d.ts +4 -1
  10. package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js +3 -0
  11. package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -1
  12. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.d.ts +12 -0
  13. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js +10 -1
  14. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js.map +1 -1
  15. package/dist/commonjs/v3/runEngineWorker/supervisor/session.d.ts +3 -0
  16. package/dist/commonjs/v3/runEngineWorker/supervisor/session.js +1 -0
  17. package/dist/commonjs/v3/runEngineWorker/supervisor/session.js.map +1 -1
  18. package/dist/commonjs/v3/schemas/api-type.test.js +32 -0
  19. package/dist/commonjs/v3/schemas/api-type.test.js.map +1 -1
  20. package/dist/commonjs/v3/schemas/api.d.ts +374 -22
  21. package/dist/commonjs/v3/schemas/api.js +30 -5
  22. package/dist/commonjs/v3/schemas/api.js.map +1 -1
  23. package/dist/commonjs/v3/schemas/batchItemNDJSON.test.d.ts +1 -0
  24. package/dist/commonjs/v3/schemas/batchItemNDJSON.test.js +79 -0
  25. package/dist/commonjs/v3/schemas/batchItemNDJSON.test.js.map +1 -0
  26. package/dist/commonjs/v3/utils/ioSerialization.d.ts +9 -1
  27. package/dist/commonjs/v3/utils/ioSerialization.js +15 -6
  28. package/dist/commonjs/v3/utils/ioSerialization.js.map +1 -1
  29. package/dist/commonjs/version.js +1 -1
  30. package/dist/esm/v3/apiClient/types.d.ts +4 -0
  31. package/dist/esm/v3/otel/tracingSDK.js +6 -0
  32. package/dist/esm/v3/otel/tracingSDK.js.map +1 -1
  33. package/dist/esm/v3/runEngineWorker/supervisor/consumerPool.d.ts +7 -0
  34. package/dist/esm/v3/runEngineWorker/supervisor/consumerPool.js +11 -0
  35. package/dist/esm/v3/runEngineWorker/supervisor/consumerPool.js.map +1 -1
  36. package/dist/esm/v3/runEngineWorker/supervisor/consumerPool.test.js +55 -0
  37. package/dist/esm/v3/runEngineWorker/supervisor/consumerPool.test.js.map +1 -1
  38. package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.d.ts +4 -1
  39. package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js +3 -0
  40. package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -1
  41. package/dist/esm/v3/runEngineWorker/supervisor/schemas.d.ts +12 -0
  42. package/dist/esm/v3/runEngineWorker/supervisor/schemas.js +9 -0
  43. package/dist/esm/v3/runEngineWorker/supervisor/schemas.js.map +1 -1
  44. package/dist/esm/v3/runEngineWorker/supervisor/session.d.ts +3 -0
  45. package/dist/esm/v3/runEngineWorker/supervisor/session.js +1 -0
  46. package/dist/esm/v3/runEngineWorker/supervisor/session.js.map +1 -1
  47. package/dist/esm/v3/schemas/api-type.test.js +33 -1
  48. package/dist/esm/v3/schemas/api-type.test.js.map +1 -1
  49. package/dist/esm/v3/schemas/api.d.ts +374 -22
  50. package/dist/esm/v3/schemas/api.js +30 -5
  51. package/dist/esm/v3/schemas/api.js.map +1 -1
  52. package/dist/esm/v3/schemas/batchItemNDJSON.test.d.ts +1 -0
  53. package/dist/esm/v3/schemas/batchItemNDJSON.test.js +77 -0
  54. package/dist/esm/v3/schemas/batchItemNDJSON.test.js.map +1 -0
  55. package/dist/esm/v3/utils/ioSerialization.d.ts +9 -1
  56. package/dist/esm/v3/utils/ioSerialization.js +15 -6
  57. package/dist/esm/v3/utils/ioSerialization.js.map +1 -1
  58. package/dist/esm/version.js +1 -1
  59. package/package.json +18 -17
@@ -852,7 +852,7 @@ export declare const IdempotencyKeyOptionsSchema: z.ZodObject<{
852
852
  scope: "run" | "attempt" | "global";
853
853
  }>;
854
854
  export type IdempotencyKeyOptionsSchema = z.infer<typeof IdempotencyKeyOptionsSchema>;
855
- export declare const TriggerTaskRequestBody: z.ZodObject<{
855
+ export declare const TriggerTaskRequestBody: z.ZodEffects<z.ZodObject<{
856
856
  payload: z.ZodAny;
857
857
  context: z.ZodAny;
858
858
  options: z.ZodOptional<z.ZodObject<{
@@ -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;
@@ -1054,6 +1054,48 @@ export declare const TriggerTaskRequestBody: z.ZodObject<{
1054
1054
  payload?: any;
1055
1055
  context?: any;
1056
1056
  }, {
1057
+ options?: {
1058
+ metadata?: any;
1059
+ payloadType?: string | undefined;
1060
+ tags?: string | string[] | undefined;
1061
+ idempotencyKey?: string | undefined;
1062
+ maxAttempts?: number | undefined;
1063
+ maxDuration?: number | undefined;
1064
+ priority?: number | undefined;
1065
+ region?: string | undefined;
1066
+ queue?: {
1067
+ name: string;
1068
+ concurrencyLimit?: number | undefined;
1069
+ } | undefined;
1070
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1071
+ delay?: string | Date | undefined;
1072
+ idempotencyKeyTTL?: string | undefined;
1073
+ concurrencyKey?: string | number | undefined;
1074
+ ttl?: string | number | undefined;
1075
+ debounce?: {
1076
+ key: string;
1077
+ delay: string;
1078
+ mode?: "leading" | "trailing" | undefined;
1079
+ maxDelay?: string | undefined;
1080
+ } | undefined;
1081
+ test?: boolean | undefined;
1082
+ dependentAttempt?: string | undefined;
1083
+ parentAttempt?: string | undefined;
1084
+ dependentBatch?: string | undefined;
1085
+ parentBatch?: string | undefined;
1086
+ parentRunId?: string | undefined;
1087
+ resumeParentOnCompletion?: boolean | undefined;
1088
+ lockToVersion?: string | undefined;
1089
+ idempotencyKeyOptions?: {
1090
+ key: string;
1091
+ scope: "run" | "attempt" | "global";
1092
+ } | undefined;
1093
+ metadataType?: string | undefined;
1094
+ bulkActionId?: string | undefined;
1095
+ } | undefined;
1096
+ payload?: any;
1097
+ context?: any;
1098
+ }>, {
1057
1099
  options?: {
1058
1100
  metadata?: any;
1059
1101
  payloadType?: string | undefined;
@@ -1095,6 +1137,48 @@ export declare const TriggerTaskRequestBody: z.ZodObject<{
1095
1137
  } | undefined;
1096
1138
  payload?: any;
1097
1139
  context?: any;
1140
+ }, {
1141
+ options?: {
1142
+ metadata?: any;
1143
+ payloadType?: string | undefined;
1144
+ tags?: string | string[] | undefined;
1145
+ idempotencyKey?: string | undefined;
1146
+ maxAttempts?: number | undefined;
1147
+ maxDuration?: number | undefined;
1148
+ priority?: number | undefined;
1149
+ region?: string | undefined;
1150
+ queue?: {
1151
+ name: string;
1152
+ concurrencyLimit?: number | undefined;
1153
+ } | undefined;
1154
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1155
+ delay?: string | Date | undefined;
1156
+ idempotencyKeyTTL?: string | undefined;
1157
+ concurrencyKey?: string | number | undefined;
1158
+ ttl?: string | number | undefined;
1159
+ debounce?: {
1160
+ key: string;
1161
+ delay: string;
1162
+ mode?: "leading" | "trailing" | undefined;
1163
+ maxDelay?: string | undefined;
1164
+ } | undefined;
1165
+ test?: boolean | undefined;
1166
+ dependentAttempt?: string | undefined;
1167
+ parentAttempt?: string | undefined;
1168
+ dependentBatch?: string | undefined;
1169
+ parentBatch?: string | undefined;
1170
+ parentRunId?: string | undefined;
1171
+ resumeParentOnCompletion?: boolean | undefined;
1172
+ lockToVersion?: string | undefined;
1173
+ idempotencyKeyOptions?: {
1174
+ key: string;
1175
+ scope: "run" | "attempt" | "global";
1176
+ } | undefined;
1177
+ metadataType?: string | undefined;
1178
+ bulkActionId?: string | undefined;
1179
+ } | undefined;
1180
+ payload?: any;
1181
+ context?: any;
1098
1182
  }>;
1099
1183
  export type TriggerTaskRequestBody = z.infer<typeof TriggerTaskRequestBody>;
1100
1184
  export declare const TriggerTaskResponse: z.ZodObject<{
@@ -1109,7 +1193,7 @@ export declare const TriggerTaskResponse: z.ZodObject<{
1109
1193
  }>;
1110
1194
  export type TriggerTaskResponse = z.infer<typeof TriggerTaskResponse>;
1111
1195
  export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
1112
- items: z.ZodArray<z.ZodObject<{
1196
+ items: z.ZodArray<z.ZodEffects<z.ZodObject<{
1113
1197
  payload: z.ZodAny;
1114
1198
  context: z.ZodAny;
1115
1199
  options: z.ZodOptional<z.ZodObject<{
@@ -1148,7 +1232,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
1148
1232
  name: string;
1149
1233
  concurrencyLimit?: number | undefined;
1150
1234
  }>>;
1151
- concurrencyKey: z.ZodOptional<z.ZodString>;
1235
+ concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
1152
1236
  delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
1153
1237
  idempotencyKey: z.ZodOptional<z.ZodString>;
1154
1238
  idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
@@ -1245,7 +1329,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
1245
1329
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1246
1330
  delay?: string | Date | undefined;
1247
1331
  idempotencyKeyTTL?: string | undefined;
1248
- concurrencyKey?: string | undefined;
1332
+ concurrencyKey?: string | number | undefined;
1249
1333
  ttl?: string | number | undefined;
1250
1334
  debounce?: {
1251
1335
  key: string;
@@ -1311,6 +1395,48 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
1311
1395
  payload?: any;
1312
1396
  context?: any;
1313
1397
  }, {
1398
+ options?: {
1399
+ metadata?: any;
1400
+ payloadType?: string | undefined;
1401
+ tags?: string | string[] | undefined;
1402
+ idempotencyKey?: string | undefined;
1403
+ maxAttempts?: number | undefined;
1404
+ maxDuration?: number | undefined;
1405
+ priority?: number | undefined;
1406
+ region?: string | undefined;
1407
+ queue?: {
1408
+ name: string;
1409
+ concurrencyLimit?: number | undefined;
1410
+ } | undefined;
1411
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1412
+ delay?: string | Date | undefined;
1413
+ idempotencyKeyTTL?: string | undefined;
1414
+ concurrencyKey?: string | number | undefined;
1415
+ ttl?: string | number | undefined;
1416
+ debounce?: {
1417
+ key: string;
1418
+ delay: string;
1419
+ mode?: "leading" | "trailing" | undefined;
1420
+ maxDelay?: string | undefined;
1421
+ } | undefined;
1422
+ test?: boolean | undefined;
1423
+ dependentAttempt?: string | undefined;
1424
+ parentAttempt?: string | undefined;
1425
+ dependentBatch?: string | undefined;
1426
+ parentBatch?: string | undefined;
1427
+ parentRunId?: string | undefined;
1428
+ resumeParentOnCompletion?: boolean | undefined;
1429
+ lockToVersion?: string | undefined;
1430
+ idempotencyKeyOptions?: {
1431
+ key: string;
1432
+ scope: "run" | "attempt" | "global";
1433
+ } | undefined;
1434
+ metadataType?: string | undefined;
1435
+ bulkActionId?: string | undefined;
1436
+ } | undefined;
1437
+ payload?: any;
1438
+ context?: any;
1439
+ }>, {
1314
1440
  options?: {
1315
1441
  metadata?: any;
1316
1442
  payloadType?: string | undefined;
@@ -1352,6 +1478,48 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
1352
1478
  } | undefined;
1353
1479
  payload?: any;
1354
1480
  context?: any;
1481
+ }, {
1482
+ options?: {
1483
+ metadata?: any;
1484
+ payloadType?: string | undefined;
1485
+ tags?: string | string[] | undefined;
1486
+ idempotencyKey?: string | undefined;
1487
+ maxAttempts?: number | undefined;
1488
+ maxDuration?: number | undefined;
1489
+ priority?: number | undefined;
1490
+ region?: string | undefined;
1491
+ queue?: {
1492
+ name: string;
1493
+ concurrencyLimit?: number | undefined;
1494
+ } | undefined;
1495
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1496
+ delay?: string | Date | undefined;
1497
+ idempotencyKeyTTL?: string | undefined;
1498
+ concurrencyKey?: string | number | undefined;
1499
+ ttl?: string | number | undefined;
1500
+ debounce?: {
1501
+ key: string;
1502
+ delay: string;
1503
+ mode?: "leading" | "trailing" | undefined;
1504
+ maxDelay?: string | undefined;
1505
+ } | undefined;
1506
+ test?: boolean | undefined;
1507
+ dependentAttempt?: string | undefined;
1508
+ parentAttempt?: string | undefined;
1509
+ dependentBatch?: string | undefined;
1510
+ parentBatch?: string | undefined;
1511
+ parentRunId?: string | undefined;
1512
+ resumeParentOnCompletion?: boolean | undefined;
1513
+ lockToVersion?: string | undefined;
1514
+ idempotencyKeyOptions?: {
1515
+ key: string;
1516
+ scope: "run" | "attempt" | "global";
1517
+ } | undefined;
1518
+ metadataType?: string | undefined;
1519
+ bulkActionId?: string | undefined;
1520
+ } | undefined;
1521
+ payload?: any;
1522
+ context?: any;
1355
1523
  }>, "many">;
1356
1524
  dependentAttempt: z.ZodOptional<z.ZodString>;
1357
1525
  }, "strip", z.ZodTypeAny, {
@@ -1417,7 +1585,7 @@ export declare const BatchTriggerTaskRequestBody: z.ZodObject<{
1417
1585
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1418
1586
  delay?: string | Date | undefined;
1419
1587
  idempotencyKeyTTL?: string | undefined;
1420
- concurrencyKey?: string | undefined;
1588
+ concurrencyKey?: string | number | undefined;
1421
1589
  ttl?: string | number | undefined;
1422
1590
  debounce?: {
1423
1591
  key: string;
@@ -1451,7 +1619,7 @@ export declare const BatchTriggerTaskItem: z.ZodObject<{
1451
1619
  payload: z.ZodAny;
1452
1620
  context: z.ZodAny;
1453
1621
  options: z.ZodOptional<z.ZodObject<{
1454
- concurrencyKey: z.ZodOptional<z.ZodString>;
1622
+ concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
1455
1623
  delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
1456
1624
  idempotencyKey: z.ZodOptional<z.ZodString>;
1457
1625
  idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
@@ -1548,7 +1716,7 @@ export declare const BatchTriggerTaskItem: z.ZodObject<{
1548
1716
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1549
1717
  delay?: string | Date | undefined;
1550
1718
  idempotencyKeyTTL?: string | undefined;
1551
- concurrencyKey?: string | undefined;
1719
+ concurrencyKey?: string | number | undefined;
1552
1720
  ttl?: string | number | undefined;
1553
1721
  debounce?: {
1554
1722
  key: string;
@@ -1618,7 +1786,7 @@ export declare const BatchTriggerTaskItem: z.ZodObject<{
1618
1786
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1619
1787
  delay?: string | Date | undefined;
1620
1788
  idempotencyKeyTTL?: string | undefined;
1621
- concurrencyKey?: string | undefined;
1789
+ concurrencyKey?: string | number | undefined;
1622
1790
  ttl?: string | number | undefined;
1623
1791
  debounce?: {
1624
1792
  key: string;
@@ -1645,7 +1813,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
1645
1813
  payload: z.ZodAny;
1646
1814
  context: z.ZodAny;
1647
1815
  options: z.ZodOptional<z.ZodObject<{
1648
- concurrencyKey: z.ZodOptional<z.ZodString>;
1816
+ concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
1649
1817
  delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
1650
1818
  idempotencyKey: z.ZodOptional<z.ZodString>;
1651
1819
  idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
@@ -1742,7 +1910,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
1742
1910
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1743
1911
  delay?: string | Date | undefined;
1744
1912
  idempotencyKeyTTL?: string | undefined;
1745
- concurrencyKey?: string | undefined;
1913
+ concurrencyKey?: string | number | undefined;
1746
1914
  ttl?: string | number | undefined;
1747
1915
  debounce?: {
1748
1916
  key: string;
@@ -1812,7 +1980,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
1812
1980
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1813
1981
  delay?: string | Date | undefined;
1814
1982
  idempotencyKeyTTL?: string | undefined;
1815
- concurrencyKey?: string | undefined;
1983
+ concurrencyKey?: string | number | undefined;
1816
1984
  ttl?: string | number | undefined;
1817
1985
  debounce?: {
1818
1986
  key: string;
@@ -1903,7 +2071,7 @@ export declare const BatchTriggerTaskV2RequestBody: z.ZodObject<{
1903
2071
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
1904
2072
  delay?: string | Date | undefined;
1905
2073
  idempotencyKeyTTL?: string | undefined;
1906
- concurrencyKey?: string | undefined;
2074
+ concurrencyKey?: string | number | undefined;
1907
2075
  ttl?: string | number | undefined;
1908
2076
  debounce?: {
1909
2077
  key: string;
@@ -1976,7 +2144,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
1976
2144
  payload: z.ZodAny;
1977
2145
  context: z.ZodAny;
1978
2146
  options: z.ZodOptional<z.ZodObject<{
1979
- concurrencyKey: z.ZodOptional<z.ZodString>;
2147
+ concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
1980
2148
  delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
1981
2149
  idempotencyKey: z.ZodOptional<z.ZodString>;
1982
2150
  idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
@@ -2073,7 +2241,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
2073
2241
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2074
2242
  delay?: string | Date | undefined;
2075
2243
  idempotencyKeyTTL?: string | undefined;
2076
- concurrencyKey?: string | undefined;
2244
+ concurrencyKey?: string | number | undefined;
2077
2245
  ttl?: string | number | undefined;
2078
2246
  debounce?: {
2079
2247
  key: string;
@@ -2143,7 +2311,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
2143
2311
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2144
2312
  delay?: string | Date | undefined;
2145
2313
  idempotencyKeyTTL?: string | undefined;
2146
- concurrencyKey?: string | undefined;
2314
+ concurrencyKey?: string | number | undefined;
2147
2315
  ttl?: string | number | undefined;
2148
2316
  debounce?: {
2149
2317
  key: string;
@@ -2231,7 +2399,7 @@ export declare const BatchTriggerTaskV3RequestBody: z.ZodObject<{
2231
2399
  machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2232
2400
  delay?: string | Date | undefined;
2233
2401
  idempotencyKeyTTL?: string | undefined;
2234
- concurrencyKey?: string | undefined;
2402
+ concurrencyKey?: string | number | undefined;
2235
2403
  ttl?: string | number | undefined;
2236
2404
  debounce?: {
2237
2405
  key: string;
@@ -2336,7 +2504,12 @@ export declare const CreateBatchResponse: z.ZodObject<{
2336
2504
  export type CreateBatchResponse = z.infer<typeof CreateBatchResponse>;
2337
2505
  /**
2338
2506
  * Phase 2: Individual item in the NDJSON stream
2339
- * Each line in the NDJSON body should match this schema
2507
+ * Each line in the NDJSON body should match this schema.
2508
+ *
2509
+ * `options` reuses the strict shape from BatchTriggerTaskItem so that the
2510
+ * Phase-2 streaming path validates option fields identically to the V2/V3
2511
+ * batch trigger endpoints — historically this used z.record(z.unknown()) and
2512
+ * let invalid values (e.g. numeric concurrencyKey) reach Prisma.
2340
2513
  */
2341
2514
  export declare const BatchItemNDJSON: z.ZodObject<{
2342
2515
  /** Zero-based index of this item (used for idempotency and ordering) */
@@ -2346,16 +2519,192 @@ export declare const BatchItemNDJSON: z.ZodObject<{
2346
2519
  /** The payload for this task run */
2347
2520
  payload: z.ZodOptional<z.ZodUnknown>;
2348
2521
  /** Options for this specific item */
2349
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2522
+ options: z.ZodOptional<z.ZodObject<{
2523
+ concurrencyKey: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>>;
2524
+ delay: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
2525
+ idempotencyKey: z.ZodOptional<z.ZodString>;
2526
+ idempotencyKeyTTL: z.ZodOptional<z.ZodString>;
2527
+ /** The original user-provided idempotency key and scope */
2528
+ idempotencyKeyOptions: z.ZodOptional<z.ZodObject<{
2529
+ key: z.ZodString;
2530
+ scope: z.ZodEnum<["run", "attempt", "global"]>;
2531
+ }, "strip", z.ZodTypeAny, {
2532
+ key: string;
2533
+ scope: "run" | "attempt" | "global";
2534
+ }, {
2535
+ key: string;
2536
+ scope: "run" | "attempt" | "global";
2537
+ }>>;
2538
+ lockToVersion: z.ZodOptional<z.ZodString>;
2539
+ machine: z.ZodOptional<z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>>;
2540
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
2541
+ maxDuration: z.ZodOptional<z.ZodNumber>;
2542
+ metadata: z.ZodAny;
2543
+ metadataType: z.ZodOptional<z.ZodString>;
2544
+ parentAttempt: z.ZodOptional<z.ZodString>;
2545
+ payloadType: z.ZodOptional<z.ZodString>;
2546
+ queue: z.ZodOptional<z.ZodObject<{
2547
+ name: z.ZodString;
2548
+ }, "strip", z.ZodTypeAny, {
2549
+ name: string;
2550
+ }, {
2551
+ name: string;
2552
+ }>>;
2553
+ tags: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
2554
+ test: z.ZodOptional<z.ZodBoolean>;
2555
+ ttl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
2556
+ priority: z.ZodOptional<z.ZodNumber>;
2557
+ region: z.ZodOptional<z.ZodString>;
2558
+ debounce: z.ZodOptional<z.ZodObject<{
2559
+ key: z.ZodString;
2560
+ delay: z.ZodString;
2561
+ mode: z.ZodOptional<z.ZodEnum<["leading", "trailing"]>>;
2562
+ maxDelay: z.ZodOptional<z.ZodString>;
2563
+ }, "strip", z.ZodTypeAny, {
2564
+ key: string;
2565
+ delay: string;
2566
+ mode?: "leading" | "trailing" | undefined;
2567
+ maxDelay?: string | undefined;
2568
+ }, {
2569
+ key: string;
2570
+ delay: string;
2571
+ mode?: "leading" | "trailing" | undefined;
2572
+ maxDelay?: string | undefined;
2573
+ }>>;
2574
+ }, "strip", z.ZodTypeAny, {
2575
+ metadata?: any;
2576
+ payloadType?: string | undefined;
2577
+ tags?: string | string[] | undefined;
2578
+ idempotencyKey?: string | undefined;
2579
+ maxAttempts?: number | undefined;
2580
+ maxDuration?: number | undefined;
2581
+ priority?: number | undefined;
2582
+ region?: string | undefined;
2583
+ queue?: {
2584
+ name: string;
2585
+ } | undefined;
2586
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2587
+ delay?: string | Date | undefined;
2588
+ idempotencyKeyTTL?: string | undefined;
2589
+ concurrencyKey?: string | undefined;
2590
+ ttl?: string | number | undefined;
2591
+ debounce?: {
2592
+ key: string;
2593
+ delay: string;
2594
+ mode?: "leading" | "trailing" | undefined;
2595
+ maxDelay?: string | undefined;
2596
+ } | undefined;
2597
+ test?: boolean | undefined;
2598
+ parentAttempt?: string | undefined;
2599
+ lockToVersion?: string | undefined;
2600
+ idempotencyKeyOptions?: {
2601
+ key: string;
2602
+ scope: "run" | "attempt" | "global";
2603
+ } | undefined;
2604
+ metadataType?: string | undefined;
2605
+ }, {
2606
+ metadata?: any;
2607
+ payloadType?: string | undefined;
2608
+ tags?: string | string[] | undefined;
2609
+ idempotencyKey?: string | undefined;
2610
+ maxAttempts?: number | undefined;
2611
+ maxDuration?: number | undefined;
2612
+ priority?: number | undefined;
2613
+ region?: string | undefined;
2614
+ queue?: {
2615
+ name: string;
2616
+ } | undefined;
2617
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2618
+ delay?: string | Date | undefined;
2619
+ idempotencyKeyTTL?: string | undefined;
2620
+ concurrencyKey?: string | number | undefined;
2621
+ ttl?: string | number | undefined;
2622
+ debounce?: {
2623
+ key: string;
2624
+ delay: string;
2625
+ mode?: "leading" | "trailing" | undefined;
2626
+ maxDelay?: string | undefined;
2627
+ } | undefined;
2628
+ test?: boolean | undefined;
2629
+ parentAttempt?: string | undefined;
2630
+ lockToVersion?: string | undefined;
2631
+ idempotencyKeyOptions?: {
2632
+ key: string;
2633
+ scope: "run" | "attempt" | "global";
2634
+ } | undefined;
2635
+ metadataType?: string | undefined;
2636
+ }>>;
2350
2637
  }, "strip", z.ZodTypeAny, {
2351
2638
  task: string;
2352
2639
  index: number;
2353
- options?: Record<string, unknown> | undefined;
2640
+ options?: {
2641
+ metadata?: any;
2642
+ payloadType?: string | undefined;
2643
+ tags?: string | string[] | undefined;
2644
+ idempotencyKey?: string | undefined;
2645
+ maxAttempts?: number | undefined;
2646
+ maxDuration?: number | undefined;
2647
+ priority?: number | undefined;
2648
+ region?: string | undefined;
2649
+ queue?: {
2650
+ name: string;
2651
+ } | undefined;
2652
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2653
+ delay?: string | Date | undefined;
2654
+ idempotencyKeyTTL?: string | undefined;
2655
+ concurrencyKey?: string | undefined;
2656
+ ttl?: string | number | undefined;
2657
+ debounce?: {
2658
+ key: string;
2659
+ delay: string;
2660
+ mode?: "leading" | "trailing" | undefined;
2661
+ maxDelay?: string | undefined;
2662
+ } | undefined;
2663
+ test?: boolean | undefined;
2664
+ parentAttempt?: string | undefined;
2665
+ lockToVersion?: string | undefined;
2666
+ idempotencyKeyOptions?: {
2667
+ key: string;
2668
+ scope: "run" | "attempt" | "global";
2669
+ } | undefined;
2670
+ metadataType?: string | undefined;
2671
+ } | undefined;
2354
2672
  payload?: unknown;
2355
2673
  }, {
2356
2674
  task: string;
2357
2675
  index: number;
2358
- options?: Record<string, unknown> | undefined;
2676
+ options?: {
2677
+ metadata?: any;
2678
+ payloadType?: string | undefined;
2679
+ tags?: string | string[] | undefined;
2680
+ idempotencyKey?: string | undefined;
2681
+ maxAttempts?: number | undefined;
2682
+ maxDuration?: number | undefined;
2683
+ priority?: number | undefined;
2684
+ region?: string | undefined;
2685
+ queue?: {
2686
+ name: string;
2687
+ } | undefined;
2688
+ machine?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
2689
+ delay?: string | Date | undefined;
2690
+ idempotencyKeyTTL?: string | undefined;
2691
+ concurrencyKey?: string | number | undefined;
2692
+ ttl?: string | number | undefined;
2693
+ debounce?: {
2694
+ key: string;
2695
+ delay: string;
2696
+ mode?: "leading" | "trailing" | undefined;
2697
+ maxDelay?: string | undefined;
2698
+ } | undefined;
2699
+ test?: boolean | undefined;
2700
+ parentAttempt?: string | undefined;
2701
+ lockToVersion?: string | undefined;
2702
+ idempotencyKeyOptions?: {
2703
+ key: string;
2704
+ scope: "run" | "attempt" | "global";
2705
+ } | undefined;
2706
+ metadataType?: string | undefined;
2707
+ } | undefined;
2359
2708
  payload?: unknown;
2360
2709
  }>;
2361
2710
  export type BatchItemNDJSON = z.infer<typeof BatchItemNDJSON>;
@@ -6315,6 +6664,7 @@ export declare const ImportEnvironmentVariablesRequestBody: z.ZodObject<{
6315
6664
  variables: z.ZodRecord<z.ZodString, z.ZodString>;
6316
6665
  parentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
6317
6666
  override: z.ZodOptional<z.ZodBoolean>;
6667
+ isSecret: z.ZodOptional<z.ZodBoolean>;
6318
6668
  source: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
6319
6669
  type: z.ZodLiteral<"user">;
6320
6670
  userId: z.ZodString;
@@ -6345,6 +6695,7 @@ export declare const ImportEnvironmentVariablesRequestBody: z.ZodObject<{
6345
6695
  } | undefined;
6346
6696
  parentVariables?: Record<string, string> | undefined;
6347
6697
  override?: boolean | undefined;
6698
+ isSecret?: boolean | undefined;
6348
6699
  }, {
6349
6700
  variables: Record<string, string>;
6350
6701
  source?: {
@@ -6356,6 +6707,7 @@ export declare const ImportEnvironmentVariablesRequestBody: z.ZodObject<{
6356
6707
  } | undefined;
6357
6708
  parentVariables?: Record<string, string> | undefined;
6358
6709
  override?: boolean | undefined;
6710
+ isSecret?: boolean | undefined;
6359
6711
  }>;
6360
6712
  export type ImportEnvironmentVariablesRequestBody = z.infer<typeof ImportEnvironmentVariablesRequestBody>;
6361
6713
  export declare const EnvironmentVariableResponseBody: z.ZodObject<{
@@ -105,7 +105,13 @@ export const IdempotencyKeyOptionsSchema = z.object({
105
105
  key: z.string(),
106
106
  scope: z.enum(["run", "attempt", "global"]),
107
107
  });
108
- export const TriggerTaskRequestBody = z.object({
108
+ // Coerces user-supplied concurrencyKey values to string. The downstream Prisma
109
+ // column is String?, so passing a number (a common foot-gun when callers do
110
+ // `concurrencyKey: payload.userId`) used to fail at `prisma.taskRun.create`
111
+ // with PrismaClientValidationError. Accept the intent and stringify here.
112
+ const ConcurrencyKeySchema = z.union([z.string(), z.number()]).transform((value) => String(value));
113
+ export const TriggerTaskRequestBody = z
114
+ .object({
109
115
  payload: z.any(),
110
116
  context: z.any(),
111
117
  options: z
@@ -142,7 +148,7 @@ export const TriggerTaskRequestBody = z.object({
142
148
  concurrencyLimit: z.number().int().optional(),
143
149
  })
144
150
  .optional(),
145
- concurrencyKey: z.string().optional(),
151
+ concurrencyKey: ConcurrencyKeySchema.optional(),
146
152
  delay: z.string().or(z.coerce.date()).optional(),
147
153
  idempotencyKey: z
148
154
  .string()
@@ -176,6 +182,18 @@ export const TriggerTaskRequestBody = z.object({
176
182
  .optional(),
177
183
  })
178
184
  .optional(),
185
+ })
186
+ .superRefine((value, ctx) => {
187
+ if (value.options?.payloadType !== "application/store") {
188
+ return;
189
+ }
190
+ if (typeof value.payload !== "string" || value.payload.length === 0) {
191
+ ctx.addIssue({
192
+ code: z.ZodIssueCode.custom,
193
+ message: "payload must be a non-empty string when options.payloadType is application/store",
194
+ path: ["payload"],
195
+ });
196
+ }
179
197
  });
180
198
  export const TriggerTaskResponse = z.object({
181
199
  id: z.string(),
@@ -191,7 +209,7 @@ export const BatchTriggerTaskItem = z.object({
191
209
  context: z.any(),
192
210
  options: z
193
211
  .object({
194
- concurrencyKey: z.string().optional(),
212
+ concurrencyKey: ConcurrencyKeySchema.optional(),
195
213
  delay: z.string().or(z.coerce.date()).optional(),
196
214
  idempotencyKey: z
197
215
  .string()
@@ -315,7 +333,12 @@ export const CreateBatchResponse = z.object({
315
333
  });
316
334
  /**
317
335
  * Phase 2: Individual item in the NDJSON stream
318
- * Each line in the NDJSON body should match this schema
336
+ * Each line in the NDJSON body should match this schema.
337
+ *
338
+ * `options` reuses the strict shape from BatchTriggerTaskItem so that the
339
+ * Phase-2 streaming path validates option fields identically to the V2/V3
340
+ * batch trigger endpoints — historically this used z.record(z.unknown()) and
341
+ * let invalid values (e.g. numeric concurrencyKey) reach Prisma.
319
342
  */
320
343
  export const BatchItemNDJSON = z.object({
321
344
  /** Zero-based index of this item (used for idempotency and ordering) */
@@ -325,7 +348,7 @@ export const BatchItemNDJSON = z.object({
325
348
  /** The payload for this task run */
326
349
  payload: z.unknown().optional(),
327
350
  /** Options for this specific item */
328
- options: z.record(z.unknown()).optional(),
351
+ options: BatchTriggerTaskItem.shape.options,
329
352
  });
330
353
  /**
331
354
  * Phase 2: Stream items response
@@ -891,6 +914,8 @@ export const ImportEnvironmentVariablesRequestBody = z.object({
891
914
  variables: z.record(z.string()),
892
915
  parentVariables: z.record(z.string()).optional(),
893
916
  override: z.boolean().optional(),
917
+ // When omitted, variables default to non-secret (the DB default is false).
918
+ isSecret: z.boolean().optional(),
894
919
  source: z
895
920
  .discriminatedUnion("type", [
896
921
  z.object({ type: z.literal("user"), userId: z.string() }),