stepzen 0.10.0 → 0.11.0-beta.2

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.10.0 darwin-x64 node-v14.18.3
32
+ stepzen/0.11.0-beta.2 darwin-x64 node-v14.19.1
33
33
  $ stepzen --help [COMMAND]
34
34
  USAGE
35
35
  $ stepzen COMMAND
@@ -91,18 +91,31 @@ USAGE
91
91
  $ stepzen import SCHEMAS
92
92
 
93
93
  OPTIONS
94
- -h, --help show CLI help
95
- --dir=dir working directory
94
+ -h, --help
95
+ show CLI help
96
96
 
97
- --name=name subfolder inside the workspace folder to save the imported schema files, defaults to the
98
- imported schema name
97
+ --dir=dir
98
+ working directory
99
99
 
100
- --prefix=prefix [curl] prefix to add every type in the generated schema.
100
+ --name=name
101
+ subfolder inside the workspace folder to save the imported schema files, defaults to the imported schema name
101
102
 
102
- --query-name=query-name [curl] property name to add to the Query type as a way to access the imported cURL endpoint.
103
+ --path-params=path-params
104
+ [curl] specifies path parameters in the URL path. Can be formed by taking the original path and replacing the
105
+ variable segments with $paramName placeholders.
103
106
 
104
- --query-type=query-type [curl] name for the type returned by the cURL endpoint in the generated schema. The name
105
- specified by --query-type is not prefixed by --prefix if both flags are present.
107
+ Example:
108
+ stepzen import curl https://example.com/users/jane/posts/12 --path-params '/users/$userId/posts/$postId'
109
+
110
+ --prefix=prefix
111
+ [curl] prefix to add every type in the generated schema.
112
+
113
+ --query-name=query-name
114
+ [curl] property name to add to the Query type as a way to access the imported cURL endpoint.
115
+
116
+ --query-type=query-type
117
+ [curl] name for the type returned by the cURL endpoint in the generated schema. The name specified by --query-type
118
+ is not prefixed by --prefix if both flags are present.
106
119
  ```
107
120
 
108
121
  ## `stepzen list TYPE`
@@ -12,9 +12,11 @@ const generate_1 = require("../generate");
12
12
  const utils_1 = require("../shared/utils");
13
13
  const helpers_1 = require("../generate/helpers");
14
14
  const curl2sdl_1 = require("../generate/curl2sdl");
15
+ const curl_parser_1 = require("../shared/curl-parser");
15
16
  const workspace_1 = require("../shared/workspace");
16
17
  const init_1 = require("./init");
17
18
  const constants_1 = require("../shared/constants");
19
+ const path_params_parser_1 = require("../shared/path-params-parser");
18
20
  class Import extends command_1.Command {
19
21
  async run() {
20
22
  const { args, argv, flags } = this.parse(Import);
@@ -40,25 +42,45 @@ class Import extends command_1.Command {
40
42
  if (schemas.length > 1) {
41
43
  throw new errors_1.CLIError('Please run cURL import separately from importing other schemas');
42
44
  }
43
- if (argv.length < 2) {
44
- throw new errors_1.CLIError('Please append the full cURL command, e.g. ' +
45
- chalk.bold(`${this.config.name} import curl https://test.stepzen.net/version`));
46
- }
47
45
  this.log(chalk.yellow(`NOTE: ${chalk.bold('stepzen import curl')} is a ${chalk.bold('new')} feature.`));
48
46
  this.log(chalk.yellow('If you have any issues, please check if they have been addressed ' +
49
47
  'in the latest version, or reach out to StepZen on Discord: ' +
50
- 'https://discord.gg/9k2VdPn2FR'));
51
- // LATER: introduce a generic graphqlize() API taking in schema as the first arg
52
- argv.shift(); // remove 'curl' and pass everything else further
53
- cli_ux_1.cli.action.start('Starting');
54
- const resultOrError = await curl2sdl_1.curl2sdl({
55
- argv,
48
+ constants_1.STEPZEN_DISCORD_URL));
49
+ let curl2sdlOptions;
50
+ const fixedOptions = {
56
51
  name: flags.name,
57
52
  source: workspace.schema,
53
+ };
54
+ const editableOptions = {
58
55
  queryName: flags['query-name'],
59
56
  rootType: flags['query-type'],
60
57
  typePrefix: flags.prefix,
61
- });
58
+ pathParams: flags['path-params'],
59
+ };
60
+ if (argv.length === 1) {
61
+ // no parameters given: start an interactive prompt
62
+ console.log();
63
+ console.log('This command introspects the response of a REST endpoint and generates' +
64
+ ' a GraphQL schema allowing you to access this endpoint through your ' +
65
+ 'StepZen API. curl syntax is supported so that you copy and paste a ' +
66
+ 'curl command instead of the URL.');
67
+ console.log();
68
+ curl2sdlOptions = Object.assign(Object.assign({}, fixedOptions), (await curl2sdl_1.askCurlQuestions(editableOptions)));
69
+ }
70
+ else {
71
+ // run non-interative
72
+ const argsOrError = curl_parser_1.parseCurlArgv(argv);
73
+ if ('error' in argsOrError) {
74
+ throw new errors_1.CLIError(argsOrError.error);
75
+ }
76
+ const parsedPathParamsOrError = path_params_parser_1.parsePathParamsPattern(argsOrError.url, flags['path-params']);
77
+ if ('error' in parsedPathParamsOrError) {
78
+ throw new errors_1.CLIError(parsedPathParamsOrError.error);
79
+ }
80
+ curl2sdlOptions = Object.assign(Object.assign(Object.assign({}, fixedOptions), editableOptions), { pathParams: parsedPathParamsOrError, curlArgs: argsOrError });
81
+ }
82
+ cli_ux_1.cli.action.start('Starting');
83
+ const resultOrError = await curl2sdl_1.curl2sdl(curl2sdlOptions);
62
84
  cli_ux_1.cli.action.stop();
63
85
  if ('error' in resultOrError) {
64
86
  this.log('A problem occured while processing your import. ' +
@@ -70,7 +92,7 @@ class Import extends command_1.Command {
70
92
  }
71
93
  else {
72
94
  ;
73
- ['prefix', 'query-type', 'query-name'].forEach(flag => {
95
+ ['prefix', 'query-type', 'query-name', 'path-params'].forEach(flag => {
74
96
  if (flag in flags) {
75
97
  this.log(chalk.gray(`The ${chalk.bold(`--${flag}`)} flag only applies when importing ${chalk.bold('curl')}. It will be ignored now.`));
76
98
  }
@@ -118,6 +140,16 @@ Import.flags = {
118
140
  description: '[curl] name for the type returned by the cURL endpoint in the ' +
119
141
  `generated schema. The name specified by ${chalk.bold('--query-type')} is not prefixed by ${chalk.bold('--prefix')} if both flags are present.`,
120
142
  }),
143
+ 'path-params': command_1.flags.string({
144
+ description: `[curl] specifies path parameters in the URL path.` +
145
+ ` Can be formed by taking the original path and replacing the` +
146
+ ` variable segments with ${chalk.bold('$paramName')} placeholders.` +
147
+ `\n` +
148
+ `\nExample:` +
149
+ `\nstepzen import curl https://example.com/users/jane/posts/12` +
150
+ ` --path-params` +
151
+ ` '/users/${chalk.bold('$userId')}/posts/${chalk.bold('$postId')}'`,
152
+ }),
121
153
  };
122
154
  Import.args = [
123
155
  {
@@ -1,16 +1,24 @@
1
+ import { CurlArguments } from '../shared/curl-parser';
2
+ import { PathParam } from '../shared/path-params-parser';
1
3
  export declare type Curl2SdlOptions = {
2
- argv: readonly string[];
4
+ curlArgs: CurlArguments;
3
5
  name: string;
4
6
  source: string;
5
7
  queryName?: string;
6
8
  rootType?: string;
7
9
  typePrefix?: string;
10
+ pathParams: readonly PathParam[];
8
11
  };
9
- export declare type HeaderInput = {
10
- name: string;
11
- value: string;
12
+ export declare type EditableCurl2SdlOptions = Pick<Curl2SdlOptions, 'curlArgs' | 'queryName' | 'rootType' | 'typePrefix' | 'pathParams'>;
13
+ export declare type CurlAnswers = {
14
+ url: string;
15
+ queryName: string;
16
+ rootType: string;
17
+ typePrefix: string;
18
+ pathParams: string;
12
19
  };
13
- export declare const curl2sdl: ({ argv, name, source, queryName, rootType, typePrefix, }: Curl2SdlOptions) => Promise<{
20
+ export declare const askCurlQuestions: (defaultAnswers?: Partial<CurlAnswers>) => Promise<EditableCurl2SdlOptions>;
21
+ export declare const curl2sdl: ({ curlArgs, name, source, queryName, rootType, typePrefix, pathParams, }: Curl2SdlOptions) => Promise<{
14
22
  error: string;
15
23
  } | {
16
24
  outPath: string;
@@ -1,24 +1,80 @@
1
1
  "use strict";
2
2
  // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.curl2sdl = void 0;
4
+ exports.curl2sdl = exports.askCurlQuestions = void 0;
5
5
  const errors_1 = require("@oclif/errors");
6
+ const chalk = require("chalk");
6
7
  const fs = require("fs-extra");
8
+ const inquirer = require("inquirer");
9
+ const lodash_1 = require("lodash");
7
10
  const os = require("os");
8
11
  const path = require("path");
12
+ const string_argv_1 = require("string-argv");
9
13
  const node_fetch_1 = require("node-fetch");
10
14
  const debug = require("debug");
11
15
  const prettier = require("prettier");
12
16
  const transpiler_1 = require("@stepzen/transpiler");
13
17
  const curl_parser_1 = require("../shared/curl-parser");
18
+ const path_params_parser_1 = require("../shared/path-params-parser");
14
19
  const constants_1 = require("../shared/constants");
15
20
  const errors_2 = require("../shared/errors");
16
- exports.curl2sdl = async ({ argv, name, source, queryName, rootType, typePrefix, }) => {
17
- let json;
18
- const curlArgs = curl_parser_1.parseCurlArgv(argv);
21
+ exports.askCurlQuestions = async (defaultAnswers = {}) => {
22
+ let questions = [
23
+ {
24
+ name: 'url',
25
+ message: 'Endpoint URL or a full curl command',
26
+ },
27
+ {
28
+ name: 'pathParams',
29
+ message: 'Parameters for endpoint URL path',
30
+ },
31
+ {
32
+ name: 'queryName',
33
+ message: 'Query name to use when generating schema (leave blank to use defaults)',
34
+ },
35
+ {
36
+ name: 'rootType',
37
+ message: 'Query type name to use when generating schema (leave blank to use defaults)',
38
+ },
39
+ {
40
+ name: 'typePrefix',
41
+ message: 'Prefix to add to all generated type name (leave blank to use defaults)',
42
+ },
43
+ ];
44
+ questions = questions.map(question => (Object.assign(Object.assign({}, question), { default: lodash_1.get(defaultAnswers, question.name) })));
45
+ const answers = await inquirer.prompt(questions);
46
+ const curlArgs = curl_parser_1.parseCurlArgv(string_argv_1.default(answers.url));
19
47
  if ('error' in curlArgs) {
20
- throw new errors_1.CLIError(curlArgs.error);
48
+ console.log();
49
+ console.log(chalk.red('A problem occurred while parsing the curl command:\n', curlArgs.error), '\nPlease enter a URL or a supported curl command.');
50
+ console.log();
51
+ return exports.askCurlQuestions(answers);
52
+ }
53
+ const parsedPathParamsOrError = path_params_parser_1.parsePathParamsPattern(curlArgs.url, answers.pathParams);
54
+ if ('error' in parsedPathParamsOrError) {
55
+ console.log();
56
+ console.log(chalk.red('A problem occurred while parsing path parameters pattern:\n', parsedPathParamsOrError.error));
57
+ console.log();
58
+ console.log(`Please enter a path parameter specification that` +
59
+ ` can be formed by taking the original path and replacing the variable` +
60
+ ` segments with ${chalk.bold('$paramName')} placeholders.`);
61
+ console.log();
62
+ console.log('Example:\n' +
63
+ `\tendpoint URL: https://example.com/users/jane/posts/12\n ` +
64
+ `\tpath parameters: /users/${chalk.bold('$userId')}/posts/${chalk.bold('$postId')}`);
65
+ console.log();
66
+ return exports.askCurlQuestions(answers);
21
67
  }
68
+ return {
69
+ curlArgs,
70
+ queryName: answers.queryName,
71
+ rootType: answers.rootType,
72
+ typePrefix: answers.typePrefix,
73
+ pathParams: parsedPathParamsOrError,
74
+ };
75
+ };
76
+ exports.curl2sdl = async ({ curlArgs, name, source, queryName, rootType, typePrefix, pathParams, }) => {
77
+ let json;
22
78
  try {
23
79
  const url = `${constants_1.STEPZEN_JSON2SDL_SERVER_URL}/api/graphql`;
24
80
  const query = `query (
@@ -27,6 +83,9 @@ exports.curl2sdl = async ({ argv, name, source, queryName, rootType, typePrefix,
27
83
  $rootType: String
28
84
  $typePrefix: String
29
85
  $headers: [HeaderInput!]
86
+ $data: String
87
+ $method: HTTPMethod
88
+ $pathParams: [PathParam!]
30
89
  ) {
31
90
  getSDLFromCurl(
32
91
  command: $command
@@ -34,6 +93,9 @@ exports.curl2sdl = async ({ argv, name, source, queryName, rootType, typePrefix,
34
93
  rootType: $rootType
35
94
  typePrefix: $typePrefix
36
95
  headers: $headers
96
+ data: $data
97
+ method: $method
98
+ pathParams: $pathParams
37
99
  ) {
38
100
  sdl
39
101
  config
@@ -45,6 +107,9 @@ exports.curl2sdl = async ({ argv, name, source, queryName, rootType, typePrefix,
45
107
  rootType: rootType || null,
46
108
  typePrefix: typePrefix || null,
47
109
  headers: curlArgs.headers.length > 0 ? curlArgs.headers : null,
110
+ data: curlArgs.data || null,
111
+ method: curlArgs.method,
112
+ pathParams: pathParams.length > 0 ? pathParams : null,
48
113
  };
49
114
  debug('stepzen:curl2sdl')(url);
50
115
  debug('stepzen:curl2sdl')(query);
@@ -1,3 +1,9 @@
1
1
  import { Hook } from '@oclif/config';
2
+ export declare const compareMajorVersions: (v1: string, v2: string) => number | string;
3
+ export declare const shouldCheckVersion: (version: string) => boolean;
4
+ export declare const checkUpgrade: (version: string) => Promise<{
5
+ message?: string;
6
+ isBlocking: boolean;
7
+ }>;
2
8
  declare const hook: Hook<'prerun'>;
3
9
  export default hook;
@@ -1,19 +1,56 @@
1
1
  "use strict";
2
2
  // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.checkUpgrade = exports.shouldCheckVersion = exports.compareMajorVersions = void 0;
4
5
  const chalk = require("chalk");
5
6
  const compareVersions = require("compare-versions");
6
- const shell = require("shelljs");
7
+ const fs = require("fs-extra");
8
+ const debug_1 = require("debug");
9
+ const node_fetch_1 = require("node-fetch");
10
+ const constants_1 = require("../../shared/constants");
11
+ const errors_1 = require("../../shared/errors");
7
12
  const { version } = require('../../../package.json');
8
- const hook = async function () {
9
- if (!shell.which('npm')) {
10
- return null;
13
+ const majorRegexp = /\d+\./;
14
+ const timeoutBeta = 1000 * 60 * 60 * 24; // one day
15
+ const timeoutStable = 7 * timeoutBeta; // one week
16
+ exports.compareMajorVersions = (v1, v2) => {
17
+ const v1Major = v1.match(majorRegexp);
18
+ const v2Major = v2.match(majorRegexp);
19
+ if (!v1Major || !v2Major) {
20
+ return ('Cannot get the major from the version string ' +
21
+ `'${v1Major ? v2 : v1}'. Does it follow semver?`);
22
+ }
23
+ return parseInt(v1Major[0], 10) - parseInt(v2Major[0], 10);
24
+ };
25
+ exports.shouldCheckVersion = (version) => {
26
+ if (!fs.existsSync(constants_1.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP)) {
27
+ // always check for a new version if the file does not exist
28
+ return true;
29
+ }
30
+ const { mtime } = fs.statSync(constants_1.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP);
31
+ const threshold = version.includes('beta') ? timeoutBeta : timeoutStable;
32
+ return new Date().getTime() - mtime.getTime() > threshold;
33
+ };
34
+ exports.checkUpgrade = async (version) => {
35
+ if (!exports.shouldCheckVersion(version)) {
36
+ return { message: undefined, isBlocking: false };
37
+ }
38
+ let versions;
39
+ try {
40
+ const pkgmeta = await node_fetch_1.default('https://registry.npmjs.org/stepzen').then(r => r.json());
41
+ versions = pkgmeta['dist-tags'];
42
+ }
43
+ catch (error) {
44
+ // cannot connect to npm -> proceed
45
+ debug_1.default('stepzen:check-upgrade')('failed to get the stepzen version info from npm', error);
46
+ return { message: undefined, isBlocking: false };
11
47
  }
12
- const npm = shell.exec('npm view stepzen dist-tags --json', { silent: true });
13
- const versions = JSON.parse(npm);
14
48
  let beta = false;
15
49
  let latest = versions.latest;
16
- let warning = '';
50
+ const result = {
51
+ message: undefined,
52
+ isBlocking: false,
53
+ };
17
54
  if (version.includes('beta')) {
18
55
  beta = true;
19
56
  latest = versions.beta;
@@ -22,23 +59,45 @@ const hook = async function () {
22
59
  if (upgradeable === -1) {
23
60
  const diff = `${chalk.grey(version)} => ${latest}`;
24
61
  if (beta) {
25
- warning = `${chalk.yellow('An upgrade to the beta channel is available:')}
62
+ result.message = `${chalk.yellow('An upgrade to the beta channel is available:')}
26
63
  ${diff}
27
64
  ${chalk.green('npm install -g stepzen@beta')}
28
65
  `;
29
66
  }
30
67
  else {
31
- warning = `${chalk.yellow('An upgrade to StepZen CLI is available:')}
68
+ result.message = `${chalk.yellow('An upgrade to StepZen CLI is available:')}
32
69
  ${diff}
33
70
  ${chalk.green('npm install -g stepzen')}
34
71
  `;
35
72
  }
73
+ const versionCmpLatest = exports.compareMajorVersions(version, latest);
74
+ if (typeof versionCmpLatest === 'string') {
75
+ debug_1.default('stepzen:check-upgrade')(versionCmpLatest);
76
+ result.message = errors_1.UPGRADE_CHECK_ERROR;
77
+ result.isBlocking = true;
78
+ }
79
+ else {
80
+ result.isBlocking = versionCmpLatest < 0;
81
+ }
82
+ }
83
+ try {
84
+ // update the modification time on the file
85
+ fs.writeFileSync(constants_1.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP, '');
86
+ }
87
+ catch (_a) {
88
+ // ignore
36
89
  }
37
- if (warning) {
90
+ return result;
91
+ };
92
+ const hook = async function () {
93
+ const { message, isBlocking } = await exports.checkUpgrade(version);
94
+ if (message) {
38
95
  this.log('');
39
- this.log(warning.trim());
96
+ this.log(message.trim());
40
97
  this.log('');
41
- this.exit();
98
+ if (isBlocking) {
99
+ this.exit(1);
100
+ }
42
101
  }
43
102
  };
44
103
  exports.default = hook;
@@ -1,4 +1,5 @@
1
1
  export declare const STEPZEN_CONFIG_DIRECTORY: string;
2
+ export declare const STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP: string;
2
3
  export declare const STEPZEN_CONFIG_FILE: string;
3
4
  export declare const STEPZEN_DOMAIN: string;
4
5
  export declare const STEPZEN_SERVER_URL: string;
@@ -10,3 +11,4 @@ export declare const ADMIN_LIST_URL = "/cli/admin/list";
10
11
  export declare const ADMIN_UPLOAD_URL = "/cli/admin/upload";
11
12
  export declare const ADMIN_VERIFY_URL = "/cli/admin/verify";
12
13
  export declare const STEPZEN_JSON2SDL_SERVER_URL: string;
14
+ export declare const STEPZEN_DISCORD_URL = "https://discord.gg/9k2VdPn2FR";
@@ -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_JSON2SDL_SERVER_URL = exports.ADMIN_VERIFY_URL = exports.ADMIN_UPLOAD_URL = exports.ADMIN_LIST_URL = exports.ADMIN_DEPLOY_URL = exports.STEPZEN_API_TEMPLATES_REPOSITORY = exports.STEPZEN_GENERATOR_ENGINES_ENDPOINT = exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = exports.STEPZEN_SERVER_URL = exports.STEPZEN_DOMAIN = exports.STEPZEN_CONFIG_FILE = exports.STEPZEN_CONFIG_DIRECTORY = void 0;
4
+ exports.STEPZEN_DISCORD_URL = exports.STEPZEN_JSON2SDL_SERVER_URL = exports.ADMIN_VERIFY_URL = exports.ADMIN_UPLOAD_URL = exports.ADMIN_LIST_URL = exports.ADMIN_DEPLOY_URL = exports.STEPZEN_API_TEMPLATES_REPOSITORY = 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;
5
5
  // This file contains constants and all magic strings
6
6
  const dotenv = require("dotenv");
7
7
  const os = require("os");
@@ -12,6 +12,7 @@ dotenv.config();
12
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, } = process.env;
13
13
  // Where your authentication details are stored locally
14
14
  exports.STEPZEN_CONFIG_DIRECTORY = path.join(os.homedir(), '.stepzen');
15
+ exports.STEPZEN_LAST_UPDATE_CHECK_TIMESTAMP = path.join(exports.STEPZEN_CONFIG_DIRECTORY, 'last_update_check.timestamp');
15
16
  exports.STEPZEN_CONFIG_FILE = ENV_VAR_STEPZEN_CONFIG_FILE || 'stepzen-config.yaml';
16
17
  // The zenctl domain. Override with the env var `STEPZEN_DOMAIN`
17
18
  exports.STEPZEN_DOMAIN = ENV_VAR_STEPZEN_DOMAIN || 'stepzen.io';
@@ -31,3 +32,4 @@ exports.ADMIN_UPLOAD_URL = '/cli/admin/upload';
31
32
  exports.ADMIN_VERIFY_URL = '/cli/admin/verify';
32
33
  exports.STEPZEN_JSON2SDL_SERVER_URL = ENV_VAR_STEPZEN_JSON2SDL_SERVER_URL ||
33
34
  'https://jsonintrospection-ng-prod-xynkgeaaaa-uc.a.run.app';
35
+ exports.STEPZEN_DISCORD_URL = 'https://discord.gg/9k2VdPn2FR';
@@ -15,10 +15,12 @@ export declare const parseCurlHeaderString: (header: string) => {
15
15
  };
16
16
  export interface CurlArguments {
17
17
  url: string;
18
+ method: 'Get' | 'Post';
18
19
  headers: Array<{
19
20
  name: string;
20
21
  value: string;
21
22
  }>;
23
+ data?: string;
22
24
  }
23
25
  export interface ParseError {
24
26
  error: string;
@@ -2,11 +2,13 @@
2
2
  // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.parseCurlArgv = exports.parseCurlHeaderString = void 0;
5
+ const constants_1 = require("./constants");
5
6
  // Based on the existing curl flags at https://curl.se/docs/manpage.html
6
7
  const curlFlagRegex = /^(-[a-zA-Z0-9.:#])|(--[a-zA-Z0-9.-]+)$/;
7
8
  // Based on the definition of a `token` at
8
9
  // https://datatracker.ietf.org/doc/html/rfc2616#page-17
9
10
  const httpHeaderRegex = /^(?<name>[a-zA-Z0-9!#$%&'*+,-.^_`|~]+)\s*:(?<value>.*)$/;
11
+ const httpURLRegex = /^https?:\/\//i;
10
12
  /**
11
13
  * Parse a header string according to https://curl.se/docs/manpage.html#-H
12
14
  * and https://datatracker.ietf.org/doc/html/rfc2616#section-4.2
@@ -43,7 +45,58 @@ exports.parseCurlHeaderString = (header) => {
43
45
  };
44
46
  };
45
47
  const isAFlagArg = (arg) => curlFlagRegex.test(arg);
46
- const isAHeaderFlag = (flag) => ['-H', '--header'].includes(flag);
48
+ const isAURL = (arg) => httpURLRegex.test(arg);
49
+ const parseHeaderFlag = (argv, i, partialCurlArgs) => {
50
+ if (i + 1 >= argv.length) {
51
+ return {
52
+ error: `The '${argv[i]}' curl flag requires a value`,
53
+ };
54
+ }
55
+ const headerOrError = exports.parseCurlHeaderString(argv[i + 1]);
56
+ if (headerOrError && 'error' in headerOrError) {
57
+ return headerOrError; // error
58
+ }
59
+ const headers = partialCurlArgs.headers || [];
60
+ // A `null` from parseCurlHeaderString() means a header should NOT be
61
+ // sent. This is not supported by zenserv / the introspection service
62
+ // so the CLI simply omits such headers
63
+ if (headerOrError) {
64
+ headers.push(headerOrError); // header
65
+ }
66
+ return {
67
+ result: Object.assign(Object.assign({}, partialCurlArgs), { headers }),
68
+ skip: 1,
69
+ };
70
+ };
71
+ const parseDataFlag = (argv, i, partialCurlArgs) => {
72
+ if (i + 1 >= argv.length) {
73
+ return {
74
+ error: `The '${argv[i]}' curl flag requires a value`,
75
+ };
76
+ }
77
+ if (argv[i] !== '--data-raw' && argv[i + 1].charAt(0) === '@') {
78
+ return {
79
+ error: `Reading request data from local files in not currently supported ` +
80
+ `by StepZen CLI (${argv[i]} ${argv[i + 1]}). If this is a blocker ` +
81
+ `for you, please let us know on Discord (${constants_1.STEPZEN_DISCORD_URL})`,
82
+ };
83
+ }
84
+ const data = (partialCurlArgs.data ? partialCurlArgs.data + '&' : '') + argv[i + 1];
85
+ return {
86
+ result: Object.assign(Object.assign({}, partialCurlArgs), { data }),
87
+ skip: 1,
88
+ };
89
+ };
90
+ const flags = [
91
+ {
92
+ matches: ['-H', '--header'],
93
+ parse: parseHeaderFlag,
94
+ },
95
+ {
96
+ matches: ['-d', '--data', '--data-ascii', '--data-raw', '--data-binary'],
97
+ parse: parseDataFlag,
98
+ },
99
+ ];
47
100
  /**
48
101
  * Parse a curl command line arguments array to a JSON structure consumable by
49
102
  * the StepZen introspection service backend.
@@ -60,39 +113,33 @@ const isAHeaderFlag = (flag) => ['-H', '--header'].includes(flag);
60
113
  * @returns {*} a structured object with the curl arguments
61
114
  */
62
115
  exports.parseCurlArgv = (argv) => {
63
- const result = {
64
- url: '',
65
- headers: [],
66
- };
116
+ var _a;
117
+ if (((_a = argv[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'curl') {
118
+ argv = argv.slice(1);
119
+ }
120
+ let result = {};
67
121
  for (let i = 0; i < argv.length; i++) {
68
122
  if (isAFlagArg(argv[i])) {
69
- if (isAHeaderFlag(argv[i])) {
70
- if (i + 1 === argv.length) {
71
- return {
72
- error: `The '${argv[i]}' curl flag requires a value`,
73
- };
123
+ const knownFlag = flags.find(flag => flag.matches.includes(argv[i]));
124
+ if (knownFlag) {
125
+ const resultOrError = knownFlag.parse(argv, i, result);
126
+ if ('error' in resultOrError) {
127
+ return resultOrError; // error
74
128
  }
75
- const headerOrError = exports.parseCurlHeaderString(argv[i + 1]);
76
- if (headerOrError && 'error' in headerOrError) {
77
- return headerOrError; // error
78
- }
79
- // A `null` from parseCurlHeaderString() means a header should NOT be
80
- // sent. This is not supported by zenserv / the introspection service
81
- // so the CLI simply omits such headers
82
- if (headerOrError) {
83
- result.headers.push(headerOrError); // header
84
- }
85
- i += 1; // skip over the flag value
129
+ result = resultOrError.result; // result
130
+ i += resultOrError.skip || 0;
86
131
  }
87
132
  else {
88
133
  return {
89
- error: `The '${argv[i]}' curl flag is not currently supported by StepZen CLI`,
134
+ error: `The '${argv[i]}' curl flag is not currently supported by StepZen CLI.` +
135
+ ` If this is a blocker for you, please let us know on Discord (${constants_1.STEPZEN_DISCORD_URL})`,
90
136
  };
91
137
  }
92
138
  }
93
139
  else if (result.url) {
94
140
  return {
95
- error: `Multiple URLs are not currently supported by StepZen CLI (${argv[i]})`,
141
+ error: `Multiple URLs are not currently supported by StepZen CLI (${argv[i]}).` +
142
+ ` If this is a blocker for you, please let us know on Discord (${constants_1.STEPZEN_DISCORD_URL})`,
96
143
  };
97
144
  }
98
145
  else {
@@ -104,5 +151,23 @@ exports.parseCurlArgv = (argv) => {
104
151
  error: 'curl: a URL is required',
105
152
  };
106
153
  }
154
+ if (!isAURL(result.url)) {
155
+ return {
156
+ error: `Unsupported URL schema in '${result.url}'.` +
157
+ ` StepZen CLI currently supports 'https' and 'http'.` +
158
+ ` If this is a blocker for you, please let us know on Discord (${constants_1.STEPZEN_DISCORD_URL})`,
159
+ };
160
+ }
161
+ result.headers = result.headers || [];
162
+ result.method = result.method || result.data ? 'Post' : 'Get';
163
+ // Add the default content-type header if the request has any data
164
+ // in it, and no content-type header is explicitly provided.
165
+ if (result.headers.findIndex(header => header.name.toLowerCase() === 'content-type') === -1 &&
166
+ result.data) {
167
+ result.headers.push({
168
+ name: 'content-type',
169
+ value: 'application/x-www-form-urlencoded',
170
+ });
171
+ }
107
172
  return result;
108
173
  };
@@ -2,3 +2,4 @@ export declare const formatTemporaryErrorMessage: (errors: ReadonlyArray<{
2
2
  message?: string;
3
3
  }>) => string;
4
4
  export declare const PERMANENT_STEPZEN_ERROR: string;
5
+ export declare const UPGRADE_CHECK_ERROR: string;
@@ -1,12 +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.PERMANENT_STEPZEN_ERROR = exports.formatTemporaryErrorMessage = void 0;
4
+ exports.UPGRADE_CHECK_ERROR = exports.PERMANENT_STEPZEN_ERROR = exports.formatTemporaryErrorMessage = void 0;
5
+ const constants_1 = require("./constants");
5
6
  exports.formatTemporaryErrorMessage = (errors) => `A problem occurred while processing your import${errors.length > 0 && errors[0].message ? `: "${errors[0].message}"` : ''}. Please try again.` +
6
7
  ` If the issue persists, make sure you are on the latest version of StepZen ` +
7
8
  `CLI. And if the issue still persists contact support via the StepZen discord ` +
8
- `channel (https://discord.gg/9k2VdPn2FR).`;
9
+ `channel (${constants_1.STEPZEN_DISCORD_URL}).`;
9
10
  exports.PERMANENT_STEPZEN_ERROR = 'An unexpected problem occurred while processing your import.' +
10
11
  ` If the issue persists, make sure you are on the latest version of StepZen ` +
11
12
  `CLI. And if the issue still persists contact support via the StepZen discord ` +
12
- `channel (https://discord.gg/9k2VdPn2FR).`;
13
+ `channel (${constants_1.STEPZEN_DISCORD_URL}).`;
14
+ exports.UPGRADE_CHECK_ERROR = 'An unexpected problem occurred while checking for new CLI versions.' +
15
+ ` If the issue persists, make sure you are on the latest version of StepZen ` +
16
+ `CLI. And if the issue still persists contact support via the StepZen discord ` +
17
+ `channel (${constants_1.STEPZEN_DISCORD_URL}).`;
@@ -0,0 +1,7 @@
1
+ import { ParseError } from './curl-parser';
2
+ export declare type PathParam = {
3
+ index: number;
4
+ name: string;
5
+ };
6
+ export declare const formatPatternDiffWithPath: (patternSegments: readonly string[], pathSegments: readonly string[]) => string | null;
7
+ export declare const parsePathParamsPattern: (url: string, pathParamsPattern?: string | undefined) => PathParam[] | ParseError;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.parsePathParamsPattern = exports.formatPatternDiffWithPath = void 0;
5
+ const chalk = require("chalk");
6
+ const pathParamRegex = /^\$[_A-Za-z]\w*$/;
7
+ exports.formatPatternDiffWithPath = (patternSegments, pathSegments) => {
8
+ let hasErrors = false;
9
+ const diff = [];
10
+ for (let i = 0; i < patternSegments.length; i++) {
11
+ const patternSegment = patternSegments[i];
12
+ if (i >= pathSegments.length) {
13
+ diff.push(chalk.red(`< ${patternSegment} >`));
14
+ hasErrors = true;
15
+ }
16
+ else if (patternSegment.charAt(0) === '$') {
17
+ diff.push(patternSegment);
18
+ }
19
+ else {
20
+ const pathSegment = pathSegments[i];
21
+ if (pathSegment === patternSegment) {
22
+ diff.push(pathSegment);
23
+ }
24
+ else {
25
+ diff.push(chalk.red(`< ${patternSegment} >`));
26
+ hasErrors = true;
27
+ }
28
+ }
29
+ }
30
+ for (let i = patternSegments.length; i < pathSegments.length; i++) {
31
+ diff.push(chalk.magenta(`< ${pathSegments[i]} >`));
32
+ hasErrors = true;
33
+ }
34
+ return hasErrors ? diff.join('/') : null;
35
+ };
36
+ exports.parsePathParamsPattern = (url, pathParamsPattern) => {
37
+ if (!pathParamsPattern) {
38
+ return [];
39
+ }
40
+ if (pathParamsPattern.charAt(0) === '/') {
41
+ pathParamsPattern = pathParamsPattern.slice(1);
42
+ }
43
+ let pathname = new URL(url).pathname;
44
+ if (pathname.charAt(0) === '/') {
45
+ pathname = pathname.slice(1);
46
+ }
47
+ const pathSegments = pathname.split('/');
48
+ const patternSegments = pathParamsPattern.split('/');
49
+ const maybeDiff = exports.formatPatternDiffWithPath(patternSegments, pathSegments);
50
+ if (maybeDiff) {
51
+ return {
52
+ error: `Path parameters do not align with the URL path: /${maybeDiff}`,
53
+ };
54
+ }
55
+ const invalidParameterSegments = patternSegments.filter(segment => segment.charAt(0) === '$' && !pathParamRegex.test(segment));
56
+ if (invalidParameterSegments.length > 0) {
57
+ return {
58
+ error: `The path parameter name '${invalidParameterSegments[0]}' is not` +
59
+ ` allowed. Path parameter names should be valid GraphQL identifiers` +
60
+ ` prefixed with $ (dollar sign).`,
61
+ };
62
+ }
63
+ return patternSegments
64
+ .map((segment, index) => ({
65
+ index,
66
+ name: segment,
67
+ }))
68
+ .filter(({ name }) => name.charAt(0) === '$')
69
+ .map(({ index, name }) => ({
70
+ index,
71
+ name: name.slice(1),
72
+ }));
73
+ };
@@ -1 +1 @@
1
- {"version":"0.10.0","commands":{"deploy":{"id":"deploy","description":"deploy to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"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 schemas from stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"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."}},"args":[{"name":"schemas","required":true}]},"init":{"id":"init","description":"stepzen init","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"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":{"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":{"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":{"account":{"name":"account","type":"option","char":"a","hidden":true},"adminkey":{"name":"adminkey","type":"option","char":"k","hidden":true},"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":{"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":{"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":{"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":{"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":{"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":{"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.11.0-beta.2","commands":{"deploy":{"id":"deploy","description":"deploy to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"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 schemas from stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"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'"}},"args":[{"name":"schemas","required":true}]},"init":{"id":"init","description":"stepzen init","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"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":{"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":{"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":{"account":{"name":"account","type":"option","char":"a","hidden":true},"adminkey":{"name":"adminkey","type":"option","char":"k","hidden":true},"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":{"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":{"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":{"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":{"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":{"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":{"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.10.0",
4
+ "version": "0.11.0-beta.2",
5
5
  "license": "MIT",
6
6
  "author": "Darren Waddell <darren@stepzen.com>",
7
7
  "contributors": [
@@ -119,6 +119,8 @@
119
119
  "posttest": "eslint . --ignore-path .prettierignore",
120
120
  "prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
121
121
  "test": "tsc -b && STEPZEN_DOMAIN=steprz.io STEPZEN_SERVER_URL=http://localhost nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
122
+ "test:single:example": "npm run test:single -- test/src/shared/curl-parser.test.ts",
123
+ "test:single": "tsc -b && STEPZEN_DOMAIN=steprz.io STEPZEN_SERVER_URL=http://localhost mocha --forbid-only test/_global.test.ts",
122
124
  "version": "oclif-dev readme && git add README.md",
123
125
  "prepare": "husky install"
124
126
  },