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,4 +1,5 @@
|
|
|
1
1
|
const BaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
+
const { Args } = require('@oclif/core');
|
|
2
3
|
const { buildFlags } = require('../../buildFlags');
|
|
3
4
|
const { listVersions, getWritableApp, callAPI } = require('../../../utils/api');
|
|
4
5
|
const { cyan } = require('colors/safe');
|
|
@@ -14,13 +15,13 @@ class ClearCacheCommand extends BaseCommand {
|
|
|
14
15
|
let selectedMajorVersion = majorVersion ? Number(majorVersion) : null;
|
|
15
16
|
if (Number.isNaN(selectedMajorVersion)) {
|
|
16
17
|
throw new Error(
|
|
17
|
-
`Invalid major version '${majorVersion}'. Must be a number
|
|
18
|
+
`Invalid major version '${majorVersion}'. Must be a number.`,
|
|
18
19
|
);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const majorVersions = [
|
|
22
23
|
...new Set(
|
|
23
|
-
versions.map((appVersion) => Number(appVersion.version.split('.')[0]))
|
|
24
|
+
versions.map((appVersion) => Number(appVersion.version.split('.')[0])),
|
|
24
25
|
),
|
|
25
26
|
];
|
|
26
27
|
// Finds the current version in package.json.
|
|
@@ -30,14 +31,14 @@ class ClearCacheCommand extends BaseCommand {
|
|
|
30
31
|
if (selectedMajorVersion === null) {
|
|
31
32
|
selectedMajorVersion = await this._promptForMajorVersionSelection(
|
|
32
33
|
majorVersions,
|
|
33
|
-
currentVersion
|
|
34
|
+
currentVersion,
|
|
34
35
|
);
|
|
35
36
|
} else {
|
|
36
37
|
if (!majorVersions.includes(selectedMajorVersion)) {
|
|
37
38
|
throw new Error(
|
|
38
39
|
`This integration does not have any versions on major version '${selectedMajorVersion}'. Valid versions are: ${majorVersions.join(
|
|
39
|
-
', '
|
|
40
|
-
)}
|
|
40
|
+
', ',
|
|
41
|
+
)}`,
|
|
41
42
|
);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
@@ -45,9 +46,9 @@ class ClearCacheCommand extends BaseCommand {
|
|
|
45
46
|
if (
|
|
46
47
|
!(await this.confirm(
|
|
47
48
|
`Are you sure you want to clear all cache data for major version '${cyan(
|
|
48
|
-
selectedMajorVersion
|
|
49
|
+
selectedMajorVersion,
|
|
49
50
|
)}'?`,
|
|
50
|
-
true
|
|
51
|
+
true,
|
|
51
52
|
))
|
|
52
53
|
) {
|
|
53
54
|
this.log('\ncancelled');
|
|
@@ -86,19 +87,18 @@ class ClearCacheCommand extends BaseCommand {
|
|
|
86
87
|
return await this.promptWithList(
|
|
87
88
|
"Which major version's cache data would you like to delete?",
|
|
88
89
|
majorVersionChoices,
|
|
89
|
-
{ default: currentMajorVersion }
|
|
90
|
+
{ default: currentMajorVersion },
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
ClearCacheCommand.args =
|
|
95
|
-
{
|
|
96
|
-
name: 'majorVersion',
|
|
95
|
+
ClearCacheCommand.args = {
|
|
96
|
+
majorVersion: Args.string({
|
|
97
97
|
description:
|
|
98
98
|
'(Optional) The cache data will be deleted for this major version. If not provided, you must pick from a list of major versions for this integration.',
|
|
99
99
|
required: false,
|
|
100
|
-
},
|
|
101
|
-
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
102
|
ClearCacheCommand.flags = buildFlags();
|
|
103
103
|
ClearCacheCommand.description = `Clear the cache data for a major version.
|
|
104
104
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const ZapierBaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
+
const { Args, Flags } = require('@oclif/core');
|
|
2
3
|
const { createCanary, listCanaries } = require('../../../utils/api');
|
|
3
4
|
const { buildFlags } = require('../../buildFlags');
|
|
4
|
-
const { flags } = require('@oclif/command');
|
|
5
5
|
|
|
6
6
|
class CanaryCreateCommand extends ZapierBaseCommand {
|
|
7
7
|
async perform() {
|
|
@@ -16,8 +16,10 @@ class CanaryCreateCommand extends ZapierBaseCommand {
|
|
|
16
16
|
const activeCanaries = await listCanaries();
|
|
17
17
|
if (activeCanaries.objects.length > 0) {
|
|
18
18
|
const existingCanary = activeCanaries.objects[0];
|
|
19
|
-
const secondsRemaining =
|
|
20
|
-
|
|
19
|
+
const secondsRemaining =
|
|
20
|
+
existingCanary.until_timestamp - Math.floor(Date.now() / 1000);
|
|
21
|
+
this
|
|
22
|
+
.log(`A canary deployment already exists from version ${existingCanary.from_version} to version ${existingCanary.to_version}, there are ${secondsRemaining} seconds remaining.
|
|
21
23
|
|
|
22
24
|
If you would like to stop this canary now, run \`zapier canary:delete ${existingCanary.from_version} ${existingCanary.to_version}\``);
|
|
23
25
|
return;
|
|
@@ -27,8 +29,7 @@ If you would like to stop this canary now, run \`zapier canary:delete ${existing
|
|
|
27
29
|
- From version: ${versionFrom}
|
|
28
30
|
- To version: ${versionTo}
|
|
29
31
|
- Traffic amount: ${percent}%
|
|
30
|
-
- Duration: ${duration} seconds`
|
|
31
|
-
);
|
|
32
|
+
- Duration: ${duration} seconds`);
|
|
32
33
|
|
|
33
34
|
await createCanary(versionFrom, versionTo, percent, duration);
|
|
34
35
|
|
|
@@ -41,7 +42,7 @@ If you would like to stop this canary now, run \`zapier canary:delete ${existing
|
|
|
41
42
|
this.throwForInvalidVersion(versionTo);
|
|
42
43
|
|
|
43
44
|
if (versionFrom === versionTo) {
|
|
44
|
-
this.error('`VERSIONFROM` and `VERSIONTO` can not be the same')
|
|
45
|
+
this.error('`VERSIONFROM` and `VERSIONTO` can not be the same');
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -60,23 +61,29 @@ If you would like to stop this canary now, run \`zapier canary:delete ${existing
|
|
|
60
61
|
|
|
61
62
|
CanaryCreateCommand.flags = buildFlags({
|
|
62
63
|
commandFlags: {
|
|
63
|
-
percent:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
percent: Flags.integer({
|
|
65
|
+
char: 'p',
|
|
66
|
+
description: 'Percent of traffic to route to new version',
|
|
67
|
+
required: true,
|
|
68
|
+
}),
|
|
69
|
+
duration: Flags.integer({
|
|
70
|
+
char: 'd',
|
|
71
|
+
description: 'Duration of the canary in seconds',
|
|
72
|
+
required: true,
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
67
76
|
|
|
68
|
-
CanaryCreateCommand.args =
|
|
69
|
-
{
|
|
70
|
-
name: 'versionFrom',
|
|
71
|
-
required: true,
|
|
77
|
+
CanaryCreateCommand.args = {
|
|
78
|
+
versionFrom: Args.string({
|
|
72
79
|
description: 'Version to route traffic from',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'versionTo',
|
|
76
80
|
required: true,
|
|
81
|
+
}),
|
|
82
|
+
versionTo: Args.string({
|
|
77
83
|
description: 'Version to canary traffic to',
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
required: true,
|
|
85
|
+
}),
|
|
86
|
+
};
|
|
80
87
|
|
|
81
88
|
CanaryCreateCommand.description = `Create a new canary deployment, diverting a specified percentage of traffic from one version to another for a specified duration.
|
|
82
89
|
|
|
@@ -88,7 +95,7 @@ Note: this is similar to \`zapier migrate\` but different in that this is tempor
|
|
|
88
95
|
|
|
89
96
|
CanaryCreateCommand.examples = [
|
|
90
97
|
'zapier canary:create 1.0.0 1.1.0 -p 25 -d 720',
|
|
91
|
-
'zapier canary:create 2.0.0 2.1.0 --percent 50 --duration 300'
|
|
98
|
+
'zapier canary:create 2.0.0 2.1.0 --percent 50 --duration 300',
|
|
92
99
|
];
|
|
93
100
|
CanaryCreateCommand.skipValidInstallCheck = true;
|
|
94
101
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const ZapierBaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
+
const { Args } = require('@oclif/core');
|
|
2
3
|
const { deleteCanary, listCanaries } = require('../../../utils/api');
|
|
3
4
|
|
|
4
5
|
class CanaryDeleteCommand extends ZapierBaseCommand {
|
|
@@ -7,19 +8,28 @@ class CanaryDeleteCommand extends ZapierBaseCommand {
|
|
|
7
8
|
|
|
8
9
|
this.validateVersions(versionFrom, versionTo);
|
|
9
10
|
|
|
10
|
-
const existingCanary = await this.findExistingCanary(
|
|
11
|
+
const existingCanary = await this.findExistingCanary(
|
|
12
|
+
versionFrom,
|
|
13
|
+
versionTo,
|
|
14
|
+
);
|
|
11
15
|
if (!existingCanary) {
|
|
12
|
-
this.log(
|
|
16
|
+
this.log(
|
|
17
|
+
`There is no active canary from version ${versionFrom} to version ${versionTo}`,
|
|
18
|
+
);
|
|
13
19
|
return;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
const confirmed = await this.confirm(
|
|
22
|
+
const confirmed = await this.confirm(
|
|
23
|
+
`Are you sure you want to delete the canary from ${versionFrom} to ${versionTo}?`,
|
|
24
|
+
);
|
|
17
25
|
if (!confirmed) {
|
|
18
26
|
this.log('Canary deletion cancelled.');
|
|
19
27
|
return;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
this.startSpinner(
|
|
30
|
+
this.startSpinner(
|
|
31
|
+
`Deleting active canary from ${versionFrom} to ${versionTo}`,
|
|
32
|
+
);
|
|
23
33
|
await deleteCanary(versionFrom, versionTo);
|
|
24
34
|
this.stopSpinner();
|
|
25
35
|
this.log('Canary deployment deleted successfully.');
|
|
@@ -27,7 +37,9 @@ class CanaryDeleteCommand extends ZapierBaseCommand {
|
|
|
27
37
|
|
|
28
38
|
async findExistingCanary(versionFrom, versionTo) {
|
|
29
39
|
const activeCanaries = await listCanaries();
|
|
30
|
-
return activeCanaries.objects.find(
|
|
40
|
+
return activeCanaries.objects.find(
|
|
41
|
+
(c) => c.from_version === versionFrom && c.to_version === versionTo,
|
|
42
|
+
);
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
validateVersions(versionFrom, versionTo) {
|
|
@@ -35,25 +47,23 @@ class CanaryDeleteCommand extends ZapierBaseCommand {
|
|
|
35
47
|
this.throwForInvalidVersion(versionTo);
|
|
36
48
|
|
|
37
49
|
if (versionFrom === versionTo) {
|
|
38
|
-
this.error('Versions can not be the same')
|
|
50
|
+
this.error('Versions can not be the same');
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
53
|
}
|
|
42
54
|
|
|
43
|
-
CanaryDeleteCommand.args =
|
|
44
|
-
{
|
|
45
|
-
name: 'versionFrom',
|
|
46
|
-
required: true,
|
|
55
|
+
CanaryDeleteCommand.args = {
|
|
56
|
+
versionFrom: Args.string({
|
|
47
57
|
description: 'Version to route traffic from',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'versionTo',
|
|
51
58
|
required: true,
|
|
59
|
+
}),
|
|
60
|
+
versionTo: Args.string({
|
|
52
61
|
description: 'Version canary traffic is routed to',
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
required: true,
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
55
65
|
CanaryDeleteCommand.description = 'Delete an active canary deployment';
|
|
56
66
|
CanaryDeleteCommand.examples = ['zapier canary:delete 1.0.0 1.1.0'];
|
|
57
67
|
CanaryDeleteCommand.skipValidInstallCheck = true;
|
|
58
68
|
|
|
59
|
-
module.exports = CanaryDeleteCommand;
|
|
69
|
+
module.exports = CanaryDeleteCommand;
|
|
@@ -7,11 +7,11 @@ class CanaryListCommand extends ZapierBaseCommand {
|
|
|
7
7
|
async perform() {
|
|
8
8
|
const canaries = await listCanaries();
|
|
9
9
|
|
|
10
|
-
const formattedCanaries = canaries.objects.map(c => ({
|
|
10
|
+
const formattedCanaries = canaries.objects.map((c) => ({
|
|
11
11
|
from_version: c.from_version,
|
|
12
12
|
to_version: c.to_version,
|
|
13
13
|
percent: c.percent,
|
|
14
|
-
seconds_remaining: c.until_timestamp - Math.floor(Date.now() / 1000)
|
|
14
|
+
seconds_remaining: c.until_timestamp - Math.floor(Date.now() / 1000),
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
17
|
this.log(bold('Active Canaries') + '\n');
|
|
@@ -23,16 +23,14 @@ class CanaryListCommand extends ZapierBaseCommand {
|
|
|
23
23
|
['Traffic Amount', 'percent'],
|
|
24
24
|
['Seconds Remaining', 'seconds_remaining'],
|
|
25
25
|
],
|
|
26
|
-
emptyMessage: grey(
|
|
27
|
-
`No active canary deployments found.`
|
|
28
|
-
),
|
|
26
|
+
emptyMessage: grey(`No active canary deployments found.`),
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
CanaryListCommand.flags = buildFlags({ opts: { format: true } });
|
|
34
32
|
CanaryListCommand.description = 'List all active canary deployments';
|
|
35
|
-
CanaryListCommand.examples = ['zapier canary:list']
|
|
33
|
+
CanaryListCommand.examples = ['zapier canary:list'];
|
|
36
34
|
CanaryListCommand.skipValidInstallCheck = true;
|
|
37
35
|
|
|
38
|
-
module.exports = CanaryListCommand;
|
|
36
|
+
module.exports = CanaryListCommand;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { Args, Flags } = require('@oclif/core');
|
|
2
|
+
|
|
1
3
|
const BaseCommand = require('../ZapierBaseCommand');
|
|
2
4
|
const { buildFlags } = require('../buildFlags');
|
|
3
5
|
|
|
@@ -6,8 +8,6 @@ const { convertApp } = require('../../utils/convert');
|
|
|
6
8
|
const { isExistingEmptyDir } = require('../../utils/files');
|
|
7
9
|
const { initApp } = require('../../utils/init');
|
|
8
10
|
|
|
9
|
-
const { flags } = require('@oclif/command');
|
|
10
|
-
|
|
11
11
|
class ConvertCommand extends BaseCommand {
|
|
12
12
|
generateCreateFunc(appId, version) {
|
|
13
13
|
return async (tempAppDir) => {
|
|
@@ -23,7 +23,7 @@ class ConvertCommand extends BaseCommand {
|
|
|
23
23
|
|
|
24
24
|
if (!versionInfo.definition_override) {
|
|
25
25
|
this.error(
|
|
26
|
-
`Integration ${appId} @ ${version} is already a CLI integration and can't be converted. Instead, pick a version that was created using the Visual Builder
|
|
26
|
+
`Integration ${appId} @ ${version} is already a CLI integration and can't be converted. Instead, pick a version that was created using the Visual Builder.`,
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
this.stopSpinner();
|
|
@@ -32,7 +32,7 @@ class ConvertCommand extends BaseCommand {
|
|
|
32
32
|
} catch (e) {
|
|
33
33
|
if (e.status === 404) {
|
|
34
34
|
this.error(
|
|
35
|
-
`Visual Builder integration ${appId} @ ${version} not found. Double check the integration id and version
|
|
35
|
+
`Visual Builder integration ${appId} @ ${version} not found. Double check the integration id and version.`,
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
this.error(e.json.errors[0]);
|
|
@@ -45,7 +45,7 @@ class ConvertCommand extends BaseCommand {
|
|
|
45
45
|
const { version } = this.flags;
|
|
46
46
|
if (!appId) {
|
|
47
47
|
this.error(
|
|
48
|
-
'You must provide an integrationId. See zapier convert --help for more info.'
|
|
48
|
+
'You must provide an integrationId. See zapier convert --help for more info.',
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -60,23 +60,22 @@ class ConvertCommand extends BaseCommand {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
ConvertCommand.args =
|
|
64
|
-
{
|
|
65
|
-
name: 'integrationId',
|
|
66
|
-
required: true,
|
|
63
|
+
ConvertCommand.args = {
|
|
64
|
+
integrationId: Args.string({
|
|
67
65
|
description: `To get the integration/app ID, go to "https://developer.zapier.com", click on an integration, and copy the number directly after "/app/" in the URL.`,
|
|
68
|
-
parse: (input) => Number(input),
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'path',
|
|
72
66
|
required: true,
|
|
67
|
+
parse: (input) => Number(input),
|
|
68
|
+
}),
|
|
69
|
+
path: Args.string({
|
|
73
70
|
description:
|
|
74
71
|
'Relative to your current path - IE: `.` for current directory.',
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
required: true,
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
|
|
77
76
|
ConvertCommand.flags = buildFlags({
|
|
78
77
|
commandFlags: {
|
|
79
|
-
version:
|
|
78
|
+
version: Flags.string({
|
|
80
79
|
char: 'v',
|
|
81
80
|
description:
|
|
82
81
|
'Convert a specific version. Required when converting a Visual Builder integration.',
|
|
@@ -84,6 +83,7 @@ ConvertCommand.flags = buildFlags({
|
|
|
84
83
|
}),
|
|
85
84
|
},
|
|
86
85
|
});
|
|
86
|
+
|
|
87
87
|
ConvertCommand.description = `Convert a Visual Builder integration to a CLI integration.
|
|
88
88
|
|
|
89
89
|
The resulting CLI integration will be identical to its Visual Builder version and ready to push and use immediately!
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const BaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
+
const { Args } = require('@oclif/core');
|
|
2
3
|
const { buildFlags } = require('../../buildFlags');
|
|
3
4
|
const { callAPI } = require('../../../utils/api');
|
|
4
5
|
|
|
@@ -17,13 +18,12 @@ class DeleteVersionCommand extends BaseCommand {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
DeleteVersionCommand.args =
|
|
21
|
-
{
|
|
22
|
-
name: 'version',
|
|
23
|
-
required: true,
|
|
21
|
+
DeleteVersionCommand.args = {
|
|
22
|
+
version: Args.string({
|
|
24
23
|
description: `Specify the version to delete. It must have no users or Zaps.`,
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
27
|
DeleteVersionCommand.flags = buildFlags();
|
|
28
28
|
DeleteVersionCommand.skipValidInstallCheck = true;
|
|
29
29
|
DeleteVersionCommand.description = `Delete a specific version of your integration.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const BaseCommand = require('../ZapierBaseCommand');
|
|
2
|
+
const { Args } = require('@oclif/core');
|
|
2
3
|
const { buildFlags } = require('../buildFlags');
|
|
3
4
|
|
|
4
5
|
const { callAPI } = require('../../utils/api');
|
|
@@ -8,7 +9,7 @@ class DeprecateCommand extends BaseCommand {
|
|
|
8
9
|
const app = await this.getWritableApp();
|
|
9
10
|
const { version, date } = this.args;
|
|
10
11
|
this.log(
|
|
11
|
-
`Preparing to deprecate version ${version} your app "${app.title}".\n
|
|
12
|
+
`Preparing to deprecate version ${version} your app "${app.title}".\n`,
|
|
12
13
|
);
|
|
13
14
|
const url = `/apps/${app.id}/versions/${version}/deprecate`;
|
|
14
15
|
this.startSpinner(`Deprecating ${version}`);
|
|
@@ -20,25 +21,23 @@ class DeprecateCommand extends BaseCommand {
|
|
|
20
21
|
});
|
|
21
22
|
this.stopSpinner();
|
|
22
23
|
this.log(
|
|
23
|
-
`\nWe'll let users know that this version is no longer recommended and will cease to work on ${date}
|
|
24
|
+
`\nWe'll let users know that this version is no longer recommended and will cease to work on ${date}.`,
|
|
24
25
|
);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
DeprecateCommand.flags = buildFlags();
|
|
29
|
-
DeprecateCommand.args =
|
|
30
|
-
{
|
|
31
|
-
name: 'version',
|
|
30
|
+
DeprecateCommand.args = {
|
|
31
|
+
version: Args.string({
|
|
32
32
|
description: 'The version to deprecate.',
|
|
33
33
|
required: true,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'date',
|
|
37
|
-
required: true,
|
|
34
|
+
}),
|
|
35
|
+
date: Args.string({
|
|
38
36
|
description:
|
|
39
37
|
'The date (YYYY-MM-DD) when Zapier will make the specified version unavailable.',
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
42
41
|
DeprecateCommand.examples = ['zapier deprecate 1.2.3 2011-10-01'];
|
|
43
42
|
DeprecateCommand.description = `Mark a non-production version of your integration as deprecated, with removal by a certain date.
|
|
44
43
|
|
|
@@ -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 push` to see the redirect_uri.',
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -134,7 +134,7 @@ class DescribeCommand extends BaseCommand {
|
|
|
134
134
|
.map((method) => method({ key: resource.key }))
|
|
135
135
|
.filter((path) => _.has(definition, path))
|
|
136
136
|
.join('\n'),
|
|
137
|
-
})
|
|
137
|
+
}),
|
|
138
138
|
);
|
|
139
139
|
this.logTitle('Resources');
|
|
140
140
|
this.logTable({
|
|
@@ -153,7 +153,7 @@ class DescribeCommand extends BaseCommand {
|
|
|
153
153
|
const rows = _.values(definition[type]).map((row) => {
|
|
154
154
|
// add possible action paths
|
|
155
155
|
let paths = actionTemplates.map((method) =>
|
|
156
|
-
method({ type, key: row.key })
|
|
156
|
+
method({ type, key: row.key }),
|
|
157
157
|
);
|
|
158
158
|
|
|
159
159
|
// add possible resource paths
|
|
@@ -161,7 +161,7 @@ class DescribeCommand extends BaseCommand {
|
|
|
161
161
|
const key = row.operation.resource.split('.')[0];
|
|
162
162
|
const resourceTemplates = makeResourceTemplates(typeMap[type]);
|
|
163
163
|
paths = paths.concat(
|
|
164
|
-
resourceTemplates.map((method) => method({ key }))
|
|
164
|
+
resourceTemplates.map((method) => method({ key })),
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -182,7 +182,7 @@ 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 scaffold\` command to add one.`,
|
|
186
186
|
),
|
|
187
187
|
});
|
|
188
188
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const BaseCommand = require('../../ZapierBaseCommand');
|
|
2
|
+
const { Args } = require('@oclif/core');
|
|
2
3
|
const { buildFlags } = require('../../buildFlags');
|
|
3
4
|
const { listEnv } = require('../../../utils/api');
|
|
4
5
|
|
|
@@ -22,13 +23,12 @@ class GetEnvCommand extends BaseCommand {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
GetEnvCommand.args =
|
|
26
|
-
{
|
|
27
|
-
name: 'version',
|
|
26
|
+
GetEnvCommand.args = {
|
|
27
|
+
version: Args.string({
|
|
28
28
|
description: 'The version to get the environment for.',
|
|
29
29
|
required: true,
|
|
30
|
-
},
|
|
31
|
-
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
32
|
GetEnvCommand.flags = buildFlags({ opts: { format: true } });
|
|
33
33
|
GetEnvCommand.description = `Get environment variables for a version.`;
|
|
34
34
|
GetEnvCommand.examples = [`zapier env:get 1.2.3`];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { Args } = require('@oclif/core');
|
|
1
2
|
const { cyan } = require('colors/safe');
|
|
2
3
|
const { omit } = require('lodash');
|
|
3
4
|
|
|
@@ -7,7 +8,7 @@ const { callAPI } = require('../../../utils/api');
|
|
|
7
8
|
|
|
8
9
|
const successMessage = (version) =>
|
|
9
10
|
`Successfully wrote the following to the environment of version ${cyan(
|
|
10
|
-
version
|
|
11
|
+
version,
|
|
11
12
|
)}:`;
|
|
12
13
|
|
|
13
14
|
class SetEnvCommand extends BaseCommand {
|
|
@@ -19,7 +20,7 @@ class SetEnvCommand extends BaseCommand {
|
|
|
19
20
|
|
|
20
21
|
if (!valuesToSet.length) {
|
|
21
22
|
this.error(
|
|
22
|
-
'Must specify at least one key-value pair to set (like `SOME_KEY=1234`)'
|
|
23
|
+
'Must specify at least one key-value pair to set (like `SOME_KEY=1234`)',
|
|
23
24
|
);
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -39,7 +40,7 @@ class SetEnvCommand extends BaseCommand {
|
|
|
39
40
|
const app = await this.getWritableApp();
|
|
40
41
|
if (!app.all_versions.includes(version)) {
|
|
41
42
|
this.error(
|
|
42
|
-
`Version ${version} doesn't exist on integration "${app.title}"
|
|
43
|
+
`Version ${version} doesn't exist on integration "${app.title}"`,
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -53,7 +54,7 @@ class SetEnvCommand extends BaseCommand {
|
|
|
53
54
|
body: payload,
|
|
54
55
|
method: 'POST',
|
|
55
56
|
},
|
|
56
|
-
true
|
|
57
|
+
true,
|
|
57
58
|
);
|
|
58
59
|
|
|
59
60
|
this.log(successMessage(version));
|
|
@@ -73,19 +74,17 @@ class SetEnvCommand extends BaseCommand {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
SetEnvCommand.args =
|
|
77
|
-
{
|
|
78
|
-
name: 'version',
|
|
77
|
+
SetEnvCommand.args = {
|
|
78
|
+
version: Args.string({
|
|
79
79
|
description:
|
|
80
80
|
'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.',
|
|
81
81
|
required: true,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'key-value pairs...',
|
|
82
|
+
}),
|
|
83
|
+
'key-value pairs...': Args.string({
|
|
85
84
|
description:
|
|
86
85
|
'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`',
|
|
87
|
-
},
|
|
88
|
-
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
89
88
|
SetEnvCommand.flags = buildFlags();
|
|
90
89
|
SetEnvCommand.description = `Set environment variables for a version.`;
|
|
91
90
|
SetEnvCommand.examples = [`zapier env:set 1.2.3 SECRET=12345 OTHER=4321`];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { Args } = require('@oclif/core');
|
|
1
2
|
const { cyan } = require('colors/safe');
|
|
2
3
|
|
|
3
4
|
const BaseCommand = require('../../ZapierBaseCommand');
|
|
@@ -6,7 +7,7 @@ const { callAPI } = require('../../../utils/api');
|
|
|
6
7
|
|
|
7
8
|
const successMessage = (version) =>
|
|
8
9
|
`Successfully unset the following keys in the environment of version ${cyan(
|
|
9
|
-
version
|
|
10
|
+
version,
|
|
10
11
|
)} (if they existed):`;
|
|
11
12
|
|
|
12
13
|
class UnsetEnvCommand extends BaseCommand {
|
|
@@ -36,7 +37,7 @@ class UnsetEnvCommand extends BaseCommand {
|
|
|
36
37
|
const app = await this.getWritableApp();
|
|
37
38
|
if (!app.all_versions.includes(version)) {
|
|
38
39
|
this.error(
|
|
39
|
-
`Version ${version} doesn't exist on integration "${app.title}"
|
|
40
|
+
`Version ${version} doesn't exist on integration "${app.title}"`,
|
|
40
41
|
);
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -54,17 +55,15 @@ class UnsetEnvCommand extends BaseCommand {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
UnsetEnvCommand.args =
|
|
58
|
-
{
|
|
59
|
-
name: 'version',
|
|
58
|
+
UnsetEnvCommand.args = {
|
|
59
|
+
version: Args.string({
|
|
60
60
|
description: 'The version to set the environment for.',
|
|
61
61
|
required: true,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'keys...',
|
|
62
|
+
}),
|
|
63
|
+
'keys...': Args.string({
|
|
65
64
|
description: 'The keys to unset. Keys are case-insensitive.',
|
|
66
|
-
},
|
|
67
|
-
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
68
67
|
UnsetEnvCommand.flags = buildFlags();
|
|
69
68
|
UnsetEnvCommand.description = `Unset environment variables for a version.`;
|
|
70
69
|
UnsetEnvCommand.examples = [`zapier env:unset 1.2.3 SECRET OTHER`];
|