@zapier/zapier-sdk 0.119.5 → 0.119.6
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 +6 -0
- package/dist/beta.cjs +287 -287
- package/dist/beta.d.mts +17 -17
- package/dist/beta.d.ts +17 -17
- package/dist/beta.mjs +2 -2
- package/dist/{chunk-YIHKNF7S.mjs → chunk-2XVA36IO.mjs} +1 -1
- package/dist/{chunk-I6SF4BKR.cjs → chunk-5FVYDLIN.cjs} +88 -88
- package/dist/{chunk-YZMIF24O.mjs → chunk-CQ3C7UWQ.mjs} +22 -5
- package/dist/{chunk-6LPWOY7I.cjs → chunk-FXUI47PZ.cjs} +22 -5
- package/dist/experimental.cjs +318 -318
- package/dist/experimental.d.mts +17 -17
- package/dist/experimental.d.ts +17 -17
- package/dist/experimental.mjs +4 -4
- package/dist/{index-DR_2xqqX.d.mts → index-CThNTXl2.d.mts} +18 -18
- package/dist/{index-DR_2xqqX.d.ts → index-CThNTXl2.d.ts} +18 -18
- 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 +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFXUI47PZ_cjs = require('./chunk-FXUI47PZ.cjs');
|
|
4
4
|
var kitcore = require('@zapier/kitcore');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var codeSubstrateDefaults = {
|
|
8
|
-
categories: [
|
|
8
|
+
categories: [chunkFXUI47PZ_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: chunkFXUI47PZ_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 chunkFXUI47PZ_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 chunkFXUI47PZ_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 chunkFXUI47PZ_cjs.ZapierValidationError(
|
|
114
114
|
`appVersions["${key}"] is missing implementationName`
|
|
115
115
|
);
|
|
116
116
|
}
|
|
@@ -319,7 +319,7 @@ var ListWorkflowsApiResponseSchema = zod.z.object({
|
|
|
319
319
|
var listWorkflowsPlugin = kitcore.defineMethod({
|
|
320
320
|
...codeSubstrateDefaults,
|
|
321
321
|
name: "listWorkflows",
|
|
322
|
-
imports: [
|
|
322
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
323
323
|
type: "list",
|
|
324
324
|
itemType: "Workflow",
|
|
325
325
|
inputSchema: ListWorkflowsOptionsSchema,
|
|
@@ -327,7 +327,7 @@ var listWorkflowsPlugin = kitcore.defineMethod({
|
|
|
327
327
|
skipOutputValidation: true,
|
|
328
328
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
329
329
|
// standard list output (no `adaptPage`) applies.
|
|
330
|
-
output: { type: "list", defaultPageSize:
|
|
330
|
+
output: { type: "list", defaultPageSize: chunkFXUI47PZ_cjs.DEFAULT_PAGE_SIZE },
|
|
331
331
|
run: async ({ imports, input }) => {
|
|
332
332
|
const api = imports.api;
|
|
333
333
|
const searchParams = {};
|
|
@@ -404,13 +404,13 @@ var GetWorkflowResponseSchema = zod.z.object({
|
|
|
404
404
|
var getWorkflowPlugin = kitcore.defineMethod({
|
|
405
405
|
...codeSubstrateDefaults,
|
|
406
406
|
name: "getWorkflow",
|
|
407
|
-
imports: [
|
|
407
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
408
408
|
itemType: "Workflow",
|
|
409
409
|
inputSchema: GetWorkflowOptionsSchema,
|
|
410
410
|
outputSchema: GetWorkflowResponseSchema,
|
|
411
411
|
skipOutputValidation: true,
|
|
412
412
|
output: "item",
|
|
413
|
-
resolvers: { workflow:
|
|
413
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
414
414
|
run: async ({ imports, input }) => {
|
|
415
415
|
const api = imports.api;
|
|
416
416
|
const raw = await api.get(
|
|
@@ -458,7 +458,7 @@ var CreateWorkflowResponseSchema = zod.z.object({
|
|
|
458
458
|
var createWorkflowPlugin = kitcore.defineMethod({
|
|
459
459
|
...codeSubstrateDefaults,
|
|
460
460
|
name: "createWorkflow",
|
|
461
|
-
imports: [
|
|
461
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
462
462
|
type: "create",
|
|
463
463
|
itemType: "Workflow",
|
|
464
464
|
inputSchema: CreateWorkflowOptionsSchema,
|
|
@@ -554,7 +554,7 @@ var ImportWorkflowResponseSchema = zod.z.object({
|
|
|
554
554
|
var importWorkflowPlugin = kitcore.defineMethod({
|
|
555
555
|
...codeSubstrateDefaults,
|
|
556
556
|
name: "importWorkflow",
|
|
557
|
-
imports: [
|
|
557
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
558
558
|
type: "create",
|
|
559
559
|
itemType: "Workflow",
|
|
560
560
|
// The response is the composite `{ workflow, draft, issues }`, not the bare
|
|
@@ -586,8 +586,8 @@ var importWorkflowPlugin = kitcore.defineMethod({
|
|
|
586
586
|
// and add only what a caller can't infer from a bare 403.
|
|
587
587
|
customErrorHandler: ({ status, data }) => {
|
|
588
588
|
if (status === 403) {
|
|
589
|
-
const detail =
|
|
590
|
-
return new
|
|
589
|
+
const detail = chunkFXUI47PZ_cjs.extractErrorDetail(data)?.replace(/[.!?]+$/, "");
|
|
590
|
+
return new chunkFXUI47PZ_cjs.ZapierApiError(
|
|
591
591
|
`${detail || "Zap import forbidden"}. Retrying will not help.`,
|
|
592
592
|
{ statusCode: status }
|
|
593
593
|
);
|
|
@@ -625,14 +625,14 @@ var UpdateWorkflowResponseSchema = zod.z.object({
|
|
|
625
625
|
var updateWorkflowPlugin = kitcore.defineMethod({
|
|
626
626
|
...codeSubstrateDefaults,
|
|
627
627
|
name: "updateWorkflow",
|
|
628
|
-
imports: [
|
|
628
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
629
629
|
type: "update",
|
|
630
630
|
itemType: "Workflow",
|
|
631
631
|
inputSchema: UpdateWorkflowOptionsSchema,
|
|
632
632
|
outputSchema: UpdateWorkflowResponseSchema,
|
|
633
633
|
skipOutputValidation: true,
|
|
634
634
|
output: "item",
|
|
635
|
-
resolvers: { workflow:
|
|
635
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
636
636
|
run: async ({ imports, input }) => {
|
|
637
637
|
const api = imports.api;
|
|
638
638
|
const body = {};
|
|
@@ -665,14 +665,14 @@ var EnableWorkflowResponseSchema = zod.z.object({
|
|
|
665
665
|
var enableWorkflowPlugin = kitcore.defineMethod({
|
|
666
666
|
...codeSubstrateDefaults,
|
|
667
667
|
name: "enableWorkflow",
|
|
668
|
-
imports: [
|
|
668
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
669
669
|
type: "update",
|
|
670
670
|
itemType: "Workflow",
|
|
671
671
|
inputSchema: EnableWorkflowOptionsSchema,
|
|
672
672
|
outputSchema: EnableWorkflowResponseSchema,
|
|
673
673
|
skipOutputValidation: true,
|
|
674
674
|
output: "item",
|
|
675
|
-
resolvers: { workflow:
|
|
675
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
676
676
|
run: async ({ imports, input }) => {
|
|
677
677
|
const api = imports.api;
|
|
678
678
|
const raw = await api.post(
|
|
@@ -700,14 +700,14 @@ var DisableWorkflowResponseSchema = zod.z.object({
|
|
|
700
700
|
var disableWorkflowPlugin = kitcore.defineMethod({
|
|
701
701
|
...codeSubstrateDefaults,
|
|
702
702
|
name: "disableWorkflow",
|
|
703
|
-
imports: [
|
|
703
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
704
704
|
type: "update",
|
|
705
705
|
itemType: "Workflow",
|
|
706
706
|
inputSchema: DisableWorkflowOptionsSchema,
|
|
707
707
|
outputSchema: DisableWorkflowResponseSchema,
|
|
708
708
|
skipOutputValidation: true,
|
|
709
709
|
output: "item",
|
|
710
|
-
resolvers: { workflow:
|
|
710
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
711
711
|
run: async ({ imports, input }) => {
|
|
712
712
|
const api = imports.api;
|
|
713
713
|
const raw = await api.post(
|
|
@@ -734,7 +734,7 @@ var DeleteWorkflowResponseSchema = zod.z.object({
|
|
|
734
734
|
var deleteWorkflowPlugin = kitcore.defineMethod({
|
|
735
735
|
...codeSubstrateDefaults,
|
|
736
736
|
name: "deleteWorkflow",
|
|
737
|
-
imports: [
|
|
737
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
738
738
|
type: "delete",
|
|
739
739
|
itemType: "Workflow",
|
|
740
740
|
confirm: "delete",
|
|
@@ -742,7 +742,7 @@ var deleteWorkflowPlugin = kitcore.defineMethod({
|
|
|
742
742
|
outputSchema: DeleteWorkflowResponseSchema,
|
|
743
743
|
skipOutputValidation: true,
|
|
744
744
|
output: "raw",
|
|
745
|
-
resolvers: { workflow:
|
|
745
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
746
746
|
run: async ({ imports, input }) => {
|
|
747
747
|
const api = imports.api;
|
|
748
748
|
await api.delete(
|
|
@@ -806,7 +806,7 @@ var ListDurableRunsApiResponseSchema = zod.z.object({
|
|
|
806
806
|
var listDurableRunsPlugin = kitcore.defineMethod({
|
|
807
807
|
...codeSubstrateDefaults,
|
|
808
808
|
name: "listDurableRuns",
|
|
809
|
-
imports: [
|
|
809
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
810
810
|
type: "list",
|
|
811
811
|
itemType: "DurableRun",
|
|
812
812
|
inputSchema: ListDurableRunsOptionsSchema,
|
|
@@ -814,7 +814,7 @@ var listDurableRunsPlugin = kitcore.defineMethod({
|
|
|
814
814
|
skipOutputValidation: true,
|
|
815
815
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
816
816
|
// standard list output (no `adaptPage`) applies.
|
|
817
|
-
output: { type: "list", defaultPageSize:
|
|
817
|
+
output: { type: "list", defaultPageSize: chunkFXUI47PZ_cjs.DEFAULT_PAGE_SIZE },
|
|
818
818
|
run: async ({ imports, input }) => {
|
|
819
819
|
const api = imports.api;
|
|
820
820
|
const searchParams = {};
|
|
@@ -931,13 +931,13 @@ var GetDurableRunResponseSchema = zod.z.object({
|
|
|
931
931
|
var getDurableRunPlugin = kitcore.defineMethod({
|
|
932
932
|
...codeSubstrateDefaults,
|
|
933
933
|
name: "getDurableRun",
|
|
934
|
-
imports: [
|
|
934
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
935
935
|
itemType: "DurableRun",
|
|
936
936
|
inputSchema: GetDurableRunOptionsSchema,
|
|
937
937
|
outputSchema: GetDurableRunResponseSchema,
|
|
938
938
|
skipOutputValidation: true,
|
|
939
939
|
output: "item",
|
|
940
|
-
resolvers: { run:
|
|
940
|
+
resolvers: { run: chunkFXUI47PZ_cjs.durableRunIdResolver },
|
|
941
941
|
run: async ({ imports, input }) => {
|
|
942
942
|
const api = imports.api;
|
|
943
943
|
const raw = await api.get(
|
|
@@ -1031,7 +1031,7 @@ var sourceFilesResolver = kitcore.defineResolver({
|
|
|
1031
1031
|
var runDurablePlugin = kitcore.defineMethod({
|
|
1032
1032
|
...codeSubstrateDefaults,
|
|
1033
1033
|
name: "runDurable",
|
|
1034
|
-
imports: [
|
|
1034
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1035
1035
|
type: "create",
|
|
1036
1036
|
itemType: "DurableRun",
|
|
1037
1037
|
inputSchema: RunDurableOptionsSchema,
|
|
@@ -1088,14 +1088,14 @@ var CancelDurableRunResponseSchema = zod.z.object({
|
|
|
1088
1088
|
var cancelDurableRunPlugin = kitcore.defineMethod({
|
|
1089
1089
|
...codeSubstrateDefaults,
|
|
1090
1090
|
name: "cancelDurableRun",
|
|
1091
|
-
imports: [
|
|
1091
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1092
1092
|
type: "update",
|
|
1093
1093
|
itemType: "DurableRun",
|
|
1094
1094
|
inputSchema: CancelDurableRunOptionsSchema,
|
|
1095
1095
|
outputSchema: CancelDurableRunResponseSchema,
|
|
1096
1096
|
skipOutputValidation: true,
|
|
1097
1097
|
output: "item",
|
|
1098
|
-
resolvers: { run:
|
|
1098
|
+
resolvers: { run: chunkFXUI47PZ_cjs.durableRunIdResolver },
|
|
1099
1099
|
run: async ({ imports, input }) => {
|
|
1100
1100
|
const api = imports.api;
|
|
1101
1101
|
await api.post(
|
|
@@ -1210,14 +1210,14 @@ function describeOpenDraft(draft) {
|
|
|
1210
1210
|
var publishWorkflowVersionPlugin = kitcore.defineMethod({
|
|
1211
1211
|
...codeSubstrateDefaults,
|
|
1212
1212
|
name: "publishWorkflowVersion",
|
|
1213
|
-
imports: [
|
|
1213
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1214
1214
|
type: "create",
|
|
1215
1215
|
itemType: "WorkflowVersion",
|
|
1216
1216
|
inputSchema: PublishWorkflowVersionOptionsSchema,
|
|
1217
1217
|
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
1218
1218
|
skipOutputValidation: true,
|
|
1219
1219
|
output: "item",
|
|
1220
|
-
resolvers: { workflow:
|
|
1220
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver, sourceFiles: sourceFilesResolver },
|
|
1221
1221
|
run: async ({ imports, input }) => {
|
|
1222
1222
|
const api = imports.api;
|
|
1223
1223
|
const sourceFiles = "sourceFiles" in input ? input.sourceFiles : input.source_files;
|
|
@@ -1271,13 +1271,13 @@ var publishWorkflowVersionPlugin = kitcore.defineMethod({
|
|
|
1271
1271
|
if (status !== 409) return void 0;
|
|
1272
1272
|
const conflict = extractOpenDraftConflict(data);
|
|
1273
1273
|
if (!conflict) {
|
|
1274
|
-
return new
|
|
1275
|
-
|
|
1274
|
+
return new chunkFXUI47PZ_cjs.ZapierConflictError(
|
|
1275
|
+
chunkFXUI47PZ_cjs.extractErrorDetail(data) ?? "Workflow version publish conflict.",
|
|
1276
1276
|
{ statusCode: status, resourceType: "workflow" }
|
|
1277
1277
|
);
|
|
1278
1278
|
}
|
|
1279
1279
|
const detail = conflict.detail ?? "Cannot publish over open draft(s).";
|
|
1280
|
-
return new
|
|
1280
|
+
return new chunkFXUI47PZ_cjs.ZapierConflictError(
|
|
1281
1281
|
[
|
|
1282
1282
|
`${detail} Blocking draft(s):`,
|
|
1283
1283
|
...conflict.openDrafts.map(describeOpenDraft),
|
|
@@ -1333,7 +1333,7 @@ var ListWorkflowVersionsApiResponseSchema = zod.z.object({
|
|
|
1333
1333
|
var listWorkflowVersionsPlugin = kitcore.defineMethod({
|
|
1334
1334
|
...codeSubstrateDefaults,
|
|
1335
1335
|
name: "listWorkflowVersions",
|
|
1336
|
-
imports: [
|
|
1336
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1337
1337
|
type: "list",
|
|
1338
1338
|
itemType: "WorkflowVersion",
|
|
1339
1339
|
inputSchema: ListWorkflowVersionsOptionsSchema,
|
|
@@ -1341,8 +1341,8 @@ var listWorkflowVersionsPlugin = kitcore.defineMethod({
|
|
|
1341
1341
|
skipOutputValidation: true,
|
|
1342
1342
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1343
1343
|
// standard list output (no `adaptPage`) applies.
|
|
1344
|
-
output: { type: "list", defaultPageSize:
|
|
1345
|
-
resolvers: { workflow:
|
|
1344
|
+
output: { type: "list", defaultPageSize: chunkFXUI47PZ_cjs.DEFAULT_PAGE_SIZE },
|
|
1345
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
1346
1346
|
run: async ({ imports, input }) => {
|
|
1347
1347
|
const api = imports.api;
|
|
1348
1348
|
const searchParams = {};
|
|
@@ -1377,15 +1377,15 @@ var GetWorkflowVersionResponseSchema = WorkflowVersionSchema;
|
|
|
1377
1377
|
var getWorkflowVersionPlugin = kitcore.defineMethod({
|
|
1378
1378
|
...codeSubstrateDefaults,
|
|
1379
1379
|
name: "getWorkflowVersion",
|
|
1380
|
-
imports: [
|
|
1380
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1381
1381
|
itemType: "WorkflowVersion",
|
|
1382
1382
|
inputSchema: GetWorkflowVersionOptionsSchema,
|
|
1383
1383
|
outputSchema: GetWorkflowVersionResponseSchema,
|
|
1384
1384
|
skipOutputValidation: true,
|
|
1385
1385
|
output: "item",
|
|
1386
1386
|
resolvers: {
|
|
1387
|
-
workflow:
|
|
1388
|
-
version:
|
|
1387
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
1388
|
+
version: chunkFXUI47PZ_cjs.workflowVersionIdResolver
|
|
1389
1389
|
},
|
|
1390
1390
|
run: async ({ imports, input }) => {
|
|
1391
1391
|
const api = imports.api;
|
|
@@ -1445,7 +1445,7 @@ var ListWorkflowDraftsApiResponseSchema = zod.z.object({
|
|
|
1445
1445
|
var listWorkflowDraftsPlugin = kitcore.defineMethod({
|
|
1446
1446
|
...codeSubstrateDefaults,
|
|
1447
1447
|
name: "listWorkflowDrafts",
|
|
1448
|
-
imports: [
|
|
1448
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1449
1449
|
type: "list",
|
|
1450
1450
|
itemType: "WorkflowDraft",
|
|
1451
1451
|
inputSchema: ListWorkflowDraftsOptionsSchema,
|
|
@@ -1453,8 +1453,8 @@ var listWorkflowDraftsPlugin = kitcore.defineMethod({
|
|
|
1453
1453
|
skipOutputValidation: true,
|
|
1454
1454
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
1455
1455
|
// standard list output (no `adaptPage`) applies.
|
|
1456
|
-
output: { type: "list", defaultPageSize:
|
|
1457
|
-
resolvers: { workflow:
|
|
1456
|
+
output: { type: "list", defaultPageSize: chunkFXUI47PZ_cjs.DEFAULT_PAGE_SIZE },
|
|
1457
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
1458
1458
|
run: async ({ imports, input }) => {
|
|
1459
1459
|
const api = imports.api;
|
|
1460
1460
|
const searchParams = {};
|
|
@@ -1495,15 +1495,15 @@ var GetWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1495
1495
|
var getWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1496
1496
|
...codeSubstrateDefaults,
|
|
1497
1497
|
name: "getWorkflowDraft",
|
|
1498
|
-
imports: [
|
|
1498
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1499
1499
|
itemType: "WorkflowDraft",
|
|
1500
1500
|
inputSchema: GetWorkflowDraftOptionsSchema,
|
|
1501
1501
|
outputSchema: GetWorkflowDraftResponseSchema,
|
|
1502
1502
|
skipOutputValidation: true,
|
|
1503
1503
|
output: "item",
|
|
1504
1504
|
resolvers: {
|
|
1505
|
-
workflow:
|
|
1506
|
-
draft:
|
|
1505
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
1506
|
+
draft: chunkFXUI47PZ_cjs.workflowDraftIdResolver
|
|
1507
1507
|
},
|
|
1508
1508
|
run: async ({ imports, input }) => {
|
|
1509
1509
|
const api = imports.api;
|
|
@@ -1532,14 +1532,14 @@ var CreateWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1532
1532
|
var createWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1533
1533
|
...codeSubstrateDefaults,
|
|
1534
1534
|
name: "createWorkflowDraft",
|
|
1535
|
-
imports: [
|
|
1535
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1536
1536
|
type: "create",
|
|
1537
1537
|
itemType: "WorkflowDraft",
|
|
1538
1538
|
inputSchema: CreateWorkflowDraftOptionsSchema,
|
|
1539
1539
|
outputSchema: CreateWorkflowDraftResponseSchema,
|
|
1540
1540
|
skipOutputValidation: true,
|
|
1541
1541
|
output: "item",
|
|
1542
|
-
resolvers: { workflow:
|
|
1542
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
1543
1543
|
run: async ({ imports, input }) => {
|
|
1544
1544
|
const api = imports.api;
|
|
1545
1545
|
const body = {};
|
|
@@ -1597,7 +1597,7 @@ var UpdateWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1597
1597
|
var updateWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1598
1598
|
...codeSubstrateDefaults,
|
|
1599
1599
|
name: "updateWorkflowDraft",
|
|
1600
|
-
imports: [
|
|
1600
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1601
1601
|
type: "update",
|
|
1602
1602
|
itemType: "WorkflowDraft",
|
|
1603
1603
|
inputSchema: UpdateWorkflowDraftOptionsSchema,
|
|
@@ -1605,8 +1605,8 @@ var updateWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1605
1605
|
skipOutputValidation: true,
|
|
1606
1606
|
output: "item",
|
|
1607
1607
|
resolvers: {
|
|
1608
|
-
workflow:
|
|
1609
|
-
draft:
|
|
1608
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
1609
|
+
draft: chunkFXUI47PZ_cjs.workflowDraftIdResolver,
|
|
1610
1610
|
sourceFiles: sourceFilesResolver
|
|
1611
1611
|
},
|
|
1612
1612
|
run: async ({ imports, input }) => {
|
|
@@ -1655,8 +1655,8 @@ var updateWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1655
1655
|
// re-read the draft, and retry instead of blind-overwriting.
|
|
1656
1656
|
customErrorHandler: ({ status, data }) => {
|
|
1657
1657
|
if (status === 409) {
|
|
1658
|
-
const detail =
|
|
1659
|
-
return new
|
|
1658
|
+
const detail = chunkFXUI47PZ_cjs.extractErrorDetail(data);
|
|
1659
|
+
return new chunkFXUI47PZ_cjs.ZapierConflictError(
|
|
1660
1660
|
`${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.`,
|
|
1661
1661
|
{ statusCode: status, resourceType: "workflow-draft" }
|
|
1662
1662
|
);
|
|
@@ -1680,7 +1680,7 @@ var DiscardWorkflowDraftResponseSchema = WorkflowDraftSchema;
|
|
|
1680
1680
|
var discardWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1681
1681
|
...codeSubstrateDefaults,
|
|
1682
1682
|
name: "discardWorkflowDraft",
|
|
1683
|
-
imports: [
|
|
1683
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1684
1684
|
type: "delete",
|
|
1685
1685
|
itemType: "WorkflowDraft",
|
|
1686
1686
|
// Soft delete returns the discarded draft, not the `{ success: boolean }`
|
|
@@ -1694,8 +1694,8 @@ var discardWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1694
1694
|
skipOutputValidation: true,
|
|
1695
1695
|
output: "item",
|
|
1696
1696
|
resolvers: {
|
|
1697
|
-
workflow:
|
|
1698
|
-
draft:
|
|
1697
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
1698
|
+
draft: chunkFXUI47PZ_cjs.workflowDraftIdResolver
|
|
1699
1699
|
},
|
|
1700
1700
|
run: async ({ imports, input }) => {
|
|
1701
1701
|
const api = imports.api;
|
|
@@ -1739,7 +1739,7 @@ var PublishWorkflowDraftResponseSchema = zod.z.object({
|
|
|
1739
1739
|
var publishWorkflowDraftPlugin = kitcore.defineMethod({
|
|
1740
1740
|
...codeSubstrateDefaults,
|
|
1741
1741
|
name: "publishWorkflowDraft",
|
|
1742
|
-
imports: [
|
|
1742
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1743
1743
|
type: "create",
|
|
1744
1744
|
itemType: "WorkflowVersion",
|
|
1745
1745
|
// The response is the composite `{ draft, version }`, not the bare
|
|
@@ -1750,8 +1750,8 @@ var publishWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1750
1750
|
skipOutputValidation: true,
|
|
1751
1751
|
output: "item",
|
|
1752
1752
|
resolvers: {
|
|
1753
|
-
workflow:
|
|
1754
|
-
draft:
|
|
1753
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
1754
|
+
draft: chunkFXUI47PZ_cjs.workflowDraftIdResolver
|
|
1755
1755
|
},
|
|
1756
1756
|
run: async ({ imports, input }) => {
|
|
1757
1757
|
const api = imports.api;
|
|
@@ -1788,15 +1788,15 @@ var publishWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
1788
1788
|
// to ZapierValidationError via the client's default handling.
|
|
1789
1789
|
customErrorHandler: ({ status, data }) => {
|
|
1790
1790
|
if (status === 409) {
|
|
1791
|
-
const detail =
|
|
1792
|
-
return new
|
|
1791
|
+
const detail = chunkFXUI47PZ_cjs.extractErrorDetail(data);
|
|
1792
|
+
return new chunkFXUI47PZ_cjs.ZapierConflictError(
|
|
1793
1793
|
`${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.`,
|
|
1794
1794
|
{ statusCode: status, resourceType: "workflow-draft" }
|
|
1795
1795
|
);
|
|
1796
1796
|
}
|
|
1797
1797
|
if (status === 503) {
|
|
1798
|
-
const detail =
|
|
1799
|
-
return new
|
|
1798
|
+
const detail = chunkFXUI47PZ_cjs.extractErrorDetail(data);
|
|
1799
|
+
return new chunkFXUI47PZ_cjs.ZapierApiError(
|
|
1800
1800
|
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.",
|
|
1801
1801
|
{ statusCode: status }
|
|
1802
1802
|
);
|
|
@@ -1836,11 +1836,11 @@ async function readRunUntilEnded({
|
|
|
1836
1836
|
latest = await read(requestWaitSeconds);
|
|
1837
1837
|
if (TERMINAL_RUN_STATUSES.has(latest.status)) return latest;
|
|
1838
1838
|
} catch (error) {
|
|
1839
|
-
if (!pendingWhileNotFound || !
|
|
1839
|
+
if (!pendingWhileNotFound || !chunkFXUI47PZ_cjs.isZapierNotFoundError(error)) throw error;
|
|
1840
1840
|
notFound = error;
|
|
1841
1841
|
}
|
|
1842
1842
|
if (Date.now() - askedAt < requestWaitSeconds * 1e3 / 2) {
|
|
1843
|
-
await
|
|
1843
|
+
await chunkFXUI47PZ_cjs.sleep(Math.min(backoffMilliseconds, deadline - Date.now()));
|
|
1844
1844
|
backoffMilliseconds = Math.min(
|
|
1845
1845
|
backoffMilliseconds * 2,
|
|
1846
1846
|
MAX_BACKOFF_MILLISECONDS
|
|
@@ -1960,15 +1960,15 @@ var GetWorkflowRunResponseSchema = zod.z.discriminatedUnion("kind", [
|
|
|
1960
1960
|
var getWorkflowRunPlugin = kitcore.defineMethod({
|
|
1961
1961
|
...codeSubstrateDefaults,
|
|
1962
1962
|
name: "getWorkflowRun",
|
|
1963
|
-
imports: [
|
|
1963
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
1964
1964
|
itemType: "WorkflowRun",
|
|
1965
1965
|
inputSchema: GetWorkflowRunOptionsSchema,
|
|
1966
1966
|
outputSchema: GetWorkflowRunResponseSchema,
|
|
1967
1967
|
skipOutputValidation: true,
|
|
1968
1968
|
output: "item",
|
|
1969
1969
|
resolvers: {
|
|
1970
|
-
workflow:
|
|
1971
|
-
run:
|
|
1970
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
1971
|
+
run: chunkFXUI47PZ_cjs.workflowRunIdResolver
|
|
1972
1972
|
},
|
|
1973
1973
|
run: async ({ imports, input }) => {
|
|
1974
1974
|
const api = imports.api;
|
|
@@ -2026,7 +2026,7 @@ var RunWorkflowDraftResponseSchema = zod.z.object({
|
|
|
2026
2026
|
var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
2027
2027
|
...codeSubstrateDefaults,
|
|
2028
2028
|
name: "runWorkflowDraft",
|
|
2029
|
-
imports: [
|
|
2029
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef, getWorkflowRunPlugin],
|
|
2030
2030
|
type: "create",
|
|
2031
2031
|
itemType: "WorkflowRun",
|
|
2032
2032
|
// The response is the draft variant of the run resource (`kind: "draft"`,
|
|
@@ -2038,9 +2038,9 @@ var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
2038
2038
|
skipOutputValidation: true,
|
|
2039
2039
|
output: "item",
|
|
2040
2040
|
resolvers: {
|
|
2041
|
-
workflow:
|
|
2042
|
-
draft:
|
|
2043
|
-
draftRevision:
|
|
2041
|
+
workflow: chunkFXUI47PZ_cjs.workflowIdResolver,
|
|
2042
|
+
draft: chunkFXUI47PZ_cjs.workflowDraftIdResolver,
|
|
2043
|
+
draftRevision: chunkFXUI47PZ_cjs.workflowDraftRevisionResolver
|
|
2044
2044
|
},
|
|
2045
2045
|
run: async ({ imports, input }) => {
|
|
2046
2046
|
const api = imports.api;
|
|
@@ -2062,8 +2062,8 @@ var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
2062
2062
|
// retries with backoff and then throws ZapierRateLimitError.
|
|
2063
2063
|
customErrorHandler: ({ status, data }) => {
|
|
2064
2064
|
if (status === 409) {
|
|
2065
|
-
const detail =
|
|
2066
|
-
return new
|
|
2065
|
+
const detail = chunkFXUI47PZ_cjs.extractErrorDetail(data);
|
|
2066
|
+
return new chunkFXUI47PZ_cjs.ZapierConflictError(
|
|
2067
2067
|
`${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.`,
|
|
2068
2068
|
{ statusCode: status, resourceType: "workflow-draft" }
|
|
2069
2069
|
);
|
|
@@ -2084,7 +2084,7 @@ var runWorkflowDraftPlugin = kitcore.defineMethod({
|
|
|
2084
2084
|
var listWorkflowRunsPlugin = kitcore.defineMethod({
|
|
2085
2085
|
...codeSubstrateDefaults,
|
|
2086
2086
|
name: "listWorkflowRuns",
|
|
2087
|
-
imports: [
|
|
2087
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
2088
2088
|
type: "list",
|
|
2089
2089
|
itemType: "WorkflowRun",
|
|
2090
2090
|
inputSchema: ListWorkflowRunsOptionsSchema,
|
|
@@ -2092,8 +2092,8 @@ var listWorkflowRunsPlugin = kitcore.defineMethod({
|
|
|
2092
2092
|
skipOutputValidation: true,
|
|
2093
2093
|
// The handler already returns a clean `{ data, nextCursor }` page, so the
|
|
2094
2094
|
// standard list output (no `adaptPage`) applies.
|
|
2095
|
-
output: { type: "list", defaultPageSize:
|
|
2096
|
-
resolvers: { workflow:
|
|
2095
|
+
output: { type: "list", defaultPageSize: chunkFXUI47PZ_cjs.DEFAULT_PAGE_SIZE },
|
|
2096
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
2097
2097
|
run: async ({ imports, input }) => {
|
|
2098
2098
|
const api = imports.api;
|
|
2099
2099
|
const searchParams = {};
|
|
@@ -2145,7 +2145,7 @@ var GetTriggerRunResponseSchema = zod.z.object({
|
|
|
2145
2145
|
var getTriggerRunPlugin = kitcore.defineMethod({
|
|
2146
2146
|
...codeSubstrateDefaults,
|
|
2147
2147
|
name: "getTriggerRun",
|
|
2148
|
-
imports: [
|
|
2148
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
2149
2149
|
itemType: "WorkflowRun",
|
|
2150
2150
|
inputSchema: GetTriggerRunOptionsSchema,
|
|
2151
2151
|
outputSchema: GetTriggerRunResponseSchema,
|
|
@@ -2197,14 +2197,14 @@ var TriggerWorkflowResponseSchema = zod.z.object({
|
|
|
2197
2197
|
var triggerWorkflowPlugin = kitcore.defineMethod({
|
|
2198
2198
|
...codeSubstrateDefaults,
|
|
2199
2199
|
name: "triggerWorkflow",
|
|
2200
|
-
imports: [
|
|
2200
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
2201
2201
|
type: "create",
|
|
2202
2202
|
itemType: "WorkflowRun",
|
|
2203
2203
|
inputSchema: TriggerWorkflowOptionsSchema,
|
|
2204
2204
|
outputSchema: TriggerWorkflowResponseSchema,
|
|
2205
2205
|
skipOutputValidation: true,
|
|
2206
2206
|
output: "item",
|
|
2207
|
-
resolvers: { workflow:
|
|
2207
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
2208
2208
|
run: async ({ imports, input }) => {
|
|
2209
2209
|
const api = imports.api;
|
|
2210
2210
|
const rawWorkflow = await api.get(
|
|
@@ -2218,7 +2218,7 @@ var triggerWorkflowPlugin = kitcore.defineMethod({
|
|
|
2218
2218
|
const segments = new URL(workflow.trigger_url).pathname.split("/");
|
|
2219
2219
|
const triggerToken = segments[segments.length - 1];
|
|
2220
2220
|
if (!triggerToken) {
|
|
2221
|
-
throw new
|
|
2221
|
+
throw new chunkFXUI47PZ_cjs.ZapierApiError(
|
|
2222
2222
|
`Workflow ${input.workflow} returned a malformed trigger_url`,
|
|
2223
2223
|
{ statusCode: 0, response: workflow.trigger_url }
|
|
2224
2224
|
);
|
|
@@ -2261,7 +2261,7 @@ var runWorkflowPlugin = kitcore.defineMethod({
|
|
|
2261
2261
|
outputSchema: RunWorkflowResponseSchema,
|
|
2262
2262
|
skipOutputValidation: true,
|
|
2263
2263
|
output: "item",
|
|
2264
|
-
resolvers: { workflow:
|
|
2264
|
+
resolvers: { workflow: chunkFXUI47PZ_cjs.workflowIdResolver },
|
|
2265
2265
|
run: async ({ imports, input }) => {
|
|
2266
2266
|
const { data: trigger } = await imports.triggerWorkflow({
|
|
2267
2267
|
workflow: input.workflow,
|
|
@@ -2275,8 +2275,8 @@ var runWorkflowPlugin = kitcore.defineMethod({
|
|
|
2275
2275
|
});
|
|
2276
2276
|
return { data: { ...run, trigger_id: trigger.id } };
|
|
2277
2277
|
} catch (error) {
|
|
2278
|
-
if (!
|
|
2279
|
-
throw new
|
|
2278
|
+
if (!chunkFXUI47PZ_cjs.isZapierNotFoundError(error)) throw error;
|
|
2279
|
+
throw new chunkFXUI47PZ_cjs.ZapierTimeoutError(
|
|
2280
2280
|
`The run for trigger ${trigger.id} had not started after ${waitSeconds}s. Check it later with getTriggerRun.`,
|
|
2281
2281
|
{ cause: error }
|
|
2282
2282
|
);
|
|
@@ -2346,7 +2346,7 @@ var ValidateWorkflowResponseSchema = zod.z.object({
|
|
|
2346
2346
|
var validateWorkflowPlugin = kitcore.defineMethod({
|
|
2347
2347
|
...codeSubstrateDefaults,
|
|
2348
2348
|
name: "validateWorkflow",
|
|
2349
|
-
imports: [
|
|
2349
|
+
imports: [chunkFXUI47PZ_cjs.apiPluginRef],
|
|
2350
2350
|
itemType: "WorkflowValidation",
|
|
2351
2351
|
inputSchema: ValidateWorkflowOptionsSchema,
|
|
2352
2352
|
outputSchema: ValidateWorkflowResponseSchema,
|
|
@@ -2374,7 +2374,7 @@ var zapierBetaSdkPlugin = kitcore.definePlugin({
|
|
|
2374
2374
|
namespace: "zapier",
|
|
2375
2375
|
name: "beta-sdk",
|
|
2376
2376
|
exports: [
|
|
2377
|
-
|
|
2377
|
+
chunkFXUI47PZ_cjs.zapierSdkPlugin,
|
|
2378
2378
|
// Next Gen Zaps (workflows, drafts, runs). `list*` plugins are exported
|
|
2379
2379
|
// before their `get*` / mutation siblings because per-row resolvers
|
|
2380
2380
|
// reach the listing methods.
|
|
@@ -2411,8 +2411,8 @@ var zapierBetaSdkPlugin = kitcore.definePlugin({
|
|
|
2411
2411
|
function createZapierSdk(options = {}) {
|
|
2412
2412
|
return kitcore.createSdk(zapierBetaSdkPlugin, {
|
|
2413
2413
|
configuration: {
|
|
2414
|
-
[
|
|
2415
|
-
[kitcore.CORE_OPTIONS_ID]:
|
|
2414
|
+
[chunkFXUI47PZ_cjs.SDK_OPTIONS_ID]: options,
|
|
2415
|
+
[kitcore.CORE_OPTIONS_ID]: chunkFXUI47PZ_cjs.zapierCoreOptions
|
|
2416
2416
|
}
|
|
2417
2417
|
});
|
|
2418
2418
|
}
|