@zapier/zapier-sdk 0.72.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +32 -32
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +9 -0
  5. package/dist/api/types.d.ts +5 -4
  6. package/dist/api/types.d.ts.map +1 -1
  7. package/dist/experimental.cjs +175 -65
  8. package/dist/experimental.d.mts +160 -12
  9. package/dist/experimental.d.ts +158 -10
  10. package/dist/experimental.d.ts.map +1 -1
  11. package/dist/experimental.mjs +175 -65
  12. package/dist/{index-B43uST61.d.mts → index-D1O7Pcex.d.mts} +5 -4
  13. package/dist/{index-B43uST61.d.ts → index-D1O7Pcex.d.ts} +5 -4
  14. package/dist/index.cjs +10 -1
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.mjs +10 -1
  17. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +42 -3
  18. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
  19. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +49 -11
  20. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +117 -5
  21. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
  22. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +77 -14
  23. package/dist/plugins/codeSubstrate/runDurable/index.d.ts +37 -2
  24. package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
  25. package/dist/plugins/codeSubstrate/runDurable/index.js +10 -9
  26. package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +117 -4
  27. package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -1
  28. package/dist/plugins/codeSubstrate/runDurable/schemas.js +38 -37
  29. package/dist/plugins/codeSubstrate/shared.d.ts +56 -0
  30. package/dist/plugins/codeSubstrate/shared.d.ts.map +1 -1
  31. package/dist/plugins/codeSubstrate/shared.js +100 -0
  32. package/package.json +1 -1
@@ -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 body = {
15
- source_files: options.source_files,
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 (options.zapier_durable_version !== undefined) {
21
- body.zapier_durable_version = options.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 !== undefined) {
27
- body.connections = options.connections;
58
+ if (options.connections === null) {
59
+ body.connections = null;
28
60
  }
29
- if (options.app_versions !== undefined) {
30
- body.app_versions = options.app_versions;
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,
@@ -1,25 +1,136 @@
1
1
  import { z } from "zod";
2
- export declare const PublishWorkflowVersionOptionsSchema: z.ZodObject<{
2
+ declare const TriggerConfigSchema: z.ZodObject<{
3
+ selectedApi: z.ZodOptional<z.ZodString>;
4
+ selected_api: z.ZodOptional<z.ZodString>;
5
+ action: z.ZodString;
6
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9
+ }, z.core.$strip>;
10
+ export type TriggerConfig = z.infer<typeof TriggerConfigSchema>;
11
+ export declare const PublishWorkflowVersionSchema: z.ZodObject<{
12
+ workflow: z.ZodString;
13
+ sourceFiles: z.ZodRecord<z.ZodString, z.ZodString>;
14
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
15
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
16
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
17
+ enabled: z.ZodOptional<z.ZodBoolean>;
18
+ connections: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
19
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
20
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
21
+ }, z.core.$strip>>>>;
22
+ appVersions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
23
+ implementationName: z.ZodOptional<z.ZodString>;
24
+ implementation_name: z.ZodOptional<z.ZodString>;
25
+ version: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>>>>;
27
+ app_versions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
28
+ implementationName: z.ZodOptional<z.ZodString>;
29
+ implementation_name: z.ZodOptional<z.ZodString>;
30
+ version: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>>>;
32
+ trigger: z.ZodOptional<z.ZodObject<{
33
+ selectedApi: z.ZodOptional<z.ZodString>;
34
+ selected_api: z.ZodOptional<z.ZodString>;
35
+ action: z.ZodString;
36
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ }, z.core.$strip>>;
40
+ }, z.core.$strip>;
41
+ declare const PublishWorkflowVersionSchemaDeprecated: z.ZodObject<{
3
42
  workflow: z.ZodString;
4
43
  source_files: z.ZodRecord<z.ZodString, z.ZodString>;
5
44
  dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
45
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
6
46
  zapier_durable_version: z.ZodOptional<z.ZodString>;
7
47
  enabled: z.ZodOptional<z.ZodBoolean>;
8
48
  connections: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
9
- connection_id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>;
49
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
50
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
51
+ }, z.core.$strip>>>>;
52
+ appVersions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
53
+ implementationName: z.ZodOptional<z.ZodString>;
54
+ implementation_name: z.ZodOptional<z.ZodString>;
55
+ version: z.ZodOptional<z.ZodString>;
10
56
  }, z.core.$strip>>>>;
11
57
  app_versions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
12
- implementation_name: z.ZodString;
58
+ implementationName: z.ZodOptional<z.ZodString>;
59
+ implementation_name: z.ZodOptional<z.ZodString>;
13
60
  version: z.ZodOptional<z.ZodString>;
14
61
  }, z.core.$strip>>>>;
15
62
  trigger: z.ZodOptional<z.ZodObject<{
16
- selected_api: z.ZodString;
63
+ selectedApi: z.ZodOptional<z.ZodString>;
64
+ selected_api: z.ZodOptional<z.ZodString>;
17
65
  action: z.ZodString;
66
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
67
  authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
68
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
20
69
  }, z.core.$strip>>;
21
70
  }, z.core.$strip>;
22
- export type PublishWorkflowVersionOptions = z.infer<typeof PublishWorkflowVersionOptionsSchema>;
71
+ export declare const PublishWorkflowVersionOptionsSchema: z.ZodUnion<readonly [z.ZodObject<{
72
+ workflow: z.ZodString;
73
+ sourceFiles: z.ZodRecord<z.ZodString, z.ZodString>;
74
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
75
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
76
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
77
+ enabled: z.ZodOptional<z.ZodBoolean>;
78
+ connections: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
79
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
80
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
81
+ }, z.core.$strip>>>>;
82
+ appVersions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
83
+ implementationName: z.ZodOptional<z.ZodString>;
84
+ implementation_name: z.ZodOptional<z.ZodString>;
85
+ version: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strip>>>>;
87
+ app_versions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
88
+ implementationName: z.ZodOptional<z.ZodString>;
89
+ implementation_name: z.ZodOptional<z.ZodString>;
90
+ version: z.ZodOptional<z.ZodString>;
91
+ }, z.core.$strip>>>>;
92
+ trigger: z.ZodOptional<z.ZodObject<{
93
+ selectedApi: z.ZodOptional<z.ZodString>;
94
+ selected_api: z.ZodOptional<z.ZodString>;
95
+ action: z.ZodString;
96
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
97
+ authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
99
+ }, z.core.$strip>>;
100
+ }, z.core.$strip>, z.ZodObject<{
101
+ workflow: z.ZodString;
102
+ source_files: z.ZodRecord<z.ZodString, z.ZodString>;
103
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
105
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
106
+ enabled: z.ZodOptional<z.ZodBoolean>;
107
+ connections: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
108
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
109
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
110
+ }, z.core.$strip>>>>;
111
+ appVersions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
112
+ implementationName: z.ZodOptional<z.ZodString>;
113
+ implementation_name: z.ZodOptional<z.ZodString>;
114
+ version: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>>>>;
116
+ app_versions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
117
+ implementationName: z.ZodOptional<z.ZodString>;
118
+ implementation_name: z.ZodOptional<z.ZodString>;
119
+ version: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>>>>;
121
+ trigger: z.ZodOptional<z.ZodObject<{
122
+ selectedApi: z.ZodOptional<z.ZodString>;
123
+ selected_api: z.ZodOptional<z.ZodString>;
124
+ action: z.ZodString;
125
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
128
+ }, z.core.$strip>>;
129
+ }, z.core.$strip>]>;
130
+ export type PublishWorkflowVersionOptions = z.infer<typeof PublishWorkflowVersionSchema> | (Omit<z.infer<typeof PublishWorkflowVersionSchemaDeprecated>, "source_files"> & {
131
+ /** @deprecated Use `sourceFiles` instead. */
132
+ source_files: z.infer<typeof PublishWorkflowVersionSchemaDeprecated>["source_files"];
133
+ });
23
134
  export declare const PublishWorkflowVersionResponseSchema: z.ZodObject<{
24
135
  id: z.ZodString;
25
136
  workflow_id: z.ZodString;
@@ -43,4 +154,5 @@ export declare const PublishWorkflowVersionResponseSchema: z.ZodObject<{
43
154
  }, z.core.$strip>>>;
44
155
  }, z.core.$strip>;
45
156
  export type PublishWorkflowVersionResponse = z.infer<typeof PublishWorkflowVersionResponseSchema>;
157
+ export {};
46
158
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;iBA2C7C,CAAC;AAEJ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;iBA8B/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,QAAA,MAAM,mBAAmB;;;;;;;iBA0BtB,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAyDhE,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAarC,CAAC;AAGL,QAAA,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKF,CAAC;AAG3C,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEF,CAAC;AAE/C,MAAM,MAAM,6BAA6B,GACrC,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,GAC5C,CAAC,IAAI,CACH,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,EACtD,cAAc,CACf,GAAG;IACF,6CAA6C;IAC7C,YAAY,EAAE,CAAC,CAAC,KAAK,CACnB,OAAO,sCAAsC,CAC9C,CAAC,cAAc,CAAC,CAAC;CACnB,CAAC,CAAC;AAEP,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;iBA8B/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC"}
@@ -1,37 +1,100 @@
1
1
  import { z } from "zod";
2
+ import { AppVersionBindingSchema as AppVersionBindingInputSchema, ConnectionBindingSchema as ConnectionBindingInputSchema, SourceFilesSchema, } from "../shared";
2
3
  import { AppVersionBindingSchema, ConnectionBindingSchema, WorkflowVersionTriggerConfigSchema, } from "../shared-schemas";
3
- export const PublishWorkflowVersionOptionsSchema = z
4
+ // `selectedApi` is conceptually required when a trigger is configured, but it
5
+ // coexists with its deprecated snake_case alias. AGENTS.md rule 9 prescribes a
6
+ // union schema for a required renamed param; here we deliberately diverge —
7
+ // a union nested inside `trigger` would drop `.shape`, which the docs
8
+ // generator needs to render the trigger's fields. Instead both names are
9
+ // optional (so `.shape` survives, snake_case stays hidden via `deprecated`)
10
+ // and `toWireTrigger` enforces that one is present.
11
+ const TriggerConfigSchema = z
4
12
  .object({
5
- workflow: z.string().uuid().describe("Durable workflow ID"),
6
- source_files: z
7
- .record(z.string(), z.string())
8
- .refine((files) => Object.keys(files).length > 0, {
9
- message: "source_files must contain at least one file",
10
- })
11
- .describe("Source files keyed by filename → contents"),
13
+ selectedApi: z
14
+ .string()
15
+ .optional()
16
+ .describe("Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured."),
17
+ /** @deprecated Use `selectedApi` instead. */
18
+ selected_api: z.string().optional().meta({ deprecated: true }),
19
+ action: z.string().describe("Trigger action key (e.g. 'new_row')"),
20
+ authenticationId: z
21
+ .string()
22
+ .nullish()
23
+ .describe("Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier)."),
24
+ /** @deprecated Use `authenticationId` instead. */
25
+ authentication_id: z.string().nullish().meta({ deprecated: true }),
26
+ params: z
27
+ .record(z.string(), z.unknown())
28
+ .optional()
29
+ .describe("Trigger parameters as a JSON object"),
30
+ })
31
+ .describe("Zapier trigger configuration. When set, the workflow subscribes to trigger events.");
32
+ const PublishWorkflowVersionDescription = "Publish a new version of a durable workflow. Enables the workflow by default.";
33
+ // Shared, non-renamed properties for both the canonical and deprecated
34
+ // `sourceFiles` variants. `workflow` and `sourceFiles` live on the variant
35
+ // objects (not here) so they stay the leading keys — the CLI derives
36
+ // positional args from key order, and the original order is
37
+ // `<workflow> <source-files>`.
38
+ const PublishWorkflowVersionBaseSchema = z.object({
12
39
  dependencies: z
13
40
  .record(z.string(), z.string())
14
41
  .optional()
15
42
  .describe("Optional npm package dependencies"),
16
- zapier_durable_version: z
43
+ zapierDurableVersion: z
17
44
  .string()
18
45
  .optional()
19
46
  .describe('Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'),
47
+ /** @deprecated Use `zapierDurableVersion` instead. */
48
+ zapier_durable_version: z.string().optional().meta({ deprecated: true }),
20
49
  enabled: z
21
50
  .boolean()
22
51
  .optional()
23
52
  .describe("Enable the workflow after publishing. Defaults to true; pass false to publish without enabling."),
24
53
  connections: z
25
- .record(z.string(), ConnectionBindingSchema)
54
+ .record(z.string(), ConnectionBindingInputSchema)
26
55
  .nullish()
27
56
  .describe("Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding."),
28
- app_versions: z
29
- .record(z.string(), AppVersionBindingSchema)
57
+ appVersions: z
58
+ .record(z.string(), AppVersionBindingInputSchema)
30
59
  .nullish()
31
60
  .describe("Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding."),
32
- trigger: WorkflowVersionTriggerConfigSchema.optional().describe("Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows."),
61
+ /** @deprecated Use `appVersions` instead. */
62
+ app_versions: z
63
+ .record(z.string(), AppVersionBindingInputSchema)
64
+ .nullish()
65
+ .meta({ deprecated: true }),
66
+ trigger: TriggerConfigSchema.optional().describe("Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; omit for webhook-only workflows."),
67
+ });
68
+ const WorkflowPropertySchema = z
69
+ .string()
70
+ .uuid()
71
+ .describe("Durable workflow ID");
72
+ // Canonical schema (new names only) — drives docs, CLI help, and the registry.
73
+ export const PublishWorkflowVersionSchema = z
74
+ .object({
75
+ workflow: WorkflowPropertySchema,
76
+ sourceFiles: SourceFilesSchema,
33
77
  })
34
- .describe("Publish a new version of a durable workflow. Enables the workflow by default.");
78
+ .merge(PublishWorkflowVersionBaseSchema)
79
+ .describe(PublishWorkflowVersionDescription)
80
+ .meta({
81
+ aliases: {
82
+ source_files: "sourceFiles",
83
+ zapier_durable_version: "zapierDurableVersion",
84
+ app_versions: "appVersions",
85
+ },
86
+ });
87
+ // Deprecated schema (backward compat) — keeps the old `source_files` name valid.
88
+ const PublishWorkflowVersionSchemaDeprecated = z
89
+ .object({
90
+ workflow: WorkflowPropertySchema,
91
+ source_files: SourceFilesSchema,
92
+ })
93
+ .merge(PublishWorkflowVersionBaseSchema);
94
+ // Union for runtime validation: accepts either the canonical or the old name.
95
+ export const PublishWorkflowVersionOptionsSchema = z
96
+ .union([PublishWorkflowVersionSchema, PublishWorkflowVersionSchemaDeprecated])
97
+ .describe(PublishWorkflowVersionDescription);
35
98
  export const PublishWorkflowVersionResponseSchema = z.object({
36
99
  id: z.string().describe("Workflow version ID (UUID)"),
37
100
  workflow_id: z.string().describe("Parent workflow ID (UUID)"),
@@ -22,15 +22,50 @@ export declare const runDurablePlugin: (sdk: {
22
22
  };
23
23
  }) => {
24
24
  runDurable: (options?: {
25
+ sourceFiles: Record<string, string>;
26
+ input?: unknown;
27
+ dependencies?: Record<string, string> | undefined;
28
+ zapierDurableVersion?: string | undefined;
29
+ zapier_durable_version?: string | undefined;
30
+ connections?: Record<string, {
31
+ connectionId?: string | number | undefined;
32
+ connection_id?: string | number | undefined;
33
+ }> | undefined;
34
+ appVersions?: Record<string, {
35
+ implementationName?: string | undefined;
36
+ implementation_name?: string | undefined;
37
+ version?: string | undefined;
38
+ }> | undefined;
39
+ app_versions?: Record<string, {
40
+ implementationName?: string | undefined;
41
+ implementation_name?: string | undefined;
42
+ version?: string | undefined;
43
+ }> | undefined;
44
+ private?: boolean | undefined;
45
+ notifications?: {
46
+ url: string;
47
+ events: ("error" | "started" | "cancelled" | "completed" | "progress")[];
48
+ type?: "webhook" | undefined;
49
+ max_retries?: number | undefined;
50
+ }[] | undefined;
51
+ } | {
25
52
  source_files: Record<string, string>;
26
53
  input?: unknown;
27
54
  dependencies?: Record<string, string> | undefined;
55
+ zapierDurableVersion?: string | undefined;
28
56
  zapier_durable_version?: string | undefined;
29
57
  connections?: Record<string, {
30
- connection_id: string | number;
58
+ connectionId?: string | number | undefined;
59
+ connection_id?: string | number | undefined;
60
+ }> | undefined;
61
+ appVersions?: Record<string, {
62
+ implementationName?: string | undefined;
63
+ implementation_name?: string | undefined;
64
+ version?: string | undefined;
31
65
  }> | undefined;
32
66
  app_versions?: Record<string, {
33
- implementation_name: string;
67
+ implementationName?: string | undefined;
68
+ implementation_name?: string | undefined;
34
69
  version?: string | undefined;
35
70
  }> | undefined;
36
71
  private?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4C5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { definePlugin, createPluginMethod } from "kitcore";
2
- import { codeSubstrateDefaults } from "../shared";
2
+ import { codeSubstrateDefaults, toWireConnections, toWireAppVersions, } from "../shared";
3
3
  import { RunDurableOptionsSchema, RunDurableResponseSchema } from "./schemas";
4
4
  export const runDurablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
5
5
  ...codeSubstrateDefaults,
@@ -9,23 +9,24 @@ export const runDurablePlugin = definePlugin((sdk) => createPluginMethod(sdk, {
9
9
  inputSchema: RunDurableOptionsSchema,
10
10
  outputSchema: RunDurableResponseSchema,
11
11
  handler: async ({ sdk, options }) => {
12
- const body = {
13
- source_files: options.source_files,
14
- };
12
+ const sourceFiles = "sourceFiles" in options ? options.sourceFiles : options.source_files;
13
+ const zapierDurableVersion = options.zapierDurableVersion ?? options.zapier_durable_version;
14
+ const appVersions = options.appVersions ?? options.app_versions;
15
+ const body = { source_files: sourceFiles };
15
16
  if (options.input !== undefined) {
16
17
  body.input = options.input;
17
18
  }
18
19
  if (options.dependencies !== undefined) {
19
20
  body.dependencies = options.dependencies;
20
21
  }
21
- if (options.zapier_durable_version !== undefined) {
22
- body.zapier_durable_version = options.zapier_durable_version;
22
+ if (zapierDurableVersion !== undefined) {
23
+ body.zapier_durable_version = zapierDurableVersion;
23
24
  }
24
25
  if (options.connections !== undefined) {
25
- body.connections = options.connections;
26
+ body.connections = toWireConnections(options.connections);
26
27
  }
27
- if (options.app_versions !== undefined) {
28
- body.app_versions = options.app_versions;
28
+ if (appVersions !== undefined) {
29
+ body.app_versions = toWireAppVersions(appVersions);
29
30
  }
30
31
  if (options.private !== undefined) {
31
32
  body.is_private = options.private;
@@ -1,14 +1,56 @@
1
1
  import { z } from "zod";
2
- export declare const RunDurableOptionsSchema: z.ZodObject<{
2
+ export declare const RunDurableSchema: z.ZodObject<{
3
+ sourceFiles: z.ZodRecord<z.ZodString, z.ZodString>;
4
+ input: z.ZodOptional<z.ZodUnknown>;
5
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
6
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
7
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
8
+ connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
9
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
10
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
11
+ }, z.core.$strip>>>;
12
+ appVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
13
+ implementationName: z.ZodOptional<z.ZodString>;
14
+ implementation_name: z.ZodOptional<z.ZodString>;
15
+ version: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>>;
17
+ app_versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
18
+ implementationName: z.ZodOptional<z.ZodString>;
19
+ implementation_name: z.ZodOptional<z.ZodString>;
20
+ version: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>>>;
22
+ private: z.ZodOptional<z.ZodBoolean>;
23
+ notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
24
+ type: z.ZodOptional<z.ZodLiteral<"webhook">>;
25
+ url: z.ZodString;
26
+ max_retries: z.ZodOptional<z.ZodNumber>;
27
+ events: z.ZodArray<z.ZodEnum<{
28
+ error: "error";
29
+ started: "started";
30
+ cancelled: "cancelled";
31
+ completed: "completed";
32
+ progress: "progress";
33
+ }>>;
34
+ }, z.core.$strip>>>;
35
+ }, z.core.$strip>;
36
+ declare const RunDurableSchemaDeprecated: z.ZodObject<{
3
37
  source_files: z.ZodRecord<z.ZodString, z.ZodString>;
4
38
  input: z.ZodOptional<z.ZodUnknown>;
5
39
  dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
6
41
  zapier_durable_version: z.ZodOptional<z.ZodString>;
7
42
  connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
8
- connection_id: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>;
43
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
44
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
45
+ }, z.core.$strip>>>;
46
+ appVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
47
+ implementationName: z.ZodOptional<z.ZodString>;
48
+ implementation_name: z.ZodOptional<z.ZodString>;
49
+ version: z.ZodOptional<z.ZodString>;
9
50
  }, z.core.$strip>>>;
10
51
  app_versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
11
- implementation_name: z.ZodString;
52
+ implementationName: z.ZodOptional<z.ZodString>;
53
+ implementation_name: z.ZodOptional<z.ZodString>;
12
54
  version: z.ZodOptional<z.ZodString>;
13
55
  }, z.core.$strip>>>;
14
56
  private: z.ZodOptional<z.ZodBoolean>;
@@ -25,7 +67,77 @@ export declare const RunDurableOptionsSchema: z.ZodObject<{
25
67
  }>>;
26
68
  }, z.core.$strip>>>;
27
69
  }, z.core.$strip>;
28
- export type RunDurableOptions = z.infer<typeof RunDurableOptionsSchema>;
70
+ export declare const RunDurableOptionsSchema: z.ZodUnion<readonly [z.ZodObject<{
71
+ sourceFiles: z.ZodRecord<z.ZodString, z.ZodString>;
72
+ input: z.ZodOptional<z.ZodUnknown>;
73
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
74
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
75
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
76
+ connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
77
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
78
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
79
+ }, z.core.$strip>>>;
80
+ appVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
81
+ implementationName: z.ZodOptional<z.ZodString>;
82
+ implementation_name: z.ZodOptional<z.ZodString>;
83
+ version: z.ZodOptional<z.ZodString>;
84
+ }, z.core.$strip>>>;
85
+ app_versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
86
+ implementationName: z.ZodOptional<z.ZodString>;
87
+ implementation_name: z.ZodOptional<z.ZodString>;
88
+ version: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>>>;
90
+ private: z.ZodOptional<z.ZodBoolean>;
91
+ notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
92
+ type: z.ZodOptional<z.ZodLiteral<"webhook">>;
93
+ url: z.ZodString;
94
+ max_retries: z.ZodOptional<z.ZodNumber>;
95
+ events: z.ZodArray<z.ZodEnum<{
96
+ error: "error";
97
+ started: "started";
98
+ cancelled: "cancelled";
99
+ completed: "completed";
100
+ progress: "progress";
101
+ }>>;
102
+ }, z.core.$strip>>>;
103
+ }, z.core.$strip>, z.ZodObject<{
104
+ source_files: z.ZodRecord<z.ZodString, z.ZodString>;
105
+ input: z.ZodOptional<z.ZodUnknown>;
106
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
107
+ zapierDurableVersion: z.ZodOptional<z.ZodString>;
108
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
109
+ connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
110
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
111
+ connection_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodNumber]>>;
112
+ }, z.core.$strip>>>;
113
+ appVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
114
+ implementationName: z.ZodOptional<z.ZodString>;
115
+ implementation_name: z.ZodOptional<z.ZodString>;
116
+ version: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strip>>>;
118
+ app_versions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
119
+ implementationName: z.ZodOptional<z.ZodString>;
120
+ implementation_name: z.ZodOptional<z.ZodString>;
121
+ version: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>>>;
123
+ private: z.ZodOptional<z.ZodBoolean>;
124
+ notifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
125
+ type: z.ZodOptional<z.ZodLiteral<"webhook">>;
126
+ url: z.ZodString;
127
+ max_retries: z.ZodOptional<z.ZodNumber>;
128
+ events: z.ZodArray<z.ZodEnum<{
129
+ error: "error";
130
+ started: "started";
131
+ cancelled: "cancelled";
132
+ completed: "completed";
133
+ progress: "progress";
134
+ }>>;
135
+ }, z.core.$strip>>>;
136
+ }, z.core.$strip>]>;
137
+ export type RunDurableOptions = z.infer<typeof RunDurableSchema> | (Omit<z.infer<typeof RunDurableSchemaDeprecated>, "source_files"> & {
138
+ /** @deprecated Use `sourceFiles` instead. */
139
+ source_files: z.infer<typeof RunDurableSchemaDeprecated>["source_files"];
140
+ });
29
141
  export declare const RunDurableResponseSchema: z.ZodObject<{
30
142
  id: z.ZodString;
31
143
  status: z.ZodLiteral<"initialized">;
@@ -33,4 +145,5 @@ export declare const RunDurableResponseSchema: z.ZodObject<{
33
145
  created_at: z.ZodString;
34
146
  }, z.core.$strip>;
35
147
  export type RunDurableResponse = z.infer<typeof RunDurableResponseSchema>;
148
+ export {};
36
149
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8DxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CjC,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;;;iBAanC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/runDurable/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0FxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUzB,CAAC;AAGL,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEF,CAAC;AAG/B,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEF,CAAC;AAEnC,MAAM,MAAM,iBAAiB,GACzB,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAChC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,EAAE,cAAc,CAAC,GAAG;IAClE,6CAA6C;IAC7C,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC,cAAc,CAAC,CAAC;CAC1E,CAAC,CAAC;AAEP,eAAO,MAAM,wBAAwB;;;;;iBAanC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}