@zapier/zapier-sdk 0.60.0 → 0.62.0
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/CHANGELOG.md +24 -0
- package/README.md +229 -1
- package/dist/experimental.cjs +384 -10
- package/dist/experimental.d.mts +182 -2
- package/dist/experimental.d.ts +180 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +14 -0
- package/dist/experimental.mjs +384 -11
- package/dist/{index-iKbnOz6r.d.mts → index-3fBEDEsp.d.mts} +25 -1
- package/dist/{index-iKbnOz6r.d.ts → index-3fBEDEsp.d.ts} +25 -1
- package/dist/index.cjs +19 -9
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +19 -10
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +45 -0
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/createWorkflow/index.js +19 -0
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts +16 -0
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.js +25 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +39 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.js +27 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts +6 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/deleteWorkflow/schemas.js +6 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +40 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/index.js +20 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/schemas.d.ts +11 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/disableWorkflow/schemas.js +12 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +40 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/index.js +20 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/schemas.d.ts +11 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/enableWorkflow/schemas.js +12 -0
- package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts +89 -0
- package/dist/plugins/codeSubstrate/getDurableRun/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/getDurableRun/index.js +20 -0
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +178 -0
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.js +130 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts +55 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/index.js +27 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts +73 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/listDurableRuns/schemas.js +59 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +47 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/index.js +27 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts +18 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts.map +1 -0
- package/dist/plugins/codeSubstrate/updateWorkflow/schemas.js +30 -0
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +1 -4
- package/dist/resolvers/clientId.d.ts.map +1 -1
- package/dist/resolvers/clientId.js +2 -4
- package/dist/resolvers/durableRunId.d.ts +4 -0
- package/dist/resolvers/durableRunId.d.ts.map +1 -0
- package/dist/resolvers/durableRunId.js +14 -0
- package/dist/resolvers/index.d.ts +1 -0
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +1 -0
- package/package.json +1 -1
package/dist/experimental.cjs
CHANGED
|
@@ -2889,7 +2889,7 @@ async function invalidateCredentialsToken(options) {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
|
|
2891
2891
|
// src/sdk-version.ts
|
|
2892
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
2892
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.62.0" : void 0) || "unknown";
|
|
2893
2893
|
|
|
2894
2894
|
// src/utils/open-url.ts
|
|
2895
2895
|
var nodePrefix = "node:";
|
|
@@ -4208,10 +4208,7 @@ var clientCredentialsNameResolver = {
|
|
|
4208
4208
|
// src/resolvers/clientId.ts
|
|
4209
4209
|
var clientIdResolver = {
|
|
4210
4210
|
type: "dynamic",
|
|
4211
|
-
fetch: async (sdk) => {
|
|
4212
|
-
const result = await sdk.listClientCredentials({ maxItems: 100 });
|
|
4213
|
-
return result.data;
|
|
4214
|
-
},
|
|
4211
|
+
fetch: async (sdk) => toIterable(sdk.listClientCredentials({})),
|
|
4215
4212
|
prompt: (credentials) => ({
|
|
4216
4213
|
type: "list",
|
|
4217
4214
|
name: "clientId",
|
|
@@ -4289,6 +4286,21 @@ var workflowIdResolver = {
|
|
|
4289
4286
|
})
|
|
4290
4287
|
};
|
|
4291
4288
|
|
|
4289
|
+
// src/resolvers/durableRunId.ts
|
|
4290
|
+
var durableRunIdResolver = {
|
|
4291
|
+
type: "dynamic",
|
|
4292
|
+
fetch: async (sdk) => toIterable(sdk.listDurableRuns()),
|
|
4293
|
+
prompt: (runs) => ({
|
|
4294
|
+
type: "list",
|
|
4295
|
+
name: "run",
|
|
4296
|
+
message: "Select a run:",
|
|
4297
|
+
choices: runs.map((run) => ({
|
|
4298
|
+
name: `${run.id} \u2014 ${run.status}`,
|
|
4299
|
+
value: run.id
|
|
4300
|
+
}))
|
|
4301
|
+
})
|
|
4302
|
+
};
|
|
4303
|
+
|
|
4292
4304
|
// src/resolvers/triggerMessages.ts
|
|
4293
4305
|
var triggerMessagesResolver = {
|
|
4294
4306
|
type: "dynamic",
|
|
@@ -6151,10 +6163,7 @@ var deleteClientCredentialsPlugin = definePlugin(
|
|
|
6151
6163
|
{
|
|
6152
6164
|
authRequired: true,
|
|
6153
6165
|
requiredScopes: ["credentials"],
|
|
6154
|
-
resource: {
|
|
6155
|
-
type: "client-credential",
|
|
6156
|
-
id: options.clientId
|
|
6157
|
-
}
|
|
6166
|
+
resource: { type: "client-credential", id: options.clientId }
|
|
6158
6167
|
}
|
|
6159
6168
|
);
|
|
6160
6169
|
return { success: true };
|
|
@@ -10646,6 +10655,370 @@ var getWorkflowPlugin = definePlugin(
|
|
|
10646
10655
|
}
|
|
10647
10656
|
})
|
|
10648
10657
|
);
|
|
10658
|
+
var CreateWorkflowOptionsSchema = zod.z.object({
|
|
10659
|
+
name: zod.z.string().min(1).describe("Workflow name"),
|
|
10660
|
+
description: zod.z.string().optional().describe("Optional description for the workflow")
|
|
10661
|
+
}).describe(
|
|
10662
|
+
"Create a durable workflow container. Starts disabled with no version; publish a version to add code."
|
|
10663
|
+
);
|
|
10664
|
+
var CreateWorkflowResponseSchema = zod.z.object({
|
|
10665
|
+
id: zod.z.string().describe("Workflow ID (UUID)"),
|
|
10666
|
+
name: zod.z.string().describe("Workflow name"),
|
|
10667
|
+
description: zod.z.string().nullable().describe("Workflow description (null if unset)"),
|
|
10668
|
+
trigger_url: zod.z.string().describe(
|
|
10669
|
+
"Public webhook URL that fires this workflow when POSTed to. Embeds a secret trigger token in the path \u2014 treat as sensitive."
|
|
10670
|
+
),
|
|
10671
|
+
enabled: zod.z.boolean().describe(
|
|
10672
|
+
"Whether the workflow currently accepts triggers. Always false on a new workflow until enabled."
|
|
10673
|
+
),
|
|
10674
|
+
created_at: zod.z.string().describe("When the workflow was created (ISO-8601)")
|
|
10675
|
+
});
|
|
10676
|
+
|
|
10677
|
+
// src/plugins/codeSubstrate/createWorkflow/index.ts
|
|
10678
|
+
var createWorkflowPlugin = definePlugin(
|
|
10679
|
+
(sdk) => createPluginMethod(sdk, {
|
|
10680
|
+
...codeSubstrateDefaults,
|
|
10681
|
+
name: "createWorkflow",
|
|
10682
|
+
type: "create",
|
|
10683
|
+
itemType: "Workflow",
|
|
10684
|
+
inputSchema: CreateWorkflowOptionsSchema,
|
|
10685
|
+
outputSchema: CreateWorkflowResponseSchema,
|
|
10686
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10687
|
+
const body = { name: options.name };
|
|
10688
|
+
if (options.description !== void 0) {
|
|
10689
|
+
body.description = options.description;
|
|
10690
|
+
}
|
|
10691
|
+
const data = await sdk2.context.api.post(
|
|
10692
|
+
"/durableworkflowzaps/api/v0/workflows",
|
|
10693
|
+
body,
|
|
10694
|
+
{ authRequired: true }
|
|
10695
|
+
);
|
|
10696
|
+
return { data };
|
|
10697
|
+
}
|
|
10698
|
+
})
|
|
10699
|
+
);
|
|
10700
|
+
var UpdateWorkflowOptionsSchema = zod.z.object({
|
|
10701
|
+
workflow: zod.z.string().uuid().describe("Durable workflow ID"),
|
|
10702
|
+
name: zod.z.string().min(1).optional().describe("New name for the workflow"),
|
|
10703
|
+
description: zod.z.string().nullish().describe("New description for the workflow (pass null to clear)")
|
|
10704
|
+
}).refine((data) => data.name !== void 0 || data.description !== void 0, {
|
|
10705
|
+
message: "Provide name or description (at least one is required)"
|
|
10706
|
+
}).describe("Update a durable workflow's name and/or description");
|
|
10707
|
+
var UpdateWorkflowResponseSchema = zod.z.object({
|
|
10708
|
+
id: zod.z.string().describe("Workflow ID (UUID)"),
|
|
10709
|
+
name: zod.z.string().describe("Workflow name (post-update)"),
|
|
10710
|
+
description: zod.z.string().nullable().describe("Workflow description, post-update (null if unset)"),
|
|
10711
|
+
trigger_url: zod.z.string().describe(
|
|
10712
|
+
"Public webhook URL that fires this workflow when POSTed to. Embeds a secret trigger token in the path \u2014 treat as sensitive."
|
|
10713
|
+
),
|
|
10714
|
+
enabled: zod.z.boolean().describe("Whether the workflow currently accepts triggers"),
|
|
10715
|
+
created_at: zod.z.string().describe("When the workflow was created (ISO-8601)"),
|
|
10716
|
+
updated_at: zod.z.string().describe("When this update was applied (ISO-8601)")
|
|
10717
|
+
});
|
|
10718
|
+
|
|
10719
|
+
// src/plugins/codeSubstrate/updateWorkflow/index.ts
|
|
10720
|
+
var updateWorkflowPlugin = definePlugin(
|
|
10721
|
+
(sdk) => createPluginMethod(sdk, {
|
|
10722
|
+
...codeSubstrateDefaults,
|
|
10723
|
+
name: "updateWorkflow",
|
|
10724
|
+
type: "update",
|
|
10725
|
+
itemType: "Workflow",
|
|
10726
|
+
inputSchema: UpdateWorkflowOptionsSchema,
|
|
10727
|
+
outputSchema: UpdateWorkflowResponseSchema,
|
|
10728
|
+
resolvers: { workflow: workflowIdResolver },
|
|
10729
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10730
|
+
const body = {};
|
|
10731
|
+
if (options.name !== void 0) {
|
|
10732
|
+
body.name = options.name;
|
|
10733
|
+
}
|
|
10734
|
+
if (options.description !== void 0) {
|
|
10735
|
+
body.description = options.description;
|
|
10736
|
+
}
|
|
10737
|
+
const data = await sdk2.context.api.patch(
|
|
10738
|
+
`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`,
|
|
10739
|
+
body,
|
|
10740
|
+
{
|
|
10741
|
+
authRequired: true,
|
|
10742
|
+
resource: { type: "workflow", id: options.workflow }
|
|
10743
|
+
}
|
|
10744
|
+
);
|
|
10745
|
+
return { data };
|
|
10746
|
+
}
|
|
10747
|
+
})
|
|
10748
|
+
);
|
|
10749
|
+
var EnableWorkflowOptionsSchema = zod.z.object({
|
|
10750
|
+
workflow: zod.z.string().uuid().describe("Durable workflow ID")
|
|
10751
|
+
}).describe("Enable a durable workflow so it accepts triggers");
|
|
10752
|
+
var EnableWorkflowResponseSchema = zod.z.object({
|
|
10753
|
+
id: zod.z.string().describe("Workflow ID (UUID)"),
|
|
10754
|
+
enabled: zod.z.boolean().describe("Workflow's enabled state after the operation (always true)")
|
|
10755
|
+
});
|
|
10756
|
+
|
|
10757
|
+
// src/plugins/codeSubstrate/enableWorkflow/index.ts
|
|
10758
|
+
var enableWorkflowPlugin = definePlugin(
|
|
10759
|
+
(sdk) => createPluginMethod(sdk, {
|
|
10760
|
+
...codeSubstrateDefaults,
|
|
10761
|
+
name: "enableWorkflow",
|
|
10762
|
+
type: "update",
|
|
10763
|
+
itemType: "Workflow",
|
|
10764
|
+
inputSchema: EnableWorkflowOptionsSchema,
|
|
10765
|
+
outputSchema: EnableWorkflowResponseSchema,
|
|
10766
|
+
resolvers: { workflow: workflowIdResolver },
|
|
10767
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10768
|
+
const data = await sdk2.context.api.post(
|
|
10769
|
+
`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/enable`,
|
|
10770
|
+
void 0,
|
|
10771
|
+
{
|
|
10772
|
+
authRequired: true,
|
|
10773
|
+
resource: { type: "workflow", id: options.workflow }
|
|
10774
|
+
}
|
|
10775
|
+
);
|
|
10776
|
+
return { data };
|
|
10777
|
+
}
|
|
10778
|
+
})
|
|
10779
|
+
);
|
|
10780
|
+
var DisableWorkflowOptionsSchema = zod.z.object({
|
|
10781
|
+
workflow: zod.z.string().uuid().describe("Durable workflow ID")
|
|
10782
|
+
}).describe("Disable a durable workflow so it stops accepting triggers");
|
|
10783
|
+
var DisableWorkflowResponseSchema = zod.z.object({
|
|
10784
|
+
id: zod.z.string().describe("Workflow ID (UUID)"),
|
|
10785
|
+
enabled: zod.z.boolean().describe(
|
|
10786
|
+
"Workflow's enabled state after the operation. Typically false; mirrors the row's true state in case a concurrent enable raced with this call."
|
|
10787
|
+
)
|
|
10788
|
+
});
|
|
10789
|
+
|
|
10790
|
+
// src/plugins/codeSubstrate/disableWorkflow/index.ts
|
|
10791
|
+
var disableWorkflowPlugin = definePlugin(
|
|
10792
|
+
(sdk) => createPluginMethod(sdk, {
|
|
10793
|
+
...codeSubstrateDefaults,
|
|
10794
|
+
name: "disableWorkflow",
|
|
10795
|
+
type: "update",
|
|
10796
|
+
itemType: "Workflow",
|
|
10797
|
+
inputSchema: DisableWorkflowOptionsSchema,
|
|
10798
|
+
outputSchema: DisableWorkflowResponseSchema,
|
|
10799
|
+
resolvers: { workflow: workflowIdResolver },
|
|
10800
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10801
|
+
const data = await sdk2.context.api.post(
|
|
10802
|
+
`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/disable`,
|
|
10803
|
+
void 0,
|
|
10804
|
+
{
|
|
10805
|
+
authRequired: true,
|
|
10806
|
+
resource: { type: "workflow", id: options.workflow }
|
|
10807
|
+
}
|
|
10808
|
+
);
|
|
10809
|
+
return { data };
|
|
10810
|
+
}
|
|
10811
|
+
})
|
|
10812
|
+
);
|
|
10813
|
+
var DeleteWorkflowOptionsSchema = zod.z.object({
|
|
10814
|
+
workflow: zod.z.string().uuid().describe("Durable workflow ID")
|
|
10815
|
+
}).describe(
|
|
10816
|
+
"Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't exist; callers wanting idempotency should catch that themselves."
|
|
10817
|
+
);
|
|
10818
|
+
|
|
10819
|
+
// src/plugins/codeSubstrate/deleteWorkflow/index.ts
|
|
10820
|
+
var deleteWorkflowPlugin = definePlugin(
|
|
10821
|
+
(sdk) => createPluginMethod(sdk, {
|
|
10822
|
+
...codeSubstrateDefaults,
|
|
10823
|
+
name: "deleteWorkflow",
|
|
10824
|
+
type: "delete",
|
|
10825
|
+
itemType: "Workflow",
|
|
10826
|
+
confirm: "delete",
|
|
10827
|
+
inputSchema: DeleteWorkflowOptionsSchema,
|
|
10828
|
+
resolvers: { workflow: workflowIdResolver },
|
|
10829
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10830
|
+
await sdk2.context.api.delete(
|
|
10831
|
+
`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}`,
|
|
10832
|
+
void 0,
|
|
10833
|
+
{
|
|
10834
|
+
authRequired: true,
|
|
10835
|
+
resource: { type: "workflow", id: options.workflow }
|
|
10836
|
+
}
|
|
10837
|
+
);
|
|
10838
|
+
return { data: { id: options.workflow } };
|
|
10839
|
+
}
|
|
10840
|
+
})
|
|
10841
|
+
);
|
|
10842
|
+
var RunStatusSchema = zod.z.enum(["initialized", "started", "finished", "failed", "cancelled"]).describe(
|
|
10843
|
+
"Run lifecycle status. `finished` / `failed` / `cancelled` are terminal."
|
|
10844
|
+
);
|
|
10845
|
+
var RunErrorSchema = zod.z.object({
|
|
10846
|
+
code: zod.z.string().describe("Machine-readable error category"),
|
|
10847
|
+
message: zod.z.string().describe("Human-readable error summary")
|
|
10848
|
+
}).passthrough().describe(
|
|
10849
|
+
"Structured run error. Always carries `code` and `message`; additional keys may appear depending on the error type."
|
|
10850
|
+
);
|
|
10851
|
+
var RunItemSchema = zod.z.object({
|
|
10852
|
+
id: zod.z.string().describe("Run ID (UUID)"),
|
|
10853
|
+
status: RunStatusSchema,
|
|
10854
|
+
input: zod.z.unknown().describe("Input data passed to the run"),
|
|
10855
|
+
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
10856
|
+
error: RunErrorSchema.nullable().describe(
|
|
10857
|
+
"Structured error details when the run failed (null otherwise)"
|
|
10858
|
+
),
|
|
10859
|
+
execution_id: zod.z.string().nullable().describe(
|
|
10860
|
+
"Linked execution ID. Null until the run leaves the `initialized` state."
|
|
10861
|
+
),
|
|
10862
|
+
is_private: zod.z.boolean().describe(
|
|
10863
|
+
"When true, the run is visible only to the creating user; otherwise visible across the account."
|
|
10864
|
+
),
|
|
10865
|
+
created_at: zod.z.string().describe("When the run was created (ISO-8601)"),
|
|
10866
|
+
updated_at: zod.z.string().describe("When the run was last updated (ISO-8601)")
|
|
10867
|
+
});
|
|
10868
|
+
var ListDurableRunsOptionsSchema = zod.z.object({
|
|
10869
|
+
pageSize: zod.z.number().min(1).max(100).optional().describe("Number of runs per page (max 100)"),
|
|
10870
|
+
cursor: zod.z.string().optional().describe("Pagination cursor"),
|
|
10871
|
+
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
10872
|
+
}).describe(
|
|
10873
|
+
"List run-once durable runs for the authenticated account, newest first"
|
|
10874
|
+
);
|
|
10875
|
+
zod.z.object({
|
|
10876
|
+
results: zod.z.array(RunItemSchema),
|
|
10877
|
+
meta: zod.z.object({
|
|
10878
|
+
limit: zod.z.number(),
|
|
10879
|
+
cursor: zod.z.string().nullable().optional(),
|
|
10880
|
+
next_cursor: zod.z.string().nullable().optional()
|
|
10881
|
+
}),
|
|
10882
|
+
links: zod.z.object({
|
|
10883
|
+
next: zod.z.string().nullable().optional()
|
|
10884
|
+
}).optional()
|
|
10885
|
+
});
|
|
10886
|
+
|
|
10887
|
+
// src/plugins/codeSubstrate/listDurableRuns/index.ts
|
|
10888
|
+
var listDurableRunsPlugin = definePlugin(
|
|
10889
|
+
(sdk) => createPaginatedPluginMethod(sdk, {
|
|
10890
|
+
...codeSubstrateDefaults,
|
|
10891
|
+
name: "listDurableRuns",
|
|
10892
|
+
type: "list",
|
|
10893
|
+
itemType: "DurableRun",
|
|
10894
|
+
inputSchema: ListDurableRunsOptionsSchema,
|
|
10895
|
+
outputSchema: RunItemSchema,
|
|
10896
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
10897
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
10898
|
+
const searchParams = {};
|
|
10899
|
+
if (options.pageSize !== void 0) {
|
|
10900
|
+
searchParams.limit = options.pageSize.toString();
|
|
10901
|
+
}
|
|
10902
|
+
if (options.cursor) {
|
|
10903
|
+
searchParams.cursor = options.cursor;
|
|
10904
|
+
}
|
|
10905
|
+
const response = await sdk2.context.api.get(
|
|
10906
|
+
"/sdkdurableapi/api/v0/runs",
|
|
10907
|
+
{ searchParams, authRequired: true }
|
|
10908
|
+
);
|
|
10909
|
+
return {
|
|
10910
|
+
data: response.results,
|
|
10911
|
+
nextCursor: response.meta.next_cursor ?? void 0
|
|
10912
|
+
};
|
|
10913
|
+
}
|
|
10914
|
+
})
|
|
10915
|
+
);
|
|
10916
|
+
var OperationTypeSchema = zod.z.enum(["step", "wait", "callback"]).describe(
|
|
10917
|
+
"Operation kind: `step` is a journaled function call; `wait` is a time-based suspension; `callback` is a wait on an external callback."
|
|
10918
|
+
);
|
|
10919
|
+
var OperationStatusSchema = zod.z.enum(["pending", "completed", "failed", "exhausted"]).describe(
|
|
10920
|
+
"Operation lifecycle status. `exhausted` means retries were exceeded."
|
|
10921
|
+
);
|
|
10922
|
+
var OperationSchema = zod.z.object({
|
|
10923
|
+
id: zod.z.string().describe("Operation ID (UUID)"),
|
|
10924
|
+
execution_id: zod.z.string().describe("Parent execution ID"),
|
|
10925
|
+
name: zod.z.string().describe("Operation name as declared by the workflow author"),
|
|
10926
|
+
type: OperationTypeSchema,
|
|
10927
|
+
status: OperationStatusSchema,
|
|
10928
|
+
result: zod.z.unknown().optional().describe("Result value when the operation completed"),
|
|
10929
|
+
error: zod.z.unknown().optional().describe("Error payload when the operation failed"),
|
|
10930
|
+
retry_count: zod.z.number().describe("Number of retry attempts so far"),
|
|
10931
|
+
max_attempts: zod.z.number().optional().describe(
|
|
10932
|
+
"Cap on total attempts for this operation. Absent if no cap applies."
|
|
10933
|
+
),
|
|
10934
|
+
next_retry_at: zod.z.string().optional().describe("When the next retry will be attempted (ISO-8601)"),
|
|
10935
|
+
resume_at: zod.z.string().optional().describe(
|
|
10936
|
+
"When a `wait` operation resumes (ISO-8601). Set only for type=wait."
|
|
10937
|
+
),
|
|
10938
|
+
callback_token: zod.z.string().nullable().optional().describe(
|
|
10939
|
+
"Token for delivering a callback. Set only for type=callback; null until the callback URL is materialized."
|
|
10940
|
+
),
|
|
10941
|
+
payload_schema: zod.z.unknown().optional().describe("JSON Schema describing the expected callback payload"),
|
|
10942
|
+
payload: zod.z.unknown().optional().describe("Payload delivered to a callback operation, when received"),
|
|
10943
|
+
expires_at: zod.z.string().optional().describe("When a callback or wait operation expires (ISO-8601)"),
|
|
10944
|
+
completed_at: zod.z.string().optional().describe("When the operation reached a terminal state (ISO-8601)"),
|
|
10945
|
+
created_at: zod.z.string().describe("When the operation was created (ISO-8601)")
|
|
10946
|
+
});
|
|
10947
|
+
var ExecutionStatusSchema = zod.z.enum(["running", "waiting", "completed", "failed"]).describe(
|
|
10948
|
+
"Execution lifecycle status. `waiting` means blocked on a wait or callback operation."
|
|
10949
|
+
);
|
|
10950
|
+
var ExecutionSummarySchema = zod.z.object({
|
|
10951
|
+
id: zod.z.string().describe("Execution ID (UUID)"),
|
|
10952
|
+
name: zod.z.string().describe("Durable function name"),
|
|
10953
|
+
status: ExecutionStatusSchema,
|
|
10954
|
+
input: zod.z.unknown().describe("Input passed when the execution was created"),
|
|
10955
|
+
output: zod.z.unknown().optional().describe("Return value when status is `completed`"),
|
|
10956
|
+
error: zod.z.unknown().optional().describe("Error details when status is `failed`"),
|
|
10957
|
+
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe(
|
|
10958
|
+
"Caller-supplied tags (Zap ID, Step ID, Agent ID, etc.) carried alongside the execution"
|
|
10959
|
+
),
|
|
10960
|
+
created_at: zod.z.string().describe("When the execution was created (ISO-8601)"),
|
|
10961
|
+
summary: zod.z.object({
|
|
10962
|
+
total_attempts: zod.z.number().describe(
|
|
10963
|
+
"Total ticks attempted against this execution across all retries"
|
|
10964
|
+
),
|
|
10965
|
+
last_error: zod.z.object({
|
|
10966
|
+
code: zod.z.string().describe("Machine-readable error category"),
|
|
10967
|
+
title: zod.z.string().describe("Short error label"),
|
|
10968
|
+
detail: zod.z.string().nullable().optional().describe("Longer-form error detail, when provided")
|
|
10969
|
+
}).passthrough().optional().describe("The most recent error, if the execution has failed once")
|
|
10970
|
+
}).passthrough().nullable().optional().describe(
|
|
10971
|
+
"Aggregate health summary. Null when no attempts have been recorded yet."
|
|
10972
|
+
),
|
|
10973
|
+
operations: zod.z.array(OperationSchema).optional().describe(
|
|
10974
|
+
"Operations journal \u2014 append-only record of every step/wait/callback the execution made"
|
|
10975
|
+
)
|
|
10976
|
+
});
|
|
10977
|
+
var GetDurableRunOptionsSchema = zod.z.object({
|
|
10978
|
+
run: zod.z.string().uuid().describe("Durable run ID")
|
|
10979
|
+
}).describe(
|
|
10980
|
+
"Get the full state of a run-once durable run, including its operations journal"
|
|
10981
|
+
);
|
|
10982
|
+
var GetDurableRunResponseSchema = zod.z.object({
|
|
10983
|
+
id: zod.z.string().describe("Run ID (UUID)"),
|
|
10984
|
+
status: RunStatusSchema,
|
|
10985
|
+
input: zod.z.unknown().describe("Input data passed to the run"),
|
|
10986
|
+
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
10987
|
+
error: RunErrorSchema.nullable().describe(
|
|
10988
|
+
"Structured error details when the run failed (null otherwise)"
|
|
10989
|
+
),
|
|
10990
|
+
execution: ExecutionSummarySchema.nullable().describe(
|
|
10991
|
+
"Linked execution, including the operations journal. Null while the run is still in `initialized` state."
|
|
10992
|
+
),
|
|
10993
|
+
is_private: zod.z.boolean().describe(
|
|
10994
|
+
"When true, the run is visible only to the creating user; otherwise visible across the account."
|
|
10995
|
+
),
|
|
10996
|
+
created_at: zod.z.string().describe("When the run was created (ISO-8601)"),
|
|
10997
|
+
updated_at: zod.z.string().describe("When the run was last updated (ISO-8601)")
|
|
10998
|
+
});
|
|
10999
|
+
|
|
11000
|
+
// src/plugins/codeSubstrate/getDurableRun/index.ts
|
|
11001
|
+
var getDurableRunPlugin = definePlugin(
|
|
11002
|
+
(sdk) => createPluginMethod(sdk, {
|
|
11003
|
+
...codeSubstrateDefaults,
|
|
11004
|
+
name: "getDurableRun",
|
|
11005
|
+
type: "item",
|
|
11006
|
+
itemType: "DurableRun",
|
|
11007
|
+
inputSchema: GetDurableRunOptionsSchema,
|
|
11008
|
+
outputSchema: GetDurableRunResponseSchema,
|
|
11009
|
+
resolvers: { run: durableRunIdResolver },
|
|
11010
|
+
handler: async ({ sdk: sdk2, options }) => {
|
|
11011
|
+
const data = await sdk2.context.api.get(
|
|
11012
|
+
`/sdkdurableapi/api/v0/runs/${encodeURIComponent(options.run)}`,
|
|
11013
|
+
{
|
|
11014
|
+
authRequired: true,
|
|
11015
|
+
resource: { type: "run", id: options.run }
|
|
11016
|
+
}
|
|
11017
|
+
);
|
|
11018
|
+
return { data };
|
|
11019
|
+
}
|
|
11020
|
+
})
|
|
11021
|
+
);
|
|
10649
11022
|
|
|
10650
11023
|
// src/utils/batch-utils.ts
|
|
10651
11024
|
var DEFAULT_CONCURRENCY = 10;
|
|
@@ -10805,7 +11178,7 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
10805
11178
|
|
|
10806
11179
|
// src/experimental.ts
|
|
10807
11180
|
function createZapierSdk2(options = {}) {
|
|
10808
|
-
return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(createTriggerInboxPlugin).addPlugin(ensureTriggerInboxPlugin).addPlugin(listTriggerInboxesPlugin).addPlugin(getTriggerInboxPlugin).addPlugin(updateTriggerInboxPlugin).addPlugin(deleteTriggerInboxPlugin).addPlugin(pauseTriggerInboxPlugin).addPlugin(resumeTriggerInboxPlugin).addPlugin(listTriggerInboxMessagesPlugin).addPlugin(leaseTriggerInboxMessagesPlugin).addPlugin(ackTriggerInboxMessagesPlugin).addPlugin(releaseTriggerInboxMessagesPlugin).addPlugin(drainTriggerInboxPlugin).addPlugin(watchTriggerInboxPlugin).addPlugin(listTriggersPlugin).addPlugin(listTriggerInputFieldsPlugin).addPlugin(listTriggerInputFieldChoicesPlugin).addPlugin(getTriggerInputFieldsSchemaPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(listWorkflowsPlugin).addPlugin(getWorkflowPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
11181
|
+
return createSdk().addPlugin(createOptionsPlugin(options)).addPlugin(eventEmissionPlugin).addPlugin(apiPlugin).addPlugin(manifestPlugin).addPlugin(capabilitiesPlugin).addPlugin(connectionsPlugin).addPlugin(listAppsPlugin).addPlugin(getAppPlugin).addPlugin(listActionsPlugin).addPlugin(getActionPlugin).addPlugin(listActionInputFieldsPlugin).addPlugin(getActionInputFieldsSchemaPlugin).addPlugin(listActionInputFieldChoicesPlugin).addPlugin(listInputFieldsDeprecatedPlugin).addPlugin(getInputFieldsSchemaDeprecatedPlugin).addPlugin(listInputFieldChoicesDeprecatedPlugin).addPlugin(runActionPlugin).addPlugin(listConnectionsPlugin).addPlugin(getConnectionPlugin).addPlugin(findFirstConnectionPlugin).addPlugin(findUniqueConnectionPlugin).addPlugin(listAuthenticationsPlugin).addPlugin(getAuthenticationPlugin).addPlugin(findFirstAuthenticationPlugin).addPlugin(findUniqueAuthenticationPlugin).addPlugin(listClientCredentialsPlugin).addPlugin(createClientCredentialsPlugin).addPlugin(deleteClientCredentialsPlugin).addPlugin(fetchPlugin).addPlugin(requestPlugin).addPlugin(createTriggerInboxPlugin).addPlugin(ensureTriggerInboxPlugin).addPlugin(listTriggerInboxesPlugin).addPlugin(getTriggerInboxPlugin).addPlugin(updateTriggerInboxPlugin).addPlugin(deleteTriggerInboxPlugin).addPlugin(pauseTriggerInboxPlugin).addPlugin(resumeTriggerInboxPlugin).addPlugin(listTriggerInboxMessagesPlugin).addPlugin(leaseTriggerInboxMessagesPlugin).addPlugin(ackTriggerInboxMessagesPlugin).addPlugin(releaseTriggerInboxMessagesPlugin).addPlugin(drainTriggerInboxPlugin).addPlugin(watchTriggerInboxPlugin).addPlugin(listTriggersPlugin).addPlugin(listTriggerInputFieldsPlugin).addPlugin(listTriggerInputFieldChoicesPlugin).addPlugin(getTriggerInputFieldsSchemaPlugin).addPlugin(listTablesPlugin).addPlugin(getTablePlugin).addPlugin(deleteTablePlugin).addPlugin(createTablePlugin).addPlugin(listTableFieldsPlugin).addPlugin(createTableFieldsPlugin).addPlugin(deleteTableFieldsPlugin).addPlugin(getTableRecordPlugin).addPlugin(listTableRecordsPlugin).addPlugin(createTableRecordsPlugin).addPlugin(deleteTableRecordsPlugin).addPlugin(updateTableRecordsPlugin).addPlugin(listWorkflowsPlugin).addPlugin(getWorkflowPlugin).addPlugin(createWorkflowPlugin).addPlugin(updateWorkflowPlugin).addPlugin(enableWorkflowPlugin).addPlugin(disableWorkflowPlugin).addPlugin(deleteWorkflowPlugin).addPlugin(listDurableRunsPlugin).addPlugin(getDurableRunPlugin).addPlugin(appsPlugin).addPlugin(getProfilePlugin);
|
|
10809
11182
|
}
|
|
10810
11183
|
|
|
10811
11184
|
exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
|
|
@@ -10919,6 +11292,7 @@ exports.deleteClientCredentialsPlugin = deleteClientCredentialsPlugin;
|
|
|
10919
11292
|
exports.deleteTableFieldsPlugin = deleteTableFieldsPlugin;
|
|
10920
11293
|
exports.deleteTablePlugin = deleteTablePlugin;
|
|
10921
11294
|
exports.deleteTableRecordsPlugin = deleteTableRecordsPlugin;
|
|
11295
|
+
exports.durableRunIdResolver = durableRunIdResolver;
|
|
10922
11296
|
exports.eventEmissionPlugin = eventEmissionPlugin;
|
|
10923
11297
|
exports.fetchPlugin = fetchPlugin;
|
|
10924
11298
|
exports.findFirstConnectionPlugin = findFirstConnectionPlugin;
|