zcatalyst-cli 1.11.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/optional-import.toml +10 -0
- package/lib/commands/functions/shell.js +5 -2
- package/lib/error.js +10 -8
- package/lib/fn-utils/lib/node.js +2 -2
- package/lib/init/dependencies/npm-install.js +8 -1
- package/lib/init/features/client/initializers/angular.js +13 -15
- package/lib/init/features/client/initializers/lyte.js +2 -7
- package/lib/init/features/client/initializers/react.js +11 -10
- package/lib/init/util/client.js +5 -4
- package/lib/optional-import.js +25 -10
- package/lib/plugin-loader.js +22 -11
- package/lib/serve/server/lib/web_client/server.js +12 -12
- package/lib/shell/index.js +10 -6
- package/lib/util_modules/config/lib/client.js +18 -21
- package/lib/util_modules/constants/lib/urls.js +20 -12
- package/lib/util_modules/global-space.js +0 -97
- package/package.json +3 -3
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +2 -2
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +2 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[OPT-IMP-1]
|
|
2
|
+
context='''The Plugin(${arg[0]}) cannot be found in the ${arg[1]} path.'''
|
|
3
|
+
aid='''Please ensure that the ${arg[0]} plugin is installed in the ${arg[2]} directory or
|
|
4
|
+
Try providing the exact path to the ${arg[0]} plugin directory relative to the project root directory.'''
|
|
5
|
+
link=''
|
|
6
|
+
|
|
7
|
+
[OPT-IMP-2]
|
|
8
|
+
context='''The Plugin directory(${arg[0]}) cannot be found in the ${arg[1]} path.'''
|
|
9
|
+
aid='''Please ensure that you have provided the correct path to the Plugin directory.'''
|
|
10
|
+
link=''
|
|
@@ -41,8 +41,11 @@ exports.default = new command_1.default('functions:shell')
|
|
|
41
41
|
`(default: ${constants_1.DEFAULT.serve_port.http.basicio})`)
|
|
42
42
|
.option('--debug [port]', 'the functions are invoked from local environment enabling debugging options on provided port.' +
|
|
43
43
|
`(default: ${constants_1.DEFAULT.serve_port.debug.basicio})`)
|
|
44
|
-
.option('--ignore-scripts', 'ignore the pre and post
|
|
45
|
-
.option('--watch', 'watch for file and directory changes and enable hot reload'
|
|
44
|
+
.option('--ignore-scripts', 'ignore the pre and post lifecycle scripts')
|
|
45
|
+
.option('--watch', 'watch for file and directory changes and enable hot reload' +
|
|
46
|
+
'\n' +
|
|
47
|
+
'(deprecated: The watch mode will be enabled by default. To disable watch mode use the --no-watch option)')
|
|
48
|
+
.option('--no-watch', 'disable watching the files for changes')
|
|
46
49
|
.needs('auth', [constants_1.SCOPE.functions, constants_1.SCOPE.functions_execution])
|
|
47
50
|
.needs('config')
|
|
48
51
|
.needs('rc')
|
package/lib/error.js
CHANGED
|
@@ -50,14 +50,16 @@ class CatalystError extends Error {
|
|
|
50
50
|
original: util_1.inspect(unknownError),
|
|
51
51
|
skipHelp: skipHelp === undefined ? true : skipHelp
|
|
52
52
|
});
|
|
53
|
-
if ('
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
if (typeof unknownError === 'object') {
|
|
54
|
+
if ('message' in unknownError) {
|
|
55
|
+
newError.message = unknownError.message;
|
|
56
|
+
}
|
|
57
|
+
if ('stack' in unknownError) {
|
|
58
|
+
newError.stack = unknownError.stack;
|
|
59
|
+
}
|
|
60
|
+
if ('name' in unknownError) {
|
|
61
|
+
newError.name = unknownError.name;
|
|
62
|
+
}
|
|
61
63
|
}
|
|
62
64
|
return newError;
|
|
63
65
|
}
|
package/lib/fn-utils/lib/node.js
CHANGED
|
@@ -16,10 +16,10 @@ exports.validate = void 0;
|
|
|
16
16
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
17
|
const path_1 = require("path");
|
|
18
18
|
const error_1 = __importDefault(require("../../error"));
|
|
19
|
+
const npm_install_1 = __importDefault(require("../../init/dependencies/npm-install"));
|
|
19
20
|
const constants_1 = require("../../util_modules/constants");
|
|
20
21
|
const fs_1 = require("../../util_modules/fs");
|
|
21
22
|
const js_1 = require("../../util_modules/js");
|
|
22
|
-
const shell_1 = require("../../util_modules/shell");
|
|
23
23
|
function validate(targets, idx) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
if (targets.length < idx + 1) {
|
|
@@ -50,7 +50,7 @@ function validate(targets, idx) {
|
|
|
50
50
|
}
|
|
51
51
|
const nodeModuleExists = yield fs_1.ASYNC.dirExists(path_1.join(currentTarget.source, constants_1.FILENAME.node_modules));
|
|
52
52
|
if (!nodeModuleExists) {
|
|
53
|
-
yield
|
|
53
|
+
yield npm_install_1.default(currentTarget.source, true);
|
|
54
54
|
}
|
|
55
55
|
currentTarget.valid = true;
|
|
56
56
|
return validate(targets, ++idx);
|
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const error_1 = __importDefault(require("../../error"));
|
|
15
16
|
const prompt_1 = __importDefault(require("../../prompt"));
|
|
16
17
|
const shell_1 = require("../../util_modules/shell");
|
|
17
18
|
exports.default = (pth, skipPrompt = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -21,7 +22,13 @@ exports.default = (pth, skipPrompt = false) => __awaiter(void 0, void 0, void 0,
|
|
|
21
22
|
when: () => !skipPrompt
|
|
22
23
|
}));
|
|
23
24
|
if (ans.NPMinstall === undefined || ans.NPMinstall) {
|
|
24
|
-
return shell_1.spawn('npm', ['install'], { cwd: pth })
|
|
25
|
+
return shell_1.spawn('npm', ['install'], { cwd: pth })
|
|
26
|
+
.ASYNC()
|
|
27
|
+
.catch((err) => {
|
|
28
|
+
throw error_1.default.getErrorInstance(err, {
|
|
29
|
+
message: 'Failure when executing npm install.'
|
|
30
|
+
});
|
|
31
|
+
});
|
|
25
32
|
}
|
|
26
33
|
return;
|
|
27
34
|
});
|
|
@@ -42,7 +42,6 @@ const logger_js_1 = require("../../../../util_modules/logger.js");
|
|
|
42
42
|
const ansi_colors_1 = require("ansi-colors");
|
|
43
43
|
const client_js_1 = require("../../../util/client.js");
|
|
44
44
|
const path_1 = require("path");
|
|
45
|
-
const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
|
|
46
45
|
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
47
46
|
const error_js_1 = __importDefault(require("../../../../error.js"));
|
|
48
47
|
const { angular } = plugin_js_1.default;
|
|
@@ -59,22 +58,20 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
59
58
|
'--skip-git',
|
|
60
59
|
'true'
|
|
61
60
|
];
|
|
62
|
-
const isModuleFound = (yield global_space_js_1.default(angular.plugin, false));
|
|
63
61
|
try {
|
|
64
62
|
const collection = require.resolve(path_1.join(angular.collection_name, 'package.json'));
|
|
65
63
|
yield shell_js_1.spawn(angular.runner_command[0], [...opts, '--collection', path_1.dirname(collection)], {
|
|
66
64
|
stdio: 'inherit',
|
|
67
|
-
cwd: runtime_store_js_1.default.get('cwd')
|
|
68
|
-
env: {
|
|
69
|
-
CATALYST_ANGULAR_PLUGIN_GLOBAL: isModuleFound ? 'true' : 'false'
|
|
70
|
-
}
|
|
65
|
+
cwd: runtime_store_js_1.default.get('cwd')
|
|
71
66
|
}).ASYNC();
|
|
72
67
|
}
|
|
73
68
|
catch (e) {
|
|
74
69
|
if (e === null) {
|
|
75
70
|
throw new error_js_1.default('Process aborted!', { exit: 0, skipHelp: true });
|
|
76
71
|
}
|
|
77
|
-
const err = error_js_1.default.getErrorInstance(e
|
|
72
|
+
const err = error_js_1.default.getErrorInstance(e, {
|
|
73
|
+
message: 'Failure when creating new Angular App'
|
|
74
|
+
}).original;
|
|
78
75
|
if (!err.code || err.code !== 'ENOENT') {
|
|
79
76
|
throw err;
|
|
80
77
|
}
|
|
@@ -92,15 +89,16 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
92
89
|
angular.collection_name
|
|
93
90
|
], {
|
|
94
91
|
stdio: 'inherit',
|
|
95
|
-
cwd: runtime_store_js_1.default.get('cwd')
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
cwd: runtime_store_js_1.default.get('cwd')
|
|
93
|
+
})
|
|
94
|
+
.ASYNC()
|
|
95
|
+
.catch((err) => {
|
|
96
|
+
throw error_js_1.default.getErrorInstance(err, {
|
|
97
|
+
message: 'Failure when creating new Angular App with npx'
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
100
|
}
|
|
101
101
|
yield ASYNC.findAndReplace(path_1.join(clientDirPath, file_names_js_1.default.client.package_json))(client.package.name, clientName);
|
|
102
|
-
runtime_store_js_1.default.set('payload.client.plugin',
|
|
103
|
-
? angular.plugin
|
|
104
|
-
: path_1.relative(project_js_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', angular.plugin)));
|
|
102
|
+
runtime_store_js_1.default.set('payload.client.plugin', angular.plugin);
|
|
105
103
|
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
106
104
|
});
|
|
@@ -41,7 +41,6 @@ const placeholders_js_1 = __importDefault(require("../../../../util_modules/cons
|
|
|
41
41
|
const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
|
|
42
42
|
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
43
43
|
const project_js_1 = require("../../../../util_modules/project.js");
|
|
44
|
-
const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
|
|
45
44
|
const { lyte } = plugin_js_1.default;
|
|
46
45
|
const { client } = placeholders_js_1.default;
|
|
47
46
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -49,13 +48,9 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
49
48
|
const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
|
|
50
49
|
yield client_js_1.directoryOverridePrompt(clientDirPath);
|
|
51
50
|
yield ASYNC.copyDir(template_js_1.default.client.lyte, clientDirPath);
|
|
52
|
-
|
|
53
|
-
!isModuleFound &&
|
|
54
|
-
(yield client_js_1.addDevDep(path_1.join(clientDirPath, 'package.json'), { [lyte.plugin]: 'latest' }));
|
|
51
|
+
yield client_js_1.addDependency(path_1.join(clientDirPath, 'package.json'), { [lyte.plugin]: 'latest' }, { dev: true });
|
|
55
52
|
yield ASYNC.findAndReplace(clientDirPath)(client.package.name, clientName);
|
|
56
53
|
yield npm_install_js_1.default(clientDirPath, true);
|
|
57
|
-
runtime_store_js_1.default.set('payload.client.plugin',
|
|
58
|
-
? lyte.plugin
|
|
59
|
-
: path_1.relative(project_js_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', lyte.plugin)));
|
|
54
|
+
runtime_store_js_1.default.set('payload.client.plugin', lyte.plugin);
|
|
60
55
|
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
61
56
|
});
|
|
@@ -37,12 +37,12 @@ const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js
|
|
|
37
37
|
const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
|
|
38
38
|
const path_1 = require("path");
|
|
39
39
|
const os_1 = require("os");
|
|
40
|
-
const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
|
|
41
40
|
const index_js_1 = __importDefault(require("../../../../prompt/index.js"));
|
|
42
41
|
const client_js_1 = require("../../../util/client.js");
|
|
43
42
|
const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
|
|
44
43
|
const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
|
|
45
44
|
const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
|
|
45
|
+
const error_js_1 = __importDefault(require("../../../../error.js"));
|
|
46
46
|
const { react } = plugin_js_1.default;
|
|
47
47
|
const { client } = placeholders_js_1.default;
|
|
48
48
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -60,18 +60,19 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
60
60
|
const reactPluginDir = path_1.join(catalystTempDir, 'react');
|
|
61
61
|
yield ASYNC.emptyDir(reactPluginDir);
|
|
62
62
|
yield ASYNC.copyDir(flavourPrompt.flavour === 'ts' ? template_js_1.default.client.react.ts : template_js_1.default.client.react.js, reactPluginDir);
|
|
63
|
-
|
|
64
|
-
!isModuleFound &&
|
|
65
|
-
(yield client_js_1.addDevDep(path_1.join(reactPluginDir, 'template.json'), { [react.plugin]: 'latest' }, [
|
|
66
|
-
'package'
|
|
67
|
-
]));
|
|
63
|
+
yield client_js_1.addDependency(path_1.join(reactPluginDir, 'template.json'), { [react.plugin]: 'latest' }, { depPath: ['package'] });
|
|
68
64
|
yield ASYNC.findAndReplace(reactPluginDir)(client.package.name, clientName);
|
|
69
65
|
yield shell_js_1.spawn('npx', [react.runner_command[0], clientName, '--template', 'file:' + reactPluginDir], {
|
|
70
66
|
stdio: 'inherit',
|
|
71
67
|
cwd: runtime_store_js_1.default.get('cwd')
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
})
|
|
69
|
+
.ASYNC()
|
|
70
|
+
.catch((err) => {
|
|
71
|
+
throw error_js_1.default.getErrorInstance(err, {
|
|
72
|
+
message: 'Failure while Creating react app',
|
|
73
|
+
skipHelp: false
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
runtime_store_js_1.default.set('payload.client.plugin', react.plugin);
|
|
76
77
|
return client_js_1.fillClientInitPayload(clientDirPath, clientName);
|
|
77
78
|
});
|
package/lib/init/util/client.js
CHANGED
|
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.
|
|
34
|
+
exports.addDependency = exports.clientNamePrompt = exports.directoryOverridePrompt = exports.fillClientInitPayload = void 0;
|
|
35
35
|
const ansi_colors_1 = require("ansi-colors");
|
|
36
36
|
const runtime_store_js_1 = __importDefault(require("../../runtime-store.js"));
|
|
37
37
|
const error_js_1 = __importDefault(require("../../error.js"));
|
|
@@ -77,12 +77,13 @@ function clientNamePrompt(question, defaultAns) {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
exports.clientNamePrompt = clientNamePrompt;
|
|
80
|
-
function
|
|
80
|
+
function addDependency(filePath, dep, { dev = false, depPath = [] } = {}) {
|
|
81
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
82
|
try {
|
|
83
83
|
const packageJson = yield ASYNC.readJSONFile(filePath);
|
|
84
84
|
if (packageJson) {
|
|
85
|
-
depPath.push('devDependencies');
|
|
85
|
+
depPath.push(dev ? 'devDependencies' : 'dependencies');
|
|
86
|
+
js_js_1.JS.assign(dep, js_js_1.JS.get(packageJson, depPath));
|
|
86
87
|
js_js_1.JS.set(packageJson, depPath, dep);
|
|
87
88
|
yield ASYNC.writeJSONFile(filePath, packageJson);
|
|
88
89
|
}
|
|
@@ -93,4 +94,4 @@ function addDevDep(filePath, dep, depPath = []) {
|
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
|
-
exports.
|
|
97
|
+
exports.addDependency = addDependency;
|
package/lib/optional-import.js
CHANGED
|
@@ -32,19 +32,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
const app_module_path_1 = __importDefault(require("app-module-path"));
|
|
35
|
-
const
|
|
36
|
-
const global_space_1 = __importDefault(require("./util_modules/global-space"));
|
|
35
|
+
const project_js_1 = require("./util_modules/project.js");
|
|
37
36
|
const path_1 = require("path");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const async_js_1 = require("./util_modules/fs/lib/async.js");
|
|
38
|
+
const error_js_1 = __importDefault(require("./error.js"));
|
|
39
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
40
|
+
exports.default = (name, source) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
if (name === path_1.basename(name)) {
|
|
42
|
+
const projectModulePath = project_js_1.resolveProjectPath(path_1.join(source, 'node_modules', name));
|
|
43
|
+
const projectModulePathExists = yield async_js_1.dirExists(projectModulePath);
|
|
44
|
+
if (!projectModulePathExists) {
|
|
45
|
+
throw new error_js_1.default('Module path does not exists', {
|
|
46
|
+
errorId: 'OPT-IMP-1',
|
|
47
|
+
arg: [ansi_colors_1.bold(name), ansi_colors_1.italic.red(projectModulePath), ansi_colors_1.bold(source)],
|
|
48
|
+
exit: 1
|
|
49
|
+
});
|
|
50
|
+
}
|
|
41
51
|
app_module_path_1.default.addPath(projectModulePath);
|
|
42
52
|
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
43
53
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
const projectModulePath = project_js_1.resolveProjectPath(name);
|
|
55
|
+
const projectModulePathExists = yield async_js_1.dirExists(projectModulePath);
|
|
56
|
+
if (!projectModulePathExists) {
|
|
57
|
+
throw new error_js_1.default('Module path does not exists', {
|
|
58
|
+
errorId: 'OPT-IMP-2',
|
|
59
|
+
arg: [ansi_colors_1.bold(name), ansi_colors_1.italic.red(projectModulePath), ansi_colors_1.bold(source)],
|
|
60
|
+
exit: 1
|
|
61
|
+
});
|
|
48
62
|
}
|
|
49
|
-
|
|
63
|
+
app_module_path_1.default.addPath(projectModulePath);
|
|
64
|
+
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
50
65
|
});
|
package/lib/plugin-loader.js
CHANGED
|
@@ -32,18 +32,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
const ansi_colors_1 = require("ansi-colors");
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
35
|
+
const error_js_1 = __importDefault(require("./error.js"));
|
|
36
|
+
const optional_import_js_1 = __importDefault(require("./optional-import.js"));
|
|
37
|
+
const runtime_store_js_1 = __importDefault(require("./runtime-store.js"));
|
|
38
|
+
const ClientConfig = __importStar(require("./util_modules/config/lib/client.js"));
|
|
39
|
+
const FunctionsConfig = __importStar(require("./util_modules/config/lib/functions.js"));
|
|
40
|
+
const config = {
|
|
41
|
+
client: {
|
|
42
|
+
plugin: ClientConfig.plugin,
|
|
43
|
+
source: ClientConfig.source
|
|
44
|
+
},
|
|
45
|
+
functions: {
|
|
46
|
+
plugin: FunctionsConfig.plugin,
|
|
47
|
+
source: FunctionsConfig.source
|
|
48
|
+
}
|
|
49
|
+
};
|
|
39
50
|
const loadedPlugins = {};
|
|
40
51
|
function pluginLoader(feature, name, source) {
|
|
41
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
53
|
+
const pluginConfig = config[feature];
|
|
54
|
+
if (pluginConfig === undefined) {
|
|
44
55
|
return;
|
|
45
56
|
}
|
|
46
|
-
const plugins =
|
|
57
|
+
const plugins = pluginConfig.plugin(name, source);
|
|
47
58
|
let specificPlugin;
|
|
48
59
|
if (typeof plugins === 'string') {
|
|
49
60
|
specificPlugin = plugins;
|
|
@@ -59,10 +70,10 @@ function pluginLoader(feature, name, source) {
|
|
|
59
70
|
pluginMod = loadedPlugins[specificPlugin];
|
|
60
71
|
}
|
|
61
72
|
else {
|
|
62
|
-
pluginMod = yield
|
|
73
|
+
pluginMod = yield optional_import_js_1.default(specificPlugin, pluginConfig.source());
|
|
63
74
|
}
|
|
64
75
|
if (pluginMod === undefined) {
|
|
65
|
-
throw new
|
|
76
|
+
throw new error_js_1.default(`Configured plugin could not be found for [${feature}:${name}] - ${specificPlugin}`, {
|
|
66
77
|
exit: 1,
|
|
67
78
|
errorId: 'PLG-LDR-1',
|
|
68
79
|
arg: [ansi_colors_1.italic.red(specificPlugin), ansi_colors_1.bold(name), ansi_colors_1.bold(feature)]
|
|
@@ -70,11 +81,11 @@ function pluginLoader(feature, name, source) {
|
|
|
70
81
|
}
|
|
71
82
|
loadedPlugins[specificPlugin] = pluginMod;
|
|
72
83
|
if (typeof pluginMod === 'function') {
|
|
73
|
-
|
|
84
|
+
runtime_store_js_1.default.set(`context.${feature}.plugins.${name}${source ? '.' + source : ''}`, specificPlugin);
|
|
74
85
|
return pluginMod;
|
|
75
86
|
}
|
|
76
87
|
else if (typeof pluginMod[name] === 'function') {
|
|
77
|
-
|
|
88
|
+
runtime_store_js_1.default.set(`context.${feature}.plugins.${name}${source ? '.' + source : ''}`, specificPlugin);
|
|
78
89
|
return pluginMod[name];
|
|
79
90
|
}
|
|
80
91
|
return;
|
|
@@ -39,8 +39,8 @@ function prepareScriptFile(dir, port) {
|
|
|
39
39
|
function stringInjector(source, anchorIdx, marker, inject) {
|
|
40
40
|
const headLastIdx = anchorIdx + marker.length;
|
|
41
41
|
const scriptPrefix = source.slice(0, headLastIdx);
|
|
42
|
-
const
|
|
43
|
-
return scriptPrefix + inject +
|
|
42
|
+
const scriptSuffix = source.slice(headLastIdx);
|
|
43
|
+
return scriptPrefix + inject + scriptSuffix;
|
|
44
44
|
}
|
|
45
45
|
function injectScript(scriptLocale, indexHtml) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -60,7 +60,7 @@ function reloadApp(event, path, liveSockets) {
|
|
|
60
60
|
}
|
|
61
61
|
function webClientServer(httpPort, source, homepage, enableWatch) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const
|
|
63
|
+
const eventListener = new events_1.EventEmitter();
|
|
64
64
|
const catalystTempDir = path_1.join(source, '.catalyst');
|
|
65
65
|
const socketServerPort = yield port_resolver_js_1.default.getFreePort(httpPort, 20, true);
|
|
66
66
|
const reloadScriptSrc = enableWatch
|
|
@@ -75,7 +75,7 @@ function webClientServer(httpPort, source, homepage, enableWatch) {
|
|
|
75
75
|
let watcherReady = false;
|
|
76
76
|
clientWatcher.on('error', (err) => {
|
|
77
77
|
watcherReady = false;
|
|
78
|
-
|
|
78
|
+
eventListener.emit('error', new error_js_1.default('client watcher error', {
|
|
79
79
|
original: err,
|
|
80
80
|
exit: 1,
|
|
81
81
|
skipHelp: true
|
|
@@ -112,9 +112,9 @@ function webClientServer(httpPort, source, homepage, enableWatch) {
|
|
|
112
112
|
reloadApp('Deletion of file(s) is', path_1.relative(source, path), liveSockets);
|
|
113
113
|
});
|
|
114
114
|
}, 1000);
|
|
115
|
-
|
|
115
|
+
eventListener.addListener('close', () => socketServer === null || socketServer === void 0 ? void 0 : socketServer.close());
|
|
116
116
|
});
|
|
117
|
-
|
|
117
|
+
eventListener.addListener('close', () => {
|
|
118
118
|
if (clientWatcher) {
|
|
119
119
|
clientWatcher.close();
|
|
120
120
|
}
|
|
@@ -130,7 +130,7 @@ function webClientServer(httpPort, source, homepage, enableWatch) {
|
|
|
130
130
|
(requestedFile.includes('.html') || requestedFile.includes('.htm'))) {
|
|
131
131
|
const homepageFile = yield index_js_2.ASYNC.readFile(path_1.join(source, homepage));
|
|
132
132
|
if (!homepageFile) {
|
|
133
|
-
|
|
133
|
+
eventListener.emit('error', new error_js_1.default('Unable to read the homepage file', {
|
|
134
134
|
exit: 1,
|
|
135
135
|
errorId: 'WEB-CLIENT-SERVER-1',
|
|
136
136
|
arg: [ansi_colors_1.red.italic(homepage)]
|
|
@@ -155,17 +155,17 @@ function webClientServer(httpPort, source, homepage, enableWatch) {
|
|
|
155
155
|
});
|
|
156
156
|
}));
|
|
157
157
|
const server = app.listen(httpPort).on('error', (err) => {
|
|
158
|
-
|
|
158
|
+
eventListener.emit('error', err);
|
|
159
159
|
});
|
|
160
|
-
|
|
160
|
+
eventListener.on('error', (err) => {
|
|
161
161
|
logger_js_1.error('Error when serving the web-client: ' + err.message);
|
|
162
162
|
logger_js_1.info('Please exit the command to get more info');
|
|
163
|
-
|
|
163
|
+
eventListener.emit('close');
|
|
164
164
|
});
|
|
165
|
-
|
|
165
|
+
eventListener.on('close', () => {
|
|
166
166
|
server.close(() => logger_js_1.debug('client server closed'));
|
|
167
167
|
});
|
|
168
|
-
return new Promise((res) => server.on('listening', () => res(
|
|
168
|
+
return new Promise((res) => server.on('listening', () => res(eventListener)));
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
exports.default = webClientServer;
|
package/lib/shell/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const fn_utils_1 = require("../fn-utils");
|
|
|
21
21
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
22
22
|
const constants_1 = require("../util_modules/constants");
|
|
23
23
|
const fs_1 = require("../util_modules/fs");
|
|
24
|
-
const
|
|
24
|
+
const logger_js_1 = require("../util_modules/logger.js");
|
|
25
25
|
const option_1 = require("../util_modules/option");
|
|
26
26
|
const http_functions_1 = __importDefault(require("./dependencies/http-functions"));
|
|
27
27
|
const local_function_1 = __importDefault(require("./dependencies/local-function"));
|
|
@@ -50,7 +50,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
50
50
|
.get('context.functions.targets', [])
|
|
51
51
|
.filter((target) => {
|
|
52
52
|
if (!target.valid) {
|
|
53
|
-
|
|
53
|
+
logger_js_1.warning('target [' +
|
|
54
54
|
target.name +
|
|
55
55
|
'] is not a valid one reason : ' +
|
|
56
56
|
target.failure_reason);
|
|
@@ -64,9 +64,13 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
replServer.start();
|
|
67
|
-
const watchOpt = option_1.getOptionValue('watch'
|
|
67
|
+
const watchOpt = option_1.getOptionValue('watch');
|
|
68
|
+
if (watchOpt === true) {
|
|
69
|
+
logger_js_1.info();
|
|
70
|
+
logger_js_1.labeled('DEPRECATED', `The ${ansi_colors_1.italic.bold('--watch')} option is deprecated. \nThe watch mode will be enabled by default. If you wish to disable it use the ${ansi_colors_1.italic.bold('--no-watch')} option. \nPlease execute ${ansi_colors_1.bold('catalyst functions:shell ' + ansi_colors_1.italic('--help'))} command for more usage details.`).WARN();
|
|
71
|
+
}
|
|
68
72
|
yield Promise.all(targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
if (watchOpt) {
|
|
73
|
+
if (watchOpt !== false) {
|
|
70
74
|
yield fn_watcher_1.default(target);
|
|
71
75
|
}
|
|
72
76
|
const localFn = new local_function_1.default(replServer, target);
|
|
@@ -85,8 +89,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
85
89
|
})));
|
|
86
90
|
yield fs_1.ASYNC.deleteDir(path_1.join(runtime_store_1.default.get('cwd'), '.build')).catch();
|
|
87
91
|
fn_utils_1.fnUtils.common.executeHook({ prefix: 'post', command: 'serve' });
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
logger_js_1.info();
|
|
93
|
+
logger_js_1.success('shell complete');
|
|
90
94
|
}
|
|
91
95
|
catch (e) {
|
|
92
96
|
yield Promise.all([
|
|
@@ -5,16 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.script = exports.ignore = exports.plugin = exports.source = exports.raw = void 0;
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
8
|
+
const error_js_1 = __importDefault(require("../../../error.js"));
|
|
9
|
+
const runtime_store_js_1 = __importDefault(require("../../../runtime-store.js"));
|
|
10
|
+
const file_names_js_1 = __importDefault(require("../../constants/lib/file-names.js"));
|
|
11
|
+
const folder_names_js_1 = __importDefault(require("../../constants/lib/folder-names.js"));
|
|
12
|
+
const js_js_1 = require("../../js.js");
|
|
13
13
|
function raw(throwError = false) {
|
|
14
|
-
const config =
|
|
14
|
+
const config = runtime_store_js_1.default.get('config', null);
|
|
15
15
|
if (config === null) {
|
|
16
16
|
if (throwError) {
|
|
17
|
-
throw new
|
|
17
|
+
throw new error_js_1.default(file_names_js_1.default.config + ' file is required', { exit: 2 });
|
|
18
18
|
}
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
@@ -23,13 +23,10 @@ function raw(throwError = false) {
|
|
|
23
23
|
exports.raw = raw;
|
|
24
24
|
function source() {
|
|
25
25
|
const clientConfig = raw();
|
|
26
|
-
return (clientConfig && clientConfig.source) ||
|
|
26
|
+
return (clientConfig && clientConfig.source) || folder_names_js_1.default.client;
|
|
27
27
|
}
|
|
28
28
|
exports.source = source;
|
|
29
|
-
function plugin(name
|
|
30
|
-
if (source) {
|
|
31
|
-
logger_1.debug('Source config not supported for client');
|
|
32
|
-
}
|
|
29
|
+
function plugin(name) {
|
|
33
30
|
const clientConfig = raw();
|
|
34
31
|
const rawPlugins = clientConfig && clientConfig.plugin;
|
|
35
32
|
if (!rawPlugins) {
|
|
@@ -55,17 +52,17 @@ function ignore(sourcePath) {
|
|
|
55
52
|
const clientConfig = raw();
|
|
56
53
|
const ignoreArr = (clientConfig && clientConfig.ignore) || [];
|
|
57
54
|
return ignoreArr.map((value) => {
|
|
58
|
-
if (
|
|
59
|
-
return '**' + path_1.sep +
|
|
55
|
+
if (js_js_1.JS.indexOf(value, path_1.sep) === js_js_1.JS.size(value) - 1) {
|
|
56
|
+
return '**' + path_1.sep + js_js_1.JS.initial(value).join('');
|
|
60
57
|
}
|
|
61
58
|
else {
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
64
|
-
? sourcePath +
|
|
59
|
+
if (js_js_1.JS.startsWith(value, path_1.sep)) {
|
|
60
|
+
return js_js_1.JS.endsWith(value, path_1.sep)
|
|
61
|
+
? sourcePath + js_js_1.JS.initial(value).join('')
|
|
65
62
|
: sourcePath + value;
|
|
66
63
|
}
|
|
67
|
-
return
|
|
68
|
-
? sourcePath + path_1.sep +
|
|
64
|
+
return js_js_1.JS.endsWith(value, path_1.sep)
|
|
65
|
+
? sourcePath + path_1.sep + js_js_1.JS.initial(value).join('')
|
|
69
66
|
: sourcePath + path_1.sep + value;
|
|
70
67
|
}
|
|
71
68
|
});
|
|
@@ -75,13 +72,13 @@ function script(name, fallback) {
|
|
|
75
72
|
const clientConfig = raw();
|
|
76
73
|
const rawScripts = clientConfig && (clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.scripts);
|
|
77
74
|
if (rawScripts === undefined && fallback === undefined) {
|
|
78
|
-
throw new
|
|
75
|
+
throw new error_js_1.default('Scripts not found', { exit: 2 });
|
|
79
76
|
}
|
|
80
77
|
if (name === undefined) {
|
|
81
78
|
return rawScripts || fallback;
|
|
82
79
|
}
|
|
83
80
|
if (rawScripts && rawScripts[name] === undefined && fallback === undefined) {
|
|
84
|
-
throw new
|
|
81
|
+
throw new error_js_1.default('Scripts not found', { exit: 2 });
|
|
85
82
|
}
|
|
86
83
|
return (rawScripts && rawScripts[name]) || fallback;
|
|
87
84
|
}
|
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
6
|
+
const env_js_1 = require("../../env.js");
|
|
7
|
+
const dc_js_1 = require("../../../dc.js");
|
|
8
|
+
const dc_type_js_1 = __importDefault(require("./dc-type.js"));
|
|
5
9
|
class URL {
|
|
6
10
|
static get auth() {
|
|
7
|
-
const dc =
|
|
11
|
+
const dc = dc_js_1.getActiveDCType();
|
|
8
12
|
if (dc === undefined) {
|
|
9
13
|
return URL._auth;
|
|
10
14
|
}
|
|
11
15
|
return URL._auth.replace('.com', dc.ext);
|
|
12
16
|
}
|
|
13
17
|
static get admin() {
|
|
14
|
-
const dc =
|
|
18
|
+
const dc = dc_js_1.getActiveDCType();
|
|
15
19
|
if (dc === undefined) {
|
|
16
20
|
return URL._admin;
|
|
17
21
|
}
|
|
18
22
|
return URL._admin.replace('.com', dc.ext);
|
|
19
23
|
}
|
|
20
24
|
static get app() {
|
|
21
|
-
const dc =
|
|
25
|
+
const dc = dc_js_1.getActiveDCType();
|
|
22
26
|
if (dc === undefined) {
|
|
23
27
|
return URL._app;
|
|
24
28
|
}
|
|
25
29
|
return URL._app.replace('.com', dc.ext);
|
|
26
30
|
}
|
|
27
31
|
static get catalystStatic() {
|
|
28
|
-
const dc =
|
|
32
|
+
const dc = dc_js_1.getActiveDCType();
|
|
29
33
|
if (dc === undefined) {
|
|
30
34
|
return URL._catalystStatic;
|
|
31
35
|
}
|
|
36
|
+
if (dc.ext === dc_type_js_1.default.in.ext) {
|
|
37
|
+
return URL._zohoStatic.replace(dc_type_js_1.default.us.ext, dc_type_js_1.default.in.ext);
|
|
38
|
+
}
|
|
32
39
|
return URL._catalystStatic.replace('.com', dc.ext);
|
|
33
40
|
}
|
|
34
41
|
static get console() {
|
|
35
|
-
const dc =
|
|
42
|
+
const dc = dc_js_1.getActiveDCType();
|
|
36
43
|
if (dc === undefined) {
|
|
37
44
|
return URL._console;
|
|
38
45
|
}
|
|
@@ -40,8 +47,9 @@ class URL {
|
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
49
|
exports.default = URL;
|
|
43
|
-
URL._auth =
|
|
44
|
-
URL._admin =
|
|
45
|
-
URL._app =
|
|
46
|
-
URL.
|
|
47
|
-
URL.
|
|
50
|
+
URL._auth = env_js_1.envOverride('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
|
|
51
|
+
URL._admin = env_js_1.envOverride('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
|
|
52
|
+
URL._app = env_js_1.envOverride('CATALYST_APP_URL', 'https://catalystserverless.com');
|
|
53
|
+
URL._zohoStatic = env_js_1.envOverride('ZOHO_STATIC', 'https://www.zoho.com/catalyst');
|
|
54
|
+
URL._catalystStatic = env_js_1.envOverride('CATALYST_STATIC', 'https://catalyst.zoho.com');
|
|
55
|
+
URL._console = env_js_1.envOverride('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
|
|
@@ -1,99 +1,2 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getYarnNodePth = exports.getNpmNodePth = void 0;
|
|
16
|
-
const shell_js_1 = require("./shell.js");
|
|
17
|
-
const plugin_js_1 = __importDefault(require("./constants/lib/plugin.js"));
|
|
18
|
-
const env_js_1 = require("./env.js");
|
|
19
|
-
const path_1 = require("path");
|
|
20
|
-
const index_js_1 = require("./fs/index.js");
|
|
21
|
-
const runtime_store_js_1 = __importDefault(require("../runtime-store.js"));
|
|
22
|
-
const logger_js_1 = require("./logger.js");
|
|
23
|
-
function getNpmNodePth() {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const cachedPath = runtime_store_js_1.default.get('npm.nodePath', false);
|
|
26
|
-
if (cachedPath) {
|
|
27
|
-
return cachedPath;
|
|
28
|
-
}
|
|
29
|
-
const spawnres = yield shell_js_1.spawn(plugin_js_1.default.mangaer.npm.command, plugin_js_1.default.mangaer.npm.opts, {
|
|
30
|
-
stdio: 'pipe'
|
|
31
|
-
}).ASYNC();
|
|
32
|
-
const nodePath = spawnres.stdout.replace(/\n/g, env_js_1.isWindows ? '\\node_modules' : '/lib/node_modules');
|
|
33
|
-
runtime_store_js_1.default.set('npm.nodePath', nodePath);
|
|
34
|
-
return nodePath;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
exports.getNpmNodePth = getNpmNodePth;
|
|
38
|
-
function getYarnNodePth() {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const cachedPath = runtime_store_js_1.default.get('yarn.nodePath', false);
|
|
41
|
-
if (cachedPath) {
|
|
42
|
-
return cachedPath;
|
|
43
|
-
}
|
|
44
|
-
const spawnres = yield shell_js_1.spawn(plugin_js_1.default.mangaer.yarn.command, plugin_js_1.default.mangaer.yarn.opts, {
|
|
45
|
-
stdio: 'pipe'
|
|
46
|
-
}).ASYNC();
|
|
47
|
-
const nodePath = spawnres.stdout.replace(/\n/g, path_1.sep + 'node_modules');
|
|
48
|
-
runtime_store_js_1.default.set('yarn.nodePath', nodePath);
|
|
49
|
-
return nodePath;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.getYarnNodePth = getYarnNodePth;
|
|
53
|
-
function findNpmPkg(pkgName, fallback) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
try {
|
|
56
|
-
const nodeModulesPath = yield getNpmNodePth().catch((err) => logger_js_1.debug(err));
|
|
57
|
-
const pkgPath = path_1.join(nodeModulesPath, pkgName);
|
|
58
|
-
return (yield index_js_1.ASYNC.dirExists(pkgPath)) ? pkgPath : fallback;
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
logger_js_1.debug('NPM pkg find error');
|
|
62
|
-
logger_js_1.debug(e);
|
|
63
|
-
}
|
|
64
|
-
return fallback;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function findYarnPkg(pkgName, fallback) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
try {
|
|
70
|
-
const nodeModulesPath = yield getYarnNodePth().catch((err) => logger_js_1.debug(err));
|
|
71
|
-
const pkgPath = path_1.join(nodeModulesPath, pkgName);
|
|
72
|
-
return (yield index_js_1.ASYNC.dirExists(pkgPath)) ? pkgPath : fallback;
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
logger_js_1.debug('YARN pkg find error');
|
|
76
|
-
logger_js_1.debug(e);
|
|
77
|
-
}
|
|
78
|
-
return fallback;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function findPkg(pkgName, fallback = false, pkgManager) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
if (pkgManager) {
|
|
84
|
-
return pkgManager === 'npm'
|
|
85
|
-
? findNpmPkg(pkgName, fallback)
|
|
86
|
-
: findYarnPkg(pkgName, fallback);
|
|
87
|
-
}
|
|
88
|
-
const npmPkg = yield findNpmPkg(pkgName, fallback);
|
|
89
|
-
if (npmPkg !== null) {
|
|
90
|
-
return npmPkg;
|
|
91
|
-
}
|
|
92
|
-
const yarnPkg = yield findYarnPkg(pkgName, fallback);
|
|
93
|
-
if (yarnPkg !== null) {
|
|
94
|
-
return yarnPkg;
|
|
95
|
-
}
|
|
96
|
-
return fallback;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
exports.default = findPkg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"better-queue": "^3.8.10",
|
|
31
31
|
"chokidar": "^3.5.2",
|
|
32
32
|
"cli-cursor": "^3.1.0",
|
|
33
|
-
"cli-table3": "
|
|
33
|
+
"cli-table3": "0.6.0",
|
|
34
34
|
"commander": "^8.2.0",
|
|
35
35
|
"conf": "^10.0.2",
|
|
36
36
|
"cross-spawn": "^7.0.3",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"ws": "^8.2.3",
|
|
57
57
|
"xml2js": "^0.4.23",
|
|
58
58
|
"yaml": "^1.10.2",
|
|
59
|
-
"zcatalyst-angular-schematics": "^0.0
|
|
59
|
+
"zcatalyst-angular-schematics": "^0.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/app-module-path": "^2.2.0",
|
|
@@ -156,10 +156,10 @@ public class BotHandler implements com.zc.cliq.interfaces.BotHandler {
|
|
|
156
156
|
String summary;
|
|
157
157
|
String bodyStr = new StringBuilder("*From*: ").append(reqBody.getString("fromAddress")).append("\n*Subject*: ").append(reqBody.getString("subject")).append("\n*Content*: ").append((summary = reqBody.getString("summary")).length() > 100 ? summary.substring(0, 100) : summary).toString();
|
|
158
158
|
Message msg = Message.getInstance(bodyStr);
|
|
159
|
-
msg.setBot("PostPerson", "https://
|
|
159
|
+
msg.setBot("PostPerson", "https://www.zoho.com/sites/default/files/catalyst/functions-images/icon-robot.jpg");
|
|
160
160
|
CardDetails card = CardDetails.getInstance();
|
|
161
161
|
card.setTitle("New Mail");
|
|
162
|
-
card.setThumbnail("https://
|
|
162
|
+
card.setThumbnail("https://www.zoho.com/sites/default/files/catalyst/functions-images/mail.svg");
|
|
163
163
|
msg.setCard(card);
|
|
164
164
|
|
|
165
165
|
ButtonObject button = new ButtonObject();
|
|
@@ -117,12 +117,11 @@ botHandler.webHookHandler(async (req, res) => {
|
|
|
117
117
|
const summary = reqBody.summary || '';
|
|
118
118
|
const bodyStr = `*From*: ${reqBody.fromAddress} \n *Subject*: ${reqBody.subject} \n *Content*: ${ summary.length > 100 ? summary.substring(0, 100): summary}`;
|
|
119
119
|
|
|
120
|
-
res.bot = res.newBotDetails('PostPerson',
|
|
121
|
-
'https://previews.123rf.com/images/nastyatrel/nastyatrel2006/nastyatrel200600035/149438272-flat-vector-illustration-chat-bot-icon-flat-line-style-vector-.jpg');
|
|
120
|
+
res.bot = res.newBotDetails('PostPerson', 'https://www.zoho.com/sites/default/files/catalyst/functions-images/icon-robot.jpg');
|
|
122
121
|
|
|
123
122
|
const card = res.newCard();
|
|
124
123
|
card.title = 'New Mail';
|
|
125
|
-
card.thumbnail = 'https://
|
|
124
|
+
card.thumbnail = 'https://www.zoho.com/sites/default/files/catalyst/functions-images/mail.svg';
|
|
126
125
|
res.card = card;
|
|
127
126
|
|
|
128
127
|
const button = res.newButton();
|