@zapier/zapier-sdk 0.63.0 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +256 -0
  3. package/dist/experimental.cjs +387 -2
  4. package/dist/experimental.d.mts +145 -2
  5. package/dist/experimental.d.ts +143 -0
  6. package/dist/experimental.d.ts.map +1 -1
  7. package/dist/experimental.js +12 -0
  8. package/dist/experimental.mjs +386 -3
  9. package/dist/{index-3fBEDEsp.d.mts → index-JhNxS_mq.d.mts} +39 -1
  10. package/dist/{index-3fBEDEsp.d.ts → index-JhNxS_mq.d.ts} +39 -1
  11. package/dist/index.cjs +43 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +42 -2
  14. package/dist/plugins/codeSubstrate/getTriggerRun/index.d.ts +47 -0
  15. package/dist/plugins/codeSubstrate/getTriggerRun/index.d.ts.map +1 -0
  16. package/dist/plugins/codeSubstrate/getTriggerRun/index.js +23 -0
  17. package/dist/plugins/codeSubstrate/getTriggerRun/schemas.d.ts +24 -0
  18. package/dist/plugins/codeSubstrate/getTriggerRun/schemas.d.ts.map +1 -0
  19. package/dist/plugins/codeSubstrate/getTriggerRun/schemas.js +30 -0
  20. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +49 -0
  21. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts.map +1 -0
  22. package/dist/plugins/codeSubstrate/getWorkflowRun/index.js +25 -0
  23. package/dist/plugins/codeSubstrate/getWorkflowRun/schemas.d.ts +26 -0
  24. package/dist/plugins/codeSubstrate/getWorkflowRun/schemas.d.ts.map +1 -0
  25. package/dist/plugins/codeSubstrate/getWorkflowRun/schemas.js +43 -0
  26. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +46 -0
  27. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -0
  28. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.js +25 -0
  29. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts +17 -0
  30. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts.map +1 -0
  31. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.js +25 -0
  32. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +53 -0
  33. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -0
  34. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.js +34 -0
  35. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts +65 -0
  36. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts.map +1 -0
  37. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.js +69 -0
  38. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +49 -0
  39. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -0
  40. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.js +34 -0
  41. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts +37 -0
  42. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts.map +1 -0
  43. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.js +48 -0
  44. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +49 -0
  45. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -0
  46. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.js +33 -0
  47. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +20 -0
  48. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -0
  49. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +42 -0
  50. package/dist/resolvers/index.d.ts +2 -0
  51. package/dist/resolvers/index.d.ts.map +1 -1
  52. package/dist/resolvers/index.js +2 -0
  53. package/dist/resolvers/workflowRunId.d.ts +6 -0
  54. package/dist/resolvers/workflowRunId.d.ts.map +1 -0
  55. package/dist/resolvers/workflowRunId.js +20 -0
  56. package/dist/resolvers/workflowVersionId.d.ts +6 -0
  57. package/dist/resolvers/workflowVersionId.d.ts.map +1 -0
  58. package/dist/resolvers/workflowVersionId.js +20 -0
  59. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { codeSubstrateDefaults } from "../shared";
4
+ import { PublishWorkflowVersionOptionsSchema, PublishWorkflowVersionResponseSchema, } from "./schemas";
5
+ export const publishWorkflowVersionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
6
+ ...codeSubstrateDefaults,
7
+ name: "publishWorkflowVersion",
8
+ type: "create",
9
+ itemType: "WorkflowVersion",
10
+ inputSchema: PublishWorkflowVersionOptionsSchema,
11
+ outputSchema: PublishWorkflowVersionResponseSchema,
12
+ resolvers: { workflow: workflowIdResolver },
13
+ handler: async ({ sdk, options }) => {
14
+ const body = {
15
+ source_files: options.source_files,
16
+ };
17
+ if (options.dependencies !== undefined) {
18
+ body.dependencies = options.dependencies;
19
+ }
20
+ if (options.zapier_durable_version !== undefined) {
21
+ body.zapier_durable_version = options.zapier_durable_version;
22
+ }
23
+ if (options.enabled !== undefined) {
24
+ body.enabled = options.enabled;
25
+ }
26
+ const raw = await sdk.context.api.post(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`, body, {
27
+ authRequired: true,
28
+ resource: { type: "workflow", id: options.workflow },
29
+ });
30
+ const data = PublishWorkflowVersionResponseSchema.parse(raw);
31
+ return { data };
32
+ },
33
+ }));
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export declare const PublishWorkflowVersionOptionsSchema: z.ZodObject<{
3
+ workflow: z.ZodString;
4
+ source_files: z.ZodRecord<z.ZodString, z.ZodString>;
5
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
6
+ zapier_durable_version: z.ZodOptional<z.ZodString>;
7
+ enabled: z.ZodOptional<z.ZodBoolean>;
8
+ }, z.core.$strip>;
9
+ export type PublishWorkflowVersionOptions = z.infer<typeof PublishWorkflowVersionOptionsSchema>;
10
+ export declare const PublishWorkflowVersionResponseSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ workflow_id: z.ZodString;
13
+ source_files: z.ZodRecord<z.ZodString, z.ZodString>;
14
+ zapier_durable_version: z.ZodString;
15
+ dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
16
+ created_by_user_id: z.ZodString;
17
+ created_at: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type PublishWorkflowVersionResponse = z.infer<typeof PublishWorkflowVersionResponseSchema>;
20
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +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;AAExB,eAAO,MAAM,mCAAmC;;;;;;iBA4B7C,CAAC;AAEJ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;iBAmB/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ export const PublishWorkflowVersionOptionsSchema = z
3
+ .object({
4
+ workflow: z.string().uuid().describe("Durable workflow ID"),
5
+ source_files: z
6
+ .record(z.string(), z.string())
7
+ .refine((files) => Object.keys(files).length > 0, {
8
+ message: "source_files must contain at least one file",
9
+ })
10
+ .describe("Source files keyed by filename → contents"),
11
+ dependencies: z
12
+ .record(z.string(), z.string())
13
+ .optional()
14
+ .describe("Optional npm package dependencies"),
15
+ zapier_durable_version: z
16
+ .string()
17
+ .optional()
18
+ .describe('Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"). Defaults to server-configured version if omitted.'),
19
+ enabled: z
20
+ .boolean()
21
+ .optional()
22
+ .describe("Enable the workflow after publishing. Defaults to true; pass false to publish without enabling."),
23
+ })
24
+ .describe("Publish a new version of a durable workflow. Enables the workflow by default.");
25
+ export const PublishWorkflowVersionResponseSchema = z.object({
26
+ id: z.string().describe("Workflow version ID (UUID)"),
27
+ workflow_id: z.string().describe("Parent workflow ID (UUID)"),
28
+ source_files: z
29
+ .record(z.string(), z.string())
30
+ .describe("Source files keyed by filename → contents"),
31
+ zapier_durable_version: z
32
+ .string()
33
+ .describe("Pinned semver of @zapier/zapier-durable used by this version's runs"),
34
+ dependencies: z
35
+ .record(z.string(), z.string())
36
+ .nullable()
37
+ .describe("Additional npm dependencies pinned for this version (or null)"),
38
+ created_by_user_id: z
39
+ .string()
40
+ .describe("ID of the user who published this version"),
41
+ created_at: z.string().describe("When the version was published (ISO-8601)"),
42
+ });
@@ -14,6 +14,8 @@ export { tableIdResolver } from "./tableId";
14
14
  export { triggerInboxResolver } from "./triggerInbox";
15
15
  export { workflowIdResolver } from "./workflowId";
16
16
  export { durableRunIdResolver } from "./durableRunId";
17
+ export { workflowVersionIdResolver } from "./workflowVersionId";
18
+ export { workflowRunIdResolver } from "./workflowRunId";
17
19
  export { triggerMessagesResolver } from "./triggerMessages";
18
20
  export { tableRecordIdResolver, tableRecordIdsResolver } from "./tableRecordId";
19
21
  export { tableFieldIdsResolver } from "./tableFieldIds";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAA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OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
@@ -16,6 +16,8 @@ export { tableIdResolver } from "./tableId";
16
16
  export { triggerInboxResolver } from "./triggerInbox";
17
17
  export { workflowIdResolver } from "./workflowId";
18
18
  export { durableRunIdResolver } from "./durableRunId";
19
+ export { workflowVersionIdResolver } from "./workflowVersionId";
20
+ export { workflowRunIdResolver } from "./workflowRunId";
19
21
  export { triggerMessagesResolver } from "./triggerMessages";
20
22
  export { tableRecordIdResolver, tableRecordIdsResolver } from "./tableRecordId";
21
23
  export { tableFieldIdsResolver } from "./tableFieldIds";
@@ -0,0 +1,6 @@
1
+ import type { DynamicResolver } from "../utils/schema-utils";
2
+ import type { WorkflowRunListItem } from "../plugins/codeSubstrate/listWorkflowRuns/schemas";
3
+ export declare const workflowRunIdResolver: DynamicResolver<WorkflowRunListItem, {
4
+ workflow: string;
5
+ }>;
6
+ //# sourceMappingURL=workflowRunId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowRunId.d.ts","sourceRoot":"","sources":["../../src/resolvers/workflowRunId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAY7F,eAAO,MAAM,qBAAqB,EAAE,eAAe,CACjD,mBAAmB,EACnB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAmBrB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { toIterable } from "../utils/pagination-utils";
2
+ // Dependent resolver — needs the parent workflow id to scope the run
3
+ // listing. The `workflow` input on consuming plugins is picker-only
4
+ // (the underlying API endpoint takes only the run id).
5
+ export const workflowRunIdResolver = {
6
+ type: "dynamic",
7
+ depends: ["workflow"],
8
+ fetch: async (sdk, params) => toIterable(sdk.listWorkflowRuns({
9
+ workflow: params.workflow,
10
+ })),
11
+ prompt: (runs) => ({
12
+ type: "list",
13
+ name: "run",
14
+ message: "Select a workflow run:",
15
+ choices: runs.map((r) => ({
16
+ name: `${r.id} — ${r.status}`,
17
+ value: r.id,
18
+ })),
19
+ }),
20
+ };
@@ -0,0 +1,6 @@
1
+ import type { DynamicResolver } from "../utils/schema-utils";
2
+ import type { WorkflowVersionListItem } from "../plugins/codeSubstrate/listWorkflowVersions/schemas";
3
+ export declare const workflowVersionIdResolver: DynamicResolver<WorkflowVersionListItem, {
4
+ workflow: string;
5
+ }>;
6
+ //# sourceMappingURL=workflowVersionId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowVersionId.d.ts","sourceRoot":"","sources":["../../src/resolvers/workflowVersionId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAarG,eAAO,MAAM,yBAAyB,EAAE,eAAe,CACrD,uBAAuB,EACvB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAmBrB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { toIterable } from "../utils/pagination-utils";
2
+ // Dependent resolver — needs the parent workflow id to fetch the
3
+ // version list. Picker shows versions newest-first per the backend
4
+ // ordering.
5
+ export const workflowVersionIdResolver = {
6
+ type: "dynamic",
7
+ depends: ["workflow"],
8
+ fetch: async (sdk, params) => toIterable(sdk.listWorkflowVersions({
9
+ workflow: params.workflow,
10
+ })),
11
+ prompt: (versions) => ({
12
+ type: "list",
13
+ name: "version",
14
+ message: "Select a workflow version:",
15
+ choices: versions.map((v) => ({
16
+ name: `${v.id} — ${v.zapier_durable_version}`,
17
+ value: v.id,
18
+ })),
19
+ }),
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.63.0",
3
+ "version": "0.65.0",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",