@zapier/zapier-sdk-cli 0.64.1 → 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 +19 -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.mjs
CHANGED
|
@@ -7,14 +7,14 @@ import crypto, { createHash } from 'crypto';
|
|
|
7
7
|
import * as path from 'path';
|
|
8
8
|
import { resolve, join, dirname, basename, relative, extname } from 'path';
|
|
9
9
|
import * as lockfile from 'proper-lockfile';
|
|
10
|
-
import {
|
|
10
|
+
import { defineMethod, apiPluginRef, resolveCredentialsPluginRef, eventEmissionPluginRef, sdkOptionsPluginRef, declareOptionalProperty, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, declareMethod, ZapierValidationError, ZapierUnknownError, manifestPluginRef, defineResolver, defineMethodOverride, zapierCoreOptions, injectCliLogin, definePlugin, omitExports, zapierSdkPlugin, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierError, ZapierReleaseTriggerMessageSignal, getOrCreateApiClient, isCredentialsObject, ZapierAuthenticationError, ZapierAbortDrainSignal, buildApplicationLifecycleEvent, AuthMechanism, createSdk, CORE_OPTIONS_ID, SDK_OPTIONS_ID, addPlugin, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId, DEPRECATION_NOTICE_EVENT } from '@zapier/zapier-sdk';
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
import chalk3 from 'chalk';
|
|
12
13
|
import { hostname } from 'os';
|
|
13
14
|
import inquirer from 'inquirer';
|
|
14
15
|
import express from 'express';
|
|
15
16
|
import { createInterface } from 'readline/promises';
|
|
16
17
|
import open from 'open';
|
|
17
|
-
import chalk3 from 'chalk';
|
|
18
18
|
import ora from 'ora';
|
|
19
19
|
import pkceChallenge from 'pkce-challenge';
|
|
20
20
|
import { startMcpServer } from '@zapier/zapier-sdk-mcp';
|
|
@@ -25,6 +25,7 @@ import 'is-installed-globally';
|
|
|
25
25
|
import { execSync, spawn } from 'child_process';
|
|
26
26
|
import Handlebars from 'handlebars';
|
|
27
27
|
import { fileURLToPath } from 'url';
|
|
28
|
+
import { triggerInboxResolver, DrainTriggerInboxSchema, WatchTriggerInboxSchema } from '@zapier/zapier-sdk/experimental';
|
|
28
29
|
import 'wrap-ansi';
|
|
29
30
|
|
|
30
31
|
var __defProp = Object.defineProperty;
|
|
@@ -837,6 +838,11 @@ function getConfigPath() {
|
|
|
837
838
|
return cfg.path;
|
|
838
839
|
}
|
|
839
840
|
|
|
841
|
+
// src/utils/string-utils.ts
|
|
842
|
+
function toKebabCase(str) {
|
|
843
|
+
return str.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
|
|
844
|
+
}
|
|
845
|
+
|
|
840
846
|
// src/utils/retry.ts
|
|
841
847
|
function sleep(ms) {
|
|
842
848
|
return new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
@@ -2038,7 +2044,7 @@ function promptlessLegacyJwtUpgradeError() {
|
|
|
2038
2044
|
);
|
|
2039
2045
|
}
|
|
2040
2046
|
async function clearExistingAuthState({
|
|
2041
|
-
|
|
2047
|
+
imports,
|
|
2042
2048
|
baseUrl,
|
|
2043
2049
|
interactive,
|
|
2044
2050
|
entryPoint
|
|
@@ -2059,7 +2065,7 @@ Log out and ${getActiveCredentialsAction(entryPoint)}?`
|
|
|
2059
2065
|
}
|
|
2060
2066
|
try {
|
|
2061
2067
|
await revokeCredentials({
|
|
2062
|
-
api:
|
|
2068
|
+
api: imports.api,
|
|
2063
2069
|
credentials: activeCredentials
|
|
2064
2070
|
});
|
|
2065
2071
|
} catch {
|
|
@@ -2124,13 +2130,13 @@ async function saveClientCredentials({
|
|
|
2124
2130
|
return { clientId };
|
|
2125
2131
|
}
|
|
2126
2132
|
function emitAccountAuthSuccess({
|
|
2127
|
-
|
|
2133
|
+
imports,
|
|
2128
2134
|
profile,
|
|
2129
2135
|
clientId,
|
|
2130
2136
|
isNonInteractive,
|
|
2131
2137
|
isHeadless
|
|
2132
2138
|
}) {
|
|
2133
|
-
|
|
2139
|
+
imports.eventEmission.emit(
|
|
2134
2140
|
"platform.sdk.ApplicationLifecycleEvent",
|
|
2135
2141
|
buildApplicationLifecycleEvent(
|
|
2136
2142
|
{
|
|
@@ -2149,11 +2155,11 @@ function emitAccountAuthSuccess({
|
|
|
2149
2155
|
);
|
|
2150
2156
|
}
|
|
2151
2157
|
function emitSignupSuccess({
|
|
2152
|
-
|
|
2158
|
+
imports,
|
|
2153
2159
|
isNonInteractive,
|
|
2154
2160
|
isHeadless
|
|
2155
2161
|
}) {
|
|
2156
|
-
|
|
2162
|
+
imports.eventEmission.emit(
|
|
2157
2163
|
"platform.sdk.ApplicationLifecycleEvent",
|
|
2158
2164
|
buildApplicationLifecycleEvent({
|
|
2159
2165
|
lifecycle_event_type: "signup_success",
|
|
@@ -2172,7 +2178,7 @@ async function runOauthWithRedaction(runOauth) {
|
|
|
2172
2178
|
}
|
|
2173
2179
|
}
|
|
2174
2180
|
async function runOauthForEntryPoint({
|
|
2175
|
-
|
|
2181
|
+
imports,
|
|
2176
2182
|
entryPoint,
|
|
2177
2183
|
timeoutMs,
|
|
2178
2184
|
pkceCredentials,
|
|
@@ -2192,7 +2198,7 @@ async function runOauthForEntryPoint({
|
|
|
2192
2198
|
onProgress: (event) => {
|
|
2193
2199
|
if (event.type === "callback_accepted") {
|
|
2194
2200
|
emitSignupSuccess({
|
|
2195
|
-
|
|
2201
|
+
imports,
|
|
2196
2202
|
isNonInteractive: false,
|
|
2197
2203
|
isHeadless: headless === true
|
|
2198
2204
|
});
|
|
@@ -2213,7 +2219,7 @@ async function runOauthForEntryPoint({
|
|
|
2213
2219
|
);
|
|
2214
2220
|
}
|
|
2215
2221
|
async function provisionAccountCredentials({
|
|
2216
|
-
|
|
2222
|
+
imports,
|
|
2217
2223
|
entryPoint,
|
|
2218
2224
|
accessToken,
|
|
2219
2225
|
credentialsBaseUrl,
|
|
@@ -2226,7 +2232,7 @@ async function provisionAccountCredentials({
|
|
|
2226
2232
|
const scopedApi = getOrCreateApiClient({
|
|
2227
2233
|
credentials: accessToken,
|
|
2228
2234
|
baseUrl: credentialsBaseUrl,
|
|
2229
|
-
callerPackage:
|
|
2235
|
+
callerPackage: imports.sdkOptions?.callerPackage
|
|
2230
2236
|
});
|
|
2231
2237
|
const profile = await getProfile(scopedApi);
|
|
2232
2238
|
process.stderr.write(`${getProfileMessage(entryPoint, profile.email)}
|
|
@@ -2255,7 +2261,7 @@ async function provisionAccountCredentials({
|
|
|
2255
2261
|
process.stderr.write("\u{1F510} Approvals are enabled for these credentials.\n");
|
|
2256
2262
|
}
|
|
2257
2263
|
emitAccountAuthSuccess({
|
|
2258
|
-
|
|
2264
|
+
imports,
|
|
2259
2265
|
profile,
|
|
2260
2266
|
clientId,
|
|
2261
2267
|
isNonInteractive,
|
|
@@ -2263,7 +2269,7 @@ async function provisionAccountCredentials({
|
|
|
2263
2269
|
});
|
|
2264
2270
|
}
|
|
2265
2271
|
async function runAccountAuth({
|
|
2266
|
-
|
|
2272
|
+
imports,
|
|
2267
2273
|
options,
|
|
2268
2274
|
entryPoint
|
|
2269
2275
|
}) {
|
|
@@ -2295,7 +2301,7 @@ async function runAccountAuth({
|
|
|
2295
2301
|
}
|
|
2296
2302
|
}
|
|
2297
2303
|
if (!await clearExistingAuthState({
|
|
2298
|
-
|
|
2304
|
+
imports,
|
|
2299
2305
|
baseUrl: pending.credentialsBaseUrl,
|
|
2300
2306
|
interactive: false,
|
|
2301
2307
|
entryPoint
|
|
@@ -2309,7 +2315,7 @@ async function runAccountAuth({
|
|
|
2309
2315
|
onProgress: (event) => {
|
|
2310
2316
|
if (entryPoint === "signup" && event.type === "callback_accepted") {
|
|
2311
2317
|
emitSignupSuccess({
|
|
2312
|
-
|
|
2318
|
+
imports,
|
|
2313
2319
|
isNonInteractive: true,
|
|
2314
2320
|
isHeadless: pending.headless
|
|
2315
2321
|
});
|
|
@@ -2318,7 +2324,7 @@ async function runAccountAuth({
|
|
|
2318
2324
|
});
|
|
2319
2325
|
});
|
|
2320
2326
|
await provisionAccountCredentials({
|
|
2321
|
-
|
|
2327
|
+
imports,
|
|
2322
2328
|
entryPoint,
|
|
2323
2329
|
accessToken: accessToken2,
|
|
2324
2330
|
credentialsBaseUrl: pending.credentialsBaseUrl,
|
|
@@ -2332,11 +2338,11 @@ async function runAccountAuth({
|
|
|
2332
2338
|
}
|
|
2333
2339
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
2334
2340
|
const interactive = !resolveNonInteractive(options);
|
|
2335
|
-
const resolvedCredentials = await
|
|
2341
|
+
const resolvedCredentials = await imports.resolveCredentials();
|
|
2336
2342
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
2337
2343
|
const headless = options.headless === true;
|
|
2338
2344
|
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
2339
|
-
|
|
2345
|
+
options: imports.sdkOptions,
|
|
2340
2346
|
resolvedCredentials
|
|
2341
2347
|
});
|
|
2342
2348
|
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
@@ -2351,7 +2357,7 @@ async function runAccountAuth({
|
|
|
2351
2357
|
}
|
|
2352
2358
|
}
|
|
2353
2359
|
if (!await clearExistingAuthState({
|
|
2354
|
-
|
|
2360
|
+
imports,
|
|
2355
2361
|
baseUrl: credentialsBaseUrl,
|
|
2356
2362
|
interactive,
|
|
2357
2363
|
entryPoint
|
|
@@ -2372,7 +2378,7 @@ async function runAccountAuth({
|
|
|
2372
2378
|
return;
|
|
2373
2379
|
}
|
|
2374
2380
|
const { accessToken } = await runOauthForEntryPoint({
|
|
2375
|
-
|
|
2381
|
+
imports,
|
|
2376
2382
|
entryPoint,
|
|
2377
2383
|
timeoutMs: timeoutSeconds * 1e3,
|
|
2378
2384
|
pkceCredentials,
|
|
@@ -2381,7 +2387,7 @@ async function runAccountAuth({
|
|
|
2381
2387
|
interactive
|
|
2382
2388
|
});
|
|
2383
2389
|
await provisionAccountCredentials({
|
|
2384
|
-
|
|
2390
|
+
imports,
|
|
2385
2391
|
entryPoint,
|
|
2386
2392
|
accessToken,
|
|
2387
2393
|
credentialsBaseUrl,
|
|
@@ -2426,17 +2432,26 @@ var LoginSchema = z.object({
|
|
|
2426
2432
|
});
|
|
2427
2433
|
|
|
2428
2434
|
// src/plugins/login/index.ts
|
|
2429
|
-
var loginPlugin =
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2435
|
+
var loginPlugin = defineMethod({
|
|
2436
|
+
name: "login",
|
|
2437
|
+
imports: [
|
|
2438
|
+
apiPluginRef,
|
|
2439
|
+
resolveCredentialsPluginRef,
|
|
2440
|
+
eventEmissionPluginRef,
|
|
2441
|
+
sdkOptionsPluginRef
|
|
2442
|
+
],
|
|
2443
|
+
output: "raw",
|
|
2444
|
+
inputSchema: LoginSchema,
|
|
2445
|
+
categories: ["account"],
|
|
2446
|
+
supportsJsonOutput: false,
|
|
2447
|
+
run: async ({ imports, input }) => {
|
|
2448
|
+
await runAccountAuth({
|
|
2449
|
+
imports,
|
|
2450
|
+
options: input,
|
|
2451
|
+
entryPoint: "login"
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2440
2455
|
var SignupSchema = z.object({
|
|
2441
2456
|
timeout: z.string().optional().describe("Signup timeout in seconds (default: 300)"),
|
|
2442
2457
|
useApprovals: z.boolean().optional().describe(
|
|
@@ -2468,68 +2483,92 @@ var SignupSchema = z.object({
|
|
|
2468
2483
|
});
|
|
2469
2484
|
|
|
2470
2485
|
// src/plugins/signup/index.ts
|
|
2471
|
-
var signupPlugin =
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2486
|
+
var signupPlugin = defineMethod({
|
|
2487
|
+
name: "signup",
|
|
2488
|
+
imports: [
|
|
2489
|
+
apiPluginRef,
|
|
2490
|
+
resolveCredentialsPluginRef,
|
|
2491
|
+
eventEmissionPluginRef,
|
|
2492
|
+
sdkOptionsPluginRef
|
|
2493
|
+
],
|
|
2494
|
+
output: "raw",
|
|
2495
|
+
inputSchema: SignupSchema,
|
|
2496
|
+
categories: ["account"],
|
|
2497
|
+
supportsJsonOutput: false,
|
|
2498
|
+
run: async ({ imports, input }) => {
|
|
2499
|
+
await runAccountAuth({
|
|
2500
|
+
imports,
|
|
2501
|
+
options: input,
|
|
2502
|
+
entryPoint: "signup"
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
});
|
|
2482
2506
|
var LogoutSchema = z.object({}).describe("Log out of your Zapier account");
|
|
2483
2507
|
|
|
2484
2508
|
// src/plugins/logout/index.ts
|
|
2485
|
-
var logoutPlugin =
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
await
|
|
2503
|
-
api: sdk2.context.api,
|
|
2504
|
-
credentials: activeCredentials,
|
|
2505
|
-
onEvent,
|
|
2506
|
-
alwaysClearLocalState: true
|
|
2507
|
-
});
|
|
2509
|
+
var logoutPlugin = defineMethod({
|
|
2510
|
+
name: "logout",
|
|
2511
|
+
imports: [apiPluginRef, resolveCredentialsPluginRef, sdkOptionsPluginRef],
|
|
2512
|
+
output: "raw",
|
|
2513
|
+
inputSchema: LogoutSchema,
|
|
2514
|
+
categories: ["account"],
|
|
2515
|
+
supportsJsonOutput: false,
|
|
2516
|
+
run: async ({ imports }) => {
|
|
2517
|
+
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
2518
|
+
resolveCredentials: imports.resolveCredentials,
|
|
2519
|
+
options: imports.sdkOptions
|
|
2520
|
+
});
|
|
2521
|
+
const activeCredentials = getActiveCredentials({
|
|
2522
|
+
baseUrl: credentialsBaseUrl
|
|
2523
|
+
});
|
|
2524
|
+
const onEvent = imports.sdkOptions?.onEvent;
|
|
2525
|
+
if (!activeCredentials) {
|
|
2526
|
+
await logout({ onEvent });
|
|
2508
2527
|
console.log("\u2705 Successfully logged out");
|
|
2528
|
+
return;
|
|
2509
2529
|
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2530
|
+
await revokeCredentials({
|
|
2531
|
+
api: imports.api,
|
|
2532
|
+
credentials: activeCredentials,
|
|
2533
|
+
onEvent,
|
|
2534
|
+
alwaysClearLocalState: true
|
|
2535
|
+
});
|
|
2536
|
+
console.log("\u2705 Successfully logged out");
|
|
2537
|
+
}
|
|
2538
|
+
});
|
|
2539
|
+
var CLI_EXTENSIONS_ID = "cli/extensions";
|
|
2540
|
+
var cliExtensionsPluginRef = declareOptionalProperty({
|
|
2541
|
+
id: CLI_EXTENSIONS_ID
|
|
2542
|
+
});
|
|
2543
|
+
var CLI_EXPERIMENTAL_ID = "cli/experimental";
|
|
2544
|
+
var cliExperimentalPluginRef = declareOptionalProperty({
|
|
2545
|
+
id: CLI_EXPERIMENTAL_ID
|
|
2546
|
+
});
|
|
2512
2547
|
var McpSchema = z.object({
|
|
2513
2548
|
port: z.string().optional().describe("Port to listen on (for future HTTP transport)")
|
|
2514
2549
|
}).describe("Start MCP server for Zapier SDK");
|
|
2515
2550
|
|
|
2516
2551
|
// src/plugins/mcp/index.ts
|
|
2517
|
-
var mcpPlugin =
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2552
|
+
var mcpPlugin = defineMethod({
|
|
2553
|
+
name: "mcp",
|
|
2554
|
+
imports: [
|
|
2555
|
+
sdkOptionsPluginRef,
|
|
2556
|
+
cliExtensionsPluginRef,
|
|
2557
|
+
cliExperimentalPluginRef
|
|
2558
|
+
],
|
|
2559
|
+
output: "raw",
|
|
2560
|
+
inputSchema: McpSchema,
|
|
2561
|
+
categories: ["utility"],
|
|
2562
|
+
run: async ({ imports, input }) => {
|
|
2563
|
+
await startMcpServer({
|
|
2564
|
+
...input,
|
|
2565
|
+
debug: imports.sdkOptions?.debug,
|
|
2566
|
+
maxConcurrentRequests: imports.sdkOptions?.maxConcurrentRequests,
|
|
2567
|
+
extensions: imports.extensions,
|
|
2568
|
+
experimental: imports.experimental
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
});
|
|
2533
2572
|
var BundleCodeSchema = z.object({
|
|
2534
2573
|
input: z.string().min(1).describe("Input TypeScript file path to bundle"),
|
|
2535
2574
|
output: OutputPropertySchema.optional().describe(
|
|
@@ -2540,15 +2579,16 @@ var BundleCodeSchema = z.object({
|
|
|
2540
2579
|
target: z.string().optional().describe("ECMAScript target version"),
|
|
2541
2580
|
cjs: z.boolean().optional().describe("Output CommonJS format instead of ESM")
|
|
2542
2581
|
}).describe("Bundle TypeScript code into executable JavaScript");
|
|
2543
|
-
var bundleCodePlugin =
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
)
|
|
2582
|
+
var bundleCodePlugin = defineMethod({
|
|
2583
|
+
name: "bundleCode",
|
|
2584
|
+
categories: ["utility"],
|
|
2585
|
+
deprecation: { message: "bundleCode is no longer maintained." },
|
|
2586
|
+
inputSchema: BundleCodeSchema,
|
|
2587
|
+
// Returns the bundled code string verbatim — no `{ data }` envelope,
|
|
2588
|
+
// matching legacy.
|
|
2589
|
+
output: "raw",
|
|
2590
|
+
run: async ({ input }) => bundleCode(input)
|
|
2591
|
+
});
|
|
2552
2592
|
async function bundleCode(options) {
|
|
2553
2593
|
const {
|
|
2554
2594
|
input,
|
|
@@ -2605,14 +2645,16 @@ async function bundleCode(options) {
|
|
|
2605
2645
|
}
|
|
2606
2646
|
}
|
|
2607
2647
|
var GetLoginConfigPathSchema = z.object({}).describe("Show the path to the login configuration file");
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2648
|
+
|
|
2649
|
+
// src/plugins/getLoginConfigPath/index.ts
|
|
2650
|
+
var getLoginConfigPathPlugin = defineMethod({
|
|
2651
|
+
name: "getLoginConfigPath",
|
|
2652
|
+
categories: ["utility"],
|
|
2653
|
+
inputSchema: GetLoginConfigPathSchema,
|
|
2654
|
+
// Returns the path string verbatim — no `{ data }` envelope, matching legacy.
|
|
2655
|
+
output: "raw",
|
|
2656
|
+
run: async () => getConfigPath()
|
|
2657
|
+
});
|
|
2616
2658
|
var AddSchema = z.object({
|
|
2617
2659
|
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
2618
2660
|
"One or more app keys to add (e.g., 'slack', 'github', 'trello')"
|
|
@@ -2640,105 +2682,107 @@ async function detectTypesOutputDirectory() {
|
|
|
2640
2682
|
}
|
|
2641
2683
|
return "./zapier/apps/";
|
|
2642
2684
|
}
|
|
2643
|
-
var
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
switch (event.type) {
|
|
2690
|
-
case "connections_lookup_start":
|
|
2691
|
-
console.log(`\u{1F510} Looking up ${event.count} connection(s)...`);
|
|
2692
|
-
break;
|
|
2693
|
-
case "connections_lookup_complete":
|
|
2694
|
-
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
2695
|
-
break;
|
|
2696
|
-
case "connection_matched":
|
|
2697
|
-
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2698
|
-
console.log(
|
|
2699
|
-
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
2700
|
-
);
|
|
2701
|
-
break;
|
|
2702
|
-
case "connection_not_matched":
|
|
2703
|
-
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2704
|
-
console.warn(
|
|
2705
|
-
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
2706
|
-
);
|
|
2707
|
-
break;
|
|
2708
|
-
case "file_written":
|
|
2709
|
-
console.log(
|
|
2710
|
-
`\u{1F527} Generated types for ${event.manifestKey} at ${event.filePath}`
|
|
2711
|
-
);
|
|
2712
|
-
break;
|
|
2713
|
-
case "app_processing_error":
|
|
2714
|
-
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2715
|
-
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2716
|
-
break;
|
|
2717
|
-
}
|
|
2718
|
-
};
|
|
2719
|
-
const manifestResult = await sdk2.buildManifest({
|
|
2720
|
-
apps: appKeys,
|
|
2721
|
-
skipWrite: false,
|
|
2722
|
-
configPath,
|
|
2723
|
-
onProgress: handleManifestProgress
|
|
2724
|
-
});
|
|
2725
|
-
const typesResult = await sdk2.generateAppTypes({
|
|
2726
|
-
apps: appKeys,
|
|
2727
|
-
connections: connectionIds,
|
|
2728
|
-
skipWrite: false,
|
|
2729
|
-
typesOutputDirectory: resolvedTypesOutput,
|
|
2730
|
-
onProgress: handleTypesProgress
|
|
2731
|
-
});
|
|
2732
|
-
const results = manifestResult.manifest?.apps || {};
|
|
2733
|
-
const successfulApps = Object.keys(results).filter(
|
|
2734
|
-
(manifestKey) => typesResult.writtenFiles?.[manifestKey]
|
|
2735
|
-
);
|
|
2736
|
-
if (successfulApps.length > 0) {
|
|
2737
|
-
console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
|
|
2685
|
+
var buildManifestRef = declareMethod({ id: "buildManifest" });
|
|
2686
|
+
var generateAppTypesRef = declareMethod({ id: "generateAppTypes" });
|
|
2687
|
+
var addAppsPlugin = defineMethod({
|
|
2688
|
+
name: "add",
|
|
2689
|
+
imports: [buildManifestRef, generateAppTypesRef],
|
|
2690
|
+
output: "raw",
|
|
2691
|
+
categories: ["utility"],
|
|
2692
|
+
inputSchema: AddSchema,
|
|
2693
|
+
run: async ({ imports, input }) => {
|
|
2694
|
+
const {
|
|
2695
|
+
apps: appKeys,
|
|
2696
|
+
connections: connectionIds,
|
|
2697
|
+
configPath,
|
|
2698
|
+
typesOutput = await detectTypesOutputDirectory()
|
|
2699
|
+
} = input;
|
|
2700
|
+
const resolvedTypesOutput = resolve(typesOutput);
|
|
2701
|
+
console.log(`\u{1F4E6} Adding ${appKeys.length} app(s)...`);
|
|
2702
|
+
const appSlugAndKeyMap = /* @__PURE__ */ new Map();
|
|
2703
|
+
const handleManifestProgress = (event) => {
|
|
2704
|
+
switch (event.type) {
|
|
2705
|
+
case "apps_lookup_start":
|
|
2706
|
+
console.log(`\u{1F4E6} Looking up ${event.count} app(s)...`);
|
|
2707
|
+
break;
|
|
2708
|
+
case "app_found":
|
|
2709
|
+
const displayName = event.app.slug ? `${event.app.slug} (${event.app.key})` : event.app.key;
|
|
2710
|
+
appSlugAndKeyMap.set(event.app.key, displayName);
|
|
2711
|
+
break;
|
|
2712
|
+
case "apps_lookup_complete":
|
|
2713
|
+
if (event.count === 0) {
|
|
2714
|
+
console.warn("\u26A0\uFE0F No apps found");
|
|
2715
|
+
}
|
|
2716
|
+
break;
|
|
2717
|
+
case "app_processing_start":
|
|
2718
|
+
const appName = event.slug ? `${event.slug} (${event.app})` : event.app;
|
|
2719
|
+
console.log(`\u{1F4E6} Adding ${appName}...`);
|
|
2720
|
+
break;
|
|
2721
|
+
case "manifest_updated":
|
|
2722
|
+
const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2723
|
+
console.log(
|
|
2724
|
+
`\u{1F4DD} Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`
|
|
2725
|
+
);
|
|
2726
|
+
break;
|
|
2727
|
+
case "app_processing_error":
|
|
2728
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2729
|
+
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2730
|
+
break;
|
|
2738
2731
|
}
|
|
2732
|
+
};
|
|
2733
|
+
const handleTypesProgress = (event) => {
|
|
2734
|
+
switch (event.type) {
|
|
2735
|
+
case "connections_lookup_start":
|
|
2736
|
+
console.log(`\u{1F510} Looking up ${event.count} connection(s)...`);
|
|
2737
|
+
break;
|
|
2738
|
+
case "connections_lookup_complete":
|
|
2739
|
+
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
2740
|
+
break;
|
|
2741
|
+
case "connection_matched":
|
|
2742
|
+
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2743
|
+
console.log(
|
|
2744
|
+
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
2745
|
+
);
|
|
2746
|
+
break;
|
|
2747
|
+
case "connection_not_matched":
|
|
2748
|
+
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2749
|
+
console.warn(
|
|
2750
|
+
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
2751
|
+
);
|
|
2752
|
+
break;
|
|
2753
|
+
case "file_written":
|
|
2754
|
+
console.log(
|
|
2755
|
+
`\u{1F527} Generated types for ${event.manifestKey} at ${event.filePath}`
|
|
2756
|
+
);
|
|
2757
|
+
break;
|
|
2758
|
+
case "app_processing_error":
|
|
2759
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2760
|
+
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2761
|
+
break;
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
const manifestResult = await imports.buildManifest({
|
|
2765
|
+
apps: appKeys,
|
|
2766
|
+
skipWrite: false,
|
|
2767
|
+
configPath,
|
|
2768
|
+
onProgress: handleManifestProgress
|
|
2769
|
+
});
|
|
2770
|
+
const typesResult = await imports.generateAppTypes({
|
|
2771
|
+
apps: appKeys,
|
|
2772
|
+
connections: connectionIds,
|
|
2773
|
+
skipWrite: false,
|
|
2774
|
+
typesOutputDirectory: resolvedTypesOutput,
|
|
2775
|
+
onProgress: handleTypesProgress
|
|
2776
|
+
});
|
|
2777
|
+
const results = manifestResult.manifest?.apps || {};
|
|
2778
|
+
const successfulApps = Object.keys(results).filter(
|
|
2779
|
+
(manifestKey) => typesResult.writtenFiles?.[manifestKey]
|
|
2780
|
+
);
|
|
2781
|
+
if (successfulApps.length > 0) {
|
|
2782
|
+
console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
|
|
2739
2783
|
}
|
|
2740
|
-
}
|
|
2741
|
-
);
|
|
2784
|
+
}
|
|
2785
|
+
});
|
|
2742
2786
|
var GenerateAppTypesSchema = z.object({
|
|
2743
2787
|
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
2744
2788
|
"One or more app keys to generate types for (e.g., 'slack', 'github', 'trello')"
|
|
@@ -2756,26 +2800,28 @@ var GenerateAppTypesSchema = z.object({
|
|
|
2756
2800
|
"Generate TypeScript type definitions for apps - can optionally write to disk or just return type strings"
|
|
2757
2801
|
);
|
|
2758
2802
|
var AstTypeGenerator = class {
|
|
2759
|
-
constructor() {
|
|
2803
|
+
constructor(options) {
|
|
2760
2804
|
this.factory = ts.factory;
|
|
2761
2805
|
this.printer = ts.createPrinter({
|
|
2762
2806
|
newLine: ts.NewLineKind.LineFeed,
|
|
2763
2807
|
removeComments: false,
|
|
2764
2808
|
omitTrailingSemicolon: false
|
|
2765
2809
|
});
|
|
2810
|
+
this.listActions = options.listActions;
|
|
2811
|
+
this.listActionInputFields = options.listActionInputFields;
|
|
2766
2812
|
}
|
|
2767
2813
|
/**
|
|
2768
2814
|
* Generate TypeScript types using AST for a specific app
|
|
2769
2815
|
*/
|
|
2770
2816
|
async generateTypes(options) {
|
|
2771
|
-
const { app, connectionId
|
|
2772
|
-
const actionsResult = await
|
|
2817
|
+
const { app, connectionId } = options;
|
|
2818
|
+
const actionsResult = await this.listActions({
|
|
2773
2819
|
appKey: app.implementation_id
|
|
2774
2820
|
});
|
|
2775
2821
|
const actions = actionsResult.data;
|
|
2776
2822
|
const actionsWithFields = [];
|
|
2777
2823
|
const inputFieldsTasks = actions.map(
|
|
2778
|
-
(action) => () =>
|
|
2824
|
+
(action) => () => this.listActionInputFields({
|
|
2779
2825
|
appKey: app.implementation_id,
|
|
2780
2826
|
actionKey: action.key,
|
|
2781
2827
|
actionType: action.action_type,
|
|
@@ -3345,133 +3391,147 @@ function createManifestEntry(app) {
|
|
|
3345
3391
|
version: app.version
|
|
3346
3392
|
};
|
|
3347
3393
|
}
|
|
3348
|
-
var
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3394
|
+
var listAppsRef = declareMethod({ id: "listApps" });
|
|
3395
|
+
var listConnectionsRef = declareMethod({ id: "listConnections" });
|
|
3396
|
+
var listActionsRef = declareMethod({ id: "listActions" });
|
|
3397
|
+
var listActionInputFieldsRef = declareMethod({ id: "listActionInputFields" });
|
|
3398
|
+
var generateAppTypesPlugin = defineMethod({
|
|
3399
|
+
name: "generateAppTypes",
|
|
3400
|
+
imports: [
|
|
3401
|
+
listAppsRef,
|
|
3402
|
+
listConnectionsRef,
|
|
3403
|
+
listActionsRef,
|
|
3404
|
+
listActionInputFieldsRef
|
|
3405
|
+
],
|
|
3406
|
+
output: "raw",
|
|
3407
|
+
categories: ["utility"],
|
|
3408
|
+
// Cast: schema validates JSON fields only; GenerateAppTypesOptions adds the
|
|
3409
|
+
// runtime-only `onProgress` callback, widening the input type for `run`.
|
|
3410
|
+
inputSchema: GenerateAppTypesSchema,
|
|
3411
|
+
// The schema stays for projection (CLI flags / docs); the runtime parse is
|
|
3412
|
+
// skipped because it would strip the runtime-only `onProgress` callback.
|
|
3413
|
+
skipInputValidation: true,
|
|
3414
|
+
run: async ({ imports, input }) => {
|
|
3415
|
+
const {
|
|
3416
|
+
apps: appKeys,
|
|
3417
|
+
connections: connectionIds,
|
|
3418
|
+
skipWrite = false,
|
|
3419
|
+
typesOutputDirectory = await detectTypesOutputDirectory(),
|
|
3420
|
+
onProgress
|
|
3421
|
+
} = input;
|
|
3422
|
+
const resolvedTypesOutput = resolve(typesOutputDirectory);
|
|
3423
|
+
const result = { typeDefinitions: {} };
|
|
3424
|
+
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
3425
|
+
const appsIterable = imports.listApps({ apps: appKeys }).items();
|
|
3426
|
+
const apps = [];
|
|
3427
|
+
for await (const app of appsIterable) {
|
|
3428
|
+
apps.push(app);
|
|
3429
|
+
onProgress?.({ type: "app_found", app });
|
|
3430
|
+
}
|
|
3431
|
+
onProgress?.({ type: "apps_lookup_complete", count: apps.length });
|
|
3432
|
+
if (apps.length === 0) {
|
|
3433
|
+
return result;
|
|
3434
|
+
}
|
|
3435
|
+
const connections = [];
|
|
3436
|
+
if (connectionIds && connectionIds.length > 0) {
|
|
3437
|
+
onProgress?.({
|
|
3438
|
+
type: "connections_lookup_start",
|
|
3439
|
+
count: connectionIds.length
|
|
3440
|
+
});
|
|
3441
|
+
const connectionsIterable = imports.listConnections({ connections: connectionIds }).items();
|
|
3442
|
+
for await (const connection of connectionsIterable) {
|
|
3443
|
+
connections.push(connection);
|
|
3396
3444
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
}
|
|
3418
|
-
let connectionId;
|
|
3419
|
-
if (connections.length > 0) {
|
|
3420
|
-
const matchingConnection = connections.find(
|
|
3421
|
-
(conn) => conn.app_key === app.key
|
|
3422
|
-
);
|
|
3423
|
-
if (matchingConnection) {
|
|
3424
|
-
connectionId = matchingConnection.id;
|
|
3425
|
-
onProgress?.({
|
|
3426
|
-
type: "connection_matched",
|
|
3427
|
-
app: app.key,
|
|
3428
|
-
connectionId: matchingConnection.id,
|
|
3429
|
-
connectionTitle: matchingConnection.title || ""
|
|
3430
|
-
});
|
|
3431
|
-
} else {
|
|
3432
|
-
onProgress?.({
|
|
3433
|
-
type: "connection_not_matched",
|
|
3434
|
-
app: app.key
|
|
3435
|
-
});
|
|
3436
|
-
}
|
|
3437
|
-
}
|
|
3438
|
-
const manifestKey = getManifestKey(app);
|
|
3439
|
-
const generator = new AstTypeGenerator();
|
|
3440
|
-
const typeDefinitionString = await generator.generateTypes({
|
|
3441
|
-
app,
|
|
3442
|
-
connectionId,
|
|
3443
|
-
sdk: sdk2
|
|
3444
|
-
});
|
|
3445
|
-
result.typeDefinitions[manifestKey] = typeDefinitionString;
|
|
3446
|
-
onProgress?.({
|
|
3447
|
-
type: "type_generated",
|
|
3448
|
-
manifestKey,
|
|
3449
|
-
sizeBytes: typeDefinitionString.length
|
|
3450
|
-
});
|
|
3451
|
-
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
3452
|
-
const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
3453
|
-
await writeFile(filePath, typeDefinitionString, "utf8");
|
|
3454
|
-
result.writtenFiles[manifestKey] = filePath;
|
|
3455
|
-
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
3456
|
-
}
|
|
3457
|
-
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3458
|
-
} catch (error) {
|
|
3459
|
-
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3445
|
+
onProgress?.({
|
|
3446
|
+
type: "connections_lookup_complete",
|
|
3447
|
+
count: connections.length
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3450
|
+
if (!skipWrite && resolvedTypesOutput) {
|
|
3451
|
+
await mkdir(resolvedTypesOutput, { recursive: true });
|
|
3452
|
+
}
|
|
3453
|
+
if (!skipWrite) {
|
|
3454
|
+
result.writtenFiles = {};
|
|
3455
|
+
}
|
|
3456
|
+
for (const app of apps) {
|
|
3457
|
+
onProgress?.({
|
|
3458
|
+
type: "app_processing_start",
|
|
3459
|
+
app: app.key,
|
|
3460
|
+
slug: app.slug
|
|
3461
|
+
});
|
|
3462
|
+
try {
|
|
3463
|
+
if (!app.version) {
|
|
3464
|
+
const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
|
|
3460
3465
|
onProgress?.({
|
|
3461
3466
|
type: "app_processing_error",
|
|
3462
3467
|
app: app.key,
|
|
3463
3468
|
error: errorMessage
|
|
3464
3469
|
});
|
|
3465
|
-
|
|
3466
|
-
|
|
3470
|
+
throw new ZapierValidationError(errorMessage, {
|
|
3471
|
+
details: {
|
|
3472
|
+
appKey: app.key,
|
|
3473
|
+
implementationId: app.implementation_id
|
|
3474
|
+
}
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
let connectionId;
|
|
3478
|
+
if (connections.length > 0) {
|
|
3479
|
+
const matchingConnection = connections.find(
|
|
3480
|
+
(conn) => conn.app_key === app.key
|
|
3481
|
+
);
|
|
3482
|
+
if (matchingConnection) {
|
|
3483
|
+
connectionId = matchingConnection.id;
|
|
3484
|
+
onProgress?.({
|
|
3485
|
+
type: "connection_matched",
|
|
3486
|
+
app: app.key,
|
|
3487
|
+
connectionId: matchingConnection.id,
|
|
3488
|
+
connectionTitle: matchingConnection.title || ""
|
|
3489
|
+
});
|
|
3490
|
+
} else {
|
|
3491
|
+
onProgress?.({
|
|
3492
|
+
type: "connection_not_matched",
|
|
3493
|
+
app: app.key
|
|
3494
|
+
});
|
|
3467
3495
|
}
|
|
3468
|
-
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3469
3496
|
}
|
|
3497
|
+
const manifestKey = getManifestKey(app);
|
|
3498
|
+
const generator = new AstTypeGenerator({
|
|
3499
|
+
listActions: imports.listActions,
|
|
3500
|
+
listActionInputFields: imports.listActionInputFields
|
|
3501
|
+
});
|
|
3502
|
+
const typeDefinitionString = await generator.generateTypes({
|
|
3503
|
+
app,
|
|
3504
|
+
connectionId
|
|
3505
|
+
});
|
|
3506
|
+
result.typeDefinitions[manifestKey] = typeDefinitionString;
|
|
3507
|
+
onProgress?.({
|
|
3508
|
+
type: "type_generated",
|
|
3509
|
+
manifestKey,
|
|
3510
|
+
sizeBytes: typeDefinitionString.length
|
|
3511
|
+
});
|
|
3512
|
+
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
3513
|
+
const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
3514
|
+
await writeFile(filePath, typeDefinitionString, "utf8");
|
|
3515
|
+
result.writtenFiles[manifestKey] = filePath;
|
|
3516
|
+
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
3517
|
+
}
|
|
3518
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3519
|
+
} catch (error) {
|
|
3520
|
+
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3521
|
+
onProgress?.({
|
|
3522
|
+
type: "app_processing_error",
|
|
3523
|
+
app: app.key,
|
|
3524
|
+
error: errorMessage
|
|
3525
|
+
});
|
|
3526
|
+
if (error instanceof ZapierValidationError) {
|
|
3527
|
+
throw error;
|
|
3528
|
+
}
|
|
3529
|
+
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3470
3530
|
}
|
|
3471
|
-
return result;
|
|
3472
3531
|
}
|
|
3473
|
-
|
|
3474
|
-
|
|
3532
|
+
return result;
|
|
3533
|
+
}
|
|
3534
|
+
});
|
|
3475
3535
|
var BuildManifestSchema = z.object({
|
|
3476
3536
|
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
3477
3537
|
"One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"
|
|
@@ -3487,80 +3547,78 @@ var BuildManifestSchema = z.object({
|
|
|
3487
3547
|
);
|
|
3488
3548
|
|
|
3489
3549
|
// src/plugins/buildManifest/index.ts
|
|
3490
|
-
var
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3550
|
+
var listAppsRef2 = declareMethod({ id: "listApps" });
|
|
3551
|
+
var buildManifestPlugin = defineMethod({
|
|
3552
|
+
name: "buildManifest",
|
|
3553
|
+
imports: [listAppsRef2, manifestPluginRef],
|
|
3554
|
+
output: "raw",
|
|
3555
|
+
categories: ["utility"],
|
|
3556
|
+
// Cast: BuildManifestSchema validates JSON-serializable fields only.
|
|
3557
|
+
// BuildManifestOptions adds an `onProgress` callback; this widens the input
|
|
3558
|
+
// type so `run` can read it.
|
|
3559
|
+
inputSchema: BuildManifestSchema,
|
|
3560
|
+
// The schema stays for projection (CLI flags / docs); the runtime parse is
|
|
3561
|
+
// skipped because it would strip the runtime-only `onProgress` callback.
|
|
3562
|
+
skipInputValidation: true,
|
|
3563
|
+
run: async ({ imports, input }) => {
|
|
3564
|
+
const { apps: appKeys, skipWrite = false, configPath, onProgress } = input;
|
|
3565
|
+
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
3566
|
+
const appsIterable = imports.listApps({ apps: appKeys }).items();
|
|
3567
|
+
const apps = [];
|
|
3568
|
+
for await (const app of appsIterable) {
|
|
3569
|
+
apps.push(app);
|
|
3570
|
+
onProgress?.({ type: "app_found", app });
|
|
3571
|
+
}
|
|
3572
|
+
onProgress?.({ type: "apps_lookup_complete", count: apps.length });
|
|
3573
|
+
if (apps.length === 0) {
|
|
3574
|
+
return {};
|
|
3575
|
+
}
|
|
3576
|
+
let updatedManifest;
|
|
3577
|
+
for (const app of apps) {
|
|
3578
|
+
onProgress?.({
|
|
3579
|
+
type: "app_processing_start",
|
|
3580
|
+
app: app.key,
|
|
3581
|
+
slug: app.slug
|
|
3582
|
+
});
|
|
3583
|
+
try {
|
|
3584
|
+
const manifestEntry = createManifestEntry(app);
|
|
3519
3585
|
onProgress?.({
|
|
3520
|
-
type: "
|
|
3586
|
+
type: "manifest_entry_built",
|
|
3521
3587
|
app: app.key,
|
|
3522
|
-
|
|
3588
|
+
manifestKey: manifestEntry.implementationName,
|
|
3589
|
+
version: manifestEntry.version || ""
|
|
3523
3590
|
});
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3549
|
-
onProgress?.({
|
|
3550
|
-
type: "app_processing_error",
|
|
3551
|
-
app: app.key,
|
|
3552
|
-
error: errorMessage
|
|
3553
|
-
});
|
|
3554
|
-
if (error instanceof ZapierValidationError) {
|
|
3555
|
-
throw error;
|
|
3556
|
-
}
|
|
3557
|
-
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3591
|
+
const { key: updatedManifestKey, manifest } = await imports.manifest.updateManifestEntry({
|
|
3592
|
+
appKey: app.key,
|
|
3593
|
+
entry: manifestEntry,
|
|
3594
|
+
configPath,
|
|
3595
|
+
skipWrite,
|
|
3596
|
+
manifest: updatedManifest
|
|
3597
|
+
});
|
|
3598
|
+
updatedManifest = manifest;
|
|
3599
|
+
onProgress?.({
|
|
3600
|
+
type: "manifest_updated",
|
|
3601
|
+
app: app.key,
|
|
3602
|
+
manifestKey: updatedManifestKey,
|
|
3603
|
+
version: manifestEntry.version || ""
|
|
3604
|
+
});
|
|
3605
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3606
|
+
} catch (error) {
|
|
3607
|
+
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3608
|
+
onProgress?.({
|
|
3609
|
+
type: "app_processing_error",
|
|
3610
|
+
app: app.key,
|
|
3611
|
+
error: errorMessage
|
|
3612
|
+
});
|
|
3613
|
+
if (error instanceof ZapierValidationError) {
|
|
3614
|
+
throw error;
|
|
3558
3615
|
}
|
|
3616
|
+
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3559
3617
|
}
|
|
3560
|
-
return { manifest: updatedManifest };
|
|
3561
3618
|
}
|
|
3562
|
-
|
|
3563
|
-
|
|
3619
|
+
return { manifest: updatedManifest };
|
|
3620
|
+
}
|
|
3621
|
+
});
|
|
3564
3622
|
var FeedbackSchema = z.object({
|
|
3565
3623
|
feedback: z.string().describe(
|
|
3566
3624
|
"Your feedback on the Zapier SDK. Describe what worked well, what was frustrating, or any suggestions."
|
|
@@ -3568,11 +3626,13 @@ var FeedbackSchema = z.object({
|
|
|
3568
3626
|
}).describe(
|
|
3569
3627
|
"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."
|
|
3570
3628
|
);
|
|
3571
|
-
|
|
3629
|
+
|
|
3630
|
+
// src/plugins/feedback/index.ts
|
|
3631
|
+
var feedbackResolver = defineResolver({
|
|
3572
3632
|
type: "static",
|
|
3573
3633
|
inputType: "text",
|
|
3574
3634
|
placeholder: "Enter your feedback"
|
|
3575
|
-
};
|
|
3635
|
+
});
|
|
3576
3636
|
var DEFAULT_FEEDBACK_WEBHOOK_URL = "https://hooks.zapier.com/hooks/catch/20279515/uc98k9m/";
|
|
3577
3637
|
var MAX_RETRIES = 2;
|
|
3578
3638
|
var RETRY_DELAY_MS = 1e3;
|
|
@@ -3594,31 +3654,33 @@ async function postWithRetry({
|
|
|
3594
3654
|
}
|
|
3595
3655
|
return response;
|
|
3596
3656
|
}
|
|
3597
|
-
var feedbackPlugin =
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3657
|
+
var feedbackPlugin = defineMethod({
|
|
3658
|
+
name: "feedback",
|
|
3659
|
+
imports: [sdkOptionsPluginRef],
|
|
3660
|
+
categories: ["utility"],
|
|
3661
|
+
inputSchema: FeedbackSchema,
|
|
3662
|
+
// Returns the thank-you string verbatim — no `{ data }` envelope, matching
|
|
3663
|
+
// legacy.
|
|
3664
|
+
output: "raw",
|
|
3665
|
+
resolvers: { feedback: feedbackResolver },
|
|
3666
|
+
run: async ({ imports, input }) => {
|
|
3667
|
+
const user = await getLoggedInUser();
|
|
3668
|
+
const body = JSON.stringify({
|
|
3669
|
+
email: user.email,
|
|
3670
|
+
customuser_id: user.customUserId,
|
|
3671
|
+
feedback: input.feedback
|
|
3672
|
+
});
|
|
3673
|
+
const response = await postWithRetry({
|
|
3674
|
+
body,
|
|
3675
|
+
attemptsLeft: MAX_RETRIES
|
|
3676
|
+
});
|
|
3677
|
+
if (imports.sdkOptions?.debug) {
|
|
3678
|
+
const text = await response.text();
|
|
3679
|
+
console.error("[debug] Webhook response:", text);
|
|
3619
3680
|
}
|
|
3620
|
-
|
|
3621
|
-
|
|
3681
|
+
return "Thank you for your feedback!";
|
|
3682
|
+
}
|
|
3683
|
+
});
|
|
3622
3684
|
var CurlSchema = z.object({
|
|
3623
3685
|
url: z.string().describe("Request URL"),
|
|
3624
3686
|
request: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method (defaults to GET, or POST if data is provided)"),
|
|
@@ -3795,8 +3857,38 @@ async function buildFormData(formArgs, formStringArgs) {
|
|
|
3795
3857
|
}
|
|
3796
3858
|
|
|
3797
3859
|
// src/plugins/curl/index.ts
|
|
3798
|
-
var
|
|
3799
|
-
|
|
3860
|
+
var fetchRef = declareMethod({
|
|
3861
|
+
id: "fetch"
|
|
3862
|
+
});
|
|
3863
|
+
var curlPlugin = defineMethod({
|
|
3864
|
+
name: "curl",
|
|
3865
|
+
imports: [fetchRef],
|
|
3866
|
+
// Returns nothing renderable; output goes to stdout/stderr/files, matching
|
|
3867
|
+
// curl itself.
|
|
3868
|
+
output: "raw",
|
|
3869
|
+
inputSchema: CurlSchema,
|
|
3870
|
+
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.",
|
|
3871
|
+
categories: ["http"],
|
|
3872
|
+
aliases: {
|
|
3873
|
+
request: "X",
|
|
3874
|
+
header: "H",
|
|
3875
|
+
data: "d",
|
|
3876
|
+
form: "F",
|
|
3877
|
+
get: "G",
|
|
3878
|
+
head: "I",
|
|
3879
|
+
location: "L",
|
|
3880
|
+
include: "i",
|
|
3881
|
+
output: "o",
|
|
3882
|
+
remoteName: "O",
|
|
3883
|
+
verbose: "v",
|
|
3884
|
+
silent: "s",
|
|
3885
|
+
showError: "S",
|
|
3886
|
+
writeOut: "w",
|
|
3887
|
+
maxTime: "m",
|
|
3888
|
+
user: "u",
|
|
3889
|
+
fail: "f"
|
|
3890
|
+
},
|
|
3891
|
+
run: async ({ imports, input }) => {
|
|
3800
3892
|
const {
|
|
3801
3893
|
url: rawUrl,
|
|
3802
3894
|
request,
|
|
@@ -3826,7 +3918,7 @@ var curlPlugin = definePlugin((sdk) => {
|
|
|
3826
3918
|
compressed,
|
|
3827
3919
|
connection: connectionParam,
|
|
3828
3920
|
connectionId
|
|
3829
|
-
} =
|
|
3921
|
+
} = input;
|
|
3830
3922
|
const connection = connectionParam ?? connectionId;
|
|
3831
3923
|
const parsedUrl = new URL(rawUrl);
|
|
3832
3924
|
const headers = {};
|
|
@@ -3928,7 +4020,7 @@ var curlPlugin = definePlugin((sdk) => {
|
|
|
3928
4020
|
process.stderr.write(">\n");
|
|
3929
4021
|
}
|
|
3930
4022
|
const start = performance.now();
|
|
3931
|
-
const response = await
|
|
4023
|
+
const response = await imports.fetch(effectiveUrl.toString(), {
|
|
3932
4024
|
method,
|
|
3933
4025
|
headers,
|
|
3934
4026
|
body,
|
|
@@ -4007,52 +4099,13 @@ ${Array.from(
|
|
|
4007
4099
|
}
|
|
4008
4100
|
return void 0;
|
|
4009
4101
|
}
|
|
4010
|
-
return {
|
|
4011
|
-
curl,
|
|
4012
|
-
context: {
|
|
4013
|
-
meta: {
|
|
4014
|
-
curl: {
|
|
4015
|
-
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.",
|
|
4016
|
-
categories: ["http"],
|
|
4017
|
-
inputSchema: CurlSchema,
|
|
4018
|
-
aliases: {
|
|
4019
|
-
request: "X",
|
|
4020
|
-
header: "H",
|
|
4021
|
-
data: "d",
|
|
4022
|
-
form: "F",
|
|
4023
|
-
get: "G",
|
|
4024
|
-
head: "I",
|
|
4025
|
-
location: "L",
|
|
4026
|
-
include: "i",
|
|
4027
|
-
output: "o",
|
|
4028
|
-
remoteName: "O",
|
|
4029
|
-
verbose: "v",
|
|
4030
|
-
silent: "s",
|
|
4031
|
-
showError: "S",
|
|
4032
|
-
writeOut: "w",
|
|
4033
|
-
maxTime: "m",
|
|
4034
|
-
user: "u",
|
|
4035
|
-
fail: "f"
|
|
4036
|
-
}
|
|
4037
|
-
}
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
};
|
|
4041
4102
|
});
|
|
4042
|
-
var
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
meta.fetch = {
|
|
4047
|
-
...sdk.context.meta.fetch,
|
|
4048
|
-
deprecation: {
|
|
4049
|
-
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
4050
|
-
}
|
|
4051
|
-
};
|
|
4052
|
-
}
|
|
4053
|
-
return { context: { meta } };
|
|
4103
|
+
var cliFetchOverride = defineMethodOverride({
|
|
4104
|
+
target: "fetch",
|
|
4105
|
+
deprecation: {
|
|
4106
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
4054
4107
|
}
|
|
4055
|
-
);
|
|
4108
|
+
});
|
|
4056
4109
|
var TEMPLATES = ["basic"];
|
|
4057
4110
|
var InitSchema = z.object({
|
|
4058
4111
|
projectName: z.string().min(1).describe("Name of the project directory to create"),
|
|
@@ -4469,61 +4522,61 @@ function displaySummaryAndNextSteps({
|
|
|
4469
4522
|
}
|
|
4470
4523
|
|
|
4471
4524
|
// src/plugins/init/index.ts
|
|
4472
|
-
var initPlugin =
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
const packageManager = packageManagerInfo.name === "unknown" ? "npm" : packageManagerInfo.name;
|
|
4491
|
-
const steps = getInitSteps({
|
|
4492
|
-
projectDir,
|
|
4493
|
-
projectName,
|
|
4494
|
-
packageManager,
|
|
4495
|
-
displayHooks
|
|
4496
|
-
});
|
|
4497
|
-
const completedSetupStepIds = [];
|
|
4498
|
-
for (let i = 0; i < steps.length; i++) {
|
|
4499
|
-
const step = steps[i];
|
|
4500
|
-
const succeeded = await withInterruptCleanup(
|
|
4501
|
-
step.cleanup,
|
|
4502
|
-
() => runStep({
|
|
4503
|
-
step,
|
|
4504
|
-
stepNumber: i + 1,
|
|
4505
|
-
totalSteps: steps.length,
|
|
4506
|
-
nonInteractive,
|
|
4507
|
-
displayHooks
|
|
4508
|
-
})
|
|
4509
|
-
);
|
|
4510
|
-
if (!succeeded) break;
|
|
4511
|
-
completedSetupStepIds.push(step.id);
|
|
4512
|
-
}
|
|
4513
|
-
if (completedSetupStepIds.length === 0) {
|
|
4514
|
-
throw new ZapierCliExitError(
|
|
4515
|
-
"Project setup failed \u2014 no steps completed."
|
|
4516
|
-
);
|
|
4517
|
-
}
|
|
4518
|
-
displaySummaryAndNextSteps({
|
|
4519
|
-
projectName,
|
|
4520
|
-
steps,
|
|
4521
|
-
completedSetupStepIds,
|
|
4522
|
-
packageManager
|
|
4523
|
-
});
|
|
4525
|
+
var initPlugin = defineMethod({
|
|
4526
|
+
name: "init",
|
|
4527
|
+
categories: ["utility"],
|
|
4528
|
+
supportsJsonOutput: false,
|
|
4529
|
+
inputSchema: InitSchema,
|
|
4530
|
+
// All progress goes to the console; nothing to envelope, matching legacy.
|
|
4531
|
+
output: "raw",
|
|
4532
|
+
run: async ({ input }) => {
|
|
4533
|
+
const { projectName: rawName } = input;
|
|
4534
|
+
const nonInteractive = resolveNonInteractive(input);
|
|
4535
|
+
const cwd = process.cwd();
|
|
4536
|
+
const { projectName, projectDir } = validateInitOptions({ rawName, cwd });
|
|
4537
|
+
const displayHooks = createConsoleDisplayHooks();
|
|
4538
|
+
const packageManagerInfo = detectPackageManager(cwd);
|
|
4539
|
+
if (packageManagerInfo.name === "unknown") {
|
|
4540
|
+
displayHooks.onWarn(
|
|
4541
|
+
"Could not detect package manager, defaulting to npm."
|
|
4542
|
+
);
|
|
4524
4543
|
}
|
|
4525
|
-
|
|
4526
|
-
|
|
4544
|
+
const packageManager = packageManagerInfo.name === "unknown" ? "npm" : packageManagerInfo.name;
|
|
4545
|
+
const steps = getInitSteps({
|
|
4546
|
+
projectDir,
|
|
4547
|
+
projectName,
|
|
4548
|
+
packageManager,
|
|
4549
|
+
displayHooks
|
|
4550
|
+
});
|
|
4551
|
+
const completedSetupStepIds = [];
|
|
4552
|
+
for (let i = 0; i < steps.length; i++) {
|
|
4553
|
+
const step = steps[i];
|
|
4554
|
+
const succeeded = await withInterruptCleanup(
|
|
4555
|
+
step.cleanup,
|
|
4556
|
+
() => runStep({
|
|
4557
|
+
step,
|
|
4558
|
+
stepNumber: i + 1,
|
|
4559
|
+
totalSteps: steps.length,
|
|
4560
|
+
nonInteractive,
|
|
4561
|
+
displayHooks
|
|
4562
|
+
})
|
|
4563
|
+
);
|
|
4564
|
+
if (!succeeded) break;
|
|
4565
|
+
completedSetupStepIds.push(step.id);
|
|
4566
|
+
}
|
|
4567
|
+
if (completedSetupStepIds.length === 0) {
|
|
4568
|
+
throw new ZapierCliExitError(
|
|
4569
|
+
"Project setup failed \u2014 no steps completed."
|
|
4570
|
+
);
|
|
4571
|
+
}
|
|
4572
|
+
displaySummaryAndNextSteps({
|
|
4573
|
+
projectName,
|
|
4574
|
+
steps,
|
|
4575
|
+
completedSetupStepIds,
|
|
4576
|
+
packageManager
|
|
4577
|
+
});
|
|
4578
|
+
}
|
|
4579
|
+
});
|
|
4527
4580
|
function jsonReplacer(_key, value) {
|
|
4528
4581
|
if (value instanceof Error) {
|
|
4529
4582
|
return {
|
|
@@ -4763,127 +4816,132 @@ var ExecCliProperty = z.string().optional().describe(
|
|
|
4763
4816
|
var ExecShellCliProperty = z.string().optional().describe(
|
|
4764
4817
|
"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."
|
|
4765
4818
|
);
|
|
4766
|
-
var
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4819
|
+
var drainTriggerInboxRef = declareMethod({ id: "drainTriggerInbox" });
|
|
4820
|
+
var drainTriggerInboxCliPlugin = defineMethod({
|
|
4821
|
+
// Distinct id "cli/drainTriggerInbox" so it never collides with the SDK
|
|
4822
|
+
// drain's id, but the SAME surface binding "drainTriggerInbox" so it replaces
|
|
4823
|
+
// the SDK drain on the CLI surface.
|
|
4824
|
+
namespace: "cli",
|
|
4825
|
+
name: "drainTriggerInbox",
|
|
4826
|
+
imports: [drainTriggerInboxRef],
|
|
4827
|
+
type: "create",
|
|
4828
|
+
itemType: "void",
|
|
4829
|
+
returnType: "void",
|
|
4830
|
+
categories: ["trigger"],
|
|
4831
|
+
// Mirror the SDK drain's rendered CLI description, which is the drain schema's
|
|
4832
|
+
// description (what the pre-module CLI surfaced via context.meta).
|
|
4833
|
+
description: DrainTriggerInboxSchema.description,
|
|
4834
|
+
// Visible in cli+mcp+sdk views, matching the legacy override's `packages:
|
|
4835
|
+
// undefined` (the SDK drain is `packages: ["sdk"]`; the CLI replacement drops
|
|
4836
|
+
// that gate so the command shows up on the CLI surface).
|
|
4837
|
+
inputSchema: DrainTriggerInboxSchema.extend({
|
|
4838
|
+
exec: ExecCliProperty,
|
|
4839
|
+
execShell: ExecShellCliProperty,
|
|
4840
|
+
json: JsonProperty
|
|
4841
|
+
}),
|
|
4842
|
+
// The wrapper owns input handling (it builds onMessage and reattaches the
|
|
4843
|
+
// post-`--` argv); the extended schema stays for projection (CLI flags / docs).
|
|
4844
|
+
skipInputValidation: true,
|
|
4845
|
+
// Returns Promise<void> verbatim — no `{ data }` envelope, matching legacy.
|
|
4846
|
+
output: "raw",
|
|
4847
|
+
resolvers: { inbox: triggerInboxResolver },
|
|
4848
|
+
run: ({ imports, input }) => {
|
|
4849
|
+
const original = imports.drainTriggerInbox;
|
|
4850
|
+
const options = input;
|
|
4851
|
+
const doDrain = async () => {
|
|
4852
|
+
const { json, exec, execShell, ...sdkArgs } = options;
|
|
4853
|
+
rejectExecJsonMutex({ exec, execShell, json });
|
|
4854
|
+
if (!exec && !execShell && !json) {
|
|
4855
|
+
requireInteractiveTty("drain-trigger-inbox");
|
|
4856
|
+
}
|
|
4857
|
+
const sigintController = new AbortController();
|
|
4858
|
+
const onSigint = () => sigintController.abort();
|
|
4859
|
+
process.on("SIGINT", onSigint);
|
|
4860
|
+
const combined = combineSignals(sdkArgs.signal, sigintController.signal);
|
|
4861
|
+
let fulfilled = 0;
|
|
4862
|
+
let rejected = 0;
|
|
4863
|
+
let skipped = 0;
|
|
4864
|
+
const liveOnError = (reason, message) => {
|
|
4865
|
+
rejected++;
|
|
4866
|
+
printDrainError(reason, message);
|
|
4867
|
+
};
|
|
4868
|
+
try {
|
|
4869
|
+
if (exec) {
|
|
4870
|
+
const execArgv = [exec, ...getPostDashArgs()];
|
|
4871
|
+
await original({
|
|
4872
|
+
...sdkArgs,
|
|
4873
|
+
signal: combined.signal,
|
|
4874
|
+
onMessage: async (message) => {
|
|
4875
|
+
await runExecCommand(execArgv, message, combined.signal);
|
|
4876
|
+
fulfilled++;
|
|
4877
|
+
},
|
|
4878
|
+
onError: liveOnError
|
|
4879
|
+
});
|
|
4880
|
+
return;
|
|
4786
4881
|
}
|
|
4787
|
-
|
|
4788
|
-
const onSigint = () => sigintController.abort();
|
|
4789
|
-
process.on("SIGINT", onSigint);
|
|
4790
|
-
const combined = combineSignals(
|
|
4791
|
-
sdkArgs.signal,
|
|
4792
|
-
sigintController.signal
|
|
4793
|
-
);
|
|
4794
|
-
let fulfilled = 0;
|
|
4795
|
-
let rejected = 0;
|
|
4796
|
-
let skipped = 0;
|
|
4797
|
-
const liveOnError = (reason, message) => {
|
|
4798
|
-
rejected++;
|
|
4799
|
-
printDrainError(reason, message);
|
|
4800
|
-
};
|
|
4801
|
-
try {
|
|
4802
|
-
if (exec) {
|
|
4803
|
-
const execArgv = [exec, ...getPostDashArgs()];
|
|
4804
|
-
await original({
|
|
4805
|
-
...sdkArgs,
|
|
4806
|
-
signal: combined.signal,
|
|
4807
|
-
onMessage: async (message) => {
|
|
4808
|
-
await runExecCommand(execArgv, message, combined.signal);
|
|
4809
|
-
fulfilled++;
|
|
4810
|
-
},
|
|
4811
|
-
onError: liveOnError
|
|
4812
|
-
});
|
|
4813
|
-
return;
|
|
4814
|
-
}
|
|
4815
|
-
if (execShell) {
|
|
4816
|
-
await original({
|
|
4817
|
-
...sdkArgs,
|
|
4818
|
-
signal: combined.signal,
|
|
4819
|
-
onMessage: async (message) => {
|
|
4820
|
-
await runShellCommand(execShell, message, combined.signal);
|
|
4821
|
-
fulfilled++;
|
|
4822
|
-
},
|
|
4823
|
-
onError: liveOnError
|
|
4824
|
-
});
|
|
4825
|
-
return;
|
|
4826
|
-
}
|
|
4827
|
-
if (json) {
|
|
4828
|
-
const data = [];
|
|
4829
|
-
const errors = [];
|
|
4830
|
-
await original({
|
|
4831
|
-
...sdkArgs,
|
|
4832
|
-
signal: combined.signal,
|
|
4833
|
-
continueOnError: true,
|
|
4834
|
-
onMessage: (message) => {
|
|
4835
|
-
data.push(message);
|
|
4836
|
-
},
|
|
4837
|
-
onError: (reason, message) => {
|
|
4838
|
-
errors.push({ reason, message });
|
|
4839
|
-
}
|
|
4840
|
-
});
|
|
4841
|
-
process.stdout.write(
|
|
4842
|
-
JSON.stringify({ data, errors }, jsonReplacer, 2) + "\n"
|
|
4843
|
-
);
|
|
4844
|
-
return;
|
|
4845
|
-
}
|
|
4846
|
-
if (sdkArgs.continueOnError === false) {
|
|
4847
|
-
warnInteractiveContinueOnErrorOverride();
|
|
4848
|
-
}
|
|
4849
|
-
const interactive = createInteractiveCallback();
|
|
4882
|
+
if (execShell) {
|
|
4850
4883
|
await original({
|
|
4851
4884
|
...sdkArgs,
|
|
4852
4885
|
signal: combined.signal,
|
|
4853
|
-
concurrency: 1,
|
|
4854
|
-
continueOnError: true,
|
|
4855
4886
|
onMessage: async (message) => {
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4887
|
+
await runShellCommand(execShell, message, combined.signal);
|
|
4888
|
+
fulfilled++;
|
|
4889
|
+
},
|
|
4890
|
+
onError: liveOnError
|
|
4891
|
+
});
|
|
4892
|
+
return;
|
|
4893
|
+
}
|
|
4894
|
+
if (json) {
|
|
4895
|
+
const data = [];
|
|
4896
|
+
const errors = [];
|
|
4897
|
+
await original({
|
|
4898
|
+
...sdkArgs,
|
|
4899
|
+
signal: combined.signal,
|
|
4900
|
+
continueOnError: true,
|
|
4901
|
+
onMessage: (message) => {
|
|
4902
|
+
data.push(message);
|
|
4903
|
+
},
|
|
4904
|
+
onError: (reason, message) => {
|
|
4905
|
+
errors.push({ reason, message });
|
|
4865
4906
|
}
|
|
4866
4907
|
});
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4872
|
-
}
|
|
4908
|
+
process.stdout.write(
|
|
4909
|
+
JSON.stringify({ data, errors }, jsonReplacer, 2) + "\n"
|
|
4910
|
+
);
|
|
4911
|
+
return;
|
|
4873
4912
|
}
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4913
|
+
if (sdkArgs.continueOnError === false) {
|
|
4914
|
+
warnInteractiveContinueOnErrorOverride();
|
|
4915
|
+
}
|
|
4916
|
+
const interactive = createInteractiveCallback();
|
|
4917
|
+
await original({
|
|
4918
|
+
...sdkArgs,
|
|
4919
|
+
signal: combined.signal,
|
|
4920
|
+
concurrency: 1,
|
|
4921
|
+
continueOnError: true,
|
|
4922
|
+
onMessage: async (message) => {
|
|
4923
|
+
try {
|
|
4924
|
+
await interactive(message);
|
|
4925
|
+
fulfilled++;
|
|
4926
|
+
} catch (err) {
|
|
4927
|
+
if (err instanceof ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
4928
|
+
skipped++;
|
|
4929
|
+
}
|
|
4930
|
+
throw err;
|
|
4931
|
+
}
|
|
4881
4932
|
}
|
|
4933
|
+
});
|
|
4934
|
+
} finally {
|
|
4935
|
+
process.off("SIGINT", onSigint);
|
|
4936
|
+
combined.dispose();
|
|
4937
|
+
if (!json) {
|
|
4938
|
+
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4882
4939
|
}
|
|
4883
4940
|
}
|
|
4884
4941
|
};
|
|
4942
|
+
return doDrain();
|
|
4885
4943
|
}
|
|
4886
|
-
);
|
|
4944
|
+
});
|
|
4887
4945
|
var JsonProperty2 = z.boolean().optional().describe(
|
|
4888
4946
|
"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."
|
|
4889
4947
|
);
|
|
@@ -4893,120 +4951,117 @@ var ExecCliProperty2 = z.string().optional().describe(
|
|
|
4893
4951
|
var ExecShellCliProperty2 = z.string().optional().describe(
|
|
4894
4952
|
"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."
|
|
4895
4953
|
);
|
|
4896
|
-
var
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
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
|
-
|
|
4954
|
+
var cliWatchDescription = `${WatchTriggerInboxSchema.description} stdout (including --json NDJSON) is unaffected.`;
|
|
4955
|
+
var watchTriggerInboxRef = declareMethod({ id: "watchTriggerInbox" });
|
|
4956
|
+
var watchTriggerInboxCliPlugin = defineMethod({
|
|
4957
|
+
// Distinct id "cli/watchTriggerInbox", same surface binding "watchTriggerInbox".
|
|
4958
|
+
namespace: "cli",
|
|
4959
|
+
name: "watchTriggerInbox",
|
|
4960
|
+
imports: [watchTriggerInboxRef],
|
|
4961
|
+
type: "create",
|
|
4962
|
+
itemType: "void",
|
|
4963
|
+
returnType: "void",
|
|
4964
|
+
categories: ["trigger"],
|
|
4965
|
+
description: cliWatchDescription,
|
|
4966
|
+
// Visible in cli+mcp+sdk views, matching the legacy override's `packages:
|
|
4967
|
+
// undefined` (the SDK watch is `packages: ["sdk"]`).
|
|
4968
|
+
inputSchema: WatchTriggerInboxSchema.extend({
|
|
4969
|
+
exec: ExecCliProperty2,
|
|
4970
|
+
execShell: ExecShellCliProperty2,
|
|
4971
|
+
json: JsonProperty2
|
|
4972
|
+
}),
|
|
4973
|
+
// The wrapper owns input handling; the extended schema stays for projection.
|
|
4974
|
+
skipInputValidation: true,
|
|
4975
|
+
// Returns Promise<void> verbatim — no `{ data }` envelope, matching legacy.
|
|
4976
|
+
output: "raw",
|
|
4977
|
+
resolvers: { inbox: triggerInboxResolver },
|
|
4978
|
+
run: ({ imports, input }) => {
|
|
4979
|
+
const original = imports.watchTriggerInbox;
|
|
4980
|
+
const options = input;
|
|
4981
|
+
const doWatch = async () => {
|
|
4982
|
+
const { json, exec, execShell, ...sdkArgs } = options;
|
|
4983
|
+
rejectExecJsonMutex({ exec, execShell, json });
|
|
4984
|
+
if (!exec && !execShell && !json) {
|
|
4985
|
+
requireInteractiveTty("watch-trigger-inbox");
|
|
4986
|
+
}
|
|
4987
|
+
const sigintController = new AbortController();
|
|
4988
|
+
const onSigint = () => sigintController.abort();
|
|
4989
|
+
process.on("SIGINT", onSigint);
|
|
4990
|
+
const combined = combineSignals(sdkArgs.signal, sigintController.signal);
|
|
4991
|
+
let fulfilled = 0;
|
|
4992
|
+
let rejected = 0;
|
|
4993
|
+
let skipped = 0;
|
|
4994
|
+
const liveOnError = (reason, message) => {
|
|
4995
|
+
rejected++;
|
|
4996
|
+
printDrainError(reason, message);
|
|
4997
|
+
};
|
|
4998
|
+
try {
|
|
4999
|
+
if (exec) {
|
|
5000
|
+
const execArgv = [exec, ...getPostDashArgs()];
|
|
5001
|
+
await original({
|
|
5002
|
+
...sdkArgs,
|
|
5003
|
+
signal: combined.signal,
|
|
5004
|
+
onMessage: async (message) => {
|
|
5005
|
+
await runExecCommand(execArgv, message, combined.signal);
|
|
5006
|
+
fulfilled++;
|
|
5007
|
+
},
|
|
5008
|
+
onError: liveOnError
|
|
5009
|
+
});
|
|
5010
|
+
} else if (execShell) {
|
|
5011
|
+
await original({
|
|
5012
|
+
...sdkArgs,
|
|
5013
|
+
signal: combined.signal,
|
|
5014
|
+
onMessage: async (message) => {
|
|
5015
|
+
await runShellCommand(execShell, message, combined.signal);
|
|
5016
|
+
fulfilled++;
|
|
5017
|
+
},
|
|
5018
|
+
onError: liveOnError
|
|
5019
|
+
});
|
|
5020
|
+
} else if (json) {
|
|
5021
|
+
const ndjson = createNdjsonCallback();
|
|
5022
|
+
await original({
|
|
5023
|
+
...sdkArgs,
|
|
5024
|
+
signal: combined.signal,
|
|
5025
|
+
onMessage: async (message) => {
|
|
5026
|
+
await ndjson(message);
|
|
5027
|
+
fulfilled++;
|
|
5028
|
+
},
|
|
5029
|
+
onError: liveOnError
|
|
5030
|
+
});
|
|
5031
|
+
} else {
|
|
5032
|
+
if (sdkArgs.continueOnError === false) {
|
|
5033
|
+
warnInteractiveContinueOnErrorOverride();
|
|
5034
|
+
}
|
|
5035
|
+
const interactive = createInteractiveCallback();
|
|
5036
|
+
await original({
|
|
5037
|
+
...sdkArgs,
|
|
5038
|
+
signal: combined.signal,
|
|
5039
|
+
concurrency: 1,
|
|
5040
|
+
continueOnError: true,
|
|
5041
|
+
onMessage: async (message) => {
|
|
5042
|
+
try {
|
|
5043
|
+
await interactive(message);
|
|
4962
5044
|
fulfilled++;
|
|
4963
|
-
}
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
} else {
|
|
4967
|
-
if (sdkArgs.continueOnError === false) {
|
|
4968
|
-
warnInteractiveContinueOnErrorOverride();
|
|
4969
|
-
}
|
|
4970
|
-
const interactive = createInteractiveCallback();
|
|
4971
|
-
await original({
|
|
4972
|
-
...sdkArgs,
|
|
4973
|
-
signal: combined.signal,
|
|
4974
|
-
concurrency: 1,
|
|
4975
|
-
continueOnError: true,
|
|
4976
|
-
onMessage: async (message) => {
|
|
4977
|
-
try {
|
|
4978
|
-
await interactive(message);
|
|
4979
|
-
fulfilled++;
|
|
4980
|
-
} catch (err) {
|
|
4981
|
-
if (err instanceof ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
4982
|
-
skipped++;
|
|
4983
|
-
}
|
|
4984
|
-
throw err;
|
|
5045
|
+
} catch (err) {
|
|
5046
|
+
if (err instanceof ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
5047
|
+
skipped++;
|
|
4985
5048
|
}
|
|
5049
|
+
throw err;
|
|
4986
5050
|
}
|
|
4987
|
-
}
|
|
4988
|
-
}
|
|
4989
|
-
} finally {
|
|
4990
|
-
process.off("SIGINT", onSigint);
|
|
4991
|
-
combined.dispose();
|
|
4992
|
-
if (!json) {
|
|
4993
|
-
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4994
|
-
}
|
|
5051
|
+
}
|
|
5052
|
+
});
|
|
4995
5053
|
}
|
|
4996
|
-
}
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
description: cliDescription,
|
|
5002
|
-
inputSchema: extendedInputSchema,
|
|
5003
|
-
packages: void 0
|
|
5004
|
-
}
|
|
5054
|
+
} finally {
|
|
5055
|
+
process.off("SIGINT", onSigint);
|
|
5056
|
+
combined.dispose();
|
|
5057
|
+
if (!json) {
|
|
5058
|
+
printDrainSummary({ fulfilled, rejected, skipped });
|
|
5005
5059
|
}
|
|
5006
5060
|
}
|
|
5007
5061
|
};
|
|
5062
|
+
return doWatch();
|
|
5008
5063
|
}
|
|
5009
|
-
);
|
|
5064
|
+
});
|
|
5010
5065
|
var activeNotices = /* @__PURE__ */ new Map();
|
|
5011
5066
|
function collectDeprecationNotice(event) {
|
|
5012
5067
|
if (event.type !== DEPRECATION_NOTICE_EVENT) return;
|
|
@@ -5023,16 +5078,57 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
|
|
|
5023
5078
|
// package.json with { type: 'json' }
|
|
5024
5079
|
var package_default = {
|
|
5025
5080
|
name: "@zapier/zapier-sdk-cli",
|
|
5026
|
-
version: "0.
|
|
5081
|
+
version: "0.65.0"};
|
|
5027
5082
|
|
|
5028
5083
|
// src/sdk.ts
|
|
5084
|
+
var warnedDeprecatedMethods = /* @__PURE__ */ new Set();
|
|
5085
|
+
var cliCoreOptions = {
|
|
5086
|
+
...zapierCoreOptions,
|
|
5087
|
+
logDeprecation: ({ methodName, deprecation }) => {
|
|
5088
|
+
if (warnedDeprecatedMethods.has(methodName)) return;
|
|
5089
|
+
warnedDeprecatedMethods.add(methodName);
|
|
5090
|
+
console.warn();
|
|
5091
|
+
console.warn(
|
|
5092
|
+
chalk3.yellow.bold("\u26A0\uFE0F DEPRECATION WARNING") + chalk3.yellow(` - \`${toKebabCase(methodName)}\` is deprecated.`)
|
|
5093
|
+
);
|
|
5094
|
+
console.warn(chalk3.yellow(` ${deprecation.message}`));
|
|
5095
|
+
console.warn();
|
|
5096
|
+
}
|
|
5097
|
+
};
|
|
5029
5098
|
injectCliLogin(login_exports);
|
|
5099
|
+
var cliSdkPlugin = definePlugin({
|
|
5100
|
+
namespace: "zapier",
|
|
5101
|
+
name: "cli-sdk",
|
|
5102
|
+
exports: [
|
|
5103
|
+
// The SDK's `drainTriggerInbox` / `watchTriggerInbox` are eager,
|
|
5104
|
+
// callback-driven module methods; the CLI replaces them with module
|
|
5105
|
+
// methods that layer presentation flags (`--json`, interactive prompt,
|
|
5106
|
+
// `--exec-shell` wrapping) around the same `onMessage` callback,
|
|
5107
|
+
// delegating to the SDK originals by id. `omitExports` drops the SDK
|
|
5108
|
+
// drain/watch BINDINGS so the CLI replacements can bind those names
|
|
5109
|
+
// without a duplicate-binding throw, while keeping the SDK originals
|
|
5110
|
+
// materialized + addressable by id (the delegate target the CLI wrappers
|
|
5111
|
+
// reach via `declareMethod`).
|
|
5112
|
+
omitExports(zapierSdkPlugin, ["drainTriggerInbox", "watchTriggerInbox"]),
|
|
5113
|
+
drainTriggerInboxCliPlugin,
|
|
5114
|
+
watchTriggerInboxCliPlugin,
|
|
5115
|
+
loginPlugin,
|
|
5116
|
+
signupPlugin,
|
|
5117
|
+
logoutPlugin,
|
|
5118
|
+
mcpPlugin,
|
|
5119
|
+
getLoginConfigPathPlugin,
|
|
5120
|
+
initPlugin,
|
|
5121
|
+
bundleCodePlugin,
|
|
5122
|
+
feedbackPlugin,
|
|
5123
|
+
curlPlugin,
|
|
5124
|
+
addAppsPlugin,
|
|
5125
|
+
buildManifestPlugin,
|
|
5126
|
+
generateAppTypesPlugin
|
|
5127
|
+
]
|
|
5128
|
+
});
|
|
5030
5129
|
function createZapierCliSdk(options = {}) {
|
|
5031
5130
|
const { extensions = [], ...sdkOptions } = options;
|
|
5032
|
-
const
|
|
5033
|
-
context: { extensions }
|
|
5034
|
-
});
|
|
5035
|
-
const stack = createZapierSdkStack({
|
|
5131
|
+
const stackOptions = {
|
|
5036
5132
|
...sdkOptions,
|
|
5037
5133
|
eventEmission: { ...sdkOptions.eventEmission, callContext: "cli" },
|
|
5038
5134
|
callerPackage: { name: package_default.name, version: package_default.version },
|
|
@@ -5040,15 +5136,17 @@ function createZapierCliSdk(options = {}) {
|
|
|
5040
5136
|
// box is additive: the SDK's own inline warn still fires, so the notice
|
|
5041
5137
|
// cannot be hidden by any rendering path.
|
|
5042
5138
|
onEvent: (event) => collectDeprecationNoticeAndForward(event, sdkOptions.onEvent)
|
|
5043
|
-
}
|
|
5044
|
-
const sdk = createSdk(
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5139
|
+
};
|
|
5140
|
+
const sdk = createSdk(cliSdkPlugin, {
|
|
5141
|
+
configuration: {
|
|
5142
|
+
[SDK_OPTIONS_ID]: stackOptions,
|
|
5143
|
+
[CORE_OPTIONS_ID]: cliCoreOptions,
|
|
5144
|
+
// Resolved extensions, forwarded to `mcp` (imported by ref there) so
|
|
5145
|
+
// the MCP server's SDK matches the CLI surface.
|
|
5146
|
+
[CLI_EXTENSIONS_ID]: extensions
|
|
5147
|
+
}
|
|
5148
|
+
});
|
|
5149
|
+
addPlugin(sdk, cliFetchOverride);
|
|
5052
5150
|
for (const ext of extensions) {
|
|
5053
5151
|
try {
|
|
5054
5152
|
addPlugin(sdk, ext);
|
|
@@ -5063,7 +5161,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
5063
5161
|
|
|
5064
5162
|
// package.json
|
|
5065
5163
|
var package_default2 = {
|
|
5066
|
-
version: "0.
|
|
5164
|
+
version: "0.65.0"};
|
|
5067
5165
|
|
|
5068
5166
|
// src/telemetry/builders.ts
|
|
5069
5167
|
function createCliBaseEvent(context = {}) {
|