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