@zapier/zapier-sdk 0.64.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 (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +129 -0
  3. package/dist/experimental.cjs +198 -2
  4. package/dist/experimental.d.mts +76 -2
  5. package/dist/experimental.d.ts +74 -0
  6. package/dist/experimental.d.ts.map +1 -1
  7. package/dist/experimental.js +6 -0
  8. package/dist/experimental.mjs +198 -3
  9. package/dist/{index-Bfvj0KLi.d.mts → index-JhNxS_mq.d.mts} +25 -1
  10. package/dist/{index-Bfvj0KLi.d.ts → index-JhNxS_mq.d.ts} +25 -1
  11. package/dist/index.cjs +22 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +22 -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/listWorkflowRuns/index.d.ts +53 -0
  27. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -0
  28. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.js +34 -0
  29. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts +65 -0
  30. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts.map +1 -0
  31. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.js +69 -0
  32. package/dist/resolvers/index.d.ts +1 -0
  33. package/dist/resolvers/index.d.ts.map +1 -1
  34. package/dist/resolvers/index.js +1 -0
  35. package/dist/resolvers/workflowRunId.d.ts +6 -0
  36. package/dist/resolvers/workflowRunId.d.ts.map +1 -0
  37. package/dist/resolvers/workflowRunId.js +20 -0
  38. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ export declare const getTriggerRunPlugin: (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
+ getTriggerRun: (options?: {
25
+ trigger: string;
26
+ } | undefined) => Promise<{
27
+ data: {
28
+ id: string;
29
+ durable_run_id: string | null;
30
+ workflow_version_id: string | null;
31
+ status: string;
32
+ input: unknown;
33
+ output: unknown;
34
+ error: unknown;
35
+ created_at: string;
36
+ updated_at: string;
37
+ };
38
+ }>;
39
+ } & {
40
+ context: {
41
+ meta: {
42
+ getTriggerRun: import("../../..").PluginMeta;
43
+ };
44
+ };
45
+ };
46
+ export type GetTriggerRunPluginProvides = ReturnType<typeof getTriggerRunPlugin>;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getTriggerRun/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyB/B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAClD,OAAO,mBAAmB,CAC3B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { codeSubstrateDefaults } from "../shared";
3
+ import { GetTriggerRunOptionsSchema, GetTriggerRunResponseSchema, } from "./schemas";
4
+ export const getTriggerRunPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
5
+ ...codeSubstrateDefaults,
6
+ name: "getTriggerRun",
7
+ type: "item",
8
+ itemType: "WorkflowRun",
9
+ inputSchema: GetTriggerRunOptionsSchema,
10
+ outputSchema: GetTriggerRunResponseSchema,
11
+ // No resolver for `trigger` — users typically have the trigger id
12
+ // from a recent trigger fire and pass it directly. Authoring a
13
+ // picker would require listing triggers across all workflows,
14
+ // which has no clean entry point today.
15
+ handler: async ({ sdk, options }) => {
16
+ const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/triggers/${encodeURIComponent(options.trigger)}/run`, {
17
+ authRequired: true,
18
+ resource: { type: "workflow-trigger", id: options.trigger },
19
+ });
20
+ const data = GetTriggerRunResponseSchema.parse(raw);
21
+ return { data };
22
+ },
23
+ }));
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ export declare const GetTriggerRunOptionsSchema: z.ZodObject<{
3
+ trigger: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type GetTriggerRunOptions = z.infer<typeof GetTriggerRunOptionsSchema>;
6
+ export declare const GetTriggerRunResponseSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ durable_run_id: z.ZodNullable<z.ZodString>;
9
+ workflow_version_id: z.ZodNullable<z.ZodString>;
10
+ status: z.ZodUnion<readonly [z.ZodEnum<{
11
+ initialized: "initialized";
12
+ started: "started";
13
+ finished: "finished";
14
+ failed: "failed";
15
+ cancelled: "cancelled";
16
+ }>, z.ZodString]>;
17
+ input: z.ZodUnknown;
18
+ output: z.ZodNullable<z.ZodUnknown>;
19
+ error: z.ZodNullable<z.ZodUnknown>;
20
+ created_at: z.ZodString;
21
+ updated_at: z.ZodString;
22
+ }, z.core.$strip>;
23
+ export type GetTriggerRunResponse = z.infer<typeof GetTriggerRunResponseSchema>;
24
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getTriggerRun/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B;;iBAMpC,CAAC;AAEJ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;iBAwBtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import { WorkflowRunStatusSchema } from "../listWorkflowRuns/schemas";
3
+ export const GetTriggerRunOptionsSchema = z
4
+ .object({
5
+ trigger: z.string().uuid().describe("Workflow trigger ID"),
6
+ })
7
+ .describe("Get the workflow run associated with a deployed workflow's trigger. Useful immediately after firing a trigger, when you have the trigger ID but not yet the run ID.");
8
+ export const GetTriggerRunResponseSchema = z.object({
9
+ id: z.string().describe("Workflow run ID (UUID)"),
10
+ durable_run_id: z
11
+ .string()
12
+ .nullable()
13
+ .describe("Linked sdkdurableapi run ID. Null until the durable run is created."),
14
+ workflow_version_id: z
15
+ .string()
16
+ .nullable()
17
+ .describe("Workflow version the run is bound to"),
18
+ status: WorkflowRunStatusSchema,
19
+ input: z.unknown().describe("Input passed to the run"),
20
+ output: z
21
+ .unknown()
22
+ .nullable()
23
+ .describe("Return value, present when status is `finished`"),
24
+ error: z
25
+ .unknown()
26
+ .nullable()
27
+ .describe("Error payload when status is `failed` (null otherwise)"),
28
+ created_at: z.string().describe("When the run was created (ISO-8601)"),
29
+ updated_at: z.string().describe("When the run was last updated (ISO-8601)"),
30
+ });
@@ -0,0 +1,49 @@
1
+ export declare const getWorkflowRunPlugin: (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
+ getWorkflowRun: (options?: {
25
+ run: string;
26
+ workflow?: string | undefined;
27
+ } | undefined) => Promise<{
28
+ data: {
29
+ id: string;
30
+ trigger_id: string | null;
31
+ durable_run_id: string | null;
32
+ workflow_version_id: string | null;
33
+ status: string;
34
+ input: unknown;
35
+ output: unknown;
36
+ error: unknown;
37
+ created_at: string;
38
+ updated_at: string;
39
+ };
40
+ }>;
41
+ } & {
42
+ context: {
43
+ meta: {
44
+ getWorkflowRun: import("../../..").PluginMeta;
45
+ };
46
+ };
47
+ };
48
+ export type GetWorkflowRunPluginProvides = ReturnType<typeof getWorkflowRunPlugin>;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getWorkflowRun/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBhC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { definePlugin, createPluginMethod } from "../../../utils/plugin-utils";
2
+ import { workflowIdResolver } from "../../../resolvers/workflowId";
3
+ import { workflowRunIdResolver } from "../../../resolvers/workflowRunId";
4
+ import { codeSubstrateDefaults } from "../shared";
5
+ import { GetWorkflowRunOptionsSchema, GetWorkflowRunResponseSchema, } from "./schemas";
6
+ export const getWorkflowRunPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
7
+ ...codeSubstrateDefaults,
8
+ name: "getWorkflowRun",
9
+ type: "item",
10
+ itemType: "WorkflowRun",
11
+ inputSchema: GetWorkflowRunOptionsSchema,
12
+ outputSchema: GetWorkflowRunResponseSchema,
13
+ resolvers: {
14
+ workflow: workflowIdResolver,
15
+ run: workflowRunIdResolver,
16
+ },
17
+ handler: async ({ sdk, options }) => {
18
+ const raw = await sdk.context.api.get(`/durableworkflowzaps/api/v0/workflows/runs/${encodeURIComponent(options.run)}`, {
19
+ authRequired: true,
20
+ resource: { type: "workflow-run", id: options.run },
21
+ });
22
+ const data = GetWorkflowRunResponseSchema.parse(raw);
23
+ return { data };
24
+ },
25
+ }));
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ export declare const GetWorkflowRunOptionsSchema: z.ZodObject<{
3
+ workflow: z.ZodOptional<z.ZodString>;
4
+ run: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type GetWorkflowRunOptions = z.infer<typeof GetWorkflowRunOptionsSchema>;
7
+ export declare const GetWorkflowRunResponseSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ trigger_id: z.ZodNullable<z.ZodString>;
10
+ durable_run_id: z.ZodNullable<z.ZodString>;
11
+ workflow_version_id: z.ZodNullable<z.ZodString>;
12
+ status: z.ZodUnion<readonly [z.ZodEnum<{
13
+ initialized: "initialized";
14
+ started: "started";
15
+ finished: "finished";
16
+ failed: "failed";
17
+ cancelled: "cancelled";
18
+ }>, z.ZodString]>;
19
+ input: z.ZodUnknown;
20
+ output: z.ZodNullable<z.ZodUnknown>;
21
+ error: z.ZodNullable<z.ZodUnknown>;
22
+ created_at: z.ZodString;
23
+ updated_at: z.ZodString;
24
+ }, z.core.$strip>;
25
+ export type GetWorkflowRunResponse = z.infer<typeof GetWorkflowRunResponseSchema>;
26
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/getWorkflowRun/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,2BAA2B;;;iBAiBrC,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;iBA4BvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC"}
@@ -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,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
+ });
@@ -15,6 +15,7 @@ export { triggerInboxResolver } from "./triggerInbox";
15
15
  export { workflowIdResolver } from "./workflowId";
16
16
  export { durableRunIdResolver } from "./durableRunId";
17
17
  export { workflowVersionIdResolver } from "./workflowVersionId";
18
+ export { workflowRunIdResolver } from "./workflowRunId";
18
19
  export { triggerMessagesResolver } from "./triggerMessages";
19
20
  export { tableRecordIdResolver, tableRecordIdsResolver } from "./tableRecordId";
20
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,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,mDAAmD;AACnD,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAClF,0DAA0D;AAC1D,OAAO,EAAE,2BAA2B,IAAI,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
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,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,mDAAmD;AACnD,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAClF,0DAA0D;AAC1D,OAAO,EAAE,2BAA2B,IAAI,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
@@ -17,6 +17,7 @@ export { triggerInboxResolver } from "./triggerInbox";
17
17
  export { workflowIdResolver } from "./workflowId";
18
18
  export { durableRunIdResolver } from "./durableRunId";
19
19
  export { workflowVersionIdResolver } from "./workflowVersionId";
20
+ export { workflowRunIdResolver } from "./workflowRunId";
20
21
  export { triggerMessagesResolver } from "./triggerMessages";
21
22
  export { tableRecordIdResolver, tableRecordIdsResolver } from "./tableRecordId";
22
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.64.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",