@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,43 @@
1
+ import { z } from "zod";
2
+ import { WorkflowRunStatusSchema } from "../listWorkflowRuns/schemas";
3
+ export const GetWorkflowRunOptionsSchema = z
4
+ .object({
5
+ // Picker-only field — the API endpoint is /workflows/runs/:id and
6
+ // does not take a workflow id, but the run-id picker is scoped to a
7
+ // parent workflow so the user can browse runs without enumerating
8
+ // every run across every workflow on the account.
9
+ workflow: z
10
+ .string()
11
+ .uuid()
12
+ .optional()
13
+ .describe("Parent workflow ID — used only to scope the CLI run-id picker; ignored by the API call."),
14
+ run: z.string().uuid().describe("Workflow run ID"),
15
+ })
16
+ .describe("Get the current state of a workflow run (a triggered execution of a deployed workflow)");
17
+ export const GetWorkflowRunResponseSchema = z.object({
18
+ id: z.string().describe("Workflow run ID (UUID)"),
19
+ trigger_id: z
20
+ .string()
21
+ .nullable()
22
+ .describe("ID of the trigger that fired this run, if any"),
23
+ durable_run_id: z
24
+ .string()
25
+ .nullable()
26
+ .describe("Linked sdkdurableapi run ID. Null until the durable run is created."),
27
+ workflow_version_id: z
28
+ .string()
29
+ .nullable()
30
+ .describe("Workflow version the run is bound to"),
31
+ status: WorkflowRunStatusSchema,
32
+ input: z.unknown().describe("Input passed to the run"),
33
+ output: z
34
+ .unknown()
35
+ .nullable()
36
+ .describe("Return value, present when status is `finished`"),
37
+ error: z
38
+ .unknown()
39
+ .nullable()
40
+ .describe("Error payload when status is `failed` (null otherwise)"),
41
+ created_at: z.string().describe("When the run was created (ISO-8601)"),
42
+ updated_at: z.string().describe("When the run was last updated (ISO-8601)"),
43
+ });
@@ -0,0 +1,46 @@
1
+ export declare const getWorkflowVersionPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ getWorkflowVersion: (options?: {
25
+ workflow: string;
26
+ version: string;
27
+ } | undefined) => Promise<{
28
+ data: {
29
+ id: string;
30
+ workflow_id: string;
31
+ source_files: Record<string, string>;
32
+ zapier_durable_version: string;
33
+ dependencies: Record<string, string> | null;
34
+ created_by_user_id: string;
35
+ created_at: string;
36
+ };
37
+ }>;
38
+ } & {
39
+ context: {
40
+ meta: {
41
+ getWorkflowVersion: import("../../..").PluginMeta;
42
+ };
43
+ };
44
+ };
45
+ export type GetWorkflowVersionPluginProvides = ReturnType<typeof getWorkflowVersionPlugin>;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getWorkflowVersion/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,UAAU,CACvD,OAAO,wBAAwB,CAChC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { workflowVersionIdResolver } from "../../../resolvers/workflowVersionId";
4
+ import { codeSubstrateDefaults } from "../shared";
5
+ import { GetWorkflowVersionOptionsSchema, GetWorkflowVersionResponseSchema, } from "./schemas";
6
+ export const getWorkflowVersionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
7
+ ...codeSubstrateDefaults,
8
+ name: "getWorkflowVersion",
9
+ type: "item",
10
+ itemType: "WorkflowVersion",
11
+ inputSchema: GetWorkflowVersionOptionsSchema,
12
+ outputSchema: GetWorkflowVersionResponseSchema,
13
+ resolvers: {
14
+ workflow: workflowIdResolver,
15
+ version: workflowVersionIdResolver,
16
+ },
17
+ handler: async ({ sdk, options }) => {
18
+ const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions/${encodeURIComponent(options.version)}`, {
19
+ authRequired: true,
20
+ resource: { type: "workflow-version", id: options.version },
21
+ });
22
+ const data = GetWorkflowVersionResponseSchema.parse(raw);
23
+ return { data };
24
+ },
25
+ }));
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ export declare const GetWorkflowVersionOptionsSchema: z.ZodObject<{
3
+ workflow: z.ZodString;
4
+ version: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type GetWorkflowVersionOptions = z.infer<typeof GetWorkflowVersionOptionsSchema>;
7
+ export declare const GetWorkflowVersionResponseSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ workflow_id: z.ZodString;
10
+ source_files: z.ZodRecord<z.ZodString, z.ZodString>;
11
+ zapier_durable_version: z.ZodString;
12
+ dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
13
+ created_by_user_id: z.ZodString;
14
+ created_at: z.ZodString;
15
+ }, z.core.$strip>;
16
+ export type GetWorkflowVersionResponse = z.infer<typeof GetWorkflowVersionResponseSchema>;
17
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getWorkflowVersion/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,+BAA+B;;;iBAKgC,CAAC;AAE7E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;iBAmB3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ export const GetWorkflowVersionOptionsSchema = z
3
+ .object({
4
+ workflow: z.string().uuid().describe("Durable workflow ID"),
5
+ version: z.string().uuid().describe("Workflow version ID"),
6
+ })
7
+ .describe("Get full details of a workflow version including source files");
8
+ export const GetWorkflowVersionResponseSchema = z.object({
9
+ id: z.string().describe("Workflow version ID (UUID)"),
10
+ workflow_id: z.string().describe("Parent workflow ID (UUID)"),
11
+ source_files: z
12
+ .record(z.string(), z.string())
13
+ .describe("Source files keyed by filename → contents"),
14
+ zapier_durable_version: z
15
+ .string()
16
+ .describe("Pinned semver of @zapier/zapier-durable used by this version's runs"),
17
+ dependencies: z
18
+ .record(z.string(), z.string())
19
+ .nullable()
20
+ .describe("Additional npm dependencies pinned for this version (or null)"),
21
+ created_by_user_id: z
22
+ .string()
23
+ .describe("ID of the user who published this version"),
24
+ created_at: z.string().describe("When the version was published (ISO-8601)"),
25
+ });
@@ -0,0 +1,53 @@
1
+ export declare const listWorkflowRunsPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ listWorkflowRuns: (options?: ({
25
+ workflow: string;
26
+ pageSize?: number | undefined;
27
+ cursor?: string | undefined;
28
+ maxItems?: number | undefined;
29
+ } & {
30
+ cursor?: string;
31
+ pageSize?: number;
32
+ maxItems?: number;
33
+ }) | undefined) => import("../../..").PaginatedSdkResult<{
34
+ id: string;
35
+ trigger_id: string | null;
36
+ durable_run_id: string | null;
37
+ workflow_version_id: string | null;
38
+ status: string;
39
+ input: unknown;
40
+ output: unknown;
41
+ error: unknown;
42
+ created_at: string;
43
+ updated_at: string;
44
+ }>;
45
+ } & {
46
+ context: {
47
+ meta: {
48
+ listWorkflowRuns: import("../../..").PluginMeta;
49
+ };
50
+ };
51
+ };
52
+ export type ListWorkflowRunsPluginProvides = ReturnType<typeof listWorkflowRunsPlugin>;
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listWorkflowRuns/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkClC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,UAAU,CACrD,OAAO,sBAAsB,CAC9B,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { definePlugin, createPaginatedPluginMethod, } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { DEFAULT_PAGE_SIZE } from "../../../constants";
4
+ import { codeSubstrateDefaults } from "../shared";
5
+ import { ListWorkflowRunsApiResponseSchema, ListWorkflowRunsOptionsSchema, WorkflowRunListItemSchema, } from "./schemas";
6
+ export const listWorkflowRunsPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
7
+ ...codeSubstrateDefaults,
8
+ name: "listWorkflowRuns",
9
+ type: "list",
10
+ itemType: "WorkflowRun",
11
+ inputSchema: ListWorkflowRunsOptionsSchema,
12
+ outputSchema: WorkflowRunListItemSchema,
13
+ defaultPageSize: DEFAULT_PAGE_SIZE,
14
+ resolvers: { workflow: workflowIdResolver },
15
+ handler: async ({ sdk, options }) => {
16
+ const searchParams = {};
17
+ if (options.pageSize !== undefined) {
18
+ searchParams.limit = options.pageSize.toString();
19
+ }
20
+ if (options.cursor) {
21
+ searchParams.cursor = options.cursor;
22
+ }
23
+ const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/runs`, {
24
+ searchParams,
25
+ authRequired: true,
26
+ resource: { type: "workflow", id: options.workflow },
27
+ });
28
+ const response = ListWorkflowRunsApiResponseSchema.parse(raw);
29
+ return {
30
+ data: response.results,
31
+ nextCursor: response.meta.next_cursor ?? undefined,
32
+ };
33
+ },
34
+ }));
@@ -0,0 +1,65 @@
1
+ import { z } from "zod";
2
+ export declare const WorkflowRunStatusSchema: z.ZodUnion<readonly [z.ZodEnum<{
3
+ initialized: "initialized";
4
+ started: "started";
5
+ finished: "finished";
6
+ failed: "failed";
7
+ cancelled: "cancelled";
8
+ }>, z.ZodString]>;
9
+ export type WorkflowRunStatus = z.infer<typeof WorkflowRunStatusSchema>;
10
+ export declare const WorkflowRunListItemSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ trigger_id: z.ZodNullable<z.ZodString>;
13
+ durable_run_id: z.ZodNullable<z.ZodString>;
14
+ workflow_version_id: z.ZodNullable<z.ZodString>;
15
+ status: z.ZodUnion<readonly [z.ZodEnum<{
16
+ initialized: "initialized";
17
+ started: "started";
18
+ finished: "finished";
19
+ failed: "failed";
20
+ cancelled: "cancelled";
21
+ }>, z.ZodString]>;
22
+ input: z.ZodUnknown;
23
+ output: z.ZodNullable<z.ZodUnknown>;
24
+ error: z.ZodNullable<z.ZodUnknown>;
25
+ created_at: z.ZodString;
26
+ updated_at: z.ZodString;
27
+ }, z.core.$strip>;
28
+ export type WorkflowRunListItem = z.infer<typeof WorkflowRunListItemSchema>;
29
+ export declare const ListWorkflowRunsOptionsSchema: z.ZodObject<{
30
+ workflow: z.ZodString;
31
+ pageSize: z.ZodOptional<z.ZodNumber>;
32
+ cursor: z.ZodOptional<z.ZodString>;
33
+ maxItems: z.ZodOptional<z.ZodNumber>;
34
+ }, z.core.$strip>;
35
+ export type ListWorkflowRunsOptions = z.infer<typeof ListWorkflowRunsOptionsSchema>;
36
+ export declare const ListWorkflowRunsApiResponseSchema: z.ZodObject<{
37
+ results: z.ZodArray<z.ZodObject<{
38
+ id: z.ZodString;
39
+ trigger_id: z.ZodNullable<z.ZodString>;
40
+ durable_run_id: z.ZodNullable<z.ZodString>;
41
+ workflow_version_id: z.ZodNullable<z.ZodString>;
42
+ status: z.ZodUnion<readonly [z.ZodEnum<{
43
+ initialized: "initialized";
44
+ started: "started";
45
+ finished: "finished";
46
+ failed: "failed";
47
+ cancelled: "cancelled";
48
+ }>, z.ZodString]>;
49
+ input: z.ZodUnknown;
50
+ output: z.ZodNullable<z.ZodUnknown>;
51
+ error: z.ZodNullable<z.ZodUnknown>;
52
+ created_at: z.ZodString;
53
+ updated_at: z.ZodString;
54
+ }, z.core.$strip>>;
55
+ meta: z.ZodObject<{
56
+ limit: z.ZodNumber;
57
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ }, z.core.$strip>;
60
+ links: z.ZodOptional<z.ZodObject<{
61
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>;
64
+ export type ListWorkflowRunsApiResponse = z.infer<typeof ListWorkflowRunsApiResponseSchema>;
65
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listWorkflowRuns/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,uBAAuB;;;;;;iBAOjC,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;iBA8BpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,6BAA6B;;;;;iBAoBvC,CAAC;AAEJ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAY5C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ // Open enum: known values listed for docs / TS autocomplete; string
3
+ // fallback lets new server-side states (e.g. "paused") flow through
4
+ // without breaking .parse() on the response.
5
+ export const WorkflowRunStatusSchema = z
6
+ .union([
7
+ z.enum(["initialized", "started", "finished", "failed", "cancelled"]),
8
+ z.string(),
9
+ ])
10
+ .describe("Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal.");
11
+ export const WorkflowRunListItemSchema = z.object({
12
+ id: z.string().describe("Workflow run ID (UUID)"),
13
+ trigger_id: z
14
+ .string()
15
+ .nullable()
16
+ .describe("ID of the trigger that fired this run, if any. Null for runs created without a trigger."),
17
+ durable_run_id: z
18
+ .string()
19
+ .nullable()
20
+ .describe("Linked sdkdurableapi run ID. Null until the durable run is created."),
21
+ workflow_version_id: z
22
+ .string()
23
+ .nullable()
24
+ .describe("Workflow version the run is bound to. Null in rare edge cases."),
25
+ status: WorkflowRunStatusSchema,
26
+ input: z.unknown().describe("Input passed to the run"),
27
+ output: z
28
+ .unknown()
29
+ .nullable()
30
+ .describe("Return value, present when status is `finished`"),
31
+ error: z
32
+ .unknown()
33
+ .nullable()
34
+ .describe("Error payload when status is `failed` (null otherwise)"),
35
+ created_at: z.string().describe("When the run was created (ISO-8601)"),
36
+ updated_at: z.string().describe("When the run was last updated (ISO-8601)"),
37
+ });
38
+ export const ListWorkflowRunsOptionsSchema = z
39
+ .object({
40
+ workflow: z.string().uuid().describe("Durable workflow ID"),
41
+ pageSize: z
42
+ .number()
43
+ .int()
44
+ .min(1)
45
+ .max(100)
46
+ .optional()
47
+ .describe("Number of runs per page (max 100)"),
48
+ cursor: z.string().optional().describe("Pagination cursor"),
49
+ maxItems: z
50
+ .number()
51
+ .int()
52
+ .min(1)
53
+ .optional()
54
+ .describe("Maximum total runs to return across all pages"),
55
+ })
56
+ .describe("List workflow runs (triggered executions) for a specific deployed workflow, newest first");
57
+ export const ListWorkflowRunsApiResponseSchema = z.object({
58
+ results: z.array(WorkflowRunListItemSchema),
59
+ meta: z.object({
60
+ limit: z.number(),
61
+ cursor: z.string().nullable().optional(),
62
+ next_cursor: z.string().nullable().optional(),
63
+ }),
64
+ links: z
65
+ .object({
66
+ next: z.string().nullable().optional(),
67
+ })
68
+ .optional(),
69
+ });
@@ -0,0 +1,49 @@
1
+ export declare const listWorkflowVersionsPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ listWorkflowVersions: (options?: ({
25
+ workflow: string;
26
+ pageSize?: number | undefined;
27
+ cursor?: string | undefined;
28
+ maxItems?: number | undefined;
29
+ } & {
30
+ cursor?: string;
31
+ pageSize?: number;
32
+ maxItems?: number;
33
+ }) | undefined) => import("../../..").PaginatedSdkResult<{
34
+ id: string;
35
+ workflow_id: string;
36
+ zapier_durable_version: string;
37
+ dependencies: Record<string, string> | null;
38
+ created_by_user_id: string;
39
+ created_at: string;
40
+ }>;
41
+ } & {
42
+ context: {
43
+ meta: {
44
+ listWorkflowVersions: import("../../..").PluginMeta;
45
+ };
46
+ };
47
+ };
48
+ export type ListWorkflowVersionsPluginProvides = ReturnType<typeof listWorkflowVersionsPlugin>;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listWorkflowVersions/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCtC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,UAAU,CACzD,OAAO,0BAA0B,CAClC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { definePlugin, createPaginatedPluginMethod, } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { DEFAULT_PAGE_SIZE } from "../../../constants";
4
+ import { codeSubstrateDefaults } from "../shared";
5
+ import { ListWorkflowVersionsApiResponseSchema, ListWorkflowVersionsOptionsSchema, WorkflowVersionListItemSchema, } from "./schemas";
6
+ export const listWorkflowVersionsPlugin = definePlugin((sdk) => createPaginatedPluginMethod(sdk, {
7
+ ...codeSubstrateDefaults,
8
+ name: "listWorkflowVersions",
9
+ type: "list",
10
+ itemType: "WorkflowVersion",
11
+ inputSchema: ListWorkflowVersionsOptionsSchema,
12
+ outputSchema: WorkflowVersionListItemSchema,
13
+ defaultPageSize: DEFAULT_PAGE_SIZE,
14
+ resolvers: { workflow: workflowIdResolver },
15
+ handler: async ({ sdk, options }) => {
16
+ const searchParams = {};
17
+ if (options.pageSize !== undefined) {
18
+ searchParams.limit = options.pageSize.toString();
19
+ }
20
+ if (options.cursor) {
21
+ searchParams.cursor = options.cursor;
22
+ }
23
+ const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/${encodeURIComponent(options.workflow)}/versions`, {
24
+ searchParams,
25
+ authRequired: true,
26
+ resource: { type: "workflow", id: options.workflow },
27
+ });
28
+ const response = ListWorkflowVersionsApiResponseSchema.parse(raw);
29
+ return {
30
+ data: response.results,
31
+ nextCursor: response.meta.next_cursor ?? undefined,
32
+ };
33
+ },
34
+ }));
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ export declare const WorkflowVersionListItemSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ workflow_id: z.ZodString;
5
+ zapier_durable_version: z.ZodString;
6
+ dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
7
+ created_by_user_id: z.ZodString;
8
+ created_at: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export type WorkflowVersionListItem = z.infer<typeof WorkflowVersionListItemSchema>;
11
+ export declare const ListWorkflowVersionsOptionsSchema: z.ZodObject<{
12
+ workflow: z.ZodString;
13
+ pageSize: z.ZodOptional<z.ZodNumber>;
14
+ cursor: z.ZodOptional<z.ZodString>;
15
+ maxItems: z.ZodOptional<z.ZodNumber>;
16
+ }, z.core.$strip>;
17
+ export type ListWorkflowVersionsOptions = z.infer<typeof ListWorkflowVersionsOptionsSchema>;
18
+ export declare const ListWorkflowVersionsApiResponseSchema: z.ZodObject<{
19
+ results: z.ZodArray<z.ZodObject<{
20
+ id: z.ZodString;
21
+ workflow_id: z.ZodString;
22
+ zapier_durable_version: z.ZodString;
23
+ dependencies: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
24
+ created_by_user_id: z.ZodString;
25
+ created_at: z.ZodString;
26
+ }, z.core.$strip>>;
27
+ meta: z.ZodObject<{
28
+ limit: z.ZodNumber;
29
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ }, z.core.$strip>;
32
+ links: z.ZodOptional<z.ZodObject<{
33
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$strip>;
36
+ export type ListWorkflowVersionsApiResponse = z.infer<typeof ListWorkflowVersionsApiResponseSchema>;
37
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/listWorkflowVersions/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B;;;;;;;iBAgBxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;iBAkBqB,CAAC;AAEpE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;iBAYhD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,qCAAqC,CAC7C,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export const WorkflowVersionListItemSchema = z.object({
3
+ id: z.string().describe("Workflow version ID (UUID)"),
4
+ workflow_id: z.string().describe("Parent workflow ID (UUID)"),
5
+ zapier_durable_version: z
6
+ .string()
7
+ .describe("Pinned semver of @zapier/zapier-durable used by this version's runs"),
8
+ dependencies: z
9
+ .record(z.string(), z.string())
10
+ .nullable()
11
+ .describe("Additional npm dependencies pinned for this version (or null)"),
12
+ created_by_user_id: z
13
+ .string()
14
+ .describe("ID of the user who published this version"),
15
+ created_at: z.string().describe("When the version was published (ISO-8601)"),
16
+ });
17
+ export const ListWorkflowVersionsOptionsSchema = z
18
+ .object({
19
+ workflow: z.string().uuid().describe("Durable workflow ID"),
20
+ pageSize: z
21
+ .number()
22
+ .int()
23
+ .min(1)
24
+ .max(100)
25
+ .optional()
26
+ .describe("Number of versions per page (max 100)"),
27
+ cursor: z.string().optional().describe("Pagination cursor"),
28
+ maxItems: z
29
+ .number()
30
+ .int()
31
+ .min(1)
32
+ .optional()
33
+ .describe("Maximum total versions to return across all pages"),
34
+ })
35
+ .describe("List published versions for a workflow, newest first");
36
+ export const ListWorkflowVersionsApiResponseSchema = z.object({
37
+ results: z.array(WorkflowVersionListItemSchema),
38
+ meta: z.object({
39
+ limit: z.number(),
40
+ cursor: z.string().nullable().optional(),
41
+ next_cursor: z.string().nullable().optional(),
42
+ }),
43
+ links: z
44
+ .object({
45
+ next: z.string().nullable().optional(),
46
+ })
47
+ .optional(),
48
+ });
@@ -0,0 +1,49 @@
1
+ export declare const publishWorkflowVersionPlugin: (sdk: {
2
+ context: {
3
+ api: import("../../..").ApiClient;
4
+ resolveCredentials: () => Promise<string | {
5
+ clientId: string;
6
+ clientSecret: string;
7
+ type?: "client_credentials" | undefined;
8
+ baseUrl?: string | undefined;
9
+ scope?: string | undefined;
10
+ } | {
11
+ clientId: string;
12
+ type?: "pkce" | undefined;
13
+ baseUrl?: string | undefined;
14
+ scope?: string | undefined;
15
+ } | undefined>;
16
+ };
17
+ } & {
18
+ context: import("../../eventEmission").EventEmissionContext;
19
+ } & {
20
+ context: {
21
+ meta: Record<string, import("../../..").PluginMeta>;
22
+ };
23
+ }) => {
24
+ publishWorkflowVersion: (options?: {
25
+ workflow: string;
26
+ source_files: Record<string, string>;
27
+ dependencies?: Record<string, string> | undefined;
28
+ zapier_durable_version?: string | undefined;
29
+ enabled?: boolean | undefined;
30
+ } | undefined) => Promise<{
31
+ data: {
32
+ id: string;
33
+ workflow_id: string;
34
+ source_files: Record<string, string>;
35
+ zapier_durable_version: string;
36
+ dependencies: Record<string, string> | null;
37
+ created_by_user_id: string;
38
+ created_at: string;
39
+ };
40
+ }>;
41
+ } & {
42
+ context: {
43
+ meta: {
44
+ publishWorkflowVersion: import("../../..").PluginMeta;
45
+ };
46
+ };
47
+ };
48
+ export type PublishWorkflowVersionPluginProvides = ReturnType<typeof publishWorkflowVersionPlugin>;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/publishWorkflowVersion/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCxC,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAC3D,OAAO,4BAA4B,CACpC,CAAC"}