@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.
- package/CHANGELOG.md +21 -0
- package/README.md +149 -31
- package/dist/api/approval-review-stream.d.ts +25 -0
- package/dist/api/approval-review-stream.d.ts.map +1 -0
- package/dist/api/approval-review-stream.js +104 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +215 -27
- package/dist/api/types.d.ts +13 -3
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -0
- package/dist/experimental.cjs +602 -37
- package/dist/experimental.d.mts +88 -2
- package/dist/experimental.d.ts +90 -4
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +10 -0
- package/dist/experimental.mjs +602 -38
- package/dist/{index-BNaiNmM-.d.mts → index-B43uST61.d.mts} +181 -12
- package/dist/{index-BNaiNmM-.d.ts → index-B43uST61.d.ts} +181 -12
- package/dist/index.cjs +592 -32
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +592 -33
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +2 -1
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts +1 -0
- package/dist/plugins/codeSubstrate/createWorkflow/index.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/createWorkflow/index.js +3 -2
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts +1 -0
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.d.ts.map +1 -1
- package/dist/plugins/codeSubstrate/createWorkflow/schemas.js +7 -1
- package/dist/plugins/codeSubstrate/deleteWorkflow/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/disableWorkflow/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/enableWorkflow/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/getDurableRun/schemas.d.ts +4 -4
- package/dist/plugins/codeSubstrate/getWorkflow/index.d.ts +2 -2
- package/dist/plugins/codeSubstrate/getWorkflow/schemas.d.ts +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowRun/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/getWorkflowVersion/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowRuns/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/listWorkflowVersions/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/listWorkflows/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/listWorkflows/schemas.d.ts +2 -2
- package/dist/plugins/codeSubstrate/publishWorkflowVersion/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/runDurable/schemas.js +1 -1
- package/dist/plugins/codeSubstrate/shared-schemas.d.ts +2 -2
- package/dist/plugins/codeSubstrate/triggerWorkflow/index.d.ts +1 -1
- package/dist/plugins/codeSubstrate/updateWorkflow/index.d.ts +1 -1
- package/dist/plugins/createConnection/index.d.ts +189 -0
- package/dist/plugins/createConnection/index.d.ts.map +1 -0
- package/dist/plugins/createConnection/index.js +71 -0
- package/dist/plugins/createConnection/schemas.d.ts +21 -0
- package/dist/plugins/createConnection/schemas.d.ts.map +1 -0
- package/dist/plugins/createConnection/schemas.js +38 -0
- package/dist/plugins/getConnectionStartUrl/index.d.ts +206 -0
- package/dist/plugins/getConnectionStartUrl/index.d.ts.map +1 -0
- package/dist/plugins/getConnectionStartUrl/index.js +39 -0
- package/dist/plugins/getConnectionStartUrl/schemas.d.ts +15 -0
- package/dist/plugins/getConnectionStartUrl/schemas.d.ts.map +1 -0
- package/dist/plugins/getConnectionStartUrl/schemas.js +23 -0
- package/dist/plugins/waitForNewConnection/index.d.ts +209 -0
- package/dist/plugins/waitForNewConnection/index.d.ts.map +1 -0
- package/dist/plugins/waitForNewConnection/index.js +75 -0
- package/dist/plugins/waitForNewConnection/schemas.d.ts +17 -0
- package/dist/plugins/waitForNewConnection/schemas.d.ts.map +1 -0
- package/dist/plugins/waitForNewConnection/schemas.js +39 -0
- package/dist/sdk.d.ts +126 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +8 -0
- package/dist/types/errors.d.ts +13 -4
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +2 -0
- package/dist/types/sdk.d.ts +1 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +5 -1
- package/dist/utils/open-url.d.ts.map +1 -1
- package/dist/utils/open-url.js +7 -0
- package/dist/utils/should-open-browser.d.ts +24 -0
- package/dist/utils/should-open-browser.d.ts.map +1 -0
- package/dist/utils/should-open-browser.js +55 -0
- package/package.json +1 -1
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA4DlD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,wBAAgB,mBAAmB,CAAC,OA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAVrzK;AASD,MAAM,WAAW,SAAU,SAAQ,UAAU,CAAC,OAAO,eAAe,CAAC;CAAG"}
|
package/dist/sdk.js
CHANGED
|
@@ -14,6 +14,9 @@ import { listConnectionsPlugin } 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)
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -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`:
|
|
199
|
-
* `approvalMode: "throw"` — the caller is expected to surface the approval
|
|
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,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,QAAQ;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAiB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAkB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;I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E,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"}
|
package/dist/types/errors.js
CHANGED
|
@@ -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
|
/**
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyGb,MAAM;iBAAW,MAAM;;cAAvB,MAAM;iBAAW,MAAM;;;;;;;iBAiBzC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AACjG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG1E,MAAM,WAAW,kBACf,SAAQ,gCAAgC,EACtC,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB;CAAG"}
|
package/dist/types/sdk.js
CHANGED
|
@@ -73,7 +73,11 @@ export const BaseSdkOptionsSchema = z.object({
|
|
|
73
73
|
approvalMode: z
|
|
74
74
|
.enum(["disabled", "poll", "throw"])
|
|
75
75
|
.optional()
|
|
76
|
-
.describe('Approval flow behavior. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. "disabled" throws a ZapierApprovalError on approval-required responses without creating an approval. Resolution order is: explicit option, then ZAPIER_APPROVAL_MODE, then the default behavior (poll for interactive TTY, throw otherwise).'),
|
|
76
|
+
.describe('Approval flow behavior for manual approvals. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the manual approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. Server-created auto-mode approvals always poll until they reach a terminal status and retry the original request on approval, even when this option is "throw". "disabled" throws a ZapierApprovalError on approval-required responses without creating an approval. Resolution order is: explicit option, then ZAPIER_APPROVAL_MODE, then the default behavior (poll for interactive TTY, throw otherwise).'),
|
|
77
|
+
openAutoModeApprovalsInBrowser: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("By default, auto-mode approvals do not open in a browser. Enable this option to open the approval URL and watch the approval process. Resolution order is: explicit option, then ZAPIER_OPEN_AUTO_MODE_APPROVALS_IN_BROWSER, then false."),
|
|
77
81
|
// Internal
|
|
78
82
|
manifestPath: z
|
|
79
83
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-url.d.ts","sourceRoot":"","sources":["../../src/utils/open-url.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,OAAO,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"open-url.d.ts","sourceRoot":"","sources":["../../src/utils/open-url.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,OAAO,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,CAsEhD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/utils/open-url.js
CHANGED
|
@@ -58,6 +58,13 @@ const openUrl = async (url) => {
|
|
|
58
58
|
command = "rundll32";
|
|
59
59
|
args = ["url.dll,FileProtocolHandler", target];
|
|
60
60
|
}
|
|
61
|
+
else if (platform === "linux") {
|
|
62
|
+
// xdg-open hands the URL to the desktop's default handler. On a headless
|
|
63
|
+
// host it exits non-zero (no handler / no display); the `error` handler
|
|
64
|
+
// below and the caller's stderr fallback cover that case.
|
|
65
|
+
command = "xdg-open";
|
|
66
|
+
args = [target];
|
|
67
|
+
}
|
|
61
68
|
else {
|
|
62
69
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
63
70
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide whether `createConnection` should attempt to auto-open a browser
|
|
3
|
+
* tab. Used as the default for `browser: "auto"`. Callers can always force
|
|
4
|
+
* with `browser: "always"` or `browser: "never"`.
|
|
5
|
+
*
|
|
6
|
+
* Returns `false` only when we're confident the open would land somewhere
|
|
7
|
+
* the user can't act on:
|
|
8
|
+
*
|
|
9
|
+
* 1. CI — no human at the keyboard.
|
|
10
|
+
* 2. SSH session — the browser would launch on the remote host, not on
|
|
11
|
+
* the user's local machine.
|
|
12
|
+
* 3. Headless Linux — no display server means there's nowhere for a
|
|
13
|
+
* browser to land. (macOS / Windows are assumed to have a display.)
|
|
14
|
+
*
|
|
15
|
+
* Otherwise returns `true`. Notably this does NOT branch on `isTTY` or
|
|
16
|
+
* any agent env-var allowlist — the URL is always printed to stderr
|
|
17
|
+
* regardless, so a failed or skipped auto-open degrades gracefully to
|
|
18
|
+
* "user copies the printed URL." We bias toward opening because the cost
|
|
19
|
+
* of a false negative (user has to copy/paste) is small, while the cost
|
|
20
|
+
* of a false positive (browser opens in the wrong place) only really
|
|
21
|
+
* matters for the three scenarios above.
|
|
22
|
+
*/
|
|
23
|
+
export declare function shouldOpenBrowser(): boolean;
|
|
24
|
+
//# sourceMappingURL=should-open-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-open-browser.d.ts","sourceRoot":"","sources":["../../src/utils/should-open-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide whether `createConnection` should attempt to auto-open a browser
|
|
3
|
+
* tab. Used as the default for `browser: "auto"`. Callers can always force
|
|
4
|
+
* with `browser: "always"` or `browser: "never"`.
|
|
5
|
+
*
|
|
6
|
+
* Returns `false` only when we're confident the open would land somewhere
|
|
7
|
+
* the user can't act on:
|
|
8
|
+
*
|
|
9
|
+
* 1. CI — no human at the keyboard.
|
|
10
|
+
* 2. SSH session — the browser would launch on the remote host, not on
|
|
11
|
+
* the user's local machine.
|
|
12
|
+
* 3. Headless Linux — no display server means there's nowhere for a
|
|
13
|
+
* browser to land. (macOS / Windows are assumed to have a display.)
|
|
14
|
+
*
|
|
15
|
+
* Otherwise returns `true`. Notably this does NOT branch on `isTTY` or
|
|
16
|
+
* any agent env-var allowlist — the URL is always printed to stderr
|
|
17
|
+
* regardless, so a failed or skipped auto-open degrades gracefully to
|
|
18
|
+
* "user copies the printed URL." We bias toward opening because the cost
|
|
19
|
+
* of a false negative (user has to copy/paste) is small, while the cost
|
|
20
|
+
* of a false positive (browser opens in the wrong place) only really
|
|
21
|
+
* matters for the three scenarios above.
|
|
22
|
+
*/
|
|
23
|
+
export function shouldOpenBrowser() {
|
|
24
|
+
if (isCiEnv())
|
|
25
|
+
return false;
|
|
26
|
+
const env = globalThis.process?.env;
|
|
27
|
+
if (env?.SSH_TTY || env?.SSH_CONNECTION)
|
|
28
|
+
return false;
|
|
29
|
+
if (globalThis.process?.platform === "linux" &&
|
|
30
|
+
!env?.DISPLAY &&
|
|
31
|
+
!env?.WAYLAND_DISPLAY) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Inlined copy of `plugins/eventEmission/utils.ts`'s `isCi()`. Inlined
|
|
38
|
+
* rather than imported so `should-open-browser.ts` (a general util) doesn't
|
|
39
|
+
* reach into a peer plugin's internals — no other `utils/` file does that.
|
|
40
|
+
* Reads `globalThis.process?.env` to match `isCi()` and the rest of the core
|
|
41
|
+
* package's universal-SDK access pattern (safe in browser bundles).
|
|
42
|
+
*/
|
|
43
|
+
function isCiEnv() {
|
|
44
|
+
const env = globalThis.process?.env;
|
|
45
|
+
return !!(env?.CI ||
|
|
46
|
+
env?.CONTINUOUS_INTEGRATION ||
|
|
47
|
+
env?.GITHUB_ACTIONS ||
|
|
48
|
+
env?.JENKINS_URL ||
|
|
49
|
+
env?.GITLAB_CI ||
|
|
50
|
+
env?.CIRCLECI ||
|
|
51
|
+
env?.TRAVIS ||
|
|
52
|
+
env?.BUILDKITE ||
|
|
53
|
+
env?.DRONE ||
|
|
54
|
+
env?.BITBUCKET_PIPELINES_UUID);
|
|
55
|
+
}
|