@zapier/zapier-sdk 0.73.0 → 0.73.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +32 -32
- package/dist/experimental.cjs +166 -65
- package/dist/experimental.d.mts +158 -10
- package/dist/experimental.d.ts +158 -10
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.mjs +166 -65
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +42 -3
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +49 -11
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +117 -5
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +77 -14
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts +37 -2
- package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/index.js +10 -9
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +117 -4
- package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/runDurable/schemas.js +38 -37
- package/dist/plugins/codeSubstrate/shared.d.ts +56 -0
- package/dist/plugins/codeSubstrate/shared.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/shared.js +100 -0
- package/package.json +1 -1
package/dist/experimental.mjs
CHANGED
|
@@ -3285,7 +3285,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
|
|
3287
3287
|
// src/sdk-version.ts
|
|
3288
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.
|
|
3288
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
|
|
3289
3289
|
|
|
3290
3290
|
// src/utils/open-url.ts
|
|
3291
3291
|
var nodePrefix = "node:";
|
|
@@ -11754,13 +11754,62 @@ var getTriggerInputFieldsSchemaPlugin = definePlugin(
|
|
|
11754
11754
|
}
|
|
11755
11755
|
})
|
|
11756
11756
|
);
|
|
11757
|
-
|
|
11758
|
-
// src/plugins/codeSubstrate/shared.ts
|
|
11759
11757
|
var codeSubstrateDefaults = {
|
|
11760
11758
|
categories: ["code-workflow"],
|
|
11761
11759
|
experimental: true
|
|
11762
11760
|
};
|
|
11761
|
+
var SourceFilesSchema = z.record(z.string(), z.string()).refine((files) => Object.keys(files).length > 0, {
|
|
11762
|
+
message: "sourceFiles must contain at least one file"
|
|
11763
|
+
}).describe("Source files keyed by filename \u2192 contents");
|
|
11764
|
+
var UUID_PATTERN = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
11765
|
+
var ConnectionIdValueSchema = z.union([
|
|
11766
|
+
z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
|
|
11767
|
+
z.string().regex(UUID_PATTERN, "must be a UUID"),
|
|
11768
|
+
z.number().int().positive()
|
|
11769
|
+
]).describe(
|
|
11770
|
+
"Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."
|
|
11771
|
+
);
|
|
11763
11772
|
var ConnectionBindingSchema = z.object({
|
|
11773
|
+
connectionId: ConnectionIdValueSchema.optional(),
|
|
11774
|
+
/** @deprecated Use `connectionId` instead. */
|
|
11775
|
+
connection_id: ConnectionIdValueSchema.optional().meta({ deprecated: true })
|
|
11776
|
+
});
|
|
11777
|
+
var AppVersionBindingSchema = z.object({
|
|
11778
|
+
implementationName: z.string().min(1).optional().describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
|
|
11779
|
+
/** @deprecated Use `implementationName` instead. */
|
|
11780
|
+
implementation_name: z.string().min(1).optional().meta({ deprecated: true }),
|
|
11781
|
+
version: z.string().optional().describe("Pinned app version (e.g. `1.27.1`). Latest if omitted.")
|
|
11782
|
+
});
|
|
11783
|
+
function toWireConnections(connections) {
|
|
11784
|
+
const wire = {};
|
|
11785
|
+
for (const [alias, entry] of Object.entries(connections)) {
|
|
11786
|
+
const connectionId = entry.connectionId ?? entry.connection_id;
|
|
11787
|
+
if (connectionId === void 0) {
|
|
11788
|
+
throw new ZapierValidationError(
|
|
11789
|
+
`connections["${alias}"] is missing connectionId`
|
|
11790
|
+
);
|
|
11791
|
+
}
|
|
11792
|
+
wire[alias] = { connection_id: connectionId };
|
|
11793
|
+
}
|
|
11794
|
+
return wire;
|
|
11795
|
+
}
|
|
11796
|
+
function toWireAppVersions(appVersions) {
|
|
11797
|
+
const wire = {};
|
|
11798
|
+
for (const [key, entry] of Object.entries(appVersions)) {
|
|
11799
|
+
const implementationName = entry.implementationName ?? entry.implementation_name;
|
|
11800
|
+
if (implementationName === void 0) {
|
|
11801
|
+
throw new ZapierValidationError(
|
|
11802
|
+
`appVersions["${key}"] is missing implementationName`
|
|
11803
|
+
);
|
|
11804
|
+
}
|
|
11805
|
+
wire[key] = {
|
|
11806
|
+
implementation_name: implementationName,
|
|
11807
|
+
...entry.version !== void 0 ? { version: entry.version } : {}
|
|
11808
|
+
};
|
|
11809
|
+
}
|
|
11810
|
+
return wire;
|
|
11811
|
+
}
|
|
11812
|
+
var ConnectionBindingSchema2 = z.object({
|
|
11764
11813
|
connection_id: z.union([
|
|
11765
11814
|
z.number().int().positive(),
|
|
11766
11815
|
z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
|
|
@@ -11771,7 +11820,7 @@ var ConnectionBindingSchema = z.object({
|
|
|
11771
11820
|
}).describe(
|
|
11772
11821
|
"Connection binding: maps a single alias to a concrete connection."
|
|
11773
11822
|
);
|
|
11774
|
-
var
|
|
11823
|
+
var AppVersionBindingSchema2 = z.object({
|
|
11775
11824
|
implementation_name: z.string().describe("App implementation identifier (e.g. 'SlackCLIAPI')"),
|
|
11776
11825
|
version: z.string().optional().describe("App implementation version (e.g. '1.27.1')")
|
|
11777
11826
|
}).describe("App-version binding: maps a single alias to an app version.");
|
|
@@ -11889,8 +11938,8 @@ var WorkflowVersionSchema = z.object({
|
|
|
11889
11938
|
trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
|
|
11890
11939
|
"Trigger configuration persisted on this version, or null for webhook-only workflows."
|
|
11891
11940
|
),
|
|
11892
|
-
connections: z.record(z.string(),
|
|
11893
|
-
app_versions: z.record(z.string(),
|
|
11941
|
+
connections: z.record(z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
|
|
11942
|
+
app_versions: z.record(z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
|
|
11894
11943
|
});
|
|
11895
11944
|
var GetWorkflowOptionsSchema = z.object({
|
|
11896
11945
|
workflow: z.string().uuid().describe("Durable workflow ID")
|
|
@@ -12341,19 +12390,6 @@ var getDurableRunPlugin = definePlugin(
|
|
|
12341
12390
|
}
|
|
12342
12391
|
})
|
|
12343
12392
|
);
|
|
12344
|
-
var ConnectionMapEntrySchema = z.object({
|
|
12345
|
-
connection_id: z.union([
|
|
12346
|
-
z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
|
|
12347
|
-
z.string().uuid("must be a UUID"),
|
|
12348
|
-
z.number().int().positive()
|
|
12349
|
-
]).describe(
|
|
12350
|
-
"Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."
|
|
12351
|
-
)
|
|
12352
|
-
});
|
|
12353
|
-
var AppVersionMapEntrySchema = z.object({
|
|
12354
|
-
implementation_name: z.string().min(1).describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
|
|
12355
|
-
version: z.string().optional().describe("Pinned app version (e.g. `1.27.1`). Latest if omitted.")
|
|
12356
|
-
});
|
|
12357
12393
|
var RunNotificationEventSchema = z.enum(["started", "progress", "completed", "error", "cancelled"]).describe("Run lifecycle event this notification subscribes to");
|
|
12358
12394
|
var RunNotificationSchema = z.object({
|
|
12359
12395
|
type: z.literal("webhook").optional().describe("Notification transport. Webhook is the only supported type."),
|
|
@@ -12367,28 +12403,37 @@ var RunNotificationSchema = z.object({
|
|
|
12367
12403
|
}).describe(
|
|
12368
12404
|
"Webhook subscriber for run lifecycle events. Server POSTs `{run_id, event}` on each subscribed transition."
|
|
12369
12405
|
);
|
|
12370
|
-
var
|
|
12371
|
-
source_files: z.record(z.string(), z.string()).refine((files) => Object.keys(files).length > 0, {
|
|
12372
|
-
message: "source_files must contain at least one file"
|
|
12373
|
-
}).describe("Source files keyed by filename \u2192 contents"),
|
|
12406
|
+
var RunDurableBaseSchema = z.object({
|
|
12374
12407
|
input: z.unknown().optional().describe("Input data passed to the run"),
|
|
12375
12408
|
dependencies: z.record(z.string(), z.string()).optional().describe("Optional npm package dependencies"),
|
|
12376
|
-
|
|
12409
|
+
zapierDurableVersion: z.string().optional().describe(
|
|
12377
12410
|
'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
|
|
12378
12411
|
),
|
|
12379
|
-
|
|
12380
|
-
|
|
12412
|
+
/** @deprecated Use `zapierDurableVersion` instead. */
|
|
12413
|
+
zapier_durable_version: z.string().optional().meta({ deprecated: true }),
|
|
12414
|
+
connections: z.record(z.string(), ConnectionBindingSchema).optional().describe(
|
|
12415
|
+
'Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connectionId": "123" } }`.'
|
|
12381
12416
|
),
|
|
12382
|
-
|
|
12417
|
+
appVersions: z.record(z.string(), AppVersionBindingSchema).optional().describe(
|
|
12383
12418
|
"Pinned app versions. Maps app keys (slugs) to implementation names and versions."
|
|
12384
12419
|
),
|
|
12420
|
+
/** @deprecated Use `appVersions` instead. */
|
|
12421
|
+
app_versions: z.record(z.string(), AppVersionBindingSchema).optional().meta({ deprecated: true }),
|
|
12385
12422
|
private: z.boolean().optional().describe("Only the creating user can see the run (default false)"),
|
|
12386
12423
|
notifications: z.array(RunNotificationSchema).optional().describe(
|
|
12387
12424
|
"Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to."
|
|
12388
12425
|
)
|
|
12389
|
-
})
|
|
12390
|
-
|
|
12391
|
-
)
|
|
12426
|
+
});
|
|
12427
|
+
var RunDurableDescription = "Run a workflow source file as a run-once durable run on sdkdurableapi (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status.";
|
|
12428
|
+
var RunDurableSchema = z.object({ sourceFiles: SourceFilesSchema }).merge(RunDurableBaseSchema).describe(RunDurableDescription).meta({
|
|
12429
|
+
aliases: {
|
|
12430
|
+
source_files: "sourceFiles",
|
|
12431
|
+
zapier_durable_version: "zapierDurableVersion",
|
|
12432
|
+
app_versions: "appVersions"
|
|
12433
|
+
}
|
|
12434
|
+
});
|
|
12435
|
+
var RunDurableSchemaDeprecated = z.object({ source_files: SourceFilesSchema }).merge(RunDurableBaseSchema);
|
|
12436
|
+
var RunDurableOptionsSchema = z.union([RunDurableSchema, RunDurableSchemaDeprecated]).describe(RunDurableDescription);
|
|
12392
12437
|
var RunDurableResponseSchema = z.object({
|
|
12393
12438
|
id: z.string().describe("Run ID (UUID) \u2014 server-generated, time-sortable"),
|
|
12394
12439
|
status: z.literal("initialized").describe(
|
|
@@ -12410,23 +12455,24 @@ var runDurablePlugin = definePlugin(
|
|
|
12410
12455
|
inputSchema: RunDurableOptionsSchema,
|
|
12411
12456
|
outputSchema: RunDurableResponseSchema,
|
|
12412
12457
|
handler: async ({ sdk: sdk2, options }) => {
|
|
12413
|
-
const
|
|
12414
|
-
|
|
12415
|
-
|
|
12458
|
+
const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
|
|
12459
|
+
const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
|
|
12460
|
+
const appVersions = options.appVersions ?? options.app_versions;
|
|
12461
|
+
const body = { source_files: sourceFiles };
|
|
12416
12462
|
if (options.input !== void 0) {
|
|
12417
12463
|
body.input = options.input;
|
|
12418
12464
|
}
|
|
12419
12465
|
if (options.dependencies !== void 0) {
|
|
12420
12466
|
body.dependencies = options.dependencies;
|
|
12421
12467
|
}
|
|
12422
|
-
if (
|
|
12423
|
-
body.zapier_durable_version =
|
|
12468
|
+
if (zapierDurableVersion !== void 0) {
|
|
12469
|
+
body.zapier_durable_version = zapierDurableVersion;
|
|
12424
12470
|
}
|
|
12425
12471
|
if (options.connections !== void 0) {
|
|
12426
|
-
body.connections = options.connections;
|
|
12472
|
+
body.connections = toWireConnections(options.connections);
|
|
12427
12473
|
}
|
|
12428
|
-
if (
|
|
12429
|
-
body.app_versions =
|
|
12474
|
+
if (appVersions !== void 0) {
|
|
12475
|
+
body.app_versions = toWireAppVersions(appVersions);
|
|
12430
12476
|
}
|
|
12431
12477
|
if (options.private !== void 0) {
|
|
12432
12478
|
body.is_private = options.private;
|
|
@@ -12481,30 +12527,61 @@ var cancelDurableRunPlugin = definePlugin(
|
|
|
12481
12527
|
}
|
|
12482
12528
|
})
|
|
12483
12529
|
);
|
|
12484
|
-
var
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12530
|
+
var TriggerConfigSchema = z.object({
|
|
12531
|
+
selectedApi: z.string().optional().describe(
|
|
12532
|
+
"Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured."
|
|
12533
|
+
),
|
|
12534
|
+
/** @deprecated Use `selectedApi` instead. */
|
|
12535
|
+
selected_api: z.string().optional().meta({ deprecated: true }),
|
|
12536
|
+
action: z.string().describe("Trigger action key (e.g. 'new_row')"),
|
|
12537
|
+
authenticationId: z.string().nullish().describe(
|
|
12538
|
+
"Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier)."
|
|
12539
|
+
),
|
|
12540
|
+
/** @deprecated Use `authenticationId` instead. */
|
|
12541
|
+
authentication_id: z.string().nullish().meta({ deprecated: true }),
|
|
12542
|
+
params: z.record(z.string(), z.unknown()).optional().describe("Trigger parameters as a JSON object")
|
|
12543
|
+
}).describe(
|
|
12544
|
+
"Zapier trigger configuration. When set, the workflow subscribes to trigger events."
|
|
12545
|
+
);
|
|
12546
|
+
var PublishWorkflowVersionDescription = "Publish a new version of a durable workflow. Enables the workflow by default.";
|
|
12547
|
+
var PublishWorkflowVersionBaseSchema = z.object({
|
|
12489
12548
|
dependencies: z.record(z.string(), z.string()).optional().describe("Optional npm package dependencies"),
|
|
12490
|
-
|
|
12549
|
+
zapierDurableVersion: z.string().optional().describe(
|
|
12491
12550
|
'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
|
|
12492
12551
|
),
|
|
12552
|
+
/** @deprecated Use `zapierDurableVersion` instead. */
|
|
12553
|
+
zapier_durable_version: z.string().optional().meta({ deprecated: true }),
|
|
12493
12554
|
enabled: z.boolean().optional().describe(
|
|
12494
12555
|
"Enable the workflow after publishing. Defaults to true; pass false to publish without enabling."
|
|
12495
12556
|
),
|
|
12496
12557
|
connections: z.record(z.string(), ConnectionBindingSchema).nullish().describe(
|
|
12497
12558
|
"Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding."
|
|
12498
12559
|
),
|
|
12499
|
-
|
|
12560
|
+
appVersions: z.record(z.string(), AppVersionBindingSchema).nullish().describe(
|
|
12500
12561
|
"Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding."
|
|
12501
12562
|
),
|
|
12502
|
-
|
|
12563
|
+
/** @deprecated Use `appVersions` instead. */
|
|
12564
|
+
app_versions: z.record(z.string(), AppVersionBindingSchema).nullish().meta({ deprecated: true }),
|
|
12565
|
+
trigger: TriggerConfigSchema.optional().describe(
|
|
12503
12566
|
"Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows."
|
|
12504
12567
|
)
|
|
12505
|
-
})
|
|
12506
|
-
|
|
12507
|
-
|
|
12568
|
+
});
|
|
12569
|
+
var WorkflowPropertySchema = z.string().uuid().describe("Durable workflow ID");
|
|
12570
|
+
var PublishWorkflowVersionSchema = z.object({
|
|
12571
|
+
workflow: WorkflowPropertySchema,
|
|
12572
|
+
sourceFiles: SourceFilesSchema
|
|
12573
|
+
}).merge(PublishWorkflowVersionBaseSchema).describe(PublishWorkflowVersionDescription).meta({
|
|
12574
|
+
aliases: {
|
|
12575
|
+
source_files: "sourceFiles",
|
|
12576
|
+
zapier_durable_version: "zapierDurableVersion",
|
|
12577
|
+
app_versions: "appVersions"
|
|
12578
|
+
}
|
|
12579
|
+
});
|
|
12580
|
+
var PublishWorkflowVersionSchemaDeprecated = z.object({
|
|
12581
|
+
workflow: WorkflowPropertySchema,
|
|
12582
|
+
source_files: SourceFilesSchema
|
|
12583
|
+
}).merge(PublishWorkflowVersionBaseSchema);
|
|
12584
|
+
var PublishWorkflowVersionOptionsSchema = z.union([PublishWorkflowVersionSchema, PublishWorkflowVersionSchemaDeprecated]).describe(PublishWorkflowVersionDescription);
|
|
12508
12585
|
var PublishWorkflowVersionResponseSchema = z.object({
|
|
12509
12586
|
id: z.string().describe("Workflow version ID (UUID)"),
|
|
12510
12587
|
workflow_id: z.string().describe("Parent workflow ID (UUID)"),
|
|
@@ -12518,11 +12595,30 @@ var PublishWorkflowVersionResponseSchema = z.object({
|
|
|
12518
12595
|
trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
|
|
12519
12596
|
"Trigger configuration persisted on this version, or null for webhook-only workflows."
|
|
12520
12597
|
),
|
|
12521
|
-
connections: z.record(z.string(),
|
|
12522
|
-
app_versions: z.record(z.string(),
|
|
12598
|
+
connections: z.record(z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
|
|
12599
|
+
app_versions: z.record(z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
|
|
12523
12600
|
});
|
|
12524
12601
|
|
|
12525
12602
|
// src/plugins/codeSubstrate/publishWorkflowVersion/index.ts
|
|
12603
|
+
function toWireTrigger(trigger) {
|
|
12604
|
+
const selectedApi = trigger.selectedApi ?? trigger.selected_api;
|
|
12605
|
+
if (selectedApi === void 0) {
|
|
12606
|
+
throw new ZapierValidationError("trigger is missing selectedApi");
|
|
12607
|
+
}
|
|
12608
|
+
const wire = {
|
|
12609
|
+
selected_api: selectedApi,
|
|
12610
|
+
action: trigger.action
|
|
12611
|
+
};
|
|
12612
|
+
if ("authenticationId" in trigger) {
|
|
12613
|
+
wire.authentication_id = trigger.authenticationId;
|
|
12614
|
+
} else if ("authentication_id" in trigger) {
|
|
12615
|
+
wire.authentication_id = trigger.authentication_id;
|
|
12616
|
+
}
|
|
12617
|
+
if (trigger.params !== void 0) {
|
|
12618
|
+
wire.params = trigger.params;
|
|
12619
|
+
}
|
|
12620
|
+
return wire;
|
|
12621
|
+
}
|
|
12526
12622
|
var publishWorkflowVersionPlugin = definePlugin(
|
|
12527
12623
|
(sdk) => createPluginMethod(sdk, {
|
|
12528
12624
|
...codeSubstrateDefaults,
|
|
@@ -12533,26 +12629,31 @@ var publishWorkflowVersionPlugin = definePlugin(
|
|
|
12533
12629
|
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
12534
12630
|
resolvers: { workflow: workflowIdResolver },
|
|
12535
12631
|
handler: async ({ sdk: sdk2, options }) => {
|
|
12536
|
-
const
|
|
12537
|
-
|
|
12538
|
-
|
|
12632
|
+
const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
|
|
12633
|
+
const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
|
|
12634
|
+
const appVersions = "appVersions" in options ? options.appVersions : options.app_versions;
|
|
12635
|
+
const body = { source_files: sourceFiles };
|
|
12539
12636
|
if (options.dependencies !== void 0) {
|
|
12540
12637
|
body.dependencies = options.dependencies;
|
|
12541
12638
|
}
|
|
12542
|
-
if (
|
|
12543
|
-
body.zapier_durable_version =
|
|
12639
|
+
if (zapierDurableVersion !== void 0) {
|
|
12640
|
+
body.zapier_durable_version = zapierDurableVersion;
|
|
12544
12641
|
}
|
|
12545
12642
|
if (options.enabled !== void 0) {
|
|
12546
12643
|
body.enabled = options.enabled;
|
|
12547
12644
|
}
|
|
12548
|
-
if (options.connections
|
|
12549
|
-
body.connections =
|
|
12645
|
+
if (options.connections === null) {
|
|
12646
|
+
body.connections = null;
|
|
12647
|
+
} else if (options.connections !== void 0) {
|
|
12648
|
+
body.connections = toWireConnections(options.connections);
|
|
12550
12649
|
}
|
|
12551
|
-
if (
|
|
12552
|
-
body.app_versions =
|
|
12650
|
+
if (appVersions === null) {
|
|
12651
|
+
body.app_versions = null;
|
|
12652
|
+
} else if (appVersions !== void 0) {
|
|
12653
|
+
body.app_versions = toWireAppVersions(appVersions);
|
|
12553
12654
|
}
|
|
12554
12655
|
if (options.trigger !== void 0) {
|
|
12555
|
-
body.trigger = options.trigger;
|
|
12656
|
+
body.trigger = toWireTrigger(options.trigger);
|
|
12556
12657
|
}
|
|
12557
12658
|
const raw = await sdk2.context.api.post(
|
|
12558
12659
|
`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`,
|
|
@@ -12579,8 +12680,8 @@ var WorkflowVersionListItemSchema = z.object({
|
|
|
12579
12680
|
trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
|
|
12580
12681
|
"Trigger configuration persisted on this version, or null for webhook-only workflows."
|
|
12581
12682
|
),
|
|
12582
|
-
connections: z.record(z.string(),
|
|
12583
|
-
app_versions: z.record(z.string(),
|
|
12683
|
+
connections: z.record(z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
|
|
12684
|
+
app_versions: z.record(z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
|
|
12584
12685
|
});
|
|
12585
12686
|
var ListWorkflowVersionsOptionsSchema = z.object({
|
|
12586
12687
|
workflow: z.string().uuid().describe("Durable workflow ID"),
|
|
@@ -12652,8 +12753,8 @@ var GetWorkflowVersionResponseSchema = z.object({
|
|
|
12652
12753
|
trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
|
|
12653
12754
|
"Trigger configuration persisted on this version, or null for webhook-only workflows."
|
|
12654
12755
|
),
|
|
12655
|
-
connections: z.record(z.string(),
|
|
12656
|
-
app_versions: z.record(z.string(),
|
|
12756
|
+
connections: z.record(z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
|
|
12757
|
+
app_versions: z.record(z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
|
|
12657
12758
|
});
|
|
12658
12759
|
|
|
12659
12760
|
// src/plugins/codeSubstrate/getWorkflowVersion/index.ts
|
package/dist/index.cjs
CHANGED
|
@@ -6880,7 +6880,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
6880
6880
|
}
|
|
6881
6881
|
|
|
6882
6882
|
// src/sdk-version.ts
|
|
6883
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.
|
|
6883
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
|
|
6884
6884
|
|
|
6885
6885
|
// src/utils/open-url.ts
|
|
6886
6886
|
var nodePrefix = "node:";
|
package/dist/index.mjs
CHANGED
|
@@ -6878,7 +6878,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
6878
6878
|
}
|
|
6879
6879
|
|
|
6880
6880
|
// src/sdk-version.ts
|
|
6881
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.
|
|
6881
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
|
|
6882
6882
|
|
|
6883
6883
|
// src/utils/open-url.ts
|
|
6884
6884
|
var nodePrefix = "node:";
|
|
@@ -56,21 +56,60 @@ export declare const publishWorkflowVersionPlugin: (sdk: {
|
|
|
56
56
|
};
|
|
57
57
|
}) => {
|
|
58
58
|
publishWorkflowVersion: (options?: {
|
|
59
|
+
workflow: string;
|
|
60
|
+
sourceFiles: Record<string, string>;
|
|
61
|
+
dependencies?: Record<string, string> | undefined;
|
|
62
|
+
zapierDurableVersion?: string | undefined;
|
|
63
|
+
zapier_durable_version?: string | undefined;
|
|
64
|
+
enabled?: boolean | undefined;
|
|
65
|
+
connections?: Record<string, {
|
|
66
|
+
connectionId?: string | number | undefined;
|
|
67
|
+
connection_id?: string | number | undefined;
|
|
68
|
+
}> | null | undefined;
|
|
69
|
+
appVersions?: Record<string, {
|
|
70
|
+
implementationName?: string | undefined;
|
|
71
|
+
implementation_name?: string | undefined;
|
|
72
|
+
version?: string | undefined;
|
|
73
|
+
}> | null | undefined;
|
|
74
|
+
app_versions?: Record<string, {
|
|
75
|
+
implementationName?: string | undefined;
|
|
76
|
+
implementation_name?: string | undefined;
|
|
77
|
+
version?: string | undefined;
|
|
78
|
+
}> | null | undefined;
|
|
79
|
+
trigger?: {
|
|
80
|
+
action: string;
|
|
81
|
+
selectedApi?: string | undefined;
|
|
82
|
+
selected_api?: string | undefined;
|
|
83
|
+
authenticationId?: string | null | undefined;
|
|
84
|
+
authentication_id?: string | null | undefined;
|
|
85
|
+
params?: Record<string, unknown> | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
} | {
|
|
59
88
|
workflow: string;
|
|
60
89
|
source_files: Record<string, string>;
|
|
61
90
|
dependencies?: Record<string, string> | undefined;
|
|
91
|
+
zapierDurableVersion?: string | undefined;
|
|
62
92
|
zapier_durable_version?: string | undefined;
|
|
63
93
|
enabled?: boolean | undefined;
|
|
64
94
|
connections?: Record<string, {
|
|
65
|
-
|
|
95
|
+
connectionId?: string | number | undefined;
|
|
96
|
+
connection_id?: string | number | undefined;
|
|
97
|
+
}> | null | undefined;
|
|
98
|
+
appVersions?: Record<string, {
|
|
99
|
+
implementationName?: string | undefined;
|
|
100
|
+
implementation_name?: string | undefined;
|
|
101
|
+
version?: string | undefined;
|
|
66
102
|
}> | null | undefined;
|
|
67
103
|
app_versions?: Record<string, {
|
|
68
|
-
|
|
104
|
+
implementationName?: string | undefined;
|
|
105
|
+
implementation_name?: string | undefined;
|
|
69
106
|
version?: string | undefined;
|
|
70
107
|
}> | null | undefined;
|
|
71
108
|
trigger?: {
|
|
72
|
-
selected_api: string;
|
|
73
109
|
action: string;
|
|
110
|
+
selectedApi?: string | undefined;
|
|
111
|
+
selected_api?: string | undefined;
|
|
112
|
+
authenticationId?: string | null | undefined;
|
|
74
113
|
authentication_id?: string | null | undefined;
|
|
75
114
|
params?: Record<string, unknown> | undefined;
|
|
76
115
|
} | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/index.ts"],"names":[],"mappings":"AA6CA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DxC,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAC3D,OAAO,4BAA4B,CACpC,CAAC"}
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { definePlugin, createPluginMethod } from "kitcore";
|
|
2
|
+
import { ZapierValidationError } from "../../../types/errors";
|
|
2
3
|
import { workflowIdResolver } from "../../../resolvers/workflowId";
|
|
3
|
-
import { codeSubstrateDefaults } from "../shared";
|
|
4
|
+
import { codeSubstrateDefaults, toWireConnections, toWireAppVersions, } from "../shared";
|
|
4
5
|
import { PublishWorkflowVersionOptionsSchema, PublishWorkflowVersionResponseSchema, } from "./schemas";
|
|
6
|
+
/**
|
|
7
|
+
* Reshape the trigger config onto the wire body. `selectedApi` is the
|
|
8
|
+
* camelCase locator (with a deprecated snake_case alias) and is required
|
|
9
|
+
* when a trigger is configured, so a missing one is a client-side
|
|
10
|
+
* validation error.
|
|
11
|
+
*/
|
|
12
|
+
function toWireTrigger(trigger) {
|
|
13
|
+
const selectedApi = trigger.selectedApi ?? trigger.selected_api;
|
|
14
|
+
if (selectedApi === undefined) {
|
|
15
|
+
throw new ZapierValidationError("trigger is missing selectedApi");
|
|
16
|
+
}
|
|
17
|
+
const wire = {
|
|
18
|
+
selected_api: selectedApi,
|
|
19
|
+
action: trigger.action,
|
|
20
|
+
};
|
|
21
|
+
// Read with `in` so an explicit `null` (a no-auth trigger) is forwarded
|
|
22
|
+
// rather than collapsed into "omitted" by `??`.
|
|
23
|
+
if ("authenticationId" in trigger) {
|
|
24
|
+
wire.authentication_id = trigger.authenticationId;
|
|
25
|
+
}
|
|
26
|
+
else if ("authentication_id" in trigger) {
|
|
27
|
+
wire.authentication_id = trigger.authentication_id;
|
|
28
|
+
}
|
|
29
|
+
if (trigger.params !== undefined) {
|
|
30
|
+
wire.params = trigger.params;
|
|
31
|
+
}
|
|
32
|
+
return wire;
|
|
33
|
+
}
|
|
5
34
|
export const publishWorkflowVersionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
6
35
|
...codeSubstrateDefaults,
|
|
7
36
|
name: "publishWorkflowVersion",
|
|
@@ -11,26 +40,35 @@ export const publishWorkflowVersionPlugin = definePlugin((sdk) => createPluginMe
|
|
|
11
40
|
outputSchema: PublishWorkflowVersionResponseSchema,
|
|
12
41
|
resolvers: { workflow: workflowIdResolver },
|
|
13
42
|
handler: async ({ sdk, options }) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
43
|
+
const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
|
|
44
|
+
const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
|
|
45
|
+
// Read with `in` rather than `??` so an explicit `null` (clear the
|
|
46
|
+
// binding) survives and isn't collapsed into the deprecated alias.
|
|
47
|
+
const appVersions = "appVersions" in options ? options.appVersions : options.app_versions;
|
|
48
|
+
const body = { source_files: sourceFiles };
|
|
17
49
|
if (options.dependencies !== undefined) {
|
|
18
50
|
body.dependencies = options.dependencies;
|
|
19
51
|
}
|
|
20
|
-
if (
|
|
21
|
-
body.zapier_durable_version =
|
|
52
|
+
if (zapierDurableVersion !== undefined) {
|
|
53
|
+
body.zapier_durable_version = zapierDurableVersion;
|
|
22
54
|
}
|
|
23
55
|
if (options.enabled !== undefined) {
|
|
24
56
|
body.enabled = options.enabled;
|
|
25
57
|
}
|
|
26
|
-
if (options.connections
|
|
27
|
-
body.connections =
|
|
58
|
+
if (options.connections === null) {
|
|
59
|
+
body.connections = null;
|
|
28
60
|
}
|
|
29
|
-
if (options.
|
|
30
|
-
body.
|
|
61
|
+
else if (options.connections !== undefined) {
|
|
62
|
+
body.connections = toWireConnections(options.connections);
|
|
63
|
+
}
|
|
64
|
+
if (appVersions === null) {
|
|
65
|
+
body.app_versions = null;
|
|
66
|
+
}
|
|
67
|
+
else if (appVersions !== undefined) {
|
|
68
|
+
body.app_versions = toWireAppVersions(appVersions);
|
|
31
69
|
}
|
|
32
70
|
if (options.trigger !== undefined) {
|
|
33
|
-
body.trigger = options.trigger;
|
|
71
|
+
body.trigger = toWireTrigger(options.trigger);
|
|
34
72
|
}
|
|
35
73
|
const raw = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`, body, {
|
|
36
74
|
authRequired: true,
|