zcatalyst-cli 1.26.1 → 1.27.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 -0
- package/lib/appsail-utils.d.ts +1 -1
- package/lib/appsail-utils.js +170 -129
- package/lib/authentication/credential.d.ts +2 -1
- package/lib/authentication/credential.js +20 -3
- package/lib/authentication/crypt.d.ts +7 -3
- package/lib/authentication/crypt.js +87 -16
- package/lib/authentication/index.js +1 -0
- package/lib/authentication/key-manager.d.ts +7 -0
- package/lib/authentication/key-manager.js +62 -0
- package/lib/authentication/login.js +20 -20
- package/lib/bin/catalyst.js +1 -15
- package/lib/client.d.ts +3 -1
- package/lib/client.js +16 -5
- package/lib/command_needs/rc.js +13 -3
- package/lib/commands/appsail/add.js +10 -0
- package/lib/commands/client/delete.js +18 -6
- package/lib/commands/client/setup.js +7 -0
- package/lib/commands/deploy/index.js +3 -3
- package/lib/commands/deploy/slate.js +65 -4
- package/lib/commands/functions/add.js +7 -0
- package/lib/commands/functions/delete.js +22 -4
- package/lib/commands/functions/execute.js +39 -71
- package/lib/commands/functions/setup.js +13 -0
- package/lib/commands/functions/shell.js +15 -1
- package/lib/commands/iac/import.js +2 -2
- package/lib/commands/init.js +34 -20
- package/lib/commands/login.js +1 -0
- package/lib/commands/pull.js +22 -1
- package/lib/commands/serve.js +2 -1
- package/lib/commands/slate/create.js +7 -4
- package/lib/commands/slate/link.js +11 -5
- package/lib/commands/slate/unlink.js +7 -0
- package/lib/commands/zest/generate/index.js +28 -35
- package/lib/deploy/features/appsail/index.js +2 -1
- package/lib/deploy/features/slate.d.ts +3 -1
- package/lib/deploy/features/slate.js +204 -5
- package/lib/docs/client-utils.toml +0 -5
- package/lib/docs/command_needs/rc.toml +9 -1
- package/lib/docs/commands/client/delete.toml +4 -0
- package/lib/docs/commands/deploy/slate.toml +3 -0
- package/lib/docs/commands/functions/delete.toml +10 -0
- package/lib/docs/commands/functions/execute.toml +1 -16
- package/lib/docs/commands/functions/setup.toml +3 -0
- package/lib/docs/commands/functions/shell.toml +8 -0
- package/lib/docs/commands/init.toml +3 -0
- package/lib/docs/commands/pull.toml +6 -0
- package/lib/docs/commands/slate/unlink.toml +6 -0
- package/lib/docs/execute/command-utils.toml +14 -0
- package/lib/docs/execute/execute-input-resolver.toml +37 -0
- package/lib/docs/init/features/project.toml +20 -0
- package/lib/docs/init/util/client.toml +4 -0
- package/lib/docs/prompt/index.toml +15 -0
- package/lib/docs/pull/features/apig.toml +6 -0
- package/lib/docs/pull/features/client.toml +20 -0
- package/lib/docs/pull/features/functions/index.toml +24 -0
- package/lib/endpoints/lib/slate.d.ts +14 -1
- package/lib/endpoints/lib/slate.js +35 -0
- package/lib/error/context-help.js +1 -1
- package/lib/error/index.js +9 -13
- package/lib/execute/command-utils.d.ts +5 -0
- package/lib/execute/command-utils.js +86 -0
- package/lib/execute/execute-input-resolver.d.ts +29 -0
- package/lib/execute/execute-input-resolver.js +207 -0
- package/lib/execute/index.d.ts +4 -1
- package/lib/execute/index.js +3 -2
- package/lib/fn-utils/lib/integ.js +22 -17
- package/lib/index.js +1 -0
- package/lib/init/dependencies/package-json.js +11 -7
- package/lib/init/features/appsail/index.js +75 -26
- package/lib/init/features/appsail/prompt-fields.d.ts +43 -0
- package/lib/init/features/appsail/prompt-fields.js +55 -0
- package/lib/init/features/appsail/utils/custom-runtime.d.ts +3 -0
- package/lib/init/features/appsail/utils/custom-runtime.js +161 -0
- package/lib/init/features/appsail/{utils.d.ts → utils/index.d.ts} +2 -2
- package/lib/init/features/appsail/utils/index.js +170 -0
- package/lib/init/features/client/index.js +4 -3
- package/lib/init/features/client/initializers/angular.js +3 -2
- package/lib/init/features/client/initializers/react.js +4 -3
- package/lib/init/features/client/prompt-fields.d.ts +37 -0
- package/lib/init/features/client/prompt-fields.js +48 -0
- package/lib/init/features/functions/index.js +37 -8
- package/lib/init/features/functions/languages/java.js +42 -7
- package/lib/init/features/functions/languages/node.js +42 -10
- package/lib/init/features/functions/languages/python.js +42 -7
- package/lib/init/features/functions/prompt-fields.d.ts +25 -0
- package/lib/init/features/functions/prompt-fields.js +34 -0
- package/lib/init/features/project.js +41 -6
- package/lib/init/features/slate/index.js +2 -0
- package/lib/init/features/slate/prompt-fields.d.ts +31 -0
- package/lib/init/features/slate/prompt-fields.js +41 -0
- package/lib/init/index.js +2 -1
- package/lib/init/util/client.js +11 -8
- package/lib/init/util/common.d.ts +2 -0
- package/lib/init/util/common.js +33 -3
- package/lib/init/util/prompt-fields.d.ts +7 -0
- package/lib/init/util/prompt-fields.js +13 -0
- package/lib/internal/command.d.ts +3 -0
- package/lib/internal/command.js +26 -3
- package/lib/migration/global/1.27.0.d.ts +2 -0
- package/lib/migration/global/1.27.0.js +39 -0
- package/lib/prompt/choice.d.ts +2 -0
- package/lib/prompt/choice.js +24 -0
- package/lib/prompt/cli-option-key.d.ts +1 -0
- package/lib/prompt/cli-option-key.js +10 -0
- package/lib/prompt/index.d.ts +6 -22
- package/lib/prompt/index.js +264 -67
- package/lib/prompt/overwrite-prompt.d.ts +11 -0
- package/lib/prompt/overwrite-prompt.js +16 -0
- package/lib/prompt/question-factory.d.ts +34 -0
- package/lib/prompt/question-factory.js +41 -0
- package/lib/prompt/register-fields.d.ts +24 -0
- package/lib/prompt/register-fields.js +37 -0
- package/lib/pull/features/apig.js +57 -6
- package/lib/pull/features/client.js +107 -24
- package/lib/pull/features/functions/index.js +100 -4
- package/lib/pull/index.js +1 -1
- package/lib/pull/utils.d.ts +13 -0
- package/lib/pull/utils.js +20 -0
- package/lib/repl-server.d.ts +4 -0
- package/lib/repl-server.js +9 -0
- package/lib/serve/features/appsail.js +2 -45
- package/lib/serve/server/lib/master/index.js +3 -3
- package/lib/serve/server/lib/slate/static-server.js +2 -2
- package/lib/serve/server/lib/web_client/server.js +2 -2
- package/lib/shell/format-functions.d.ts +4 -0
- package/lib/shell/format-functions.js +59 -0
- package/lib/shell/index.js +18 -0
- package/lib/util_modules/config/lib/appsail.d.ts +3 -2
- package/lib/util_modules/config/lib/appsail.js +21 -5
- package/lib/util_modules/config/lib/slate.d.ts +19 -0
- package/lib/util_modules/config-store.d.ts +1 -0
- package/lib/util_modules/config-store.js +29 -10
- package/lib/util_modules/constants/index.d.ts +0 -1
- package/lib/util_modules/constants/index.js +1 -3
- package/lib/util_modules/constants/lib/urls.d.ts +2 -0
- package/lib/util_modules/constants/lib/urls.js +4 -0
- package/lib/util_modules/dc.d.ts +6 -1
- package/lib/util_modules/dc.js +21 -8
- package/lib/util_modules/env.d.ts +3 -0
- package/lib/util_modules/env.js +41 -0
- package/lib/util_modules/fs/lib/sync.d.ts +1 -0
- package/lib/util_modules/fs/lib/sync.js +19 -0
- package/lib/util_modules/logger/utils.d.ts +1 -0
- package/lib/util_modules/logger/utils.js +5 -1
- package/lib/util_modules/option.d.ts +1 -0
- package/lib/util_modules/option.js +8 -0
- package/lib/util_modules/{server.js → server/index.js} +3 -3
- package/lib/util_modules/server/needed-scopes.d.ts +1 -0
- package/lib/util_modules/{constants/lib → server}/needed-scopes.js +7 -7
- package/package.json +3 -2
- package/lib/init/features/appsail/utils.js +0 -273
- package/lib/util_modules/constants/lib/needed-scopes.d.ts +0 -4
- /package/lib/docs/{dc.toml → util_modules/dc.toml} +0 -0
- /package/lib/util_modules/{server.d.ts → server/index.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IQuestion, PromptFieldHandle } from './index';
|
|
2
|
+
type OverwriteResource = 'Directory' | 'File';
|
|
3
|
+
interface OverwritePromptOpts {
|
|
4
|
+
fieldOrName?: string | PromptFieldHandle;
|
|
5
|
+
resourceName: string;
|
|
6
|
+
resourceType?: OverwriteResource;
|
|
7
|
+
contextText?: string;
|
|
8
|
+
defaultAns?: boolean | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const overwritePromptQuestion: ({ fieldOrName, resourceName, resourceType, contextText, defaultAns }: OverwritePromptOpts) => IQuestion;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.overwritePromptQuestion = void 0;
|
|
4
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
5
|
+
const question_factory_1 = require("./question-factory");
|
|
6
|
+
const overwritePromptQuestion = ({ fieldOrName = 'overwrite', resourceName, resourceType = 'Directory', contextText = '', defaultAns = false }) => {
|
|
7
|
+
const messageSuffix = contextText ? ` ${contextText}` : '';
|
|
8
|
+
const qOpts = {
|
|
9
|
+
type: 'confirm'
|
|
10
|
+
};
|
|
11
|
+
if (defaultAns !== null) {
|
|
12
|
+
qOpts['defaultAns'] = defaultAns;
|
|
13
|
+
}
|
|
14
|
+
return (0, question_factory_1.buildQuestion)(fieldOrName, `${resourceType} ${(0, ansi_colors_1.underline)(resourceName)} already exists${messageSuffix}. Overwrite ?`, qOpts);
|
|
15
|
+
};
|
|
16
|
+
exports.overwritePromptQuestion = overwritePromptQuestion;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import Separator from 'inquirer/lib/objects/separator';
|
|
3
|
+
import { PromptFieldHandle } from './register-fields';
|
|
4
|
+
import type { TreeData, TreeNode } from './types/tree';
|
|
5
|
+
import CatalystError from '../error';
|
|
6
|
+
export interface IChoice extends inquirer.ChoiceOptions, inquirer.ListChoiceOptions, inquirer.CheckboxChoiceOptions {
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IQuestion extends inquirer.Question, inquirer.ListQuestionOptions {
|
|
10
|
+
fieldOrName: string | PromptFieldHandle;
|
|
11
|
+
type?: inquirer.QuestionTypeName | 'file-path' | 'tree' | 'search-box' | 'with-desc';
|
|
12
|
+
defaultAns?: unknown;
|
|
13
|
+
choices?: Array<IChoice | TSeparator> | Array<string | TSeparator>;
|
|
14
|
+
treeChoices?: Array<TreeNode | TreeData>;
|
|
15
|
+
rootPath?: string;
|
|
16
|
+
exclude?: Array<string>;
|
|
17
|
+
excludeDir?: boolean;
|
|
18
|
+
ignoreFiles?: boolean;
|
|
19
|
+
depth?: number;
|
|
20
|
+
empTxt?: string;
|
|
21
|
+
validatingText?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
searchable?: boolean;
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
highlight?: boolean;
|
|
26
|
+
notFoundMsg?: string;
|
|
27
|
+
searchMsg?: string;
|
|
28
|
+
boxType?: string;
|
|
29
|
+
source?: (answersSoFar: unknown, input: string | undefined) => Promise<unknown> | unknown;
|
|
30
|
+
niInputMissingError?: CatalystError | string;
|
|
31
|
+
}
|
|
32
|
+
export type TSeparator = Separator;
|
|
33
|
+
export declare function getQuestionPromptName(question: IQuestion): string;
|
|
34
|
+
export declare function buildQuestion(fieldOrName: string | PromptFieldHandle, messageText: string, { type, defaultAns, choices, validate, filter, when, prefix, suffix, ...otheropts }?: Omit<IQuestion, 'name' | 'fieldOrName'>): IQuestion;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.getQuestionPromptName = getQuestionPromptName;
|
|
15
|
+
exports.buildQuestion = buildQuestion;
|
|
16
|
+
const choice_1 = require("./choice");
|
|
17
|
+
const register_fields_1 = require("./register-fields");
|
|
18
|
+
function getQuestionPromptName(question) {
|
|
19
|
+
return question.fieldOrName instanceof register_fields_1.PromptFieldHandle
|
|
20
|
+
? question.fieldOrName.promptName
|
|
21
|
+
: question.fieldOrName;
|
|
22
|
+
}
|
|
23
|
+
function buildQuestion(fieldOrName, messageText, _a = {}) {
|
|
24
|
+
var { type = 'input', defaultAns, choices = [], validate = () => {
|
|
25
|
+
return true;
|
|
26
|
+
}, filter = (ans) => {
|
|
27
|
+
return ans;
|
|
28
|
+
}, when = () => {
|
|
29
|
+
return true;
|
|
30
|
+
}, prefix = '', suffix = '' } = _a, otheropts = __rest(_a, ["type", "defaultAns", "choices", "validate", "filter", "when", "prefix", "suffix"]);
|
|
31
|
+
if (choices.length > 0 && typeof choices[0] === 'string') {
|
|
32
|
+
choices = choices.map((strChoice) => (0, choice_1.choice)(strChoice));
|
|
33
|
+
}
|
|
34
|
+
return Object.assign({ type,
|
|
35
|
+
fieldOrName, message: messageText, default: defaultAns, choices,
|
|
36
|
+
validate,
|
|
37
|
+
filter,
|
|
38
|
+
when,
|
|
39
|
+
prefix,
|
|
40
|
+
suffix }, otheropts);
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type PromptFieldDef = {
|
|
2
|
+
name: string;
|
|
3
|
+
cliOption: {
|
|
4
|
+
description: string;
|
|
5
|
+
option: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export type PromptFieldNames<T extends ReadonlyArray<PromptFieldDef>> = T[number]['name'];
|
|
9
|
+
export type DefinedPromptFields<T extends ReadonlyArray<PromptFieldDef>> = PromptFieldsRegistry<T>;
|
|
10
|
+
export declare class PromptFieldHandle<F extends PromptFieldDef = PromptFieldDef> extends Array<string> {
|
|
11
|
+
readonly def: F;
|
|
12
|
+
constructor(def: F);
|
|
13
|
+
get optKey(): string;
|
|
14
|
+
get promptName(): string;
|
|
15
|
+
toCliOpts(): [string, string];
|
|
16
|
+
}
|
|
17
|
+
export declare class PromptFieldsRegistry<T extends ReadonlyArray<PromptFieldDef>> {
|
|
18
|
+
readonly map: Map<string, PromptFieldHandle<PromptFieldDef>>;
|
|
19
|
+
constructor(fields: T);
|
|
20
|
+
get<K extends PromptFieldNames<T>>(name: K): PromptFieldHandle<Extract<T[number], {
|
|
21
|
+
name: K;
|
|
22
|
+
}>>;
|
|
23
|
+
}
|
|
24
|
+
export declare function definePromptFields<T extends ReadonlyArray<PromptFieldDef>>(fields: T): PromptFieldsRegistry<T>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PromptFieldsRegistry = exports.PromptFieldHandle = void 0;
|
|
4
|
+
exports.definePromptFields = definePromptFields;
|
|
5
|
+
const cli_option_key_1 = require("./cli-option-key");
|
|
6
|
+
class PromptFieldHandle extends Array {
|
|
7
|
+
constructor(def) {
|
|
8
|
+
super();
|
|
9
|
+
this.def = def;
|
|
10
|
+
this.push(this.def.cliOption.option, this.def.cliOption.description);
|
|
11
|
+
}
|
|
12
|
+
get optKey() {
|
|
13
|
+
return (0, cli_option_key_1.commanderOptionKey)(this.def.cliOption.option);
|
|
14
|
+
}
|
|
15
|
+
get promptName() {
|
|
16
|
+
return this.def.name;
|
|
17
|
+
}
|
|
18
|
+
toCliOpts() {
|
|
19
|
+
return [this.def.cliOption.option, this.def.cliOption.description];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.PromptFieldHandle = PromptFieldHandle;
|
|
23
|
+
class PromptFieldsRegistry {
|
|
24
|
+
constructor(fields) {
|
|
25
|
+
this.map = new Map();
|
|
26
|
+
for (const f of fields) {
|
|
27
|
+
this.map.set(f.name, new PromptFieldHandle(f));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
get(name) {
|
|
31
|
+
return this.map.get(name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.PromptFieldsRegistry = PromptFieldsRegistry;
|
|
35
|
+
function definePromptFields(fields) {
|
|
36
|
+
return new PromptFieldsRegistry(fields);
|
|
37
|
+
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,10 +45,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
46
|
};
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const ansi_colors_1 = require("ansi-colors");
|
|
16
48
|
const apig_utils_1 = require("../../apig-utils");
|
|
17
49
|
const endpoints_1 = require("../../endpoints");
|
|
18
|
-
const prompt_1 =
|
|
50
|
+
const prompt_1 = __importStar(require("../../prompt"));
|
|
19
51
|
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
20
52
|
const config_1 = require("../../util_modules/config");
|
|
21
53
|
const fs_1 = require("../../util_modules/fs");
|
|
@@ -23,6 +55,10 @@ const sync_1 = require("../../util_modules/fs/lib/sync");
|
|
|
23
55
|
const index_1 = require("../../util_modules/logger/index");
|
|
24
56
|
const project_1 = require("../../util_modules/project");
|
|
25
57
|
const error_1 = __importDefault(require("../../error"));
|
|
58
|
+
const env_1 = require("../../util_modules/env");
|
|
59
|
+
const option_1 = require("../../util_modules/option");
|
|
60
|
+
const utils_1 = require("../utils");
|
|
61
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
26
62
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
63
|
const apigName = config_1.apigConfig.rules();
|
|
28
64
|
const apigDirPath = (0, project_1.resolveProjectPath)(apigName);
|
|
@@ -37,7 +73,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
37
73
|
(0, index_1.info)();
|
|
38
74
|
const consent = yield prompt_1.default.ask(prompt_1.default.question('enable', 'The APIG is disable in catalyst console, Do you want to enable it and pull the APIG rules now ?', {
|
|
39
75
|
type: 'confirm',
|
|
40
|
-
defaultAns:
|
|
76
|
+
defaultAns: (0, env_1.isNonInteractiveMode)()
|
|
41
77
|
}));
|
|
42
78
|
if (!consent.enable) {
|
|
43
79
|
(0, index_1.info)('Skipping APIG pull. Since the APIG is disabled in catalyst console.');
|
|
@@ -47,12 +83,27 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
47
83
|
}
|
|
48
84
|
const fileExists = yield fs_1.ASYNC.fileExists(apigDirPath);
|
|
49
85
|
const overwriteAns = fileExists
|
|
50
|
-
? yield prompt_1.default.ask(
|
|
51
|
-
|
|
52
|
-
|
|
86
|
+
? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({
|
|
87
|
+
resourceName: apigDirPath,
|
|
88
|
+
resourceType: 'File',
|
|
89
|
+
defaultAns: (0, env_1.isNonInteractiveMode)() &&
|
|
90
|
+
(0, option_1.getOptionValue)(utils_1.promptPullFields.get('overwrite').optKey, false)
|
|
91
|
+
? true
|
|
92
|
+
: false
|
|
53
93
|
}))
|
|
54
94
|
: { overwrite: true };
|
|
55
95
|
if (!overwriteAns.overwrite) {
|
|
96
|
+
if ((0, env_1.isNonInteractiveMode)()) {
|
|
97
|
+
throw new error_1.default('APIG pull failed as the APIG rules file already exists and the --overwrite option is not used to overwrite the file in local.', {
|
|
98
|
+
exit: 1,
|
|
99
|
+
errorId: 'E_NON_INTERACTIVE_APIG_PULL_OVERWRITE',
|
|
100
|
+
arg: [
|
|
101
|
+
ansi_colors_1.italic.red(apigDirPath),
|
|
102
|
+
(0, ansi_colors_1.italic)('--overwrite'),
|
|
103
|
+
(0, ansi_colors_1.italic)(`catalyst pull apig ${(0, ansi_colors_1.green)('--overwrite')}`)
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
56
107
|
(0, index_1.info)('Skipping APIG pull');
|
|
57
108
|
return;
|
|
58
109
|
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -17,51 +50,101 @@ const archiver_1 = __importDefault(require("../../archiver"));
|
|
|
17
50
|
const client_utils_1 = require("../../client-utils");
|
|
18
51
|
const endpoints_1 = require("../../endpoints");
|
|
19
52
|
const error_1 = __importDefault(require("../../error"));
|
|
20
|
-
const prompt_1 =
|
|
53
|
+
const prompt_1 = __importStar(require("../../prompt"));
|
|
21
54
|
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
22
55
|
const config_1 = require("../../util_modules/config");
|
|
23
56
|
const fs_1 = require("../../util_modules/fs");
|
|
24
57
|
const js_1 = require("../../util_modules/js");
|
|
25
58
|
const index_1 = require("../../util_modules/logger/index");
|
|
26
59
|
const path_1 = require("path");
|
|
60
|
+
const env_1 = require("../../util_modules/env");
|
|
61
|
+
const option_1 = require("../../util_modules/option");
|
|
62
|
+
const utils_1 = require("../utils");
|
|
63
|
+
function getPullClientVersion() {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const webappAPI = yield (0, endpoints_1.clientAPI)();
|
|
66
|
+
const historyArr = (yield webappAPI.getAllHistory());
|
|
67
|
+
if (historyArr.length === 0) {
|
|
68
|
+
(0, index_1.warning)('No Web Client app version found, Ensure that a Web Client is deployed in catalyst console before pulling it.');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const resource = (0, option_1.getOptionValue)(utils_1.promptPullFields.get('resource').optKey, undefined);
|
|
72
|
+
if (resource) {
|
|
73
|
+
const resources = resource.split(',');
|
|
74
|
+
if (resources.length > 1) {
|
|
75
|
+
throw new error_1.default('Multiple resources are not allowed for client pull. Please specify only one client version to pull.', {
|
|
76
|
+
exit: 1,
|
|
77
|
+
errorId: 'E_NON_INTERACTIVE_CLIENT_PULL_MULTIPLE_RESOURCES',
|
|
78
|
+
arg: [(0, ansi_colors_1.italic)('catalyst pull client --resource <client_version>')]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const _appVersion = historyArr.find((history) => history.app_version === resources[0]);
|
|
82
|
+
return _appVersion ? _appVersion.history_id : undefined;
|
|
83
|
+
}
|
|
84
|
+
else if ((0, env_1.isNonInteractiveMode)()) {
|
|
85
|
+
throw new error_1.default('Client pull failed. Please specify the client version to pull using --resource option in non-interactive mode.', {
|
|
86
|
+
exit: 1,
|
|
87
|
+
errorId: 'E_NON_INTERACTIVE_CLIENT_PULL_NO_RESOURCE',
|
|
88
|
+
arg: [
|
|
89
|
+
(0, ansi_colors_1.italic)('--resource'),
|
|
90
|
+
(0, ansi_colors_1.italic)(`catalyst pull client ${(0, ansi_colors_1.green)('--resource <client_version>')}`),
|
|
91
|
+
(0, ansi_colors_1.bold)(historyArr.map((history) => '* ' + history.app_version).join('\n'))
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const choices = historyArr.map((history) => {
|
|
96
|
+
let live = '';
|
|
97
|
+
if (js_1.JS.get(history, 'status', false)) {
|
|
98
|
+
live = (0, ansi_colors_1.cyan)(' (LIVE)');
|
|
99
|
+
}
|
|
100
|
+
return prompt_1.default.choice(history.app_version + live, {
|
|
101
|
+
value: history.history_id,
|
|
102
|
+
short: history.app_version,
|
|
103
|
+
id: history.app_version
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
const historyAns = yield prompt_1.default.ask(prompt_1.default.question('history', 'Select a Catalyst client app version : ', {
|
|
107
|
+
type: 'list',
|
|
108
|
+
choices
|
|
109
|
+
}));
|
|
110
|
+
return historyAns.history;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
27
113
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
114
|
const clientDirName = config_1.clientConfig.source();
|
|
29
115
|
const clientDirPath = clientDirName;
|
|
30
116
|
const webappAPI = yield (0, endpoints_1.clientAPI)();
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
(0, index_1.info)('No history details found in remote console');
|
|
117
|
+
const historyAns = yield getPullClientVersion();
|
|
118
|
+
if (!historyAns)
|
|
34
119
|
return;
|
|
35
|
-
}
|
|
36
120
|
const folderExits = yield fs_1.ASYNC.dirExists(clientDirPath);
|
|
37
121
|
const overwriteAns = folderExits
|
|
38
|
-
? yield prompt_1.default.ask(
|
|
39
|
-
|
|
40
|
-
defaultAns:
|
|
122
|
+
? yield prompt_1.default.ask((0, prompt_1.overwritePromptQuestion)({
|
|
123
|
+
resourceName: clientDirName,
|
|
124
|
+
defaultAns: (0, env_1.isNonInteractiveMode)() &&
|
|
125
|
+
(0, option_1.getOptionValue)(utils_1.promptPullFields.get('overwrite').optKey, false)
|
|
126
|
+
? true
|
|
127
|
+
: false
|
|
41
128
|
}))
|
|
42
129
|
: { overwrite: true };
|
|
43
130
|
if (!overwriteAns.overwrite) {
|
|
131
|
+
if ((0, env_1.isNonInteractiveMode)()) {
|
|
132
|
+
throw new error_1.default('Client pull failed as the client directory already exists and the --overwrite option is not used to overwrite the file in local', {
|
|
133
|
+
exit: 1,
|
|
134
|
+
errorId: 'E_NON_INTERACTIVE_CLIENT_PULL_NO_OVERWRITE',
|
|
135
|
+
arg: [
|
|
136
|
+
ansi_colors_1.italic.red(clientDirPath),
|
|
137
|
+
(0, ansi_colors_1.italic)('--overwrite'),
|
|
138
|
+
(0, ansi_colors_1.italic)(`catalyst pull client ${(0, ansi_colors_1.green)('--overwrite')}`)
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
44
142
|
(0, index_1.info)('Skipping client pull');
|
|
45
143
|
return;
|
|
46
144
|
}
|
|
47
145
|
yield fs_1.ASYNC.deleteDir(clientDirPath).catch();
|
|
48
|
-
const choices = historyArr.map((history) => {
|
|
49
|
-
let live = '';
|
|
50
|
-
if (js_1.JS.get(history, 'status', false)) {
|
|
51
|
-
live = (0, ansi_colors_1.cyan)(' (LIVE)');
|
|
52
|
-
}
|
|
53
|
-
return prompt_1.default.choice(history.app_version + live, {
|
|
54
|
-
value: history.history_id,
|
|
55
|
-
short: history.app_version,
|
|
56
|
-
id: history.app_version
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
const historyAns = yield prompt_1.default.ask(prompt_1.default.question('history', 'Select a Catalyst client app version : ', {
|
|
60
|
-
type: 'list',
|
|
61
|
-
choices
|
|
62
|
-
}));
|
|
63
146
|
try {
|
|
64
|
-
const clientZip = (yield webappAPI.download(historyAns
|
|
147
|
+
const clientZip = (yield webappAPI.download(historyAns));
|
|
65
148
|
yield new archiver_1.default().load(clientZip).extract(clientDirPath).finalize();
|
|
66
149
|
yield client_utils_1.clientUtils.validate({ skipPluginValidation: true });
|
|
67
150
|
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -17,7 +50,7 @@ const path_1 = require("path");
|
|
|
17
50
|
const languages_1 = require("./languages");
|
|
18
51
|
const archiver_1 = __importDefault(require("../../../archiver"));
|
|
19
52
|
const endpoints_1 = require("../../../endpoints");
|
|
20
|
-
const prompt_1 =
|
|
53
|
+
const prompt_1 = __importStar(require("../../../prompt"));
|
|
21
54
|
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
22
55
|
const config_1 = require("../../../util_modules/config");
|
|
23
56
|
const constants_1 = require("../../../util_modules/constants");
|
|
@@ -30,8 +63,12 @@ const python_1 = require("../../../fn-utils/lib/python");
|
|
|
30
63
|
const throbber_1 = __importDefault(require("../../../throbber"));
|
|
31
64
|
const ensure_java_userconfig_1 = require("../../../fn-utils/lib/java/ensure-java-userconfig");
|
|
32
65
|
const logger_1 = require("../../../util_modules/logger");
|
|
66
|
+
const env_1 = require("../../../util_modules/env");
|
|
67
|
+
const utils_1 = require("../../utils");
|
|
68
|
+
const option_1 = require("../../../util_modules/option");
|
|
33
69
|
function selFnsPrompt(targs, fnDirPath) {
|
|
34
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a;
|
|
35
72
|
const choicesObj = targs.reduce((accumulator, fn) => {
|
|
36
73
|
const name = fn.name;
|
|
37
74
|
const type = fn.type === constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.applogic]
|
|
@@ -58,6 +95,49 @@ function selFnsPrompt(targs, fnDirPath) {
|
|
|
58
95
|
result.push(...value);
|
|
59
96
|
return result;
|
|
60
97
|
}, []);
|
|
98
|
+
if ((0, env_1.isNonInteractiveMode)()) {
|
|
99
|
+
const fns = ((_a = ((0, option_1.getOptionValue)(utils_1.promptPullFields.get('resource').optKey, undefined) ||
|
|
100
|
+
undefined)) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
101
|
+
if (fns.length === 0) {
|
|
102
|
+
throw new error_1.default('Fns to pull not specified in non-interactive mode', {
|
|
103
|
+
exit: 1,
|
|
104
|
+
errorId: 'E_NON_INTERACTIVE_FNS_PULL-1',
|
|
105
|
+
arg: [
|
|
106
|
+
(0, ansi_colors_1.italic)('--resource'),
|
|
107
|
+
(0, ansi_colors_1.italic)('catalyst pull functions --resource fn1,fn2,fn3'),
|
|
108
|
+
(0, ansi_colors_1.bold)(choicesArr
|
|
109
|
+
.filter((_choice) => { var _a; return !!_choice.id || !!((_a = _choice.value) === null || _a === void 0 ? void 0 : _a.name); })
|
|
110
|
+
.map((choice) => '* ' + (choice.id || choice.value.name))
|
|
111
|
+
.join('\n'))
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return fns.reduce((_fnsArr, _fn) => {
|
|
116
|
+
const _choice = choicesArr.find((_choice) => {
|
|
117
|
+
var _a;
|
|
118
|
+
return (_choice.id && _choice.id === _fn) ||
|
|
119
|
+
(((_a = _choice.value) === null || _a === void 0 ? void 0 : _a.name) && _choice.value.name === _fn);
|
|
120
|
+
});
|
|
121
|
+
if (_choice) {
|
|
122
|
+
_fnsArr.push(_choice.value);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
throw new error_1.default('Cannot find the function in remote: ' + _fn, {
|
|
126
|
+
exit: 1,
|
|
127
|
+
errorId: 'E_NON_INTERACTIVE_FNS_PULL-2',
|
|
128
|
+
arg: [
|
|
129
|
+
(0, ansi_colors_1.italic)(`--resource ${(0, ansi_colors_1.red)(_fn)}`),
|
|
130
|
+
(0, ansi_colors_1.italic)('--resource'),
|
|
131
|
+
(0, ansi_colors_1.bold)(choicesArr
|
|
132
|
+
.filter((_choice) => { var _a; return !!_choice.id || !!((_a = _choice.value) === null || _a === void 0 ? void 0 : _a.name); })
|
|
133
|
+
.map((choice) => '* ' + (choice.id || choice.value.name))
|
|
134
|
+
.join('\n'))
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return _fnsArr;
|
|
139
|
+
}, []);
|
|
140
|
+
}
|
|
61
141
|
const functionsAns = yield prompt_1.default.ask(prompt_1.default.question('functions', 'Select all the functions that you want to pull from remote console : ', {
|
|
62
142
|
type: 'checkbox',
|
|
63
143
|
choices: choicesArr,
|
|
@@ -108,15 +188,31 @@ exports.default = (_fns) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
108
188
|
yield Promise.all(fns.map((fn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
189
|
const folderExists = yield fs_1.ASYNC.dirExists(fn.source);
|
|
110
190
|
if (folderExists) {
|
|
111
|
-
dirOverwriteQns.push(
|
|
112
|
-
|
|
113
|
-
|
|
191
|
+
dirOverwriteQns.push((0, prompt_1.overwritePromptQuestion)({
|
|
192
|
+
fieldOrName: fn.name,
|
|
193
|
+
resourceName: fn.source,
|
|
194
|
+
defaultAns: (0, env_1.isNonInteractiveMode)() ? true : false
|
|
114
195
|
}));
|
|
115
196
|
}
|
|
116
197
|
})));
|
|
117
198
|
const dirOverwriteAns = yield prompt_1.default.ask(...dirOverwriteQns);
|
|
118
199
|
const targets = fns.filter((fn) => {
|
|
119
200
|
if (dirOverwriteAns[fn.name] === undefined || dirOverwriteAns[fn.name]) {
|
|
201
|
+
if ((0, env_1.isNonInteractiveMode)()) {
|
|
202
|
+
const overWriteOpt = (0, option_1.getOptionValue)(utils_1.promptPullFields.get('overwrite').optKey, false);
|
|
203
|
+
if (!overWriteOpt) {
|
|
204
|
+
throw new error_1.default('Cannot overwrite existing function directory in non-interactive mode as the --overwrite option is not specified', {
|
|
205
|
+
exit: 1,
|
|
206
|
+
errorId: 'E_NON_INTERACTIVE_FNS_PULL-3',
|
|
207
|
+
arg: [
|
|
208
|
+
(0, ansi_colors_1.bold)(`(${fn.name})`),
|
|
209
|
+
(0, ansi_colors_1.italic)('catalyst pull'),
|
|
210
|
+
(0, ansi_colors_1.italic)('--overwrite'),
|
|
211
|
+
(0, ansi_colors_1.italic)(`catalyst pull functions --resource ${(0, option_1.getOptionValue)(utils_1.promptPullFields.get('resource').optKey, 'fn1,fn2,fn3')} ${(0, ansi_colors_1.bold)('--overwrite')}`)
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
120
216
|
return true;
|
|
121
217
|
}
|
|
122
218
|
(0, index_1.message)('skipping pull of function: ' + fn.name);
|
package/lib/pull/index.js
CHANGED
|
@@ -41,7 +41,7 @@ function pull() {
|
|
|
41
41
|
(0, index_1.info)((0, ansi_colors_1.bold)('\n' + (0, ansi_colors_1.white)('===> ') + js_1.JS.capitalize(feature) + ' Setup'));
|
|
42
42
|
yield MODULE().catch((err) => {
|
|
43
43
|
(0, index_1.info)();
|
|
44
|
-
(0, index_1.warning)(`Skipping pull of ${feature}. Since ${err.message}
|
|
44
|
+
(0, index_1.warning)(`Skipping pull of ${feature}. Since ${err.message}.`);
|
|
45
45
|
});
|
|
46
46
|
if (runtime_store_1.default.get('context.payload.' + feature, false)) {
|
|
47
47
|
runtime_store_1.default.set('context.payload.features', runtime_store_1.default.get('context.payload.features', []).concat(feature));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const promptPullFields: import("../prompt").PromptFieldsRegistry<readonly [{
|
|
2
|
+
readonly name: "overwrite";
|
|
3
|
+
readonly cliOption: {
|
|
4
|
+
readonly option: "--overwrite";
|
|
5
|
+
readonly description: "Overwrite existing resources such as functions/client/apig in the local directory if present";
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "resource";
|
|
9
|
+
readonly cliOption: {
|
|
10
|
+
readonly option: "--resource <fn_name|client_version>";
|
|
11
|
+
readonly description: "Specify the name of the resource to pull as comma separated values. For example: --resource func1,func2 (only applicable for Non-Interactive mode)";
|
|
12
|
+
};
|
|
13
|
+
}]>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promptPullFields = void 0;
|
|
4
|
+
const prompt_1 = require("../prompt");
|
|
5
|
+
exports.promptPullFields = (0, prompt_1.definePromptFields)([
|
|
6
|
+
{
|
|
7
|
+
name: 'overwrite',
|
|
8
|
+
cliOption: {
|
|
9
|
+
option: '--overwrite',
|
|
10
|
+
description: 'Overwrite existing resources such as functions/client/apig in the local directory if present'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'resource',
|
|
15
|
+
cliOption: {
|
|
16
|
+
option: '--resource <fn_name|client_version>',
|
|
17
|
+
description: 'Specify the name of the resource to pull as comma separated values. For example: --resource func1,func2 (only applicable for Non-Interactive mode)'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]);
|
package/lib/repl-server.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ declare class Repl {
|
|
|
21
21
|
start(): Repl;
|
|
22
22
|
emit(eventName: string, ...inputs: Array<any>): boolean;
|
|
23
23
|
showPrompt(): void;
|
|
24
|
+
defineCommand(keyword: string, cmd: {
|
|
25
|
+
help?: string;
|
|
26
|
+
action: (this: REPLServer, args: string) => void;
|
|
27
|
+
}): Repl;
|
|
24
28
|
setContext(command: string, exe: unknown): Repl;
|
|
25
29
|
close(): void;
|
|
26
30
|
pause(): void;
|
package/lib/repl-server.js
CHANGED
|
@@ -58,6 +58,15 @@ class Repl {
|
|
|
58
58
|
this.server.displayPrompt();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
defineCommand(keyword, cmd) {
|
|
62
|
+
if (this.server === null) {
|
|
63
|
+
throw new index_js_1.default('command cannot be defined before server is started', {
|
|
64
|
+
exit: 2
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
this.server.defineCommand(keyword, cmd);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
61
70
|
setContext(command, exe) {
|
|
62
71
|
if (this.server === null) {
|
|
63
72
|
throw new index_js_1.default('context cannot be set before server is started', { exit: 2 });
|