@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.73.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6c7627c: CamelCase the input params on `runDurable` and `publishWorkflowVersion` (`sourceFiles`, `zapierDurableVersion`, `appVersions`, and the nested connection / app-version / trigger fields), keeping the old snake_case names as deprecated aliases. Handlers map them back to the snake_case wire body; output fields are unchanged.
8
+
3
9
  ## 0.73.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -1658,21 +1658,21 @@ Publish a new version of a durable workflow. Enables the workflow by default.
1658
1658
 
1659
1659
  **Parameters:**
1660
1660
 
1661
- | Name | Type | Required | Default | Possible Values | Description |
1662
- | ---------------------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------------------- |
1663
- | `options` | `object` | ✅ | — | — | |
1664
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1665
- | ​ ↳ `source_files` | `object` | ✅ | — | — | Source files keyed by filename → contents |
1666
- | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
1667
- | ​ ↳ `zapier_durable_version` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
1668
- | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Enable the workflow after publishing. Defaults to true; pass false to publish without enabling. |
1669
- | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
1670
- | ​ ↳ `app_versions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
1671
- | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows. |
1672
- | ​   ↳ `selected_api` | `string` | | — | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
1673
- | ​   ↳ `action` | `string` | ✅ | — | — | Trigger action key (e.g. 'new_row') |
1674
- | ​   ↳ `authentication_id` | `string` | ❌ | — | — | Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier). |
1675
- | ​   ↳ `params` | `object` | ❌ | — | — | Trigger parameters as a JSON object |
1661
+ | Name | Type | Required | Default | Possible Values | Description |
1662
+ | -------------------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------------------- |
1663
+ | `options` | `object` | ✅ | — | — | |
1664
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1665
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
1666
+ | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
1667
+ | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
1668
+ | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Enable the workflow after publishing. Defaults to true; pass false to publish without enabling. |
1669
+ | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
1670
+ | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
1671
+ | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows. |
1672
+ | ​   ↳ `selectedApi` | `string` | | — | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured. |
1673
+ | ​   ↳ `action` | `string` | ✅ | — | — | Trigger action key (e.g. 'new_row') |
1674
+ | ​   ↳ `authenticationId` | `string` | ❌ | — | — | Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier). |
1675
+ | ​   ↳ `params` | `object` | ❌ | — | — | Trigger parameters as a JSON object |
1676
1676
 
1677
1677
  **Returns:** `Promise<WorkflowVersionItem>`
1678
1678
 
@@ -1695,7 +1695,7 @@ Publish a new version of a durable workflow. Enables the workflow by default.
1695
1695
  ```typescript
1696
1696
  const result = await zapier.publishWorkflowVersion({
1697
1697
  workflow: "example-workflow",
1698
- source_files: {},
1698
+ sourceFiles: {},
1699
1699
  });
1700
1700
  ```
1701
1701
 
@@ -1705,21 +1705,21 @@ Run a workflow source file as a run-once durable run on sdkdurableapi (no deploy
1705
1705
 
1706
1706
  **Parameters:**
1707
1707
 
1708
- | Name | Type | Required | Default | Possible Values | Description |
1709
- | ---------------------------- | ---------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
1710
- | `options` | `object` | ✅ | — | — | |
1711
- | ​ ↳ `source_files` | `object` | ✅ | — | — | Source files keyed by filename → contents |
1712
- | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the run |
1713
- | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
1714
- | ​ ↳ `zapier_durable_version` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
1715
- | ​ ↳ `connections` | `object` | ❌ | — | — | Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connection_id": "123" } }`. |
1716
- | ​ ↳ `app_versions` | `object` | ❌ | — | — | Pinned app versions. Maps app keys (slugs) to implementation names and versions. |
1717
- | ​ ↳ `private` | `boolean` | ❌ | — | — | Only the creating user can see the run (default false) |
1718
- | ​ ↳ `notifications[]` | `object[]` | ❌ | — | — | Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to. |
1719
- | ​   ↳ `type` | `string` | ❌ | — | `webhook` | Notification transport. Webhook is the only supported type. |
1720
- | ​   ↳ `url` | `string` | ✅ | — | — | URL to POST event notifications to. Payload is `{run_id, event}`. |
1721
- | ​   ↳ `max_retries` | `number` | ❌ | — | — | Max delivery attempts with exponential backoff. Defaults to 3 server-side. |
1722
- | ​   ↳ `events` | `array` | ✅ | — | — | One or more lifecycle events to subscribe this URL to. |
1708
+ | Name | Type | Required | Default | Possible Values | Description |
1709
+ | -------------------------- | ---------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
1710
+ | `options` | `object` | ✅ | — | — | |
1711
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
1712
+ | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the run |
1713
+ | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies |
1714
+ | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted. |
1715
+ | ​ ↳ `connections` | `object` | ❌ | — | — | Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connectionId": "123" } }`. |
1716
+ | ​ ↳ `appVersions` | `object` | ❌ | — | — | Pinned app versions. Maps app keys (slugs) to implementation names and versions. |
1717
+ | ​ ↳ `private` | `boolean` | ❌ | — | — | Only the creating user can see the run (default false) |
1718
+ | ​ ↳ `notifications[]` | `object[]` | ❌ | — | — | Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to. |
1719
+ | ​   ↳ `type` | `string` | ❌ | — | `webhook` | Notification transport. Webhook is the only supported type. |
1720
+ | ​   ↳ `url` | `string` | ✅ | — | — | URL to POST event notifications to. Payload is `{run_id, event}`. |
1721
+ | ​   ↳ `max_retries` | `number` | ❌ | — | — | Max delivery attempts with exponential backoff. Defaults to 3 server-side. |
1722
+ | ​   ↳ `events` | `array` | ✅ | — | — | One or more lifecycle events to subscribe this URL to. |
1723
1723
 
1724
1724
  **Returns:** `Promise<DurableRunItem>`
1725
1725
 
@@ -1735,7 +1735,7 @@ Run a workflow source file as a run-once durable run on sdkdurableapi (no deploy
1735
1735
 
1736
1736
  ```typescript
1737
1737
  const result = await zapier.runDurable({
1738
- source_files: {},
1738
+ sourceFiles: {},
1739
1739
  });
1740
1740
  ```
1741
1741
 
@@ -3287,7 +3287,7 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
3287
3287
  }
3288
3288
 
3289
3289
  // src/sdk-version.ts
3290
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.0" : void 0) || "unknown";
3290
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.73.1" : void 0) || "unknown";
3291
3291
 
3292
3292
  // src/utils/open-url.ts
3293
3293
  var nodePrefix = "node:";
@@ -11756,13 +11756,62 @@ var getTriggerInputFieldsSchemaPlugin = definePlugin(
11756
11756
  }
11757
11757
  })
11758
11758
  );
11759
-
11760
- // src/plugins/codeSubstrate/shared.ts
11761
11759
  var codeSubstrateDefaults = {
11762
11760
  categories: ["code-workflow"],
11763
11761
  experimental: true
11764
11762
  };
11763
+ var SourceFilesSchema = zod.z.record(zod.z.string(), zod.z.string()).refine((files) => Object.keys(files).length > 0, {
11764
+ message: "sourceFiles must contain at least one file"
11765
+ }).describe("Source files keyed by filename \u2192 contents");
11766
+ 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}$/;
11767
+ var ConnectionIdValueSchema = zod.z.union([
11768
+ zod.z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
11769
+ zod.z.string().regex(UUID_PATTERN, "must be a UUID"),
11770
+ zod.z.number().int().positive()
11771
+ ]).describe(
11772
+ "Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."
11773
+ );
11765
11774
  var ConnectionBindingSchema = zod.z.object({
11775
+ connectionId: ConnectionIdValueSchema.optional(),
11776
+ /** @deprecated Use `connectionId` instead. */
11777
+ connection_id: ConnectionIdValueSchema.optional().meta({ deprecated: true })
11778
+ });
11779
+ var AppVersionBindingSchema = zod.z.object({
11780
+ implementationName: zod.z.string().min(1).optional().describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
11781
+ /** @deprecated Use `implementationName` instead. */
11782
+ implementation_name: zod.z.string().min(1).optional().meta({ deprecated: true }),
11783
+ version: zod.z.string().optional().describe("Pinned app version (e.g. `1.27.1`). Latest if omitted.")
11784
+ });
11785
+ function toWireConnections(connections) {
11786
+ const wire = {};
11787
+ for (const [alias, entry] of Object.entries(connections)) {
11788
+ const connectionId = entry.connectionId ?? entry.connection_id;
11789
+ if (connectionId === void 0) {
11790
+ throw new ZapierValidationError(
11791
+ `connections["${alias}"] is missing connectionId`
11792
+ );
11793
+ }
11794
+ wire[alias] = { connection_id: connectionId };
11795
+ }
11796
+ return wire;
11797
+ }
11798
+ function toWireAppVersions(appVersions) {
11799
+ const wire = {};
11800
+ for (const [key, entry] of Object.entries(appVersions)) {
11801
+ const implementationName = entry.implementationName ?? entry.implementation_name;
11802
+ if (implementationName === void 0) {
11803
+ throw new ZapierValidationError(
11804
+ `appVersions["${key}"] is missing implementationName`
11805
+ );
11806
+ }
11807
+ wire[key] = {
11808
+ implementation_name: implementationName,
11809
+ ...entry.version !== void 0 ? { version: entry.version } : {}
11810
+ };
11811
+ }
11812
+ return wire;
11813
+ }
11814
+ var ConnectionBindingSchema2 = zod.z.object({
11766
11815
  connection_id: zod.z.union([
11767
11816
  zod.z.number().int().positive(),
11768
11817
  zod.z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
@@ -11773,7 +11822,7 @@ var ConnectionBindingSchema = zod.z.object({
11773
11822
  }).describe(
11774
11823
  "Connection binding: maps a single alias to a concrete connection."
11775
11824
  );
11776
- var AppVersionBindingSchema = zod.z.object({
11825
+ var AppVersionBindingSchema2 = zod.z.object({
11777
11826
  implementation_name: zod.z.string().describe("App implementation identifier (e.g. 'SlackCLIAPI')"),
11778
11827
  version: zod.z.string().optional().describe("App implementation version (e.g. '1.27.1')")
11779
11828
  }).describe("App-version binding: maps a single alias to an app version.");
@@ -11891,8 +11940,8 @@ var WorkflowVersionSchema = zod.z.object({
11891
11940
  trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
11892
11941
  "Trigger configuration persisted on this version, or null for webhook-only workflows."
11893
11942
  ),
11894
- connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).nullable().describe("Connection aliases bound on this version (or null)."),
11895
- app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullable().describe("App-version pins bound on this version (or null).")
11943
+ connections: zod.z.record(zod.z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
11944
+ app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
11896
11945
  });
11897
11946
  var GetWorkflowOptionsSchema = zod.z.object({
11898
11947
  workflow: zod.z.string().uuid().describe("Durable workflow ID")
@@ -12343,19 +12392,6 @@ var getDurableRunPlugin = definePlugin(
12343
12392
  }
12344
12393
  })
12345
12394
  );
12346
- var ConnectionMapEntrySchema = zod.z.object({
12347
- connection_id: zod.z.union([
12348
- zod.z.string().regex(/^[1-9][0-9]*$/, "must be a positive integer string"),
12349
- zod.z.string().uuid("must be a UUID"),
12350
- zod.z.number().int().positive()
12351
- ]).describe(
12352
- "Zapier connection ID. Accepts a positive integer (legacy) or a UUID string (newer connections)."
12353
- )
12354
- });
12355
- var AppVersionMapEntrySchema = zod.z.object({
12356
- implementation_name: zod.z.string().min(1).describe("Zapier app implementation name (e.g. `SlackCLIAPI`)"),
12357
- version: zod.z.string().optional().describe("Pinned app version (e.g. `1.27.1`). Latest if omitted.")
12358
- });
12359
12395
  var RunNotificationEventSchema = zod.z.enum(["started", "progress", "completed", "error", "cancelled"]).describe("Run lifecycle event this notification subscribes to");
12360
12396
  var RunNotificationSchema = zod.z.object({
12361
12397
  type: zod.z.literal("webhook").optional().describe("Notification transport. Webhook is the only supported type."),
@@ -12369,28 +12405,37 @@ var RunNotificationSchema = zod.z.object({
12369
12405
  }).describe(
12370
12406
  "Webhook subscriber for run lifecycle events. Server POSTs `{run_id, event}` on each subscribed transition."
12371
12407
  );
12372
- var RunDurableOptionsSchema = zod.z.object({
12373
- source_files: zod.z.record(zod.z.string(), zod.z.string()).refine((files) => Object.keys(files).length > 0, {
12374
- message: "source_files must contain at least one file"
12375
- }).describe("Source files keyed by filename \u2192 contents"),
12408
+ var RunDurableBaseSchema = zod.z.object({
12376
12409
  input: zod.z.unknown().optional().describe("Input data passed to the run"),
12377
12410
  dependencies: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Optional npm package dependencies"),
12378
- zapier_durable_version: zod.z.string().optional().describe(
12411
+ zapierDurableVersion: zod.z.string().optional().describe(
12379
12412
  'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
12380
12413
  ),
12381
- connections: zod.z.record(zod.z.string(), ConnectionMapEntrySchema).optional().describe(
12382
- 'Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connection_id": "123" } }`.'
12414
+ /** @deprecated Use `zapierDurableVersion` instead. */
12415
+ zapier_durable_version: zod.z.string().optional().meta({ deprecated: true }),
12416
+ connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).optional().describe(
12417
+ 'Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connectionId": "123" } }`.'
12383
12418
  ),
12384
- app_versions: zod.z.record(zod.z.string(), AppVersionMapEntrySchema).optional().describe(
12419
+ appVersions: zod.z.record(zod.z.string(), AppVersionBindingSchema).optional().describe(
12385
12420
  "Pinned app versions. Maps app keys (slugs) to implementation names and versions."
12386
12421
  ),
12422
+ /** @deprecated Use `appVersions` instead. */
12423
+ app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).optional().meta({ deprecated: true }),
12387
12424
  private: zod.z.boolean().optional().describe("Only the creating user can see the run (default false)"),
12388
12425
  notifications: zod.z.array(RunNotificationSchema).optional().describe(
12389
12426
  "Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to."
12390
12427
  )
12391
- }).describe(
12392
- "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."
12393
- );
12428
+ });
12429
+ 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.";
12430
+ var RunDurableSchema = zod.z.object({ sourceFiles: SourceFilesSchema }).merge(RunDurableBaseSchema).describe(RunDurableDescription).meta({
12431
+ aliases: {
12432
+ source_files: "sourceFiles",
12433
+ zapier_durable_version: "zapierDurableVersion",
12434
+ app_versions: "appVersions"
12435
+ }
12436
+ });
12437
+ var RunDurableSchemaDeprecated = zod.z.object({ source_files: SourceFilesSchema }).merge(RunDurableBaseSchema);
12438
+ var RunDurableOptionsSchema = zod.z.union([RunDurableSchema, RunDurableSchemaDeprecated]).describe(RunDurableDescription);
12394
12439
  var RunDurableResponseSchema = zod.z.object({
12395
12440
  id: zod.z.string().describe("Run ID (UUID) \u2014 server-generated, time-sortable"),
12396
12441
  status: zod.z.literal("initialized").describe(
@@ -12412,23 +12457,24 @@ var runDurablePlugin = definePlugin(
12412
12457
  inputSchema: RunDurableOptionsSchema,
12413
12458
  outputSchema: RunDurableResponseSchema,
12414
12459
  handler: async ({ sdk: sdk2, options }) => {
12415
- const body = {
12416
- source_files: options.source_files
12417
- };
12460
+ const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
12461
+ const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
12462
+ const appVersions = options.appVersions ?? options.app_versions;
12463
+ const body = { source_files: sourceFiles };
12418
12464
  if (options.input !== void 0) {
12419
12465
  body.input = options.input;
12420
12466
  }
12421
12467
  if (options.dependencies !== void 0) {
12422
12468
  body.dependencies = options.dependencies;
12423
12469
  }
12424
- if (options.zapier_durable_version !== void 0) {
12425
- body.zapier_durable_version = options.zapier_durable_version;
12470
+ if (zapierDurableVersion !== void 0) {
12471
+ body.zapier_durable_version = zapierDurableVersion;
12426
12472
  }
12427
12473
  if (options.connections !== void 0) {
12428
- body.connections = options.connections;
12474
+ body.connections = toWireConnections(options.connections);
12429
12475
  }
12430
- if (options.app_versions !== void 0) {
12431
- body.app_versions = options.app_versions;
12476
+ if (appVersions !== void 0) {
12477
+ body.app_versions = toWireAppVersions(appVersions);
12432
12478
  }
12433
12479
  if (options.private !== void 0) {
12434
12480
  body.is_private = options.private;
@@ -12483,30 +12529,61 @@ var cancelDurableRunPlugin = definePlugin(
12483
12529
  }
12484
12530
  })
12485
12531
  );
12486
- var PublishWorkflowVersionOptionsSchema = zod.z.object({
12487
- workflow: zod.z.string().uuid().describe("Durable workflow ID"),
12488
- source_files: zod.z.record(zod.z.string(), zod.z.string()).refine((files) => Object.keys(files).length > 0, {
12489
- message: "source_files must contain at least one file"
12490
- }).describe("Source files keyed by filename \u2192 contents"),
12532
+ var TriggerConfigSchema = zod.z.object({
12533
+ selectedApi: zod.z.string().optional().describe(
12534
+ "Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured."
12535
+ ),
12536
+ /** @deprecated Use `selectedApi` instead. */
12537
+ selected_api: zod.z.string().optional().meta({ deprecated: true }),
12538
+ action: zod.z.string().describe("Trigger action key (e.g. 'new_row')"),
12539
+ authenticationId: zod.z.string().nullish().describe(
12540
+ "Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier)."
12541
+ ),
12542
+ /** @deprecated Use `authenticationId` instead. */
12543
+ authentication_id: zod.z.string().nullish().meta({ deprecated: true }),
12544
+ params: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Trigger parameters as a JSON object")
12545
+ }).describe(
12546
+ "Zapier trigger configuration. When set, the workflow subscribes to trigger events."
12547
+ );
12548
+ var PublishWorkflowVersionDescription = "Publish a new version of a durable workflow. Enables the workflow by default.";
12549
+ var PublishWorkflowVersionBaseSchema = zod.z.object({
12491
12550
  dependencies: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Optional npm package dependencies"),
12492
- zapier_durable_version: zod.z.string().optional().describe(
12551
+ zapierDurableVersion: zod.z.string().optional().describe(
12493
12552
  'Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'
12494
12553
  ),
12554
+ /** @deprecated Use `zapierDurableVersion` instead. */
12555
+ zapier_durable_version: zod.z.string().optional().meta({ deprecated: true }),
12495
12556
  enabled: zod.z.boolean().optional().describe(
12496
12557
  "Enable the workflow after publishing. Defaults to true; pass false to publish without enabling."
12497
12558
  ),
12498
12559
  connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).nullish().describe(
12499
12560
  "Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding."
12500
12561
  ),
12501
- app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullish().describe(
12562
+ appVersions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullish().describe(
12502
12563
  "Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding."
12503
12564
  ),
12504
- trigger: WorkflowVersionTriggerConfigSchema.optional().describe(
12565
+ /** @deprecated Use `appVersions` instead. */
12566
+ app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullish().meta({ deprecated: true }),
12567
+ trigger: TriggerConfigSchema.optional().describe(
12505
12568
  "Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows."
12506
12569
  )
12507
- }).describe(
12508
- "Publish a new version of a durable workflow. Enables the workflow by default."
12509
- );
12570
+ });
12571
+ var WorkflowPropertySchema = zod.z.string().uuid().describe("Durable workflow ID");
12572
+ var PublishWorkflowVersionSchema = zod.z.object({
12573
+ workflow: WorkflowPropertySchema,
12574
+ sourceFiles: SourceFilesSchema
12575
+ }).merge(PublishWorkflowVersionBaseSchema).describe(PublishWorkflowVersionDescription).meta({
12576
+ aliases: {
12577
+ source_files: "sourceFiles",
12578
+ zapier_durable_version: "zapierDurableVersion",
12579
+ app_versions: "appVersions"
12580
+ }
12581
+ });
12582
+ var PublishWorkflowVersionSchemaDeprecated = zod.z.object({
12583
+ workflow: WorkflowPropertySchema,
12584
+ source_files: SourceFilesSchema
12585
+ }).merge(PublishWorkflowVersionBaseSchema);
12586
+ var PublishWorkflowVersionOptionsSchema = zod.z.union([PublishWorkflowVersionSchema, PublishWorkflowVersionSchemaDeprecated]).describe(PublishWorkflowVersionDescription);
12510
12587
  var PublishWorkflowVersionResponseSchema = zod.z.object({
12511
12588
  id: zod.z.string().describe("Workflow version ID (UUID)"),
12512
12589
  workflow_id: zod.z.string().describe("Parent workflow ID (UUID)"),
@@ -12520,11 +12597,30 @@ var PublishWorkflowVersionResponseSchema = zod.z.object({
12520
12597
  trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
12521
12598
  "Trigger configuration persisted on this version, or null for webhook-only workflows."
12522
12599
  ),
12523
- connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).nullable().describe("Connection aliases bound on this version (or null)."),
12524
- app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullable().describe("App-version pins bound on this version (or null).")
12600
+ connections: zod.z.record(zod.z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
12601
+ app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
12525
12602
  });
12526
12603
 
12527
12604
  // src/plugins/codeSubstrate/publishWorkflowVersion/index.ts
12605
+ function toWireTrigger(trigger) {
12606
+ const selectedApi = trigger.selectedApi ?? trigger.selected_api;
12607
+ if (selectedApi === void 0) {
12608
+ throw new ZapierValidationError("trigger is missing selectedApi");
12609
+ }
12610
+ const wire = {
12611
+ selected_api: selectedApi,
12612
+ action: trigger.action
12613
+ };
12614
+ if ("authenticationId" in trigger) {
12615
+ wire.authentication_id = trigger.authenticationId;
12616
+ } else if ("authentication_id" in trigger) {
12617
+ wire.authentication_id = trigger.authentication_id;
12618
+ }
12619
+ if (trigger.params !== void 0) {
12620
+ wire.params = trigger.params;
12621
+ }
12622
+ return wire;
12623
+ }
12528
12624
  var publishWorkflowVersionPlugin = definePlugin(
12529
12625
  (sdk) => createPluginMethod(sdk, {
12530
12626
  ...codeSubstrateDefaults,
@@ -12535,26 +12631,31 @@ var publishWorkflowVersionPlugin = definePlugin(
12535
12631
  outputSchema: PublishWorkflowVersionResponseSchema,
12536
12632
  resolvers: { workflow: workflowIdResolver },
12537
12633
  handler: async ({ sdk: sdk2, options }) => {
12538
- const body = {
12539
- source_files: options.source_files
12540
- };
12634
+ const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
12635
+ const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
12636
+ const appVersions = "appVersions" in options ? options.appVersions : options.app_versions;
12637
+ const body = { source_files: sourceFiles };
12541
12638
  if (options.dependencies !== void 0) {
12542
12639
  body.dependencies = options.dependencies;
12543
12640
  }
12544
- if (options.zapier_durable_version !== void 0) {
12545
- body.zapier_durable_version = options.zapier_durable_version;
12641
+ if (zapierDurableVersion !== void 0) {
12642
+ body.zapier_durable_version = zapierDurableVersion;
12546
12643
  }
12547
12644
  if (options.enabled !== void 0) {
12548
12645
  body.enabled = options.enabled;
12549
12646
  }
12550
- if (options.connections !== void 0) {
12551
- body.connections = options.connections;
12647
+ if (options.connections === null) {
12648
+ body.connections = null;
12649
+ } else if (options.connections !== void 0) {
12650
+ body.connections = toWireConnections(options.connections);
12552
12651
  }
12553
- if (options.app_versions !== void 0) {
12554
- body.app_versions = options.app_versions;
12652
+ if (appVersions === null) {
12653
+ body.app_versions = null;
12654
+ } else if (appVersions !== void 0) {
12655
+ body.app_versions = toWireAppVersions(appVersions);
12555
12656
  }
12556
12657
  if (options.trigger !== void 0) {
12557
- body.trigger = options.trigger;
12658
+ body.trigger = toWireTrigger(options.trigger);
12558
12659
  }
12559
12660
  const raw = await sdk2.context.api.post(
12560
12661
  `/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`,
@@ -12581,8 +12682,8 @@ var WorkflowVersionListItemSchema = zod.z.object({
12581
12682
  trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
12582
12683
  "Trigger configuration persisted on this version, or null for webhook-only workflows."
12583
12684
  ),
12584
- connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).nullable().describe("Connection aliases bound on this version (or null)."),
12585
- app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullable().describe("App-version pins bound on this version (or null).")
12685
+ connections: zod.z.record(zod.z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
12686
+ app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
12586
12687
  });
12587
12688
  var ListWorkflowVersionsOptionsSchema = zod.z.object({
12588
12689
  workflow: zod.z.string().uuid().describe("Durable workflow ID"),
@@ -12654,8 +12755,8 @@ var GetWorkflowVersionResponseSchema = zod.z.object({
12654
12755
  trigger: WorkflowVersionTriggerConfigSchema.nullable().describe(
12655
12756
  "Trigger configuration persisted on this version, or null for webhook-only workflows."
12656
12757
  ),
12657
- connections: zod.z.record(zod.z.string(), ConnectionBindingSchema).nullable().describe("Connection aliases bound on this version (or null)."),
12658
- app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema).nullable().describe("App-version pins bound on this version (or null).")
12758
+ connections: zod.z.record(zod.z.string(), ConnectionBindingSchema2).nullable().describe("Connection aliases bound on this version (or null)."),
12759
+ app_versions: zod.z.record(zod.z.string(), AppVersionBindingSchema2).nullable().describe("App-version pins bound on this version (or null).")
12659
12760
  });
12660
12761
 
12661
12762
  // src/plugins/codeSubstrate/getWorkflowVersion/index.ts