@zapier/zapier-sdk 0.120.0 → 0.122.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 +34 -0
- package/README.md +65 -47
- package/dist/beta.cjs +287 -287
- package/dist/beta.d.mts +244 -116
- package/dist/beta.d.ts +244 -116
- package/dist/beta.mjs +2 -2
- package/dist/{chunk-VLYXR2T6.cjs → chunk-5H5J5AKU.cjs} +1 -1
- package/dist/{chunk-CYPVUHGJ.cjs → chunk-AUBIZWYI.cjs} +237 -109
- package/dist/{chunk-ZSALKPF6.mjs → chunk-FYLZ2LZO.mjs} +1 -1
- package/dist/{chunk-CKZGXKRK.mjs → chunk-PHEZB6T2.mjs} +150 -22
- package/dist/experimental.cjs +321 -321
- package/dist/experimental.d.mts +256 -128
- package/dist/experimental.d.ts +256 -128
- package/dist/experimental.mjs +7 -7
- package/dist/{index-CThNTXl2.d.mts → index-BnMxdUcw.d.mts} +2 -2
- package/dist/{index-CThNTXl2.d.ts → index-BnMxdUcw.d.ts} +2 -2
- package/dist/index.cjs +281 -281
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5H5J5AKU_cjs = require('./chunk-5H5J5AKU.cjs');
|
|
4
4
|
var kitcore = require('@zapier/kitcore');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var codeSubstrateDefaults = {
|
|
8
|
-
categories: [
|
|
8
|
+
categories: [chunk5H5J5AKU_cjs.taxonomy.categories["code-workflow"]],
|
|
9
9
|
stability: "beta"
|
|
10
10
|
};
|
|
11
11
|
var CODE_SUBSTRATE_ANALYZER_API = "/code-substrate-analyzer";
|
|
@@ -19,7 +19,7 @@ function toWireWorkflowClientAttribution({
|
|
|
19
19
|
return {
|
|
20
20
|
...creationHarness === void 0 ? {} : { harness: creationHarness },
|
|
21
21
|
access_method: creationAccessMethod,
|
|
22
|
-
sdk_version:
|
|
22
|
+
sdk_version: chunk5H5J5AKU_cjs.SDK_VERSION
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
var JsonPayloadSchema = zod.z.preprocess((val) => {
|
|
@@ -62,7 +62,7 @@ function toWireConnections(connections) {
|
|
|
62
62
|
for (const [alias, entry] of Object.entries(connections)) {
|
|
63
63
|
const connectionId = entry.connectionId ?? entry.connection_id;
|
|
64
64
|
if (connectionId === void 0) {
|
|
65
|
-
throw new
|
|
65
|
+
throw new chunk5H5J5AKU_cjs.ZapierValidationError(
|
|
66
66
|
`connections["${alias}"] is missing connectionId`
|
|
67
67
|
);
|
|
68
68
|
}
|
|
@@ -89,7 +89,7 @@ var TriggerConfigSchema = zod.z.object({
|
|
|
89
89
|
function toWireTrigger(trigger) {
|
|
90
90
|
const selectedApi = trigger.selectedApi ?? trigger.selected_api;
|
|
91
91
|
if (selectedApi === void 0) {
|
|
92
|
-
throw new
|
|
92
|
+
throw new chunk5H5J5AKU_cjs.ZapierValidationError("trigger is missing selectedApi");
|
|
93
93
|
}
|
|
94
94
|
const wire = {
|
|
95
95
|
selected_api: selectedApi,
|
|
@@ -110,7 +110,7 @@ function toWireAppVersions(appVersions) {
|
|
|
110
110
|
for (const [key, entry] of Object.entries(appVersions)) {
|
|
111
111
|
const implementationName = entry.implementationName ?? entry.implementation_name;
|
|
112
112
|
if (implementationName === void 0) {
|
|
113
|
-
throw new
|
|
113
|
+
throw new chunk5H5J5AKU_cjs.ZapierValidationError(
|
|
114
114
|
`appVersions["${key}"] is missing implementationName`
|
|
115
115
|
);
|
|
116
116
|
}
|
|
@@ -323,7 +323,7 @@ var ListWorkflowsApiResponseSchema = zod.z.object({
|
|
|
323
323
|
var listWorkflowsPlugin = kitcore.defineMethod({
|
|
324
324
|
...codeSubstrateDefaults,
|
|
325
325
|
name: "listWorkflows",
|
|
326
|
-
imports: [
|
|
326
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
327
327
|
type: "list",
|
|
328
328
|
itemType: "Workflow",
|
|
329
329
|
inputSchema: ListWorkflowsOptionsSchema,
|
|
@@ -331,7 +331,7 @@ var listWorkflowsPlugin = kitcore.defineMethod({
|
|
|
331
331
|
skipOutputValidation: true,
|
|
332
332
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
333
333
|
// standard list output (no `adaptPage`) applies.
|
|
334
|
-
output: { type: "list", defaultPageSize:
|
|
334
|
+
output: { type: "list", defaultPageSize: chunk5H5J5AKU_cjs.DEFAULT_PAGE_SIZE },
|
|
335
335
|
run: async ({ imports, input }) => {
|
|
336
336
|
const api = imports.api;
|
|
337
337
|
const searchParams = {};
|
|
@@ -412,13 +412,13 @@ var GetWorkflowResponseSchema = zod.z.object({
|
|
|
412
412
|
var getWorkflowPlugin = kitcore.defineMethod({
|
|
413
413
|
...codeSubstrateDefaults,
|
|
414
414
|
name: "getWorkflow",
|
|
415
|
-
imports: [
|
|
415
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
416
416
|
itemType: "Workflow",
|
|
417
417
|
inputSchema: GetWorkflowOptionsSchema,
|
|
418
418
|
outputSchema: GetWorkflowResponseSchema,
|
|
419
419
|
skipOutputValidation: true,
|
|
420
420
|
output: "item",
|
|
421
|
-
resolvers: { workflow:
|
|
421
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
422
422
|
run: async ({ imports, input }) => {
|
|
423
423
|
const api = imports.api;
|
|
424
424
|
const raw = await api.get(
|
|
@@ -470,7 +470,7 @@ var CreateWorkflowResponseSchema = zod.z.object({
|
|
|
470
470
|
var createWorkflowPlugin = kitcore.defineMethod({
|
|
471
471
|
...codeSubstrateDefaults,
|
|
472
472
|
name: "createWorkflow",
|
|
473
|
-
imports: [
|
|
473
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
474
474
|
type: "create",
|
|
475
475
|
itemType: "Workflow",
|
|
476
476
|
inputSchema: CreateWorkflowOptionsSchema,
|
|
@@ -570,7 +570,7 @@ var ImportWorkflowResponseSchema = zod.z.object({
|
|
|
570
570
|
var importWorkflowPlugin = kitcore.defineMethod({
|
|
571
571
|
...codeSubstrateDefaults,
|
|
572
572
|
name: "importWorkflow",
|
|
573
|
-
imports: [
|
|
573
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
574
574
|
type: "create",
|
|
575
575
|
itemType: "Workflow",
|
|
576
576
|
// The response is the composite `{ workflow, draft, issues }`, not the bare
|
|
@@ -602,8 +602,8 @@ var importWorkflowPlugin = kitcore.defineMethod({
|
|
|
602
602
|
// and add only what a caller can't infer from a bare 403.
|
|
603
603
|
customErrorHandler: ({ status, data }) => {
|
|
604
604
|
if (status === 403) {
|
|
605
|
-
const detail =
|
|
606
|
-
return new
|
|
605
|
+
const detail = chunk5H5J5AKU_cjs.extractErrorDetail(data)?.replace(/[.!?]+$/, "");
|
|
606
|
+
return new chunk5H5J5AKU_cjs.ZapierApiError(
|
|
607
607
|
`${detail || "Zap import forbidden"}. Retrying will not help.`,
|
|
608
608
|
{ statusCode: status }
|
|
609
609
|
);
|
|
@@ -645,14 +645,14 @@ var UpdateWorkflowResponseSchema = zod.z.object({
|
|
|
645
645
|
var updateWorkflowPlugin = kitcore.defineMethod({
|
|
646
646
|
...codeSubstrateDefaults,
|
|
647
647
|
name: "updateWorkflow",
|
|
648
|
-
imports: [
|
|
648
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
649
649
|
type: "update",
|
|
650
650
|
itemType: "Workflow",
|
|
651
651
|
inputSchema: UpdateWorkflowOptionsSchema,
|
|
652
652
|
outputSchema: UpdateWorkflowResponseSchema,
|
|
653
653
|
skipOutputValidation: true,
|
|
654
654
|
output: "item",
|
|
655
|
-
resolvers: { workflow:
|
|
655
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
656
656
|
run: async ({ imports, input }) => {
|
|
657
657
|
const api = imports.api;
|
|
658
658
|
const body = {};
|
|
@@ -685,14 +685,14 @@ var EnableWorkflowResponseSchema = zod.z.object({
|
|
|
685
685
|
var enableWorkflowPlugin = kitcore.defineMethod({
|
|
686
686
|
...codeSubstrateDefaults,
|
|
687
687
|
name: "enableWorkflow",
|
|
688
|
-
imports: [
|
|
688
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
689
689
|
type: "update",
|
|
690
690
|
itemType: "Workflow",
|
|
691
691
|
inputSchema: EnableWorkflowOptionsSchema,
|
|
692
692
|
outputSchema: EnableWorkflowResponseSchema,
|
|
693
693
|
skipOutputValidation: true,
|
|
694
694
|
output: "item",
|
|
695
|
-
resolvers: { workflow:
|
|
695
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
696
696
|
run: async ({ imports, input }) => {
|
|
697
697
|
const api = imports.api;
|
|
698
698
|
const raw = await api.post(
|
|
@@ -720,14 +720,14 @@ var DisableWorkflowResponseSchema = zod.z.object({
|
|
|
720
720
|
var disableWorkflowPlugin = kitcore.defineMethod({
|
|
721
721
|
...codeSubstrateDefaults,
|
|
722
722
|
name: "disableWorkflow",
|
|
723
|
-
imports: [
|
|
723
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
724
724
|
type: "update",
|
|
725
725
|
itemType: "Workflow",
|
|
726
726
|
inputSchema: DisableWorkflowOptionsSchema,
|
|
727
727
|
outputSchema: DisableWorkflowResponseSchema,
|
|
728
728
|
skipOutputValidation: true,
|
|
729
729
|
output: "item",
|
|
730
|
-
resolvers: { workflow:
|
|
730
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
731
731
|
run: async ({ imports, input }) => {
|
|
732
732
|
const api = imports.api;
|
|
733
733
|
const raw = await api.post(
|
|
@@ -754,7 +754,7 @@ var DeleteWorkflowResponseSchema = zod.z.object({
|
|
|
754
754
|
var deleteWorkflowPlugin = kitcore.defineMethod({
|
|
755
755
|
...codeSubstrateDefaults,
|
|
756
756
|
name: "deleteWorkflow",
|
|
757
|
-
imports: [
|
|
757
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
758
758
|
type: "delete",
|
|
759
759
|
itemType: "Workflow",
|
|
760
760
|
confirm: "delete",
|
|
@@ -762,7 +762,7 @@ var deleteWorkflowPlugin = kitcore.defineMethod({
|
|
|
762
762
|
outputSchema: DeleteWorkflowResponseSchema,
|
|
763
763
|
skipOutputValidation: true,
|
|
764
764
|
output: "raw",
|
|
765
|
-
resolvers: { workflow:
|
|
765
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
766
766
|
run: async ({ imports, input }) => {
|
|
767
767
|
const api = imports.api;
|
|
768
768
|
await api.delete(
|
|
@@ -789,8 +789,8 @@ var RunErrorSchema = zod.z.object({
|
|
|
789
789
|
var RunItemSchema = zod.z.object({
|
|
790
790
|
id: zod.z.string().describe("Run ID (UUID)"),
|
|
791
791
|
status: RunStatusSchema,
|
|
792
|
-
input: zod.z.unknown().describe("Input data passed to the run"),
|
|
793
|
-
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
792
|
+
input: zod.z.unknown().optional().describe("Input data passed to the run"),
|
|
793
|
+
output: zod.z.unknown().nullable().optional().describe("Return value, present when status is `finished`"),
|
|
794
794
|
error: RunErrorSchema.nullable().describe(
|
|
795
795
|
"Structured error details when the run failed (null otherwise)"
|
|
796
796
|
),
|
|
@@ -830,7 +830,7 @@ var ListDurableRunsApiResponseSchema = zod.z.object({
|
|
|
830
830
|
var listDurableRunsPlugin = kitcore.defineMethod({
|
|
831
831
|
...codeSubstrateDefaults,
|
|
832
832
|
name: "listDurableRuns",
|
|
833
|
-
imports: [
|
|
833
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
834
834
|
type: "list",
|
|
835
835
|
itemType: "DurableRun",
|
|
836
836
|
inputSchema: ListDurableRunsOptionsSchema,
|
|
@@ -838,7 +838,7 @@ var listDurableRunsPlugin = kitcore.defineMethod({
|
|
|
838
838
|
skipOutputValidation: true,
|
|
839
839
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
840
840
|
// standard list output (no `adaptPage`) applies.
|
|
841
|
-
output: { type: "list", defaultPageSize:
|
|
841
|
+
output: { type: "list", defaultPageSize: chunk5H5J5AKU_cjs.DEFAULT_PAGE_SIZE },
|
|
842
842
|
run: async ({ imports, input }) => {
|
|
843
843
|
const api = imports.api;
|
|
844
844
|
const searchParams = {};
|
|
@@ -903,7 +903,7 @@ var ExecutionSummarySchema = zod.z.object({
|
|
|
903
903
|
id: zod.z.string().describe("Execution ID (UUID)"),
|
|
904
904
|
name: zod.z.string().describe("Durable function name"),
|
|
905
905
|
status: ExecutionStatusSchema,
|
|
906
|
-
input: zod.z.unknown().describe("Input passed when the execution was created"),
|
|
906
|
+
input: zod.z.unknown().optional().describe("Input passed when the execution was created"),
|
|
907
907
|
output: zod.z.unknown().optional().describe("Return value when status is `completed`"),
|
|
908
908
|
error: zod.z.unknown().optional().describe("Error details when status is `failed`"),
|
|
909
909
|
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe(
|
|
@@ -936,8 +936,8 @@ var GetDurableRunOptionsSchema = zod.z.object({
|
|
|
936
936
|
var GetDurableRunResponseSchema = zod.z.object({
|
|
937
937
|
id: zod.z.string().describe("Run ID (UUID)"),
|
|
938
938
|
status: RunStatusSchema,
|
|
939
|
-
input: zod.z.unknown().describe("Input data passed to the run"),
|
|
940
|
-
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
939
|
+
input: zod.z.unknown().optional().describe("Input data passed to the run"),
|
|
940
|
+
output: zod.z.unknown().nullable().optional().describe("Return value, present when status is `finished`"),
|
|
941
941
|
error: RunErrorSchema.nullable().describe(
|
|
942
942
|
"Structured error details when the run failed (null otherwise)"
|
|
943
943
|
),
|
|
@@ -959,13 +959,13 @@ var GetDurableRunResponseSchema = zod.z.object({
|
|
|
959
959
|
var getDurableRunPlugin = kitcore.defineMethod({
|
|
960
960
|
...codeSubstrateDefaults,
|
|
961
961
|
name: "getDurableRun",
|
|
962
|
-
imports: [
|
|
962
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
963
963
|
itemType: "DurableRun",
|
|
964
964
|
inputSchema: GetDurableRunOptionsSchema,
|
|
965
965
|
outputSchema: GetDurableRunResponseSchema,
|
|
966
966
|
skipOutputValidation: true,
|
|
967
967
|
output: "item",
|
|
968
|
-
resolvers: { run:
|
|
968
|
+
resolvers: { run: chunk5H5J5AKU_cjs.durableRunIdResolver },
|
|
969
969
|
run: async ({ imports, input }) => {
|
|
970
970
|
const api = imports.api;
|
|
971
971
|
const raw = await api.get(
|
|
@@ -1063,7 +1063,7 @@ var sourceFilesResolver = kitcore.defineResolver({
|
|
|
1063
1063
|
var runDurablePlugin = kitcore.defineMethod({
|
|
1064
1064
|
...codeSubstrateDefaults,
|
|
1065
1065
|
name: "runDurable",
|
|
1066
|
-
imports: [
|
|
1066
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1067
1067
|
type: "create",
|
|
1068
1068
|
itemType: "DurableRun",
|
|
1069
1069
|
inputSchema: RunDurableOptionsSchema,
|
|
@@ -1120,14 +1120,14 @@ var CancelDurableRunResponseSchema = zod.z.object({
|
|
|
1120
1120
|
var cancelDurableRunPlugin = kitcore.defineMethod({
|
|
1121
1121
|
...codeSubstrateDefaults,
|
|
1122
1122
|
name: "cancelDurableRun",
|
|
1123
|
-
imports: [
|
|
1123
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1124
1124
|
type: "update",
|
|
1125
1125
|
itemType: "DurableRun",
|
|
1126
1126
|
inputSchema: CancelDurableRunOptionsSchema,
|
|
1127
1127
|
outputSchema: CancelDurableRunResponseSchema,
|
|
1128
1128
|
skipOutputValidation: true,
|
|
1129
1129
|
output: "item",
|
|
1130
|
-
resolvers: { run:
|
|
1130
|
+
resolvers: { run: chunk5H5J5AKU_cjs.durableRunIdResolver },
|
|
1131
1131
|
run: async ({ imports, input }) => {
|
|
1132
1132
|
const api = imports.api;
|
|
1133
1133
|
await api.post(
|
|
@@ -1242,14 +1242,14 @@ function describeOpenDraft(draft) {
|
|
|
1242
1242
|
var publishWorkflowVersionPlugin = kitcore.defineMethod({
|
|
1243
1243
|
...codeSubstrateDefaults,
|
|
1244
1244
|
name: "publishWorkflowVersion",
|
|
1245
|
-
imports: [
|
|
1245
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1246
1246
|
type: "create",
|
|
1247
1247
|
itemType: "WorkflowVersion",
|
|
1248
1248
|
inputSchema: PublishWorkflowVersionOptionsSchema,
|
|
1249
1249
|
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
1250
1250
|
skipOutputValidation: true,
|
|
1251
1251
|
output: "item",
|
|
1252
|
-
resolvers: { workflow:
|
|
1252
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver, sourceFiles: sourceFilesResolver },
|
|
1253
1253
|
run: async ({ imports, input }) => {
|
|
1254
1254
|
const api = imports.api;
|
|
1255
1255
|
const sourceFiles = "sourceFiles" in input ? input.sourceFiles : input.source_files;
|
|
@@ -1303,13 +1303,13 @@ var publishWorkflowVersionPlugin = kitcore.defineMethod({
|
|
|
1303
1303
|
if (status !== 409) return void 0;
|
|
1304
1304
|
const conflict = extractOpenDraftConflict(data);
|
|
1305
1305
|
if (!conflict) {
|
|
1306
|
-
return new
|
|
1307
|
-
|
|
1306
|
+
return new chunk5H5J5AKU_cjs.ZapierConflictError(
|
|
1307
|
+
chunk5H5J5AKU_cjs.extractErrorDetail(data) ?? "Workflow version publish conflict.",
|
|
1308
1308
|
{ statusCode: status, resourceType: "workflow" }
|
|
1309
1309
|
);
|
|
1310
1310
|
}
|
|
1311
1311
|
const detail = conflict.detail ?? "Cannot publish over open draft(s).";
|
|
1312
|
-
return new
|
|
1312
|
+
return new chunk5H5J5AKU_cjs.ZapierConflictError(
|
|
1313
1313
|
[
|
|
1314
1314
|
`${detail} Blocking draft(s):`,
|
|
1315
1315
|
...conflict.openDrafts.map(describeOpenDraft),
|
|
@@ -1365,7 +1365,7 @@ var ListWorkflowVersionsApiResponseSchema = zod.z.object({
|
|
|
1365
1365
|
var listWorkflowVersionsPlugin = kitcore.defineMethod({
|
|
1366
1366
|
...codeSubstrateDefaults,
|
|
1367
1367
|
name: "listWorkflowVersions",
|
|
1368
|
-
imports: [
|
|
1368
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1369
1369
|
type: "list",
|
|
1370
1370
|
itemType: "WorkflowVersion",
|
|
1371
1371
|
inputSchema: ListWorkflowVersionsOptionsSchema,
|
|
@@ -1373,8 +1373,8 @@ var listWorkflowVersionsPlugin = kitcore.defineMethod({
|
|
|
1373
1373
|
skipOutputValidation: true,
|
|
1374
1374
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1375
1375
|
// standard list output (no `adaptPage`) applies.
|
|
1376
|
-
output: { type: "list", defaultPageSize:
|
|
1377
|
-
resolvers: { workflow:
|
|
1376
|
+
output: { type: "list", defaultPageSize: chunk5H5J5AKU_cjs.DEFAULT_PAGE_SIZE },
|
|
1377
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
1378
1378
|
run: async ({ imports, input }) => {
|
|
1379
1379
|
const api = imports.api;
|
|
1380
1380
|
const searchParams = {};
|
|
@@ -1409,15 +1409,15 @@ var GetWorkflowVersionResponseSchema = WorkflowVersionSchema;
|
|
|
1409
1409
|
var getWorkflowVersionPlugin = kitcore.defineMethod({
|
|
1410
1410
|
...codeSubstrateDefaults,
|
|
1411
1411
|
name: "getWorkflowVersion",
|
|
1412
|
-
imports: [
|
|
1412
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1413
1413
|
itemType: "WorkflowVersion",
|
|
1414
1414
|
inputSchema: GetWorkflowVersionOptionsSchema,
|
|
1415
1415
|
outputSchema: GetWorkflowVersionResponseSchema,
|
|
1416
1416
|
skipOutputValidation: true,
|
|
1417
1417
|
output: "item",
|
|
1418
1418
|
resolvers: {
|
|
1419
|
-
workflow:
|
|
1420
|
-
version:
|
|
1419
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
1420
|
+
version: chunk5H5J5AKU_cjs.workflowVersionIdResolver
|
|
1421
1421
|
},
|
|
1422
1422
|
run: async ({ imports, input }) => {
|
|
1423
1423
|
const api = imports.api;
|
|
@@ -1477,7 +1477,7 @@ var ListWorkflowDraftsApiResponseSchema = zod.z.object({
|
|
|
1477
1477
|
var listWorkflowDraftsPlugin = kitcore.defineMethod({
|
|
1478
1478
|
...codeSubstrateDefaults,
|
|
1479
1479
|
name: "listWorkflowDrafts",
|
|
1480
|
-
imports: [
|
|
1480
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1481
1481
|
type: "list",
|
|
1482
1482
|
itemType: "WorkflowDraft",
|
|
1483
1483
|
inputSchema: ListWorkflowDraftsOptionsSchema,
|
|
@@ -1485,8 +1485,8 @@ var listWorkflowDraftsPlugin = kitcore.defineMethod({
|
|
|
1485
1485
|
skipOutputValidation: true,
|
|
1486
1486
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1487
1487
|
// standard list output (no `adaptPage`) applies.
|
|
1488
|
-
output: { type: "list", defaultPageSize:
|
|
1489
|
-
resolvers: { workflow:
|
|
1488
|
+
output: { type: "list", defaultPageSize: chunk5H5J5AKU_cjs.DEFAULT_PAGE_SIZE },
|
|
1489
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
1490
1490
|
run: async ({ imports, input }) => {
|
|
1491
1491
|
const api = imports.api;
|
|
1492
1492
|
const searchParams = {};
|
|
@@ -1527,15 +1527,15 @@ var GetWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1527
1527
|
var getWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1528
1528
|
...codeSubstrateDefaults,
|
|
1529
1529
|
name: "getWorkflowDraft",
|
|
1530
|
-
imports: [
|
|
1530
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1531
1531
|
itemType: "WorkflowDraft",
|
|
1532
1532
|
inputSchema: GetWorkflowDraftOptionsSchema,
|
|
1533
1533
|
outputSchema: GetWorkflowDraftResponseSchema,
|
|
1534
1534
|
skipOutputValidation: true,
|
|
1535
1535
|
output: "item",
|
|
1536
1536
|
resolvers: {
|
|
1537
|
-
workflow:
|
|
1538
|
-
draft:
|
|
1537
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
1538
|
+
draft: chunk5H5J5AKU_cjs.workflowDraftIdResolver
|
|
1539
1539
|
},
|
|
1540
1540
|
run: async ({ imports, input }) => {
|
|
1541
1541
|
const api = imports.api;
|
|
@@ -1564,14 +1564,14 @@ var CreateWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1564
1564
|
var createWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1565
1565
|
...codeSubstrateDefaults,
|
|
1566
1566
|
name: "createWorkflowDraft",
|
|
1567
|
-
imports: [
|
|
1567
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1568
1568
|
type: "create",
|
|
1569
1569
|
itemType: "WorkflowDraft",
|
|
1570
1570
|
inputSchema: CreateWorkflowDraftOptionsSchema,
|
|
1571
1571
|
outputSchema: CreateWorkflowDraftResponseSchema,
|
|
1572
1572
|
skipOutputValidation: true,
|
|
1573
1573
|
output: "item",
|
|
1574
|
-
resolvers: { workflow:
|
|
1574
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
1575
1575
|
run: async ({ imports, input }) => {
|
|
1576
1576
|
const api = imports.api;
|
|
1577
1577
|
const body = {};
|
|
@@ -1629,7 +1629,7 @@ var UpdateWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1629
1629
|
var updateWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1630
1630
|
...codeSubstrateDefaults,
|
|
1631
1631
|
name: "updateWorkflowDraft",
|
|
1632
|
-
imports: [
|
|
1632
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1633
1633
|
type: "update",
|
|
1634
1634
|
itemType: "WorkflowDraft",
|
|
1635
1635
|
inputSchema: UpdateWorkflowDraftOptionsSchema,
|
|
@@ -1637,8 +1637,8 @@ var updateWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1637
1637
|
skipOutputValidation: true,
|
|
1638
1638
|
output: "item",
|
|
1639
1639
|
resolvers: {
|
|
1640
|
-
workflow:
|
|
1641
|
-
draft:
|
|
1640
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
1641
|
+
draft: chunk5H5J5AKU_cjs.workflowDraftIdResolver,
|
|
1642
1642
|
sourceFiles: sourceFilesResolver
|
|
1643
1643
|
},
|
|
1644
1644
|
run: async ({ imports, input }) => {
|
|
@@ -1687,8 +1687,8 @@ var updateWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1687
1687
|
// re-read the draft, and retry instead of blind-overwriting.
|
|
1688
1688
|
customErrorHandler: ({ status, data }) => {
|
|
1689
1689
|
if (status === 409) {
|
|
1690
|
-
const detail =
|
|
1691
|
-
return new
|
|
1690
|
+
const detail = chunk5H5J5AKU_cjs.extractErrorDetail(data);
|
|
1691
|
+
return new chunk5H5J5AKU_cjs.ZapierConflictError(
|
|
1692
1692
|
`${detail ?? "Draft revision conflict"} \u2014 the draft changed since it was last read. Re-read the draft to get the current draft_revision, merge your edits, and retry.`,
|
|
1693
1693
|
{ statusCode: status, resourceType: "workflow-draft" }
|
|
1694
1694
|
);
|
|
@@ -1712,7 +1712,7 @@ var DiscardWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1712
1712
|
var discardWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1713
1713
|
...codeSubstrateDefaults,
|
|
1714
1714
|
name: "discardWorkflowDraft",
|
|
1715
|
-
imports: [
|
|
1715
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1716
1716
|
type: "delete",
|
|
1717
1717
|
itemType: "WorkflowDraft",
|
|
1718
1718
|
// Soft delete returns the discarded draft, not the `{ success: boolean }`
|
|
@@ -1726,8 +1726,8 @@ var discardWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1726
1726
|
skipOutputValidation: true,
|
|
1727
1727
|
output: "item",
|
|
1728
1728
|
resolvers: {
|
|
1729
|
-
workflow:
|
|
1730
|
-
draft:
|
|
1729
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
1730
|
+
draft: chunk5H5J5AKU_cjs.workflowDraftIdResolver
|
|
1731
1731
|
},
|
|
1732
1732
|
run: async ({ imports, input }) => {
|
|
1733
1733
|
const api = imports.api;
|
|
@@ -1771,7 +1771,7 @@ var PublishWorkflowDraftResponseSchema = zod.z.object({
|
|
|
1771
1771
|
var publishWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1772
1772
|
...codeSubstrateDefaults,
|
|
1773
1773
|
name: "publishWorkflowDraft",
|
|
1774
|
-
imports: [
|
|
1774
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1775
1775
|
type: "create",
|
|
1776
1776
|
itemType: "WorkflowVersion",
|
|
1777
1777
|
// The response is the composite `{ draft, version }`, not the bare
|
|
@@ -1782,8 +1782,8 @@ var publishWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1782
1782
|
skipOutputValidation: true,
|
|
1783
1783
|
output: "item",
|
|
1784
1784
|
resolvers: {
|
|
1785
|
-
workflow:
|
|
1786
|
-
draft:
|
|
1785
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
1786
|
+
draft: chunk5H5J5AKU_cjs.workflowDraftIdResolver
|
|
1787
1787
|
},
|
|
1788
1788
|
run: async ({ imports, input }) => {
|
|
1789
1789
|
const api = imports.api;
|
|
@@ -1820,15 +1820,15 @@ var publishWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1820
1820
|
// to ZapierValidationError via the client's default handling.
|
|
1821
1821
|
customErrorHandler: ({ status, data }) => {
|
|
1822
1822
|
if (status === 409) {
|
|
1823
|
-
const detail =
|
|
1824
|
-
return new
|
|
1823
|
+
const detail = chunk5H5J5AKU_cjs.extractErrorDetail(data);
|
|
1824
|
+
return new chunk5H5J5AKU_cjs.ZapierConflictError(
|
|
1825
1825
|
`${detail ?? "Draft publish conflict"} \u2014 the draft changed since it was last read, or a trigger switchover is already in progress. Re-read the draft to get the current draft_revision, then retry the publish.`,
|
|
1826
1826
|
{ statusCode: status, resourceType: "workflow-draft" }
|
|
1827
1827
|
);
|
|
1828
1828
|
}
|
|
1829
1829
|
if (status === 503) {
|
|
1830
|
-
const detail =
|
|
1831
|
-
return new
|
|
1830
|
+
const detail = chunk5H5J5AKU_cjs.extractErrorDetail(data);
|
|
1831
|
+
return new chunk5H5J5AKU_cjs.ZapierApiError(
|
|
1832
1832
|
detail !== void 0 ? `${detail} \u2014 the trigger config could not be validated against the platform catalog, so the publish was rejected (fail-closed). This is transient; retry the publish.` : "Draft publish temporarily unavailable \u2014 trigger validation is fail-closed, or the service is briefly unavailable. This is transient; retry the publish.",
|
|
1833
1833
|
{ statusCode: status }
|
|
1834
1834
|
);
|
|
@@ -1868,11 +1868,11 @@ async function readRunUntilEnded({
|
|
|
1868
1868
|
latest = await read(requestWaitSeconds);
|
|
1869
1869
|
if (TERMINAL_RUN_STATUSES.has(latest.status)) return latest;
|
|
1870
1870
|
} catch (error) {
|
|
1871
|
-
if (!pendingWhileNotFound || !
|
|
1871
|
+
if (!pendingWhileNotFound || !chunk5H5J5AKU_cjs.isZapierNotFoundError(error)) throw error;
|
|
1872
1872
|
notFound = error;
|
|
1873
1873
|
}
|
|
1874
1874
|
if (Date.now() - askedAt < requestWaitSeconds * 1e3 / 2) {
|
|
1875
|
-
await
|
|
1875
|
+
await chunk5H5J5AKU_cjs.sleep(Math.min(backoffMilliseconds, deadline - Date.now()));
|
|
1876
1876
|
backoffMilliseconds = Math.min(
|
|
1877
1877
|
backoffMilliseconds * 2,
|
|
1878
1878
|
MAX_BACKOFF_MILLISECONDS
|
|
@@ -1894,8 +1894,8 @@ var workflowRunListItemBase = zod.z.object({
|
|
|
1894
1894
|
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
1895
1895
|
),
|
|
1896
1896
|
status: WorkflowRunStatusSchema,
|
|
1897
|
-
input: zod.z.unknown().describe("Input passed to the run"),
|
|
1898
|
-
error: zod.z.unknown().nullable().describe("Error payload when status is `failed` (null otherwise)"),
|
|
1897
|
+
input: zod.z.unknown().optional().describe("Input passed to the run"),
|
|
1898
|
+
error: zod.z.unknown().nullable().optional().describe("Error payload when status is `failed` (null otherwise)"),
|
|
1899
1899
|
created_at: zod.z.string().describe("When the run was created (ISO-8601)"),
|
|
1900
1900
|
updated_at: zod.z.string().describe("When the run was last updated (ISO-8601)")
|
|
1901
1901
|
});
|
|
@@ -1961,9 +1961,9 @@ var workflowRunBase = zod.z.object({
|
|
|
1961
1961
|
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
1962
1962
|
),
|
|
1963
1963
|
status: WorkflowRunStatusSchema,
|
|
1964
|
-
input: zod.z.unknown().describe("Input passed to the run"),
|
|
1965
|
-
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
1966
|
-
error: zod.z.unknown().nullable().describe("Error payload when status is `failed` (null otherwise)"),
|
|
1964
|
+
input: zod.z.unknown().optional().describe("Input passed to the run"),
|
|
1965
|
+
output: zod.z.unknown().nullable().optional().describe("Return value, present when status is `finished`"),
|
|
1966
|
+
error: zod.z.unknown().nullable().optional().describe("Error payload when status is `failed` (null otherwise)"),
|
|
1967
1967
|
created_at: zod.z.string().describe("When the run was created (ISO-8601)"),
|
|
1968
1968
|
updated_at: zod.z.string().describe("When the run was last updated (ISO-8601)")
|
|
1969
1969
|
});
|
|
@@ -1992,15 +1992,15 @@ var GetWorkflowRunResponseSchema = zod.z.discriminatedUnion("kind", [
|
|
|
1992
1992
|
var getWorkflowRunPlugin = kitcore.defineMethod({
|
|
1993
1993
|
...codeSubstrateDefaults,
|
|
1994
1994
|
name: "getWorkflowRun",
|
|
1995
|
-
imports: [
|
|
1995
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
1996
1996
|
itemType: "WorkflowRun",
|
|
1997
1997
|
inputSchema: GetWorkflowRunOptionsSchema,
|
|
1998
1998
|
outputSchema: GetWorkflowRunResponseSchema,
|
|
1999
1999
|
skipOutputValidation: true,
|
|
2000
2000
|
output: "item",
|
|
2001
2001
|
resolvers: {
|
|
2002
|
-
workflow:
|
|
2003
|
-
run:
|
|
2002
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
2003
|
+
run: chunk5H5J5AKU_cjs.workflowRunIdResolver
|
|
2004
2004
|
},
|
|
2005
2005
|
run: async ({ imports, input }) => {
|
|
2006
2006
|
const api = imports.api;
|
|
@@ -2047,9 +2047,9 @@ var RunWorkflowDraftResponseSchema = zod.z.object({
|
|
|
2047
2047
|
),
|
|
2048
2048
|
draft_revision: zod.z.number().int().describe("The draft's revision at the moment this run was created."),
|
|
2049
2049
|
status: WorkflowRunStatusSchema,
|
|
2050
|
-
input: zod.z.unknown().describe("Input passed to the run"),
|
|
2051
|
-
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
2052
|
-
error: zod.z.unknown().nullable().describe("Error payload when status is `failed` (null otherwise)"),
|
|
2050
|
+
input: zod.z.unknown().optional().describe("Input passed to the run"),
|
|
2051
|
+
output: zod.z.unknown().nullable().optional().describe("Return value, present when status is `finished`"),
|
|
2052
|
+
error: zod.z.unknown().nullable().optional().describe("Error payload when status is `failed` (null otherwise)"),
|
|
2053
2053
|
created_at: zod.z.string().describe("When the run was created (ISO-8601)"),
|
|
2054
2054
|
updated_at: zod.z.string().describe("When the run was last updated (ISO-8601)")
|
|
2055
2055
|
});
|
|
@@ -2058,7 +2058,7 @@ var RunWorkflowDraftResponseSchema = zod.z.object({
|
|
|
2058
2058
|
var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
2059
2059
|
...codeSubstrateDefaults,
|
|
2060
2060
|
name: "runWorkflowDraft",
|
|
2061
|
-
imports: [
|
|
2061
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef, getWorkflowRunPlugin],
|
|
2062
2062
|
type: "create",
|
|
2063
2063
|
itemType: "WorkflowRun",
|
|
2064
2064
|
// The response is the draft variant of the run resource (`kind: "draft"`,
|
|
@@ -2070,9 +2070,9 @@ var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
2070
2070
|
skipOutputValidation: true,
|
|
2071
2071
|
output: "item",
|
|
2072
2072
|
resolvers: {
|
|
2073
|
-
workflow:
|
|
2074
|
-
draft:
|
|
2075
|
-
draftRevision:
|
|
2073
|
+
workflow: chunk5H5J5AKU_cjs.workflowIdResolver,
|
|
2074
|
+
draft: chunk5H5J5AKU_cjs.workflowDraftIdResolver,
|
|
2075
|
+
draftRevision: chunk5H5J5AKU_cjs.workflowDraftRevisionResolver
|
|
2076
2076
|
},
|
|
2077
2077
|
run: async ({ imports, input }) => {
|
|
2078
2078
|
const api = imports.api;
|
|
@@ -2094,8 +2094,8 @@ var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
2094
2094
|
// retries with backoff and then throws ZapierRateLimitError.
|
|
2095
2095
|
customErrorHandler: ({ status, data }) => {
|
|
2096
2096
|
if (status === 409) {
|
|
2097
|
-
const detail =
|
|
2098
|
-
return new
|
|
2097
|
+
const detail = chunk5H5J5AKU_cjs.extractErrorDetail(data);
|
|
2098
|
+
return new chunk5H5J5AKU_cjs.ZapierConflictError(
|
|
2099
2099
|
`${detail ?? "Draft run conflict"} \u2014 the draft changed since it was last read. Re-read the draft to get the current draft_revision, then retry the run.`,
|
|
2100
2100
|
{ statusCode: status, resourceType: "workflow-draft" }
|
|
2101
2101
|
);
|
|
@@ -2116,7 +2116,7 @@ var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
2116
2116
|
var listWorkflowRunsPlugin = kitcore.defineMethod({
|
|
2117
2117
|
...codeSubstrateDefaults,
|
|
2118
2118
|
name: "listWorkflowRuns",
|
|
2119
|
-
imports: [
|
|
2119
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
2120
2120
|
type: "list",
|
|
2121
2121
|
itemType: "WorkflowRun",
|
|
2122
2122
|
inputSchema: ListWorkflowRunsOptionsSchema,
|
|
@@ -2124,8 +2124,8 @@ var listWorkflowRunsPlugin = kitcore.defineMethod({
|
|
|
2124
2124
|
skipOutputValidation: true,
|
|
2125
2125
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
2126
2126
|
// standard list output (no `adaptPage`) applies.
|
|
2127
|
-
output: { type: "list", defaultPageSize:
|
|
2128
|
-
resolvers: { workflow:
|
|
2127
|
+
output: { type: "list", defaultPageSize: chunk5H5J5AKU_cjs.DEFAULT_PAGE_SIZE },
|
|
2128
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
2129
2129
|
run: async ({ imports, input }) => {
|
|
2130
2130
|
const api = imports.api;
|
|
2131
2131
|
const searchParams = {};
|
|
@@ -2166,9 +2166,9 @@ var GetTriggerRunResponseSchema = zod.z.object({
|
|
|
2166
2166
|
),
|
|
2167
2167
|
workflow_version_id: zod.z.string().nullable().describe("Workflow version the run is bound to"),
|
|
2168
2168
|
status: WorkflowRunStatusSchema,
|
|
2169
|
-
input: zod.z.unknown().describe("Input passed to the run"),
|
|
2170
|
-
output: zod.z.unknown().nullable().describe("Return value, present when status is `finished`"),
|
|
2171
|
-
error: zod.z.unknown().nullable().describe("Error payload when status is `failed` (null otherwise)"),
|
|
2169
|
+
input: zod.z.unknown().optional().describe("Input passed to the run"),
|
|
2170
|
+
output: zod.z.unknown().nullable().optional().describe("Return value, present when status is `finished`"),
|
|
2171
|
+
error: zod.z.unknown().nullable().optional().describe("Error payload when status is `failed` (null otherwise)"),
|
|
2172
2172
|
created_at: zod.z.string().describe("When the run was created (ISO-8601)"),
|
|
2173
2173
|
updated_at: zod.z.string().describe("When the run was last updated (ISO-8601)")
|
|
2174
2174
|
});
|
|
@@ -2177,7 +2177,7 @@ var GetTriggerRunResponseSchema = zod.z.object({
|
|
|
2177
2177
|
var getTriggerRunPlugin = kitcore.defineMethod({
|
|
2178
2178
|
...codeSubstrateDefaults,
|
|
2179
2179
|
name: "getTriggerRun",
|
|
2180
|
-
imports: [
|
|
2180
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
2181
2181
|
itemType: "WorkflowRun",
|
|
2182
2182
|
inputSchema: GetTriggerRunOptionsSchema,
|
|
2183
2183
|
outputSchema: GetTriggerRunResponseSchema,
|
|
@@ -2229,14 +2229,14 @@ var TriggerWorkflowResponseSchema = zod.z.object({
|
|
|
2229
2229
|
var triggerWorkflowPlugin = kitcore.defineMethod({
|
|
2230
2230
|
...codeSubstrateDefaults,
|
|
2231
2231
|
name: "triggerWorkflow",
|
|
2232
|
-
imports: [
|
|
2232
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
2233
2233
|
type: "create",
|
|
2234
2234
|
itemType: "WorkflowRun",
|
|
2235
2235
|
inputSchema: TriggerWorkflowOptionsSchema,
|
|
2236
2236
|
outputSchema: TriggerWorkflowResponseSchema,
|
|
2237
2237
|
skipOutputValidation: true,
|
|
2238
2238
|
output: "item",
|
|
2239
|
-
resolvers: { workflow:
|
|
2239
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
2240
2240
|
run: async ({ imports, input }) => {
|
|
2241
2241
|
const api = imports.api;
|
|
2242
2242
|
const rawWorkflow = await api.get(
|
|
@@ -2250,7 +2250,7 @@ var triggerWorkflowPlugin = kitcore.defineMethod({
|
|
|
2250
2250
|
const segments = new URL(workflow.trigger_url).pathname.split("/");
|
|
2251
2251
|
const triggerToken = segments[segments.length - 1];
|
|
2252
2252
|
if (!triggerToken) {
|
|
2253
|
-
throw new
|
|
2253
|
+
throw new chunk5H5J5AKU_cjs.ZapierApiError(
|
|
2254
2254
|
`Workflow ${input.workflow} returned a malformed trigger_url`,
|
|
2255
2255
|
{ statusCode: 0, response: workflow.trigger_url }
|
|
2256
2256
|
);
|
|
@@ -2293,7 +2293,7 @@ var runWorkflowPlugin = kitcore.defineMethod({
|
|
|
2293
2293
|
outputSchema: RunWorkflowResponseSchema,
|
|
2294
2294
|
skipOutputValidation: true,
|
|
2295
2295
|
output: "item",
|
|
2296
|
-
resolvers: { workflow:
|
|
2296
|
+
resolvers: { workflow: chunk5H5J5AKU_cjs.workflowIdResolver },
|
|
2297
2297
|
run: async ({ imports, input }) => {
|
|
2298
2298
|
const { data: trigger } = await imports.triggerWorkflow({
|
|
2299
2299
|
workflow: input.workflow,
|
|
@@ -2307,8 +2307,8 @@ var runWorkflowPlugin = kitcore.defineMethod({
|
|
|
2307
2307
|
});
|
|
2308
2308
|
return { data: { ...run, trigger_id: trigger.id } };
|
|
2309
2309
|
} catch (error) {
|
|
2310
|
-
if (!
|
|
2311
|
-
throw new
|
|
2310
|
+
if (!chunk5H5J5AKU_cjs.isZapierNotFoundError(error)) throw error;
|
|
2311
|
+
throw new chunk5H5J5AKU_cjs.ZapierTimeoutError(
|
|
2312
2312
|
`The run for trigger ${trigger.id} had not started after ${waitSeconds}s. Check it later with getTriggerRun.`,
|
|
2313
2313
|
{ cause: error }
|
|
2314
2314
|
);
|
|
@@ -2317,7 +2317,10 @@ var runWorkflowPlugin = kitcore.defineMethod({
|
|
|
2317
2317
|
});
|
|
2318
2318
|
var MAX_SOURCE_FILES_COUNT = 50;
|
|
2319
2319
|
var MAX_SOURCE_FILE_LENGTH = 2e5;
|
|
2320
|
+
var MAX_TRIGGER_CONFIGURATIONS_COUNT = 20;
|
|
2321
|
+
var MAX_CONNECTIONS_COUNT = 100;
|
|
2320
2322
|
var DEFAULT_ENTRYPOINT_FILE = "/workflow.ts";
|
|
2323
|
+
var TRIGGER_NODE_ID_PATTERN = /^workflow-trigger-[0-9]+$/;
|
|
2321
2324
|
var EXAMPLE_SOURCE_FILES = {
|
|
2322
2325
|
[DEFAULT_ENTRYPOINT_FILE]: 'import { defineDurable } from "@zapier/zapier-durable"; export default defineDurable({ name: "hello-world", run: async (ctx) => { return ctx.step("greet", async () => "Hello, world!"); } });'
|
|
2323
2326
|
};
|
|
@@ -2329,10 +2332,65 @@ var WorkflowValidationSourceFilesSchema = zod.z.record(
|
|
|
2329
2332
|
}).refine((files) => Object.keys(files).length <= MAX_SOURCE_FILES_COUNT, {
|
|
2330
2333
|
message: `sourceFiles must contain at most ${MAX_SOURCE_FILES_COUNT} files`
|
|
2331
2334
|
}).describe("Exact TypeScript sources keyed by absolute logical path.").meta({ example: EXAMPLE_SOURCE_FILES });
|
|
2335
|
+
var WorkflowCheckGroupSchema = zod.z.enum(["source", "access"]).describe(
|
|
2336
|
+
"`source` runs checks that read only the request. `access` looks up the app, action, connection, and trigger references against Zapier and the caller's account."
|
|
2337
|
+
);
|
|
2338
|
+
var WorkflowIssueSeveritySchema = zod.z.enum(["error", "warning", "info", "hint"]).describe("Diagnostic severity.");
|
|
2339
|
+
var WorkflowValidationTriggerSchema = zod.z.object({
|
|
2340
|
+
selectedApi: zod.z.string().optional().describe(
|
|
2341
|
+
"Zapier implementation id the trigger is published with, e.g. `ScheduleCLIAPI@1.6.0`. Checked for a version pin and, with `action`, that the trigger exists."
|
|
2342
|
+
),
|
|
2343
|
+
app: zod.z.string().optional().describe("Key of the app the trigger belongs to."),
|
|
2344
|
+
appTitle: zod.z.string().optional().describe("Display name of the app the trigger belongs to."),
|
|
2345
|
+
action: zod.z.string().optional().describe("Trigger action key on the app."),
|
|
2346
|
+
actionTitle: zod.z.string().optional().describe("Display name of the trigger action."),
|
|
2347
|
+
params: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe(
|
|
2348
|
+
"Trigger settings keyed by field key. When set, checked against the trigger's fields."
|
|
2349
|
+
)
|
|
2350
|
+
}).describe("Trigger configuration for one trigger node.");
|
|
2332
2351
|
var ValidateWorkflowOptionsSchema = zod.z.object({
|
|
2333
2352
|
sourceFiles: WorkflowValidationSourceFilesSchema,
|
|
2334
2353
|
entrypointFile: zod.z.string().regex(/^\//, "entrypointFile must start with /").optional().describe(
|
|
2335
2354
|
"Absolute logical path of the entry file in sourceFiles. Defaults to /workflow.ts."
|
|
2355
|
+
),
|
|
2356
|
+
zapierDurableVersion: zod.z.string().min(1).optional().describe(
|
|
2357
|
+
'Version of @zapier/zapier-durable the workflow will run on, e.g. "1.2.3". Version checks are skipped when omitted or "latest".'
|
|
2358
|
+
),
|
|
2359
|
+
dependencies: zod.z.record(zod.z.string(), zod.z.string()).optional().describe(
|
|
2360
|
+
"npm package dependencies keyed by package name. Dependency checks are skipped when omitted."
|
|
2361
|
+
),
|
|
2362
|
+
checkGroups: zod.z.array(WorkflowCheckGroupSchema).min(1).refine((groups) => new Set(groups).size === groups.length, {
|
|
2363
|
+
message: "checkGroups must not repeat a group"
|
|
2364
|
+
}).optional().describe(
|
|
2365
|
+
"Check groups to run. Runs every group when omitted. Pass only `source` to skip the account lookups, e.g. while code is being edited."
|
|
2366
|
+
),
|
|
2367
|
+
severity: WorkflowIssueSeveritySchema.optional().describe(
|
|
2368
|
+
"Return only issues with exactly this severity, and skip checks that only report other severities. Returns every issue when omitted."
|
|
2369
|
+
),
|
|
2370
|
+
triggerConfigurations: zod.z.record(zod.z.string(), WorkflowValidationTriggerSchema).superRefine((triggers, ctx) => {
|
|
2371
|
+
for (const key of Object.keys(triggers)) {
|
|
2372
|
+
if (!TRIGGER_NODE_ID_PATTERN.test(key)) {
|
|
2373
|
+
ctx.addIssue({
|
|
2374
|
+
code: "custom",
|
|
2375
|
+
message: `triggerConfigurations keys must be trigger node ids like workflow-trigger-0; got '${key}'`
|
|
2376
|
+
});
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}).refine(
|
|
2380
|
+
(triggers) => Object.keys(triggers).length <= MAX_TRIGGER_CONFIGURATIONS_COUNT,
|
|
2381
|
+
{
|
|
2382
|
+
message: `triggerConfigurations must contain at most ${MAX_TRIGGER_CONFIGURATIONS_COUNT} triggers`
|
|
2383
|
+
}
|
|
2384
|
+
).optional().describe(
|
|
2385
|
+
'Trigger configurations keyed by trigger node id (`workflow-trigger-{i}`). The trigger isn\'t in the source, so it\'s only checked when sent, e.g. `{ "workflow-trigger-0": { "selectedApi": "ScheduleCLIAPI@1.6.0", "action": "everyDay" } }`.'
|
|
2386
|
+
),
|
|
2387
|
+
connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).refine(
|
|
2388
|
+
(connections) => Object.keys(connections).length <= MAX_CONNECTIONS_COUNT,
|
|
2389
|
+
{
|
|
2390
|
+
message: `connections must contain at most ${MAX_CONNECTIONS_COUNT} aliases`
|
|
2391
|
+
}
|
|
2392
|
+
).optional().describe(
|
|
2393
|
+
'Named connection aliases the source uses. Maps each alias to its Zapier connection ID, e.g. `{ "slack": { "connectionId": 123 } }`. Aliases are only checked when sent.'
|
|
2336
2394
|
)
|
|
2337
2395
|
}).refine(
|
|
2338
2396
|
({ sourceFiles, entrypointFile }) => (entrypointFile ?? DEFAULT_ENTRYPOINT_FILE) in sourceFiles,
|
|
@@ -2355,11 +2413,29 @@ var WorkflowValidationIssueSchema = zod.z.object({
|
|
|
2355
2413
|
"Extensible diagnostic category; clients must accept unfamiliar values."
|
|
2356
2414
|
),
|
|
2357
2415
|
message: zod.z.string().describe("Safe human-readable explanation."),
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
severity:
|
|
2416
|
+
title: zod.z.string().optional().describe(
|
|
2417
|
+
"Short label for the issue, safe to show in place of `message` where space is short. Omitted for kinds with no title yet; fall back to `message`."
|
|
2418
|
+
),
|
|
2419
|
+
severity: WorkflowIssueSeveritySchema,
|
|
2362
2420
|
suggestion: zod.z.string().optional().describe("Actionable fix hint."),
|
|
2421
|
+
fix: zod.z.string().optional().describe(
|
|
2422
|
+
"Extensible: what resolves the issue. Known values are `agent` (change the source), `upgrade` (change the account's plan) and `retry` (a lookup failed; validate again). Omitted or unknown means `agent`."
|
|
2423
|
+
),
|
|
2424
|
+
incomplete: zod.z.boolean().optional().describe(
|
|
2425
|
+
"`true` when the issue means the workflow isn't finished yet rather than wrong, e.g. no steps yet. Still blocks publish."
|
|
2426
|
+
),
|
|
2427
|
+
app_key: zod.z.string().optional().describe(
|
|
2428
|
+
"Implementation id of the app the issue is about, e.g. `SlackCLIAPI`. Set on `admin-restricted-app`."
|
|
2429
|
+
),
|
|
2430
|
+
connection_id: zod.z.string().optional().describe(
|
|
2431
|
+
"Zapier connection id the issue is about, as a string. Set on connection issues."
|
|
2432
|
+
),
|
|
2433
|
+
connection_alias: zod.z.string().optional().describe(
|
|
2434
|
+
"Connection alias the source used, a key of the request's `connections`. Set on connection issues when the source named the connection by alias."
|
|
2435
|
+
),
|
|
2436
|
+
unchecked_kind: zod.z.string().optional().describe(
|
|
2437
|
+
"On `check-unavailable`, the issue kind whose check couldn't run because a lookup failed. Validating again retries it."
|
|
2438
|
+
),
|
|
2363
2439
|
source: WorkflowValidationSourceLocationSchema.optional().describe(
|
|
2364
2440
|
"Affected source location."
|
|
2365
2441
|
),
|
|
@@ -2368,6 +2444,19 @@ var WorkflowValidationIssueSchema = zod.z.object({
|
|
|
2368
2444
|
),
|
|
2369
2445
|
syntax_kind: zod.z.string().optional().describe(
|
|
2370
2446
|
"TypeScript AST node kind the diagnostic was raised against (e.g. `CallExpression`)."
|
|
2447
|
+
),
|
|
2448
|
+
state_path: zod.z.string().optional().describe("Workflow state path the issue is about."),
|
|
2449
|
+
projection_node_id: zod.z.string().optional().describe(
|
|
2450
|
+
"Diagram node the issue is about. Validation sets it only on trigger issues, to the trigger node id (`workflow-trigger-{i}`)."
|
|
2451
|
+
),
|
|
2452
|
+
configuration_id: zod.z.string().optional().describe(
|
|
2453
|
+
"Canonical configuration reference. Validation currently leaves it unset."
|
|
2454
|
+
),
|
|
2455
|
+
operation_id: zod.z.string().optional().describe(
|
|
2456
|
+
"Canonical operation that owns the issue, when unambiguous. Match against diagram nodes' `operation_ids` for the same source."
|
|
2457
|
+
),
|
|
2458
|
+
region_id: zod.z.string().optional().describe(
|
|
2459
|
+
"Immediate canonical parent region of the owning operation. May have no visible container in the diagram."
|
|
2371
2460
|
)
|
|
2372
2461
|
});
|
|
2373
2462
|
var ValidateWorkflowResponseSchema = zod.z.object({
|
|
@@ -2375,10 +2464,28 @@ var ValidateWorkflowResponseSchema = zod.z.object({
|
|
|
2375
2464
|
});
|
|
2376
2465
|
|
|
2377
2466
|
// src/plugins/codeSubstrate/validateWorkflow/index.ts
|
|
2467
|
+
function toWireTriggerConfigurations(triggers) {
|
|
2468
|
+
return Object.fromEntries(
|
|
2469
|
+
Object.entries(triggers).map(([nodeId, trigger]) => {
|
|
2470
|
+
const wire = {};
|
|
2471
|
+
if (trigger.selectedApi !== void 0) {
|
|
2472
|
+
wire.selected_api = trigger.selectedApi;
|
|
2473
|
+
}
|
|
2474
|
+
if (trigger.app !== void 0) wire.app_key = trigger.app;
|
|
2475
|
+
if (trigger.appTitle !== void 0) wire.app_title = trigger.appTitle;
|
|
2476
|
+
if (trigger.action !== void 0) wire.action_key = trigger.action;
|
|
2477
|
+
if (trigger.actionTitle !== void 0) {
|
|
2478
|
+
wire.action_title = trigger.actionTitle;
|
|
2479
|
+
}
|
|
2480
|
+
if (trigger.params !== void 0) wire.params = trigger.params;
|
|
2481
|
+
return [nodeId, wire];
|
|
2482
|
+
})
|
|
2483
|
+
);
|
|
2484
|
+
}
|
|
2378
2485
|
var validateWorkflowPlugin = kitcore.defineMethod({
|
|
2379
2486
|
...codeSubstrateDefaults,
|
|
2380
2487
|
name: "validateWorkflow",
|
|
2381
|
-
imports: [
|
|
2488
|
+
imports: [chunk5H5J5AKU_cjs.apiPluginRef],
|
|
2382
2489
|
itemType: "WorkflowValidation",
|
|
2383
2490
|
inputSchema: ValidateWorkflowOptionsSchema,
|
|
2384
2491
|
outputSchema: ValidateWorkflowResponseSchema,
|
|
@@ -2392,10 +2499,31 @@ var validateWorkflowPlugin = kitcore.defineMethod({
|
|
|
2392
2499
|
if (input.entrypointFile !== void 0) {
|
|
2393
2500
|
body.entrypoint_file = input.entrypointFile;
|
|
2394
2501
|
}
|
|
2502
|
+
if (input.zapierDurableVersion !== void 0) {
|
|
2503
|
+
body.zapier_durable_version = input.zapierDurableVersion;
|
|
2504
|
+
}
|
|
2505
|
+
if (input.dependencies !== void 0) {
|
|
2506
|
+
body.dependencies = input.dependencies;
|
|
2507
|
+
}
|
|
2508
|
+
if (input.checkGroups !== void 0) {
|
|
2509
|
+
body.check_groups = input.checkGroups;
|
|
2510
|
+
}
|
|
2511
|
+
if (input.triggerConfigurations !== void 0) {
|
|
2512
|
+
body.trigger_configurations = toWireTriggerConfigurations(
|
|
2513
|
+
input.triggerConfigurations
|
|
2514
|
+
);
|
|
2515
|
+
}
|
|
2516
|
+
if (input.connections !== void 0) {
|
|
2517
|
+
body.connections = toWireConnections(input.connections);
|
|
2518
|
+
}
|
|
2395
2519
|
const raw = await imports.api.post(
|
|
2396
2520
|
`${CODE_SUBSTRATE_ANALYZER_API}/validations`,
|
|
2397
2521
|
body,
|
|
2398
|
-
{
|
|
2522
|
+
{
|
|
2523
|
+
authRequired: true,
|
|
2524
|
+
// The analyzer rejects `severity` in the body; it is a query parameter.
|
|
2525
|
+
...input.severity === void 0 ? {} : { searchParams: { severity: input.severity } }
|
|
2526
|
+
}
|
|
2399
2527
|
);
|
|
2400
2528
|
return { data: ValidateWorkflowResponseSchema.parse(raw) };
|
|
2401
2529
|
}
|
|
@@ -2406,7 +2534,7 @@ var zapierBetaSdkPlugin = kitcore.definePlugin({
|
|
|
2406
2534
|
namespace: "zapier",
|
|
2407
2535
|
name: "beta-sdk",
|
|
2408
2536
|
exports: [
|
|
2409
|
-
|
|
2537
|
+
chunk5H5J5AKU_cjs.zapierSdkPlugin,
|
|
2410
2538
|
// Next Gen Zaps (workflows, drafts, runs). `list*` plugins are exported
|
|
2411
2539
|
// before their `get*` / mutation siblings because per-row resolvers
|
|
2412
2540
|
// reach the listing methods.
|
|
@@ -2443,8 +2571,8 @@ var zapierBetaSdkPlugin = kitcore.definePlugin({
|
|
|
2443
2571
|
function createZapierSdk(options = {}) {
|
|
2444
2572
|
return kitcore.createSdk(zapierBetaSdkPlugin, {
|
|
2445
2573
|
configuration: {
|
|
2446
|
-
[
|
|
2447
|
-
[kitcore.CORE_OPTIONS_ID]:
|
|
2574
|
+
[chunk5H5J5AKU_cjs.SDK_OPTIONS_ID]: options,
|
|
2575
|
+
[kitcore.CORE_OPTIONS_ID]: chunk5H5J5AKU_cjs.zapierCoreOptions
|
|
2448
2576
|
}
|
|
2449
2577
|
});
|
|
2450
2578
|
}
|