@zapier/zapier-sdk 0.69.3 → 0.70.1

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 (67) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +12 -1
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +10 -1
  5. package/dist/api/error-classification.d.ts +7 -0
  6. package/dist/api/error-classification.d.ts.map +1 -1
  7. package/dist/api/error-classification.js +15 -2
  8. package/dist/api/index.d.ts +1 -1
  9. package/dist/api/index.d.ts.map +1 -1
  10. package/dist/api/sse-parser.d.ts +34 -0
  11. package/dist/api/sse-parser.d.ts.map +1 -1
  12. package/dist/api/sse-parser.js +28 -0
  13. package/dist/api/types.d.ts +9 -1
  14. package/dist/api/types.d.ts.map +1 -1
  15. package/dist/auth.d.ts.map +1 -1
  16. package/dist/auth.js +2 -2
  17. package/dist/experimental.cjs +152 -50
  18. package/dist/experimental.d.mts +12 -12
  19. package/dist/experimental.d.ts +10 -10
  20. package/dist/experimental.mjs +152 -50
  21. package/dist/{index-DuFFW71E.d.mts → index-DjLMJ3w8.d.mts} +36 -4
  22. package/dist/{index-DuFFW71E.d.ts → index-DjLMJ3w8.d.ts} +36 -4
  23. package/dist/index.cjs +32 -5
  24. package/dist/index.d.mts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.mjs +32 -5
  28. package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts +1 -1
  29. package/dist/plugins/codeSubstrate/cancelDurableRun/index.d.ts.map +1 -1
  30. package/dist/plugins/codeSubstrate/cancelDurableRun/index.js +2 -1
  31. package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -1
  32. package/dist/plugins/codeSubstrate/createWorkflow/index.js +2 -1
  33. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
  34. package/dist/plugins/codeSubstrate/deleteWorkflow/index.js +2 -1
  35. package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts +4 -0
  36. package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts.map +1 -1
  37. package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.js +7 -0
  38. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
  39. package/dist/plugins/codeSubstrate/disableWorkflow/index.js +2 -1
  40. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
  41. package/dist/plugins/codeSubstrate/enableWorkflow/index.js +2 -1
  42. package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts +5 -5
  43. package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts.map +1 -1
  44. package/dist/plugins/codeSubstrate/getDurableRun/index.js +2 -1
  45. package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +24 -24
  46. package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts.map +1 -1
  47. package/dist/plugins/codeSubstrate/getDurableRun/schemas.js +4 -9
  48. package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts +1 -1
  49. package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts.map +1 -1
  50. package/dist/plugins/codeSubstrate/listDurableRuns/index.js +6 -2
  51. package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts +6 -6
  52. package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts.map +1 -1
  53. package/dist/plugins/codeSubstrate/listDurableRuns/schemas.js +2 -3
  54. package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
  55. package/dist/plugins/codeSubstrate/runDurable/index.js +3 -2
  56. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
  57. package/dist/plugins/codeSubstrate/updateWorkflow/index.js +2 -1
  58. package/dist/plugins/triggers/drainTriggerInbox/index.d.ts +4 -2
  59. package/dist/plugins/triggers/drainTriggerInbox/index.d.ts.map +1 -1
  60. package/dist/plugins/triggers/drainTriggerInbox/index.js +39 -6
  61. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts +4 -2
  62. package/dist/plugins/triggers/watchTriggerInbox/index.d.ts.map +1 -1
  63. package/dist/plugins/triggers/watchTriggerInbox/index.js +100 -16
  64. package/dist/plugins/triggers/watchTriggerInbox/sse.d.ts +8 -6
  65. package/dist/plugins/triggers/watchTriggerInbox/sse.d.ts.map +1 -1
  66. package/dist/plugins/triggers/watchTriggerInbox/sse.js +11 -13
  67. package/package.json +1 -1
@@ -11,10 +11,11 @@ export const enableWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sdk
11
11
  outputSchema: EnableWorkflowResponseSchema,
12
12
  resolvers: { workflow: workflowIdResolver },
13
13
  handler: async ({ sdk, options }) => {
14
- const data = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/enable`, undefined, {
14
+ const raw = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/enable`, undefined, {
15
15
  authRequired: true,
16
16
  resource: { type: "workflow", id: options.workflow },
17
17
  });
18
+ const data = EnableWorkflowResponseSchema.parse(raw);
18
19
  return { data };
19
20
  },
20
21
  }));
@@ -27,7 +27,7 @@ export declare const getDurableRunPlugin: (sdk: {
27
27
  maxItems?: number;
28
28
  }) | undefined) => import("kitcore").PaginatedSdkResult<{
29
29
  id: string;
30
- status: "initialized" | "started" | "finished" | "failed" | "cancelled";
30
+ status: string;
31
31
  input: unknown;
32
32
  output: unknown;
33
33
  error: {
@@ -56,7 +56,7 @@ export declare const getDurableRunPlugin: (sdk: {
56
56
  } | undefined) => Promise<{
57
57
  data: {
58
58
  id: string;
59
- status: "initialized" | "started" | "finished" | "failed" | "cancelled";
59
+ status: string;
60
60
  input: unknown;
61
61
  output: unknown;
62
62
  error: {
@@ -67,7 +67,7 @@ export declare const getDurableRunPlugin: (sdk: {
67
67
  execution: {
68
68
  id: string;
69
69
  name: string;
70
- status: "failed" | "waiting" | "completed" | "running";
70
+ status: string;
71
71
  input: unknown;
72
72
  created_at: string;
73
73
  output?: unknown;
@@ -87,8 +87,8 @@ export declare const getDurableRunPlugin: (sdk: {
87
87
  id: string;
88
88
  execution_id: string;
89
89
  name: string;
90
- type: "step" | "wait" | "callback";
91
- status: "pending" | "failed" | "exhausted" | "completed";
90
+ type: string;
91
+ status: string;
92
92
  retry_count: number;
93
93
  created_at: string;
94
94
  result?: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getDurableRun/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyB/B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAClD,OAAO,mBAAmB,CAC3B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getDurableRun/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B/B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAClD,OAAO,mBAAmB,CAC3B,CAAC"}
@@ -11,10 +11,11 @@ export const getDurableRunPlugin = definePlugin((sdk) => createPluginMethod(sdk,
11
11
  outputSchema: GetDurableRunResponseSchema,
12
12
  resolvers: { run: durableRunIdResolver },
13
13
  handler: async ({ sdk, options }) => {
14
- const data = await sdk.context.api.get(`/sdkdurableapi/api/v0/runs/${encodeURIComponent(options.run)}`, {
14
+ const raw = await sdk.context.api.get(`/sdkdurableapi/api/v0/runs/${encodeURIComponent(options.run)}`, {
15
15
  authRequired: true,
16
16
  resource: { type: "run", id: options.run },
17
17
  });
18
+ const data = GetDurableRunResponseSchema.parse(raw);
18
19
  return { data };
19
20
  },
20
21
  }));
@@ -1,32 +1,32 @@
1
1
  import { z } from "zod";
2
- export declare const OperationTypeSchema: z.ZodEnum<{
2
+ export declare const OperationTypeSchema: z.ZodUnion<readonly [z.ZodEnum<{
3
3
  step: "step";
4
4
  wait: "wait";
5
5
  callback: "callback";
6
- }>;
6
+ }>, z.ZodString]>;
7
7
  export type OperationType = z.infer<typeof OperationTypeSchema>;
8
- export declare const OperationStatusSchema: z.ZodEnum<{
8
+ export declare const OperationStatusSchema: z.ZodUnion<readonly [z.ZodEnum<{
9
9
  pending: "pending";
10
10
  failed: "failed";
11
11
  exhausted: "exhausted";
12
12
  completed: "completed";
13
- }>;
13
+ }>, z.ZodString]>;
14
14
  export type OperationStatus = z.infer<typeof OperationStatusSchema>;
15
15
  export declare const OperationSchema: z.ZodObject<{
16
16
  id: z.ZodString;
17
17
  execution_id: z.ZodString;
18
18
  name: z.ZodString;
19
- type: z.ZodEnum<{
19
+ type: z.ZodUnion<readonly [z.ZodEnum<{
20
20
  step: "step";
21
21
  wait: "wait";
22
22
  callback: "callback";
23
- }>;
24
- status: z.ZodEnum<{
23
+ }>, z.ZodString]>;
24
+ status: z.ZodUnion<readonly [z.ZodEnum<{
25
25
  pending: "pending";
26
26
  failed: "failed";
27
27
  exhausted: "exhausted";
28
28
  completed: "completed";
29
- }>;
29
+ }>, z.ZodString]>;
30
30
  result: z.ZodOptional<z.ZodUnknown>;
31
31
  error: z.ZodOptional<z.ZodUnknown>;
32
32
  retry_count: z.ZodNumber;
@@ -41,22 +41,22 @@ export declare const OperationSchema: z.ZodObject<{
41
41
  created_at: z.ZodString;
42
42
  }, z.core.$strip>;
43
43
  export type Operation = z.infer<typeof OperationSchema>;
44
- export declare const ExecutionStatusSchema: z.ZodEnum<{
44
+ export declare const ExecutionStatusSchema: z.ZodUnion<readonly [z.ZodEnum<{
45
45
  failed: "failed";
46
46
  waiting: "waiting";
47
47
  completed: "completed";
48
48
  running: "running";
49
- }>;
49
+ }>, z.ZodString]>;
50
50
  export type ExecutionStatus = z.infer<typeof ExecutionStatusSchema>;
51
51
  export declare const ExecutionSummarySchema: z.ZodObject<{
52
52
  id: z.ZodString;
53
53
  name: z.ZodString;
54
- status: z.ZodEnum<{
54
+ status: z.ZodUnion<readonly [z.ZodEnum<{
55
55
  failed: "failed";
56
56
  waiting: "waiting";
57
57
  completed: "completed";
58
58
  running: "running";
59
- }>;
59
+ }>, z.ZodString]>;
60
60
  input: z.ZodUnknown;
61
61
  output: z.ZodOptional<z.ZodUnknown>;
62
62
  error: z.ZodOptional<z.ZodUnknown>;
@@ -74,17 +74,17 @@ export declare const ExecutionSummarySchema: z.ZodObject<{
74
74
  id: z.ZodString;
75
75
  execution_id: z.ZodString;
76
76
  name: z.ZodString;
77
- type: z.ZodEnum<{
77
+ type: z.ZodUnion<readonly [z.ZodEnum<{
78
78
  step: "step";
79
79
  wait: "wait";
80
80
  callback: "callback";
81
- }>;
82
- status: z.ZodEnum<{
81
+ }>, z.ZodString]>;
82
+ status: z.ZodUnion<readonly [z.ZodEnum<{
83
83
  pending: "pending";
84
84
  failed: "failed";
85
85
  exhausted: "exhausted";
86
86
  completed: "completed";
87
- }>;
87
+ }>, z.ZodString]>;
88
88
  result: z.ZodOptional<z.ZodUnknown>;
89
89
  error: z.ZodOptional<z.ZodUnknown>;
90
90
  retry_count: z.ZodNumber;
@@ -106,13 +106,13 @@ export declare const GetDurableRunOptionsSchema: z.ZodObject<{
106
106
  export type GetDurableRunOptions = z.infer<typeof GetDurableRunOptionsSchema>;
107
107
  export declare const GetDurableRunResponseSchema: z.ZodObject<{
108
108
  id: z.ZodString;
109
- status: z.ZodEnum<{
109
+ status: z.ZodUnion<readonly [z.ZodEnum<{
110
110
  initialized: "initialized";
111
111
  started: "started";
112
112
  finished: "finished";
113
113
  failed: "failed";
114
114
  cancelled: "cancelled";
115
- }>;
115
+ }>, z.ZodString]>;
116
116
  input: z.ZodUnknown;
117
117
  output: z.ZodNullable<z.ZodUnknown>;
118
118
  error: z.ZodNullable<z.ZodObject<{
@@ -122,12 +122,12 @@ export declare const GetDurableRunResponseSchema: z.ZodObject<{
122
122
  execution: z.ZodNullable<z.ZodObject<{
123
123
  id: z.ZodString;
124
124
  name: z.ZodString;
125
- status: z.ZodEnum<{
125
+ status: z.ZodUnion<readonly [z.ZodEnum<{
126
126
  failed: "failed";
127
127
  waiting: "waiting";
128
128
  completed: "completed";
129
129
  running: "running";
130
- }>;
130
+ }>, z.ZodString]>;
131
131
  input: z.ZodUnknown;
132
132
  output: z.ZodOptional<z.ZodUnknown>;
133
133
  error: z.ZodOptional<z.ZodUnknown>;
@@ -145,17 +145,17 @@ export declare const GetDurableRunResponseSchema: z.ZodObject<{
145
145
  id: z.ZodString;
146
146
  execution_id: z.ZodString;
147
147
  name: z.ZodString;
148
- type: z.ZodEnum<{
148
+ type: z.ZodUnion<readonly [z.ZodEnum<{
149
149
  step: "step";
150
150
  wait: "wait";
151
151
  callback: "callback";
152
- }>;
153
- status: z.ZodEnum<{
152
+ }>, z.ZodString]>;
153
+ status: z.ZodUnion<readonly [z.ZodEnum<{
154
154
  pending: "pending";
155
155
  failed: "failed";
156
156
  exhausted: "exhausted";
157
157
  completed: "completed";
158
- }>;
158
+ }>, z.ZodString]>;
159
159
  result: z.ZodOptional<z.ZodUnknown>;
160
160
  error: z.ZodOptional<z.ZodUnknown>;
161
161
  retry_count: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getDurableRun/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;EAI7B,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,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AEhE,eAAO,MAAM,qBAAqB;;;;;iBAGjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyD1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,qBAAqB;;;;;iBAGjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqDjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,0BAA0B;;iBAMpC,CAAC;AAEJ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -1,11 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { RunErrorSchema, RunStatusSchema } from "../listDurableRuns/schemas";
3
- export const OperationTypeSchema = z
4
- .enum(["step", "wait", "callback"])
5
- .describe("Operation kind: `step` is a journaled function call; `wait` is a time-based suspension; `callback` is a wait on an external callback.");
6
- export const OperationStatusSchema = z
7
- .enum(["pending", "completed", "failed", "exhausted"])
8
- .describe("Operation lifecycle status. `exhausted` means retries were exceeded.");
3
+ import { openEnum } from "kitcore";
4
+ export const OperationTypeSchema = openEnum(["step", "wait", "callback"], "Operation kind: `step` is a journaled function call; `wait` is a time-based suspension; `callback` is a wait on an external callback.");
5
+ export const OperationStatusSchema = openEnum(["pending", "completed", "failed", "exhausted"], "Operation lifecycle status. `exhausted` means retries were exceeded.");
9
6
  export const OperationSchema = z.object({
10
7
  id: z.string().describe("Operation ID (UUID)"),
11
8
  execution_id: z.string().describe("Parent execution ID"),
@@ -58,9 +55,7 @@ export const OperationSchema = z.object({
58
55
  .describe("When the operation reached a terminal state (ISO-8601)"),
59
56
  created_at: z.string().describe("When the operation was created (ISO-8601)"),
60
57
  });
61
- export const ExecutionStatusSchema = z
62
- .enum(["running", "waiting", "completed", "failed"])
63
- .describe("Execution lifecycle status. `waiting` means blocked on a wait or callback operation.");
58
+ export const ExecutionStatusSchema = openEnum(["running", "waiting", "completed", "failed"], "Execution lifecycle status. `waiting` means blocked on a wait or callback operation.");
64
59
  export const ExecutionSummarySchema = z.object({
65
60
  id: z.string().describe("Execution ID (UUID)"),
66
61
  name: z.string().describe("Durable function name"),
@@ -31,7 +31,7 @@ export declare const listDurableRunsPlugin: (sdk: {
31
31
  maxItems?: number;
32
32
  }) | undefined) => import("kitcore").PaginatedSdkResult<{
33
33
  id: string;
34
- status: "initialized" | "started" | "finished" | "failed" | "cancelled";
34
+ status: string;
35
35
  input: unknown;
36
36
  output: unknown;
37
37
  error: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listDurableRuns/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BjC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CACpD,OAAO,qBAAqB,CAC7B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listDurableRuns/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BjC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,UAAU,CACpD,OAAO,qBAAqB,CAC7B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { definePlugin, createPaginatedPluginMethod } from "kitcore";
2
2
  import { DEFAULT_PAGE_SIZE } from "../../../constants";
3
3
  import { codeSubstrateDefaults } from "../shared";
4
- import { ListDurableRunsOptionsSchema, RunItemSchema, } from "./schemas";
4
+ import { ListDurableRunsApiResponseSchema, ListDurableRunsOptionsSchema, RunItemSchema, } from "./schemas";
5
5
  export const listDurableRunsPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
6
6
  ...codeSubstrateDefaults,
7
7
  name: "listDurableRuns",
@@ -18,7 +18,11 @@ export const listDurableRunsPlugin = definePlugin((sdk) => createPaginatedPlugin
18
18
  if (options.cursor) {
19
19
  searchParams.cursor = options.cursor;
20
20
  }
21
- const response = await sdk.context.api.get("/sdkdurableapi/api/v0/runs", { searchParams, authRequired: true });
21
+ const raw = await sdk.context.api.get("/sdkdurableapi/api/v0/runs", {
22
+ searchParams,
23
+ authRequired: true,
24
+ });
25
+ const response = ListDurableRunsApiResponseSchema.parse(raw);
22
26
  return {
23
27
  data: response.results,
24
28
  nextCursor: response.meta.next_cursor ?? undefined,
@@ -1,11 +1,11 @@
1
1
  import { z } from "zod";
2
- export declare const RunStatusSchema: z.ZodEnum<{
2
+ export declare const RunStatusSchema: z.ZodUnion<readonly [z.ZodEnum<{
3
3
  initialized: "initialized";
4
4
  started: "started";
5
5
  finished: "finished";
6
6
  failed: "failed";
7
7
  cancelled: "cancelled";
8
- }>;
8
+ }>, z.ZodString]>;
9
9
  export type RunStatus = z.infer<typeof RunStatusSchema>;
10
10
  export declare const RunErrorSchema: z.ZodObject<{
11
11
  code: z.ZodString;
@@ -14,13 +14,13 @@ export declare const RunErrorSchema: z.ZodObject<{
14
14
  export type RunError = z.infer<typeof RunErrorSchema>;
15
15
  export declare const RunItemSchema: z.ZodObject<{
16
16
  id: z.ZodString;
17
- status: z.ZodEnum<{
17
+ status: z.ZodUnion<readonly [z.ZodEnum<{
18
18
  initialized: "initialized";
19
19
  started: "started";
20
20
  finished: "finished";
21
21
  failed: "failed";
22
22
  cancelled: "cancelled";
23
- }>;
23
+ }>, z.ZodString]>;
24
24
  input: z.ZodUnknown;
25
25
  output: z.ZodNullable<z.ZodUnknown>;
26
26
  error: z.ZodNullable<z.ZodObject<{
@@ -42,13 +42,13 @@ export type ListDurableRunsOptions = z.infer<typeof ListDurableRunsOptionsSchema
42
42
  export declare const ListDurableRunsApiResponseSchema: z.ZodObject<{
43
43
  results: z.ZodArray<z.ZodObject<{
44
44
  id: z.ZodString;
45
- status: z.ZodEnum<{
45
+ status: z.ZodUnion<readonly [z.ZodEnum<{
46
46
  initialized: "initialized";
47
47
  started: "started";
48
48
  finished: "finished";
49
49
  failed: "failed";
50
50
  cancelled: "cancelled";
51
- }>;
51
+ }>, z.ZodString]>;
52
52
  input: z.ZodUnknown;
53
53
  output: z.ZodNullable<z.ZodUnknown>;
54
54
  error: z.ZodNullable<z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listDurableRuns/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;;EAIzB,CAAC;AAEJ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc;;;iBAQxB,CAAC;AAEJ,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;iBAwB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import { z } from "zod";
2
- export const RunStatusSchema = z
3
- .enum(["initialized", "started", "finished", "failed", "cancelled"])
4
- .describe("Run lifecycle status. `finished` / `failed` / `cancelled` are terminal.");
2
+ import { openEnum } from "kitcore";
3
+ export const RunStatusSchema = openEnum(["initialized", "started", "finished", "failed", "cancelled"], "Run lifecycle status. `finished` / `failed` / `cancelled` are terminal.");
5
4
  export const RunErrorSchema = z
6
5
  .object({
7
6
  code: z.string().describe("Machine-readable error category"),
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { definePlugin, createPluginMethod } from "kitcore";
2
2
  import { codeSubstrateDefaults } from "../shared";
3
- import { RunDurableOptionsSchema, RunDurableResponseSchema, } from "./schemas";
3
+ import { RunDurableOptionsSchema, RunDurableResponseSchema } from "./schemas";
4
4
  export const runDurablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
5
5
  ...codeSubstrateDefaults,
6
6
  name: "runDurable",
@@ -30,7 +30,8 @@ export const runDurablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
30
30
  if (options.private !== undefined) {
31
31
  body.is_private = options.private;
32
32
  }
33
- const data = await sdk.context.api.post("/sdkdurableapi/api/v0/runs", body, { authRequired: true });
33
+ const raw = await sdk.context.api.post("/sdkdurableapi/api/v0/runs", body, { authRequired: true });
34
+ const data = RunDurableResponseSchema.parse(raw);
34
35
  return { data };
35
36
  },
36
37
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/updateWorkflow/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiChC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/updateWorkflow/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
@@ -18,10 +18,11 @@ export const updateWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sdk
18
18
  if (options.description !== undefined) {
19
19
  body.description = options.description;
20
20
  }
21
- const data = await sdk.context.api.patch(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`, body, {
21
+ const raw = await sdk.context.api.patch(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`, body, {
22
22
  authRequired: true,
23
23
  resource: { type: "workflow", id: options.workflow },
24
24
  });
25
+ const data = UpdateWorkflowResponseSchema.parse(raw);
25
26
  return { data };
26
27
  },
27
28
  }));
@@ -5,6 +5,8 @@ import type { AckTriggerInboxMessagesPluginProvides } from "../ackTriggerInboxMe
5
5
  import type { ReleaseTriggerInboxMessagesPluginProvides } from "../releaseTriggerInboxMessages";
6
6
  import type { LeasedTriggerMessageItem } from "../../../schemas/TriggerMessage";
7
7
  export { ZapierAbortDrainSignal, ZapierReleaseTriggerMessageSignal, } from "./schemas";
8
+ export declare function markNonRetryableDrainError<E>(err: E): E;
9
+ export declare function isNonRetryableDrainError(err: unknown): boolean;
8
10
  interface RunDrainPassOptions {
9
11
  sdk: ApiPluginProvides & LeaseTriggerInboxMessagesPluginProvides & AckTriggerInboxMessagesPluginProvides & ReleaseTriggerInboxMessagesPluginProvides;
10
12
  inboxId: string;
@@ -28,8 +30,8 @@ export interface RunDrainPassOutcome {
28
30
  /**
29
31
  * One drain pass through `runBatchedDrainPipeline`. Used directly by
30
32
  * `drainTriggerInbox` (single pass) and as the inner loop body of
31
- * `watchTriggerInbox` (called repeatedly with poll backoff between
32
- * empty passes).
33
+ * `watchTriggerInbox` (called once per drain request, with bounded error
34
+ * backoff between passes that fail with a transient error).
33
35
  */
34
36
  export declare function runDrainPass(options: RunDrainPassOptions): Promise<RunDrainPassOutcome>;
35
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/drainTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,gCAAgC,CAAC;AAIhG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAMhF,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,WAAW,CAAC;AAcnB,UAAU,mBAAmB;IAC3B,GAAG,EAA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AO,uBAAuB,CAC/B,CAAC"}
@@ -8,6 +8,30 @@ import { resolveTriggerInboxId } from "../utils";
8
8
  import { triggersDefaults } from "../shared";
9
9
  import { isAbortError } from "../../../utils/abort-utils";
10
10
  export { ZapierAbortDrainSignal, ZapierReleaseTriggerMessageSignal, } from "./schemas";
11
+ /**
12
+ * Drain errors that must NOT be retried, by error identity: a fail-fast handler
13
+ * error (the user's own failure — retrying would re-run a handler that already
14
+ * chose to stop) and an `initialization_failure` (a permanent inbox setup
15
+ * problem). The watch loop retries transient infrastructure errors but consults
16
+ * this set to leave these fatal. A WeakSet rather than a marker property because
17
+ * handler errors are the user's own values and must reach their catch
18
+ * unmodified. `markNonRetryableDrainError` no-ops on a non-object throw (it
19
+ * can't be weakly held), but that case is still fatal without this set: the
20
+ * watch loop classifies any non-object thrown value as non-retryable on its own,
21
+ * since the API client only ever throws Error objects, so a primitive can only
22
+ * be a user fail-fast throw. Permanent HTTP errors are non-retryable too, but
23
+ * the caller classifies those by status code, not via this set.
24
+ */
25
+ const nonRetryableDrainErrors = new WeakSet();
26
+ export function markNonRetryableDrainError(err) {
27
+ if (typeof err === "object" && err !== null) {
28
+ nonRetryableDrainErrors.add(err);
29
+ }
30
+ return err;
31
+ }
32
+ export function isNonRetryableDrainError(err) {
33
+ return (typeof err === "object" && err !== null && nonRetryableDrainErrors.has(err));
34
+ }
11
35
  /**
12
36
  * Server returns 400 lease_expired when a UUIDv7 timestamp is in the
13
37
  * past. The API atomically quarantines messages that have hit
@@ -23,13 +47,17 @@ function isLeaseExpiredError(err) {
23
47
  /**
24
48
  * One drain pass through `runBatchedDrainPipeline`. Used directly by
25
49
  * `drainTriggerInbox` (single pass) and as the inner loop body of
26
- * `watchTriggerInbox` (called repeatedly with poll backoff between
27
- * empty passes).
50
+ * `watchTriggerInbox` (called once per drain request, with bounded error
51
+ * backoff between passes that fail with a transient error).
28
52
  */
29
53
  export async function runDrainPass(options) {
30
54
  const { sdk, inboxId, onMessage, concurrency, leaseLimit, leaseSeconds, maxMessages, releaseOnError, continueOnError, onError, signal, } = options;
31
55
  let firstFetch = options.firstFetch;
32
56
  let abortedFromCallback = false;
57
+ // A boolean rather than a `firstHandlerError !== undefined` sentinel so a
58
+ // handler that throws a falsy value (`throw undefined` / `throw null`) is still
59
+ // captured and surfaced as fatal, not silently swallowed.
60
+ let handlerErrorCaptured = false;
33
61
  let firstHandlerError = undefined;
34
62
  const outcomes = await runBatchedDrainPipeline({
35
63
  concurrency,
@@ -59,7 +87,7 @@ export async function runDrainPass(options) {
59
87
  if (lease.results.length === 0) {
60
88
  if (firstFetch &&
61
89
  lease.inbox_attributes.status === "initialization_failure") {
62
- throw new ZapierApiError(`Trigger inbox ${inboxId} is in initialization_failure state — inspect via getTriggerInbox.`);
90
+ throw markNonRetryableDrainError(new ZapierApiError(`Trigger inbox ${inboxId} is in initialization_failure state — inspect via getTriggerInbox.`));
63
91
  }
64
92
  firstFetch = false;
65
93
  return "exhausted";
@@ -108,8 +136,10 @@ export async function runDrainPass(options) {
108
136
  // Fail-fast: capture the first real error and tell the
109
137
  // pipeline to abort. continueOnError keeps it running.
110
138
  if (!continueOnError && !(err instanceof ZapierSignal)) {
111
- if (firstHandlerError === undefined)
139
+ if (!handlerErrorCaptured) {
112
140
  firstHandlerError = err;
141
+ handlerErrorCaptured = true;
142
+ }
113
143
  abort = true;
114
144
  }
115
145
  return { value: message, action, abort };
@@ -142,8 +172,11 @@ export async function runDrainPass(options) {
142
172
  }
143
173
  },
144
174
  });
145
- if (firstHandlerError !== undefined)
146
- throw firstHandlerError;
175
+ // Mark so the watch loop treats this as fatal and never retries it (a
176
+ // fail-fast handler error means the user already chose to stop).
177
+ if (handlerErrorCaptured) {
178
+ throw markNonRetryableDrainError(firstHandlerError);
179
+ }
147
180
  return { abortedFromCallback, processed: outcomes.length };
148
181
  }
149
182
  /**
@@ -26,8 +26,10 @@ export declare function createDrainLatch(): DrainLatch;
26
26
  * `maxDrainIntervalSeconds` seconds (default: 300) to guarantee
27
27
  * forward progress if SSE events are missed or the connection drops
28
28
  * undetected. Resolves cleanly on `signal` abort or when a callback
29
- * throws `ZapierAbortDrainSignal`; rejects on a fatal error or a
30
- * fail-fast handler error.
29
+ * throws `ZapierAbortDrainSignal`. Transient drain failures (5xx, 429,
30
+ * network blips) are retried indefinitely with bounded backoff until they
31
+ * succeed or the watch is aborted; it rejects only on a fail-fast handler
32
+ * error, an `initialization_failure`, or a permanent HTTP error.
31
33
  */
32
34
  export declare const watchTriggerInboxPlugin: (sdk: {
33
35
  context: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/triggers/watchTriggerInbox/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAC;AAetC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA2BzD,MAAM,WAAW,UAAU;IACzB,8EAA8E;IAC9E,OAAO,IAAI,IAAI,CAAC;IAChB,sEAAsE;IACtE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CA2B7C;AAoLD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAMnB;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE;;;;;;iCAI7B,wBAAwB,KAChC,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHnB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,UAAU,CACtD,OAAO,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