stepzen 0.17.0-beta.2 → 0.17.0-beta.3
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/start.js +8 -2
- package/lib/start/console.js +6 -2
- package/lib/start/deploy.d.ts +1 -1
- package/lib/start/deploy.js +19 -3
- 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.3 darwin-x64 node-v14.19.3
|
|
33
33
|
$ stepzen --help [COMMAND]
|
|
34
34
|
USAGE
|
|
35
35
|
$ stepzen COMMAND
|
package/lib/commands/start.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const chokidar = require("chokidar");
|
|
5
|
+
const debug = require("debug");
|
|
5
6
|
const core_1 = require("@oclif/core");
|
|
6
7
|
const command_1 = require("@oclif/command");
|
|
7
8
|
const errors_1 = require("@oclif/errors");
|
|
@@ -33,6 +34,7 @@ class Start extends zen_command_1.default {
|
|
|
33
34
|
// This is the file watcher
|
|
34
35
|
if (!flags['no-watcher']) {
|
|
35
36
|
const redeploy = throttle_debounce_1.debounce(500, (path) => {
|
|
37
|
+
debug('stepzen:start')(`chokidar decected change to ${path}`);
|
|
36
38
|
start_1.changed({ workspace, file: path });
|
|
37
39
|
start_1.deploy({ workspace, flags });
|
|
38
40
|
});
|
|
@@ -45,15 +47,18 @@ class Start extends zen_command_1.default {
|
|
|
45
47
|
.on('change', redeploy)
|
|
46
48
|
.on('add', redeploy)
|
|
47
49
|
.on('unlink', redeploy);
|
|
50
|
+
debug('stepzen:start')(`chokidar started watching ${workspace.schema}`);
|
|
48
51
|
}
|
|
49
52
|
// Start!
|
|
50
53
|
core_1.CliUx.ux.action.start('Starting...');
|
|
54
|
+
let didDeploy = false;
|
|
51
55
|
// Unless explicitly disabled, auto-init
|
|
52
56
|
if (!flags['no-init']) {
|
|
53
|
-
await start_1.deploy({ workspace, flags });
|
|
57
|
+
didDeploy = await start_1.deploy({ workspace, flags });
|
|
54
58
|
}
|
|
55
59
|
// Create the dashboard
|
|
56
60
|
if (!flags['no-dashboard']) {
|
|
61
|
+
debug('stepzen:start')(`starting the dashboard server on ${flags.port}`);
|
|
57
62
|
const ui = await dashboard({
|
|
58
63
|
account: configuration.account,
|
|
59
64
|
adminkey: configuration.adminkey,
|
|
@@ -71,11 +76,12 @@ class Start extends zen_command_1.default {
|
|
|
71
76
|
workspace,
|
|
72
77
|
});
|
|
73
78
|
await ui.start();
|
|
79
|
+
debug('stepzen:start')(`dashboard server on ${flags.port} started`);
|
|
74
80
|
}
|
|
75
81
|
// Done
|
|
76
82
|
core_1.CliUx.ux.action.stop();
|
|
77
83
|
if (!flags['no-console']) {
|
|
78
|
-
if (
|
|
84
|
+
if (didDeploy) {
|
|
79
85
|
start_1.success({
|
|
80
86
|
workspace,
|
|
81
87
|
account: configuration.account,
|
package/lib/start/console.js
CHANGED
|
@@ -23,7 +23,9 @@ exports.success = ({ workspace, account, port, }) => {
|
|
|
23
23
|
console.log(` -Method "POST" \``);
|
|
24
24
|
console.log(` -Headers @{`);
|
|
25
25
|
console.log(` "Content-Type" = "application/json"`);
|
|
26
|
-
|
|
26
|
+
if (!account.startsWith('public')) {
|
|
27
|
+
console.log(` "Authorization" = "APIKey $(stepzen whoami --apikey)"`);
|
|
28
|
+
}
|
|
27
29
|
console.log(` } \``);
|
|
28
30
|
console.log(` -Body (@{`);
|
|
29
31
|
console.log(` "query" = '${chalk.bgYellow.black('your graphql query')}'`);
|
|
@@ -33,7 +35,9 @@ exports.success = ({ workspace, account, port, }) => {
|
|
|
33
35
|
console.log(chalk.grey(`You can test your hosted API with cURL:`));
|
|
34
36
|
console.log();
|
|
35
37
|
console.log(`curl ${url} \\`);
|
|
36
|
-
|
|
38
|
+
if (!account.startsWith('public')) {
|
|
39
|
+
console.log(` --header "Authorization: Apikey $(stepzen whoami --apikey)" \\`);
|
|
40
|
+
}
|
|
37
41
|
console.log(` --header "Content-Type: application/json" \\`);
|
|
38
42
|
console.log(` --data '{"query": "${chalk.bgYellow.black('your graphql query')}"}'`);
|
|
39
43
|
}
|
package/lib/start/deploy.d.ts
CHANGED
package/lib/start/deploy.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
5
5
|
const chalk = require("chalk");
|
|
6
|
+
const debug = require("debug");
|
|
6
7
|
const core_1 = require("@oclif/core");
|
|
7
8
|
const dotenv = require("dotenv");
|
|
8
9
|
const fs = require("fs-extra");
|
|
@@ -15,15 +16,19 @@ exports.default = async ({ workspace, flags, }) => {
|
|
|
15
16
|
var e_1, _a;
|
|
16
17
|
dotenv.config({ path: path.join(workspace.directory, '.env') });
|
|
17
18
|
if (!flags['no-validate']) {
|
|
19
|
+
const validateCmd = `stepzen validate ${workspace.schema}`;
|
|
18
20
|
try {
|
|
21
|
+
debug('stepzen:start')(`starting $(${validateCmd})`);
|
|
19
22
|
await validate_1.default.run([workspace.schema]);
|
|
23
|
+
debug('stepzen:start')(`$(${validateCmd}) completed successfully`);
|
|
20
24
|
}
|
|
21
25
|
catch (error) {
|
|
26
|
+
debug('stepzen:start')(`$(${validateCmd}) failed with`, error);
|
|
22
27
|
console.log();
|
|
23
28
|
console.log(chalk.red('Your local schema has the following GraphQL errors:'));
|
|
24
29
|
console.log();
|
|
25
30
|
console.log(error.message);
|
|
26
|
-
return;
|
|
31
|
+
return false;
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
core_1.CliUx.ux.action.start(`Deploying ${chalk.yellow(workspace.endpoint)} to StepZen`);
|
|
@@ -69,12 +74,17 @@ exports.default = async ({ workspace, flags, }) => {
|
|
|
69
74
|
try {
|
|
70
75
|
for (var uploadCmds_1 = tslib_1.__asyncValues(uploadCmds), uploadCmds_1_1; uploadCmds_1_1 = await uploadCmds_1.next(), !uploadCmds_1_1.done;) {
|
|
71
76
|
const cmd = uploadCmds_1_1.value;
|
|
77
|
+
const commandCmd = `stepzen upload '${cmd.join("' '")}'`;
|
|
72
78
|
try {
|
|
79
|
+
debug('stepzen:start')(`starting $(${commandCmd})`);
|
|
73
80
|
await upload_1.default.run(cmd);
|
|
81
|
+
debug('stepzen:start')(`$(${commandCmd}) completed successfully`);
|
|
74
82
|
}
|
|
75
83
|
catch (error) {
|
|
84
|
+
debug('stepzen:start')(`$(${commandCmd}) failed with`, error);
|
|
85
|
+
core_1.CliUx.ux.action.stop(chalk.red('fail'));
|
|
76
86
|
logError(error);
|
|
77
|
-
return;
|
|
87
|
+
return false;
|
|
78
88
|
}
|
|
79
89
|
}
|
|
80
90
|
}
|
|
@@ -85,14 +95,20 @@ exports.default = async ({ workspace, flags, }) => {
|
|
|
85
95
|
}
|
|
86
96
|
finally { if (e_1) throw e_1.error; }
|
|
87
97
|
}
|
|
98
|
+
const deployCmd = `stepzen deploy '${deployArgs.join("' '")}'`;
|
|
88
99
|
try {
|
|
100
|
+
debug('stepzen:start')(`starting $(${deployCmd})`);
|
|
89
101
|
await deploy_1.default.run(deployArgs);
|
|
102
|
+
debug('stepzen:start')(`$(${deployCmd}) completed successfully`);
|
|
90
103
|
}
|
|
91
104
|
catch (error) {
|
|
105
|
+
debug('stepzen:start')(`$(${deployCmd}) failed with`, error);
|
|
106
|
+
core_1.CliUx.ux.action.stop(chalk.red('fail'));
|
|
92
107
|
logError(error);
|
|
93
|
-
return;
|
|
108
|
+
return false;
|
|
94
109
|
}
|
|
95
110
|
const deployEnd = new Date().getTime();
|
|
96
111
|
const deployTime = deployEnd - deployStart;
|
|
97
112
|
core_1.CliUx.ux.action.stop(`${chalk.grey('done in')} ${prettyMilliseconds(deployTime)} 🚀`);
|
|
113
|
+
return true;
|
|
98
114
|
};
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.17.0-beta.
|
|
1
|
+
{"version":"0.17.0-beta.3","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.","hidden":true,"allowNo":false},"prefix":{"name":"prefix","type":"option","description":"[curl, graphql] 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":[]}}}
|