zcatalyst-cli 1.18.0-beta.0 → 1.18.0-beta.2
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/command_needs/rc.toml +8 -8
- package/docs/commands/event/generate/job.toml +7 -0
- package/docs/endpoints/lib/job-scheduling.toml +3 -0
- package/docs/internal/command.toml +5 -0
- package/lib/appsail-utils.js +4 -10
- package/lib/authentication/index.js +1 -0
- package/lib/bin/catalyst.js +1 -1
- package/lib/command_needs/rc.js +8 -8
- package/lib/commands/appsail/add.js +2 -1
- package/lib/commands/client/setup.js +2 -1
- package/lib/commands/codelib/install.js +5 -2
- package/lib/commands/event/generate/index.js +2 -1
- package/lib/commands/event/generate/integ.js +2 -1
- package/lib/commands/event/generate/job.js +82 -0
- package/lib/commands/functions/add.js +2 -1
- package/lib/commands/functions/delete.js +2 -4
- package/lib/commands/functions/setup.js +2 -1
- package/lib/commands/functions/shell.js +1 -0
- package/lib/commands/index.js +3 -1
- package/lib/commands/init.js +10 -7
- package/lib/commands/login.js +1 -0
- package/lib/commands/logout.js +1 -0
- package/lib/commands/pull.js +1 -0
- package/lib/commands/serve.js +1 -1
- package/lib/commands/whoami.js +1 -0
- package/lib/deploy/features/appsail/index.js +42 -25
- package/lib/deploy/features/appsail/utils.js +4 -5
- package/lib/endpoints/index.js +10 -3
- package/lib/endpoints/lib/appsail.js +7 -1
- package/lib/endpoints/lib/job-scheduling.js +61 -0
- package/lib/express_middlewares/logger.js +2 -4
- package/lib/fn-utils/lib/common.js +2 -3
- package/lib/fn-utils/lib/java.js +1 -1
- package/lib/fn-utils/lib/python.js +2 -2
- package/lib/fn-watcher.js +1 -1
- package/lib/init/dependencies/python/ensure-python.js +6 -8
- package/lib/init/features/appsail/index.js +36 -26
- package/lib/init/features/client/index.js +2 -1
- package/lib/init/features/functions/index.js +4 -0
- package/lib/init/features/functions/languages/python.js +21 -5
- package/lib/init/features/project.js +5 -15
- package/lib/internal/api.js +25 -6
- package/lib/internal/command.js +30 -6
- package/lib/migration/index.js +4 -2
- package/lib/optional-import.js +3 -2
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/prompt/types/tree.js +3 -3
- package/lib/serve/features/appsail.js +2 -3
- package/lib/serve/index.js +1 -2
- package/lib/serve/server/index.js +8 -9
- package/lib/serve/server/lib/appsail/index.js +29 -35
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-cli-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/aio_server/lib/catalyst-java-runtime-1.0.0.jar +0 -0
- package/lib/serve/server/lib/java/index.js +2 -2
- package/lib/serve/server/lib/master/appsail.js +53 -0
- package/lib/serve/server/lib/master/functions.js +34 -0
- package/lib/serve/server/lib/master/index.js +155 -0
- package/lib/{express_middlewares/unknownReqProxy.js → serve/server/lib/master/unknown-req-proxy.js} +4 -7
- package/lib/serve/server/lib/master/utils.js +130 -0
- package/lib/serve/server/lib/master/web-client.js +39 -0
- package/lib/serve/server/lib/node/index.js +3 -3
- package/lib/serve/server/lib/python/index.js +3 -3
- package/lib/shell/dependencies/invoker/bio/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/cron/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +2 -1
- package/lib/shell/dependencies/invoker/event/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/event/node.mjs +1 -0
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +14 -0
- package/lib/shell/dependencies/invoker/integ/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/integ/node.mjs +13 -0
- package/lib/shell/dependencies/invoker/job/java/JavajobInvoker.java +268 -0
- package/lib/shell/dependencies/invoker/job/java/lib/catalyst-function-sdk-1.0.0.jar +0 -0
- package/lib/shell/dependencies/invoker/job/java/lib/org.json.jar +0 -0
- package/lib/shell/dependencies/invoker/job/node.mjs +93 -0
- package/lib/shell/dependencies/local-function.js +121 -13
- package/lib/shell/index.js +7 -1
- package/lib/shell/prepare/languages/index.js +4 -4
- package/lib/shell/prepare/languages/java.js +1 -2
- package/lib/shell/prepare/languages/python.js +10 -16
- package/lib/throbber/index.js +6 -1
- package/lib/userConfig.js +7 -1
- package/lib/util_modules/config/index.js +1 -1
- package/lib/util_modules/config/lib/{appSail.js → appsail.js} +60 -10
- package/lib/util_modules/config/lib/client.js +6 -8
- package/lib/util_modules/config/lib/functions.js +6 -8
- package/lib/util_modules/constants/lib/default.js +9 -9
- package/lib/util_modules/constants/lib/fn-type.js +2 -1
- package/lib/util_modules/constants/lib/needed-scopes.js +53 -44
- package/lib/util_modules/constants/lib/placeholders.js +6 -0
- package/lib/util_modules/constants/lib/ref-mapping.js +2 -1
- package/lib/util_modules/constants/lib/remote-mapping.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +5 -1
- package/lib/util_modules/constants/lib/template.js +9 -4
- package/lib/util_modules/constants/lib/urls.js +8 -0
- package/lib/util_modules/fs/lib/async.js +14 -4
- package/lib/util_modules/fs/lib/sync.js +12 -1
- package/lib/util_modules/server.js +2 -4
- package/lib/winston.js +17 -11
- package/package.json +1 -1
- package/templates/event/job.json +30 -0
- package/templates/init/functions/java/job/.classpath +6 -0
- package/templates/init/functions/java/job/.project +17 -0
- package/templates/init/functions/java/job/catalyst-config.json +11 -0
- package/templates/init/functions/java/job/sample.java +34 -0
- package/templates/init/functions/node/aio/package.json +1 -1
- package/templates/init/functions/node/aio/sample.js +7 -0
- package/templates/init/functions/node/bio/package.json +1 -1
- package/templates/init/functions/node/bio/sample.js +5 -0
- package/templates/init/functions/node/bio/types/basicio.d.ts +57 -0
- package/templates/init/functions/node/cron/package.json +1 -1
- package/templates/init/functions/node/cron/sample.js +5 -0
- package/templates/init/functions/node/cron/types/cron.d.ts +64 -0
- package/templates/init/functions/node/event/package.json +1 -1
- package/templates/init/functions/node/event/sample.js +11 -8
- package/templates/init/functions/node/event/types/event.d.ts +82 -0
- package/templates/init/functions/node/integ/cliq/package.json +1 -1
- package/templates/init/functions/node/integ/convokraft/package.json +1 -1
- package/templates/init/functions/node/{stream → job}/catalyst-config.json +3 -2
- package/templates/init/functions/node/{stream → job}/package.json +1 -1
- package/templates/init/functions/node/job/sample.js +27 -0
- package/templates/init/functions/node/job/types/job.d.ts +62 -0
- package/templates/init/functions/python/job/catalyst-config.json +11 -0
- package/templates/init/functions/python/job/requirements.txt +1 -0
- package/templates/init/functions/python/job/sample.py +22 -0
- package/templates/init.txt +13 -0
- package/lib/serve/server/lib/master.js +0 -326
- package/templates/init/functions/node/stream/sample.js +0 -15
|
@@ -31,6 +31,7 @@ const option_1 = require("../../../util_modules/option");
|
|
|
31
31
|
const project_1 = require("../../../util_modules/project");
|
|
32
32
|
const utils_1 = require("./utils");
|
|
33
33
|
const throbber_1 = __importDefault(require("../../../throbber"));
|
|
34
|
+
const minimatch_1 = __importDefault(require("minimatch"));
|
|
34
35
|
function executeHook(script, name, moduleSource) {
|
|
35
36
|
if ((0, option_1.getOptionValue)('ignoreScripts', false)) {
|
|
36
37
|
(0, logger_1.debug)(`skipping ${name} hook`);
|
|
@@ -57,7 +58,7 @@ function getConfigJsonInputs() {
|
|
|
57
58
|
when: () => optValues.build_path === false,
|
|
58
59
|
rootPath: cwd,
|
|
59
60
|
validate: ({ value }) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const pathRes = (0, utils_1.validateBuildPath)(value);
|
|
61
|
+
const pathRes = yield (0, utils_1.validateBuildPath)(value);
|
|
61
62
|
if (!pathRes) {
|
|
62
63
|
return `Invalid path: ${value}`;
|
|
63
64
|
}
|
|
@@ -142,7 +143,9 @@ function getStandAloneTarget() {
|
|
|
142
143
|
configJson.stack = configJson.stack.runtime;
|
|
143
144
|
}
|
|
144
145
|
return {
|
|
145
|
-
|
|
146
|
+
name: nameOpt === false ? appSailName.name : nameOpt,
|
|
147
|
+
source: cwd,
|
|
148
|
+
config: configJson,
|
|
146
149
|
validity: { valid: true }
|
|
147
150
|
};
|
|
148
151
|
});
|
|
@@ -157,15 +160,15 @@ exports.default = (standAlone = false) => __awaiter(void 0, void 0, void 0, func
|
|
|
157
160
|
const filtered = (0, appsail_utils_1.filterTargets)(targets);
|
|
158
161
|
let pythonPrompt = false;
|
|
159
162
|
const validTargets = (0, appsail_utils_1.validateAppSail)(filtered).filter((targ) => {
|
|
160
|
-
var _a
|
|
163
|
+
var _a;
|
|
161
164
|
if (targ.validity.valid) {
|
|
162
165
|
if (!pythonPrompt &&
|
|
163
|
-
((_a = targ.
|
|
166
|
+
((_a = targ.config) === null || _a === void 0 ? void 0 : _a.stack.startsWith(constants_1.RUNTIME.language.python.value))) {
|
|
164
167
|
pythonPrompt = true;
|
|
165
168
|
}
|
|
166
169
|
return targ;
|
|
167
170
|
}
|
|
168
|
-
(0, logger_1.labeled)('AppSail: ', 'Invalid AppSail service ' + (0, ansi_colors_1.bold)(
|
|
171
|
+
(0, logger_1.labeled)('AppSail: ', 'Invalid AppSail service ' + (0, ansi_colors_1.bold)(targ.name || 'Unknown')).ERROR();
|
|
169
172
|
(0, logger_1.error)('Reason: ' + targ.validity.reason);
|
|
170
173
|
(0, logger_1.info)();
|
|
171
174
|
return false;
|
|
@@ -179,32 +182,44 @@ exports.default = (standAlone = false) => __awaiter(void 0, void 0, void 0, func
|
|
|
179
182
|
const throbber = throbber_1.default.getInstance();
|
|
180
183
|
const deployRes = yield validTargets.reduce((result, _targ) => __awaiter(void 0, void 0, void 0, function* () {
|
|
181
184
|
var _a, _b;
|
|
182
|
-
const targ = _targ.
|
|
185
|
+
const targ = _targ.config;
|
|
183
186
|
const prevRes = yield result;
|
|
187
|
+
const throbberName = `prepare_appsail_${_targ.name}`;
|
|
184
188
|
try {
|
|
185
189
|
if ((_a = targ.scripts) === null || _a === void 0 ? void 0 : _a.predeploy) {
|
|
186
|
-
executeHook(targ.scripts.predeploy, 'predeploy',
|
|
190
|
+
executeHook(targ.scripts.predeploy, 'predeploy', _targ.source);
|
|
187
191
|
}
|
|
188
|
-
const throbberName = `prepare_appsail_${targ.name}`;
|
|
189
192
|
throbber.add(throbberName, {
|
|
190
|
-
text: `Preparing AppSail[${
|
|
193
|
+
text: `Preparing AppSail[${_targ.name}]`
|
|
191
194
|
});
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
const folderPath = targ.build_path;
|
|
196
|
+
const isBuildPath = yield fs_1.ASYNC.isPathExists(folderPath);
|
|
197
|
+
if (!isBuildPath) {
|
|
198
|
+
throw new error_1.default(`the build path doesn't exists: ${folderPath}`, {
|
|
199
|
+
exit: 1,
|
|
200
|
+
skipHelp: true
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
const ignoreFile = yield fs_1.ASYNC.readFile((0, path_1.join)(_targ.source, constants_1.FILENAME.catalyst_ignore));
|
|
204
|
+
const excludePatterns = [
|
|
205
|
+
'**/.DS_Store',
|
|
206
|
+
'**/.vscode/**/*',
|
|
207
|
+
`**/${constants_1.FILENAME.log}`,
|
|
208
|
+
`**/${constants_1.FILENAME.config}`,
|
|
209
|
+
`**/${constants_1.FILENAME.rc}`,
|
|
210
|
+
`**/${constants_1.FILENAME.app_config}`,
|
|
211
|
+
`**/${constants_1.FILENAME.catalyst_ignore}`,
|
|
212
|
+
...((ignoreFile === null || ignoreFile === void 0 ? void 0 : ignoreFile.split('\n')) || [])
|
|
213
|
+
];
|
|
196
214
|
const folderContents = yield fs_1.ASYNC.walk(folderPath, {
|
|
197
215
|
filter: {
|
|
198
|
-
exclude:
|
|
199
|
-
'
|
|
200
|
-
|
|
201
|
-
`**/${constants_1.FILENAME.app_config}`,
|
|
202
|
-
`**/${constants_1.FILENAME.catalyst_ignore}`,
|
|
203
|
-
...((ignoreFile === null || ignoreFile === void 0 ? void 0 : ignoreFile.split('\n')) || [])
|
|
204
|
-
],
|
|
216
|
+
exclude: (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
217
|
+
return !!excludePatterns.find((glob) => (0, minimatch_1.default)(path.replace(folderPath + path_1.sep, ''), glob, { dot: true }));
|
|
218
|
+
}),
|
|
205
219
|
excludeDir: true
|
|
206
220
|
}
|
|
207
221
|
});
|
|
222
|
+
const zip = new archiver_1.default();
|
|
208
223
|
folderContents.forEach((content) => {
|
|
209
224
|
zip.add(content.path === folderPath
|
|
210
225
|
? (0, path_1.basename)(content.path)
|
|
@@ -215,22 +230,25 @@ exports.default = (standAlone = false) => __awaiter(void 0, void 0, void 0, func
|
|
|
215
230
|
const finalized = yield zip.finalize();
|
|
216
231
|
const zipStream = yield finalized.fsStream();
|
|
217
232
|
throbber.remove(throbberName);
|
|
218
|
-
const { stack,
|
|
233
|
+
const { stack, command, memory, platform, env_variables, catalyst_auth, login_redirect } = targ;
|
|
219
234
|
const apiRes = yield sailAPI.deploy(zipStream.stream, {
|
|
220
235
|
stack,
|
|
221
|
-
name,
|
|
236
|
+
name: _targ.name,
|
|
222
237
|
memory,
|
|
223
238
|
platform,
|
|
224
239
|
command,
|
|
240
|
+
catalystAuth: catalyst_auth,
|
|
241
|
+
loginRedirect: login_redirect,
|
|
225
242
|
envVariables: env_variables,
|
|
226
243
|
contentLength: zipStream.length
|
|
227
244
|
});
|
|
228
245
|
_targ.url = apiRes.url;
|
|
229
246
|
if ((_b = targ.scripts) === null || _b === void 0 ? void 0 : _b.postdeploy) {
|
|
230
|
-
executeHook(targ.scripts.postdeploy, 'postdeploy',
|
|
247
|
+
executeHook(targ.scripts.postdeploy, 'postdeploy', _targ.source);
|
|
231
248
|
}
|
|
232
249
|
}
|
|
233
250
|
catch (err) {
|
|
251
|
+
throbber.remove(throbberName);
|
|
234
252
|
(0, logger_1.debug)(err);
|
|
235
253
|
_targ.validity = {
|
|
236
254
|
valid: false,
|
|
@@ -241,10 +259,9 @@ exports.default = (standAlone = false) => __awaiter(void 0, void 0, void 0, func
|
|
|
241
259
|
return Promise.resolve(prevRes);
|
|
242
260
|
}), Promise.resolve([]));
|
|
243
261
|
const deployedValidTargets = deployRes.filter((targ) => {
|
|
244
|
-
var _a;
|
|
245
262
|
if (!targ.validity.valid) {
|
|
246
263
|
(0, logger_1.warning)('Deploy of AppSail [' +
|
|
247
|
-
|
|
264
|
+
targ.name +
|
|
248
265
|
'] was unsuccessful since ' +
|
|
249
266
|
targ.validity.reason);
|
|
250
267
|
}
|
|
@@ -36,10 +36,10 @@ function validateOptions(validationFn, option, ...args) {
|
|
|
36
36
|
exports.validateOptions = validateOptions;
|
|
37
37
|
function validateBuildPath(path) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const cwd =
|
|
39
|
+
const cwd = runtime_store_1.default.get('cwd');
|
|
40
40
|
if (path) {
|
|
41
41
|
const buildPath = (0, path_1.isAbsolute)(path) ? path : (0, path_1.resolve)(cwd, path);
|
|
42
|
-
return (yield fs_1.ASYNC.
|
|
42
|
+
return (yield fs_1.ASYNC.isPathExists(buildPath)) ? path : false;
|
|
43
43
|
}
|
|
44
44
|
return false;
|
|
45
45
|
});
|
|
@@ -79,11 +79,10 @@ exports.validateName = validateName;
|
|
|
79
79
|
function urlLogger() {
|
|
80
80
|
const deployTargets = runtime_store_1.default.get('payload.appsail.targets', []);
|
|
81
81
|
deployTargets.forEach((sail) => {
|
|
82
|
-
var _a, _b;
|
|
83
82
|
if (sail.url !== undefined) {
|
|
84
|
-
(0, logger_1.labeled)(`AppSail(${
|
|
83
|
+
(0, logger_1.labeled)(`AppSail(${sail.name})`, 'URL => ' + sail.url).MESSAGE();
|
|
85
84
|
}
|
|
86
|
-
(0, logger_1.labeled)(`AppSail(${
|
|
85
|
+
(0, logger_1.labeled)(`AppSail(${sail.name})`, 'deploy successful').SUCCESS();
|
|
87
86
|
(0, logger_1.info)();
|
|
88
87
|
});
|
|
89
88
|
return deployTargets;
|
package/lib/endpoints/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.tunnelAPI = exports.commonAPI = exports.codeDeck = exports.gitHubAPI = exports.appSailAPI = exports.logAPI = exports.eventBusAPI = exports.functionsAPI = exports.applogicAPI = exports.bulkDSAPI = exports.apigAPI = exports.clientAPI = exports.datastoreAPI = exports.zcqlAPI = exports.queueAPI = exports.filestoreAPI = exports.cacheAPI = exports.sdkAPI = exports.envAPI = exports.projectAPI = exports.orgAPI = void 0;
|
|
35
|
+
exports.tunnelAPI = exports.commonAPI = exports.jobScheduling = exports.codeDeck = exports.gitHubAPI = exports.appSailAPI = exports.logAPI = exports.eventBusAPI = exports.functionsAPI = exports.applogicAPI = exports.bulkDSAPI = exports.apigAPI = exports.clientAPI = exports.datastoreAPI = exports.zcqlAPI = exports.queueAPI = exports.filestoreAPI = exports.cacheAPI = exports.sdkAPI = exports.envAPI = exports.projectAPI = exports.orgAPI = void 0;
|
|
36
36
|
const project_1 = require("../util_modules/project");
|
|
37
37
|
function orgAPI({ auth = true } = {}) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41,10 +41,10 @@ function orgAPI({ auth = true } = {}) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
exports.orgAPI = orgAPI;
|
|
44
|
-
function projectAPI({ auth = true, org = (0, project_1.getEnvId)() } = {}) {
|
|
44
|
+
function projectAPI({ auth = true, org = (0, project_1.getEnvId)(), printError = true } = {}) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
const project = (yield Promise.resolve().then(() => __importStar(require('./lib/project')))).default;
|
|
47
|
-
return new project({ authNeeded: auth }, org);
|
|
47
|
+
return new project({ authNeeded: auth, printError }, org);
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
exports.projectAPI = projectAPI;
|
|
@@ -170,6 +170,13 @@ function codeDeck() {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
exports.codeDeck = codeDeck;
|
|
173
|
+
function jobScheduling({ auth = true, projectId = (0, project_1.getProjectId)() } = {}) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const jobScheduling = (yield Promise.resolve().then(() => __importStar(require('./lib/job-scheduling')))).default;
|
|
176
|
+
return new jobScheduling(projectId, { authNeeded: auth });
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
exports.jobScheduling = jobScheduling;
|
|
173
180
|
function commonAPI() {
|
|
174
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
182
|
const common = (yield Promise.resolve().then(() => __importStar(require('./lib/common')))).default;
|
|
@@ -21,7 +21,7 @@ class AppSail {
|
|
|
21
21
|
this.opts = opts;
|
|
22
22
|
this.projectId = projectId;
|
|
23
23
|
}
|
|
24
|
-
deploy(sourceFsStream, { stack, name, contentLength, command, memory, platform, envVariables = {} }) {
|
|
24
|
+
deploy(sourceFsStream, { stack, name, contentLength, command, memory, platform, envVariables = {}, catalystAuth, loginRedirect }) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
const formData = {
|
|
27
27
|
stack,
|
|
@@ -43,6 +43,12 @@ class AppSail {
|
|
|
43
43
|
variables: envVariables
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
if (typeof catalystAuth === 'boolean') {
|
|
47
|
+
configuration.catalyst_auth = catalystAuth;
|
|
48
|
+
if (typeof loginRedirect === 'string') {
|
|
49
|
+
configuration.login_redirect = loginRedirect;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
46
52
|
if (Object.keys(configuration).length > 0) {
|
|
47
53
|
formData.configuration = JSON.stringify(configuration);
|
|
48
54
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
16
|
+
const error_1 = __importDefault(require("../../error"));
|
|
17
|
+
const api_1 = __importDefault(require("../../internal/api"));
|
|
18
|
+
const logger_1 = require("../../util_modules/logger");
|
|
19
|
+
class JobScheduling {
|
|
20
|
+
constructor(projectId, opts) {
|
|
21
|
+
this.opts = opts;
|
|
22
|
+
this.projectId = projectId;
|
|
23
|
+
}
|
|
24
|
+
getJobpoolDetails(id) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const res = yield new api_1.default(this.opts).get(`/baas/v1/project/${this.projectId}/job_scheduling/jobpool${id ? '/' + id : ''}`, {
|
|
27
|
+
resolveOnError: true
|
|
28
|
+
});
|
|
29
|
+
if (res.status === 200) {
|
|
30
|
+
if (res.body && res.body.data) {
|
|
31
|
+
return res.body.data;
|
|
32
|
+
}
|
|
33
|
+
(0, logger_1.debug)(`get jobpool details response from server for (${id}): ${res.body}`);
|
|
34
|
+
throw new error_1.default('Server Error: Unexpected Response from server.', {
|
|
35
|
+
exit: 2
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (res.status === 404 && id) {
|
|
39
|
+
const allJobpools = yield this.getJobpoolDetails();
|
|
40
|
+
throw new error_1.default(`The provided jobpool identifier (${id}) is invalid`, {
|
|
41
|
+
exit: 1,
|
|
42
|
+
context: res.body,
|
|
43
|
+
status: res.status,
|
|
44
|
+
errorId: 'JOB-SCHEDULING-1',
|
|
45
|
+
arg: [
|
|
46
|
+
(0, ansi_colors_1.bold)(id),
|
|
47
|
+
(0, ansi_colors_1.bold)(allJobpools
|
|
48
|
+
.map((pool) => `${(0, ansi_colors_1.green)('*')} ${pool.name} [${pool.id}]`)
|
|
49
|
+
.join('\n'))
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
throw new error_1.default('Error when feting details of the jobpool: ' + id, {
|
|
54
|
+
exit: 2,
|
|
55
|
+
context: res.body,
|
|
56
|
+
status: res.status
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.default = JobScheduling;
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ansi_colors_1 = require("ansi-colors");
|
|
4
4
|
exports.default = (appSailDetails) => (req, _RES, next) => {
|
|
5
|
-
var _a
|
|
5
|
+
var _a;
|
|
6
6
|
console.log('[' +
|
|
7
7
|
new Date().getTime() +
|
|
8
8
|
'] ' +
|
|
9
|
-
(appSailDetails
|
|
10
|
-
? (0, ansi_colors_1.cyan)(` Appsail[${(_b = (_a = appSailDetails === null || appSailDetails === void 0 ? void 0 : appSailDetails.target) === null || _a === void 0 ? void 0 : _a.appSail) === null || _b === void 0 ? void 0 : _b.name}] `)
|
|
11
|
-
: '') +
|
|
9
|
+
(appSailDetails ? (0, ansi_colors_1.cyan)(` Appsail[${(_a = appSailDetails === null || appSailDetails === void 0 ? void 0 : appSailDetails.target) === null || _a === void 0 ? void 0 : _a.name}] `) : '') +
|
|
12
10
|
' "' +
|
|
13
11
|
(0, ansi_colors_1.cyan)(req.method) +
|
|
14
12
|
'" ' +
|
|
@@ -32,7 +32,6 @@ const js_1 = require("../../util_modules/js");
|
|
|
32
32
|
const logger_1 = require("../../util_modules/logger");
|
|
33
33
|
const option_1 = require("../../util_modules/option");
|
|
34
34
|
const project_1 = require("../../util_modules/project");
|
|
35
|
-
const fs_2 = require("fs");
|
|
36
35
|
const os_1 = require("os");
|
|
37
36
|
const pip_install_1 = require("../../init/dependencies/python/pip-install");
|
|
38
37
|
function validate() {
|
|
@@ -318,7 +317,7 @@ function pack(target) {
|
|
|
318
317
|
const tmpDir = (0, path_1.join)((0, os_1.tmpdir)(), '.catalyst', 'python', target.name + Date.now().toString());
|
|
319
318
|
yield fs_1.ASYNC.ensureDir(tmpDir);
|
|
320
319
|
yield fs_1.ASYNC.emptyDir(tmpDir);
|
|
321
|
-
yield (0, pip_install_1.installRequirements)(reqFile, tmpDir, target.stack.replace('python_', ''),
|
|
320
|
+
yield (0, pip_install_1.installRequirements)(reqFile, tmpDir, target.stack.replace('python_', ''), (0, os_1.platform)() === 'linux');
|
|
322
321
|
const files = yield fs_1.ASYNC.walk(tmpDir);
|
|
323
322
|
files.forEach((file) => {
|
|
324
323
|
zip.add(file.path.replace(tmpDir + path_1.sep, ''), file.stats.isSymbolicLink()
|
|
@@ -578,7 +577,7 @@ function copyModDirPerm(src, dest, perm, { replace = true } = {}) {
|
|
|
578
577
|
return res();
|
|
579
578
|
}
|
|
580
579
|
const destFile = (0, path_1.join)(dest, (0, path_1.basename)(content.path));
|
|
581
|
-
yield fs_1.ASYNC.copyFile(content.path, destFile, replace
|
|
580
|
+
yield fs_1.ASYNC.copyFile(content.path, destFile, replace).catch((err) => {
|
|
582
581
|
if (!replace && err.code === 'EEXIST') {
|
|
583
582
|
return;
|
|
584
583
|
}
|
package/lib/fn-utils/lib/java.js
CHANGED
|
@@ -287,7 +287,7 @@ function compileJavaFiles(file, spawnCommand, targetVersion, targetSource, outpu
|
|
|
287
287
|
'*' + module.exports.classPathSep + '.',
|
|
288
288
|
'-g',
|
|
289
289
|
'-Xprefer:source',
|
|
290
|
-
'-Xlint',
|
|
290
|
+
userConfig_1.default.get('javac.disable_warnings') === 'true' ? '-Xlint:none' : '-Xlint',
|
|
291
291
|
file.replace(targetSource, outputFolder)
|
|
292
292
|
], {
|
|
293
293
|
cwd: outputFolder,
|
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.removeRequirements = exports.validate = void 0;
|
|
39
39
|
const ansi_colors_1 = require("ansi-colors");
|
|
40
|
-
const os_1 = require("os");
|
|
40
|
+
const os_1 = __importStar(require("os"));
|
|
41
41
|
const path_1 = __importStar(require("path"));
|
|
42
42
|
const error_1 = __importDefault(require("../../error"));
|
|
43
43
|
const ensure_python_1 = require("../../init/dependencies/python/ensure-python");
|
|
@@ -111,7 +111,7 @@ function removeRequirements(reqFile, target) {
|
|
|
111
111
|
const tmpDir = (0, path_1.join)((0, os_1.tmpdir)(), '.catalyst', 'python', Date.now().toString());
|
|
112
112
|
yield fs_1.ASYNC.ensureDir(tmpDir);
|
|
113
113
|
yield fs_1.ASYNC.emptyDir(tmpDir);
|
|
114
|
-
yield (0, pip_install_1.installRequirements)(reqFile, tmpDir, (_a = target.stack) === null || _a === void 0 ? void 0 : _a.replace('python_', ''),
|
|
114
|
+
yield (0, pip_install_1.installRequirements)(reqFile, tmpDir, (_a = target.stack) === null || _a === void 0 ? void 0 : _a.replace('python_', ''), os_1.default.platform() === 'linux');
|
|
115
115
|
const files = yield fs_1.ASYNC.walk(tmpDir, { depth: 1, includeDirPaths: true });
|
|
116
116
|
yield Promise.all(files.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
yield fs_1.ASYNC.deleteFile((0, path_1.join)(target.source, path_1.default.basename(file.path)));
|
package/lib/fn-watcher.js
CHANGED
|
@@ -35,7 +35,7 @@ exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
35
35
|
target.valid = true;
|
|
36
36
|
target.compilationError = undefined;
|
|
37
37
|
target.compilationWarning = undefined;
|
|
38
|
-
yield (0, languages_1.prepareFunctions)([target]
|
|
38
|
+
yield (0, languages_1.prepareFunctions)([target]);
|
|
39
39
|
if (currentLatestEvent.at === latestEvent.at) {
|
|
40
40
|
latestEvent = undefined;
|
|
41
41
|
}
|
|
@@ -99,14 +99,12 @@ function validateCommand(version, spawnCommand, skipHelp) {
|
|
|
99
99
|
const data = Buffer.concat(dataBuf).toString();
|
|
100
100
|
return resolve(data);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
102
|
+
reject(new error_1.default(`unable to locate python${version} with the given binary path`, {
|
|
103
|
+
exit: 1,
|
|
104
|
+
errorId: 'PY-1',
|
|
105
|
+
arg: [version, (0, ansi_colors_1.bold)(spawnCommand)],
|
|
106
|
+
skipHelp
|
|
107
|
+
}));
|
|
110
108
|
});
|
|
111
109
|
child.on('error', (err) => {
|
|
112
110
|
reject(new error_1.default(`unable to locate python${version} with the given binary path`, {
|
|
@@ -36,7 +36,7 @@ function getAppSailZip() {
|
|
|
36
36
|
api: _gitHubAPI.appsailNodejs.bind(_gitHubAPI),
|
|
37
37
|
command: 'node index.js',
|
|
38
38
|
source: (0, project_1.resolveProjectPath)('appsail-nodejs'),
|
|
39
|
-
build:
|
|
39
|
+
build: './',
|
|
40
40
|
stack: {
|
|
41
41
|
runtime: 'node16',
|
|
42
42
|
lang: 'node'
|
|
@@ -54,7 +54,7 @@ function getAppSailZip() {
|
|
|
54
54
|
api: _gitHubAPI.appsailJava.bind(_gitHubAPI),
|
|
55
55
|
command: 'java -jar demo-0.0.1-SNAPSHOT.jar',
|
|
56
56
|
source: (0, project_1.resolveProjectPath)('appsail-java'),
|
|
57
|
-
build: (0,
|
|
57
|
+
build: (0, path_1.join)('target', 'demo-0.0.1-SNAPSHOT.jar'),
|
|
58
58
|
stack: {
|
|
59
59
|
runtime: 'java8',
|
|
60
60
|
lang: 'java'
|
|
@@ -73,7 +73,7 @@ function getAppSailZip() {
|
|
|
73
73
|
api: _gitHubAPI.appsailPython.bind(_gitHubAPI),
|
|
74
74
|
command: 'python3 app.py',
|
|
75
75
|
source: (0, project_1.resolveProjectPath)('appsail-python'),
|
|
76
|
-
build:
|
|
76
|
+
build: './',
|
|
77
77
|
stack: {
|
|
78
78
|
runtime: 'python_3_9',
|
|
79
79
|
lang: 'python'
|
|
@@ -141,22 +141,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
141
141
|
})
|
|
142
142
|
}))).source
|
|
143
143
|
};
|
|
144
|
-
const appConfigPth = (0, path_1.join)(_appSailConfig.source, constants_1.FILENAME.app_config);
|
|
145
|
-
const isAppConfig = yield fs_1.ASYNC.fileExists(appConfigPth);
|
|
146
144
|
const existingSails = config_1.appSailConfig.raw() || [];
|
|
147
|
-
yield prompt_1.default.
|
|
148
|
-
const appSail = yield prompt_1.default.ask(prompt_1.default.question('buildPath', 'Please provide the build path of your AppSail service: ', {
|
|
149
|
-
type: 'file-path',
|
|
150
|
-
validate: (pth) => __awaiter(void 0, void 0, void 0, function* () {
|
|
151
|
-
const buildPath = (0, path_1.resolve)(process.cwd(), pth.value);
|
|
152
|
-
if ((yield fs_1.ASYNC.dirExists(buildPath)) || (yield fs_1.ASYNC.fileExists(buildPath))) {
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
return 'Path does not exists';
|
|
156
|
-
}),
|
|
157
|
-
when: !_appSailConfig.build,
|
|
158
|
-
rootPath: _appSailConfig.source
|
|
159
|
-
}), prompt_1.default.question('name', 'Please provide the name for your AppSail service: ', {
|
|
145
|
+
const appName = yield prompt_1.default.ask(prompt_1.default.question('name', 'Please provide the name for your AppSail: ', {
|
|
160
146
|
type: 'input',
|
|
161
147
|
default: 'AppSail',
|
|
162
148
|
validate: (name) => {
|
|
@@ -165,7 +151,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
165
151
|
: true;
|
|
166
152
|
const match = name.match(constants_1.REGEX.functions.package.name)
|
|
167
153
|
? true
|
|
168
|
-
: `Invalid
|
|
154
|
+
: `Invalid AppSail name. It should be in the following format: ${constants_1.REGEX.functions.package.name}`;
|
|
169
155
|
return typeof exists === 'string'
|
|
170
156
|
? exists
|
|
171
157
|
: typeof match === 'string'
|
|
@@ -173,16 +159,40 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
173
159
|
: true;
|
|
174
160
|
}
|
|
175
161
|
}));
|
|
176
|
-
const appSailStack = _appSailConfig.stack ||
|
|
177
|
-
(yield (0, common_1.getRuntimePromptAnswer)('Please choose a stack for your AppSail: '));
|
|
178
162
|
const payload = {
|
|
179
|
-
source: _appSailConfig.source,
|
|
180
|
-
name:
|
|
163
|
+
source: (0, path_1.relative)((0, project_1.getProjectRoot)(), _appSailConfig.source) || '.',
|
|
164
|
+
name: appName.name
|
|
181
165
|
};
|
|
166
|
+
const appConfigPth = (0, path_1.join)(_appSailConfig.source, constants_1.FILENAME.app_config);
|
|
167
|
+
const isAppConfig = yield fs_1.ASYNC.fileExists(appConfigPth);
|
|
168
|
+
if (isAppConfig) {
|
|
169
|
+
(0, logger_1.info)();
|
|
170
|
+
(0, logger_1.warning)(`The ${(0, ansi_colors_1.bold)(constants_1.FILENAME.app_config)} file is already present in the appsail directory`);
|
|
171
|
+
}
|
|
172
|
+
const overWrite = yield prompt_1.default.ask(prompt_1.default.question('appConfig', 'Do you wish to overwrite the ' + constants_1.FILENAME.app_config, {
|
|
173
|
+
type: 'confirm',
|
|
174
|
+
default: false,
|
|
175
|
+
when: isAppConfig
|
|
176
|
+
}));
|
|
177
|
+
const activeWrite = overWrite.appConfig !== false;
|
|
178
|
+
if (!activeWrite) {
|
|
179
|
+
runtime_store_1.default.set('payload.appsail.targets', [payload]);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const buildPath = yield prompt_1.default.ask(prompt_1.default.question('path', 'Please provide the build path of your AppSail service: ', {
|
|
183
|
+
type: 'input',
|
|
184
|
+
rootPath: _appSailConfig.source,
|
|
185
|
+
when: !_appSailConfig.build && activeWrite
|
|
186
|
+
}));
|
|
187
|
+
const appSailStack = _appSailConfig.stack ||
|
|
188
|
+
(yield (0, common_1.getRuntimePromptAnswer)('Please choose a stack for your AppSail: '));
|
|
182
189
|
const appConfig = {
|
|
183
190
|
command: _appSailConfig.command ||
|
|
184
|
-
'echo Please specify the start-up command in the app-config.json file under the key command',
|
|
185
|
-
build_path: _appSailConfig.build ||
|
|
191
|
+
'echo Please specify the start-up command in the app-config.json file under the key command for AppSail $X_ZC_RESOURCE_NAME',
|
|
192
|
+
build_path: _appSailConfig.build ||
|
|
193
|
+
((0, path_1.isAbsolute)(buildPath.path)
|
|
194
|
+
? (0, path_1.relative)(_appSailConfig.source, buildPath.path) || '.'
|
|
195
|
+
: buildPath.path),
|
|
186
196
|
stack: appSailStack.runtime,
|
|
187
197
|
env_variables: {},
|
|
188
198
|
memory: _appSailConfig.memory || 256,
|
|
@@ -209,5 +219,5 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
209
219
|
}
|
|
210
220
|
}
|
|
211
221
|
runtime_store_1.default.set('payload.appsail.targets', [payload]);
|
|
212
|
-
|
|
222
|
+
activeWrite && (yield fs_1.ASYNC.writeJSONFile(appConfigPth, appConfig));
|
|
213
223
|
});
|
|
@@ -38,6 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
38
|
const index_js_1 = __importDefault(require("../../../prompt/index.js"));
|
|
39
39
|
const index_js_2 = require("../../../util_modules/constants/index.js");
|
|
40
40
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
41
42
|
const clientInitAnswer = yield index_js_1.default.ask(index_js_1.default.question('clientFlavour', 'Choose the type of client to initialise: ', {
|
|
42
43
|
type: 'list',
|
|
43
44
|
choices: index_js_2.PLUGIN.client.map((plugin) => {
|
|
@@ -47,5 +48,5 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
47
48
|
});
|
|
48
49
|
})
|
|
49
50
|
}));
|
|
50
|
-
return (yield Promise.resolve().then(() => __importStar(require(
|
|
51
|
+
return (yield (_a = './initializers/' + clientInitAnswer.clientFlavour, Promise.resolve().then(() => __importStar(require(_a))))).default();
|
|
51
52
|
});
|
|
@@ -72,6 +72,10 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
72
72
|
prompt_1.default.choice('Browser Logic', {
|
|
73
73
|
value: constants_1.FN_TYPE.browserLogic,
|
|
74
74
|
short: 'browser logic'
|
|
75
|
+
}),
|
|
76
|
+
prompt_1.default.choice('Job', {
|
|
77
|
+
value: constants_1.FN_TYPE.job,
|
|
78
|
+
short: 'job'
|
|
75
79
|
})
|
|
76
80
|
];
|
|
77
81
|
const integServicesRes = yield integServicesPromise;
|
|
@@ -79,15 +79,31 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
79
79
|
const pyRespJson = fnType === constants_1.FN_TYPE.integration
|
|
80
80
|
? yield (0, pip_install_1.pypiRes)('zcatalyst-cliq')
|
|
81
81
|
: yield (0, pip_install_1.pypiRes)('zcatalyst-sdk');
|
|
82
|
+
const latestVersion = (() => {
|
|
83
|
+
const releases = pyRespJson.releases;
|
|
84
|
+
const latest = Object.entries(releases).reduce((latest, [version, details]) => {
|
|
85
|
+
var _a;
|
|
86
|
+
const whlDetails = details.at(0);
|
|
87
|
+
if (!(whlDetails === null || whlDetails === void 0 ? void 0 : whlDetails.upload_time)) {
|
|
88
|
+
return latest;
|
|
89
|
+
}
|
|
90
|
+
const uploadTime = new Date(whlDetails.upload_time).getTime();
|
|
91
|
+
if (!((_a = latest.details) === null || _a === void 0 ? void 0 : _a.upload_time) ||
|
|
92
|
+
uploadTime > new Date(latest.details.upload_time).getTime()) {
|
|
93
|
+
latest = {
|
|
94
|
+
version,
|
|
95
|
+
details: whlDetails
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return latest;
|
|
99
|
+
}, {});
|
|
100
|
+
return latest.version;
|
|
101
|
+
})();
|
|
82
102
|
yield fs_1.ASYNC.findAndReplace(targetPath)([
|
|
83
103
|
constants_1.PLACEHOLDER.functions.python_package.name,
|
|
84
104
|
constants_1.PLACEHOLDER.functions.python_package.main,
|
|
85
105
|
constants_1.PLACEHOLDER.functions.python_package.sdkVersion
|
|
86
|
-
], [
|
|
87
|
-
functionAns.name,
|
|
88
|
-
functionAns.main,
|
|
89
|
-
pyRespJson.info.version
|
|
90
|
-
]);
|
|
106
|
+
], [functionAns.name, functionAns.main, latestVersion]);
|
|
91
107
|
yield fs_1.ASYNC.rename((0, path_1.join)(targetPath, constants_1.FILENAME.functions.python_main), () => functionAns.main);
|
|
92
108
|
const integ_config = runtime_store_1.default.get('context.functions.integration.config', '');
|
|
93
109
|
yield fn_utils_1.fnUtils.common.findAndReplaceConfigProps(targetPath, {
|
|
@@ -34,26 +34,16 @@ const client_utils_1 = require("../../client-utils");
|
|
|
34
34
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
35
|
var _a, _b;
|
|
36
36
|
const orgAPI = yield (0, endpoints_1.orgAPI)();
|
|
37
|
-
const projectAPIWithoutOrg = yield (0, endpoints_1.projectAPI)();
|
|
38
37
|
const defaultRCProjectName = (0, project_1.getDefaultProjectName)(null);
|
|
39
38
|
const defaultRCProjectId = (0, project_1.getDefaultProjectId)(null);
|
|
40
39
|
if (defaultRCProjectName !== null &&
|
|
41
40
|
defaultRCProjectId !== null &&
|
|
42
41
|
!(0, option_1.getOptionValue)('force', false)) {
|
|
43
|
-
(0, logger_1.message)(constants_1.FILENAME.rc +
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
if (js_1.JS.get(err, 'context.response.statusCode') !== 404) {
|
|
50
|
-
throw err;
|
|
51
|
-
}
|
|
52
|
-
(0, logger_1.warning)('cleaning up ' +
|
|
53
|
-
constants_1.FILENAME.rc +
|
|
54
|
-
' since the current default project for this folder is not found in remote');
|
|
55
|
-
yield (0, project_1.removeProject)(defaultRCProjectId + '');
|
|
56
|
-
}
|
|
42
|
+
(0, logger_1.message)(constants_1.FILENAME.rc +
|
|
43
|
+
' already has ' +
|
|
44
|
+
(0, ansi_colors_1.bold)(defaultRCProjectName) +
|
|
45
|
+
' as a default project. To overwrite use --force option');
|
|
46
|
+
throw new error_1.default('Skipping project setup, since project directory contains a default project. To overwrite use --force option', { skipHelp: true, exit: 0 });
|
|
57
47
|
}
|
|
58
48
|
const orgList = yield orgAPI.getAllOrgs();
|
|
59
49
|
if (orgList.length === 0) {
|