@zapier/zapier-sdk-cli 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +27 -0
- package/README.md +5 -5
- package/dist/cli.cjs +986 -823
- package/dist/cli.mjs +987 -824
- package/dist/experimental.cjs +867 -745
- package/dist/experimental.d.mts +2 -1
- package/dist/experimental.d.ts +2 -1
- package/dist/experimental.mjs +870 -748
- package/dist/extensions-GB0w0RUO.d.mts +533 -0
- package/dist/extensions-GB0w0RUO.d.ts +533 -0
- package/dist/index.cjs +843 -745
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +843 -745
- package/package.json +3 -3
- package/dist/extensions-N27h0wrp.d.mts +0 -568
- package/dist/extensions-N27h0wrp.d.ts +0 -568
package/dist/index.cjs
CHANGED
|
@@ -9,12 +9,12 @@ var path = require('path');
|
|
|
9
9
|
var lockfile = require('proper-lockfile');
|
|
10
10
|
var zapierSdk = require('@zapier/zapier-sdk');
|
|
11
11
|
var zod = require('zod');
|
|
12
|
+
var chalk3 = require('chalk');
|
|
12
13
|
var os = require('os');
|
|
13
14
|
var inquirer = require('inquirer');
|
|
14
15
|
var express = require('express');
|
|
15
16
|
var promises$1 = require('readline/promises');
|
|
16
17
|
var open = require('open');
|
|
17
|
-
var chalk3 = require('chalk');
|
|
18
18
|
var ora = require('ora');
|
|
19
19
|
var pkceChallenge = require('pkce-challenge');
|
|
20
20
|
var zapierSdkMcp = require('@zapier/zapier-sdk-mcp');
|
|
@@ -25,6 +25,7 @@ require('is-installed-globally');
|
|
|
25
25
|
var child_process = require('child_process');
|
|
26
26
|
var Handlebars = require('handlebars');
|
|
27
27
|
var url = require('url');
|
|
28
|
+
var experimental = require('@zapier/zapier-sdk/experimental');
|
|
28
29
|
require('wrap-ansi');
|
|
29
30
|
|
|
30
31
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -54,10 +55,10 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
54
55
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
55
56
|
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
56
57
|
var lockfile__namespace = /*#__PURE__*/_interopNamespace(lockfile);
|
|
58
|
+
var chalk3__default = /*#__PURE__*/_interopDefault(chalk3);
|
|
57
59
|
var inquirer__default = /*#__PURE__*/_interopDefault(inquirer);
|
|
58
60
|
var express__default = /*#__PURE__*/_interopDefault(express);
|
|
59
61
|
var open__default = /*#__PURE__*/_interopDefault(open);
|
|
60
|
-
var chalk3__default = /*#__PURE__*/_interopDefault(chalk3);
|
|
61
62
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
62
63
|
var pkceChallenge__default = /*#__PURE__*/_interopDefault(pkceChallenge);
|
|
63
64
|
var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
|
|
@@ -873,6 +874,11 @@ function getConfigPath() {
|
|
|
873
874
|
return cfg.path;
|
|
874
875
|
}
|
|
875
876
|
|
|
877
|
+
// src/utils/string-utils.ts
|
|
878
|
+
function toKebabCase(str) {
|
|
879
|
+
return str.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
|
|
880
|
+
}
|
|
881
|
+
|
|
876
882
|
// src/utils/retry.ts
|
|
877
883
|
function sleep(ms) {
|
|
878
884
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
@@ -2074,7 +2080,7 @@ function promptlessLegacyJwtUpgradeError() {
|
|
|
2074
2080
|
);
|
|
2075
2081
|
}
|
|
2076
2082
|
async function clearExistingAuthState({
|
|
2077
|
-
|
|
2083
|
+
imports,
|
|
2078
2084
|
baseUrl,
|
|
2079
2085
|
interactive,
|
|
2080
2086
|
entryPoint
|
|
@@ -2095,7 +2101,7 @@ Log out and ${getActiveCredentialsAction(entryPoint)}?`
|
|
|
2095
2101
|
}
|
|
2096
2102
|
try {
|
|
2097
2103
|
await revokeCredentials({
|
|
2098
|
-
api:
|
|
2104
|
+
api: imports.api,
|
|
2099
2105
|
credentials: activeCredentials
|
|
2100
2106
|
});
|
|
2101
2107
|
} catch {
|
|
@@ -2160,13 +2166,13 @@ async function saveClientCredentials({
|
|
|
2160
2166
|
return { clientId };
|
|
2161
2167
|
}
|
|
2162
2168
|
function emitAccountAuthSuccess({
|
|
2163
|
-
|
|
2169
|
+
imports,
|
|
2164
2170
|
profile,
|
|
2165
2171
|
clientId,
|
|
2166
2172
|
isNonInteractive,
|
|
2167
2173
|
isHeadless
|
|
2168
2174
|
}) {
|
|
2169
|
-
|
|
2175
|
+
imports.eventEmission.emit(
|
|
2170
2176
|
"platform.sdk.ApplicationLifecycleEvent",
|
|
2171
2177
|
zapierSdk.buildApplicationLifecycleEvent(
|
|
2172
2178
|
{
|
|
@@ -2185,11 +2191,11 @@ function emitAccountAuthSuccess({
|
|
|
2185
2191
|
);
|
|
2186
2192
|
}
|
|
2187
2193
|
function emitSignupSuccess({
|
|
2188
|
-
|
|
2194
|
+
imports,
|
|
2189
2195
|
isNonInteractive,
|
|
2190
2196
|
isHeadless
|
|
2191
2197
|
}) {
|
|
2192
|
-
|
|
2198
|
+
imports.eventEmission.emit(
|
|
2193
2199
|
"platform.sdk.ApplicationLifecycleEvent",
|
|
2194
2200
|
zapierSdk.buildApplicationLifecycleEvent({
|
|
2195
2201
|
lifecycle_event_type: "signup_success",
|
|
@@ -2208,7 +2214,7 @@ async function runOauthWithRedaction(runOauth) {
|
|
|
2208
2214
|
}
|
|
2209
2215
|
}
|
|
2210
2216
|
async function runOauthForEntryPoint({
|
|
2211
|
-
|
|
2217
|
+
imports,
|
|
2212
2218
|
entryPoint,
|
|
2213
2219
|
timeoutMs,
|
|
2214
2220
|
pkceCredentials,
|
|
@@ -2228,7 +2234,7 @@ async function runOauthForEntryPoint({
|
|
|
2228
2234
|
onProgress: (event) => {
|
|
2229
2235
|
if (event.type === "callback_accepted") {
|
|
2230
2236
|
emitSignupSuccess({
|
|
2231
|
-
|
|
2237
|
+
imports,
|
|
2232
2238
|
isNonInteractive: false,
|
|
2233
2239
|
isHeadless: headless === true
|
|
2234
2240
|
});
|
|
@@ -2249,7 +2255,7 @@ async function runOauthForEntryPoint({
|
|
|
2249
2255
|
);
|
|
2250
2256
|
}
|
|
2251
2257
|
async function provisionAccountCredentials({
|
|
2252
|
-
|
|
2258
|
+
imports,
|
|
2253
2259
|
entryPoint,
|
|
2254
2260
|
accessToken,
|
|
2255
2261
|
credentialsBaseUrl,
|
|
@@ -2262,7 +2268,7 @@ async function provisionAccountCredentials({
|
|
|
2262
2268
|
const scopedApi = zapierSdk.getOrCreateApiClient({
|
|
2263
2269
|
credentials: accessToken,
|
|
2264
2270
|
baseUrl: credentialsBaseUrl,
|
|
2265
|
-
callerPackage:
|
|
2271
|
+
callerPackage: imports.sdkOptions?.callerPackage
|
|
2266
2272
|
});
|
|
2267
2273
|
const profile = await getProfile(scopedApi);
|
|
2268
2274
|
process.stderr.write(`${getProfileMessage(entryPoint, profile.email)}
|
|
@@ -2291,7 +2297,7 @@ async function provisionAccountCredentials({
|
|
|
2291
2297
|
process.stderr.write("\u{1F510} Approvals are enabled for these credentials.\n");
|
|
2292
2298
|
}
|
|
2293
2299
|
emitAccountAuthSuccess({
|
|
2294
|
-
|
|
2300
|
+
imports,
|
|
2295
2301
|
profile,
|
|
2296
2302
|
clientId,
|
|
2297
2303
|
isNonInteractive,
|
|
@@ -2299,7 +2305,7 @@ async function provisionAccountCredentials({
|
|
|
2299
2305
|
});
|
|
2300
2306
|
}
|
|
2301
2307
|
async function runAccountAuth({
|
|
2302
|
-
|
|
2308
|
+
imports,
|
|
2303
2309
|
options,
|
|
2304
2310
|
entryPoint
|
|
2305
2311
|
}) {
|
|
@@ -2331,7 +2337,7 @@ async function runAccountAuth({
|
|
|
2331
2337
|
}
|
|
2332
2338
|
}
|
|
2333
2339
|
if (!await clearExistingAuthState({
|
|
2334
|
-
|
|
2340
|
+
imports,
|
|
2335
2341
|
baseUrl: pending.credentialsBaseUrl,
|
|
2336
2342
|
interactive: false,
|
|
2337
2343
|
entryPoint
|
|
@@ -2345,7 +2351,7 @@ async function runAccountAuth({
|
|
|
2345
2351
|
onProgress: (event) => {
|
|
2346
2352
|
if (entryPoint === "signup" && event.type === "callback_accepted") {
|
|
2347
2353
|
emitSignupSuccess({
|
|
2348
|
-
|
|
2354
|
+
imports,
|
|
2349
2355
|
isNonInteractive: true,
|
|
2350
2356
|
isHeadless: pending.headless
|
|
2351
2357
|
});
|
|
@@ -2354,7 +2360,7 @@ async function runAccountAuth({
|
|
|
2354
2360
|
});
|
|
2355
2361
|
});
|
|
2356
2362
|
await provisionAccountCredentials({
|
|
2357
|
-
|
|
2363
|
+
imports,
|
|
2358
2364
|
entryPoint,
|
|
2359
2365
|
accessToken: accessToken2,
|
|
2360
2366
|
credentialsBaseUrl: pending.credentialsBaseUrl,
|
|
@@ -2368,11 +2374,11 @@ async function runAccountAuth({
|
|
|
2368
2374
|
}
|
|
2369
2375
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
2370
2376
|
const interactive = !resolveNonInteractive(options);
|
|
2371
|
-
const resolvedCredentials = await
|
|
2377
|
+
const resolvedCredentials = await imports.resolveCredentials();
|
|
2372
2378
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
2373
2379
|
const headless = options.headless === true;
|
|
2374
2380
|
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
2375
|
-
|
|
2381
|
+
options: imports.sdkOptions,
|
|
2376
2382
|
resolvedCredentials
|
|
2377
2383
|
});
|
|
2378
2384
|
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
@@ -2387,7 +2393,7 @@ async function runAccountAuth({
|
|
|
2387
2393
|
}
|
|
2388
2394
|
}
|
|
2389
2395
|
if (!await clearExistingAuthState({
|
|
2390
|
-
|
|
2396
|
+
imports,
|
|
2391
2397
|
baseUrl: credentialsBaseUrl,
|
|
2392
2398
|
interactive,
|
|
2393
2399
|
entryPoint
|
|
@@ -2408,7 +2414,7 @@ async function runAccountAuth({
|
|
|
2408
2414
|
return;
|
|
2409
2415
|
}
|
|
2410
2416
|
const { accessToken } = await runOauthForEntryPoint({
|
|
2411
|
-
|
|
2417
|
+
imports,
|
|
2412
2418
|
entryPoint,
|
|
2413
2419
|
timeoutMs: timeoutSeconds * 1e3,
|
|
2414
2420
|
pkceCredentials,
|
|
@@ -2417,7 +2423,7 @@ async function runAccountAuth({
|
|
|
2417
2423
|
interactive
|
|
2418
2424
|
});
|
|
2419
2425
|
await provisionAccountCredentials({
|
|
2420
|
-
|
|
2426
|
+
imports,
|
|
2421
2427
|
entryPoint,
|
|
2422
2428
|
accessToken,
|
|
2423
2429
|
credentialsBaseUrl,
|
|
@@ -2462,17 +2468,26 @@ var LoginSchema = zod.z.object({
|
|
|
2462
2468
|
});
|
|
2463
2469
|
|
|
2464
2470
|
// src/plugins/login/index.ts
|
|
2465
|
-
var loginPlugin = zapierSdk.
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2471
|
+
var loginPlugin = zapierSdk.defineMethod({
|
|
2472
|
+
name: "login",
|
|
2473
|
+
imports: [
|
|
2474
|
+
zapierSdk.apiPluginRef,
|
|
2475
|
+
zapierSdk.resolveCredentialsPluginRef,
|
|
2476
|
+
zapierSdk.eventEmissionPluginRef,
|
|
2477
|
+
zapierSdk.sdkOptionsPluginRef
|
|
2478
|
+
],
|
|
2479
|
+
output: "raw",
|
|
2480
|
+
inputSchema: LoginSchema,
|
|
2481
|
+
categories: ["account"],
|
|
2482
|
+
supportsJsonOutput: false,
|
|
2483
|
+
run: async ({ imports, input }) => {
|
|
2484
|
+
await runAccountAuth({
|
|
2485
|
+
imports,
|
|
2486
|
+
options: input,
|
|
2487
|
+
entryPoint: "login"
|
|
2488
|
+
});
|
|
2489
|
+
}
|
|
2490
|
+
});
|
|
2476
2491
|
var SignupSchema = zod.z.object({
|
|
2477
2492
|
timeout: zod.z.string().optional().describe("Signup timeout in seconds (default: 300)"),
|
|
2478
2493
|
useApprovals: zod.z.boolean().optional().describe(
|
|
@@ -2504,68 +2519,92 @@ var SignupSchema = zod.z.object({
|
|
|
2504
2519
|
});
|
|
2505
2520
|
|
|
2506
2521
|
// src/plugins/signup/index.ts
|
|
2507
|
-
var signupPlugin = zapierSdk.
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2522
|
+
var signupPlugin = zapierSdk.defineMethod({
|
|
2523
|
+
name: "signup",
|
|
2524
|
+
imports: [
|
|
2525
|
+
zapierSdk.apiPluginRef,
|
|
2526
|
+
zapierSdk.resolveCredentialsPluginRef,
|
|
2527
|
+
zapierSdk.eventEmissionPluginRef,
|
|
2528
|
+
zapierSdk.sdkOptionsPluginRef
|
|
2529
|
+
],
|
|
2530
|
+
output: "raw",
|
|
2531
|
+
inputSchema: SignupSchema,
|
|
2532
|
+
categories: ["account"],
|
|
2533
|
+
supportsJsonOutput: false,
|
|
2534
|
+
run: async ({ imports, input }) => {
|
|
2535
|
+
await runAccountAuth({
|
|
2536
|
+
imports,
|
|
2537
|
+
options: input,
|
|
2538
|
+
entryPoint: "signup"
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
});
|
|
2518
2542
|
var LogoutSchema = zod.z.object({}).describe("Log out of your Zapier account");
|
|
2519
2543
|
|
|
2520
2544
|
// src/plugins/logout/index.ts
|
|
2521
|
-
var logoutPlugin = zapierSdk.
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
await
|
|
2539
|
-
api: sdk2.context.api,
|
|
2540
|
-
credentials: activeCredentials,
|
|
2541
|
-
onEvent,
|
|
2542
|
-
alwaysClearLocalState: true
|
|
2543
|
-
});
|
|
2545
|
+
var logoutPlugin = zapierSdk.defineMethod({
|
|
2546
|
+
name: "logout",
|
|
2547
|
+
imports: [zapierSdk.apiPluginRef, zapierSdk.resolveCredentialsPluginRef, zapierSdk.sdkOptionsPluginRef],
|
|
2548
|
+
output: "raw",
|
|
2549
|
+
inputSchema: LogoutSchema,
|
|
2550
|
+
categories: ["account"],
|
|
2551
|
+
supportsJsonOutput: false,
|
|
2552
|
+
run: async ({ imports }) => {
|
|
2553
|
+
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
2554
|
+
resolveCredentials: imports.resolveCredentials,
|
|
2555
|
+
options: imports.sdkOptions
|
|
2556
|
+
});
|
|
2557
|
+
const activeCredentials = getActiveCredentials({
|
|
2558
|
+
baseUrl: credentialsBaseUrl
|
|
2559
|
+
});
|
|
2560
|
+
const onEvent = imports.sdkOptions?.onEvent;
|
|
2561
|
+
if (!activeCredentials) {
|
|
2562
|
+
await logout({ onEvent });
|
|
2544
2563
|
console.log("\u2705 Successfully logged out");
|
|
2564
|
+
return;
|
|
2545
2565
|
}
|
|
2546
|
-
|
|
2547
|
-
|
|
2566
|
+
await revokeCredentials({
|
|
2567
|
+
api: imports.api,
|
|
2568
|
+
credentials: activeCredentials,
|
|
2569
|
+
onEvent,
|
|
2570
|
+
alwaysClearLocalState: true
|
|
2571
|
+
});
|
|
2572
|
+
console.log("\u2705 Successfully logged out");
|
|
2573
|
+
}
|
|
2574
|
+
});
|
|
2575
|
+
var CLI_EXTENSIONS_ID = "cli/extensions";
|
|
2576
|
+
var cliExtensionsPluginRef = zapierSdk.declareOptionalProperty({
|
|
2577
|
+
id: CLI_EXTENSIONS_ID
|
|
2578
|
+
});
|
|
2579
|
+
var CLI_EXPERIMENTAL_ID = "cli/experimental";
|
|
2580
|
+
var cliExperimentalPluginRef = zapierSdk.declareOptionalProperty({
|
|
2581
|
+
id: CLI_EXPERIMENTAL_ID
|
|
2582
|
+
});
|
|
2548
2583
|
var McpSchema = zod.z.object({
|
|
2549
2584
|
port: zod.z.string().optional().describe("Port to listen on (for future HTTP transport)")
|
|
2550
2585
|
}).describe("Start MCP server for Zapier SDK");
|
|
2551
2586
|
|
|
2552
2587
|
// src/plugins/mcp/index.ts
|
|
2553
|
-
var mcpPlugin = zapierSdk.
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2588
|
+
var mcpPlugin = zapierSdk.defineMethod({
|
|
2589
|
+
name: "mcp",
|
|
2590
|
+
imports: [
|
|
2591
|
+
zapierSdk.sdkOptionsPluginRef,
|
|
2592
|
+
cliExtensionsPluginRef,
|
|
2593
|
+
cliExperimentalPluginRef
|
|
2594
|
+
],
|
|
2595
|
+
output: "raw",
|
|
2596
|
+
inputSchema: McpSchema,
|
|
2597
|
+
categories: ["utility"],
|
|
2598
|
+
run: async ({ imports, input }) => {
|
|
2599
|
+
await zapierSdkMcp.startMcpServer({
|
|
2600
|
+
...input,
|
|
2601
|
+
debug: imports.sdkOptions?.debug,
|
|
2602
|
+
maxConcurrentRequests: imports.sdkOptions?.maxConcurrentRequests,
|
|
2603
|
+
extensions: imports.extensions,
|
|
2604
|
+
experimental: imports.experimental
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
});
|
|
2569
2608
|
var BundleCodeSchema = zod.z.object({
|
|
2570
2609
|
input: zod.z.string().min(1).describe("Input TypeScript file path to bundle"),
|
|
2571
2610
|
output: zapierSdk.OutputPropertySchema.optional().describe(
|
|
@@ -2576,15 +2615,16 @@ var BundleCodeSchema = zod.z.object({
|
|
|
2576
2615
|
target: zod.z.string().optional().describe("ECMAScript target version"),
|
|
2577
2616
|
cjs: zod.z.boolean().optional().describe("Output CommonJS format instead of ESM")
|
|
2578
2617
|
}).describe("Bundle TypeScript code into executable JavaScript");
|
|
2579
|
-
var bundleCodePlugin = zapierSdk.
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
)
|
|
2618
|
+
var bundleCodePlugin = zapierSdk.defineMethod({
|
|
2619
|
+
name: "bundleCode",
|
|
2620
|
+
categories: ["utility"],
|
|
2621
|
+
deprecation: { message: "bundleCode is no longer maintained." },
|
|
2622
|
+
inputSchema: BundleCodeSchema,
|
|
2623
|
+
// Returns the bundled code string verbatim — no `{ data }` envelope,
|
|
2624
|
+
// matching legacy.
|
|
2625
|
+
output: "raw",
|
|
2626
|
+
run: async ({ input }) => bundleCode(input)
|
|
2627
|
+
});
|
|
2588
2628
|
async function bundleCode(options) {
|
|
2589
2629
|
const {
|
|
2590
2630
|
input,
|
|
@@ -2641,14 +2681,16 @@ async function bundleCode(options) {
|
|
|
2641
2681
|
}
|
|
2642
2682
|
}
|
|
2643
2683
|
var GetLoginConfigPathSchema = zod.z.object({}).describe("Show the path to the login configuration file");
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2684
|
+
|
|
2685
|
+
// src/plugins/getLoginConfigPath/index.ts
|
|
2686
|
+
var getLoginConfigPathPlugin = zapierSdk.defineMethod({
|
|
2687
|
+
name: "getLoginConfigPath",
|
|
2688
|
+
categories: ["utility"],
|
|
2689
|
+
inputSchema: GetLoginConfigPathSchema,
|
|
2690
|
+
// Returns the path string verbatim — no `{ data }` envelope, matching legacy.
|
|
2691
|
+
output: "raw",
|
|
2692
|
+
run: async () => getConfigPath()
|
|
2693
|
+
});
|
|
2652
2694
|
var AddSchema = zod.z.object({
|
|
2653
2695
|
apps: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
2654
2696
|
"One or more app keys to add (e.g., 'slack', 'github', 'trello')"
|
|
@@ -2676,105 +2718,107 @@ async function detectTypesOutputDirectory() {
|
|
|
2676
2718
|
}
|
|
2677
2719
|
return "./zapier/apps/";
|
|
2678
2720
|
}
|
|
2679
|
-
var
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
switch (event.type) {
|
|
2726
|
-
case "connections_lookup_start":
|
|
2727
|
-
console.log(`\u{1F510} Looking up ${event.count} connection(s)...`);
|
|
2728
|
-
break;
|
|
2729
|
-
case "connections_lookup_complete":
|
|
2730
|
-
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
2731
|
-
break;
|
|
2732
|
-
case "connection_matched":
|
|
2733
|
-
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2734
|
-
console.log(
|
|
2735
|
-
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
2736
|
-
);
|
|
2737
|
-
break;
|
|
2738
|
-
case "connection_not_matched":
|
|
2739
|
-
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2740
|
-
console.warn(
|
|
2741
|
-
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
2742
|
-
);
|
|
2743
|
-
break;
|
|
2744
|
-
case "file_written":
|
|
2745
|
-
console.log(
|
|
2746
|
-
`\u{1F527} Generated types for ${event.manifestKey} at ${event.filePath}`
|
|
2747
|
-
);
|
|
2748
|
-
break;
|
|
2749
|
-
case "app_processing_error":
|
|
2750
|
-
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2751
|
-
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2752
|
-
break;
|
|
2753
|
-
}
|
|
2754
|
-
};
|
|
2755
|
-
const manifestResult = await sdk2.buildManifest({
|
|
2756
|
-
apps: appKeys,
|
|
2757
|
-
skipWrite: false,
|
|
2758
|
-
configPath,
|
|
2759
|
-
onProgress: handleManifestProgress
|
|
2760
|
-
});
|
|
2761
|
-
const typesResult = await sdk2.generateAppTypes({
|
|
2762
|
-
apps: appKeys,
|
|
2763
|
-
connections: connectionIds,
|
|
2764
|
-
skipWrite: false,
|
|
2765
|
-
typesOutputDirectory: resolvedTypesOutput,
|
|
2766
|
-
onProgress: handleTypesProgress
|
|
2767
|
-
});
|
|
2768
|
-
const results = manifestResult.manifest?.apps || {};
|
|
2769
|
-
const successfulApps = Object.keys(results).filter(
|
|
2770
|
-
(manifestKey) => typesResult.writtenFiles?.[manifestKey]
|
|
2771
|
-
);
|
|
2772
|
-
if (successfulApps.length > 0) {
|
|
2773
|
-
console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
|
|
2721
|
+
var buildManifestRef = zapierSdk.declareMethod({ id: "buildManifest" });
|
|
2722
|
+
var generateAppTypesRef = zapierSdk.declareMethod({ id: "generateAppTypes" });
|
|
2723
|
+
var addAppsPlugin = zapierSdk.defineMethod({
|
|
2724
|
+
name: "add",
|
|
2725
|
+
imports: [buildManifestRef, generateAppTypesRef],
|
|
2726
|
+
output: "raw",
|
|
2727
|
+
categories: ["utility"],
|
|
2728
|
+
inputSchema: AddSchema,
|
|
2729
|
+
run: async ({ imports, input }) => {
|
|
2730
|
+
const {
|
|
2731
|
+
apps: appKeys,
|
|
2732
|
+
connections: connectionIds,
|
|
2733
|
+
configPath,
|
|
2734
|
+
typesOutput = await detectTypesOutputDirectory()
|
|
2735
|
+
} = input;
|
|
2736
|
+
const resolvedTypesOutput = path.resolve(typesOutput);
|
|
2737
|
+
console.log(`\u{1F4E6} Adding ${appKeys.length} app(s)...`);
|
|
2738
|
+
const appSlugAndKeyMap = /* @__PURE__ */ new Map();
|
|
2739
|
+
const handleManifestProgress = (event) => {
|
|
2740
|
+
switch (event.type) {
|
|
2741
|
+
case "apps_lookup_start":
|
|
2742
|
+
console.log(`\u{1F4E6} Looking up ${event.count} app(s)...`);
|
|
2743
|
+
break;
|
|
2744
|
+
case "app_found":
|
|
2745
|
+
const displayName = event.app.slug ? `${event.app.slug} (${event.app.key})` : event.app.key;
|
|
2746
|
+
appSlugAndKeyMap.set(event.app.key, displayName);
|
|
2747
|
+
break;
|
|
2748
|
+
case "apps_lookup_complete":
|
|
2749
|
+
if (event.count === 0) {
|
|
2750
|
+
console.warn("\u26A0\uFE0F No apps found");
|
|
2751
|
+
}
|
|
2752
|
+
break;
|
|
2753
|
+
case "app_processing_start":
|
|
2754
|
+
const appName = event.slug ? `${event.slug} (${event.app})` : event.app;
|
|
2755
|
+
console.log(`\u{1F4E6} Adding ${appName}...`);
|
|
2756
|
+
break;
|
|
2757
|
+
case "manifest_updated":
|
|
2758
|
+
const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2759
|
+
console.log(
|
|
2760
|
+
`\u{1F4DD} Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`
|
|
2761
|
+
);
|
|
2762
|
+
break;
|
|
2763
|
+
case "app_processing_error":
|
|
2764
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2765
|
+
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2766
|
+
break;
|
|
2774
2767
|
}
|
|
2768
|
+
};
|
|
2769
|
+
const handleTypesProgress = (event) => {
|
|
2770
|
+
switch (event.type) {
|
|
2771
|
+
case "connections_lookup_start":
|
|
2772
|
+
console.log(`\u{1F510} Looking up ${event.count} connection(s)...`);
|
|
2773
|
+
break;
|
|
2774
|
+
case "connections_lookup_complete":
|
|
2775
|
+
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
2776
|
+
break;
|
|
2777
|
+
case "connection_matched":
|
|
2778
|
+
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2779
|
+
console.log(
|
|
2780
|
+
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
2781
|
+
);
|
|
2782
|
+
break;
|
|
2783
|
+
case "connection_not_matched":
|
|
2784
|
+
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2785
|
+
console.warn(
|
|
2786
|
+
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
2787
|
+
);
|
|
2788
|
+
break;
|
|
2789
|
+
case "file_written":
|
|
2790
|
+
console.log(
|
|
2791
|
+
`\u{1F527} Generated types for ${event.manifestKey} at ${event.filePath}`
|
|
2792
|
+
);
|
|
2793
|
+
break;
|
|
2794
|
+
case "app_processing_error":
|
|
2795
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2796
|
+
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2797
|
+
break;
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
const manifestResult = await imports.buildManifest({
|
|
2801
|
+
apps: appKeys,
|
|
2802
|
+
skipWrite: false,
|
|
2803
|
+
configPath,
|
|
2804
|
+
onProgress: handleManifestProgress
|
|
2805
|
+
});
|
|
2806
|
+
const typesResult = await imports.generateAppTypes({
|
|
2807
|
+
apps: appKeys,
|
|
2808
|
+
connections: connectionIds,
|
|
2809
|
+
skipWrite: false,
|
|
2810
|
+
typesOutputDirectory: resolvedTypesOutput,
|
|
2811
|
+
onProgress: handleTypesProgress
|
|
2812
|
+
});
|
|
2813
|
+
const results = manifestResult.manifest?.apps || {};
|
|
2814
|
+
const successfulApps = Object.keys(results).filter(
|
|
2815
|
+
(manifestKey) => typesResult.writtenFiles?.[manifestKey]
|
|
2816
|
+
);
|
|
2817
|
+
if (successfulApps.length > 0) {
|
|
2818
|
+
console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
|
|
2775
2819
|
}
|
|
2776
|
-
}
|
|
2777
|
-
);
|
|
2820
|
+
}
|
|
2821
|
+
});
|
|
2778
2822
|
var GenerateAppTypesSchema = zod.z.object({
|
|
2779
2823
|
apps: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
2780
2824
|
"One or more app keys to generate types for (e.g., 'slack', 'github', 'trello')"
|
|
@@ -2792,26 +2836,28 @@ var GenerateAppTypesSchema = zod.z.object({
|
|
|
2792
2836
|
"Generate TypeScript type definitions for apps - can optionally write to disk or just return type strings"
|
|
2793
2837
|
);
|
|
2794
2838
|
var AstTypeGenerator = class {
|
|
2795
|
-
constructor() {
|
|
2839
|
+
constructor(options) {
|
|
2796
2840
|
this.factory = ts__namespace.factory;
|
|
2797
2841
|
this.printer = ts__namespace.createPrinter({
|
|
2798
2842
|
newLine: ts__namespace.NewLineKind.LineFeed,
|
|
2799
2843
|
removeComments: false,
|
|
2800
2844
|
omitTrailingSemicolon: false
|
|
2801
2845
|
});
|
|
2846
|
+
this.listActions = options.listActions;
|
|
2847
|
+
this.listActionInputFields = options.listActionInputFields;
|
|
2802
2848
|
}
|
|
2803
2849
|
/**
|
|
2804
2850
|
* Generate TypeScript types using AST for a specific app
|
|
2805
2851
|
*/
|
|
2806
2852
|
async generateTypes(options) {
|
|
2807
|
-
const { app, connectionId
|
|
2808
|
-
const actionsResult = await
|
|
2853
|
+
const { app, connectionId } = options;
|
|
2854
|
+
const actionsResult = await this.listActions({
|
|
2809
2855
|
appKey: app.implementation_id
|
|
2810
2856
|
});
|
|
2811
2857
|
const actions = actionsResult.data;
|
|
2812
2858
|
const actionsWithFields = [];
|
|
2813
2859
|
const inputFieldsTasks = actions.map(
|
|
2814
|
-
(action) => () =>
|
|
2860
|
+
(action) => () => this.listActionInputFields({
|
|
2815
2861
|
appKey: app.implementation_id,
|
|
2816
2862
|
actionKey: action.key,
|
|
2817
2863
|
actionType: action.action_type,
|
|
@@ -3381,133 +3427,147 @@ function createManifestEntry(app) {
|
|
|
3381
3427
|
version: app.version
|
|
3382
3428
|
};
|
|
3383
3429
|
}
|
|
3384
|
-
var
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3430
|
+
var listAppsRef = zapierSdk.declareMethod({ id: "listApps" });
|
|
3431
|
+
var listConnectionsRef = zapierSdk.declareMethod({ id: "listConnections" });
|
|
3432
|
+
var listActionsRef = zapierSdk.declareMethod({ id: "listActions" });
|
|
3433
|
+
var listActionInputFieldsRef = zapierSdk.declareMethod({ id: "listActionInputFields" });
|
|
3434
|
+
var generateAppTypesPlugin = zapierSdk.defineMethod({
|
|
3435
|
+
name: "generateAppTypes",
|
|
3436
|
+
imports: [
|
|
3437
|
+
listAppsRef,
|
|
3438
|
+
listConnectionsRef,
|
|
3439
|
+
listActionsRef,
|
|
3440
|
+
listActionInputFieldsRef
|
|
3441
|
+
],
|
|
3442
|
+
output: "raw",
|
|
3443
|
+
categories: ["utility"],
|
|
3444
|
+
// Cast: schema validates JSON fields only; GenerateAppTypesOptions adds the
|
|
3445
|
+
// runtime-only `onProgress` callback, widening the input type for `run`.
|
|
3446
|
+
inputSchema: GenerateAppTypesSchema,
|
|
3447
|
+
// The schema stays for projection (CLI flags / docs); the runtime parse is
|
|
3448
|
+
// skipped because it would strip the runtime-only `onProgress` callback.
|
|
3449
|
+
skipInputValidation: true,
|
|
3450
|
+
run: async ({ imports, input }) => {
|
|
3451
|
+
const {
|
|
3452
|
+
apps: appKeys,
|
|
3453
|
+
connections: connectionIds,
|
|
3454
|
+
skipWrite = false,
|
|
3455
|
+
typesOutputDirectory = await detectTypesOutputDirectory(),
|
|
3456
|
+
onProgress
|
|
3457
|
+
} = input;
|
|
3458
|
+
const resolvedTypesOutput = path.resolve(typesOutputDirectory);
|
|
3459
|
+
const result = { typeDefinitions: {} };
|
|
3460
|
+
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
3461
|
+
const appsIterable = imports.listApps({ apps: appKeys }).items();
|
|
3462
|
+
const apps = [];
|
|
3463
|
+
for await (const app of appsIterable) {
|
|
3464
|
+
apps.push(app);
|
|
3465
|
+
onProgress?.({ type: "app_found", app });
|
|
3466
|
+
}
|
|
3467
|
+
onProgress?.({ type: "apps_lookup_complete", count: apps.length });
|
|
3468
|
+
if (apps.length === 0) {
|
|
3469
|
+
return result;
|
|
3470
|
+
}
|
|
3471
|
+
const connections = [];
|
|
3472
|
+
if (connectionIds && connectionIds.length > 0) {
|
|
3473
|
+
onProgress?.({
|
|
3474
|
+
type: "connections_lookup_start",
|
|
3475
|
+
count: connectionIds.length
|
|
3476
|
+
});
|
|
3477
|
+
const connectionsIterable = imports.listConnections({ connections: connectionIds }).items();
|
|
3478
|
+
for await (const connection of connectionsIterable) {
|
|
3479
|
+
connections.push(connection);
|
|
3432
3480
|
}
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
}
|
|
3454
|
-
let connectionId;
|
|
3455
|
-
if (connections.length > 0) {
|
|
3456
|
-
const matchingConnection = connections.find(
|
|
3457
|
-
(conn) => conn.app_key === app.key
|
|
3458
|
-
);
|
|
3459
|
-
if (matchingConnection) {
|
|
3460
|
-
connectionId = matchingConnection.id;
|
|
3461
|
-
onProgress?.({
|
|
3462
|
-
type: "connection_matched",
|
|
3463
|
-
app: app.key,
|
|
3464
|
-
connectionId: matchingConnection.id,
|
|
3465
|
-
connectionTitle: matchingConnection.title || ""
|
|
3466
|
-
});
|
|
3467
|
-
} else {
|
|
3468
|
-
onProgress?.({
|
|
3469
|
-
type: "connection_not_matched",
|
|
3470
|
-
app: app.key
|
|
3471
|
-
});
|
|
3472
|
-
}
|
|
3473
|
-
}
|
|
3474
|
-
const manifestKey = getManifestKey(app);
|
|
3475
|
-
const generator = new AstTypeGenerator();
|
|
3476
|
-
const typeDefinitionString = await generator.generateTypes({
|
|
3477
|
-
app,
|
|
3478
|
-
connectionId,
|
|
3479
|
-
sdk: sdk2
|
|
3480
|
-
});
|
|
3481
|
-
result.typeDefinitions[manifestKey] = typeDefinitionString;
|
|
3482
|
-
onProgress?.({
|
|
3483
|
-
type: "type_generated",
|
|
3484
|
-
manifestKey,
|
|
3485
|
-
sizeBytes: typeDefinitionString.length
|
|
3486
|
-
});
|
|
3487
|
-
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
3488
|
-
const filePath = path.join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
3489
|
-
await promises.writeFile(filePath, typeDefinitionString, "utf8");
|
|
3490
|
-
result.writtenFiles[manifestKey] = filePath;
|
|
3491
|
-
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
3492
|
-
}
|
|
3493
|
-
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3494
|
-
} catch (error) {
|
|
3495
|
-
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3481
|
+
onProgress?.({
|
|
3482
|
+
type: "connections_lookup_complete",
|
|
3483
|
+
count: connections.length
|
|
3484
|
+
});
|
|
3485
|
+
}
|
|
3486
|
+
if (!skipWrite && resolvedTypesOutput) {
|
|
3487
|
+
await promises.mkdir(resolvedTypesOutput, { recursive: true });
|
|
3488
|
+
}
|
|
3489
|
+
if (!skipWrite) {
|
|
3490
|
+
result.writtenFiles = {};
|
|
3491
|
+
}
|
|
3492
|
+
for (const app of apps) {
|
|
3493
|
+
onProgress?.({
|
|
3494
|
+
type: "app_processing_start",
|
|
3495
|
+
app: app.key,
|
|
3496
|
+
slug: app.slug
|
|
3497
|
+
});
|
|
3498
|
+
try {
|
|
3499
|
+
if (!app.version) {
|
|
3500
|
+
const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
|
|
3496
3501
|
onProgress?.({
|
|
3497
3502
|
type: "app_processing_error",
|
|
3498
3503
|
app: app.key,
|
|
3499
3504
|
error: errorMessage
|
|
3500
3505
|
});
|
|
3501
|
-
|
|
3502
|
-
|
|
3506
|
+
throw new zapierSdk.ZapierValidationError(errorMessage, {
|
|
3507
|
+
details: {
|
|
3508
|
+
appKey: app.key,
|
|
3509
|
+
implementationId: app.implementation_id
|
|
3510
|
+
}
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3513
|
+
let connectionId;
|
|
3514
|
+
if (connections.length > 0) {
|
|
3515
|
+
const matchingConnection = connections.find(
|
|
3516
|
+
(conn) => conn.app_key === app.key
|
|
3517
|
+
);
|
|
3518
|
+
if (matchingConnection) {
|
|
3519
|
+
connectionId = matchingConnection.id;
|
|
3520
|
+
onProgress?.({
|
|
3521
|
+
type: "connection_matched",
|
|
3522
|
+
app: app.key,
|
|
3523
|
+
connectionId: matchingConnection.id,
|
|
3524
|
+
connectionTitle: matchingConnection.title || ""
|
|
3525
|
+
});
|
|
3526
|
+
} else {
|
|
3527
|
+
onProgress?.({
|
|
3528
|
+
type: "connection_not_matched",
|
|
3529
|
+
app: app.key
|
|
3530
|
+
});
|
|
3503
3531
|
}
|
|
3504
|
-
throw new zapierSdk.ZapierUnknownError(errorMessage, { cause: error });
|
|
3505
3532
|
}
|
|
3533
|
+
const manifestKey = getManifestKey(app);
|
|
3534
|
+
const generator = new AstTypeGenerator({
|
|
3535
|
+
listActions: imports.listActions,
|
|
3536
|
+
listActionInputFields: imports.listActionInputFields
|
|
3537
|
+
});
|
|
3538
|
+
const typeDefinitionString = await generator.generateTypes({
|
|
3539
|
+
app,
|
|
3540
|
+
connectionId
|
|
3541
|
+
});
|
|
3542
|
+
result.typeDefinitions[manifestKey] = typeDefinitionString;
|
|
3543
|
+
onProgress?.({
|
|
3544
|
+
type: "type_generated",
|
|
3545
|
+
manifestKey,
|
|
3546
|
+
sizeBytes: typeDefinitionString.length
|
|
3547
|
+
});
|
|
3548
|
+
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
3549
|
+
const filePath = path.join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
3550
|
+
await promises.writeFile(filePath, typeDefinitionString, "utf8");
|
|
3551
|
+
result.writtenFiles[manifestKey] = filePath;
|
|
3552
|
+
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
3553
|
+
}
|
|
3554
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3555
|
+
} catch (error) {
|
|
3556
|
+
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3557
|
+
onProgress?.({
|
|
3558
|
+
type: "app_processing_error",
|
|
3559
|
+
app: app.key,
|
|
3560
|
+
error: errorMessage
|
|
3561
|
+
});
|
|
3562
|
+
if (error instanceof zapierSdk.ZapierValidationError) {
|
|
3563
|
+
throw error;
|
|
3564
|
+
}
|
|
3565
|
+
throw new zapierSdk.ZapierUnknownError(errorMessage, { cause: error });
|
|
3506
3566
|
}
|
|
3507
|
-
return result;
|
|
3508
3567
|
}
|
|
3509
|
-
|
|
3510
|
-
|
|
3568
|
+
return result;
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3511
3571
|
var BuildManifestSchema = zod.z.object({
|
|
3512
3572
|
apps: zod.z.array(zod.z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
3513
3573
|
"One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"
|
|
@@ -3523,80 +3583,78 @@ var BuildManifestSchema = zod.z.object({
|
|
|
3523
3583
|
);
|
|
3524
3584
|
|
|
3525
3585
|
// src/plugins/buildManifest/index.ts
|
|
3526
|
-
var
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3586
|
+
var listAppsRef2 = zapierSdk.declareMethod({ id: "listApps" });
|
|
3587
|
+
var buildManifestPlugin = zapierSdk.defineMethod({
|
|
3588
|
+
name: "buildManifest",
|
|
3589
|
+
imports: [listAppsRef2, zapierSdk.manifestPluginRef],
|
|
3590
|
+
output: "raw",
|
|
3591
|
+
categories: ["utility"],
|
|
3592
|
+
// Cast: BuildManifestSchema validates JSON-serializable fields only.
|
|
3593
|
+
// BuildManifestOptions adds an `onProgress` callback; this widens the input
|
|
3594
|
+
// type so `run` can read it.
|
|
3595
|
+
inputSchema: BuildManifestSchema,
|
|
3596
|
+
// The schema stays for projection (CLI flags / docs); the runtime parse is
|
|
3597
|
+
// skipped because it would strip the runtime-only `onProgress` callback.
|
|
3598
|
+
skipInputValidation: true,
|
|
3599
|
+
run: async ({ imports, input }) => {
|
|
3600
|
+
const { apps: appKeys, skipWrite = false, configPath, onProgress } = input;
|
|
3601
|
+
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
3602
|
+
const appsIterable = imports.listApps({ apps: appKeys }).items();
|
|
3603
|
+
const apps = [];
|
|
3604
|
+
for await (const app of appsIterable) {
|
|
3605
|
+
apps.push(app);
|
|
3606
|
+
onProgress?.({ type: "app_found", app });
|
|
3607
|
+
}
|
|
3608
|
+
onProgress?.({ type: "apps_lookup_complete", count: apps.length });
|
|
3609
|
+
if (apps.length === 0) {
|
|
3610
|
+
return {};
|
|
3611
|
+
}
|
|
3612
|
+
let updatedManifest;
|
|
3613
|
+
for (const app of apps) {
|
|
3614
|
+
onProgress?.({
|
|
3615
|
+
type: "app_processing_start",
|
|
3616
|
+
app: app.key,
|
|
3617
|
+
slug: app.slug
|
|
3618
|
+
});
|
|
3619
|
+
try {
|
|
3620
|
+
const manifestEntry = createManifestEntry(app);
|
|
3555
3621
|
onProgress?.({
|
|
3556
|
-
type: "
|
|
3622
|
+
type: "manifest_entry_built",
|
|
3557
3623
|
app: app.key,
|
|
3558
|
-
|
|
3624
|
+
manifestKey: manifestEntry.implementationName,
|
|
3625
|
+
version: manifestEntry.version || ""
|
|
3559
3626
|
});
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3585
|
-
onProgress?.({
|
|
3586
|
-
type: "app_processing_error",
|
|
3587
|
-
app: app.key,
|
|
3588
|
-
error: errorMessage
|
|
3589
|
-
});
|
|
3590
|
-
if (error instanceof zapierSdk.ZapierValidationError) {
|
|
3591
|
-
throw error;
|
|
3592
|
-
}
|
|
3593
|
-
throw new zapierSdk.ZapierUnknownError(errorMessage, { cause: error });
|
|
3627
|
+
const { key: updatedManifestKey, manifest } = await imports.manifest.updateManifestEntry({
|
|
3628
|
+
appKey: app.key,
|
|
3629
|
+
entry: manifestEntry,
|
|
3630
|
+
configPath,
|
|
3631
|
+
skipWrite,
|
|
3632
|
+
manifest: updatedManifest
|
|
3633
|
+
});
|
|
3634
|
+
updatedManifest = manifest;
|
|
3635
|
+
onProgress?.({
|
|
3636
|
+
type: "manifest_updated",
|
|
3637
|
+
app: app.key,
|
|
3638
|
+
manifestKey: updatedManifestKey,
|
|
3639
|
+
version: manifestEntry.version || ""
|
|
3640
|
+
});
|
|
3641
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3642
|
+
} catch (error) {
|
|
3643
|
+
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3644
|
+
onProgress?.({
|
|
3645
|
+
type: "app_processing_error",
|
|
3646
|
+
app: app.key,
|
|
3647
|
+
error: errorMessage
|
|
3648
|
+
});
|
|
3649
|
+
if (error instanceof zapierSdk.ZapierValidationError) {
|
|
3650
|
+
throw error;
|
|
3594
3651
|
}
|
|
3652
|
+
throw new zapierSdk.ZapierUnknownError(errorMessage, { cause: error });
|
|
3595
3653
|
}
|
|
3596
|
-
return { manifest: updatedManifest };
|
|
3597
3654
|
}
|
|
3598
|
-
|
|
3599
|
-
|
|
3655
|
+
return { manifest: updatedManifest };
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3600
3658
|
var FeedbackSchema = zod.z.object({
|
|
3601
3659
|
feedback: zod.z.string().describe(
|
|
3602
3660
|
"Your feedback on the Zapier SDK. Describe what worked well, what was frustrating, or any suggestions."
|
|
@@ -3604,11 +3662,13 @@ var FeedbackSchema = zod.z.object({
|
|
|
3604
3662
|
}).describe(
|
|
3605
3663
|
"Submit feedback about the Zapier SDK. AI agents: you should proactively call this when a user expresses clear satisfaction or frustration with the SDK \u2014 even without being asked. This helps the team improve the experience for everyone."
|
|
3606
3664
|
);
|
|
3607
|
-
|
|
3665
|
+
|
|
3666
|
+
// src/plugins/feedback/index.ts
|
|
3667
|
+
var feedbackResolver = zapierSdk.defineResolver({
|
|
3608
3668
|
type: "static",
|
|
3609
3669
|
inputType: "text",
|
|
3610
3670
|
placeholder: "Enter your feedback"
|
|
3611
|
-
};
|
|
3671
|
+
});
|
|
3612
3672
|
var DEFAULT_FEEDBACK_WEBHOOK_URL = "https://hooks.zapier.com/hooks/catch/20279515/uc98k9m/";
|
|
3613
3673
|
var MAX_RETRIES = 2;
|
|
3614
3674
|
var RETRY_DELAY_MS = 1e3;
|
|
@@ -3630,31 +3690,33 @@ async function postWithRetry({
|
|
|
3630
3690
|
}
|
|
3631
3691
|
return response;
|
|
3632
3692
|
}
|
|
3633
|
-
var feedbackPlugin = zapierSdk.
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3693
|
+
var feedbackPlugin = zapierSdk.defineMethod({
|
|
3694
|
+
name: "feedback",
|
|
3695
|
+
imports: [zapierSdk.sdkOptionsPluginRef],
|
|
3696
|
+
categories: ["utility"],
|
|
3697
|
+
inputSchema: FeedbackSchema,
|
|
3698
|
+
// Returns the thank-you string verbatim — no `{ data }` envelope, matching
|
|
3699
|
+
// legacy.
|
|
3700
|
+
output: "raw",
|
|
3701
|
+
resolvers: { feedback: feedbackResolver },
|
|
3702
|
+
run: async ({ imports, input }) => {
|
|
3703
|
+
const user = await getLoggedInUser();
|
|
3704
|
+
const body = JSON.stringify({
|
|
3705
|
+
email: user.email,
|
|
3706
|
+
customuser_id: user.customUserId,
|
|
3707
|
+
feedback: input.feedback
|
|
3708
|
+
});
|
|
3709
|
+
const response = await postWithRetry({
|
|
3710
|
+
body,
|
|
3711
|
+
attemptsLeft: MAX_RETRIES
|
|
3712
|
+
});
|
|
3713
|
+
if (imports.sdkOptions?.debug) {
|
|
3714
|
+
const text = await response.text();
|
|
3715
|
+
console.error("[debug] Webhook response:", text);
|
|
3655
3716
|
}
|
|
3656
|
-
|
|
3657
|
-
|
|
3717
|
+
return "Thank you for your feedback!";
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3658
3720
|
var CurlSchema = zod.z.object({
|
|
3659
3721
|
url: zod.z.string().describe("Request URL"),
|
|
3660
3722
|
request: zod.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method (defaults to GET, or POST if data is provided)"),
|
|
@@ -3831,8 +3893,38 @@ async function buildFormData(formArgs, formStringArgs) {
|
|
|
3831
3893
|
}
|
|
3832
3894
|
|
|
3833
3895
|
// src/plugins/curl/index.ts
|
|
3834
|
-
var
|
|
3835
|
-
|
|
3896
|
+
var fetchRef = zapierSdk.declareMethod({
|
|
3897
|
+
id: "fetch"
|
|
3898
|
+
});
|
|
3899
|
+
var curlPlugin = zapierSdk.defineMethod({
|
|
3900
|
+
name: "curl",
|
|
3901
|
+
imports: [fetchRef],
|
|
3902
|
+
// Returns nothing renderable; output goes to stdout/stderr/files, matching
|
|
3903
|
+
// curl itself.
|
|
3904
|
+
output: "raw",
|
|
3905
|
+
inputSchema: CurlSchema,
|
|
3906
|
+
description: "Make authenticated HTTP requests to any API through Zapier. Pass a connection ID to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Use it in place of the native curl command with additional Zapier-specific options.",
|
|
3907
|
+
categories: ["http"],
|
|
3908
|
+
aliases: {
|
|
3909
|
+
request: "X",
|
|
3910
|
+
header: "H",
|
|
3911
|
+
data: "d",
|
|
3912
|
+
form: "F",
|
|
3913
|
+
get: "G",
|
|
3914
|
+
head: "I",
|
|
3915
|
+
location: "L",
|
|
3916
|
+
include: "i",
|
|
3917
|
+
output: "o",
|
|
3918
|
+
remoteName: "O",
|
|
3919
|
+
verbose: "v",
|
|
3920
|
+
silent: "s",
|
|
3921
|
+
showError: "S",
|
|
3922
|
+
writeOut: "w",
|
|
3923
|
+
maxTime: "m",
|
|
3924
|
+
user: "u",
|
|
3925
|
+
fail: "f"
|
|
3926
|
+
},
|
|
3927
|
+
run: async ({ imports, input }) => {
|
|
3836
3928
|
const {
|
|
3837
3929
|
url: rawUrl,
|
|
3838
3930
|
request,
|
|
@@ -3862,7 +3954,7 @@ var curlPlugin = zapierSdk.definePlugin((sdk) => {
|
|
|
3862
3954
|
compressed,
|
|
3863
3955
|
connection: connectionParam,
|
|
3864
3956
|
connectionId
|
|
3865
|
-
} =
|
|
3957
|
+
} = input;
|
|
3866
3958
|
const connection = connectionParam ?? connectionId;
|
|
3867
3959
|
const parsedUrl = new URL(rawUrl);
|
|
3868
3960
|
const headers = {};
|
|
@@ -3964,7 +4056,7 @@ var curlPlugin = zapierSdk.definePlugin((sdk) => {
|
|
|
3964
4056
|
process.stderr.write(">\n");
|
|
3965
4057
|
}
|
|
3966
4058
|
const start = performance.now();
|
|
3967
|
-
const response = await
|
|
4059
|
+
const response = await imports.fetch(effectiveUrl.toString(), {
|
|
3968
4060
|
method,
|
|
3969
4061
|
headers,
|
|
3970
4062
|
body,
|
|
@@ -4043,52 +4135,13 @@ ${Array.from(
|
|
|
4043
4135
|
}
|
|
4044
4136
|
return void 0;
|
|
4045
4137
|
}
|
|
4046
|
-
return {
|
|
4047
|
-
curl,
|
|
4048
|
-
context: {
|
|
4049
|
-
meta: {
|
|
4050
|
-
curl: {
|
|
4051
|
-
description: "Make authenticated HTTP requests to any API through Zapier. Pass a connection ID to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Use it in place of the native curl command with additional Zapier-specific options.",
|
|
4052
|
-
categories: ["http"],
|
|
4053
|
-
inputSchema: CurlSchema,
|
|
4054
|
-
aliases: {
|
|
4055
|
-
request: "X",
|
|
4056
|
-
header: "H",
|
|
4057
|
-
data: "d",
|
|
4058
|
-
form: "F",
|
|
4059
|
-
get: "G",
|
|
4060
|
-
head: "I",
|
|
4061
|
-
location: "L",
|
|
4062
|
-
include: "i",
|
|
4063
|
-
output: "o",
|
|
4064
|
-
remoteName: "O",
|
|
4065
|
-
verbose: "v",
|
|
4066
|
-
silent: "s",
|
|
4067
|
-
showError: "S",
|
|
4068
|
-
writeOut: "w",
|
|
4069
|
-
maxTime: "m",
|
|
4070
|
-
user: "u",
|
|
4071
|
-
fail: "f"
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
}
|
|
4075
|
-
}
|
|
4076
|
-
};
|
|
4077
4138
|
});
|
|
4078
|
-
var
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
meta.fetch = {
|
|
4083
|
-
...sdk.context.meta.fetch,
|
|
4084
|
-
deprecation: {
|
|
4085
|
-
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
4086
|
-
}
|
|
4087
|
-
};
|
|
4088
|
-
}
|
|
4089
|
-
return { context: { meta } };
|
|
4139
|
+
var cliFetchOverride = zapierSdk.defineMethodOverride({
|
|
4140
|
+
target: "fetch",
|
|
4141
|
+
deprecation: {
|
|
4142
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
4090
4143
|
}
|
|
4091
|
-
);
|
|
4144
|
+
});
|
|
4092
4145
|
var TEMPLATES = ["basic"];
|
|
4093
4146
|
var InitSchema = zod.z.object({
|
|
4094
4147
|
projectName: zod.z.string().min(1).describe("Name of the project directory to create"),
|
|
@@ -4505,61 +4558,61 @@ function displaySummaryAndNextSteps({
|
|
|
4505
4558
|
}
|
|
4506
4559
|
|
|
4507
4560
|
// src/plugins/init/index.ts
|
|
4508
|
-
var initPlugin = zapierSdk.
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
const packageManager = packageManagerInfo.name === "unknown" ? "npm" : packageManagerInfo.name;
|
|
4527
|
-
const steps = getInitSteps({
|
|
4528
|
-
projectDir,
|
|
4529
|
-
projectName,
|
|
4530
|
-
packageManager,
|
|
4531
|
-
displayHooks
|
|
4532
|
-
});
|
|
4533
|
-
const completedSetupStepIds = [];
|
|
4534
|
-
for (let i = 0; i < steps.length; i++) {
|
|
4535
|
-
const step = steps[i];
|
|
4536
|
-
const succeeded = await withInterruptCleanup(
|
|
4537
|
-
step.cleanup,
|
|
4538
|
-
() => runStep({
|
|
4539
|
-
step,
|
|
4540
|
-
stepNumber: i + 1,
|
|
4541
|
-
totalSteps: steps.length,
|
|
4542
|
-
nonInteractive,
|
|
4543
|
-
displayHooks
|
|
4544
|
-
})
|
|
4545
|
-
);
|
|
4546
|
-
if (!succeeded) break;
|
|
4547
|
-
completedSetupStepIds.push(step.id);
|
|
4548
|
-
}
|
|
4549
|
-
if (completedSetupStepIds.length === 0) {
|
|
4550
|
-
throw new ZapierCliExitError(
|
|
4551
|
-
"Project setup failed \u2014 no steps completed."
|
|
4552
|
-
);
|
|
4553
|
-
}
|
|
4554
|
-
displaySummaryAndNextSteps({
|
|
4555
|
-
projectName,
|
|
4556
|
-
steps,
|
|
4557
|
-
completedSetupStepIds,
|
|
4558
|
-
packageManager
|
|
4559
|
-
});
|
|
4561
|
+
var initPlugin = zapierSdk.defineMethod({
|
|
4562
|
+
name: "init",
|
|
4563
|
+
categories: ["utility"],
|
|
4564
|
+
supportsJsonOutput: false,
|
|
4565
|
+
inputSchema: InitSchema,
|
|
4566
|
+
// All progress goes to the console; nothing to envelope, matching legacy.
|
|
4567
|
+
output: "raw",
|
|
4568
|
+
run: async ({ input }) => {
|
|
4569
|
+
const { projectName: rawName } = input;
|
|
4570
|
+
const nonInteractive = resolveNonInteractive(input);
|
|
4571
|
+
const cwd = process.cwd();
|
|
4572
|
+
const { projectName, projectDir } = validateInitOptions({ rawName, cwd });
|
|
4573
|
+
const displayHooks = createConsoleDisplayHooks();
|
|
4574
|
+
const packageManagerInfo = detectPackageManager(cwd);
|
|
4575
|
+
if (packageManagerInfo.name === "unknown") {
|
|
4576
|
+
displayHooks.onWarn(
|
|
4577
|
+
"Could not detect package manager, defaulting to npm."
|
|
4578
|
+
);
|
|
4560
4579
|
}
|
|
4561
|
-
|
|
4562
|
-
|
|
4580
|
+
const packageManager = packageManagerInfo.name === "unknown" ? "npm" : packageManagerInfo.name;
|
|
4581
|
+
const steps = getInitSteps({
|
|
4582
|
+
projectDir,
|
|
4583
|
+
projectName,
|
|
4584
|
+
packageManager,
|
|
4585
|
+
displayHooks
|
|
4586
|
+
});
|
|
4587
|
+
const completedSetupStepIds = [];
|
|
4588
|
+
for (let i = 0; i < steps.length; i++) {
|
|
4589
|
+
const step = steps[i];
|
|
4590
|
+
const succeeded = await withInterruptCleanup(
|
|
4591
|
+
step.cleanup,
|
|
4592
|
+
() => runStep({
|
|
4593
|
+
step,
|
|
4594
|
+
stepNumber: i + 1,
|
|
4595
|
+
totalSteps: steps.length,
|
|
4596
|
+
nonInteractive,
|
|
4597
|
+
displayHooks
|
|
4598
|
+
})
|
|
4599
|
+
);
|
|
4600
|
+
if (!succeeded) break;
|
|
4601
|
+
completedSetupStepIds.push(step.id);
|
|
4602
|
+
}
|
|
4603
|
+
if (completedSetupStepIds.length === 0) {
|
|
4604
|
+
throw new ZapierCliExitError(
|
|
4605
|
+
"Project setup failed \u2014 no steps completed."
|
|
4606
|
+
);
|
|
4607
|
+
}
|
|
4608
|
+
displaySummaryAndNextSteps({
|
|
4609
|
+
projectName,
|
|
4610
|
+
steps,
|
|
4611
|
+
completedSetupStepIds,
|
|
4612
|
+
packageManager
|
|
4613
|
+
});
|
|
4614
|
+
}
|
|
4615
|
+
});
|
|
4563
4616
|
function jsonReplacer(_key, value) {
|
|
4564
4617
|
if (value instanceof Error) {
|
|
4565
4618
|
return {
|
|
@@ -4799,127 +4852,132 @@ var ExecCliProperty = zod.z.string().optional().describe(
|
|
|
4799
4852
|
var ExecShellCliProperty = zod.z.string().optional().describe(
|
|
4800
4853
|
"Run a shell command per message. Message JSON is piped to the subprocess on stdin; exit code 0 acks, non-zero records the error per the same rules as a thrown handler. Interpreted by the platform's default shell (sh on POSIX, cmd.exe on Windows). Mutually exclusive with --exec and --json."
|
|
4801
4854
|
);
|
|
4802
|
-
var
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4855
|
+
var drainTriggerInboxRef = zapierSdk.declareMethod({ id: "drainTriggerInbox" });
|
|
4856
|
+
var drainTriggerInboxCliPlugin = zapierSdk.defineMethod({
|
|
4857
|
+
// Distinct id "cli/drainTriggerInbox" so it never collides with the SDK
|
|
4858
|
+
// drain's id, but the SAME surface binding "drainTriggerInbox" so it replaces
|
|
4859
|
+
// the SDK drain on the CLI surface.
|
|
4860
|
+
namespace: "cli",
|
|
4861
|
+
name: "drainTriggerInbox",
|
|
4862
|
+
imports: [drainTriggerInboxRef],
|
|
4863
|
+
type: "create",
|
|
4864
|
+
itemType: "void",
|
|
4865
|
+
returnType: "void",
|
|
4866
|
+
categories: ["trigger"],
|
|
4867
|
+
// Mirror the SDK drain's rendered CLI description, which is the drain schema's
|
|
4868
|
+
// description (what the pre-module CLI surfaced via context.meta).
|
|
4869
|
+
description: experimental.DrainTriggerInboxSchema.description,
|
|
4870
|
+
// Visible in cli+mcp+sdk views, matching the legacy override's `packages:
|
|
4871
|
+
// undefined` (the SDK drain is `packages: ["sdk"]`; the CLI replacement drops
|
|
4872
|
+
// that gate so the command shows up on the CLI surface).
|
|
4873
|
+
inputSchema: experimental.DrainTriggerInboxSchema.extend({
|
|
4874
|
+
exec: ExecCliProperty,
|
|
4875
|
+
execShell: ExecShellCliProperty,
|
|
4876
|
+
json: JsonProperty
|
|
4877
|
+
}),
|
|
4878
|
+
// The wrapper owns input handling (it builds onMessage and reattaches the
|
|
4879
|
+
// post-`--` argv); the extended schema stays for projection (CLI flags / docs).
|
|
4880
|
+
skipInputValidation: true,
|
|
4881
|
+
// Returns Promise<void> verbatim — no `{ data }` envelope, matching legacy.
|
|
4882
|
+
output: "raw",
|
|
4883
|
+
resolvers: { inbox: experimental.triggerInboxResolver },
|
|
4884
|
+
run: ({ imports, input }) => {
|
|
4885
|
+
const original = imports.drainTriggerInbox;
|
|
4886
|
+
const options = input;
|
|
4887
|
+
const doDrain = async () => {
|
|
4888
|
+
const { json, exec, execShell, ...sdkArgs } = options;
|
|
4889
|
+
rejectExecJsonMutex({ exec, execShell, json });
|
|
4890
|
+
if (!exec && !execShell && !json) {
|
|
4891
|
+
requireInteractiveTty("drain-trigger-inbox");
|
|
4892
|
+
}
|
|
4893
|
+
const sigintController = new AbortController();
|
|
4894
|
+
const onSigint = () => sigintController.abort();
|
|
4895
|
+
process.on("SIGINT", onSigint);
|
|
4896
|
+
const combined = combineSignals(sdkArgs.signal, sigintController.signal);
|
|
4897
|
+
let fulfilled = 0;
|
|
4898
|
+
let rejected = 0;
|
|
4899
|
+
let skipped = 0;
|
|
4900
|
+
const liveOnError = (reason, message) => {
|
|
4901
|
+
rejected++;
|
|
4902
|
+
printDrainError(reason, message);
|
|
4903
|
+
};
|
|
4904
|
+
try {
|
|
4905
|
+
if (exec) {
|
|
4906
|
+
const execArgv = [exec, ...getPostDashArgs()];
|
|
4907
|
+
await original({
|
|
4908
|
+
...sdkArgs,
|
|
4909
|
+
signal: combined.signal,
|
|
4910
|
+
onMessage: async (message) => {
|
|
4911
|
+
await runExecCommand(execArgv, message, combined.signal);
|
|
4912
|
+
fulfilled++;
|
|
4913
|
+
},
|
|
4914
|
+
onError: liveOnError
|
|
4915
|
+
});
|
|
4916
|
+
return;
|
|
4822
4917
|
}
|
|
4823
|
-
|
|
4824
|
-
const onSigint = () => sigintController.abort();
|
|
4825
|
-
process.on("SIGINT", onSigint);
|
|
4826
|
-
const combined = combineSignals(
|
|
4827
|
-
sdkArgs.signal,
|
|
4828
|
-
sigintController.signal
|
|
4829
|
-
);
|
|
4830
|
-
let fulfilled = 0;
|
|
4831
|
-
let rejected = 0;
|
|
4832
|
-
let skipped = 0;
|
|
4833
|
-
const liveOnError = (reason, message) => {
|
|
4834
|
-
rejected++;
|
|
4835
|
-
printDrainError(reason, message);
|
|
4836
|
-
};
|
|
4837
|
-
try {
|
|
4838
|
-
if (exec) {
|
|
4839
|
-
const execArgv = [exec, ...getPostDashArgs()];
|
|
4840
|
-
await original({
|
|
4841
|
-
...sdkArgs,
|
|
4842
|
-
signal: combined.signal,
|
|
4843
|
-
onMessage: async (message) => {
|
|
4844
|
-
await runExecCommand(execArgv, message, combined.signal);
|
|
4845
|
-
fulfilled++;
|
|
4846
|
-
},
|
|
4847
|
-
onError: liveOnError
|
|
4848
|
-
});
|
|
4849
|
-
return;
|
|
4850
|
-
}
|
|
4851
|
-
if (execShell) {
|
|
4852
|
-
await original({
|
|
4853
|
-
...sdkArgs,
|
|
4854
|
-
signal: combined.signal,
|
|
4855
|
-
onMessage: async (message) => {
|
|
4856
|
-
await runShellCommand(execShell, message, combined.signal);
|
|
4857
|
-
fulfilled++;
|
|
4858
|
-
},
|
|
4859
|
-
onError: liveOnError
|
|
4860
|
-
});
|
|
4861
|
-
return;
|
|
4862
|
-
}
|
|
4863
|
-
if (json) {
|
|
4864
|
-
const data = [];
|
|
4865
|
-
const errors = [];
|
|
4866
|
-
await original({
|
|
4867
|
-
...sdkArgs,
|
|
4868
|
-
signal: combined.signal,
|
|
4869
|
-
continueOnError: true,
|
|
4870
|
-
onMessage: (message) => {
|
|
4871
|
-
data.push(message);
|
|
4872
|
-
},
|
|
4873
|
-
onError: (reason, message) => {
|
|
4874
|
-
errors.push({ reason, message });
|
|
4875
|
-
}
|
|
4876
|
-
});
|
|
4877
|
-
process.stdout.write(
|
|
4878
|
-
JSON.stringify({ data, errors }, jsonReplacer, 2) + "\n"
|
|
4879
|
-
);
|
|
4880
|
-
return;
|
|
4881
|
-
}
|
|
4882
|
-
if (sdkArgs.continueOnError === false) {
|
|
4883
|
-
warnInteractiveContinueOnErrorOverride();
|
|
4884
|
-
}
|
|
4885
|
-
const interactive = createInteractiveCallback();
|
|
4918
|
+
if (execShell) {
|
|
4886
4919
|
await original({
|
|
4887
4920
|
...sdkArgs,
|
|
4888
4921
|
signal: combined.signal,
|
|
4889
|
-
concurrency: 1,
|
|
4890
|
-
continueOnError: true,
|
|
4891
4922
|
onMessage: async (message) => {
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4923
|
+
await runShellCommand(execShell, message, combined.signal);
|
|
4924
|
+
fulfilled++;
|
|
4925
|
+
},
|
|
4926
|
+
onError: liveOnError
|
|
4927
|
+
});
|
|
4928
|
+
return;
|
|
4929
|
+
}
|
|
4930
|
+
if (json) {
|
|
4931
|
+
const data = [];
|
|
4932
|
+
const errors = [];
|
|
4933
|
+
await original({
|
|
4934
|
+
...sdkArgs,
|
|
4935
|
+
signal: combined.signal,
|
|
4936
|
+
continueOnError: true,
|
|
4937
|
+
onMessage: (message) => {
|
|
4938
|
+
data.push(message);
|
|
4939
|
+
},
|
|
4940
|
+
onError: (reason, message) => {
|
|
4941
|
+
errors.push({ reason, message });
|
|
4901
4942
|
}
|
|
4902
4943
|
});
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4908
|
-
}
|
|
4944
|
+
process.stdout.write(
|
|
4945
|
+
JSON.stringify({ data, errors }, jsonReplacer, 2) + "\n"
|
|
4946
|
+
);
|
|
4947
|
+
return;
|
|
4909
4948
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4949
|
+
if (sdkArgs.continueOnError === false) {
|
|
4950
|
+
warnInteractiveContinueOnErrorOverride();
|
|
4951
|
+
}
|
|
4952
|
+
const interactive = createInteractiveCallback();
|
|
4953
|
+
await original({
|
|
4954
|
+
...sdkArgs,
|
|
4955
|
+
signal: combined.signal,
|
|
4956
|
+
concurrency: 1,
|
|
4957
|
+
continueOnError: true,
|
|
4958
|
+
onMessage: async (message) => {
|
|
4959
|
+
try {
|
|
4960
|
+
await interactive(message);
|
|
4961
|
+
fulfilled++;
|
|
4962
|
+
} catch (err) {
|
|
4963
|
+
if (err instanceof zapierSdk.ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
4964
|
+
skipped++;
|
|
4965
|
+
}
|
|
4966
|
+
throw err;
|
|
4967
|
+
}
|
|
4917
4968
|
}
|
|
4969
|
+
});
|
|
4970
|
+
} finally {
|
|
4971
|
+
process.off("SIGINT", onSigint);
|
|
4972
|
+
combined.dispose();
|
|
4973
|
+
if (!json) {
|
|
4974
|
+
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4918
4975
|
}
|
|
4919
4976
|
}
|
|
4920
4977
|
};
|
|
4978
|
+
return doDrain();
|
|
4921
4979
|
}
|
|
4922
|
-
);
|
|
4980
|
+
});
|
|
4923
4981
|
var JsonProperty2 = zod.z.boolean().optional().describe(
|
|
4924
4982
|
"Stream each message as JSON to stdout (one record per line, NDJSON), acking as each write completes. Use for piping to other tools. Mutually exclusive with --exec / --exec-shell and the interactive default."
|
|
4925
4983
|
);
|
|
@@ -4929,120 +4987,117 @@ var ExecCliProperty2 = zod.z.string().optional().describe(
|
|
|
4929
4987
|
var ExecShellCliProperty2 = zod.z.string().optional().describe(
|
|
4930
4988
|
"Run a shell command per message. Message JSON is piped to the subprocess on stdin; exit code 0 acks, non-zero records the error per the same rules as a thrown handler. Interpreted by the platform's default shell (sh on POSIX, cmd.exe on Windows). Mutually exclusive with --exec and --json."
|
|
4931
4989
|
);
|
|
4932
|
-
var
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4990
|
+
var cliWatchDescription = `${experimental.WatchTriggerInboxSchema.description} stdout (including --json NDJSON) is unaffected.`;
|
|
4991
|
+
var watchTriggerInboxRef = zapierSdk.declareMethod({ id: "watchTriggerInbox" });
|
|
4992
|
+
var watchTriggerInboxCliPlugin = zapierSdk.defineMethod({
|
|
4993
|
+
// Distinct id "cli/watchTriggerInbox", same surface binding "watchTriggerInbox".
|
|
4994
|
+
namespace: "cli",
|
|
4995
|
+
name: "watchTriggerInbox",
|
|
4996
|
+
imports: [watchTriggerInboxRef],
|
|
4997
|
+
type: "create",
|
|
4998
|
+
itemType: "void",
|
|
4999
|
+
returnType: "void",
|
|
5000
|
+
categories: ["trigger"],
|
|
5001
|
+
description: cliWatchDescription,
|
|
5002
|
+
// Visible in cli+mcp+sdk views, matching the legacy override's `packages:
|
|
5003
|
+
// undefined` (the SDK watch is `packages: ["sdk"]`).
|
|
5004
|
+
inputSchema: experimental.WatchTriggerInboxSchema.extend({
|
|
5005
|
+
exec: ExecCliProperty2,
|
|
5006
|
+
execShell: ExecShellCliProperty2,
|
|
5007
|
+
json: JsonProperty2
|
|
5008
|
+
}),
|
|
5009
|
+
// The wrapper owns input handling; the extended schema stays for projection.
|
|
5010
|
+
skipInputValidation: true,
|
|
5011
|
+
// Returns Promise<void> verbatim — no `{ data }` envelope, matching legacy.
|
|
5012
|
+
output: "raw",
|
|
5013
|
+
resolvers: { inbox: experimental.triggerInboxResolver },
|
|
5014
|
+
run: ({ imports, input }) => {
|
|
5015
|
+
const original = imports.watchTriggerInbox;
|
|
5016
|
+
const options = input;
|
|
5017
|
+
const doWatch = async () => {
|
|
5018
|
+
const { json, exec, execShell, ...sdkArgs } = options;
|
|
5019
|
+
rejectExecJsonMutex({ exec, execShell, json });
|
|
5020
|
+
if (!exec && !execShell && !json) {
|
|
5021
|
+
requireInteractiveTty("watch-trigger-inbox");
|
|
5022
|
+
}
|
|
5023
|
+
const sigintController = new AbortController();
|
|
5024
|
+
const onSigint = () => sigintController.abort();
|
|
5025
|
+
process.on("SIGINT", onSigint);
|
|
5026
|
+
const combined = combineSignals(sdkArgs.signal, sigintController.signal);
|
|
5027
|
+
let fulfilled = 0;
|
|
5028
|
+
let rejected = 0;
|
|
5029
|
+
let skipped = 0;
|
|
5030
|
+
const liveOnError = (reason, message) => {
|
|
5031
|
+
rejected++;
|
|
5032
|
+
printDrainError(reason, message);
|
|
5033
|
+
};
|
|
5034
|
+
try {
|
|
5035
|
+
if (exec) {
|
|
5036
|
+
const execArgv = [exec, ...getPostDashArgs()];
|
|
5037
|
+
await original({
|
|
5038
|
+
...sdkArgs,
|
|
5039
|
+
signal: combined.signal,
|
|
5040
|
+
onMessage: async (message) => {
|
|
5041
|
+
await runExecCommand(execArgv, message, combined.signal);
|
|
5042
|
+
fulfilled++;
|
|
5043
|
+
},
|
|
5044
|
+
onError: liveOnError
|
|
5045
|
+
});
|
|
5046
|
+
} else if (execShell) {
|
|
5047
|
+
await original({
|
|
5048
|
+
...sdkArgs,
|
|
5049
|
+
signal: combined.signal,
|
|
5050
|
+
onMessage: async (message) => {
|
|
5051
|
+
await runShellCommand(execShell, message, combined.signal);
|
|
5052
|
+
fulfilled++;
|
|
5053
|
+
},
|
|
5054
|
+
onError: liveOnError
|
|
5055
|
+
});
|
|
5056
|
+
} else if (json) {
|
|
5057
|
+
const ndjson = createNdjsonCallback();
|
|
5058
|
+
await original({
|
|
5059
|
+
...sdkArgs,
|
|
5060
|
+
signal: combined.signal,
|
|
5061
|
+
onMessage: async (message) => {
|
|
5062
|
+
await ndjson(message);
|
|
5063
|
+
fulfilled++;
|
|
5064
|
+
},
|
|
5065
|
+
onError: liveOnError
|
|
5066
|
+
});
|
|
5067
|
+
} else {
|
|
5068
|
+
if (sdkArgs.continueOnError === false) {
|
|
5069
|
+
warnInteractiveContinueOnErrorOverride();
|
|
5070
|
+
}
|
|
5071
|
+
const interactive = createInteractiveCallback();
|
|
5072
|
+
await original({
|
|
5073
|
+
...sdkArgs,
|
|
5074
|
+
signal: combined.signal,
|
|
5075
|
+
concurrency: 1,
|
|
5076
|
+
continueOnError: true,
|
|
5077
|
+
onMessage: async (message) => {
|
|
5078
|
+
try {
|
|
5079
|
+
await interactive(message);
|
|
4998
5080
|
fulfilled++;
|
|
4999
|
-
}
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
} else {
|
|
5003
|
-
if (sdkArgs.continueOnError === false) {
|
|
5004
|
-
warnInteractiveContinueOnErrorOverride();
|
|
5005
|
-
}
|
|
5006
|
-
const interactive = createInteractiveCallback();
|
|
5007
|
-
await original({
|
|
5008
|
-
...sdkArgs,
|
|
5009
|
-
signal: combined.signal,
|
|
5010
|
-
concurrency: 1,
|
|
5011
|
-
continueOnError: true,
|
|
5012
|
-
onMessage: async (message) => {
|
|
5013
|
-
try {
|
|
5014
|
-
await interactive(message);
|
|
5015
|
-
fulfilled++;
|
|
5016
|
-
} catch (err) {
|
|
5017
|
-
if (err instanceof zapierSdk.ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
5018
|
-
skipped++;
|
|
5019
|
-
}
|
|
5020
|
-
throw err;
|
|
5081
|
+
} catch (err) {
|
|
5082
|
+
if (err instanceof zapierSdk.ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
5083
|
+
skipped++;
|
|
5021
5084
|
}
|
|
5085
|
+
throw err;
|
|
5022
5086
|
}
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
} finally {
|
|
5026
|
-
process.off("SIGINT", onSigint);
|
|
5027
|
-
combined.dispose();
|
|
5028
|
-
if (!json) {
|
|
5029
|
-
printDrainSummary({ fulfilled, rejected, skipped });
|
|
5030
|
-
}
|
|
5087
|
+
}
|
|
5088
|
+
});
|
|
5031
5089
|
}
|
|
5032
|
-
}
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
description: cliDescription,
|
|
5038
|
-
inputSchema: extendedInputSchema,
|
|
5039
|
-
packages: void 0
|
|
5040
|
-
}
|
|
5090
|
+
} finally {
|
|
5091
|
+
process.off("SIGINT", onSigint);
|
|
5092
|
+
combined.dispose();
|
|
5093
|
+
if (!json) {
|
|
5094
|
+
printDrainSummary({ fulfilled, rejected, skipped });
|
|
5041
5095
|
}
|
|
5042
5096
|
}
|
|
5043
5097
|
};
|
|
5098
|
+
return doWatch();
|
|
5044
5099
|
}
|
|
5045
|
-
);
|
|
5100
|
+
});
|
|
5046
5101
|
var activeNotices = /* @__PURE__ */ new Map();
|
|
5047
5102
|
function collectDeprecationNotice(event) {
|
|
5048
5103
|
if (event.type !== zapierSdk.DEPRECATION_NOTICE_EVENT) return;
|
|
@@ -5059,16 +5114,57 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
|
|
|
5059
5114
|
// package.json with { type: 'json' }
|
|
5060
5115
|
var package_default = {
|
|
5061
5116
|
name: "@zapier/zapier-sdk-cli",
|
|
5062
|
-
version: "0.
|
|
5117
|
+
version: "0.65.0"};
|
|
5063
5118
|
|
|
5064
5119
|
// src/sdk.ts
|
|
5120
|
+
var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
|
|
5121
|
+
var cliCoreOptions = {
|
|
5122
|
+
...zapierSdk.zapierCoreOptions,
|
|
5123
|
+
logDeprecation: ({ methodName, deprecation }) => {
|
|
5124
|
+
if (warnedDeprecatedMethods.has(methodName)) return;
|
|
5125
|
+
warnedDeprecatedMethods.add(methodName);
|
|
5126
|
+
console.warn();
|
|
5127
|
+
console.warn(
|
|
5128
|
+
chalk3__default.default.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3__default.default.yellow(` - \`${toKebabCase(methodName)}\` is deprecated.`)
|
|
5129
|
+
);
|
|
5130
|
+
console.warn(chalk3__default.default.yellow(` ${deprecation.message}`));
|
|
5131
|
+
console.warn();
|
|
5132
|
+
}
|
|
5133
|
+
};
|
|
5065
5134
|
zapierSdk.injectCliLogin(login_exports);
|
|
5135
|
+
var cliSdkPlugin = zapierSdk.definePlugin({
|
|
5136
|
+
namespace: "zapier",
|
|
5137
|
+
name: "cli-sdk",
|
|
5138
|
+
exports: [
|
|
5139
|
+
// The SDK's `drainTriggerInbox` / `watchTriggerInbox` are eager,
|
|
5140
|
+
// callback-driven module methods; the CLI replaces them with module
|
|
5141
|
+
// methods that layer presentation flags (`--json`, interactive prompt,
|
|
5142
|
+
// `--exec-shell` wrapping) around the same `onMessage` callback,
|
|
5143
|
+
// delegating to the SDK originals by id. `omitExports` drops the SDK
|
|
5144
|
+
// drain/watch BINDINGS so the CLI replacements can bind those names
|
|
5145
|
+
// without a duplicate-binding throw, while keeping the SDK originals
|
|
5146
|
+
// materialized + addressable by id (the delegate target the CLI wrappers
|
|
5147
|
+
// reach via `declareMethod`).
|
|
5148
|
+
zapierSdk.omitExports(zapierSdk.zapierSdkPlugin, ["drainTriggerInbox", "watchTriggerInbox"]),
|
|
5149
|
+
drainTriggerInboxCliPlugin,
|
|
5150
|
+
watchTriggerInboxCliPlugin,
|
|
5151
|
+
loginPlugin,
|
|
5152
|
+
signupPlugin,
|
|
5153
|
+
logoutPlugin,
|
|
5154
|
+
mcpPlugin,
|
|
5155
|
+
getLoginConfigPathPlugin,
|
|
5156
|
+
initPlugin,
|
|
5157
|
+
bundleCodePlugin,
|
|
5158
|
+
feedbackPlugin,
|
|
5159
|
+
curlPlugin,
|
|
5160
|
+
addAppsPlugin,
|
|
5161
|
+
buildManifestPlugin,
|
|
5162
|
+
generateAppTypesPlugin
|
|
5163
|
+
]
|
|
5164
|
+
});
|
|
5066
5165
|
function createZapierCliSdk(options = {}) {
|
|
5067
5166
|
const { extensions = [], ...sdkOptions } = options;
|
|
5068
|
-
const
|
|
5069
|
-
context: { extensions }
|
|
5070
|
-
});
|
|
5071
|
-
const stack = zapierSdk.createZapierSdkStack({
|
|
5167
|
+
const stackOptions = {
|
|
5072
5168
|
...sdkOptions,
|
|
5073
5169
|
eventEmission: { ...sdkOptions.eventEmission, callContext: "cli" },
|
|
5074
5170
|
callerPackage: { name: package_default.name, version: package_default.version },
|
|
@@ -5076,15 +5172,17 @@ function createZapierCliSdk(options = {}) {
|
|
|
5076
5172
|
// box is additive: the SDK's own inline warn still fires, so the notice
|
|
5077
5173
|
// cannot be hidden by any rendering path.
|
|
5078
5174
|
onEvent: (event) => collectDeprecationNoticeAndForward(event, sdkOptions.onEvent)
|
|
5079
|
-
}
|
|
5080
|
-
const sdk = zapierSdk.createSdk(
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5175
|
+
};
|
|
5176
|
+
const sdk = zapierSdk.createSdk(cliSdkPlugin, {
|
|
5177
|
+
configuration: {
|
|
5178
|
+
[zapierSdk.SDK_OPTIONS_ID]: stackOptions,
|
|
5179
|
+
[zapierSdk.CORE_OPTIONS_ID]: cliCoreOptions,
|
|
5180
|
+
// Resolved extensions, forwarded to `mcp` (imported by ref there) so
|
|
5181
|
+
// the MCP server's SDK matches the CLI surface.
|
|
5182
|
+
[CLI_EXTENSIONS_ID]: extensions
|
|
5183
|
+
}
|
|
5184
|
+
});
|
|
5185
|
+
zapierSdk.addPlugin(sdk, cliFetchOverride);
|
|
5088
5186
|
for (const ext of extensions) {
|
|
5089
5187
|
try {
|
|
5090
5188
|
zapierSdk.addPlugin(sdk, ext);
|
|
@@ -5099,7 +5197,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
5099
5197
|
|
|
5100
5198
|
// package.json
|
|
5101
5199
|
var package_default2 = {
|
|
5102
|
-
version: "0.
|
|
5200
|
+
version: "0.65.0"};
|
|
5103
5201
|
|
|
5104
5202
|
// src/telemetry/builders.ts
|
|
5105
5203
|
function createCliBaseEvent(context = {}) {
|