zapier-platform-cli 16.0.0 → 16.1.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.
@@ -1771,6 +1771,168 @@
1771
1771
  "list.js"
1772
1772
  ]
1773
1773
  },
1774
+ "env:get": {
1775
+ "aliases": [],
1776
+ "args": {
1777
+ "version": {
1778
+ "description": "The version to get the environment for.",
1779
+ "name": "version",
1780
+ "required": true
1781
+ }
1782
+ },
1783
+ "description": "Get environment variables for a version.",
1784
+ "examples": [
1785
+ "zapier env:get 1.2.3"
1786
+ ],
1787
+ "flags": {
1788
+ "debug": {
1789
+ "char": "d",
1790
+ "description": "Show extra debugging output.",
1791
+ "name": "debug",
1792
+ "allowNo": false,
1793
+ "type": "boolean"
1794
+ },
1795
+ "format": {
1796
+ "char": "f",
1797
+ "description": "Change the way structured data is presented. If \"json\" or \"raw\", you can pipe the output of the command into other tools, such as jq.",
1798
+ "name": "format",
1799
+ "default": "table",
1800
+ "hasDynamicHelp": false,
1801
+ "multiple": false,
1802
+ "options": [
1803
+ "plain",
1804
+ "json",
1805
+ "raw",
1806
+ "row",
1807
+ "table"
1808
+ ],
1809
+ "type": "option"
1810
+ },
1811
+ "invokedFromAnotherCommand": {
1812
+ "hidden": true,
1813
+ "name": "invokedFromAnotherCommand",
1814
+ "allowNo": false,
1815
+ "type": "boolean"
1816
+ }
1817
+ },
1818
+ "hasDynamicHelp": false,
1819
+ "hiddenAliases": [],
1820
+ "id": "env:get",
1821
+ "pluginAlias": "zapier-platform-cli",
1822
+ "pluginName": "zapier-platform-cli",
1823
+ "pluginType": "core",
1824
+ "strict": true,
1825
+ "enableJsonFlag": false,
1826
+ "skipValidInstallCheck": true,
1827
+ "isESM": false,
1828
+ "relativePath": [
1829
+ "src",
1830
+ "oclif",
1831
+ "commands",
1832
+ "env",
1833
+ "get.js"
1834
+ ]
1835
+ },
1836
+ "env:set": {
1837
+ "aliases": [],
1838
+ "args": {
1839
+ "version": {
1840
+ "description": "The version to set the environment for. Values are copied forward when a new version is created, but this command will only ever affect the specified version.",
1841
+ "name": "version",
1842
+ "required": true
1843
+ },
1844
+ "key-value pairs...": {
1845
+ "description": "The key-value pairs to set. Keys are case-insensitive. Each pair should be space separated and pairs should be separated by an `=`. For example: `A=123 B=456`",
1846
+ "name": "key-value pairs..."
1847
+ }
1848
+ },
1849
+ "description": "Set environment variables for a version.",
1850
+ "examples": [
1851
+ "zapier env:set 1.2.3 SECRET=12345 OTHER=4321"
1852
+ ],
1853
+ "flags": {
1854
+ "debug": {
1855
+ "char": "d",
1856
+ "description": "Show extra debugging output.",
1857
+ "name": "debug",
1858
+ "allowNo": false,
1859
+ "type": "boolean"
1860
+ },
1861
+ "invokedFromAnotherCommand": {
1862
+ "hidden": true,
1863
+ "name": "invokedFromAnotherCommand",
1864
+ "allowNo": false,
1865
+ "type": "boolean"
1866
+ }
1867
+ },
1868
+ "hasDynamicHelp": false,
1869
+ "hiddenAliases": [],
1870
+ "id": "env:set",
1871
+ "pluginAlias": "zapier-platform-cli",
1872
+ "pluginName": "zapier-platform-cli",
1873
+ "pluginType": "core",
1874
+ "strict": false,
1875
+ "enableJsonFlag": false,
1876
+ "skipValidInstallCheck": true,
1877
+ "isESM": false,
1878
+ "relativePath": [
1879
+ "src",
1880
+ "oclif",
1881
+ "commands",
1882
+ "env",
1883
+ "set.js"
1884
+ ]
1885
+ },
1886
+ "env:unset": {
1887
+ "aliases": [],
1888
+ "args": {
1889
+ "version": {
1890
+ "description": "The version to set the environment for.",
1891
+ "name": "version",
1892
+ "required": true
1893
+ },
1894
+ "keys...": {
1895
+ "description": "The keys to unset. Keys are case-insensitive.",
1896
+ "name": "keys..."
1897
+ }
1898
+ },
1899
+ "description": "Unset environment variables for a version.",
1900
+ "examples": [
1901
+ "zapier env:unset 1.2.3 SECRET OTHER"
1902
+ ],
1903
+ "flags": {
1904
+ "debug": {
1905
+ "char": "d",
1906
+ "description": "Show extra debugging output.",
1907
+ "name": "debug",
1908
+ "allowNo": false,
1909
+ "type": "boolean"
1910
+ },
1911
+ "invokedFromAnotherCommand": {
1912
+ "hidden": true,
1913
+ "name": "invokedFromAnotherCommand",
1914
+ "allowNo": false,
1915
+ "type": "boolean"
1916
+ }
1917
+ },
1918
+ "hasDynamicHelp": false,
1919
+ "hiddenAliases": [],
1920
+ "id": "env:unset",
1921
+ "pluginAlias": "zapier-platform-cli",
1922
+ "pluginName": "zapier-platform-cli",
1923
+ "pluginType": "core",
1924
+ "strict": false,
1925
+ "enableJsonFlag": false,
1926
+ "skipValidInstallCheck": true,
1927
+ "isESM": false,
1928
+ "relativePath": [
1929
+ "src",
1930
+ "oclif",
1931
+ "commands",
1932
+ "env",
1933
+ "unset.js"
1934
+ ]
1935
+ },
1774
1936
  "team:add": {
1775
1937
  "aliases": [
1776
1938
  "team:invite"
@@ -2148,169 +2310,7 @@
2148
2310
  "users",
2149
2311
  "remove.js"
2150
2312
  ]
2151
- },
2152
- "env:get": {
2153
- "aliases": [],
2154
- "args": {
2155
- "version": {
2156
- "description": "The version to get the environment for.",
2157
- "name": "version",
2158
- "required": true
2159
- }
2160
- },
2161
- "description": "Get environment variables for a version.",
2162
- "examples": [
2163
- "zapier env:get 1.2.3"
2164
- ],
2165
- "flags": {
2166
- "debug": {
2167
- "char": "d",
2168
- "description": "Show extra debugging output.",
2169
- "name": "debug",
2170
- "allowNo": false,
2171
- "type": "boolean"
2172
- },
2173
- "format": {
2174
- "char": "f",
2175
- "description": "Change the way structured data is presented. If \"json\" or \"raw\", you can pipe the output of the command into other tools, such as jq.",
2176
- "name": "format",
2177
- "default": "table",
2178
- "hasDynamicHelp": false,
2179
- "multiple": false,
2180
- "options": [
2181
- "plain",
2182
- "json",
2183
- "raw",
2184
- "row",
2185
- "table"
2186
- ],
2187
- "type": "option"
2188
- },
2189
- "invokedFromAnotherCommand": {
2190
- "hidden": true,
2191
- "name": "invokedFromAnotherCommand",
2192
- "allowNo": false,
2193
- "type": "boolean"
2194
- }
2195
- },
2196
- "hasDynamicHelp": false,
2197
- "hiddenAliases": [],
2198
- "id": "env:get",
2199
- "pluginAlias": "zapier-platform-cli",
2200
- "pluginName": "zapier-platform-cli",
2201
- "pluginType": "core",
2202
- "strict": true,
2203
- "enableJsonFlag": false,
2204
- "skipValidInstallCheck": true,
2205
- "isESM": false,
2206
- "relativePath": [
2207
- "src",
2208
- "oclif",
2209
- "commands",
2210
- "env",
2211
- "get.js"
2212
- ]
2213
- },
2214
- "env:set": {
2215
- "aliases": [],
2216
- "args": {
2217
- "version": {
2218
- "description": "The version to set the environment for. Values are copied forward when a new version is created, but this command will only ever affect the specified version.",
2219
- "name": "version",
2220
- "required": true
2221
- },
2222
- "key-value pairs...": {
2223
- "description": "The key-value pairs to set. Keys are case-insensitive. Each pair should be space separated and pairs should be separated by an `=`. For example: `A=123 B=456`",
2224
- "name": "key-value pairs..."
2225
- }
2226
- },
2227
- "description": "Set environment variables for a version.",
2228
- "examples": [
2229
- "zapier env:set 1.2.3 SECRET=12345 OTHER=4321"
2230
- ],
2231
- "flags": {
2232
- "debug": {
2233
- "char": "d",
2234
- "description": "Show extra debugging output.",
2235
- "name": "debug",
2236
- "allowNo": false,
2237
- "type": "boolean"
2238
- },
2239
- "invokedFromAnotherCommand": {
2240
- "hidden": true,
2241
- "name": "invokedFromAnotherCommand",
2242
- "allowNo": false,
2243
- "type": "boolean"
2244
- }
2245
- },
2246
- "hasDynamicHelp": false,
2247
- "hiddenAliases": [],
2248
- "id": "env:set",
2249
- "pluginAlias": "zapier-platform-cli",
2250
- "pluginName": "zapier-platform-cli",
2251
- "pluginType": "core",
2252
- "strict": false,
2253
- "enableJsonFlag": false,
2254
- "skipValidInstallCheck": true,
2255
- "isESM": false,
2256
- "relativePath": [
2257
- "src",
2258
- "oclif",
2259
- "commands",
2260
- "env",
2261
- "set.js"
2262
- ]
2263
- },
2264
- "env:unset": {
2265
- "aliases": [],
2266
- "args": {
2267
- "version": {
2268
- "description": "The version to set the environment for.",
2269
- "name": "version",
2270
- "required": true
2271
- },
2272
- "keys...": {
2273
- "description": "The keys to unset. Keys are case-insensitive.",
2274
- "name": "keys..."
2275
- }
2276
- },
2277
- "description": "Unset environment variables for a version.",
2278
- "examples": [
2279
- "zapier env:unset 1.2.3 SECRET OTHER"
2280
- ],
2281
- "flags": {
2282
- "debug": {
2283
- "char": "d",
2284
- "description": "Show extra debugging output.",
2285
- "name": "debug",
2286
- "allowNo": false,
2287
- "type": "boolean"
2288
- },
2289
- "invokedFromAnotherCommand": {
2290
- "hidden": true,
2291
- "name": "invokedFromAnotherCommand",
2292
- "allowNo": false,
2293
- "type": "boolean"
2294
- }
2295
- },
2296
- "hasDynamicHelp": false,
2297
- "hiddenAliases": [],
2298
- "id": "env:unset",
2299
- "pluginAlias": "zapier-platform-cli",
2300
- "pluginName": "zapier-platform-cli",
2301
- "pluginType": "core",
2302
- "strict": false,
2303
- "enableJsonFlag": false,
2304
- "skipValidInstallCheck": true,
2305
- "isESM": false,
2306
- "relativePath": [
2307
- "src",
2308
- "oclif",
2309
- "commands",
2310
- "env",
2311
- "unset.js"
2312
- ]
2313
2313
  }
2314
2314
  },
2315
- "version": "16.0.0"
2315
+ "version": "16.1.1"
2316
2316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-cli",
3
- "version": "16.0.0",
3
+ "version": "16.1.1",
4
4
  "description": "The CLI for managing integrations in Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform",
6
6
  "homepage": "https://platform.zapier.com/",
package/src/constants.js CHANGED
@@ -26,7 +26,7 @@ const BLOCKLISTED_PATHS = [
26
26
  ];
27
27
  const NODE_VERSION = versionStore[versionStore.length - 1].nodeVersion;
28
28
  const LAMBDA_VERSION = `v${NODE_VERSION}`;
29
- const NODE_VERSION_CLI_REQUIRES = '>=16'; // should be the oldest non-ETL version
29
+ const NODE_VERSION_CLI_REQUIRES = '>=18'; // should be the oldest non-ETL version
30
30
  const AUTH_KEY = 'deployKey';
31
31
  const ANALYTICS_KEY = 'analyticsMode';
32
32
  const ANALYTICS_MODES = {
@@ -42,7 +42,7 @@ const PACKAGE_VERSION = packageJson.version;
42
42
  const UPDATE_NOTIFICATION_INTERVAL = 1000 * 60 * 60 * 24 * 7; // one week
43
43
 
44
44
  const CHECK_REF_DOC_LINK =
45
- 'https://platform.zapier.com/docs/integration-checks-reference';
45
+ 'https://docs.zapier.com/platform/publish/integration-checks-reference';
46
46
 
47
47
  const ISSUES_URL =
48
48
  'https://github.com/zapier/zapier-platform/issues/new/choose';
@@ -1,5 +1,5 @@
1
1
  # The "dynamic-dropdown" Template
2
2
 
3
- This example integration uses the [Star Wars API](https://swapi.dev/) to provide a dynamic listing of choices for an `inputField` in a trigger.
3
+ This example integration uses the [Star Wars API](https://swapi.info/) to provide a dynamic listing of choices for an `inputField` in a trigger.
4
4
 
5
5
  ![](https://cdn.zappy.app/d985065c5098089795d9b60c77791e12.png)
@@ -5,8 +5,8 @@ const perform = async (z, bundle) => {
5
5
  // Ideally, we should poll through all the pages of results, but in this
6
6
  // example we're going to omit that part. Thus, this trigger only "see" the
7
7
  // people in their first page of results.
8
- const response = await z.request({ url: 'https://swapi.dev/api/people/' });
9
- let peopleArray = response.data.results;
8
+ const response = await z.request({ url: 'https://swapi.info/api/people/' });
9
+ let peopleArray = response.data;
10
10
 
11
11
  if (bundle.inputData.species_id) {
12
12
  // The Zap's setup has requested a specific species of person. Since the
@@ -3,7 +3,7 @@ const { extractID } = require('../utils');
3
3
  // Fetches a list of records from the endpoint
4
4
  const perform = async (z, bundle) => {
5
5
  const request = {
6
- url: 'https://swapi.dev/api/species/',
6
+ url: 'https://swapi.info/api/species/',
7
7
  params: {},
8
8
  };
9
9
 
@@ -13,7 +13,7 @@ const perform = async (z, bundle) => {
13
13
  }
14
14
 
15
15
  const response = await z.request(request);
16
- const speciesArray = response.data.results;
16
+ const speciesArray = response.data;
17
17
  return speciesArray.map((species) => {
18
18
  species.id = extractID(species.url);
19
19
  return species;
@@ -346,7 +346,7 @@ class ZapierBaseCommand extends Command {
346
346
  if (!this.args) {
347
347
  throw new Error('unable to record analytics until args are parsed');
348
348
  }
349
- return recordAnalytics(this.id, true, Object.keys(this.args), this.flags);
349
+ return recordAnalytics(this.id, true, this.args, this.flags);
350
350
  }
351
351
  }
352
352
 
@@ -15,6 +15,7 @@ class HistoryCommand extends BaseCommand {
15
15
  ['What', 'action'],
16
16
  ['Message', 'message'],
17
17
  ['Who', 'customuser'],
18
+ ['Version', 'version'],
18
19
  ['Timestamp', 'date'],
19
20
  ],
20
21
  emptyMessage: 'No historical actions found',
@@ -1,22 +1,22 @@
1
1
  const chalk = require('chalk');
2
2
  const { marked } = require('marked');
3
- const TerminalRenderer = require('marked-terminal');
3
+ const { markedTerminal } = require('marked-terminal');
4
4
 
5
- marked.setOptions({
6
- renderer: new TerminalRenderer({
5
+ marked.use(
6
+ markedTerminal({
7
7
  tab: 2,
8
8
  width: process.stdout.getWindowSize()[0] - 2,
9
9
  reflowText: true,
10
10
  codespan: chalk.underline.bold,
11
11
  }),
12
- });
12
+ );
13
13
 
14
14
  module.exports = (options) => {
15
15
  const cmdId = options.id === 'help' ? options.argv[0] : options.id;
16
16
  const cmd = options.config.findCommand(cmdId);
17
17
  if (cmd) {
18
18
  if (cmd.description) {
19
- cmd.description = marked(cmd.description).trim();
19
+ cmd.description = marked.parse(cmd.description).trim();
20
20
  }
21
21
  // TODO: Do the same for flag descriptions?
22
22
  }
@@ -2,6 +2,7 @@ const { callAPI } = require('./api');
2
2
  // const { readFile } = require('./files');
3
3
  const debug = require('debug')('zapier:analytics');
4
4
  const pkg = require('../../package.json');
5
+ const { getLinkedAppConfig } = require('../utils/api');
5
6
  const { ANALYTICS_KEY, ANALYTICS_MODES, IS_TESTING } = require('../constants');
6
7
  const { readUserConfig, writeUserConfig } = require('./userConfig');
7
8
 
@@ -20,25 +21,37 @@ const shouldSkipAnalytics = (mode) =>
20
21
  process.env.DISABLE_ZAPIER_ANALYTICS ||
21
22
  mode === ANALYTICS_MODES.disabled;
22
23
 
23
- const recordAnalytics = async (command, isValidCommand, argNames, flags) => {
24
+ const recordAnalytics = async (command, isValidCommand, args, flags) => {
24
25
  const analyticsMode = await currentAnalyticsMode();
25
26
 
26
27
  if (shouldSkipAnalytics(analyticsMode)) {
27
28
  debug('skipping analytics');
28
29
  return;
29
30
  }
30
-
31
+ const argKeys = Object.keys(args);
32
+ const flagKeys = Object.keys(flags);
31
33
  const shouldRecordAnonymously = analyticsMode === ANALYTICS_MODES.anonymous;
32
34
 
35
+ const integrationIDKey = argKeys.find(
36
+ (key) => key.toLowerCase() === 'integrationid',
37
+ );
38
+ const integrationID = integrationIDKey ? args[integrationIDKey] : undefined;
39
+
40
+ // Some commands ( like "zapier convert" ) won't have an app directory when called.
41
+ // Instead, having the app ID in the arguments.
42
+ // In this case, we fallback to using "integrationid" in arguments ( if it's there )
43
+ // and don't want to "explode" if appID is missing
44
+ const linkedAppId =
45
+ (await getLinkedAppConfig(undefined, false))?.id || integrationID;
46
+
33
47
  // to make this more testable, we should split this out into its own function
34
48
  const analyticsBody = {
35
49
  command,
36
50
  isValidCommand,
37
- numArgs: argNames.length,
38
- flags: {
39
- ...flags,
40
- ...(command === 'help' ? { helpCommand: argNames[0] } : {}), // include the beginning of args so we know what they want help on
41
- },
51
+ numArgs: argKeys.length,
52
+ appId: linkedAppId,
53
+ argsKeys: argKeys,
54
+ flagKeys: flagKeys,
42
55
  cliVersion: pkg.version,
43
56
  os: shouldRecordAnonymously ? undefined : process.platform,
44
57
  };
package/src/utils/api.js CHANGED
@@ -95,7 +95,7 @@ const callAPI = async (
95
95
  }
96
96
  }
97
97
 
98
- debug(`>> ${requestOptions.method} ${requestOptions.url}`);
98
+ debug(`>> ${requestOptions.method} ${requestOptions.url || res.url}`);
99
99
 
100
100
  if (requestOptions.body) {
101
101
  const replacementStr = 'raw zip removed in logs';
@@ -17,4 +17,5 @@ module.exports = [
17
17
  { nodeVersion: '14', npmVersion: '>=5.6.0' }, // 12.x
18
18
  { nodeVersion: '16', npmVersion: '>=5.6.0' }, // 13.x
19
19
  { nodeVersion: '18', npmVersion: '>=5.6.0' }, // 15.x
20
+ { nodeVersion: '18', npmVersion: '>=10.7.0' }, // 16.x
20
21
  ];