stepzen 0.44.0 → 0.45.0-beta.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.
- package/README.md +76 -71
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +6 -0
- package/bin/{run → run.js} +8 -21
- package/lib/commands/delete.d.ts +3 -3
- package/lib/commands/delete.d.ts.map +1 -1
- package/lib/commands/delete.js +32 -33
- package/lib/commands/delete.js.map +1 -1
- package/lib/commands/deploy.d.ts +10 -12
- package/lib/commands/deploy.d.ts.map +1 -1
- package/lib/commands/deploy.js +98 -98
- package/lib/commands/deploy.js.map +1 -1
- package/lib/commands/import/curl.d.ts +17 -24
- package/lib/commands/import/curl.d.ts.map +1 -1
- package/lib/commands/import/curl.js +85 -85
- package/lib/commands/import/curl.js.map +1 -1
- package/lib/commands/import/db2.d.ts +20 -28
- package/lib/commands/import/db2.d.ts.map +1 -1
- package/lib/commands/import/db2.js +59 -62
- package/lib/commands/import/db2.js.map +1 -1
- package/lib/commands/import/flow.d.ts +10 -71
- package/lib/commands/import/flow.d.ts.map +1 -1
- package/lib/commands/import/flow.js +39 -43
- package/lib/commands/import/flow.js.map +1 -1
- package/lib/commands/import/graphql.d.ts +10 -18
- package/lib/commands/import/graphql.d.ts.map +1 -1
- package/lib/commands/import/graphql.js +38 -42
- package/lib/commands/import/graphql.js.map +1 -1
- package/lib/commands/import/index.d.ts +7 -10
- package/lib/commands/import/index.d.ts.map +1 -1
- package/lib/commands/import/index.js +52 -53
- package/lib/commands/import/index.js.map +1 -1
- package/lib/commands/import/mysql.d.ts +14 -22
- package/lib/commands/import/mysql.d.ts.map +1 -1
- package/lib/commands/import/mysql.js +53 -56
- package/lib/commands/import/mysql.js.map +1 -1
- package/lib/commands/import/openapi.d.ts +9 -16
- package/lib/commands/import/openapi.d.ts.map +1 -1
- package/lib/commands/import/openapi.js +38 -41
- package/lib/commands/import/openapi.js.map +1 -1
- package/lib/commands/import/oracle.d.ts +19 -26
- package/lib/commands/import/oracle.d.ts.map +1 -1
- package/lib/commands/import/oracle.js +56 -59
- package/lib/commands/import/oracle.js.map +1 -1
- package/lib/commands/import/postgresql.d.ts +15 -23
- package/lib/commands/import/postgresql.d.ts.map +1 -1
- package/lib/commands/import/postgresql.js +54 -57
- package/lib/commands/import/postgresql.js.map +1 -1
- package/lib/commands/import/presto.d.ts +14 -22
- package/lib/commands/import/presto.d.ts.map +1 -1
- package/lib/commands/import/presto.js +57 -60
- package/lib/commands/import/presto.js.map +1 -1
- package/lib/commands/import/snowflake.d.ts +16 -24
- package/lib/commands/import/snowflake.d.ts.map +1 -1
- package/lib/commands/import/snowflake.js +61 -64
- package/lib/commands/import/snowflake.js.map +1 -1
- package/lib/commands/init.d.ts +5 -7
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +22 -22
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/lint.d.ts +2 -4
- package/lib/commands/lint.d.ts.map +1 -1
- package/lib/commands/lint.js +15 -18
- package/lib/commands/lint.js.map +1 -1
- package/lib/commands/list.d.ts +4 -6
- package/lib/commands/list.d.ts.map +1 -1
- package/lib/commands/list.js +66 -63
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/login.d.ts +8 -10
- package/lib/commands/login.d.ts.map +1 -1
- package/lib/commands/login.js +94 -92
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.d.ts +2 -3
- package/lib/commands/logout.d.ts.map +1 -1
- package/lib/commands/logout.js +8 -11
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/request.d.ts +10 -12
- package/lib/commands/request.d.ts.map +1 -1
- package/lib/commands/request.js +127 -129
- package/lib/commands/request.js.map +1 -1
- package/lib/commands/service.d.ts +9 -11
- package/lib/commands/service.d.ts.map +1 -1
- package/lib/commands/service.js +203 -203
- package/lib/commands/service.js.map +1 -1
- package/lib/commands/start.d.ts +13 -15
- package/lib/commands/start.d.ts.map +1 -1
- package/lib/commands/start.js +61 -60
- package/lib/commands/start.js.map +1 -1
- package/lib/commands/transpile.d.ts +8 -10
- package/lib/commands/transpile.d.ts.map +1 -1
- package/lib/commands/transpile.js +31 -34
- package/lib/commands/transpile.js.map +1 -1
- package/lib/commands/upload.d.ts +6 -8
- package/lib/commands/upload.d.ts.map +1 -1
- package/lib/commands/upload.js +41 -44
- package/lib/commands/upload.js.map +1 -1
- package/lib/commands/validate.d.ts +3 -4
- package/lib/commands/validate.d.ts.map +1 -1
- package/lib/commands/validate.js +23 -26
- package/lib/commands/validate.js.map +1 -1
- package/lib/commands/whoami.d.ts +6 -8
- package/lib/commands/whoami.d.ts.map +1 -1
- package/lib/commands/whoami.js +39 -48
- package/lib/commands/whoami.js.map +1 -1
- package/lib/generate/curl2sdl.d.ts +8 -8
- package/lib/generate/curl2sdl.d.ts.map +1 -1
- package/lib/generate/curl2sdl.js +16 -20
- package/lib/generate/curl2sdl.js.map +1 -1
- package/lib/generate/flags.d.ts +11 -11
- package/lib/generate/flags.d.ts.map +1 -1
- package/lib/generate/flags.js +16 -17
- package/lib/generate/flags.js.map +1 -1
- package/lib/generate/flow2sdl.d.ts +5 -5
- package/lib/generate/flow2sdl.d.ts.map +1 -1
- package/lib/generate/flow2sdl.js +13 -19
- package/lib/generate/flow2sdl.js.map +1 -1
- package/lib/generate/graphql2sdl.d.ts +5 -5
- package/lib/generate/graphql2sdl.d.ts.map +1 -1
- package/lib/generate/graphql2sdl.js +22 -28
- package/lib/generate/graphql2sdl.js.map +1 -1
- package/lib/generate/helpers.d.ts +5 -5
- package/lib/generate/helpers.d.ts.map +1 -1
- package/lib/generate/helpers.js +39 -44
- package/lib/generate/helpers.js.map +1 -1
- package/lib/generate/import-command.d.ts +7 -13
- package/lib/generate/import-command.d.ts.map +1 -1
- package/lib/generate/import-command.js +51 -52
- package/lib/generate/import-command.js.map +1 -1
- package/lib/generate/openapi2sdl.d.ts +4 -4
- package/lib/generate/openapi2sdl.d.ts.map +1 -1
- package/lib/generate/openapi2sdl.js +10 -16
- package/lib/generate/openapi2sdl.js.map +1 -1
- package/lib/generate/questions.d.ts.map +1 -1
- package/lib/generate/questions.js +4 -7
- package/lib/generate/questions.js.map +1 -1
- package/lib/generate/sql2sdl.d.ts +13 -13
- package/lib/generate/sql2sdl.d.ts.map +1 -1
- package/lib/generate/sql2sdl.js +13 -16
- package/lib/generate/sql2sdl.js.map +1 -1
- package/lib/hooks/init/version.d.ts +1 -1
- package/lib/hooks/init/version.d.ts.map +1 -1
- package/lib/hooks/init/version.js +11 -9
- package/lib/hooks/init/version.js.map +1 -1
- package/lib/hooks/prerun/check-upgrade.d.ts +1 -1
- package/lib/hooks/prerun/check-upgrade.d.ts.map +1 -1
- package/lib/hooks/prerun/check-upgrade.js +42 -46
- package/lib/hooks/prerun/check-upgrade.js.map +1 -1
- package/lib/hooks/prerun/ensure-config-file.d.ts +1 -1
- package/lib/hooks/prerun/ensure-config-file.d.ts.map +1 -1
- package/lib/hooks/prerun/ensure-config-file.js +9 -11
- package/lib/hooks/prerun/ensure-config-file.js.map +1 -1
- package/lib/hooks/prerun/ensure-permissions.d.ts +1 -1
- package/lib/hooks/prerun/ensure-permissions.d.ts.map +1 -1
- package/lib/hooks/prerun/ensure-permissions.js +15 -11
- package/lib/hooks/prerun/ensure-permissions.js.map +1 -1
- package/lib/index.js +1 -5
- package/lib/index.js.map +1 -1
- package/lib/shared/actions.d.ts +2 -2
- package/lib/shared/actions.d.ts.map +1 -1
- package/lib/shared/actions.js +15 -21
- package/lib/shared/actions.js.map +1 -1
- package/lib/shared/configuration.d.ts +5 -3
- package/lib/shared/configuration.d.ts.map +1 -1
- package/lib/shared/configuration.js +39 -52
- package/lib/shared/configuration.js.map +1 -1
- package/lib/shared/constants.d.ts +7 -4
- package/lib/shared/constants.d.ts.map +1 -1
- package/lib/shared/constants.js +70 -86
- package/lib/shared/constants.js.map +1 -1
- package/lib/shared/curl-parser.d.ts +2 -2
- package/lib/shared/curl-parser.d.ts.map +1 -1
- package/lib/shared/curl-parser.js +9 -13
- package/lib/shared/curl-parser.js.map +1 -1
- package/lib/shared/docker.d.ts +2 -4
- package/lib/shared/docker.d.ts.map +1 -1
- package/lib/shared/docker.js +40 -48
- package/lib/shared/docker.js.map +1 -1
- package/lib/shared/errors.js +7 -11
- package/lib/shared/errors.js.map +1 -1
- package/lib/shared/header-params-parser.d.ts +2 -4
- package/lib/shared/header-params-parser.d.ts.map +1 -1
- package/lib/shared/header-params-parser.js +23 -29
- package/lib/shared/header-params-parser.js.map +1 -1
- package/lib/shared/header.d.ts +7 -7
- package/lib/shared/header.d.ts.map +1 -1
- package/lib/shared/header.js +5 -10
- package/lib/shared/header.js.map +1 -1
- package/lib/shared/inquirer.d.ts +7 -6
- package/lib/shared/inquirer.d.ts.map +1 -1
- package/lib/shared/inquirer.js +29 -37
- package/lib/shared/inquirer.js.map +1 -1
- package/lib/shared/moniker.js +4 -9
- package/lib/shared/moniker.js.map +1 -1
- package/lib/shared/path-params-parser.d.ts +2 -2
- package/lib/shared/path-params-parser.d.ts.map +1 -1
- package/lib/shared/path-params-parser.js +6 -12
- package/lib/shared/path-params-parser.js.map +1 -1
- package/lib/shared/request-variables-parser.d.ts +4 -4
- package/lib/shared/request-variables-parser.d.ts.map +1 -1
- package/lib/shared/request-variables-parser.js +10 -14
- package/lib/shared/request-variables-parser.js.map +1 -1
- package/lib/shared/rmtemp.d.ts +1 -0
- package/lib/shared/rmtemp.d.ts.map +1 -1
- package/lib/shared/rmtemp.js +7 -10
- package/lib/shared/rmtemp.js.map +1 -1
- package/lib/shared/segment.d.ts +10 -0
- package/lib/shared/segment.d.ts.map +1 -0
- package/lib/shared/segment.js +162 -0
- package/lib/shared/segment.js.map +1 -0
- package/lib/shared/stepzen-sdk.d.ts +8 -8
- package/lib/shared/stepzen-sdk.d.ts.map +1 -1
- package/lib/shared/stepzen-sdk.js +27 -36
- package/lib/shared/stepzen-sdk.js.map +1 -1
- package/lib/shared/types.d.ts +13 -11
- package/lib/shared/types.d.ts.map +1 -1
- package/lib/shared/types.js +1 -2
- package/lib/shared/url-helpers.d.ts.map +1 -1
- package/lib/shared/url-helpers.js +7 -14
- package/lib/shared/url-helpers.js.map +1 -1
- package/lib/shared/utils.d.ts +2 -2
- package/lib/shared/utils.d.ts.map +1 -1
- package/lib/shared/utils.js +55 -71
- package/lib/shared/utils.js.map +1 -1
- package/lib/shared/validation.js +12 -17
- package/lib/shared/validation.js.map +1 -1
- package/lib/shared/workspace.d.ts +1 -1
- package/lib/shared/workspace.d.ts.map +1 -1
- package/lib/shared/workspace.js +34 -45
- package/lib/shared/workspace.js.map +1 -1
- package/lib/shared/zen-command.d.ts +5 -10
- package/lib/shared/zen-command.d.ts.map +1 -1
- package/lib/shared/zen-command.js +132 -113
- package/lib/shared/zen-command.js.map +1 -1
- package/oclif.manifest.json +1281 -945
- package/package.json +35 -33
- package/bin/dev +0 -23
package/lib/commands/deploy.js
CHANGED
|
@@ -1,36 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright IBM Corp. 2020, 2024
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
import { Args, Flags, ux } from '@oclif/core';
|
|
3
|
+
import { CLIError } from '@oclif/core/errors';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import prettyMilliseconds from 'pretty-ms';
|
|
8
|
+
import { deploy } from '../shared/actions.js';
|
|
9
|
+
import { writeCredentialsAndServiceToConfigFile } from '../shared/configuration.js';
|
|
10
|
+
import { getDeploymentType } from '../shared/constants.js';
|
|
11
|
+
import { trackDeployEvent } from '../shared/segment.js';
|
|
12
|
+
import { hasSdkInterfaceV2, tryZenCtl2ThenZenCtl1, } from '../shared/stepzen-sdk.js';
|
|
13
|
+
import { formatEndpointInfo, validateEndpoint } from '../shared/utils.js';
|
|
14
|
+
import ZenCommand from '../shared/zen-command.js';
|
|
15
|
+
import Upload from './upload.js';
|
|
16
|
+
export default class Deploy extends ZenCommand {
|
|
17
|
+
static description = 'Deploy to StepZen.';
|
|
18
|
+
static usage = `deploy [ENDPOINT] [--config=path/to/config.yaml] [--dir=path/to/workspace]
|
|
19
|
+
|
|
20
|
+
-- OR (deprecated) --
|
|
21
|
+
|
|
22
|
+
$ stepzen deploy ENDPOINT --schema=schema [--configurationsets=cs1[,cs2[,..]]]`;
|
|
23
|
+
static flags = {
|
|
24
|
+
...ZenCommand.flags,
|
|
25
|
+
dir: Flags.string({ description: 'Working directory' }),
|
|
26
|
+
silent: Flags.boolean(),
|
|
27
|
+
// configurationsets is assumed to be a comma separated string naming uploaded configurationsets
|
|
28
|
+
// a special configuration 'stepzen/defaults' is recognized.
|
|
29
|
+
configurationsets: Flags.string({
|
|
30
|
+
description: chalk `
|
|
31
|
+
Name(s) of configuration sets uploaded earlier with {bold stepzen upload}` +
|
|
32
|
+
chalk `
|
|
33
|
+
{yellow [DEPRECATED: this flag will be removed in future versions]}
|
|
34
|
+
|
|
35
|
+
Instead, please use one of these options:
|
|
36
|
+
- {bold stepzen deploy} (without the {bold --configurationsets} flag)
|
|
37
|
+
\tto use the configuration from the {bold config.yaml} file in the current directory (if exists)
|
|
38
|
+
- {bold stepzen deploy --config path/to/config.yaml}
|
|
39
|
+
\tto explicitly specify the configuration file`,
|
|
40
|
+
exclusive: ['config', 'dir'],
|
|
41
|
+
}),
|
|
42
|
+
config: Flags.string({
|
|
43
|
+
helpValue: 'path/to/config.yaml',
|
|
44
|
+
description: '[default: config.yaml] Configuration file to use (relative to the current directory)',
|
|
45
|
+
}),
|
|
46
|
+
schema: Flags.string({
|
|
47
|
+
description: chalk `
|
|
48
|
+
Name of a schema uploaded earlier with {bold stepzen upload}` +
|
|
49
|
+
chalk `
|
|
50
|
+
{yellow [DEPRECATED: this flag will be removed in future versions]}
|
|
51
|
+
|
|
52
|
+
Instead, please use one of these options:
|
|
53
|
+
- {bold stepzen deploy} (without the {bold --schema} flag)
|
|
54
|
+
\tto deploy the schema from a StepZen workspace in your current directory
|
|
55
|
+
- {bold stepzen deploy --dir path/to/workspace}
|
|
56
|
+
\tto deploy from a StepZen workspace in another folder`,
|
|
57
|
+
exclusive: ['config', 'dir'],
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
static args = {
|
|
61
|
+
endpoint: Args.string({
|
|
62
|
+
description: chalk `name of the endpoint (e.g. {bold api/customers})
|
|
63
|
+
[default: use the {underline endpoint} property from stepzen.config.json]`,
|
|
64
|
+
required: false,
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
19
67
|
// eslint-disable-next-line complexity
|
|
20
68
|
async run() {
|
|
21
69
|
const { args, flags } = await this.parse(Deploy);
|
|
22
70
|
// validate the endpoint arg
|
|
23
71
|
if (args.endpoint) {
|
|
24
|
-
const maybeError =
|
|
72
|
+
const maybeError = validateEndpoint(args.endpoint);
|
|
25
73
|
if (typeof maybeError === 'string') {
|
|
26
|
-
throw new
|
|
74
|
+
throw new CLIError(maybeError);
|
|
27
75
|
}
|
|
28
76
|
}
|
|
29
77
|
// validate the --dir and --config flags
|
|
30
78
|
const checkExists = (flag, kind) => {
|
|
31
79
|
const value = flags[flag];
|
|
32
80
|
if (value && !fs.existsSync(path.resolve(value))) {
|
|
33
|
-
throw new
|
|
81
|
+
throw new CLIError(chalk `${kind} does not exist: {bold --${flag} ${value}}` +
|
|
34
82
|
`\nPlease check that the path is correct and try again.`);
|
|
35
83
|
}
|
|
36
84
|
};
|
|
@@ -40,14 +88,14 @@ class Deploy extends zen_command_1.default {
|
|
|
40
88
|
let { configuration } = await this.ensureStepZenAccount({
|
|
41
89
|
nonInteractive: flags['non-interactive'],
|
|
42
90
|
});
|
|
43
|
-
if (hasDeprecatedFlags &&
|
|
91
|
+
if (hasDeprecatedFlags && hasSdkInterfaceV2(configuration)) {
|
|
44
92
|
// zenctl2 does not support listing schemas and configuration sets
|
|
45
93
|
const usedDeprecatedFlags = flags.schema && flags.configurationsets
|
|
46
94
|
? chalk `{bold --schema} and {bold --configurationsets} flags`
|
|
47
95
|
: flags.schema
|
|
48
96
|
? chalk `{bold --schema} flag`
|
|
49
97
|
: chalk `{bold --configurationsets} flag`;
|
|
50
|
-
throw new
|
|
98
|
+
throw new CLIError(chalk `{bold stepzen deploy} no longer supports the ${usedDeprecatedFlags}.` +
|
|
51
99
|
chalk `\n\tSee more help with --help`);
|
|
52
100
|
}
|
|
53
101
|
// Print a deprecation warning (if necessary)
|
|
@@ -61,29 +109,31 @@ class Deploy extends zen_command_1.default {
|
|
|
61
109
|
})
|
|
62
110
|
.filter(Boolean);
|
|
63
111
|
messages[messages.length - 1] += chalk `\n\tSee more help with --help`;
|
|
64
|
-
|
|
112
|
+
for (const message of messages) {
|
|
113
|
+
this.warn(message);
|
|
114
|
+
}
|
|
65
115
|
this.log();
|
|
66
116
|
}
|
|
67
117
|
// Enforce the "required" flag on `schema` for the deprecated code path
|
|
68
118
|
// (this was done by oclif when `schema` was marked as `required`)
|
|
69
119
|
if (hasDeprecatedFlags && !flags.schema) {
|
|
70
|
-
throw new
|
|
120
|
+
throw new CLIError(chalk `When using {bold --configurationsets}, the {bold --schema} flag is required:` +
|
|
71
121
|
chalk `\n\t--schema SCHEMA {dim name of a schema uploaded earlier with {bold stepzen upload}}` +
|
|
72
122
|
chalk `\n\tSee more help with --help`);
|
|
73
123
|
}
|
|
74
124
|
// Enforce the "required" flag on `endpoint` for the deprecated code path
|
|
75
125
|
// (this was done by oclif when `endpoint` arg was marked as `required`)
|
|
76
126
|
if (hasDeprecatedFlags && !args.endpoint) {
|
|
77
|
-
throw new
|
|
127
|
+
throw new CLIError(chalk `When using {bold --schema}, the {bold endpoint} argument is required:` +
|
|
78
128
|
chalk `\n\tendpoint {dim name of the endpoint (e.g. {bold api/customers})}` +
|
|
79
129
|
chalk `\n\tSee more help with --help`);
|
|
80
130
|
}
|
|
81
|
-
const deployStart =
|
|
131
|
+
const deployStart = Date.now();
|
|
82
132
|
let result;
|
|
83
133
|
if (hasDeprecatedFlags) {
|
|
84
134
|
const endpoint = args.endpoint;
|
|
85
135
|
if (!flags.silent) {
|
|
86
|
-
|
|
136
|
+
ux.action.start(`Deploying ${chalk.yellow(endpoint)} to StepZen`);
|
|
87
137
|
}
|
|
88
138
|
try {
|
|
89
139
|
result = await this.doDeployV1WithSdkV1({
|
|
@@ -93,11 +143,11 @@ class Deploy extends zen_command_1.default {
|
|
|
93
143
|
configuration,
|
|
94
144
|
});
|
|
95
145
|
}
|
|
96
|
-
catch (
|
|
146
|
+
catch (error_) {
|
|
97
147
|
if (!flags.silent) {
|
|
98
|
-
|
|
148
|
+
ux.action.stop(chalk.red('fail'));
|
|
99
149
|
}
|
|
100
|
-
throw
|
|
150
|
+
throw error_;
|
|
101
151
|
}
|
|
102
152
|
} /* no deprecated flags */
|
|
103
153
|
else {
|
|
@@ -108,7 +158,7 @@ class Deploy extends zen_command_1.default {
|
|
|
108
158
|
});
|
|
109
159
|
const endpoint = args.endpoint || workspace.endpoint;
|
|
110
160
|
if (!flags.silent) {
|
|
111
|
-
|
|
161
|
+
ux.action.start(`Deploying ${chalk.yellow(endpoint)} to StepZen`);
|
|
112
162
|
}
|
|
113
163
|
let configPath;
|
|
114
164
|
if (flags.config) {
|
|
@@ -124,7 +174,7 @@ class Deploy extends zen_command_1.default {
|
|
|
124
174
|
configPath = undefined;
|
|
125
175
|
}
|
|
126
176
|
try {
|
|
127
|
-
const res = await
|
|
177
|
+
const res = await tryZenCtl2ThenZenCtl1(configuration, stepzen => {
|
|
128
178
|
if (stepzen.version === 'v2') {
|
|
129
179
|
return this.doDeployV2WithSdkV2({
|
|
130
180
|
endpoint,
|
|
@@ -142,34 +192,33 @@ class Deploy extends zen_command_1.default {
|
|
|
142
192
|
});
|
|
143
193
|
});
|
|
144
194
|
if (res.configMigrated) {
|
|
145
|
-
// eslint-disable-next-line require-atomic-updates
|
|
146
195
|
configuration = res.configuration;
|
|
147
|
-
await
|
|
196
|
+
await writeCredentialsAndServiceToConfigFile(configuration, res.configuration.serviceInstance);
|
|
148
197
|
}
|
|
149
198
|
result = res.result;
|
|
150
199
|
}
|
|
151
|
-
catch (
|
|
200
|
+
catch (error_) {
|
|
152
201
|
if (!flags.silent) {
|
|
153
|
-
|
|
202
|
+
ux.action.stop(chalk.red('fail'));
|
|
154
203
|
}
|
|
155
|
-
throw
|
|
204
|
+
throw error_;
|
|
156
205
|
}
|
|
157
206
|
}
|
|
158
207
|
const { endpoint, response: { data, error }, } = result;
|
|
159
208
|
if (data) {
|
|
160
209
|
if (!flags.silent) {
|
|
161
|
-
const deployEnd =
|
|
210
|
+
const deployEnd = Date.now();
|
|
162
211
|
const deployTime = deployEnd - deployStart;
|
|
163
|
-
|
|
164
|
-
console.log(
|
|
212
|
+
ux.action.stop(`${chalk.grey('done in')} ${prettyMilliseconds(deployTime)} 🚀`);
|
|
213
|
+
console.log(formatEndpointInfo({ configuration, endpoint }));
|
|
165
214
|
}
|
|
166
215
|
}
|
|
167
216
|
else {
|
|
168
217
|
if (!flags.silent) {
|
|
169
|
-
|
|
218
|
+
ux.action.stop(chalk.red('fail'));
|
|
170
219
|
}
|
|
171
220
|
// Errors. Exit, and output the server's error response
|
|
172
|
-
throw new
|
|
221
|
+
throw new CLIError(error?.message || 'An error occurred.');
|
|
173
222
|
}
|
|
174
223
|
}
|
|
175
224
|
async doDeployV1WithSdkV1({ endpoint, schema, configurationsets, configuration, }) {
|
|
@@ -180,7 +229,7 @@ class Deploy extends zen_command_1.default {
|
|
|
180
229
|
? `${configurationsets},stepzen/public`
|
|
181
230
|
: 'stepzen/public';
|
|
182
231
|
}
|
|
183
|
-
const response = await
|
|
232
|
+
const response = await deploy(endpoint, configurationsets, schema);
|
|
184
233
|
return {
|
|
185
234
|
endpoint,
|
|
186
235
|
response: {
|
|
@@ -195,7 +244,7 @@ class Deploy extends zen_command_1.default {
|
|
|
195
244
|
const schema = endpoint;
|
|
196
245
|
let configurationsets;
|
|
197
246
|
if (endpointConfig) {
|
|
198
|
-
await
|
|
247
|
+
await Upload.run([
|
|
199
248
|
'configurationset',
|
|
200
249
|
endpoint,
|
|
201
250
|
'--file',
|
|
@@ -204,7 +253,7 @@ class Deploy extends zen_command_1.default {
|
|
|
204
253
|
]);
|
|
205
254
|
configurationsets = endpoint;
|
|
206
255
|
}
|
|
207
|
-
await
|
|
256
|
+
await Upload.run([
|
|
208
257
|
'schema',
|
|
209
258
|
endpoint,
|
|
210
259
|
'--dir',
|
|
@@ -229,7 +278,7 @@ class Deploy extends zen_command_1.default {
|
|
|
229
278
|
const client = await stepzen.client({
|
|
230
279
|
account: configuration.account,
|
|
231
280
|
adminKey: configuration.adminkey,
|
|
232
|
-
deploymentType:
|
|
281
|
+
deploymentType: getDeploymentType(configuration),
|
|
233
282
|
});
|
|
234
283
|
const response = await client.deploy({
|
|
235
284
|
folder,
|
|
@@ -242,7 +291,7 @@ class Deploy extends zen_command_1.default {
|
|
|
242
291
|
if (response.error.message.includes('Variable "$configuration" got invalid value')) {
|
|
243
292
|
// - use the terms familiar to CLI users
|
|
244
293
|
// - avoid dumping the `config.yaml` content into the stdout as it typically contains keys
|
|
245
|
-
response.error.message = response.error.message.replace(/^
|
|
294
|
+
response.error.message = response.error.message.replace(/^variable "\$configuration" got invalid value.*/i, chalk `the {bold config.yaml} file does not pass validation.` +
|
|
246
295
|
` Please fix the issues and try again.`);
|
|
247
296
|
}
|
|
248
297
|
if (response.error.message.includes('ruleset is invalid:')) {
|
|
@@ -252,58 +301,9 @@ class Deploy extends zen_command_1.default {
|
|
|
252
301
|
`\nIn field "ruleset":`);
|
|
253
302
|
}
|
|
254
303
|
}
|
|
304
|
+
// track stepzen deployment command
|
|
305
|
+
trackDeployEvent(endpoint);
|
|
255
306
|
return { endpoint, response };
|
|
256
307
|
}
|
|
257
308
|
}
|
|
258
|
-
exports.default = Deploy;
|
|
259
|
-
Deploy.description = 'Deploy to StepZen.';
|
|
260
|
-
Deploy.usage = `deploy [ENDPOINT] [--config=path/to/config.yaml] [--dir=path/to/workspace]
|
|
261
|
-
|
|
262
|
-
-- OR (deprecated) --
|
|
263
|
-
|
|
264
|
-
$ stepzen deploy ENDPOINT --schema=schema [--configurationsets=cs1[,cs2[,..]]]`;
|
|
265
|
-
Deploy.flags = {
|
|
266
|
-
...zen_command_1.default.flags,
|
|
267
|
-
dir: core_1.Flags.string({ description: 'Working directory' }),
|
|
268
|
-
silent: core_1.Flags.boolean(),
|
|
269
|
-
// configurationsets is assumed to be a comma separated string naming uploaded configurationsets
|
|
270
|
-
// a special configuration 'stepzen/defaults' is recognized.
|
|
271
|
-
configurationsets: core_1.Flags.string({
|
|
272
|
-
description: chalk `
|
|
273
|
-
Name(s) of configuration sets uploaded earlier with {bold stepzen upload}` +
|
|
274
|
-
chalk `
|
|
275
|
-
{yellow [DEPRECATED: this flag will be removed in future versions]}
|
|
276
|
-
|
|
277
|
-
Instead, please use one of these options:
|
|
278
|
-
- {bold stepzen deploy} (without the {bold --configurationsets} flag)
|
|
279
|
-
\tto use the configuration from the {bold config.yaml} file in the current directory (if exists)
|
|
280
|
-
- {bold stepzen deploy --config path/to/config.yaml}
|
|
281
|
-
\tto explicitly specify the configuration file`,
|
|
282
|
-
exclusive: ['config', 'dir'],
|
|
283
|
-
}),
|
|
284
|
-
config: core_1.Flags.string({
|
|
285
|
-
helpValue: 'path/to/config.yaml',
|
|
286
|
-
description: '[default: config.yaml] Configuration file to use (relative to the current directory)',
|
|
287
|
-
}),
|
|
288
|
-
schema: core_1.Flags.string({
|
|
289
|
-
description: chalk `
|
|
290
|
-
Name of a schema uploaded earlier with {bold stepzen upload}` +
|
|
291
|
-
chalk `
|
|
292
|
-
{yellow [DEPRECATED: this flag will be removed in future versions]}
|
|
293
|
-
|
|
294
|
-
Instead, please use one of these options:
|
|
295
|
-
- {bold stepzen deploy} (without the {bold --schema} flag)
|
|
296
|
-
\tto deploy the schema from a StepZen workspace in your current directory
|
|
297
|
-
- {bold stepzen deploy --dir path/to/workspace}
|
|
298
|
-
\tto deploy from a StepZen workspace in another folder`,
|
|
299
|
-
exclusive: ['config', 'dir'],
|
|
300
|
-
}),
|
|
301
|
-
};
|
|
302
|
-
Deploy.args = {
|
|
303
|
-
endpoint: core_1.Args.string({
|
|
304
|
-
description: chalk `name of the endpoint (e.g. {bold api/customers})
|
|
305
|
-
[default: use the {underline endpoint} property from stepzen.config.json]`,
|
|
306
|
-
required: false,
|
|
307
|
-
}),
|
|
308
|
-
};
|
|
309
309
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,iCAAiC;AASjC,OAAO,EAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,kBAAkB,MAAM,WAAW,CAAA;AAE1C,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAC,sCAAsC,EAAC,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AACrD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,oBAA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ACnC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC1B,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAA;IAC7B,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CurlImportOptions } from '../../generate/curl2sdl';
|
|
3
|
-
import { CommonImportOptions
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { Input, OutputArgs, OutputFlags, ParserOutput } from '@oclif/core/parser';
|
|
2
|
+
import type { CurlImportOptions } from '../../generate/curl2sdl.js';
|
|
3
|
+
import type { CommonImportOptions } from '../../generate/import-command.js';
|
|
4
|
+
import { ImportCommandBase } from '../../generate/import-command.js';
|
|
5
|
+
type InteractiveCurl2SdlOptions = Pick<CurlImportOptions, 'curlArgs' | 'queryName' | 'rootType' | 'typePrefix' | 'pathParams'>;
|
|
6
|
+
type CurlAnswers = {
|
|
6
7
|
url: string;
|
|
7
8
|
queryName: string;
|
|
8
9
|
rootType: string;
|
|
@@ -13,21 +14,15 @@ export default class ImportCurl extends ImportCommandBase {
|
|
|
13
14
|
static description: string;
|
|
14
15
|
get source(): "curl";
|
|
15
16
|
static flags: {
|
|
16
|
-
prefix: import("@oclif/core/
|
|
17
|
-
data: import("@oclif/core/
|
|
18
|
-
request: import("@oclif/core/
|
|
19
|
-
url: import("@oclif/core/
|
|
20
|
-
header: import("@oclif/core/
|
|
21
|
-
'header-param': import("@oclif/core/
|
|
22
|
-
'query-name': import("@oclif/core/
|
|
23
|
-
'query-type': import("@oclif/core/
|
|
24
|
-
'path-params': import("@oclif/core/
|
|
25
|
-
dir: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
26
|
-
silent: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
27
|
-
name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
28
|
-
overwrite: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
29
|
-
help: import("@oclif/core/lib/interfaces/parser").BooleanFlag<void>;
|
|
30
|
-
'non-interactive': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
17
|
+
prefix: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
data: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
request: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
url: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
header: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'header-param': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'query-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'query-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'path-params': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
26
|
};
|
|
32
27
|
static strict: boolean;
|
|
33
28
|
protected import(commonOptions: CommonImportOptions): Promise<{
|
|
@@ -36,12 +31,10 @@ export default class ImportCurl extends ImportCommandBase {
|
|
|
36
31
|
};
|
|
37
32
|
result?: undefined;
|
|
38
33
|
} | {
|
|
39
|
-
result: import("../../generate/helpers").IntrospectionServiceResponse;
|
|
34
|
+
result: import("../../generate/helpers.js").IntrospectionServiceResponse;
|
|
40
35
|
error?: undefined;
|
|
41
36
|
}>;
|
|
42
|
-
protected parse<F extends
|
|
43
|
-
argv: string[];
|
|
44
|
-
}>;
|
|
37
|
+
protected parse<F extends OutputFlags<any>, B extends OutputFlags<any>, A extends OutputArgs<any>>(options: Input<F, B, A>, argv?: string[]): Promise<ParserOutput<F, B, A>>;
|
|
45
38
|
getImportOptionsInteractively(defaults?: Partial<CurlAnswers>): Promise<InteractiveCurl2SdlOptions>;
|
|
46
39
|
}
|
|
47
40
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../src/commands/import/curl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"curl.d.ts","sourceRoot":"","sources":["../../../src/commands/import/curl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAA;AAUzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAA;AASlE,KAAK,0BAA0B,GAAG,IAAI,CACpC,iBAAiB,EACjB,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CACpE,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,iBAAiB;IACvD,MAAM,CAAC,WAAW,SAOkB;IAEpC,IAAI,MAAM,WAET;IAED,MAAM,CAAC,KAAK;;;;;;;;;;MA8CX;IAGD,MAAM,CAAC,MAAM,UAAQ;cAEL,MAAM,CAAC,aAAa,EAAE,mBAAmB;;;;;;;;;cAyGzC,KAAK,CAEnB,CAAC,S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