@twilio/flex-dev-utils 5.0.1-beta.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 +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2018, Twilio, Inc. <help@twilio.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+
[](../../LICENSE)
|
|
4
|
+
|
|
5
|
+
# Flex Dev Utils
|
|
6
|
+
|
|
7
|
+
Common development utility functions and scripts for Flex plugin creation.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
These utilities are included by default when you use flex-plugin.
|
|
12
|
+
|
|
13
|
+
## Contributing
|
|
14
|
+
|
|
15
|
+
Make sure to follow the instructions in the [main repository](https://github.com/twilio/flex-plugin-builder#contributing) to set up the project.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Install dependencies and link local packages with each other
|
|
19
|
+
cd packages/flex-dev-utils
|
|
20
|
+
npx lerna bootstrap
|
|
21
|
+
|
|
22
|
+
# Run tests
|
|
23
|
+
npm test
|
|
24
|
+
|
|
25
|
+
# To use your local package in a different project
|
|
26
|
+
npm link
|
|
27
|
+
# then in a different project
|
|
28
|
+
npm link flex-dev-utils
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Contributors
|
|
32
|
+
|
|
33
|
+
Thank you to all the lovely contributors to this project. Please check the main repository to see [all contributors](https://github.com/twilio/flex-plugin-builder#contributors).
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
[MIT](../../LICENSE)
|
|
38
|
+
|
package/dist/axios.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
2
|
+
import axios, { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
3
|
+
import httpAdapter from 'axios/lib/adapters/http';
|
|
4
|
+
import settle from 'axios/lib/core/settle';
|
|
5
|
+
export default axios;
|
|
6
|
+
export { AxiosRequestConfig, AxiosInstance, MockAdapter, httpAdapter, settle };
|
package/dist/axios.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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.settle = exports.httpAdapter = exports.MockAdapter = void 0;
|
|
7
|
+
/* eslint-disable import/order */
|
|
8
|
+
var axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
|
|
9
|
+
exports.MockAdapter = axios_mock_adapter_1.default;
|
|
10
|
+
var axios_1 = __importDefault(require("axios"));
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
var http_1 = __importDefault(require("axios/lib/adapters/http"));
|
|
13
|
+
exports.httpAdapter = http_1.default;
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
var settle_1 = __importDefault(require("axios/lib/core/settle"));
|
|
16
|
+
exports.settle = settle_1.default;
|
|
17
|
+
exports.default = axios_1.default;
|
|
18
|
+
//# sourceMappingURL=axios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../src/axios.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAiC;AACjC,0EAA6C;AASD,sBATrC,4BAAW,CASqC;AARvD,gDAAiE;AAEjE,aAAa;AACb,iEAAkD;AAKO,sBALlD,cAAW,CAKkD;AAJpE,aAAa;AACb,iEAA2C;AAG2B,iBAH/D,gBAAM,CAG+D;AAD5E,kBAAe,eAAK,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Keychain, KeychainCredential } from './keychain';
|
|
2
|
+
export declare const SERVICE_NAME = "com.twilio.flex.plugins.builder";
|
|
3
|
+
export interface Credential {
|
|
4
|
+
username: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Instantiates a keychain to use
|
|
9
|
+
*/
|
|
10
|
+
export declare const _getKeychain: () => Keychain;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the credential service
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare const _getService: () => Promise<KeychainCredential[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Finds the credential. If more than one credential exists, then it prompt the user to choose one.
|
|
18
|
+
*
|
|
19
|
+
* @param accountSid optional accountSid to find
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
export declare const _findCredential: (accountSid?: string | undefined) => Promise<Credential | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Saves the credential
|
|
25
|
+
*
|
|
26
|
+
* @param username the username
|
|
27
|
+
* @param password the password
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
export declare const _saveCredential: (username: string, password: string) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Fetches the API Key/Secret and stores them in keychain.
|
|
33
|
+
* If no credentials exists, then prompts the user to enter the credentials
|
|
34
|
+
*/
|
|
35
|
+
export declare const getCredential: () => Promise<Credential>;
|
|
36
|
+
/**
|
|
37
|
+
* Clears the credentials
|
|
38
|
+
*/
|
|
39
|
+
export declare const clearCredentials: () => Promise<void>;
|
|
40
|
+
export default getCredential;
|
|
@@ -0,0 +1,241 @@
|
|
|
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.clearCredentials = exports.getCredential = exports._saveCredential = exports._findCredential = exports._getService = exports._getKeychain = exports.SERVICE_NAME = void 0;
|
|
43
|
+
/* eslint-disable prefer-destructuring */
|
|
44
|
+
var errors_1 = require("./errors");
|
|
45
|
+
var questions_1 = require("./questions");
|
|
46
|
+
var env_1 = require("./env");
|
|
47
|
+
var keychain_1 = __importDefault(require("./keychain"));
|
|
48
|
+
var validators_1 = require("./validators");
|
|
49
|
+
exports.SERVICE_NAME = 'com.twilio.flex.plugins.builder';
|
|
50
|
+
var accountSidQuestion = {
|
|
51
|
+
type: 'input',
|
|
52
|
+
name: 'accountSid',
|
|
53
|
+
message: 'Enter your Twilio Account Sid:',
|
|
54
|
+
validate: validators_1.validateAccountSid,
|
|
55
|
+
};
|
|
56
|
+
var authTokenQuestion = {
|
|
57
|
+
type: 'password',
|
|
58
|
+
name: 'authToken',
|
|
59
|
+
message: 'Enter your Twilio Auth Token:',
|
|
60
|
+
validate: validators_1.isInputNotEmpty,
|
|
61
|
+
};
|
|
62
|
+
var chooseAccount = {
|
|
63
|
+
type: 'list',
|
|
64
|
+
name: 'account',
|
|
65
|
+
message: 'Choose one of the following Account Sids:',
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Instantiates a keychain to use
|
|
69
|
+
*/
|
|
70
|
+
var _getKeychain = function () { return keychain_1.default(exports.SERVICE_NAME); };
|
|
71
|
+
exports._getKeychain = _getKeychain;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the credential service
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
var _getService = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
if (env_1.env.isCI()) {
|
|
79
|
+
return [2 /*return*/, []];
|
|
80
|
+
}
|
|
81
|
+
return [2 /*return*/, exports._getKeychain().findCredentials()];
|
|
82
|
+
});
|
|
83
|
+
}); };
|
|
84
|
+
exports._getService = _getService;
|
|
85
|
+
/**
|
|
86
|
+
* Finds the credential. If more than one credential exists, then it prompt the user to choose one.
|
|
87
|
+
*
|
|
88
|
+
* @param accountSid optional accountSid to find
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
var _findCredential = function (accountSid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
var convertCredential, credentials, match, accounts, selectedAccount;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
convertCredential = function (credential) { return ({
|
|
97
|
+
username: credential.account,
|
|
98
|
+
password: credential.password,
|
|
99
|
+
}); };
|
|
100
|
+
return [4 /*yield*/, exports._getService()];
|
|
101
|
+
case 1:
|
|
102
|
+
credentials = _a.sent();
|
|
103
|
+
if (accountSid) {
|
|
104
|
+
match = credentials.find(function (cred) { return cred.account === accountSid; });
|
|
105
|
+
if (match) {
|
|
106
|
+
return [2 /*return*/, convertCredential(match)];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
accounts = credentials
|
|
110
|
+
.map(function (cred) { return cred.account; })
|
|
111
|
+
.filter(function (acc) { return acc.length === 34 && (acc.substr(0, 2) === 'AC' || acc.substr(0, 2) === 'SK'); });
|
|
112
|
+
if (credentials.length === 0) {
|
|
113
|
+
return [2 /*return*/, null];
|
|
114
|
+
}
|
|
115
|
+
if (credentials.length === 1) {
|
|
116
|
+
return [2 /*return*/, convertCredential(credentials[0])];
|
|
117
|
+
}
|
|
118
|
+
if (accounts.length === 0) {
|
|
119
|
+
return [2 /*return*/, null];
|
|
120
|
+
}
|
|
121
|
+
/* istanbul ignore next */
|
|
122
|
+
if (accounts.length === 1) {
|
|
123
|
+
return [2 /*return*/, convertCredential(credentials.find(function (cred) { return cred.account === accounts[0]; }))];
|
|
124
|
+
}
|
|
125
|
+
return [4 /*yield*/, questions_1.choose(chooseAccount, accounts)];
|
|
126
|
+
case 2:
|
|
127
|
+
selectedAccount = _a.sent();
|
|
128
|
+
return [2 /*return*/, convertCredential(credentials.find(function (cred) { return cred.account === selectedAccount; }))];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}); };
|
|
132
|
+
exports._findCredential = _findCredential;
|
|
133
|
+
/**
|
|
134
|
+
* Saves the credential
|
|
135
|
+
*
|
|
136
|
+
* @param username the username
|
|
137
|
+
* @param password the password
|
|
138
|
+
* @private
|
|
139
|
+
*/
|
|
140
|
+
var _saveCredential = function (username, password) { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
if (!(!env_1.env.isCI() && !process.env.SKIP_CREDENTIALS_SAVING)) return [3 /*break*/, 2];
|
|
145
|
+
return [4 /*yield*/, exports._getKeychain().setPassword(username, password)];
|
|
146
|
+
case 1:
|
|
147
|
+
_a.sent();
|
|
148
|
+
_a.label = 2;
|
|
149
|
+
case 2: return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}); };
|
|
153
|
+
exports._saveCredential = _saveCredential;
|
|
154
|
+
/**
|
|
155
|
+
* Fetches the API Key/Secret and stores them in keychain.
|
|
156
|
+
* If no credentials exists, then prompts the user to enter the credentials
|
|
157
|
+
*/
|
|
158
|
+
var getCredential = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
+
var username, password, missingCredentials, credential;
|
|
160
|
+
return __generator(this, function (_a) {
|
|
161
|
+
switch (_a.label) {
|
|
162
|
+
case 0:
|
|
163
|
+
missingCredentials = !((process.env.TWILIO_ACCOUNT_SID && process.env.TWILIO_AUTH_TOKEN) ||
|
|
164
|
+
(process.env.TWILIO_API_KEY && process.env.TWILIO_API_SECRET));
|
|
165
|
+
if (env_1.env.isCI() && missingCredentials) {
|
|
166
|
+
throw new errors_1.FlexPluginError('❌. Running script in CI, but no AccountSid/AuthToken or API Key/Secret was provided');
|
|
167
|
+
}
|
|
168
|
+
if (!(process.env.TWILIO_ACCOUNT_SID && process.env.TWILIO_AUTH_TOKEN)) return [3 /*break*/, 2];
|
|
169
|
+
return [4 /*yield*/, validators_1.validateAccountSid(process.env.TWILIO_ACCOUNT_SID)];
|
|
170
|
+
case 1:
|
|
171
|
+
if (!(_a.sent())) {
|
|
172
|
+
throw new errors_1.FlexPluginError('AccountSid is not valid.');
|
|
173
|
+
}
|
|
174
|
+
username = process.env.TWILIO_ACCOUNT_SID;
|
|
175
|
+
password = process.env.TWILIO_AUTH_TOKEN;
|
|
176
|
+
return [3 /*break*/, 6];
|
|
177
|
+
case 2:
|
|
178
|
+
if (!(process.env.TWILIO_API_KEY && process.env.TWILIO_API_SECRET)) return [3 /*break*/, 4];
|
|
179
|
+
return [4 /*yield*/, validators_1.validateApiKey(process.env.TWILIO_API_KEY)];
|
|
180
|
+
case 3:
|
|
181
|
+
if (!(_a.sent())) {
|
|
182
|
+
throw new errors_1.FlexPluginError('API Key is not valid.');
|
|
183
|
+
}
|
|
184
|
+
username = process.env.TWILIO_API_KEY;
|
|
185
|
+
password = process.env.TWILIO_API_SECRET;
|
|
186
|
+
return [3 /*break*/, 6];
|
|
187
|
+
case 4: return [4 /*yield*/, exports._findCredential(process.env.TWILIO_ACCOUNT_SID)];
|
|
188
|
+
case 5:
|
|
189
|
+
credential = _a.sent();
|
|
190
|
+
if (credential) {
|
|
191
|
+
username = credential.username;
|
|
192
|
+
password = credential.password;
|
|
193
|
+
}
|
|
194
|
+
_a.label = 6;
|
|
195
|
+
case 6:
|
|
196
|
+
if (!(!username || !password)) return [3 /*break*/, 9];
|
|
197
|
+
return [4 /*yield*/, questions_1.prompt(accountSidQuestion)];
|
|
198
|
+
case 7:
|
|
199
|
+
username = _a.sent();
|
|
200
|
+
return [4 /*yield*/, questions_1.prompt(authTokenQuestion)];
|
|
201
|
+
case 8:
|
|
202
|
+
password = _a.sent();
|
|
203
|
+
_a.label = 9;
|
|
204
|
+
case 9:
|
|
205
|
+
// Save the credential
|
|
206
|
+
return [4 /*yield*/, exports._saveCredential(username, password)];
|
|
207
|
+
case 10:
|
|
208
|
+
// Save the credential
|
|
209
|
+
_a.sent();
|
|
210
|
+
return [2 /*return*/, { username: username, password: password }];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}); };
|
|
214
|
+
exports.getCredential = getCredential;
|
|
215
|
+
/**
|
|
216
|
+
* Clears the credentials
|
|
217
|
+
*/
|
|
218
|
+
var clearCredentials = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
219
|
+
var credentials, promises;
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
switch (_a.label) {
|
|
222
|
+
case 0:
|
|
223
|
+
if (env_1.env.isCI()) {
|
|
224
|
+
return [2 /*return*/, Promise.resolve()];
|
|
225
|
+
}
|
|
226
|
+
return [4 /*yield*/, exports._getService()];
|
|
227
|
+
case 1:
|
|
228
|
+
credentials = _a.sent();
|
|
229
|
+
promises = credentials.map(function (cred) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
230
|
+
return [2 /*return*/, exports._getKeychain().deletePassword(cred.account)];
|
|
231
|
+
}); }); });
|
|
232
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
233
|
+
case 2:
|
|
234
|
+
_a.sent();
|
|
235
|
+
return [2 /*return*/, Promise.resolve()];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}); };
|
|
239
|
+
exports.clearCredentials = clearCredentials;
|
|
240
|
+
exports.default = exports.getCredential;
|
|
241
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -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AAE,EAAE;oBACd,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;iBAC1B;gBAEmB,qBAAM,mBAAW,EAAE,EAAA;;gBAAjC,WAAW,GAAG,SAAmB;gBACjC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,UAAO,IAAI;oBAAK,sBAAA,oBAAY,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;yBAAA,CAAC,CAAC;gBAC9F,qBAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAA;;gBAA3B,SAA2B,CAAC;gBAE5B,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;;;KAC1B,CAAC;AAVW,QAAA,gBAAgB,oBAU3B;AAEF,kBAAe,qBAAa,CAAC"}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { env as default, default as env, Environment, Lifecycle, Region } from '@twilio/flex-plugins-utils-env';
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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.Lifecycle = exports.Environment = exports.env = exports.default = void 0;
|
|
7
|
+
/* eslint-disable import/no-unused-modules */
|
|
8
|
+
var flex_plugins_utils_env_1 = require("@twilio/flex-plugins-utils-env");
|
|
9
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return flex_plugins_utils_env_1.env; } });
|
|
10
|
+
Object.defineProperty(exports, "env", { enumerable: true, get: function () { return __importDefault(flex_plugins_utils_env_1).default; } });
|
|
11
|
+
Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return flex_plugins_utils_env_1.Environment; } });
|
|
12
|
+
Object.defineProperty(exports, "Lifecycle", { enumerable: true, get: function () { return flex_plugins_utils_env_1.Lifecycle; } });
|
|
13
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA6C;AAC7C,yEAAgH;AAAvG,iHAAA,GAAG,OAAW;AAAE,8HAAA,OAAO,OAAO;AAAE,qHAAA,WAAW,OAAA;AAAE,mHAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as FlexPluginError } from './lib/FlexPluginError';
|
|
2
|
+
export { default as ValidationError } from './lib/ValidationError';
|
|
3
|
+
export { default as UserActionError } from './lib/UserActionError';
|
|
4
|
+
export { TwilioError, TwilioApiError, NotImplementedError, TwilioCliError } from '@twilio/flex-plugins-utils-exception';
|
|
5
|
+
declare const _default: {};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
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.TwilioCliError = exports.NotImplementedError = exports.TwilioApiError = exports.TwilioError = exports.UserActionError = exports.ValidationError = exports.FlexPluginError = void 0;
|
|
7
|
+
var FlexPluginError_1 = require("./lib/FlexPluginError");
|
|
8
|
+
Object.defineProperty(exports, "FlexPluginError", { enumerable: true, get: function () { return __importDefault(FlexPluginError_1).default; } });
|
|
9
|
+
var ValidationError_1 = require("./lib/ValidationError");
|
|
10
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return __importDefault(ValidationError_1).default; } });
|
|
11
|
+
var UserActionError_1 = require("./lib/UserActionError");
|
|
12
|
+
Object.defineProperty(exports, "UserActionError", { enumerable: true, get: function () { return __importDefault(UserActionError_1).default; } });
|
|
13
|
+
var flex_plugins_utils_exception_1 = require("@twilio/flex-plugins-utils-exception");
|
|
14
|
+
Object.defineProperty(exports, "TwilioError", { enumerable: true, get: function () { return flex_plugins_utils_exception_1.TwilioError; } });
|
|
15
|
+
Object.defineProperty(exports, "TwilioApiError", { enumerable: true, get: function () { return flex_plugins_utils_exception_1.TwilioApiError; } });
|
|
16
|
+
Object.defineProperty(exports, "NotImplementedError", { enumerable: true, get: function () { return flex_plugins_utils_exception_1.NotImplementedError; } });
|
|
17
|
+
Object.defineProperty(exports, "TwilioCliError", { enumerable: true, get: function () { return flex_plugins_utils_exception_1.TwilioCliError; } });
|
|
18
|
+
exports.default = {};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAmE;AAA1D,mIAAA,OAAO,OAAmB;AACnC,yDAAmE;AAA1D,mIAAA,OAAO,OAAmB;AACnC,yDAAmE;AAA1D,mIAAA,OAAO,OAAmB;AACnC,qFAAwH;AAA/G,2HAAA,WAAW,OAAA;AAAE,8HAAA,cAAc,OAAA;AAAE,mIAAA,mBAAmB,OAAA;AAAE,8HAAA,cAAc,OAAA;AAEzE,kBAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
var flex_plugins_utils_exception_1 = require("@twilio/flex-plugins-utils-exception");
|
|
19
|
+
var fs_1 = require("../../fs");
|
|
20
|
+
var logger_1 = require("../../logger");
|
|
21
|
+
var FlexPluginError = /** @class */ (function (_super) {
|
|
22
|
+
__extends(FlexPluginError, _super);
|
|
23
|
+
function FlexPluginError(msg) {
|
|
24
|
+
var _this =
|
|
25
|
+
/* istanbul ignore next */
|
|
26
|
+
_super.call(this, msg) || this;
|
|
27
|
+
_this.print = function () {
|
|
28
|
+
logger_1.logger.error(_this.message);
|
|
29
|
+
};
|
|
30
|
+
_this.details = function () {
|
|
31
|
+
var headline = logger_1.logger.coloredStrings.headline;
|
|
32
|
+
if (_this.pkg) {
|
|
33
|
+
var deps_1 = _this.pkg.dependencies;
|
|
34
|
+
var names = ['@twilio/flex-plugin', '@twilio/flex-plugin-scripts'];
|
|
35
|
+
logger_1.logger.newline();
|
|
36
|
+
logger_1.logger.info("Your plugin " + _this.pkg.name + " is using the following versions:");
|
|
37
|
+
logger_1.logger.newline();
|
|
38
|
+
names.forEach(function (name) { return logger_1.logger.info("\t " + headline("\"" + name + "\": \"" + deps_1[name] + "\"")); });
|
|
39
|
+
logger_1.logger.newline();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
_this.pkg = fs_1.readAppPackageJson();
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
_this.pkg = null;
|
|
47
|
+
}
|
|
48
|
+
Object.setPrototypeOf(_this, FlexPluginError.prototype);
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
return FlexPluginError;
|
|
52
|
+
}(flex_plugins_utils_exception_1.TwilioError));
|
|
53
|
+
exports.default = FlexPluginError;
|
|
54
|
+
//# sourceMappingURL=FlexPluginError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlexPluginError.js","sourceRoot":"","sources":["../../../src/errors/lib/FlexPluginError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qFAAmE;AAEnE,+BAA8D;AAC9D,uCAAsC;AAEtC;IAA6C,mCAAW;IAGtD,yBAAY,GAAY;QAAxB;QACE,0BAA0B;QAC1B,kBAAM,GAAG,CAAC,SASX;QAEM,WAAK,GAAG;YACb,eAAM,CAAC,KAAK,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC;QAEK,aAAO,GAAG;YACP,IAAA,QAAQ,GAAK,eAAM,CAAC,cAAc,SAA1B,CAA2B;YAC3C,IAAI,KAAI,CAAC,GAAG,EAAE;gBACZ,IAAM,MAAI,GAAG,KAAI,CAAC,GAAG,CAAC,YAAY,CAAC;gBACnC,IAAM,KAAK,GAAG,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;gBAErE,eAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,eAAM,CAAC,IAAI,CAAC,iBAAe,KAAI,CAAC,GAAG,CAAC,IAAI,sCAAmC,CAAC,CAAC;gBAC7E,eAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,IAAK,OAAA,eAAM,CAAC,IAAI,CAAC,QAAM,QAAQ,CAAC,OAAI,IAAI,cAAO,MAAI,CAAC,IAAI,CAAC,OAAG,CAAG,CAAC,EAA3D,CAA2D,CAAC,CAAC;gBACrF,eAAM,CAAC,OAAO,EAAE,CAAC;aAClB;QACH,CAAC,CAAC;QAzBA,IAAI;YACF,KAAI,CAAC,GAAG,GAAG,uBAAkB,EAAE,CAAC;SACjC;QAAC,OAAO,CAAC,EAAE;YACV,KAAI,CAAC,GAAG,GAAG,IAAI,CAAC;SACjB;QAED,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;;IACzD,CAAC;IAmBH,sBAAC;AAAD,CAAC,AAjCD,CAA6C,0CAAW,GAiCvD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
var FlexPluginError_1 = __importDefault(require("./FlexPluginError"));
|
|
22
|
+
var UserActionError = /** @class */ (function (_super) {
|
|
23
|
+
__extends(UserActionError, _super);
|
|
24
|
+
function UserActionError(reason, message) {
|
|
25
|
+
var _this =
|
|
26
|
+
/* istanbul ignore next */
|
|
27
|
+
_super.call(this, message || reason) || this;
|
|
28
|
+
_this.reason = reason;
|
|
29
|
+
Object.setPrototypeOf(_this, UserActionError.prototype);
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
return UserActionError;
|
|
33
|
+
}(FlexPluginError_1.default));
|
|
34
|
+
exports.default = UserActionError;
|
|
35
|
+
//# sourceMappingURL=UserActionError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserActionError.js","sourceRoot":"","sources":["../../../src/errors/lib/UserActionError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,sEAAgD;AAEhD;IAA6C,mCAAe;IAG1D,yBAAY,MAAc,EAAE,OAAgB;QAA5C;QACE,0BAA0B;QAC1B,kBAAM,OAAO,IAAI,MAAM,CAAC,SAKzB;QAHC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;;IACzD,CAAC;IACH,sBAAC;AAAD,CAAC,AAXD,CAA6C,yBAAe,GAW3D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
var FlexPluginError_1 = __importDefault(require("./FlexPluginError"));
|
|
22
|
+
var ValidationError = /** @class */ (function (_super) {
|
|
23
|
+
__extends(ValidationError, _super);
|
|
24
|
+
function ValidationError() {
|
|
25
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
}
|
|
27
|
+
return ValidationError;
|
|
28
|
+
}(FlexPluginError_1.default));
|
|
29
|
+
exports.default = ValidationError;
|
|
30
|
+
//# sourceMappingURL=ValidationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationError.js","sourceRoot":"","sources":["../../../src/errors/lib/ValidationError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,sEAAgD;AAEhD;IAA6C,mCAAe;IAA5D;;IAA8D,CAAC;IAAD,sBAAC;AAAD,CAAC,AAA/D,CAA6C,yBAAe,GAAG"}
|
package/dist/exit.d.ts
ADDED
package/dist/exit.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Exits unless --no-process-exit flag is provided
|
|
5
|
+
*
|
|
6
|
+
* @param exitCode the exitCode
|
|
7
|
+
* @param args the process argument
|
|
8
|
+
*/
|
|
9
|
+
var exit = function (exitCode, args) {
|
|
10
|
+
if (args === void 0) { args = []; }
|
|
11
|
+
// Exit if not an embedded script
|
|
12
|
+
if (!args.includes('--no-process-exit')) {
|
|
13
|
+
// eslint-disable-next-line no-process-exit
|
|
14
|
+
process.exit(exitCode);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.default = exit;
|
|
18
|
+
//# sourceMappingURL=exit.js.map
|
package/dist/exit.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../src/exit.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,IAAM,IAAI,GAAG,UAAC,QAAgB,EAAE,IAAmB;IAAnB,qBAAA,EAAA,SAAmB;IACjD,iCAAiC;IACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QACvC,2CAA2C;QAC3C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACxB;AACH,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|