@zapier/zapier-sdk 0.70.3 → 0.71.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 (114) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +248 -95
  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 +702 -67
  14. package/dist/experimental.d.mts +242 -2
  15. package/dist/experimental.d.ts +240 -0
  16. package/dist/experimental.d.ts.map +1 -1
  17. package/dist/experimental.js +10 -0
  18. package/dist/experimental.mjs +702 -68
  19. package/dist/{index-rIzBEINC.d.mts → index-B43uST61.d.mts} +248 -10
  20. package/dist/{index-rIzBEINC.d.ts → index-B43uST61.d.ts} +248 -10
  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/deleteWorkflow/index.d.ts +9 -0
  27. package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts.map +1 -1
  28. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +9 -0
  29. package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts.map +1 -1
  30. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +9 -0
  31. package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts.map +1 -1
  32. package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +5 -5
  33. package/dist/plugins/codeSubstrate/getTriggerRun/schemas.d.ts +1 -1
  34. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +31 -0
  35. package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts.map +1 -1
  36. package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts +42 -0
  37. package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts.map +1 -1
  38. package/dist/plugins/codeSubstrate/getWorkflow/schemas.js +20 -0
  39. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +9 -0
  40. package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts.map +1 -1
  41. package/dist/plugins/codeSubstrate/getWorkflowRun/schemas.d.ts +1 -1
  42. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +35 -0
  43. package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts.map +1 -1
  44. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts +13 -0
  45. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.d.ts.map +1 -1
  46. package/dist/plugins/codeSubstrate/getWorkflowVersion/schemas.js +10 -0
  47. package/dist/plugins/codeSubstrate/listDurableRuns/schemas.d.ts +3 -3
  48. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +9 -0
  49. package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts.map +1 -1
  50. package/dist/plugins/codeSubstrate/listWorkflowRuns/schemas.d.ts +3 -3
  51. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +22 -0
  52. package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts.map +1 -1
  53. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts +26 -0
  54. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.d.ts.map +1 -1
  55. package/dist/plugins/codeSubstrate/listWorkflowVersions/schemas.js +10 -0
  56. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +9 -0
  57. package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts.map +1 -1
  58. package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts +32 -0
  59. package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts.map +1 -1
  60. package/dist/plugins/codeSubstrate/listWorkflows/schemas.js +11 -0
  61. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +22 -0
  62. package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts.map +1 -1
  63. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts +14 -1
  64. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.d.ts.map +1 -1
  65. package/dist/plugins/codeSubstrate/publishWorkflowVersion/schemas.js +11 -44
  66. package/dist/plugins/codeSubstrate/runDurable/index.d.ts +6 -0
  67. package/dist/plugins/codeSubstrate/runDurable/index.d.ts.map +1 -1
  68. package/dist/plugins/codeSubstrate/runDurable/index.js +3 -0
  69. package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts +12 -0
  70. package/dist/plugins/codeSubstrate/runDurable/schemas.d.ts.map +1 -1
  71. package/dist/plugins/codeSubstrate/runDurable/schemas.js +33 -0
  72. package/dist/plugins/codeSubstrate/shared-schemas.d.ts +37 -0
  73. package/dist/plugins/codeSubstrate/shared-schemas.d.ts.map +1 -0
  74. package/dist/plugins/codeSubstrate/shared-schemas.js +69 -0
  75. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +9 -0
  76. package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts.map +1 -1
  77. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +11 -0
  78. package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts.map +1 -1
  79. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts +2 -0
  80. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.d.ts.map +1 -1
  81. package/dist/plugins/codeSubstrate/updateWorkflow/schemas.js +7 -0
  82. package/dist/plugins/createConnection/index.d.ts +189 -0
  83. package/dist/plugins/createConnection/index.d.ts.map +1 -0
  84. package/dist/plugins/createConnection/index.js +71 -0
  85. package/dist/plugins/createConnection/schemas.d.ts +21 -0
  86. package/dist/plugins/createConnection/schemas.d.ts.map +1 -0
  87. package/dist/plugins/createConnection/schemas.js +38 -0
  88. package/dist/plugins/getConnectionStartUrl/index.d.ts +206 -0
  89. package/dist/plugins/getConnectionStartUrl/index.d.ts.map +1 -0
  90. package/dist/plugins/getConnectionStartUrl/index.js +39 -0
  91. package/dist/plugins/getConnectionStartUrl/schemas.d.ts +15 -0
  92. package/dist/plugins/getConnectionStartUrl/schemas.d.ts.map +1 -0
  93. package/dist/plugins/getConnectionStartUrl/schemas.js +23 -0
  94. package/dist/plugins/waitForNewConnection/index.d.ts +209 -0
  95. package/dist/plugins/waitForNewConnection/index.d.ts.map +1 -0
  96. package/dist/plugins/waitForNewConnection/index.js +75 -0
  97. package/dist/plugins/waitForNewConnection/schemas.d.ts +17 -0
  98. package/dist/plugins/waitForNewConnection/schemas.d.ts.map +1 -0
  99. package/dist/plugins/waitForNewConnection/schemas.js +39 -0
  100. package/dist/sdk.d.ts +126 -0
  101. package/dist/sdk.d.ts.map +1 -1
  102. package/dist/sdk.js +8 -0
  103. package/dist/types/errors.d.ts +13 -4
  104. package/dist/types/errors.d.ts.map +1 -1
  105. package/dist/types/errors.js +2 -0
  106. package/dist/types/sdk.d.ts +1 -0
  107. package/dist/types/sdk.d.ts.map +1 -1
  108. package/dist/types/sdk.js +5 -1
  109. package/dist/utils/open-url.d.ts.map +1 -1
  110. package/dist/utils/open-url.js +7 -0
  111. package/dist/utils/should-open-browser.d.ts +24 -0
  112. package/dist/utils/should-open-browser.d.ts.map +1 -0
  113. package/dist/utils/should-open-browser.js +55 -0
  114. package/package.json +1 -1
@@ -0,0 +1,209 @@
1
+ import { type WaitForNewConnectionItem } from "./schemas";
2
+ export declare const waitForNewConnectionPlugin: (sdk: {
3
+ context: {
4
+ api: import("../..").ApiClient;
5
+ resolveCredentials: () => Promise<string | {
6
+ clientId: string;
7
+ clientSecret: string;
8
+ type?: "client_credentials" | undefined;
9
+ baseUrl?: string | undefined;
10
+ scope?: string | undefined;
11
+ } | {
12
+ clientId: string;
13
+ type?: "pkce" | undefined;
14
+ baseUrl?: string | undefined;
15
+ scope?: string | undefined;
16
+ } | undefined>;
17
+ };
18
+ } & {
19
+ context: {
20
+ getResolvedManifest: () => Promise<import("../manifest").Manifest | null>;
21
+ getVersionedImplementationId: (appKey: string) => Promise<string | null>;
22
+ resolveAppKeys: ({ appKeys }: {
23
+ appKeys: string[];
24
+ }) => Promise<import("../..").ResolvedAppLocator[]>;
25
+ updateManifestEntry: (options: import("../manifest").UpdateManifestEntryOptions) => Promise<import("../manifest").UpdateManifestEntryResult>;
26
+ addActionEntry: (options: import("../manifest").AddActionEntryOptions) => Promise<import("../manifest").AddActionEntryResult>;
27
+ findActionEntry: ({ name, manifest, }: {
28
+ name: string;
29
+ manifest: import("../manifest").Manifest;
30
+ }) => import("../manifest").ActionEntry | null;
31
+ listActionEntries: ({ configPath, }?: {
32
+ configPath?: string;
33
+ }) => Promise<Array<[string, import("../manifest").ActionEntry]>>;
34
+ deleteActionEntry: ({ name, configPath, skipWrite, }: {
35
+ name: string;
36
+ configPath?: string;
37
+ skipWrite?: boolean;
38
+ }) => Promise<import("../manifest").Manifest>;
39
+ hasActionEntry: ({ name, manifest, }: {
40
+ name: string;
41
+ manifest: import("../manifest").Manifest;
42
+ }) => boolean;
43
+ findManifestEntry: typeof import("../manifest").findManifestEntry;
44
+ readManifestFromFile: typeof import("../manifest").readManifestFromFile;
45
+ getManifestConnections: () => Promise<Record<string, {
46
+ connectionId: string | number;
47
+ }> | null>;
48
+ };
49
+ } & {
50
+ getApp: (options?: {
51
+ app: string;
52
+ } | {
53
+ appKey: string;
54
+ } | undefined) => Promise<{
55
+ data: {
56
+ slug: string;
57
+ title: string;
58
+ key: string;
59
+ implementation_id: string;
60
+ description?: string | undefined;
61
+ is_hidden?: boolean | undefined;
62
+ auth_type?: string | undefined;
63
+ actions?: {
64
+ read?: number | undefined;
65
+ read_bulk?: number | undefined;
66
+ write?: number | undefined;
67
+ search?: number | undefined;
68
+ search_or_write?: number | undefined;
69
+ search_and_write?: number | undefined;
70
+ filter?: number | undefined;
71
+ } | undefined;
72
+ is_deprecated?: boolean | undefined;
73
+ is_beta?: boolean | undefined;
74
+ is_premium?: boolean | undefined;
75
+ age_in_days?: number | undefined;
76
+ banner?: string | undefined;
77
+ categories?: {
78
+ id: number;
79
+ name: string;
80
+ slug: string;
81
+ }[] | undefined;
82
+ images?: {
83
+ url_16x16?: string | undefined;
84
+ url_32x32?: string | undefined;
85
+ url_64x64?: string | undefined;
86
+ url_128x128?: string | undefined;
87
+ } | undefined;
88
+ popularity?: number | undefined;
89
+ has_filters?: boolean | undefined;
90
+ has_reads?: boolean | undefined;
91
+ has_searches?: boolean | undefined;
92
+ has_searches_or_writes?: boolean | undefined;
93
+ has_upfront_fields?: boolean | undefined;
94
+ has_writes?: boolean | undefined;
95
+ is_built_in?: boolean | undefined;
96
+ is_featured?: boolean | undefined;
97
+ is_invite?: boolean | undefined;
98
+ is_public?: boolean | undefined;
99
+ is_upcoming?: boolean | undefined;
100
+ visibility?: string | undefined;
101
+ primary_color?: string | undefined;
102
+ secondary_color?: string | undefined;
103
+ classification?: string | undefined;
104
+ api_docs_url?: string | undefined;
105
+ image?: string | undefined;
106
+ version?: string | undefined;
107
+ };
108
+ }>;
109
+ } & {
110
+ context: {
111
+ meta: {
112
+ getApp: import("kitcore").PluginMeta<unknown>;
113
+ };
114
+ };
115
+ } & {
116
+ listApps: (options?: ({
117
+ search?: string | undefined;
118
+ apps?: string[] | undefined;
119
+ appKeys?: string[] | undefined;
120
+ pageSize?: number | undefined;
121
+ maxItems?: number | undefined;
122
+ cursor?: string | undefined;
123
+ } & {
124
+ cursor?: string;
125
+ pageSize?: number;
126
+ maxItems?: number;
127
+ }) | undefined) => import("kitcore").PaginatedSdkResult<{
128
+ slug: string;
129
+ title: string;
130
+ key: string;
131
+ implementation_id: string;
132
+ description?: string | undefined;
133
+ is_hidden?: boolean | undefined;
134
+ auth_type?: string | undefined;
135
+ actions?: {
136
+ read?: number | undefined;
137
+ read_bulk?: number | undefined;
138
+ write?: number | undefined;
139
+ search?: number | undefined;
140
+ search_or_write?: number | undefined;
141
+ search_and_write?: number | undefined;
142
+ filter?: number | undefined;
143
+ } | undefined;
144
+ is_deprecated?: boolean | undefined;
145
+ is_beta?: boolean | undefined;
146
+ is_premium?: boolean | undefined;
147
+ age_in_days?: number | undefined;
148
+ banner?: string | undefined;
149
+ categories?: {
150
+ id: number;
151
+ name: string;
152
+ slug: string;
153
+ }[] | undefined;
154
+ images?: {
155
+ url_16x16?: string | undefined;
156
+ url_32x32?: string | undefined;
157
+ url_64x64?: string | undefined;
158
+ url_128x128?: string | undefined;
159
+ } | undefined;
160
+ popularity?: number | undefined;
161
+ has_filters?: boolean | undefined;
162
+ has_reads?: boolean | undefined;
163
+ has_searches?: boolean | undefined;
164
+ has_searches_or_writes?: boolean | undefined;
165
+ has_upfront_fields?: boolean | undefined;
166
+ has_writes?: boolean | undefined;
167
+ is_built_in?: boolean | undefined;
168
+ is_featured?: boolean | undefined;
169
+ is_invite?: boolean | undefined;
170
+ is_public?: boolean | undefined;
171
+ is_upcoming?: boolean | undefined;
172
+ visibility?: string | undefined;
173
+ primary_color?: string | undefined;
174
+ secondary_color?: string | undefined;
175
+ classification?: string | undefined;
176
+ api_docs_url?: string | undefined;
177
+ image?: string | undefined;
178
+ version?: string | undefined;
179
+ }>;
180
+ } & {
181
+ context: {
182
+ meta: {
183
+ listApps: import("kitcore").PluginMeta<unknown>;
184
+ };
185
+ };
186
+ } & {
187
+ context: import("../eventEmission").EventEmissionContext;
188
+ } & {
189
+ context: {
190
+ meta: Record<string, import("kitcore").PluginMeta>;
191
+ };
192
+ }) => {
193
+ waitForNewConnection: (options?: {
194
+ app: string;
195
+ startedAt: number;
196
+ timeoutMs?: number | undefined;
197
+ pollIntervalMs?: number | undefined;
198
+ } | undefined) => Promise<{
199
+ data: WaitForNewConnectionItem;
200
+ }>;
201
+ } & {
202
+ context: {
203
+ meta: {
204
+ waitForNewConnection: import("kitcore").PluginMeta<unknown>;
205
+ };
206
+ };
207
+ };
208
+ export type WaitForNewConnectionPluginProvides = ReturnType<typeof waitForNewConnectionPlugin>;
209
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/waitForNewConnection/index.ts"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,WAAW,CAAC;AAuBnB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwFuwT,CAAC;;;;sBAAiX,CAAC;qBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAzEnqU,wBAAwB;;;;;;;;CAoE/C,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,UAAU,CACzD,OAAO,0BAA0B,CAClC,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { definePlugin, createPluginMethod } from "kitcore";
2
+ import { setMethodMetadata } from "../eventEmission/method-metadata";
3
+ import { appKeyResolver } from "../../resolvers";
4
+ import { ZapierTimeoutError } from "../../types/errors";
5
+ import { WaitForNewConnectionSchema, WaitForNewConnectionItemSchema, } from "./schemas";
6
+ const CONNECTIONS_PATH = "/api/v0/connections";
7
+ export const waitForNewConnectionPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
8
+ name: "waitForNewConnection",
9
+ categories: ["connection"],
10
+ type: "item",
11
+ itemType: "Connection",
12
+ inputSchema: WaitForNewConnectionSchema,
13
+ outputSchema: WaitForNewConnectionItemSchema,
14
+ resolvers: { app: appKeyResolver },
15
+ handler: async ({ sdk: inner, options, }) => {
16
+ // Resolve slug → versionless app key so the `app_key` filter matches
17
+ // what the API stores on connection rows.
18
+ const versionedKey = await inner.context.getVersionedImplementationId(options.app);
19
+ const appKey = versionedKey ? versionedKey.split("@")[0] : options.app;
20
+ // Tag this method's scope so eventEmission's onMethodEnd hook
21
+ // emits the MethodCalled event with `selected_api` set.
22
+ setMethodMetadata({ selectedApi: appKey });
23
+ // Server-side sort newest-first + `page_size=1` lets us poll a one-row
24
+ // response and just check the head: if the most recently created
25
+ // `appKey` connection is fresh (`date >= startedAt`), it's ours by
26
+ // construction. No pagination concerns; no client-side disambiguation
27
+ // among fresh rows. Delegating the poll loop to `api.poll` also gets
28
+ // us backoff, timeout enforcement, and consistent `ZapierTimeoutError`
29
+ // behavior for free.
30
+ try {
31
+ const top = await inner.context.api.poll(CONNECTIONS_PATH, {
32
+ searchParams: {
33
+ app_key: appKey,
34
+ // Scope to the current user's own connections. The connection
35
+ // we're waiting on is by definition owned by the caller; without
36
+ // this the one-row head-check could match a teammate's freshly
37
+ // created connection for the same app.
38
+ owner: "me",
39
+ is_expired: "false",
40
+ ordering: "-date",
41
+ page_size: "1",
42
+ },
43
+ authRequired: true,
44
+ timeoutMs: options.timeoutMs ?? 300000,
45
+ initialDelay: options.pollIntervalMs ?? 3000,
46
+ isPending: (body) => {
47
+ const rows = body.data ?? [];
48
+ const head = rows[0];
49
+ if (!head?.date)
50
+ return true;
51
+ const created = Math.floor(new Date(head.date).getTime() / 1000);
52
+ return !Number.isFinite(created) || created < options.startedAt;
53
+ },
54
+ resultExtractor: (body) =>
55
+ // `isPending` guaranteed a fresh row at index 0 before this fires.
56
+ body.data[0],
57
+ });
58
+ return {
59
+ data: WaitForNewConnectionItemSchema.parse({
60
+ id: String(top.public_id ?? top.id),
61
+ app: appKey,
62
+ title: top.title ?? null,
63
+ }),
64
+ };
65
+ }
66
+ catch (err) {
67
+ // Wrap api.poll's generic timeout with an actionable next step.
68
+ if (err instanceof ZapierTimeoutError) {
69
+ throw new ZapierTimeoutError(`Timed out waiting for a new "${appKey}" connection. ` +
70
+ `If the user completed the auth flow, retrieve the connection via sdk.getConnection({ id }) with the ID shown on the completion page.`);
71
+ }
72
+ throw err;
73
+ }
74
+ },
75
+ }));
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ export declare const WaitForNewConnectionSchema: z.ZodObject<{
3
+ app: z.ZodString & {
4
+ _def: z.core.$ZodStringDef & import("kitcore").PositionalMetadata;
5
+ };
6
+ startedAt: z.ZodNumber;
7
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
8
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
9
+ }, z.core.$strip>;
10
+ export type WaitForNewConnectionOptions = z.infer<typeof WaitForNewConnectionSchema>;
11
+ export declare const WaitForNewConnectionItemSchema: z.ZodObject<{
12
+ id: z.ZodString;
13
+ app: z.ZodString;
14
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ }, z.core.$strip>;
16
+ export type WaitForNewConnectionItem = z.infer<typeof WaitForNewConnectionItemSchema>;
17
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/waitForNewConnection/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,0BAA0B;;;;;;;iBA6BpC,CAAC;AAEJ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,0BAA0B,CAClC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;iBAoBS,CAAC;AAErD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import { AppPropertySchema } from "../../types/properties";
3
+ export const WaitForNewConnectionSchema = z
4
+ .object({
5
+ app: AppPropertySchema,
6
+ startedAt: z
7
+ .number()
8
+ .int()
9
+ .nonnegative()
10
+ .describe("Unix timestamp (seconds). Only connections whose `date` is at or after this value count as 'new'. Prefer the `startedAt` returned by `get-connection-start-url` — it's server-stamped, so the comparison isn't thrown off by client clock skew. If you mint the timestamp yourself, capture it *before* showing the start URL so a fast OAuth completion isn't missed."),
11
+ timeoutMs: z
12
+ .number()
13
+ .int()
14
+ .positive()
15
+ .optional()
16
+ .describe("How long to wait before giving up. Default 5 minutes (300_000)."),
17
+ pollIntervalMs: z
18
+ .number()
19
+ .int()
20
+ .positive()
21
+ .optional()
22
+ .describe("Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults)."),
23
+ })
24
+ .describe("Wait for a new connection to appear for the given app. Polls `/api/v0/connections` with server-side `ordering=-date` until the most recent matching row's `date` is at or after the started-at timestamp, then returns it. Pair with `get-connection-start-url` — that mints the URL the user opens, this waits for the resulting connection to land. Errors with a timeout after the configured timeout (default 5 min). Example (JS):\n\n```ts\nconst { data: { url, app, startedAt } } = await zapier.getConnectionStartUrl({ app: 'slack' });\n// show `url` to the user via the channel they're reading from\nconst { data: conn } = await zapier.waitForNewConnection({ app, startedAt });\n```");
25
+ export const WaitForNewConnectionItemSchema = z
26
+ .object({
27
+ id: z
28
+ .string()
29
+ .describe("The new connection's ID. Public UUID when available, falling back to the numeric ID."),
30
+ app: z
31
+ .string()
32
+ .describe("Versionless app key the connection was created for (e.g., 'SlackCLIAPI')."),
33
+ title: z
34
+ .string()
35
+ .nullable()
36
+ .optional()
37
+ .describe("Human-readable connection title set by the auth flow, when available."),
38
+ })
39
+ .describe("The new connection that was detected.");
package/dist/sdk.d.ts CHANGED
@@ -443,6 +443,48 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
443
443
  findUniqueConnection: import("kitcore").PluginMeta<unknown>;
444
444
  };
445
445
  };
446
+ } & {
447
+ getConnectionStartUrl: (options?: {
448
+ app: string;
449
+ } | undefined) => Promise<{
450
+ data: import("./plugins/getConnectionStartUrl/schemas").GetConnectionStartUrlItem;
451
+ }>;
452
+ } & {
453
+ context: {
454
+ meta: {
455
+ getConnectionStartUrl: import("kitcore").PluginMeta<unknown>;
456
+ };
457
+ };
458
+ } & {
459
+ waitForNewConnection: (options?: {
460
+ app: string;
461
+ startedAt: number;
462
+ timeoutMs?: number | undefined;
463
+ pollIntervalMs?: number | undefined;
464
+ } | undefined) => Promise<{
465
+ data: import("./plugins/waitForNewConnection/schemas").WaitForNewConnectionItem;
466
+ }>;
467
+ } & {
468
+ context: {
469
+ meta: {
470
+ waitForNewConnection: import("kitcore").PluginMeta<unknown>;
471
+ };
472
+ };
473
+ } & {
474
+ createConnection: (options?: {
475
+ app: string;
476
+ browser: "never" | "auto" | "always";
477
+ timeoutMs?: number | undefined;
478
+ pollIntervalMs?: number | undefined;
479
+ } | undefined) => Promise<{
480
+ data: import("./plugins/createConnection/schemas").CreateConnectionItem;
481
+ }>;
482
+ } & {
483
+ context: {
484
+ meta: {
485
+ createConnection: import("kitcore").PluginMeta<unknown>;
486
+ };
487
+ };
446
488
  } & {
447
489
  listActions: (options?: (({
448
490
  app: string;
@@ -2417,6 +2459,48 @@ export declare function createZapierSdkStack(options?: ZapierSdkOptions): import
2417
2459
  findUniqueConnection: import("kitcore").PluginMeta<unknown>;
2418
2460
  };
2419
2461
  };
2462
+ } & {
2463
+ getConnectionStartUrl: (options?: {
2464
+ app: string;
2465
+ } | undefined) => Promise<{
2466
+ data: import("./plugins/getConnectionStartUrl/schemas").GetConnectionStartUrlItem;
2467
+ }>;
2468
+ } & {
2469
+ context: {
2470
+ meta: {
2471
+ getConnectionStartUrl: import("kitcore").PluginMeta<unknown>;
2472
+ };
2473
+ };
2474
+ } & {
2475
+ waitForNewConnection: (options?: {
2476
+ app: string;
2477
+ startedAt: number;
2478
+ timeoutMs?: number | undefined;
2479
+ pollIntervalMs?: number | undefined;
2480
+ } | undefined) => Promise<{
2481
+ data: import("./plugins/waitForNewConnection/schemas").WaitForNewConnectionItem;
2482
+ }>;
2483
+ } & {
2484
+ context: {
2485
+ meta: {
2486
+ waitForNewConnection: import("kitcore").PluginMeta<unknown>;
2487
+ };
2488
+ };
2489
+ } & {
2490
+ createConnection: (options?: {
2491
+ app: string;
2492
+ browser: "never" | "auto" | "always";
2493
+ timeoutMs?: number | undefined;
2494
+ pollIntervalMs?: number | undefined;
2495
+ } | undefined) => Promise<{
2496
+ data: import("./plugins/createConnection/schemas").CreateConnectionItem;
2497
+ }>;
2498
+ } & {
2499
+ context: {
2500
+ meta: {
2501
+ createConnection: import("kitcore").PluginMeta<unknown>;
2502
+ };
2503
+ };
2420
2504
  } & {
2421
2505
  listActions: (options?: (({
2422
2506
  app: string;
@@ -4379,6 +4463,48 @@ export declare function createZapierSdk(options?: ZapierSdkOptions): import("kit
4379
4463
  findUniqueConnection: import("kitcore").PluginMeta<unknown>;
4380
4464
  };
4381
4465
  };
4466
+ } & {
4467
+ getConnectionStartUrl: (options?: {
4468
+ app: string;
4469
+ } | undefined) => Promise<{
4470
+ data: import("./plugins/getConnectionStartUrl/schemas").GetConnectionStartUrlItem;
4471
+ }>;
4472
+ } & {
4473
+ context: {
4474
+ meta: {
4475
+ getConnectionStartUrl: import("kitcore").PluginMeta<unknown>;
4476
+ };
4477
+ };
4478
+ } & {
4479
+ waitForNewConnection: (options?: {
4480
+ app: string;
4481
+ startedAt: number;
4482
+ timeoutMs?: number | undefined;
4483
+ pollIntervalMs?: number | undefined;
4484
+ } | undefined) => Promise<{
4485
+ data: import("./plugins/waitForNewConnection/schemas").WaitForNewConnectionItem;
4486
+ }>;
4487
+ } & {
4488
+ context: {
4489
+ meta: {
4490
+ waitForNewConnection: import("kitcore").PluginMeta<unknown>;
4491
+ };
4492
+ };
4493
+ } & {
4494
+ createConnection: (options?: {
4495
+ app: string;
4496
+ browser: "never" | "auto" | "always";
4497
+ timeoutMs?: number | undefined;
4498
+ pollIntervalMs?: number | undefined;
4499
+ } | undefined) => Promise<{
4500
+ data: import("./plugins/createConnection/schemas").CreateConnectionItem;
4501
+ }>;
4502
+ } & {
4503
+ context: {
4504
+ meta: {
4505
+ createConnection: import("kitcore").PluginMeta<unknown>;
4506
+ };
4507
+ };
4382
4508
  } & {
4383
4509
  listActions: (options?: (({
4384
4510
  app: string;
package/dist/sdk.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAyDlD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB;;;;EAE5D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS;;;;;;;;;GAOxB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAyHizK,CAAC;;;;sBAAiX,CAAC;qBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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sPlugin } from "./plugins/listConnections";
14
14
  import { getConnectionPlugin } from "./plugins/getConnection";
15
15
  import { findFirstConnectionPlugin } from "./plugins/findFirstConnection";
16
16
  import { findUniqueConnectionPlugin } from "./plugins/findUniqueConnection";
17
+ import { getConnectionStartUrlPlugin } from "./plugins/getConnectionStartUrl";
18
+ import { waitForNewConnectionPlugin } from "./plugins/waitForNewConnection";
19
+ import { createConnectionPlugin } from "./plugins/createConnection";
17
20
  import { listAuthenticationsPlugin, getAuthenticationPlugin, findFirstAuthenticationPlugin, findUniqueAuthenticationPlugin, } from "./plugins/deprecated/authentications";
18
21
  import { listClientCredentialsPlugin } from "./plugins/listClientCredentials";
19
22
  import { createClientCredentialsPlugin } from "./plugins/createClientCredentials";
@@ -111,6 +114,11 @@ export function createZapierSdkStack(options = {}) {
111
114
  .use(getConnectionPlugin)
112
115
  .use(findFirstConnectionPlugin)
113
116
  .use(findUniqueConnectionPlugin)
117
+ // Connection creation. `createConnection` composes the two low-level
118
+ // methods at runtime, so register them first.
119
+ .use(getConnectionStartUrlPlugin)
120
+ .use(waitForNewConnectionPlugin)
121
+ .use(createConnectionPlugin)
114
122
  // Actions / fields
115
123
  .use(listActionsPlugin)
116
124
  .use(getActionPlugin)
@@ -195,9 +195,11 @@ export declare class ZapierRateLimitError extends ZapierError {
195
195
  /**
196
196
  * Terminal status of an approval attempt, exposed on `ZapierApprovalError.approvalStatus`.
197
197
  *
198
- * - `pending`: The approval was created but not yet resolved. Only thrown in
199
- * `approvalMode: "throw"` — the caller is expected to surface the approval URL
200
- * to an end user (e.g. an LLM instructing its user to click the link).
198
+ * - `pending`: A manual approval was created but not yet resolved. Only thrown
199
+ * in `approvalMode: "throw"` — the caller is expected to surface the approval
200
+ * URL to an end user (e.g. an LLM instructing its user to click the link).
201
+ * Auto-mode approvals are polled to terminal resolution instead of throwing
202
+ * `pending`.
201
203
  * - `denied`: A human explicitly rejected the approval in the UI.
202
204
  * - `policy_denied`: A policy rule blocked the request before (or instead of)
203
205
  * creating an approval. Cannot be approved by a human.
@@ -205,12 +207,15 @@ export declare class ZapierRateLimitError extends ZapierError {
205
207
  * `"disabled"` (the default) so the SDK did not create an approval. Set
206
208
  * `approvalMode` to `"poll"` or `"throw"` (or the `ZAPIER_APPROVAL_MODE` env
207
209
  * var) to enable the approval flow.
210
+ * - `failed`: The approval reached a terminal processing failure after it was
211
+ * created, such as the approved policy being rejected by the permissions
212
+ * service.
208
213
  * - `timeout`: Poll mode exceeded `approvalTimeoutMs` without the approval
209
214
  * being resolved.
210
215
  * - `max_retries_exceeded`: A single request triggered more sequential approval
211
216
  * rounds than `maxApprovalRetries` allows (runaway-loop safeguard).
212
217
  */
213
- export type ApprovalStatus = "denied" | "timeout" | "pending" | "policy_denied" | "approval_required" | "max_retries_exceeded";
218
+ export type ApprovalStatus = "denied" | "failed" | "timeout" | "pending" | "policy_denied" | "approval_required" | "max_retries_exceeded";
214
219
  /**
215
220
  * Error thrown when a request requires approval and the approval is denied, times out,
216
221
  * or the auth type doesn't support the approval flow.
@@ -222,11 +227,15 @@ export declare class ZapierApprovalError extends ZapierError {
222
227
  approvalStatus?: ApprovalStatus;
223
228
  approvalUrl?: string;
224
229
  pollUrl?: string;
230
+ streamUrl?: string;
231
+ reason?: string;
225
232
  constructor(message: string, options?: ErrorOptions & {
226
233
  approvalId?: string;
227
234
  status?: ApprovalStatus;
228
235
  approvalUrl?: string;
229
236
  pollUrl?: string;
237
+ streamUrl?: string;
238
+ reason?: string;
230
239
  });
231
240
  }
232
241
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EAEjB,KAAK,UAAU,EAEf,KAAK,QAAQ,EACd,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MA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pB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAY,GAAG;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,cAAc,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACZ;CAUT;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,IAAI,EAAG,oBAAoB,CAAU;gBAElC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;CAGxD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA0F7D"}
@@ -225,6 +225,8 @@ export class ZapierApprovalError extends ZapierError {
225
225
  this.approvalStatus = options.status;
226
226
  this.approvalUrl = options.approvalUrl;
227
227
  this.pollUrl = options.pollUrl;
228
+ this.streamUrl = options.streamUrl;
229
+ this.reason = options.reason;
228
230
  }
229
231
  }
230
232
  /**
@@ -66,6 +66,7 @@ export declare const BaseSdkOptionsSchema: z.ZodObject<{
66
66
  poll: "poll";
67
67
  throw: "throw";
68
68
  }>>;
69
+ openAutoModeApprovalsInBrowser: z.ZodOptional<z.ZodBoolean>;
69
70
  manifestPath: z.ZodOptional<z.ZodString>;
70
71
  manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
71
72
  onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
@@ -1 +1 @@
1
- {"version":3,"file":"s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