zcatalyst-cli 1.13.2 → 1.14.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/client-utils.toml +6 -1
- package/docs/commands/ds/import.toml +5 -0
- package/docs/fn-utils/lib/python.toml +4 -0
- package/docs/init/dependencies/python/ensure-python.toml +12 -0
- package/docs/init/dependencies/python/pip-install.toml +4 -0
- package/docs/serve/index.toml +5 -0
- package/lib/authentication/login.js +2 -1
- package/lib/cli_table/index.js +26 -2
- package/lib/cli_table/src/cell.js +359 -267
- package/lib/cli_table/src/layout-manager.js +231 -209
- package/lib/cli_table/src/table.js +76 -60
- package/lib/cli_table/src/utils.js +259 -224
- package/lib/client-utils.js +18 -4
- package/lib/command_needs/rc.js +57 -8
- package/lib/commands/config/delete.js +23 -0
- package/lib/commands/config/get.js +23 -0
- package/lib/commands/config/list.js +23 -0
- package/lib/commands/config/set.js +29 -0
- package/lib/commands/console/cache.js +31 -1
- package/lib/commands/console/queue.js +31 -1
- package/lib/commands/console/zcql.js +27 -1
- package/lib/commands/ds/export.js +2 -2
- package/lib/commands/ds/import.js +25 -5
- package/lib/commands/ds/status.js +2 -2
- package/lib/commands/iac/export.js +1 -1
- package/lib/commands/iac/import.js +1 -1
- package/lib/commands/iac/pack.js +16 -5
- package/lib/commands/iac/status.js +1 -1
- package/lib/commands/index.js +4 -0
- package/lib/commands/project/list.js +1 -1
- package/lib/commands/project/use.js +1 -1
- package/lib/deploy/features/client.js +2 -2
- package/lib/deploy/features/functions/index.js +13 -3
- package/lib/deploy/features/functions/languages/index.js +19 -2
- package/lib/endpoints/index.js +12 -5
- package/lib/endpoints/lib/env.js +5 -2
- package/lib/endpoints/lib/functions.js +30 -0
- package/lib/endpoints/lib/org.js +35 -0
- package/lib/endpoints/lib/project.js +7 -3
- package/lib/express_middlewares/unknownReqProxy.js +4 -1
- package/lib/fn-utils/index.js +2 -0
- package/lib/fn-utils/lib/common.js +68 -7
- package/lib/fn-utils/lib/integ.js +15 -11
- package/lib/fn-utils/lib/java.js +7 -3
- package/lib/fn-utils/lib/python.js +121 -0
- package/lib/fn-watcher.js +10 -2
- package/lib/index.js +2 -1
- package/lib/init/dependencies/python/ensure-python.js +151 -0
- package/lib/init/dependencies/python/pip-install.js +175 -0
- package/lib/init/features/functions/index.js +50 -29
- package/lib/init/features/functions/languages/index.js +3 -1
- package/lib/init/features/functions/languages/python.js +115 -0
- package/lib/init/features/index.js +2 -2
- package/lib/init/features/project.js +26 -6
- package/lib/init/util/project.js +2 -2
- package/lib/internal/api.js +2 -0
- package/lib/internal/command.js +1 -1
- package/lib/internal/rc.js +2 -0
- package/lib/port-resolver.js +4 -3
- package/lib/prompt/types/file-path.js +1 -1
- package/lib/pull/features/functions/index.js +35 -2
- package/lib/pull/features/functions/languages.js +8 -1
- package/lib/readLineUtils.js +37 -1
- package/lib/readline/features/cache.js +175 -1
- package/lib/readline/features/index.js +7 -1
- package/lib/readline/features/queue.js +209 -1
- package/lib/readline/features/zcql.js +237 -1
- package/lib/readline/index.js +30 -1
- package/lib/serve/index.js +48 -7
- package/lib/serve/server/index.js +118 -44
- 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-function-sdk-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/master.js +18 -5
- package/lib/serve/server/lib/node.mjs +41 -0
- package/lib/serve/server/lib/web_client/index.js +7 -3
- package/lib/serve/server/lib/web_client/server.js +31 -15
- package/lib/shell/dependencies/http-functions.js +57 -21
- package/lib/shell/dependencies/invoker/bio/java/JavabioInvoker.java +1 -2
- package/lib/shell/dependencies/invoker/bio/node.mjs +127 -0
- package/lib/shell/dependencies/invoker/cron/java/JavacronInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/cron/node.mjs +87 -0
- package/lib/shell/dependencies/invoker/event/java/JavaeventInvoker.java +3 -3
- package/lib/shell/dependencies/invoker/event/node.mjs +84 -0
- package/lib/shell/dependencies/invoker/integ/java/JavaintegInvoker.java +1 -1
- package/lib/shell/dependencies/invoker/integ/node.mjs +88 -0
- package/lib/shell/dependencies/local-function.js +74 -22
- package/lib/shell/index.js +11 -2
- package/lib/shell/prepare/index.js +21 -0
- package/lib/shell/prepare/languages/index.js +8 -2
- package/lib/shell/prepare/languages/java.js +39 -2
- package/lib/shell/prepare/languages/node.js +21 -2
- package/lib/shell/prepare/languages/python.js +65 -0
- package/lib/throbber/index.js +3 -1
- package/lib/userConfig.js +48 -0
- package/lib/util_modules/constants/index.js +3 -1
- package/lib/util_modules/constants/lib/apig-rules.js +8 -0
- package/lib/util_modules/constants/lib/cliq-handlers.js +17 -1
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +2 -2
- package/lib/util_modules/constants/lib/env-path.js +12 -0
- package/lib/util_modules/constants/lib/file-names.js +4 -1
- package/lib/util_modules/constants/lib/folder-names.js +3 -1
- package/lib/util_modules/constants/lib/placeholders.js +6 -1
- package/lib/util_modules/constants/lib/runtime.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -0
- package/lib/util_modules/constants/lib/template.js +9 -0
- package/lib/util_modules/constants/lib/urls.js +2 -6
- package/lib/util_modules/context-help.js +2 -0
- package/lib/util_modules/fs/lib/async.js +35 -11
- package/lib/util_modules/project.js +20 -1
- package/package.json +2 -1
- package/templates/init/functions/java/aio/catalyst-config.json +3 -2
- package/templates/init/functions/java/bio/catalyst-config.json +3 -2
- package/templates/init/functions/java/cron/catalyst-config.json +3 -2
- package/templates/init/functions/java/event/catalyst-config.json +3 -2
- package/templates/init/functions/java/integ/cliq/catalyst-config.json +1 -0
- package/templates/init/functions/node/aio/catalyst-config.json +3 -2
- package/templates/init/functions/node/bio/catalyst-config.json +3 -2
- package/templates/init/functions/node/cron/catalyst-config.json +3 -2
- package/templates/init/functions/node/event/catalyst-config.json +3 -2
- package/templates/init/functions/node/integ/cliq/catalyst-config.json +1 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +2 -2
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +1 -2
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/installation-validator.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/message-action-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +1 -1
- package/templates/init/functions/node/integ/cliq/sample.js +4 -4
- package/templates/init/functions/python/aio/catalyst-config.json +11 -0
- package/templates/init/functions/python/aio/requirements.txt +1 -0
- package/templates/init/functions/python/aio/sample.py +26 -0
- package/templates/init/functions/python/bio/catalyst-config.json +11 -0
- package/templates/init/functions/python/bio/requirements.txt +1 -0
- package/templates/init/functions/python/bio/sample.py +6 -0
- package/templates/init/functions/python/cron/catalyst-config.json +11 -0
- package/templates/init/functions/python/cron/requirements.txt +1 -0
- package/templates/init/functions/python/cron/sample.py +18 -0
- package/templates/init/functions/python/event/catalyst-config.json +11 -0
- package/templates/init/functions/python/event/requirements.txt +1 -0
- package/templates/init/functions/python/event/sample.py +21 -0
- package/templates/init/functions/python/integ/cliq/catalyst-config.json +11 -0
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +174 -0
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +102 -0
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +409 -0
- package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +12 -0
- package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +16 -0
- package/templates/init/functions/python/integ/cliq/handlers/message_action_handler.py +18 -0
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +269 -0
- package/templates/init/functions/python/integ/cliq/requirements.txt +1 -0
- package/templates/init/functions/python/integ/cliq/sample.py +21 -0
- package/lib/serve/server/lib/node.js +0 -62
- package/lib/shell/dependencies/invoker/bio/node.js +0 -80
- package/lib/shell/dependencies/invoker/cron/node.js +0 -54
- package/lib/shell/dependencies/invoker/event/node.js +0 -56
- package/lib/shell/dependencies/invoker/integ/node.js +0 -79
- 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
- package/templates/init/functions/node/integ/cliq/.DS_Store +0 -0
|
@@ -13,9 +13,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const path_1 = require("path");
|
|
16
|
+
const http_1 = __importDefault(require("http"));
|
|
16
17
|
const error_1 = __importDefault(require("../../error"));
|
|
17
18
|
const fn_utils_1 = require("../../fn-utils");
|
|
18
19
|
const credential_1 = __importDefault(require("../../internal/credential"));
|
|
20
|
+
const port_resolver_1 = __importDefault(require("../../port-resolver"));
|
|
21
|
+
const userConfig_1 = __importDefault(require("../../userConfig"));
|
|
19
22
|
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
20
23
|
const constants_1 = require("../../util_modules/constants");
|
|
21
24
|
const runtime_1 = __importDefault(require("../../util_modules/constants/lib/runtime"));
|
|
@@ -24,6 +27,7 @@ const js_1 = require("../../util_modules/js");
|
|
|
24
27
|
const logger_1 = require("../../util_modules/logger");
|
|
25
28
|
const project_1 = require("../../util_modules/project");
|
|
26
29
|
const shell_1 = require("../../util_modules/shell");
|
|
30
|
+
const http_functions_1 = require("../dependencies/http-functions");
|
|
27
31
|
class LocalFunction {
|
|
28
32
|
constructor(repl, target) {
|
|
29
33
|
var _a, _b, _c;
|
|
@@ -34,13 +38,14 @@ class LocalFunction {
|
|
|
34
38
|
this.watcher = target.watcher;
|
|
35
39
|
this.target = js_1.JS.omit(target, ['zip_stream', 'watcher']);
|
|
36
40
|
this.slave = null;
|
|
37
|
-
this.nodeInvoker = (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'node.
|
|
38
|
-
|
|
41
|
+
this.nodeInvoker = (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'node.mjs'));
|
|
42
|
+
const projectRoot = runtime_store_1.default.get('project.root');
|
|
43
|
+
this.javaInvoker = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'Java' + target.type + 'Invoker');
|
|
39
44
|
if ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) {
|
|
40
45
|
fn_utils_1.fnUtils.java.ensureJavaInvoker(this.javaInvoker, (0, path_1.normalize)((0, path_1.join)(__dirname, './invoker', target.type, 'java', 'Java' + target.type + 'Invoker.java')));
|
|
41
46
|
}
|
|
42
|
-
this.responseFile = (0, path_1.join)(
|
|
43
|
-
this.metaFile = (0, path_1.join)(
|
|
47
|
+
this.responseFile = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'user_res_body');
|
|
48
|
+
this.metaFile = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'user_meta.json');
|
|
44
49
|
this.call = this._call.bind(this);
|
|
45
50
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('preparing', () => {
|
|
46
51
|
if (!this.repl.paused) {
|
|
@@ -81,7 +86,8 @@ class LocalFunction {
|
|
|
81
86
|
return new error_1.default('Event bus details missing');
|
|
82
87
|
}
|
|
83
88
|
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
var _a, _b, _c, _d;
|
|
89
|
+
var _a, _b, _c, _d, _e, _f;
|
|
90
|
+
const projectRoot = runtime_store_1.default.get('project.root');
|
|
85
91
|
const accessToken = yield credential_1.default.getAccessToken();
|
|
86
92
|
const slaveOptions = [];
|
|
87
93
|
const debugPort = runtime_store_1.default.get('context.port.debug.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic], null);
|
|
@@ -107,16 +113,11 @@ class LocalFunction {
|
|
|
107
113
|
'x-zc-admin-cred-token': accessToken,
|
|
108
114
|
'x-zc-user-type': 'admin'
|
|
109
115
|
}));
|
|
110
|
-
slaveOptions.push(JSON.stringify((0, path_1.join)(
|
|
116
|
+
slaveOptions.push(JSON.stringify((0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)));
|
|
111
117
|
this.slave = (0, shell_1.spawn)('node', slaveOptions, {
|
|
112
|
-
cwd: this.target.
|
|
118
|
+
cwd: (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, this.target.name),
|
|
113
119
|
stdio: 'pipe',
|
|
114
|
-
env: {
|
|
115
|
-
X_ZOHO_CATALYST_IS_LOCAL: 'true',
|
|
116
|
-
X_ZOHO_CATALYST_FUNCTION_LOADED: 'true',
|
|
117
|
-
X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth,
|
|
118
|
-
X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin
|
|
119
|
-
}
|
|
120
|
+
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, this.target.env_var)
|
|
120
121
|
}).RAW();
|
|
121
122
|
}
|
|
122
123
|
else if ((_b = this.target.stack) === null || _b === void 0 ? void 0 : _b.startsWith(runtime_1.default.language.java)) {
|
|
@@ -145,26 +146,77 @@ class LocalFunction {
|
|
|
145
146
|
'x-zc-user-type': 'admin'
|
|
146
147
|
}));
|
|
147
148
|
this.slave = (0, shell_1.spawn)('java', slaveOptions, {
|
|
148
|
-
cwd: this.target.
|
|
149
|
+
cwd: (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, this.target.name),
|
|
149
150
|
stdio: 'pipe',
|
|
150
|
-
env: {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, this.target.env_var)
|
|
152
|
+
}).RAW();
|
|
153
|
+
}
|
|
154
|
+
else if ((_c = this.target.stack) === null || _c === void 0 ? void 0 : _c.startsWith(runtime_1.default.language.python)) {
|
|
155
|
+
const stackVersion = (_d = this.target.stack) === null || _d === void 0 ? void 0 : _d.replace('python_', '');
|
|
156
|
+
const runtimesDir = constants_1.ENVPATH.runtimes.data;
|
|
157
|
+
const httpPort = parseInt(runtime_store_1.default.get('context.port.http.' + constants_1.REMOTE_REF.functions.type[constants_1.FN_TYPE.basic]), 10);
|
|
158
|
+
const runTimePort = yield port_resolver_1.default.getFreePort(httpPort, 20, false);
|
|
159
|
+
yield fs_1.ASYNC.ensureFile(this.responseFile, true);
|
|
160
|
+
yield fs_1.ASYNC.ensureFile(this.metaFile, true);
|
|
161
|
+
slaveOptions.push('-u');
|
|
162
|
+
slaveOptions.push('main.py');
|
|
163
|
+
this.slave = (0, shell_1.spawn)(userConfig_1.default.get(`python${stackVersion}.bin`), slaveOptions, {
|
|
164
|
+
cwd: (0, path_1.join)(runtimesDir, runtime_1.default.language.python, `zcatalyst_runtime_${stackVersion.replace('_', '')}`),
|
|
165
|
+
stdio: 'pipe',
|
|
166
|
+
env: Object.assign({ X_ZOHO_CATALYST_IS_LOCAL: 'true', X_ZOHO_CATALYST_FUNCTION_LOADED: 'true', X_ZOHO_CATALYST_ACCOUNTS_URL: constants_1.ORIGIN.auth, X_ZOHO_CATALYST_CONSOLE_URL: constants_1.ORIGIN.admin, X_ZOHO_CATALYST_CODE_LOCATION: (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, this.target.name), X_ZOHO_CATALYST_SERVER_LISTEN_PORT: runTimePort.toString(), CATALYST_PROJECT_TIMEZONE: (0, project_1.getProjectTimezone)(Intl.DateTimeFormat().resolvedOptions().timeZone) }, this.target.env_var)
|
|
156
167
|
}).RAW();
|
|
168
|
+
this.slave.on('spawn', () => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const jsonData = JSON.parse(data);
|
|
170
|
+
jsonData.timestamp = Date.now();
|
|
171
|
+
const reqJson = JSON.stringify(jsonData);
|
|
172
|
+
yield (0, http_functions_1.checkIfRuntimeServerRunning)(runTimePort.toString());
|
|
173
|
+
const req = http_1.default
|
|
174
|
+
.request(`http://127.0.0.1:${runTimePort}`, {
|
|
175
|
+
headers: {
|
|
176
|
+
'x-zc-projectid': (0, project_1.getProjectId)(),
|
|
177
|
+
'x-zc-project-domain': (0, project_1.getDomainPrefix)() +
|
|
178
|
+
'.' +
|
|
179
|
+
constants_1.ORIGIN.app.replace('https://', ''),
|
|
180
|
+
'x-zc-project-key': (0, project_1.getDomainKey)(),
|
|
181
|
+
'x-zc-environment': (0, project_1.getEnvName)(),
|
|
182
|
+
'x-zc-user-cred-type': 'token',
|
|
183
|
+
'x-zc-user-cred-token': accessToken,
|
|
184
|
+
'x-zc-admin-cred-type': 'token',
|
|
185
|
+
'x-zc-admin-cred-token': accessToken,
|
|
186
|
+
'x-zc-user-type': 'admin',
|
|
187
|
+
'Content-Length': reqJson.length
|
|
188
|
+
}
|
|
189
|
+
}, (resp) => {
|
|
190
|
+
resp.on('data', (data) => {
|
|
191
|
+
const respStr = data.toString();
|
|
192
|
+
fs_1.SYNC.writeFile(this.responseFile, respStr);
|
|
193
|
+
});
|
|
194
|
+
resp.on('close', () => {
|
|
195
|
+
var _a;
|
|
196
|
+
const metaJson = { response: { statusCode: resp.statusCode } };
|
|
197
|
+
fs_1.SYNC.writeFile(this.metaFile, JSON.stringify(metaJson));
|
|
198
|
+
(_a = this.slave) === null || _a === void 0 ? void 0 : _a.kill('SIGINT');
|
|
199
|
+
});
|
|
200
|
+
})
|
|
201
|
+
.on('error', (err) => {
|
|
202
|
+
var _a;
|
|
203
|
+
console.log(err);
|
|
204
|
+
(_a = this.slave) === null || _a === void 0 ? void 0 : _a.kill('SIGINT');
|
|
205
|
+
});
|
|
206
|
+
req.write(reqJson);
|
|
207
|
+
req.end();
|
|
208
|
+
}));
|
|
157
209
|
}
|
|
158
210
|
if (this.slave === null) {
|
|
159
211
|
throw new error_1.default('Slave listening started before initialising', {
|
|
160
212
|
exit: 2
|
|
161
213
|
});
|
|
162
214
|
}
|
|
163
|
-
(
|
|
215
|
+
(_e = this.slave.stdout) === null || _e === void 0 ? void 0 : _e.on('data', (message) => {
|
|
164
216
|
(0, shell_1.clearLine)(process.stdout);
|
|
165
217
|
(0, logger_1.info)(message.toString());
|
|
166
218
|
});
|
|
167
|
-
(
|
|
219
|
+
(_f = this.slave.stderr) === null || _f === void 0 ? void 0 : _f.on('data', (message) => {
|
|
168
220
|
const errorStr = js_1.JS.trim(message.toString());
|
|
169
221
|
(0, shell_1.clearLine)(process.stdout);
|
|
170
222
|
(0, logger_1.info)(errorStr);
|
package/lib/shell/index.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
const httpServer = new http_functions_1.default({ repl: replServer });
|
|
47
|
+
const projectRoot = runtime_store_1.default.get('project.root');
|
|
47
48
|
try {
|
|
48
49
|
yield (0, prepare_1.default)([constants_1.FN_TYPE.basic, constants_1.FN_TYPE.cron, constants_1.FN_TYPE.event, constants_1.FN_TYPE.integration]);
|
|
49
50
|
const targets = runtime_store_1.default
|
|
@@ -87,14 +88,22 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
87
88
|
return target.localFn.shutdown();
|
|
88
89
|
}
|
|
89
90
|
})));
|
|
90
|
-
yield fs_1.ASYNC.
|
|
91
|
+
yield fs_1.ASYNC.chmod((0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions), '755', {
|
|
92
|
+
recursive: true,
|
|
93
|
+
checkPath: false
|
|
94
|
+
}).catch((err) => (0, logger_js_1.debug)('Error modifying permissions: ', err));
|
|
95
|
+
yield fs_1.ASYNC.deleteDir((0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)).catch();
|
|
91
96
|
fn_utils_1.fnUtils.common.executeHook({ prefix: 'post', command: 'serve' });
|
|
92
97
|
(0, logger_js_1.info)();
|
|
93
98
|
(0, logger_js_1.success)('shell complete');
|
|
94
99
|
}
|
|
95
100
|
catch (e) {
|
|
101
|
+
yield fs_1.ASYNC.chmod((0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions), '755', {
|
|
102
|
+
recursive: true,
|
|
103
|
+
checkPath: false
|
|
104
|
+
}).catch((err) => (0, logger_js_1.debug)('Error modifying permissions: ', err));
|
|
96
105
|
yield Promise.all([
|
|
97
|
-
fs_1.ASYNC.deleteDir((0, path_1.join)(
|
|
106
|
+
fs_1.ASYNC.deleteDir((0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)).catch(),
|
|
98
107
|
httpServer ? httpServer.stop() : undefined
|
|
99
108
|
]);
|
|
100
109
|
throw e;
|
|
@@ -14,11 +14,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const fn_utils_1 = require("../../fn-utils");
|
|
16
16
|
const common_1 = require("../../fn-utils/lib/common");
|
|
17
|
+
const pip_install_1 = require("../../init/dependencies/python/pip-install");
|
|
17
18
|
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
19
|
+
const throbber_1 = __importDefault(require("../../throbber"));
|
|
18
20
|
const constants_1 = require("../../util_modules/constants");
|
|
21
|
+
const runtime_1 = __importDefault(require("../../util_modules/constants/lib/runtime"));
|
|
19
22
|
const languages_1 = require("./languages");
|
|
20
23
|
exports.default = (fnTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
24
|
fn_utils_1.fnUtils.common.executeHook({ prefix: 'pre', command: 'serve' });
|
|
25
|
+
const throbber = throbber_1.default.getInstance();
|
|
22
26
|
const targets = yield fn_utils_1.fnUtils.common.validate();
|
|
23
27
|
let refinedTargets = yield fn_utils_1.fnUtils.common.refineTargets(targets);
|
|
24
28
|
refinedTargets = refinedTargets.map((target) => {
|
|
@@ -29,10 +33,27 @@ exports.default = (fnTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
29
33
|
fnTypes.map((t) => constants_1.REMOTE_REF.functions.type[t]).join(',') +
|
|
30
34
|
' are supported.';
|
|
31
35
|
}
|
|
36
|
+
else if (target.valid) {
|
|
37
|
+
throbber.add('function_serve_' + target.name, {
|
|
38
|
+
text: `preparing function [${target.name}]`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
32
41
|
return target;
|
|
33
42
|
});
|
|
34
43
|
runtime_store_1.default.set('context.functions.targets', refinedTargets);
|
|
35
44
|
yield (0, languages_1.prepareFunctions)(refinedTargets);
|
|
45
|
+
const pyStacks = [];
|
|
46
|
+
refinedTargets.filter((target) => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python)) &&
|
|
49
|
+
!pyStacks.includes(target.stack) &&
|
|
50
|
+
target.valid) {
|
|
51
|
+
pyStacks.push(target.stack);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
yield Promise.all(pyStacks.map((stack) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
yield (0, pip_install_1.ensurePyRuntime)(constants_1.ENVPATH.runtimes.data, stack);
|
|
56
|
+
})));
|
|
36
57
|
yield (0, common_1.resolveAllFnPorts)(refinedTargets);
|
|
37
58
|
return refinedTargets;
|
|
38
59
|
});
|
|
@@ -47,11 +47,17 @@ function java(targets) {
|
|
|
47
47
|
return (yield Promise.resolve().then(() => __importStar(require('./java')))).default(targets);
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function python(targets, fnWatchEvent) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return (yield Promise.resolve().then(() => __importStar(require('./python')))).default(targets, fnWatchEvent);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function prepareFunctions(targets, fnWatchEvent) {
|
|
51
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
57
|
return Promise.all([
|
|
53
58
|
node(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.nodejs)) && target.valid; })),
|
|
54
|
-
java(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) && target.valid; }))
|
|
59
|
+
java(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.java)) && target.valid; })),
|
|
60
|
+
python(targets.filter((target) => { var _a; return ((_a = target.stack) === null || _a === void 0 ? void 0 : _a.startsWith(runtime_1.default.language.python)) && target.valid; }), fnWatchEvent)
|
|
55
61
|
]);
|
|
56
62
|
});
|
|
57
63
|
}
|
|
@@ -14,21 +14,58 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const path_1 = require("path");
|
|
16
16
|
const fn_utils_1 = require("../../../fn-utils");
|
|
17
|
+
const common_1 = require("../../../fn-utils/lib/common");
|
|
18
|
+
const java_1 = require("../../../fn-utils/lib/java");
|
|
17
19
|
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
20
|
+
const constants_1 = require("../../../util_modules/constants");
|
|
18
21
|
const fs_1 = require("../../../util_modules/fs");
|
|
22
|
+
const fs_2 = require("fs");
|
|
23
|
+
const throbber_1 = __importDefault(require("../../../throbber"));
|
|
19
24
|
exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
25
|
if (targets === undefined || targets.length === 0) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
28
|
+
const throbber = throbber_1.default.getInstance();
|
|
23
29
|
yield fn_utils_1.fnUtils.java.validate(targets, 0);
|
|
24
30
|
const javaTargets = targets
|
|
25
|
-
.filter((target) =>
|
|
31
|
+
.filter((target) => {
|
|
32
|
+
if (!target.valid) {
|
|
33
|
+
throbber.remove('function_serve_' + target.name);
|
|
34
|
+
}
|
|
35
|
+
return target.valid;
|
|
36
|
+
})
|
|
26
37
|
.map((target) => {
|
|
27
38
|
fn_utils_1.fnUtils.common.generateUrlForTarget(target);
|
|
28
39
|
return target;
|
|
29
40
|
});
|
|
41
|
+
const projectRoot = runtime_store_1.default.get('project.root');
|
|
30
42
|
return Promise.all(javaTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
|
|
43
|
+
if (!target.valid) {
|
|
44
|
+
return target;
|
|
45
|
+
}
|
|
46
|
+
const targetBuildPath = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
|
|
47
|
+
if (yield fs_1.ASYNC.isPathExists(targetBuildPath)) {
|
|
48
|
+
yield fs_1.ASYNC.chmod(targetBuildPath, '755', { recursive: true });
|
|
49
|
+
yield fs_1.ASYNC.deleteDir(targetBuildPath);
|
|
50
|
+
}
|
|
51
|
+
if (target.type === constants_1.FN_TYPE.advanced || target.type === constants_1.FN_TYPE.applogic) {
|
|
52
|
+
const javaServer = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, '.catalyst', 'aioserver', 'JavaaioServer');
|
|
53
|
+
const javaInvoker = (0, path_1.join)(__dirname, '../../../serve/server/lib/java/JavaaioServer.java');
|
|
54
|
+
(0, java_1.ensureJavaInvoker)(javaServer, javaInvoker);
|
|
55
|
+
const serverFiles = yield fs_1.ASYNC.walk((0, path_1.dirname)(javaServer));
|
|
56
|
+
yield Promise.all(serverFiles.map((file) => {
|
|
57
|
+
return fs_1.ASYNC.copyFile(file, (0, path_1.join)(targetBuildPath, (0, path_1.relative)((0, path_1.dirname)(javaServer), file.replace('lib' + path_1.sep, ''))), fs_2.constants.COPYFILE_EXCL).catch((err) => {
|
|
58
|
+
if (err.code !== 'EEXIST') {
|
|
59
|
+
throbber.remove('function_serve_' + target.name);
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
yield (0, common_1.copyModDirPerm)((0, path_1.join)(target.source, constants_1.FOLDERNAME.output), targetBuildPath, '555', {
|
|
66
|
+
replace: false
|
|
67
|
+
});
|
|
68
|
+
throbber.remove('function_serve_' + target.name);
|
|
32
69
|
return target;
|
|
33
70
|
})));
|
|
34
71
|
});
|
|
@@ -8,17 +8,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const path_1 = require("path");
|
|
12
16
|
const fn_utils_1 = require("../../../fn-utils");
|
|
17
|
+
const common_1 = require("../../../fn-utils/lib/common");
|
|
18
|
+
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
19
|
+
const throbber_1 = __importDefault(require("../../../throbber"));
|
|
20
|
+
const constants_1 = require("../../../util_modules/constants");
|
|
13
21
|
exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
22
|
if (targets === undefined || targets.length === 0) {
|
|
15
23
|
return;
|
|
16
24
|
}
|
|
25
|
+
const throbber = throbber_1.default.getInstance();
|
|
17
26
|
yield fn_utils_1.fnUtils.node.validate(targets, 0);
|
|
18
|
-
|
|
19
|
-
.filter((target) =>
|
|
27
|
+
const nodeTargets = targets
|
|
28
|
+
.filter((target) => {
|
|
29
|
+
if (!target.valid) {
|
|
30
|
+
throbber.remove('function_serve_' + target.name);
|
|
31
|
+
}
|
|
32
|
+
return target.valid;
|
|
33
|
+
})
|
|
20
34
|
.map((target) => {
|
|
21
35
|
fn_utils_1.fnUtils.common.generateUrlForTarget(target);
|
|
22
36
|
return target;
|
|
23
37
|
});
|
|
38
|
+
return Promise.all(nodeTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
yield (0, common_1.copyModDirPerm)(target.source, (0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name), '555');
|
|
40
|
+
throbber.remove('function_serve_' + target.name);
|
|
41
|
+
return target;
|
|
42
|
+
})));
|
|
24
43
|
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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 path_1 = require("path");
|
|
16
|
+
const fn_utils_1 = require("../../../fn-utils");
|
|
17
|
+
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
18
|
+
const common_1 = require("../../../fn-utils/lib/common");
|
|
19
|
+
const constants_1 = require("../../../util_modules/constants");
|
|
20
|
+
const fs_1 = require("../../../util_modules/fs");
|
|
21
|
+
const pip_install_1 = require("../../../init/dependencies/python/pip-install");
|
|
22
|
+
const error_1 = __importDefault(require("../../../error"));
|
|
23
|
+
const fs_extra_1 = require("fs-extra");
|
|
24
|
+
const throbber_1 = __importDefault(require("../../../throbber"));
|
|
25
|
+
exports.default = (targets, fnWatchEvent) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
if (targets === undefined || targets.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const throbber = throbber_1.default.getInstance();
|
|
30
|
+
yield fn_utils_1.fnUtils.python.validate(targets, 0);
|
|
31
|
+
const pyTargets = targets
|
|
32
|
+
.filter((target) => {
|
|
33
|
+
if (!target.valid) {
|
|
34
|
+
throbber.remove('function_serve_' + target.name);
|
|
35
|
+
}
|
|
36
|
+
return target.valid;
|
|
37
|
+
})
|
|
38
|
+
.map((target) => {
|
|
39
|
+
fn_utils_1.fnUtils.common.generateUrlForTarget(target);
|
|
40
|
+
return target;
|
|
41
|
+
});
|
|
42
|
+
return Promise.all(pyTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
var _a;
|
|
44
|
+
const buildPath = (0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
|
|
45
|
+
const reqFile = (0, path_1.join)(target.source, constants_1.FILENAME.functions.python_requirements);
|
|
46
|
+
const requirementsExists = yield fs_1.ASYNC.readFile(reqFile);
|
|
47
|
+
const watch = fnWatchEvent
|
|
48
|
+
? fnWatchEvent.pth === constants_1.FILENAME.functions.python_requirements
|
|
49
|
+
: true;
|
|
50
|
+
if (requirementsExists && watch) {
|
|
51
|
+
yield (0, fs_extra_1.ensureDir)(buildPath);
|
|
52
|
+
try {
|
|
53
|
+
yield (0, pip_install_1.installRequirements)(reqFile, buildPath, (_a = target.stack) === null || _a === void 0 ? void 0 : _a.replace('python_', ''));
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
const error = error_1.default.getErrorInstance(err);
|
|
57
|
+
target.valid = false;
|
|
58
|
+
target.failure_reason = error.message;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
yield (0, common_1.copyModDirPerm)(target.source, buildPath, '555');
|
|
62
|
+
throbber.remove('function_serve_' + target.name);
|
|
63
|
+
return target;
|
|
64
|
+
})));
|
|
65
|
+
});
|
package/lib/throbber/index.js
CHANGED
|
@@ -197,9 +197,11 @@ class Throbber {
|
|
|
197
197
|
}
|
|
198
198
|
bindSigint() {
|
|
199
199
|
process.prependOnceListener('SIGINT', () => {
|
|
200
|
+
if (!this.hasActiveSpinners()) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
200
203
|
cli_cursor_1.default.show();
|
|
201
204
|
(0, readline_1.moveCursor)(process.stderr, 0, this.lineCount);
|
|
202
|
-
process.exit(0);
|
|
203
205
|
});
|
|
204
206
|
}
|
|
205
207
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
const fs_1 = require("./util_modules/fs");
|
|
7
|
+
const constants_1 = require("./util_modules/constants");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const error_1 = __importDefault(require("./error"));
|
|
10
|
+
class UserConfig {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.validKeys = ['python3_9.bin'];
|
|
13
|
+
this.configFilePath = path_1.default.join(constants_1.ENVPATH.userConfig.config, '.zcconfig');
|
|
14
|
+
this.config = fs_1.SYNC.readJSONFile(this.configFilePath, { checkpath: true }) || {};
|
|
15
|
+
}
|
|
16
|
+
set(key, value) {
|
|
17
|
+
if (!this.validKeys.includes(key)) {
|
|
18
|
+
throw new error_1.default('Invalid key provided', {
|
|
19
|
+
exit: 1
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
fs_1.SYNC.ensureFile(this.configFilePath);
|
|
23
|
+
this.config[key] = value;
|
|
24
|
+
const content = JSON.stringify(this.config, null, 2) + '\n';
|
|
25
|
+
fs_1.SYNC.writeFile(this.configFilePath, content, 'utf8');
|
|
26
|
+
return this.config;
|
|
27
|
+
}
|
|
28
|
+
get(key) {
|
|
29
|
+
return this.config[key];
|
|
30
|
+
}
|
|
31
|
+
delete(key) {
|
|
32
|
+
if (!this.config[key]) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
delete this.config[key];
|
|
36
|
+
const content = JSON.stringify(this.config, null, 2) + '\n';
|
|
37
|
+
fs_1.SYNC.writeFile(this.configFilePath, content, 'utf8');
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
list() {
|
|
41
|
+
let result = '';
|
|
42
|
+
this.validKeys.forEach((entry) => {
|
|
43
|
+
result += `${entry}=${this.config[entry] || ''}\n`;
|
|
44
|
+
});
|
|
45
|
+
return result.trim();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = new UserConfig();
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IAC = exports.PLUGIN = exports.ORIGIN = exports.TEMPLATE = exports.SCOPE = exports.REMOTE_REF = exports.REGEX = exports.REFERENCE = exports.PLACEHOLDER = exports.INTEG = exports.FOLDERNAME = exports.FN_TYPE = exports.DC_TYPE = exports.FILENAME = exports.EVENT_SOURCE = exports.EVENT_REF = exports.DEFAULT = exports.CLIQ = exports.AUTH = exports.APIG_RULES = void 0;
|
|
6
|
+
exports.ENVPATH = exports.IAC = exports.PLUGIN = exports.ORIGIN = exports.TEMPLATE = exports.SCOPE = exports.REMOTE_REF = exports.REGEX = exports.REFERENCE = exports.PLACEHOLDER = exports.INTEG = exports.FOLDERNAME = exports.FN_TYPE = exports.DC_TYPE = exports.FILENAME = exports.EVENT_SOURCE = exports.EVENT_REF = exports.DEFAULT = exports.CLIQ = exports.AUTH = exports.APIG_RULES = void 0;
|
|
7
7
|
var apig_rules_1 = require("./lib/apig-rules");
|
|
8
8
|
Object.defineProperty(exports, "APIG_RULES", { enumerable: true, get: function () { return __importDefault(apig_rules_1).default; } });
|
|
9
9
|
var auth_1 = require("./lib/auth");
|
|
@@ -44,3 +44,5 @@ var plugin_1 = require("./lib/plugin");
|
|
|
44
44
|
Object.defineProperty(exports, "PLUGIN", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
|
|
45
45
|
var iac_1 = require("./lib/iac");
|
|
46
46
|
Object.defineProperty(exports, "IAC", { enumerable: true, get: function () { return __importDefault(iac_1).default; } });
|
|
47
|
+
var env_path_1 = require("./lib/env-path");
|
|
48
|
+
Object.defineProperty(exports, "ENVPATH", { enumerable: true, get: function () { return __importDefault(env_path_1).default; } });
|
|
@@ -121,6 +121,14 @@ exports.default = Object.freeze([
|
|
|
121
121
|
authentication: undefined,
|
|
122
122
|
status: true
|
|
123
123
|
},
|
|
124
|
+
{
|
|
125
|
+
name: 'catalyst_default_delete_rows',
|
|
126
|
+
source_endpoint: '/baas/v1/project/{projectId:[0-9]+}/table/{tableId:[A-Za-z0-9_]+}/row',
|
|
127
|
+
target_endpoint: '/baas/v1/project/{projectId}/table/{tableId}/row',
|
|
128
|
+
method: 'DELETE',
|
|
129
|
+
authentication: undefined,
|
|
130
|
+
status: true
|
|
131
|
+
},
|
|
124
132
|
{
|
|
125
133
|
name: 'catalyst_default_signup',
|
|
126
134
|
source_endpoint: '/baas/v1/project/{projectId:[0-9]+}/project-user/signup',
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const file_names_1 = __importDefault(require("./file-names"));
|
|
8
|
-
const { node_main, node_package, java_main, java_classpath, java_project } = file_names_1.default.functions;
|
|
8
|
+
const { node_main, node_package, java_main, java_classpath, java_project, python_main, python_requirements } = file_names_1.default.functions;
|
|
9
9
|
const template_root = (0, path_1.join)(__dirname, '../../../../templates');
|
|
10
10
|
const handlers = {
|
|
11
11
|
bot_handler: 'bot_handler',
|
|
@@ -20,8 +20,10 @@ exports.default = Object.freeze({
|
|
|
20
20
|
event_template_dir: (0, path_1.join)(template_root, './event/integ/cliq/'),
|
|
21
21
|
node_handlers_template_dir: './handlers',
|
|
22
22
|
java_handlers_template_dir: './com/handlers',
|
|
23
|
+
python_handlers_template_dir: './handlers',
|
|
23
24
|
node_handlers_path: 'handlers/',
|
|
24
25
|
java_handlers_path: 'com.handlers.',
|
|
26
|
+
python_handlers_path: 'handlers/',
|
|
25
27
|
node_template_contents_initial_copy: [node_main, node_package, file_names_1.default.catalyst_config],
|
|
26
28
|
java_template_contents_initial_copy: [
|
|
27
29
|
java_main,
|
|
@@ -29,6 +31,11 @@ exports.default = Object.freeze({
|
|
|
29
31
|
java_project,
|
|
30
32
|
file_names_1.default.catalyst_config
|
|
31
33
|
],
|
|
34
|
+
python_template_contents_initial_copy: [
|
|
35
|
+
python_main,
|
|
36
|
+
file_names_1.default.catalyst_config,
|
|
37
|
+
python_requirements
|
|
38
|
+
],
|
|
32
39
|
component_handlers: Object.keys(handlers),
|
|
33
40
|
node_handler_file_mapping: {
|
|
34
41
|
[handlers.bot_handler]: 'bot-handler.js',
|
|
@@ -48,6 +55,15 @@ exports.default = Object.freeze({
|
|
|
48
55
|
[handlers.installation_handler]: 'InstallationHandler.java',
|
|
49
56
|
[handlers.installation_validator]: 'InstallationValidator.java'
|
|
50
57
|
},
|
|
58
|
+
python_handler_file_mapping: {
|
|
59
|
+
[handlers.bot_handler]: 'bot_handler.py',
|
|
60
|
+
[handlers.command_handler]: 'command_handler.py',
|
|
61
|
+
[handlers.messageaction_handler]: 'message_action_handler.py',
|
|
62
|
+
[handlers.widget_handler]: 'widget_handler.py',
|
|
63
|
+
[handlers.function_handler]: 'function_handler.py',
|
|
64
|
+
[handlers.installation_handler]: 'installation_handler.py',
|
|
65
|
+
[handlers.installation_validator]: 'installation_validator.py'
|
|
66
|
+
},
|
|
51
67
|
handlers_event_template: {
|
|
52
68
|
['bot']: [
|
|
53
69
|
'welcome_handler',
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const env_paths_1 = __importDefault(require("env-paths"));
|
|
7
|
+
exports.default = Object.freeze({
|
|
8
|
+
runtimes: (0, env_paths_1.default)('zcatalyst-cli-runtimes', {
|
|
9
|
+
suffix: ''
|
|
10
|
+
}),
|
|
11
|
+
userConfig: (0, env_paths_1.default)('zcatalyst-cli')
|
|
12
|
+
});
|
|
@@ -6,9 +6,12 @@ exports.default = Object.freeze({
|
|
|
6
6
|
rc: '.catalystrc',
|
|
7
7
|
config: 'catalyst.json',
|
|
8
8
|
client: {
|
|
9
|
-
package_json: 'client-package.json'
|
|
9
|
+
package_json: 'client-package.json',
|
|
10
|
+
notFoundPage: '404.html'
|
|
10
11
|
},
|
|
11
12
|
functions: {
|
|
13
|
+
python_main: 'sample.py',
|
|
14
|
+
python_requirements: 'requirements.txt',
|
|
12
15
|
node_main: 'sample.js',
|
|
13
16
|
node_package: 'package.json',
|
|
14
17
|
java_main: 'sample.java',
|