stepzen 0.17.0-beta.1 → 0.17.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.17.0-beta.1 darwin-x64 node-v14.19.1
32
+ stepzen/0.17.0-beta.2 darwin-x64 node-v14.19.3
33
33
  $ stepzen --help [COMMAND]
34
34
  USAGE
35
35
  $ stepzen COMMAND
@@ -126,9 +126,6 @@ OPTIONS
126
126
  Subfolder inside the workspace folder to save the imported schema files to. Defaults to the name of the imported
127
127
  schema.
128
128
 
129
- --overwrite
130
- Overwrite any existing schema with the same name. Cannot be used without also providing a --name flag.
131
-
132
129
  --path-params=path-params
133
130
  [curl] specifies path parameters in the URL path. Can be formed by taking the original path and replacing the
134
131
  variable segments with $paramName placeholders.
@@ -137,7 +134,7 @@ OPTIONS
137
134
  stepzen import curl https://example.com/users/jane/posts/12 --path-params '/users/$userId/posts/$postId'
138
135
 
139
136
  --prefix=prefix
140
- [curl] prefix to add every type in the generated schema.
137
+ [curl, graphql] prefix to add every type in the generated schema.
141
138
 
142
139
  --query-name=query-name
143
140
  [curl] property name to add to the Query type as a way to access the imported cURL endpoint.
@@ -3,8 +3,10 @@ import ZenCommand from '../shared/zen-command';
3
3
  import { Workspace } from '../shared/types';
4
4
  export default class Import extends ZenCommand {
5
5
  static description: string;
6
- static curlFlags: {
6
+ static commonIntrospectionFlags: {
7
7
  prefix: flags.IOptionFlag<string | undefined>;
8
+ };
9
+ static curlFlags: {
8
10
  'query-name': flags.IOptionFlag<string | undefined>;
9
11
  'query-type': flags.IOptionFlag<string | undefined>;
10
12
  'path-params': flags.IOptionFlag<string | undefined>;
@@ -22,6 +24,10 @@ export default class Import extends ZenCommand {
22
24
  static flagsForSchemas: ({
23
25
  flags: {
24
26
  prefix: flags.IOptionFlag<string | undefined>;
27
+ };
28
+ schemas: string[];
29
+ } | {
30
+ flags: {
25
31
  'query-name': flags.IOptionFlag<string | undefined>;
26
32
  'query-type': flags.IOptionFlag<string | undefined>;
27
33
  'path-params': flags.IOptionFlag<string | undefined>;
@@ -48,11 +54,11 @@ export default class Import extends ZenCommand {
48
54
  'db-user': flags.IOptionFlag<string | undefined>;
49
55
  'db-password': flags.IOptionFlag<string | undefined>;
50
56
  'db-database': flags.IOptionFlag<string | undefined>;
51
- prefix: flags.IOptionFlag<string | undefined>;
52
57
  'query-name': flags.IOptionFlag<string | undefined>;
53
58
  'query-type': flags.IOptionFlag<string | undefined>;
54
59
  'path-params': flags.IOptionFlag<string | undefined>;
55
60
  'header-param': flags.IOptionFlag<string[]>;
61
+ prefix: flags.IOptionFlag<string | undefined>;
56
62
  dir: flags.IOptionFlag<string | undefined>;
57
63
  help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
58
64
  silent: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
@@ -76,11 +82,11 @@ export default class Import extends ZenCommand {
76
82
  'db-user': string | undefined;
77
83
  'db-password': string | undefined;
78
84
  'db-database': string | undefined;
79
- prefix: string | undefined;
80
85
  'query-name': string | undefined;
81
86
  'query-type': string | undefined;
82
87
  'path-params': string | undefined;
83
88
  'header-param': string[];
89
+ prefix: string | undefined;
84
90
  dir: string | undefined;
85
91
  help: void;
86
92
  silent: boolean;
@@ -15,6 +15,7 @@ const helpers_1 = require("../generate/helpers");
15
15
  const curl2sdl_1 = require("../generate/curl2sdl");
16
16
  const curl_parser_1 = require("../shared/curl-parser");
17
17
  const zen_command_1 = require("../shared/zen-command");
18
+ const graphql2sdl_1 = require("../generate/graphql2sdl");
18
19
  const constants_1 = require("../shared/constants");
19
20
  const path_params_parser_1 = require("../shared/path-params-parser");
20
21
  const header_params_parser_1 = require("../shared/header-params-parser");
@@ -93,6 +94,35 @@ class Import extends zen_command_1.default {
93
94
  }
94
95
  result = resultOrError.outPath;
95
96
  }
97
+ else if (schema === 'graphql') {
98
+ const editableOptions = {
99
+ typePrefix: flags.prefix,
100
+ };
101
+ let answers;
102
+ if (argv.length === 1) {
103
+ // interactive
104
+ answers = await graphql2sdl_1.askGraphQLQuestions(editableOptions);
105
+ }
106
+ else {
107
+ // non-interactive
108
+ answers = Object.assign(Object.assign({}, editableOptions), { endpoint: argv[1] });
109
+ }
110
+ const fixedOptions = {
111
+ name: flags.name,
112
+ source: workspace.schema,
113
+ onConflict,
114
+ };
115
+ const options = Object.assign(Object.assign({}, fixedOptions), answers);
116
+ core_1.CliUx.ux.action.start('Starting');
117
+ const resultOrError = await graphql2sdl_1.graphql2sdl(options);
118
+ core_1.CliUx.ux.action.stop();
119
+ if ('error' in resultOrError) {
120
+ this.log('A problem occured while processing your import.');
121
+ this.log(resultOrError.error);
122
+ this.exit();
123
+ }
124
+ result = resultOrError.outPath;
125
+ }
96
126
  else {
97
127
  // Map flag names to the properties defined for sql engines in:
98
128
  // https://github.com/steprz/generator-engines/blob/main/generator/src/shared/sql.ts
@@ -124,6 +154,10 @@ class Import extends zen_command_1.default {
124
154
  this.log(chalk.green(`Successfully imported schema ${chalk.bold(schema)} from StepZen`));
125
155
  }
126
156
  async ensureOnConflictBehavior(workspace, schema, flags) {
157
+ const featureFlag = process.env.STEPZEN_DETECT_NAME_CONFLICTS;
158
+ if (featureFlag === undefined || featureFlag.toLowerCase() === 'false') {
159
+ return 'append';
160
+ }
127
161
  const name = flags.name || schema;
128
162
  const hasConflict = fs.existsSync(path.join(workspace.schema, name));
129
163
  if (!hasConflict) {
@@ -217,10 +251,12 @@ class Import extends zen_command_1.default {
217
251
  }
218
252
  exports.default = Import;
219
253
  Import.description = 'import a schema for an external data source or a API endpoint to your GraphQL API';
220
- Import.curlFlags = {
254
+ Import.commonIntrospectionFlags = {
221
255
  prefix: command_1.flags.string({
222
- description: '[curl] prefix to add every type in the generated schema.',
256
+ description: '[curl, graphql] prefix to add every type in the generated schema.',
223
257
  }),
258
+ };
259
+ Import.curlFlags = {
224
260
  'query-name': command_1.flags.string({
225
261
  description: '[curl] property name to add to the Query type as a way to' +
226
262
  ' access the imported cURL endpoint.',
@@ -271,18 +307,20 @@ Import.postgresqlFlags = {
271
307
  }),
272
308
  };
273
309
  Import.flagsForSchemas = [
310
+ { flags: Import.commonIntrospectionFlags, schemas: ['curl', 'graphql'] },
274
311
  { flags: Import.curlFlags, schemas: ['curl'] },
275
312
  { flags: Import.sqlFlags, schemas: ['mysql', 'postgresql'] },
276
313
  { flags: Import.postgresqlFlags, schemas: ['postgresql'] },
277
314
  ];
278
- 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({
315
+ Import.flags = Object.assign(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({
279
316
  description: 'Subfolder inside the workspace folder to save the imported' +
280
317
  ' schema files to. Defaults to the name of the imported schema.',
281
318
  }), overwrite: command_1.flags.boolean({
282
319
  description: 'Overwrite any existing schema with the same name. Cannot be used' +
283
320
  ' without also providing a --name flag.',
284
321
  dependsOn: ['name'],
285
- }) }), Import.curlFlags), Import.sqlFlags), Import.postgresqlFlags);
322
+ hidden: true,
323
+ }) }), Import.commonIntrospectionFlags), Import.curlFlags), Import.sqlFlags), Import.postgresqlFlags);
286
324
  Import.args = [
287
325
  {
288
326
  name: 'schema',
@@ -2,9 +2,9 @@
2
2
  // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const command_1 = require("@oclif/command");
5
+ const transpiler_1 = require("@stepzen/transpiler");
5
6
  const utils_1 = require("../shared/utils");
6
7
  const zen_command_1 = require("../shared/zen-command");
7
- const { lint } = require('@stepzen/transpiler');
8
8
  class Init extends zen_command_1.default {
9
9
  async run() {
10
10
  const { flags } = this.parse(Init);
@@ -18,7 +18,7 @@ class Init extends zen_command_1.default {
18
18
  this.log(formatted);
19
19
  };
20
20
  // Lint
21
- await lint(directory);
21
+ await transpiler_1.lint(directory);
22
22
  }
23
23
  }
24
24
  exports.default = Init;
@@ -17,5 +17,5 @@ export default class Transpile extends ZenCommand {
17
17
  name: string;
18
18
  required: boolean;
19
19
  }[];
20
- run(): Promise<any>;
20
+ run(): Promise<string | false | undefined>;
21
21
  }
@@ -6,26 +6,26 @@ const command_1 = require("@oclif/command");
6
6
  const errors_1 = require("@oclif/errors");
7
7
  const fs = require("fs-extra");
8
8
  const path = require("path");
9
+ const transpiler_1 = require("@stepzen/transpiler");
9
10
  const utils_1 = require("../shared/utils");
10
11
  const zen_command_1 = require("../shared/zen-command");
11
- const { configure, stitch, validate } = require('@stepzen/transpiler');
12
12
  class Transpile extends zen_command_1.default {
13
13
  async run() {
14
14
  const { args, flags } = this.parse(Transpile);
15
15
  const folder = utils_1.getDirectory(args.folder);
16
16
  // CONFIG
17
17
  if (flags['output-configuration']) {
18
- const config = await configure(folder, flags.silent);
18
+ const config = await transpiler_1.configure(folder, flags.silent);
19
19
  if (flags['hide-output']) {
20
20
  return config;
21
21
  }
22
- this.log(config);
22
+ this.log(`${config}`);
23
23
  return;
24
24
  }
25
25
  // SCHEMA
26
26
  try {
27
- const schema = stitch(folder);
28
- validate(schema, {
27
+ const schema = transpiler_1.stitch(folder);
28
+ transpiler_1.validate(schema, {
29
29
  extensions: await utils_1.getStepZenExtensions(),
30
30
  });
31
31
  const file = path.join(schema, 'index.graphql');
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const chalk = require("chalk");
5
5
  const command_1 = require("@oclif/command");
6
6
  const errors_1 = require("@oclif/errors");
7
+ const transpiler_1 = require("@stepzen/transpiler");
7
8
  const utils_1 = require("../shared/utils");
8
9
  const zen_command_1 = require("../shared/zen-command");
9
- const { stitch, validate } = require('@stepzen/transpiler');
10
10
  class Validate extends zen_command_1.default {
11
11
  async run() {
12
12
  const { args } = this.parse(Validate);
13
13
  const folder = utils_1.getDirectory(args.folder);
14
14
  try {
15
- const schema = stitch(folder);
16
- validate(schema, {
15
+ const schema = transpiler_1.stitch(folder);
16
+ transpiler_1.validate(schema, {
17
17
  extensions: await utils_1.getStepZenExtensions(),
18
18
  });
19
19
  }
@@ -1,24 +1,6 @@
1
1
  import { CurlArguments } from '../shared/curl-parser';
2
2
  import { PathParam } from '../shared/path-params-parser';
3
- export declare type NameValueHeaderInput = {
4
- name: string;
5
- value: string;
6
- };
7
- export declare type NamePartsHeaderInput = {
8
- name: string;
9
- parts: HeaderInputValuePart[];
10
- };
11
- export declare type HeaderInput = NameValueHeaderInput | NamePartsHeaderInput;
12
- export declare type HeaderInputConstantValuePart = {
13
- kind: 'Constant';
14
- value: string;
15
- };
16
- export declare type HeaderInputVariableValuePart = {
17
- kind: 'Variable';
18
- value: string;
19
- name: string;
20
- };
21
- export declare type HeaderInputValuePart = HeaderInputConstantValuePart | HeaderInputVariableValuePart;
3
+ import { HeaderInput } from '../shared/header';
22
4
  export declare type Curl2SdlOptions = {
23
5
  curlArgs: CurlArguments;
24
6
  name?: string;
@@ -2,22 +2,13 @@
2
2
  // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.curl2sdl = exports.askCurlQuestions = exports.makeDuplicateParamsMessage = exports.compileParameterList = void 0;
5
- const errors_1 = require("@oclif/errors");
6
5
  const chalk = require("chalk");
7
- const fs = require("fs-extra");
8
6
  const inquirer = require("inquirer");
9
7
  const lodash_1 = require("lodash");
10
- const os = require("os");
11
- const path = require("path");
12
8
  const string_argv_1 = require("string-argv");
13
- const node_fetch_1 = require("node-fetch");
14
- const debug = require("debug");
15
- const prettier = require("prettier");
16
- const transpiler_1 = require("@stepzen/transpiler");
17
9
  const curl_parser_1 = require("../shared/curl-parser");
18
10
  const path_params_parser_1 = require("../shared/path-params-parser");
19
- const constants_1 = require("../shared/constants");
20
- const errors_2 = require("../shared/errors");
11
+ const helpers_1 = require("./helpers");
21
12
  /**
22
13
  * Collect together all query parameters from HTTP headers and from the
23
14
  * pathname, and return them as a uniform list.
@@ -116,7 +107,7 @@ exports.askCurlQuestions = async (defaultAnswers = {}) => {
116
107
  },
117
108
  {
118
109
  name: 'typePrefix',
119
- message: 'Prefix to add to all generated type name (leave blank to use defaults)',
110
+ message: 'Prefix to add to all generated type names (leave blank to use defaults)',
120
111
  },
121
112
  ];
122
113
  questions = questions.map(question => (Object.assign(Object.assign({}, question), { default: lodash_1.get(defaultAnswers, question.name) })));
@@ -152,107 +143,45 @@ exports.askCurlQuestions = async (defaultAnswers = {}) => {
152
143
  };
153
144
  };
154
145
  exports.curl2sdl = async ({ curlArgs, name, source, queryName, rootType, typePrefix, pathParams, headers, onConflict, }) => {
155
- let json;
156
- try {
157
- const url = `${constants_1.STEPZEN_JSON2SDL_SERVER_URL}/api/graphql`;
158
- const query = `query (
159
- $command: String!
160
- $queryName: String
161
- $rootType: String
162
- $typePrefix: String
163
- $headers: [HeaderInput!]
164
- $data: String
165
- $method: HTTPMethod
166
- $pathParams: [PathParamInput!]
167
- ) {
168
- getSDLFromCurl(
169
- command: $command
170
- queryName: $queryName
171
- rootType: $rootType
172
- typePrefix: $typePrefix
173
- headers: $headers
174
- data: $data
175
- method: $method
176
- pathParams: $pathParams
177
- ) {
178
- sdl
179
- config
180
- }
181
- }`;
182
- const variables = {
183
- command: curlArgs.url,
184
- queryName: queryName || null,
185
- rootType: rootType || null,
186
- typePrefix: typePrefix || null,
187
- headers: headers.length > 0 ? headers : null,
188
- data: curlArgs.data || null,
189
- method: curlArgs.method,
190
- pathParams: pathParams.length > 0 ? pathParams : null,
191
- };
192
- debug('stepzen:curl2sdl')(url);
193
- debug('stepzen:curl2sdl')(query);
194
- debug('stepzen:curl2sdl')(variables);
195
- const payload = JSON.stringify({
196
- query,
197
- variables,
198
- });
199
- debug('stepzen:curl2sdl')(payload);
200
- const response = await node_fetch_1.default(url, {
201
- method: 'POST',
202
- headers: { 'Content-Type': 'application/json' },
203
- body: JSON.stringify({
204
- query,
205
- variables,
206
- }),
207
- });
208
- const text = await response.text();
209
- debug('stepzen:curl2sdl')(text);
210
- json = JSON.parse(text);
211
- }
212
- catch (error) {
213
- debug('stepzen:curl2sdl')(error);
214
- throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
215
- }
216
- if (!json.data && !json.errors) {
217
- debug('stepzen:curl2sdl')('expected the response from the JSON introspection service ' +
218
- 'to contain either `data` or `errors`');
219
- throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
220
- }
221
- if (json.errors) {
222
- return { error: json.errors.map((error) => error.message).join('\n') };
223
- }
224
- const { getSDLFromCurl } = json.data;
225
- if (!getSDLFromCurl) {
226
- debug('stepzen:curl2sdl')('expected the response from the JSON introspection service ' +
227
- 'to contain a `getSDLFromCurl` object');
228
- throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
229
- }
230
- const { config, sdl } = getSDLFromCurl;
231
- if (!config && !sdl) {
232
- debug('stepzen:curl2sdl')('expected the response from the JSON introspection service ' +
233
- 'to contain at least one of `getSDLFromCurl.config` or ' +
234
- '`getSDLFromCurl.sdl` properties');
235
- throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
236
- }
237
- // write out the generated config and schema files
238
- const tmp = path.join(os.tmpdir(), `stepzen-curl2sdl-${Date.now()}`);
239
- fs.ensureDirSync(tmp);
240
- // fs.ensureDirSync(path.join(tmp, subfolder))
241
- if (config) {
242
- fs.writeFileSync(path.join(tmp, 'config.yaml'), prettier.format(config, { parser: 'yaml' }));
243
- }
244
- if (sdl) {
245
- fs.writeFileSync(path.join(tmp, 'index.graphql'), prettier.format(sdl, { parser: 'graphql' }));
246
- }
247
- const result = await transpiler_1.merge(source, {
248
- name: name || 'curl',
249
- source: tmp,
250
- }, {
251
- answers: {},
252
- output: null,
253
- silent: true,
254
- mergeTypes: false,
255
- onConflict,
146
+ const response = await helpers_1.queryIntrospectionService({
147
+ operation: 'getSDLFromCurl',
148
+ variables: {
149
+ command: {
150
+ type: 'String!',
151
+ value: curlArgs.url,
152
+ },
153
+ queryName: {
154
+ type: 'String',
155
+ value: queryName || null,
156
+ },
157
+ rootType: {
158
+ type: 'String',
159
+ value: rootType || null,
160
+ },
161
+ typePrefix: {
162
+ type: 'String',
163
+ value: typePrefix || null,
164
+ },
165
+ headers: {
166
+ type: '[HeaderInput!]',
167
+ value: headers && headers.length > 0 ? headers : null,
168
+ },
169
+ data: {
170
+ type: 'String',
171
+ value: curlArgs.data || null,
172
+ },
173
+ method: {
174
+ type: 'HTTPMethod!',
175
+ value: curlArgs.method,
176
+ },
177
+ pathParams: {
178
+ type: '[PathParamInput!]',
179
+ value: pathParams.length > 0 ? pathParams : null,
180
+ },
181
+ },
256
182
  });
257
- return { outPath: result };
183
+ if (response.error) {
184
+ return { error: response.error };
185
+ }
186
+ return helpers_1.writeSdlAndConfig(name || 'curl', source, onConflict, response);
258
187
  };
@@ -0,0 +1,23 @@
1
+ import { HeaderInput } from '../shared/header';
2
+ export declare type GraphQL2SdlOptions = {
3
+ name?: string;
4
+ source: string;
5
+ endpoint: string;
6
+ typePrefix?: string;
7
+ includeRootOperations?: boolean;
8
+ header?: string;
9
+ onConflict: 'overwrite' | 'append';
10
+ };
11
+ export declare type EditableGraphQL2SdlOptions = Pick<GraphQL2SdlOptions, 'endpoint' | 'typePrefix' | 'includeRootOperations' | 'header'>;
12
+ export declare type GraphQLAnswers = {
13
+ endpoint: string;
14
+ typePrefix: string;
15
+ includeRootOperations: boolean;
16
+ headers: readonly HeaderInput[];
17
+ };
18
+ export declare const askGraphQLQuestions: (defaultAnswers?: Partial<GraphQLAnswers>) => Promise<EditableGraphQL2SdlOptions>;
19
+ export declare const graphql2sdl: ({ name, source, endpoint, typePrefix, includeRootOperations, header, onConflict, }: GraphQL2SdlOptions) => Promise<{
20
+ error: string;
21
+ } | {
22
+ outPath: string;
23
+ }>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.graphql2sdl = exports.askGraphQLQuestions = void 0;
5
+ const inquirer = require("inquirer");
6
+ const lodash_1 = require("lodash");
7
+ const header_1 = require("../shared/header");
8
+ const helpers_1 = require("./helpers");
9
+ exports.askGraphQLQuestions = async (defaultAnswers = {}) => {
10
+ let questions = [
11
+ {
12
+ name: 'endpoint',
13
+ message: 'What is the GraphQL endpoint URL?',
14
+ validate: input => input.trim() !== '',
15
+ },
16
+ {
17
+ name: 'typePrefix',
18
+ message: 'Prefix to add to all generated type names (leave blank for none)',
19
+ },
20
+ {
21
+ name: 'includeRootOperations',
22
+ type: 'confirm',
23
+ message: 'Should type prefix be added to query and mutation fields as well?',
24
+ when: answers => Boolean(answers.typePrefix),
25
+ },
26
+ {
27
+ name: 'header',
28
+ type: 'input',
29
+ message: 'Add an HTTP header, e.g. Header-Name: header value (leave blank for none)',
30
+ validate: input => input === '' || header_1.HEADER_REGEX.test(input.trim()) || 'invalid header',
31
+ },
32
+ ];
33
+ questions = questions.map(question => (Object.assign(Object.assign({}, question), { default: lodash_1.get(defaultAnswers, question.name) })));
34
+ return inquirer.prompt(questions);
35
+ };
36
+ exports.graphql2sdl = async ({ name, source, endpoint, typePrefix, includeRootOperations, header, onConflict, }) => {
37
+ const response = await helpers_1.queryIntrospectionService({
38
+ operation: 'getSDLFromGraphQL',
39
+ variables: {
40
+ endpoint: {
41
+ type: 'String!',
42
+ value: endpoint,
43
+ },
44
+ typePrefix: {
45
+ type: 'String',
46
+ value: typePrefix || null,
47
+ },
48
+ includeRootOperations: {
49
+ type: 'Boolean',
50
+ value: includeRootOperations || null,
51
+ },
52
+ headers: {
53
+ type: '[HeaderInput!]',
54
+ value: header ? [header_1.parseHeaderNameValue(header)] : null,
55
+ },
56
+ },
57
+ });
58
+ if (response.error) {
59
+ return { error: response.error };
60
+ }
61
+ return helpers_1.writeSdlAndConfig(name || 'graphql', source, onConflict, response);
62
+ };
@@ -11,3 +11,21 @@ export declare const getSchema: (arg: string) => string;
11
11
  export declare const getTemplates: () => Promise<string>;
12
12
  export declare const askGeneratorQuestions: (id: string, settings: any, state: any) => Promise<any>;
13
13
  export declare const askTemplateQuestions: (id: string, settings: any, state: any) => Promise<any>;
14
+ export declare type IntrospectionServiceQuery = {
15
+ operation: string;
16
+ variables: {
17
+ [id: string]: {
18
+ type: string;
19
+ value: any | null;
20
+ };
21
+ };
22
+ };
23
+ export declare type IntrospectionServiceResponse = {
24
+ sdl?: string;
25
+ config?: string;
26
+ error?: string;
27
+ };
28
+ export declare const queryIntrospectionService: (query: IntrospectionServiceQuery) => Promise<IntrospectionServiceResponse>;
29
+ export declare const writeSdlAndConfig: (name: string, source: string, onConflict: 'overwrite' | 'append', { config, sdl }: IntrospectionServiceResponse) => Promise<{
30
+ outPath: string;
31
+ }>;
@@ -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.askTemplateQuestions = exports.askGeneratorQuestions = exports.getTemplates = exports.getSchema = exports.getConfiguration = exports.createGeneratorFiles = void 0;
4
+ exports.writeSdlAndConfig = exports.queryIntrospectionService = exports.askTemplateQuestions = exports.askGeneratorQuestions = exports.getTemplates = exports.getSchema = exports.getConfiguration = exports.createGeneratorFiles = void 0;
5
5
  const errors_1 = require("@oclif/errors");
6
6
  const chalk = require("chalk");
7
7
  const debug = require("debug");
@@ -12,6 +12,8 @@ const lodash_1 = require("lodash");
12
12
  const os = require("os");
13
13
  const path = require("path");
14
14
  const shell = require("shelljs");
15
+ const transpiler = require("@stepzen/transpiler");
16
+ const prettier = require("prettier");
15
17
  const constants_1 = require("../shared/constants");
16
18
  const errors_2 = require("../shared/errors");
17
19
  const { version } = require('../../package.json');
@@ -159,3 +161,86 @@ exports.askTemplateQuestions = async (id, settings, state) => {
159
161
  const answers = await inquirer.prompt(questions);
160
162
  return Object.assign(Object.assign({}, state), answers);
161
163
  };
164
+ exports.queryIntrospectionService = async (query) => {
165
+ let json;
166
+ try {
167
+ const url = `${constants_1.STEPZEN_JSON2SDL_SERVER_URL}/api/graphql`;
168
+ debug('stepzen:introspection')(url);
169
+ const queryString = `query (
170
+ ${Object.entries(query.variables).map(([id, { type }]) => `$${id}: ${type}`)}
171
+ ) {
172
+ ${query.operation}(${Object.keys(query.variables).map(id => `${id}: $${id}`)}) {
173
+ sdl
174
+ config
175
+ }
176
+ }`;
177
+ debug('stepzen:introspection')(queryString);
178
+ debug('stepzen:introspection')(query.variables);
179
+ const payload = JSON.stringify({
180
+ query: queryString,
181
+ variables: lodash_1.mapValues(query.variables, ({ value }) => value),
182
+ });
183
+ debug('stepzen:introspection')(payload);
184
+ const response = await node_fetch_1.default(url, {
185
+ method: 'POST',
186
+ headers: { 'Content-Type': 'application/json' },
187
+ body: payload,
188
+ });
189
+ const text = await response.text();
190
+ debug('stepzen:introspection')(text);
191
+ json = JSON.parse(text);
192
+ }
193
+ catch (error) {
194
+ debug('stepzen:introspection')(error);
195
+ throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
196
+ }
197
+ if (!json.data && !json.errors) {
198
+ debug('stepzen:introspection')('expected the response from the JSON introspection service ' +
199
+ 'to contain either `data` or `errors`');
200
+ throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
201
+ }
202
+ if (json.errors) {
203
+ const compileError = (error) => {
204
+ var _a;
205
+ return error.message +
206
+ (((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.details) ? `: ${error.extensions.details}` : '');
207
+ };
208
+ return { error: json.errors.map(compileError).join('\n') };
209
+ }
210
+ if (!json.data[query.operation]) {
211
+ debug('stepzen:graphql2sdl')('expected the response from the JSON introspection service ' +
212
+ `to contain a \`${query.operation}\` object`);
213
+ throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
214
+ }
215
+ const { config, sdl } = json.data[query.operation];
216
+ if (!config && !sdl) {
217
+ debug('stepzen:curl2sdl')('expected the response from the JSON introspection service ' +
218
+ `to contain at least one of \`${query.operation}.config\` or ` +
219
+ `\`${query.operation}.sdl\` properties`);
220
+ throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
221
+ }
222
+ return { config, sdl };
223
+ };
224
+ exports.writeSdlAndConfig = async (name, source, onConflict, { config, sdl }) => {
225
+ // write out the generated config and schema files
226
+ const tmp = path.join(os.tmpdir(), `stepzen-introspection-${Date.now()}`);
227
+ fs.ensureDirSync(tmp);
228
+ // fs.ensureDirSync(path.join(tmp, subfolder))
229
+ if (config) {
230
+ fs.writeFileSync(path.join(tmp, 'config.yaml'), prettier.format(config, { parser: 'yaml' }));
231
+ }
232
+ if (sdl) {
233
+ fs.writeFileSync(path.join(tmp, 'index.graphql'), prettier.format(sdl, { parser: 'graphql' }));
234
+ }
235
+ const result = await transpiler.merge(source, {
236
+ name: name,
237
+ source: tmp,
238
+ }, {
239
+ answers: {},
240
+ output: null,
241
+ silent: true,
242
+ mergeTypes: false,
243
+ onConflict,
244
+ });
245
+ return { outPath: result };
246
+ };
@@ -1,4 +1,4 @@
1
- import { HeaderInput } from '../generate/curl2sdl';
1
+ import { HeaderInput } from './header';
2
2
  import { ParseError, CurlHeader } from './curl-parser';
3
3
  export declare const parseHeaderParam: (headers: readonly CurlHeader[], headerParam: string) => {
4
4
  header: HeaderInput;
@@ -0,0 +1,21 @@
1
+ export declare type NameValueHeaderInput = {
2
+ name: string;
3
+ value: string;
4
+ };
5
+ export declare type NamePartsHeaderInput = {
6
+ name: string;
7
+ parts: HeaderInputValuePart[];
8
+ };
9
+ export declare type HeaderInput = NameValueHeaderInput | NamePartsHeaderInput;
10
+ export declare type HeaderInputConstantValuePart = {
11
+ kind: 'Constant';
12
+ value: string;
13
+ };
14
+ export declare type HeaderInputVariableValuePart = {
15
+ kind: 'Variable';
16
+ value: string;
17
+ name: string;
18
+ };
19
+ export declare type HeaderInputValuePart = HeaderInputConstantValuePart | HeaderInputVariableValuePart;
20
+ export declare const HEADER_REGEX: RegExp;
21
+ export declare const parseHeaderNameValue: (input: string) => NameValueHeaderInput | null;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // Copyright (c) 2020,2021,2022, StepZen, Inc.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.parseHeaderNameValue = exports.HEADER_REGEX = void 0;
5
+ exports.HEADER_REGEX = /([\w-]+): (.*)/;
6
+ exports.parseHeaderNameValue = (input) => {
7
+ const match = input.match(exports.HEADER_REGEX);
8
+ if (match) {
9
+ const [name, value] = match.splice(1, 2);
10
+ return { name, value };
11
+ }
12
+ return null;
13
+ };
@@ -15,10 +15,19 @@ exports.success = ({ workspace, account, port, }) => {
15
15
  const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
16
16
  const url = `https://${account}.${domain}/${workspace.endpoint}/__graphql`;
17
17
  console.log();
18
- console.log(chalk.grey(`Your API url is`, chalk.green(` ${url}`)));
19
- console.log();
20
18
  if (process.platform === 'win32') {
21
- console.log(chalk.grey(`You can explore your hosted API with GraphiQL at `), chalk.green(` http://localhost:${port}/${workspace.endpoint}`));
19
+ console.log(chalk.grey(`In PowerShell you can test your hosted API with Invoke-WebRequest:`));
20
+ console.log();
21
+ console.log(`Invoke-WebRequest \``);
22
+ console.log(` -Uri ${url} \``);
23
+ console.log(` -Method "POST" \``);
24
+ console.log(` -Headers @{`);
25
+ console.log(` "Content-Type" = "application/json"`);
26
+ console.log(` "Authorization" = "APIKey $(stepzen whoami --apikey)"`);
27
+ console.log(` } \``);
28
+ console.log(` -Body (@{`);
29
+ console.log(` "query" = '${chalk.bgYellow.black('your graphql query')}'`);
30
+ console.log(` } | ConvertTo-Json)`);
22
31
  }
23
32
  else {
24
33
  console.log(chalk.grey(`You can test your hosted API with cURL:`));
@@ -26,8 +35,10 @@ exports.success = ({ workspace, account, port, }) => {
26
35
  console.log(`curl ${url} \\`);
27
36
  console.log(` --header "Authorization: Apikey $(stepzen whoami --apikey)" \\`);
28
37
  console.log(` --header "Content-Type: application/json" \\`);
29
- console.log(` --data '{"query": "your graphql query"}'`);
30
- console.log();
31
- console.log(chalk.grey(`or explore it with GraphiQL at`), chalk.green(` http://localhost:${port}/${workspace.endpoint}`));
38
+ console.log(` --data '{"query": "${chalk.bgYellow.black('your graphql query')}"}'`);
32
39
  }
40
+ console.log();
41
+ console.log(chalk.grey(`or explore it with GraphiQL at http://localhost:${port}/${workspace.endpoint}`));
42
+ console.log();
43
+ console.log(chalk.grey(`Your API url is ${chalk.green(url)}`));
33
44
  };
@@ -4,13 +4,13 @@ const tslib_1 = require("tslib");
4
4
  // Copyright (c) 2020,2021,2022, StepZen, Inc.
5
5
  const chalk = require("chalk");
6
6
  const core_1 = require("@oclif/core");
7
+ const dotenv = require("dotenv");
7
8
  const fs = require("fs-extra");
8
9
  const path = require("path");
9
10
  const prettyMilliseconds = require("pretty-ms");
10
11
  const deploy_1 = require("../commands/deploy");
11
12
  const upload_1 = require("../commands/upload");
12
13
  const validate_1 = require("../commands/validate");
13
- const dotenv = require('dotenv');
14
14
  exports.default = async ({ workspace, flags, }) => {
15
15
  var e_1, _a;
16
16
  dotenv.config({ path: path.join(workspace.directory, '.env') });
@@ -1 +1 @@
1
- {"version":"0.17.0-beta.1","commands":{"deploy":{"id":"deploy","description":"deploy to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"configurationsets":{"name":"configurationsets","type":"option","description":"Configurationsets to use","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"schema":{"name":"schema","type":"option","description":"Schema to use","required":true},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"destination","description":"destination","required":true}]},"import":{"id":"import","description":"import a schema for an external data source or a API endpoint to your GraphQL API","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","description":"working directory"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","hidden":true,"allowNo":false},"name":{"name":"name","type":"option","description":"Subfolder inside the workspace folder to save the imported schema files to. Defaults to the name of the imported schema."},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrite any existing schema with the same name. Cannot be used without also providing a --name flag.","allowNo":false},"prefix":{"name":"prefix","type":"option","description":"[curl] prefix to add every type in the generated schema."},"query-name":{"name":"query-name","type":"option","description":"[curl] property name to add to the Query type as a way to access the imported cURL endpoint."},"query-type":{"name":"query-type","type":"option","description":"[curl] name for the type returned by the cURL endpoint in the generated schema. The name specified by --query-type is not prefixed by --prefix if both flags are present."},"path-params":{"name":"path-params","type":"option","description":"[curl] specifies path parameters in the URL path. Can be formed by taking the original path and replacing the variable segments with $paramName placeholders.\n\nExample:\nstepzen import curl https://example.com/users/jane/posts/12 --path-params '/users/$userId/posts/$postId'"},"header-param":{"name":"header-param","type":"option","description":"[curl] specifies a parameter in a header value. Can be formed by taking a -H, --header flag and replacing the variable part of the header value with a $paramName placeholder. Repeat this flag once for each header with a parameter.\n\nExample:\nstepzen import curl https://example.com/api/customers \\\n\t-H \"Authorization: apikey SecretAPIKeyValue\" \\\n\t--header-param 'Authorization: apikey $apikey'"},"db-host":{"name":"db-host","type":"option","description":"[mysql, postgresql] database host"},"db-user":{"name":"db-user","type":"option","description":"[mysql, postgresql] database user name"},"db-password":{"name":"db-password","type":"option","description":"[mysql, postgresql] database password"},"db-database":{"name":"db-database","type":"option","description":"[mysql, postgresql] name of database to import"},"db-schema":{"name":"db-schema","type":"option","description":"[postgresql] database schema"}},"args":[{"name":"schema","required":true}]},"init":{"id":"init","description":"stepzen init","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"endpoint":{"name":"endpoint","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"yes":{"name":"yes","type":"boolean","hidden":true,"allowNo":false}},"args":[{"name":"directory","hidden":true}]},"lint":{"id":"lint","description":"StepZen lint","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"list":{"id":"list","description":"list your items","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"type","description":"type","required":true,"options":["configurationsets","schemas"]}]},"login":{"id":"login","description":"log in to StepZen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"account":{"name":"account","type":"option","char":"a","hidden":true},"adminkey":{"name":"adminkey","type":"option","char":"k","hidden":true},"public":{"name":"public","type":"boolean","description":"Create a public anonymous StepZen account and use it. This is handy for trying StepZen out, but it not suitable for handling private data as all endpoints created with a public account will be public.","allowNo":false},"config":{"name":"config","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"log out of StepZen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"start":{"id":"start","description":"upload and deploy your schema","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","description":"working directory"},"endpoint":{"name":"endpoint","type":"option","description":"Override workspace endpoint"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"no-console":{"name":"no-console","type":"boolean","hidden":true,"allowNo":false},"no-dashboard":{"name":"no-dashboard","type":"boolean","hidden":true,"allowNo":false},"no-init":{"name":"no-init","type":"boolean","hidden":true,"allowNo":false},"no-validate":{"name":"no-validate","type":"boolean","hidden":true,"allowNo":false},"no-watcher":{"name":"no-watcher","type":"boolean","hidden":true,"allowNo":false},"port":{"name":"port","type":"option","default":5001}},"args":[]},"transpile":{"id":"transpile","description":"transpile a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"config":{"name":"config","type":"option","hidden":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"hide-output":{"name":"hide-output","type":"boolean","hidden":true,"allowNo":false},"inspect":{"name":"inspect","type":"boolean","char":"i","hidden":true,"allowNo":false},"inspect-after":{"name":"inspect-after","type":"boolean","hidden":true,"allowNo":false},"output-configuration":{"name":"output-configuration","type":"boolean","allowNo":false},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"folder","required":true}]},"upload":{"id":"upload","description":"upload to StepZen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"dir":{"name":"dir","type":"option","description":"A directory to upload"},"file":{"name":"file","type":"option","description":"A file to upload"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","allowNo":false}},"args":[{"name":"type","description":"type","required":true,"options":["configurationset","schema"]},{"name":"destination","description":"destination","required":true}]},"validate":{"id":"validate","description":"validate a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"folder","required":true}]},"whoami":{"id":"whoami","description":"display your credentials with StepZen whoami","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"showkeys":{"name":"showkeys","type":"boolean","allowNo":false},"apikey":{"name":"apikey","type":"boolean","allowNo":false},"adminkey":{"name":"adminkey","type":"boolean","allowNo":false}},"args":[]}}}
1
+ {"version":"0.17.0-beta.2","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":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stepzen",
3
3
  "description": "The StepZen CLI",
4
- "version": "0.17.0-beta.1",
4
+ "version": "0.17.0-beta.2",
5
5
  "license": "MIT",
6
6
  "author": "Darren Waddell <darren@stepzen.com>",
7
7
  "contributors": [