stepzen 0.13.0-beta.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commands/deploy.d.ts +11 -3
- package/lib/commands/deploy.js +5 -13
- package/lib/commands/import.d.ts +15 -3
- package/lib/commands/import.js +8 -24
- package/lib/commands/init.d.ts +10 -3
- package/lib/commands/init.js +3 -6
- package/lib/commands/lint.d.ts +9 -3
- package/lib/commands/lint.js +3 -5
- package/lib/commands/list.d.ts +8 -3
- package/lib/commands/list.js +4 -10
- package/lib/commands/login.d.ts +11 -3
- package/lib/commands/login.js +5 -19
- package/lib/commands/logout.d.ts +8 -3
- package/lib/commands/logout.js +3 -4
- package/lib/commands/start.d.ts +17 -3
- package/lib/commands/start.js +4 -19
- package/lib/commands/transpile.d.ts +14 -3
- package/lib/commands/transpile.js +3 -10
- package/lib/commands/upload.d.ts +11 -3
- package/lib/commands/upload.js +17 -17
- package/lib/commands/validate.d.ts +8 -3
- package/lib/commands/validate.js +3 -4
- package/lib/commands/whoami.d.ts +11 -3
- package/lib/commands/whoami.js +6 -10
- package/lib/generate/curl2sdl.d.ts +1 -1
- package/lib/generate/helpers.d.ts +0 -4
- package/lib/generate/helpers.js +3 -102
- package/lib/generate/index.d.ts +1 -1
- package/lib/shared/actions.d.ts +1 -1
- package/lib/shared/actions.js +2 -15
- package/lib/shared/configuration.d.ts +1 -1
- package/lib/shared/configuration.js +1 -1
- package/lib/shared/constants.d.ts +1 -1
- package/lib/shared/constants.js +2 -1
- package/lib/shared/stepzen-sdk.d.ts +8 -0
- package/lib/shared/stepzen-sdk.js +22 -1
- package/lib/shared/utils.js +1 -1
- package/lib/shared/zen-command.d.ts +15 -0
- package/lib/shared/zen-command.js +100 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -2
- package/lib/hooks/prerun/check-account.d.ts +0 -3
- package/lib/hooks/prerun/check-account.js +0 -12
package/lib/commands/validate.js
CHANGED
|
@@ -5,8 +5,9 @@ const chalk = require("chalk");
|
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
6
|
const errors_1 = require("@oclif/errors");
|
|
7
7
|
const utils_1 = require("../shared/utils");
|
|
8
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
8
9
|
const { stitch, validate } = require('@stepzen/transpiler');
|
|
9
|
-
class Validate extends
|
|
10
|
+
class Validate extends zen_command_1.default {
|
|
10
11
|
async run() {
|
|
11
12
|
const { args } = this.parse(Validate);
|
|
12
13
|
const folder = utils_1.getDirectory(args.folder);
|
|
@@ -24,9 +25,7 @@ class Validate extends command_1.Command {
|
|
|
24
25
|
exports.default = Validate;
|
|
25
26
|
Validate.description = 'validate a graphql schema';
|
|
26
27
|
Validate.hidden = true;
|
|
27
|
-
Validate.flags = {
|
|
28
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
29
|
-
};
|
|
28
|
+
Validate.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { help: command_1.flags.help({ char: 'h' }) });
|
|
30
29
|
Validate.args = [
|
|
31
30
|
{
|
|
32
31
|
name: 'folder',
|
package/lib/commands/whoami.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import ZenCommand from '../shared/zen-command';
|
|
3
|
+
export default class WhoAmI extends ZenCommand {
|
|
3
4
|
static description: string;
|
|
4
5
|
static hidden: boolean;
|
|
5
|
-
static flags:
|
|
6
|
+
static flags: {
|
|
7
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
showkeys: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
+
apikey: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
10
|
+
adminkey: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
11
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
12
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
13
|
+
};
|
|
6
14
|
static args: never[];
|
|
7
15
|
run(): Promise<void>;
|
|
8
16
|
}
|
package/lib/commands/whoami.js
CHANGED
|
@@ -5,7 +5,8 @@ const chalk = require("chalk");
|
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
6
|
const configuration_1 = require("../shared/configuration");
|
|
7
7
|
const utils_1 = require("../shared/utils");
|
|
8
|
-
|
|
8
|
+
const zen_command_1 = require("../shared/zen-command");
|
|
9
|
+
class WhoAmI extends zen_command_1.default {
|
|
9
10
|
async run() {
|
|
10
11
|
const { flags } = this.parse(WhoAmI);
|
|
11
12
|
const configuration = configuration_1.readConfiguration();
|
|
@@ -52,19 +53,14 @@ class WhoAmI extends command_1.Command {
|
|
|
52
53
|
exports.default = WhoAmI;
|
|
53
54
|
WhoAmI.description = 'stepzen whoami';
|
|
54
55
|
WhoAmI.hidden = true;
|
|
55
|
-
WhoAmI.flags = {
|
|
56
|
-
help: command_1.flags.help({ char: 'h' }),
|
|
57
|
-
showkeys: command_1.flags.boolean({
|
|
56
|
+
WhoAmI.flags = Object.assign(Object.assign({}, zen_command_1.default.flags), { help: command_1.flags.help({ char: 'h' }), showkeys: command_1.flags.boolean({
|
|
58
57
|
default: false,
|
|
59
58
|
exclusive: ['adminkey', 'apikey'],
|
|
60
|
-
}),
|
|
61
|
-
apikey: command_1.flags.boolean({
|
|
59
|
+
}), apikey: command_1.flags.boolean({
|
|
62
60
|
default: false,
|
|
63
61
|
exclusive: ['showkeys', 'adminkey'],
|
|
64
|
-
}),
|
|
65
|
-
adminkey: command_1.flags.boolean({
|
|
62
|
+
}), adminkey: command_1.flags.boolean({
|
|
66
63
|
default: false,
|
|
67
64
|
exclusive: ['showkeys', 'apikey'],
|
|
68
|
-
})
|
|
69
|
-
};
|
|
65
|
+
}) });
|
|
70
66
|
WhoAmI.args = [];
|
|
@@ -2,7 +2,7 @@ import { CurlArguments } from '../shared/curl-parser';
|
|
|
2
2
|
import { PathParam } from '../shared/path-params-parser';
|
|
3
3
|
export declare type Curl2SdlOptions = {
|
|
4
4
|
curlArgs: CurlArguments;
|
|
5
|
-
name
|
|
5
|
+
name?: string;
|
|
6
6
|
source: string;
|
|
7
7
|
queryName?: string;
|
|
8
8
|
rootType?: string;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { Answers, DistinctQuestion } from 'inquirer';
|
|
2
|
-
export declare const createGeneratorFilesDirectly: (id: string, details: any) => Promise<string>;
|
|
3
|
-
export declare const createGeneratorFilesViaStepZen: (id: string, details: any) => Promise<string>;
|
|
4
2
|
export declare const createGeneratorFiles: (id: string, details: any) => Promise<string>;
|
|
5
3
|
export declare type GeneratorConfiguration = {
|
|
6
4
|
questions: DistinctQuestion<Answers>[];
|
|
@@ -8,8 +6,6 @@ export declare type GeneratorConfiguration = {
|
|
|
8
6
|
errors: Record<string, any>;
|
|
9
7
|
status: number;
|
|
10
8
|
};
|
|
11
|
-
export declare const getConfigurationDirectly: (id: string, details?: any) => Promise<GeneratorConfiguration | null>;
|
|
12
|
-
export declare const getConfigurationViaStepZen: (id: string, details?: any) => Promise<GeneratorConfiguration | null>;
|
|
13
9
|
export declare const getConfiguration: (id: string, details?: any) => Promise<GeneratorConfiguration | null>;
|
|
14
10
|
export declare const getSchemaList: (arg: string) => string[];
|
|
15
11
|
export declare const getTemplates: () => Promise<string>;
|
package/lib/generate/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.askTemplateQuestions = exports.askGeneratorQuestions = exports.getTemplates = exports.getSchemaList = exports.getConfiguration = exports.
|
|
4
|
+
exports.askTemplateQuestions = exports.askGeneratorQuestions = exports.getTemplates = exports.getSchemaList = 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,11 +12,10 @@ 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 configuration_1 = require("../shared/configuration");
|
|
16
15
|
const constants_1 = require("../shared/constants");
|
|
17
16
|
const errors_2 = require("../shared/errors");
|
|
18
17
|
const { version } = require('../../package.json');
|
|
19
|
-
exports.
|
|
18
|
+
exports.createGeneratorFiles = async (id, details) => {
|
|
20
19
|
const url = `${constants_1.STEPZEN_DIRECT_GENERATOR_ENGINES_URL}/create`;
|
|
21
20
|
debug('stepzen:generate')(`calling the generator engine ${id} via ${url}`);
|
|
22
21
|
try {
|
|
@@ -45,49 +44,7 @@ exports.createGeneratorFilesDirectly = async (id, details) => {
|
|
|
45
44
|
throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
|
-
exports.
|
|
49
|
-
const config = configuration_1.readConfiguration();
|
|
50
|
-
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
51
|
-
const url = `https://${config.account}.${domain}/${constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT}/__graphql`;
|
|
52
|
-
debug('stepzen:generate')(`calling the generator engine ${id} via ${url}`);
|
|
53
|
-
const response = await node_fetch_1.default(url, {
|
|
54
|
-
body: JSON.stringify({
|
|
55
|
-
query: `
|
|
56
|
-
query {
|
|
57
|
-
create(id: "${id}" details: "${JSON.stringify(details.answers).replace(/"/g, '\\"')}") {
|
|
58
|
-
content
|
|
59
|
-
name
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
`,
|
|
63
|
-
}),
|
|
64
|
-
headers: {
|
|
65
|
-
Authorization: `Apikey ${config.adminkey}`,
|
|
66
|
-
'Content-Type': 'application/json',
|
|
67
|
-
'stepzen-cli-version': version,
|
|
68
|
-
'user-agent': `stepzen-cli/${version}`,
|
|
69
|
-
},
|
|
70
|
-
method: 'POST',
|
|
71
|
-
});
|
|
72
|
-
const { data, errors } = await response.json();
|
|
73
|
-
if (errors) {
|
|
74
|
-
throw new errors_1.CLIError(errors_2.formatTemporaryErrorMessage(errors));
|
|
75
|
-
}
|
|
76
|
-
const tmp = path.join(os.tmpdir(), `stepzen-generated-schema-${Date.now()}`);
|
|
77
|
-
fs.ensureDirSync(tmp);
|
|
78
|
-
for (const file of data.create) {
|
|
79
|
-
const dir = path.join(tmp, file.name);
|
|
80
|
-
fs.writeFileSync(dir, file.content);
|
|
81
|
-
}
|
|
82
|
-
return tmp;
|
|
83
|
-
};
|
|
84
|
-
exports.createGeneratorFiles = async (id, details) => {
|
|
85
|
-
const fn = constants_1.STEPZEN_DIRECT_GENERATOR_ENGINES_URL
|
|
86
|
-
? exports.createGeneratorFilesDirectly
|
|
87
|
-
: exports.createGeneratorFilesViaStepZen;
|
|
88
|
-
return fn(id, details);
|
|
89
|
-
};
|
|
90
|
-
exports.getConfigurationDirectly = async (id, details = {}) => {
|
|
47
|
+
exports.getConfiguration = async (id, details = {}) => {
|
|
91
48
|
const url = `${constants_1.STEPZEN_DIRECT_GENERATOR_ENGINES_URL}/configure`;
|
|
92
49
|
debug('stepzen:generate')(`calling the generator engine ${id} via ${url}`);
|
|
93
50
|
try {
|
|
@@ -115,62 +72,6 @@ exports.getConfigurationDirectly = async (id, details = {}) => {
|
|
|
115
72
|
throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
|
|
116
73
|
}
|
|
117
74
|
};
|
|
118
|
-
exports.getConfigurationViaStepZen = async (id, details = {}) => {
|
|
119
|
-
const config = configuration_1.readConfiguration();
|
|
120
|
-
const domain = constants_1.STEPZEN_DOMAIN.replace('.io', '.net');
|
|
121
|
-
const url = `https://${config.account}.${domain}/${constants_1.STEPZEN_GENERATOR_ENGINES_ENDPOINT}/__graphql`;
|
|
122
|
-
debug('stepzen:generate')(`calling the generator engine ${id} via ${url}`);
|
|
123
|
-
const response = await node_fetch_1.default(url, {
|
|
124
|
-
body: JSON.stringify({
|
|
125
|
-
query: `
|
|
126
|
-
query {
|
|
127
|
-
configure(id: "${id}" details: "${JSON.stringify(details).replace(/"/g, '\\"')}") {
|
|
128
|
-
answers
|
|
129
|
-
errors
|
|
130
|
-
questions
|
|
131
|
-
status
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
`,
|
|
135
|
-
}),
|
|
136
|
-
headers: {
|
|
137
|
-
Authorization: `Apikey ${config.adminkey}`,
|
|
138
|
-
'Content-Type': 'application/json',
|
|
139
|
-
'stepzen-cli-version': version,
|
|
140
|
-
'user-agent': `stepzen-cli/${version}`,
|
|
141
|
-
},
|
|
142
|
-
method: 'POST',
|
|
143
|
-
});
|
|
144
|
-
const { data, errors } = await response.json();
|
|
145
|
-
if (errors) {
|
|
146
|
-
return {
|
|
147
|
-
questions: [],
|
|
148
|
-
answers: {},
|
|
149
|
-
status: -1,
|
|
150
|
-
errors: {
|
|
151
|
-
error: errors[0].message,
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
if (data.configure) {
|
|
157
|
-
data.configure.answers = JSON.parse(data.configure.answers);
|
|
158
|
-
data.configure.errors = JSON.parse(data.configure.errors);
|
|
159
|
-
data.configure.questions = JSON.parse(data.configure.questions);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
debug('stepzen:response')(error);
|
|
164
|
-
throw new errors_1.CLIError(errors_2.PERMANENT_STEPZEN_ERROR);
|
|
165
|
-
}
|
|
166
|
-
return data.configure;
|
|
167
|
-
};
|
|
168
|
-
exports.getConfiguration = async (id, details = {}) => {
|
|
169
|
-
const fn = constants_1.STEPZEN_DIRECT_GENERATOR_ENGINES_URL
|
|
170
|
-
? exports.getConfigurationDirectly
|
|
171
|
-
: exports.getConfigurationViaStepZen;
|
|
172
|
-
return fn(id, details);
|
|
173
|
-
};
|
|
174
75
|
exports.getSchemaList = (arg) => {
|
|
175
76
|
const schemas = arg.split(',').map((schema) => schema.trim());
|
|
176
77
|
// Make sure they're unique, otherwise, complain
|
package/lib/generate/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: (schemas: any, name: string, source: string) => Promise<string>;
|
|
1
|
+
declare const _default: (schemas: any, name: string | undefined, source: string) => Promise<string>;
|
|
2
2
|
export default _default;
|
package/lib/shared/actions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ZenCtlResponse } from './types';
|
|
2
2
|
export declare const deploy: (destination: string, configurationsets: string | undefined, schema: string) => Promise<ZenCtlResponse>;
|
|
3
3
|
export declare const list: (type: 'configurationsets' | 'schemas') => Promise<ZenCtlResponse>;
|
|
4
|
-
export declare const upload: (type:
|
|
4
|
+
export declare const upload: (type: 'configurationset' | 'schema', destination: string, source: string) => Promise<any>;
|
package/lib/shared/actions.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.upload = exports.list = exports.deploy = void 0;
|
|
5
|
-
// This file contains 'actions' - calls to zenctl
|
|
6
|
-
const errors_1 = require("@oclif/errors");
|
|
7
5
|
const configuration_1 = require("./configuration");
|
|
8
6
|
const constants_1 = require("./constants");
|
|
9
7
|
const stepzen_sdk_1 = require("./stepzen-sdk");
|
|
@@ -33,7 +31,7 @@ exports.list = async (type) => {
|
|
|
33
31
|
});
|
|
34
32
|
return client.list[type]();
|
|
35
33
|
};
|
|
36
|
-
exports.upload = async (type, destination,
|
|
34
|
+
exports.upload = async (type, destination, source) => {
|
|
37
35
|
const config = configuration_1.readConfiguration();
|
|
38
36
|
const server = constants_1.STEPZEN_SERVER_URL.replace('{account}', config.account);
|
|
39
37
|
const client = await stepzen_sdk_1.default.client({
|
|
@@ -42,16 +40,5 @@ exports.upload = async (type, destination, file, directory) => {
|
|
|
42
40
|
domain: constants_1.STEPZEN_DOMAIN,
|
|
43
41
|
server,
|
|
44
42
|
});
|
|
45
|
-
|
|
46
|
-
if (!file) {
|
|
47
|
-
throw new errors_1.CLIError('Please specify a source file with the --file flag');
|
|
48
|
-
}
|
|
49
|
-
return client.upload.configurationset(destination, file);
|
|
50
|
-
}
|
|
51
|
-
if (type === 'schema') {
|
|
52
|
-
if (!directory) {
|
|
53
|
-
throw new errors_1.CLIError('Please specify a source directory with the --dir flag');
|
|
54
|
-
}
|
|
55
|
-
return client.upload.schema(destination, directory);
|
|
56
|
-
}
|
|
43
|
+
return client.upload[type](destination, source);
|
|
57
44
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MachineConfiguration } from './types';
|
|
2
|
-
export declare const readConfiguration: () => MachineConfiguration |
|
|
2
|
+
export declare const readConfiguration: () => MachineConfiguration | null;
|
|
3
3
|
export declare const importConfiguration: (filepath: string) => MachineConfiguration;
|
|
4
4
|
export declare const removeConfigurationFromLoginFile: () => boolean;
|
|
5
5
|
export declare const writeConfigurationToLoginFile: (configuration: MachineConfiguration) => MachineConfiguration;
|
|
@@ -5,7 +5,7 @@ export declare const STEPZEN_DOMAIN: string;
|
|
|
5
5
|
export declare const STEPZEN_SERVER_URL: string;
|
|
6
6
|
export declare const STEPZEN_GENERATOR_ENGINES_SCHEMA: string;
|
|
7
7
|
export declare const STEPZEN_GENERATOR_ENGINES_ENDPOINT = "stepzen-generator/engines";
|
|
8
|
-
export declare const STEPZEN_DIRECT_GENERATOR_ENGINES_URL: string
|
|
8
|
+
export declare const STEPZEN_DIRECT_GENERATOR_ENGINES_URL: string;
|
|
9
9
|
export declare const STEPZEN_API_TEMPLATES_REPOSITORY = "https://github.com/steprz/stepzen-schemas";
|
|
10
10
|
export declare const ADMIN_DEPLOY_URL = "/cli/admin/deploy";
|
|
11
11
|
export declare const ADMIN_LIST_URL = "/cli/admin/list";
|
package/lib/shared/constants.js
CHANGED
|
@@ -24,7 +24,8 @@ exports.STEPZEN_GENERATOR_ENGINES_SCHEMA = ENV_VAR_STEPZEN_GENERATOR_ENGINES_SCH
|
|
|
24
24
|
// Generator Engines schema: target API endpoint
|
|
25
25
|
exports.STEPZEN_GENERATOR_ENGINES_ENDPOINT = 'stepzen-generator/engines';
|
|
26
26
|
// If defined, call the generator engines cloud function directly, skipping zenctl
|
|
27
|
-
exports.STEPZEN_DIRECT_GENERATOR_ENGINES_URL = ENV_VAR_STEPZEN_DIRECT_GENERATOR_ENGINES_URL
|
|
27
|
+
exports.STEPZEN_DIRECT_GENERATOR_ENGINES_URL = ENV_VAR_STEPZEN_DIRECT_GENERATOR_ENGINES_URL ||
|
|
28
|
+
'https://us-central1-stepzen-functions.cloudfunctions.net/generator-engine';
|
|
28
29
|
// API Templates repository
|
|
29
30
|
exports.STEPZEN_API_TEMPLATES_REPOSITORY = 'https://github.com/steprz/stepzen-schemas';
|
|
30
31
|
// Paths to the endpoints used (only for tests)
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
declare const stepzen: {
|
|
2
|
+
login: (adminkey: string, account?: string) => Promise<{
|
|
3
|
+
account: string;
|
|
4
|
+
adminkey: string;
|
|
5
|
+
}>;
|
|
6
|
+
createAnonymousAccount: () => {
|
|
7
|
+
account: string;
|
|
8
|
+
adminkey: string;
|
|
9
|
+
};
|
|
2
10
|
verify: (account: string, adminkey: string) => Promise<boolean>;
|
|
3
11
|
client: (options: Pick<import("@stepzen/sdk").StepZenAccount, "account" | "adminkey"> & Partial<import("@stepzen/sdk").StepZenAccount>) => Promise<{
|
|
4
12
|
account: () => Promise<{
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const errors_1 = require("@oclif/errors");
|
|
4
5
|
const sdk_1 = require("@stepzen/sdk");
|
|
5
6
|
const { version } = require('../../package.json');
|
|
6
|
-
const stepzen = sdk_1.init({ appName: `stepzen-cli/${version}` })
|
|
7
|
+
const stepzen = Object.assign(Object.assign({}, sdk_1.init({ appName: `stepzen-cli/${version}` })), { login: async (adminkey, account = adminkey.split(':')[0]) => {
|
|
8
|
+
// Check whether the account and admin key exist and are correct by calling
|
|
9
|
+
// the stepzen admin api.
|
|
10
|
+
const isValidConfiguration = await stepzen.verify(account, adminkey);
|
|
11
|
+
if (!isValidConfiguration) {
|
|
12
|
+
// Exit, with error
|
|
13
|
+
throw new errors_1.CLIError('We are unable to verify your account details. Could you please check them?');
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
account,
|
|
17
|
+
adminkey,
|
|
18
|
+
};
|
|
19
|
+
}, createAnonymousAccount: () => {
|
|
20
|
+
const anonAdminKey = process.env.STEPZEN_ANONYMOUS_ADMINKEY ||
|
|
21
|
+
// LATER: call the actual API (pending https://github.com/steprz/zen/issues/5545)
|
|
22
|
+
'test::steprz.io+666::test';
|
|
23
|
+
return {
|
|
24
|
+
account: anonAdminKey.split(':')[0],
|
|
25
|
+
adminkey: anonAdminKey,
|
|
26
|
+
};
|
|
27
|
+
} });
|
|
7
28
|
exports.default = stepzen;
|
package/lib/shared/utils.js
CHANGED
|
@@ -52,7 +52,7 @@ exports.clearConsole = () => {
|
|
|
52
52
|
exports.ensureApiKey = async () => {
|
|
53
53
|
const configuration = configuration_1.readConfiguration();
|
|
54
54
|
const details = configuration;
|
|
55
|
-
if (!details.apikey) {
|
|
55
|
+
if (details && !details.apikey) {
|
|
56
56
|
debug('stepzen:account')(`Fetching API key for account ${details.account}`);
|
|
57
57
|
try {
|
|
58
58
|
const client = await stepzen_sdk_1.default.client(details);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command, flags } from '@oclif/command';
|
|
2
|
+
import { MachineConfiguration } from './types';
|
|
3
|
+
export declare abstract class ZenCommand extends Command {
|
|
4
|
+
static flags: {
|
|
5
|
+
'non-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
6
|
+
'enable-login-prompt': flags.IOptionFlag<boolean | undefined>;
|
|
7
|
+
};
|
|
8
|
+
ensureStepZenAccount(): Promise<{
|
|
9
|
+
configuration: MachineConfiguration;
|
|
10
|
+
}>;
|
|
11
|
+
promptUserToLogIn(): Promise<{
|
|
12
|
+
configuration: MachineConfiguration;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export default ZenCommand;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ZenCommand = void 0;
|
|
5
|
+
const command_1 = require("@oclif/command");
|
|
6
|
+
const errors_1 = require("@oclif/errors");
|
|
7
|
+
const inquirer = require("inquirer");
|
|
8
|
+
const chalk = require("chalk");
|
|
9
|
+
const configuration_1 = require("./configuration");
|
|
10
|
+
const stepzen_sdk_1 = require("./stepzen-sdk");
|
|
11
|
+
class ZenCommand extends command_1.Command {
|
|
12
|
+
async ensureStepZenAccount() {
|
|
13
|
+
const configuration = configuration_1.readConfiguration();
|
|
14
|
+
if (configuration && configuration.account) {
|
|
15
|
+
return {
|
|
16
|
+
configuration,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const TheCommand = this.constructor;
|
|
20
|
+
const { flags } = this.parse(TheCommand);
|
|
21
|
+
if (flags['enable-login-prompt']) {
|
|
22
|
+
return this.promptUserToLogIn();
|
|
23
|
+
}
|
|
24
|
+
throw new errors_1.CLIError('Could not find StepZen account credentials.' +
|
|
25
|
+
' Please run `stepzen login` first.');
|
|
26
|
+
}
|
|
27
|
+
async promptUserToLogIn() {
|
|
28
|
+
this.log(chalk.bold(chalk.cyan('Welcome to StepZen CLI!')));
|
|
29
|
+
this.log('');
|
|
30
|
+
this.log(`Please log in with your StepZen account to make your GraphQL API private.` +
|
|
31
|
+
` All APIs created without logging in will be public.`);
|
|
32
|
+
this.log('');
|
|
33
|
+
const answers = await inquirer.prompt([
|
|
34
|
+
{
|
|
35
|
+
message: 'How would you like to continue?',
|
|
36
|
+
name: 'loginPath',
|
|
37
|
+
type: 'list',
|
|
38
|
+
choices: [
|
|
39
|
+
'Log in via stepzen.com',
|
|
40
|
+
'Continue without logging in (make your API public)',
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
let configuration = null;
|
|
45
|
+
if (answers.loginPath === 'Log in via stepzen.com') {
|
|
46
|
+
const answers = await inquirer.prompt([
|
|
47
|
+
{
|
|
48
|
+
message: 'What is your Admin Key?',
|
|
49
|
+
name: 'adminkey',
|
|
50
|
+
type: 'password',
|
|
51
|
+
validate: async (value) => {
|
|
52
|
+
try {
|
|
53
|
+
await stepzen_sdk_1.default.login(value);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return `${error}`;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
suffix: chalk.blue(` (available at ${chalk.bold('https://stepzen.com/account')})`),
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
configuration = await stepzen_sdk_1.default.login(answers.adminkey);
|
|
64
|
+
configuration_1.writeConfigurationToLoginFile(configuration);
|
|
65
|
+
this.log('You have successfully logged in.');
|
|
66
|
+
this.log('');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
configuration = await stepzen_sdk_1.default.createAnonymousAccount();
|
|
70
|
+
configuration_1.writeConfigurationToLoginFile(configuration);
|
|
71
|
+
this.log(`We've created a temporary public account for you.\nAll endpoints` +
|
|
72
|
+
` deployed to this account will be automatically deleted after 24` +
|
|
73
|
+
` hours. You can log in with your regular StepZen account at any` +
|
|
74
|
+
` time by running ${chalk.bold('stepzen login')}.`);
|
|
75
|
+
this.log('');
|
|
76
|
+
}
|
|
77
|
+
return { configuration };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.ZenCommand = ZenCommand;
|
|
81
|
+
ZenCommand.flags = {
|
|
82
|
+
'non-interactive': command_1.flags.boolean({
|
|
83
|
+
description: 'disable all interactive prompts',
|
|
84
|
+
hidden: true,
|
|
85
|
+
}),
|
|
86
|
+
// The flag type has to be `option` (not `boolean`) for `env` to take effect
|
|
87
|
+
'enable-login-prompt': command_1.flags.option({
|
|
88
|
+
description: 'An (internal) feature flag to enable the "prompt user to log in"' +
|
|
89
|
+
' feature for the users who run the CLI without being logged in. It' +
|
|
90
|
+
' is intentially hidden and not documented because in the future' +
|
|
91
|
+
' this feature will be enabled for all users and the flag will be' +
|
|
92
|
+
' removed.',
|
|
93
|
+
hidden: true,
|
|
94
|
+
options: ['true', 'false'],
|
|
95
|
+
parse: value => Boolean(value),
|
|
96
|
+
default: false,
|
|
97
|
+
env: 'STEPZEN_ENABLE_LOGIN_PROMPT',
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
exports.default = ZenCommand;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.13.0-beta.1","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 a schema for an external data source or a API endpoint to your GraphQL API.","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":[]}}}
|
|
1
|
+
{"version":"0.13.0","commands":{"deploy":{"id":"deploy","description":"deploy to stepzen","pluginName":"stepzen","pluginType":"core","aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":false},"dir":{"name":"dir","type":"option","description":"working directory"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"silent":{"name":"silent","type":"boolean","hidden":true,"allowNo":false},"name":{"name":"name","type":"option","description":"subfolder inside the workspace folder to save the imported schema files, defaults to the imported schema name"},"prefix":{"name":"prefix","type":"option","description":"[curl] prefix to add every type in the generated schema."},"query-name":{"name":"query-name","type":"option","description":"[curl] property name to add to the Query type as a way to access the imported cURL endpoint."},"query-type":{"name":"query-type","type":"option","description":"[curl] name for the type returned by the cURL endpoint in the generated schema. The name specified by --query-type is not prefixed by --prefix if both flags are present."},"path-params":{"name":"path-params","type":"option","description":"[curl] specifies path parameters in the URL path. Can be formed by taking the original path and replacing the variable segments with $paramName placeholders.\n\nExample:\nstepzen import curl https://example.com/users/jane/posts/12 --path-params '/users/$userId/posts/$postId'"}},"args":[{"name":"schemas","required":true}]},"init":{"id":"init","description":"stepzen init","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":false},"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":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":false},"dir":{"name":"dir","type":"option","description":"working directory"},"endpoint":{"name":"endpoint","type":"option","description":"Override workspace endpoint"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"no-console":{"name":"no-console","type":"boolean","hidden":true,"allowNo":false},"no-dashboard":{"name":"no-dashboard","type":"boolean","hidden":true,"allowNo":false},"no-init":{"name":"no-init","type":"boolean","hidden":true,"allowNo":false},"no-server":{"name":"no-server","type":"boolean","hidden":true,"allowNo":false},"no-validate":{"name":"no-validate","type":"boolean","hidden":true,"allowNo":false},"no-watcher":{"name":"no-watcher","type":"boolean","hidden":true,"allowNo":false},"port":{"name":"port","type":"option","default":5001}},"args":[]},"transpile":{"id":"transpile","description":"transpile a graphql schema","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"folder","required":true}]},"whoami":{"id":"whoami","description":"stepzen whoami","pluginName":"stepzen","pluginType":"core","hidden":true,"aliases":[],"flags":{"non-interactive":{"name":"non-interactive","type":"boolean","description":"disable all interactive prompts","hidden":true,"allowNo":false},"enable-login-prompt":{"name":"enable-login-prompt","type":"option","description":"An (internal) feature flag to enable the \"prompt user to log in\" feature for the users who run the CLI without being logged in. It is intentially hidden and not documented because in the future this feature will be enabled for all users and the flag will be removed.","hidden":true,"options":["true","false"],"default":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.13.0
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Darren Waddell <darren@stepzen.com>",
|
|
7
7
|
"contributors": [
|
|
@@ -106,7 +106,6 @@
|
|
|
106
106
|
],
|
|
107
107
|
"hooks": {
|
|
108
108
|
"prerun": [
|
|
109
|
-
"./lib/hooks/prerun/check-account",
|
|
110
109
|
"./lib/hooks/prerun/check-upgrade",
|
|
111
110
|
"./lib/hooks/prerun/ensure-api-key",
|
|
112
111
|
"./lib/hooks/prerun/ensure-permissions"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) 2020,2021,2022, StepZen, Inc.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const utils_1 = require("../../shared/utils");
|
|
5
|
-
const hook = async function ({ Command: { id } }) {
|
|
6
|
-
const CHECK_COMMANDS = ['deploy', 'start', 'upload'];
|
|
7
|
-
if (CHECK_COMMANDS.includes(id) === false) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
await utils_1.checkAuth();
|
|
11
|
-
};
|
|
12
|
-
exports.default = hook;
|