@zapier/zapier-sdk 0.42.0 → 0.43.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.
- package/CHANGELOG.md +12 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +309 -35
- package/dist/api/types.d.ts +29 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +32 -0
- package/dist/index.cjs +616 -197
- package/dist/index.d.mts +241 -408
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +611 -198
- package/dist/plugins/api/index.d.ts +5 -1
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +6 -3
- package/dist/plugins/apps/index.d.ts +2 -3
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +1 -1
- package/dist/plugins/capabilities/index.d.ts +8 -6
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +3 -3
- package/dist/plugins/connections/index.d.ts +3 -1
- package/dist/plugins/connections/index.d.ts.map +1 -1
- package/dist/plugins/connections/index.js +2 -3
- package/dist/plugins/createClientCredentials/index.d.ts +6 -4
- package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/index.js +4 -3
- package/dist/plugins/createClientCredentials/schemas.d.ts +1 -0
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/schemas.js +6 -0
- package/dist/plugins/deleteClientCredentials/index.d.ts +6 -4
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +3 -3
- package/dist/plugins/deprecated/authentications.d.ts +9 -9
- package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.js +4 -4
- package/dist/plugins/eventEmission/index.d.ts +4 -5
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +8 -7
- package/dist/plugins/fetch/index.d.ts +6 -6
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +20 -6
- package/dist/plugins/findFirstConnection/index.d.ts +3 -4
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +2 -2
- package/dist/plugins/findUniqueConnection/index.d.ts +3 -4
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +2 -2
- package/dist/plugins/getAction/index.d.ts +7 -7
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +2 -2
- package/dist/plugins/getApp/index.d.ts +2 -3
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +2 -2
- package/dist/plugins/getConnection/index.d.ts +6 -6
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +3 -3
- package/dist/plugins/getInputFieldsSchema/index.d.ts +8 -6
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +4 -4
- package/dist/plugins/getProfile/index.d.ts +6 -6
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +3 -3
- package/dist/plugins/listActions/index.d.ts +8 -6
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +3 -3
- package/dist/plugins/listApps/index.d.ts +3 -3
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +3 -3
- package/dist/plugins/listClientCredentials/index.d.ts +6 -4
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +3 -3
- package/dist/plugins/listConnections/index.d.ts +8 -6
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +5 -5
- package/dist/plugins/listInputFieldChoices/index.d.ts +9 -8
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +4 -4
- package/dist/plugins/listInputFields/index.d.ts +8 -8
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +4 -4
- package/dist/plugins/manifest/index.d.ts +8 -3
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +2 -3
- package/dist/plugins/registry/index.d.ts +1 -2
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +3 -3
- package/dist/plugins/request/index.d.ts +3 -4
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +2 -2
- package/dist/plugins/runAction/index.d.ts +8 -8
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +17 -6
- package/dist/plugins/tables/createTable/index.d.ts +3 -5
- package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.js +3 -3
- package/dist/plugins/tables/createTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +3 -3
- package/dist/plugins/tables/createTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +3 -3
- package/dist/plugins/tables/deleteTable/index.d.ts +5 -5
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +4 -4
- package/dist/plugins/tables/deleteTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +3 -3
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +3 -3
- package/dist/plugins/tables/getTable/index.d.ts +3 -5
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +3 -3
- package/dist/plugins/tables/getTableRecord/index.d.ts +3 -5
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +3 -3
- package/dist/plugins/tables/listTableFields/index.d.ts +3 -5
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +3 -3
- package/dist/plugins/tables/listTableRecords/index.d.ts +3 -3
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +3 -3
- package/dist/plugins/tables/listTables/index.d.ts +5 -3
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +4 -4
- package/dist/plugins/tables/updateTableRecords/index.d.ts +3 -5
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +3 -3
- package/dist/resolvers/connectionId.js +1 -1
- package/dist/resolvers/tableId.js +1 -1
- package/dist/sdk.d.ts +29 -257
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +33 -43
- package/dist/types/errors.d.ts +37 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +18 -0
- package/dist/types/plugin.d.ts +29 -48
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/plugin.js +7 -3
- package/dist/types/sdk.d.ts +9 -3
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +20 -0
- package/dist/utils/open-approval.d.ts +2 -0
- package/dist/utils/open-approval.d.ts.map +1 -0
- package/dist/utils/open-approval.js +13 -0
- package/dist/utils/open-url.d.ts +3 -0
- package/dist/utils/open-url.d.ts.map +1 -0
- package/dist/utils/open-url.js +72 -0
- package/package.json +3 -1
package/dist/types/plugin.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ------------------------------
|
|
3
|
-
* Plugin Type System
|
|
3
|
+
* Plugin Type System
|
|
4
4
|
* ------------------------------
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Plugins receive the sdk as a positional parameter. sdk.context holds shared
|
|
7
|
+
* internal state (api client, event emission, meta, options, etc.). SDK methods
|
|
8
|
+
* live at the root, context nests under .context.
|
|
9
|
+
*
|
|
10
|
+
* A plugin is (sdk) => partialSdk. createSdk() returns an empty SDK. addPlugin
|
|
11
|
+
* merges the plugin's result into the SDK, producing a new SDK.
|
|
8
12
|
*/
|
|
9
13
|
export {};
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -58,6 +58,13 @@ export declare const BaseSdkOptionsSchema: z.ZodObject<{
|
|
|
58
58
|
trackingBaseUrl: z.ZodOptional<z.ZodString>;
|
|
59
59
|
maxNetworkRetries: z.ZodOptional<z.ZodNumber>;
|
|
60
60
|
maxNetworkRetryDelayMs: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
isInteractive: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
approvalTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
maxApprovalRetries: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
approvalMode: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
poll: "poll";
|
|
66
|
+
fail: "fail";
|
|
67
|
+
}>>;
|
|
61
68
|
manifestPath: z.ZodOptional<z.ZodString>;
|
|
62
69
|
manifest: z.ZodOptional<z.ZodCustom<Manifest, Manifest>>;
|
|
63
70
|
onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
|
|
@@ -98,7 +105,6 @@ import type { ListInputFieldsPluginProvides } from "../plugins/listInputFields";
|
|
|
98
105
|
import type { GetInputFieldsSchemaPluginProvides } from "../plugins/getInputFieldsSchema";
|
|
99
106
|
import type { ListInputFieldChoicesPluginProvides } from "../plugins/listInputFieldChoices";
|
|
100
107
|
import type { RequestPluginProvides } from "../plugins/request";
|
|
101
|
-
import type { GetSdkType } from "./plugin";
|
|
102
108
|
import type { ManifestPluginProvides } from "../plugins/manifest";
|
|
103
109
|
import type { ListTablesPluginProvides } from "../plugins/tables/listTables";
|
|
104
110
|
import type { GetTablePluginProvides } from "../plugins/tables/getTable";
|
|
@@ -151,7 +157,7 @@ export interface FunctionDeprecation {
|
|
|
151
157
|
}
|
|
152
158
|
export interface ZapierSdkFunctions extends ListInputFieldsSdkFunction, GetConnectionSdkFunction, FindFirstConnectionSdkFunction, FindUniqueConnectionSdkFunction, RelayRequestSdkFunction {
|
|
153
159
|
}
|
|
154
|
-
export
|
|
160
|
+
export type ZapierSdk = RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & ListConnectionsPluginProvides & GetConnectionPluginProvides & FindFirstConnectionPluginProvides & FindUniqueConnectionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListClientCredentialsPluginProvides & CreateClientCredentialsPluginProvides & DeleteClientCredentialsPluginProvides & ListInputFieldsPluginProvides & GetInputFieldsSchemaPluginProvides & ListInputFieldChoicesPluginProvides & RequestPluginProvides & GetProfilePluginProvides & EventEmissionProvides & ApiPluginProvides & ListTablesPluginProvides & GetTablePluginProvides & DeleteTablePluginProvides & CreateTablePluginProvides & ListTableFieldsPluginProvides & CreateTableFieldsPluginProvides & DeleteTableFieldsPluginProvides & GetTableRecordPluginProvides & ListTableRecordsPluginProvides & CreateTableRecordsPluginProvides & DeleteTableRecordsPluginProvides & UpdateTableRecordsPluginProvides & {
|
|
155
161
|
apps: ActionProxy & ZapierSdkApps;
|
|
156
|
-
}
|
|
162
|
+
};
|
|
157
163
|
//# sourceMappingURL=sdk.d.ts.map
|
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;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,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;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4F/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,K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B,6BAA6B,GAC7B,2BAA2B,GAC3B,iCAAiC,GACjC,kCAAkC,GAClC,iCAAiC,GACjC,+BAA+B,GAC/B,qCAAqC,GACrC,sCAAsC,GACtC,mCAAmC,GACnC,qCAAqC,GACrC,qCAAqC,GACrC,6BAA6B,GAC7B,kCAAkC,GAClC,mCAAmC,GACnC,qBAAqB,GACrB,wBAAwB,GACxB,qBAAqB,GACrB,iBAAiB,GACjB,wBAAwB,GACxB,sBAAsB,GACtB,yBAAyB,GACzB,yBAAyB,GACzB,6BAA6B,GAC7B,+BAA+B,GAC/B,+BAA+B,GAC/B,4BAA4B,GAC5B,8BAA8B,GAC9B,gCAAgC,GAChC,gCAAgC,GAChC,gCAAgC,GAAG;IACjC,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;CACnC,CAAC"}
|
package/dist/types/sdk.js
CHANGED
|
@@ -36,6 +36,26 @@ export const BaseSdkOptionsSchema = z.object({
|
|
|
36
36
|
.optional()
|
|
37
37
|
.describe("Max delay in ms to wait for retry (default: 60000).")
|
|
38
38
|
.meta({ valueHint: "ms" }),
|
|
39
|
+
isInteractive: z
|
|
40
|
+
.boolean()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Whether this session is interactive (user can visit approval URLs). Defaults to ZAPIER_IS_INTERACTIVE env var.")
|
|
43
|
+
.meta({ internal: true }),
|
|
44
|
+
approvalTimeoutMs: z
|
|
45
|
+
.number()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe("Timeout in ms for approval polling. Default: 600000 (10 min).")
|
|
48
|
+
.meta({ valueHint: "ms", internal: true }),
|
|
49
|
+
maxApprovalRetries: z
|
|
50
|
+
.number()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2.")
|
|
53
|
+
.meta({ internal: true }),
|
|
54
|
+
approvalMode: z
|
|
55
|
+
.enum(["poll", "fail"])
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Approval flow behavior. "poll" opens browser and polls (default). "fail" creates the approval and throws immediately with the approval URL.')
|
|
58
|
+
.meta({ internal: true }),
|
|
39
59
|
// Internal
|
|
40
60
|
manifestPath: z
|
|
41
61
|
.string()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-approval.d.ts","sourceRoot":"","sources":["../../src/utils/open-approval.ts"],"names":[],"mappings":"AAEA,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAU7D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import openUrl from "./open-url";
|
|
2
|
+
export async function openApproval(url) {
|
|
3
|
+
// Always surface the URL so the user has a clickable fallback if openUrl
|
|
4
|
+
// silently no-ops (headless servers, WSL without a handler, misconfigured
|
|
5
|
+
// default browser, etc.).
|
|
6
|
+
console.error(`Approval required. Opening browser: ${url}`);
|
|
7
|
+
try {
|
|
8
|
+
await openUrl(url);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// Best-effort — URL already printed to stderr above.
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +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,CAgEhD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// String-literal `import("node:child_process")` is statically resolved by
|
|
2
|
+
// esbuild and ends up as `import('child_process')` in dist/index.mjs, which
|
|
3
|
+
// then fails when downstream consumers bundle the SDK with platform: "browser".
|
|
4
|
+
// Wrapping the specifier in a template literal makes esbuild (and every other
|
|
5
|
+
// modern bundler) treat the call as a truly dynamic import and leave it alone.
|
|
6
|
+
// At runtime the catch below handles the failure when the host has neither
|
|
7
|
+
// window.open nor node built-ins.
|
|
8
|
+
const nodePrefix = "node:";
|
|
9
|
+
async function loadChildProcess() {
|
|
10
|
+
return import(`${nodePrefix}child_process`);
|
|
11
|
+
}
|
|
12
|
+
async function loadProcess() {
|
|
13
|
+
return import(`${nodePrefix}process`);
|
|
14
|
+
}
|
|
15
|
+
const openUrl = async (url) => {
|
|
16
|
+
if (typeof url !== "string") {
|
|
17
|
+
throw new TypeError("Expected `url` to be a string");
|
|
18
|
+
}
|
|
19
|
+
let parsed;
|
|
20
|
+
try {
|
|
21
|
+
parsed = new URL(url);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
25
|
+
}
|
|
26
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
27
|
+
throw new Error(`Refusing to open non-http(s) URL: ${parsed.protocol}`);
|
|
28
|
+
}
|
|
29
|
+
const target = parsed.toString();
|
|
30
|
+
// Browser: `noopener` prevents the opened page from touching window.opener.
|
|
31
|
+
if (typeof globalThis.window !== "undefined" &&
|
|
32
|
+
typeof globalThis.window.open === "function") {
|
|
33
|
+
globalThis.window.open(target, "_blank", "noopener");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let spawn;
|
|
37
|
+
let platform;
|
|
38
|
+
try {
|
|
39
|
+
const [cp, proc] = await Promise.all([loadChildProcess(), loadProcess()]);
|
|
40
|
+
spawn = cp.spawn;
|
|
41
|
+
platform = proc.platform;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
throw new Error("openUrl: no supported runtime. window.open is unavailable and node:child_process could not be loaded.");
|
|
45
|
+
}
|
|
46
|
+
if (typeof spawn !== "function") {
|
|
47
|
+
throw new Error("openUrl: child_process.spawn is not available in this runtime");
|
|
48
|
+
}
|
|
49
|
+
let command;
|
|
50
|
+
let args;
|
|
51
|
+
if (platform === "darwin") {
|
|
52
|
+
command = "open";
|
|
53
|
+
args = [target];
|
|
54
|
+
}
|
|
55
|
+
else if (platform === "win32") {
|
|
56
|
+
// rundll32 dispatches to the default URL handler without going through
|
|
57
|
+
// cmd.exe, avoiding `&`/`^`/`|` metacharacter pitfalls.
|
|
58
|
+
command = "rundll32";
|
|
59
|
+
args = ["url.dll,FileProtocolHandler", target];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
63
|
+
}
|
|
64
|
+
const child = spawn(command, args, {
|
|
65
|
+
stdio: "ignore",
|
|
66
|
+
detached: true,
|
|
67
|
+
windowsHide: true,
|
|
68
|
+
});
|
|
69
|
+
child.once("error", () => { });
|
|
70
|
+
child.unref();
|
|
71
|
+
};
|
|
72
|
+
export default openUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
+
"@zapier/policy-context": "0.7.0",
|
|
73
|
+
"@zapier/policy-schema": "0.11.0",
|
|
72
74
|
"@zapier/zapier-sdk-core": "^0.8.0",
|
|
73
75
|
"zod": "4.2.1"
|
|
74
76
|
},
|