zapier-platform-cli 18.4.0 → 18.5.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.
Files changed (50) hide show
  1. package/package.json +4 -4
  2. package/src/app-templates.js +1 -0
  3. package/src/generators/index.js +3 -2
  4. package/src/generators/templates/README.template.md +9 -9
  5. package/src/generators/templates/line-items/README.md +16 -0
  6. package/src/generators/templates/line-items/creates/order.js +67 -0
  7. package/src/generators/templates/line-items/index.js +12 -0
  8. package/src/generators/templates/line-items/test/creates.test.js +30 -0
  9. package/src/oclif/ZapierBaseCommand.js +1 -1
  10. package/src/oclif/commands/analytics.js +1 -1
  11. package/src/oclif/commands/build.js +3 -3
  12. package/src/oclif/commands/cache/clear.js +5 -2
  13. package/src/oclif/commands/canary/create.js +7 -7
  14. package/src/oclif/commands/canary/delete.js +1 -1
  15. package/src/oclif/commands/canary/list.js +1 -1
  16. package/src/oclif/commands/convert.js +1 -1
  17. package/src/oclif/commands/delete/integration.js +1 -1
  18. package/src/oclif/commands/delete/version.js +1 -1
  19. package/src/oclif/commands/deprecate.js +4 -4
  20. package/src/oclif/commands/describe.js +3 -3
  21. package/src/oclif/commands/env/get.js +2 -2
  22. package/src/oclif/commands/env/set.js +3 -1
  23. package/src/oclif/commands/env/unset.js +1 -1
  24. package/src/oclif/commands/init.js +5 -5
  25. package/src/oclif/commands/integrations.js +2 -1
  26. package/src/oclif/commands/invoke/action.js +4 -2
  27. package/src/oclif/commands/invoke/auth/refresh.js +1 -1
  28. package/src/oclif/commands/invoke/index.js +9 -2
  29. package/src/oclif/commands/invoke/input-types.js +10 -2
  30. package/src/oclif/commands/invoke/prompts.js +238 -11
  31. package/src/oclif/commands/invoke/remote.js +41 -15
  32. package/src/oclif/commands/jobs.js +2 -2
  33. package/src/oclif/commands/legacy.js +1 -1
  34. package/src/oclif/commands/link.js +2 -2
  35. package/src/oclif/commands/logs.js +3 -3
  36. package/src/oclif/commands/migrate.js +10 -10
  37. package/src/oclif/commands/promote.js +5 -5
  38. package/src/oclif/commands/pull.js +1 -1
  39. package/src/oclif/commands/push.js +5 -2
  40. package/src/oclif/commands/register.js +8 -8
  41. package/src/oclif/commands/scaffold.js +4 -4
  42. package/src/oclif/commands/team/add.js +3 -3
  43. package/src/oclif/commands/team/get.js +2 -2
  44. package/src/oclif/commands/test.js +4 -4
  45. package/src/oclif/commands/upload.js +1 -1
  46. package/src/oclif/commands/users/add.js +3 -3
  47. package/src/oclif/commands/users/get.js +4 -4
  48. package/src/oclif/commands/users/links.js +1 -1
  49. package/src/oclif/commands/validate.js +5 -5
  50. package/src/oclif/commands/versions.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-cli",
3
- "version": "18.4.0",
3
+ "version": "18.5.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/",
@@ -41,7 +41,7 @@
41
41
  "ignore": "7.0.5",
42
42
  "inquirer": "8.2.5",
43
43
  "jscodeshift": "^17.3.0",
44
- "lodash": "4.17.23",
44
+ "lodash": "4.18.1",
45
45
  "luxon": "3.7.1",
46
46
  "marked": "15.0.12",
47
47
  "marked-terminal": "7.3.0",
@@ -87,8 +87,8 @@
87
87
  "additionalVersionFlags": [
88
88
  "-v"
89
89
  ],
90
- "bin": "zapier",
91
- "dirname": "zapier",
90
+ "bin": "zapier-platform",
91
+ "dirname": "zapier-platform",
92
92
  "plugins": [
93
93
  "@oclif/plugin-autocomplete",
94
94
  "@oclif/plugin-help",
@@ -20,6 +20,7 @@ module.exports = [
20
20
  // features
21
21
  'dynamic-dropdown',
22
22
  'files',
23
+ 'line-items',
23
24
  'middleware',
24
25
  'resource',
25
26
  'rest-hooks',
@@ -217,6 +217,7 @@ const TEMPLATE_ROUTES = {
217
217
  'digest-auth': writeForAuthTemplate,
218
218
  'dynamic-dropdown': writeForStandaloneTemplate,
219
219
  files: writeForStandaloneTemplate,
220
+ 'line-items': writeForStandaloneTemplate,
220
221
  minimal: writeForMinimalTemplate,
221
222
  'oauth1-trello': writeForAuthTemplate,
222
223
  oauth2: writeForAuthTemplate,
@@ -246,12 +247,12 @@ const ProjectGeneratorPromise = createGeneratorClass((Generator) => {
246
247
  this.destinationRoot(path.resolve(this.options.path));
247
248
 
248
249
  const jsFilter = filter(['*.js', '*.json', '*.ts'], { restore: true });
249
- this.queueTransformStream([
250
+ this.queueTransformStream(
250
251
  { disabled: true },
251
252
  jsFilter,
252
253
  prettier({ singleQuote: true }),
253
254
  jsFilter.restore,
254
- ]);
255
+ );
255
256
  }
256
257
 
257
258
  async prompting() {
@@ -1,34 +1,34 @@
1
1
  # <%= name %>
2
2
 
3
- This Zapier integration project is generated by the `zapier init` CLI command.
3
+ This Zapier integration project is generated by the `zapier-platform init` CLI command.
4
4
 
5
5
  These are what you normally do next:
6
6
 
7
7
  ```bash
8
8
  # Install dependencies
9
- npm install # or you can use pnpm or yarn
9
+ npm install --ignore-scripts # or you can use pnpm or yarn
10
10
 
11
11
  # Run tests
12
- zapier test
12
+ zapier-platform test
13
13
 
14
14
  # Register the integration on Zapier if you haven't
15
- zapier register "App Title"
15
+ zapier-platform register "App Title"
16
16
 
17
17
  # Or you can link to an existing integration on Zapier
18
- zapier link
18
+ zapier-platform link
19
19
 
20
20
  # Push it to Zapier
21
- zapier push
21
+ zapier-platform push
22
22
  ```
23
23
 
24
- Then, to add more features, you can use the `zapier scaffold` command, for example:
24
+ Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
25
25
 
26
26
  ```bash
27
27
  # Add a trigger
28
- zapier scaffold trigger contact
28
+ zapier-platform scaffold trigger contact
29
29
 
30
30
  # Add an action
31
- zapier scaffold create contact
31
+ zapier-platform scaffold create contact
32
32
  ```
33
33
 
34
34
  Find out more on the latest docs: https://docs.zapier.com/platform
@@ -0,0 +1,16 @@
1
+ # line-items
2
+
3
+ An example integration demonstrating line item support. Line items are fields
4
+ with a `children` property that represent structured, repeating data — like rows
5
+ in a spreadsheet or items in an order.
6
+
7
+ ## Testing with `zapier-platform invoke`
8
+
9
+ ```bash
10
+ # Non-interactive with JSON input
11
+ zapier-platform invoke create order --non-interactive \
12
+ -i '{"name": "My Order", "line_items": [{"product_name": "Pens", "quantity": "12", "price": "1.50"}]}'
13
+
14
+ # Interactive mode — use the line item editing UI
15
+ zapier-platform invoke create order -i '{"name": "My Order"}'
16
+ ```
@@ -0,0 +1,67 @@
1
+ const perform = async (z, bundle) => {
2
+ const response = await z.request({
3
+ url: 'https://httpbin.zapier-tooling.com/post',
4
+ method: 'POST',
5
+ body: {
6
+ name: bundle.inputData.name,
7
+ line_items: bundle.inputData.line_items,
8
+ },
9
+ });
10
+
11
+ return response.data;
12
+ };
13
+
14
+ module.exports = {
15
+ key: 'order',
16
+ noun: 'Order',
17
+ display: {
18
+ label: 'Create Order',
19
+ description: 'Creates a new order with line items.',
20
+ },
21
+ operation: {
22
+ inputFields: [
23
+ { key: 'name', required: true, type: 'string', label: 'Order Name' },
24
+ {
25
+ key: 'line_items',
26
+ label: 'Line Items',
27
+ children: [
28
+ {
29
+ key: 'product_name',
30
+ type: 'string',
31
+ label: 'Product Name',
32
+ required: true,
33
+ },
34
+ {
35
+ key: 'quantity',
36
+ type: 'integer',
37
+ label: 'Quantity',
38
+ required: true,
39
+ },
40
+ { key: 'price', type: 'number', label: 'Unit Price' },
41
+ ],
42
+ },
43
+ ],
44
+ perform,
45
+ sample: {
46
+ id: 1,
47
+ name: 'Stationery Order',
48
+ line_items: [
49
+ { product_name: 'Pens', quantity: 12, price: 1.5 },
50
+ { product_name: 'Notebooks', quantity: 3, price: 8.99 },
51
+ ],
52
+ },
53
+ outputFields: [
54
+ { key: 'id', label: 'ID' },
55
+ { key: 'name', label: 'Order Name' },
56
+ {
57
+ key: 'line_items',
58
+ label: 'Line Items',
59
+ children: [
60
+ { key: 'product_name', label: 'Product Name' },
61
+ { key: 'quantity', label: 'Quantity' },
62
+ { key: 'price', label: 'Unit Price' },
63
+ ],
64
+ },
65
+ ],
66
+ },
67
+ };
@@ -0,0 +1,12 @@
1
+ const order = require('./creates/order');
2
+
3
+ const App = {
4
+ version: require('./package.json').version,
5
+ platformVersion: require('zapier-platform-core').version,
6
+
7
+ creates: {
8
+ [order.key]: order,
9
+ },
10
+ };
11
+
12
+ module.exports = App;
@@ -0,0 +1,30 @@
1
+ /* globals describe, expect, test */
2
+
3
+ const zapier = require('zapier-platform-core');
4
+
5
+ const App = require('../index');
6
+ const appTester = zapier.createAppTester(App);
7
+ zapier.tools.env.inject();
8
+
9
+ describe('creates', () => {
10
+ test('create order with line items', async () => {
11
+ const bundle = {
12
+ inputData: {
13
+ name: 'Test Order',
14
+ line_items: [
15
+ { product_name: 'Pens', quantity: 12, price: 1.5 },
16
+ { product_name: 'Notebooks', quantity: 3, price: 8.99 },
17
+ ],
18
+ },
19
+ };
20
+ const result = await appTester(
21
+ App.creates.order.operation.perform,
22
+ bundle,
23
+ );
24
+ const body = JSON.parse(result.data);
25
+ expect(body.name).toBe('Test Order');
26
+ expect(body.line_items).toHaveLength(2);
27
+ expect(body.line_items[0].product_name).toBe('Pens');
28
+ expect(body.line_items[1].quantity).toBe(3);
29
+ });
30
+ });
@@ -267,7 +267,7 @@ class ZapierBaseCommand extends Command {
267
267
  }));
268
268
  const visibleArgv = argv.filter((arg) => !arg.hidden);
269
269
 
270
- return ['zapier', name, ...visibleArgv.map(formatArg)].join(' ');
270
+ return ['zapier-platform', name, ...visibleArgv.map(formatArg)].join(' ');
271
271
  }
272
272
 
273
273
  // this is fine for now but we'll want to hack into https://github.com/oclif/plugin-help/blob/master/src/command.ts at some point
@@ -40,7 +40,7 @@ AnalyticsCommand.flags = buildFlags({
40
40
  }),
41
41
  },
42
42
  });
43
- AnalyticsCommand.examples = ['zapier analytics --mode enabled'];
43
+ AnalyticsCommand.examples = ['zapier-platform analytics --mode enabled'];
44
44
  AnalyticsCommand.description = `Show the status of the analytics that are collected. Also used to change what is collected.`;
45
45
  AnalyticsCommand.skipValidInstallCheck = true;
46
46
 
@@ -24,12 +24,12 @@ class BuildCommand extends BaseCommand {
24
24
 
25
25
  this.log(
26
26
  `\nBuild complete! Created ${BUILD_PATH} and ${SOURCE_PATH}.\n` +
27
- `Now you can upload them with the ${colors.bold.underline('zapier upload')} command.`,
27
+ `Now you can upload them with the ${colors.bold.underline('zapier-platform upload')} command.`,
28
28
  );
29
29
 
30
30
  if (!skipDepInstall) {
31
31
  this.log(
32
- `\nTip: Try ${colors.bold.underline('zapier build --skip-dep-install')} for faster builds.`,
32
+ `\nTip: Try ${colors.bold.underline('zapier-platform build --skip-dep-install')} for faster builds.`,
33
33
  );
34
34
  }
35
35
  }
@@ -64,6 +64,6 @@ This command does the following:
64
64
  * Zips up all needed \`.js\` files. If you want to include more files, add a "includeInBuild" property (array with strings of regexp paths) to your \`${CURRENT_APP_FILE}\`.
65
65
  * Moves the zip to \`${BUILD_PATH}\` and \`${SOURCE_PATH}\` and deletes the temp folder
66
66
 
67
- This command is typically followed by \`zapier upload\`.`;
67
+ This command is typically followed by \`zapier-platform upload\`.`;
68
68
 
69
69
  module.exports = BuildCommand;
@@ -104,9 +104,12 @@ ClearCacheCommand.description = `Clear the cache data for a major version.
104
104
 
105
105
  This command clears the cache data for a major version of your integration.
106
106
  The job will be run in the background and may take some time to complete.
107
- You can check \`zapier history\` to see the job status.
107
+ You can check \`zapier-platform history\` to see the job status.
108
108
  `;
109
- ClearCacheCommand.examples = [`zapier cache:clear`, `zapier cache:clear 2`];
109
+ ClearCacheCommand.examples = [
110
+ `zapier-platform cache:clear`,
111
+ `zapier-platform cache:clear 2`,
112
+ ];
110
113
  ClearCacheCommand.skipValidInstallCheck = true;
111
114
  ClearCacheCommand.hide = true;
112
115
 
@@ -24,7 +24,7 @@ class CanaryCreateCommand extends ZapierBaseCommand {
24
24
  this
25
25
  .log(`A canary deployment already exists from version ${existingCanary.from_version} to version ${existingCanary.to_version}, there are ${secondsRemaining} seconds remaining.
26
26
 
27
- If you would like to stop this canary now, run \`zapier canary:delete ${existingCanary.from_version} ${existingCanary.to_version}\``);
27
+ If you would like to stop this canary now, run \`zapier-platform canary:delete ${existingCanary.from_version} ${existingCanary.to_version}\``);
28
28
  return;
29
29
  }
30
30
 
@@ -126,7 +126,7 @@ CanaryCreateCommand.args = {
126
126
 
127
127
  CanaryCreateCommand.description = `Create a new canary deployment, diverting a specified percentage of traffic from one version to another for a specified duration.
128
128
 
129
- Only one canary can be active at the same time. You can run \`zapier canary:list\` to check. If you would like to create a new canary with different parameters, you can wait for the canary to finish, or delete it using \`zapier canary:delete a.b.c x.y.z\`.
129
+ Only one canary can be active at the same time. You can run \`zapier-platform canary:list\` to check. If you would like to create a new canary with different parameters, you can wait for the canary to finish, or delete it using \`zapier-platform canary:delete a.b.c x.y.z\`.
130
130
 
131
131
  To canary traffic for a specific user, use the --user flag.
132
132
 
@@ -134,15 +134,15 @@ To canary traffic for an entire account, use the --account-id. Note: this scenar
134
134
 
135
135
  To canary traffic for a specific user within a specific account, use both --user and --account-id flags.
136
136
 
137
- Note: this is similar to \`zapier migrate\` but different in that this is temporary and will "revert" the changes once the specified duration is expired.
137
+ Note: this is similar to \`zapier-platform migrate\` but different in that this is temporary and will "revert" the changes once the specified duration is expired.
138
138
 
139
139
  **Only use this command to canary traffic between non-breaking versions!**`;
140
140
 
141
141
  CanaryCreateCommand.examples = [
142
- 'zapier canary:create 1.0.0 1.1.0 -p 10 -d 3600',
143
- 'zapier canary:create 2.0.0 2.1.0 --percent 25 --duration 1800 --user user@example.com',
144
- 'zapier canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345 -u user@example.com',
145
- 'zapier canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345',
142
+ 'zapier-platform canary:create 1.0.0 1.1.0 -p 10 -d 3600',
143
+ 'zapier-platform canary:create 2.0.0 2.1.0 --percent 25 --duration 1800 --user user@example.com',
144
+ 'zapier-platform canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345 -u user@example.com',
145
+ 'zapier-platform canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345',
146
146
  ];
147
147
  CanaryCreateCommand.skipValidInstallCheck = true;
148
148
 
@@ -63,7 +63,7 @@ CanaryDeleteCommand.args = {
63
63
  }),
64
64
  };
65
65
  CanaryDeleteCommand.description = 'Delete an active canary deployment';
66
- CanaryDeleteCommand.examples = ['zapier canary:delete 1.0.0 1.1.0'];
66
+ CanaryDeleteCommand.examples = ['zapier-platform canary:delete 1.0.0 1.1.0'];
67
67
  CanaryDeleteCommand.skipValidInstallCheck = true;
68
68
 
69
69
  module.exports = CanaryDeleteCommand;
@@ -34,7 +34,7 @@ class CanaryListCommand extends ZapierBaseCommand {
34
34
 
35
35
  CanaryListCommand.flags = buildFlags({ opts: { format: true } });
36
36
  CanaryListCommand.description = 'List all active canary deployments';
37
- CanaryListCommand.examples = ['zapier canary:list'];
37
+ CanaryListCommand.examples = ['zapier-platform canary:list'];
38
38
  CanaryListCommand.skipValidInstallCheck = true;
39
39
 
40
40
  module.exports = CanaryListCommand;
@@ -156,7 +156,7 @@ The resulting CLI integration will be identical to its Visual Builder version an
156
156
 
157
157
  If you re-run this command on an existing directory it will leave existing files alone and not clobber them.
158
158
 
159
- You'll need to do a \`zapier push\` before the new version is visible in the editor, but otherwise you're good to go.`;
159
+ You'll need to do a \`zapier-platform push\` before the new version is visible in the editor, but otherwise you're good to go.`;
160
160
 
161
161
  ConvertCommand.skipValidInstallCheck = true;
162
162
 
@@ -17,7 +17,7 @@ class DeleteAppCommand extends BaseCommand {
17
17
  DeleteAppCommand.flags = buildFlags();
18
18
  DeleteAppCommand.description = `Delete your integration (including all versions).
19
19
 
20
- This 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.`;
20
+ This only works if there are no active users or Zaps on any version. If you only want to delete certain versions, use the \`zapier-platform 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.`;
21
21
  DeleteAppCommand.aliases = ['delete:app'];
22
22
  DeleteAppCommand.skipValidInstallCheck = true;
23
23
 
@@ -27,6 +27,6 @@ DeleteVersionCommand.flags = buildFlags();
27
27
  DeleteVersionCommand.skipValidInstallCheck = true;
28
28
  DeleteVersionCommand.description = `Delete a specific version of your integration.
29
29
 
30
- This 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.`;
30
+ This only works if there are no users or Zaps on that version. You will probably need to have run \`zapier-platform migrate\` and \`zapier-platform deprecate\` before this command will work.`;
31
31
 
32
32
  module.exports = DeleteVersionCommand;
@@ -23,7 +23,7 @@ class DeprecateCommand extends BaseCommand {
23
23
 
24
24
  this.log(
25
25
  `${colors.yellow('Warning: Deprecation is an irreversible action that will eventually block access to this version.')}\n` +
26
- `${colors.yellow('If all your changes are non-breaking, use `zapier migrate` instead to move users over to a newer version.')}\n`,
26
+ `${colors.yellow('If all your changes are non-breaking, use `zapier-platform migrate` instead to move users over to a newer version.')}\n`,
27
27
  );
28
28
 
29
29
  // Get deprecation reason - either from flag or prompt user
@@ -118,9 +118,9 @@ DeprecateCommand.args = {
118
118
  }),
119
119
  };
120
120
  DeprecateCommand.examples = [
121
- 'zapier deprecate 1.2.3 2011-10-01',
122
- 'zapier deprecate 1.2.3 2011-10-01 --reason=security_vulnerability',
123
- 'zapier deprecate 1.2.3 2011-10-01 -r critical_bug',
121
+ 'zapier-platform deprecate 1.2.3 2011-10-01',
122
+ 'zapier-platform deprecate 1.2.3 2011-10-01 --reason=security_vulnerability',
123
+ 'zapier-platform deprecate 1.2.3 2011-10-01 -r critical_bug',
124
124
  ];
125
125
  DeprecateCommand.description = `Mark a non-production version of your integration as deprecated, with removal by a certain date.
126
126
 
@@ -95,7 +95,7 @@ class DescribeCommand extends BaseCommand {
95
95
  authentication.redirect_uri = version.oauth_redirect_uri;
96
96
  } else {
97
97
  authentication.redirect_uri = grey(
98
- 'Run `zapier push` to see the redirect_uri.',
98
+ 'Run `zapier-platform push` to see the redirect_uri.',
99
99
  );
100
100
  }
101
101
  }
@@ -182,13 +182,13 @@ class DescribeCommand extends BaseCommand {
182
182
  ['Available Methods', 'paths', grey('n/a')],
183
183
  ],
184
184
  emptyMessage: grey(
185
- `Nothing found for ${type}. Use the \`zapier scaffold\` command to add one.`,
185
+ `Nothing found for ${type}. Use the \`zapier-platform scaffold\` command to add one.`,
186
186
  ),
187
187
  });
188
188
 
189
189
  this.log();
190
190
 
191
- this.log('To add more, use the `zapier scaffold` command.');
191
+ this.log('To add more, use the `zapier-platform scaffold` command.');
192
192
  });
193
193
  }
194
194
  }
@@ -19,7 +19,7 @@ class GetEnvCommand extends BaseCommand {
19
19
  emptyMessage: `Version ${version} has no environment values set`,
20
20
  });
21
21
 
22
- this.log('Set new values with `zapier env:set`');
22
+ this.log('Set new values with `zapier-platform env:set`');
23
23
  }
24
24
  }
25
25
 
@@ -31,7 +31,7 @@ GetEnvCommand.args = {
31
31
  };
32
32
  GetEnvCommand.flags = buildFlags({ opts: { format: true } });
33
33
  GetEnvCommand.description = `Get environment variables for a version.`;
34
- GetEnvCommand.examples = [`zapier env:get 1.2.3`];
34
+ GetEnvCommand.examples = [`zapier-platform env:get 1.2.3`];
35
35
  GetEnvCommand.skipValidInstallCheck = true;
36
36
 
37
37
  module.exports = GetEnvCommand;
@@ -104,7 +104,9 @@ SetEnvCommand.flags = buildFlags({
104
104
  },
105
105
  });
106
106
  SetEnvCommand.description = `Set environment variables for a version.`;
107
- SetEnvCommand.examples = [`zapier env:set 1.2.3 SECRET=12345 OTHER=4321`];
107
+ SetEnvCommand.examples = [
108
+ `zapier-platform env:set 1.2.3 SECRET=12345 OTHER=4321`,
109
+ ];
108
110
  SetEnvCommand.strict = false;
109
111
  SetEnvCommand.skipValidInstallCheck = true;
110
112
 
@@ -90,7 +90,7 @@ UnsetEnvCommand.flags = buildFlags({
90
90
  },
91
91
  });
92
92
  UnsetEnvCommand.description = `Unset environment variables for a version.`;
93
- UnsetEnvCommand.examples = [`zapier env:unset 1.2.3 SECRET OTHER`];
93
+ UnsetEnvCommand.examples = [`zapier-platform env:unset 1.2.3 SECRET OTHER`];
94
94
  UnsetEnvCommand.strict = false;
95
95
  UnsetEnvCommand.skipValidInstallCheck = true;
96
96
 
@@ -56,16 +56,16 @@ InitCommand.args = {
56
56
  }),
57
57
  };
58
58
  InitCommand.examples = [
59
- 'zapier init myapp',
60
- 'zapier init ./path/myapp --template oauth2',
61
- 'zapier init ./path/myapp --template minimal --module esm',
62
- 'zapier init ./path/myapp --template oauth2 --language typescript',
59
+ 'zapier-platform init myapp',
60
+ 'zapier-platform init ./path/myapp --template oauth2',
61
+ 'zapier-platform init ./path/myapp --template minimal --module esm',
62
+ 'zapier-platform init ./path/myapp --template oauth2 --language typescript',
63
63
  ];
64
64
  InitCommand.description = `Initialize a new Zapier integration with a project template.
65
65
 
66
66
  After running this, you'll have a new integration in the specified directory. If you re-run this command on an existing directory, it will prompt before overwriting any existing files.
67
67
 
68
- This doesn't register or deploy the integration with Zapier - try the \`zapier register\` and \`zapier push\` commands for that!`;
68
+ This doesn't register or deploy the integration with Zapier - try the \`zapier-platform register\` and \`zapier-platform push\` commands for that!`;
69
69
 
70
70
  InitCommand.skipValidInstallCheck = true;
71
71
 
@@ -19,7 +19,8 @@ class IntegrationsCommand extends BaseCommand {
19
19
  ['Date Created', 'date'],
20
20
  ['Linked', 'linked'],
21
21
  ],
22
- emptyMessage: 'No integrations found, try the `zapier register` command.',
22
+ emptyMessage:
23
+ 'No integrations found, try the `zapier-platform register` command.',
23
24
  });
24
25
  }
25
26
  }
@@ -1,4 +1,5 @@
1
1
  const debug = require('debug')('zapier:invoke');
2
+ const _ = require('lodash');
2
3
 
3
4
  const { startSpinner, endSpinner } = require('../../../utils/display');
4
5
  const { customLogger } = require('./logger');
@@ -71,8 +72,9 @@ const invokeAction = async (command, context) => {
71
72
  await promptForFields(command, context, inputFields, invokeAction);
72
73
  }
73
74
 
74
- // Preserve original inputData as inputDataRaw before type resolution
75
- const inputDataRaw = { ...context.inputData };
75
+ // Preserve original inputData as inputDataRaw before type resolution (deep
76
+ // copy needed because resolveInputDataTypes mutates nested objects in-place)
77
+ const inputDataRaw = _.cloneDeep(context.inputData);
76
78
  let inputData;
77
79
  if (context.remote) {
78
80
  // Let the remote server resolve input data types
@@ -69,7 +69,7 @@ const refreshAuth = async (context) => {
69
69
  }
70
70
  if (_.isEmpty(context.authData)) {
71
71
  throw new Error(
72
- 'No auth data found in the .env file. Run `zapier invoke auth start` first to initialize the auth data.',
72
+ 'No auth data found in the .env file. Run `zapier-platform invoke auth start` first to initialize the auth data.',
73
73
  );
74
74
  }
75
75
  switch (authentication.type) {
@@ -146,10 +146,12 @@ class InvokeCommand extends BaseCommand {
146
146
  context.appId = (await getLinkedAppConfig(null, false))?.id;
147
147
  context.deployKey = (await readCredentials(false))[AUTH_KEY];
148
148
 
149
+ const hasAuth = Boolean(context.appDefinition.authentication);
150
+
149
151
  if (
150
152
  context.authId === '-' ||
151
153
  context.authId === '' ||
152
- (context.remote && !context.authId)
154
+ (context.remote && !context.authId && hasAuth)
153
155
  ) {
154
156
  if (context.nonInteractive) {
155
157
  throw new Error(
@@ -159,6 +161,12 @@ class InvokeCommand extends BaseCommand {
159
161
  context.authId = (await promptForAuthentication(this)).toString();
160
162
  }
161
163
 
164
+ if (context.remote && !context.authId && !hasAuth) {
165
+ // The remote invoke API requires authentication_id in the POST body,
166
+ // but the server accepts 0 for apps without authentication configured.
167
+ context.authId = '0';
168
+ }
169
+
162
170
  if (context.authId) {
163
171
  context.authId = parseInt(context.authId);
164
172
  if (isNaN(context.authId)) {
@@ -482,7 +490,6 @@ The \`--debug\` flag will show you the HTTP request logs and any console logs yo
482
490
  The following is a non-exhaustive list of current limitations in local and relay mode. We may support them in the future.
483
491
 
484
492
  - Hook triggers, including REST hook subscribe/unsubscribe
485
- - Line items
486
493
  - Output hydration
487
494
  - File upload
488
495
  - Function-based connection label
@@ -57,7 +57,8 @@ const parseDecimal = (s) => {
57
57
  }
58
58
  }
59
59
  const cleaned = chars.join('').replace(/[.,-]$/, '');
60
- return parseFloat(cleaned);
60
+ const result = parseFloat(cleaned);
61
+ return isNaN(result) ? 0 : result;
61
62
  };
62
63
 
63
64
  /**
@@ -232,7 +233,14 @@ const resolveInputDataTypes = (inputData, inputFields, timezone) => {
232
233
  }
233
234
  }
234
235
 
235
- // TODO: Handle line items (fields with "children")
236
+ // Handle line items (fields with "children")
237
+ for (const field of inputFields) {
238
+ if (field.children && field.children.length && Array.isArray(inputData[field.key])) {
239
+ for (const item of inputData[field.key]) {
240
+ resolveInputDataTypes(item, field.children, timezone);
241
+ }
242
+ }
243
+ }
236
244
 
237
245
  return inputData;
238
246
  };