zapier-platform-cli 17.0.0 → 17.0.2

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.
@@ -1793,6 +1793,88 @@
1793
1793
  "list.js"
1794
1794
  ]
1795
1795
  },
1796
+ "delete:integration": {
1797
+ "aliases": [
1798
+ "delete:app"
1799
+ ],
1800
+ "args": {},
1801
+ "description": "Delete your integration (including all versions).\n\nThis only works if there are no active users or Zaps on any version. If you only want to delete certain versions, use the `zapier delete:version` command instead. It's unlikely that you'll be able to run this on an app that you've pushed publicly, since there are usually still users.",
1802
+ "flags": {
1803
+ "debug": {
1804
+ "char": "d",
1805
+ "description": "Show extra debugging output.",
1806
+ "name": "debug",
1807
+ "allowNo": false,
1808
+ "type": "boolean"
1809
+ },
1810
+ "invokedFromAnotherCommand": {
1811
+ "hidden": true,
1812
+ "name": "invokedFromAnotherCommand",
1813
+ "allowNo": false,
1814
+ "type": "boolean"
1815
+ }
1816
+ },
1817
+ "hasDynamicHelp": false,
1818
+ "hiddenAliases": [],
1819
+ "id": "delete:integration",
1820
+ "pluginAlias": "zapier-platform-cli",
1821
+ "pluginName": "zapier-platform-cli",
1822
+ "pluginType": "core",
1823
+ "strict": true,
1824
+ "enableJsonFlag": false,
1825
+ "skipValidInstallCheck": true,
1826
+ "isESM": false,
1827
+ "relativePath": [
1828
+ "src",
1829
+ "oclif",
1830
+ "commands",
1831
+ "delete",
1832
+ "integration.js"
1833
+ ]
1834
+ },
1835
+ "delete:version": {
1836
+ "aliases": [],
1837
+ "args": {
1838
+ "version": {
1839
+ "description": "Specify the version to delete. It must have no users or Zaps.",
1840
+ "name": "version",
1841
+ "required": true
1842
+ }
1843
+ },
1844
+ "description": "Delete a specific version of your integration.\n\nThis only works if there are no users or Zaps on that version. You will probably need to have run `zapier migrate` and `zapier deprecate` before this command will work.",
1845
+ "flags": {
1846
+ "debug": {
1847
+ "char": "d",
1848
+ "description": "Show extra debugging output.",
1849
+ "name": "debug",
1850
+ "allowNo": false,
1851
+ "type": "boolean"
1852
+ },
1853
+ "invokedFromAnotherCommand": {
1854
+ "hidden": true,
1855
+ "name": "invokedFromAnotherCommand",
1856
+ "allowNo": false,
1857
+ "type": "boolean"
1858
+ }
1859
+ },
1860
+ "hasDynamicHelp": false,
1861
+ "hiddenAliases": [],
1862
+ "id": "delete:version",
1863
+ "pluginAlias": "zapier-platform-cli",
1864
+ "pluginName": "zapier-platform-cli",
1865
+ "pluginType": "core",
1866
+ "strict": true,
1867
+ "enableJsonFlag": false,
1868
+ "skipValidInstallCheck": true,
1869
+ "isESM": false,
1870
+ "relativePath": [
1871
+ "src",
1872
+ "oclif",
1873
+ "commands",
1874
+ "delete",
1875
+ "version.js"
1876
+ ]
1877
+ },
1796
1878
  "env:get": {
1797
1879
  "aliases": [],
1798
1880
  "args": {
@@ -1969,88 +2051,6 @@
1969
2051
  "unset.js"
1970
2052
  ]
1971
2053
  },
1972
- "delete:integration": {
1973
- "aliases": [
1974
- "delete:app"
1975
- ],
1976
- "args": {},
1977
- "description": "Delete your integration (including all versions).\n\nThis only works if there are no active users or Zaps on any version. If you only want to delete certain versions, use the `zapier delete:version` command instead. It's unlikely that you'll be able to run this on an app that you've pushed publicly, since there are usually still users.",
1978
- "flags": {
1979
- "debug": {
1980
- "char": "d",
1981
- "description": "Show extra debugging output.",
1982
- "name": "debug",
1983
- "allowNo": false,
1984
- "type": "boolean"
1985
- },
1986
- "invokedFromAnotherCommand": {
1987
- "hidden": true,
1988
- "name": "invokedFromAnotherCommand",
1989
- "allowNo": false,
1990
- "type": "boolean"
1991
- }
1992
- },
1993
- "hasDynamicHelp": false,
1994
- "hiddenAliases": [],
1995
- "id": "delete:integration",
1996
- "pluginAlias": "zapier-platform-cli",
1997
- "pluginName": "zapier-platform-cli",
1998
- "pluginType": "core",
1999
- "strict": true,
2000
- "enableJsonFlag": false,
2001
- "skipValidInstallCheck": true,
2002
- "isESM": false,
2003
- "relativePath": [
2004
- "src",
2005
- "oclif",
2006
- "commands",
2007
- "delete",
2008
- "integration.js"
2009
- ]
2010
- },
2011
- "delete:version": {
2012
- "aliases": [],
2013
- "args": {
2014
- "version": {
2015
- "description": "Specify the version to delete. It must have no users or Zaps.",
2016
- "name": "version",
2017
- "required": true
2018
- }
2019
- },
2020
- "description": "Delete a specific version of your integration.\n\nThis only works if there are no users or Zaps on that version. You will probably need to have run `zapier migrate` and `zapier deprecate` before this command will work.",
2021
- "flags": {
2022
- "debug": {
2023
- "char": "d",
2024
- "description": "Show extra debugging output.",
2025
- "name": "debug",
2026
- "allowNo": false,
2027
- "type": "boolean"
2028
- },
2029
- "invokedFromAnotherCommand": {
2030
- "hidden": true,
2031
- "name": "invokedFromAnotherCommand",
2032
- "allowNo": false,
2033
- "type": "boolean"
2034
- }
2035
- },
2036
- "hasDynamicHelp": false,
2037
- "hiddenAliases": [],
2038
- "id": "delete:version",
2039
- "pluginAlias": "zapier-platform-cli",
2040
- "pluginName": "zapier-platform-cli",
2041
- "pluginType": "core",
2042
- "strict": true,
2043
- "enableJsonFlag": false,
2044
- "skipValidInstallCheck": true,
2045
- "isESM": false,
2046
- "relativePath": [
2047
- "src",
2048
- "oclif",
2049
- "commands",
2050
- "delete",
2051
- "version.js"
2052
- ]
2053
- },
2054
2054
  "team:add": {
2055
2055
  "aliases": [
2056
2056
  "team:invite"
@@ -2430,5 +2430,5 @@
2430
2430
  ]
2431
2431
  }
2432
2432
  },
2433
- "version": "17.0.0"
2433
+ "version": "17.0.2"
2434
2434
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-cli",
3
- "version": "17.0.0",
3
+ "version": "17.0.2",
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/",
@@ -290,9 +290,9 @@ class ProjectGenerator extends Generator {
290
290
  {
291
291
  type: 'list',
292
292
  name: 'module',
293
- choices: ['commonjs', 'esm'],
293
+ choices: ['esm', 'commonjs'],
294
294
  message: 'Choose module type:',
295
- default: 'commonjs',
295
+ default: 'esm',
296
296
  },
297
297
  ]);
298
298
  this.options.module = this.answers.module;
@@ -20,7 +20,10 @@ export default {
20
20
  getAccessToken: {
21
21
  url: `${API_URL}/oauth/access-token`,
22
22
  method: 'POST',
23
- params: {
23
+ headers: {
24
+ 'content-type': 'application/x-www-form-urlencoded',
25
+ },
26
+ body: {
24
27
  client_id: '{{process.env.CLIENT_ID}}',
25
28
  client_secret: '{{process.env.CLIENT_SECRET}}',
26
29
  code: '{{bundle.inputData.code}}',
@@ -31,7 +34,10 @@ export default {
31
34
  refreshAccessToken: {
32
35
  url: `${API_URL}/oauth/refresh-token`,
33
36
  method: 'POST',
34
- params: {
37
+ headers: {
38
+ 'content-type': 'application/x-www-form-urlencoded',
39
+ },
40
+ body: {
35
41
  client_id: '{{process.env.CLIENT_ID}}',
36
42
  client_secret: '{{process.env.CLIENT_SECRET}}',
37
43
  refresh_token: '{{bundle.authData.refresh_token}}',
@@ -63,6 +63,7 @@ const requiredFiles = async ({ cwd, entryPoints }) => {
63
63
  external: ['../test/userapp'],
64
64
  format: 'esm',
65
65
  write: false, // no need to write outfile
66
+ absWorkingDir: cwd,
66
67
  });
67
68
 
68
69
  return Object.keys(result.metafile.inputs).map((path) =>
@@ -228,7 +228,10 @@ const loadAppRawUsingImport = async (
228
228
  try {
229
229
  // zapierwrapper.mjs is only available since zapier-platform-core v17.
230
230
  // And only zapierwrapper.mjs exposes appRaw just for this use case.
231
- appRaw = (await import(wrapperPath)).appRaw;
231
+ // Convert path to file:// URL for Windows compatibility with ESM imports
232
+ const pathForUrl = path.resolve(wrapperPath).replace(/\\/g, '/');
233
+ const wrapperUrl = new URL(`file:///${pathForUrl.replace(/^\//, '')}`);
234
+ appRaw = (await import(wrapperUrl.href)).appRaw;
232
235
  } catch (err) {
233
236
  if (err.name === 'SyntaxError') {
234
237
  // Run a separate process to print the line number of the SyntaxError.
@@ -251,7 +254,8 @@ const loadAppRawUsingImport = async (
251
254
  };
252
255
 
253
256
  const loadAppRawUsingRequire = (appDir) => {
254
- let appRaw = require(appDir);
257
+ const normalizedPath = path.resolve(appDir);
258
+ let appRaw = require(normalizedPath);
255
259
  if (appRaw && appRaw.default) {
256
260
  // Node.js 22+ supports using require() to import ESM.
257
261
  // For Node.js < 20.17.0, require() will throw an error on ESM.
@@ -325,7 +329,10 @@ const getLocalAppHandler = async ({
325
329
 
326
330
  // Assumes the entry point of zapier-platform-core is index.js
327
331
  const coreEntryPoint = path.join(corePackageDir, 'index.js');
328
- const zapier = (await import(coreEntryPoint)).default;
332
+ // Convert path to file:// URL for Windows compatibility with ESM imports
333
+ const pathForUrl = path.resolve(coreEntryPoint).replace(/\\/g, '/');
334
+ const coreEntryUrl = new URL(`file:///${pathForUrl.replace(/^\//, '')}`);
335
+ const zapier = (await import(coreEntryUrl.href)).default;
329
336
 
330
337
  const handler = zapier.createAppHandler(appRaw);
331
338
  if (handler.length === 3) {
@@ -360,6 +367,7 @@ const localAppCommand = async (event, appDir, shouldDeleteWrapper = true) => {
360
367
  appDir,
361
368
  shouldDeleteWrapper,
362
369
  });
370
+
363
371
  if (handler.length === 3) {
364
372
  // < 17: function handler(event, ctx, callback)
365
373
  return new Promise((resolve, reject) => {
@@ -18,4 +18,5 @@ module.exports = [
18
18
  { nodeVersion: '16', npmVersion: '>=5.6.0' }, // 13.x
19
19
  { nodeVersion: '18', npmVersion: '>=5.6.0' }, // 15.x
20
20
  { nodeVersion: '18', npmVersion: '>=10.7.0' }, // 16.x
21
+ { nodeVersion: '18', npmVersion: '>=10.7.0' }, // 17.x
21
22
  ];