stepzen 0.17.0-beta.0 → 0.17.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 +1 -1
- package/lib/commands/import.d.ts +2 -2
- package/lib/commands/import.js +17 -35
- package/lib/commands/init.d.ts +0 -3
- package/lib/commands/init.js +5 -108
- package/lib/commands/start.d.ts +0 -1
- package/lib/commands/start.js +32 -37
- package/lib/generate/helpers.js +1 -1
- package/lib/shared/utils.d.ts +15 -1
- package/lib/shared/utils.js +28 -7
- package/lib/shared/workspace.d.ts +8 -0
- package/lib/shared/workspace.js +105 -1
- package/lib/shared/zen-command.d.ts +5 -1
- package/lib/shared/zen-command.js +27 -0
- package/lib/start/console.d.ts +11 -2
- package/lib/start/console.js +26 -9
- package/lib/start/deploy.d.ts +5 -1
- package/lib/start/deploy.js +1 -25
- package/lib/start/index.d.ts +2 -3
- package/lib/start/index.js +6 -5
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ $ npm install -g stepzen
|
|
|
29
29
|
$ stepzen COMMAND
|
|
30
30
|
running command...
|
|
31
31
|
$ stepzen (-v|--version|version)
|
|
32
|
-
stepzen/0.17.0-beta.
|
|
32
|
+
stepzen/0.17.0-beta.1 darwin-x64 node-v14.19.1
|
|
33
33
|
$ stepzen --help [COMMAND]
|
|
34
34
|
USAGE
|
|
35
35
|
$ stepzen COMMAND
|
package/lib/commands/import.d.ts
CHANGED
|
@@ -67,9 +67,9 @@ export default class Import extends ZenCommand {
|
|
|
67
67
|
static strict: boolean;
|
|
68
68
|
run(): Promise<void>;
|
|
69
69
|
ensureOnConflictBehavior(workspace: Workspace, schema: string, flags: ReturnType<Import['parseWorkaround']>['flags']): Promise<"overwrite" | "append">;
|
|
70
|
-
warnAboutIgnoredFlags
|
|
70
|
+
warnAboutIgnoredFlags(schema: string, usedFlags: {
|
|
71
71
|
[key: string]: any;
|
|
72
|
-
})
|
|
72
|
+
}): void;
|
|
73
73
|
parseWorkaround(): import("@oclif/parser").Output<{
|
|
74
74
|
'db-schema': string | undefined;
|
|
75
75
|
'db-host': string | undefined;
|
package/lib/commands/import.js
CHANGED
|
@@ -14,50 +14,18 @@ const utils_1 = require("../shared/utils");
|
|
|
14
14
|
const helpers_1 = require("../generate/helpers");
|
|
15
15
|
const curl2sdl_1 = require("../generate/curl2sdl");
|
|
16
16
|
const curl_parser_1 = require("../shared/curl-parser");
|
|
17
|
-
const workspace_1 = require("../shared/workspace");
|
|
18
17
|
const zen_command_1 = require("../shared/zen-command");
|
|
19
|
-
const init_1 = require("./init");
|
|
20
18
|
const constants_1 = require("../shared/constants");
|
|
21
19
|
const path_params_parser_1 = require("../shared/path-params-parser");
|
|
22
20
|
const header_params_parser_1 = require("../shared/header-params-parser");
|
|
23
21
|
class Import extends zen_command_1.default {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
// notify the user about any ignored flags
|
|
27
|
-
this.warnAboutIgnoredFlags = (schema, usedFlags) => {
|
|
28
|
-
Import.flagsForSchemas.forEach(({ flags, schemas }) => {
|
|
29
|
-
if (!schemas.includes(schema)) {
|
|
30
|
-
Object.keys(flags).forEach(flag => {
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(usedFlags, flag)) {
|
|
32
|
-
this.log(chalk.gray(`The ${chalk.bold(`--${flag}`)} flag only applies when importing ${schemas
|
|
33
|
-
.map(schema => chalk.bold(schema))
|
|
34
|
-
.join(', ')}. It will be ignored now.`));
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
22
|
async run() {
|
|
42
23
|
const { args, argv, flags } = this.parseWorkaround();
|
|
43
24
|
// Get a list of schemas you're asking for
|
|
44
25
|
const schema = helpers_1.getSchema(args.schema);
|
|
45
|
-
// Get
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const maybeWorkspace = workspace_1.getWorkspace(directory);
|
|
49
|
-
if (maybeWorkspace) {
|
|
50
|
-
workspace = maybeWorkspace;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
try {
|
|
54
|
-
workspace = await init_1.default.run([directory]);
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
throw new errors_1.CLIError(`Could not create a StepZen workspace in the ${flags.dir ? directory : 'current'} directory.\n` + error.message);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// Make sure that the onConflict behaviour is defined and feasible
|
|
26
|
+
// Get or create a StepZen workspace (possibly interactive)
|
|
27
|
+
const workspace = await this.ensureStepZenWorkspace({ directory: flags.dir });
|
|
28
|
+
// Define a sane onConflict behaviour (possibly interactive)
|
|
61
29
|
const onConflict = await this.ensureOnConflictBehavior(workspace, schema, flags);
|
|
62
30
|
this.warnAboutIgnoredFlags(schema, flags);
|
|
63
31
|
// Select an import execution flow:
|
|
@@ -196,6 +164,20 @@ class Import extends zen_command_1.default {
|
|
|
196
164
|
}
|
|
197
165
|
this.exit();
|
|
198
166
|
}
|
|
167
|
+
// notify the user about any ignored flags
|
|
168
|
+
warnAboutIgnoredFlags(schema, usedFlags) {
|
|
169
|
+
Import.flagsForSchemas.forEach(({ flags, schemas }) => {
|
|
170
|
+
if (!schemas.includes(schema)) {
|
|
171
|
+
Object.keys(flags).forEach(flag => {
|
|
172
|
+
if (Object.prototype.hasOwnProperty.call(usedFlags, flag)) {
|
|
173
|
+
this.log(chalk.gray(`The ${chalk.bold(`--${flag}`)} flag only applies when importing ${schemas
|
|
174
|
+
.map(schema => chalk.bold(schema))
|
|
175
|
+
.join(', ')}. It will be ignored now.`));
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
199
181
|
// Correct the value for the 'header-param' flag to work around the oclif's
|
|
200
182
|
// parser issue with multi-value flags: https://github.com/oclif/oclif/issues/261
|
|
201
183
|
parseWorkaround() {
|
package/lib/commands/init.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { flags } from '@oclif/command';
|
|
2
2
|
import ZenCommand from '../shared/zen-command';
|
|
3
|
-
export declare const validateWorkspaceName: (directory: string, name: string) => boolean;
|
|
4
|
-
export declare const generateWorkspaceName: (directory: string) => string;
|
|
5
|
-
export declare const guessSchemaRoot: (directory: string) => string;
|
|
6
3
|
export default class Init extends ZenCommand {
|
|
7
4
|
static description: string;
|
|
8
5
|
static hidden: boolean;
|
package/lib/commands/init.js
CHANGED
|
@@ -1,120 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.guessSchemaRoot = exports.generateWorkspaceName = exports.validateWorkspaceName = void 0;
|
|
5
4
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const errors_1 = require("@oclif/errors");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const glob = require("glob");
|
|
9
|
-
const inquirer = require("inquirer");
|
|
10
|
-
const os = require("os");
|
|
11
|
-
const path = require("path");
|
|
12
|
-
const utils_1 = require("../shared/utils");
|
|
13
|
-
const moniker_1 = require("../shared/moniker");
|
|
14
5
|
const workspace_1 = require("../shared/workspace");
|
|
15
6
|
const zen_command_1 = require("../shared/zen-command");
|
|
16
|
-
exports.validateWorkspaceName = (directory, name) => {
|
|
17
|
-
return !fs.existsSync(path.join(directory, name));
|
|
18
|
-
};
|
|
19
|
-
exports.generateWorkspaceName = (directory) => {
|
|
20
|
-
let name = 'hello-stepzen';
|
|
21
|
-
while (!exports.validateWorkspaceName(directory, name)) {
|
|
22
|
-
name = `hello-${moniker_1.getRandomDescriptor()}-stepzen`;
|
|
23
|
-
}
|
|
24
|
-
return name;
|
|
25
|
-
};
|
|
26
|
-
exports.guessSchemaRoot = (directory) => {
|
|
27
|
-
const existing = [
|
|
28
|
-
...glob.sync('*/**/config.yaml', {
|
|
29
|
-
cwd: directory,
|
|
30
|
-
ignore: '**/node_modules/**',
|
|
31
|
-
}),
|
|
32
|
-
...glob.sync('*/**/index.graphql', {
|
|
33
|
-
cwd: directory,
|
|
34
|
-
ignore: '**/node_modules/**',
|
|
35
|
-
}),
|
|
36
|
-
];
|
|
37
|
-
return existing.length > 0 ? path.dirname(existing[0]) : '';
|
|
38
|
-
};
|
|
39
7
|
class Init extends zen_command_1.default {
|
|
40
8
|
async run() {
|
|
41
9
|
const { args, flags } = this.parse(Init);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
' Please select a different directory.');
|
|
48
|
-
}
|
|
49
|
-
const isHomeDir = directory === os.homedir();
|
|
50
|
-
// Prevent init from running in the home directory if the directory was
|
|
51
|
-
// explicitly provided as an aargument to `stepzen init`.
|
|
52
|
-
// StepZen CLI sometimes would enumerate all files in the workspace folder
|
|
53
|
-
// doing so in the home directory is likely to fail.
|
|
54
|
-
if (args.directory && isHomeDir) {
|
|
55
|
-
throw new errors_1.CLIError('Using the home directory as a StepZen workspace is not supported.' +
|
|
56
|
-
' Please select a different directory.');
|
|
57
|
-
}
|
|
58
|
-
// Make a suggestion for the workspace name (if running in the HOME
|
|
59
|
-
// directory)
|
|
60
|
-
const name = isHomeDir
|
|
61
|
-
? exports.generateWorkspaceName(directory)
|
|
62
|
-
: path.basename(directory);
|
|
63
|
-
// See if we think there's a StepZen schema already
|
|
64
|
-
const root = isHomeDir ? '' : exports.guessSchemaRoot(directory);
|
|
65
|
-
// If you've passed an endpoint, validate it, and throw an error
|
|
66
|
-
// straight away if needed
|
|
67
|
-
if (flags.endpoint) {
|
|
68
|
-
const error = utils_1.validateEndpoint(flags.endpoint);
|
|
69
|
-
if (typeof error === 'string') {
|
|
70
|
-
throw new errors_1.CLIError(error);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Make a suggestion for the endpoint
|
|
74
|
-
const endpoint = flags.endpoint || `api/${moniker_1.default()}`;
|
|
75
|
-
// What questions will we ask?
|
|
76
|
-
const questions = [
|
|
77
|
-
{
|
|
78
|
-
default: name,
|
|
79
|
-
message: 'What would you like to call your workspace?',
|
|
80
|
-
name: 'name',
|
|
81
|
-
validate: (name) => exports.validateWorkspaceName(directory, name),
|
|
82
|
-
when: isHomeDir && !flags.yes,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
default: endpoint,
|
|
86
|
-
message: 'What would you like your endpoint to be called?',
|
|
87
|
-
name: 'endpoint',
|
|
88
|
-
validate: utils_1.validateEndpoint,
|
|
89
|
-
when: !flags.endpoint && !flags.yes,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
message: `We have detected a schema in this directory. Set the schema root to "${root}"?`,
|
|
93
|
-
name: 'use-root',
|
|
94
|
-
type: 'confirm',
|
|
95
|
-
when: Boolean(root) && !flags.yes,
|
|
96
|
-
},
|
|
97
|
-
];
|
|
98
|
-
// Get the answers
|
|
99
|
-
const answers = Object.assign({ name,
|
|
100
|
-
endpoint, 'use-root': true }, (await inquirer.prompt(questions)));
|
|
101
|
-
// Append the suggested workspace name to the directory (if running
|
|
102
|
-
// in the HOME directory)
|
|
103
|
-
if (isHomeDir) {
|
|
104
|
-
// eslint-disable-next-line require-atomic-updates
|
|
105
|
-
directory = path.join(directory, answers.name);
|
|
106
|
-
fs.mkdirSync(directory);
|
|
107
|
-
}
|
|
108
|
-
// Create the workspace
|
|
109
|
-
const workspace = { endpoint: answers.endpoint };
|
|
110
|
-
if (root && answers['use-root'])
|
|
111
|
-
workspace.root = root;
|
|
112
|
-
// Write the file
|
|
113
|
-
const file = path.join(directory, 'stepzen.config.json');
|
|
114
|
-
fs.writeFileSync(file, JSON.stringify(workspace, null, ' '));
|
|
115
|
-
// Fetch the newly created workspace
|
|
116
|
-
const created = workspace_1.getWorkspace(directory);
|
|
117
|
-
// Done!
|
|
10
|
+
const created = await workspace_1.initWorkspace({
|
|
11
|
+
directory: args.directory,
|
|
12
|
+
endpoint: flags.endpoint,
|
|
13
|
+
yes: flags.yes,
|
|
14
|
+
});
|
|
118
15
|
this.log(`Created a StepZen workspace in ${created.directory}`);
|
|
119
16
|
return created;
|
|
120
17
|
}
|
package/lib/commands/start.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export default class Start extends ZenCommand {
|
|
|
9
9
|
'no-console': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
10
|
'no-dashboard': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
11
|
'no-init': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
12
|
-
'no-server': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
13
12
|
'no-validate': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
14
13
|
'no-watcher': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
15
14
|
port: import("@oclif/parser/lib/flags").IOptionFlag<number>;
|
package/lib/commands/start.js
CHANGED
|
@@ -7,10 +7,7 @@ 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 utils_1 = require("../shared/utils");
|
|
11
10
|
const start_1 = require("../start");
|
|
12
|
-
const workspace_1 = require("../shared/workspace");
|
|
13
|
-
const init_1 = require("./init");
|
|
14
11
|
const constants_1 = require("../shared/constants");
|
|
15
12
|
const zen_command_1 = require("../shared/zen-command");
|
|
16
13
|
const dashboard = require('@stepzen/dashboard');
|
|
@@ -19,28 +16,13 @@ class Start extends zen_command_1.default {
|
|
|
19
16
|
async run() {
|
|
20
17
|
const { flags } = this.parse(Start);
|
|
21
18
|
const { configuration } = await this.ensureStepZenAccount();
|
|
22
|
-
// Get
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const initArgs = [directory];
|
|
31
|
-
if (flags.endpoint) {
|
|
32
|
-
initArgs.push('--endpoint', flags.endpoint);
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
workspace = await init_1.default.run(initArgs);
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
throw new errors_1.CLIError(`Could not create a StepZen workspace in the ${flags.dir ? directory : 'current'} directory.\n` + error.message);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// If you have overridden the endpoint, set it
|
|
19
|
+
// Get or create a StepZen workspace (possibly interactive)
|
|
20
|
+
const workspace = await this.ensureStepZenWorkspace({
|
|
21
|
+
directory: flags.dir,
|
|
22
|
+
endpoint: flags.endpoint,
|
|
23
|
+
});
|
|
24
|
+
// If the user has overridden the endpoint, apply the override
|
|
42
25
|
if (flags.endpoint) {
|
|
43
|
-
// eslint-disable-next-line require-atomic-updates
|
|
44
26
|
workspace.endpoint = flags.endpoint;
|
|
45
27
|
}
|
|
46
28
|
// Check the port is available
|
|
@@ -50,25 +32,25 @@ class Start extends zen_command_1.default {
|
|
|
50
32
|
}
|
|
51
33
|
// This is the file watcher
|
|
52
34
|
if (!flags['no-watcher']) {
|
|
35
|
+
const redeploy = throttle_debounce_1.debounce(500, (path) => {
|
|
36
|
+
start_1.changed({ workspace, file: path });
|
|
37
|
+
start_1.deploy({ workspace, flags });
|
|
38
|
+
});
|
|
53
39
|
chokidar
|
|
54
|
-
.watch(
|
|
55
|
-
|
|
40
|
+
.watch(['**/*.graphql', 'config.yaml'], {
|
|
41
|
+
cwd: workspace.schema,
|
|
42
|
+
ignored: 'node_modules/**',
|
|
43
|
+
ignoreInitial: true,
|
|
56
44
|
})
|
|
57
|
-
.on('change',
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
await start_1.console(workspace);
|
|
61
|
-
}));
|
|
45
|
+
.on('change', redeploy)
|
|
46
|
+
.on('add', redeploy)
|
|
47
|
+
.on('unlink', redeploy);
|
|
62
48
|
}
|
|
63
49
|
// Start!
|
|
64
|
-
utils_1.clearConsole();
|
|
65
50
|
core_1.CliUx.ux.action.start('Starting...');
|
|
66
51
|
// Unless explicitly disabled, auto-init
|
|
67
52
|
if (!flags['no-init']) {
|
|
68
|
-
await start_1.deploy(
|
|
69
|
-
}
|
|
70
|
-
if (!flags['no-console']) {
|
|
71
|
-
start_1.console(workspace);
|
|
53
|
+
await start_1.deploy({ workspace, flags });
|
|
72
54
|
}
|
|
73
55
|
// Create the dashboard
|
|
74
56
|
if (!flags['no-dashboard']) {
|
|
@@ -92,9 +74,22 @@ class Start extends zen_command_1.default {
|
|
|
92
74
|
}
|
|
93
75
|
// Done
|
|
94
76
|
core_1.CliUx.ux.action.stop();
|
|
77
|
+
if (!flags['no-console']) {
|
|
78
|
+
if (!flags['no-init']) {
|
|
79
|
+
start_1.success({
|
|
80
|
+
workspace,
|
|
81
|
+
account: configuration.account,
|
|
82
|
+
port: flags.port,
|
|
83
|
+
});
|
|
84
|
+
this.log();
|
|
85
|
+
}
|
|
86
|
+
if (!flags['no-watcher']) {
|
|
87
|
+
start_1.watching(workspace);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
95
90
|
}
|
|
96
91
|
}
|
|
97
92
|
exports.default = Start;
|
|
98
93
|
Start.description = 'upload and deploy your schema';
|
|
99
|
-
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-
|
|
94
|
+
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-validate': command_1.flags.boolean({ hidden: true }), 'no-watcher': command_1.flags.boolean({ hidden: true }), port: command_1.flags.integer({ default: 5001, env: 'PORT' }) });
|
|
100
95
|
Start.args = [];
|
package/lib/generate/helpers.js
CHANGED
|
@@ -92,7 +92,7 @@ exports.getSchema = (arg) => {
|
|
|
92
92
|
const schema = arg.trim();
|
|
93
93
|
// Now supports importing only one schema at a time:
|
|
94
94
|
// https://github.com/steprz/stepzen-cli/issues/628
|
|
95
|
-
if (schema.includes(',')) {
|
|
95
|
+
if (schema.includes(',') || schema.includes(' ')) {
|
|
96
96
|
throw new errors_1.CLIError("Importing multiple schemas is no longer supported; please specify only one (e.g. 'stepzen import mysql')");
|
|
97
97
|
}
|
|
98
98
|
// support `postgres` as an alias to `postgresql`
|
package/lib/shared/utils.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
export declare const clearConsole: () => void;
|
|
2
1
|
export declare const getDirectory: (d?: string | undefined) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Replace the path prefix with `~` if it is inside the user's home directory.
|
|
4
|
+
*
|
|
5
|
+
* @param {*} absPath an absolute file or directory path
|
|
6
|
+
* @returns {*} the same path that possibly looks more friendly to users
|
|
7
|
+
*/
|
|
8
|
+
export declare const homeRelative: (absPath: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Replace the path prefix with `~` if it is inside the user's home directory.
|
|
11
|
+
*
|
|
12
|
+
* @param {*} absPath an absolute file or directory path
|
|
13
|
+
* @param {*} workspace an absolute file or the workspace root
|
|
14
|
+
* @returns {*} the same path that possibly looks more friendly to users
|
|
15
|
+
*/
|
|
16
|
+
export declare const workspaceRelative: (absPath: string, workspace: string) => string;
|
|
3
17
|
export declare const getStepZenExtensions: () => Promise<string>;
|
|
4
18
|
export declare const validateEndpoint: (endpoint: string) => any;
|
|
5
19
|
export declare const maskStepZenKey: (key: string) => string;
|
package/lib/shared/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.maskStepZenKey = exports.validateEndpoint = exports.getStepZenExtensions = exports.
|
|
4
|
+
exports.maskStepZenKey = exports.validateEndpoint = exports.getStepZenExtensions = exports.workspaceRelative = exports.homeRelative = exports.getDirectory = void 0;
|
|
5
5
|
const errors_1 = require("@oclif/errors");
|
|
6
6
|
const debug = require("debug");
|
|
7
7
|
const node_fetch_1 = require("node-fetch");
|
|
@@ -10,12 +10,6 @@ const os = require("os");
|
|
|
10
10
|
const path = require("path");
|
|
11
11
|
const prettier = require("prettier");
|
|
12
12
|
const constants_1 = require("./constants");
|
|
13
|
-
exports.clearConsole = () => {
|
|
14
|
-
process.stdout.write(
|
|
15
|
-
// Taken from create-react-app
|
|
16
|
-
// eslint-disable-next-line unicorn/no-hex-escape
|
|
17
|
-
process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H');
|
|
18
|
-
};
|
|
19
13
|
exports.getDirectory = (d = process.cwd()) => {
|
|
20
14
|
let directory = d;
|
|
21
15
|
// If it starts with `~`, expand this
|
|
@@ -31,6 +25,33 @@ exports.getDirectory = (d = process.cwd()) => {
|
|
|
31
25
|
}
|
|
32
26
|
return directory;
|
|
33
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Replace the path prefix with `~` if it is inside the user's home directory.
|
|
30
|
+
*
|
|
31
|
+
* @param {*} absPath an absolute file or directory path
|
|
32
|
+
* @returns {*} the same path that possibly looks more friendly to users
|
|
33
|
+
*/
|
|
34
|
+
exports.homeRelative = (absPath) => {
|
|
35
|
+
let pretty = absPath;
|
|
36
|
+
if (absPath.startsWith(os.homedir())) {
|
|
37
|
+
pretty = '~' + absPath.substring(os.homedir().length);
|
|
38
|
+
}
|
|
39
|
+
return pretty;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Replace the path prefix with `~` if it is inside the user's home directory.
|
|
43
|
+
*
|
|
44
|
+
* @param {*} absPath an absolute file or directory path
|
|
45
|
+
* @param {*} workspace an absolute file or the workspace root
|
|
46
|
+
* @returns {*} the same path that possibly looks more friendly to users
|
|
47
|
+
*/
|
|
48
|
+
exports.workspaceRelative = (absPath, workspace) => {
|
|
49
|
+
let pretty = absPath;
|
|
50
|
+
if (absPath.startsWith(workspace)) {
|
|
51
|
+
pretty = '.' + absPath.substring(workspace.length);
|
|
52
|
+
}
|
|
53
|
+
return pretty;
|
|
54
|
+
};
|
|
34
55
|
exports.getStepZenExtensions = async () => {
|
|
35
56
|
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
36
57
|
const url = `https://www.${domain}/directives.graphql`;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { Workspace } from './types';
|
|
2
|
+
export declare const validateWorkspaceName: (directory: string, name: string) => boolean;
|
|
3
|
+
export declare const generateWorkspaceName: (directory: string) => string;
|
|
4
|
+
export declare const guessSchemaRoot: (directory: string) => string;
|
|
2
5
|
export declare const getWorkspace: (directory: string) => Workspace | null;
|
|
6
|
+
export declare const initWorkspace: (args: {
|
|
7
|
+
directory?: string;
|
|
8
|
+
endpoint?: string;
|
|
9
|
+
yes?: boolean;
|
|
10
|
+
}) => Promise<Workspace>;
|
package/lib/shared/workspace.js
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getWorkspace = void 0;
|
|
4
|
+
exports.initWorkspace = exports.getWorkspace = exports.guessSchemaRoot = exports.generateWorkspaceName = exports.validateWorkspaceName = void 0;
|
|
5
5
|
const errors_1 = require("@oclif/errors");
|
|
6
6
|
const fs = require("fs");
|
|
7
|
+
const glob = require("glob");
|
|
8
|
+
const inquirer = require("inquirer");
|
|
7
9
|
const os = require("os");
|
|
8
10
|
const path = require("path");
|
|
11
|
+
const moniker_1 = require("../shared/moniker");
|
|
9
12
|
const utils_1 = require("./utils");
|
|
13
|
+
exports.validateWorkspaceName = (directory, name) => {
|
|
14
|
+
return !fs.existsSync(path.join(directory, name));
|
|
15
|
+
};
|
|
16
|
+
exports.generateWorkspaceName = (directory) => {
|
|
17
|
+
let name = 'hello-stepzen';
|
|
18
|
+
while (!exports.validateWorkspaceName(directory, name)) {
|
|
19
|
+
name = `hello-${moniker_1.getRandomDescriptor()}-stepzen`;
|
|
20
|
+
}
|
|
21
|
+
return name;
|
|
22
|
+
};
|
|
23
|
+
exports.guessSchemaRoot = (directory) => {
|
|
24
|
+
const existing = [
|
|
25
|
+
...glob.sync('*/**/config.yaml', {
|
|
26
|
+
cwd: directory,
|
|
27
|
+
ignore: '**/node_modules/**',
|
|
28
|
+
}),
|
|
29
|
+
...glob.sync('*/**/index.graphql', {
|
|
30
|
+
cwd: directory,
|
|
31
|
+
ignore: '**/node_modules/**',
|
|
32
|
+
}),
|
|
33
|
+
];
|
|
34
|
+
return existing.length > 0 ? path.dirname(existing[0]) : '';
|
|
35
|
+
};
|
|
10
36
|
exports.getWorkspace = (directory) => {
|
|
11
37
|
let workspaceRoot;
|
|
12
38
|
const parts = path
|
|
@@ -54,3 +80,81 @@ exports.getWorkspace = (directory) => {
|
|
|
54
80
|
schema: schema,
|
|
55
81
|
};
|
|
56
82
|
};
|
|
83
|
+
exports.initWorkspace = async (args) => {
|
|
84
|
+
// Get the correct directory
|
|
85
|
+
let directory = utils_1.getDirectory(args.directory);
|
|
86
|
+
// Make sure it is not already a workspace
|
|
87
|
+
if (exports.getWorkspace(directory)) {
|
|
88
|
+
throw new errors_1.CLIError(`This directory is already a StepZen workspace: ${directory}.` +
|
|
89
|
+
' Please select a different directory.');
|
|
90
|
+
}
|
|
91
|
+
const isHomeDir = directory === os.homedir();
|
|
92
|
+
// Prevent init from running in the home directory if the directory was
|
|
93
|
+
// explicitly provided as an aargument to `stepzen init`.
|
|
94
|
+
// StepZen CLI sometimes would enumerate all files in the workspace folder
|
|
95
|
+
// doing so in the home directory is likely to fail.
|
|
96
|
+
if (args.directory && isHomeDir) {
|
|
97
|
+
throw new errors_1.CLIError('Using the home directory as a StepZen workspace is not supported.' +
|
|
98
|
+
' Please select a different directory.');
|
|
99
|
+
}
|
|
100
|
+
// Make a suggestion for the workspace name (if running in the HOME
|
|
101
|
+
// directory)
|
|
102
|
+
const name = isHomeDir
|
|
103
|
+
? exports.generateWorkspaceName(directory)
|
|
104
|
+
: path.basename(directory);
|
|
105
|
+
// See if we think there's a StepZen schema already
|
|
106
|
+
const root = isHomeDir ? '' : exports.guessSchemaRoot(directory);
|
|
107
|
+
// If you've passed an endpoint, validate it, and throw an error
|
|
108
|
+
// straight away if needed
|
|
109
|
+
if (args.endpoint) {
|
|
110
|
+
const error = utils_1.validateEndpoint(args.endpoint);
|
|
111
|
+
if (typeof error === 'string') {
|
|
112
|
+
throw new errors_1.CLIError(error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Make a suggestion for the endpoint
|
|
116
|
+
const endpoint = args.endpoint || `api/${moniker_1.default()}`;
|
|
117
|
+
// What questions will we ask?
|
|
118
|
+
const questions = [
|
|
119
|
+
{
|
|
120
|
+
default: name,
|
|
121
|
+
message: 'What would you like to call your workspace?',
|
|
122
|
+
name: 'name',
|
|
123
|
+
validate: (name) => exports.validateWorkspaceName(directory, name),
|
|
124
|
+
when: isHomeDir && !args.yes,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
default: endpoint,
|
|
128
|
+
message: 'What would you like your endpoint to be called?',
|
|
129
|
+
name: 'endpoint',
|
|
130
|
+
validate: utils_1.validateEndpoint,
|
|
131
|
+
when: !args.endpoint && !args.yes,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
message: `We have detected a schema in this directory. Set the schema root to "${root}"?`,
|
|
135
|
+
name: 'use-root',
|
|
136
|
+
type: 'confirm',
|
|
137
|
+
when: Boolean(root) && !args.yes,
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
// Get the answers
|
|
141
|
+
const answers = Object.assign({ name,
|
|
142
|
+
endpoint, 'use-root': true }, (await inquirer.prompt(questions)));
|
|
143
|
+
// Append the suggested workspace name to the directory (if running
|
|
144
|
+
// in the HOME directory)
|
|
145
|
+
if (isHomeDir) {
|
|
146
|
+
// eslint-disable-next-line require-atomic-updates
|
|
147
|
+
directory = path.join(directory, answers.name);
|
|
148
|
+
fs.mkdirSync(directory);
|
|
149
|
+
}
|
|
150
|
+
// Create the workspace
|
|
151
|
+
const workspace = { endpoint: answers.endpoint };
|
|
152
|
+
if (root && answers['use-root'])
|
|
153
|
+
workspace.root = root;
|
|
154
|
+
// Write the file
|
|
155
|
+
const file = path.join(directory, 'stepzen.config.json');
|
|
156
|
+
fs.writeFileSync(file, JSON.stringify(workspace, null, ' '));
|
|
157
|
+
// Fetch the newly created workspace
|
|
158
|
+
const created = exports.getWorkspace(directory);
|
|
159
|
+
return created;
|
|
160
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from '@oclif/command';
|
|
2
|
-
import { MachineConfiguration, StepZenCredentials } from './types';
|
|
2
|
+
import { MachineConfiguration, StepZenCredentials, Workspace } from './types';
|
|
3
3
|
export declare abstract class ZenCommand extends Command {
|
|
4
4
|
static flags: {
|
|
5
5
|
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
@@ -7,6 +7,10 @@ export declare abstract class ZenCommand extends Command {
|
|
|
7
7
|
ensureStepZenAccount(): Promise<{
|
|
8
8
|
configuration: import("./types").LoggedInMachineConfiguration;
|
|
9
9
|
}>;
|
|
10
|
+
ensureStepZenWorkspace(options?: {
|
|
11
|
+
directory?: string;
|
|
12
|
+
endpoint?: string;
|
|
13
|
+
}): Promise<Workspace>;
|
|
10
14
|
promptUserToLogIn(uuid: string): Promise<{
|
|
11
15
|
configuration: MachineConfiguration & StepZenCredentials;
|
|
12
16
|
}>;
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ZenCommand = void 0;
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
|
+
const errors_1 = require("@oclif/errors");
|
|
6
7
|
const inquirer = require("inquirer");
|
|
7
8
|
const chalk = require("chalk");
|
|
9
|
+
const process = require("process");
|
|
8
10
|
const configuration_1 = require("./configuration");
|
|
9
11
|
const stepzen_sdk_1 = require("./stepzen-sdk");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
const workspace_1 = require("./workspace");
|
|
10
14
|
class ZenCommand extends command_1.Command {
|
|
11
15
|
async ensureStepZenAccount() {
|
|
12
16
|
const configuration = await configuration_1.readConfiguration();
|
|
@@ -17,6 +21,29 @@ class ZenCommand extends command_1.Command {
|
|
|
17
21
|
}
|
|
18
22
|
return this.promptUserToLogIn(configuration.uuid);
|
|
19
23
|
}
|
|
24
|
+
async ensureStepZenWorkspace(options = {}) {
|
|
25
|
+
let workspace;
|
|
26
|
+
const directory = utils_1.getDirectory(options.directory);
|
|
27
|
+
const maybeWorkspace = workspace_1.getWorkspace(directory);
|
|
28
|
+
if (maybeWorkspace) {
|
|
29
|
+
workspace = maybeWorkspace;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
try {
|
|
33
|
+
workspace = await workspace_1.initWorkspace({ directory, endpoint: options.endpoint });
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw new errors_1.CLIError(`Could not create a StepZen workspace in the ${options.directory ? directory : 'current'} directory.\n` + error.message);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Emphasize that the workspace is not the _current_ directory.
|
|
40
|
+
if (workspace.directory !== process.cwd()) {
|
|
41
|
+
this.log();
|
|
42
|
+
this.log(` ⤴️ Using the StepZen workspace in ${chalk.blue(utils_1.homeRelative(workspace.directory))}`);
|
|
43
|
+
this.log();
|
|
44
|
+
}
|
|
45
|
+
return workspace;
|
|
46
|
+
}
|
|
20
47
|
async promptUserToLogIn(uuid) {
|
|
21
48
|
this.log(chalk.bold(chalk.cyan('Welcome to the StepZen CLI!')));
|
|
22
49
|
this.log('');
|
package/lib/start/console.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { Workspace } from '../shared/types';
|
|
2
|
+
export declare const watching: (workspace: Workspace) => void;
|
|
3
|
+
export declare const changed: ({ file, workspace, }: {
|
|
4
|
+
file: string;
|
|
5
|
+
workspace: Workspace;
|
|
6
|
+
}) => void;
|
|
7
|
+
export declare const success: ({ workspace, account, port, }: {
|
|
8
|
+
workspace: Workspace;
|
|
9
|
+
account: string;
|
|
10
|
+
port: number;
|
|
11
|
+
}) => void;
|
package/lib/start/console.js
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.success = exports.changed = exports.watching = void 0;
|
|
4
5
|
const chalk = require("chalk");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const utils_1 = require("../shared/utils");
|
|
7
|
+
const constants_1 = require("../shared/constants");
|
|
8
|
+
exports.watching = (workspace) => {
|
|
9
|
+
console.log(`Watching ${chalk.blue(utils_1.homeRelative(workspace.schema))} for changes...`);
|
|
10
|
+
};
|
|
11
|
+
exports.changed = ({ file, workspace, }) => {
|
|
12
|
+
console.log(`File changed: ${chalk.blue(utils_1.workspaceRelative(file, workspace.directory))}`);
|
|
13
|
+
};
|
|
14
|
+
exports.success = ({ workspace, account, port, }) => {
|
|
15
|
+
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
16
|
+
const url = `https://${account}.${domain}/${workspace.endpoint}/__graphql`;
|
|
11
17
|
console.log();
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
console.log(chalk.grey(`Your API url is`, chalk.green(` ${url}`)));
|
|
19
|
+
console.log();
|
|
20
|
+
if (process.platform === 'win32') {
|
|
21
|
+
console.log(chalk.grey(`You can explore your hosted API with GraphiQL at `), chalk.green(` http://localhost:${port}/${workspace.endpoint}`));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log(chalk.grey(`You can test your hosted API with cURL:`));
|
|
25
|
+
console.log();
|
|
26
|
+
console.log(`curl ${url} \\`);
|
|
27
|
+
console.log(` --header "Authorization: Apikey $(stepzen whoami --apikey)" \\`);
|
|
28
|
+
console.log(` --header "Content-Type: application/json" \\`);
|
|
29
|
+
console.log(` --data '{"query": "your graphql query"}'`);
|
|
30
|
+
console.log();
|
|
31
|
+
console.log(chalk.grey(`or explore it with GraphiQL at`), chalk.green(` http://localhost:${port}/${workspace.endpoint}`));
|
|
14
32
|
}
|
|
15
|
-
console.log(`Watching ${chalk.blue(cwd)} for GraphQL changes...`);
|
|
16
33
|
};
|
package/lib/start/deploy.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Workspace } from '../shared/types';
|
|
2
|
+
declare const _default: ({ workspace, flags, }: {
|
|
3
|
+
workspace: Workspace;
|
|
4
|
+
flags: Record<string, any>;
|
|
5
|
+
}) => Promise<void>;
|
|
2
6
|
export default _default;
|
package/lib/start/deploy.js
CHANGED
|
@@ -8,18 +8,12 @@ const fs = require("fs-extra");
|
|
|
8
8
|
const path = require("path");
|
|
9
9
|
const prettyMilliseconds = require("pretty-ms");
|
|
10
10
|
const deploy_1 = require("../commands/deploy");
|
|
11
|
-
const configuration_1 = require("../shared/configuration");
|
|
12
|
-
const constants_1 = require("../shared/constants");
|
|
13
11
|
const upload_1 = require("../commands/upload");
|
|
14
12
|
const validate_1 = require("../commands/validate");
|
|
15
13
|
const dotenv = require('dotenv');
|
|
16
|
-
exports.default = async (
|
|
14
|
+
exports.default = async ({ workspace, flags, }) => {
|
|
17
15
|
var e_1, _a;
|
|
18
16
|
dotenv.config({ path: path.join(workspace.directory, '.env') });
|
|
19
|
-
if (file) {
|
|
20
|
-
console.log(`File changed: ${chalk.blue(file)}`);
|
|
21
|
-
}
|
|
22
|
-
const configuration = (await configuration_1.readConfiguration());
|
|
23
17
|
if (!flags['no-validate']) {
|
|
24
18
|
try {
|
|
25
19
|
await validate_1.default.run([workspace.schema]);
|
|
@@ -101,22 +95,4 @@ exports.default = async (file, workspace, flags) => {
|
|
|
101
95
|
const deployEnd = new Date().getTime();
|
|
102
96
|
const deployTime = deployEnd - deployStart;
|
|
103
97
|
core_1.CliUx.ux.action.stop(`${chalk.grey('done in')} ${prettyMilliseconds(deployTime)} 🚀`);
|
|
104
|
-
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
105
|
-
const endpoint = `https://${configuration.account}.${domain}/${workspace.endpoint}/__graphql`;
|
|
106
|
-
console.log();
|
|
107
|
-
console.log(chalk.grey(`Your API url is`, chalk.green(` ${endpoint}`)));
|
|
108
|
-
console.log();
|
|
109
|
-
if (process.platform === 'win32') {
|
|
110
|
-
console.log(chalk.grey(`You can explore your hosted API with GraphiQL at `), chalk.green(` http://localhost:${flags.port}/${workspace.endpoint}`));
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
console.log(chalk.grey(`You can test your hosted API with cURL:`));
|
|
114
|
-
console.log();
|
|
115
|
-
console.log(`curl ${endpoint} \\`);
|
|
116
|
-
console.log(` --header "Authorization: Apikey $(stepzen whoami --apikey)" \\`);
|
|
117
|
-
console.log(` --header "Content-Type: application/json" \\`);
|
|
118
|
-
console.log(` --data '{"query": "your graphql query"}'`);
|
|
119
|
-
console.log();
|
|
120
|
-
console.log(chalk.grey(`or explore it with GraphiQL at`), chalk.green(` http://localhost:${flags.port}/${workspace.endpoint}`));
|
|
121
|
-
}
|
|
122
98
|
};
|
package/lib/start/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { console, deploy };
|
|
1
|
+
export { default as deploy } from './deploy';
|
|
2
|
+
export { changed, success, watching } from './console';
|
package/lib/start/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports
|
|
4
|
+
var deploy_1 = require("./deploy");
|
|
5
|
+
Object.defineProperty(exports, "deploy", { enumerable: true, get: function () { return deploy_1.default; } });
|
|
6
|
+
var console_1 = require("./console");
|
|
7
|
+
Object.defineProperty(exports, "changed", { enumerable: true, get: function () { return console_1.changed; } });
|
|
8
|
+
Object.defineProperty(exports, "success", { enumerable: true, get: function () { return console_1.success; } });
|
|
9
|
+
Object.defineProperty(exports, "watching", { enumerable: true, get: function () { return console_1.watching; } });
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.17.0-beta.
|
|
1
|
+
{"version":"0.17.0-beta.1","commands":{"deploy":{"id":"deploy","description":"deploy to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"configurationsets":{"name":"configurationsets","type":"option","description":"Configurationsets to use","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"schema":{"name":"schema","type":"option","description":"Schema to use","required":true},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"destination","description":"destination","required":true}]},"import":{"id":"import","description":"import a schema for an external data source or a API endpoint to your GraphQL API","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","description":"working directory"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","hidden":true,"allowNo":false},"name":{"name":"name","type":"option","description":"Subfolder inside the workspace folder to save the imported schema files to. Defaults to the name of the imported schema."},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrite any existing schema with the same name. Cannot be used without also providing a --name flag.","allowNo":false},"prefix":{"name":"prefix","type":"option","description":"[curl] prefix to add every type in the generated schema."},"query-name":{"name":"query-name","type":"option","description":"[curl] property name to add to the Query type as a way to access the imported cURL endpoint."},"query-type":{"name":"query-type","type":"option","description":"[curl] name for the type returned by the cURL endpoint in the generated schema. The name specified by --query-type is not prefixed by --prefix if both flags are present."},"path-params":{"name":"path-params","type":"option","description":"[curl] specifies path parameters in the URL path. Can be formed by taking the original path and replacing the variable segments with $paramName placeholders.\n\nExample:\nstepzen import curl https://example.com/users/jane/posts/12 --path-params '/users/$userId/posts/$postId'"},"header-param":{"name":"header-param","type":"option","description":"[curl] specifies a parameter in a header value. Can be formed by taking a -H, --header flag and replacing the variable part of the header value with a $paramName placeholder. Repeat this flag once for each header with a parameter.\n\nExample:\nstepzen import curl https://example.com/api/customers \\\n\t-H \"Authorization: apikey SecretAPIKeyValue\" \\\n\t--header-param 'Authorization: apikey $apikey'"},"db-host":{"name":"db-host","type":"option","description":"[mysql, postgresql] database host"},"db-user":{"name":"db-user","type":"option","description":"[mysql, postgresql] database user name"},"db-password":{"name":"db-password","type":"option","description":"[mysql, postgresql] database password"},"db-database":{"name":"db-database","type":"option","description":"[mysql, postgresql] name of database to import"},"db-schema":{"name":"db-schema","type":"option","description":"[postgresql] database schema"}},"args":[{"name":"schema","required":true}]},"init":{"id":"init","description":"stepzen init","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"endpoint":{"name":"endpoint","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"yes":{"name":"yes","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"directory","hidden":true}]},"lint":{"id":"lint","description":"StepZen lint","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"list":{"id":"list","description":"list your items","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"type","description":"type","required":true,"options":["configurationsets","schemas"]}]},"login":{"id":"login","description":"log in to StepZen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"account":{"name":"account","type":"option","char":"a","hidden":true},"adminkey":{"name":"adminkey","type":"option","char":"k","hidden":true},"public":{"name":"public","type":"boolean","description":"Create a public anonymous StepZen account and use it. This is handy for trying StepZen out, but it not suitable for handling private data as all endpoints created with a public account will be public.","allowNo":false},"config":{"name":"config","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"log out of StepZen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"upload and deploy your schema","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","description":"working directory"},"endpoint":{"name":"endpoint","type":"option","description":"Override workspace endpoint"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"no-console":{"name":"no-console","type":"boolean","hidden":true,"allowNo":false},"no-dashboard":{"name":"no-dashboard","type":"boolean","hidden":true,"allowNo":false},"no-init":{"name":"no-init","type":"boolean","hidden":true,"allowNo":false},"no-validate":{"name":"no-validate","type":"boolean","hidden":true,"allowNo":false},"no-watcher":{"name":"no-watcher","type":"boolean","hidden":true,"allowNo":false},"port":{"name":"port","type":"option","default":5001}},"args":[]},"transpile":{"id":"transpile","description":"transpile a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"config":{"name":"config","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"hide-output":{"name":"hide-output","type":"boolean","hidden":true,"allowNo":false},"inspect":{"name":"inspect","type":"boolean","char":"i","hidden":true,"allowNo":false},"inspect-after":{"name":"inspect-after","type":"boolean","hidden":true,"allowNo":false},"output-configuration":{"name":"output-configuration","type":"boolean","allowNo":false},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"folder","required":true}]},"upload":{"id":"upload","description":"upload to StepZen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","description":"A directory to upload"},"file":{"name":"file","type":"option","description":"A file to upload"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"type","description":"type","required":true,"options":["configurationset","schema"]},{"name":"destination","description":"destination","required":true}]},"validate":{"id":"validate","description":"validate a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"folder","required":true}]},"whoami":{"id":"whoami","description":"display your credentials with StepZen whoami","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"showkeys":{"name":"showkeys","type":"boolean","allowNo":false},"apikey":{"name":"apikey","type":"boolean","allowNo":false},"adminkey":{"name":"adminkey","type":"boolean","allowNo":false}},"args":[]}}}
|