stepzen 0.13.0-beta.1 → 0.13.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/README.md +1 -1
- package/lib/commands/deploy.d.ts +11 -3
- package/lib/commands/deploy.js +5 -13
- package/lib/commands/import.d.ts +15 -3
- package/lib/commands/import.js +8 -24
- package/lib/commands/init.d.ts +10 -3
- package/lib/commands/init.js +3 -6
- package/lib/commands/lint.d.ts +9 -3
- package/lib/commands/lint.js +3 -5
- package/lib/commands/list.d.ts +8 -3
- package/lib/commands/list.js +4 -10
- package/lib/commands/login.d.ts +11 -3
- package/lib/commands/login.js +5 -19
- package/lib/commands/logout.d.ts +8 -3
- package/lib/commands/logout.js +3 -4
- package/lib/commands/start.d.ts +17 -3
- package/lib/commands/start.js +4 -19
- package/lib/commands/transpile.d.ts +14 -3
- package/lib/commands/transpile.js +3 -10
- package/lib/commands/upload.d.ts +11 -3
- package/lib/commands/upload.js +17 -17
- package/lib/commands/validate.d.ts +8 -3
- package/lib/commands/validate.js +3 -4
- package/lib/commands/whoami.d.ts +11 -3
- package/lib/commands/whoami.js +6 -10
- package/lib/generate/curl2sdl.d.ts +1 -1
- package/lib/generate/helpers.d.ts +0 -4
- package/lib/generate/helpers.js +3 -102
- package/lib/generate/index.d.ts +1 -1
- package/lib/shared/actions.d.ts +1 -1
- package/lib/shared/actions.js +2 -15
- package/lib/shared/configuration.d.ts +1 -1
- package/lib/shared/configuration.js +1 -1
- package/lib/shared/constants.d.ts +1 -1
- package/lib/shared/constants.js +2 -1
- package/lib/shared/stepzen-sdk.d.ts +8 -0
- package/lib/shared/stepzen-sdk.js +22 -1
- package/lib/shared/utils.js +1 -1
- package/lib/shared/zen-command.d.ts +15 -0
- package/lib/shared/zen-command.js +100 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -2
- package/lib/hooks/prerun/check-account.d.ts +0 -3
- package/lib/hooks/prerun/check-account.js +0 -12
package/README.md
CHANGED
package/lib/commands/deploy.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Deploy extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
configurationsets: flags.IOptionFlag<string>;
|
|
7
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
schema: flags.IOptionFlag<string>;
|
|
9
|
+
silent: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
12
|
+
};
|
|
5
13
|
static args: {
|
|
6
14
|
name: string;
|
|
7
15
|
description: string;
|
package/lib/commands/deploy.js
CHANGED
|
@@ -8,19 +8,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
const command_1 = require("@oclif/command");
|
|
9
9
|
const errors_1 = require("@oclif/errors");
|
|
10
10
|
const actions_1 = require("../shared/actions");
|
|
11
|
-
const
|
|
12
|
-
class Deploy extends
|
|
11
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
12
|
+
class Deploy extends zen_command_1.default {
|
|
13
13
|
async run() {
|
|
14
14
|
const { args, flags } = this.parse(Deploy);
|
|
15
15
|
// Make sure that you definitely specify folder/name
|
|
16
16
|
if (args.destination.includes('/') === false) {
|
|
17
17
|
throw new errors_1.CLIError('You must specify the folder/name you want to use');
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
if (!configuration) {
|
|
21
|
-
// Configuration not found. Most likely because someone is not logged in. Exit with error.
|
|
22
|
-
throw new errors_1.CLIError('You are probably not logged in.');
|
|
23
|
-
}
|
|
19
|
+
await this.ensureStepZenAccount();
|
|
24
20
|
if (!flags.silent) {
|
|
25
21
|
this.log('Deploying...');
|
|
26
22
|
}
|
|
@@ -38,17 +34,13 @@ class Deploy extends command_1.Command {
|
|
|
38
34
|
}
|
|
39
35
|
exports.default = Deploy;
|
|
40
36
|
Deploy.description = 'deploy to stepzen';
|
|
41
|
-
Deploy.flags = {
|
|
37
|
+
Deploy.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), {
|
|
42
38
|
// configurationsets is assumed to be a comma separated string naming uploaded configurationsets
|
|
43
39
|
// a special configuration 'stepzen/defaults' is recognized.
|
|
44
40
|
configurationsets: command_1.flags.string({
|
|
45
41
|
description: 'Configurationsets to use',
|
|
46
42
|
default: '',
|
|
47
|
-
}),
|
|
48
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
49
|
-
schema: command_1.flags.string({ description: 'Schema to use', required: true }),
|
|
50
|
-
silent: command_1.flags.boolean(),
|
|
51
|
-
};
|
|
43
|
+
}), help: command_1.flags.help({ char: 'h' }), schema: command_1.flags.string({ description: 'Schema to use', required: true }), silent: command_1.flags.boolean() });
|
|
52
44
|
Deploy.args = [
|
|
53
45
|
{
|
|
54
46
|
name: 'destination',
|
package/lib/commands/import.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Import extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
dir: flags.IOptionFlag<string | undefined>;
|
|
7
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
silent: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
+
name: flags.IOptionFlag<string | undefined>;
|
|
10
|
+
prefix: flags.IOptionFlag<string | undefined>;
|
|
11
|
+
'query-name': flags.IOptionFlag<string | undefined>;
|
|
12
|
+
'query-type': flags.IOptionFlag<string | undefined>;
|
|
13
|
+
'path-params': flags.IOptionFlag<string | undefined>;
|
|
14
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
15
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
16
|
+
};
|
|
5
17
|
static args: {
|
|
6
18
|
name: string;
|
|
7
19
|
required: boolean;
|
package/lib/commands/import.js
CHANGED
|
@@ -7,17 +7,17 @@ const command_1 = require("@oclif/command");
|
|
|
7
7
|
const errors_1 = require("@oclif/errors");
|
|
8
8
|
const transpiler_1 = require("@stepzen/transpiler");
|
|
9
9
|
const cli_ux_1 = require("cli-ux");
|
|
10
|
-
const deploy_1 = require("./deploy");
|
|
11
10
|
const generate_1 = require("../generate");
|
|
12
11
|
const utils_1 = require("../shared/utils");
|
|
13
12
|
const helpers_1 = require("../generate/helpers");
|
|
14
13
|
const curl2sdl_1 = require("../generate/curl2sdl");
|
|
15
14
|
const curl_parser_1 = require("../shared/curl-parser");
|
|
16
15
|
const workspace_1 = require("../shared/workspace");
|
|
16
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
17
17
|
const init_1 = require("./init");
|
|
18
18
|
const constants_1 = require("../shared/constants");
|
|
19
19
|
const path_params_parser_1 = require("../shared/path-params-parser");
|
|
20
|
-
class Import extends
|
|
20
|
+
class Import extends zen_command_1.default {
|
|
21
21
|
async run() {
|
|
22
22
|
const { args, argv, flags } = this.parse(Import);
|
|
23
23
|
// Get a list of schemas you're asking for
|
|
@@ -106,13 +106,6 @@ class Import extends command_1.Command {
|
|
|
106
106
|
this.log(chalk.gray(`The ${chalk.bold(`--${flag}`)} flag only applies when importing ${chalk.bold('curl')}. It will be ignored now.`));
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
// Make sure the user has latest Generator Schema
|
|
110
|
-
await deploy_1.default.run([
|
|
111
|
-
constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT,
|
|
112
|
-
'--schema',
|
|
113
|
-
constants_1.STEPZEN_GENERATOR_ENGINES_SCHEMA,
|
|
114
|
-
'--silent',
|
|
115
|
-
]);
|
|
116
109
|
// Let's go!
|
|
117
110
|
result = await generate_1.default(schemas, flags.name, workspace.schema);
|
|
118
111
|
// Validate
|
|
@@ -130,26 +123,18 @@ class Import extends command_1.Command {
|
|
|
130
123
|
}
|
|
131
124
|
exports.default = Import;
|
|
132
125
|
Import.description = 'Import a schema for an external data source or a API endpoint to your GraphQL API.';
|
|
133
|
-
Import.flags = {
|
|
134
|
-
dir: command_1.flags.string({ description: 'working directory' }),
|
|
135
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
136
|
-
silent: command_1.flags.boolean({ hidden: true }),
|
|
137
|
-
name: command_1.flags.string({
|
|
126
|
+
Import.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { dir: command_1.flags.string({ description: 'working directory' }), help: command_1.flags.help({ char: 'h' }), silent: command_1.flags.boolean({ hidden: true }), name: command_1.flags.string({
|
|
138
127
|
description: 'subfolder inside the workspace folder to save the imported' +
|
|
139
128
|
' schema files, defaults to the imported schema name',
|
|
140
|
-
}),
|
|
141
|
-
prefix: command_1.flags.string({
|
|
129
|
+
}), prefix: command_1.flags.string({
|
|
142
130
|
description: '[curl] prefix to add every type in the generated schema.',
|
|
143
|
-
}),
|
|
144
|
-
'query-name': command_1.flags.string({
|
|
131
|
+
}), 'query-name': command_1.flags.string({
|
|
145
132
|
description: '[curl] property name to add to the Query type as a way to' +
|
|
146
133
|
' access the imported cURL endpoint.',
|
|
147
|
-
}),
|
|
148
|
-
'query-type': command_1.flags.string({
|
|
134
|
+
}), 'query-type': command_1.flags.string({
|
|
149
135
|
description: '[curl] name for the type returned by the cURL endpoint in the ' +
|
|
150
136
|
`generated schema. The name specified by ${chalk.bold('--query-type')} is not prefixed by ${chalk.bold('--prefix')} if both flags are present.`,
|
|
151
|
-
}),
|
|
152
|
-
'path-params': command_1.flags.string({
|
|
137
|
+
}), 'path-params': command_1.flags.string({
|
|
153
138
|
description: `[curl] specifies path parameters in the URL path.` +
|
|
154
139
|
` Can be formed by taking the original path and replacing the` +
|
|
155
140
|
` variable segments with ${chalk.bold('$paramName')} placeholders.` +
|
|
@@ -158,8 +143,7 @@ Import.flags = {
|
|
|
158
143
|
`\nstepzen import curl https://example.com/users/jane/posts/12` +
|
|
159
144
|
` --path-params` +
|
|
160
145
|
` '/users/${chalk.bold('$userId')}/posts/${chalk.bold('$postId')}'`,
|
|
161
|
-
})
|
|
162
|
-
};
|
|
146
|
+
}) });
|
|
163
147
|
Import.args = [
|
|
164
148
|
{
|
|
165
149
|
name: 'schemas',
|
package/lib/commands/init.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
2
3
|
export declare const validateWorkspaceName: (directory: string, name: string) => boolean;
|
|
3
4
|
export declare const generateWorkspaceName: (directory: string) => string;
|
|
4
5
|
export declare const guessSchemaRoot: (directory: string) => string;
|
|
5
|
-
export default class Init extends
|
|
6
|
+
export default class Init extends ZenCommand {
|
|
6
7
|
static description: string;
|
|
7
8
|
static hidden: boolean;
|
|
8
|
-
static flags:
|
|
9
|
+
static flags: {
|
|
10
|
+
endpoint: flags.IOptionFlag<string | undefined>;
|
|
11
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
12
|
+
yes: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
13
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
14
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
15
|
+
};
|
|
9
16
|
static args: {
|
|
10
17
|
hidden: boolean;
|
|
11
18
|
name: string;
|
package/lib/commands/init.js
CHANGED
|
@@ -12,6 +12,7 @@ const path = require("path");
|
|
|
12
12
|
const utils_1 = require("../shared/utils");
|
|
13
13
|
const moniker_1 = require("../shared/moniker");
|
|
14
14
|
const workspace_1 = require("../shared/workspace");
|
|
15
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
15
16
|
exports.validateWorkspaceName = (directory, name) => {
|
|
16
17
|
return !fs.existsSync(path.join(directory, name));
|
|
17
18
|
};
|
|
@@ -35,7 +36,7 @@ exports.guessSchemaRoot = (directory) => {
|
|
|
35
36
|
];
|
|
36
37
|
return existing.length > 0 ? path.dirname(existing[0]) : '';
|
|
37
38
|
};
|
|
38
|
-
class Init extends
|
|
39
|
+
class Init extends zen_command_1.default {
|
|
39
40
|
async run() {
|
|
40
41
|
const { args, flags } = this.parse(Init);
|
|
41
42
|
// Get the correct directory
|
|
@@ -121,11 +122,7 @@ class Init extends command_1.Command {
|
|
|
121
122
|
exports.default = Init;
|
|
122
123
|
Init.description = 'stepzen init';
|
|
123
124
|
Init.hidden = true;
|
|
124
|
-
Init.flags = {
|
|
125
|
-
endpoint: command_1.flags.string({ hidden: true }),
|
|
126
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
127
|
-
yes: command_1.flags.boolean({ default: false, hidden: true }),
|
|
128
|
-
};
|
|
125
|
+
Init.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { endpoint: command_1.flags.string({ hidden: true }), help: command_1.flags.help({ char: 'h' }), yes: command_1.flags.boolean({ default: false, hidden: true }) });
|
|
129
126
|
Init.args = [
|
|
130
127
|
{
|
|
131
128
|
hidden: true,
|
package/lib/commands/lint.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Init extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static hidden: boolean;
|
|
5
|
-
static flags:
|
|
6
|
+
static flags: {
|
|
7
|
+
dir: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
11
|
+
};
|
|
6
12
|
run(): Promise<void>;
|
|
7
13
|
}
|
package/lib/commands/lint.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
5
|
const utils_1 = require("../shared/utils");
|
|
6
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
6
7
|
const { lint } = require('@stepzen/transpiler');
|
|
7
|
-
class Init extends
|
|
8
|
+
class Init extends zen_command_1.default {
|
|
8
9
|
async run() {
|
|
9
10
|
const { flags } = this.parse(Init);
|
|
10
11
|
// Get the correct directory
|
|
@@ -23,7 +24,4 @@ class Init extends command_1.Command {
|
|
|
23
24
|
exports.default = Init;
|
|
24
25
|
Init.description = 'stepzen lint';
|
|
25
26
|
Init.hidden = true;
|
|
26
|
-
Init.flags = {
|
|
27
|
-
dir: command_1.flags.string({ hidden: true }),
|
|
28
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
29
|
-
};
|
|
27
|
+
Init.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { dir: command_1.flags.string({ hidden: true }), help: command_1.flags.help({ char: 'h' }) });
|
package/lib/commands/list.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class List extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
8
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
9
|
+
};
|
|
5
10
|
static args: {
|
|
6
11
|
name: string;
|
|
7
12
|
required: boolean;
|
package/lib/commands/list.js
CHANGED
|
@@ -8,16 +8,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
const command_1 = require("@oclif/command");
|
|
9
9
|
const errors_1 = require("@oclif/errors");
|
|
10
10
|
const actions_1 = require("../shared/actions");
|
|
11
|
-
const
|
|
12
|
-
class List extends
|
|
11
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
12
|
+
class List extends zen_command_1.default {
|
|
13
13
|
async run() {
|
|
14
14
|
var _a;
|
|
15
15
|
const { args } = this.parse(List);
|
|
16
|
-
|
|
17
|
-
if (!configuration) {
|
|
18
|
-
// Configuration not found. Most likely because someone is not logged in. Exit with error.
|
|
19
|
-
throw new errors_1.CLIError('You are probably not logged in.');
|
|
20
|
-
}
|
|
16
|
+
await this.ensureStepZenAccount();
|
|
21
17
|
const response = await actions_1.list(args.type);
|
|
22
18
|
if (response.success) {
|
|
23
19
|
if (((_a = response.results) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
@@ -37,9 +33,7 @@ class List extends command_1.Command {
|
|
|
37
33
|
}
|
|
38
34
|
exports.default = List;
|
|
39
35
|
List.description = 'list your items';
|
|
40
|
-
List.flags = {
|
|
41
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
42
|
-
};
|
|
36
|
+
List.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { help: command_1.flags.help({ char: 'h' }) });
|
|
43
37
|
List.args = [
|
|
44
38
|
{
|
|
45
39
|
name: 'type',
|
package/lib/commands/login.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Login extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
account: flags.IOptionFlag<string | undefined>;
|
|
7
|
+
adminkey: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
config: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
10
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
12
|
+
};
|
|
5
13
|
run(): Promise<void>;
|
|
6
14
|
}
|
package/lib/commands/login.js
CHANGED
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
// Stepzen login checks that credentials presented are good and
|
|
6
6
|
// subsequently changes the identity of the logged in account.
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
|
-
const errors_1 = require("@oclif/errors");
|
|
9
8
|
const cli_ux_1 = require("cli-ux");
|
|
10
9
|
const configuration_1 = require("../shared/configuration");
|
|
11
10
|
const stepzen_sdk_1 = require("../shared/stepzen-sdk");
|
|
12
|
-
|
|
11
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
12
|
+
class Login extends zen_command_1.default {
|
|
13
13
|
async run() {
|
|
14
14
|
const { flags } = this.parse(Login);
|
|
15
15
|
let account;
|
|
@@ -38,26 +38,12 @@ class Login extends command_1.Command {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
// the stepzen admin api.
|
|
43
|
-
const isValidConfiguration = await stepzen_sdk_1.default.verify(account, adminkey);
|
|
44
|
-
if (!isValidConfiguration) {
|
|
45
|
-
// Exit, with error
|
|
46
|
-
throw new errors_1.CLIError('We are unable to verify your account details. Could you please check them?');
|
|
47
|
-
}
|
|
41
|
+
const configuration = await stepzen_sdk_1.default.login(adminkey, account);
|
|
48
42
|
// Change the default account.
|
|
49
|
-
configuration_1.writeConfigurationToLoginFile(
|
|
50
|
-
account,
|
|
51
|
-
adminkey,
|
|
52
|
-
});
|
|
43
|
+
configuration_1.writeConfigurationToLoginFile(configuration);
|
|
53
44
|
this.log('You have successfully logged in.');
|
|
54
45
|
}
|
|
55
46
|
}
|
|
56
47
|
exports.default = Login;
|
|
57
48
|
Login.description = 'log in to stepzen';
|
|
58
|
-
Login.flags = {
|
|
59
|
-
account: command_1.flags.string({ char: 'a', exclusive: ['config'], hidden: true }),
|
|
60
|
-
adminkey: command_1.flags.string({ char: 'k', exclusive: ['config'], hidden: true }),
|
|
61
|
-
config: command_1.flags.string({ exclusive: ['account', 'adminkey'], hidden: true }),
|
|
62
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
63
|
-
};
|
|
49
|
+
Login.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { account: command_1.flags.string({ char: 'a', exclusive: ['config'], hidden: true }), adminkey: command_1.flags.string({ char: 'k', exclusive: ['config'], hidden: true }), config: command_1.flags.string({ exclusive: ['account', 'adminkey'], hidden: true }), help: command_1.flags.help({ char: 'h' }) });
|
package/lib/commands/logout.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Logout extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
8
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
9
|
+
};
|
|
5
10
|
run(): Promise<void>;
|
|
6
11
|
}
|
package/lib/commands/logout.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
// The logout command removes the entry in the login file.
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const configuration_1 = require("../shared/configuration");
|
|
8
|
-
|
|
8
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
9
|
+
class Logout extends zen_command_1.default {
|
|
9
10
|
async run() {
|
|
10
11
|
// Remove the configuration from the login file.
|
|
11
12
|
configuration_1.removeConfigurationFromLoginFile();
|
|
@@ -14,6 +15,4 @@ class Logout extends command_1.Command {
|
|
|
14
15
|
}
|
|
15
16
|
exports.default = Logout;
|
|
16
17
|
Logout.description = 'log out of stepzen';
|
|
17
|
-
Logout.flags = {
|
|
18
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
19
|
-
};
|
|
18
|
+
Logout.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { help: command_1.flags.help({ char: 'h' }) });
|
package/lib/commands/start.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Start extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
dir: flags.IOptionFlag<string | undefined>;
|
|
7
|
+
endpoint: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
'no-console': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
|
+
'no-dashboard': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
|
+
'no-init': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
12
|
+
'no-server': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
13
|
+
'no-validate': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
14
|
+
'no-watcher': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
15
|
+
port: import("@oclif/parser/lib/flags").IOptionFlag<number>;
|
|
16
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
17
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
18
|
+
};
|
|
5
19
|
static args: never[];
|
|
6
20
|
run(): Promise<void>;
|
|
7
21
|
}
|
package/lib/commands/start.js
CHANGED
|
@@ -7,23 +7,19 @@ const command_1 = require("@oclif/command");
|
|
|
7
7
|
const errors_1 = require("@oclif/errors");
|
|
8
8
|
const throttle_debounce_1 = require("throttle-debounce");
|
|
9
9
|
const detect = require("detect-port");
|
|
10
|
-
const configuration_1 = require("../shared/configuration");
|
|
11
10
|
const utils_1 = require("../shared/utils");
|
|
12
11
|
const start_1 = require("../start");
|
|
13
12
|
const workspace_1 = require("../shared/workspace");
|
|
14
13
|
const init_1 = require("./init");
|
|
15
14
|
const dashboard_interface_1 = require("../generate/dashboard-interface");
|
|
16
15
|
const constants_1 = require("../shared/constants");
|
|
16
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
17
17
|
const dashboard = require('@stepzen/dashboard');
|
|
18
18
|
const { version } = require('../../package.json');
|
|
19
|
-
class Start extends
|
|
19
|
+
class Start extends zen_command_1.default {
|
|
20
20
|
async run() {
|
|
21
21
|
const { flags } = this.parse(Start);
|
|
22
|
-
const configuration =
|
|
23
|
-
if (!configuration) {
|
|
24
|
-
// Configuration not found. Most likely because someone is not logged in. Exit with error.
|
|
25
|
-
throw new errors_1.CLIError('You are probably not logged in.');
|
|
26
|
-
}
|
|
22
|
+
const { configuration } = await this.ensureStepZenAccount();
|
|
27
23
|
// Get the working directory and workspace
|
|
28
24
|
let workspace;
|
|
29
25
|
const directory = utils_1.getDirectory(flags.dir);
|
|
@@ -103,16 +99,5 @@ class Start extends command_1.Command {
|
|
|
103
99
|
}
|
|
104
100
|
exports.default = Start;
|
|
105
101
|
Start.description = 'upload and deploy your schema';
|
|
106
|
-
Start.flags = {
|
|
107
|
-
dir: command_1.flags.string({ description: 'working directory' }),
|
|
108
|
-
endpoint: command_1.flags.string({ description: 'Override workspace endpoint' }),
|
|
109
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
110
|
-
'no-console': command_1.flags.boolean({ hidden: true }),
|
|
111
|
-
'no-dashboard': command_1.flags.boolean({ hidden: true }),
|
|
112
|
-
'no-init': command_1.flags.boolean({ hidden: true }),
|
|
113
|
-
'no-server': command_1.flags.boolean({ hidden: true }),
|
|
114
|
-
'no-validate': command_1.flags.boolean({ hidden: true }),
|
|
115
|
-
'no-watcher': command_1.flags.boolean({ hidden: true }),
|
|
116
|
-
port: command_1.flags.integer({ default: 5001, env: 'PORT' }),
|
|
117
|
-
};
|
|
102
|
+
Start.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { dir: command_1.flags.string({ description: 'working directory' }), endpoint: command_1.flags.string({ description: 'Override workspace endpoint' }), help: command_1.flags.help({ char: 'h' }), 'no-console': command_1.flags.boolean({ hidden: true }), 'no-dashboard': command_1.flags.boolean({ hidden: true }), 'no-init': command_1.flags.boolean({ hidden: true }), 'no-server': command_1.flags.boolean({ hidden: true }), 'no-validate': command_1.flags.boolean({ hidden: true }), 'no-watcher': command_1.flags.boolean({ hidden: true }), port: command_1.flags.integer({ default: 5001, env: 'PORT' }) });
|
|
118
103
|
Start.args = [];
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Transpile extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static hidden: boolean;
|
|
5
|
-
static flags:
|
|
6
|
+
static flags: {
|
|
7
|
+
config: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
'hide-output': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
|
+
inspect: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
|
+
'inspect-after': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
12
|
+
'output-configuration': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
13
|
+
silent: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
14
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
15
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
16
|
+
};
|
|
6
17
|
static args: {
|
|
7
18
|
name: string;
|
|
8
19
|
required: boolean;
|
|
@@ -7,8 +7,9 @@ const errors_1 = require("@oclif/errors");
|
|
|
7
7
|
const fs = require("fs-extra");
|
|
8
8
|
const path = require("path");
|
|
9
9
|
const utils_1 = require("../shared/utils");
|
|
10
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
10
11
|
const { configure, stitch, validate } = require('@stepzen/transpiler');
|
|
11
|
-
class Transpile extends
|
|
12
|
+
class Transpile extends zen_command_1.default {
|
|
12
13
|
async run() {
|
|
13
14
|
const { args, flags } = this.parse(Transpile);
|
|
14
15
|
const folder = utils_1.getDirectory(args.folder);
|
|
@@ -39,15 +40,7 @@ class Transpile extends command_1.Command {
|
|
|
39
40
|
exports.default = Transpile;
|
|
40
41
|
Transpile.description = 'transpile a graphql schema';
|
|
41
42
|
Transpile.hidden = true;
|
|
42
|
-
Transpile.flags = {
|
|
43
|
-
config: command_1.flags.string({ hidden: true }),
|
|
44
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
45
|
-
'hide-output': command_1.flags.boolean({ hidden: true }),
|
|
46
|
-
inspect: command_1.flags.boolean({ char: 'i', hidden: true }),
|
|
47
|
-
'inspect-after': command_1.flags.boolean({ hidden: true }),
|
|
48
|
-
'output-configuration': command_1.flags.boolean(),
|
|
49
|
-
silent: command_1.flags.boolean(),
|
|
50
|
-
};
|
|
43
|
+
Transpile.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { config: command_1.flags.string({ hidden: true }), help: command_1.flags.help({ char: 'h' }), 'hide-output': command_1.flags.boolean({ hidden: true }), inspect: command_1.flags.boolean({ char: 'i', hidden: true }), 'inspect-after': command_1.flags.boolean({ hidden: true }), 'output-configuration': command_1.flags.boolean(), silent: command_1.flags.boolean() });
|
|
51
44
|
Transpile.args = [
|
|
52
45
|
{
|
|
53
46
|
name: 'folder',
|
package/lib/commands/upload.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Upload extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
dir: flags.IOptionFlag<string | undefined>;
|
|
7
|
+
file: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
silent: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
12
|
+
};
|
|
5
13
|
static args: ({
|
|
6
14
|
name: string;
|
|
7
15
|
required: boolean;
|
package/lib/commands/upload.js
CHANGED
|
@@ -11,28 +11,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
// provided by the user.
|
|
12
12
|
const command_1 = require("@oclif/command");
|
|
13
13
|
const errors_1 = require("@oclif/errors");
|
|
14
|
-
const configuration_1 = require("../shared/configuration");
|
|
15
14
|
const actions_1 = require("../shared/actions");
|
|
16
|
-
|
|
15
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
16
|
+
class Upload extends zen_command_1.default {
|
|
17
17
|
async run() {
|
|
18
18
|
const { args, flags } = this.parse(Upload);
|
|
19
19
|
// Make sure that you definitely specify folder/name
|
|
20
20
|
if (args.destination.includes('/') === false) {
|
|
21
21
|
throw new errors_1.CLIError('You must specify the folder/name you want to use');
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
await this.ensureStepZenAccount();
|
|
24
|
+
let source;
|
|
25
|
+
if (args.type === 'configurationset') {
|
|
26
|
+
if (!flags.file) {
|
|
27
|
+
throw new errors_1.CLIError('Please specify a source file with the --file flag');
|
|
28
|
+
}
|
|
29
|
+
source = flags.file;
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
else {
|
|
32
|
+
if (!flags.dir) {
|
|
33
|
+
throw new errors_1.CLIError('Please specify a source directory with the --dir flag');
|
|
34
|
+
}
|
|
35
|
+
source = flags.dir;
|
|
31
36
|
}
|
|
32
37
|
if (!flags.silent) {
|
|
33
38
|
this.log('Uploading...');
|
|
34
39
|
}
|
|
35
|
-
const response = await actions_1.upload(args.type, args.destination,
|
|
40
|
+
const response = await actions_1.upload(args.type, args.destination, source);
|
|
36
41
|
if (response.success) {
|
|
37
42
|
if (!flags.silent) {
|
|
38
43
|
this.log(response.message);
|
|
@@ -48,15 +53,10 @@ exports.default = Upload;
|
|
|
48
53
|
Upload.description = 'upload to stepzen';
|
|
49
54
|
// The uploaded resource is either a directory or a file. In case it is the former,
|
|
50
55
|
// it will be packaged into a zip archive and transferred.
|
|
51
|
-
Upload.flags = {
|
|
52
|
-
dir: command_1.flags.string({
|
|
56
|
+
Upload.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { dir: command_1.flags.string({
|
|
53
57
|
description: 'A directory to upload',
|
|
54
58
|
exclusive: ['file'],
|
|
55
|
-
}),
|
|
56
|
-
file: command_1.flags.string({ description: 'A file to upload', exclusive: ['dir'] }),
|
|
57
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
58
|
-
silent: command_1.flags.boolean(),
|
|
59
|
-
};
|
|
59
|
+
}), file: command_1.flags.string({ description: 'A file to upload', exclusive: ['dir'] }), help: command_1.flags.help({ char: 'h' }), silent: command_1.flags.boolean() });
|
|
60
60
|
// the type and name of the uploaded resource.
|
|
61
61
|
Upload.args = [
|
|
62
62
|
{
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class Validate extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static hidden: boolean;
|
|
5
|
-
static flags:
|
|
6
|
+
static flags: {
|
|
7
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
10
|
+
};
|
|
6
11
|
static args: {
|
|
7
12
|
name: string;
|
|
8
13
|
required: boolean;
|