zcatalyst-cli 1.11.1 → 1.13.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/docs/optional-import.toml +10 -0
- package/lib/apig-utils.js +39 -39
- package/lib/archiver.js +13 -9
- package/lib/authentication/index.js +22 -18
- package/lib/authentication/login.js +37 -39
- package/lib/bin/catalyst.js +15 -15
- package/lib/cli_table/src/cell.js +26 -26
- package/lib/cli_table/src/layout-manager.js +44 -45
- package/lib/cli_table/src/table.js +9 -9
- package/lib/cli_table/src/utils.js +35 -36
- package/lib/client-utils.js +18 -18
- package/lib/client.js +1 -1
- package/lib/command_needs/auth.js +7 -7
- package/lib/command_needs/rc.js +24 -24
- package/lib/commands/apig/disable.js +5 -5
- package/lib/commands/apig/enable.js +5 -5
- package/lib/commands/apig/status.js +9 -9
- package/lib/commands/client/delete.js +19 -19
- package/lib/commands/client/setup.js +8 -4
- package/lib/commands/deploy.js +18 -14
- package/lib/commands/ds/export.js +11 -11
- package/lib/commands/ds/import.js +12 -12
- package/lib/commands/ds/status.js +15 -15
- package/lib/commands/event/generate/index.js +21 -17
- package/lib/commands/event/generate/integ.js +7 -3
- package/lib/commands/functions/add.js +8 -4
- package/lib/commands/functions/config.js +5 -5
- package/lib/commands/functions/delete.js +22 -22
- package/lib/commands/functions/setup.js +8 -4
- package/lib/commands/functions/shell.js +12 -5
- package/lib/commands/help.js +4 -4
- package/lib/commands/iac/export.js +8 -8
- package/lib/commands/iac/import.js +29 -21
- package/lib/commands/iac/pack.js +15 -11
- package/lib/commands/iac/status.js +6 -2
- package/lib/commands/index.js +5 -1
- package/lib/commands/init.js +14 -10
- package/lib/commands/login.js +5 -1
- package/lib/commands/logout.js +5 -1
- package/lib/commands/project/list.js +14 -10
- package/lib/commands/project/reset.js +5 -5
- package/lib/commands/project/use.js +9 -9
- package/lib/commands/pull.js +18 -14
- package/lib/commands/run.js +13 -9
- package/lib/commands/serve.js +5 -1
- package/lib/commands/token/generate.js +6 -2
- package/lib/commands/token/list.js +7 -3
- package/lib/commands/token/revoke.js +6 -2
- package/lib/commands/whoami.js +3 -3
- package/lib/dc.js +2 -2
- package/lib/deploy/features/apig.js +6 -6
- package/lib/deploy/features/client.js +1 -1
- package/lib/deploy/features/functions/index.js +9 -9
- package/lib/deploy/features/index.js +5 -1
- package/lib/deploy/index.js +2 -2
- package/lib/endpoints/index.js +17 -13
- package/lib/endpoints/lib/apig.js +5 -5
- package/lib/endpoints/lib/applogic.js +4 -4
- package/lib/endpoints/lib/cache.js +3 -3
- package/lib/endpoints/lib/catalyst-details.js +1 -1
- package/lib/endpoints/lib/client.js +5 -5
- package/lib/endpoints/lib/datastore.js +2 -2
- package/lib/endpoints/lib/ds-bulk.js +5 -5
- package/lib/endpoints/lib/env.js +1 -1
- package/lib/endpoints/lib/event-bus.js +1 -1
- package/lib/endpoints/lib/filestore.js +2 -2
- package/lib/endpoints/lib/functions.js +4 -4
- package/lib/endpoints/lib/iac.js +10 -10
- package/lib/endpoints/lib/project.js +20 -5
- package/lib/endpoints/lib/queue.js +3 -3
- package/lib/endpoints/lib/sdk.js +1 -1
- package/lib/endpoints/lib/zcql.js +1 -1
- package/lib/error.js +11 -9
- package/lib/errorOut.js +2 -2
- package/lib/event_generate/cache.js +5 -5
- package/lib/event_generate/custom.js +2 -2
- package/lib/event_generate/datastore.js +5 -5
- package/lib/event_generate/filestore.js +5 -5
- package/lib/event_generate/integration/cliq.js +3 -3
- package/lib/event_generate/user.js +1 -1
- package/lib/event_generate/webapp.js +5 -5
- package/lib/execute-script.js +19 -15
- package/lib/express_middlewares/authenticator.js +32 -5
- package/lib/express_middlewares/logger.js +2 -2
- package/lib/express_middlewares/unknownReqProxy.js +1 -1
- package/lib/fn-utils/index.js +5 -1
- package/lib/fn-utils/lib/common.js +44 -44
- package/lib/fn-utils/lib/integ.js +9 -9
- package/lib/fn-utils/lib/java.js +48 -46
- package/lib/fn-utils/lib/node.js +8 -8
- package/lib/fn-watcher.js +9 -11
- package/lib/iac/status/bundle.js +5 -5
- package/lib/iac/status/deploy.js +4 -4
- package/lib/index.js +2 -2
- package/lib/init/dependencies/npm-install.js +8 -1
- package/lib/init/dependencies/package-json.js +6 -6
- package/lib/init/features/client/index.js +5 -1
- package/lib/init/features/client/initializers/angular.js +29 -27
- package/lib/init/features/client/initializers/basic.js +10 -6
- package/lib/init/features/client/initializers/lyte.js +12 -13
- package/lib/init/features/client/initializers/react.js +23 -18
- package/lib/init/features/functions/index.js +23 -14
- package/lib/init/features/functions/languages/java.js +10 -10
- package/lib/init/features/functions/languages/node.js +9 -9
- package/lib/init/features/index.js +12 -8
- package/lib/init/features/project.js +20 -20
- package/lib/init/index.js +2 -2
- package/lib/init/util/client.js +12 -7
- package/lib/init/util/functions.js +1 -1
- package/lib/init/util/project.js +4 -4
- package/lib/internal/api.js +19 -19
- package/lib/internal/command.js +20 -16
- package/lib/internal/config.js +5 -5
- package/lib/internal/credential.js +10 -10
- package/lib/internal/crypt.js +5 -5
- package/lib/internal/rc.js +5 -5
- package/lib/migration/global/1.6.2.js +3 -3
- package/lib/migration/index.js +22 -18
- package/lib/option-filter.js +34 -30
- package/lib/optional-import.js +30 -11
- package/lib/plugin-loader.js +28 -13
- package/lib/port-resolver.js +4 -4
- package/lib/progress.js +2 -2
- package/lib/prompt/index.js +6 -2
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/pull/features/apig.js +9 -9
- package/lib/pull/features/client.js +7 -7
- package/lib/pull/features/functions/index.js +15 -15
- package/lib/pull/features/index.js +5 -1
- package/lib/pull/index.js +4 -4
- package/lib/repl-server.js +2 -2
- package/lib/serve/features/apig.js +1 -1
- package/lib/serve/features/index.js +8 -4
- package/lib/serve/index.js +15 -11
- package/lib/serve/server/index.js +34 -27
- package/lib/serve/server/lib/java/JavaaioServer.java +5 -3
- package/lib/serve/server/lib/java/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/lib/zip4j-2.5.0.jar +0 -0
- package/lib/serve/server/lib/master.js +33 -36
- package/lib/serve/server/lib/node.js +7 -3
- package/lib/serve/server/lib/web_client/index.js +3 -3
- package/lib/serve/server/lib/web_client/server.js +33 -30
- package/lib/shell/dependencies/http-functions.js +38 -33
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +14 -3
- package/lib/shell/dependencies/invoker/bio/node.js +5 -2
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +7 -2
- package/lib/shell/dependencies/invoker/integ/node.js +8 -4
- package/lib/shell/dependencies/local-function.js +44 -40
- package/lib/shell/index.js +16 -12
- package/lib/shell/prepare/index.js +2 -2
- package/lib/shell/prepare/languages/index.js +5 -1
- package/lib/shell/prepare/languages/java.js +1 -1
- package/lib/throbber/index.js +17 -17
- package/lib/throbber/utils.js +9 -9
- package/lib/track.js +7 -7
- package/lib/util_modules/config/index.js +5 -1
- package/lib/util_modules/config/lib/client.js +18 -21
- package/lib/util_modules/constants/lib/auth.js +6 -6
- package/lib/util_modules/constants/lib/cliq-handlers.js +2 -2
- package/lib/util_modules/constants/lib/template.js +21 -21
- package/lib/util_modules/constants/lib/urls.js +20 -12
- package/lib/util_modules/context-help.js +15 -15
- package/lib/util_modules/fs/index.js +5 -1
- package/lib/util_modules/fs/lib/async.js +4 -4
- package/lib/util_modules/fs/utils.js +1 -1
- package/lib/util_modules/global-space.js +0 -97
- package/lib/util_modules/logger.js +2 -2
- package/lib/util_modules/parser/toml.js +1 -1
- package/lib/util_modules/project.js +6 -6
- package/lib/util_modules/server.js +53 -0
- package/lib/util_modules/shell.js +4 -4
- package/lib/winston.js +5 -5
- package/package.json +40 -40
- package/scripts/postInstall.js +7 -6
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +23 -5
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +23 -8
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -3
- package/templates/init/functions/node/integ/cliq/package.json +2 -1
- package/templates/init/functions/node/integ/cliq/sample.js +3 -1
- package/docs/.DS_Store +0 -0
- package/lib/serve/server/lib/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/templates/.DS_Store +0 -0
- package/templates/init/.DS_Store +0 -0
- package/templates/init/client/.DS_Store +0 -0
- package/templates/init/client/react/.DS_Store +0 -0
|
@@ -28,18 +28,18 @@ class Credential {
|
|
|
28
28
|
if (tokenObj.token === undefined ||
|
|
29
29
|
js_1.JS.isEmpty(tokenObj.token) ||
|
|
30
30
|
tokenObj.token.slice(1, 2) !== '_') {
|
|
31
|
-
const tokenOption = option_1.getGlobalOptionValue('token');
|
|
31
|
+
const tokenOption = (0, option_1.getGlobalOptionValue)('token');
|
|
32
32
|
if (tokenOption) {
|
|
33
33
|
throw new error_1.default('Invalid token passed for authentication.', {
|
|
34
34
|
exit: 1,
|
|
35
35
|
errorId: 'CRED-1',
|
|
36
|
-
arg: [tokenOption, ansi_colors_1.bold('--token')]
|
|
36
|
+
arg: [tokenOption, (0, ansi_colors_1.bold)('--token')]
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
throw new error_1.default('Invalid token for authentication', {
|
|
40
40
|
exit: 0,
|
|
41
41
|
errorId: 'CRED-2',
|
|
42
|
-
arg: [ansi_colors_1.bold('catalyst login --force')]
|
|
42
|
+
arg: [(0, ansi_colors_1.bold)('catalyst login --force')]
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
this.cToken = tokenObj.token;
|
|
@@ -60,7 +60,7 @@ class Credential {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
_getTokenObjFromStore(pth = 'credential') {
|
|
63
|
-
const encryptedToken = config_store_1.default.get(dc_1.getActiveDC() + '.' + pth, null);
|
|
63
|
+
const encryptedToken = config_store_1.default.get((0, dc_1.getActiveDC)() + '.' + pth, null);
|
|
64
64
|
if (encryptedToken === null) {
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
@@ -73,7 +73,7 @@ class Credential {
|
|
|
73
73
|
}
|
|
74
74
|
_setTokenObjToStore(pth) {
|
|
75
75
|
const encryptObj = Credential.crypt.encrypt(Credential.credentialObject);
|
|
76
|
-
config_store_1.default.set(dc_1.getActiveDC() + '.' + pth, encryptObj);
|
|
76
|
+
config_store_1.default.set((0, dc_1.getActiveDC)() + '.' + pth, encryptObj);
|
|
77
77
|
}
|
|
78
78
|
_getAccessTokenFromCache() {
|
|
79
79
|
if (js_1.JS.isEmpty(Credential.credentialObject)) {
|
|
@@ -111,7 +111,7 @@ class Credential {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
_destroyTokenObjFromStore(pth = 'credential') {
|
|
114
|
-
const activeDC = dc_1.getActiveDC();
|
|
114
|
+
const activeDC = (0, dc_1.getActiveDC)();
|
|
115
115
|
config_store_1.default.delete(activeDC + '.' + pth);
|
|
116
116
|
if (pth === 'credential') {
|
|
117
117
|
config_store_1.default.delete(`${activeDC}.user`);
|
|
@@ -121,7 +121,7 @@ class Credential {
|
|
|
121
121
|
refreshAccessToken() {
|
|
122
122
|
var _a, _b;
|
|
123
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
logger_1.debug('> refreshing access token <');
|
|
124
|
+
(0, logger_1.debug)('> refreshing access token <');
|
|
125
125
|
const res = yield new api_1.default({ authNeeded: false })
|
|
126
126
|
.post('/oauth/v2/token', {
|
|
127
127
|
origin: constants_1.ORIGIN.auth,
|
|
@@ -143,10 +143,10 @@ class Credential {
|
|
|
143
143
|
});
|
|
144
144
|
if (!js_1.JS.isString(res.body.access_token)) {
|
|
145
145
|
throw new error_1.default('unable to refresh access token.', {
|
|
146
|
-
original: util_1.inspect(res.body),
|
|
146
|
+
original: (0, util_1.inspect)(res.body),
|
|
147
147
|
exit: 0,
|
|
148
148
|
errorId: 'CRED-2',
|
|
149
|
-
arg: [ansi_colors_1.bold('catalyst login --force')]
|
|
149
|
+
arg: [(0, ansi_colors_1.bold)('catalyst login --force')]
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
this._rebuildTokenCache(res);
|
|
@@ -216,7 +216,7 @@ class Credential {
|
|
|
216
216
|
throw new error_1.default('Authentication required', {
|
|
217
217
|
exit: 0,
|
|
218
218
|
errorId: 'CRED-3',
|
|
219
|
-
arg: [ansi_colors_1.bold('catalyst login')]
|
|
219
|
+
arg: [(0, ansi_colors_1.bold)('catalyst login')]
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
return Credential.oneTimeToken;
|
package/lib/internal/crypt.js
CHANGED
|
@@ -12,16 +12,16 @@ class Crypt {
|
|
|
12
12
|
return value;
|
|
13
13
|
}
|
|
14
14
|
const initializationVector = data.slice(0, 16);
|
|
15
|
-
const password = crypto_1.pbkdf2Sync(this.encryptionKey, initializationVector.toString(), 1000, 32, 'sha512');
|
|
16
|
-
const decipher = crypto_1.createDecipheriv(this.cryptAlgo, password, initializationVector);
|
|
15
|
+
const password = (0, crypto_1.pbkdf2Sync)(this.encryptionKey, initializationVector.toString(), 1000, 32, 'sha512');
|
|
16
|
+
const decipher = (0, crypto_1.createDecipheriv)(this.cryptAlgo, password, initializationVector);
|
|
17
17
|
data = Buffer.concat([decipher.update(data.slice(17)), decipher.final()]);
|
|
18
18
|
return this._deserialize(data.toString());
|
|
19
19
|
}
|
|
20
20
|
encrypt(value) {
|
|
21
21
|
const data = this._serialize(value);
|
|
22
|
-
const initializationVector = crypto_1.randomBytes(16);
|
|
23
|
-
const password = crypto_1.pbkdf2Sync(this.encryptionKey, initializationVector.toString(), 1000, 32, 'sha512');
|
|
24
|
-
const cipher = crypto_1.createCipheriv(this.cryptAlgo, password, initializationVector);
|
|
22
|
+
const initializationVector = (0, crypto_1.randomBytes)(16);
|
|
23
|
+
const password = (0, crypto_1.pbkdf2Sync)(this.encryptionKey, initializationVector.toString(), 1000, 32, 'sha512');
|
|
24
|
+
const cipher = (0, crypto_1.createCipheriv)(this.cryptAlgo, password, initializationVector);
|
|
25
25
|
const dataBuff = Buffer.concat([
|
|
26
26
|
initializationVector,
|
|
27
27
|
Buffer.from(':'),
|
package/lib/internal/rc.js
CHANGED
|
@@ -161,7 +161,7 @@ class RC {
|
|
|
161
161
|
throw new error_1.default('Unable to find and remove project object in RC file with project ID : ' + id, { exit: 2 });
|
|
162
162
|
}
|
|
163
163
|
if (projectArr.length === 0) {
|
|
164
|
-
logger_1.warning('No projects found in ' + constants_1.FILENAME.rc + ' hence removing it.');
|
|
164
|
+
(0, logger_1.warning)('No projects found in ' + constants_1.FILENAME.rc + ' hence removing it.');
|
|
165
165
|
return this.delete();
|
|
166
166
|
}
|
|
167
167
|
this._reIndex(projectArr, removedProjectArr[0].idx, 'project');
|
|
@@ -273,11 +273,11 @@ class RC {
|
|
|
273
273
|
}
|
|
274
274
|
static load() {
|
|
275
275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
const pd = project_1.getProjectRoot();
|
|
277
|
-
if (yield fs_1.ASYNC.fileExists(path_1.normalize(path_1.join(pd, constants_1.FILENAME.rc)))) {
|
|
278
|
-
return RC.loadFile(path_1.normalize(path_1.join(pd, constants_1.FILENAME.rc)));
|
|
276
|
+
const pd = (0, project_1.getProjectRoot)();
|
|
277
|
+
if (yield fs_1.ASYNC.fileExists((0, path_1.normalize)((0, path_1.join)(pd, constants_1.FILENAME.rc)))) {
|
|
278
|
+
return RC.loadFile((0, path_1.normalize)((0, path_1.join)(pd, constants_1.FILENAME.rc)));
|
|
279
279
|
}
|
|
280
|
-
return new RC(path_1.normalize(path_1.join(pd, constants_1.FILENAME.rc)));
|
|
280
|
+
return new RC((0, path_1.normalize)((0, path_1.join)(pd, constants_1.FILENAME.rc)));
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
}
|
|
@@ -22,9 +22,9 @@ const migrate = () => {
|
|
|
22
22
|
if (config_store_1.default.has(constants_1.DC_TYPE.eu.value)) {
|
|
23
23
|
config_store_1.default.delete(constants_1.DC_TYPE.eu.value + '.usage');
|
|
24
24
|
}
|
|
25
|
-
logger_1.info();
|
|
26
|
-
logger_1.info(ansi_colors_1.bold.cyan('Note: ') +
|
|
25
|
+
(0, logger_1.info)();
|
|
26
|
+
(0, logger_1.info)(ansi_colors_1.bold.cyan('Note: ') +
|
|
27
27
|
'The usage statistics collection will be done based on the consent provided with the login.');
|
|
28
|
-
logger_1.info();
|
|
28
|
+
(0, logger_1.info)();
|
|
29
29
|
};
|
|
30
30
|
exports.migrate = migrate;
|
package/lib/migration/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -44,7 +48,7 @@ const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0
|
|
|
44
48
|
return Promise.resolve();
|
|
45
49
|
}
|
|
46
50
|
const migFile = migFiles[idx];
|
|
47
|
-
const currentMigFileVersion = path_1.parse(migFile).name;
|
|
51
|
+
const currentMigFileVersion = (0, path_1.parse)(migFile).name;
|
|
48
52
|
const migDetails = rc.get(['migration', currentMigFileVersion]);
|
|
49
53
|
if (migDetails && migDetails.completed) {
|
|
50
54
|
return runMigration(rc, migFiles, ++idx);
|
|
@@ -52,14 +56,14 @@ const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0
|
|
|
52
56
|
try {
|
|
53
57
|
const migModule = yield Promise.resolve().then(() => __importStar(require(migFile)));
|
|
54
58
|
if (migModule.isRequire()) {
|
|
55
|
-
logger_1.debug('migration started for v' + currentMigFileVersion);
|
|
59
|
+
(0, logger_1.debug)('migration started for v' + currentMigFileVersion);
|
|
56
60
|
migModule.migrate();
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
catch (e) {
|
|
60
|
-
logger_1.debug('migration failed for v' + currentMigFileVersion);
|
|
64
|
+
(0, logger_1.debug)('migration failed for v' + currentMigFileVersion);
|
|
61
65
|
rc.set(['migration', currentMigFileVersion], {
|
|
62
|
-
error: util_1.inspect(e),
|
|
66
|
+
error: (0, util_1.inspect)(e),
|
|
63
67
|
completed: false
|
|
64
68
|
});
|
|
65
69
|
rc.syncSave();
|
|
@@ -75,7 +79,7 @@ const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0
|
|
|
75
79
|
});
|
|
76
80
|
rc.set('migration.last_success', currentMigFileVersion);
|
|
77
81
|
rc.syncSave();
|
|
78
|
-
logger_1.debug('migration completed for v' + currentMigFileVersion);
|
|
82
|
+
(0, logger_1.debug)('migration completed for v' + currentMigFileVersion);
|
|
79
83
|
return runMigration(rc, migFiles, ++idx);
|
|
80
84
|
});
|
|
81
85
|
const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -86,7 +90,7 @@ const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, funct
|
|
|
86
90
|
if (!migFile) {
|
|
87
91
|
return;
|
|
88
92
|
}
|
|
89
|
-
const currentMigFileVersion = path_1.parse(migFile).name;
|
|
93
|
+
const currentMigFileVersion = (0, path_1.parse)(migFile).name;
|
|
90
94
|
const migDetails = config_store_1.default.get('migration.' + currentMigFileVersion.replace(new RegExp('\\.', 'g'), '\\.'));
|
|
91
95
|
if (migDetails && migDetails.completed) {
|
|
92
96
|
return runGlobalMigration(migFiles);
|
|
@@ -94,14 +98,14 @@ const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, funct
|
|
|
94
98
|
try {
|
|
95
99
|
const migModule = yield Promise.resolve().then(() => __importStar(require(migFile)));
|
|
96
100
|
if (migModule.isRequire()) {
|
|
97
|
-
logger_1.debug('migration started for v' + currentMigFileVersion);
|
|
101
|
+
(0, logger_1.debug)('migration started for v' + currentMigFileVersion);
|
|
98
102
|
migModule.migrate();
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
catch (e) {
|
|
102
|
-
logger_1.debug('migration failed for v' + currentMigFileVersion);
|
|
106
|
+
(0, logger_1.debug)('migration failed for v' + currentMigFileVersion);
|
|
103
107
|
config_store_1.default.set('migration.' + currentMigFileVersion.replace(new RegExp('\\.', 'g'), '\\.'), {
|
|
104
|
-
error: util_1.inspect(e),
|
|
108
|
+
error: (0, util_1.inspect)(e),
|
|
105
109
|
completed: false
|
|
106
110
|
});
|
|
107
111
|
const err = error_1.default.getErrorInstance(e, {
|
|
@@ -115,7 +119,7 @@ const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, funct
|
|
|
115
119
|
completed: true
|
|
116
120
|
});
|
|
117
121
|
config_store_1.default.set('migration.last_success', currentMigFileVersion);
|
|
118
|
-
logger_1.debug('migration completed for v' + currentMigFileVersion);
|
|
122
|
+
(0, logger_1.debug)('migration completed for v' + currentMigFileVersion);
|
|
119
123
|
return runGlobalMigration(migFiles);
|
|
120
124
|
});
|
|
121
125
|
const getMigFiles = (dir, currentVersion, lastRunVersion) => {
|
|
@@ -127,25 +131,25 @@ const getMigFiles = (dir, currentVersion, lastRunVersion) => {
|
|
|
127
131
|
if (migFiles.length === 0) {
|
|
128
132
|
return [];
|
|
129
133
|
}
|
|
130
|
-
if (lastRunVersion && semver_1.gte(lastRunVersion, currentVersion)) {
|
|
134
|
+
if (lastRunVersion && (0, semver_1.gte)(lastRunVersion, currentVersion)) {
|
|
131
135
|
return [];
|
|
132
136
|
}
|
|
133
137
|
return migFiles
|
|
134
|
-
.filter((file) => semver_1.valid(path_1.parse(file).name) &&
|
|
135
|
-
(!lastRunVersion || semver_1.gte(path_1.parse(file).name, lastRunVersion)))
|
|
136
|
-
.sort((v1, v2) => semver_1.compare(path_1.parse(v1).name, path_1.parse(v2).name));
|
|
138
|
+
.filter((file) => (0, semver_1.valid)((0, path_1.parse)(file).name) &&
|
|
139
|
+
(!lastRunVersion || (0, semver_1.gte)((0, path_1.parse)(file).name, lastRunVersion)))
|
|
140
|
+
.sort((v1, v2) => (0, semver_1.compare)((0, path_1.parse)(v1).name, (0, path_1.parse)(v2).name));
|
|
137
141
|
};
|
|
138
142
|
exports.default = (currentVersion) => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
143
|
const promiseArr = [];
|
|
140
144
|
const lastRunGlobalMigration = config_store_1.default.get('migration.last_success');
|
|
141
|
-
const globalMigFiles = getMigFiles(path_1.join(__dirname, 'global'), currentVersion, lastRunGlobalMigration);
|
|
145
|
+
const globalMigFiles = getMigFiles((0, path_1.join)(__dirname, 'global'), currentVersion, lastRunGlobalMigration);
|
|
142
146
|
if (globalMigFiles.length > 0) {
|
|
143
147
|
promiseArr.push(runGlobalMigration(globalMigFiles));
|
|
144
148
|
}
|
|
145
|
-
const rc = yield rc_1.default.load().catch(() => logger_1.debug('Unable to load rc file.'));
|
|
149
|
+
const rc = yield rc_1.default.load().catch(() => (0, logger_1.debug)('Unable to load rc file.'));
|
|
146
150
|
if (rc && rc.loaded) {
|
|
147
151
|
const lastRunLocalMigration = rc.get('migration.last_success');
|
|
148
|
-
const localMigFiles = getMigFiles(path_1.join(__dirname, 'local'), currentVersion, lastRunLocalMigration);
|
|
152
|
+
const localMigFiles = getMigFiles((0, path_1.join)(__dirname, 'local'), currentVersion, lastRunLocalMigration);
|
|
149
153
|
if (localMigFiles.length > 0) {
|
|
150
154
|
promiseArr.push(runMigration(rc, localMigFiles));
|
|
151
155
|
}
|
package/lib/option-filter.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -41,13 +45,13 @@ function enrichOptsData(opt, optValue, validTargets, multiTargetSupport = true)
|
|
|
41
45
|
.split(',')
|
|
42
46
|
.reduce((accumulator, entry, entryIndex, optArr) => {
|
|
43
47
|
if (optArr.indexOf(entry) !== entryIndex) {
|
|
44
|
-
optArr[entryIndex] = ansi_colors_1.red(optArr[entryIndex]);
|
|
45
|
-
throw new error_1.default(`Duplicate target found for ${ansi_colors_1.bold(entry)}.`, {
|
|
48
|
+
optArr[entryIndex] = (0, ansi_colors_1.red)(optArr[entryIndex]);
|
|
49
|
+
throw new error_1.default(`Duplicate target found for ${(0, ansi_colors_1.bold)(entry)}.`, {
|
|
46
50
|
exit: 1,
|
|
47
51
|
errorId: 'OPT-FILTER-1',
|
|
48
52
|
arg: [
|
|
49
|
-
ansi_colors_1.bold('--' + opt),
|
|
50
|
-
ansi_colors_1.bold('Option input: ') + ansi_colors_1.italic('--' + opt + ' ' + optArr.join(','))
|
|
53
|
+
(0, ansi_colors_1.bold)('--' + opt),
|
|
54
|
+
(0, ansi_colors_1.bold)('Option input: ') + (0, ansi_colors_1.italic)('--' + opt + ' ' + optArr.join(','))
|
|
51
55
|
]
|
|
52
56
|
});
|
|
53
57
|
}
|
|
@@ -58,8 +62,8 @@ function enrichOptsData(opt, optValue, validTargets, multiTargetSupport = true)
|
|
|
58
62
|
errorId: 'OPT-FILTER-2',
|
|
59
63
|
arg: [
|
|
60
64
|
ansi_colors_1.bold.red(entrySet[0]),
|
|
61
|
-
ansi_colors_1.bold('--' + opt),
|
|
62
|
-
ansi_colors_1.bold(validTargets.map((target) => '* ' + target).join('\n'))
|
|
65
|
+
(0, ansi_colors_1.bold)('--' + opt),
|
|
66
|
+
(0, ansi_colors_1.bold)(validTargets.map((target) => '* ' + target).join('\n'))
|
|
63
67
|
]
|
|
64
68
|
});
|
|
65
69
|
}
|
|
@@ -77,8 +81,8 @@ function enrichOptsData(opt, optValue, validTargets, multiTargetSupport = true)
|
|
|
77
81
|
((res.hasFilter && entrySet.length === 1) ||
|
|
78
82
|
(!res.hasFilter && entrySet.length === 2));
|
|
79
83
|
if (truthy) {
|
|
80
|
-
optArr[idx] = ansi_colors_1.red(optArr[idx]);
|
|
81
|
-
optArr[entryIndex] = ansi_colors_1.red(optArr[entryIndex]);
|
|
84
|
+
optArr[idx] = (0, ansi_colors_1.red)(optArr[idx]);
|
|
85
|
+
optArr[entryIndex] = (0, ansi_colors_1.red)(optArr[entryIndex]);
|
|
82
86
|
}
|
|
83
87
|
return truthy;
|
|
84
88
|
})) {
|
|
@@ -87,8 +91,8 @@ function enrichOptsData(opt, optValue, validTargets, multiTargetSupport = true)
|
|
|
87
91
|
errorId: 'OPT-FILTER-3',
|
|
88
92
|
arg: [
|
|
89
93
|
ansi_colors_1.bold.red(entrySet[0]),
|
|
90
|
-
ansi_colors_1.bold('--' + opt),
|
|
91
|
-
ansi_colors_1.bold('Option input: ') + ansi_colors_1.italic(`--${opt} ${optArr.join(',')}`)
|
|
94
|
+
(0, ansi_colors_1.bold)('--' + opt),
|
|
95
|
+
(0, ansi_colors_1.bold)('Option input: ') + (0, ansi_colors_1.italic)(`--${opt} ${optArr.join(',')}`)
|
|
92
96
|
]
|
|
93
97
|
});
|
|
94
98
|
}
|
|
@@ -104,26 +108,26 @@ function enrichOptsData(opt, optValue, validTargets, multiTargetSupport = true)
|
|
|
104
108
|
}, []);
|
|
105
109
|
}
|
|
106
110
|
function validateTargets() {
|
|
107
|
-
if (option_1.getOptionValue('except', false) && option_1.getOptionValue('only', false)) {
|
|
111
|
+
if ((0, option_1.getOptionValue)('except', false) && (0, option_1.getOptionValue)('only', false)) {
|
|
108
112
|
throw new error_1.default('Cannot specify both --only and --except', {
|
|
109
113
|
exit: 1,
|
|
110
114
|
errorId: 'OPT-FILTER-4',
|
|
111
|
-
arg: [ansi_colors_1.bold('--only'), ansi_colors_1.bold('--except')]
|
|
115
|
+
arg: [(0, ansi_colors_1.bold)('--only'), (0, ansi_colors_1.bold)('--except')]
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
|
-
const enrichedOnlyOpts = enrichOptsData('only', option_1.getOptionValue('only'), validGlobalTargets);
|
|
118
|
+
const enrichedOnlyOpts = enrichOptsData('only', (0, option_1.getOptionValue)('only'), validGlobalTargets);
|
|
115
119
|
if (enrichedOnlyOpts.length > 0) {
|
|
116
120
|
return enrichedOnlyOpts;
|
|
117
121
|
}
|
|
118
|
-
const enrichedExceptOpts = enrichOptsData('except', option_1.getOptionValue('except'), validGlobalTargets);
|
|
122
|
+
const enrichedExceptOpts = enrichOptsData('except', (0, option_1.getOptionValue)('except'), validGlobalTargets);
|
|
119
123
|
if (enrichedExceptOpts.length > 0) {
|
|
120
124
|
return enrichedExceptOpts;
|
|
121
125
|
}
|
|
122
126
|
return [];
|
|
123
127
|
}
|
|
124
128
|
function validatePorts() {
|
|
125
|
-
const customHttpPort = option_1.getOptionValue('http', false);
|
|
126
|
-
const enrichedDebugOpts = enrichOptsData('debug', option_1.getOptionValue('debug'), Object.keys(constants_1.DEFAULT.serve_port.debug));
|
|
129
|
+
const customHttpPort = (0, option_1.getOptionValue)('http', false);
|
|
130
|
+
const enrichedDebugOpts = enrichOptsData('debug', (0, option_1.getOptionValue)('debug'), Object.keys(constants_1.DEFAULT.serve_port.debug));
|
|
127
131
|
if (enrichedDebugOpts.some((opt) => {
|
|
128
132
|
const noFilter = !opt.hasFilter;
|
|
129
133
|
if (opt.target === 'client') {
|
|
@@ -138,10 +142,10 @@ function validatePorts() {
|
|
|
138
142
|
exit: 1,
|
|
139
143
|
errorId: 'OPT-FILTER-6',
|
|
140
144
|
arg: [
|
|
141
|
-
ansi_colors_1.bold('--debug'),
|
|
145
|
+
(0, ansi_colors_1.bold)('--debug'),
|
|
142
146
|
ansi_colors_1.italic.red('--debug <target>'),
|
|
143
|
-
ansi_colors_1.bold('* basicio: ') + ansi_colors_1.italic.green('--debug basicio:<port>'),
|
|
144
|
-
ansi_colors_1.bold('* advancedio: ') + ansi_colors_1.italic.green('--debug advancedio:<name>:<port>')
|
|
147
|
+
(0, ansi_colors_1.bold)('* basicio: ') + ansi_colors_1.italic.green('--debug basicio:<port>'),
|
|
148
|
+
(0, ansi_colors_1.bold)('* advancedio: ') + ansi_colors_1.italic.green('--debug advancedio:<name>:<port>')
|
|
145
149
|
]
|
|
146
150
|
});
|
|
147
151
|
}
|
|
@@ -159,8 +163,8 @@ function filterPorts() {
|
|
|
159
163
|
exit: 1,
|
|
160
164
|
errorId: 'OPT-FILTER-7',
|
|
161
165
|
arg: [
|
|
162
|
-
ansi_colors_1.bold('--debug'),
|
|
163
|
-
ansi_colors_1.bold('advancedio'),
|
|
166
|
+
(0, ansi_colors_1.bold)('--debug'),
|
|
167
|
+
(0, ansi_colors_1.bold)('advancedio'),
|
|
164
168
|
ansi_colors_1.italic.red('--debug advancedio:<name|port>'),
|
|
165
169
|
ansi_colors_1.italic.green('--debug advancedio:<name>:<port>')
|
|
166
170
|
]
|
|
@@ -182,24 +186,24 @@ function filterTargets(pathSense = true) {
|
|
|
182
186
|
if (validTargetResultants.length === 0) {
|
|
183
187
|
if (runtime_store_1.default.get('project.root') !== runtime_store_1.default.get('cwd')) {
|
|
184
188
|
targets = targets.filter((target) => {
|
|
185
|
-
if (target === 'apig' && option_1.getCurrentCommand() === 'serve') {
|
|
189
|
+
if (target === 'apig' && (0, option_1.getCurrentCommand)() === 'serve') {
|
|
186
190
|
return true;
|
|
187
191
|
}
|
|
188
192
|
if (!pathSense) {
|
|
189
193
|
return true;
|
|
190
194
|
}
|
|
191
|
-
const targetRoot = project_1.resolveProjectPath(CONFIG[(target + 'Config')].source());
|
|
195
|
+
const targetRoot = (0, project_1.resolveProjectPath)(CONFIG[(target + 'Config')].source());
|
|
192
196
|
return (fs_1.SYNC.isPathInside(targetRoot, runtime_store_1.default.get('cwd')) ||
|
|
193
197
|
runtime_store_1.default.get('cwd') === targetRoot);
|
|
194
198
|
});
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
|
-
else if (option_1.getOptionValue('only', false)) {
|
|
201
|
+
else if ((0, option_1.getOptionValue)('only', false)) {
|
|
198
202
|
targets = validTargetResultants.map((resultant) => {
|
|
199
203
|
return resultant.target;
|
|
200
204
|
});
|
|
201
205
|
}
|
|
202
|
-
else if (option_1.getOptionValue('except', false)) {
|
|
206
|
+
else if ((0, option_1.getOptionValue)('except', false)) {
|
|
203
207
|
const unwantedTargets = validTargetResultants
|
|
204
208
|
.filter((val) => {
|
|
205
209
|
if (val.target === 'functions' && val.hasFilter) {
|
|
@@ -212,16 +216,16 @@ function filterTargets(pathSense = true) {
|
|
|
212
216
|
}
|
|
213
217
|
targets = js_1.JS.uniq(targets);
|
|
214
218
|
if (targets.length === 0) {
|
|
215
|
-
const aid = option_1.getOptionValue('except', false)
|
|
216
|
-
? `the ${ansi_colors_1.bold('--except')} option does not rule out all the valid targets.`
|
|
217
|
-
: `the desired features are initialised in the ${ansi_colors_1.bold(constants_1.FILENAME.config)} file.`;
|
|
219
|
+
const aid = (0, option_1.getOptionValue)('except', false)
|
|
220
|
+
? `the ${(0, ansi_colors_1.bold)('--except')} option does not rule out all the valid targets.`
|
|
221
|
+
: `the desired features are initialised in the ${(0, ansi_colors_1.bold)(constants_1.FILENAME.config)} file.`;
|
|
218
222
|
throw new error_1.default('Cannot understand what targets.', {
|
|
219
223
|
exit: 1,
|
|
220
224
|
errorId: 'OPT-FILTER-8',
|
|
221
225
|
arg: [aid]
|
|
222
226
|
});
|
|
223
227
|
}
|
|
224
|
-
if (targets.length === 1 && targets.includes('apig') && option_1.getCurrentCommand() === 'serve') {
|
|
228
|
+
if (targets.length === 1 && targets.includes('apig') && (0, option_1.getCurrentCommand)() === 'serve') {
|
|
225
229
|
throw new error_1.default('API Gateway cannot be served separately', {
|
|
226
230
|
exit: 1,
|
|
227
231
|
errorId: 'OPT-FILTER-9'
|
package/lib/optional-import.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -32,19 +36,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
36
|
};
|
|
33
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
38
|
const app_module_path_1 = __importDefault(require("app-module-path"));
|
|
35
|
-
const
|
|
36
|
-
const global_space_1 = __importDefault(require("./util_modules/global-space"));
|
|
39
|
+
const project_js_1 = require("./util_modules/project.js");
|
|
37
40
|
const path_1 = require("path");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const async_js_1 = require("./util_modules/fs/lib/async.js");
|
|
42
|
+
const error_js_1 = __importDefault(require("./error.js"));
|
|
43
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
44
|
+
exports.default = (name, source) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
if (name === (0, path_1.basename)(name)) {
|
|
46
|
+
const projectModulePath = (0, project_js_1.resolveProjectPath)((0, path_1.join)(source, 'node_modules', name));
|
|
47
|
+
const projectModulePathExists = yield (0, async_js_1.dirExists)(projectModulePath);
|
|
48
|
+
if (!projectModulePathExists) {
|
|
49
|
+
throw new error_js_1.default('Module path does not exists', {
|
|
50
|
+
errorId: 'OPT-IMP-1',
|
|
51
|
+
arg: [(0, ansi_colors_1.bold)(name), ansi_colors_1.italic.red(projectModulePath), (0, ansi_colors_1.bold)(source)],
|
|
52
|
+
exit: 1
|
|
53
|
+
});
|
|
54
|
+
}
|
|
41
55
|
app_module_path_1.default.addPath(projectModulePath);
|
|
42
56
|
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
43
57
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
const projectModulePath = (0, project_js_1.resolveProjectPath)(name);
|
|
59
|
+
const projectModulePathExists = yield (0, async_js_1.dirExists)(projectModulePath);
|
|
60
|
+
if (!projectModulePathExists) {
|
|
61
|
+
throw new error_js_1.default('Module path does not exists', {
|
|
62
|
+
errorId: 'OPT-IMP-2',
|
|
63
|
+
arg: [(0, ansi_colors_1.bold)(name), ansi_colors_1.italic.red(projectModulePath), (0, ansi_colors_1.bold)(source)],
|
|
64
|
+
exit: 1
|
|
65
|
+
});
|
|
48
66
|
}
|
|
49
|
-
|
|
67
|
+
app_module_path_1.default.addPath(projectModulePath);
|
|
68
|
+
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
50
69
|
});
|
package/lib/plugin-loader.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -32,18 +36,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
36
|
};
|
|
33
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
38
|
const ansi_colors_1 = require("ansi-colors");
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
+
const error_js_1 = __importDefault(require("./error.js"));
|
|
40
|
+
const optional_import_js_1 = __importDefault(require("./optional-import.js"));
|
|
41
|
+
const runtime_store_js_1 = __importDefault(require("./runtime-store.js"));
|
|
42
|
+
const ClientConfig = __importStar(require("./util_modules/config/lib/client.js"));
|
|
43
|
+
const FunctionsConfig = __importStar(require("./util_modules/config/lib/functions.js"));
|
|
44
|
+
const config = {
|
|
45
|
+
client: {
|
|
46
|
+
plugin: ClientConfig.plugin,
|
|
47
|
+
source: ClientConfig.source
|
|
48
|
+
},
|
|
49
|
+
functions: {
|
|
50
|
+
plugin: FunctionsConfig.plugin,
|
|
51
|
+
source: FunctionsConfig.source
|
|
52
|
+
}
|
|
53
|
+
};
|
|
39
54
|
const loadedPlugins = {};
|
|
40
55
|
function pluginLoader(feature, name, source) {
|
|
41
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
57
|
+
const pluginConfig = config[feature];
|
|
58
|
+
if (pluginConfig === undefined) {
|
|
44
59
|
return;
|
|
45
60
|
}
|
|
46
|
-
const plugins =
|
|
61
|
+
const plugins = pluginConfig.plugin(name, source);
|
|
47
62
|
let specificPlugin;
|
|
48
63
|
if (typeof plugins === 'string') {
|
|
49
64
|
specificPlugin = plugins;
|
|
@@ -59,22 +74,22 @@ function pluginLoader(feature, name, source) {
|
|
|
59
74
|
pluginMod = loadedPlugins[specificPlugin];
|
|
60
75
|
}
|
|
61
76
|
else {
|
|
62
|
-
pluginMod = yield
|
|
77
|
+
pluginMod = yield (0, optional_import_js_1.default)(specificPlugin, pluginConfig.source());
|
|
63
78
|
}
|
|
64
79
|
if (pluginMod === undefined) {
|
|
65
|
-
throw new
|
|
80
|
+
throw new error_js_1.default(`Configured plugin could not be found for [${feature}:${name}] - ${specificPlugin}`, {
|
|
66
81
|
exit: 1,
|
|
67
82
|
errorId: 'PLG-LDR-1',
|
|
68
|
-
arg: [ansi_colors_1.italic.red(specificPlugin), ansi_colors_1.bold(name), ansi_colors_1.bold(feature)]
|
|
83
|
+
arg: [ansi_colors_1.italic.red(specificPlugin), (0, ansi_colors_1.bold)(name), (0, ansi_colors_1.bold)(feature)]
|
|
69
84
|
});
|
|
70
85
|
}
|
|
71
86
|
loadedPlugins[specificPlugin] = pluginMod;
|
|
72
87
|
if (typeof pluginMod === 'function') {
|
|
73
|
-
|
|
88
|
+
runtime_store_js_1.default.set(`context.${feature}.plugins.${name}${source ? '.' + source : ''}`, specificPlugin);
|
|
74
89
|
return pluginMod;
|
|
75
90
|
}
|
|
76
91
|
else if (typeof pluginMod[name] === 'function') {
|
|
77
|
-
|
|
92
|
+
runtime_store_js_1.default.set(`context.${feature}.plugins.${name}${source ? '.' + source : ''}`, specificPlugin);
|
|
78
93
|
return pluginMod[name];
|
|
79
94
|
}
|
|
80
95
|
return;
|
package/lib/port-resolver.js
CHANGED
|
@@ -27,7 +27,7 @@ class PortResolver {
|
|
|
27
27
|
if (searchSpan < 0) {
|
|
28
28
|
throw new Error('unable find port. searchSpan has reached the bottom line');
|
|
29
29
|
}
|
|
30
|
-
const port = yield portfinder_1.getPortPromise({
|
|
30
|
+
const port = yield (0, portfinder_1.getPortPromise)({
|
|
31
31
|
port: startPort,
|
|
32
32
|
stopPort: startPort + searchSpan
|
|
33
33
|
});
|
|
@@ -77,7 +77,7 @@ class PortResolver {
|
|
|
77
77
|
err.arg = [
|
|
78
78
|
ansi_colors_1.bold.red(port + ''),
|
|
79
79
|
type === 'debug' ? 'debugging' : 'serving',
|
|
80
|
-
ansi_colors_1.bold(feature),
|
|
80
|
+
(0, ansi_colors_1.bold)(feature),
|
|
81
81
|
name,
|
|
82
82
|
type
|
|
83
83
|
];
|
|
@@ -89,11 +89,11 @@ class PortResolver {
|
|
|
89
89
|
fileName: __filename
|
|
90
90
|
});
|
|
91
91
|
cerr.errorId = 'PORT-RESOLVER-2';
|
|
92
|
-
cerr.arg = [ansi_colors_1.bold(port + ''), ansi_colors_1.bold(port + searchSpan + ''), ansi_colors_1.bold('--' + type)];
|
|
92
|
+
cerr.arg = [(0, ansi_colors_1.bold)(port + ''), (0, ansi_colors_1.bold)(port + searchSpan + ''), (0, ansi_colors_1.bold)('--' + type)];
|
|
93
93
|
throw cerr;
|
|
94
94
|
}
|
|
95
95
|
if (finalPort !== port) {
|
|
96
|
-
logger_1.debug(`${type} port : '${port}' is not available. Hence port '${finalPort}' will be used instead.`);
|
|
96
|
+
(0, logger_1.debug)(`${type} port : '${port}' is not available. Hence port '${finalPort}' will be used instead.`);
|
|
97
97
|
}
|
|
98
98
|
return finalPort;
|
|
99
99
|
});
|
package/lib/progress.js
CHANGED
|
@@ -46,8 +46,8 @@ class Progress {
|
|
|
46
46
|
const [seconds, nanoSeconds] = process.hrtime(this.startTime);
|
|
47
47
|
const timeSinceStartInMs = seconds * 1000 + nanoSeconds / 1e6;
|
|
48
48
|
const averageTimePerCount = timeSinceStartInMs / this.currentProgress;
|
|
49
|
-
const estTimeLeftStr = pretty_ms_1.default(Math.round(averageTimePerCount * (this.total - this.currentProgress)));
|
|
50
|
-
prependedHeader = 'Est. time left: ' + `${ansi_colors_1.white(estTimeLeftStr)}`;
|
|
49
|
+
const estTimeLeftStr = (0, pretty_ms_1.default)(Math.round(averageTimePerCount * (this.total - this.currentProgress)));
|
|
50
|
+
prependedHeader = 'Est. time left: ' + `${(0, ansi_colors_1.white)(estTimeLeftStr)}`;
|
|
51
51
|
if (this.currentProgress >= this.total) {
|
|
52
52
|
if (this.throbber.hasActiveSpinners()) {
|
|
53
53
|
const [totalSec] = process.hrtime(this.startTime);
|
package/lib/prompt/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -63,7 +67,7 @@ exports.default = {
|
|
|
63
67
|
throw new error_1.default('No such type registered', { exit: 2 });
|
|
64
68
|
}
|
|
65
69
|
}),
|
|
66
|
-
|
|
70
|
+
separator: (line) => {
|
|
67
71
|
return new inquirer_1.default.Separator(line);
|
|
68
72
|
},
|
|
69
73
|
choice,
|
|
@@ -32,7 +32,7 @@ class InquirerFilePath extends inquirer_autocomplete_prompt_1.default {
|
|
|
32
32
|
const { rootPath = '.', exclude = [] } = question;
|
|
33
33
|
const questionBase = Object.assign({
|
|
34
34
|
emptyText: 'No valid file inside current directory!. Try giving the entire path and press ' +
|
|
35
|
-
ansi_colors_1.cyan('<return> ') +
|
|
35
|
+
(0, ansi_colors_1.cyan)('<return> ') +
|
|
36
36
|
'key'
|
|
37
37
|
}, question, {
|
|
38
38
|
source: (_, pattern) => getPaths(rootPath, pattern, exclude, question.default)
|