zapier-platform-cli 18.0.0 → 18.0.5

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.
@@ -2555,5 +2555,5 @@
2555
2555
  ]
2556
2556
  }
2557
2557
  },
2558
- "version": "18.0.0"
2558
+ "version": "18.0.5"
2559
2559
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-cli",
3
- "version": "18.0.0",
3
+ "version": "18.0.5",
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/",
@@ -13,7 +13,6 @@
13
13
  "/src/generators/",
14
14
  "/src/oclif/",
15
15
  "/src/bin/",
16
- "/src/bin/run.cmd",
17
16
  "/src/utils/",
18
17
  "/scaffold/",
19
18
  "/oclif.manifest.json"
@@ -21,24 +20,6 @@
21
20
  "engines": {
22
21
  "node": ">=18.20"
23
22
  },
24
- "scripts": {
25
- "docs": "ZAPIER_BASE_ENDPOINT='' node scripts/docs.js",
26
- "preversion": "git pull && yarn validate",
27
- "prepack": "oclif manifest",
28
- "postpack": "rimraf oclif.manifest.json",
29
- "precommit": "yarn docs && git add docs",
30
- "version": "yarn docs && git add docs/*",
31
- "postversion": "git push && git push --tags",
32
- "lint": "eslint src",
33
- "lint:fix": "eslint --fix src",
34
- "test": "cross-env NODE_ENV=test mocha -t 200s --recursive src/tests --exit",
35
- "test:debug": "cross-env NODE_ENV=test node inspect ../../node_modules/.bin/mocha -t 200s --recursive src/tests --exit",
36
- "smoke-test": "cross-env NODE_ENV=test mocha -t 6m --recursive src/smoke-tests --exit",
37
- "smoke-test:debug": "cross-env NODE_ENV=test node inspect ../../node_modules/.bin/mocha -t 6m --recursive src/smoke-tests --exit",
38
- "validate-templates": "./scripts/validate-app-templates.js",
39
- "set-template-versions": "./scripts/set-app-template-versions.js",
40
- "validate": "yarn test && yarn smoke-test && yarn lint"
41
- },
42
23
  "dependencies": {
43
24
  "@oclif/core": "4.5.2",
44
25
  "@oclif/plugin-autocomplete": "3.2.34",
@@ -51,7 +32,7 @@
51
32
  "cli-table3": "0.6.5",
52
33
  "colors": "1.4.0",
53
34
  "debug": "4.4.1",
54
- "decompress": "4.2.1",
35
+ "decompress-unzip": "4.0.1",
55
36
  "dotenv": "17.2.1",
56
37
  "esbuild": "0.25.8",
57
38
  "fs-extra": "11.3.1",
@@ -91,7 +72,7 @@
91
72
  "yamljs": "0.3.0"
92
73
  },
93
74
  "bin": {
94
- "zapier": "./src/bin/run-deprecated",
75
+ "zapier": "./src/bin/run",
95
76
  "zapier-platform": "./src/bin/run"
96
77
  },
97
78
  "oclif": {
@@ -137,5 +118,21 @@
137
118
  "description": "Add, remove, or get invited users of your integration."
138
119
  }
139
120
  }
121
+ },
122
+ "scripts": {
123
+ "build-docs": "ZAPIER_BASE_ENDPOINT='' node scripts/docs.js",
124
+ "preversion": "git pull && pnpm validate",
125
+ "precommit": "pnpm build-docs && git add docs",
126
+ "version": "pnpm build-docs && git add docs/*",
127
+ "postversion": "git push && git push --tags",
128
+ "lint": "eslint src",
129
+ "lint:fix": "eslint --fix src",
130
+ "test": "cross-env NODE_ENV=test mocha -t 200s --recursive src/tests --exit",
131
+ "test:debug": "cross-env NODE_ENV=test node inspect ../../node_modules/.bin/mocha -t 200s --recursive src/tests --exit",
132
+ "smoke-test": "cross-env NODE_ENV=test mocha -t 6m --recursive src/smoke-tests --exit",
133
+ "smoke-test:debug": "cross-env NODE_ENV=test node inspect ../../node_modules/.bin/mocha -t 6m --recursive src/smoke-tests --exit",
134
+ "validate-templates": "./scripts/validate-app-templates.js",
135
+ "set-template-versions": "./scripts/set-app-template-versions.js",
136
+ "validate": "pnpm test && pnpm smoke-test && pnpm lint"
140
137
  }
141
- }
138
+ }
package/src/bin/run CHANGED
@@ -1,6 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const path = require('node:path');
4
+
3
5
  (async () => {
4
6
  const oclif = await import('@oclif/core');
5
7
  await oclif.execute({ development: false, dir: __dirname });
8
+
9
+ // Show deprecation warning for the old "zapier" binary name
10
+ // Users can suppress this warning by setting ZAPIER_SUPPRESS_DEPRECATION_WARNING
11
+ if (!process.env.ZAPIER_SUPPRESS_DEPRECATION_WARNING) {
12
+ const msg =
13
+ 'The "zapier" command is deprecated and will be removed in a future version. ' +
14
+ 'Please use "zapier-platform" instead.\n' +
15
+ 'To suppress this warning, set ZAPIER_SUPPRESS_DEPRECATION_WARNING in your environment.\n';
16
+
17
+ if (process.platform === 'win32') {
18
+ // On Windows, we cannot reliably detect which wrapper was invoked (zapier vs zapier-platform)
19
+ // because both wrappers point to the same script. Show a generic deprecation notice instead of a warning..
20
+ console.warn('\n[DEPRECATION NOTICE] ' + msg);
21
+ } else {
22
+ // On Unix, we can detect which symlink was used
23
+ const scriptPath = process.argv[1] || '';
24
+ const binName = path.basename(scriptPath, path.extname(scriptPath));
25
+ if (binName === 'zapier') {
26
+ console.warn('\n[DEPRECATION WARNING] ' + msg);
27
+ }
28
+ }
29
+ }
6
30
  })();
@@ -6,7 +6,7 @@ These are what you normally do next:
6
6
 
7
7
  ```bash
8
8
  # Install dependencies
9
- npm install # or you can use yarn
9
+ npm install # or you can use pnpm or yarn
10
10
 
11
11
  # Run tests
12
12
  zapier test
@@ -4,6 +4,7 @@ logs
4
4
  npm-debug.log*
5
5
  yarn-debug.log*
6
6
  yarn-error.log*
7
+ pnpm-debug.log*
7
8
 
8
9
  # Runtime data
9
10
  pids
@@ -61,3 +62,5 @@ typings/
61
62
 
62
63
  # next.js build output
63
64
  .next
65
+
66
+ .pnpm-store/
@@ -12,7 +12,7 @@ const colors = require('colors/safe');
12
12
  const esbuild = require('esbuild');
13
13
  const fse = require('fs-extra');
14
14
  const { createUpdateNotifier } = require('./esm-wrapper');
15
- const decompress = require('decompress');
15
+ const decompress = require('./decompress');
16
16
 
17
17
  const {
18
18
  BUILD_DIR,
@@ -0,0 +1,121 @@
1
+ // This is a modernized version of the decompress package.
2
+ // Instead of letting decompress import many of its plugins, such as
3
+ // decompress-unzip, decompress-tar, etc, we extracted only the unzip part,
4
+ // so we only depend on decompress-unzip.
5
+ // Original source: https://github.com/kevva/decompress/blob/84a8c104/index.js
6
+
7
+ const fsP = require('node:fs/promises');
8
+ const path = require('node:path');
9
+
10
+ const decompressUnzip = require('decompress-unzip');
11
+
12
+ const safeMakeDir = async (dir, realOutputPath) => {
13
+ let resolvedPathToCheck;
14
+
15
+ try {
16
+ resolvedPathToCheck = await fsP.realpath(dir);
17
+ } catch (error) {
18
+ const parent = path.dirname(dir);
19
+ resolvedPathToCheck = await safeMakeDir(parent, realOutputPath);
20
+ }
21
+
22
+ // Security check for zip slip vulnerability
23
+ if (!resolvedPathToCheck.startsWith(realOutputPath)) {
24
+ throw new Error('Refusing to create a directory outside the output path.');
25
+ }
26
+
27
+ await fsP.mkdir(dir, { recursive: true });
28
+ return await fsP.realpath(dir);
29
+ };
30
+
31
+ const preventWritingThroughSymlink = async (destination, realOutputPath) => {
32
+ let symlinkPointsTo;
33
+ try {
34
+ symlinkPointsTo = await fsP.readlink(destination);
35
+ } catch (error) {
36
+ // Either no file exists, or it's not a symlink. In either case, this is
37
+ // not an escape we need to worry about in this phase.
38
+ }
39
+
40
+ if (symlinkPointsTo) {
41
+ throw new Error('Refusing to write into a symlink');
42
+ }
43
+ };
44
+
45
+ const extractItem = async (item, realOutputPath) => {
46
+ const dest = path.join(realOutputPath, item.path);
47
+ const mode = item.mode & ~process.umask();
48
+ const now = new Date();
49
+
50
+ if (item.type === 'directory') {
51
+ await safeMakeDir(dest, realOutputPath);
52
+ await fsP.utimes(dest, now, item.mtime);
53
+ return item;
54
+ }
55
+
56
+ await safeMakeDir(path.dirname(dest), realOutputPath);
57
+
58
+ if (item.type === 'file') {
59
+ await preventWritingThroughSymlink(dest, realOutputPath);
60
+ }
61
+
62
+ const realDestinationDir = await fsP.realpath(path.dirname(dest));
63
+ if (!realDestinationDir.startsWith(realOutputPath)) {
64
+ throw new Error(
65
+ 'Refusing to write outside output directory: ' + realDestinationDir,
66
+ );
67
+ }
68
+
69
+ if (item.type === 'symlink') {
70
+ // Security check to block symlinks pointing outside output directory,
71
+ // like evil_link -> ../../../../../etc/passwd. We don't throw an error
72
+ // here, just skip creating the symlink, because there are known zip files
73
+ // containing such symlinks (such as .editorconfig) that are not essential
74
+ // to the integration.
75
+ const absTargetPath = path.resolve(realDestinationDir, item.linkname);
76
+ const relTargetPath = path.relative(realOutputPath, absTargetPath);
77
+ if (!relTargetPath.startsWith('..')) {
78
+ // Windows will have issues with the following line, since creating a
79
+ // symlink on Windows requires Administrator privilege. But that's fine
80
+ // because we only run decompress on Windows in CI tests, which do run
81
+ // with Administrator privilege.
82
+ await fsP.symlink(item.linkname, dest);
83
+ }
84
+ } else {
85
+ await fsP.writeFile(dest, item.data, { mode });
86
+ await fsP.utimes(dest, now, item.mtime);
87
+ }
88
+
89
+ return item;
90
+ };
91
+
92
+ const decompress = async (input, output) => {
93
+ if (typeof input !== 'string') {
94
+ throw new TypeError('input must be a file path (string)');
95
+ }
96
+
97
+ if (typeof output !== 'string') {
98
+ throw new TypeError('output must be a directory path (string)');
99
+ }
100
+
101
+ let fd, buf;
102
+ try {
103
+ fd = await fsP.open(input);
104
+ buf = await fd.readFile();
105
+ } finally {
106
+ await fd?.close();
107
+ }
108
+
109
+ // Ensure output directory exists
110
+ await fsP.mkdir(output, { recursive: true });
111
+ const realOutputPath = await fsP.realpath(output);
112
+
113
+ const items = await decompressUnzip()(buf);
114
+ return await Promise.all(
115
+ items.map(async (x) => {
116
+ return await extractItem(x, realOutputPath);
117
+ }),
118
+ );
119
+ };
120
+
121
+ module.exports = decompress;
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const path = require('node:path');
4
-
5
- (async () => {
6
- const oclif = await import('@oclif/core');
7
- await oclif.execute({ development: false, dir: __dirname });
8
-
9
- console.warn(
10
- '[DEPRECATION WARNING] ' +
11
- 'The executable name "zapier" is deprecated and will be removed in a future version. ' +
12
- 'Please use "zapier-platform" instead.',
13
- );
14
- })();
@@ -1,6 +0,0 @@
1
- build
2
- docs
3
- node_modules
4
- *.log
5
- .environment
6
- lib.env