stepzen 0.16.0-beta.0 → 0.16.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 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.16.0-beta.0 darwin-x64 node-v14.19.1
32
+ stepzen/0.16.0-beta.1 darwin-x64 node-v14.19.1
33
33
  $ stepzen --help [COMMAND]
34
34
  USAGE
35
35
  $ stepzen COMMAND
@@ -84,7 +84,7 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.1
84
84
 
85
85
  ## `stepzen import SCHEMAS`
86
86
 
87
- Import a schema for an external data source or a API endpoint to your GraphQL API.
87
+ import a schema for an external data source or a API endpoint to your GraphQL API
88
88
 
89
89
  ```
90
90
  USAGE
@@ -160,7 +160,7 @@ OPTIONS
160
160
 
161
161
  ## `stepzen login`
162
162
 
163
- Log in to StepZen
163
+ log in to StepZen
164
164
 
165
165
  ```
166
166
  USAGE
@@ -175,7 +175,7 @@ OPTIONS
175
175
 
176
176
  ## `stepzen logout`
177
177
 
178
- log out of stepzen
178
+ log out of StepZen
179
179
 
180
180
  ```
181
181
  USAGE
@@ -202,7 +202,7 @@ OPTIONS
202
202
 
203
203
  ## `stepzen upload TYPE DESTINATION`
204
204
 
205
- upload to stepzen
205
+ upload to StepZen
206
206
 
207
207
  ```
208
208
  USAGE
@@ -18,6 +18,29 @@ export default class Import extends ZenCommand {
18
18
  static postgresqlFlags: {
19
19
  'db-schema': flags.IOptionFlag<string | undefined>;
20
20
  };
21
+ static flagsForSchemas: ({
22
+ flags: {
23
+ prefix: flags.IOptionFlag<string | undefined>;
24
+ 'query-name': flags.IOptionFlag<string | undefined>;
25
+ 'query-type': flags.IOptionFlag<string | undefined>;
26
+ 'path-params': flags.IOptionFlag<string | undefined>;
27
+ 'header-param': flags.IOptionFlag<string[]>;
28
+ };
29
+ schemas: string[];
30
+ } | {
31
+ flags: {
32
+ 'db-host': flags.IOptionFlag<string | undefined>;
33
+ 'db-user': flags.IOptionFlag<string | undefined>;
34
+ 'db-password': flags.IOptionFlag<string | undefined>;
35
+ 'db-database': flags.IOptionFlag<string | undefined>;
36
+ };
37
+ schemas: string[];
38
+ } | {
39
+ flags: {
40
+ 'db-schema': flags.IOptionFlag<string | undefined>;
41
+ };
42
+ schemas: string[];
43
+ })[];
21
44
  static flags: {
22
45
  'db-schema': flags.IOptionFlag<string | undefined>;
23
46
  'db-host': flags.IOptionFlag<string | undefined>;
@@ -41,5 +64,26 @@ export default class Import extends ZenCommand {
41
64
  }[];
42
65
  static strict: boolean;
43
66
  run(): Promise<void>;
44
- warnAboutIgnoredFlags: (schemas: string[], maybeIgnored: string[], relevantSchemas: string[]) => void;
67
+ warnAboutIgnoredFlags: (usedSchemas: readonly string[], usedFlags: {
68
+ [key: string]: any;
69
+ }) => void;
70
+ parseWorkaround(): import("@oclif/parser").Output<{
71
+ 'db-schema': string | undefined;
72
+ 'db-host': string | undefined;
73
+ 'db-user': string | undefined;
74
+ 'db-password': string | undefined;
75
+ 'db-database': string | undefined;
76
+ prefix: string | undefined;
77
+ 'query-name': string | undefined;
78
+ 'query-type': string | undefined;
79
+ 'path-params': string | undefined;
80
+ 'header-param': string[];
81
+ dir: string | undefined;
82
+ help: void;
83
+ silent: boolean;
84
+ name: string | undefined;
85
+ 'non-interactive': boolean;
86
+ }, {
87
+ [name: string]: any;
88
+ }>;
45
89
  }
@@ -22,21 +22,22 @@ class Import extends zen_command_1.default {
22
22
  constructor() {
23
23
  super(...arguments);
24
24
  // notify the user about any ignored flags
25
- this.warnAboutIgnoredFlags = (schemas, maybeIgnored, relevantSchemas) => {
26
- if (!schemas.some(schema => relevantSchemas.includes(schema))) {
27
- maybeIgnored.forEach(flag => {
28
- // eslint-disable-next-line no-prototype-builtins
29
- if (command_1.flags.hasOwnProperty(flag)) {
30
- this.log(chalk.gray(`The ${chalk.bold(`--${flag}`)} flag only applies when importing ${relevantSchemas
31
- .map(schema => chalk.bold(schema))
32
- .join(', ')}. It will be ignored now.`));
33
- }
34
- });
35
- }
25
+ this.warnAboutIgnoredFlags = (usedSchemas, usedFlags) => {
26
+ Import.flagsForSchemas.forEach(({ flags, schemas }) => {
27
+ if (!usedSchemas.some(usedSchema => schemas.includes(usedSchema))) {
28
+ Object.keys(flags).forEach(flag => {
29
+ if (Object.prototype.hasOwnProperty.call(usedFlags, flag)) {
30
+ this.log(chalk.gray(`The ${chalk.bold(`--${flag}`)} flag only applies when importing ${schemas
31
+ .map(schema => chalk.bold(schema))
32
+ .join(', ')}. It will be ignored now.`));
33
+ }
34
+ });
35
+ }
36
+ });
36
37
  };
37
38
  }
38
39
  async run() {
39
- const { args, argv, flags } = this.parse(Import);
40
+ const { args, argv, flags } = this.parseWorkaround();
40
41
  // Get a list of schemas you're asking for
41
42
  const schemas = helpers_1.getSchemaList(args.schemas);
42
43
  if (schemas.length > 1 && flags.name) {
@@ -58,14 +59,7 @@ class Import extends zen_command_1.default {
58
59
  throw new errors_1.CLIError(`Could not create a StepZen workspace in the ${flags.dir ? directory : 'current'} directory.\n` + error.message);
59
60
  }
60
61
  }
61
- this.warnAboutIgnoredFlags(schemas, Object.keys(Import.curlFlags), ['curl']);
62
- this.warnAboutIgnoredFlags(schemas, Object.keys(Import.sqlFlags), [
63
- 'mysql',
64
- 'postgresql',
65
- ]);
66
- this.warnAboutIgnoredFlags(schemas, Object.keys(Import.postgresqlFlags), [
67
- 'postgresql',
68
- ]);
62
+ this.warnAboutIgnoredFlags(schemas, flags);
69
63
  // Select an import execution flow:
70
64
  // - v1 with `stepzen/engines` and cloud function
71
65
  // - v2 with the graphqlize service
@@ -164,9 +158,45 @@ class Import extends zen_command_1.default {
164
158
  this;
165
159
  this.log(chalk.green(`Successfully imported ${schemas.length} schemas from StepZen`));
166
160
  }
161
+ // Correct the value for the 'header-param' flag to work around the oclif's
162
+ // parser issue with multi-value flags: https://github.com/oclif/oclif/issues/261
163
+ parseWorkaround() {
164
+ const argv = this.argv;
165
+ const parsed = this.parse(Import, argv);
166
+ if (!parsed.flags['header-param']) {
167
+ return parsed;
168
+ }
169
+ // Every ['--header-param', value] pair in the argv array should match
170
+ // only one value in the 'header-param' flag's value list.
171
+ const matchedIndices = new Set();
172
+ // For each value in the 'header-param' flag's value list, find the original
173
+ // ['--header-param', value] pair in the argv array.
174
+ for (let i = 0; i < parsed.flags['header-param'].length; i++) {
175
+ const value = parsed.flags['header-param'][i];
176
+ const flagIdx = argv.findIndex((arg, idx) => {
177
+ const spaceDelimMatch = arg === '--header-param' &&
178
+ idx < argv.length &&
179
+ argv[idx + 1] === value;
180
+ const eqlDelimMatch = arg === `--header-param=${value}`;
181
+ return (spaceDelimMatch || eqlDelimMatch) && !matchedIndices.has(idx);
182
+ });
183
+ // If not found, that means the given value was associated with the
184
+ // `--header-param` flag incorrectly. In that case, it's moved from
185
+ // `flags` to `argv` in the parsed output.
186
+ if (flagIdx === -1) {
187
+ parsed.flags['header-param'].splice(i, 1);
188
+ i -= 1; // compensate for the .splice() call above
189
+ parsed.argv.push(value);
190
+ }
191
+ else {
192
+ matchedIndices.add(flagIdx);
193
+ }
194
+ }
195
+ return parsed;
196
+ }
167
197
  }
168
198
  exports.default = Import;
169
- Import.description = 'Import a schema for an external data source or a API endpoint to your GraphQL API.';
199
+ Import.description = 'import a schema for an external data source or a API endpoint to your GraphQL API';
170
200
  Import.curlFlags = {
171
201
  prefix: command_1.flags.string({
172
202
  description: '[curl] prefix to add every type in the generated schema.',
@@ -220,6 +250,11 @@ Import.postgresqlFlags = {
220
250
  description: '[postgresql] database schema',
221
251
  }),
222
252
  };
253
+ Import.flagsForSchemas = [
254
+ { flags: Import.curlFlags, schemas: ['curl'] },
255
+ { flags: Import.sqlFlags, schemas: ['mysql', 'postgresql'] },
256
+ { flags: Import.postgresqlFlags, schemas: ['postgresql'] },
257
+ ];
223
258
  Import.flags = Object.assign(Object.assign(Object.assign(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({
224
259
  description: 'subfolder inside the workspace folder to save the imported' +
225
260
  ' schema files, defaults to the imported schema name',
@@ -22,6 +22,6 @@ class Init extends zen_command_1.default {
22
22
  }
23
23
  }
24
24
  exports.default = Init;
25
- Init.description = 'stepzen lint';
25
+ Init.description = 'StepZen lint';
26
26
  Init.hidden = true;
27
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' }) });
@@ -54,7 +54,7 @@ class Login extends zen_command_1.default {
54
54
  }
55
55
  }
56
56
  exports.default = Login;
57
- Login.description = 'Log in to StepZen';
57
+ Login.description = 'log in to StepZen';
58
58
  Login.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { account: command_1.flags.string({
59
59
  char: 'a',
60
60
  exclusive: ['config', 'public'],
@@ -14,5 +14,5 @@ class Logout extends zen_command_1.default {
14
14
  }
15
15
  }
16
16
  exports.default = Logout;
17
- Logout.description = 'log out of stepzen';
17
+ Logout.description = 'log out of StepZen';
18
18
  Logout.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { help: command_1.flags.help({ char: 'h' }) });
@@ -11,7 +11,6 @@ const utils_1 = require("../shared/utils");
11
11
  const start_1 = require("../start");
12
12
  const workspace_1 = require("../shared/workspace");
13
13
  const init_1 = require("./init");
14
- const dashboard_interface_1 = require("../generate/dashboard-interface");
15
14
  const constants_1 = require("../shared/constants");
16
15
  const zen_command_1 = require("../shared/zen-command");
17
16
  const dashboard = require('@stepzen/dashboard');
@@ -81,7 +80,6 @@ class Start extends zen_command_1.default {
81
80
  version,
82
81
  },
83
82
  domain: constants_1.STEPZEN_DOMAIN,
84
- generators: dashboard_interface_1.createDashboardInterface(workspace),
85
83
  predicates: {
86
84
  available: true,
87
85
  enabled: false,
@@ -50,7 +50,7 @@ class Upload extends zen_command_1.default {
50
50
  }
51
51
  }
52
52
  exports.default = Upload;
53
- Upload.description = 'upload to stepzen';
53
+ Upload.description = 'upload to StepZen';
54
54
  // The uploaded resource is either a directory or a file. In case it is the former,
55
55
  // it will be packaged into a zip archive and transferred.
56
56
  Upload.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { dir: command_1.flags.string({
@@ -51,7 +51,7 @@ class WhoAmI extends zen_command_1.default {
51
51
  }
52
52
  }
53
53
  exports.default = WhoAmI;
54
- WhoAmI.description = 'stepzen whoami';
54
+ WhoAmI.description = 'display your credentials with StepZen whoami';
55
55
  WhoAmI.hidden = true;
56
56
  WhoAmI.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { help: command_1.flags.help({ char: 'h' }), showkeys: command_1.flags.boolean({
57
57
  default: false,
@@ -31,7 +31,7 @@ exports.default = async (schemas, name, source, preAnswered = {}) => {
31
31
  for (var _f = tslib_1.__asyncValues(Object.keys(generators)), _g; _g = await _f.next(), !_g.done;) {
32
32
  const id = _g.value;
33
33
  const configure = await helpers_1.getConfiguration(id, answers);
34
- if (configure) {
34
+ if (configure === null || configure === void 0 ? void 0 : configure.questions.length) {
35
35
  generators[id] = {
36
36
  questions: configure.questions,
37
37
  type: 'generator',
@@ -3,8 +3,6 @@ export declare const STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP: string;
3
3
  export declare const STEPZEN_CONFIG_FILE: string;
4
4
  export declare const STEPZEN_DOMAIN: string;
5
5
  export declare const STEPZEN_SERVER_URL: string;
6
- export declare const STEPZEN_GENERATOR_ENGINES_SCHEMA: string;
7
- export declare const STEPZEN_GENERATOR_ENGINES_ENDPOINT = "stepzen-generator/engines";
8
6
  export declare const STEPZEN_DIRECT_GENERATOR_ENGINES_URL: string;
9
7
  export declare const STEPZEN_API_TEMPLATES_REPOSITORY = "https://github.com/steprz/stepzen-schemas";
10
8
  export declare const ADMIN_DEPLOY_URL = "/cli/admin/deploy";
@@ -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.STEPZEN_DISCORD_URL = exports.STEPZEN_JSON2SDL_SERVER_URL = exports.ADMIN_ACCOUNT_URL = exports.ADMIN_UPLOAD_URL = exports.ADMIN_LIST_URL = exports.ADMIN_DEPLOY_URL = exports.STEPZEN_API_TEMPLATES_REPOSITORY = exports.STEPZEN_DIRECT_GENERATOR_ENGINES_URL = exports.STEPZEN_GENERATOR_ENGINES_ENDPOINT = exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = exports.STEPZEN_SERVER_URL = exports.STEPZEN_DOMAIN = exports.STEPZEN_CONFIG_FILE = exports.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP = exports.STEPZEN_CONFIG_DIRECTORY = void 0;
4
+ exports.STEPZEN_DISCORD_URL = exports.STEPZEN_JSON2SDL_SERVER_URL = exports.ADMIN_ACCOUNT_URL = exports.ADMIN_UPLOAD_URL = exports.ADMIN_LIST_URL = exports.ADMIN_DEPLOY_URL = exports.STEPZEN_API_TEMPLATES_REPOSITORY = exports.STEPZEN_DIRECT_GENERATOR_ENGINES_URL = exports.STEPZEN_SERVER_URL = exports.STEPZEN_DOMAIN = exports.STEPZEN_CONFIG_FILE = exports.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP = exports.STEPZEN_CONFIG_DIRECTORY = void 0;
5
5
  // This file contains constants and all magic strings
6
6
  const dotenv = require("dotenv");
7
7
  const os = require("os");
@@ -9,7 +9,7 @@ const path = require("path");
9
9
  // This allows you to set environment variables in a `.env` file.
10
10
  // This file needs to be in your working directory.
11
11
  dotenv.config();
12
- const { STEPZEN_CONFIG_FILE: ENV_VAR_STEPZEN_CONFIG_FILE, STEPZEN_DOMAIN: ENV_VAR_STEPZEN_DOMAIN, STEPZEN_GENERATOR_ENGINES_SCHEMA: ENV_VAR_STEPZEN_GENERATOR_ENGINES_SCHEMA, STEPZEN_SERVER_URL: ENV_VAR_STEPZEN_SERVER_URL, STEPZEN_JSON2SDL_SERVER_URL: ENV_VAR_STEPZEN_JSON2SDL_SERVER_URL, STEPZEN_DIRECT_GENERATOR_ENGINES_URL: ENV_VAR_STEPZEN_DIRECT_GENERATOR_ENGINES_URL, } = process.env;
12
+ const { STEPZEN_CONFIG_FILE: ENV_VAR_STEPZEN_CONFIG_FILE, STEPZEN_DOMAIN: ENV_VAR_STEPZEN_DOMAIN, STEPZEN_SERVER_URL: ENV_VAR_STEPZEN_SERVER_URL, STEPZEN_JSON2SDL_SERVER_URL: ENV_VAR_STEPZEN_JSON2SDL_SERVER_URL, STEPZEN_DIRECT_GENERATOR_ENGINES_URL: ENV_VAR_STEPZEN_DIRECT_GENERATOR_ENGINES_URL, } = process.env;
13
13
  // Where your authentication details are stored locally
14
14
  exports.STEPZEN_CONFIG_DIRECTORY = path.join(os.homedir(), '.stepzen');
15
15
  exports.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP = path.join(exports.STEPZEN_CONFIG_DIRECTORY, 'last_update_check.timestamp');
@@ -18,11 +18,6 @@ exports.STEPZEN_CONFIG_FILE = ENV_VAR_STEPZEN_CONFIG_FILE || 'stepzen-config.yam
18
18
  exports.STEPZEN_DOMAIN = ENV_VAR_STEPZEN_DOMAIN || 'stepzen.io';
19
19
  // The zenctl URL. Override with the env var `STEPZEN_SERVER_URL`
20
20
  exports.STEPZEN_SERVER_URL = ENV_VAR_STEPZEN_SERVER_URL || 'https://{account}.stepzen.io';
21
- // Generator Engines schema: folder/name
22
- // Use 'stepzen/engines-dev' to test the dev instance of https://github.com/steprz/generator-engines
23
- exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = ENV_VAR_STEPZEN_GENERATOR_ENGINES_SCHEMA || 'stepzen/engines';
24
- // Generator Engines schema: target API endpoint
25
- exports.STEPZEN_GENERATOR_ENGINES_ENDPOINT = 'stepzen-generator/engines';
26
21
  // If defined, call the generator engines cloud function directly, skipping zenctl
27
22
  exports.STEPZEN_DIRECT_GENERATOR_ENGINES_URL = ENV_VAR_STEPZEN_DIRECT_GENERATOR_ENGINES_URL ||
28
23
  'https://us-central1-stepzen-functions.cloudfunctions.net/generator-engine';
@@ -1 +1 @@
1
- {"version":"0.16.0-beta.0","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, defaults to the imported schema name"},"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":"schemas","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-server":{"name":"no-server","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":"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":[]}}}
1
+ {"version":"0.16.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, defaults to the imported schema name"},"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":"schemas","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-server":{"name":"no-server","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":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stepzen",
3
3
  "description": "The StepZen CLI",
4
- "version": "0.16.0-beta.0",
4
+ "version": "0.16.0-beta.1",
5
5
  "license": "MIT",
6
6
  "author": "Darren Waddell <darren@stepzen.com>",
7
7
  "contributors": [
@@ -31,7 +31,7 @@
31
31
  "@oclif/core": "1.7.0",
32
32
  "@oclif/errors": "1.3.5",
33
33
  "@oclif/plugin-help": "^5.1.12",
34
- "@stepzen/dashboard": "0.1.37",
34
+ "@stepzen/dashboard": "0.2.0",
35
35
  "@stepzen/sdk": "0.11.0",
36
36
  "@stepzen/transpiler": "0.0.38",
37
37
  "chalk": "^4.1.1",
@@ -1,7 +0,0 @@
1
- export declare const createDashboardInterface: (workspace: any) => {
2
- endpoint: string;
3
- onStart: () => Promise<void>;
4
- onImport: (id: string, files: any) => Promise<{
5
- success: boolean;
6
- }>;
7
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
- // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.createDashboardInterface = void 0;
5
- const fs = require("fs-extra");
6
- const os = require("os");
7
- const path = require("path");
8
- const deploy_1 = require("../commands/deploy");
9
- const constants_1 = require("../shared/constants");
10
- const { merge } = require('@stepzen/transpiler');
11
- exports.createDashboardInterface = (workspace) => ({
12
- endpoint: constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT,
13
- onStart: async () => {
14
- await deploy_1.default.run([
15
- constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT,
16
- '--schema',
17
- constants_1.STEPZEN_GENERATOR_ENGINES_SCHEMA,
18
- '--silent',
19
- ]);
20
- },
21
- onImport: async (id, files) => {
22
- const tmp = path.join(os.tmpdir(), `stepzen-generated-schema-${Date.now()}`);
23
- fs.ensureDirSync(tmp);
24
- for (const file of files) {
25
- const cleaned = file.name.replace(os.tmpdir(), '');
26
- const dir = path.join(tmp, cleaned);
27
- fs.writeFileSync(dir, file.content);
28
- }
29
- const built = await merge(workspace.schema, {
30
- name: id,
31
- source: tmp,
32
- }, {
33
- silent: true,
34
- });
35
- fs.copySync(built, workspace.schema);
36
- fs.removeSync(built);
37
- fs.removeSync(tmp);
38
- return {
39
- success: true,
40
- };
41
- },
42
- });