@codiac.io/codiac-cli 1.3.170 → 1.3.171

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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/dist/cli-common/built-in-cli-user-input.d.ts +1 -1
  3. package/dist/cli-common/built-in-cli-user-input.js +1 -0
  4. package/dist/cli-common/built-in-cli-user-input.js.map +1 -1
  5. package/dist/cli-common/prompt-select-fuzzy.js +2 -0
  6. package/dist/cli-common/prompt-select-fuzzy.js.map +1 -1
  7. package/dist/commands/asset/recycle.js +1 -0
  8. package/dist/commands/asset/recycle.js.map +1 -1
  9. package/dist/commands/asset/volume/create.js.map +1 -1
  10. package/dist/commands/asset/volume/delete.js.map +1 -1
  11. package/dist/commands/cli.js +1 -0
  12. package/dist/commands/cli.js.map +1 -1
  13. package/dist/commands/commit.js +1 -0
  14. package/dist/commands/commit.js.map +1 -1
  15. package/dist/commands/config/add.js.map +1 -1
  16. package/dist/commands/config/delete.js.map +1 -1
  17. package/dist/commands/config/view.js.map +1 -1
  18. package/dist/commands/dep/remove.js +1 -0
  19. package/dist/commands/dep/remove.js.map +1 -1
  20. package/dist/commands/dep/source.js +1 -0
  21. package/dist/commands/dep/source.js.map +1 -1
  22. package/dist/commands/dep/syncup.js +1 -0
  23. package/dist/commands/dep/syncup.js.map +1 -1
  24. package/dist/commands/dep/unsource.js +1 -0
  25. package/dist/commands/dep/unsource.js.map +1 -1
  26. package/dist/commands/dep/upgrade.js +2 -0
  27. package/dist/commands/dep/upgrade.js.map +1 -1
  28. package/dist/commands/deploy.js +3 -1
  29. package/dist/commands/deploy.js.map +1 -1
  30. package/dist/commands/identity/delete.js.map +1 -1
  31. package/dist/commands/imageRegistry/forget.js +0 -1
  32. package/dist/commands/imageRegistry/forget.js.map +1 -1
  33. package/dist/commands/imageRegistry/pullSecret/set.js +0 -1
  34. package/dist/commands/imageRegistry/pullSecret/set.js.map +1 -1
  35. package/dist/commands/imageRegistry/pullSecret/unset.js +3 -6
  36. package/dist/commands/imageRegistry/pullSecret/unset.js.map +1 -1
  37. package/dist/commands/kit/create.js +1 -0
  38. package/dist/commands/kit/create.js.map +1 -1
  39. package/dist/commands/merge.js +1 -0
  40. package/dist/commands/merge.js.map +1 -1
  41. package/dist/commands/pkg/remove.js +1 -0
  42. package/dist/commands/pkg/remove.js.map +1 -1
  43. package/dist/commands/pull.js.map +1 -1
  44. package/dist/commands/secretStore/capture.js +1 -3
  45. package/dist/commands/secretStore/capture.js.map +1 -1
  46. package/dist/commands/secretStore/forget.js +2 -4
  47. package/dist/commands/secretStore/forget.js.map +1 -1
  48. package/dist/commands/snapshot/tags.d.ts +89 -0
  49. package/dist/commands/snapshot/tags.js +543 -0
  50. package/dist/commands/snapshot/tags.js.map +1 -0
  51. package/dist/commands/stage.js +1 -0
  52. package/dist/commands/stage.js.map +1 -1
  53. package/dist/commands/switch.js.map +1 -1
  54. package/dist/commands/unstage.js +1 -0
  55. package/dist/commands/unstage.js.map +1 -1
  56. package/oclif.manifest.json +97 -1
  57. package/package.json +12 -9
@@ -1 +1 @@
1
- {"version":3,"file":"forget.js","sourceRoot":"","sources":["../../../src/commands/secretStore/forget.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AACpC,MAAM,YAAY,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAG7D,2EAAsE;AACtE,6CAA0C;AAC1C,+FAA0F;AAK1F,MAAqB,iBAAkB,SAAQ,+CAAqB;IAiBxD,SAAS;QACjB,KAAK,CAAC,SAAS,EAAE,CAAC;QAClB,2DAA2B,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,uEAAuE;IACvE,yBAAyB;IAEzB,uEAAuE;IAIjE,GAAG;;YACP,IAAI;gBACF,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,i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E,CAAC"}
@@ -0,0 +1,89 @@
1
+ import "reflect-metadata";
2
+ import { RootMap } from "../../apis/codiac-api/contracts";
3
+ import { CommandBaseExec, IEnterpriseEntity } from "../../command-base-exec";
4
+ import { AtLeast } from "@codiac.io/codiac-common/contracts";
5
+ import { InteractionModes } from "../../uilogic/config-ui-utils";
6
+ import { DocumentData } from "flexsearch";
7
+ export interface SnapShotData extends DocumentData {
8
+ id: string;
9
+ version: string;
10
+ date: string;
11
+ cabinets: string[];
12
+ tags: string[];
13
+ ownerTags: {
14
+ id: string;
15
+ name: string;
16
+ }[];
17
+ }
18
+ export interface Item {
19
+ [key: string]: any;
20
+ }
21
+ export type SnapShotDataFilter = {
22
+ expr: object;
23
+ input: string[];
24
+ };
25
+ export type SnapShotTagInfo = {
26
+ filters?: {
27
+ cabinets?: SnapShotDataFilter;
28
+ dates?: SnapShotDataFilter;
29
+ versions?: SnapShotDataFilter;
30
+ tags?: SnapShotDataFilter;
31
+ };
32
+ silent?: boolean;
33
+ pageSize?: number;
34
+ toScript?: {
35
+ enabled: boolean;
36
+ addTags?: Set<string>;
37
+ removeTags?: Set<string>;
38
+ snapShotData?: SnapShotData[];
39
+ };
40
+ } & Pick<SnapShotTagPiped, "add" | "remove"> & IEnterpriseEntity;
41
+ export interface SnapShotTagPiped {
42
+ filters?: {
43
+ cabinets?: string[];
44
+ dates?: string[];
45
+ versions?: string[];
46
+ tags?: string[];
47
+ };
48
+ add?: string[];
49
+ remove?: string[];
50
+ }
51
+ export default class SnapshotTags extends CommandBaseExec<SnapShotTagInfo> {
52
+ static description: string;
53
+ static examples: string[];
54
+ static flags: {
55
+ filterCabinets: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
56
+ filterDates: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
57
+ filterVersions: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
58
+ filterTags: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
59
+ silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
60
+ addTags: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
61
+ removeTags: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
62
+ toScript: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
63
+ "to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
64
+ pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
65
+ };
66
+ static args: {};
67
+ private indexedSnapShots;
68
+ captureArgs(): Promise<[Partial<SnapShotTagInfo>, InteractionModes | undefined, boolean]>;
69
+ protected runAsync(): Promise<void>;
70
+ buildCandidate_silently(partial: AtLeast<SnapShotTagInfo, "enterprise">, rootMap: RootMap): Promise<SnapShotTagInfo | undefined>;
71
+ buildCandidate_interactively(partial: AtLeast<SnapShotTagInfo, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<SnapShotTagInfo | undefined>;
72
+ buildCommandString(candidate: SnapShotTagInfo, cmd: string[]): string[];
73
+ executeTask(candidate: SnapShotTagInfo): Promise<void>;
74
+ private bulkManageTags;
75
+ private bulkAddTag;
76
+ private addTags;
77
+ private bulkRemoveTag;
78
+ private checkForTags;
79
+ private removeTags;
80
+ private multiSelect;
81
+ private multiSelectInstructions;
82
+ private getData;
83
+ private loadIndexed;
84
+ private getOptions;
85
+ private getCachedStore;
86
+ private reduceByField;
87
+ private toInQuery;
88
+ private clearScreen;
89
+ }
@@ -0,0 +1,543 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("reflect-metadata");
5
+ const core_1 = require("@oclif/core");
6
+ const core_2 = require("@oclif/core");
7
+ const inquirer_select_pro_1 = require("inquirer-select-pro");
8
+ const command_base_exec_1 = require("../../command-base-exec");
9
+ const config_ui_utils_1 = require("../../uilogic/config-ui-utils");
10
+ const flexsearch_1 = require("flexsearch");
11
+ class SnapshotTags extends command_base_exec_1.CommandBaseExec {
12
+ captureArgs() {
13
+ var _a, _b, _c, _d, _e, _f;
14
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+ const { flags } = yield this.parse(SnapshotTags);
16
+ let partial = {};
17
+ partial.pageSize = flags.pageSize;
18
+ let piped;
19
+ partial.toScript = { enabled: flags["to-script"] };
20
+ const pipedInput = this.pipedInput;
21
+ if (pipedInput) {
22
+ try {
23
+ piped = JSON.parse(pipedInput);
24
+ partial.silent = true;
25
+ partial.toScript = { enabled: false };
26
+ partial.add = [...((_a = flags.addTags) !== null && _a !== void 0 ? _a : []), ...((_b = piped === null || piped === void 0 ? void 0 : piped.add) !== null && _b !== void 0 ? _b : [])];
27
+ partial.remove = [...((_c = flags.removeTags) !== null && _c !== void 0 ? _c : []), ...((_d = piped === null || piped === void 0 ? void 0 : piped.remove) !== null && _d !== void 0 ? _d : [])];
28
+ }
29
+ catch (error) {
30
+ this.log(error);
31
+ throw new Error("Piped data is invalid");
32
+ }
33
+ }
34
+ partial.silent = partial.silent || flags.silent;
35
+ Object.entries(SnapshotTags.flags).forEach(([name, flagDef]) => {
36
+ var _a;
37
+ if (flagDef.expr) {
38
+ const expr = flagDef.expr;
39
+ partial.filters = partial.filters || {};
40
+ let data = [];
41
+ let flagset = flags[name] && Array.isArray(flags[name]) && flags[name].length > 0;
42
+ if (flagset) {
43
+ for (let index = 0; index < flags[name].length; index++) {
44
+ const element = flags[name][index];
45
+ data = [...data, ...element.split(',').map((t) => t.trim()).filter(Boolean)];
46
+ }
47
+ // data = [...flags[name]]
48
+ }
49
+ if (pipedInput && (piped === null || piped === void 0 ? void 0 : piped.filters)) {
50
+ const pipedData = (_a = piped.filters[expr.name]) !== null && _a !== void 0 ? _a : [];
51
+ data = [...(data !== null && data !== void 0 ? data : []), ...pipedData];
52
+ flagset = data.length > 0;
53
+ }
54
+ if (flagset)
55
+ partial.filters[expr.name] = { input: data, expr: this.toInQuery(data, expr.on) };
56
+ }
57
+ });
58
+ // ---------------------------------------------------------------
59
+ // TODO: move everything from here down into the base class
60
+ // ---------------------------------------------------------------
61
+ const interactionMode = (this.pipedInput) ? config_ui_utils_1.InteractionModes.silent : (_f = (_e = undefined !== null && undefined !== void 0 ? undefined : (flags.echo ? config_ui_utils_1.InteractionModes.echo : undefined)) !== null && _e !== void 0 ? _e : (flags["to-script"] ? config_ui_utils_1.InteractionModes.toscript : undefined)) !== null && _f !== void 0 ? _f : (flags.silent ? config_ui_utils_1.InteractionModes.silent : undefined);
62
+ const takeDefaults = flags['take-defaults'];
63
+ return [partial, interactionMode, takeDefaults];
64
+ });
65
+ }
66
+ runAsync() {
67
+ const _super = Object.create(null, {
68
+ runAsync: { get: () => super.runAsync }
69
+ });
70
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
+ yield _super.runAsync.call(this);
72
+ process.exit(0);
73
+ });
74
+ }
75
+ buildCandidate_silently(partial, rootMap) {
76
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
77
+ const snapshots = yield this.getData(partial);
78
+ const partialFull = partial;
79
+ if (partialFull.remove && Array.isArray(partialFull.remove) && partialFull.remove.length > 0) {
80
+ const allTags = this.checkForTags(snapshots);
81
+ if (!allTags || !Array.isArray(allTags) || (Array.isArray(allTags) && allTags.length === 0)) {
82
+ this.log('\nNo tags to remove');
83
+ }
84
+ else {
85
+ this.removeTags(snapshots, partialFull.remove, true);
86
+ }
87
+ }
88
+ if (partialFull.add && Array.isArray(partialFull.add) && partialFull.add.length > 0) {
89
+ this.addTags(snapshots, partialFull.add, true);
90
+ }
91
+ return partial;
92
+ });
93
+ }
94
+ buildCandidate_interactively(partial, rootMap, takeDefaults) {
95
+ var _a;
96
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
97
+ while (true) {
98
+ const selectedItems = yield this.multiSelect(partial);
99
+ if (!selectedItems || selectedItems.length === 0) {
100
+ return partial;
101
+ }
102
+ yield this.bulkManageTags(selectedItems, partial);
103
+ if ((_a = partial === null || partial === void 0 ? void 0 : partial.toScript) === null || _a === void 0 ? void 0 : _a.enabled) {
104
+ partial.toScript.snapShotData = selectedItems;
105
+ return partial;
106
+ }
107
+ const again = yield core_2.ux.prompt('\nBack to search (s) or (q)uit?', { type: 'single', default: 's' });
108
+ if (again.toLowerCase() === 'q') {
109
+ return partial;
110
+ }
111
+ }
112
+ });
113
+ }
114
+ buildCommandString(candidate, cmd) {
115
+ var _a, _b, _c;
116
+ this._ui.userMessage("");
117
+ cmd.push("--silent");
118
+ const addTags = ((_a = candidate.toScript) === null || _a === void 0 ? void 0 : _a.addTags) ? Array.from(candidate.toScript.addTags) : [];
119
+ for (let index = 0; index < addTags.length; index++) {
120
+ const tag = addTags[index];
121
+ cmd.push(`--addTags ${tag}`);
122
+ }
123
+ const removeTags = ((_b = candidate.toScript) === null || _b === void 0 ? void 0 : _b.removeTags) ? Array.from(candidate.toScript.removeTags) : [];
124
+ for (let index = 0; index < removeTags.length; index++) {
125
+ const tag = removeTags[index];
126
+ cmd.push(`--removeTags ${tag}`);
127
+ }
128
+ const snapShotData = ((_c = candidate.toScript) === null || _c === void 0 ? void 0 : _c.snapShotData) ? Array.from(candidate.toScript.snapShotData) : [];
129
+ for (let index = 0; index < snapShotData.length; index++) {
130
+ const item = snapShotData[index];
131
+ cmd.push(`--filterVersions ${item.version}`);
132
+ }
133
+ return cmd;
134
+ }
135
+ executeTask(candidate) {
136
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
137
+ process.exit(0);
138
+ });
139
+ }
140
+ bulkManageTags(snapshots, partial) {
141
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
142
+ while (true) {
143
+ this.log(`Selected ${snapshots.length} snapshot(s)\n`);
144
+ const action = yield core_2.ux.prompt('(a)dd tag to all (r)emove tag from all (d)one', { type: 'single', default: 'a' });
145
+ switch (action.toLowerCase()) {
146
+ case 'a':
147
+ yield this.bulkAddTag(snapshots, partial);
148
+ break;
149
+ case 'r':
150
+ yield this.bulkRemoveTag(snapshots, partial);
151
+ break;
152
+ case 'd':
153
+ return;
154
+ default:
155
+ this.log('Invalid option');
156
+ }
157
+ }
158
+ });
159
+ }
160
+ bulkAddTag(snapshots, partial) {
161
+ var _a, _b;
162
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
163
+ const tag = yield core_2.ux.prompt('\nEnter tag to ADD', { required: false });
164
+ const t = tag.trim();
165
+ if (!t)
166
+ return;
167
+ if ((_a = partial === null || partial === void 0 ? void 0 : partial.toScript) === null || _a === void 0 ? void 0 : _a.enabled) {
168
+ if (!((_b = partial === null || partial === void 0 ? void 0 : partial.toScript) === null || _b === void 0 ? void 0 : _b.addTags))
169
+ partial.toScript.addTags = new Set();
170
+ partial.toScript.addTags.add(t);
171
+ }
172
+ else {
173
+ yield this.addTags(snapshots, [t]);
174
+ }
175
+ });
176
+ }
177
+ addTags(snapshots, tagList, silent = false) {
178
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
179
+ const tagRepoOptions = {
180
+ throwNotFound: true,
181
+ projection: { pathsIncluded: ["ownerId", "name"], pathsExcluded: [] }
182
+ };
183
+ let added = [];
184
+ for (const s of snapshots) {
185
+ for (const t of tagList) {
186
+ if (!s.tags.includes(t)) {
187
+ s.tags.push(t);
188
+ s.tags.sort();
189
+ added.push({
190
+ name: t,
191
+ ownerId: s.id,
192
+ ownerType: "EnterpriseVersionConfig"
193
+ });
194
+ }
195
+ }
196
+ }
197
+ if (added.length > 0) {
198
+ core_2.ux.action.start('Saving tags');
199
+ try {
200
+ const tags = yield this._codiacApi.Tag.createMany(added, tagRepoOptions);
201
+ const ownerTagObjs = this.reduceByField(tags, 'ownerId');
202
+ for (const s of snapshots) {
203
+ s.ownerTags = [...s.ownerTags, ...ownerTagObjs[s.id]];
204
+ }
205
+ core_2.ux.action.stop('✓ Saved successfully');
206
+ }
207
+ catch (error) {
208
+ core_2.ux.action.stop('failed');
209
+ this.error(`Failed to save tags: ${error.message}`);
210
+ }
211
+ this.log(`\nAdded "${tagList.join(",")}" to ${added.length} snapshot(s)`);
212
+ if (silent)
213
+ yield core_2.ux.anykey('\nPress any key to continue...');
214
+ }
215
+ else {
216
+ this.log(`\nAll selected already have "${tagList.join(",")}"`);
217
+ }
218
+ });
219
+ }
220
+ bulkRemoveTag(snapshots, partial) {
221
+ var _a, _b;
222
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
223
+ const allTags = this.checkForTags(snapshots);
224
+ if (!allTags || !Array.isArray(allTags) || (Array.isArray(allTags) && allTags.length === 0)) {
225
+ this.log('\nNo tags to remove');
226
+ return;
227
+ }
228
+ try {
229
+ const tag = yield (0, inquirer_select_pro_1.select)({
230
+ message: 'Select tag to REMOVE',
231
+ options: allTags.map(t => ({ name: t, value: t })),
232
+ multiple: false,
233
+ });
234
+ if ((_a = partial === null || partial === void 0 ? void 0 : partial.toScript) === null || _a === void 0 ? void 0 : _a.enabled) {
235
+ if (!((_b = partial === null || partial === void 0 ? void 0 : partial.toScript) === null || _b === void 0 ? void 0 : _b.removeTags))
236
+ partial.toScript.removeTags = new Set();
237
+ partial.toScript.removeTags.add(tag);
238
+ }
239
+ else {
240
+ yield this.removeTags(snapshots, [tag]);
241
+ }
242
+ }
243
+ catch (error) {
244
+ return;
245
+ }
246
+ });
247
+ }
248
+ checkForTags(snapshots) {
249
+ const allTags = Array.from(new Set(snapshots.flatMap(s => s.tags)));
250
+ if (!allTags.length) {
251
+ this.log('\nNo tags to remove');
252
+ return undefined;
253
+ }
254
+ return allTags;
255
+ }
256
+ removeTags(snapshots, tagList, silent = false) {
257
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
258
+ const tagRepoOptions = {
259
+ throwNotFound: true,
260
+ projection: { pathsIncluded: ["ownerId", "name"], pathsExcluded: [] }
261
+ };
262
+ try {
263
+ let removed = [];
264
+ for (const s of snapshots) {
265
+ for (const tag of tagList) {
266
+ const i = s.tags.indexOf(tag);
267
+ const tagIdx = s.ownerTags.findIndex(t => t.name === tag);
268
+ if (i !== -1) {
269
+ removed.push(s.ownerTags[tagIdx].id);
270
+ s.tags.splice(i, 1);
271
+ s.ownerTags.splice(tagIdx, 1);
272
+ }
273
+ }
274
+ }
275
+ if (removed.length > 0) {
276
+ core_2.ux.action.start('Removing tags');
277
+ try {
278
+ yield this._codiacApi.Tag.deleteWhere({ ids: removed }, tagRepoOptions);
279
+ core_2.ux.action.stop('✓ Removed successfully');
280
+ }
281
+ catch (error) {
282
+ core_2.ux.action.stop('failed');
283
+ this.error(`Failed to remove tags: ${error.message}`);
284
+ }
285
+ this.log(`\nRemoved "${tagList.join(",")}" from ${removed.length} snapshot(s)`);
286
+ if (silent)
287
+ yield core_2.ux.anykey('\nPress any key to continue...');
288
+ }
289
+ else {
290
+ this.log(`\nNo snapshot had tag "${tagList.join(",")}"`);
291
+ }
292
+ }
293
+ catch (error) {
294
+ return;
295
+ }
296
+ });
297
+ }
298
+ multiSelect(partial) {
299
+ var _a;
300
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
301
+ try {
302
+ const result = yield (0, inquirer_select_pro_1.select)({
303
+ filter: true,
304
+ instructions: this.multiSelectInstructions,
305
+ message: 'Search & select snapshots',
306
+ multiple: true,
307
+ canToggleAll: true,
308
+ required: true,
309
+ options: (input = '') => tslib_1.__awaiter(this, void 0, void 0, function* () {
310
+ return this.getOptions(partial, input);
311
+ }),
312
+ theme: {
313
+ style: {
314
+ answer: (text) => {
315
+ if (text === '')
316
+ return '';
317
+ const items = text.split("Cabinets");
318
+ return Array.isArray(items) && items.length > 0 ? `${items.length - 1} items selected: ` : '';
319
+ },
320
+ },
321
+ },
322
+ pageSize: (_a = partial.pageSize) !== null && _a !== void 0 ? _a : 10,
323
+ loop: false
324
+ });
325
+ if (result && Array.isArray(result) && result.length > 0) {
326
+ const store = this.getCachedStore();
327
+ return result.map(i => store.get(i));
328
+ }
329
+ else
330
+ return null;
331
+ }
332
+ catch (error) {
333
+ return null;
334
+ }
335
+ });
336
+ }
337
+ multiSelectInstructions(context) {
338
+ const { theme } = context;
339
+ const keys = [];
340
+ keys.push(`${theme.style.key('tab')} to select/deselect`);
341
+ keys.push(`${theme.style.key('ctrl')} + ${theme.style.key('a')} to toggle all`);
342
+ keys.push(`${theme.style.key('enter')} to proceed`);
343
+ const helpTipTop = ` (Press ${keys.join(', ')})`;
344
+ const headerLine = `${'Versions'.padStart(13)}${'Date'.padStart(7)}`;
345
+ return `${helpTipTop}\n${headerLine}`;
346
+ }
347
+ getData(partial) {
348
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
349
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
350
+ const enterpriseVersionConfigsRepoOptions = {
351
+ throwNotFound: true,
352
+ projection: { pathsIncluded: ["version", "tags.name", "created"], pathsExcluded: [] }
353
+ };
354
+ const cabinetRepoOptions = {
355
+ throwNotFound: true,
356
+ projection: { pathsIncluded: ["enterpriseCode", "environment", "version", "name"], pathsExcluded: [] }
357
+ };
358
+ const tagRepoOptions = {
359
+ throwNotFound: true,
360
+ projection: { pathsIncluded: ["ownerId", "name"], pathsExcluded: [] }
361
+ };
362
+ let enterpriseVersionConfigCriteria;
363
+ const cabinetCriteria = { all: true };
364
+ let tagCriteria = { ownerType: "EnterpriseVersionConfig" };
365
+ const isCabinetFiltered = !!((_b = (_a = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _a === void 0 ? void 0 : _a.cabinets) === null || _b === void 0 ? void 0 : _b.expr);
366
+ const listCabinets = yield this._codiacApi.Cabinet.tryReadMany(isCabinetFiltered ? (_d = (_c = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _c === void 0 ? void 0 : _c.cabinets) === null || _d === void 0 ? void 0 : _d.expr : cabinetCriteria, cabinetRepoOptions);
367
+ if (isCabinetFiltered && (!(listCabinets.success && listCabinets.output && ((_e = listCabinets.output) === null || _e === void 0 ? void 0 : _e.length) > 0))) {
368
+ throw new Error('No Cabinets found. <ctrl> + c to exit');
369
+ }
370
+ const cabinets = (_f = listCabinets.output) !== null && _f !== void 0 ? _f : [];
371
+ if (isCabinetFiltered)
372
+ enterpriseVersionConfigCriteria = this.toInQuery(cabinets.map(c => c.version).filter((v) => v !== undefined), 'version');
373
+ let tags = [];
374
+ const isTagFiltered = !!((_h = (_g = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _g === void 0 ? void 0 : _g.tags) === null || _h === void 0 ? void 0 : _h.expr);
375
+ if (isTagFiltered) {
376
+ const listTags = yield this._codiacApi.Tag.tryReadMany(Object.assign(Object.assign({}, tagCriteria), (_k = (_j = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _j === void 0 ? void 0 : _j.tags) === null || _k === void 0 ? void 0 : _k.expr), tagRepoOptions);
377
+ if (!(listTags.success && listTags.output && ((_l = listTags.output) === null || _l === void 0 ? void 0 : _l.length) > 0)) {
378
+ throw new Error('No Tags found. <ctrl> + c to exit');
379
+ }
380
+ tags = listTags.output;
381
+ enterpriseVersionConfigCriteria = Object.assign(Object.assign({}, (enterpriseVersionConfigCriteria !== null && enterpriseVersionConfigCriteria !== void 0 ? enterpriseVersionConfigCriteria : {})), { ids: tags.map(c => c.ownerId).filter((v) => v !== undefined) });
382
+ }
383
+ const isVersionFiltered = !!((_o = (_m = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _m === void 0 ? void 0 : _m.versions) === null || _o === void 0 ? void 0 : _o.expr);
384
+ if (isVersionFiltered)
385
+ enterpriseVersionConfigCriteria = Object.assign(Object.assign({}, (enterpriseVersionConfigCriteria !== null && enterpriseVersionConfigCriteria !== void 0 ? enterpriseVersionConfigCriteria : {})), (_q = (_p = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _p === void 0 ? void 0 : _p.versions) === null || _q === void 0 ? void 0 : _q.expr);
386
+ const ListEnterpriseVersionConfigs = yield this._codiacApi.EnterpriseVersionConfig.
387
+ tryReadMany(enterpriseVersionConfigCriteria !== null && enterpriseVersionConfigCriteria !== void 0 ? enterpriseVersionConfigCriteria : { all: true }, enterpriseVersionConfigsRepoOptions);
388
+ if (!(ListEnterpriseVersionConfigs.success && ListEnterpriseVersionConfigs.output && ((_r = ListEnterpriseVersionConfigs.output) === null || _r === void 0 ? void 0 : _r.length) > 0)) {
389
+ throw new Error('No Versions found. <ctrl> + c to exit');
390
+ }
391
+ let enterpriseVersionConfigs = ListEnterpriseVersionConfigs.output;
392
+ const isDateFiltered = !!((_t = (_s = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _s === void 0 ? void 0 : _s.dates) === null || _t === void 0 ? void 0 : _t.expr);
393
+ if (isDateFiltered) {
394
+ const dateStrings = (_v = (_u = partial === null || partial === void 0 ? void 0 : partial.filters) === null || _u === void 0 ? void 0 : _u.dates) === null || _v === void 0 ? void 0 : _v.input;
395
+ const targetDays = new Set(dateStrings.map(d => new Date(d).toLocaleDateString('en-CA')));
396
+ enterpriseVersionConfigs = enterpriseVersionConfigs.filter((e) => {
397
+ return targetDays.has(new Date(e.created).toLocaleDateString('en-CA'));
398
+ });
399
+ if (enterpriseVersionConfigs.length === 0) {
400
+ throw new Error('No Versions found. <ctrl> + c to exit');
401
+ }
402
+ }
403
+ if (!isTagFiltered) {
404
+ tagCriteria = Object.assign(Object.assign({}, tagCriteria), (this.toInQuery(enterpriseVersionConfigs.map(e => e.id).filter((v) => v !== undefined), 'ownerId')));
405
+ tags = yield this._codiacApi.Tag.readMany(tagCriteria, Object.assign(Object.assign({}, tagRepoOptions), { throwNotFound: false }));
406
+ }
407
+ const ownerTagObjs = this.reduceByField(tags, 'ownerId');
408
+ const ownerTags = this.reduceByField(tags, 'ownerId', 'name');
409
+ const versionCabinets = this.reduceByField(cabinets, 'version', 'name');
410
+ const snapShotData = enterpriseVersionConfigs.map((v) => {
411
+ return {
412
+ id: v.id,
413
+ version: v.version,
414
+ date: (typeof v.created === 'string' ? new Date(v.created) : v.created).toLocaleDateString('en-US', {
415
+ month: '2-digit',
416
+ day: '2-digit',
417
+ year: 'numeric'
418
+ }),
419
+ cabinets: versionCabinets[v.version] || [],
420
+ tags: ownerTags[v.id] || [],
421
+ ownerTags: ownerTagObjs[v.id] || []
422
+ };
423
+ });
424
+ return snapShotData;
425
+ });
426
+ }
427
+ loadIndexed(partial) {
428
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
429
+ if (!this.indexedSnapShots) {
430
+ const snapShotData = yield this.getData(partial);
431
+ this.indexedSnapShots = new flexsearch_1.Document({
432
+ worker: true,
433
+ document: {
434
+ id: "id",
435
+ store: true,
436
+ index: [{
437
+ field: "version",
438
+ tokenize: "forward",
439
+ encoder: flexsearch_1.Charset.LatinAdvanced,
440
+ }, {
441
+ field: "dates",
442
+ tokenize: "forward",
443
+ encoder: flexsearch_1.Charset.LatinAdvanced
444
+ }, {
445
+ field: "cabinets",
446
+ tokenize: "forward",
447
+ encoder: flexsearch_1.Charset.LatinAdvanced
448
+ },
449
+ {
450
+ field: "tags",
451
+ tokenize: "forward",
452
+ encoder: flexsearch_1.Charset.LatinAdvanced
453
+ }
454
+ ],
455
+ }
456
+ });
457
+ for (let i = 0; i < snapShotData.length; i++) {
458
+ yield this.indexedSnapShots.add(snapShotData[i]);
459
+ }
460
+ }
461
+ return this.indexedSnapShots;
462
+ });
463
+ }
464
+ getOptions(partial, input = '') {
465
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
466
+ const formatData = (doc) => ({
467
+ name: `${doc.version.padEnd(10)} ${doc.date.padEnd(12)} Cabinets - [${doc.cabinets.join(', ')}] Tags - [${doc.tags.join(', ')}]`,
468
+ value: doc.id,
469
+ });
470
+ const indexedSnapShots = yield this.loadIndexed(partial);
471
+ let options = [];
472
+ if (input) {
473
+ const searchedResults = yield indexedSnapShots.search({
474
+ query: input,
475
+ // suggest: true,
476
+ enrich: true,
477
+ // index:["version"],
478
+ merge: true
479
+ });
480
+ options = searchedResults.map(s => {
481
+ const doc = s.doc;
482
+ return formatData(doc);
483
+ });
484
+ }
485
+ else {
486
+ const store = this.getCachedStore();
487
+ options = [...store].map((s) => {
488
+ const doc = s;
489
+ return formatData(doc[1]);
490
+ });
491
+ }
492
+ return options;
493
+ });
494
+ }
495
+ getCachedStore() {
496
+ const store = this.indexedSnapShots.store;
497
+ return store;
498
+ }
499
+ reduceByField(array, keyField, valueField) {
500
+ return array.reduce((acc, item) => {
501
+ const key = String(item[keyField]);
502
+ const value = valueField ? item[valueField] : item;
503
+ if (!acc[key]) {
504
+ acc[key] = [];
505
+ }
506
+ acc[key].push(value);
507
+ return acc;
508
+ }, {});
509
+ }
510
+ toInQuery(array, field) {
511
+ return {
512
+ [field]: { $in: array }
513
+ };
514
+ }
515
+ clearScreen() {
516
+ // process.stdout.write('\x1Bc')
517
+ }
518
+ }
519
+ exports.default = SnapshotTags;
520
+ SnapshotTags.description = 'manage snapshot version tags';
521
+ SnapshotTags.examples = [
522
+ '<%= config.bin %> <%= command.id %>',
523
+ '<%= config.bin %> <%= command.id %> --silent --addTags prod --addTags stable --filterVersions 10036A9Z --filterVersions 000000',
524
+ '<%= config.bin %> <%= command.id %> --silent --removeTags deprecated --removeTags stable --filterCabinet west',
525
+ 'echo -n \'{"filters":{"versions":["587JZ95N"]},"add":["tag1","tag2"]}\' | <%= config.bin %> <%= command.id %> --silent --addTags tag3 --filterVersions 00000000',
526
+ '<%= config.bin %> <%= command.id %> --to-script --filterVersions 10036A9Z',
527
+ ];
528
+ SnapshotTags.flags = {
529
+ filterCabinets: core_1.Flags.string({ char: 'c', multiple: true, description: 'Filter by cabinet', expr: { on: "name", name: "cabinets" } }),
530
+ filterDates: core_1.Flags.string({ char: 'd', multiple: true, description: 'Filter by exact date', expr: { on: "created", name: "dates" } }),
531
+ filterVersions: core_1.Flags.string({ char: 'v', multiple: true, description: 'Filter by version', expr: { on: "versions", name: "versions" } }),
532
+ filterTags: core_1.Flags.string({ char: 't', multiple: true, description: 'Filter by tag', expr: { on: "name", name: "tags" } }),
533
+ silent: core_1.Flags.boolean({ char: 's', description: 'Run in silent mode without interactive prompts' }),
534
+ addTags: core_1.Flags.string({ description: 'Tags to add', multiple: true, dependsOn: ['silent'] }),
535
+ removeTags: core_1.Flags.string({ description: 'Tags to remove', multiple: true, dependsOn: ['silent'] }),
536
+ toScript: core_1.Flags.boolean({ description: 'Generate script command without executing' }),
537
+ // echo: Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
538
+ "to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'scripts interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
539
+ pageSize: core_1.Flags.integer({ description: 'Number of records per page', default: 10 }),
540
+ // "take-defaults": Flags.boolean({ /* char: 'y', */ 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." })
541
+ };
542
+ SnapshotTags.args = {};
543
+ //# sourceMappingURL=tags.js.map