@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/experimental.mjs
CHANGED
|
@@ -7,9 +7,9 @@ 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, DEPRECATION_NOTICE_EVENT } from '@zapier/zapier-sdk';
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
-
import { injectCliLogin,
|
|
12
|
+
import { triggerInboxResolver, DrainTriggerInboxSchema, WatchTriggerInboxSchema, injectCliLogin as injectCliLogin$1, definePlugin as definePlugin$1, omitExports as omitExports$1, zapierExperimentalSdkPlugin, createSdk, CORE_OPTIONS_ID, SDK_OPTIONS_ID, addPlugin } from '@zapier/zapier-sdk/experimental';
|
|
13
13
|
import { hostname } from 'os';
|
|
14
14
|
import inquirer from 'inquirer';
|
|
15
15
|
import express from 'express';
|
|
@@ -2039,7 +2039,7 @@ function promptlessLegacyJwtUpgradeError() {
|
|
|
2039
2039
|
);
|
|
2040
2040
|
}
|
|
2041
2041
|
async function clearExistingAuthState({
|
|
2042
|
-
|
|
2042
|
+
imports,
|
|
2043
2043
|
baseUrl,
|
|
2044
2044
|
interactive,
|
|
2045
2045
|
entryPoint
|
|
@@ -2060,7 +2060,7 @@ Log out and ${getActiveCredentialsAction(entryPoint)}?`
|
|
|
2060
2060
|
}
|
|
2061
2061
|
try {
|
|
2062
2062
|
await revokeCredentials({
|
|
2063
|
-
api:
|
|
2063
|
+
api: imports.api,
|
|
2064
2064
|
credentials: activeCredentials
|
|
2065
2065
|
});
|
|
2066
2066
|
} catch {
|
|
@@ -2125,13 +2125,13 @@ async function saveClientCredentials({
|
|
|
2125
2125
|
return { clientId };
|
|
2126
2126
|
}
|
|
2127
2127
|
function emitAccountAuthSuccess({
|
|
2128
|
-
|
|
2128
|
+
imports,
|
|
2129
2129
|
profile,
|
|
2130
2130
|
clientId,
|
|
2131
2131
|
isNonInteractive,
|
|
2132
2132
|
isHeadless
|
|
2133
2133
|
}) {
|
|
2134
|
-
|
|
2134
|
+
imports.eventEmission.emit(
|
|
2135
2135
|
"platform.sdk.ApplicationLifecycleEvent",
|
|
2136
2136
|
buildApplicationLifecycleEvent(
|
|
2137
2137
|
{
|
|
@@ -2150,11 +2150,11 @@ function emitAccountAuthSuccess({
|
|
|
2150
2150
|
);
|
|
2151
2151
|
}
|
|
2152
2152
|
function emitSignupSuccess({
|
|
2153
|
-
|
|
2153
|
+
imports,
|
|
2154
2154
|
isNonInteractive,
|
|
2155
2155
|
isHeadless
|
|
2156
2156
|
}) {
|
|
2157
|
-
|
|
2157
|
+
imports.eventEmission.emit(
|
|
2158
2158
|
"platform.sdk.ApplicationLifecycleEvent",
|
|
2159
2159
|
buildApplicationLifecycleEvent({
|
|
2160
2160
|
lifecycle_event_type: "signup_success",
|
|
@@ -2173,7 +2173,7 @@ async function runOauthWithRedaction(runOauth) {
|
|
|
2173
2173
|
}
|
|
2174
2174
|
}
|
|
2175
2175
|
async function runOauthForEntryPoint({
|
|
2176
|
-
|
|
2176
|
+
imports,
|
|
2177
2177
|
entryPoint,
|
|
2178
2178
|
timeoutMs,
|
|
2179
2179
|
pkceCredentials,
|
|
@@ -2193,7 +2193,7 @@ async function runOauthForEntryPoint({
|
|
|
2193
2193
|
onProgress: (event) => {
|
|
2194
2194
|
if (event.type === "callback_accepted") {
|
|
2195
2195
|
emitSignupSuccess({
|
|
2196
|
-
|
|
2196
|
+
imports,
|
|
2197
2197
|
isNonInteractive: false,
|
|
2198
2198
|
isHeadless: headless === true
|
|
2199
2199
|
});
|
|
@@ -2214,7 +2214,7 @@ async function runOauthForEntryPoint({
|
|
|
2214
2214
|
);
|
|
2215
2215
|
}
|
|
2216
2216
|
async function provisionAccountCredentials({
|
|
2217
|
-
|
|
2217
|
+
imports,
|
|
2218
2218
|
entryPoint,
|
|
2219
2219
|
accessToken,
|
|
2220
2220
|
credentialsBaseUrl,
|
|
@@ -2227,7 +2227,7 @@ async function provisionAccountCredentials({
|
|
|
2227
2227
|
const scopedApi = getOrCreateApiClient({
|
|
2228
2228
|
credentials: accessToken,
|
|
2229
2229
|
baseUrl: credentialsBaseUrl,
|
|
2230
|
-
callerPackage:
|
|
2230
|
+
callerPackage: imports.sdkOptions?.callerPackage
|
|
2231
2231
|
});
|
|
2232
2232
|
const profile = await getProfile(scopedApi);
|
|
2233
2233
|
process.stderr.write(`${getProfileMessage(entryPoint, profile.email)}
|
|
@@ -2256,7 +2256,7 @@ async function provisionAccountCredentials({
|
|
|
2256
2256
|
process.stderr.write("\u{1F510} Approvals are enabled for these credentials.\n");
|
|
2257
2257
|
}
|
|
2258
2258
|
emitAccountAuthSuccess({
|
|
2259
|
-
|
|
2259
|
+
imports,
|
|
2260
2260
|
profile,
|
|
2261
2261
|
clientId,
|
|
2262
2262
|
isNonInteractive,
|
|
@@ -2264,7 +2264,7 @@ async function provisionAccountCredentials({
|
|
|
2264
2264
|
});
|
|
2265
2265
|
}
|
|
2266
2266
|
async function runAccountAuth({
|
|
2267
|
-
|
|
2267
|
+
imports,
|
|
2268
2268
|
options,
|
|
2269
2269
|
entryPoint
|
|
2270
2270
|
}) {
|
|
@@ -2296,7 +2296,7 @@ async function runAccountAuth({
|
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
2298
|
if (!await clearExistingAuthState({
|
|
2299
|
-
|
|
2299
|
+
imports,
|
|
2300
2300
|
baseUrl: pending.credentialsBaseUrl,
|
|
2301
2301
|
interactive: false,
|
|
2302
2302
|
entryPoint
|
|
@@ -2310,7 +2310,7 @@ async function runAccountAuth({
|
|
|
2310
2310
|
onProgress: (event) => {
|
|
2311
2311
|
if (entryPoint === "signup" && event.type === "callback_accepted") {
|
|
2312
2312
|
emitSignupSuccess({
|
|
2313
|
-
|
|
2313
|
+
imports,
|
|
2314
2314
|
isNonInteractive: true,
|
|
2315
2315
|
isHeadless: pending.headless
|
|
2316
2316
|
});
|
|
@@ -2319,7 +2319,7 @@ async function runAccountAuth({
|
|
|
2319
2319
|
});
|
|
2320
2320
|
});
|
|
2321
2321
|
await provisionAccountCredentials({
|
|
2322
|
-
|
|
2322
|
+
imports,
|
|
2323
2323
|
entryPoint,
|
|
2324
2324
|
accessToken: accessToken2,
|
|
2325
2325
|
credentialsBaseUrl: pending.credentialsBaseUrl,
|
|
@@ -2333,11 +2333,11 @@ async function runAccountAuth({
|
|
|
2333
2333
|
}
|
|
2334
2334
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
2335
2335
|
const interactive = !resolveNonInteractive(options);
|
|
2336
|
-
const resolvedCredentials = await
|
|
2336
|
+
const resolvedCredentials = await imports.resolveCredentials();
|
|
2337
2337
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
2338
2338
|
const headless = options.headless === true;
|
|
2339
2339
|
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
2340
|
-
|
|
2340
|
+
options: imports.sdkOptions,
|
|
2341
2341
|
resolvedCredentials
|
|
2342
2342
|
});
|
|
2343
2343
|
const providedName = options.name !== void 0 ? validateCredentialsName(options.name) : void 0;
|
|
@@ -2352,7 +2352,7 @@ async function runAccountAuth({
|
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
2354
|
if (!await clearExistingAuthState({
|
|
2355
|
-
|
|
2355
|
+
imports,
|
|
2356
2356
|
baseUrl: credentialsBaseUrl,
|
|
2357
2357
|
interactive,
|
|
2358
2358
|
entryPoint
|
|
@@ -2373,7 +2373,7 @@ async function runAccountAuth({
|
|
|
2373
2373
|
return;
|
|
2374
2374
|
}
|
|
2375
2375
|
const { accessToken } = await runOauthForEntryPoint({
|
|
2376
|
-
|
|
2376
|
+
imports,
|
|
2377
2377
|
entryPoint,
|
|
2378
2378
|
timeoutMs: timeoutSeconds * 1e3,
|
|
2379
2379
|
pkceCredentials,
|
|
@@ -2382,7 +2382,7 @@ async function runAccountAuth({
|
|
|
2382
2382
|
interactive
|
|
2383
2383
|
});
|
|
2384
2384
|
await provisionAccountCredentials({
|
|
2385
|
-
|
|
2385
|
+
imports,
|
|
2386
2386
|
entryPoint,
|
|
2387
2387
|
accessToken,
|
|
2388
2388
|
credentialsBaseUrl,
|
|
@@ -2427,17 +2427,26 @@ var LoginSchema = z.object({
|
|
|
2427
2427
|
});
|
|
2428
2428
|
|
|
2429
2429
|
// src/plugins/login/index.ts
|
|
2430
|
-
var loginPlugin =
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2430
|
+
var loginPlugin = defineMethod({
|
|
2431
|
+
name: "login",
|
|
2432
|
+
imports: [
|
|
2433
|
+
apiPluginRef,
|
|
2434
|
+
resolveCredentialsPluginRef,
|
|
2435
|
+
eventEmissionPluginRef,
|
|
2436
|
+
sdkOptionsPluginRef
|
|
2437
|
+
],
|
|
2438
|
+
output: "raw",
|
|
2439
|
+
inputSchema: LoginSchema,
|
|
2440
|
+
categories: ["account"],
|
|
2441
|
+
supportsJsonOutput: false,
|
|
2442
|
+
run: async ({ imports, input }) => {
|
|
2443
|
+
await runAccountAuth({
|
|
2444
|
+
imports,
|
|
2445
|
+
options: input,
|
|
2446
|
+
entryPoint: "login"
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
});
|
|
2441
2450
|
var SignupSchema = z.object({
|
|
2442
2451
|
timeout: z.string().optional().describe("Signup timeout in seconds (default: 300)"),
|
|
2443
2452
|
useApprovals: z.boolean().optional().describe(
|
|
@@ -2469,68 +2478,92 @@ var SignupSchema = z.object({
|
|
|
2469
2478
|
});
|
|
2470
2479
|
|
|
2471
2480
|
// src/plugins/signup/index.ts
|
|
2472
|
-
var signupPlugin =
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2481
|
+
var signupPlugin = defineMethod({
|
|
2482
|
+
name: "signup",
|
|
2483
|
+
imports: [
|
|
2484
|
+
apiPluginRef,
|
|
2485
|
+
resolveCredentialsPluginRef,
|
|
2486
|
+
eventEmissionPluginRef,
|
|
2487
|
+
sdkOptionsPluginRef
|
|
2488
|
+
],
|
|
2489
|
+
output: "raw",
|
|
2490
|
+
inputSchema: SignupSchema,
|
|
2491
|
+
categories: ["account"],
|
|
2492
|
+
supportsJsonOutput: false,
|
|
2493
|
+
run: async ({ imports, input }) => {
|
|
2494
|
+
await runAccountAuth({
|
|
2495
|
+
imports,
|
|
2496
|
+
options: input,
|
|
2497
|
+
entryPoint: "signup"
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
});
|
|
2483
2501
|
var LogoutSchema = z.object({}).describe("Log out of your Zapier account");
|
|
2484
2502
|
|
|
2485
2503
|
// src/plugins/logout/index.ts
|
|
2486
|
-
var logoutPlugin =
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
await
|
|
2504
|
-
api: sdk2.context.api,
|
|
2505
|
-
credentials: activeCredentials,
|
|
2506
|
-
onEvent,
|
|
2507
|
-
alwaysClearLocalState: true
|
|
2508
|
-
});
|
|
2504
|
+
var logoutPlugin = defineMethod({
|
|
2505
|
+
name: "logout",
|
|
2506
|
+
imports: [apiPluginRef, resolveCredentialsPluginRef, sdkOptionsPluginRef],
|
|
2507
|
+
output: "raw",
|
|
2508
|
+
inputSchema: LogoutSchema,
|
|
2509
|
+
categories: ["account"],
|
|
2510
|
+
supportsJsonOutput: false,
|
|
2511
|
+
run: async ({ imports }) => {
|
|
2512
|
+
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
2513
|
+
resolveCredentials: imports.resolveCredentials,
|
|
2514
|
+
options: imports.sdkOptions
|
|
2515
|
+
});
|
|
2516
|
+
const activeCredentials = getActiveCredentials({
|
|
2517
|
+
baseUrl: credentialsBaseUrl
|
|
2518
|
+
});
|
|
2519
|
+
const onEvent = imports.sdkOptions?.onEvent;
|
|
2520
|
+
if (!activeCredentials) {
|
|
2521
|
+
await logout({ onEvent });
|
|
2509
2522
|
console.log("\u2705 Successfully logged out");
|
|
2523
|
+
return;
|
|
2510
2524
|
}
|
|
2511
|
-
|
|
2512
|
-
|
|
2525
|
+
await revokeCredentials({
|
|
2526
|
+
api: imports.api,
|
|
2527
|
+
credentials: activeCredentials,
|
|
2528
|
+
onEvent,
|
|
2529
|
+
alwaysClearLocalState: true
|
|
2530
|
+
});
|
|
2531
|
+
console.log("\u2705 Successfully logged out");
|
|
2532
|
+
}
|
|
2533
|
+
});
|
|
2534
|
+
var CLI_EXTENSIONS_ID = "cli/extensions";
|
|
2535
|
+
var cliExtensionsPluginRef = declareOptionalProperty({
|
|
2536
|
+
id: CLI_EXTENSIONS_ID
|
|
2537
|
+
});
|
|
2538
|
+
var CLI_EXPERIMENTAL_ID = "cli/experimental";
|
|
2539
|
+
var cliExperimentalPluginRef = declareOptionalProperty({
|
|
2540
|
+
id: CLI_EXPERIMENTAL_ID
|
|
2541
|
+
});
|
|
2513
2542
|
var McpSchema = z.object({
|
|
2514
2543
|
port: z.string().optional().describe("Port to listen on (for future HTTP transport)")
|
|
2515
2544
|
}).describe("Start MCP server for Zapier SDK");
|
|
2516
2545
|
|
|
2517
2546
|
// src/plugins/mcp/index.ts
|
|
2518
|
-
var mcpPlugin =
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2547
|
+
var mcpPlugin = defineMethod({
|
|
2548
|
+
name: "mcp",
|
|
2549
|
+
imports: [
|
|
2550
|
+
sdkOptionsPluginRef,
|
|
2551
|
+
cliExtensionsPluginRef,
|
|
2552
|
+
cliExperimentalPluginRef
|
|
2553
|
+
],
|
|
2554
|
+
output: "raw",
|
|
2555
|
+
inputSchema: McpSchema,
|
|
2556
|
+
categories: ["utility"],
|
|
2557
|
+
run: async ({ imports, input }) => {
|
|
2558
|
+
await startMcpServer({
|
|
2559
|
+
...input,
|
|
2560
|
+
debug: imports.sdkOptions?.debug,
|
|
2561
|
+
maxConcurrentRequests: imports.sdkOptions?.maxConcurrentRequests,
|
|
2562
|
+
extensions: imports.extensions,
|
|
2563
|
+
experimental: imports.experimental
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2534
2567
|
var BundleCodeSchema = z.object({
|
|
2535
2568
|
input: z.string().min(1).describe("Input TypeScript file path to bundle"),
|
|
2536
2569
|
output: OutputPropertySchema.optional().describe(
|
|
@@ -2541,15 +2574,16 @@ var BundleCodeSchema = z.object({
|
|
|
2541
2574
|
target: z.string().optional().describe("ECMAScript target version"),
|
|
2542
2575
|
cjs: z.boolean().optional().describe("Output CommonJS format instead of ESM")
|
|
2543
2576
|
}).describe("Bundle TypeScript code into executable JavaScript");
|
|
2544
|
-
var bundleCodePlugin =
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
)
|
|
2577
|
+
var bundleCodePlugin = defineMethod({
|
|
2578
|
+
name: "bundleCode",
|
|
2579
|
+
categories: ["utility"],
|
|
2580
|
+
deprecation: { message: "bundleCode is no longer maintained." },
|
|
2581
|
+
inputSchema: BundleCodeSchema,
|
|
2582
|
+
// Returns the bundled code string verbatim — no `{ data }` envelope,
|
|
2583
|
+
// matching legacy.
|
|
2584
|
+
output: "raw",
|
|
2585
|
+
run: async ({ input }) => bundleCode(input)
|
|
2586
|
+
});
|
|
2553
2587
|
async function bundleCode(options) {
|
|
2554
2588
|
const {
|
|
2555
2589
|
input,
|
|
@@ -2606,14 +2640,16 @@ async function bundleCode(options) {
|
|
|
2606
2640
|
}
|
|
2607
2641
|
}
|
|
2608
2642
|
var GetLoginConfigPathSchema = z.object({}).describe("Show the path to the login configuration file");
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2643
|
+
|
|
2644
|
+
// src/plugins/getLoginConfigPath/index.ts
|
|
2645
|
+
var getLoginConfigPathPlugin = defineMethod({
|
|
2646
|
+
name: "getLoginConfigPath",
|
|
2647
|
+
categories: ["utility"],
|
|
2648
|
+
inputSchema: GetLoginConfigPathSchema,
|
|
2649
|
+
// Returns the path string verbatim — no `{ data }` envelope, matching legacy.
|
|
2650
|
+
output: "raw",
|
|
2651
|
+
run: async () => getConfigPath()
|
|
2652
|
+
});
|
|
2617
2653
|
var AddSchema = z.object({
|
|
2618
2654
|
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
2619
2655
|
"One or more app keys to add (e.g., 'slack', 'github', 'trello')"
|
|
@@ -2641,105 +2677,107 @@ async function detectTypesOutputDirectory() {
|
|
|
2641
2677
|
}
|
|
2642
2678
|
return "./zapier/apps/";
|
|
2643
2679
|
}
|
|
2644
|
-
var
|
|
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
|
-
|
|
2690
|
-
switch (event.type) {
|
|
2691
|
-
case "connections_lookup_start":
|
|
2692
|
-
console.log(`\u{1F510} Looking up ${event.count} connection(s)...`);
|
|
2693
|
-
break;
|
|
2694
|
-
case "connections_lookup_complete":
|
|
2695
|
-
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
2696
|
-
break;
|
|
2697
|
-
case "connection_matched":
|
|
2698
|
-
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2699
|
-
console.log(
|
|
2700
|
-
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
2701
|
-
);
|
|
2702
|
-
break;
|
|
2703
|
-
case "connection_not_matched":
|
|
2704
|
-
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2705
|
-
console.warn(
|
|
2706
|
-
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
2707
|
-
);
|
|
2708
|
-
break;
|
|
2709
|
-
case "file_written":
|
|
2710
|
-
console.log(
|
|
2711
|
-
`\u{1F527} Generated types for ${event.manifestKey} at ${event.filePath}`
|
|
2712
|
-
);
|
|
2713
|
-
break;
|
|
2714
|
-
case "app_processing_error":
|
|
2715
|
-
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2716
|
-
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2717
|
-
break;
|
|
2718
|
-
}
|
|
2719
|
-
};
|
|
2720
|
-
const manifestResult = await sdk2.buildManifest({
|
|
2721
|
-
apps: appKeys,
|
|
2722
|
-
skipWrite: false,
|
|
2723
|
-
configPath,
|
|
2724
|
-
onProgress: handleManifestProgress
|
|
2725
|
-
});
|
|
2726
|
-
const typesResult = await sdk2.generateAppTypes({
|
|
2727
|
-
apps: appKeys,
|
|
2728
|
-
connections: connectionIds,
|
|
2729
|
-
skipWrite: false,
|
|
2730
|
-
typesOutputDirectory: resolvedTypesOutput,
|
|
2731
|
-
onProgress: handleTypesProgress
|
|
2732
|
-
});
|
|
2733
|
-
const results = manifestResult.manifest?.apps || {};
|
|
2734
|
-
const successfulApps = Object.keys(results).filter(
|
|
2735
|
-
(manifestKey) => typesResult.writtenFiles?.[manifestKey]
|
|
2736
|
-
);
|
|
2737
|
-
if (successfulApps.length > 0) {
|
|
2738
|
-
console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
|
|
2680
|
+
var buildManifestRef = declareMethod({ id: "buildManifest" });
|
|
2681
|
+
var generateAppTypesRef = declareMethod({ id: "generateAppTypes" });
|
|
2682
|
+
var addAppsPlugin = defineMethod({
|
|
2683
|
+
name: "add",
|
|
2684
|
+
imports: [buildManifestRef, generateAppTypesRef],
|
|
2685
|
+
output: "raw",
|
|
2686
|
+
categories: ["utility"],
|
|
2687
|
+
inputSchema: AddSchema,
|
|
2688
|
+
run: async ({ imports, input }) => {
|
|
2689
|
+
const {
|
|
2690
|
+
apps: appKeys,
|
|
2691
|
+
connections: connectionIds,
|
|
2692
|
+
configPath,
|
|
2693
|
+
typesOutput = await detectTypesOutputDirectory()
|
|
2694
|
+
} = input;
|
|
2695
|
+
const resolvedTypesOutput = resolve(typesOutput);
|
|
2696
|
+
console.log(`\u{1F4E6} Adding ${appKeys.length} app(s)...`);
|
|
2697
|
+
const appSlugAndKeyMap = /* @__PURE__ */ new Map();
|
|
2698
|
+
const handleManifestProgress = (event) => {
|
|
2699
|
+
switch (event.type) {
|
|
2700
|
+
case "apps_lookup_start":
|
|
2701
|
+
console.log(`\u{1F4E6} Looking up ${event.count} app(s)...`);
|
|
2702
|
+
break;
|
|
2703
|
+
case "app_found":
|
|
2704
|
+
const displayName = event.app.slug ? `${event.app.slug} (${event.app.key})` : event.app.key;
|
|
2705
|
+
appSlugAndKeyMap.set(event.app.key, displayName);
|
|
2706
|
+
break;
|
|
2707
|
+
case "apps_lookup_complete":
|
|
2708
|
+
if (event.count === 0) {
|
|
2709
|
+
console.warn("\u26A0\uFE0F No apps found");
|
|
2710
|
+
}
|
|
2711
|
+
break;
|
|
2712
|
+
case "app_processing_start":
|
|
2713
|
+
const appName = event.slug ? `${event.slug} (${event.app})` : event.app;
|
|
2714
|
+
console.log(`\u{1F4E6} Adding ${appName}...`);
|
|
2715
|
+
break;
|
|
2716
|
+
case "manifest_updated":
|
|
2717
|
+
const appDisplay = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2718
|
+
console.log(
|
|
2719
|
+
`\u{1F4DD} Locked ${appDisplay} to ${event.app}@${event.version} using key '${event.manifestKey}'`
|
|
2720
|
+
);
|
|
2721
|
+
break;
|
|
2722
|
+
case "app_processing_error":
|
|
2723
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2724
|
+
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2725
|
+
break;
|
|
2739
2726
|
}
|
|
2727
|
+
};
|
|
2728
|
+
const handleTypesProgress = (event) => {
|
|
2729
|
+
switch (event.type) {
|
|
2730
|
+
case "connections_lookup_start":
|
|
2731
|
+
console.log(`\u{1F510} Looking up ${event.count} connection(s)...`);
|
|
2732
|
+
break;
|
|
2733
|
+
case "connections_lookup_complete":
|
|
2734
|
+
console.log(`\u{1F510} Found ${event.count} connection(s)`);
|
|
2735
|
+
break;
|
|
2736
|
+
case "connection_matched":
|
|
2737
|
+
const appWithConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2738
|
+
console.log(
|
|
2739
|
+
`\u{1F510} Using connection ${event.connectionId} (${event.connectionTitle}) for ${appWithConnection}`
|
|
2740
|
+
);
|
|
2741
|
+
break;
|
|
2742
|
+
case "connection_not_matched":
|
|
2743
|
+
const appWithoutConnection = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2744
|
+
console.warn(
|
|
2745
|
+
`\u26A0\uFE0F No matching connection found for ${appWithoutConnection}`
|
|
2746
|
+
);
|
|
2747
|
+
break;
|
|
2748
|
+
case "file_written":
|
|
2749
|
+
console.log(
|
|
2750
|
+
`\u{1F527} Generated types for ${event.manifestKey} at ${event.filePath}`
|
|
2751
|
+
);
|
|
2752
|
+
break;
|
|
2753
|
+
case "app_processing_error":
|
|
2754
|
+
const errorApp = appSlugAndKeyMap.get(event.app) || event.app;
|
|
2755
|
+
console.warn(`\u26A0\uFE0F ${event.error} for ${errorApp}`);
|
|
2756
|
+
break;
|
|
2757
|
+
}
|
|
2758
|
+
};
|
|
2759
|
+
const manifestResult = await imports.buildManifest({
|
|
2760
|
+
apps: appKeys,
|
|
2761
|
+
skipWrite: false,
|
|
2762
|
+
configPath,
|
|
2763
|
+
onProgress: handleManifestProgress
|
|
2764
|
+
});
|
|
2765
|
+
const typesResult = await imports.generateAppTypes({
|
|
2766
|
+
apps: appKeys,
|
|
2767
|
+
connections: connectionIds,
|
|
2768
|
+
skipWrite: false,
|
|
2769
|
+
typesOutputDirectory: resolvedTypesOutput,
|
|
2770
|
+
onProgress: handleTypesProgress
|
|
2771
|
+
});
|
|
2772
|
+
const results = manifestResult.manifest?.apps || {};
|
|
2773
|
+
const successfulApps = Object.keys(results).filter(
|
|
2774
|
+
(manifestKey) => typesResult.writtenFiles?.[manifestKey]
|
|
2775
|
+
);
|
|
2776
|
+
if (successfulApps.length > 0) {
|
|
2777
|
+
console.log(`\u2705 Added ${successfulApps.length} app(s) to manifest`);
|
|
2740
2778
|
}
|
|
2741
|
-
}
|
|
2742
|
-
);
|
|
2779
|
+
}
|
|
2780
|
+
});
|
|
2743
2781
|
var GenerateAppTypesSchema = z.object({
|
|
2744
2782
|
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
2745
2783
|
"One or more app keys to generate types for (e.g., 'slack', 'github', 'trello')"
|
|
@@ -2757,26 +2795,28 @@ var GenerateAppTypesSchema = z.object({
|
|
|
2757
2795
|
"Generate TypeScript type definitions for apps - can optionally write to disk or just return type strings"
|
|
2758
2796
|
);
|
|
2759
2797
|
var AstTypeGenerator = class {
|
|
2760
|
-
constructor() {
|
|
2798
|
+
constructor(options) {
|
|
2761
2799
|
this.factory = ts.factory;
|
|
2762
2800
|
this.printer = ts.createPrinter({
|
|
2763
2801
|
newLine: ts.NewLineKind.LineFeed,
|
|
2764
2802
|
removeComments: false,
|
|
2765
2803
|
omitTrailingSemicolon: false
|
|
2766
2804
|
});
|
|
2805
|
+
this.listActions = options.listActions;
|
|
2806
|
+
this.listActionInputFields = options.listActionInputFields;
|
|
2767
2807
|
}
|
|
2768
2808
|
/**
|
|
2769
2809
|
* Generate TypeScript types using AST for a specific app
|
|
2770
2810
|
*/
|
|
2771
2811
|
async generateTypes(options) {
|
|
2772
|
-
const { app, connectionId
|
|
2773
|
-
const actionsResult = await
|
|
2812
|
+
const { app, connectionId } = options;
|
|
2813
|
+
const actionsResult = await this.listActions({
|
|
2774
2814
|
appKey: app.implementation_id
|
|
2775
2815
|
});
|
|
2776
2816
|
const actions = actionsResult.data;
|
|
2777
2817
|
const actionsWithFields = [];
|
|
2778
2818
|
const inputFieldsTasks = actions.map(
|
|
2779
|
-
(action) => () =>
|
|
2819
|
+
(action) => () => this.listActionInputFields({
|
|
2780
2820
|
appKey: app.implementation_id,
|
|
2781
2821
|
actionKey: action.key,
|
|
2782
2822
|
actionType: action.action_type,
|
|
@@ -3346,133 +3386,147 @@ function createManifestEntry(app) {
|
|
|
3346
3386
|
version: app.version
|
|
3347
3387
|
};
|
|
3348
3388
|
}
|
|
3349
|
-
var
|
|
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
|
-
|
|
3396
|
-
|
|
3389
|
+
var listAppsRef = declareMethod({ id: "listApps" });
|
|
3390
|
+
var listConnectionsRef = declareMethod({ id: "listConnections" });
|
|
3391
|
+
var listActionsRef = declareMethod({ id: "listActions" });
|
|
3392
|
+
var listActionInputFieldsRef = declareMethod({ id: "listActionInputFields" });
|
|
3393
|
+
var generateAppTypesPlugin = defineMethod({
|
|
3394
|
+
name: "generateAppTypes",
|
|
3395
|
+
imports: [
|
|
3396
|
+
listAppsRef,
|
|
3397
|
+
listConnectionsRef,
|
|
3398
|
+
listActionsRef,
|
|
3399
|
+
listActionInputFieldsRef
|
|
3400
|
+
],
|
|
3401
|
+
output: "raw",
|
|
3402
|
+
categories: ["utility"],
|
|
3403
|
+
// Cast: schema validates JSON fields only; GenerateAppTypesOptions adds the
|
|
3404
|
+
// runtime-only `onProgress` callback, widening the input type for `run`.
|
|
3405
|
+
inputSchema: GenerateAppTypesSchema,
|
|
3406
|
+
// The schema stays for projection (CLI flags / docs); the runtime parse is
|
|
3407
|
+
// skipped because it would strip the runtime-only `onProgress` callback.
|
|
3408
|
+
skipInputValidation: true,
|
|
3409
|
+
run: async ({ imports, input }) => {
|
|
3410
|
+
const {
|
|
3411
|
+
apps: appKeys,
|
|
3412
|
+
connections: connectionIds,
|
|
3413
|
+
skipWrite = false,
|
|
3414
|
+
typesOutputDirectory = await detectTypesOutputDirectory(),
|
|
3415
|
+
onProgress
|
|
3416
|
+
} = input;
|
|
3417
|
+
const resolvedTypesOutput = resolve(typesOutputDirectory);
|
|
3418
|
+
const result = { typeDefinitions: {} };
|
|
3419
|
+
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
3420
|
+
const appsIterable = imports.listApps({ apps: appKeys }).items();
|
|
3421
|
+
const apps = [];
|
|
3422
|
+
for await (const app of appsIterable) {
|
|
3423
|
+
apps.push(app);
|
|
3424
|
+
onProgress?.({ type: "app_found", app });
|
|
3425
|
+
}
|
|
3426
|
+
onProgress?.({ type: "apps_lookup_complete", count: apps.length });
|
|
3427
|
+
if (apps.length === 0) {
|
|
3428
|
+
return result;
|
|
3429
|
+
}
|
|
3430
|
+
const connections = [];
|
|
3431
|
+
if (connectionIds && connectionIds.length > 0) {
|
|
3432
|
+
onProgress?.({
|
|
3433
|
+
type: "connections_lookup_start",
|
|
3434
|
+
count: connectionIds.length
|
|
3435
|
+
});
|
|
3436
|
+
const connectionsIterable = imports.listConnections({ connections: connectionIds }).items();
|
|
3437
|
+
for await (const connection of connectionsIterable) {
|
|
3438
|
+
connections.push(connection);
|
|
3397
3439
|
}
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
}
|
|
3419
|
-
let connectionId;
|
|
3420
|
-
if (connections.length > 0) {
|
|
3421
|
-
const matchingConnection = connections.find(
|
|
3422
|
-
(conn) => conn.app_key === app.key
|
|
3423
|
-
);
|
|
3424
|
-
if (matchingConnection) {
|
|
3425
|
-
connectionId = matchingConnection.id;
|
|
3426
|
-
onProgress?.({
|
|
3427
|
-
type: "connection_matched",
|
|
3428
|
-
app: app.key,
|
|
3429
|
-
connectionId: matchingConnection.id,
|
|
3430
|
-
connectionTitle: matchingConnection.title || ""
|
|
3431
|
-
});
|
|
3432
|
-
} else {
|
|
3433
|
-
onProgress?.({
|
|
3434
|
-
type: "connection_not_matched",
|
|
3435
|
-
app: app.key
|
|
3436
|
-
});
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
const manifestKey = getManifestKey(app);
|
|
3440
|
-
const generator = new AstTypeGenerator();
|
|
3441
|
-
const typeDefinitionString = await generator.generateTypes({
|
|
3442
|
-
app,
|
|
3443
|
-
connectionId,
|
|
3444
|
-
sdk: sdk2
|
|
3445
|
-
});
|
|
3446
|
-
result.typeDefinitions[manifestKey] = typeDefinitionString;
|
|
3447
|
-
onProgress?.({
|
|
3448
|
-
type: "type_generated",
|
|
3449
|
-
manifestKey,
|
|
3450
|
-
sizeBytes: typeDefinitionString.length
|
|
3451
|
-
});
|
|
3452
|
-
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
3453
|
-
const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
3454
|
-
await writeFile(filePath, typeDefinitionString, "utf8");
|
|
3455
|
-
result.writtenFiles[manifestKey] = filePath;
|
|
3456
|
-
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
3457
|
-
}
|
|
3458
|
-
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3459
|
-
} catch (error) {
|
|
3460
|
-
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3440
|
+
onProgress?.({
|
|
3441
|
+
type: "connections_lookup_complete",
|
|
3442
|
+
count: connections.length
|
|
3443
|
+
});
|
|
3444
|
+
}
|
|
3445
|
+
if (!skipWrite && resolvedTypesOutput) {
|
|
3446
|
+
await mkdir(resolvedTypesOutput, { recursive: true });
|
|
3447
|
+
}
|
|
3448
|
+
if (!skipWrite) {
|
|
3449
|
+
result.writtenFiles = {};
|
|
3450
|
+
}
|
|
3451
|
+
for (const app of apps) {
|
|
3452
|
+
onProgress?.({
|
|
3453
|
+
type: "app_processing_start",
|
|
3454
|
+
app: app.key,
|
|
3455
|
+
slug: app.slug
|
|
3456
|
+
});
|
|
3457
|
+
try {
|
|
3458
|
+
if (!app.version) {
|
|
3459
|
+
const errorMessage = `Invalid implementation ID format: ${app.implementation_id}. Expected format: <implementationName>@<version>`;
|
|
3461
3460
|
onProgress?.({
|
|
3462
3461
|
type: "app_processing_error",
|
|
3463
3462
|
app: app.key,
|
|
3464
3463
|
error: errorMessage
|
|
3465
3464
|
});
|
|
3466
|
-
|
|
3467
|
-
|
|
3465
|
+
throw new ZapierValidationError(errorMessage, {
|
|
3466
|
+
details: {
|
|
3467
|
+
appKey: app.key,
|
|
3468
|
+
implementationId: app.implementation_id
|
|
3469
|
+
}
|
|
3470
|
+
});
|
|
3471
|
+
}
|
|
3472
|
+
let connectionId;
|
|
3473
|
+
if (connections.length > 0) {
|
|
3474
|
+
const matchingConnection = connections.find(
|
|
3475
|
+
(conn) => conn.app_key === app.key
|
|
3476
|
+
);
|
|
3477
|
+
if (matchingConnection) {
|
|
3478
|
+
connectionId = matchingConnection.id;
|
|
3479
|
+
onProgress?.({
|
|
3480
|
+
type: "connection_matched",
|
|
3481
|
+
app: app.key,
|
|
3482
|
+
connectionId: matchingConnection.id,
|
|
3483
|
+
connectionTitle: matchingConnection.title || ""
|
|
3484
|
+
});
|
|
3485
|
+
} else {
|
|
3486
|
+
onProgress?.({
|
|
3487
|
+
type: "connection_not_matched",
|
|
3488
|
+
app: app.key
|
|
3489
|
+
});
|
|
3468
3490
|
}
|
|
3469
|
-
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3470
3491
|
}
|
|
3492
|
+
const manifestKey = getManifestKey(app);
|
|
3493
|
+
const generator = new AstTypeGenerator({
|
|
3494
|
+
listActions: imports.listActions,
|
|
3495
|
+
listActionInputFields: imports.listActionInputFields
|
|
3496
|
+
});
|
|
3497
|
+
const typeDefinitionString = await generator.generateTypes({
|
|
3498
|
+
app,
|
|
3499
|
+
connectionId
|
|
3500
|
+
});
|
|
3501
|
+
result.typeDefinitions[manifestKey] = typeDefinitionString;
|
|
3502
|
+
onProgress?.({
|
|
3503
|
+
type: "type_generated",
|
|
3504
|
+
manifestKey,
|
|
3505
|
+
sizeBytes: typeDefinitionString.length
|
|
3506
|
+
});
|
|
3507
|
+
if (!skipWrite && resolvedTypesOutput && result.writtenFiles) {
|
|
3508
|
+
const filePath = join(resolvedTypesOutput, `${manifestKey}.d.ts`);
|
|
3509
|
+
await writeFile(filePath, typeDefinitionString, "utf8");
|
|
3510
|
+
result.writtenFiles[manifestKey] = filePath;
|
|
3511
|
+
onProgress?.({ type: "file_written", manifestKey, filePath });
|
|
3512
|
+
}
|
|
3513
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3514
|
+
} catch (error) {
|
|
3515
|
+
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3516
|
+
onProgress?.({
|
|
3517
|
+
type: "app_processing_error",
|
|
3518
|
+
app: app.key,
|
|
3519
|
+
error: errorMessage
|
|
3520
|
+
});
|
|
3521
|
+
if (error instanceof ZapierValidationError) {
|
|
3522
|
+
throw error;
|
|
3523
|
+
}
|
|
3524
|
+
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3471
3525
|
}
|
|
3472
|
-
return result;
|
|
3473
3526
|
}
|
|
3474
|
-
|
|
3475
|
-
|
|
3527
|
+
return result;
|
|
3528
|
+
}
|
|
3529
|
+
});
|
|
3476
3530
|
var BuildManifestSchema = z.object({
|
|
3477
3531
|
apps: z.array(z.string().min(1, "App key cannot be empty")).min(1, "At least one app key is required").describe(
|
|
3478
3532
|
"One or more app keys to build manifest entries for (e.g., 'slack', 'github', 'trello')"
|
|
@@ -3488,80 +3542,78 @@ var BuildManifestSchema = z.object({
|
|
|
3488
3542
|
);
|
|
3489
3543
|
|
|
3490
3544
|
// src/plugins/buildManifest/index.ts
|
|
3491
|
-
var
|
|
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
|
-
|
|
3519
|
-
|
|
3545
|
+
var listAppsRef2 = declareMethod({ id: "listApps" });
|
|
3546
|
+
var buildManifestPlugin = defineMethod({
|
|
3547
|
+
name: "buildManifest",
|
|
3548
|
+
imports: [listAppsRef2, manifestPluginRef],
|
|
3549
|
+
output: "raw",
|
|
3550
|
+
categories: ["utility"],
|
|
3551
|
+
// Cast: BuildManifestSchema validates JSON-serializable fields only.
|
|
3552
|
+
// BuildManifestOptions adds an `onProgress` callback; this widens the input
|
|
3553
|
+
// type so `run` can read it.
|
|
3554
|
+
inputSchema: BuildManifestSchema,
|
|
3555
|
+
// The schema stays for projection (CLI flags / docs); the runtime parse is
|
|
3556
|
+
// skipped because it would strip the runtime-only `onProgress` callback.
|
|
3557
|
+
skipInputValidation: true,
|
|
3558
|
+
run: async ({ imports, input }) => {
|
|
3559
|
+
const { apps: appKeys, skipWrite = false, configPath, onProgress } = input;
|
|
3560
|
+
onProgress?.({ type: "apps_lookup_start", count: appKeys.length });
|
|
3561
|
+
const appsIterable = imports.listApps({ apps: appKeys }).items();
|
|
3562
|
+
const apps = [];
|
|
3563
|
+
for await (const app of appsIterable) {
|
|
3564
|
+
apps.push(app);
|
|
3565
|
+
onProgress?.({ type: "app_found", app });
|
|
3566
|
+
}
|
|
3567
|
+
onProgress?.({ type: "apps_lookup_complete", count: apps.length });
|
|
3568
|
+
if (apps.length === 0) {
|
|
3569
|
+
return {};
|
|
3570
|
+
}
|
|
3571
|
+
let updatedManifest;
|
|
3572
|
+
for (const app of apps) {
|
|
3573
|
+
onProgress?.({
|
|
3574
|
+
type: "app_processing_start",
|
|
3575
|
+
app: app.key,
|
|
3576
|
+
slug: app.slug
|
|
3577
|
+
});
|
|
3578
|
+
try {
|
|
3579
|
+
const manifestEntry = createManifestEntry(app);
|
|
3520
3580
|
onProgress?.({
|
|
3521
|
-
type: "
|
|
3581
|
+
type: "manifest_entry_built",
|
|
3522
3582
|
app: app.key,
|
|
3523
|
-
|
|
3583
|
+
manifestKey: manifestEntry.implementationName,
|
|
3584
|
+
version: manifestEntry.version || ""
|
|
3524
3585
|
});
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3550
|
-
onProgress?.({
|
|
3551
|
-
type: "app_processing_error",
|
|
3552
|
-
app: app.key,
|
|
3553
|
-
error: errorMessage
|
|
3554
|
-
});
|
|
3555
|
-
if (error instanceof ZapierValidationError) {
|
|
3556
|
-
throw error;
|
|
3557
|
-
}
|
|
3558
|
-
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3586
|
+
const { key: updatedManifestKey, manifest } = await imports.manifest.updateManifestEntry({
|
|
3587
|
+
appKey: app.key,
|
|
3588
|
+
entry: manifestEntry,
|
|
3589
|
+
configPath,
|
|
3590
|
+
skipWrite,
|
|
3591
|
+
manifest: updatedManifest
|
|
3592
|
+
});
|
|
3593
|
+
updatedManifest = manifest;
|
|
3594
|
+
onProgress?.({
|
|
3595
|
+
type: "manifest_updated",
|
|
3596
|
+
app: app.key,
|
|
3597
|
+
manifestKey: updatedManifestKey,
|
|
3598
|
+
version: manifestEntry.version || ""
|
|
3599
|
+
});
|
|
3600
|
+
onProgress?.({ type: "app_processing_complete", app: app.key });
|
|
3601
|
+
} catch (error) {
|
|
3602
|
+
const errorMessage = `Failed to process app ${app.key}: ${error instanceof Error ? error.message : String(error)}`;
|
|
3603
|
+
onProgress?.({
|
|
3604
|
+
type: "app_processing_error",
|
|
3605
|
+
app: app.key,
|
|
3606
|
+
error: errorMessage
|
|
3607
|
+
});
|
|
3608
|
+
if (error instanceof ZapierValidationError) {
|
|
3609
|
+
throw error;
|
|
3559
3610
|
}
|
|
3611
|
+
throw new ZapierUnknownError(errorMessage, { cause: error });
|
|
3560
3612
|
}
|
|
3561
|
-
return { manifest: updatedManifest };
|
|
3562
3613
|
}
|
|
3563
|
-
|
|
3564
|
-
|
|
3614
|
+
return { manifest: updatedManifest };
|
|
3615
|
+
}
|
|
3616
|
+
});
|
|
3565
3617
|
var FeedbackSchema = z.object({
|
|
3566
3618
|
feedback: z.string().describe(
|
|
3567
3619
|
"Your feedback on the Zapier SDK. Describe what worked well, what was frustrating, or any suggestions."
|
|
@@ -3569,11 +3621,13 @@ var FeedbackSchema = z.object({
|
|
|
3569
3621
|
}).describe(
|
|
3570
3622
|
"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."
|
|
3571
3623
|
);
|
|
3572
|
-
|
|
3624
|
+
|
|
3625
|
+
// src/plugins/feedback/index.ts
|
|
3626
|
+
var feedbackResolver = defineResolver({
|
|
3573
3627
|
type: "static",
|
|
3574
3628
|
inputType: "text",
|
|
3575
3629
|
placeholder: "Enter your feedback"
|
|
3576
|
-
};
|
|
3630
|
+
});
|
|
3577
3631
|
var DEFAULT_FEEDBACK_WEBHOOK_URL = "https://hooks.zapier.com/hooks/catch/20279515/uc98k9m/";
|
|
3578
3632
|
var MAX_RETRIES = 2;
|
|
3579
3633
|
var RETRY_DELAY_MS = 1e3;
|
|
@@ -3595,31 +3649,33 @@ async function postWithRetry({
|
|
|
3595
3649
|
}
|
|
3596
3650
|
return response;
|
|
3597
3651
|
}
|
|
3598
|
-
var feedbackPlugin =
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3652
|
+
var feedbackPlugin = defineMethod({
|
|
3653
|
+
name: "feedback",
|
|
3654
|
+
imports: [sdkOptionsPluginRef],
|
|
3655
|
+
categories: ["utility"],
|
|
3656
|
+
inputSchema: FeedbackSchema,
|
|
3657
|
+
// Returns the thank-you string verbatim — no `{ data }` envelope, matching
|
|
3658
|
+
// legacy.
|
|
3659
|
+
output: "raw",
|
|
3660
|
+
resolvers: { feedback: feedbackResolver },
|
|
3661
|
+
run: async ({ imports, input }) => {
|
|
3662
|
+
const user = await getLoggedInUser();
|
|
3663
|
+
const body = JSON.stringify({
|
|
3664
|
+
email: user.email,
|
|
3665
|
+
customuser_id: user.customUserId,
|
|
3666
|
+
feedback: input.feedback
|
|
3667
|
+
});
|
|
3668
|
+
const response = await postWithRetry({
|
|
3669
|
+
body,
|
|
3670
|
+
attemptsLeft: MAX_RETRIES
|
|
3671
|
+
});
|
|
3672
|
+
if (imports.sdkOptions?.debug) {
|
|
3673
|
+
const text = await response.text();
|
|
3674
|
+
console.error("[debug] Webhook response:", text);
|
|
3620
3675
|
}
|
|
3621
|
-
|
|
3622
|
-
|
|
3676
|
+
return "Thank you for your feedback!";
|
|
3677
|
+
}
|
|
3678
|
+
});
|
|
3623
3679
|
var CurlSchema = z.object({
|
|
3624
3680
|
url: z.string().describe("Request URL"),
|
|
3625
3681
|
request: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method (defaults to GET, or POST if data is provided)"),
|
|
@@ -3796,8 +3852,38 @@ async function buildFormData(formArgs, formStringArgs) {
|
|
|
3796
3852
|
}
|
|
3797
3853
|
|
|
3798
3854
|
// src/plugins/curl/index.ts
|
|
3799
|
-
var
|
|
3800
|
-
|
|
3855
|
+
var fetchRef = declareMethod({
|
|
3856
|
+
id: "fetch"
|
|
3857
|
+
});
|
|
3858
|
+
var curlPlugin = defineMethod({
|
|
3859
|
+
name: "curl",
|
|
3860
|
+
imports: [fetchRef],
|
|
3861
|
+
// Returns nothing renderable; output goes to stdout/stderr/files, matching
|
|
3862
|
+
// curl itself.
|
|
3863
|
+
output: "raw",
|
|
3864
|
+
inputSchema: CurlSchema,
|
|
3865
|
+
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.",
|
|
3866
|
+
categories: ["http"],
|
|
3867
|
+
aliases: {
|
|
3868
|
+
request: "X",
|
|
3869
|
+
header: "H",
|
|
3870
|
+
data: "d",
|
|
3871
|
+
form: "F",
|
|
3872
|
+
get: "G",
|
|
3873
|
+
head: "I",
|
|
3874
|
+
location: "L",
|
|
3875
|
+
include: "i",
|
|
3876
|
+
output: "o",
|
|
3877
|
+
remoteName: "O",
|
|
3878
|
+
verbose: "v",
|
|
3879
|
+
silent: "s",
|
|
3880
|
+
showError: "S",
|
|
3881
|
+
writeOut: "w",
|
|
3882
|
+
maxTime: "m",
|
|
3883
|
+
user: "u",
|
|
3884
|
+
fail: "f"
|
|
3885
|
+
},
|
|
3886
|
+
run: async ({ imports, input }) => {
|
|
3801
3887
|
const {
|
|
3802
3888
|
url: rawUrl,
|
|
3803
3889
|
request,
|
|
@@ -3827,7 +3913,7 @@ var curlPlugin = definePlugin((sdk) => {
|
|
|
3827
3913
|
compressed,
|
|
3828
3914
|
connection: connectionParam,
|
|
3829
3915
|
connectionId
|
|
3830
|
-
} =
|
|
3916
|
+
} = input;
|
|
3831
3917
|
const connection = connectionParam ?? connectionId;
|
|
3832
3918
|
const parsedUrl = new URL(rawUrl);
|
|
3833
3919
|
const headers = {};
|
|
@@ -3929,7 +4015,7 @@ var curlPlugin = definePlugin((sdk) => {
|
|
|
3929
4015
|
process.stderr.write(">\n");
|
|
3930
4016
|
}
|
|
3931
4017
|
const start = performance.now();
|
|
3932
|
-
const response = await
|
|
4018
|
+
const response = await imports.fetch(effectiveUrl.toString(), {
|
|
3933
4019
|
method,
|
|
3934
4020
|
headers,
|
|
3935
4021
|
body,
|
|
@@ -4008,52 +4094,13 @@ ${Array.from(
|
|
|
4008
4094
|
}
|
|
4009
4095
|
return void 0;
|
|
4010
4096
|
}
|
|
4011
|
-
return {
|
|
4012
|
-
curl,
|
|
4013
|
-
context: {
|
|
4014
|
-
meta: {
|
|
4015
|
-
curl: {
|
|
4016
|
-
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.",
|
|
4017
|
-
categories: ["http"],
|
|
4018
|
-
inputSchema: CurlSchema,
|
|
4019
|
-
aliases: {
|
|
4020
|
-
request: "X",
|
|
4021
|
-
header: "H",
|
|
4022
|
-
data: "d",
|
|
4023
|
-
form: "F",
|
|
4024
|
-
get: "G",
|
|
4025
|
-
head: "I",
|
|
4026
|
-
location: "L",
|
|
4027
|
-
include: "i",
|
|
4028
|
-
output: "o",
|
|
4029
|
-
remoteName: "O",
|
|
4030
|
-
verbose: "v",
|
|
4031
|
-
silent: "s",
|
|
4032
|
-
showError: "S",
|
|
4033
|
-
writeOut: "w",
|
|
4034
|
-
maxTime: "m",
|
|
4035
|
-
user: "u",
|
|
4036
|
-
fail: "f"
|
|
4037
|
-
}
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
}
|
|
4041
|
-
};
|
|
4042
4097
|
});
|
|
4043
|
-
var
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
meta.fetch = {
|
|
4048
|
-
...sdk.context.meta.fetch,
|
|
4049
|
-
deprecation: {
|
|
4050
|
-
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
4051
|
-
}
|
|
4052
|
-
};
|
|
4053
|
-
}
|
|
4054
|
-
return { context: { meta } };
|
|
4098
|
+
var cliFetchOverride = defineMethodOverride({
|
|
4099
|
+
target: "fetch",
|
|
4100
|
+
deprecation: {
|
|
4101
|
+
message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
|
|
4055
4102
|
}
|
|
4056
|
-
);
|
|
4103
|
+
});
|
|
4057
4104
|
var TEMPLATES = ["basic"];
|
|
4058
4105
|
var InitSchema = z.object({
|
|
4059
4106
|
projectName: z.string().min(1).describe("Name of the project directory to create"),
|
|
@@ -4470,61 +4517,66 @@ function displaySummaryAndNextSteps({
|
|
|
4470
4517
|
}
|
|
4471
4518
|
|
|
4472
4519
|
// src/plugins/init/index.ts
|
|
4473
|
-
var initPlugin =
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
const packageManager = packageManagerInfo.name === "unknown" ? "npm" : packageManagerInfo.name;
|
|
4492
|
-
const steps = getInitSteps({
|
|
4493
|
-
projectDir,
|
|
4494
|
-
projectName,
|
|
4495
|
-
packageManager,
|
|
4496
|
-
displayHooks
|
|
4497
|
-
});
|
|
4498
|
-
const completedSetupStepIds = [];
|
|
4499
|
-
for (let i = 0; i < steps.length; i++) {
|
|
4500
|
-
const step = steps[i];
|
|
4501
|
-
const succeeded = await withInterruptCleanup(
|
|
4502
|
-
step.cleanup,
|
|
4503
|
-
() => runStep({
|
|
4504
|
-
step,
|
|
4505
|
-
stepNumber: i + 1,
|
|
4506
|
-
totalSteps: steps.length,
|
|
4507
|
-
nonInteractive,
|
|
4508
|
-
displayHooks
|
|
4509
|
-
})
|
|
4510
|
-
);
|
|
4511
|
-
if (!succeeded) break;
|
|
4512
|
-
completedSetupStepIds.push(step.id);
|
|
4513
|
-
}
|
|
4514
|
-
if (completedSetupStepIds.length === 0) {
|
|
4515
|
-
throw new ZapierCliExitError(
|
|
4516
|
-
"Project setup failed \u2014 no steps completed."
|
|
4517
|
-
);
|
|
4518
|
-
}
|
|
4519
|
-
displaySummaryAndNextSteps({
|
|
4520
|
-
projectName,
|
|
4521
|
-
steps,
|
|
4522
|
-
completedSetupStepIds,
|
|
4523
|
-
packageManager
|
|
4524
|
-
});
|
|
4520
|
+
var initPlugin = defineMethod({
|
|
4521
|
+
name: "init",
|
|
4522
|
+
categories: ["utility"],
|
|
4523
|
+
supportsJsonOutput: false,
|
|
4524
|
+
inputSchema: InitSchema,
|
|
4525
|
+
// All progress goes to the console; nothing to envelope, matching legacy.
|
|
4526
|
+
output: "raw",
|
|
4527
|
+
run: async ({ input }) => {
|
|
4528
|
+
const { projectName: rawName } = input;
|
|
4529
|
+
const nonInteractive = resolveNonInteractive(input);
|
|
4530
|
+
const cwd = process.cwd();
|
|
4531
|
+
const { projectName, projectDir } = validateInitOptions({ rawName, cwd });
|
|
4532
|
+
const displayHooks = createConsoleDisplayHooks();
|
|
4533
|
+
const packageManagerInfo = detectPackageManager(cwd);
|
|
4534
|
+
if (packageManagerInfo.name === "unknown") {
|
|
4535
|
+
displayHooks.onWarn(
|
|
4536
|
+
"Could not detect package manager, defaulting to npm."
|
|
4537
|
+
);
|
|
4525
4538
|
}
|
|
4526
|
-
|
|
4527
|
-
|
|
4539
|
+
const packageManager = packageManagerInfo.name === "unknown" ? "npm" : packageManagerInfo.name;
|
|
4540
|
+
const steps = getInitSteps({
|
|
4541
|
+
projectDir,
|
|
4542
|
+
projectName,
|
|
4543
|
+
packageManager,
|
|
4544
|
+
displayHooks
|
|
4545
|
+
});
|
|
4546
|
+
const completedSetupStepIds = [];
|
|
4547
|
+
for (let i = 0; i < steps.length; i++) {
|
|
4548
|
+
const step = steps[i];
|
|
4549
|
+
const succeeded = await withInterruptCleanup(
|
|
4550
|
+
step.cleanup,
|
|
4551
|
+
() => runStep({
|
|
4552
|
+
step,
|
|
4553
|
+
stepNumber: i + 1,
|
|
4554
|
+
totalSteps: steps.length,
|
|
4555
|
+
nonInteractive,
|
|
4556
|
+
displayHooks
|
|
4557
|
+
})
|
|
4558
|
+
);
|
|
4559
|
+
if (!succeeded) break;
|
|
4560
|
+
completedSetupStepIds.push(step.id);
|
|
4561
|
+
}
|
|
4562
|
+
if (completedSetupStepIds.length === 0) {
|
|
4563
|
+
throw new ZapierCliExitError(
|
|
4564
|
+
"Project setup failed \u2014 no steps completed."
|
|
4565
|
+
);
|
|
4566
|
+
}
|
|
4567
|
+
displaySummaryAndNextSteps({
|
|
4568
|
+
projectName,
|
|
4569
|
+
steps,
|
|
4570
|
+
completedSetupStepIds,
|
|
4571
|
+
packageManager
|
|
4572
|
+
});
|
|
4573
|
+
}
|
|
4574
|
+
});
|
|
4575
|
+
|
|
4576
|
+
// src/utils/string-utils.ts
|
|
4577
|
+
function toKebabCase(str) {
|
|
4578
|
+
return str.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4579
|
+
}
|
|
4528
4580
|
function jsonReplacer(_key, value) {
|
|
4529
4581
|
if (value instanceof Error) {
|
|
4530
4582
|
return {
|
|
@@ -4764,127 +4816,132 @@ var ExecCliProperty = z.string().optional().describe(
|
|
|
4764
4816
|
var ExecShellCliProperty = z.string().optional().describe(
|
|
4765
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."
|
|
4766
4818
|
);
|
|
4767
|
-
var
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
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;
|
|
4787
4881
|
}
|
|
4788
|
-
|
|
4789
|
-
const onSigint = () => sigintController.abort();
|
|
4790
|
-
process.on("SIGINT", onSigint);
|
|
4791
|
-
const combined = combineSignals(
|
|
4792
|
-
sdkArgs.signal,
|
|
4793
|
-
sigintController.signal
|
|
4794
|
-
);
|
|
4795
|
-
let fulfilled = 0;
|
|
4796
|
-
let rejected = 0;
|
|
4797
|
-
let skipped = 0;
|
|
4798
|
-
const liveOnError = (reason, message) => {
|
|
4799
|
-
rejected++;
|
|
4800
|
-
printDrainError(reason, message);
|
|
4801
|
-
};
|
|
4802
|
-
try {
|
|
4803
|
-
if (exec) {
|
|
4804
|
-
const execArgv = [exec, ...getPostDashArgs()];
|
|
4805
|
-
await original({
|
|
4806
|
-
...sdkArgs,
|
|
4807
|
-
signal: combined.signal,
|
|
4808
|
-
onMessage: async (message) => {
|
|
4809
|
-
await runExecCommand(execArgv, message, combined.signal);
|
|
4810
|
-
fulfilled++;
|
|
4811
|
-
},
|
|
4812
|
-
onError: liveOnError
|
|
4813
|
-
});
|
|
4814
|
-
return;
|
|
4815
|
-
}
|
|
4816
|
-
if (execShell) {
|
|
4817
|
-
await original({
|
|
4818
|
-
...sdkArgs,
|
|
4819
|
-
signal: combined.signal,
|
|
4820
|
-
onMessage: async (message) => {
|
|
4821
|
-
await runShellCommand(execShell, message, combined.signal);
|
|
4822
|
-
fulfilled++;
|
|
4823
|
-
},
|
|
4824
|
-
onError: liveOnError
|
|
4825
|
-
});
|
|
4826
|
-
return;
|
|
4827
|
-
}
|
|
4828
|
-
if (json) {
|
|
4829
|
-
const data = [];
|
|
4830
|
-
const errors = [];
|
|
4831
|
-
await original({
|
|
4832
|
-
...sdkArgs,
|
|
4833
|
-
signal: combined.signal,
|
|
4834
|
-
continueOnError: true,
|
|
4835
|
-
onMessage: (message) => {
|
|
4836
|
-
data.push(message);
|
|
4837
|
-
},
|
|
4838
|
-
onError: (reason, message) => {
|
|
4839
|
-
errors.push({ reason, message });
|
|
4840
|
-
}
|
|
4841
|
-
});
|
|
4842
|
-
process.stdout.write(
|
|
4843
|
-
JSON.stringify({ data, errors }, jsonReplacer, 2) + "\n"
|
|
4844
|
-
);
|
|
4845
|
-
return;
|
|
4846
|
-
}
|
|
4847
|
-
if (sdkArgs.continueOnError === false) {
|
|
4848
|
-
warnInteractiveContinueOnErrorOverride();
|
|
4849
|
-
}
|
|
4850
|
-
const interactive = createInteractiveCallback();
|
|
4882
|
+
if (execShell) {
|
|
4851
4883
|
await original({
|
|
4852
4884
|
...sdkArgs,
|
|
4853
4885
|
signal: combined.signal,
|
|
4854
|
-
concurrency: 1,
|
|
4855
|
-
continueOnError: true,
|
|
4856
4886
|
onMessage: async (message) => {
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
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 });
|
|
4866
4906
|
}
|
|
4867
4907
|
});
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4873
|
-
}
|
|
4908
|
+
process.stdout.write(
|
|
4909
|
+
JSON.stringify({ data, errors }, jsonReplacer, 2) + "\n"
|
|
4910
|
+
);
|
|
4911
|
+
return;
|
|
4874
4912
|
}
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
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
|
+
}
|
|
4882
4932
|
}
|
|
4933
|
+
});
|
|
4934
|
+
} finally {
|
|
4935
|
+
process.off("SIGINT", onSigint);
|
|
4936
|
+
combined.dispose();
|
|
4937
|
+
if (!json) {
|
|
4938
|
+
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4883
4939
|
}
|
|
4884
4940
|
}
|
|
4885
4941
|
};
|
|
4942
|
+
return doDrain();
|
|
4886
4943
|
}
|
|
4887
|
-
);
|
|
4944
|
+
});
|
|
4888
4945
|
var JsonProperty2 = z.boolean().optional().describe(
|
|
4889
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."
|
|
4890
4947
|
);
|
|
@@ -4894,120 +4951,117 @@ var ExecCliProperty2 = z.string().optional().describe(
|
|
|
4894
4951
|
var ExecShellCliProperty2 = z.string().optional().describe(
|
|
4895
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."
|
|
4896
4953
|
);
|
|
4897
|
-
var
|
|
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
|
-
|
|
4962
|
-
|
|
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);
|
|
4963
5044
|
fulfilled++;
|
|
4964
|
-
}
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
} else {
|
|
4968
|
-
if (sdkArgs.continueOnError === false) {
|
|
4969
|
-
warnInteractiveContinueOnErrorOverride();
|
|
4970
|
-
}
|
|
4971
|
-
const interactive = createInteractiveCallback();
|
|
4972
|
-
await original({
|
|
4973
|
-
...sdkArgs,
|
|
4974
|
-
signal: combined.signal,
|
|
4975
|
-
concurrency: 1,
|
|
4976
|
-
continueOnError: true,
|
|
4977
|
-
onMessage: async (message) => {
|
|
4978
|
-
try {
|
|
4979
|
-
await interactive(message);
|
|
4980
|
-
fulfilled++;
|
|
4981
|
-
} catch (err) {
|
|
4982
|
-
if (err instanceof ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
4983
|
-
skipped++;
|
|
4984
|
-
}
|
|
4985
|
-
throw err;
|
|
5045
|
+
} catch (err) {
|
|
5046
|
+
if (err instanceof ZapierReleaseTriggerMessageSignal || err instanceof CliSkipLeaseExpireError) {
|
|
5047
|
+
skipped++;
|
|
4986
5048
|
}
|
|
5049
|
+
throw err;
|
|
4987
5050
|
}
|
|
4988
|
-
}
|
|
4989
|
-
}
|
|
4990
|
-
} finally {
|
|
4991
|
-
process.off("SIGINT", onSigint);
|
|
4992
|
-
combined.dispose();
|
|
4993
|
-
if (!json) {
|
|
4994
|
-
printDrainSummary({ fulfilled, rejected, skipped });
|
|
4995
|
-
}
|
|
5051
|
+
}
|
|
5052
|
+
});
|
|
4996
5053
|
}
|
|
4997
|
-
}
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
description: cliDescription,
|
|
5003
|
-
inputSchema: extendedInputSchema,
|
|
5004
|
-
packages: void 0
|
|
5005
|
-
}
|
|
5054
|
+
} finally {
|
|
5055
|
+
process.off("SIGINT", onSigint);
|
|
5056
|
+
combined.dispose();
|
|
5057
|
+
if (!json) {
|
|
5058
|
+
printDrainSummary({ fulfilled, rejected, skipped });
|
|
5006
5059
|
}
|
|
5007
5060
|
}
|
|
5008
5061
|
};
|
|
5062
|
+
return doWatch();
|
|
5009
5063
|
}
|
|
5010
|
-
);
|
|
5064
|
+
});
|
|
5011
5065
|
var activeNotices = /* @__PURE__ */ new Map();
|
|
5012
5066
|
function collectDeprecationNotice(event) {
|
|
5013
5067
|
if (event.type !== DEPRECATION_NOTICE_EVENT) return;
|
|
@@ -5024,19 +5078,60 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
|
|
|
5024
5078
|
// package.json with { type: 'json' }
|
|
5025
5079
|
var package_default = {
|
|
5026
5080
|
name: "@zapier/zapier-sdk-cli",
|
|
5027
|
-
version: "0.
|
|
5081
|
+
version: "0.65.0"};
|
|
5028
5082
|
|
|
5029
|
-
// src/
|
|
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
|
+
};
|
|
5030
5098
|
injectCliLogin(login_exports);
|
|
5099
|
+
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
|
+
});
|
|
5129
|
+
|
|
5130
|
+
// src/experimental.ts
|
|
5131
|
+
injectCliLogin$1(login_exports);
|
|
5031
5132
|
function createZapierCliSdk(options = {}) {
|
|
5032
5133
|
const { extensions = [], ...sdkOptions } = options;
|
|
5033
|
-
const
|
|
5034
|
-
context: { extensions }
|
|
5035
|
-
});
|
|
5036
|
-
const experimentalContextPlugin = () => ({
|
|
5037
|
-
context: { experimental: true }
|
|
5038
|
-
});
|
|
5039
|
-
const stack = createZapierSdkStack({
|
|
5134
|
+
const stackOptions = {
|
|
5040
5135
|
...sdkOptions,
|
|
5041
5136
|
eventEmission: { ...sdkOptions.eventEmission, callContext: "cli" },
|
|
5042
5137
|
callerPackage: { name: package_default.name, version: package_default.version },
|
|
@@ -5044,15 +5139,42 @@ function createZapierCliSdk(options = {}) {
|
|
|
5044
5139
|
// box is additive: the SDK's own inline warn still fires, so the notice
|
|
5045
5140
|
// cannot be hidden by any rendering path.
|
|
5046
5141
|
onEvent: (event) => collectDeprecationNoticeAndForward(event, sdkOptions.onEvent)
|
|
5047
|
-
}
|
|
5048
|
-
const
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5142
|
+
};
|
|
5143
|
+
const cliExperimentalSdkPlugin = definePlugin$1({
|
|
5144
|
+
namespace: "zapier",
|
|
5145
|
+
name: "cli-experimental-sdk",
|
|
5146
|
+
exports: [
|
|
5147
|
+
omitExports$1(zapierExperimentalSdkPlugin, [
|
|
5148
|
+
"drainTriggerInbox",
|
|
5149
|
+
"watchTriggerInbox"
|
|
5150
|
+
]),
|
|
5151
|
+
drainTriggerInboxCliPlugin,
|
|
5152
|
+
watchTriggerInboxCliPlugin,
|
|
5153
|
+
loginPlugin,
|
|
5154
|
+
signupPlugin,
|
|
5155
|
+
logoutPlugin,
|
|
5156
|
+
mcpPlugin,
|
|
5157
|
+
getLoginConfigPathPlugin,
|
|
5158
|
+
initPlugin,
|
|
5159
|
+
bundleCodePlugin,
|
|
5160
|
+
feedbackPlugin,
|
|
5161
|
+
curlPlugin,
|
|
5162
|
+
addAppsPlugin,
|
|
5163
|
+
buildManifestPlugin,
|
|
5164
|
+
generateAppTypesPlugin
|
|
5165
|
+
]
|
|
5166
|
+
});
|
|
5167
|
+
const sdk = createSdk(cliExperimentalSdkPlugin, {
|
|
5168
|
+
configuration: {
|
|
5169
|
+
[SDK_OPTIONS_ID]: stackOptions,
|
|
5170
|
+
[CORE_OPTIONS_ID]: cliCoreOptions,
|
|
5171
|
+
[CLI_EXTENSIONS_ID]: extensions,
|
|
5172
|
+
// Built by the experimental factory: `mcp` reads this to launch the
|
|
5173
|
+
// experimental MCP server so the surfaces stay aligned.
|
|
5174
|
+
[CLI_EXPERIMENTAL_ID]: true
|
|
5175
|
+
}
|
|
5176
|
+
});
|
|
5177
|
+
addPlugin(sdk, cliFetchOverride);
|
|
5056
5178
|
for (const ext of extensions) {
|
|
5057
5179
|
try {
|
|
5058
5180
|
addPlugin(sdk, ext);
|