@northflank/cli 0.8.0-beta.1 → 0.8.1
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/dist/api-helpers.js +1 -191
- package/dist/cli.js +1 -564
- package/dist/command-overview.js +1 -93
- package/dist/console-format-helpers.js +1 -108
- package/dist/context/contextCommands.js +1 -417
- package/dist/defaults.js +1 -10408
- package/dist/exec/index.js +1 -257
- package/dist/inquirer-helper.js +1 -912
- package/dist/port-forward/index.js +1 -269
- package/dist/utils.js +1 -201
- package/package.json +2 -2
package/dist/inquirer-helper.js
CHANGED
|
@@ -1,912 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
-
function step(op) {
|
|
50
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
-
while (_) try {
|
|
52
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
-
switch (op[0]) {
|
|
55
|
-
case 0: case 1: t = op; break;
|
|
56
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
-
default:
|
|
60
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
-
if (t[2]) _.ops.pop();
|
|
65
|
-
_.trys.pop(); continue;
|
|
66
|
-
}
|
|
67
|
-
op = body.call(thisArg, _);
|
|
68
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
-
if (ar || !(i in from)) {
|
|
75
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
-
ar[i] = from[i];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
-
};
|
|
81
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
82
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
|
-
};
|
|
84
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
-
exports.InquirerHelper = void 0;
|
|
86
|
-
/* eslint-disable no-await-in-loop */
|
|
87
|
-
var _ = __importStar(require("lodash"));
|
|
88
|
-
var chalk_1 = __importDefault(require("chalk"));
|
|
89
|
-
var fs = __importStar(require("fs"));
|
|
90
|
-
var utils_1 = require("./utils");
|
|
91
|
-
var api_helpers_1 = require("./api-helpers");
|
|
92
|
-
var inquirer = require('inquirer');
|
|
93
|
-
var yaml = require('js-yaml');
|
|
94
|
-
var ConfirmChoices;
|
|
95
|
-
(function (ConfirmChoices) {
|
|
96
|
-
ConfirmChoices["YES"] = "Yes, send";
|
|
97
|
-
ConfirmChoices["REPEAT"] = "No, repeat";
|
|
98
|
-
ConfirmChoices["EDIT"] = "No, edit";
|
|
99
|
-
ConfirmChoices["SAVE"] = "No, but save as file";
|
|
100
|
-
ConfirmChoices["ABORT"] = "No, abort";
|
|
101
|
-
})(ConfirmChoices || (ConfirmChoices = {}));
|
|
102
|
-
var InquirerHelper = /** @class */ (function () {
|
|
103
|
-
function InquirerHelper(apiClient) {
|
|
104
|
-
var _this = this;
|
|
105
|
-
this.apiClient = apiClient;
|
|
106
|
-
this.editPayload = function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
107
|
-
var editedResult;
|
|
108
|
-
return __generator(this, function (_a) {
|
|
109
|
-
switch (_a.label) {
|
|
110
|
-
case 0: return [4 /*yield*/, inquirer.prompt([
|
|
111
|
-
{
|
|
112
|
-
type: 'editor',
|
|
113
|
-
name: 'editedResult',
|
|
114
|
-
message: 'Go to editor',
|
|
115
|
-
default: yaml.safeDump(result),
|
|
116
|
-
},
|
|
117
|
-
])];
|
|
118
|
-
case 1:
|
|
119
|
-
editedResult = (_a.sent()).editedResult;
|
|
120
|
-
return [2 /*return*/, yaml.safeLoad(editedResult)];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}); };
|
|
124
|
-
this.saveFile = function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
125
|
-
function prompFileName() {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
return __generator(this, function (_a) {
|
|
128
|
-
return [2 /*return*/, inquirer.prompt([
|
|
129
|
-
{
|
|
130
|
-
type: 'input',
|
|
131
|
-
name: 'fileName',
|
|
132
|
-
message: 'Provide a file path to write the configuration to (<name>.[json|yaml|yml])',
|
|
133
|
-
validate: function (input) {
|
|
134
|
-
return new RegExp('.*\\.(json|yaml|yml)$').test(input) ? true : fileTypeWarning(input);
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
])];
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
var fileTypeWarning, filePath, fileEnding;
|
|
142
|
-
return __generator(this, function (_a) {
|
|
143
|
-
switch (_a.label) {
|
|
144
|
-
case 0:
|
|
145
|
-
fileTypeWarning = function (fileEnding) {
|
|
146
|
-
return "Unexpected file type: ".concat(fileEnding, ", supported types: [json|yaml|yml]");
|
|
147
|
-
};
|
|
148
|
-
return [4 /*yield*/, prompFileName()];
|
|
149
|
-
case 1:
|
|
150
|
-
filePath = (_a.sent()).fileName;
|
|
151
|
-
fileEnding = filePath.toString().split('.').pop();
|
|
152
|
-
try {
|
|
153
|
-
switch (fileEnding) {
|
|
154
|
-
case 'json':
|
|
155
|
-
(0, utils_1.success)("Configuration file written to ".concat(filePath));
|
|
156
|
-
return [2 /*return*/, fs.writeFileSync(filePath, JSON.stringify(result, null, ' '))];
|
|
157
|
-
case 'yaml':
|
|
158
|
-
case 'yml':
|
|
159
|
-
(0, utils_1.success)("Configuration file written to ".concat(filePath));
|
|
160
|
-
return [2 /*return*/, fs.writeFileSync(filePath, yaml.safeDump(result))];
|
|
161
|
-
default:
|
|
162
|
-
(0, utils_1.warning)(fileTypeWarning(fileEnding));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
catch (e) {
|
|
166
|
-
(0, utils_1.warning)("Writing configuration failed: ".concat(e.message));
|
|
167
|
-
}
|
|
168
|
-
return [2 /*return*/, undefined];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}); };
|
|
172
|
-
this.filter = function (type, required) { return function (input) {
|
|
173
|
-
var sanitisedInput = typeof input === 'string' ? input.trim() : input;
|
|
174
|
-
if (type === 'number' && Number.isNaN(sanitisedInput))
|
|
175
|
-
return '';
|
|
176
|
-
return required === false && sanitisedInput === "don't change" ? '' : sanitisedInput;
|
|
177
|
-
}; };
|
|
178
|
-
this.validate = function (prop, required) { return function (input) {
|
|
179
|
-
var valid = [];
|
|
180
|
-
if (input === '' || input === "don't change") {
|
|
181
|
-
if (required !== false) {
|
|
182
|
-
valid.push("this option is required, please answer");
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (prop.type === 'string' && !_.isUndefined(prop.pattern)) {
|
|
189
|
-
valid.push(new RegExp(prop.pattern).test(input) ? true : "doesn't match pattern '".concat(prop.pattern, "'"));
|
|
190
|
-
}
|
|
191
|
-
if (prop.type === 'string' && !_.isUndefined(prop.minLength)) {
|
|
192
|
-
valid.push(input.length >= prop.minLength
|
|
193
|
-
? true
|
|
194
|
-
: "must be longer than or equal to ".concat(prop.minLength, " characters, is ").concat(input.length, " characters"));
|
|
195
|
-
}
|
|
196
|
-
if (prop.type === 'string' && !_.isUndefined(prop.maxLength)) {
|
|
197
|
-
valid.push(input.length <= prop.maxLength
|
|
198
|
-
? true
|
|
199
|
-
: "must be shorter than or equal to ".concat(prop.maxLength, " characters, is ").concat(input.length, " characters"));
|
|
200
|
-
}
|
|
201
|
-
if (prop.type === 'integer' && !_.isFinite(Number(input))) {
|
|
202
|
-
valid.push("must be a number, is ".concat(input));
|
|
203
|
-
}
|
|
204
|
-
if (prop.type === 'integer' && !_.isUndefined(prop.minimum)) {
|
|
205
|
-
valid.push(input >= prop.minimum ? true : "must be bigger than or equal to ".concat(prop.minimum));
|
|
206
|
-
}
|
|
207
|
-
if (prop.type === 'integer' && !_.isUndefined(prop.maximum)) {
|
|
208
|
-
valid.push(input <= prop.maximum ? true : "must be smaller than or equal to ".concat(prop.maximum));
|
|
209
|
-
}
|
|
210
|
-
if (prop.type === 'rawObject') {
|
|
211
|
-
var asJson = (0, utils_1.isValidJSON)(input);
|
|
212
|
-
valid.push(asJson === false || _.isEmpty(asJson) ? "must be a valid non-empty json string" : true);
|
|
213
|
-
}
|
|
214
|
-
var errors = valid.filter(function (e) { return e !== true; });
|
|
215
|
-
var example = (prop === null || prop === void 0 ? void 0 : prop.example)
|
|
216
|
-
? "\n".concat(chalk_1.default.red('>>'), " Example: ").concat(chalk_1.default.whiteBright(JSON.stringify(prop.example)))
|
|
217
|
-
: '';
|
|
218
|
-
return errors.length > 0 ? errors.join(chalk_1.default.underline(' and it ')) + example : true;
|
|
219
|
-
}; };
|
|
220
|
-
this.getPathString = function (propPath, question, description) {
|
|
221
|
-
var current = propPath[propPath.length - 1];
|
|
222
|
-
function stringifyPath() {
|
|
223
|
-
return propPath
|
|
224
|
-
.slice(0, -1)
|
|
225
|
-
.map(function (p) { return p.charAt(0).toUpperCase() + p.slice(1); })
|
|
226
|
-
.join('>');
|
|
227
|
-
}
|
|
228
|
-
var path = propPath.length > 1 ? "".concat(chalk_1.default.bgGrey.whiteBright(stringifyPath()), ": ") : '';
|
|
229
|
-
var descr = description ? " (".concat(chalk_1.default.blue(description), ")") : '';
|
|
230
|
-
return chalk_1.default.reset("".concat(path).concat(question, " ").concat(chalk_1.default.bold.greenBright(current)).concat(descr, "?"));
|
|
231
|
-
};
|
|
232
|
-
this.askForResource = function (resourceName, resourceNames, scopedBy) { return __awaiter(_this, void 0, void 0, function () {
|
|
233
|
-
var scope, message;
|
|
234
|
-
return __generator(this, function (_a) {
|
|
235
|
-
switch (_a.label) {
|
|
236
|
-
case 0:
|
|
237
|
-
if (resourceNames.length < 1) {
|
|
238
|
-
scope = scopedBy ? "for this ".concat(scopedBy) : 'found';
|
|
239
|
-
throw new Error("No ".concat(resourceName, " ").concat(scope, "."));
|
|
240
|
-
}
|
|
241
|
-
message = "Choose the ".concat(resourceName, " to use:");
|
|
242
|
-
return [4 /*yield*/, inquirer.prompt([{ type: 'list', name: 'name', message: message, choices: resourceNames }])];
|
|
243
|
-
case 1: return [2 /*return*/, (_a.sent()).name];
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}); };
|
|
247
|
-
this.askGeneric = function (resourceName, description) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
248
|
-
var descrMsg, message, validate;
|
|
249
|
-
return __generator(this, function (_a) {
|
|
250
|
-
switch (_a.label) {
|
|
251
|
-
case 0:
|
|
252
|
-
descrMsg = "".concat(description ? "(".concat(chalk_1.default.blue(description), ") ") : '');
|
|
253
|
-
message = "Enter the ".concat(chalk_1.default.green(resourceName), " ").concat(descrMsg, "to use:");
|
|
254
|
-
validate = this.validate({ type: 'string', required: true });
|
|
255
|
-
return [4 /*yield*/, inquirer.prompt([{ type: 'input', name: 'name', message: message, validate: validate }])];
|
|
256
|
-
case 1: return [2 /*return*/, (_a.sent()).name];
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
}); }; };
|
|
260
|
-
this.askForService = function (project) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
261
|
-
var apiCall;
|
|
262
|
-
var _this = this;
|
|
263
|
-
return __generator(this, function (_a) {
|
|
264
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
265
|
-
return __generator(this, function (_a) {
|
|
266
|
-
switch (_a.label) {
|
|
267
|
-
case 0: return [4 /*yield*/, this.apiClient.list.services({
|
|
268
|
-
parameters: { projectId: projectName },
|
|
269
|
-
options: { per_page: 100 },
|
|
270
|
-
})];
|
|
271
|
-
case 1: return [2 /*return*/, (_a.sent()).data.services.map(function (svc) { return svc.id; })];
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}); };
|
|
275
|
-
return [2 /*return*/, this.askForProjectScopedResource('service', apiCall, project)];
|
|
276
|
-
});
|
|
277
|
-
}); }; };
|
|
278
|
-
this.askForJob = function (project) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
279
|
-
var apiCall;
|
|
280
|
-
var _this = this;
|
|
281
|
-
return __generator(this, function (_a) {
|
|
282
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
283
|
-
return __generator(this, function (_a) {
|
|
284
|
-
switch (_a.label) {
|
|
285
|
-
case 0: return [4 /*yield*/, this.apiClient.list.jobs({
|
|
286
|
-
parameters: { projectId: projectName },
|
|
287
|
-
options: { per_page: 100 },
|
|
288
|
-
})];
|
|
289
|
-
case 1: return [2 /*return*/, (_a.sent()).data.jobs.map(function (job) { return job.id; })];
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
}); };
|
|
293
|
-
return [2 /*return*/, this.askForProjectScopedResource('job', apiCall, project)];
|
|
294
|
-
});
|
|
295
|
-
}); }; };
|
|
296
|
-
this.askForJobRun = function (jobName, project) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
297
|
-
var apiCall;
|
|
298
|
-
var _this = this;
|
|
299
|
-
return __generator(this, function (_a) {
|
|
300
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
301
|
-
return __generator(this, function (_a) {
|
|
302
|
-
switch (_a.label) {
|
|
303
|
-
case 0: return [4 /*yield*/, this.apiClient.get.job.runs({
|
|
304
|
-
parameters: { projectId: projectName, jobId: jobName },
|
|
305
|
-
options: { per_page: 100 },
|
|
306
|
-
})];
|
|
307
|
-
case 1: return [2 /*return*/, (_a.sent()).data.runs.map(function (job) { return "".concat(job.id, " (startedAt: ").concat(job.startedAt, ")"); })];
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
}); };
|
|
311
|
-
return [2 /*return*/, this.askForProjectScopedResource('job runs', apiCall, project, "job: '".concat(jobName, "'")).then(function (j) { return j.split(' ')[0]; })];
|
|
312
|
-
});
|
|
313
|
-
}); }; };
|
|
314
|
-
this.askForBuild = function (project, serviceId, jobId) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
315
|
-
var apiCall, apiCall;
|
|
316
|
-
var _this = this;
|
|
317
|
-
return __generator(this, function (_a) {
|
|
318
|
-
if (jobId !== undefined) {
|
|
319
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
320
|
-
return __generator(this, function (_a) {
|
|
321
|
-
switch (_a.label) {
|
|
322
|
-
case 0: return [4 /*yield*/, this.apiClient.get.job.builds({
|
|
323
|
-
parameters: { projectId: projectName, jobId: jobId },
|
|
324
|
-
options: { per_page: 100 },
|
|
325
|
-
})];
|
|
326
|
-
case 1: return [2 /*return*/, (_a.sent()).data.builds.map(function (build) { return "".concat(build.id, " (startedAt: ").concat(build.createdAt, ")"); })];
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}); };
|
|
330
|
-
return [2 /*return*/, this.askForProjectScopedResource('job builds', apiCall, project, "job: '".concat(jobId, "'")).then(function (j) { return j.split(' ')[0]; })];
|
|
331
|
-
}
|
|
332
|
-
if (serviceId !== undefined) {
|
|
333
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
334
|
-
return __generator(this, function (_a) {
|
|
335
|
-
switch (_a.label) {
|
|
336
|
-
case 0: return [4 /*yield*/, this.apiClient.get.service.builds({
|
|
337
|
-
parameters: { projectId: projectName, serviceId: serviceId },
|
|
338
|
-
options: { per_page: 100 },
|
|
339
|
-
})];
|
|
340
|
-
case 1: return [2 /*return*/, (_a.sent()).data.builds.map(function (build) { return "".concat(build.id, " (startedAt: ").concat(build.createdAt, ")"); })];
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}); };
|
|
344
|
-
return [2 /*return*/, this.askForProjectScopedResource('job build', apiCall, project, "service: '".concat(jobId, "'")).then(function (j) { return j.split(' ')[0]; })];
|
|
345
|
-
}
|
|
346
|
-
throw new Error('No builds found');
|
|
347
|
-
});
|
|
348
|
-
}); }; };
|
|
349
|
-
this.askForAddon = function (project) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
350
|
-
var apiCall;
|
|
351
|
-
var _this = this;
|
|
352
|
-
return __generator(this, function (_a) {
|
|
353
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
354
|
-
return __generator(this, function (_a) {
|
|
355
|
-
switch (_a.label) {
|
|
356
|
-
case 0: return [4 /*yield*/, this.apiClient.list.addons({
|
|
357
|
-
parameters: { projectId: projectName },
|
|
358
|
-
options: { per_page: 100 },
|
|
359
|
-
})];
|
|
360
|
-
case 1: return [2 /*return*/, (_a.sent()).data.addons.map(function (svc) { return svc.id; })];
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
}); };
|
|
364
|
-
return [2 /*return*/, this.askForProjectScopedResource('addon', apiCall, project)];
|
|
365
|
-
});
|
|
366
|
-
}); }; };
|
|
367
|
-
this.askForAddonBackup = function (project, addon) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
368
|
-
var apiCall;
|
|
369
|
-
var _this = this;
|
|
370
|
-
return __generator(this, function (_a) {
|
|
371
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
372
|
-
return __generator(this, function (_a) {
|
|
373
|
-
switch (_a.label) {
|
|
374
|
-
case 0: return [4 /*yield*/, this.apiClient.get.addon.backups({
|
|
375
|
-
parameters: {
|
|
376
|
-
projectId: projectName,
|
|
377
|
-
addonId: addon,
|
|
378
|
-
},
|
|
379
|
-
options: { per_page: 100 },
|
|
380
|
-
})];
|
|
381
|
-
case 1: return [2 /*return*/, (_a.sent()).data.backups.map(function (job) { return "".concat(job.id, " (completedAt: ").concat(job.completedAt || 'not completed', ")"); })];
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}); };
|
|
385
|
-
return [2 /*return*/, this.askForProjectScopedResource('backups', apiCall, project, "addon: '".concat(addon, "'")).then(function (j) { return j.split(' ')[0]; })];
|
|
386
|
-
});
|
|
387
|
-
}); }; };
|
|
388
|
-
this.askForVolume = function (project) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
389
|
-
var apiCall;
|
|
390
|
-
var _this = this;
|
|
391
|
-
return __generator(this, function (_a) {
|
|
392
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
393
|
-
return __generator(this, function (_a) {
|
|
394
|
-
switch (_a.label) {
|
|
395
|
-
case 0: return [4 /*yield*/, this.apiClient.list.volumes({ parameters: { projectId: projectName } })];
|
|
396
|
-
case 1: return [2 /*return*/, (_a.sent()).data.map(function (vol) { return vol.id; })];
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
}); };
|
|
400
|
-
return [2 /*return*/, this.askForProjectScopedResource('volume', apiCall, project)];
|
|
401
|
-
});
|
|
402
|
-
}); }; };
|
|
403
|
-
this.askForSecret = function (project) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
404
|
-
var apiCall;
|
|
405
|
-
var _this = this;
|
|
406
|
-
return __generator(this, function (_a) {
|
|
407
|
-
apiCall = function (projectName) { return __awaiter(_this, void 0, void 0, function () {
|
|
408
|
-
return __generator(this, function (_a) {
|
|
409
|
-
switch (_a.label) {
|
|
410
|
-
case 0: return [4 /*yield*/, this.apiClient.list.secrets({
|
|
411
|
-
parameters: { projectId: projectName },
|
|
412
|
-
options: { per_page: 100 },
|
|
413
|
-
})];
|
|
414
|
-
case 1: return [2 /*return*/, (_a.sent()).data.secrets.map(function (svc) { return svc.id; })];
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
}); };
|
|
418
|
-
return [2 /*return*/, this.askForProjectScopedResource('secret', apiCall, project)];
|
|
419
|
-
});
|
|
420
|
-
}); }; };
|
|
421
|
-
this.askForSubdomain = function (domain) { return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
422
|
-
var getDomainResponse, subdomains, scopedBy;
|
|
423
|
-
return __generator(this, function (_a) {
|
|
424
|
-
switch (_a.label) {
|
|
425
|
-
case 0: return [4 /*yield*/, this.apiClient.get.domain({
|
|
426
|
-
parameters: { domain: domain },
|
|
427
|
-
})];
|
|
428
|
-
case 1:
|
|
429
|
-
getDomainResponse = _a.sent();
|
|
430
|
-
subdomains = getDomainResponse.data.subdomains.map(function (d) { return "".concat(d.name, " (full domain: ").concat(d.fullName, ")"); });
|
|
431
|
-
scopedBy = "domain (".concat(domain, ")");
|
|
432
|
-
return [2 /*return*/, this.askForResource('subdomain', subdomains, scopedBy).then(function (j) { return j.split(' ')[0]; })];
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
}); }; };
|
|
436
|
-
this.deleteWarningPrompt = function (resourceString) { return __awaiter(_this, void 0, void 0, function () {
|
|
437
|
-
return __generator(this, function (_a) {
|
|
438
|
-
switch (_a.label) {
|
|
439
|
-
case 0: return [4 /*yield*/, inquirer.prompt([
|
|
440
|
-
{
|
|
441
|
-
type: 'confirm',
|
|
442
|
-
name: 'confirmation',
|
|
443
|
-
message: chalk_1.default.yellowBright("WARNING: You are about to delete ".concat(resourceString || 'a Northflank resource', ". This is irreversible. Please confirm!")),
|
|
444
|
-
default: false,
|
|
445
|
-
},
|
|
446
|
-
])];
|
|
447
|
-
case 1: return [2 /*return*/, (_a.sent()).confirmation];
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
}); };
|
|
451
|
-
this.loginPrompt = function (options, existingContexts) { return __awaiter(_this, void 0, void 0, function () {
|
|
452
|
-
var token;
|
|
453
|
-
var _this = this;
|
|
454
|
-
return __generator(this, function (_a) {
|
|
455
|
-
switch (_a.label) {
|
|
456
|
-
case 0:
|
|
457
|
-
if (!_.isUndefined(options.name)) return [3 /*break*/, 3];
|
|
458
|
-
if (!(existingContexts.length <= 0)) return [3 /*break*/, 1];
|
|
459
|
-
_.set(options, 'name', 'default');
|
|
460
|
-
return [3 /*break*/, 3];
|
|
461
|
-
case 1: return [4 /*yield*/, (0, utils_1.retry)(10)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
462
|
-
var name, c;
|
|
463
|
-
return __generator(this, function (_a) {
|
|
464
|
-
switch (_a.label) {
|
|
465
|
-
case 0: return [4 /*yield*/, inquirer.prompt([
|
|
466
|
-
{
|
|
467
|
-
type: 'input',
|
|
468
|
-
name: 'name',
|
|
469
|
-
message: 'Choose the name of the new local context:',
|
|
470
|
-
default: 'main-context',
|
|
471
|
-
},
|
|
472
|
-
])];
|
|
473
|
-
case 1:
|
|
474
|
-
name = (_a.sent()).name;
|
|
475
|
-
if (!(!options.override && existingContexts.find(function (ctx) { return ctx.name === name; }))) return [3 /*break*/, 3];
|
|
476
|
-
return [4 /*yield*/, inquirer.prompt([
|
|
477
|
-
{
|
|
478
|
-
type: 'confirm',
|
|
479
|
-
name: 'c',
|
|
480
|
-
message: "Context with name '".concat(name, "' already exists. Do you want to override this context (y) or enter a new name (N)?"),
|
|
481
|
-
default: false,
|
|
482
|
-
},
|
|
483
|
-
])];
|
|
484
|
-
case 2:
|
|
485
|
-
c = (_a.sent()).c;
|
|
486
|
-
if (c === false)
|
|
487
|
-
throw new Error('Context name already exists.');
|
|
488
|
-
_.set(options, 'override', true);
|
|
489
|
-
_a.label = 3;
|
|
490
|
-
case 3:
|
|
491
|
-
_.set(options, 'name', name);
|
|
492
|
-
return [2 /*return*/];
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
}); })];
|
|
496
|
-
case 2:
|
|
497
|
-
_a.sent();
|
|
498
|
-
_a.label = 3;
|
|
499
|
-
case 3:
|
|
500
|
-
if (!_.isUndefined(options.token)) return [3 /*break*/, 5];
|
|
501
|
-
return [4 /*yield*/, this.tokenPrompt()];
|
|
502
|
-
case 4:
|
|
503
|
-
token = _a.sent();
|
|
504
|
-
_.set(options, 'token', token);
|
|
505
|
-
_a.label = 5;
|
|
506
|
-
case 5: return [2 /*return*/, options];
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
}); };
|
|
510
|
-
this.tokenPrompt = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
511
|
-
var token;
|
|
512
|
-
return __generator(this, function (_a) {
|
|
513
|
-
switch (_a.label) {
|
|
514
|
-
case 0: return [4 /*yield*/, inquirer.prompt([
|
|
515
|
-
{
|
|
516
|
-
type: 'password',
|
|
517
|
-
name: 'token',
|
|
518
|
-
mask: '*',
|
|
519
|
-
message: 'Choose the login token:',
|
|
520
|
-
},
|
|
521
|
-
])];
|
|
522
|
-
case 1:
|
|
523
|
-
token = (_a.sent()).token;
|
|
524
|
-
return [2 /*return*/, token];
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
}); };
|
|
528
|
-
}
|
|
529
|
-
InquirerHelper.prototype.confirmationPrompt = function (result, defaultOpt) {
|
|
530
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
531
|
-
var resultDump, length, divider, confirm, _a, _b;
|
|
532
|
-
return __generator(this, function (_c) {
|
|
533
|
-
switch (_c.label) {
|
|
534
|
-
case 0:
|
|
535
|
-
resultDump = yaml.safeDump(result);
|
|
536
|
-
length = _.max(resultDump.split('\n').map(function (l) { return l.length; }));
|
|
537
|
-
divider = chalk_1.default.grey("".concat('-'.repeat(length), "\n"));
|
|
538
|
-
return [4 /*yield*/, inquirer.prompt([
|
|
539
|
-
{
|
|
540
|
-
type: 'list',
|
|
541
|
-
name: 'confirm',
|
|
542
|
-
message: "".concat(chalk_1.default.bold.green('Please confirm following configuration:\n')).concat(divider).concat(chalk_1.default.blueBright(resultDump)).concat(divider),
|
|
543
|
-
choices: Object.values(ConfirmChoices),
|
|
544
|
-
},
|
|
545
|
-
])];
|
|
546
|
-
case 1:
|
|
547
|
-
confirm = (_c.sent()).confirm;
|
|
548
|
-
_a = confirm;
|
|
549
|
-
switch (_a) {
|
|
550
|
-
case ConfirmChoices.YES: return [3 /*break*/, 2];
|
|
551
|
-
case ConfirmChoices.ABORT: return [3 /*break*/, 3];
|
|
552
|
-
case ConfirmChoices.REPEAT: return [3 /*break*/, 4];
|
|
553
|
-
case ConfirmChoices.EDIT: return [3 /*break*/, 5];
|
|
554
|
-
case ConfirmChoices.SAVE: return [3 /*break*/, 7];
|
|
555
|
-
}
|
|
556
|
-
return [3 /*break*/, 9];
|
|
557
|
-
case 2: return [2 /*return*/, result];
|
|
558
|
-
case 3: throw new Error('Aborted.');
|
|
559
|
-
case 4: return [2 /*return*/, this.retrievePayloadViaInteractiveCli(defaultOpt)];
|
|
560
|
-
case 5:
|
|
561
|
-
_b = this.confirmationPrompt;
|
|
562
|
-
return [4 /*yield*/, this.editPayload(result)];
|
|
563
|
-
case 6: return [2 /*return*/, _b.apply(this, [_c.sent(), defaultOpt])];
|
|
564
|
-
case 7: return [4 /*yield*/, this.saveFile(result)];
|
|
565
|
-
case 8:
|
|
566
|
-
_c.sent();
|
|
567
|
-
return [2 /*return*/, this.confirmationPrompt(result, defaultOpt)];
|
|
568
|
-
case 9: throw new Error('Something unexpected happened.');
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
});
|
|
572
|
-
};
|
|
573
|
-
InquirerHelper.prototype.retrievePayloadViaInteractiveCli = function (defaultOpt, ctx) {
|
|
574
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
575
|
-
var result;
|
|
576
|
-
return __generator(this, function (_a) {
|
|
577
|
-
switch (_a.label) {
|
|
578
|
-
case 0:
|
|
579
|
-
if ((ctx === null || ctx === void 0 ? void 0 : ctx.resultCache) !== undefined)
|
|
580
|
-
this.resultCache = ctx === null || ctx === void 0 ? void 0 : ctx.resultCache;
|
|
581
|
-
this.tmpCmdPath = ctx === null || ctx === void 0 ? void 0 : ctx.cmdPath;
|
|
582
|
-
result = {};
|
|
583
|
-
return [4 /*yield*/, this.propToType([], defaultOpt.opt.body, result)];
|
|
584
|
-
case 1:
|
|
585
|
-
_a.sent();
|
|
586
|
-
this.resultCache = result;
|
|
587
|
-
return [4 /*yield*/, this.confirmationPrompt(result, defaultOpt)];
|
|
588
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
});
|
|
592
|
-
};
|
|
593
|
-
InquirerHelper.prototype.propToType = function (propPath, prop, obj, required) {
|
|
594
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
595
|
-
var type, choice_1, oneOfProp;
|
|
596
|
-
return __generator(this, function (_a) {
|
|
597
|
-
switch (_a.label) {
|
|
598
|
-
case 0:
|
|
599
|
-
if (!(prop.oneOf && !_.has(prop, 'properties'))) return [3 /*break*/, 6];
|
|
600
|
-
if (!(prop.oneOf.length > 1)) return [3 /*break*/, 3];
|
|
601
|
-
return [4 /*yield*/, inquirer.prompt([
|
|
602
|
-
{
|
|
603
|
-
type: 'list',
|
|
604
|
-
name: 'choice',
|
|
605
|
-
message: "What's the ".concat(propPath[propPath.length - 1] || '', " type?"),
|
|
606
|
-
choices: prop.oneOf.map(function (p) { return p.description; }),
|
|
607
|
-
},
|
|
608
|
-
])];
|
|
609
|
-
case 1:
|
|
610
|
-
choice_1 = (_a.sent()).choice;
|
|
611
|
-
return [4 /*yield*/, this.getType(propPath, prop.oneOf.find(function (p) { return p.description === choice_1; }), obj, required)];
|
|
612
|
-
case 2:
|
|
613
|
-
type = _a.sent();
|
|
614
|
-
return [3 /*break*/, 5];
|
|
615
|
-
case 3:
|
|
616
|
-
oneOfProp = prop.oneOf[0];
|
|
617
|
-
_.set(oneOfProp, 'description', prop.description);
|
|
618
|
-
return [4 /*yield*/, this.getType(propPath, oneOfProp, obj, required)];
|
|
619
|
-
case 4:
|
|
620
|
-
type = _a.sent();
|
|
621
|
-
_a.label = 5;
|
|
622
|
-
case 5:
|
|
623
|
-
type = {};
|
|
624
|
-
return [3 /*break*/, 8];
|
|
625
|
-
case 6: return [4 /*yield*/, this.getType(propPath, prop, obj, required)];
|
|
626
|
-
case 7:
|
|
627
|
-
type = _a.sent();
|
|
628
|
-
_a.label = 8;
|
|
629
|
-
case 8: return [2 /*return*/, type];
|
|
630
|
-
}
|
|
631
|
-
});
|
|
632
|
-
});
|
|
633
|
-
};
|
|
634
|
-
InquirerHelper.prototype.getInnerType = function (prop, path, obj, required) {
|
|
635
|
-
var _a;
|
|
636
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
637
|
-
var addEntry, propertyKeys, requiredProps, _i, propertyKeys_1, propNameInner, innerPath;
|
|
638
|
-
return __generator(this, function (_b) {
|
|
639
|
-
switch (_b.label) {
|
|
640
|
-
case 0:
|
|
641
|
-
if (!(required === false)) return [3 /*break*/, 2];
|
|
642
|
-
return [4 /*yield*/, inquirer.prompt([
|
|
643
|
-
{
|
|
644
|
-
type: 'confirm',
|
|
645
|
-
name: 'addEntry',
|
|
646
|
-
message: this.getPathString(path, "Do you want to add", prop === null || prop === void 0 ? void 0 : prop.description),
|
|
647
|
-
default: false,
|
|
648
|
-
},
|
|
649
|
-
])];
|
|
650
|
-
case 1:
|
|
651
|
-
addEntry = (_b.sent()).addEntry;
|
|
652
|
-
if (!addEntry)
|
|
653
|
-
return [2 /*return*/, obj];
|
|
654
|
-
_b.label = 2;
|
|
655
|
-
case 2:
|
|
656
|
-
propertyKeys = Object.keys((_a = prop === null || prop === void 0 ? void 0 : prop.properties) !== null && _a !== void 0 ? _a : []);
|
|
657
|
-
requiredProps = prop.required || [];
|
|
658
|
-
if (!(propertyKeys.length > 0)) return [3 /*break*/, 7];
|
|
659
|
-
_i = 0, propertyKeys_1 = propertyKeys;
|
|
660
|
-
_b.label = 3;
|
|
661
|
-
case 3:
|
|
662
|
-
if (!(_i < propertyKeys_1.length)) return [3 /*break*/, 6];
|
|
663
|
-
propNameInner = propertyKeys_1[_i];
|
|
664
|
-
innerPath = path.concat(propNameInner);
|
|
665
|
-
// innerPath.concat(propNameInner);
|
|
666
|
-
// eslint-disable-next-line no-await-in-loop
|
|
667
|
-
if (path.length > 0 && !_.has(obj, path.join('.')))
|
|
668
|
-
_.set(obj, path.join('.'), {});
|
|
669
|
-
return [4 /*yield*/, this.propToType(innerPath, prop.properties[propNameInner], obj, requiredProps.includes(propNameInner))];
|
|
670
|
-
case 4:
|
|
671
|
-
_b.sent();
|
|
672
|
-
_b.label = 5;
|
|
673
|
-
case 5:
|
|
674
|
-
_i++;
|
|
675
|
-
return [3 /*break*/, 3];
|
|
676
|
-
case 6: return [3 /*break*/, 9];
|
|
677
|
-
case 7: return [4 /*yield*/, this.getType(path, __assign(__assign({}, prop), { type: 'rawObject' }), obj, required)];
|
|
678
|
-
case 8:
|
|
679
|
-
_b.sent();
|
|
680
|
-
_b.label = 9;
|
|
681
|
-
case 9: return [2 /*return*/, obj];
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
});
|
|
685
|
-
};
|
|
686
|
-
InquirerHelper.prototype.askArrayEntry = function (propPath, firstTime, required, description) {
|
|
687
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
688
|
-
var message, addEntry;
|
|
689
|
-
return __generator(this, function (_a) {
|
|
690
|
-
switch (_a.label) {
|
|
691
|
-
case 0:
|
|
692
|
-
if (firstTime && required) {
|
|
693
|
-
return [2 /*return*/, true];
|
|
694
|
-
}
|
|
695
|
-
message = firstTime ? "Do you want to add" : "Do you want to add more";
|
|
696
|
-
return [4 /*yield*/, inquirer.prompt([
|
|
697
|
-
{
|
|
698
|
-
type: 'confirm',
|
|
699
|
-
name: 'addEntry',
|
|
700
|
-
message: this.getPathString(propPath, message, firstTime ? description : undefined),
|
|
701
|
-
default: false,
|
|
702
|
-
},
|
|
703
|
-
])];
|
|
704
|
-
case 1:
|
|
705
|
-
addEntry = (_a.sent()).addEntry;
|
|
706
|
-
return [2 /*return*/, addEntry];
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
});
|
|
710
|
-
};
|
|
711
|
-
InquirerHelper.prototype.getType = function (propPath, prop, obj, required) {
|
|
712
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
713
|
-
var result, path, _a, firstTime, current, newEntry, _b;
|
|
714
|
-
return __generator(this, function (_c) {
|
|
715
|
-
switch (_c.label) {
|
|
716
|
-
case 0:
|
|
717
|
-
path = propPath.join('.');
|
|
718
|
-
_a = prop === null || prop === void 0 ? void 0 : prop.type;
|
|
719
|
-
switch (_a) {
|
|
720
|
-
case 'array': return [3 /*break*/, 1];
|
|
721
|
-
case 'object': return [3 /*break*/, 6];
|
|
722
|
-
case 'rawObject': return [3 /*break*/, 8];
|
|
723
|
-
case 'string': return [3 /*break*/, 10];
|
|
724
|
-
case 'boolean': return [3 /*break*/, 10];
|
|
725
|
-
case 'integer': return [3 /*break*/, 10];
|
|
726
|
-
}
|
|
727
|
-
return [3 /*break*/, 10];
|
|
728
|
-
case 1:
|
|
729
|
-
firstTime = true;
|
|
730
|
-
_c.label = 2;
|
|
731
|
-
case 2: return [4 /*yield*/, this.askArrayEntry(propPath, firstTime, required, prop === null || prop === void 0 ? void 0 : prop.description)];
|
|
732
|
-
case 3:
|
|
733
|
-
if (!_c.sent()) return [3 /*break*/, 5];
|
|
734
|
-
current = _.get(obj, path);
|
|
735
|
-
_.unset(obj, path);
|
|
736
|
-
return [4 /*yield*/, this.getType(propPath, prop.items, obj)];
|
|
737
|
-
case 4:
|
|
738
|
-
_c.sent();
|
|
739
|
-
newEntry = _.get(obj, path);
|
|
740
|
-
if (!_.isArray(current)) {
|
|
741
|
-
_.set(obj, path, [newEntry]);
|
|
742
|
-
}
|
|
743
|
-
else {
|
|
744
|
-
current.push(newEntry);
|
|
745
|
-
_.set(obj, path, current);
|
|
746
|
-
}
|
|
747
|
-
firstTime = false;
|
|
748
|
-
return [3 /*break*/, 2];
|
|
749
|
-
case 5:
|
|
750
|
-
// @ts-ignore
|
|
751
|
-
return [2 /*return*/, result || []];
|
|
752
|
-
case 6: return [4 /*yield*/, this.getInnerType(prop, propPath, obj, required)];
|
|
753
|
-
case 7:
|
|
754
|
-
result = _c.sent();
|
|
755
|
-
return [2 /*return*/, result];
|
|
756
|
-
case 8:
|
|
757
|
-
_b = utils_1.isValidJSON;
|
|
758
|
-
return [4 /*yield*/, this.ask(propPath, prop, required)];
|
|
759
|
-
case 9:
|
|
760
|
-
result = _b.apply(void 0, [_c.sent()]) || undefined;
|
|
761
|
-
return [3 /*break*/, 12];
|
|
762
|
-
case 10: return [4 /*yield*/, this.ask(propPath, prop, required, obj)];
|
|
763
|
-
case 11:
|
|
764
|
-
result = _c.sent();
|
|
765
|
-
return [3 /*break*/, 12];
|
|
766
|
-
case 12:
|
|
767
|
-
if (!_.isUndefined(result)) {
|
|
768
|
-
_.set(obj, path, result);
|
|
769
|
-
}
|
|
770
|
-
return [2 /*return*/, result];
|
|
771
|
-
}
|
|
772
|
-
});
|
|
773
|
-
});
|
|
774
|
-
};
|
|
775
|
-
InquirerHelper.prototype.ask = function (propPath, prop, required, currentObj) {
|
|
776
|
-
var _a;
|
|
777
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
778
|
-
var parentPropertyPath, _b, _c, defaultValue, _d, choices, type, defaultStr, requiredAdjustedChoices, questionConfig, result;
|
|
779
|
-
return __generator(this, function (_e) {
|
|
780
|
-
switch (_e.label) {
|
|
781
|
-
case 0:
|
|
782
|
-
parentPropertyPath = propPath[propPath.length - 1];
|
|
783
|
-
return [4 /*yield*/, (0, api_helpers_1.fetchResourceList)(parentPropertyPath, this.apiClient, this.tmpCmdPath, currentObj, this.pathVars, propPath)];
|
|
784
|
-
case 1:
|
|
785
|
-
_b = _e.sent(), _c = _b.defaultValue, defaultValue = _c === void 0 ? (_a = prop === null || prop === void 0 ? void 0 : prop.example) !== null && _a !== void 0 ? _a : prop === null || prop === void 0 ? void 0 : prop.default : _c, _d = _b.choices, choices = _d === void 0 ? prop === null || prop === void 0 ? void 0 : prop.enum : _d;
|
|
786
|
-
type = 'input';
|
|
787
|
-
if (!_.isUndefined(choices)) {
|
|
788
|
-
type = 'list';
|
|
789
|
-
}
|
|
790
|
-
else if ((prop === null || prop === void 0 ? void 0 : prop.type) === 'boolean') {
|
|
791
|
-
type = 'confirm';
|
|
792
|
-
}
|
|
793
|
-
else if ((prop === null || prop === void 0 ? void 0 : prop.type) === 'integer') {
|
|
794
|
-
type = 'number';
|
|
795
|
-
}
|
|
796
|
-
else if ((prop === null || prop === void 0 ? void 0 : prop.type) === 'rawObject') {
|
|
797
|
-
type = 'editor';
|
|
798
|
-
}
|
|
799
|
-
defaultStr =
|
|
800
|
-
// eslint-disable-next-line no-nested-ternary
|
|
801
|
-
required !== false
|
|
802
|
-
? !_.isObject(defaultValue)
|
|
803
|
-
? defaultValue
|
|
804
|
-
: JSON.stringify(defaultValue)
|
|
805
|
-
: _.isBoolean(defaultValue)
|
|
806
|
-
? defaultValue
|
|
807
|
-
: "don't change";
|
|
808
|
-
if (choices)
|
|
809
|
-
defaultStr = defaultStr.toString();
|
|
810
|
-
if (_.has(this.resultCache, propPath.join('.'))) {
|
|
811
|
-
defaultStr = this.resultCache[propPath.join('.')];
|
|
812
|
-
}
|
|
813
|
-
requiredAdjustedChoices = choices && required === false ? __spreadArray(__spreadArray([], choices, true), ["don't change"], false) : choices;
|
|
814
|
-
questionConfig = {
|
|
815
|
-
type: type,
|
|
816
|
-
name: 'id',
|
|
817
|
-
message: this.getQuestionString(propPath, prop),
|
|
818
|
-
choices: requiredAdjustedChoices,
|
|
819
|
-
default: defaultStr,
|
|
820
|
-
filter: this.filter(type, required),
|
|
821
|
-
validate: this.validate(prop, required),
|
|
822
|
-
};
|
|
823
|
-
return [4 /*yield*/, inquirer.prompt([questionConfig])];
|
|
824
|
-
case 2:
|
|
825
|
-
result = (_e.sent()).id;
|
|
826
|
-
return [2 /*return*/, result === "don't change" || result === '' ? undefined : result];
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
});
|
|
830
|
-
};
|
|
831
|
-
InquirerHelper.prototype.getQuestionString = function (propPath, prop) {
|
|
832
|
-
var question = (prop === null || prop === void 0 ? void 0 : prop.type) !== 'boolean' ? "What do you want to use as" : 'Should it be';
|
|
833
|
-
return this.getPathString(propPath, question, prop === null || prop === void 0 ? void 0 : prop.description);
|
|
834
|
-
};
|
|
835
|
-
InquirerHelper.prototype.askForProject = function () {
|
|
836
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
837
|
-
var projects, projectNames;
|
|
838
|
-
return __generator(this, function (_a) {
|
|
839
|
-
switch (_a.label) {
|
|
840
|
-
case 0: return [4 /*yield*/, this.apiClient.list.projects({})];
|
|
841
|
-
case 1:
|
|
842
|
-
projects = _a.sent();
|
|
843
|
-
projectNames = projects.data.projects.map(function (prj) { return prj.id; });
|
|
844
|
-
if (projectNames.length < 1) {
|
|
845
|
-
throw new Error("No projects in current context");
|
|
846
|
-
}
|
|
847
|
-
return [4 /*yield*/, inquirer.prompt([
|
|
848
|
-
{
|
|
849
|
-
type: 'list',
|
|
850
|
-
name: 'name',
|
|
851
|
-
message: "Choose the project to use:",
|
|
852
|
-
choices: projectNames,
|
|
853
|
-
},
|
|
854
|
-
])];
|
|
855
|
-
case 2: return [2 /*return*/, (_a.sent()).name];
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
});
|
|
859
|
-
};
|
|
860
|
-
InquirerHelper.prototype.askForProjectScopedResource = function (resourceName, apiCall, project, subScope) {
|
|
861
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
862
|
-
var projectName, resourceNames;
|
|
863
|
-
return __generator(this, function (_a) {
|
|
864
|
-
switch (_a.label) {
|
|
865
|
-
case 0:
|
|
866
|
-
projectName = project || this.apiClient.contextProvider.getCurrentProjectName();
|
|
867
|
-
if (_.isUndefined(projectName)) {
|
|
868
|
-
throw new Error('Default project in context not set and no argument provided.');
|
|
869
|
-
}
|
|
870
|
-
return [4 /*yield*/, apiCall(projectName)];
|
|
871
|
-
case 1:
|
|
872
|
-
resourceNames = _a.sent();
|
|
873
|
-
return [4 /*yield*/, this.askForResource(resourceName, resourceNames, "".concat(subScope ? "".concat(subScope, " in ") : '', "project: '").concat(projectName, "'"))];
|
|
874
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
875
|
-
}
|
|
876
|
-
});
|
|
877
|
-
});
|
|
878
|
-
};
|
|
879
|
-
InquirerHelper.prototype.askForDomain = function () {
|
|
880
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
881
|
-
var listDomainsResponse, domains;
|
|
882
|
-
return __generator(this, function (_a) {
|
|
883
|
-
switch (_a.label) {
|
|
884
|
-
case 0: return [4 /*yield*/, this.apiClient.list.domains({})];
|
|
885
|
-
case 1:
|
|
886
|
-
listDomainsResponse = _a.sent();
|
|
887
|
-
domains = listDomainsResponse.data.domains.map(function (d) { return d.name; });
|
|
888
|
-
return [2 /*return*/, this.askForResource('domain', domains)];
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
});
|
|
892
|
-
};
|
|
893
|
-
InquirerHelper.prototype.askForCredentials = function () {
|
|
894
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
895
|
-
var listCredentialsResponse, credentials;
|
|
896
|
-
return __generator(this, function (_a) {
|
|
897
|
-
switch (_a.label) {
|
|
898
|
-
case 0: return [4 /*yield*/, this.apiClient.list.registryCredentials({})];
|
|
899
|
-
case 1:
|
|
900
|
-
listCredentialsResponse = _a.sent();
|
|
901
|
-
credentials = listCredentialsResponse.data.credentials.map(function (d) { return d.id; });
|
|
902
|
-
return [2 /*return*/, this.askForResource('credentials', credentials)];
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
});
|
|
906
|
-
};
|
|
907
|
-
InquirerHelper.prototype.setPathVars = function (opt) {
|
|
908
|
-
this.pathVars = opt;
|
|
909
|
-
};
|
|
910
|
-
return InquirerHelper;
|
|
911
|
-
}());
|
|
912
|
-
exports.InquirerHelper = InquirerHelper;
|
|
1
|
+
'use strict';var a7u=['isArray','registryCredentials','fetchResourceList','json','project:\x20\x27','SAVE','1tkIVXD','\x20(startedAt:\x20','980918jOHggT','Please\x20confirm\x20following\x20configuration:\x0a','defineProperty','setPathVars','./api-helpers','safeDump','askForSubdomain','apply','value','deleteWarningPrompt','getInnerType','choices','length','contextProvider','\x20(full\x20domain:\x20','WARNING:\x20You\x20are\x20about\x20to\x20delete\x20','throw','ABORT','example','maxLength','__setModuleDefault','__createBinding','minLength','Default\x20project\x20in\x20context\x20not\x20set\x20and\x20no\x20argument\x20provided.','whiteBright','getType','builds','askForProjectScopedResource','includes','propToType','No,\x20repeat','push','message','.\x20This\x20is\x20irreversible.\x20Please\x20confirm!','1kVxxtJ','__generator','__importStar','must\x20be\x20a\x20valid\x20non-empty\x20json\x20string','Do\x20you\x20want\x20to\x20add','trys','filter','\x20(completedAt:\x20','No,\x20but\x20save\x20as\x20file','required','What\x20do\x20you\x20want\x20to\x20use\x20as','askForJob','1785cMOFtS','Enter\x20the\x20','No,\x20abort','chalk','6tAIinW','test','must\x20be\x20smaller\x20than\x20or\x20equal\x20to\x20','createdAt','editor','loginPrompt','inquirer','tmpCmdPath','No,\x20edit','retry','properties','writable','iterator','charAt','boolean','bgGrey','__spreadArray','addEntry','join','__awaiter','Choose\x20the\x20project\x20to\x20use:','split','jobs','for\x20this\x20','__esModule','resultCache','rawObject','a\x20Northflank\x20resource','done','Go\x20to\x20editor','prototype','fullName','592527vnUqgf','type','has','\x27\x20already\x20exists.\x20Do\x20you\x20want\x20to\x20override\x20this\x20context\x20(y)\x20or\x20enter\x20a\x20new\x20name\x20(N)?','stringify','confirm','Yes,\x20send','toUpperCase','minimum','subdomains','doesn\x27t\x20match\x20pattern\x20\x27','token','set','editedResult','input','__assign','bold','this\x20option\x20is\x20required,\x20please\x20answer','What\x27s\x20the\x20','then','pathVars','blue','Choose\x20the\x20','askForResource','apiClient','getPathString','volumes','map','create','659IVmDTA','job:\x20\x27','1184219FpauIm','.*\x5c.(json|yaml|yml)$','confirmation','array','askForProject','job\x20builds','confirmationPrompt','job\x20build','don\x27t\x20change','Aborted.','InquirerHelper','sent','isNaN','askForBuild','saveFile','No\x20builds\x20found','YES','return','get','oneOf','retrievePayloadViaInteractiveCli','\x20in\x20','askArrayEntry','44ekmLVn','enum','isValidJSON','toString','label','addon','cmdPath','call','projects',',\x20supported\x20types:\x20[json|yaml|yml]','Do\x20you\x20want\x20to\x20add\x20more','ask','REPEAT','not\x20completed','defaultValue','greenBright','number','isEmpty','ops','string','data','Context\x20name\x20already\x20exists.','\x20and\x20it\x20','hasOwnProperty','./utils','success','yml','must\x20be\x20bigger\x20than\x20or\x20equal\x20to\x20','Provide\x20a\x20file\x20path\x20to\x20write\x20the\x20configuration\x20to\x20(<name>.[json|yaml|yml])','Writing\x20configuration\x20failed:\x20','addons','items','No\x20projects\x20in\x20current\x20context','599SlCEcG','domains','Should\x20it\x20be','blueBright','grey','askForService','service:\x20\x27','isObject','getQuestionString','109669TCFRjx','Context\x20with\x20name\x20\x27','askForVolume','warning','object','to\x20use:','subdomain','pop','Choose\x20the\x20login\x20token:','Choose\x20the\x20name\x20of\x20the\x20new\x20local\x20context:','assign','trim','underline','max','secrets','askForDomain','services','found','isUndefined','find','yellowBright','slice','job','\x20characters,\x20is\x20','prompt','askForJobRun','getCurrentProjectName','runs','name','list','domain','558357JezoQl','EDIT','function','secret','pattern','override','concat','getOwnPropertyDescriptor','green','values','volume','fileName','maximum','Unexpected\x20file\x20type:\x20','domain\x20(','default','opt','credentials','editPayload','choice','description','Configuration\x20file\x20written\x20to\x20','lodash','writeFileSync','integer','askForAddonBackup','service','isFinite','validate'];var a7W=a7F;(function(u,F){var f=a7F;while(!![]){try{var j=-parseInt(f(0x27c))*-parseInt(f(0x295))+parseInt(f(0x20d))+-parseInt(f(0x2b6))*-parseInt(f(0x23b))+-parseInt(f(0x27e))*-parseInt(f(0x20b))+parseInt(f(0x1c9))+parseInt(f(0x22f))*parseInt(f(0x25f))+parseInt(f(0x23f))*-parseInt(f(0x1e8));if(j===F)break;else u['push'](u['shift']());}catch(L){u['push'](u['shift']());}}}(a7u,0x963ea));function a7F(u,F){u=u-0x1c7;var j=a7u[u];return j;}var __assign=this&&this[a7W(0x26e)]||function(){var S=a7W;return __assign=Object[S(0x1d3)]||function(u){var D=S;for(var F,j=0x1,L=arguments[D(0x219)];j<L;j++){F=arguments[j];for(var R in F)if(Object[D(0x25d)][D(0x2ac)][D(0x29c)](F,R))u[R]=F[R];}return u;},__assign['apply'](this,arguments);},__createBinding=this&&this[a7W(0x222)]||(Object[a7W(0x27b)]?function(u,F,j,L){var Q=a7W;if(L===undefined)L=j;var R=Object[Q(0x1ef)](F,j);(!R||(Q(0x290)in R?!F[Q(0x257)]:R[Q(0x24a)]||R['configurable']))&&(R={'enumerable':!![],'get':function(){return F[j];}}),Object[Q(0x20f)](u,L,R);}:function(u,F,j,L){if(L===undefined)L=j;u[L]=F[j];}),__setModuleDefault=this&&this[a7W(0x221)]||(Object['create']?function(u,F){var X=a7W;Object[X(0x20f)](u,'default',{'enumerable':!![],'value':F});}:function(u,F){var M=a7W;u[M(0x1f7)]=F;}),__importStar=this&&this[a7W(0x231)]||function(u){var a=a7W;if(u&&u['__esModule'])return u;var F={};if(u!=null){for(var j in u)if(j!==a(0x1f7)&&Object[a(0x25d)][a(0x2ac)]['call'](u,j))__createBinding(F,u,j);}return __setModuleDefault(F,u),F;},__awaiter=this&&this[a7W(0x252)]||function(u,F,j,L){function R(z){return z instanceof j?z:new j(function(y){y(z);});}return new(j||(j=Promise))(function(z,y){function V(l){try{h(L['next'](l));}catch(t){y(t);}}function g(l){try{h(L['throw'](l));}catch(t){y(t);}}function h(l){var I=a7F;l[I(0x25b)]?z(l[I(0x215)]):R(l[I(0x215)])[I(0x272)](V,g);}h((L=L['apply'](u,F||[]))['next']());});},__generator=this&&this[a7W(0x230)]||function(u,F){var T=a7W,j={'label':0x0,'sent':function(){if(z[0x0]&0x1)throw z[0x1];return z[0x1];},'trys':[],'ops':[]},L,R,z,V;return V={'next':h(0x0),'throw':h(0x1),'return':h(0x2)},typeof Symbol===T(0x1ea)&&(V[Symbol[T(0x24b)]]=function(){return this;}),V;function h(B){return function(O){return l([B,O]);};}function l(B){var N=T;if(L)throw new TypeError('Generator\x20is\x20already\x20executing.');while(j)try{if(L=0x1,R&&(z=B[0x0]&0x2?R['return']:B[0x0]?R[N(0x21d)]||((z=R[N(0x28f)])&&z['call'](R),0x0):R['next'])&&!(z=z[N(0x29c)](R,B[0x1]))[N(0x25b)])return z;if(R=0x0,z)B=[B[0x0]&0x2,z[N(0x215)]];switch(B[0x0]){case 0x0:case 0x1:z=B;break;case 0x4:j[N(0x299)]++;return{'value':B[0x1],'done':![]};case 0x5:j[N(0x299)]++,R=B[0x1],B=[0x0];continue;case 0x7:B=j[N(0x2a7)]['pop'](),j['trys'][N(0x1d0)]();continue;default:if(!(z=j[N(0x234)],z=z['length']>0x0&&z[z[N(0x219)]-0x1])&&(B[0x0]===0x6||B[0x0]===0x2)){j=0x0;continue;}if(B[0x0]===0x3&&(!z||B[0x1]>z[0x0]&&B[0x1]<z[0x3])){j[N(0x299)]=B[0x1];break;}if(B[0x0]===0x6&&j[N(0x299)]<z[0x1]){j['label']=z[0x1],z=B;break;}if(z&&j[N(0x299)]<z[0x2]){j[N(0x299)]=z[0x2],j['ops'][N(0x22c)](B);break;}if(z[0x2])j[N(0x2a7)][N(0x1d0)]();j[N(0x234)][N(0x1d0)]();continue;}B=F[N(0x29c)](u,j);}catch(O){B=[0x6,O],R=0x0;}finally{L=z=0x0;}if(B[0x0]&0x5)throw B[0x1];return{'value':B[0x0]?B[0x1]:void 0x0,'done':!![]};}},__spreadArray=this&&this[a7W(0x24f)]||function(u,F,j){var P=a7W;if(j||arguments['length']===0x2)for(var L=0x0,R=F[P(0x219)],z;L<R;L++){if(z||!(L in F)){if(!z)z=Array[P(0x25d)]['slice'][P(0x29c)](F,0x0,L);z[L]=F[L];}}return u[P(0x1ee)](z||Array['prototype']['slice'][P(0x29c)](F));},__importDefault=this&&this['__importDefault']||function(u){var K=a7W;return u&&u[K(0x257)]?u:{'default':u};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[a7W(0x288)]=void 0x0;var _=__importStar(require(a7W(0x1fe))),chalk_1=__importDefault(require(a7W(0x23e))),fs=__importStar(require('fs')),utils_1=require(a7W(0x2ad)),api_helpers_1=require(a7W(0x211)),inquirer=require(a7W(0x245)),yaml=require('js-yaml'),ConfirmChoices;(function(u){var m=a7W;u[m(0x28e)]=m(0x265),u[m(0x2a1)]=m(0x22b),u[m(0x1e9)]=m(0x247),u[m(0x20a)]=m(0x237),u[m(0x21e)]=m(0x23d);}(ConfirmChoices||(ConfirmChoices={})));var InquirerHelper=function(){var uo=a7W;function u(F){var e=a7F,j=this;this['apiClient']=F,this[e(0x1fa)]=function(L){return __awaiter(j,void 0x0,void 0x0,function(){var R;return __generator(this,function(z){var c=a7F;switch(z[c(0x299)]){case 0x0:return[0x4,inquirer[c(0x1e1)]([{'type':c(0x243),'name':c(0x26c),'message':c(0x25c),'default':yaml[c(0x212)](L)}])];case 0x1:R=z[c(0x289)]()[c(0x26c)];return[0x2,yaml['safeLoad'](R)];}});});},this[e(0x28c)]=function(L){return __awaiter(j,void 0x0,void 0x0,function(){function R(){return __awaiter(this,void 0x0,void 0x0,function(){return __generator(this,function(g){var x=a7F;return[0x2,inquirer[x(0x1e1)]([{'type':x(0x26d),'name':x(0x1f3),'message':x(0x2b1),'validate':function(h){var i=x;return new RegExp(i(0x27f))[i(0x240)](h)?!![]:z(h);}}])];});});}var z,y,V;return __generator(this,function(g){var b=a7F;switch(g[b(0x299)]){case 0x0:z=function(h){var A=b;return A(0x1f5)[A(0x1ee)](h,A(0x29e));};return[0x4,R()];case 0x1:y=g[b(0x289)]()[b(0x1f3)],V=y[b(0x298)]()['split']('.')[b(0x1d0)]();try{switch(V){case b(0x208):(0x0,utils_1[b(0x2ae)])('Configuration\x20file\x20written\x20to\x20'['concat'](y));return[0x2,fs['writeFileSync'](y,JSON[b(0x263)](L,null,'\x20\x20'))];case'yaml':case b(0x2af):(0x0,utils_1['success'])(b(0x1fd)[b(0x1ee)](y));return[0x2,fs[b(0x1ff)](y,yaml[b(0x212)](L))];default:(0x0,utils_1[b(0x1cc)])(z(V));}}catch(h){(0x0,utils_1[b(0x1cc)])(b(0x2b2)['concat'](h[b(0x22d)]));}return[0x2,undefined];}});});},this[e(0x235)]=function(L,R){return function(z){var Y=a7F,y=typeof z===Y(0x2a8)?z[Y(0x1d4)]():z;if(L===Y(0x2a5)&&Number[Y(0x28a)](y))return'';return R===![]&&y===Y(0x286)?'':y;};},this[e(0x204)]=function(L,R){return function(z){var Z=a7F,y=[];if(z===''||z===Z(0x286)){if(R!==![])y['push'](Z(0x270));else return!![];}L[Z(0x260)]==='string'&&!_['isUndefined'](L['pattern'])&&y['push'](new RegExp(L['pattern'])[Z(0x240)](z)?!![]:Z(0x269)[Z(0x1ee)](L[Z(0x1ec)],'\x27'));L[Z(0x260)]===Z(0x2a8)&&!_[Z(0x1db)](L[Z(0x223)])&&y['push'](z[Z(0x219)]>=L['minLength']?!![]:'must\x20be\x20longer\x20than\x20or\x20equal\x20to\x20'[Z(0x1ee)](L[Z(0x223)],Z(0x1e0))['concat'](z[Z(0x219)],'\x20characters'));L['type']===Z(0x2a8)&&!_[Z(0x1db)](L[Z(0x220)])&&y[Z(0x22c)](z[Z(0x219)]<=L[Z(0x220)]?!![]:'must\x20be\x20shorter\x20than\x20or\x20equal\x20to\x20'[Z(0x1ee)](L[Z(0x220)],Z(0x1e0))[Z(0x1ee)](z[Z(0x219)],'\x20characters'));L[Z(0x260)]===Z(0x200)&&!_[Z(0x203)](Number(z))&&y[Z(0x22c)]('must\x20be\x20a\x20number,\x20is\x20'[Z(0x1ee)](z));L['type']===Z(0x200)&&!_[Z(0x1db)](L[Z(0x267)])&&y[Z(0x22c)](z>=L[Z(0x267)]?!![]:Z(0x2b0)[Z(0x1ee)](L['minimum']));L[Z(0x260)]===Z(0x200)&&!_[Z(0x1db)](L['maximum'])&&y['push'](z<=L[Z(0x1f4)]?!![]:Z(0x241)[Z(0x1ee)](L[Z(0x1f4)]));if(L[Z(0x260)]===Z(0x259)){var V=(0x0,utils_1['isValidJSON'])(z);y['push'](V===![]||_[Z(0x2a6)](V)?Z(0x232):!![]);}var g=y[Z(0x235)](function(l){return l!==!![];}),h=(L===null||L===void 0x0?void 0x0:L[Z(0x21f)])?'\x0a'[Z(0x1ee)](chalk_1[Z(0x1f7)]['red']('>>'),'\x20Example:\x20')[Z(0x1ee)](chalk_1[Z(0x1f7)][Z(0x225)](JSON[Z(0x263)](L[Z(0x21f)]))):'';return g[Z(0x219)]>0x0?g[Z(0x251)](chalk_1[Z(0x1f7)][Z(0x1d5)](Z(0x2ab)))+h:!![];};},this['getPathString']=function(L,R,z){var E=e,y=L[L[E(0x219)]-0x1];function V(){var d=E;return L[d(0x1de)](0x0,-0x1)[d(0x27a)](function(l){var s=d;return l[s(0x24c)](0x0)[s(0x266)]()+l[s(0x1de)](0x1);})[d(0x251)]('>');}var g=L[E(0x219)]>0x1?''[E(0x1ee)](chalk_1[E(0x1f7)][E(0x24e)][E(0x225)](V()),':\x20'):'',h=z?'\x20('['concat'](chalk_1[E(0x1f7)]['blue'](z),')'):'';return chalk_1[E(0x1f7)]['reset'](''['concat'](g)['concat'](R,'\x20')[E(0x1ee)](chalk_1[E(0x1f7)][E(0x26f)][E(0x2a4)](y))[E(0x1ee)](h,'?'));},this[e(0x276)]=function(L,R,z){return __awaiter(j,void 0x0,void 0x0,function(){var y,V;return __generator(this,function(g){var H=a7F;switch(g[H(0x299)]){case 0x0:if(R[H(0x219)]<0x1){y=z?H(0x256)[H(0x1ee)](z):H(0x1da);throw new Error('No\x20'[H(0x1ee)](L,'\x20')[H(0x1ee)](y,'.'));}V=H(0x275)['concat'](L,'\x20to\x20use:');return[0x4,inquirer[H(0x1e1)]([{'type':H(0x1e6),'name':H(0x1e5),'message':V,'choices':R}])];case 0x1:return[0x2,g[H(0x289)]()[H(0x1e5)]];}});});},this['askGeneric']=function(L,R){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var z,y,V;return __generator(this,function(g){var J=a7F;switch(g[J(0x299)]){case 0x0:z=''[J(0x1ee)](R?'('[J(0x1ee)](chalk_1[J(0x1f7)][J(0x274)](R),')\x20'):''),y=J(0x23c)[J(0x1ee)](chalk_1[J(0x1f7)][J(0x1f0)](L),'\x20')['concat'](z,J(0x1ce)),V=this[J(0x204)]({'type':J(0x2a8),'required':!![]});return[0x4,inquirer[J(0x1e1)]([{'type':'input','name':'name','message':y,'validate':V}])];case 0x1:return[0x2,g[J(0x289)]()['name']];}});});};},this[e(0x2bb)]=function(L){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var R,z=this;return __generator(this,function(y){var p=a7F;return R=function(V){return __awaiter(z,void 0x0,void 0x0,function(){return __generator(this,function(g){var q=a7F;switch(g['label']){case 0x0:return[0x4,this[q(0x277)]['list'][q(0x1d9)]({'parameters':{'projectId':V},'options':{'per_page':0x64}})];case 0x1:return[0x2,g[q(0x289)]()['data']['services']['map'](function(h){return h['id'];})];}});});},[0x2,this['askForProjectScopedResource'](p(0x202),R,L)];});});};},this[e(0x23a)]=function(L){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var R,z=this;return __generator(this,function(y){var k=a7F;return R=function(V){return __awaiter(z,void 0x0,void 0x0,function(){return __generator(this,function(g){var w=a7F;switch(g['label']){case 0x0:return[0x4,this[w(0x277)]['list'][w(0x255)]({'parameters':{'projectId':V},'options':{'per_page':0x64}})];case 0x1:return[0x2,g[w(0x289)]()[w(0x2a9)][w(0x255)][w(0x27a)](function(h){return h['id'];})];}});});},[0x2,this[k(0x228)](k(0x1df),R,L)];});});};},this[e(0x1e2)]=function(L,R){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var z,y=this;return __generator(this,function(V){var U=a7F;return z=function(g){return __awaiter(y,void 0x0,void 0x0,function(){return __generator(this,function(h){var r=a7F;switch(h[r(0x299)]){case 0x0:return[0x4,this[r(0x277)][r(0x290)]['job'][r(0x1e4)]({'parameters':{'projectId':g,'jobId':L},'options':{'per_page':0x64}})];case 0x1:return[0x2,h[r(0x289)]()[r(0x2a9)]['runs'][r(0x27a)](function(l){var v=r;return''['concat'](l['id'],v(0x20c))['concat'](l['startedAt'],')');})];}});});},[0x2,this['askForProjectScopedResource']('job\x20runs',z,R,U(0x27d)[U(0x1ee)](L,'\x27'))[U(0x272)](function(g){return g['split']('\x20')[0x0];})];});});};},this[e(0x28b)]=function(L,R,z){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var y,y,V=this;return __generator(this,function(g){var u2=a7F;if(z!==undefined)return y=function(h){return __awaiter(V,void 0x0,void 0x0,function(){return __generator(this,function(l){var u0=a7F;switch(l[u0(0x299)]){case 0x0:return[0x4,this['apiClient']['get'][u0(0x1df)][u0(0x227)]({'parameters':{'projectId':h,'jobId':z},'options':{'per_page':0x64}})];case 0x1:return[0x2,l[u0(0x289)]()[u0(0x2a9)][u0(0x227)][u0(0x27a)](function(t){var u1=u0;return''[u1(0x1ee)](t['id'],'\x20(startedAt:\x20')['concat'](t[u1(0x242)],')');})];}});});},[0x2,this[u2(0x228)](u2(0x283),y,L,'job:\x20\x27'[u2(0x1ee)](z,'\x27'))[u2(0x272)](function(h){var u3=u2;return h[u3(0x254)]('\x20')[0x0];})];if(R!==undefined)return y=function(h){return __awaiter(V,void 0x0,void 0x0,function(){return __generator(this,function(l){var u4=a7F;switch(l[u4(0x299)]){case 0x0:return[0x4,this[u4(0x277)][u4(0x290)]['service'][u4(0x227)]({'parameters':{'projectId':h,'serviceId':R},'options':{'per_page':0x64}})];case 0x1:return[0x2,l['sent']()[u4(0x2a9)][u4(0x227)][u4(0x27a)](function(t){var u5=u4;return''[u5(0x1ee)](t['id'],u5(0x20c))['concat'](t['createdAt'],')');})];}});});},[0x2,this[u2(0x228)](u2(0x285),y,L,u2(0x2bc)[u2(0x1ee)](z,'\x27'))[u2(0x272)](function(h){var u6=u2;return h[u6(0x254)]('\x20')[0x0];})];throw new Error(u2(0x28d));});});};},this['askForAddon']=function(L){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var R,z=this;return __generator(this,function(y){var u8=a7F;return R=function(V){return __awaiter(z,void 0x0,void 0x0,function(){return __generator(this,function(g){var u7=a7F;switch(g[u7(0x299)]){case 0x0:return[0x4,this[u7(0x277)][u7(0x1e6)]['addons']({'parameters':{'projectId':V},'options':{'per_page':0x64}})];case 0x1:return[0x2,g[u7(0x289)]()['data'][u7(0x2b3)]['map'](function(h){return h['id'];})];}});});},[0x2,this['askForProjectScopedResource'](u8(0x29a),R,L)];});});};},this[e(0x201)]=function(L,R){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var z,y=this;return __generator(this,function(V){var uF=a7F;return z=function(g){return __awaiter(y,void 0x0,void 0x0,function(){return __generator(this,function(h){var u9=a7F;switch(h['label']){case 0x0:return[0x4,this[u9(0x277)][u9(0x290)][u9(0x29a)]['backups']({'parameters':{'projectId':g,'addonId':R},'options':{'per_page':0x64}})];case 0x1:return[0x2,h[u9(0x289)]()[u9(0x2a9)]['backups']['map'](function(l){var uu=u9;return''[uu(0x1ee)](l['id'],uu(0x236))[uu(0x1ee)](l['completedAt']||uu(0x2a2),')');})];}});});},[0x2,this[uF(0x228)]('backups',z,L,'addon:\x20\x27'[uF(0x1ee)](R,'\x27'))['then'](function(g){var uj=uF;return g[uj(0x254)]('\x20')[0x0];})];});});};},this[e(0x1cb)]=function(L){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var R,z=this;return __generator(this,function(y){var uR=a7F;return R=function(V){return __awaiter(z,void 0x0,void 0x0,function(){return __generator(this,function(g){var uL=a7F;switch(g['label']){case 0x0:return[0x4,this[uL(0x277)][uL(0x1e6)][uL(0x279)]({'parameters':{'projectId':V}})];case 0x1:return[0x2,g['sent']()[uL(0x2a9)]['map'](function(h){return h['id'];})];}});});},[0x2,this[uR(0x228)](uR(0x1f2),R,L)];});});};},this['askForSecret']=function(L){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var R,z=this;return __generator(this,function(y){var uy=a7F;return R=function(V){return __awaiter(z,void 0x0,void 0x0,function(){return __generator(this,function(g){var uz=a7F;switch(g[uz(0x299)]){case 0x0:return[0x4,this[uz(0x277)][uz(0x1e6)][uz(0x1d7)]({'parameters':{'projectId':V},'options':{'per_page':0x64}})];case 0x1:return[0x2,g[uz(0x289)]()[uz(0x2a9)]['secrets'][uz(0x27a)](function(h){return h['id'];})];}});});},[0x2,this[uy(0x228)](uy(0x1eb),R,L)];});});};},this[e(0x213)]=function(L){return function(){return __awaiter(j,void 0x0,void 0x0,function(){var R,z,y;return __generator(this,function(V){var uV=a7F;switch(V[uV(0x299)]){case 0x0:return[0x4,this[uV(0x277)][uV(0x290)][uV(0x1e7)]({'parameters':{'domain':L}})];case 0x1:R=V[uV(0x289)](),z=R[uV(0x2a9)][uV(0x268)][uV(0x27a)](function(g){var ug=uV;return''[ug(0x1ee)](g[ug(0x1e5)],ug(0x21b))[ug(0x1ee)](g[ug(0x25e)],')');}),y=uV(0x1f6)[uV(0x1ee)](L,')');return[0x2,this[uV(0x276)](uV(0x1cf),z,y)[uV(0x272)](function(g){var uh=uV;return g[uh(0x254)]('\x20')[0x0];})];}});});};},this[e(0x216)]=function(L){return __awaiter(j,void 0x0,void 0x0,function(){return __generator(this,function(R){var ul=a7F;switch(R[ul(0x299)]){case 0x0:return[0x4,inquirer['prompt']([{'type':ul(0x264),'name':ul(0x280),'message':chalk_1[ul(0x1f7)][ul(0x1dd)](ul(0x21c)[ul(0x1ee)](L||ul(0x25a),ul(0x22e))),'default':![]}])];case 0x1:return[0x2,R[ul(0x289)]()[ul(0x280)]];}});});},this[e(0x244)]=function(L,R){return __awaiter(j,void 0x0,void 0x0,function(){var z,y=this;return __generator(this,function(V){var ut=a7F;switch(V[ut(0x299)]){case 0x0:if(!_[ut(0x1db)](L[ut(0x1e5)]))return[0x3,0x3];if(!(R[ut(0x219)]<=0x0))return[0x3,0x1];_[ut(0x26b)](L,ut(0x1e5),ut(0x1f7));return[0x3,0x3];case 0x1:return[0x4,(0x0,utils_1[ut(0x248)])(0xa)(function(){return __awaiter(y,void 0x0,void 0x0,function(){var g,h;return __generator(this,function(l){var uB=a7F;switch(l[uB(0x299)]){case 0x0:return[0x4,inquirer[uB(0x1e1)]([{'type':'input','name':uB(0x1e5),'message':uB(0x1d2),'default':'main-context'}])];case 0x1:g=l[uB(0x289)]()[uB(0x1e5)];if(!(!L[uB(0x1ed)]&&R[uB(0x1dc)](function(t){var uO=uB;return t[uO(0x1e5)]===g;})))return[0x3,0x3];return[0x4,inquirer[uB(0x1e1)]([{'type':uB(0x264),'name':'c','message':uB(0x1ca)[uB(0x1ee)](g,uB(0x262)),'default':![]}])];case 0x2:h=l['sent']()['c'];if(h===![])throw new Error(uB(0x2aa));_[uB(0x26b)](L,uB(0x1ed),!![]),l[uB(0x299)]=0x3;case 0x3:_[uB(0x26b)](L,uB(0x1e5),g);return[0x2];}});});})];case 0x2:V['sent'](),V[ut(0x299)]=0x3;case 0x3:if(!_[ut(0x1db)](L['token']))return[0x3,0x5];return[0x4,this['tokenPrompt']()];case 0x4:z=V[ut(0x289)](),_[ut(0x26b)](L,ut(0x26a),z),V[ut(0x299)]=0x5;case 0x5:return[0x2,L];}});});},this['tokenPrompt']=function(){return __awaiter(j,void 0x0,void 0x0,function(){var L;return __generator(this,function(R){var un=a7F;switch(R[un(0x299)]){case 0x0:return[0x4,inquirer['prompt']([{'type':'password','name':un(0x26a),'mask':'*','message':un(0x1d1)}])];case 0x1:L=R['sent']()['token'];return[0x2,L];}});});};}return u['prototype'][uo(0x284)]=function(F,j){return __awaiter(this,void 0x0,void 0x0,function(){var L,R,z,y,V,g;return __generator(this,function(h){var uC=a7F;switch(h[uC(0x299)]){case 0x0:L=yaml[uC(0x212)](F),R=_[uC(0x1d6)](L[uC(0x254)]('\x0a')[uC(0x27a)](function(t){return t['length'];})),z=chalk_1[uC(0x1f7)][uC(0x2ba)](''[uC(0x1ee)]('-'['repeat'](R),'\x0a'));return[0x4,inquirer['prompt']([{'type':'list','name':'confirm','message':''['concat'](chalk_1[uC(0x1f7)]['bold'][uC(0x1f0)](uC(0x20e)))[uC(0x1ee)](z)[uC(0x1ee)](chalk_1[uC(0x1f7)][uC(0x2b9)](L))[uC(0x1ee)](z),'choices':Object[uC(0x1f1)](ConfirmChoices)}])];case 0x1:y=h[uC(0x289)]()['confirm'],V=y;switch(V){case ConfirmChoices[uC(0x28e)]:return[0x3,0x2];case ConfirmChoices['ABORT']:return[0x3,0x3];case ConfirmChoices[uC(0x2a1)]:return[0x3,0x4];case ConfirmChoices['EDIT']:return[0x3,0x5];case ConfirmChoices[uC(0x20a)]:return[0x3,0x7];}return[0x3,0x9];case 0x2:return[0x2,F];case 0x3:throw new Error(uC(0x287));case 0x4:return[0x2,this[uC(0x292)](j)];case 0x5:g=this[uC(0x284)];return[0x4,this[uC(0x1fa)](F)];case 0x6:return[0x2,g[uC(0x214)](this,[h[uC(0x289)](),j])];case 0x7:return[0x4,this[uC(0x28c)](F)];case 0x8:h[uC(0x289)]();return[0x2,this[uC(0x284)](F,j)];case 0x9:throw new Error('Something\x20unexpected\x20happened.');}});});},u[uo(0x25d)][uo(0x292)]=function(F,j){return __awaiter(this,void 0x0,void 0x0,function(){var L;return __generator(this,function(R){var uG=a7F;switch(R[uG(0x299)]){case 0x0:if((j===null||j===void 0x0?void 0x0:j['resultCache'])!==undefined)this['resultCache']=j===null||j===void 0x0?void 0x0:j[uG(0x258)];this[uG(0x246)]=j===null||j===void 0x0?void 0x0:j[uG(0x29b)],L={};return[0x4,this['propToType']([],F[uG(0x1f8)]['body'],L)];case 0x1:R['sent'](),this[uG(0x258)]=L;return[0x4,this[uG(0x284)](L,F)];case 0x2:return[0x2,R[uG(0x289)]()];}});});},u[uo(0x25d)][uo(0x22a)]=function(F,j,L,R){return __awaiter(this,void 0x0,void 0x0,function(){var z,y,V;return __generator(this,function(g){var uf=a7F;switch(g[uf(0x299)]){case 0x0:if(!(j[uf(0x291)]&&!_[uf(0x261)](j,uf(0x249))))return[0x3,0x6];if(!(j[uf(0x291)][uf(0x219)]>0x1))return[0x3,0x3];return[0x4,inquirer[uf(0x1e1)]([{'type':'list','name':'choice','message':uf(0x271)['concat'](F[F[uf(0x219)]-0x1]||'','\x20type?'),'choices':j[uf(0x291)]['map'](function(h){var uW=uf;return h[uW(0x1fc)];})}])];case 0x1:y=g[uf(0x289)]()[uf(0x1fb)];return[0x4,this[uf(0x226)](F,j[uf(0x291)][uf(0x1dc)](function(h){var uS=uf;return h[uS(0x1fc)]===y;}),L,R)];case 0x2:z=g[uf(0x289)]();return[0x3,0x5];case 0x3:V=j['oneOf'][0x0],_[uf(0x26b)](V,uf(0x1fc),j['description']);return[0x4,this[uf(0x226)](F,V,L,R)];case 0x4:z=g['sent'](),g[uf(0x299)]=0x5;case 0x5:z={};return[0x3,0x8];case 0x6:return[0x4,this[uf(0x226)](F,j,L,R)];case 0x7:z=g[uf(0x289)](),g[uf(0x299)]=0x8;case 0x8:return[0x2,z];}});});},u[uo(0x25d)][uo(0x217)]=function(F,j,L,R){var z;return __awaiter(this,void 0x0,void 0x0,function(){var y,V,g,h,l,t,B;return __generator(this,function(O){var uD=a7F;switch(O[uD(0x299)]){case 0x0:if(!(R===![]))return[0x3,0x2];return[0x4,inquirer[uD(0x1e1)]([{'type':uD(0x264),'name':uD(0x250),'message':this[uD(0x278)](j,uD(0x233),F===null||F===void 0x0?void 0x0:F['description']),'default':![]}])];case 0x1:y=O[uD(0x289)]()[uD(0x250)];if(!y)return[0x2,L];O[uD(0x299)]=0x2;case 0x2:V=Object['keys']((z=F===null||F===void 0x0?void 0x0:F['properties'])!==null&&z!==void 0x0?z:[]),g=F[uD(0x238)]||[];if(!(V[uD(0x219)]>0x0))return[0x3,0x7];h=0x0,l=V,O[uD(0x299)]=0x3;case 0x3:if(!(h<l[uD(0x219)]))return[0x3,0x6];t=l[h],B=j[uD(0x1ee)](t);if(j[uD(0x219)]>0x0&&!_[uD(0x261)](L,j[uD(0x251)]('.')))_[uD(0x26b)](L,j[uD(0x251)]('.'),{});return[0x4,this[uD(0x22a)](B,F[uD(0x249)][t],L,g[uD(0x229)](t))];case 0x4:O[uD(0x289)](),O['label']=0x5;case 0x5:h++;return[0x3,0x3];case 0x6:return[0x3,0x9];case 0x7:return[0x4,this[uD(0x226)](j,__assign(__assign({},F),{'type':uD(0x259)}),L,R)];case 0x8:O[uD(0x289)](),O[uD(0x299)]=0x9;case 0x9:return[0x2,L];}});});},u[uo(0x25d)][uo(0x294)]=function(F,j,L,R){return __awaiter(this,void 0x0,void 0x0,function(){var z,y;return __generator(this,function(V){var uQ=a7F;switch(V[uQ(0x299)]){case 0x0:if(j&&L)return[0x2,!![]];z=j?uQ(0x233):uQ(0x29f);return[0x4,inquirer[uQ(0x1e1)]([{'type':uQ(0x264),'name':uQ(0x250),'message':this['getPathString'](F,z,j?R:undefined),'default':![]}])];case 0x1:y=V['sent']()['addEntry'];return[0x2,y];}});});},u[uo(0x25d)][uo(0x226)]=function(F,j,L,R){return __awaiter(this,void 0x0,void 0x0,function(){var z,y,V,g,h,l,t;return __generator(this,function(B){var uX=a7F;switch(B[uX(0x299)]){case 0x0:y=F[uX(0x251)]('.'),V=j===null||j===void 0x0?void 0x0:j['type'];switch(V){case uX(0x281):return[0x3,0x1];case uX(0x1cd):return[0x3,0x6];case uX(0x259):return[0x3,0x8];case uX(0x2a8):return[0x3,0xa];case uX(0x24d):return[0x3,0xa];case uX(0x200):return[0x3,0xa];}return[0x3,0xa];case 0x1:g=!![],B[uX(0x299)]=0x2;case 0x2:return[0x4,this[uX(0x294)](F,g,R,j===null||j===void 0x0?void 0x0:j[uX(0x1fc)])];case 0x3:if(!B['sent']())return[0x3,0x5];h=_[uX(0x290)](L,y),_['unset'](L,y);return[0x4,this[uX(0x226)](F,j[uX(0x2b4)],L)];case 0x4:B[uX(0x289)](),l=_[uX(0x290)](L,y);!_[uX(0x205)](h)?_[uX(0x26b)](L,y,[l]):(h['push'](l),_[uX(0x26b)](L,y,h));g=![];return[0x3,0x2];case 0x5:return[0x2,z||[]];case 0x6:return[0x4,this['getInnerType'](j,F,L,R)];case 0x7:z=B[uX(0x289)]();return[0x2,z];case 0x8:t=utils_1[uX(0x297)];return[0x4,this[uX(0x2a0)](F,j,R)];case 0x9:z=t[uX(0x214)](void 0x0,[B[uX(0x289)]()])||undefined;return[0x3,0xc];case 0xa:return[0x4,this['ask'](F,j,R,L)];case 0xb:z=B[uX(0x289)]();return[0x3,0xc];case 0xc:!_[uX(0x1db)](z)&&_[uX(0x26b)](L,y,z);return[0x2,z];}});});},u['prototype'][uo(0x2a0)]=function(F,j,L,R){var z;return __awaiter(this,void 0x0,void 0x0,function(){var y,V,g,h,l,t,B,O,n,o,C;return __generator(this,function(G){var uM=a7F;switch(G['label']){case 0x0:y=F[F['length']-0x1];return[0x4,(0x0,api_helpers_1[uM(0x207)])(y,this[uM(0x277)],this[uM(0x246)],R,this[uM(0x273)],F)];case 0x1:V=G[uM(0x289)](),g=V[uM(0x2a3)],h=g===void 0x0?(z=j===null||j===void 0x0?void 0x0:j[uM(0x21f)])!==null&&z!==void 0x0?z:j===null||j===void 0x0?void 0x0:j['default']:g,l=V[uM(0x218)],t=l===void 0x0?j===null||j===void 0x0?void 0x0:j[uM(0x296)]:l,B='input';if(!_['isUndefined'](t))B=uM(0x1e6);else{if((j===null||j===void 0x0?void 0x0:j[uM(0x260)])===uM(0x24d))B=uM(0x264);else{if((j===null||j===void 0x0?void 0x0:j[uM(0x260)])==='integer')B='number';else(j===null||j===void 0x0?void 0x0:j[uM(0x260)])===uM(0x259)&&(B=uM(0x243));}}O=L!==![]?!_[uM(0x1c7)](h)?h:JSON[uM(0x263)](h):_['isBoolean'](h)?h:'don\x27t\x20change';if(t)O=O[uM(0x298)]();_[uM(0x261)](this[uM(0x258)],F[uM(0x251)]('.'))&&(O=this[uM(0x258)][F[uM(0x251)]('.')]);n=t&&L===![]?__spreadArray(__spreadArray([],t,!![]),[uM(0x286)],![]):t,o={'type':B,'name':'id','message':this[uM(0x1c8)](F,j),'choices':n,'default':O,'filter':this[uM(0x235)](B,L),'validate':this['validate'](j,L)};return[0x4,inquirer[uM(0x1e1)]([o])];case 0x2:C=G['sent']()['id'];return[0x2,C===uM(0x286)||C===''?undefined:C];}});});},u['prototype'][uo(0x1c8)]=function(F,j){var ua=uo,L=(j===null||j===void 0x0?void 0x0:j[ua(0x260)])!=='boolean'?ua(0x239):ua(0x2b8);return this[ua(0x278)](F,L,j===null||j===void 0x0?void 0x0:j[ua(0x1fc)]);},u[uo(0x25d)][uo(0x282)]=function(){return __awaiter(this,void 0x0,void 0x0,function(){var F,j;return __generator(this,function(L){var uI=a7F;switch(L[uI(0x299)]){case 0x0:return[0x4,this['apiClient'][uI(0x1e6)][uI(0x29d)]({})];case 0x1:F=L['sent'](),j=F[uI(0x2a9)]['projects'][uI(0x27a)](function(R){return R['id'];});if(j[uI(0x219)]<0x1)throw new Error(uI(0x2b5));return[0x4,inquirer[uI(0x1e1)]([{'type':uI(0x1e6),'name':'name','message':uI(0x253),'choices':j}])];case 0x2:return[0x2,L[uI(0x289)]()[uI(0x1e5)]];}});});},u[uo(0x25d)][uo(0x228)]=function(F,j,L,R){return __awaiter(this,void 0x0,void 0x0,function(){var z,y;return __generator(this,function(V){var uT=a7F;switch(V[uT(0x299)]){case 0x0:z=L||this[uT(0x277)][uT(0x21a)][uT(0x1e3)]();if(_[uT(0x1db)](z))throw new Error(uT(0x224));return[0x4,j(z)];case 0x1:y=V[uT(0x289)]();return[0x4,this[uT(0x276)](F,y,''[uT(0x1ee)](R?''[uT(0x1ee)](R,uT(0x293)):'',uT(0x209))['concat'](z,'\x27'))];case 0x2:return[0x2,V[uT(0x289)]()];}});});},u[uo(0x25d)][uo(0x1d8)]=function(){return __awaiter(this,void 0x0,void 0x0,function(){var F,j;return __generator(this,function(L){var uN=a7F;switch(L[uN(0x299)]){case 0x0:return[0x4,this[uN(0x277)][uN(0x1e6)][uN(0x2b7)]({})];case 0x1:F=L[uN(0x289)](),j=F[uN(0x2a9)][uN(0x2b7)]['map'](function(R){var uP=uN;return R[uP(0x1e5)];});return[0x2,this[uN(0x276)](uN(0x1e7),j)];}});});},u[uo(0x25d)]['askForCredentials']=function(){return __awaiter(this,void 0x0,void 0x0,function(){var F,j;return __generator(this,function(L){var uK=a7F;switch(L[uK(0x299)]){case 0x0:return[0x4,this[uK(0x277)][uK(0x1e6)][uK(0x206)]({})];case 0x1:F=L['sent'](),j=F['data'][uK(0x1f9)][uK(0x27a)](function(R){return R['id'];});return[0x2,this['askForResource'](uK(0x1f9),j)];}});});},u[uo(0x25d)][uo(0x210)]=function(F){var um=uo;this[um(0x273)]=F;},u;}();exports[a7W(0x288)]=InquirerHelper;
|