@zapier/zapier-sdk-cli 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +35 -51
- package/dist/cli.cjs +750 -346
- package/dist/cli.mjs +751 -347
- package/dist/index.cjs +726 -336
- package/dist/index.mjs +727 -337
- package/dist/package.json +1 -1
- package/dist/src/plugins/add/ast-generator.d.ts +37 -0
- package/dist/src/plugins/add/ast-generator.js +403 -0
- package/dist/src/plugins/add/index.d.ts +13 -0
- package/dist/src/plugins/add/index.js +122 -0
- package/dist/src/plugins/add/schemas.d.ts +18 -0
- package/dist/src/plugins/add/schemas.js +19 -0
- package/dist/src/plugins/getLoginConfigPath/index.d.ts +15 -0
- package/dist/src/plugins/getLoginConfigPath/index.js +19 -0
- package/dist/src/plugins/getLoginConfigPath/schemas.d.ts +3 -0
- package/dist/src/plugins/getLoginConfigPath/schemas.js +5 -0
- package/dist/src/plugins/index.d.ts +2 -2
- package/dist/src/plugins/index.js +2 -2
- package/dist/src/sdk.js +3 -3
- package/dist/src/utils/cli-generator.js +15 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/plugins/add/ast-generator.ts +777 -0
- package/src/plugins/add/index.test.ts +58 -0
- package/src/plugins/add/index.ts +187 -0
- package/src/plugins/add/schemas.ts +26 -0
- package/src/plugins/getLoginConfigPath/index.ts +45 -0
- package/src/plugins/getLoginConfigPath/schemas.ts +10 -0
- package/src/plugins/index.ts +2 -2
- package/src/sdk.ts +4 -4
- package/src/utils/cli-generator.ts +22 -0
- package/tsup.config.ts +1 -1
- package/dist/src/plugins/generateTypes/index.d.ts +0 -21
- package/dist/src/plugins/generateTypes/index.js +0 -312
- package/dist/src/plugins/generateTypes/schemas.d.ts +0 -18
- package/dist/src/plugins/generateTypes/schemas.js +0 -14
- package/dist/src/plugins/getConfigPath/index.d.ts +0 -15
- package/dist/src/plugins/getConfigPath/index.js +0 -19
- package/dist/src/plugins/getConfigPath/schemas.d.ts +0 -3
- package/dist/src/plugins/getConfigPath/schemas.js +0 -5
- package/src/plugins/generateTypes/index.ts +0 -444
- package/src/plugins/generateTypes/schemas.ts +0 -23
- package/src/plugins/getConfigPath/index.ts +0 -42
- package/src/plugins/getConfigPath/schemas.ts +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { loginPlugin } from "./login";
|
|
2
2
|
export { logoutPlugin } from "./logout";
|
|
3
3
|
export { mcpPlugin } from "./mcp";
|
|
4
|
-
export { generateTypesPlugin } from "./generateTypes";
|
|
5
4
|
export { bundleCodePlugin } from "./bundleCode";
|
|
6
|
-
export {
|
|
5
|
+
export { getLoginConfigPathPlugin } from "./getLoginConfigPath";
|
|
6
|
+
export { addPlugin } from "./add";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { loginPlugin } from "./login";
|
|
2
2
|
export { logoutPlugin } from "./logout";
|
|
3
3
|
export { mcpPlugin } from "./mcp";
|
|
4
|
-
export { generateTypesPlugin } from "./generateTypes";
|
|
5
4
|
export { bundleCodePlugin } from "./bundleCode";
|
|
6
|
-
export {
|
|
5
|
+
export { getLoginConfigPathPlugin } from "./getLoginConfigPath";
|
|
6
|
+
export { addPlugin } from "./add";
|
package/dist/src/sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createZapierSdkWithoutRegistry, registryPlugin, } from "@zapier/zapier-sdk";
|
|
2
|
-
import { loginPlugin, logoutPlugin, mcpPlugin,
|
|
2
|
+
import { loginPlugin, logoutPlugin, mcpPlugin, bundleCodePlugin, getLoginConfigPathPlugin, addPlugin, } from "./plugins/index";
|
|
3
3
|
/**
|
|
4
4
|
* Create a Zapier SDK instance configured specifically for the CLI
|
|
5
5
|
* Includes all CLI-specific plugins in addition to the standard SDK functionality
|
|
@@ -10,9 +10,9 @@ export function createZapierCliSdk(options = {}) {
|
|
|
10
10
|
debug: options.debug,
|
|
11
11
|
});
|
|
12
12
|
// Add CLI-specific plugins before registry
|
|
13
|
-
sdk = sdk.addPlugin(generateTypesPlugin);
|
|
14
13
|
sdk = sdk.addPlugin(bundleCodePlugin);
|
|
15
|
-
sdk = sdk.addPlugin(
|
|
14
|
+
sdk = sdk.addPlugin(getLoginConfigPathPlugin);
|
|
15
|
+
sdk = sdk.addPlugin(addPlugin);
|
|
16
16
|
sdk = sdk.addPlugin(mcpPlugin);
|
|
17
17
|
sdk = sdk.addPlugin(loginPlugin);
|
|
18
18
|
sdk = sdk.addPlugin(logoutPlugin);
|
|
@@ -294,6 +294,8 @@ function createCommandConfig(cliCommandName, sdkMethodName, schema, sdk) {
|
|
|
294
294
|
}
|
|
295
295
|
function addCommand(program, commandName, config) {
|
|
296
296
|
const command = program.command(commandName).description(config.description);
|
|
297
|
+
// Track whether we've already used a positional array parameter
|
|
298
|
+
let hasPositionalArray = false;
|
|
297
299
|
// Add parameters to command
|
|
298
300
|
config.parameters.forEach((param) => {
|
|
299
301
|
// Convert camelCase to kebab-case for CLI display
|
|
@@ -302,6 +304,19 @@ function addCommand(program, commandName, config) {
|
|
|
302
304
|
// Required parameters with resolvers become optional positional arguments (resolver handles prompting)
|
|
303
305
|
command.argument(`[${kebabName}]`, param.description || `${kebabName} parameter`);
|
|
304
306
|
}
|
|
307
|
+
else if (param.required &&
|
|
308
|
+
param.type === "array" &&
|
|
309
|
+
!hasPositionalArray) {
|
|
310
|
+
// First required array parameter becomes a variadic positional argument
|
|
311
|
+
hasPositionalArray = true;
|
|
312
|
+
command.argument(`<${kebabName}...>`, param.description || `${kebabName} parameter`);
|
|
313
|
+
}
|
|
314
|
+
else if (param.required && param.type === "array") {
|
|
315
|
+
// Subsequent required array parameters become required flags
|
|
316
|
+
const flags = [`--${kebabName}`];
|
|
317
|
+
const flagSignature = flags.join(", ") + ` <values...>`;
|
|
318
|
+
command.requiredOption(flagSignature, param.description || `${kebabName} parameter (required)`);
|
|
319
|
+
}
|
|
305
320
|
else if (param.required) {
|
|
306
321
|
// Required parameters without resolvers become required positional arguments
|
|
307
322
|
command.argument(`<${kebabName}>`, param.description || `${kebabName} parameter`);
|