@zapier/zapier-sdk-cli 0.61.0 → 0.61.1

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.61.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e2cf0d: Internal refactoring of interactive parameter resolution. No change to existing commands.
8
+ - Updated dependencies [5e2cf0d]
9
+ - Updated dependencies [5e2cf0d]
10
+ - @zapier/zapier-sdk-mcp@0.16.1
11
+ - @zapier/zapier-sdk@0.80.0
12
+
3
13
  ## 0.61.0
4
14
 
5
15
  ### Minor Changes
package/dist/cli.cjs CHANGED
@@ -1554,6 +1554,148 @@ Optional fields${pathContext}:`));
1554
1554
  return constants;
1555
1555
  }
1556
1556
  };
1557
+ function offers(question, action) {
1558
+ return question.actions.some((a) => a.action === action);
1559
+ }
1560
+ function isActionRow(value) {
1561
+ return typeof value === "object" && value !== null && "action" in value;
1562
+ }
1563
+ async function promptText({
1564
+ message,
1565
+ password
1566
+ }) {
1567
+ const { value } = await inquirer__default.default.prompt([
1568
+ { type: password ? "password" : "input", name: "value", message }
1569
+ ]);
1570
+ return value;
1571
+ }
1572
+ async function answerSelect(question, field) {
1573
+ const display = (c) => c.hint ? `${c.label} ${chalk__default.default.dim(`(${c.hint})`)}` : c.label;
1574
+ if (question.multiple) {
1575
+ const choices = [
1576
+ ...question.choices.map((c) => ({ name: display(c), value: c.value })),
1577
+ ...offers(question, "more") ? [
1578
+ {
1579
+ name: chalk__default.default.dim("Load more\u2026"),
1580
+ value: { action: "more" }
1581
+ }
1582
+ ] : [],
1583
+ ...(question.notes ?? []).map((note) => ({
1584
+ name: chalk__default.default.dim(note),
1585
+ value: note,
1586
+ disabled: true
1587
+ }))
1588
+ ];
1589
+ const { values } = await inquirer__default.default.prompt([
1590
+ { type: "checkbox", name: "values", message: question.message, choices }
1591
+ ]);
1592
+ const selected = values;
1593
+ if (selected.some(isActionRow)) return { type: "more" };
1594
+ if (selected.length === 0 && offers(question, "skip")) {
1595
+ return { type: "skip" };
1596
+ }
1597
+ return { type: "choose", value: selected };
1598
+ }
1599
+ const row = (name, action) => ({
1600
+ name,
1601
+ value: { action }
1602
+ });
1603
+ const value = await search__default.default({
1604
+ message: question.message,
1605
+ source: (term) => {
1606
+ const t = (term ?? "").trim().toLowerCase();
1607
+ const matched = t ? question.choices.filter(
1608
+ (c) => `${c.label} ${c.hint ?? ""}`.toLowerCase().includes(t)
1609
+ ) : question.choices;
1610
+ const rows = matched.map((c) => ({
1611
+ name: display(c),
1612
+ value: c.value
1613
+ }));
1614
+ if (offers(question, "search"))
1615
+ rows.push(row(chalk__default.default.cyan("Search\u2026"), "search"));
1616
+ if (offers(question, "more"))
1617
+ rows.push(row(chalk__default.default.dim("Load more\u2026"), "more"));
1618
+ if (offers(question, "custom"))
1619
+ rows.push(row(chalk__default.default.dim("Enter a value manually\u2026"), "custom"));
1620
+ if (offers(question, "retry"))
1621
+ rows.push(row(chalk__default.default.yellow("Retry"), "retry"));
1622
+ if (offers(question, "skip"))
1623
+ rows.push(row(chalk__default.default.dim("Skip (optional)"), "skip"));
1624
+ if (offers(question, "cancel"))
1625
+ rows.push(row(chalk__default.default.dim("Cancel"), "cancel"));
1626
+ for (const note of question.notes ?? [])
1627
+ rows.push({ name: chalk__default.default.dim(note), value: note, disabled: true });
1628
+ return rows;
1629
+ }
1630
+ });
1631
+ if (!isActionRow(value)) {
1632
+ return { type: "choose", value };
1633
+ }
1634
+ switch (value.action) {
1635
+ case "search": {
1636
+ const term = await promptText({
1637
+ message: `Search ${field}:`,
1638
+ password: false
1639
+ });
1640
+ return { type: "search", term };
1641
+ }
1642
+ case "custom": {
1643
+ const custom = await promptText({
1644
+ message: `Enter ${field}:`,
1645
+ password: false
1646
+ });
1647
+ return { type: "custom", value: custom };
1648
+ }
1649
+ case "more":
1650
+ return { type: "more" };
1651
+ case "retry":
1652
+ return { type: "retry" };
1653
+ case "skip":
1654
+ return { type: "skip" };
1655
+ case "cancel":
1656
+ return { type: "cancel" };
1657
+ }
1658
+ }
1659
+ async function answerInput(question) {
1660
+ const value = await promptText({
1661
+ message: question.message,
1662
+ password: question.inputType === "password"
1663
+ });
1664
+ if (value === "" && offers(question, "skip")) {
1665
+ return { type: "skip" };
1666
+ }
1667
+ return { type: "custom", value };
1668
+ }
1669
+ async function answerCollection(question) {
1670
+ if (!offers(question, "done")) {
1671
+ return { type: "add" };
1672
+ }
1673
+ const { again } = await inquirer__default.default.prompt([
1674
+ {
1675
+ type: "confirm",
1676
+ name: "again",
1677
+ message: question.message,
1678
+ default: false
1679
+ }
1680
+ ]);
1681
+ return again ? { type: "add" } : { type: "done" };
1682
+ }
1683
+ var answerViaCli = ({ state, result }) => {
1684
+ if (result.error !== void 0) {
1685
+ const message = typeof result.error === "string" ? result.error : result.error.message;
1686
+ console.log(chalk__default.default.yellow(`! ${message}`));
1687
+ }
1688
+ const field = state.current?.join(".") ?? "value";
1689
+ const question = result.question;
1690
+ switch (question.type) {
1691
+ case "select":
1692
+ return answerSelect(question, field);
1693
+ case "input":
1694
+ return answerInput(question);
1695
+ case "collection":
1696
+ return answerCollection(question);
1697
+ }
1698
+ };
1557
1699
 
1558
1700
  // src/utils/cli-options.ts
1559
1701
  var RESERVED_CLI_OPTIONS = [
@@ -1585,7 +1727,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1585
1727
 
1586
1728
  // package.json
1587
1729
  var package_default = {
1588
- version: "0.61.0"};
1730
+ version: "0.61.1"};
1589
1731
 
1590
1732
  // src/telemetry/builders.ts
1591
1733
  function createCliBaseEvent(context = {}) {
@@ -1660,7 +1802,7 @@ async function formatItemsFromSchema(_functionInfo, items, startingNumber = 0, o
1660
1802
  if (options?.formatter) {
1661
1803
  const formatter = options.formatter;
1662
1804
  const input = options.input ?? {};
1663
- const context = formatter.fetchContext ? await formatter.fetchContext({ items, input }) : void 0;
1805
+ const context = formatter.getContext ? await formatter.getContext({ items, input }) : void 0;
1664
1806
  items.forEach((item, index) => {
1665
1807
  const formatted = formatter.format({ item, input, context });
1666
1808
  formatSingleItem(formatted, startingNumber + index);
@@ -2255,7 +2397,7 @@ function analyzeZodField(name, schema, functionInfo) {
2255
2397
  paramType = "object";
2256
2398
  }
2257
2399
  let paramHasResolver = false;
2258
- if (functionInfo?.resolvers?.[name]) {
2400
+ if (functionInfo?.resolvers?.[name] || functionInfo?.boundResolvers?.[name]) {
2259
2401
  paramHasResolver = true;
2260
2402
  }
2261
2403
  return {
@@ -2414,6 +2556,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
2414
2556
  const usesInputParameters = !functionInfo.inputSchema && !!functionInfo.inputParameters;
2415
2557
  const schema = functionInfo.inputSchema;
2416
2558
  const parameters = usesInputParameters ? analyzeInputParameters(functionInfo.inputParameters, functionInfo) : analyzeZodSchema(schema, functionInfo);
2559
+ if (functionInfo.boundResolvers && Object.keys(functionInfo.boundResolvers).length > 0) {
2560
+ for (const param of parameters) param.hasResolver = true;
2561
+ }
2417
2562
  const schemaAliases = getSchemaAliases(schema);
2418
2563
  if (schemaAliases) {
2419
2564
  const aliasedNames = new Set(Object.keys(schemaAliases));
@@ -2466,7 +2611,35 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
2466
2611
  }
2467
2612
  }
2468
2613
  }
2469
- if (schema && !usesInputParameters) {
2614
+ const boundResolvers = functionInfo.boundResolvers;
2615
+ if (boundResolvers && Object.keys(boundResolvers).length > 0) {
2616
+ const seedInput = Object.fromEntries(
2617
+ Object.entries(rawParams).filter(([, v]) => v !== void 0)
2618
+ );
2619
+ const controller = zapierSdk.createController(sdk);
2620
+ let resolved;
2621
+ try {
2622
+ resolved = await controller.resolve({
2623
+ method: functionInfo.name,
2624
+ input: seedInput,
2625
+ answer: interactiveMode ? answerViaCli : ({ state }) => {
2626
+ throw new ZapierCliMissingParametersError([
2627
+ {
2628
+ name: state.current?.join(".") ?? "value",
2629
+ isPositional: false
2630
+ }
2631
+ ]);
2632
+ },
2633
+ interactive: interactiveMode
2634
+ });
2635
+ } catch (err) {
2636
+ if (err instanceof zapierSdk.CoreCancelledSignal) {
2637
+ throw new ZapierCliUserCancellationError();
2638
+ }
2639
+ throw err;
2640
+ }
2641
+ Object.assign(resolvedParams, resolved);
2642
+ } else if (schema && !usesInputParameters) {
2470
2643
  const resolver = new SchemaParameterResolver();
2471
2644
  const resolved = await resolver.resolveParameters(
2472
2645
  schema,
@@ -2559,7 +2732,7 @@ ${confirmMessageAfter}`));
2559
2732
  }
2560
2733
  }
2561
2734
  } catch (error) {
2562
- success = false;
2735
+ success = error instanceof ZapierCliError ? error.exitCode === 0 : false;
2563
2736
  errorMessage = error instanceof Error ? error.message : String(error);
2564
2737
  if (error instanceof ZapierCliMissingParametersError) {
2565
2738
  renderer.renderError(error);
@@ -7438,7 +7611,7 @@ function buildBoxLines(message) {
7438
7611
  // package.json with { type: 'json' }
7439
7612
  var package_default2 = {
7440
7613
  name: "@zapier/zapier-sdk-cli",
7441
- version: "0.61.0"};
7614
+ version: "0.61.1"};
7442
7615
 
7443
7616
  // src/sdk.ts
7444
7617
  zapierSdk.injectCliLogin(login_exports);
@@ -7515,6 +7688,9 @@ function createZapierCliSdk2(options = {}) {
7515
7688
 
7516
7689
  // src/utils/extensions.ts
7517
7690
  var ENV_VAR = "ZAPIER_SDK_EXTENSIONS";
7691
+ function isModelPlugin(value) {
7692
+ return typeof value === "object" && value !== null && "pluginType" in value && typeof value.pluginType === "string";
7693
+ }
7518
7694
  async function resolveExtensions() {
7519
7695
  const seen = /* @__PURE__ */ new Set();
7520
7696
  const specs = readEnvSpecs().filter((spec) => {
@@ -7547,8 +7723,11 @@ function normalizeExtension(exported) {
7547
7723
  if (typeof exported === "function") {
7548
7724
  return [exported];
7549
7725
  }
7726
+ if (isModelPlugin(exported)) {
7727
+ return [exported];
7728
+ }
7550
7729
  if (Array.isArray(exported)) {
7551
- if (exported.every((e) => typeof e === "function")) {
7730
+ if (exported.every((e) => typeof e === "function" || isModelPlugin(e))) {
7552
7731
  return exported;
7553
7732
  }
7554
7733
  return null;
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, CommanderError, Option } from 'commander';
3
3
  import { z } from 'zod';
4
- import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, injectCliLogin, BaseSdkOptionsSchema, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, createZapierSdkStack as createZapierSdkStack$1, createSdk as createSdk$1, defineLegacyMerge as defineLegacyMerge$1, zapierSdkPlugin as zapierSdkPlugin$1, addPlugin as addPlugin$1, ZapierError, isCredentialsObject, buildApplicationLifecycleEvent, AuthMechanism, ZapierAuthenticationError, DEPRECATION_NOTICE_EVENT, runWithCallerContext, isPositional, runWithTelemetryContext, buildCapabilityMessage, formatErrorMessage, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId, ZapierApprovalError } from '@zapier/zapier-sdk';
4
+ import { definePlugin, createPluginMethod, OutputPropertySchema, ZapierBundleError, DEFAULT_CONFIG_PATH, ZapierValidationError, ZapierUnknownError, ZapierReleaseTriggerMessageSignal, injectCliLogin, BaseSdkOptionsSchema, getOrCreateApiClient, isPermanentHttpError, invalidateCachedToken, batch, toSnakeCase, ZapierAbortDrainSignal, createZapierSdkStack as createZapierSdkStack$1, createSdk as createSdk$1, defineLegacyMerge as defineLegacyMerge$1, zapierSdkPlugin as zapierSdkPlugin$1, addPlugin as addPlugin$1, ZapierError, isCredentialsObject, buildApplicationLifecycleEvent, AuthMechanism, ZapierAuthenticationError, DEPRECATION_NOTICE_EVENT, runWithCallerContext, isPositional, createController, CoreCancelledSignal, runWithTelemetryContext, buildCapabilityMessage, formatErrorMessage, getOsInfo, getPlatformVersions, getAgent, getTtyContext, getCiPlatform, isCi, getReleaseId, getCurrentTimestamp, generateEventId, ZapierApprovalError } from '@zapier/zapier-sdk';
5
5
  import inquirer from 'inquirer';
6
6
  import search from '@inquirer/search';
7
7
  import chalk from 'chalk';
@@ -1511,6 +1511,148 @@ Optional fields${pathContext}:`));
1511
1511
  return constants;
1512
1512
  }
1513
1513
  };
1514
+ function offers(question, action) {
1515
+ return question.actions.some((a) => a.action === action);
1516
+ }
1517
+ function isActionRow(value) {
1518
+ return typeof value === "object" && value !== null && "action" in value;
1519
+ }
1520
+ async function promptText({
1521
+ message,
1522
+ password
1523
+ }) {
1524
+ const { value } = await inquirer.prompt([
1525
+ { type: password ? "password" : "input", name: "value", message }
1526
+ ]);
1527
+ return value;
1528
+ }
1529
+ async function answerSelect(question, field) {
1530
+ const display = (c) => c.hint ? `${c.label} ${chalk.dim(`(${c.hint})`)}` : c.label;
1531
+ if (question.multiple) {
1532
+ const choices = [
1533
+ ...question.choices.map((c) => ({ name: display(c), value: c.value })),
1534
+ ...offers(question, "more") ? [
1535
+ {
1536
+ name: chalk.dim("Load more\u2026"),
1537
+ value: { action: "more" }
1538
+ }
1539
+ ] : [],
1540
+ ...(question.notes ?? []).map((note) => ({
1541
+ name: chalk.dim(note),
1542
+ value: note,
1543
+ disabled: true
1544
+ }))
1545
+ ];
1546
+ const { values } = await inquirer.prompt([
1547
+ { type: "checkbox", name: "values", message: question.message, choices }
1548
+ ]);
1549
+ const selected = values;
1550
+ if (selected.some(isActionRow)) return { type: "more" };
1551
+ if (selected.length === 0 && offers(question, "skip")) {
1552
+ return { type: "skip" };
1553
+ }
1554
+ return { type: "choose", value: selected };
1555
+ }
1556
+ const row = (name, action) => ({
1557
+ name,
1558
+ value: { action }
1559
+ });
1560
+ const value = await search({
1561
+ message: question.message,
1562
+ source: (term) => {
1563
+ const t = (term ?? "").trim().toLowerCase();
1564
+ const matched = t ? question.choices.filter(
1565
+ (c) => `${c.label} ${c.hint ?? ""}`.toLowerCase().includes(t)
1566
+ ) : question.choices;
1567
+ const rows = matched.map((c) => ({
1568
+ name: display(c),
1569
+ value: c.value
1570
+ }));
1571
+ if (offers(question, "search"))
1572
+ rows.push(row(chalk.cyan("Search\u2026"), "search"));
1573
+ if (offers(question, "more"))
1574
+ rows.push(row(chalk.dim("Load more\u2026"), "more"));
1575
+ if (offers(question, "custom"))
1576
+ rows.push(row(chalk.dim("Enter a value manually\u2026"), "custom"));
1577
+ if (offers(question, "retry"))
1578
+ rows.push(row(chalk.yellow("Retry"), "retry"));
1579
+ if (offers(question, "skip"))
1580
+ rows.push(row(chalk.dim("Skip (optional)"), "skip"));
1581
+ if (offers(question, "cancel"))
1582
+ rows.push(row(chalk.dim("Cancel"), "cancel"));
1583
+ for (const note of question.notes ?? [])
1584
+ rows.push({ name: chalk.dim(note), value: note, disabled: true });
1585
+ return rows;
1586
+ }
1587
+ });
1588
+ if (!isActionRow(value)) {
1589
+ return { type: "choose", value };
1590
+ }
1591
+ switch (value.action) {
1592
+ case "search": {
1593
+ const term = await promptText({
1594
+ message: `Search ${field}:`,
1595
+ password: false
1596
+ });
1597
+ return { type: "search", term };
1598
+ }
1599
+ case "custom": {
1600
+ const custom = await promptText({
1601
+ message: `Enter ${field}:`,
1602
+ password: false
1603
+ });
1604
+ return { type: "custom", value: custom };
1605
+ }
1606
+ case "more":
1607
+ return { type: "more" };
1608
+ case "retry":
1609
+ return { type: "retry" };
1610
+ case "skip":
1611
+ return { type: "skip" };
1612
+ case "cancel":
1613
+ return { type: "cancel" };
1614
+ }
1615
+ }
1616
+ async function answerInput(question) {
1617
+ const value = await promptText({
1618
+ message: question.message,
1619
+ password: question.inputType === "password"
1620
+ });
1621
+ if (value === "" && offers(question, "skip")) {
1622
+ return { type: "skip" };
1623
+ }
1624
+ return { type: "custom", value };
1625
+ }
1626
+ async function answerCollection(question) {
1627
+ if (!offers(question, "done")) {
1628
+ return { type: "add" };
1629
+ }
1630
+ const { again } = await inquirer.prompt([
1631
+ {
1632
+ type: "confirm",
1633
+ name: "again",
1634
+ message: question.message,
1635
+ default: false
1636
+ }
1637
+ ]);
1638
+ return again ? { type: "add" } : { type: "done" };
1639
+ }
1640
+ var answerViaCli = ({ state, result }) => {
1641
+ if (result.error !== void 0) {
1642
+ const message = typeof result.error === "string" ? result.error : result.error.message;
1643
+ console.log(chalk.yellow(`! ${message}`));
1644
+ }
1645
+ const field = state.current?.join(".") ?? "value";
1646
+ const question = result.question;
1647
+ switch (question.type) {
1648
+ case "select":
1649
+ return answerSelect(question, field);
1650
+ case "input":
1651
+ return answerInput(question);
1652
+ case "collection":
1653
+ return answerCollection(question);
1654
+ }
1655
+ };
1514
1656
 
1515
1657
  // src/utils/cli-options.ts
1516
1658
  var RESERVED_CLI_OPTIONS = [
@@ -1542,7 +1684,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1542
1684
 
1543
1685
  // package.json
1544
1686
  var package_default = {
1545
- version: "0.61.0"};
1687
+ version: "0.61.1"};
1546
1688
 
1547
1689
  // src/telemetry/builders.ts
1548
1690
  function createCliBaseEvent(context = {}) {
@@ -1617,7 +1759,7 @@ async function formatItemsFromSchema(_functionInfo, items, startingNumber = 0, o
1617
1759
  if (options?.formatter) {
1618
1760
  const formatter = options.formatter;
1619
1761
  const input = options.input ?? {};
1620
- const context = formatter.fetchContext ? await formatter.fetchContext({ items, input }) : void 0;
1762
+ const context = formatter.getContext ? await formatter.getContext({ items, input }) : void 0;
1621
1763
  items.forEach((item, index) => {
1622
1764
  const formatted = formatter.format({ item, input, context });
1623
1765
  formatSingleItem(formatted, startingNumber + index);
@@ -2212,7 +2354,7 @@ function analyzeZodField(name, schema, functionInfo) {
2212
2354
  paramType = "object";
2213
2355
  }
2214
2356
  let paramHasResolver = false;
2215
- if (functionInfo?.resolvers?.[name]) {
2357
+ if (functionInfo?.resolvers?.[name] || functionInfo?.boundResolvers?.[name]) {
2216
2358
  paramHasResolver = true;
2217
2359
  }
2218
2360
  return {
@@ -2371,6 +2513,9 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
2371
2513
  const usesInputParameters = !functionInfo.inputSchema && !!functionInfo.inputParameters;
2372
2514
  const schema = functionInfo.inputSchema;
2373
2515
  const parameters = usesInputParameters ? analyzeInputParameters(functionInfo.inputParameters, functionInfo) : analyzeZodSchema(schema, functionInfo);
2516
+ if (functionInfo.boundResolvers && Object.keys(functionInfo.boundResolvers).length > 0) {
2517
+ for (const param of parameters) param.hasResolver = true;
2518
+ }
2374
2519
  const schemaAliases = getSchemaAliases(schema);
2375
2520
  if (schemaAliases) {
2376
2521
  const aliasedNames = new Set(Object.keys(schemaAliases));
@@ -2423,7 +2568,35 @@ function createCommandConfig(cliCommandName, functionInfo, sdk) {
2423
2568
  }
2424
2569
  }
2425
2570
  }
2426
- if (schema && !usesInputParameters) {
2571
+ const boundResolvers = functionInfo.boundResolvers;
2572
+ if (boundResolvers && Object.keys(boundResolvers).length > 0) {
2573
+ const seedInput = Object.fromEntries(
2574
+ Object.entries(rawParams).filter(([, v]) => v !== void 0)
2575
+ );
2576
+ const controller = createController(sdk);
2577
+ let resolved;
2578
+ try {
2579
+ resolved = await controller.resolve({
2580
+ method: functionInfo.name,
2581
+ input: seedInput,
2582
+ answer: interactiveMode ? answerViaCli : ({ state }) => {
2583
+ throw new ZapierCliMissingParametersError([
2584
+ {
2585
+ name: state.current?.join(".") ?? "value",
2586
+ isPositional: false
2587
+ }
2588
+ ]);
2589
+ },
2590
+ interactive: interactiveMode
2591
+ });
2592
+ } catch (err) {
2593
+ if (err instanceof CoreCancelledSignal) {
2594
+ throw new ZapierCliUserCancellationError();
2595
+ }
2596
+ throw err;
2597
+ }
2598
+ Object.assign(resolvedParams, resolved);
2599
+ } else if (schema && !usesInputParameters) {
2427
2600
  const resolver = new SchemaParameterResolver();
2428
2601
  const resolved = await resolver.resolveParameters(
2429
2602
  schema,
@@ -2516,7 +2689,7 @@ ${confirmMessageAfter}`));
2516
2689
  }
2517
2690
  }
2518
2691
  } catch (error) {
2519
- success = false;
2692
+ success = error instanceof ZapierCliError ? error.exitCode === 0 : false;
2520
2693
  errorMessage = error instanceof Error ? error.message : String(error);
2521
2694
  if (error instanceof ZapierCliMissingParametersError) {
2522
2695
  renderer.renderError(error);
@@ -7395,7 +7568,7 @@ function buildBoxLines(message) {
7395
7568
  // package.json with { type: 'json' }
7396
7569
  var package_default2 = {
7397
7570
  name: "@zapier/zapier-sdk-cli",
7398
- version: "0.61.0"};
7571
+ version: "0.61.1"};
7399
7572
 
7400
7573
  // src/sdk.ts
7401
7574
  injectCliLogin(login_exports);
@@ -7472,6 +7645,9 @@ function createZapierCliSdk2(options = {}) {
7472
7645
 
7473
7646
  // src/utils/extensions.ts
7474
7647
  var ENV_VAR = "ZAPIER_SDK_EXTENSIONS";
7648
+ function isModelPlugin(value) {
7649
+ return typeof value === "object" && value !== null && "pluginType" in value && typeof value.pluginType === "string";
7650
+ }
7475
7651
  async function resolveExtensions() {
7476
7652
  const seen = /* @__PURE__ */ new Set();
7477
7653
  const specs = readEnvSpecs().filter((spec) => {
@@ -7504,8 +7680,11 @@ function normalizeExtension(exported) {
7504
7680
  if (typeof exported === "function") {
7505
7681
  return [exported];
7506
7682
  }
7683
+ if (isModelPlugin(exported)) {
7684
+ return [exported];
7685
+ }
7507
7686
  if (Array.isArray(exported)) {
7508
- if (exported.every((e) => typeof e === "function")) {
7687
+ if (exported.every((e) => typeof e === "function" || isModelPlugin(e))) {
7509
7688
  return exported;
7510
7689
  }
7511
7690
  return null;
@@ -4740,7 +4740,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
4740
4740
  // package.json with { type: 'json' }
4741
4741
  var package_default = {
4742
4742
  name: "@zapier/zapier-sdk-cli",
4743
- version: "0.61.0"};
4743
+ version: "0.61.1"};
4744
4744
 
4745
4745
  // src/experimental.ts
4746
4746
  experimental.injectCliLogin(login_exports);
@@ -1,5 +1,5 @@
1
- import { ZapierSdkOptions, Plugin, PluginProvides } from '@zapier/zapier-sdk/experimental';
2
- import { Z as ZapierSdkCli } from './sdk-SOLizjno.mjs';
1
+ import { ZapierSdkOptions } from '@zapier/zapier-sdk/experimental';
2
+ import { E as Extension, Z as ZapierSdkCli } from './extensions-DXyB9Vsr.mjs';
3
3
  import '@zapier/zapier-sdk';
4
4
  import 'zod';
5
5
 
@@ -27,7 +27,7 @@ interface ZapierCliSdkOptions extends ZapierSdkOptions {
27
27
  * CLI plugins, so its functions appear in `getRegistry({ package: "cli" })`
28
28
  * automatically.
29
29
  */
30
- extensions?: Plugin<unknown, PluginProvides>[];
30
+ extensions?: Extension[];
31
31
  }
32
32
  /**
33
33
  * Create a Zapier CLI SDK with experimental plugins registered. The
@@ -1,5 +1,5 @@
1
- import { ZapierSdkOptions, Plugin, PluginProvides } from '@zapier/zapier-sdk/experimental';
2
- import { Z as ZapierSdkCli } from './sdk-SOLizjno.js';
1
+ import { ZapierSdkOptions } from '@zapier/zapier-sdk/experimental';
2
+ import { E as Extension, Z as ZapierSdkCli } from './extensions-DXyB9Vsr.js';
3
3
  import '@zapier/zapier-sdk';
4
4
  import 'zod';
5
5
 
@@ -27,7 +27,7 @@ interface ZapierCliSdkOptions extends ZapierSdkOptions {
27
27
  * CLI plugins, so its functions appear in `getRegistry({ package: "cli" })`
28
28
  * automatically.
29
29
  */
30
- extensions?: Plugin<unknown, PluginProvides>[];
30
+ extensions?: Extension[];
31
31
  }
32
32
  /**
33
33
  * Create a Zapier CLI SDK with experimental plugins registered. The
@@ -4704,7 +4704,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
4704
4704
  // package.json with { type: 'json' }
4705
4705
  var package_default = {
4706
4706
  name: "@zapier/zapier-sdk-cli",
4707
- version: "0.61.0"};
4707
+ version: "0.61.1"};
4708
4708
 
4709
4709
  // src/experimental.ts
4710
4710
  injectCliLogin(login_exports);
@@ -1,5 +1,5 @@
1
1
  import * as _zapier_zapier_sdk from '@zapier/zapier-sdk';
2
- import { AppItem, Manifest, ResolvedCredentials, ApiClient, ZapierSdk } from '@zapier/zapier-sdk';
2
+ import { AppItem, Manifest, ResolvedCredentials, ApiClient, ZapierSdk, Plugin, PluginProvides } from '@zapier/zapier-sdk';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const BuildManifestSchema: z.ZodObject<{
@@ -551,4 +551,13 @@ type SignupPluginProvides = ReturnType<typeof signupPlugin>;
551
551
 
552
552
  type ZapierSdkCli = ZapierSdk & BuildManifestPluginProvides & FeedbackPluginProvides & GenerateAppTypesPluginProvides & SignupPluginProvides;
553
553
 
554
- export type { ZapierSdkCli as Z };
554
+ /** A new-model plugin descriptor (from `defineMethod` / `definePlugin` /
555
+ * `defineResolver` etc.), identified by its `pluginType` discriminant. */
556
+ interface ModelPlugin {
557
+ readonly pluginType: string;
558
+ }
559
+ /** An extension is either a legacy function plugin or a new-model plugin
560
+ * descriptor; `addPlugin` accepts both. */
561
+ type Extension = Plugin<unknown, PluginProvides> | ModelPlugin;
562
+
563
+ export type { Extension as E, ZapierSdkCli as Z };
@@ -1,5 +1,5 @@
1
1
  import * as _zapier_zapier_sdk from '@zapier/zapier-sdk';
2
- import { AppItem, Manifest, ResolvedCredentials, ApiClient, ZapierSdk } from '@zapier/zapier-sdk';
2
+ import { AppItem, Manifest, ResolvedCredentials, ApiClient, ZapierSdk, Plugin, PluginProvides } from '@zapier/zapier-sdk';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const BuildManifestSchema: z.ZodObject<{
@@ -551,4 +551,13 @@ type SignupPluginProvides = ReturnType<typeof signupPlugin>;
551
551
 
552
552
  type ZapierSdkCli = ZapierSdk & BuildManifestPluginProvides & FeedbackPluginProvides & GenerateAppTypesPluginProvides & SignupPluginProvides;
553
553
 
554
- export type { ZapierSdkCli as Z };
554
+ /** A new-model plugin descriptor (from `defineMethod` / `definePlugin` /
555
+ * `defineResolver` etc.), identified by its `pluginType` discriminant. */
556
+ interface ModelPlugin {
557
+ readonly pluginType: string;
558
+ }
559
+ /** An extension is either a legacy function plugin or a new-model plugin
560
+ * descriptor; `addPlugin` accepts both. */
561
+ type Extension = Plugin<unknown, PluginProvides> | ModelPlugin;
562
+
563
+ export type { Extension as E, ZapierSdkCli as Z };
package/dist/index.cjs CHANGED
@@ -4739,7 +4739,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
4739
4739
  // package.json with { type: 'json' }
4740
4740
  var package_default = {
4741
4741
  name: "@zapier/zapier-sdk-cli",
4742
- version: "0.61.0"};
4742
+ version: "0.61.1"};
4743
4743
 
4744
4744
  // src/sdk.ts
4745
4745
  zapierSdk.injectCliLogin(login_exports);
@@ -4779,7 +4779,7 @@ function createZapierCliSdk(options = {}) {
4779
4779
 
4780
4780
  // package.json
4781
4781
  var package_default2 = {
4782
- version: "0.61.0"};
4782
+ version: "0.61.1"};
4783
4783
 
4784
4784
  // src/telemetry/builders.ts
4785
4785
  function createCliBaseEvent(context = {}) {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { ZapierSdkOptions, Plugin, PluginProvides, BaseEvent } from '@zapier/zapier-sdk';
2
- import { Z as ZapierSdkCli } from './sdk-SOLizjno.mjs';
1
+ import { ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
2
+ import { E as Extension, Z as ZapierSdkCli } from './extensions-DXyB9Vsr.mjs';
3
3
  import 'zod';
4
4
 
5
5
  interface ZapierCliSdkOptions extends ZapierSdkOptions {
@@ -10,7 +10,7 @@ interface ZapierCliSdkOptions extends ZapierSdkOptions {
10
10
  * CLI plugins, so its functions appear in `getRegistry({ package: "cli" })`
11
11
  * automatically.
12
12
  */
13
- extensions?: Plugin<unknown, PluginProvides>[];
13
+ extensions?: Extension[];
14
14
  }
15
15
  /**
16
16
  * Create a Zapier SDK instance configured specifically for the CLI
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ZapierSdkOptions, Plugin, PluginProvides, BaseEvent } from '@zapier/zapier-sdk';
2
- import { Z as ZapierSdkCli } from './sdk-SOLizjno.js';
1
+ import { ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
2
+ import { E as Extension, Z as ZapierSdkCli } from './extensions-DXyB9Vsr.js';
3
3
  import 'zod';
4
4
 
5
5
  interface ZapierCliSdkOptions extends ZapierSdkOptions {
@@ -10,7 +10,7 @@ interface ZapierCliSdkOptions extends ZapierSdkOptions {
10
10
  * CLI plugins, so its functions appear in `getRegistry({ package: "cli" })`
11
11
  * automatically.
12
12
  */
13
- extensions?: Plugin<unknown, PluginProvides>[];
13
+ extensions?: Extension[];
14
14
  }
15
15
  /**
16
16
  * Create a Zapier SDK instance configured specifically for the CLI
package/dist/index.mjs CHANGED
@@ -4703,7 +4703,7 @@ function collectDeprecationNoticeAndForward(event, onEvent) {
4703
4703
  // package.json with { type: 'json' }
4704
4704
  var package_default = {
4705
4705
  name: "@zapier/zapier-sdk-cli",
4706
- version: "0.61.0"};
4706
+ version: "0.61.1"};
4707
4707
 
4708
4708
  // src/sdk.ts
4709
4709
  injectCliLogin(login_exports);
@@ -4743,7 +4743,7 @@ function createZapierCliSdk(options = {}) {
4743
4743
 
4744
4744
  // package.json
4745
4745
  var package_default2 = {
4746
- version: "0.61.0"};
4746
+ version: "0.61.1"};
4747
4747
 
4748
4748
  // src/telemetry/builders.ts
4749
4749
  function createCliBaseEvent(context = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.61.0",
3
+ "version": "0.61.1",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -95,8 +95,8 @@
95
95
  "typescript": "^5.8.3",
96
96
  "wrap-ansi": "^10.0.0",
97
97
  "zod": "4.3.6",
98
- "@zapier/zapier-sdk": "0.79.0",
99
- "@zapier/zapier-sdk-mcp": "0.16.0"
98
+ "@zapier/zapier-sdk": "0.80.0",
99
+ "@zapier/zapier-sdk-mcp": "0.16.1"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@types/express": "^5.0.3",