@zapier/zapier-sdk-cli 0.13.1 → 0.13.3

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,23 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.13.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 53fa85e: Show id and key properties when listing actions. Allow getAction to use an id or key. Make runAction pass action_id to API to ensure it always works.
8
+ - Updated dependencies [53fa85e]
9
+ - @zapier/zapier-sdk@0.13.3
10
+ - @zapier/zapier-sdk-mcp@0.3.16
11
+
12
+ ## 0.13.2
13
+
14
+ ### Patch Changes
15
+
16
+ - 325d5c2: Fix bug where adding apps with dashed slugs would create types with syntax errors. All valid keys are now valid properties on the apps interface.
17
+ - Updated dependencies [325d5c2]
18
+ - @zapier/zapier-sdk@0.13.2
19
+ - @zapier/zapier-sdk-mcp@0.3.15
20
+
3
21
  ## 0.13.1
4
22
 
5
23
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -626,12 +626,18 @@ function formatItemsFromSchema(functionInfo, items, startingNumber = 0) {
626
626
  }
627
627
  function formatSingleItem(formatted, itemNumber) {
628
628
  let titleLine = `${chalk3__default.default.gray(`${itemNumber + 1}.`)} ${chalk3__default.default.cyan(formatted.title)}`;
629
- if (formatted.id) {
630
- titleLine += ` ${chalk3__default.default.gray(`(ID: ${formatted.id})`)}`;
631
- } else if (formatted.keys) {
632
- titleLine += ` ${chalk3__default.default.gray(`(${formatted.keys.join(", ")})`)}`;
629
+ const subtitleParts = [];
630
+ if (formatted.keys) {
631
+ subtitleParts.push(...formatted.keys);
633
632
  } else if (formatted.key) {
634
- titleLine += ` ${chalk3__default.default.gray(`(${formatted.key})`)}`;
633
+ subtitleParts.push(formatted.key);
634
+ }
635
+ if (formatted.id) {
636
+ subtitleParts.push(formatted.id);
637
+ }
638
+ const uniqueParts = [...new Set(subtitleParts)];
639
+ if (uniqueParts.length > 0) {
640
+ titleLine += ` ${chalk3__default.default.gray(`(${uniqueParts.join(", ")})`)}`;
635
641
  }
636
642
  console.log(titleLine);
637
643
  if (formatted.description) {
@@ -1604,21 +1610,17 @@ var AstTypeGenerator = class {
1604
1610
  * Generate TypeScript types using AST for a specific app
1605
1611
  */
1606
1612
  async generateTypes(options) {
1607
- const { appKey, authenticationId, sdk: sdk2 } = options;
1608
- const { app, version } = this.parseAppIdentifier(appKey);
1613
+ const { app, authenticationId, sdk: sdk2 } = options;
1609
1614
  const actionsResult = await sdk2.listActions({
1610
- appKey: app
1615
+ appKey: app.implementation_id
1611
1616
  });
1612
1617
  const actions = actionsResult.data;
1613
- if (actions.length === 0) {
1614
- return this.generateEmptyTypesFile(app, version);
1615
- }
1616
1618
  const actionsWithFields = [];
1617
1619
  if (authenticationId) {
1618
1620
  for (const action of actions) {
1619
1621
  try {
1620
1622
  const fieldsResult = await sdk2.listInputFields({
1621
- appKey,
1623
+ appKey: app.implementation_id,
1622
1624
  actionKey: action.key,
1623
1625
  actionType: action.action_type,
1624
1626
  authenticationId
@@ -1644,7 +1646,7 @@ var AstTypeGenerator = class {
1644
1646
  ...action,
1645
1647
  inputFields: [],
1646
1648
  name: action.title || action.key,
1647
- app_key: action.app_key || appKey,
1649
+ app_key: action.app_key || app.implementation_id,
1648
1650
  action_type: action.action_type || "write",
1649
1651
  title: action.title || action.key,
1650
1652
  type: "action",
@@ -1653,20 +1655,15 @@ var AstTypeGenerator = class {
1653
1655
  }
1654
1656
  );
1655
1657
  }
1656
- const sourceFile = this.createSourceFile(app, actionsWithFields, version);
1658
+ const sourceFile = this.createSourceFile(app, actionsWithFields);
1657
1659
  return this.printer.printFile(sourceFile);
1658
1660
  }
1659
- parseAppIdentifier(identifier) {
1660
- const parts = identifier.split("@");
1661
- return {
1662
- app: parts[0],
1663
- version: parts[1]
1664
- };
1665
- }
1666
- createSourceFile(appKey, actions, version) {
1667
- const appName = this.capitalize(appKey);
1668
- const versionComment = version ? ` * Generated for ${appKey}@${version}` : ` * Generated for ${appKey}`;
1669
- const headerComment = `Auto-generated TypeScript types for Zapier ${appKey} actions
1661
+ createSourceFile(app, actions) {
1662
+ const appName = this.getPreferredAppName(app);
1663
+ const versionComment = ` * Generated for ${app.implementation_id}`;
1664
+ const preferredKey = this.getPreferredProgrammaticKey(app);
1665
+ const myVariableName = `my${appName}`;
1666
+ const headerComment = `Auto-generated TypeScript types for Zapier ${app.key} actions
1670
1667
  ${versionComment.slice(3)}
1671
1668
  Generated on: ${(/* @__PURE__ */ new Date()).toISOString()}
1672
1669
 
@@ -1678,11 +1675,11 @@ Usage:
1678
1675
 
1679
1676
  const zapier = createZapierSdk();
1680
1677
  // Types are automatically available:
1681
- await zapier.apps.${appKey}.search.user_by_email({ authenticationId: 123, inputs: { email } })
1678
+ await zapier.apps.${preferredKey}.search.user_by_email({ authenticationId: 123, inputs: { email } })
1682
1679
 
1683
1680
  // Factory usage (pinned auth):
1684
- const my${appName} = zapier.apps.${appKey}({ authenticationId: 123 })
1685
- await my${appName}.search.user_by_email({ inputs: { email } })`;
1681
+ const ${myVariableName} = zapier.apps.${preferredKey}({ authenticationId: 123 })
1682
+ await ${myVariableName}.search.user_by_email({ inputs: { email } })`;
1686
1683
  const statements = [
1687
1684
  // Import the SDK to activate module augmentation
1688
1685
  this.createImportStatement(["@zapier/zapier-sdk"]),
@@ -1720,7 +1717,8 @@ Usage:
1720
1717
  statements.push(appFactoryInterface);
1721
1718
  const appWithFactoryType = this.createAppWithFactoryType(appName);
1722
1719
  statements.push(appWithFactoryType);
1723
- const moduleAugmentation = this.createModuleAugmentation(appKey, appName);
1720
+ const allKeys = this.getAllKeys(app);
1721
+ const moduleAugmentation = this.createModuleAugmentation(allKeys, appName);
1724
1722
  statements.push(moduleAugmentation);
1725
1723
  statements.push(
1726
1724
  this.factory.createExportDeclaration(
@@ -2046,7 +2044,15 @@ Usage:
2046
2044
  ])
2047
2045
  );
2048
2046
  }
2049
- createModuleAugmentation(appKey, appName) {
2047
+ createModuleAugmentation(appKeys, appName) {
2048
+ const properties = appKeys.map(
2049
+ (appKey) => this.factory.createPropertySignature(
2050
+ void 0,
2051
+ this.createPropertyName(appKey),
2052
+ void 0,
2053
+ this.factory.createTypeReferenceNode(`${appName}AppWithFactory`)
2054
+ )
2055
+ );
2050
2056
  return this.factory.createModuleDeclaration(
2051
2057
  [this.factory.createToken(ts__namespace.SyntaxKind.DeclareKeyword)],
2052
2058
  this.factory.createStringLiteral("@zapier/zapier-sdk"),
@@ -2056,14 +2062,7 @@ Usage:
2056
2062
  "ZapierSdkApps",
2057
2063
  void 0,
2058
2064
  void 0,
2059
- [
2060
- this.factory.createPropertySignature(
2061
- void 0,
2062
- appKey,
2063
- void 0,
2064
- this.factory.createTypeReferenceNode(`${appName}AppWithFactory`)
2065
- )
2066
- ]
2065
+ properties
2067
2066
  )
2068
2067
  ])
2069
2068
  );
@@ -2101,38 +2100,6 @@ Usage:
2101
2100
  ]);
2102
2101
  }
2103
2102
  }
2104
- generateEmptyTypesFile(appKey, version) {
2105
- const appName = this.capitalize(appKey);
2106
- const versionComment = version ? ` * Generated for ${appKey}@${version}` : ` * Generated for ${appKey}`;
2107
- return `/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any */
2108
- /**
2109
- * Auto-generated TypeScript types for Zapier ${appKey} actions
2110
- ${versionComment}
2111
- * Generated on: ${(/* @__PURE__ */ new Date()).toISOString()}
2112
- *
2113
- * No actions found for this app.
2114
- */
2115
-
2116
- import type { ActionExecutionOptions, ActionExecutionResult, ZapierFetchInitOptions } from '@zapier/zapier-sdk'
2117
-
2118
- interface ${appName}AppProxy {
2119
- /** Make authenticated HTTP requests through Zapier's Relay service */
2120
- fetch: (url: string | URL, init?: ZapierFetchInitOptions) => Promise<Response>
2121
- }
2122
-
2123
- interface ${appName}AppFactory {
2124
- (options: { authenticationId: number }): ${appName}AppProxy
2125
- }
2126
-
2127
- type ${appName}AppWithFactory = ${appName}AppFactory & ${appName}AppProxy
2128
-
2129
- declare module "@zapier/zapier-sdk" {
2130
- interface ZapierSdkApps {
2131
- ${appKey}: ${appName}AppWithFactory
2132
- }
2133
- }
2134
- `;
2135
- }
2136
2103
  capitalize(str) {
2137
2104
  return str.charAt(0).toUpperCase() + str.slice(1).replace(/[-_]/g, "");
2138
2105
  }
@@ -2153,6 +2120,50 @@ declare module "@zapier/zapier-sdk" {
2153
2120
  escapeComment(comment) {
2154
2121
  return comment.replace(/\*\//g, "*\\/").replace(/\r?\n/g, " ");
2155
2122
  }
2123
+ createPropertyName(name) {
2124
+ if (this.isValidIdentifier(name)) {
2125
+ return this.factory.createIdentifier(name);
2126
+ } else {
2127
+ return this.factory.createStringLiteral(name);
2128
+ }
2129
+ }
2130
+ isValidIdentifier(name) {
2131
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
2132
+ }
2133
+ getPreferredProgrammaticKey(app) {
2134
+ if (app.slug) {
2135
+ const snakeCaseSlug = zapierSdk.toSnakeCase(app.slug);
2136
+ if (this.isValidIdentifier(snakeCaseSlug)) {
2137
+ return snakeCaseSlug;
2138
+ }
2139
+ }
2140
+ if (this.isValidIdentifier(app.key)) {
2141
+ return app.key;
2142
+ }
2143
+ return this.sanitizeToIdentifier(app.key);
2144
+ }
2145
+ getPreferredAppName(app) {
2146
+ const preferredKey = this.getPreferredProgrammaticKey(app);
2147
+ if (preferredKey.includes("_")) {
2148
+ return preferredKey.split("_").map((word) => this.capitalize(word.toLowerCase())).join("");
2149
+ }
2150
+ return this.capitalize(preferredKey);
2151
+ }
2152
+ sanitizeToIdentifier(name) {
2153
+ let sanitized = name.replace(/[^a-zA-Z0-9_$]/g, "_");
2154
+ if (/^[0-9]/.test(sanitized)) {
2155
+ sanitized = "_" + sanitized;
2156
+ }
2157
+ return sanitized;
2158
+ }
2159
+ getAllKeys(app) {
2160
+ const allKeys = /* @__PURE__ */ new Set([app.key]);
2161
+ if (app.slug) {
2162
+ allKeys.add(app.slug);
2163
+ allKeys.add(zapierSdk.toSnakeCase(app.slug));
2164
+ }
2165
+ return Array.from(allKeys);
2166
+ }
2156
2167
  };
2157
2168
  async function detectTypesOutputDirectory() {
2158
2169
  const candidates = ["src", "lib"];
@@ -2237,7 +2248,7 @@ var addPlugin = ({ sdk: sdk2, context }) => {
2237
2248
  try {
2238
2249
  const generator = new AstTypeGenerator();
2239
2250
  const typeDefinitions = await generator.generateTypes({
2240
- appKey: manifestKey,
2251
+ app,
2241
2252
  authenticationId,
2242
2253
  sdk: sdk2
2243
2254
  });
@@ -2284,7 +2295,7 @@ function createZapierCliSdk(options = {}) {
2284
2295
 
2285
2296
  // package.json
2286
2297
  var package_default = {
2287
- version: "0.13.1"};
2298
+ version: "0.13.3"};
2288
2299
 
2289
2300
  // src/cli.ts
2290
2301
  var program = new commander.Command();
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import { z } from 'zod';
4
- import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, createZapierSdkWithoutRegistry, registryPlugin, ZapierError, formatErrorMessage, isPositional } from '@zapier/zapier-sdk';
4
+ import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, createZapierSdkWithoutRegistry, registryPlugin, toSnakeCase, ZapierError, formatErrorMessage, isPositional } from '@zapier/zapier-sdk';
5
5
  import inquirer from 'inquirer';
6
6
  import chalk3 from 'chalk';
7
7
  import util from 'util';
@@ -593,12 +593,18 @@ function formatItemsFromSchema(functionInfo, items, startingNumber = 0) {
593
593
  }
594
594
  function formatSingleItem(formatted, itemNumber) {
595
595
  let titleLine = `${chalk3.gray(`${itemNumber + 1}.`)} ${chalk3.cyan(formatted.title)}`;
596
- if (formatted.id) {
597
- titleLine += ` ${chalk3.gray(`(ID: ${formatted.id})`)}`;
598
- } else if (formatted.keys) {
599
- titleLine += ` ${chalk3.gray(`(${formatted.keys.join(", ")})`)}`;
596
+ const subtitleParts = [];
597
+ if (formatted.keys) {
598
+ subtitleParts.push(...formatted.keys);
600
599
  } else if (formatted.key) {
601
- titleLine += ` ${chalk3.gray(`(${formatted.key})`)}`;
600
+ subtitleParts.push(formatted.key);
601
+ }
602
+ if (formatted.id) {
603
+ subtitleParts.push(formatted.id);
604
+ }
605
+ const uniqueParts = [...new Set(subtitleParts)];
606
+ if (uniqueParts.length > 0) {
607
+ titleLine += ` ${chalk3.gray(`(${uniqueParts.join(", ")})`)}`;
602
608
  }
603
609
  console.log(titleLine);
604
610
  if (formatted.description) {
@@ -1571,21 +1577,17 @@ var AstTypeGenerator = class {
1571
1577
  * Generate TypeScript types using AST for a specific app
1572
1578
  */
1573
1579
  async generateTypes(options) {
1574
- const { appKey, authenticationId, sdk: sdk2 } = options;
1575
- const { app, version } = this.parseAppIdentifier(appKey);
1580
+ const { app, authenticationId, sdk: sdk2 } = options;
1576
1581
  const actionsResult = await sdk2.listActions({
1577
- appKey: app
1582
+ appKey: app.implementation_id
1578
1583
  });
1579
1584
  const actions = actionsResult.data;
1580
- if (actions.length === 0) {
1581
- return this.generateEmptyTypesFile(app, version);
1582
- }
1583
1585
  const actionsWithFields = [];
1584
1586
  if (authenticationId) {
1585
1587
  for (const action of actions) {
1586
1588
  try {
1587
1589
  const fieldsResult = await sdk2.listInputFields({
1588
- appKey,
1590
+ appKey: app.implementation_id,
1589
1591
  actionKey: action.key,
1590
1592
  actionType: action.action_type,
1591
1593
  authenticationId
@@ -1611,7 +1613,7 @@ var AstTypeGenerator = class {
1611
1613
  ...action,
1612
1614
  inputFields: [],
1613
1615
  name: action.title || action.key,
1614
- app_key: action.app_key || appKey,
1616
+ app_key: action.app_key || app.implementation_id,
1615
1617
  action_type: action.action_type || "write",
1616
1618
  title: action.title || action.key,
1617
1619
  type: "action",
@@ -1620,20 +1622,15 @@ var AstTypeGenerator = class {
1620
1622
  }
1621
1623
  );
1622
1624
  }
1623
- const sourceFile = this.createSourceFile(app, actionsWithFields, version);
1625
+ const sourceFile = this.createSourceFile(app, actionsWithFields);
1624
1626
  return this.printer.printFile(sourceFile);
1625
1627
  }
1626
- parseAppIdentifier(identifier) {
1627
- const parts = identifier.split("@");
1628
- return {
1629
- app: parts[0],
1630
- version: parts[1]
1631
- };
1632
- }
1633
- createSourceFile(appKey, actions, version) {
1634
- const appName = this.capitalize(appKey);
1635
- const versionComment = version ? ` * Generated for ${appKey}@${version}` : ` * Generated for ${appKey}`;
1636
- const headerComment = `Auto-generated TypeScript types for Zapier ${appKey} actions
1628
+ createSourceFile(app, actions) {
1629
+ const appName = this.getPreferredAppName(app);
1630
+ const versionComment = ` * Generated for ${app.implementation_id}`;
1631
+ const preferredKey = this.getPreferredProgrammaticKey(app);
1632
+ const myVariableName = `my${appName}`;
1633
+ const headerComment = `Auto-generated TypeScript types for Zapier ${app.key} actions
1637
1634
  ${versionComment.slice(3)}
1638
1635
  Generated on: ${(/* @__PURE__ */ new Date()).toISOString()}
1639
1636
 
@@ -1645,11 +1642,11 @@ Usage:
1645
1642
 
1646
1643
  const zapier = createZapierSdk();
1647
1644
  // Types are automatically available:
1648
- await zapier.apps.${appKey}.search.user_by_email({ authenticationId: 123, inputs: { email } })
1645
+ await zapier.apps.${preferredKey}.search.user_by_email({ authenticationId: 123, inputs: { email } })
1649
1646
 
1650
1647
  // Factory usage (pinned auth):
1651
- const my${appName} = zapier.apps.${appKey}({ authenticationId: 123 })
1652
- await my${appName}.search.user_by_email({ inputs: { email } })`;
1648
+ const ${myVariableName} = zapier.apps.${preferredKey}({ authenticationId: 123 })
1649
+ await ${myVariableName}.search.user_by_email({ inputs: { email } })`;
1653
1650
  const statements = [
1654
1651
  // Import the SDK to activate module augmentation
1655
1652
  this.createImportStatement(["@zapier/zapier-sdk"]),
@@ -1687,7 +1684,8 @@ Usage:
1687
1684
  statements.push(appFactoryInterface);
1688
1685
  const appWithFactoryType = this.createAppWithFactoryType(appName);
1689
1686
  statements.push(appWithFactoryType);
1690
- const moduleAugmentation = this.createModuleAugmentation(appKey, appName);
1687
+ const allKeys = this.getAllKeys(app);
1688
+ const moduleAugmentation = this.createModuleAugmentation(allKeys, appName);
1691
1689
  statements.push(moduleAugmentation);
1692
1690
  statements.push(
1693
1691
  this.factory.createExportDeclaration(
@@ -2013,7 +2011,15 @@ Usage:
2013
2011
  ])
2014
2012
  );
2015
2013
  }
2016
- createModuleAugmentation(appKey, appName) {
2014
+ createModuleAugmentation(appKeys, appName) {
2015
+ const properties = appKeys.map(
2016
+ (appKey) => this.factory.createPropertySignature(
2017
+ void 0,
2018
+ this.createPropertyName(appKey),
2019
+ void 0,
2020
+ this.factory.createTypeReferenceNode(`${appName}AppWithFactory`)
2021
+ )
2022
+ );
2017
2023
  return this.factory.createModuleDeclaration(
2018
2024
  [this.factory.createToken(ts.SyntaxKind.DeclareKeyword)],
2019
2025
  this.factory.createStringLiteral("@zapier/zapier-sdk"),
@@ -2023,14 +2029,7 @@ Usage:
2023
2029
  "ZapierSdkApps",
2024
2030
  void 0,
2025
2031
  void 0,
2026
- [
2027
- this.factory.createPropertySignature(
2028
- void 0,
2029
- appKey,
2030
- void 0,
2031
- this.factory.createTypeReferenceNode(`${appName}AppWithFactory`)
2032
- )
2033
- ]
2032
+ properties
2034
2033
  )
2035
2034
  ])
2036
2035
  );
@@ -2068,38 +2067,6 @@ Usage:
2068
2067
  ]);
2069
2068
  }
2070
2069
  }
2071
- generateEmptyTypesFile(appKey, version) {
2072
- const appName = this.capitalize(appKey);
2073
- const versionComment = version ? ` * Generated for ${appKey}@${version}` : ` * Generated for ${appKey}`;
2074
- return `/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any */
2075
- /**
2076
- * Auto-generated TypeScript types for Zapier ${appKey} actions
2077
- ${versionComment}
2078
- * Generated on: ${(/* @__PURE__ */ new Date()).toISOString()}
2079
- *
2080
- * No actions found for this app.
2081
- */
2082
-
2083
- import type { ActionExecutionOptions, ActionExecutionResult, ZapierFetchInitOptions } from '@zapier/zapier-sdk'
2084
-
2085
- interface ${appName}AppProxy {
2086
- /** Make authenticated HTTP requests through Zapier's Relay service */
2087
- fetch: (url: string | URL, init?: ZapierFetchInitOptions) => Promise<Response>
2088
- }
2089
-
2090
- interface ${appName}AppFactory {
2091
- (options: { authenticationId: number }): ${appName}AppProxy
2092
- }
2093
-
2094
- type ${appName}AppWithFactory = ${appName}AppFactory & ${appName}AppProxy
2095
-
2096
- declare module "@zapier/zapier-sdk" {
2097
- interface ZapierSdkApps {
2098
- ${appKey}: ${appName}AppWithFactory
2099
- }
2100
- }
2101
- `;
2102
- }
2103
2070
  capitalize(str) {
2104
2071
  return str.charAt(0).toUpperCase() + str.slice(1).replace(/[-_]/g, "");
2105
2072
  }
@@ -2120,6 +2087,50 @@ declare module "@zapier/zapier-sdk" {
2120
2087
  escapeComment(comment) {
2121
2088
  return comment.replace(/\*\//g, "*\\/").replace(/\r?\n/g, " ");
2122
2089
  }
2090
+ createPropertyName(name) {
2091
+ if (this.isValidIdentifier(name)) {
2092
+ return this.factory.createIdentifier(name);
2093
+ } else {
2094
+ return this.factory.createStringLiteral(name);
2095
+ }
2096
+ }
2097
+ isValidIdentifier(name) {
2098
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
2099
+ }
2100
+ getPreferredProgrammaticKey(app) {
2101
+ if (app.slug) {
2102
+ const snakeCaseSlug = toSnakeCase(app.slug);
2103
+ if (this.isValidIdentifier(snakeCaseSlug)) {
2104
+ return snakeCaseSlug;
2105
+ }
2106
+ }
2107
+ if (this.isValidIdentifier(app.key)) {
2108
+ return app.key;
2109
+ }
2110
+ return this.sanitizeToIdentifier(app.key);
2111
+ }
2112
+ getPreferredAppName(app) {
2113
+ const preferredKey = this.getPreferredProgrammaticKey(app);
2114
+ if (preferredKey.includes("_")) {
2115
+ return preferredKey.split("_").map((word) => this.capitalize(word.toLowerCase())).join("");
2116
+ }
2117
+ return this.capitalize(preferredKey);
2118
+ }
2119
+ sanitizeToIdentifier(name) {
2120
+ let sanitized = name.replace(/[^a-zA-Z0-9_$]/g, "_");
2121
+ if (/^[0-9]/.test(sanitized)) {
2122
+ sanitized = "_" + sanitized;
2123
+ }
2124
+ return sanitized;
2125
+ }
2126
+ getAllKeys(app) {
2127
+ const allKeys = /* @__PURE__ */ new Set([app.key]);
2128
+ if (app.slug) {
2129
+ allKeys.add(app.slug);
2130
+ allKeys.add(toSnakeCase(app.slug));
2131
+ }
2132
+ return Array.from(allKeys);
2133
+ }
2123
2134
  };
2124
2135
  async function detectTypesOutputDirectory() {
2125
2136
  const candidates = ["src", "lib"];
@@ -2204,7 +2215,7 @@ var addPlugin = ({ sdk: sdk2, context }) => {
2204
2215
  try {
2205
2216
  const generator = new AstTypeGenerator();
2206
2217
  const typeDefinitions = await generator.generateTypes({
2207
- appKey: manifestKey,
2218
+ app,
2208
2219
  authenticationId,
2209
2220
  sdk: sdk2
2210
2221
  });
@@ -2251,7 +2262,7 @@ function createZapierCliSdk(options = {}) {
2251
2262
 
2252
2263
  // package.json
2253
2264
  var package_default = {
2254
- version: "0.13.1"};
2265
+ version: "0.13.3"};
2255
2266
 
2256
2267
  // src/cli.ts
2257
2268
  var program = new Command();