@codiac.io/codiac-cli 1.3.62 → 1.3.64
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/dist/apis/codiac-api/gen/contracts.d.ts +24 -0
- package/dist/apis/codiac-api/gen/contracts.js +16 -1
- package/dist/apis/codiac-api/gen/contracts.js.map +1 -1
- package/dist/apis/codiac-relay/gen/contracts.d.ts +2 -0
- package/dist/apis/codiac-relay/gen/contracts.js.map +1 -1
- package/dist/cli-common/built-in-cli-user-input.js +2 -2
- package/dist/cli-common/built-in-cli-user-input.js.map +1 -1
- package/dist/cli-common/prompt-select-fuzzy.d.ts +3 -6
- package/dist/cli-common/prompt-select-fuzzy.js.map +1 -1
- package/dist/codiac-constants.d.ts +4 -0
- package/dist/codiac-constants.js +5 -0
- package/dist/codiac-constants.js.map +1 -1
- package/dist/commands/asset/create.d.ts +4 -7
- package/dist/commands/asset/create.js +39 -258
- package/dist/commands/asset/create.js.map +1 -1
- package/dist/commands/asset/edit.d.ts +31 -0
- package/dist/commands/asset/edit.js +131 -0
- package/dist/commands/asset/edit.js.map +1 -0
- package/dist/commands/asset/entrypoint/delete.d.ts +42 -0
- package/dist/commands/asset/entrypoint/delete.js +312 -0
- package/dist/commands/asset/entrypoint/delete.js.map +1 -0
- package/dist/commands/asset/entrypoint/set.d.ts +45 -0
- package/dist/commands/asset/entrypoint/set.js +338 -0
- package/dist/commands/asset/entrypoint/set.js.map +1 -0
- package/dist/commands/asset/list.d.ts +1 -0
- package/dist/commands/asset/list.js +20 -0
- package/dist/commands/asset/list.js.map +1 -1
- package/dist/commands/host/delete.js +2 -1
- package/dist/commands/host/delete.js.map +1 -1
- package/dist/commands/host/map.d.ts +1 -0
- package/dist/commands/host/map.js +18 -4
- package/dist/commands/host/map.js.map +1 -1
- package/dist/commands/noc/cluster/create.d.ts +32 -11
- package/dist/commands/noc/cluster/create.js +182 -119
- package/dist/commands/noc/cluster/create.js.map +1 -1
- package/dist/commands/noc/cluster/deinit.d.ts +1 -3
- package/dist/commands/noc/cluster/deinit.js +1 -1
- package/dist/commands/noc/cluster/deinit.js.map +1 -1
- package/dist/ops/i-entry-validator.d.ts +1 -1
- package/dist/relay/relay-container.js +1 -1
- package/dist/uilogic/cloud-resource-configurators/asset-configurator.d.ts +47 -0
- package/dist/uilogic/cloud-resource-configurators/asset-configurator.js +394 -0
- package/dist/uilogic/cloud-resource-configurators/asset-configurator.js.map +1 -0
- package/dist/uilogic/cloud-resource-configurators/aws-resource-configurator.d.ts +2 -0
- package/dist/uilogic/cloud-resource-configurators/aws-resource-configurator.js +58 -3
- package/dist/uilogic/cloud-resource-configurators/aws-resource-configurator.js.map +1 -1
- package/dist/uilogic/cloud-resource-configurators/azure-resource-configurator.d.ts +1 -0
- package/dist/uilogic/cloud-resource-configurators/azure-resource-configurator.js +34 -3
- package/dist/uilogic/cloud-resource-configurators/azure-resource-configurator.js.map +1 -1
- package/dist/uilogic/config-ui-utils.js +1 -1
- package/dist/uilogic/config-ui-utils.js.map +1 -1
- package/dist/uilogic/image-registry-contextualizer.d.ts +3 -2
- package/dist/uilogic/image-registry-contextualizer.js +6 -4
- package/dist/uilogic/image-registry-contextualizer.js.map +1 -1
- package/dist/uilogic/rootmap-ui-utils.js +2 -0
- package/dist/uilogic/rootmap-ui-utils.js.map +1 -1
- package/dist/uilogic/validators/semver-range-validator.d.ts +17 -0
- package/dist/uilogic/validators/semver-range-validator.js +39 -0
- package/dist/uilogic/validators/semver-range-validator.js.map +1 -0
- package/oclif.manifest.json +408 -69
- package/package.json +3 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetEdit = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const _ = require("lodash");
|
|
7
|
+
const command_base_exec_1 = require("../../command-base-exec");
|
|
8
|
+
const config_ui_utils_1 = require("../../uilogic/config-ui-utils");
|
|
9
|
+
const asset_configurator_1 = require("../../uilogic/cloud-resource-configurators/asset-configurator");
|
|
10
|
+
const prettify_1 = require("../../prettify");
|
|
11
|
+
class AssetEdit extends command_base_exec_1.CommandBaseExec {
|
|
12
|
+
get uiAsset() {
|
|
13
|
+
if (this.uiAsset_backer == undefined) {
|
|
14
|
+
this.uiAsset_backer = new asset_configurator_1.AssetConfigurator(this._ui, this._styler, this.genRelayClient, this.logger); // this.ioc.get(AssetConfigurator);
|
|
15
|
+
}
|
|
16
|
+
return this.uiAsset_backer;
|
|
17
|
+
}
|
|
18
|
+
captureArgs() {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { args, flags } = yield this.parse(AssetEdit);
|
|
22
|
+
let partial = {};
|
|
23
|
+
if (flags.enterprise)
|
|
24
|
+
partial.enterprise = flags.enterprise;
|
|
25
|
+
if (flags.name)
|
|
26
|
+
partial.name = flags.name;
|
|
27
|
+
if (flags.code)
|
|
28
|
+
partial.code = flags.code;
|
|
29
|
+
if (flags.id)
|
|
30
|
+
partial.id = flags.id;
|
|
31
|
+
// ---------------------------------------------------------------
|
|
32
|
+
// TODO: move everything from here down into the base class
|
|
33
|
+
// ---------------------------------------------------------------
|
|
34
|
+
const interactionMode = (this.pipedInput) ? config_ui_utils_1.InteractionModes.silent : (_b = (_a = undefined !== null && undefined !== void 0 ? undefined : (flags.echo ? config_ui_utils_1.InteractionModes.echo : undefined)) !== null && _a !== void 0 ? _a : (flags["to-script"] ? config_ui_utils_1.InteractionModes.toscript : undefined)) !== null && _b !== void 0 ? _b : (flags.silent ? config_ui_utils_1.InteractionModes.silent : undefined);
|
|
35
|
+
// const takeDefaults = flags['take-defaults'];
|
|
36
|
+
return [partial, interactionMode, false];
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
buildCandidate_silently(partial, rootMap) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
let ent = rootMap.enterprises.find(e => e.name == partial.enterprise);
|
|
42
|
+
if (!ent)
|
|
43
|
+
throw new Error("Enterprise not found."); // <-- todo: move this up to the base class and pass in the enterprise object.
|
|
44
|
+
if (partial.name == undefined)
|
|
45
|
+
throw new Error("Missing asset name.");
|
|
46
|
+
let asset = ent.assets.find(a => a.name == partial.name);
|
|
47
|
+
if (!asset)
|
|
48
|
+
throw new Error("Asset not found");
|
|
49
|
+
// Overlay the existing record with the given property values
|
|
50
|
+
partial = _.merge({}, asset, partial);
|
|
51
|
+
let candidate = Object.assign({}, partial);
|
|
52
|
+
return candidate;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
buildCandidate_interactively(partial, rootMap, takeDefaults) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
let ent = rootMap.enterprises.find(e => e.name == partial.enterprise);
|
|
58
|
+
if (!ent) {
|
|
59
|
+
ent = yield this.rootMapUtils.promptForEnterprise(partial, rootMap);
|
|
60
|
+
partial.enterprise = ent.name;
|
|
61
|
+
}
|
|
62
|
+
// Dont await: let this run in the background while the user is interacting.
|
|
63
|
+
if (!this.uiAsset.isLoaded)
|
|
64
|
+
this.uiAsset.load(ent.assets);
|
|
65
|
+
let assetChanged;
|
|
66
|
+
let assetType;
|
|
67
|
+
[partial.name, assetChanged, assetType] = yield this.rootMapUtils.promptForAsset(ent.assets, partial.name);
|
|
68
|
+
let asset = ent.assets.find(a => a.name == partial.name);
|
|
69
|
+
if (!asset)
|
|
70
|
+
throw new Error("Asset not found"); // <-- this will never happen - it's just for type safety
|
|
71
|
+
// Overlay the existing record with the given property values
|
|
72
|
+
partial = _.merge({}, asset, partial);
|
|
73
|
+
let candidate;
|
|
74
|
+
let confirm = false;
|
|
75
|
+
do {
|
|
76
|
+
// TODO: edit stuff here...
|
|
77
|
+
let edited = yield this.uiAsset.editAsset(partial);
|
|
78
|
+
// TODO: show diffs only from asset
|
|
79
|
+
candidate = Object.assign({}, edited);
|
|
80
|
+
this._ui.userMessage("Changes to ".concat(candidate.name, "... "));
|
|
81
|
+
this._ui.userMessage((0, prettify_1.prettify)(candidate));
|
|
82
|
+
confirm = yield this._ui.promptConfirm("confirm", "Save changes?", false);
|
|
83
|
+
} while (!confirm);
|
|
84
|
+
return candidate;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
buildCommandString(candidate, cmd) {
|
|
88
|
+
cmd.push("--enterprise", candidate.enterprise);
|
|
89
|
+
cmd.push("--name", candidate.name);
|
|
90
|
+
// cmd.push("--id", candidate.id)
|
|
91
|
+
if (candidate.code)
|
|
92
|
+
cmd.push("--code");
|
|
93
|
+
cmd.push("--silent");
|
|
94
|
+
return cmd;
|
|
95
|
+
}
|
|
96
|
+
executeTask(candidate) {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
let result = yield this._codiacApi.Asset.tryUpdate(candidate);
|
|
100
|
+
if (result.error != undefined) {
|
|
101
|
+
throw result.error;
|
|
102
|
+
}
|
|
103
|
+
else if (result.success == true) {
|
|
104
|
+
this._ui.userMessage((_a = result.message) !== null && _a !== void 0 ? _a : "Successfully updated asset ".concat("[", candidate.name, "]"));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this._ui.userMessage((_b = result.message) !== null && _b !== void 0 ? _b : "Failed without error updating asset record for ".concat("[", candidate.name, "]. Check logs for details."));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.AssetEdit = AssetEdit;
|
|
113
|
+
AssetEdit.description = 'Changes asset attributes.';
|
|
114
|
+
AssetEdit.args = {};
|
|
115
|
+
AssetEdit.flags = {
|
|
116
|
+
enterprise: core_1.Flags.string({ char: 'e', required: false, description: 'The name of the enterprise in which this asset resides. (defaults to the current enterprise context). NOTE: The enterprise assignment for an asset is immutable and cannot be modified; this flag is used only for identifying the asset.' }),
|
|
117
|
+
name: core_1.Flags.string({ char: 'n', required: false, description: "The name of the asset to edit. NOTE: The asset name is immutable and cannot be modified; this flag is used only for identifying the asset." }),
|
|
118
|
+
code: core_1.Flags.string({ char: 'c', required: false, description: "The host name to assign this asset in the domain url. eg: 'myasset' in 'myasset.your-domain.com' (Optional: defaults to the asset name)." }),
|
|
119
|
+
// id: Flags.string({ required: false, description: "The system id of the enterprise asset to edit." }),
|
|
120
|
+
// TODO: Move these into the base class
|
|
121
|
+
silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], dependsOn: ["name"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
|
|
122
|
+
echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
|
|
123
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' })
|
|
124
|
+
// "take-defaults": Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode). This behavior does NOT apply to scenarios that the command needs to override invalid user input; such cases will always prompt for confirmation. eg: when no argument was provided for file or type, and only one exists, the system will render the autoselected file unless this flag is set." })
|
|
125
|
+
};
|
|
126
|
+
AssetEdit.examples = [
|
|
127
|
+
'<%= config.bin %> <%= command.id %>',
|
|
128
|
+
'<%= config.bin %> <%= command.id %> -n my-api',
|
|
129
|
+
'<%= config.bin %> <%= command.id %> -e main -n my-api',
|
|
130
|
+
];
|
|
131
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/commands/asset/edit.ts"],"names":[],"mappings":";;;;AAAA,sCAAmD;AACnD,4BAA6B;AAG7B,+DAA0D;AAC1D,mEAA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2BAA2B,CAAA;AAEzC,cAAI,GAAG,EAAE,CAAA;AAET,eAAK,GAAG;IACtB,UAAU,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,4OAA4O,EAAE,CAAC;IACnT,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,6IAA6I,EAAE,CAAC;IAC9M,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,2IAA2I,EAAE,CAAC;IAC5M,wGAAwG;IAExG,uCAAuC;IACvC,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IAC3M,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,ohBAAohB;CACrhB,CAAA;AAEe,kBAAQ,GAAsB;IAC5C,qCAAqC;IACrC,+CAA+C;IAC/C,uDAAuD;CACxD,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { AtLeast } from "@codiac.io/codiac-common/contracts";
|
|
3
|
+
import { Asset, EnterpriseRoot, EntryPoint, RootMap } from '../../../apis/codiac-api/contracts';
|
|
4
|
+
import { CommandBaseExec } from '../../../command-base-exec';
|
|
5
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
6
|
+
interface IAssetEntrypointDeleteRequest extends Omit<EntryPoint, "created" | "createdBy" | "modified" | "modifiedBy"> {
|
|
7
|
+
enterpriseObj: EnterpriseRoot;
|
|
8
|
+
assetObj: Asset;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @see [Dockerfile ref: ENTRYPOINT](https://docs.docker.com/reference/dockerfile/#entrypoint)
|
|
12
|
+
* @see [Dockerfile ref: CMD](https://docs.docker.com/reference/dockerfile/#cmd)
|
|
13
|
+
* @see [Dockerfile ref: SHELL](https://docs.docker.com/reference/dockerfile/#shell)
|
|
14
|
+
* @see [Dockerfile ref: Shell and Exec form](https://docs.docker.com/reference/dockerfile/#shell-and-exec-form)
|
|
15
|
+
*/
|
|
16
|
+
export default class AssetEntrypointSet extends CommandBaseExec<IAssetEntrypointDeleteRequest> {
|
|
17
|
+
static description: string;
|
|
18
|
+
static aliases: never[];
|
|
19
|
+
static args: {};
|
|
20
|
+
static flags: {
|
|
21
|
+
enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
|
+
asset: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
23
|
+
"version-range": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
24
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
25
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
};
|
|
28
|
+
static examples: Command.Example[];
|
|
29
|
+
captureArgs(): Promise<[Partial<IAssetEntrypointDeleteRequest>, (InteractionModes | undefined), boolean]>;
|
|
30
|
+
buildCandidate_silently(partial: AtLeast<IAssetEntrypointDeleteRequest, "enterprise">, rootMap: RootMap): Promise<IAssetEntrypointDeleteRequest | undefined>;
|
|
31
|
+
buildCandidate_interactively(partial: AtLeast<IAssetEntrypointDeleteRequest, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<IAssetEntrypointDeleteRequest | undefined>;
|
|
32
|
+
private buildEntryPointListItemDesc;
|
|
33
|
+
private buildConfirmPreview;
|
|
34
|
+
promptForWorkingDir(current: string | undefined): Promise<string | undefined>;
|
|
35
|
+
promptForCommand(current: string | undefined): Promise<string>;
|
|
36
|
+
promptForArgs(current: string[] | undefined): Promise<string[] | undefined>;
|
|
37
|
+
private promptForSingleCommandArg;
|
|
38
|
+
promptForVersionRange(current: string | undefined): Promise<string | undefined>;
|
|
39
|
+
buildCommandString(candidate: IAssetEntrypointDeleteRequest, cmd: string[]): string[];
|
|
40
|
+
executeTask(candidate: IAssetEntrypointDeleteRequest): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const command_base_exec_1 = require("../../../command-base-exec");
|
|
7
|
+
const config_ui_utils_1 = require("../../../uilogic/config-ui-utils");
|
|
8
|
+
const azure_resource_configurator_1 = require("../../../uilogic/cloud-resource-configurators/azure-resource-configurator");
|
|
9
|
+
const semver_range_validator_1 = require("../../../uilogic/validators/semver-range-validator");
|
|
10
|
+
;
|
|
11
|
+
/**
|
|
12
|
+
* @see [Dockerfile ref: ENTRYPOINT](https://docs.docker.com/reference/dockerfile/#entrypoint)
|
|
13
|
+
* @see [Dockerfile ref: CMD](https://docs.docker.com/reference/dockerfile/#cmd)
|
|
14
|
+
* @see [Dockerfile ref: SHELL](https://docs.docker.com/reference/dockerfile/#shell)
|
|
15
|
+
* @see [Dockerfile ref: Shell and Exec form](https://docs.docker.com/reference/dockerfile/#shell-and-exec-form)
|
|
16
|
+
*/
|
|
17
|
+
class AssetEntrypointSet extends command_base_exec_1.CommandBaseExec {
|
|
18
|
+
captureArgs() {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { args, flags } = yield this.parse(AssetEntrypointSet);
|
|
22
|
+
let partial = {};
|
|
23
|
+
if (flags.enterprise)
|
|
24
|
+
partial.enterprise = flags.enterprise;
|
|
25
|
+
if (flags.asset)
|
|
26
|
+
partial.asset = flags.asset;
|
|
27
|
+
if (flags['version-range'])
|
|
28
|
+
partial.versionRange = flags['version-range'];
|
|
29
|
+
// ---------------------------------------------------------------
|
|
30
|
+
// TODO: move everything from here down into the base class
|
|
31
|
+
// ---------------------------------------------------------------
|
|
32
|
+
const interactionMode = (this.pipedInput) ? config_ui_utils_1.InteractionModes.silent : (_b = (_a = undefined !== null && undefined !== void 0 ? undefined : (flags.echo ? config_ui_utils_1.InteractionModes.echo : undefined)) !== null && _a !== void 0 ? _a : (flags["to-script"] ? config_ui_utils_1.InteractionModes.toscript : undefined)) !== null && _b !== void 0 ? _b : (flags.silent ? config_ui_utils_1.InteractionModes.silent : undefined);
|
|
33
|
+
// const takeDefaults = flags['take-defaults'];
|
|
34
|
+
return [partial, interactionMode, false];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
buildCandidate_silently(partial, rootMap) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
// Enterprise
|
|
41
|
+
partial.enterpriseObj = rootMap.enterprises.find(e => e.name == partial.enterprise);
|
|
42
|
+
if (!partial.enterpriseObj)
|
|
43
|
+
throw new Error("Enterprise not found."); // <-- todo: move this up to the base class and pass in the enterprise object.
|
|
44
|
+
// Asset
|
|
45
|
+
if (partial.asset == undefined)
|
|
46
|
+
throw new Error("Missing asset name.");
|
|
47
|
+
partial.assetObj = partial.enterpriseObj.assets.find(a => a.name == partial.asset);
|
|
48
|
+
if (partial.assetObj == undefined)
|
|
49
|
+
throw new Error("Asset not found");
|
|
50
|
+
// Entrypoint
|
|
51
|
+
// Gotta grab the entrypoint by version range
|
|
52
|
+
// Q: then how would you change a version range without going interactive?
|
|
53
|
+
// A: by offering a version selector arg (eg: --for 1.2.3) ...and then taking the first entrypoint that matches it.
|
|
54
|
+
// Q: What if more than one matches?
|
|
55
|
+
// A: Can semver help us enforce mutually exclusive ranges?
|
|
56
|
+
if ((_b = (_a = partial.assetObj.entryPoints) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 == 0) {
|
|
57
|
+
this._ui.userMessage("Nothing to delete! Asset ".concat("[", partial.enterprise, "/", partial.asset, "] has no entrypoint overrides defined."));
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
let existing;
|
|
61
|
+
if (partial.assetObj.entryPoints) {
|
|
62
|
+
let selected = _.findIndex(partial.assetObj.entryPoints, e => e.versionRange == partial.versionRange);
|
|
63
|
+
// let selected = partial.assetObj.entryPoints.find(e => e.versionRange == partial.versionRange);
|
|
64
|
+
if (selected >= 0) {
|
|
65
|
+
existing = partial.assetObj.entryPoints.splice(selected, 1)[0]; // Remove the one we're working on. We'll add it back on the execute
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Overlay the existing record with the given property values
|
|
69
|
+
partial = _.merge({}, _.omit(existing, "created", "createdBy", "modified", "modifiedBy"), partial);
|
|
70
|
+
let candidate = Object.assign({}, partial);
|
|
71
|
+
return candidate;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
buildCandidate_interactively(partial, rootMap, takeDefaults) {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
// Enterprise
|
|
77
|
+
partial.enterpriseObj = rootMap.enterprises.find(e => e.name == partial.enterprise);
|
|
78
|
+
if (!partial.enterpriseObj) {
|
|
79
|
+
partial.enterpriseObj = yield this.rootMapUtils.promptForEnterprise(partial, rootMap);
|
|
80
|
+
}
|
|
81
|
+
partial.enterprise = partial.enterpriseObj.name;
|
|
82
|
+
// Asset
|
|
83
|
+
let assetChanged;
|
|
84
|
+
let assetType;
|
|
85
|
+
[partial.asset, assetChanged, assetType] = yield this.rootMapUtils.promptForAsset(partial.enterpriseObj.assets, partial.asset, true);
|
|
86
|
+
partial.assetObj = (partial.enterpriseObj.assets.find(a => a.name == partial.asset)); // assertion ok, we wouldnt get here without a valid selection
|
|
87
|
+
// Existing Entrypoint
|
|
88
|
+
let existing;
|
|
89
|
+
if (partial.assetObj.entryPoints && partial.assetObj.entryPoints.length > 0) {
|
|
90
|
+
const CODE_FOR_NEW_RECORD = -1;
|
|
91
|
+
let choices = partial.assetObj.entryPoints.map((e, index) => { return { name: this.buildEntryPointListItemDesc(e), value: index }; });
|
|
92
|
+
// choices.push({ name: "** create new **", value: CODE_FOR_NEW_RECORD });
|
|
93
|
+
let selected = (yield this._ui.promptSelect("selectExisting", "Entrypoint: ", choices, false, false));
|
|
94
|
+
if (selected != CODE_FOR_NEW_RECORD) {
|
|
95
|
+
// existing = partial.assetObj.entryPoints[selected];
|
|
96
|
+
existing = partial.assetObj.entryPoints.splice(selected, 1)[0]; // Remove the one we're working on. We'll add it back on the execute
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this._ui.userMessage("Nothing to delete! Asset ".concat("[", partial.enterprise, "/", partial.asset, "] has no entrypoint overrides defined."));
|
|
101
|
+
process.exit(0);
|
|
102
|
+
}
|
|
103
|
+
// Overlay the existing record with the given property values
|
|
104
|
+
partial = _.merge({}, _.omit(existing, "created", "createdBy", "modified", "modifiedBy"), partial);
|
|
105
|
+
let candidate;
|
|
106
|
+
let confirm = false;
|
|
107
|
+
// do {
|
|
108
|
+
// Lets wait till we like this command
|
|
109
|
+
// before bringing version ranges into it...
|
|
110
|
+
// partial.versionRange = await this.promptForVersionRange(partial.versionRange);
|
|
111
|
+
candidate = Object.assign({}, partial);
|
|
112
|
+
this._ui.userMessage("\n".concat("Entrypoint override for ", candidate.asset, "... \n", this.buildConfirmPreview(candidate), "\n"));
|
|
113
|
+
confirm = yield this._ui.promptConfirm("confirm", this._styler.colorCritical("Delete").concat(" this entrypoint (fall back to original image behavior)?"), false);
|
|
114
|
+
if (!confirm) {
|
|
115
|
+
this._ui.userMessage("Operation cancelled. No work was done.");
|
|
116
|
+
process.exit(0);
|
|
117
|
+
}
|
|
118
|
+
// } while (!confirm)
|
|
119
|
+
return candidate;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// -----------------------------------------------------------
|
|
123
|
+
// UI SUPPORT
|
|
124
|
+
// -----------------------------------------------------------
|
|
125
|
+
buildEntryPointListItemDesc(ep) {
|
|
126
|
+
var _a, _b, _c;
|
|
127
|
+
let desc = ep.command.concat(" ", (_b = (_a = ep.args) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : "");
|
|
128
|
+
desc = desc.trim().concat(" ", this._styler.dim((_c = ep.versionRange) !== null && _c !== void 0 ? _c : "(any version)"));
|
|
129
|
+
return desc;
|
|
130
|
+
}
|
|
131
|
+
buildConfirmPreview(ep) {
|
|
132
|
+
var _a;
|
|
133
|
+
let desc = "Asset: ".concat(this._styler.dim(ep.enterprise + "/"), this._styler.hilite(ep.asset), "\n");
|
|
134
|
+
if (ep.workingDir != undefined && !_.isEmpty(ep.workingDir))
|
|
135
|
+
desc = desc.concat("Working Dir: ", this._styler.hilite(ep.workingDir), "\n");
|
|
136
|
+
desc = desc.concat("Command: ", this._styler.hilite(JSON.stringify([ep.command])), "\n");
|
|
137
|
+
if (ep.args != undefined && ep.args.length > 0)
|
|
138
|
+
desc = desc.concat("Args: ", this._styler.hilite(JSON.stringify(ep.args)), "\n");
|
|
139
|
+
desc = desc.concat("Applicable to: ", this._styler.hilite((_a = ep.versionRange) !== null && _a !== void 0 ? _a : "(any version)"));
|
|
140
|
+
return desc;
|
|
141
|
+
}
|
|
142
|
+
promptForWorkingDir(current) {
|
|
143
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
let keep = false;
|
|
145
|
+
keep = yield this._ui.promptConfirm("workingDirConfirm", "Working Directory: ".concat(this._styler.hilite(current !== null && current !== void 0 ? current : "(use default)")), true);
|
|
146
|
+
if (!keep) {
|
|
147
|
+
let entry = current;
|
|
148
|
+
while (!entry || entry.trim() == "") {
|
|
149
|
+
entry = (yield this._ui.prompt('workingDir', 'Working Directory: ', true, current === null || current === void 0 ? void 0 : current.trim(), new azure_resource_configurator_1.NonEmptyValidator()));
|
|
150
|
+
}
|
|
151
|
+
return entry.trim();
|
|
152
|
+
}
|
|
153
|
+
return current === null || current === void 0 ? void 0 : current.trim();
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
promptForCommand(current) {
|
|
157
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
let entry = "";
|
|
159
|
+
while (!entry || entry.trim() == "") {
|
|
160
|
+
entry = (yield this._ui.prompt('command', 'Command: ', true, current === null || current === void 0 ? void 0 : current.trim(), new azure_resource_configurator_1.NonEmptyValidator()));
|
|
161
|
+
}
|
|
162
|
+
return entry.trim();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
promptForArgs(current) {
|
|
166
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
try {
|
|
168
|
+
let ultimate;
|
|
169
|
+
const existings = [];
|
|
170
|
+
if (current) {
|
|
171
|
+
existings.push(...current);
|
|
172
|
+
}
|
|
173
|
+
// CONFIRM/EDIT EACH EXISTING
|
|
174
|
+
let index = 0;
|
|
175
|
+
for (let existing of existings) {
|
|
176
|
+
index++;
|
|
177
|
+
let arg = yield this.promptForSingleCommandArg(existing, index);
|
|
178
|
+
// Append to the ultimate
|
|
179
|
+
if (arg == undefined) {
|
|
180
|
+
this._ui.userMessage("Command arg removed.");
|
|
181
|
+
index--; // reuse this index for the next port assignment
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
if (ultimate == undefined) {
|
|
185
|
+
ultimate = [arg];
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
ultimate.push(arg);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ADD NEW ONES
|
|
193
|
+
// Automatically start adding when none are defined yet. Otherwise, ask to add more.
|
|
194
|
+
// while ((ultimate == undefined || (<[]>ultimate).length == 0) || await this._ui.promptConfirm("onemore", "Add another arg?", false)) {
|
|
195
|
+
while (true) {
|
|
196
|
+
index++;
|
|
197
|
+
const thisArg = yield this.promptForSingleCommandArg(undefined, index);
|
|
198
|
+
if (thisArg == undefined) {
|
|
199
|
+
break; //index--; // re-use on the next port number
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
// Append to the ultimate
|
|
203
|
+
if (ultimate == undefined) {
|
|
204
|
+
ultimate = [thisArg];
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
ultimate.push(thisArg);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return ultimate;
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
throw err;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
promptForSingleCommandArg(current, index) {
|
|
219
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
let output;
|
|
221
|
+
output = yield this._ui.prompt('arg', `Arg ${index}: ${this._styler.dim("(enter a blank to ".concat(current ? "remove" : "complete", ")"))}`, false, current === null || current === void 0 ? void 0 : current.trim());
|
|
222
|
+
if (_.isEmpty(output === null || output === void 0 ? void 0 : output.trim())) {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
return output;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
promptForVersionRange(current) {
|
|
229
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
let keep = false;
|
|
231
|
+
keep = yield this._ui.promptConfirm("versionConfirm", "Version Range: ".concat(this._styler.hilite(current !== null && current !== void 0 ? current : "(any)")), true);
|
|
232
|
+
if (!keep) {
|
|
233
|
+
let entry = current;
|
|
234
|
+
entry = (yield this._ui.prompt('version', 'Version Range: ', true, current === null || current === void 0 ? void 0 : current.trim(), new semver_range_validator_1.SemverRangeValidator()));
|
|
235
|
+
// TODO: Consider some better assistance...
|
|
236
|
+
// ? * from this version forward (>=1.2.3)
|
|
237
|
+
// ? * from this version backward (<=1.2.3)
|
|
238
|
+
// ? * on just this version (1.2.3)
|
|
239
|
+
// ? * on any version like this (1.x)
|
|
240
|
+
// ? * on this version and any future patches (^1.2.3)
|
|
241
|
+
// ? * between inclusive (5.0.0 - 7.2.3)
|
|
242
|
+
// ? * custom range spec: 1.x || >=2.5.0 || 5.0.0 - 7.2.3
|
|
243
|
+
// ...like a builder interface...
|
|
244
|
+
// ...and perhaps use with an asset version select list...?
|
|
245
|
+
return entry.trim();
|
|
246
|
+
}
|
|
247
|
+
return current === null || current === void 0 ? void 0 : current.trim();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
// -----------------------------------------------------------
|
|
251
|
+
// EXECUTION
|
|
252
|
+
// -----------------------------------------------------------
|
|
253
|
+
buildCommandString(candidate, cmd) {
|
|
254
|
+
cmd.push("--enterprise", candidate.enterprise);
|
|
255
|
+
cmd.push("--asset", candidate.asset);
|
|
256
|
+
// cmd.push("--id", candidate.id)
|
|
257
|
+
if (candidate.versionRange)
|
|
258
|
+
cmd.push("--version-range", candidate.versionRange); // HEY!!!! if there's spaces in it, we need to wrap with string chars
|
|
259
|
+
cmd.push("--silent");
|
|
260
|
+
return cmd;
|
|
261
|
+
}
|
|
262
|
+
executeTask(candidate) {
|
|
263
|
+
var _a, _b;
|
|
264
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
let ep = _.omit(candidate, "enterpriseObj", "assetObj");
|
|
266
|
+
if (candidate.assetObj.entryPoints == undefined)
|
|
267
|
+
candidate.assetObj.entryPoints = [];
|
|
268
|
+
// let result = await this._codiacApi.Asset.tryUpdate(candidate.assetObj);
|
|
269
|
+
let patch = _.pick(candidate.assetObj, "id", "enterprise", "name", "entryPoints");
|
|
270
|
+
let result = yield this._codiacApi.Asset.tryUpdatePartial(patch);
|
|
271
|
+
if (result.error != undefined) {
|
|
272
|
+
throw result.error;
|
|
273
|
+
}
|
|
274
|
+
else if (result.success == true) {
|
|
275
|
+
this._ui.userMessage((_a = result.message) !== null && _a !== void 0 ? _a : "Successfully removed entrypoint from asset ".concat("[", candidate.asset, "]"));
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this._ui.userMessage((_b = result.message) !== null && _b !== void 0 ? _b : "Failed without error updating entrypoint for ".concat("[", candidate.asset, "]. Check logs for details."));
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.default = AssetEntrypointSet;
|
|
284
|
+
AssetEntrypointSet.description = 'Removes an existing override of the image startup command for this asset (restores the original ENTRYPOINT set in the image itself, as well as any image elements specified using CMD)).';
|
|
285
|
+
AssetEntrypointSet.aliases = [];
|
|
286
|
+
AssetEntrypointSet.args = {};
|
|
287
|
+
AssetEntrypointSet.flags = {
|
|
288
|
+
enterprise: core_1.Flags.string({ char: 'e', required: false, description: 'The name of the enterprise in which this asset resides (defaults to the current enterprise context).' }),
|
|
289
|
+
asset: core_1.Flags.string({ char: 'a', required: false, description: "The name of the asset to adjust." }),
|
|
290
|
+
"version-range": core_1.Flags.string({ char: 'v', required: false, description: '(optional, defaults to the entrypoint assigned to "any" version) Used to identify the entrypoint. The semantic version rule describing which versions of the asset will get this entrypoint applied. (eg: Just this one: `1.2.3`, or this one and any future patches: `^1.2.3`, or any on or after this one: `>=1.2.3`, or any before this one `<1.2.3` , or any between inclusive: `1.0.0 - 1.2.3`). NOTE: Remember to wrap your range spec in quotes if it has any spaces in it.' }),
|
|
291
|
+
// TODO: Move these into the base class
|
|
292
|
+
silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], dependsOn: ["asset"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
|
|
293
|
+
echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
|
|
294
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' })
|
|
295
|
+
// "take-defaults": Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode). This behavior does NOT apply to scenarios that the command needs to override invalid user input; such cases will always prompt for confirmation. eg: when no argument was provided for file or type, and only one exists, the system will render the autoselected file unless this flag is set." })
|
|
296
|
+
};
|
|
297
|
+
AssetEntrypointSet.examples = [
|
|
298
|
+
{ description: "Interactive", command: '<%= config.bin %> <%= command.id %>' },
|
|
299
|
+
{
|
|
300
|
+
description: "Interactive, preset for the a specific asset.",
|
|
301
|
+
command: '<%= config.bin %> <%= command.id %> -a my-api'
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
description: "Interactive as above, but when you have more than a single enterprise, and one of them is named `ml`.",
|
|
305
|
+
command: '<%= config.bin %> <%= command.id %> -e ml -a my-worker'
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
description: "Non-interactive, removal by specifying the version range with an explicit match",
|
|
309
|
+
command: "<%= config.bin %> <%= command.id %> -e ml -a my-worker -v '>=1.2.3' --silent"
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/asset/entr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sGAAsG,EAAE,CAAC;IAClL,ohBAAohB;CACrhB,CAAA;AAGe,2BAAQ,GAAsB;IAC5C,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,qCAAqC,EAAE;IAC9E;QACE,WAAW,EAAE,+CAA+C;QAC5D,OAAO,EAAE,+CAA+C;KACzD;IACD;QACE,WAAW,EAAE,uGAAuG;QACpH,OAAO,EAAE,wDAAwD;KAClE;IACD;QACE,WAAW,EAAE,iFAAiF;QAC9F,OAAO,EAAE,8EAA8E;KACxF;CACF,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { AtLeast } from "@codiac.io/codiac-common/contracts";
|
|
3
|
+
import { Asset, EnterpriseRoot, EntryPoint, RootMap } from '../../../apis/codiac-api/contracts';
|
|
4
|
+
import { CommandBaseExec } from '../../../command-base-exec';
|
|
5
|
+
import { InteractionModes } from '../../../uilogic/config-ui-utils';
|
|
6
|
+
interface IAssetEntrypointSetRequest extends Omit<EntryPoint, "created" | "createdBy" | "modified" | "modifiedBy"> {
|
|
7
|
+
enterpriseObj: EnterpriseRoot;
|
|
8
|
+
assetObj: Asset;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @see [Dockerfile ref: ENTRYPOINT](https://docs.docker.com/reference/dockerfile/#entrypoint)
|
|
12
|
+
* @see [Dockerfile ref: CMD](https://docs.docker.com/reference/dockerfile/#cmd)
|
|
13
|
+
* @see [Dockerfile ref: SHELL](https://docs.docker.com/reference/dockerfile/#shell)
|
|
14
|
+
* @see [Dockerfile ref: Shell and Exec form](https://docs.docker.com/reference/dockerfile/#shell-and-exec-form)
|
|
15
|
+
*/
|
|
16
|
+
export default class AssetEntrypointSet extends CommandBaseExec<IAssetEntrypointSetRequest> {
|
|
17
|
+
static description: string;
|
|
18
|
+
static aliases: string[];
|
|
19
|
+
static args: {};
|
|
20
|
+
static flags: {
|
|
21
|
+
enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
|
+
asset: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
23
|
+
workdir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
24
|
+
command: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
25
|
+
arg: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
26
|
+
"version-range": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
27
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
|
+
};
|
|
31
|
+
static examples: Command.Example[];
|
|
32
|
+
captureArgs(): Promise<[Partial<IAssetEntrypointSetRequest>, (InteractionModes | undefined), boolean]>;
|
|
33
|
+
buildCandidate_silently(partial: AtLeast<IAssetEntrypointSetRequest, "enterprise">, rootMap: RootMap): Promise<IAssetEntrypointSetRequest | undefined>;
|
|
34
|
+
buildCandidate_interactively(partial: AtLeast<IAssetEntrypointSetRequest, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<IAssetEntrypointSetRequest | undefined>;
|
|
35
|
+
private buildEntryPointListItemDesc;
|
|
36
|
+
private buildConfirmPreview;
|
|
37
|
+
promptForWorkingDir(current: string | undefined): Promise<string | undefined>;
|
|
38
|
+
promptForCommand(current: string | undefined): Promise<string>;
|
|
39
|
+
promptForArgs(current: string[] | undefined): Promise<string[] | undefined>;
|
|
40
|
+
private promptForSingleCommandArg;
|
|
41
|
+
promptForVersionRange(current: string | undefined): Promise<string | undefined>;
|
|
42
|
+
buildCommandString(candidate: IAssetEntrypointSetRequest, cmd: string[]): string[];
|
|
43
|
+
executeTask(candidate: IAssetEntrypointSetRequest): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|