zapier-platform-cli 15.19.0 → 16.1.0
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/oclif.manifest.json +2316 -1
- package/package.json +39 -32
- package/src/bin/run +4 -4
- package/src/bin/run.cmd +0 -3
- package/src/constants.js +2 -2
- package/src/generators/index.js +11 -11
- package/src/generators/templates/dynamic-dropdown/README.md +1 -1
- package/src/generators/templates/dynamic-dropdown/triggers/people.js +2 -2
- package/src/generators/templates/dynamic-dropdown/triggers/species.js +2 -2
- package/src/index.js +1 -1
- package/src/oclif/ZapierBaseCommand.js +52 -45
- package/src/oclif/buildFlags.js +14 -16
- package/src/oclif/commands/analytics.js +6 -6
- package/src/oclif/commands/build.js +6 -6
- package/src/oclif/commands/cache/clear.js +13 -13
- package/src/oclif/commands/canary/create.js +27 -20
- package/src/oclif/commands/canary/delete.js +26 -16
- package/src/oclif/commands/canary/list.js +5 -7
- package/src/oclif/commands/convert.js +16 -16
- package/src/oclif/commands/delete/version.js +6 -6
- package/src/oclif/commands/deprecate.js +10 -11
- package/src/oclif/commands/describe.js +5 -5
- package/src/oclif/commands/env/get.js +5 -5
- package/src/oclif/commands/env/set.js +11 -12
- package/src/oclif/commands/env/unset.js +9 -10
- package/src/oclif/commands/history.js +1 -0
- package/src/oclif/commands/init.js +12 -13
- package/src/oclif/commands/invoke.js +67 -69
- package/src/oclif/commands/jobs.js +1 -1
- package/src/oclif/commands/link.js +2 -2
- package/src/oclif/commands/login.js +15 -15
- package/src/oclif/commands/logout.js +1 -1
- package/src/oclif/commands/logs.js +9 -9
- package/src/oclif/commands/migrate.js +19 -22
- package/src/oclif/commands/promote.js +25 -27
- package/src/oclif/commands/push.js +2 -2
- package/src/oclif/commands/register.js +31 -32
- package/src/oclif/commands/scaffold.js +15 -17
- package/src/oclif/commands/team/add.js +12 -15
- package/src/oclif/commands/team/get.js +2 -2
- package/src/oclif/commands/team/remove.js +6 -6
- package/src/oclif/commands/test.js +8 -8
- package/src/oclif/commands/upload.js +1 -1
- package/src/oclif/commands/users/add.js +9 -11
- package/src/oclif/commands/users/get.js +7 -7
- package/src/oclif/commands/users/links.js +4 -4
- package/src/oclif/commands/users/remove.js +8 -9
- package/src/oclif/commands/validate.js +29 -21
- package/src/oclif/commands/versions.js +26 -1
- package/src/oclif/hooks/checkValidNodeVersion.js +1 -1
- package/src/oclif/hooks/deprecated.js +1 -1
- package/src/oclif/hooks/getAppRegistrationFieldChoices.js +4 -4
- package/src/oclif/hooks/renderMarkdownHelp.js +6 -7
- package/src/oclif/hooks/versionInfo.js +2 -2
- package/src/utils/analytics.js +20 -7
- package/src/utils/api.js +27 -30
- package/src/utils/ast.js +15 -15
- package/src/utils/auth-files-codegen.js +102 -99
- package/src/utils/build.js +27 -28
- package/src/utils/changelog.js +1 -1
- package/src/utils/check-missing-app-info.js +2 -2
- package/src/utils/convert.js +26 -20
- package/src/utils/credentials.js +1 -1
- package/src/utils/display.js +31 -8
- package/src/utils/files.js +3 -3
- package/src/utils/ignore.js +2 -2
- package/src/utils/local.js +1 -1
- package/src/utils/metadata.js +1 -1
- package/src/utils/misc.js +21 -22
- package/src/utils/promisify.js +1 -1
- package/src/utils/scaffold.js +12 -12
- package/src/utils/team.js +3 -3
- package/src/utils/xdg.js +3 -3
- package/src/version-store.js +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const ZapierBaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
-
|
|
2
|
+
const { Args } = require('@oclif/core');
|
|
3
3
|
const { cyan } = require('colors/safe');
|
|
4
4
|
const { buildFlags } = require('../../buildFlags');
|
|
5
5
|
const { callAPI } = require('../../../utils/api');
|
|
@@ -29,7 +29,7 @@ class TeamAddCommand extends ZapierBaseCommand {
|
|
|
29
29
|
`About to invite ${cyan(this.args.email)} to as a team member at the ${
|
|
30
30
|
this.args.role
|
|
31
31
|
} level. An email will be sent with the following message:\n\n"${message}"\n\nIs that ok?`,
|
|
32
|
-
true
|
|
32
|
+
true,
|
|
33
33
|
))
|
|
34
34
|
) {
|
|
35
35
|
this.log('\ncancelled');
|
|
@@ -42,8 +42,8 @@ class TeamAddCommand extends ZapierBaseCommand {
|
|
|
42
42
|
role === 'admin'
|
|
43
43
|
? `/apps/${id}/collaborators`
|
|
44
44
|
: role === 'subscriber'
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
? `${BASE_ENDPOINT}/api/platform/v3/integrations/${id}/subscribers`
|
|
46
|
+
: `/apps/${id}/limited_collaborators`;
|
|
47
47
|
|
|
48
48
|
await callAPI(url, {
|
|
49
49
|
url: url.startsWith('http') ? url : undefined,
|
|
@@ -54,26 +54,23 @@ class TeamAddCommand extends ZapierBaseCommand {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
TeamAddCommand.args =
|
|
58
|
-
{
|
|
59
|
-
name: 'email',
|
|
57
|
+
TeamAddCommand.args = {
|
|
58
|
+
email: Args.string({
|
|
60
59
|
description:
|
|
61
60
|
"The user to be invited. If they don't have a Zapier account, they'll be prompted to create one.",
|
|
62
61
|
required: true,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'role',
|
|
62
|
+
}),
|
|
63
|
+
role: Args.string({
|
|
66
64
|
description:
|
|
67
65
|
'The level the invited team member should be at. Admins can edit everything and get email updates. Collaborators have read-access to the app and get email updates. Subscribers only get email updates.',
|
|
68
66
|
options: ['admin', 'collaborator', 'subscriber'],
|
|
69
67
|
required: true,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: 'message',
|
|
68
|
+
}),
|
|
69
|
+
message: Args.string({
|
|
73
70
|
description:
|
|
74
71
|
'A message sent in the email to your team member, if you need to provide context. Wrap the message in quotes to ensure spaces get saved.',
|
|
75
|
-
},
|
|
76
|
-
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
77
74
|
TeamAddCommand.flags = buildFlags();
|
|
78
75
|
TeamAddCommand.description = `Add a team member to your integration.
|
|
79
76
|
|
|
@@ -17,7 +17,7 @@ class TeamRemoveCommand extends ZapierBaseCommand {
|
|
|
17
17
|
value: { id, email, role: transformUserRole(role) },
|
|
18
18
|
name: `${email} (${transformUserRole(role)})`,
|
|
19
19
|
short: email,
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
this.stopSpinner();
|
|
@@ -28,15 +28,15 @@ class TeamRemoveCommand extends ZapierBaseCommand {
|
|
|
28
28
|
id: invitationId,
|
|
29
29
|
} = await this.promptWithList(
|
|
30
30
|
'Which team member do you want to remove?',
|
|
31
|
-
choices
|
|
31
|
+
choices,
|
|
32
32
|
);
|
|
33
33
|
this.log();
|
|
34
34
|
if (
|
|
35
35
|
!(await this.confirm(
|
|
36
36
|
`About to revoke ${cyan(role)}-level access from ${cyan(
|
|
37
|
-
email
|
|
37
|
+
email,
|
|
38
38
|
)}. Are you sure?`,
|
|
39
|
-
true
|
|
39
|
+
true,
|
|
40
40
|
))
|
|
41
41
|
) {
|
|
42
42
|
this.log('\ncancelled');
|
|
@@ -49,8 +49,8 @@ class TeamRemoveCommand extends ZapierBaseCommand {
|
|
|
49
49
|
role === 'admin'
|
|
50
50
|
? `/apps/${appId}/collaborators/${invitationId}`
|
|
51
51
|
: role === 'subscriber'
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
? `${BASE_ENDPOINT}/api/platform/v3/integrations/${appId}/subscribers/${invitationId}`
|
|
53
|
+
: `/apps/${appId}/limited_collaborators`;
|
|
54
54
|
|
|
55
55
|
await callAPI(url, {
|
|
56
56
|
url: url.startsWith('http') ? url : undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { Flags } = require('@oclif/core');
|
|
2
2
|
const chalk = require('chalk');
|
|
3
3
|
|
|
4
4
|
const BaseCommand = require('../ZapierBaseCommand');
|
|
@@ -27,7 +27,7 @@ class TestCommand extends BaseCommand {
|
|
|
27
27
|
const credentials = await readCredentials(false);
|
|
28
28
|
if (credentials.deployKey) {
|
|
29
29
|
this.log(
|
|
30
|
-
`Adding ${constants.AUTH_LOCATION} to environment as ZAPIER_DEPLOY_KEY
|
|
30
|
+
`Adding ${constants.AUTH_LOCATION} to environment as ZAPIER_DEPLOY_KEY...`,
|
|
31
31
|
);
|
|
32
32
|
extraEnv.ZAPIER_DEPLOY_KEY = credentials.deployKey;
|
|
33
33
|
}
|
|
@@ -53,10 +53,10 @@ class TestCommand extends BaseCommand {
|
|
|
53
53
|
// but the space-joined array made that unclear
|
|
54
54
|
this.log(
|
|
55
55
|
`\n ${chalk.cyanBright.bold(
|
|
56
|
-
packageManager.executable
|
|
56
|
+
packageManager.executable,
|
|
57
57
|
)} ${chalk.cyanBright(
|
|
58
|
-
argv.map((a) => (a.includes(' ') ? `"${a}"` : a)).join(' ')
|
|
59
|
-
)}\n
|
|
58
|
+
argv.map((a) => (a.includes(' ') ? `"${a}"` : a)).join(' '),
|
|
59
|
+
)}\n`,
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
const output = await runCommand(packageManager.executable, argv, {
|
|
@@ -71,15 +71,15 @@ class TestCommand extends BaseCommand {
|
|
|
71
71
|
|
|
72
72
|
TestCommand.flags = buildFlags({
|
|
73
73
|
commandFlags: {
|
|
74
|
-
'skip-validate':
|
|
74
|
+
'skip-validate': Flags.boolean({
|
|
75
75
|
description:
|
|
76
76
|
"Forgo running `zapier validate` before tests are run. This will speed up tests if you're modifying functionality of an existing integration rather than adding new actions.",
|
|
77
77
|
}),
|
|
78
|
-
yarn:
|
|
78
|
+
yarn: Flags.boolean({
|
|
79
79
|
description:
|
|
80
80
|
"Use `yarn` instead of `npm`. This happens automatically if there's a `yarn.lock` file, but you can manually force `yarn` if you run tests from a sub-directory.",
|
|
81
81
|
}),
|
|
82
|
-
pnpm:
|
|
82
|
+
pnpm: Flags.boolean({
|
|
83
83
|
description:
|
|
84
84
|
"Use `pnpm` instead of `npm`. This happens automatically if there's a `pnpm-lock.yaml` file, but you can manually force `pnpm` if you run tests from a sub-directory.",
|
|
85
85
|
}),
|
|
@@ -10,7 +10,7 @@ class UploadCommand extends BaseCommand {
|
|
|
10
10
|
// it would be cool if we differentiated between new/updated here
|
|
11
11
|
await buildAndOrUpload({ upload: true });
|
|
12
12
|
this.log(
|
|
13
|
-
`\nUpload complete! Uploaded ${BUILD_PATH} and ${SOURCE_PATH} to Zapier. If it's a new version, it should now be available in the Zap editor
|
|
13
|
+
`\nUpload complete! Uploaded ${BUILD_PATH} and ${SOURCE_PATH} to Zapier. If it's a new version, it should now be available in the Zap editor.`,
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const ZapierBaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
-
const {
|
|
2
|
+
const { Args, Flags } = require('@oclif/core');
|
|
3
3
|
const { cyan } = require('colors/safe');
|
|
4
4
|
const { buildFlags } = require('../../buildFlags');
|
|
5
5
|
const { callAPI } = require('../../../utils/api');
|
|
@@ -12,7 +12,7 @@ class UsersAddCommand extends ZapierBaseCommand {
|
|
|
12
12
|
`About to invite ${cyan(this.args.email)} to ${
|
|
13
13
|
this.args.version ? `version ${this.args.version}` : 'all versions'
|
|
14
14
|
} of your integration. An invite email will be sent. Is that ok?`,
|
|
15
|
-
true
|
|
15
|
+
true,
|
|
16
16
|
))
|
|
17
17
|
) {
|
|
18
18
|
this.log('\ncancelled');
|
|
@@ -29,22 +29,20 @@ class UsersAddCommand extends ZapierBaseCommand {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
UsersAddCommand.args =
|
|
33
|
-
{
|
|
34
|
-
name: 'email',
|
|
32
|
+
UsersAddCommand.args = {
|
|
33
|
+
email: Args.string({
|
|
35
34
|
description:
|
|
36
35
|
"The user to be invited. If they don't have a Zapier account, they'll be prompted to create one.",
|
|
37
36
|
required: true,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'version',
|
|
37
|
+
}),
|
|
38
|
+
version: Args.string({
|
|
41
39
|
description:
|
|
42
40
|
'A version string (like 1.2.3). Optional, used only if you want to invite a user to a specific version instead of all versions.',
|
|
43
|
-
},
|
|
44
|
-
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
45
43
|
UsersAddCommand.flags = buildFlags({
|
|
46
44
|
commandFlags: {
|
|
47
|
-
force:
|
|
45
|
+
force: Flags.boolean({
|
|
48
46
|
char: 'f',
|
|
49
47
|
description: 'Skip confirmation. Useful for running programatically.',
|
|
50
48
|
}),
|
|
@@ -17,8 +17,8 @@ class UsersListCommand extends ZapierBaseCommand {
|
|
|
17
17
|
|
|
18
18
|
this.log(
|
|
19
19
|
`\n${yellow(
|
|
20
|
-
'Note'
|
|
21
|
-
)} that this list of users is NOT a comprehensive list of everyone who is using your integration. It only includes users who were invited directly by email (using the \`users:add EMAIL\` command or the web UI).\n
|
|
20
|
+
'Note',
|
|
21
|
+
)} that this list of users is NOT a comprehensive list of everyone who is using your integration. It only includes users who were invited directly by email (using the \`users:add EMAIL\` command or the web UI).\n`,
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
this.logTable({
|
|
@@ -33,10 +33,10 @@ class UsersListCommand extends ZapierBaseCommand {
|
|
|
33
33
|
|
|
34
34
|
this.log(
|
|
35
35
|
`\nTo invite users via a link, use the \`${cyan(
|
|
36
|
-
'zapier users:links'
|
|
36
|
+
'zapier users:links',
|
|
37
37
|
)}\` command. To invite a specific user by email, use the \`${cyan(
|
|
38
|
-
'zapier users:add'
|
|
39
|
-
)}\` command
|
|
38
|
+
'zapier users:add',
|
|
39
|
+
)}\` command.`,
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -45,9 +45,9 @@ UsersListCommand.flags = buildFlags({ opts: { format: true } });
|
|
|
45
45
|
UsersListCommand.description = `Get a list of users who have been invited to your integration.
|
|
46
46
|
|
|
47
47
|
Note that this list of users is NOT a comprehensive list of everyone who is using your integration. It only includes users who were invited directly by email (using the \`${cyan(
|
|
48
|
-
'zapier users:add'
|
|
48
|
+
'zapier users:add',
|
|
49
49
|
)}\` command or the web UI). Users who joined by clicking links generated using the \`${cyan(
|
|
50
|
-
'zapier user:links'
|
|
50
|
+
'zapier user:links',
|
|
51
51
|
)}\` command won't show up here.`;
|
|
52
52
|
UsersListCommand.aliases = ['users:list'];
|
|
53
53
|
UsersListCommand.skipValidInstallCheck = true;
|
|
@@ -13,13 +13,13 @@ class UsersLinksCommand extends ZapierBaseCommand {
|
|
|
13
13
|
|
|
14
14
|
this.log(
|
|
15
15
|
`\nYou can invite users to ${bold(
|
|
16
|
-
'all'
|
|
17
|
-
)} versions of your integration using the following link
|
|
16
|
+
'all',
|
|
17
|
+
)} versions of your integration using the following link:`,
|
|
18
18
|
);
|
|
19
19
|
this.log(`\n${cyan(inviteUrl)}\n`);
|
|
20
20
|
|
|
21
21
|
this.log(
|
|
22
|
-
'You can invite users to a specific integration version using the following links:'
|
|
22
|
+
'You can invite users to a specific integration version using the following links:',
|
|
23
23
|
);
|
|
24
24
|
this.logTable({
|
|
25
25
|
rows: Object.entries(versionInviteUrls).map(([version, url]) => ({
|
|
@@ -33,7 +33,7 @@ class UsersLinksCommand extends ZapierBaseCommand {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
this.log(
|
|
36
|
-
'\nTo invite a specific user by email, use the `zapier users:add` command.'
|
|
36
|
+
'\nTo invite a specific user by email, use the `zapier users:add` command.',
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const ZapierBaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
-
const {
|
|
2
|
+
const { Args, Flags } = require('@oclif/core');
|
|
3
3
|
const { cyan } = require('colors/safe');
|
|
4
4
|
const { buildFlags } = require('../../buildFlags');
|
|
5
5
|
const { callAPI } = require('../../../utils/api');
|
|
@@ -10,9 +10,9 @@ class UsersRemoveCommand extends ZapierBaseCommand {
|
|
|
10
10
|
!this.flags.force &&
|
|
11
11
|
!(await this.confirm(
|
|
12
12
|
`About to revoke access to ${cyan(
|
|
13
|
-
this.args.email
|
|
13
|
+
this.args.email,
|
|
14
14
|
)}. They won't be able to see your app in the editor and their Zaps will stop working. Are you sure?`,
|
|
15
|
-
true
|
|
15
|
+
true,
|
|
16
16
|
))
|
|
17
17
|
) {
|
|
18
18
|
this.log('\ncancelled');
|
|
@@ -27,16 +27,15 @@ class UsersRemoveCommand extends ZapierBaseCommand {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
UsersRemoveCommand.args =
|
|
31
|
-
{
|
|
32
|
-
name: 'email',
|
|
30
|
+
UsersRemoveCommand.args = {
|
|
31
|
+
email: Args.string({
|
|
33
32
|
description: 'The user to be removed.',
|
|
34
33
|
required: true,
|
|
35
|
-
},
|
|
36
|
-
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
37
36
|
UsersRemoveCommand.flags = buildFlags({
|
|
38
37
|
commandFlags: {
|
|
39
|
-
force:
|
|
38
|
+
force: Flags.boolean({
|
|
40
39
|
char: 'f',
|
|
41
40
|
description: 'Skips confirmation. Useful for running programatically.',
|
|
42
41
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const colors = require('colors/safe');
|
|
2
|
-
const {
|
|
2
|
+
const { Flags } = require('@oclif/core');
|
|
3
3
|
|
|
4
4
|
const BaseCommand = require('../ZapierBaseCommand');
|
|
5
5
|
const { buildFlags } = require('../buildFlags');
|
|
@@ -29,7 +29,7 @@ class ValidateCommand extends BaseCommand {
|
|
|
29
29
|
|
|
30
30
|
if (newErrors.length) {
|
|
31
31
|
this.log(
|
|
32
|
-
'Your integration is structurally invalid. Address concerns and run this command again.'
|
|
32
|
+
'Your integration is structurally invalid. Address concerns and run this command again.',
|
|
33
33
|
);
|
|
34
34
|
process.exitCode = 1;
|
|
35
35
|
} else {
|
|
@@ -41,8 +41,8 @@ class ValidateCommand extends BaseCommand {
|
|
|
41
41
|
if (process.exitCode === 1) {
|
|
42
42
|
this.log(
|
|
43
43
|
colors.grey(
|
|
44
|
-
'\nSkipping integration checks because schema did not validate.'
|
|
45
|
-
)
|
|
44
|
+
'\nSkipping integration checks because schema did not validate.',
|
|
45
|
+
),
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
return;
|
|
@@ -85,24 +85,32 @@ class ValidateCommand extends BaseCommand {
|
|
|
85
85
|
const suggestionDisplay = checkResult.suggestions.display_label;
|
|
86
86
|
|
|
87
87
|
if (checkIssues.length) {
|
|
88
|
-
this.
|
|
89
|
-
[
|
|
90
|
-
|
|
91
|
-
'
|
|
92
|
-
'properly. They block you from pushing.',
|
|
88
|
+
this.logTable({
|
|
89
|
+
headers: [
|
|
90
|
+
['', 'type'],
|
|
91
|
+
['', 'description'],
|
|
93
92
|
],
|
|
94
|
-
[
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
rows: [
|
|
94
|
+
{
|
|
95
|
+
type: `- ${colors.bold(errorDisplay)}`,
|
|
96
|
+
description:
|
|
97
|
+
'Issues that will prevent your integration from functioning properly. They block you from pushing.',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: `- ${colors.bold(warningDisplay)}`,
|
|
101
|
+
description:
|
|
102
|
+
'To-dos that must be addressed before your integration can be included in the App Directory. They block you from promoting and publishing.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: `- ${colors.bold(suggestionDisplay)}`,
|
|
106
|
+
description:
|
|
107
|
+
"Issues and recommendations that need human reviews by Zapier before publishing your integration. They don't block.",
|
|
108
|
+
},
|
|
99
109
|
],
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
],
|
|
105
|
-
]);
|
|
110
|
+
hasBorder: false,
|
|
111
|
+
showHeaders: false,
|
|
112
|
+
style: { head: [], 'padding-left': 0, 'padding-right': 0 },
|
|
113
|
+
});
|
|
106
114
|
}
|
|
107
115
|
this.log();
|
|
108
116
|
}
|
|
@@ -110,7 +118,7 @@ class ValidateCommand extends BaseCommand {
|
|
|
110
118
|
|
|
111
119
|
ValidateCommand.flags = buildFlags({
|
|
112
120
|
commandFlags: {
|
|
113
|
-
'without-style':
|
|
121
|
+
'without-style': Flags.boolean({
|
|
114
122
|
description: 'Forgo pinging the Zapier server to run further checks.',
|
|
115
123
|
}),
|
|
116
124
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const colors = require('colors/safe');
|
|
2
|
+
|
|
1
3
|
const BaseCommand = require('../ZapierBaseCommand');
|
|
2
4
|
const { buildFlags } = require('../buildFlags');
|
|
3
5
|
|
|
@@ -23,9 +25,32 @@ class VersionCommand extends BaseCommand {
|
|
|
23
25
|
'No versions to show. Try adding one with the `zapier push` command',
|
|
24
26
|
});
|
|
25
27
|
|
|
28
|
+
this.logTable({
|
|
29
|
+
headers: [],
|
|
30
|
+
rows: [
|
|
31
|
+
{
|
|
32
|
+
version: `- ${colors.bold('Errors')}`,
|
|
33
|
+
platform_version:
|
|
34
|
+
'Issues that will prevent your integration from functioning properly. They block you from pushing.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
version: `- ${colors.bold('Publishing Tasks')}`,
|
|
38
|
+
platform_version:
|
|
39
|
+
'To-dos that must be addressed before your integration can be included in the App Directory. They block you from promoting and publishing.',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
version: `- ${colors.bold('Warnings')}`,
|
|
43
|
+
platform_version:
|
|
44
|
+
"Issues and recommendations that need human reviews by Zapier before publishing your integration. They don't block.",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
hasBorder: false,
|
|
48
|
+
style: { head: [], 'padding-left': 0, 'padding-right': 0 },
|
|
49
|
+
});
|
|
50
|
+
|
|
26
51
|
if (versions.map((v) => v.user_count).filter((c) => c === null).length) {
|
|
27
52
|
this.warn(
|
|
28
|
-
'Some user counts are still being calculated - run this command again in ~10 seconds (or longer if your integration has lots of users).'
|
|
53
|
+
'Some user counts are still being calculated - run this command again in ~10 seconds (or longer if your integration has lots of users).',
|
|
29
54
|
);
|
|
30
55
|
}
|
|
31
56
|
}
|
|
@@ -5,7 +5,7 @@ const { LAMBDA_VERSION } = require('../../constants');
|
|
|
5
5
|
module.exports = function () {
|
|
6
6
|
if (!isValidNodeVersion()) {
|
|
7
7
|
this.error(
|
|
8
|
-
`Requires node version >= ${LAMBDA_VERSION}, found ${process.versions.node}. Please upgrade Node.js
|
|
8
|
+
`Requires node version >= ${LAMBDA_VERSION}, found ${process.versions.node}. Please upgrade Node.js.`,
|
|
9
9
|
);
|
|
10
10
|
}
|
|
11
11
|
};
|
|
@@ -13,7 +13,7 @@ module.exports = async function (options) {
|
|
|
13
13
|
formFields = await callAPI('/apps/fields-choices', { skipDeployKey: true });
|
|
14
14
|
} catch (e) {
|
|
15
15
|
this.error(
|
|
16
|
-
`Unable to connect to Zapier API. Please check your connection and try again. ${e}
|
|
16
|
+
`Unable to connect to Zapier API. Please check your connection and try again. ${e}`,
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -28,17 +28,17 @@ module.exports = async function (options) {
|
|
|
28
28
|
if (cmd && cmd.flags) {
|
|
29
29
|
if (cmd.flags.audience) {
|
|
30
30
|
cmd.flags.audience.options = formFields.intention.map(
|
|
31
|
-
(audienceOption) => audienceOption.value
|
|
31
|
+
(audienceOption) => audienceOption.value,
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
if (cmd.flags.role) {
|
|
35
35
|
cmd.flags.role.options = formFields.role.map(
|
|
36
|
-
(roleOption) => roleOption.value
|
|
36
|
+
(roleOption) => roleOption.value,
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
if (cmd.flags.category) {
|
|
40
40
|
cmd.flags.category.options = formFields.app_category.map(
|
|
41
|
-
(categoryOption) => categoryOption.value
|
|
41
|
+
(categoryOption) => categoryOption.value,
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
2
|
const { marked } = require('marked');
|
|
3
|
-
const
|
|
4
|
-
const { stdtermwidth } = require('@oclif/help/lib/screen');
|
|
3
|
+
const { markedTerminal } = require('marked-terminal');
|
|
5
4
|
|
|
6
|
-
marked.
|
|
7
|
-
|
|
5
|
+
marked.use(
|
|
6
|
+
markedTerminal({
|
|
8
7
|
tab: 2,
|
|
9
|
-
width:
|
|
8
|
+
width: process.stdout.getWindowSize()[0] - 2,
|
|
10
9
|
reflowText: true,
|
|
11
10
|
codespan: chalk.underline.bold,
|
|
12
11
|
}),
|
|
13
|
-
|
|
12
|
+
);
|
|
14
13
|
|
|
15
14
|
module.exports = (options) => {
|
|
16
15
|
const cmdId = options.id === 'help' ? options.argv[0] : options.id;
|
|
17
16
|
const cmd = options.config.findCommand(cmdId);
|
|
18
17
|
if (cmd) {
|
|
19
18
|
if (cmd.description) {
|
|
20
|
-
cmd.description = marked(cmd.description).trim();
|
|
19
|
+
cmd.description = marked.parse(cmd.description).trim();
|
|
21
20
|
}
|
|
22
21
|
// TODO: Do the same for flag descriptions?
|
|
23
22
|
}
|
|
@@ -18,7 +18,7 @@ module.exports = (options) => {
|
|
|
18
18
|
`* CLI version: ${options.config.version}`,
|
|
19
19
|
`* Node.js version: ${process.version}`,
|
|
20
20
|
`* OS info: ${options.config.platform}-${options.config.arch}`,
|
|
21
|
-
].join('\n')
|
|
21
|
+
].join('\n'),
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
try {
|
|
@@ -28,7 +28,7 @@ module.exports = (options) => {
|
|
|
28
28
|
const maybeCoreDepVersion = get(pJson, ['dependencies', PLATFORM_PACKAGE]);
|
|
29
29
|
if (maybeCoreDepVersion) {
|
|
30
30
|
console.log(
|
|
31
|
-
`* \`${PLATFORM_PACKAGE}\` dependency: ${maybeCoreDepVersion}
|
|
31
|
+
`* \`${PLATFORM_PACKAGE}\` dependency: ${maybeCoreDepVersion}`,
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
} catch {}
|
package/src/utils/analytics.js
CHANGED
|
@@ -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
|
|
|
@@ -27,18 +28,30 @@ const recordAnalytics = async (command, isValidCommand, args, flags) => {
|
|
|
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:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
};
|
|
@@ -54,7 +67,7 @@ const recordAnalytics = async (command, isValidCommand, args, flags) => {
|
|
|
54
67
|
skipDeployKey: shouldRecordAnonymously,
|
|
55
68
|
},
|
|
56
69
|
true,
|
|
57
|
-
false
|
|
70
|
+
false,
|
|
58
71
|
)
|
|
59
72
|
.then(({ success }) => debug('success:', success))
|
|
60
73
|
.catch(({ errText }) => debug('err:', errText));
|