@zapier/zapier-sdk 0.70.4 → 0.71.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 (81) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +149 -31
  3. package/dist/api/approval-review-stream.d.ts +25 -0
  4. package/dist/api/approval-review-stream.d.ts.map +1 -0
  5. package/dist/api/approval-review-stream.js +104 -0
  6. package/dist/api/client.d.ts.map +1 -1
  7. package/dist/api/client.js +215 -27
  8. package/dist/api/types.d.ts +13 -3
  9. package/dist/api/types.d.ts.map +1 -1
  10. package/dist/constants.d.ts +1 -0
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +6 -0
  13. package/dist/experimental.cjs +602 -37
  14. package/dist/experimental.d.mts +88 -2
  15. package/dist/experimental.d.ts +90 -4
  16. package/dist/experimental.d.ts.map +1 -1
  17. package/dist/experimental.js +10 -0
  18. package/dist/experimental.mjs +602 -38
  19. package/dist/{index-BNaiNmM-.d.mts → index-B43uST61.d.mts} +181 -12
  20. package/dist/{index-BNaiNmM-.d.ts → index-B43uST61.d.ts} +181 -12
  21. package/dist/index.cjs +592 -32
  22. package/dist/index.d.mts +1 -1
  23. package/dist/index.mjs +592 -33
  24. package/dist/plugins/api/index.d.ts.map +1 -1
  25. package/dist/plugins/api/index.js +2 -1
  26. package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +1 -0
  27. package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -1
  28. package/dist/plugins/codeSubstrate/createWorkflow/index.js +3 -2
  29. package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts +1 -0
  30. package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts.map +1 -1
  31. package/dist/plugins/codeSubstrate/createWorkflow/schemas.js +7 -1
  32. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +1 -1
  33. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +1 -1
  34. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +1 -1
  35. package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +4 -4
  36. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +2 -2
  37. package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts +1 -1
  38. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +1 -1
  39. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +1 -1
  40. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +1 -1
  41. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +1 -1
  42. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +1 -1
  43. package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts +2 -2
  44. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +1 -1
  45. package/dist/plugins/codeSubstrate/runDurable/schemas.js +1 -1
  46. package/dist/plugins/codeSubstrate/shared-schemas.d.ts +2 -2
  47. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +1 -1
  48. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +1 -1
  49. package/dist/plugins/createConnection/index.d.ts +189 -0
  50. package/dist/plugins/createConnection/index.d.ts.map +1 -0
  51. package/dist/plugins/createConnection/index.js +71 -0
  52. package/dist/plugins/createConnection/schemas.d.ts +21 -0
  53. package/dist/plugins/createConnection/schemas.d.ts.map +1 -0
  54. package/dist/plugins/createConnection/schemas.js +38 -0
  55. package/dist/plugins/getConnectionStartUrl/index.d.ts +206 -0
  56. package/dist/plugins/getConnectionStartUrl/index.d.ts.map +1 -0
  57. package/dist/plugins/getConnectionStartUrl/index.js +39 -0
  58. package/dist/plugins/getConnectionStartUrl/schemas.d.ts +15 -0
  59. package/dist/plugins/getConnectionStartUrl/schemas.d.ts.map +1 -0
  60. package/dist/plugins/getConnectionStartUrl/schemas.js +23 -0
  61. package/dist/plugins/waitForNewConnection/index.d.ts +209 -0
  62. package/dist/plugins/waitForNewConnection/index.d.ts.map +1 -0
  63. package/dist/plugins/waitForNewConnection/index.js +75 -0
  64. package/dist/plugins/waitForNewConnection/schemas.d.ts +17 -0
  65. package/dist/plugins/waitForNewConnection/schemas.d.ts.map +1 -0
  66. package/dist/plugins/waitForNewConnection/schemas.js +39 -0
  67. package/dist/sdk.d.ts +126 -0
  68. package/dist/sdk.d.ts.map +1 -1
  69. package/dist/sdk.js +8 -0
  70. package/dist/types/errors.d.ts +13 -4
  71. package/dist/types/errors.d.ts.map +1 -1
  72. package/dist/types/errors.js +2 -0
  73. package/dist/types/sdk.d.ts +1 -0
  74. package/dist/types/sdk.d.ts.map +1 -1
  75. package/dist/types/sdk.js +5 -1
  76. package/dist/utils/open-url.d.ts.map +1 -1
  77. package/dist/utils/open-url.js +7 -0
  78. package/dist/utils/should-open-browser.d.ts +24 -0
  79. package/dist/utils/should-open-browser.d.ts.map +1 -0
  80. package/dist/utils/should-open-browser.js +55 -0
  81. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAUtD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,eAAO,MAAM,SAAS;aACH;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;CA+C7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAUtD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,eAAO,MAAM,SAAS;aACH;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;CAiD7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
@@ -4,7 +4,7 @@ import { resolveCredentials } from "../../credentials";
4
4
  import { ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, } from "../../constants";
5
5
  export const apiPlugin = definePlugin((sdk) => {
6
6
  // Extract all options - everything passed to the plugin
7
- const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, maxConcurrentRequests = ZAPIER_MAX_CONCURRENT_REQUESTS, approvalTimeoutMs, maxApprovalRetries, approvalMode, callerPackage, } = sdk.context.options;
7
+ const { fetch: customFetch = globalThis.fetch, baseUrl = ZAPIER_BASE_URL, credentials, token, onEvent, debug = false, maxNetworkRetries = ZAPIER_MAX_NETWORK_RETRIES, maxNetworkRetryDelayMs = ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, maxConcurrentRequests = ZAPIER_MAX_CONCURRENT_REQUESTS, approvalTimeoutMs, maxApprovalRetries, approvalMode, openAutoModeApprovalsInBrowser, callerPackage, } = sdk.context.options;
8
8
  // Create the API client - it will handle token resolution internally
9
9
  const api = createZapierApi({
10
10
  baseUrl,
@@ -19,6 +19,7 @@ export const apiPlugin = definePlugin((sdk) => {
19
19
  approvalTimeoutMs,
20
20
  maxApprovalRetries,
21
21
  approvalMode,
22
+ openAutoModeApprovalsInBrowser,
22
23
  callerPackage,
23
24
  });
24
25
  return {
@@ -24,6 +24,7 @@ export declare const createWorkflowPlugin: (sdk: {
24
24
  createWorkflow: (options?: {
25
25
  name: string;
26
26
  description?: string | undefined;
27
+ private?: boolean | undefined;
27
28
  is_private?: boolean | undefined;
28
29
  } | undefined) => Promise<{
29
30
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/createWorkflow/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BhC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/createWorkflow/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BhC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,oBAAoB,CAC5B,CAAC"}
@@ -13,8 +13,9 @@ export const createWorkflowPlugin = definePlugin((sdk) => createPluginMethod(sdk
13
13
  if (options.description !== undefined) {
14
14
  body.description = options.description;
15
15
  }
16
- if (options.is_private !== undefined) {
17
- body.is_private = options.is_private;
16
+ const isPrivate = options.private ?? options.is_private;
17
+ if (isPrivate !== undefined) {
18
+ body.is_private = isPrivate;
18
19
  }
19
20
  const raw = await sdk.context.api.post("/durableworkflowzaps/api/v0/workflows", body, { authRequired: true });
20
21
  const data = CreateWorkflowResponseSchema.parse(raw);
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  export declare const CreateWorkflowOptionsSchema: z.ZodObject<{
3
3
  name: z.ZodString;
4
4
  description: z.ZodOptional<z.ZodString>;
5
+ private: z.ZodOptional<z.ZodBoolean>;
5
6
  is_private: z.ZodOptional<z.ZodBoolean>;
6
7
  }, z.core.$strip>;
7
8
  export type CreateWorkflowOptions = z.infer<typeof CreateWorkflowOptionsSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/createWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B;;;;iBAgBrC,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,4BAA4B;;;;;;;;;iBA2BvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/plugins/codeSubstrate/createWorkflow/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B;;;;;iBAwBrC,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,4BAA4B;;;;;;;;;iBA2BvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC"}
@@ -6,10 +6,16 @@ export const CreateWorkflowOptionsSchema = z
6
6
  .string()
7
7
  .optional()
8
8
  .describe("Optional description for the workflow"),
9
- is_private: z
9
+ private: z
10
10
  .boolean()
11
11
  .optional()
12
12
  .describe("If true, only the creating user can see or manage this workflow. Defaults to false (account-visible)."),
13
+ /** @deprecated Use `private` instead. */
14
+ is_private: z
15
+ .boolean()
16
+ .optional()
17
+ .describe("If true, only the creating user can see or manage this workflow. Defaults to false (account-visible).")
18
+ .meta({ deprecated: true }),
13
19
  })
14
20
  .describe("Create a durable workflow container. Starts disabled with no version; publish a version to add code.");
15
21
  export const CreateWorkflowResponseSchema = z.object({
@@ -37,7 +37,7 @@ export declare const deleteWorkflowPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -37,7 +37,7 @@ export declare const disableWorkflowPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -37,7 +37,7 @@ export declare const enableWorkflowPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -6,8 +6,8 @@ export declare const OperationTypeSchema: z.ZodUnion<readonly [z.ZodEnum<{
6
6
  }>, z.ZodString]>;
7
7
  export type OperationType = z.infer<typeof OperationTypeSchema>;
8
8
  export declare const OperationStatusSchema: z.ZodUnion<readonly [z.ZodEnum<{
9
- pending: "pending";
10
9
  failed: "failed";
10
+ pending: "pending";
11
11
  exhausted: "exhausted";
12
12
  completed: "completed";
13
13
  }>, z.ZodString]>;
@@ -22,8 +22,8 @@ export declare const OperationSchema: z.ZodObject<{
22
22
  callback: "callback";
23
23
  }>, z.ZodString]>;
24
24
  status: z.ZodUnion<readonly [z.ZodEnum<{
25
- pending: "pending";
26
25
  failed: "failed";
26
+ pending: "pending";
27
27
  exhausted: "exhausted";
28
28
  completed: "completed";
29
29
  }>, z.ZodString]>;
@@ -80,8 +80,8 @@ export declare const ExecutionSummarySchema: z.ZodObject<{
80
80
  callback: "callback";
81
81
  }>, z.ZodString]>;
82
82
  status: z.ZodUnion<readonly [z.ZodEnum<{
83
- pending: "pending";
84
83
  failed: "failed";
84
+ pending: "pending";
85
85
  exhausted: "exhausted";
86
86
  completed: "completed";
87
87
  }>, z.ZodString]>;
@@ -151,8 +151,8 @@ export declare const GetDurableRunResponseSchema: z.ZodObject<{
151
151
  callback: "callback";
152
152
  }>, z.ZodString]>;
153
153
  status: z.ZodUnion<readonly [z.ZodEnum<{
154
- pending: "pending";
155
154
  failed: "failed";
155
+ pending: "pending";
156
156
  exhausted: "exhausted";
157
157
  completed: "completed";
158
158
  }>, z.ZodString]>;
@@ -37,7 +37,7 @@ export declare const getWorkflowPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -69,7 +69,7 @@ export declare const getWorkflowPlugin: (sdk: {
69
69
  triggers: {
70
70
  selected_api: string;
71
71
  action: string;
72
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
72
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
73
73
  authentication_id?: string | null | undefined;
74
74
  params?: Record<string, unknown> | undefined;
75
75
  }[];
@@ -62,12 +62,12 @@ export declare const GetWorkflowResponseSchema: z.ZodObject<{
62
62
  authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
63
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
64
64
  status: z.ZodEnum<{
65
+ failed: "failed";
65
66
  pending: "pending";
66
67
  active: "active";
67
68
  unclaimed: "unclaimed";
68
69
  releasing: "releasing";
69
70
  released: "released";
70
- failed: "failed";
71
71
  }>;
72
72
  }, z.core.$strip>>;
73
73
  created_at: z.ZodString;
@@ -37,7 +37,7 @@ export declare const getWorkflowRunPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -37,7 +37,7 @@ export declare const getWorkflowVersionPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -37,7 +37,7 @@ export declare const listWorkflowRunsPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -37,7 +37,7 @@ export declare const listWorkflowVersionsPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -41,7 +41,7 @@ export declare const listWorkflowsPlugin: (sdk: {
41
41
  triggers: {
42
42
  selected_api: string;
43
43
  action: string;
44
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
44
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
45
45
  authentication_id?: string | null | undefined;
46
46
  params?: Record<string, unknown> | undefined;
47
47
  }[];
@@ -14,12 +14,12 @@ export declare const WorkflowItemSchema: z.ZodObject<{
14
14
  authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
15
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
16
  status: z.ZodEnum<{
17
+ failed: "failed";
17
18
  pending: "pending";
18
19
  active: "active";
19
20
  unclaimed: "unclaimed";
20
21
  releasing: "releasing";
21
22
  released: "released";
22
- failed: "failed";
23
23
  }>;
24
24
  }, z.core.$strip>>;
25
25
  created_at: z.ZodString;
@@ -55,12 +55,12 @@ export declare const ListWorkflowsApiResponseSchema: z.ZodObject<{
55
55
  authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
56
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
57
57
  status: z.ZodEnum<{
58
+ failed: "failed";
58
59
  pending: "pending";
59
60
  active: "active";
60
61
  unclaimed: "unclaimed";
61
62
  releasing: "releasing";
62
63
  released: "released";
63
- failed: "failed";
64
64
  }>;
65
65
  }, z.core.$strip>>;
66
66
  created_at: z.ZodString;
@@ -37,7 +37,7 @@ export declare const publishWorkflowVersionPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -67,7 +67,7 @@ export const RunDurableOptionsSchema = z
67
67
  connections: z
68
68
  .record(z.string(), ConnectionMapEntrySchema)
69
69
  .optional()
70
- .describe("Named connection aliases. Maps alias names to Zapier connection IDs."),
70
+ .describe('Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connection_id": "123" } }`.'),
71
71
  app_versions: z
72
72
  .record(z.string(), AppVersionMapEntrySchema)
73
73
  .optional()
@@ -13,12 +13,12 @@ export declare const WorkflowVersionTriggerConfigSchema: z.ZodObject<{
13
13
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
14
14
  }, z.core.$strip>;
15
15
  export declare const WorkflowTriggerStatusSchema: z.ZodEnum<{
16
+ failed: "failed";
16
17
  pending: "pending";
17
18
  active: "active";
18
19
  unclaimed: "unclaimed";
19
20
  releasing: "releasing";
20
21
  released: "released";
21
- failed: "failed";
22
22
  }>;
23
23
  export declare const WorkflowTriggerSchema: z.ZodObject<{
24
24
  selected_api: z.ZodString;
@@ -26,12 +26,12 @@ export declare const WorkflowTriggerSchema: z.ZodObject<{
26
26
  authentication_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
27
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
28
  status: z.ZodEnum<{
29
+ failed: "failed";
29
30
  pending: "pending";
30
31
  active: "active";
31
32
  unclaimed: "unclaimed";
32
33
  releasing: "releasing";
33
34
  released: "released";
34
- failed: "failed";
35
35
  }>;
36
36
  }, z.core.$strip>;
37
37
  //# sourceMappingURL=shared-schemas.d.ts.map
@@ -37,7 +37,7 @@ export declare const triggerWorkflowPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -37,7 +37,7 @@ export declare const updateWorkflowPlugin: (sdk: {
37
37
  triggers: {
38
38
  selected_api: string;
39
39
  action: string;
40
- status: "pending" | "active" | "unclaimed" | "releasing" | "released" | "failed";
40
+ status: "failed" | "pending" | "active" | "unclaimed" | "releasing" | "released";
41
41
  authentication_id?: string | null | undefined;
42
42
  params?: Record<string, unknown> | undefined;
43
43
  }[];
@@ -0,0 +1,189 @@
1
+ import { type CreateConnectionItem } from "./schemas";
2
+ export declare const createConnectionPlugin: (sdk: {
3
+ getConnectionStartUrl: (options?: {
4
+ app: string;
5
+ } | undefined) => Promise<{
6
+ data: import("../getConnectionStartUrl/schemas").GetConnectionStartUrlItem;
7
+ }>;
8
+ } & {
9
+ context: {
10
+ meta: {
11
+ getConnectionStartUrl: import("kitcore").PluginMeta<unknown>;
12
+ };
13
+ };
14
+ } & {
15
+ waitForNewConnection: (options?: {
16
+ app: string;
17
+ startedAt: number;
18
+ timeoutMs?: number | undefined;
19
+ pollIntervalMs?: number | undefined;
20
+ } | undefined) => Promise<{
21
+ data: import("../waitForNewConnection/schemas").WaitForNewConnectionItem;
22
+ }>;
23
+ } & {
24
+ context: {
25
+ meta: {
26
+ waitForNewConnection: import("kitcore").PluginMeta<unknown>;
27
+ };
28
+ };
29
+ } & {
30
+ getApp: (options?: {
31
+ app: string;
32
+ } | {
33
+ appKey: string;
34
+ } | undefined) => Promise<{
35
+ data: {
36
+ slug: string;
37
+ title: string;
38
+ key: string;
39
+ implementation_id: string;
40
+ description?: string | undefined;
41
+ is_hidden?: boolean | undefined;
42
+ auth_type?: string | undefined;
43
+ actions?: {
44
+ read?: number | undefined;
45
+ read_bulk?: number | undefined;
46
+ write?: number | undefined;
47
+ search?: number | undefined;
48
+ search_or_write?: number | undefined;
49
+ search_and_write?: number | undefined;
50
+ filter?: number | undefined;
51
+ } | undefined;
52
+ is_deprecated?: boolean | undefined;
53
+ is_beta?: boolean | undefined;
54
+ is_premium?: boolean | undefined;
55
+ age_in_days?: number | undefined;
56
+ banner?: string | undefined;
57
+ categories?: {
58
+ id: number;
59
+ name: string;
60
+ slug: string;
61
+ }[] | undefined;
62
+ images?: {
63
+ url_16x16?: string | undefined;
64
+ url_32x32?: string | undefined;
65
+ url_64x64?: string | undefined;
66
+ url_128x128?: string | undefined;
67
+ } | undefined;
68
+ popularity?: number | undefined;
69
+ has_filters?: boolean | undefined;
70
+ has_reads?: boolean | undefined;
71
+ has_searches?: boolean | undefined;
72
+ has_searches_or_writes?: boolean | undefined;
73
+ has_upfront_fields?: boolean | undefined;
74
+ has_writes?: boolean | undefined;
75
+ is_built_in?: boolean | undefined;
76
+ is_featured?: boolean | undefined;
77
+ is_invite?: boolean | undefined;
78
+ is_public?: boolean | undefined;
79
+ is_upcoming?: boolean | undefined;
80
+ visibility?: string | undefined;
81
+ primary_color?: string | undefined;
82
+ secondary_color?: string | undefined;
83
+ classification?: string | undefined;
84
+ api_docs_url?: string | undefined;
85
+ image?: string | undefined;
86
+ version?: string | undefined;
87
+ };
88
+ }>;
89
+ } & {
90
+ context: {
91
+ meta: {
92
+ getApp: import("kitcore").PluginMeta<unknown>;
93
+ };
94
+ };
95
+ } & {
96
+ listApps: (options?: ({
97
+ search?: string | undefined;
98
+ apps?: string[] | undefined;
99
+ appKeys?: string[] | undefined;
100
+ pageSize?: number | undefined;
101
+ maxItems?: number | undefined;
102
+ cursor?: string | undefined;
103
+ } & {
104
+ cursor?: string;
105
+ pageSize?: number;
106
+ maxItems?: number;
107
+ }) | undefined) => import("kitcore").PaginatedSdkResult<{
108
+ slug: string;
109
+ title: string;
110
+ key: string;
111
+ implementation_id: string;
112
+ description?: string | undefined;
113
+ is_hidden?: boolean | undefined;
114
+ auth_type?: string | undefined;
115
+ actions?: {
116
+ read?: number | undefined;
117
+ read_bulk?: number | undefined;
118
+ write?: number | undefined;
119
+ search?: number | undefined;
120
+ search_or_write?: number | undefined;
121
+ search_and_write?: number | undefined;
122
+ filter?: number | undefined;
123
+ } | undefined;
124
+ is_deprecated?: boolean | undefined;
125
+ is_beta?: boolean | undefined;
126
+ is_premium?: boolean | undefined;
127
+ age_in_days?: number | undefined;
128
+ banner?: string | undefined;
129
+ categories?: {
130
+ id: number;
131
+ name: string;
132
+ slug: string;
133
+ }[] | undefined;
134
+ images?: {
135
+ url_16x16?: string | undefined;
136
+ url_32x32?: string | undefined;
137
+ url_64x64?: string | undefined;
138
+ url_128x128?: string | undefined;
139
+ } | undefined;
140
+ popularity?: number | undefined;
141
+ has_filters?: boolean | undefined;
142
+ has_reads?: boolean | undefined;
143
+ has_searches?: boolean | undefined;
144
+ has_searches_or_writes?: boolean | undefined;
145
+ has_upfront_fields?: boolean | undefined;
146
+ has_writes?: boolean | undefined;
147
+ is_built_in?: boolean | undefined;
148
+ is_featured?: boolean | undefined;
149
+ is_invite?: boolean | undefined;
150
+ is_public?: boolean | undefined;
151
+ is_upcoming?: boolean | undefined;
152
+ visibility?: string | undefined;
153
+ primary_color?: string | undefined;
154
+ secondary_color?: string | undefined;
155
+ classification?: string | undefined;
156
+ api_docs_url?: string | undefined;
157
+ image?: string | undefined;
158
+ version?: string | undefined;
159
+ }>;
160
+ } & {
161
+ context: {
162
+ meta: {
163
+ listApps: import("kitcore").PluginMeta<unknown>;
164
+ };
165
+ };
166
+ } & {
167
+ context: import("../eventEmission").EventEmissionContext;
168
+ } & {
169
+ context: {
170
+ meta: Record<string, import("kitcore").PluginMeta>;
171
+ };
172
+ }) => {
173
+ createConnection: (options?: {
174
+ app: string;
175
+ browser: "never" | "auto" | "always";
176
+ timeoutMs?: number | undefined;
177
+ pollIntervalMs?: number | undefined;
178
+ } | undefined) => Promise<{
179
+ data: CreateConnectionItem;
180
+ }>;
181
+ } & {
182
+ context: {
183
+ meta: {
184
+ createConnection: import("kitcore").PluginMeta<unknown>;
185
+ };
186
+ };
187
+ };
188
+ export type CreateConnectionPluginProvides = ReturnType<typeof createConnectionPlugin>;
189
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/createConnection/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,WAAW,CAAC;AAWnB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyBX,oBAAoB;;;;;;;;CAqD3C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,UAAU,CACrD,OAAO,sBAAsB,CAC9B,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { definePlugin, createPluginMethod } from "kitcore";
2
+ import { setMethodMetadata } from "../eventEmission/method-metadata";
3
+ import { appKeyResolver } from "../../resolvers";
4
+ import openUrl from "../../utils/open-url";
5
+ import { shouldOpenBrowser } from "../../utils/should-open-browser";
6
+ import { CreateConnectionSchema, CreateConnectionItemSchema, } from "./schemas";
7
+ export const createConnectionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
8
+ name: "createConnection",
9
+ categories: ["connection"],
10
+ type: "create",
11
+ itemType: "Connection",
12
+ inputSchema: CreateConnectionSchema,
13
+ outputSchema: CreateConnectionItemSchema,
14
+ resolvers: { app: appKeyResolver },
15
+ formatter: {
16
+ format: (item) => ({
17
+ title: `Connection created: ${item.title || item.id}`,
18
+ id: item.id,
19
+ details: [
20
+ { text: `App: ${item.app}`, style: "normal" },
21
+ { text: `ID: ${item.id}`, style: "accent" },
22
+ ],
23
+ }),
24
+ },
25
+ handler: async ({ sdk: inner, options, }) => {
26
+ const { data: start } = await inner.getConnectionStartUrl({
27
+ app: options.app,
28
+ });
29
+ // Tag this method's scope so eventEmission's onMethodEnd hook
30
+ // emits the MethodCalled event with `selected_api` set. The inner
31
+ // call sets metadata in its own scope, so we set it again here for
32
+ // createConnection's outer scope.
33
+ setMethodMetadata({ selectedApi: start.app });
34
+ // console.error (stderr) so JSON output on stdout (CLI --json flag)
35
+ // stays parseable, and so this works without bare `process` access in
36
+ // browser bundles — matching open-approval.ts. Always printed: a
37
+ // failed / skipped browser-open falls back to user copy-paste, so this
38
+ // is the load-bearing contract.
39
+ console.error(`\nOpen this URL to complete the connection:\n ${start.url}\n`);
40
+ const shouldOpen = options.browser === "always" ||
41
+ (options.browser === "auto" && shouldOpenBrowser());
42
+ if (shouldOpen) {
43
+ try {
44
+ // Resolves once the OS handler is launched, not when the user
45
+ // finishes auth — that's waitForNewConnection's job.
46
+ await openUrl(start.url);
47
+ }
48
+ catch {
49
+ // openUrl can throw on unsupported platforms or when no handler is
50
+ // available. The URL is already printed to stderr, so the user can
51
+ // copy it.
52
+ }
53
+ }
54
+ const { data: fresh } = await inner.waitForNewConnection({
55
+ app: start.app,
56
+ // Server-stamped mint time: measured on the same clock as a
57
+ // connection's `date`, so the freshness check is immune to
58
+ // client/server clock skew.
59
+ startedAt: start.startedAt,
60
+ timeoutMs: options.timeoutMs,
61
+ pollIntervalMs: options.pollIntervalMs,
62
+ });
63
+ return {
64
+ data: CreateConnectionItemSchema.parse({
65
+ id: fresh.id,
66
+ app: start.app,
67
+ title: fresh.title ?? null,
68
+ }),
69
+ };
70
+ },
71
+ }));
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export declare const CreateConnectionSchema: z.ZodObject<{
3
+ app: z.ZodString & {
4
+ _def: z.core.$ZodStringDef & import("kitcore").PositionalMetadata;
5
+ };
6
+ browser: z.ZodDefault<z.ZodEnum<{
7
+ never: "never";
8
+ auto: "auto";
9
+ always: "always";
10
+ }>>;
11
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
12
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strip>;
14
+ export type CreateConnectionOptions = z.infer<typeof CreateConnectionSchema>;
15
+ export declare const CreateConnectionItemSchema: z.ZodObject<{
16
+ id: z.ZodString;
17
+ app: z.ZodString;
18
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ }, z.core.$strip>;
20
+ export type CreateConnectionItem = z.infer<typeof CreateConnectionItemSchema>;
21
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/createConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBA4BhC,CAAC;AAEJ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE7E,eAAO,MAAM,0BAA0B;;;;iBAoBK,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}