zcatalyst-cli 1.15.0-beta.1 → 1.15.0-beta.3
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/lib/deploy/features/functions/index.js +10 -5
- package/lib/endpoints/lib/applogic.js +11 -2
- package/lib/endpoints/lib/functions.js +11 -2
- package/lib/fn-utils/lib/common.js +20 -8
- package/lib/fn-utils/lib/integ.js +3 -1
- package/lib/init/features/functions/languages/java.js +1 -1
- package/lib/init/features/functions/languages/node.js +1 -1
- package/lib/serve/server/lib/node/browserlogic/browserlogic-selenium.js +1 -1
- package/lib/serve/server/lib/node/browserlogic/utils/deferred_promise.js +1 -1
- package/lib/serve/server/lib/node/browserlogic/utils/playwright-handler.js +1 -1
- package/lib/serve/server/lib/node/browserlogic/utils/puppeteer-handler.js +1 -1
- package/lib/serve/server/lib/node/browserlogic/utils/selenium-handler.js +1 -1
- package/lib/serve/server/lib/node/index.js +1 -1
- package/lib/util_modules/constants/lib/runtime.js +2 -1
- package/package.json +1 -1
- package/templates/init/functions/node/browserlogic/playwright/catalyst-config.json +1 -1
- package/templates/init/functions/node/browserlogic/puppeteer/catalyst-config.json +1 -1
- package/templates/init/functions/node/browserlogic/selenium/catalyst-config.json +1 -1
- package/templates/init/functions/node/integ/cliq/package.json +1 -0
|
@@ -64,20 +64,25 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
64
64
|
if (target.type !== undefined && target.type === constants_1.FN_TYPE.advanced) {
|
|
65
65
|
resp = (yield appAPI.deploy(target.zip_stream, {
|
|
66
66
|
stack: target.stack,
|
|
67
|
-
name: target.name
|
|
67
|
+
name: target.name,
|
|
68
|
+
memory: target.memory,
|
|
69
|
+
envVariables: target.env_var
|
|
68
70
|
}));
|
|
69
71
|
}
|
|
70
72
|
else {
|
|
71
73
|
resp = (yield fnAPI.deploy(target.zip_stream, {
|
|
72
74
|
stack: target.stack,
|
|
73
75
|
name: target.name,
|
|
74
|
-
type: constants_1.REMOTE_REF.functions.type[target.type]
|
|
76
|
+
type: constants_1.REMOTE_REF.functions.type[target.type],
|
|
77
|
+
memory: target.type === constants_1.FN_TYPE.browserLogic
|
|
78
|
+
? !target.memory && !target.id
|
|
79
|
+
? 512
|
|
80
|
+
: target.memory
|
|
81
|
+
: target.memory,
|
|
82
|
+
envVariables: target.env_var
|
|
75
83
|
}));
|
|
76
84
|
}
|
|
77
85
|
target.id = resp.id + '';
|
|
78
|
-
if (target.id && target.env_var && Object.keys(target.env_var).length > 0) {
|
|
79
|
-
yield fnAPI.updateConfig(target.id, target.env_var);
|
|
80
|
-
}
|
|
81
86
|
fn_utils_1.fnUtils.common.generateUrlForTarget(target);
|
|
82
87
|
}
|
|
83
88
|
catch (e) {
|
|
@@ -20,7 +20,7 @@ class Applogic {
|
|
|
20
20
|
this.opts = opts;
|
|
21
21
|
this.projectId = projectId;
|
|
22
22
|
}
|
|
23
|
-
deploy(sourceFsStream, { stack, name, memory }) {
|
|
23
|
+
deploy(sourceFsStream, { stack, name, memory, envVariables }) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
const formData = {
|
|
26
26
|
stack,
|
|
@@ -29,8 +29,17 @@ class Applogic {
|
|
|
29
29
|
if (sourceFsStream !== undefined) {
|
|
30
30
|
formData.code = sourceFsStream;
|
|
31
31
|
}
|
|
32
|
+
const configuration = {};
|
|
32
33
|
if (memory !== undefined) {
|
|
33
|
-
|
|
34
|
+
configuration.memory = memory;
|
|
35
|
+
}
|
|
36
|
+
if (envVariables !== undefined) {
|
|
37
|
+
configuration.environment = {
|
|
38
|
+
variables: envVariables
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (Object.keys(configuration).length > 0) {
|
|
42
|
+
formData.configuration = JSON.stringify(configuration);
|
|
34
43
|
}
|
|
35
44
|
const res = yield new api_1.default(this.opts).put(`/baas/v1/project/${this.projectId}/server/upsert`, {
|
|
36
45
|
formData,
|
|
@@ -73,18 +73,27 @@ class Functions {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
deploy(sourceFsStream, { stack, name, type, memory }) {
|
|
76
|
+
deploy(sourceFsStream, { stack, name, type, memory, envVariables }) {
|
|
77
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
78
|
const formData = {
|
|
79
79
|
stack,
|
|
80
80
|
name,
|
|
81
81
|
type
|
|
82
82
|
};
|
|
83
|
+
const configuration = {};
|
|
83
84
|
if (sourceFsStream !== undefined) {
|
|
84
85
|
formData.code = sourceFsStream;
|
|
85
86
|
}
|
|
86
87
|
if (memory !== undefined) {
|
|
87
|
-
|
|
88
|
+
configuration.memory = memory;
|
|
89
|
+
}
|
|
90
|
+
if (envVariables !== undefined) {
|
|
91
|
+
configuration.environment = {
|
|
92
|
+
variables: envVariables
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(configuration).length > 0) {
|
|
96
|
+
formData.configuration = JSON.stringify(configuration);
|
|
88
97
|
}
|
|
89
98
|
const res = yield new api_1.default(this.opts).put(`/baas/v1/project/${this.projectId}/function/upsert`, {
|
|
90
99
|
formData,
|
|
@@ -126,7 +126,7 @@ function validate() {
|
|
|
126
126
|
exports.validate = validate;
|
|
127
127
|
function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
128
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
let
|
|
129
|
+
let remoteFnMap = {};
|
|
130
130
|
let runtimeDetails = runtime_store_1.default.get('context.catalyst.runtime', { runtimes: [] });
|
|
131
131
|
if (mapRemoteFn) {
|
|
132
132
|
const fnAPI = yield (0, endpoints_1.functionsAPI)();
|
|
@@ -141,12 +141,13 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
141
141
|
if (!Array.isArray(allRemoteFns) || allRemoteFns.length === 0) {
|
|
142
142
|
allRemoteFns = [];
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
accumulator[fn.name] = fn
|
|
144
|
+
remoteFnMap = allRemoteFns.reduce((accumulator, fn) => {
|
|
145
|
+
accumulator[fn.name] = fn;
|
|
146
146
|
return accumulator;
|
|
147
|
-
},
|
|
147
|
+
}, remoteFnMap);
|
|
148
148
|
}
|
|
149
149
|
return Promise.all(rawTargets.map((fnPath) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
var _a;
|
|
150
151
|
fnPath = (0, project_1.resolveProjectPath)(fnPath);
|
|
151
152
|
const catalystJsonPth = (0, path_1.join)(fnPath, constants_1.FILENAME.catalyst_config);
|
|
152
153
|
const catalystJson = yield fs_1.ASYNC.readJSONFile(catalystJsonPth, {
|
|
@@ -193,7 +194,7 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
193
194
|
switch (eol) {
|
|
194
195
|
case 1:
|
|
195
196
|
case 2:
|
|
196
|
-
if (eol === 2 &&
|
|
197
|
+
if (eol === 2 && remoteFnMap[fnName] === undefined) {
|
|
197
198
|
return {
|
|
198
199
|
name: fnName,
|
|
199
200
|
source: fnPath,
|
|
@@ -223,6 +224,16 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
223
224
|
const catalystJsonString = JSON.stringify(catalystJson, null, 2) + '\n';
|
|
224
225
|
yield fs_1.ASYNC.writeFile(catalystJsonPth, catalystJsonString, 'utf8');
|
|
225
226
|
}
|
|
227
|
+
const fnMemory = js_1.JS.get(catalystJson, 'deployment.memory', js_1.JS.get(remoteFnMap[fnName], 'configuration.memory'));
|
|
228
|
+
if (fnMemory && !runtime_1.default.memory.includes(fnMemory)) {
|
|
229
|
+
return {
|
|
230
|
+
name: fnName,
|
|
231
|
+
source: fnPath,
|
|
232
|
+
valid: false,
|
|
233
|
+
type: fnType,
|
|
234
|
+
failure_reason: `The memory configuration ${fnMemory} is not supported. The supported values are ${runtime_1.default.memory.join(', ')}.`
|
|
235
|
+
};
|
|
236
|
+
}
|
|
226
237
|
const fnTarget = {
|
|
227
238
|
name: fnName,
|
|
228
239
|
stack: userStack,
|
|
@@ -231,10 +242,11 @@ function refineTargets(rawTargets, mapRemoteFn = true) {
|
|
|
231
242
|
source: fnPath,
|
|
232
243
|
valid: true,
|
|
233
244
|
integ_config: js_1.JS.get(catalystJson, 'deployment.integration_config'),
|
|
234
|
-
env_var: refineEnvVariables(js_1.JS.get(catalystJson, 'deployment.env_variables'))
|
|
245
|
+
env_var: refineEnvVariables(js_1.JS.get(catalystJson, 'deployment.env_variables')),
|
|
246
|
+
memory: fnMemory
|
|
235
247
|
};
|
|
236
|
-
if (mapRemoteFn &&
|
|
237
|
-
fnTarget.id =
|
|
248
|
+
if (mapRemoteFn && remoteFnMap[fnTarget.name] !== undefined) {
|
|
249
|
+
fnTarget.id = (_a = remoteFnMap[fnTarget.name]) === null || _a === void 0 ? void 0 : _a.id;
|
|
238
250
|
}
|
|
239
251
|
return fnTarget;
|
|
240
252
|
})));
|
|
@@ -94,7 +94,9 @@ function copyIntegHandlers(templatePath, targetPath, lang) {
|
|
|
94
94
|
yield fs_1.ASYNC.copyFiles(filePaths, targetPath);
|
|
95
95
|
const integHandlerConfig = {};
|
|
96
96
|
const handlerPaths = handlers.map((handler) => {
|
|
97
|
-
integHandlerConfig[handler] =
|
|
97
|
+
integHandlerConfig[handler] =
|
|
98
|
+
constants_1.CLIQ.java_handlers_path +
|
|
99
|
+
constants_1.CLIQ.java_handler_file_mapping[handler].replace('.java', '');
|
|
98
100
|
return (0, path_1.join)(templatePath, constants_1.CLIQ.java_handlers_template_dir, constants_1.CLIQ.java_handler_file_mapping[handler]);
|
|
99
101
|
});
|
|
100
102
|
yield fs_1.ASYNC.copyFiles(handlerPaths, (0, path_1.join)(targetPath, constants_1.CLIQ.java_handlers_template_dir));
|
|
@@ -31,7 +31,7 @@ function getTemplatePath(fnType, add) {
|
|
|
31
31
|
switch (fnType) {
|
|
32
32
|
case constants_1.FN_TYPE.browserLogic:
|
|
33
33
|
case constants_1.FN_TYPE.integration: {
|
|
34
|
-
return js_1.JS.get(constants_1.TEMPLATE.functions.java[fnType], add
|
|
34
|
+
return js_1.JS.get(constants_1.TEMPLATE.functions.java[fnType], add);
|
|
35
35
|
}
|
|
36
36
|
default: {
|
|
37
37
|
return constants_1.TEMPLATE.functions.java[fnType];
|
|
@@ -32,7 +32,7 @@ function getTemplatePath(fnType, add) {
|
|
|
32
32
|
switch (fnType) {
|
|
33
33
|
case constants_1.FN_TYPE.browserLogic:
|
|
34
34
|
case constants_1.FN_TYPE.integration: {
|
|
35
|
-
return js_1.JS.get(constants_1.TEMPLATE.functions.node[fnType], add
|
|
35
|
+
return js_1.JS.get(constants_1.TEMPLATE.functions.node[fnType], add);
|
|
36
36
|
}
|
|
37
37
|
default: {
|
|
38
38
|
return constants_1.TEMPLATE.functions.node[fnType];
|
package/package.json
CHANGED