@codiac.io/codiac-cli 1.3.43 → 1.3.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @codiac.io/codiac-cli
21
21
  $ codiac COMMAND
22
22
  running command...
23
23
  $ codiac (--version|-v)
24
- @codiac.io/codiac-cli/1.3.43 linux-x64 node-v16.17.1
24
+ @codiac.io/codiac-cli/1.3.45 linux-x64 node-v16.17.1
25
25
  $ codiac --help [COMMAND]
26
26
  USAGE
27
27
  $ codiac COMMAND
@@ -1,14 +1,25 @@
1
1
  import "reflect-metadata";
2
- import { CommandBaseEnterprise } from '../../command-base-enterprise';
2
+ import { Enterprise } from "../../apis/codiac-api/contracts";
3
+ import { Command } from '@oclif/core';
4
+ import { CommandBaseExecTenant } from '../../command-base-exec-tenant';
5
+ import { InteractionModes } from "../../uilogic/config-ui-utils";
6
+ export type EnterpriseCreateRequest = {
7
+ enterprise_code: string;
8
+ };
3
9
  export declare class MyTenantRequest {
4
10
  }
5
- export default class EnterpriseCreate extends CommandBaseEnterprise {
11
+ export default class EnterpriseCreate extends CommandBaseExecTenant<EnterpriseCreateRequest> {
6
12
  static description: string;
7
13
  static args: {
8
14
  code: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
9
15
  };
16
+ static examples: Command.Example[];
10
17
  static flags: {
11
18
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
19
+ silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
+ echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
+ "to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
22
+ "take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
23
  as: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
24
  remember: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
25
  rememberAs: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -16,5 +27,13 @@ export default class EnterpriseCreate extends CommandBaseEnterprise {
16
27
  withoutdefaults: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
28
  verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
29
  };
19
- run(): Promise<void>;
30
+ buildCommandString(candidate: EnterpriseCreateRequest, cmd: string[]): string[];
31
+ protected bootstrap(): void;
32
+ captureArgs(): Promise<[Partial<EnterpriseCreateRequest>, (InteractionModes | undefined), boolean]>;
33
+ validatePartial(partial: Partial<EnterpriseCreateRequest>): Promise<EnterpriseCreateRequest>;
34
+ getMyTenantSubscriptionId(): Promise<string>;
35
+ searchForExistingEnterprise(enterprise_code: string): Promise<Enterprise | undefined>;
36
+ buildCandidate_silently(partial: Partial<EnterpriseCreateRequest>): Promise<EnterpriseCreateRequest | undefined>;
37
+ buildCandidate_interactively(partial: Partial<EnterpriseCreateRequest>, takeDefaults: boolean): Promise<EnterpriseCreateRequest | undefined>;
38
+ executeTask(candidate: EnterpriseCreateRequest): Promise<void>;
20
39
  }
@@ -3,88 +3,109 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MyTenantRequest = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  require("reflect-metadata");
6
- const core_1 = require("@oclif/core");
7
6
  const cli_common_1 = require("../../cli-common");
8
- const command_base_enterprise_1 = require("../../command-base-enterprise");
9
7
  const cloud_provider_contextualizer_1 = require("../../uilogic/cloud-provider-contextualizer");
10
- // import { MyTenantRequest } from "@codiac.io/codiac-auth-contracts";
8
+ const core_1 = require("@oclif/core");
9
+ const command_base_exec_tenant_1 = require("../../command-base-exec-tenant");
10
+ const config_ui_utils_1 = require("../../uilogic/config-ui-utils");
11
11
  class MyTenantRequest {
12
12
  }
13
13
  exports.MyTenantRequest = MyTenantRequest;
14
- class EnterpriseCreate extends command_base_enterprise_1.CommandBaseEnterprise {
15
- run() {
14
+ class EnterpriseCreate extends command_base_exec_tenant_1.CommandBaseExecTenant {
15
+ buildCommandString(candidate, cmd) {
16
+ cmd.push(candidate.enterprise_code);
17
+ cmd.push("--silent");
18
+ return cmd;
19
+ }
20
+ bootstrap() {
21
+ super.bootstrap();
22
+ cloud_provider_contextualizer_1.CloudProviderContextualizer.bootstrap(this.ioc);
23
+ }
24
+ captureArgs() {
25
+ var _a, _b, _c;
26
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ const { args, flags } = yield this.parse(EnterpriseCreate);
28
+ let partial = {};
29
+ if (args.code)
30
+ partial.enterprise_code = args.code;
31
+ const interactionMode = (_b = (_a = (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);
32
+ const takeDefaults = (_c = flags['take-defaults']) !== null && _c !== void 0 ? _c : false;
33
+ return [partial, interactionMode, takeDefaults];
34
+ });
35
+ }
36
+ validatePartial(partial) {
16
37
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
- try {
18
- this.bootstrap();
19
- let params = yield this.parse(EnterpriseCreate);
20
- return this.exec.runWithDefaults(params, (args, flags) => tslib_1.__awaiter(this, void 0, void 0, function* () {
21
- return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- var _a;
23
- try {
24
- (_a = this._relayContainer) === null || _a === void 0 ? void 0 : _a.ready$.subscribe(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
25
- var _b, _c, _d, _e;
26
- cloud_provider_contextualizer_1.CloudProviderContextualizer.bootstrap(this.ioc);
27
- // TODO: Ensure that if the projCfg has a tenantCode, that establishTenantContext enforced it with the user authentication.
28
- // THAT IS: Boot 'em if they're not part of this project's tenant.
29
- this._userCntx = yield this.establishTenantContext(this._userCntx);
30
- // let currentEnterprise = (await this.establishEnterpriseContext()).enterprise;
31
- // let enterpriseCode = currentEnterprise.code; // NOTE: We could also pull this from: this._projUserCfg.enterprise.enterpriseCode;
32
- let partial = {};
33
- // ENTER CODE:
34
- let defaultCode = "main";
35
- partial.code = (_b = args.code) !== null && _b !== void 0 ? _b : (yield this._ui.prompt("code", "Enterprise code (no spaces): ", true, defaultCode));
36
- partial.code = (_c = partial.code) === null || _c === void 0 ? void 0 : _c.replace(" ", "");
37
- // validate that it doesnt already exist
38
- let found;
39
- do {
40
- let existings = yield this._codiacApi.Enterprise.readMany({ code: { $eq: partial.code } });
41
- found = existings.find(e => e.code === partial.code);
42
- if ((existings === null || existings === void 0 ? void 0 : existings.length) > 0) {
43
- this._ui.userMessage(`${this._styler.colorWarning("INVALID: ")} An enterprise with that name already exists for this tenant.`);
44
- partial.code = (yield this._ui.prompt("name", "Enterprise name (no spaces): ", true, partial.code));
45
- partial.code = (_d = partial.code) === null || _d === void 0 ? void 0 : _d.replace(" ", "");
46
- }
47
- } while (found !== undefined);
48
- // Assemble and write
49
- // httpRestVerb.GET, "/auth/my-tenant(/)"
50
- let tenantResult = yield this._codiacApi.Auth.MyTenant(MyTenantRequest, {}); // , tenantCode: this._userCntx.currentTenantCode
51
- // let tenantResult = await this._codiacApi.Subscription.tryReadMany({ all: true }, { forAnyTenant: true }); // , tenantCode: this._userCntx.currentTenantCode
52
- if (tenantResult.output === undefined) {
53
- throw new Error(`Cannot read the current tenant record [${this._userCntx.currentTenantCode}].`);
54
- }
55
- let subxId = (_e = tenantResult.output.currentSubscription) === null || _e === void 0 ? void 0 : _e.id; // This assertion operator is legit cuz we're pulling from a db read.
56
- let candidate = Object.assign({ code: partial.code, subscription: subxId, assets: [], products: [], domains: [] }, this.createAuditable());
57
- this._ui.startSpinner(`Creating new enterprise [${candidate.code}]...`);
58
- // let result = await this.relayClient.enterpriseCreate(partial.code!);
59
- let result = yield this._codiacApi.Enterprise.tryCreate(candidate);
60
- this._ui.stopSpinner("");
61
- if (result.error) {
62
- this.logger.error(`Error creating enterprise: ${result.message || ""}; ${result.error.message}`, result.error);
63
- this._ui.userMessage(`Error creating enterprise: ${result.message || ""}; ${result.error.message}`);
64
- }
65
- else if (!result.success) {
66
- this.logger.notice(`Enterprise creation failed without error. ${result.message}`);
67
- this._ui.userMessage(`Enterprise creation failed without error. ${result.message}`);
68
- }
69
- else if (result.output) {
70
- let saved = result.output;
71
- this.logger.notice(`${this._styler.colorGood("Success!")} Enterprise [${this._styler.hilite(saved.code)}] created for tenannt [${this._userCntx.currentTenantCode}]`);
72
- this._ui.userMessage(`${this._styler.colorGood("Success!")} Enterprise [${this._styler.hilite(saved.code)}] created for tenannt [${this._userCntx.currentTenantCode}]`);
73
- }
74
- }));
75
- }
76
- catch (err) {
77
- this.handleError(err);
78
- reject(err);
79
- }
80
- }));
81
- }));
38
+ if (!partial.enterprise_code) {
39
+ throw new Error("Enterprise code is required.");
40
+ }
41
+ return partial;
42
+ });
43
+ }
44
+ getMyTenantSubscriptionId() {
45
+ var _a;
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ // Assemble and write
48
+ // httpRestVerb.GET, "/auth/my-tenant(/)"
49
+ let tenantResult = yield this._codiacApi.Auth.MyTenant(MyTenantRequest, {}); // , tenantCode: this._userCntx.currentTenantCode
50
+ // let tenantResult = await this._codiacApi.Subscription.tryReadMany({ all: true }, { forAnyTenant: true }); // , tenantCode: this._userCntx.currentTenantCode
51
+ if (tenantResult.output === undefined) {
52
+ throw new Error(`Cannot read the current tenant record [${this._userCntx.currentTenantCode}].`);
53
+ }
54
+ let subxId = (_a = tenantResult.output.currentSubscription) === null || _a === void 0 ? void 0 : _a.id; // This assertion operator is legit cuz we're pulling from a db read.
55
+ return subxId;
56
+ });
57
+ }
58
+ searchForExistingEnterprise(enterprise_code) {
59
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
+ let existings = yield this._codiacApi.Enterprise.readMany({ code: { $eq: enterprise_code } });
61
+ let found = existings.find(e => e.code === enterprise_code);
62
+ return found;
63
+ });
64
+ }
65
+ buildCandidate_silently(partial) {
66
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
+ return yield this.validatePartial(partial);
68
+ });
69
+ }
70
+ buildCandidate_interactively(partial, takeDefaults) {
71
+ var _a;
72
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
73
+ let defaultCode = "main";
74
+ let found = {};
75
+ //default to main if no code provided vial CLI flag
76
+ partial.enterprise_code = partial.enterprise_code || defaultCode;
77
+ do {
78
+ //prompt for enterprise code defaulting to the value provided via CLI flag (or the default value if non provided)
79
+ partial.enterprise_code = (yield this._ui.prompt("name", "Enterprise name (no spaces): ", true, partial.enterprise_code));
80
+ partial.enterprise_code = (_a = partial.enterprise_code) === null || _a === void 0 ? void 0 : _a.replace(" ", "");
81
+ // validate that it doesnt already exist
82
+ found = yield this.searchForExistingEnterprise(partial.enterprise_code);
83
+ if (found !== undefined) {
84
+ this._ui.userMessage(`${this._styler.colorWarning("INVALID: ")} An enterprise with that name already exists for this tenant.`);
85
+ }
86
+ } while (found !== undefined);
87
+ return yield this.validatePartial(partial);
88
+ });
89
+ }
90
+ executeTask(candidate) {
91
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
92
+ let final_candidate = Object.assign({ code: candidate.enterprise_code, subscription: yield this.getMyTenantSubscriptionId(), assets: [], products: [], domains: [] }, this.createAuditable());
93
+ this._ui.startSpinner(`Creating new enterprise [${final_candidate.code}]...`);
94
+ // let result = await this.relayClient.enterpriseCreate(partial.code!);
95
+ let result = yield this._codiacApi.Enterprise.tryCreate(final_candidate);
96
+ this._ui.stopSpinner("");
97
+ if (result.error) {
98
+ this.logger.error(`Error creating enterprise: ${result.message || ""}; ${result.error.message}`, result.error);
99
+ this._ui.userMessage(`Error creating enterprise: ${result.message || ""}; ${result.error.message}`);
100
+ }
101
+ else if (!result.success) {
102
+ this.logger.notice(`Enterprise creation failed without error. ${result.message}`);
103
+ this._ui.userMessage(`Enterprise creation failed without error. ${result.message}`);
82
104
  }
83
- catch (err) {
84
- this.logger.error(`Error parsing arguments: ${err}`);
85
- this.logger.debug(err.stack);
86
- return new Promise((res, rej) => tslib_1.__awaiter(this, void 0, void 0, function* () { return res(); }));
87
- // return new Promise<void>(async (res,rej) => rej(new Error(`Error parsing arguments: ${err}`)));
105
+ else if (result.output) {
106
+ let saved = result.output;
107
+ this.logger.notice(`${this._styler.colorGood("Success!")} Enterprise [${this._styler.hilite(saved.code)}] created for tenannt [${this._userCntx.currentTenantCode}]`);
108
+ this._ui.userMessage(`${this._styler.colorGood("Success!")} Enterprise [${this._styler.hilite(saved.code)}] created for tenannt [${this._userCntx.currentTenantCode}]`);
88
109
  }
89
110
  });
90
111
  }
@@ -94,5 +115,12 @@ EnterpriseCreate.description = 'Creates a new enterprise under the current tenan
94
115
  EnterpriseCreate.args = {
95
116
  code: core_1.Args.string({ required: false, description: 'The unique human-readable identitifer to use for the enterprise (must be alphanunmeric with no spaces).' })
96
117
  };
97
- EnterpriseCreate.flags = Object.assign(Object.assign({}, cli_common_1.commandBase.globalFlags), { help: core_1.Flags.help({ char: 'h' }) });
118
+ EnterpriseCreate.examples = [
119
+ { description: "Create enterprise interactivley.", command: "cod enterprise create" },
120
+ { description: "Create enterprise interactivley with enterprise name.", command: "cod enterprise create my-enterprise-code" },
121
+ { description: "Create enterprise silently.", command: "cod enterprise create my-enterprise-code --silent" },
122
+ ];
123
+ EnterpriseCreate.flags = Object.assign(Object.assign({}, cli_common_1.commandBase.globalFlags), { help: core_1.Flags.help({ char: 'h' }), silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }), 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.' }), "to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
124
+ //Not sure what to do with this one yet
125
+ "take-defaults": core_1.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)." }) });
98
126
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/enterprise/create.ts"],"names":[],"mappings":";;;;AAAA,4BAA0B;AAC1B,sCAA0C;AAC1C,iDAA+C;AAC/C,2EAAqE;AACrE,+FAA0F;AAI1F,sEAAsE;AAGtE,MAAa,eAAe;CAE3B;AAFD,0CAEC;AAGD,MAAqB,gBAAiB,SAAQ,+CAAqB;IAY3D,GAAG;;YACP,IAAI;gBACF,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBAChD,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAO,IAAI,EAAE,KAAK,EAAE,EAAE;oBAC7D,OAAO,IAAI,OAAO,CAAO,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;;wBACjD,IAAI;4BACF,MAAA,IAAI,CAAC,eAAe,0CAAE,MAAM,CACzB,SAAS,CAAC,GAAS,EAAE;;gCAEpB,2DAA2B,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gCAEhD,4HAA4H;gCAC5H,mEAAmE;gCACnE,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gCAEnE,gFAAgF;gCAChF,qIAAqI;gCAErI,IAAI,OAAO,GAAwB,EAAE,CAAC;gCAEtC,cAAc;gCACd,IAAI,WAAW,GAAG,MAAM,CAAC;gCACzB,OAAO,CAAC,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,mCAAI,CAAC,MAAM,IAAI,CAAC,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ES_CLI_1 = require("../ops/INTERFACES_CLI");
15
15
  const Docker = require("dockerode");
16
16
  const DEFAULT_IMAGE_NAME = "codiacimages/codiac-relay";
17
- exports.DEFAULT_IMAGE_TAG = "1.4.16";
17
+ exports.DEFAULT_IMAGE_TAG = "1.4.24";
18
18
  const DEFAULT_CONTAINER_NAME = "codiac-relay";
19
19
  const DEFAULT_HEALTH_CHECK_URL = "http://localhost:5799/heartbeat-json"; // /ready-state";
20
20
  const DEFAULT_RETRY_TIMOUT_IN_MINUTES = 1;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.43",
2
+ "version": "1.3.45",
3
3
  "commands": {
4
4
  "branch": {
5
5
  "id": "branch",
@@ -3405,6 +3405,20 @@
3405
3405
  "pluginType": "core",
3406
3406
  "aliases": [],
3407
3407
  "hiddenAliases": [],
3408
+ "examples": [
3409
+ {
3410
+ "description": "Create enterprise interactivley.",
3411
+ "command": "cod enterprise create"
3412
+ },
3413
+ {
3414
+ "description": "Create enterprise interactivley with enterprise name.",
3415
+ "command": "cod enterprise create my-enterprise-code"
3416
+ },
3417
+ {
3418
+ "description": "Create enterprise silently.",
3419
+ "command": "cod enterprise create my-enterprise-code --silent"
3420
+ }
3421
+ ],
3408
3422
  "flags": {
3409
3423
  "as": {
3410
3424
  "name": "as",
@@ -3449,6 +3463,45 @@
3449
3463
  "char": "h",
3450
3464
  "description": "Show CLI help.",
3451
3465
  "allowNo": false
3466
+ },
3467
+ "silent": {
3468
+ "name": "silent",
3469
+ "type": "boolean",
3470
+ "description": "Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.",
3471
+ "allowNo": false,
3472
+ "exclusive": [
3473
+ "echo",
3474
+ "to-script"
3475
+ ]
3476
+ },
3477
+ "echo": {
3478
+ "name": "echo",
3479
+ "type": "boolean",
3480
+ "description": "Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.",
3481
+ "allowNo": false,
3482
+ "exclusive": [
3483
+ "to-script",
3484
+ "silent"
3485
+ ]
3486
+ },
3487
+ "to-script": {
3488
+ "name": "to-script",
3489
+ "type": "boolean",
3490
+ "description": "Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.",
3491
+ "allowNo": false,
3492
+ "exclusive": [
3493
+ "echo",
3494
+ "silent"
3495
+ ]
3496
+ },
3497
+ "take-defaults": {
3498
+ "name": "take-defaults",
3499
+ "type": "boolean",
3500
+ "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).",
3501
+ "allowNo": false,
3502
+ "exclusive": [
3503
+ "silent"
3504
+ ]
3452
3505
  }
3453
3506
  },
3454
3507
  "args": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codiac.io/codiac-cli",
3
3
  "description": "Local command line interface for managing enterprise assets and environments.",
4
- "version": "1.3.43",
4
+ "version": "1.3.45",
5
5
  "author": "Codiac",
6
6
  "bin": {
7
7
  "codiac": "./bin/run",
@@ -29,8 +29,8 @@
29
29
  "dependencies": {
30
30
  "@codiac.io/api-client-base": "^1.1.15",
31
31
  "@codiac.io/cli-tools": "^1.1.10",
32
- "@codiac.io/codiac-common": "^1.3.1",
33
- "@codiac.io/codiac-domain": "^1.6.1",
32
+ "@codiac.io/codiac-common": "^1.3.2",
33
+ "@codiac.io/codiac-domain": "^1.6.2",
34
34
  "@codiac.io/codiac-ops-common": "^1.2.1",
35
35
  "@codiac.io/codiac-relay-contracts": "^1.2.23",
36
36
  "@codiac.io/jwt-lib": "^1.1.6",