@twilio/flex-dev-utils 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/axios.d.ts +6 -0
- package/dist/axios.js +18 -0
- package/dist/axios.js.map +1 -0
- package/dist/credentials.d.ts +40 -0
- package/dist/credentials.js +241 -0
- package/dist/credentials.js.map +1 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.js +13 -0
- package/dist/env.js.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.js +19 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/lib/FlexPluginError.d.ts +7 -0
- package/dist/errors/lib/FlexPluginError.js +54 -0
- package/dist/errors/lib/FlexPluginError.js.map +1 -0
- package/dist/errors/lib/UserActionError.d.ts +5 -0
- package/dist/errors/lib/UserActionError.js +35 -0
- package/dist/errors/lib/UserActionError.js.map +1 -0
- package/dist/errors/lib/ValidationError.d.ts +3 -0
- package/dist/errors/lib/ValidationError.js +30 -0
- package/dist/errors/lib/ValidationError.js.map +1 -0
- package/dist/exit.d.ts +8 -0
- package/dist/exit.js +18 -0
- package/dist/exit.js.map +1 -0
- package/dist/fs.d.ts +318 -0
- package/dist/fs.js +797 -0
- package/dist/fs.js.map +1 -0
- package/dist/http/index.d.ts +1 -0
- package/dist/http/index.js +10 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/lib/http.d.ts +114 -0
- package/dist/http/lib/http.js +337 -0
- package/dist/http/lib/http.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/keychain.d.ts +25 -0
- package/dist/keychain.js +84 -0
- package/dist/keychain.js.map +1 -0
- package/dist/lodash.d.ts +13 -0
- package/dist/lodash.js +30 -0
- package/dist/lodash.js.map +1 -0
- package/dist/logger/index.d.ts +13 -0
- package/dist/logger/index.js +52 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/lib/boxen.d.ts +38 -0
- package/dist/logger/lib/boxen.js +85 -0
- package/dist/logger/lib/boxen.js.map +1 -0
- package/dist/logger/lib/columnify.d.ts +2 -0
- package/dist/logger/lib/columnify.js +8 -0
- package/dist/logger/lib/columnify.js.map +1 -0
- package/dist/logger/lib/logger.d.ts +157 -0
- package/dist/logger/lib/logger.js +354 -0
- package/dist/logger/lib/logger.js.map +1 -0
- package/dist/logger/lib/strings.d.ts +16 -0
- package/dist/logger/lib/strings.js +33 -0
- package/dist/logger/lib/strings.js.map +1 -0
- package/dist/logger/lib/table.d.ts +25 -0
- package/dist/logger/lib/table.js +75 -0
- package/dist/logger/lib/table.js.map +1 -0
- package/dist/open.d.ts +2 -0
- package/dist/open.js +9 -0
- package/dist/open.js.map +1 -0
- package/dist/prints.d.ts +11 -0
- package/dist/prints.js +47 -0
- package/dist/prints.js.map +1 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +9 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/lib/progress.d.ts +21 -0
- package/dist/progress/lib/progress.js +118 -0
- package/dist/progress/lib/progress.js.map +1 -0
- package/dist/questions/index.d.ts +1 -0
- package/dist/questions/index.js +12 -0
- package/dist/questions/index.js.map +1 -0
- package/dist/questions/lib/inquirer.d.ts +39 -0
- package/dist/questions/lib/inquirer.js +136 -0
- package/dist/questions/lib/inquirer.js.map +1 -0
- package/dist/random.d.ts +15 -0
- package/dist/random.js +28 -0
- package/dist/random.js.map +1 -0
- package/dist/runner.d.ts +8 -0
- package/dist/runner.js +98 -0
- package/dist/runner.js.map +1 -0
- package/dist/semver.d.ts +9 -0
- package/dist/semver.js +36 -0
- package/dist/semver.js.map +1 -0
- package/dist/sids.d.ts +48 -0
- package/dist/sids.js +50 -0
- package/dist/sids.js.map +1 -0
- package/dist/spawn/index.d.ts +4 -0
- package/dist/spawn/index.js +15 -0
- package/dist/spawn/index.js.map +1 -0
- package/dist/spawn/lib/node.d.ts +9 -0
- package/dist/spawn/lib/node.js +74 -0
- package/dist/spawn/lib/node.js.map +1 -0
- package/dist/spawn/lib/npm.d.ts +9 -0
- package/dist/spawn/lib/npm.js +74 -0
- package/dist/spawn/lib/npm.js.map +1 -0
- package/dist/spawn/lib/spawn.d.ts +22 -0
- package/dist/spawn/lib/spawn.js +111 -0
- package/dist/spawn/lib/spawn.js.map +1 -0
- package/dist/spawn/lib/yarn.d.ts +9 -0
- package/dist/spawn/lib/yarn.js +74 -0
- package/dist/spawn/lib/yarn.js.map +1 -0
- package/dist/updateNotifier.d.ts +6 -0
- package/dist/updateNotifier.js +20 -0
- package/dist/updateNotifier.js.map +1 -0
- package/dist/urls.d.ts +28 -0
- package/dist/urls.js +147 -0
- package/dist/urls.js.map +1 -0
- package/dist/validators.d.ts +42 -0
- package/dist/validators.js +78 -0
- package/dist/validators.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.progress = exports._getSpinner = void 0;
|
|
43
|
+
var flex_plugins_utils_env_1 = __importDefault(require("@twilio/flex-plugins-utils-env"));
|
|
44
|
+
var logger_1 = require("../../logger");
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
var ora = null;
|
|
47
|
+
/* istanbul ignore next */
|
|
48
|
+
var _getOra = function () {
|
|
49
|
+
if (ora) {
|
|
50
|
+
return ora;
|
|
51
|
+
}
|
|
52
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-require-imports
|
|
53
|
+
ora = require('ora');
|
|
54
|
+
return ora;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Added for testing purposes
|
|
58
|
+
* @param title
|
|
59
|
+
* @param disabled
|
|
60
|
+
*/
|
|
61
|
+
/* istanbul ignore next */
|
|
62
|
+
var _getSpinner = function (text, disabled) {
|
|
63
|
+
if (disabled) {
|
|
64
|
+
return {
|
|
65
|
+
start: function () {
|
|
66
|
+
// no-op
|
|
67
|
+
},
|
|
68
|
+
succeed: function () {
|
|
69
|
+
// no-op
|
|
70
|
+
},
|
|
71
|
+
fail: function () {
|
|
72
|
+
// no-op
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
var options = { text: text };
|
|
77
|
+
if (flex_plugins_utils_env_1.default.isDebug() || flex_plugins_utils_env_1.default.isTrace()) {
|
|
78
|
+
options.isEnabled = false;
|
|
79
|
+
}
|
|
80
|
+
return _getOra()(options);
|
|
81
|
+
};
|
|
82
|
+
exports._getSpinner = _getSpinner;
|
|
83
|
+
/**
|
|
84
|
+
* An {@link ora} progress wrapper
|
|
85
|
+
*
|
|
86
|
+
* @param title the title to show
|
|
87
|
+
* @param action the callback to run
|
|
88
|
+
* @param disabled force enable the progress
|
|
89
|
+
*/
|
|
90
|
+
var progress = function (title, action, disabled) {
|
|
91
|
+
if (disabled === void 0) { disabled = flex_plugins_utils_env_1.default.isQuiet(); }
|
|
92
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
var spinner, response, e_1;
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
spinner = exports._getSpinner(logger_1.logger.markdown(title) || '', disabled);
|
|
98
|
+
_a.label = 1;
|
|
99
|
+
case 1:
|
|
100
|
+
_a.trys.push([1, 3, , 4]);
|
|
101
|
+
spinner.start();
|
|
102
|
+
return [4 /*yield*/, action()];
|
|
103
|
+
case 2:
|
|
104
|
+
response = _a.sent();
|
|
105
|
+
spinner.succeed();
|
|
106
|
+
return [2 /*return*/, response];
|
|
107
|
+
case 3:
|
|
108
|
+
e_1 = _a.sent();
|
|
109
|
+
spinner.fail(e_1.message);
|
|
110
|
+
throw e_1;
|
|
111
|
+
case 4: return [2 /*return*/];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
exports.progress = progress;
|
|
117
|
+
exports.default = exports.progress;
|
|
118
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/progress/lib/progress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0FAAiD;AAEjD,uCAAsC;AAetC,8DAA8D;AAC9D,IAAI,GAAG,GAAQ,IAAI,CAAC;AACpB,0BAA0B;AAC1B,IAAM,OAAO,GAAG;IACd,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC;KACZ;IAED,iFAAiF;IACjF,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAErB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;;GAIG;AACH,0BAA0B;AACnB,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,QAAiB;IACzD,IAAI,QAAQ,EAAE;QACZ,OAAO;YACL,KAAK,EAAE;gBACL,QAAQ;YACV,CAAC;YACD,OAAO,EAAE;gBACP,QAAQ;YACV,CAAC;YACD,IAAI,EAAE;gBACJ,QAAQ;YACV,CAAC;SACF,CAAC;KACH;IAED,IAAM,OAAO,GAAe,EAAE,IAAI,MAAA,EAAE,CAAC;IACrC,IAAI,gCAAG,CAAC,OAAO,EAAE,IAAI,gCAAG,CAAC,OAAO,EAAE,EAAE;QAClC,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;KAC3B;IAED,OAAO,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC,CAAC;AArBW,QAAA,WAAW,eAqBtB;AAEF;;;;;;GAMG;AACI,IAAM,QAAQ,GAAG,UAAU,KAAa,EAAE,MAAmB,EAAE,QAAwB;IAAxB,yBAAA,EAAA,WAAW,gCAAG,CAAC,OAAO,EAAE;;;;;;oBACtF,OAAO,GAAG,mBAAW,CAAC,eAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;;;;oBAGlE,OAAO,CAAC,KAAK,EAAE,CAAC;oBACC,qBAAM,MAAM,EAAE,EAAA;;oBAAzB,QAAQ,GAAG,SAAc;oBAC/B,OAAO,CAAC,OAAO,EAAE,CAAC;oBAElB,sBAAO,QAAQ,EAAC;;;oBAEhB,OAAO,CAAC,IAAI,CAAC,GAAC,CAAC,OAAO,CAAC,CAAC;oBAExB,MAAM,GAAC,CAAC;;;;;CAEX,CAAC;AAdW,QAAA,QAAQ,YAcnB;AAEF,kBAAe,gBAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as inquirer, confirm, prompt, choose, Question } from './lib/inquirer';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.choose = exports.prompt = exports.confirm = exports.inquirer = void 0;
|
|
7
|
+
var inquirer_1 = require("./lib/inquirer");
|
|
8
|
+
Object.defineProperty(exports, "inquirer", { enumerable: true, get: function () { return __importDefault(inquirer_1).default; } });
|
|
9
|
+
Object.defineProperty(exports, "confirm", { enumerable: true, get: function () { return inquirer_1.confirm; } });
|
|
10
|
+
Object.defineProperty(exports, "prompt", { enumerable: true, get: function () { return inquirer_1.prompt; } });
|
|
11
|
+
Object.defineProperty(exports, "choose", { enumerable: true, get: function () { return inquirer_1.choose; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/questions/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAwF;AAA/E,qHAAA,OAAO,OAAY;AAAE,mGAAA,OAAO,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,kGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
export declare type YNAnswer = 'Y' | 'N';
|
|
3
|
+
export declare const positiveAnswers: string[];
|
|
4
|
+
export declare const negativeAnswers: string[];
|
|
5
|
+
export declare const acceptableAnswers: string[];
|
|
6
|
+
export interface Question {
|
|
7
|
+
name: string;
|
|
8
|
+
message: string;
|
|
9
|
+
type?: 'list' | 'input' | 'password';
|
|
10
|
+
validate?(input: string): boolean | string | Promise<boolean | string>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Confirmation validator
|
|
14
|
+
*
|
|
15
|
+
* @param defaultAnswer
|
|
16
|
+
*/
|
|
17
|
+
export declare const _validateConfirmation: (defaultAnswer?: YNAnswer | undefined) => (input: string) => string | boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Prompts the user to answer the question. Upon validation, returns the answer.
|
|
20
|
+
*
|
|
21
|
+
* @param question the question to prompt the user with
|
|
22
|
+
*/
|
|
23
|
+
export declare const prompt: (question: Question) => Promise<Question['name']>;
|
|
24
|
+
/**
|
|
25
|
+
* Provides a confirmation prompt. The response is a Promise<boolean> with `true` resolving to
|
|
26
|
+
* successful confirmation, and `false` being the rejected confirmation
|
|
27
|
+
*
|
|
28
|
+
* @param question the question to ask
|
|
29
|
+
* @param defaultAnswer the default answer, can be Y or N
|
|
30
|
+
*/
|
|
31
|
+
export declare const confirm: (question: string, defaultAnswer?: YNAnswer | undefined) => Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Prompts the user to select from one of the choices.
|
|
34
|
+
*
|
|
35
|
+
* @param question the question to prompt the user with
|
|
36
|
+
* @param choices the list of options
|
|
37
|
+
*/
|
|
38
|
+
export declare const choose: (question: Question, choices: string[]) => Promise<Question['name']>;
|
|
39
|
+
export default inquirer;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.choose = exports.confirm = exports.prompt = exports._validateConfirmation = exports.acceptableAnswers = exports.negativeAnswers = exports.positiveAnswers = void 0;
|
|
43
|
+
var inquirer_1 = __importDefault(require("inquirer"));
|
|
44
|
+
exports.positiveAnswers = ['y', 'yes'];
|
|
45
|
+
exports.negativeAnswers = ['n', 'no'];
|
|
46
|
+
exports.acceptableAnswers = exports.positiveAnswers.concat(exports.negativeAnswers);
|
|
47
|
+
/**
|
|
48
|
+
* Confirmation validator
|
|
49
|
+
*
|
|
50
|
+
* @param defaultAnswer
|
|
51
|
+
*/
|
|
52
|
+
var _validateConfirmation = function (defaultAnswer) {
|
|
53
|
+
return function (input) {
|
|
54
|
+
if (!input && defaultAnswer) {
|
|
55
|
+
input = defaultAnswer;
|
|
56
|
+
}
|
|
57
|
+
if (exports.acceptableAnswers.includes(input.toLowerCase())) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return 'Please answer with either "y" or "n"';
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports._validateConfirmation = _validateConfirmation;
|
|
64
|
+
/**
|
|
65
|
+
* Prompts the user to answer the question. Upon validation, returns the answer.
|
|
66
|
+
*
|
|
67
|
+
* @param question the question to prompt the user with
|
|
68
|
+
*/
|
|
69
|
+
var prompt = function (question) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
+
var result, nameKey;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
question.type = question.type || 'input';
|
|
75
|
+
return [4 /*yield*/, inquirer_1.default.prompt([question])];
|
|
76
|
+
case 1:
|
|
77
|
+
result = _a.sent();
|
|
78
|
+
nameKey = Object.keys(question).find(function (k) { return k === 'name'; });
|
|
79
|
+
return [2 /*return*/, result[question[nameKey]]];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); };
|
|
83
|
+
exports.prompt = prompt;
|
|
84
|
+
/**
|
|
85
|
+
* Provides a confirmation prompt. The response is a Promise<boolean> with `true` resolving to
|
|
86
|
+
* successful confirmation, and `false` being the rejected confirmation
|
|
87
|
+
*
|
|
88
|
+
* @param question the question to ask
|
|
89
|
+
* @param defaultAnswer the default answer, can be Y or N
|
|
90
|
+
*/
|
|
91
|
+
var confirm = function (question, defaultAnswer) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
var suffix, q, answer;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
suffix = '(y/n)';
|
|
97
|
+
if (defaultAnswer === 'Y') {
|
|
98
|
+
suffix = '(Y/n)';
|
|
99
|
+
}
|
|
100
|
+
else if (defaultAnswer === 'N') {
|
|
101
|
+
suffix = '(y/N)';
|
|
102
|
+
}
|
|
103
|
+
q = {
|
|
104
|
+
name: 'answer',
|
|
105
|
+
message: question.trim() + " " + suffix,
|
|
106
|
+
validate: exports._validateConfirmation(defaultAnswer),
|
|
107
|
+
};
|
|
108
|
+
return [4 /*yield*/, exports.prompt(q)];
|
|
109
|
+
case 1:
|
|
110
|
+
answer = _a.sent();
|
|
111
|
+
if (!answer && defaultAnswer) {
|
|
112
|
+
answer = defaultAnswer;
|
|
113
|
+
}
|
|
114
|
+
if (exports.positiveAnswers.includes(answer.toLowerCase())) {
|
|
115
|
+
return [2 /*return*/, Promise.resolve(true)];
|
|
116
|
+
}
|
|
117
|
+
return [2 /*return*/, Promise.resolve(false)];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}); };
|
|
121
|
+
exports.confirm = confirm;
|
|
122
|
+
/**
|
|
123
|
+
* Prompts the user to select from one of the choices.
|
|
124
|
+
*
|
|
125
|
+
* @param question the question to prompt the user with
|
|
126
|
+
* @param choices the list of options
|
|
127
|
+
*/
|
|
128
|
+
var choose = function (question, choices) { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
question.type = 'list';
|
|
131
|
+
return [2 /*return*/, exports.prompt(Object.assign(question, { choices: choices }))];
|
|
132
|
+
});
|
|
133
|
+
}); };
|
|
134
|
+
exports.choose = choose;
|
|
135
|
+
exports.default = inquirer_1.default;
|
|
136
|
+
//# sourceMappingURL=inquirer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inquirer.js","sourceRoot":"","sources":["../../../src/questions/lib/inquirer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA2D;AAG9C,QAAA,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC/B,QAAA,eAAe,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC9B,QAAA,iBAAiB,GAAG,uBAAe,CAAC,MAAM,CAAC,uBAAe,CAAC,CAAC;AASzE;;;;GAIG;AACI,IAAM,qBAAqB,GAChC,UAAC,aAAwB;IACzB,OAAA,UAAC,KAAa;QACZ,IAAI,CAAC,KAAK,IAAI,aAAa,EAAE;YAC3B,KAAK,GAAG,aAAa,CAAC;SACvB;QAED,IAAI,yBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,EAAE;YACnD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,sCAAsC,CAAC;IAChD,CAAC;AAVD,CAUC,CAAC;AAZS,QAAA,qBAAqB,yBAY9B;AAEJ;;;;GAIG;AACI,IAAM,MAAM,GAAG,UAAO,QAAkB;;;;;gBAC7C,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC;gBAE1B,qBAAM,kBAAQ,CAAC,MAAM,CAAC,CAAC,QAAqB,CAAC,CAAC,EAAA;;gBAAvD,MAAM,GAAG,SAA8C;gBACvD,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,KAAK,MAAM,EAAZ,CAAY,CAAW,CAAC;gBAE1E,sBAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAC;;;KAClC,CAAC;AAPW,QAAA,MAAM,UAOjB;AAEF;;;;;;GAMG;AACI,IAAM,OAAO,GAAG,UAAO,QAAgB,EAAE,aAAwB;;;;;gBAClE,MAAM,GAAG,OAAO,CAAC;gBACrB,IAAI,aAAa,KAAK,GAAG,EAAE;oBACzB,MAAM,GAAG,OAAO,CAAC;iBAClB;qBAAM,IAAI,aAAa,KAAK,GAAG,EAAE;oBAChC,MAAM,GAAG,OAAO,CAAC;iBAClB;gBAEK,CAAC,GAAa;oBAClB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAK,QAAQ,CAAC,IAAI,EAAE,SAAI,MAAQ;oBACvC,QAAQ,EAAE,6BAAqB,CAAC,aAAa,CAAC;iBAC/C,CAAC;gBAEW,qBAAM,cAAM,CAAC,CAAC,CAAC,EAAA;;gBAAxB,MAAM,GAAG,SAAe;gBAC5B,IAAI,CAAC,MAAM,IAAI,aAAa,EAAE;oBAC5B,MAAM,GAAG,aAAa,CAAC;iBACxB;gBAED,IAAI,uBAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE;oBAClD,sBAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAC;iBAC9B;gBAED,sBAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC;;;KAC/B,CAAC;AAxBW,QAAA,OAAO,WAwBlB;AAEF;;;;;GAKG;AACI,IAAM,MAAM,GAAG,UAAO,QAAkB,EAAE,OAAiB;;QAChE,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;QAEvB,sBAAO,cAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,EAAC;;KACrD,CAAC;AAJW,QAAA,MAAM,UAIjB;AAEF,kBAAe,kBAAQ,CAAC"}
|
package/dist/random.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random string
|
|
3
|
+
*
|
|
4
|
+
* @param n the length of the string
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const _randomGenerator: (n: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Generates a random string; if a list is provided, ensures the string is not in the list
|
|
10
|
+
*
|
|
11
|
+
* @param length the length
|
|
12
|
+
* @param list the list to ensure the new string is unique
|
|
13
|
+
*/
|
|
14
|
+
export declare const randomString: (length: number, list?: string[]) => string;
|
|
15
|
+
export default randomString;
|
package/dist/random.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomString = exports._randomGenerator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a random string
|
|
6
|
+
*
|
|
7
|
+
* @param n the length of the string
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
var _randomGenerator = function (n) { return Math.random().toString(26).slice(2).substring(0, n); };
|
|
11
|
+
exports._randomGenerator = _randomGenerator;
|
|
12
|
+
/**
|
|
13
|
+
* Generates a random string; if a list is provided, ensures the string is not in the list
|
|
14
|
+
*
|
|
15
|
+
* @param length the length
|
|
16
|
+
* @param list the list to ensure the new string is unique
|
|
17
|
+
*/
|
|
18
|
+
var randomString = function (length, list) {
|
|
19
|
+
if (list === void 0) { list = []; }
|
|
20
|
+
var str = exports._randomGenerator(length);
|
|
21
|
+
while (list.includes(str)) {
|
|
22
|
+
str = exports._randomGenerator(length);
|
|
23
|
+
}
|
|
24
|
+
return str;
|
|
25
|
+
};
|
|
26
|
+
exports.randomString = randomString;
|
|
27
|
+
exports.default = exports.randomString;
|
|
28
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../src/random.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,IAAM,gBAAgB,GAAG,UAAC,CAAS,IAAa,OAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAnD,CAAmD,CAAC;AAA9F,QAAA,gBAAgB,oBAA8E;AAE3G;;;;;GAKG;AACI,IAAM,YAAY,GAAG,UAAC,MAAc,EAAE,IAAmB;IAAnB,qBAAA,EAAA,SAAmB;IAC9D,IAAI,GAAG,GAAG,wBAAgB,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACzB,GAAG,GAAG,wBAAgB,CAAC,MAAM,CAAC,CAAC;KAChC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB;AAEF,kBAAe,oBAAY,CAAC"}
|
package/dist/runner.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type Callback = (...argv: string[]) => void;
|
|
2
|
+
declare const _default: (callback: Callback, ...args: string[]) => Promise<unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* A runner that calls a callable function, and handles the exception
|
|
5
|
+
* @param callback
|
|
6
|
+
* @param args
|
|
7
|
+
*/
|
|
8
|
+
export default _default;
|
package/dist/runner.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
55
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
56
|
+
to[j] = from[i];
|
|
57
|
+
return to;
|
|
58
|
+
};
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
var logger_1 = require("./logger");
|
|
61
|
+
var errors_1 = require("./errors");
|
|
62
|
+
/**
|
|
63
|
+
* A runner that calls a callable function, and handles the exception
|
|
64
|
+
* @param callback
|
|
65
|
+
* @param args
|
|
66
|
+
*/
|
|
67
|
+
exports.default = (function (callback) {
|
|
68
|
+
var args = [];
|
|
69
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
70
|
+
args[_i - 1] = arguments[_i];
|
|
71
|
+
}
|
|
72
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var e_1;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
_a.trys.push([0, 2, , 3]);
|
|
78
|
+
return [4 /*yield*/, callback.apply(void 0, __spreadArray([], __read(args)))];
|
|
79
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
80
|
+
case 2:
|
|
81
|
+
e_1 = _a.sent();
|
|
82
|
+
if (e_1 instanceof errors_1.FlexPluginError) {
|
|
83
|
+
e_1.print();
|
|
84
|
+
if (process.env.DEBUG) {
|
|
85
|
+
e_1.details();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
logger_1.logger.error(e_1);
|
|
90
|
+
}
|
|
91
|
+
// eslint-disable-next-line no-process-exit
|
|
92
|
+
return [2 /*return*/, process.exit(1)];
|
|
93
|
+
case 3: return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAkC;AAClC,mCAA2C;AAK3C;;;;GAIG;AACH,mBAAe,UAAO,QAAkB;IAAE,cAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,6BAAiB;;;;;;;;oBAEhD,qBAAM,QAAQ,wCAAI,IAAI,KAAC;wBAA9B,sBAAO,SAAuB,EAAC;;;oBAE/B,IAAI,GAAC,YAAY,wBAAe,EAAE;wBAChC,GAAC,CAAC,KAAK,EAAE,CAAC;wBACV,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;4BACrB,GAAC,CAAC,OAAO,EAAE,CAAC;yBACb;qBACF;yBAAM;wBACL,eAAM,CAAC,KAAK,CAAC,GAAC,CAAC,CAAC;qBACjB;oBAED,2CAA2C;oBAC3C,sBAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC;;;;;CAE1B,EAAC"}
|
package/dist/semver.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import semver, { ReleaseType, SemVer } from 'semver';
|
|
2
|
+
export default semver;
|
|
3
|
+
export { ReleaseType, SemVer };
|
|
4
|
+
/**
|
|
5
|
+
* Checks whether the provided version satisfies the given range. The provided version is coerced first
|
|
6
|
+
* @param version the version to test
|
|
7
|
+
* @param range the range to check
|
|
8
|
+
*/
|
|
9
|
+
export declare const versionSatisfiesRange: (version: string, range: string) => boolean;
|
package/dist/semver.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.versionSatisfiesRange = exports.SemVer = void 0;
|
|
23
|
+
var semver_1 = __importStar(require("semver"));
|
|
24
|
+
Object.defineProperty(exports, "SemVer", { enumerable: true, get: function () { return semver_1.SemVer; } });
|
|
25
|
+
exports.default = semver_1.default;
|
|
26
|
+
/**
|
|
27
|
+
* Checks whether the provided version satisfies the given range. The provided version is coerced first
|
|
28
|
+
* @param version the version to test
|
|
29
|
+
* @param range the range to check
|
|
30
|
+
*/
|
|
31
|
+
var versionSatisfiesRange = function (version, range) {
|
|
32
|
+
var _a;
|
|
33
|
+
return semver_1.default.satisfies((_a = semver_1.default.coerce(version)) === null || _a === void 0 ? void 0 : _a.version, range);
|
|
34
|
+
};
|
|
35
|
+
exports.versionSatisfiesRange = versionSatisfiesRange;
|
|
36
|
+
//# sourceMappingURL=semver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../src/semver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AAK/B,uFALQ,eAAM,OAKR;AAH5B,kBAAe,gBAAM,CAAC;AAKtB;;;;GAIG;AACI,IAAM,qBAAqB,GAAG,UAAC,OAAe,EAAE,KAAa;;IAClE,OAAO,gBAAM,CAAC,SAAS,CAAC,MAAA,gBAAM,CAAC,MAAM,CAAC,OAAO,CAAC,0CAAE,OAAiB,EAAE,KAAK,CAAC,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC"}
|
package/dist/sids.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare type Null = null | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Validates the string is a valid sid
|
|
4
|
+
*
|
|
5
|
+
* @param sid the sid
|
|
6
|
+
*/
|
|
7
|
+
export declare const isValidSid: (sid: string | Null) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the provided string is of type Sid
|
|
10
|
+
* @param sid the sid to check
|
|
11
|
+
*/
|
|
12
|
+
export declare const looksLikeSid: (sid: string) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Validates sid is of type prefix provided
|
|
15
|
+
*
|
|
16
|
+
* @param sid the sid
|
|
17
|
+
* @param prefix the prefix of the sid
|
|
18
|
+
*/
|
|
19
|
+
export declare const isSidOfType: (sid: string | Null, prefix: string | Null) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Prefix of Sids
|
|
22
|
+
*/
|
|
23
|
+
export declare const SidPrefix: {
|
|
24
|
+
AccountSid: string;
|
|
25
|
+
ApiKey: string;
|
|
26
|
+
ServiceSid: string;
|
|
27
|
+
EnvironmentSid: string;
|
|
28
|
+
BuildSid: string;
|
|
29
|
+
FileSid: string;
|
|
30
|
+
VersionSid: string;
|
|
31
|
+
DeploymentSid: string;
|
|
32
|
+
};
|
|
33
|
+
declare const _default: {
|
|
34
|
+
isValidSid: (sid: string | Null) => boolean;
|
|
35
|
+
isSidOfType: (sid: string | Null, prefix: string | Null) => boolean;
|
|
36
|
+
looksLikeSid: (sid: string) => boolean;
|
|
37
|
+
SidPrefix: {
|
|
38
|
+
AccountSid: string;
|
|
39
|
+
ApiKey: string;
|
|
40
|
+
ServiceSid: string;
|
|
41
|
+
EnvironmentSid: string;
|
|
42
|
+
BuildSid: string;
|
|
43
|
+
FileSid: string;
|
|
44
|
+
VersionSid: string;
|
|
45
|
+
DeploymentSid: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export default _default;
|
package/dist/sids.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable import/no-unused-modules */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SidPrefix = exports.isSidOfType = exports.looksLikeSid = exports.isValidSid = void 0;
|
|
5
|
+
var SID_REGEX = /^[A-Z]{2}[0-9A-Fa-c]{32}$/i;
|
|
6
|
+
/**
|
|
7
|
+
* Validates the string is a valid sid
|
|
8
|
+
*
|
|
9
|
+
* @param sid the sid
|
|
10
|
+
*/
|
|
11
|
+
var isValidSid = function (sid) { return Boolean(sid && /^[A-Z]{2}[0-9a-f]{32}$/.test(sid)); };
|
|
12
|
+
exports.isValidSid = isValidSid;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the provided string is of type Sid
|
|
15
|
+
* @param sid the sid to check
|
|
16
|
+
*/
|
|
17
|
+
var looksLikeSid = function (sid) {
|
|
18
|
+
return Boolean(sid && SID_REGEX.test(sid));
|
|
19
|
+
};
|
|
20
|
+
exports.looksLikeSid = looksLikeSid;
|
|
21
|
+
/**
|
|
22
|
+
* Validates sid is of type prefix provided
|
|
23
|
+
*
|
|
24
|
+
* @param sid the sid
|
|
25
|
+
* @param prefix the prefix of the sid
|
|
26
|
+
*/
|
|
27
|
+
var isSidOfType = function (sid, prefix) {
|
|
28
|
+
return Boolean(sid && prefix && exports.isValidSid(sid) && prefix.toUpperCase() === sid.substr(0, 2));
|
|
29
|
+
};
|
|
30
|
+
exports.isSidOfType = isSidOfType;
|
|
31
|
+
/**
|
|
32
|
+
* Prefix of Sids
|
|
33
|
+
*/
|
|
34
|
+
exports.SidPrefix = {
|
|
35
|
+
AccountSid: 'AC',
|
|
36
|
+
ApiKey: 'SK',
|
|
37
|
+
ServiceSid: 'ZS',
|
|
38
|
+
EnvironmentSid: 'ZE',
|
|
39
|
+
BuildSid: 'ZB',
|
|
40
|
+
FileSid: 'ZH',
|
|
41
|
+
VersionSid: 'ZN',
|
|
42
|
+
DeploymentSid: 'ZD',
|
|
43
|
+
};
|
|
44
|
+
exports.default = {
|
|
45
|
+
isValidSid: exports.isValidSid,
|
|
46
|
+
isSidOfType: exports.isSidOfType,
|
|
47
|
+
looksLikeSid: exports.looksLikeSid,
|
|
48
|
+
SidPrefix: exports.SidPrefix,
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=sids.js.map
|
package/dist/sids.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sids.js","sourceRoot":"","sources":["../src/sids.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAI7C,IAAM,SAAS,GAAG,4BAA4B,CAAC;AAE/C;;;;GAIG;AACI,IAAM,UAAU,GAAG,UAAC,GAAkB,IAAc,OAAA,OAAO,CAAC,GAAG,IAAI,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAlD,CAAkD,CAAC;AAAjG,QAAA,UAAU,cAAuF;AAE9G;;;GAGG;AACI,IAAM,YAAY,GAAG,UAAC,GAAW;IACtC,OAAO,OAAO,CAAC,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF;;;;;GAKG;AACI,IAAM,WAAW,GAAG,UAAC,GAAkB,EAAE,MAAqB;IACnE,OAAO,OAAO,CAAC,GAAG,IAAI,MAAM,IAAI,kBAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAEF;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,kBAAe;IACb,UAAU,oBAAA;IACV,WAAW,qBAAA;IACX,YAAY,sBAAA;IACZ,SAAS,mBAAA;CACV,CAAC"}
|