zcatalyst-cli 1.25.0 → 1.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/deploy/features/slate.js +58 -75
- package/lib/endpoints/lib/slate.d.ts +1 -1
- package/lib/endpoints/lib/slate.js +2 -2
- package/lib/internal/api.js +6 -3
- package/lib/progress.js +8 -1
- package/lib/slate-utils.js +0 -65
- package/package.json +2 -2
- package/scripts/send-notification.js +0 -107
|
@@ -25,89 +25,72 @@ const option_1 = require("../../util_modules/option");
|
|
|
25
25
|
const urls_1 = __importDefault(require("../../util_modules/constants/lib/urls"));
|
|
26
26
|
const project_1 = require("../../util_modules/project");
|
|
27
27
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
const dId = process.env.ZC_APP_DEPLOYMENT_BUILD_ID;
|
|
29
28
|
const env = getEnvironmentType();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return targ;
|
|
40
|
-
}
|
|
41
|
-
(0, logger_1.labeled)('Slate: ', 'Invalid Slate service ' + (0, ansi_colors_1.bold)(targ.name || 'Unknown')).ERROR();
|
|
42
|
-
(0, logger_1.error)('Reason: ' + ((_b = targ.validity) === null || _b === void 0 ? void 0 : _b.reason));
|
|
43
|
-
(0, logger_1.info)();
|
|
44
|
-
return false;
|
|
45
|
-
});
|
|
46
|
-
if (validTargets.length === 0) {
|
|
47
|
-
throw new error_1.default('No valid Slate services found to deploy', {
|
|
48
|
-
skipHelp: true
|
|
49
|
-
});
|
|
29
|
+
const targets = yield config_1.slateConfig.getAllTargetDetails(false);
|
|
30
|
+
if (!targets || targets.length === 0) {
|
|
31
|
+
throw new error_1.default('No targets found');
|
|
32
|
+
}
|
|
33
|
+
const filtered = slate_utils_1.slateUtils.filterTargets(targets);
|
|
34
|
+
const validTargets = filtered.filter((targ) => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
if ((_a = targ.validity) === null || _a === void 0 ? void 0 : _a.valid) {
|
|
37
|
+
return targ;
|
|
50
38
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
throbber.add(throbberName, {
|
|
60
|
-
text: `Preparing Slate[${targ.name}]`
|
|
61
|
-
});
|
|
62
|
-
const isAppExists = slateAppConfigs.find((app) => app.name === targ.name && app.app_type === 'cli');
|
|
63
|
-
const configDetails = !isAppExists
|
|
64
|
-
? (_a = (yield config_1.slateConfig.getTargetDetails(targ))) === null || _a === void 0 ? void 0 : _a.config
|
|
65
|
-
: undefined;
|
|
66
|
-
const deploymentName = configDetails === null || configDetails === void 0 ? void 0 : configDetails.deployment_name;
|
|
67
|
-
deploymentName ? configDetails === null || configDetails === void 0 ? true : delete configDetails.deployment_name : null;
|
|
68
|
-
const readStream = yield slate_utils_1.slateUtils.pack(targ.source);
|
|
69
|
-
throbber.remove(throbberName);
|
|
70
|
-
const response = yield (yield (0, endpoints_1.slateAPI)({ env })).deploy(readStream.stream, readStream.length, targ.name, '', deploymentName ? deploymentName : '', isAppExists === null || isAppExists === void 0 ? void 0 : isAppExists.id, configDetails ? JSON.stringify(configDetails) : '', (0, option_1.getOptionValue)('m') || '');
|
|
71
|
-
targ.details = response;
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
(0, logger_1.debug)(err);
|
|
75
|
-
_targ.validity = {
|
|
76
|
-
valid: false,
|
|
77
|
-
reason: error_1.default.getErrorInstance(err).message
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
prevRes.push(_targ);
|
|
81
|
-
return Promise.resolve(prevRes);
|
|
82
|
-
}), Promise.resolve([]));
|
|
83
|
-
const deployedValidTargets = deployRes.filter((targ) => {
|
|
84
|
-
var _a, _b, _c;
|
|
85
|
-
if (!((_a = targ.validity) === null || _a === void 0 ? void 0 : _a.valid)) {
|
|
86
|
-
(0, logger_1.warning)('Deploy of Slate [' +
|
|
87
|
-
targ.name +
|
|
88
|
-
'] was unsuccessful since ' +
|
|
89
|
-
((_b = targ.validity) === null || _b === void 0 ? void 0 : _b.reason));
|
|
90
|
-
}
|
|
91
|
-
return (_c = targ.validity) === null || _c === void 0 ? void 0 : _c.valid;
|
|
39
|
+
(0, logger_1.labeled)('Slate: ', 'Invalid Slate service ' + (0, ansi_colors_1.bold)(targ.name || 'Unknown')).ERROR();
|
|
40
|
+
(0, logger_1.error)('Reason: ' + ((_b = targ.validity) === null || _b === void 0 ? void 0 : _b.reason));
|
|
41
|
+
(0, logger_1.info)();
|
|
42
|
+
return false;
|
|
43
|
+
});
|
|
44
|
+
if (validTargets.length === 0) {
|
|
45
|
+
throw new error_1.default('No valid Slate services found to deploy', {
|
|
46
|
+
skipHelp: true
|
|
92
47
|
});
|
|
93
|
-
runtime_store_1.default.set('context.payload.slate.targets', deployedValidTargets);
|
|
94
|
-
if (deployedValidTargets.length > 0) {
|
|
95
|
-
runtime_store_1.default.set('context.payload.slate.deploy', true);
|
|
96
|
-
}
|
|
97
48
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
49
|
+
const slateAppConfigs = yield (yield (0, endpoints_1.slateAPI)({ env })).getAllApps();
|
|
50
|
+
const throbber = throbber_1.default.getInstance();
|
|
51
|
+
const deployRes = yield validTargets.reduce((result, _targ) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
var _a;
|
|
53
|
+
const targ = _targ;
|
|
54
|
+
const prevRes = yield result;
|
|
102
55
|
try {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
56
|
+
const throbberName = `prepare_slate_${targ.name}`;
|
|
57
|
+
throbber.add(throbberName, {
|
|
58
|
+
text: `Preparing Slate[${targ.name}]`
|
|
59
|
+
});
|
|
60
|
+
const isAppExists = slateAppConfigs.find((app) => app.name === targ.name && app.app_type === 'cli');
|
|
61
|
+
const configDetails = !isAppExists
|
|
62
|
+
? (_a = (yield config_1.slateConfig.getTargetDetails(targ))) === null || _a === void 0 ? void 0 : _a.config
|
|
63
|
+
: undefined;
|
|
64
|
+
const deploymentName = configDetails === null || configDetails === void 0 ? void 0 : configDetails.deployment_name;
|
|
65
|
+
deploymentName ? configDetails === null || configDetails === void 0 ? true : delete configDetails.deployment_name : null;
|
|
66
|
+
const readStream = yield slate_utils_1.slateUtils.pack(targ.source);
|
|
67
|
+
throbber.remove(throbberName);
|
|
68
|
+
const response = yield (yield (0, endpoints_1.slateAPI)({ env })).deploy(readStream.stream, readStream.length, targ.name, deploymentName ? deploymentName : '', isAppExists === null || isAppExists === void 0 ? void 0 : isAppExists.id, configDetails ? JSON.stringify(configDetails) : '', (0, option_1.getOptionValue)('m') || '');
|
|
69
|
+
targ.details = response;
|
|
107
70
|
}
|
|
108
71
|
catch (err) {
|
|
109
|
-
|
|
72
|
+
(0, logger_1.debug)(err);
|
|
73
|
+
_targ.validity = {
|
|
74
|
+
valid: false,
|
|
75
|
+
reason: error_1.default.getErrorInstance(err).message
|
|
76
|
+
};
|
|
110
77
|
}
|
|
78
|
+
prevRes.push(_targ);
|
|
79
|
+
return Promise.resolve(prevRes);
|
|
80
|
+
}), Promise.resolve([]));
|
|
81
|
+
const deployedValidTargets = deployRes.filter((targ) => {
|
|
82
|
+
var _a, _b, _c;
|
|
83
|
+
if (!((_a = targ.validity) === null || _a === void 0 ? void 0 : _a.valid)) {
|
|
84
|
+
(0, logger_1.warning)('Deploy of Slate [' +
|
|
85
|
+
targ.name +
|
|
86
|
+
'] was unsuccessful since ' +
|
|
87
|
+
((_b = targ.validity) === null || _b === void 0 ? void 0 : _b.reason));
|
|
88
|
+
}
|
|
89
|
+
return (_c = targ.validity) === null || _c === void 0 ? void 0 : _c.valid;
|
|
90
|
+
});
|
|
91
|
+
runtime_store_1.default.set('context.payload.slate.targets', deployedValidTargets);
|
|
92
|
+
if (deployedValidTargets.length > 0) {
|
|
93
|
+
runtime_store_1.default.set('context.payload.slate.deploy', true);
|
|
111
94
|
}
|
|
112
95
|
});
|
|
113
96
|
function getEnvironmentType() {
|
|
@@ -11,6 +11,6 @@ declare class Slate {
|
|
|
11
11
|
getFrameworks(): Promise<Array<FrameworkType>>;
|
|
12
12
|
getAllApps(): Promise<Array<ISlateAppInfo>>;
|
|
13
13
|
downloadTemplate(): Promise<unknown>;
|
|
14
|
-
deploy(sourceStream: ReadStream, contentLength: number, appName: string,
|
|
14
|
+
deploy(sourceStream: ReadStream, contentLength: number, appName: string, deploymentName?: string, appId?: string, config?: string, msg?: string): Promise<unknown>;
|
|
15
15
|
}
|
|
16
16
|
export default Slate;
|
|
@@ -62,9 +62,9 @@ class Slate {
|
|
|
62
62
|
throw new error_1.default('Error while downloading the template', { exit: 2 });
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
deploy(sourceStream, contentLength, appName,
|
|
65
|
+
deploy(sourceStream, contentLength, appName, deploymentName, appId, config, msg) {
|
|
66
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const formData = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
67
|
+
const formData = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ file: sourceStream }, (appId && { app_id: appId })), (deploymentName && { deployment_name: deploymentName })), (appId ? {} : { name: appName })), (config && { configuration: config })), (msg && { message: msg }));
|
|
68
68
|
const res = yield new api_1.default(this.opts).post(`/slate/v1/project/${this.projectId}/app/upload`, {
|
|
69
69
|
formData,
|
|
70
70
|
json: false,
|
package/lib/internal/api.js
CHANGED
|
@@ -122,9 +122,12 @@ class API {
|
|
|
122
122
|
}
|
|
123
123
|
_logUploadProgress({ chunk, error } = {}) {
|
|
124
124
|
if (this.uploadProgress) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
if (chunk) {
|
|
126
|
+
this.uploadProgress.tick(chunk.length);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
error ? this.uploadProgress.error(error) : this.uploadProgress.error();
|
|
130
|
+
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
133
|
_logDownloadProgress({ chunk, error } = {}) {
|
package/lib/progress.js
CHANGED
|
@@ -41,7 +41,14 @@ class Progress {
|
|
|
41
41
|
}
|
|
42
42
|
error(err) {
|
|
43
43
|
const msg = this.failure ? this.failure(err) : typeof err === 'string' ? err : err === null || err === void 0 ? void 0 : err.message;
|
|
44
|
-
|
|
44
|
+
if (msg) {
|
|
45
|
+
if (this.throbber.pick(this.title)) {
|
|
46
|
+
this.throbber.fail(this.title, { text: msg });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.throbber.remove(this.title);
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
tick(count = 1) {
|
|
47
54
|
let prependedHeader = '';
|
package/lib/slate-utils.js
CHANGED
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.validateServeCommand = exports.slateUtils = void 0;
|
|
16
16
|
const ansi_colors_1 = require("ansi-colors");
|
|
17
|
-
const fs_extra_1 = require("fs-extra");
|
|
18
17
|
const path_1 = require("path");
|
|
19
18
|
const archiver_1 = __importDefault(require("./archiver"));
|
|
20
19
|
const error_1 = __importDefault(require("./error"));
|
|
@@ -24,8 +23,6 @@ const option_1 = require("./util_modules/option");
|
|
|
24
23
|
const constants_1 = require("./util_modules/constants");
|
|
25
24
|
const logger_1 = require("./util_modules/logger");
|
|
26
25
|
const minimatch_1 = __importDefault(require("minimatch"));
|
|
27
|
-
const env_1 = require("./util_modules/env");
|
|
28
|
-
const async_1 = require("./util_modules/fs/lib/async");
|
|
29
26
|
exports.slateUtils = {
|
|
30
27
|
validate: (source) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
28
|
const sourceDirExists = yield fs_1.ASYNC.dirExists(source);
|
|
@@ -101,68 +98,6 @@ exports.slateUtils = {
|
|
|
101
98
|
return refinedTargets;
|
|
102
99
|
},
|
|
103
100
|
pack: (source) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
-
if (env_1.isCI) {
|
|
105
|
-
source = source !== null && source !== void 0 ? source : runtime_store_1.default.get('cwd');
|
|
106
|
-
const tempDir = (0, path_1.resolve)(constants_1.FOLDERNAME.slate);
|
|
107
|
-
if (!(yield (0, async_1.dirExists)(tempDir))) {
|
|
108
|
-
(0, fs_extra_1.mkdir)(tempDir);
|
|
109
|
-
const excludePatterns = [
|
|
110
|
-
'**/.catalyst',
|
|
111
|
-
`**/${constants_1.FILENAME.log}`,
|
|
112
|
-
`**/${constants_1.FILENAME.config}`,
|
|
113
|
-
`**/${constants_1.FILENAME.rc}`,
|
|
114
|
-
`**/${constants_1.FILENAME.app_config}`,
|
|
115
|
-
`**/${constants_1.FILENAME.catalyst_ignore}`
|
|
116
|
-
];
|
|
117
|
-
const files = yield fs_1.ASYNC.walk(source, {
|
|
118
|
-
filter: {
|
|
119
|
-
exclude: (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
-
return !!excludePatterns.find((glob) => (0, minimatch_1.default)(path.replace(source + path_1.sep, ''), glob, {
|
|
121
|
-
dot: true
|
|
122
|
-
}));
|
|
123
|
-
}),
|
|
124
|
-
excludeDir: true
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
const zip = new archiver_1.default('static');
|
|
128
|
-
const fileArr = [];
|
|
129
|
-
files.forEach((file) => {
|
|
130
|
-
fileArr.push({
|
|
131
|
-
path: (0, path_1.relative)(source, file.path),
|
|
132
|
-
type: (0, path_1.extname)(file.path).replace('.', '').toUpperCase() || '',
|
|
133
|
-
size: file.stats.size
|
|
134
|
-
});
|
|
135
|
-
zip.add(file.path.replace(source + path_1.sep, ''), file.stats.isSymbolicLink()
|
|
136
|
-
? fs_1.SYNC.readSymLink(file.path)
|
|
137
|
-
: fs_1.SYNC.getReadStream(file.path), {
|
|
138
|
-
mode: file.stats.mode
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
const zipFinalizer = yield zip.finalize();
|
|
142
|
-
const staticZip = (0, path_1.join)(tempDir, constants_1.FILENAME.slate.static_zip);
|
|
143
|
-
yield zipFinalizer.writeZip(staticZip);
|
|
144
|
-
const content = {
|
|
145
|
-
version: '',
|
|
146
|
-
framework: process.env.ZC_FRAMEWORK,
|
|
147
|
-
runtime: '',
|
|
148
|
-
static: fileArr
|
|
149
|
-
};
|
|
150
|
-
const configJson = (0, path_1.join)(tempDir, constants_1.FILENAME.slate.config_json);
|
|
151
|
-
fs_1.SYNC.writeFile(configJson, JSON.stringify(content, null, 2) + '\n');
|
|
152
|
-
}
|
|
153
|
-
const slateZip = yield fs_1.ASYNC.walk(tempDir, { includeDirPaths: false });
|
|
154
|
-
const zipWithJson = new archiver_1.default();
|
|
155
|
-
slateZip.forEach((file) => {
|
|
156
|
-
zipWithJson.add(file.path.replace(tempDir + path_1.sep, ''), file.stats.isSymbolicLink()
|
|
157
|
-
? fs_1.SYNC.readSymLink(file.path)
|
|
158
|
-
: fs_1.SYNC.getReadStream(file.path), {
|
|
159
|
-
mode: file.stats.mode
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
const zipFinalizerWithJson = yield zipWithJson.finalize();
|
|
163
|
-
yield fs_1.ASYNC.deleteDir(tempDir);
|
|
164
|
-
return yield zipFinalizerWithJson.fsStream();
|
|
165
|
-
}
|
|
166
101
|
const excludePatterns = [
|
|
167
102
|
'**/.DS_Store',
|
|
168
103
|
'**/.catalyst',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.2",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -112,6 +112,6 @@
|
|
|
112
112
|
"files": [
|
|
113
113
|
"lib/**/*",
|
|
114
114
|
"templates/**/*",
|
|
115
|
-
"scripts
|
|
115
|
+
"scripts/postInstall.js"
|
|
116
116
|
]
|
|
117
117
|
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
-
|
|
4
|
-
const PACKAGE_JSON = require('../package.json');
|
|
5
|
-
const HTTPS = require('https');
|
|
6
|
-
const VERSION = PACKAGE_JSON.version;
|
|
7
|
-
const NPM_REGISTRY_LINK = process.env.NPM_REGISTRY_LINK;
|
|
8
|
-
const RELEASE_NOTES_LINK = process.env.RELEASE_NOTES_LINK;
|
|
9
|
-
const API_KEY = process.env.API_KEY;
|
|
10
|
-
const MERGE_REQUEST_ID = process.env.CI_MERGE_REQUEST_IID;
|
|
11
|
-
|
|
12
|
-
const INSTALL_COMMAND = `npm install -g zcatalyst-cli@${VERSION}`;
|
|
13
|
-
const CHANNEL_NAMES = (process.env.CHANNEL_NAMES || '').split(',');
|
|
14
|
-
|
|
15
|
-
const notify = async () => {
|
|
16
|
-
let text = `Hey Team, we've released a new version of [ZCatalyst-CLI](${NPM_REGISTRY_LINK}) :fireworks: \n\n *Version:* \`v${VERSION}\``;
|
|
17
|
-
|
|
18
|
-
if (MERGE_REQUEST_ID) {
|
|
19
|
-
text =
|
|
20
|
-
text +
|
|
21
|
-
`\n* [Pipeline status](https://git.csez.zohocorpin.com/BaaS/ZCatalyst-CLI/-/merge_requests/${MERGE_REQUEST_ID}/pipelines)`;
|
|
22
|
-
}
|
|
23
|
-
const message = {
|
|
24
|
-
text,
|
|
25
|
-
bot: {
|
|
26
|
-
name: 'Dx Tools Update',
|
|
27
|
-
image: 'https://www.zoho.com/sites/zweb/images/producticon/catalyst.svg'
|
|
28
|
-
},
|
|
29
|
-
card: {
|
|
30
|
-
title: 'Announcement',
|
|
31
|
-
thumbnail: 'https://public-catlab-development.zohostratus.in/megaphone.gif',
|
|
32
|
-
theme: 'modern-inline'
|
|
33
|
-
},
|
|
34
|
-
slides: [
|
|
35
|
-
{
|
|
36
|
-
type: 'text',
|
|
37
|
-
title: 'Installation Command',
|
|
38
|
-
data: '```' + INSTALL_COMMAND + '```'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'text',
|
|
42
|
-
title: 'Release Notes',
|
|
43
|
-
data: `${RELEASE_NOTES_LINK}`
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
if (!CHANNEL_NAMES || !Array.isArray(CHANNEL_NAMES) || CHANNEL_NAMES.length === 0) {
|
|
49
|
-
console.error('Invalid channels: ' + process.env.CHANNEL_NAMES);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
await Promise.all(
|
|
54
|
-
CHANNEL_NAMES.map((channel) => {
|
|
55
|
-
return new Promise((resolve, reject) => {
|
|
56
|
-
try {
|
|
57
|
-
const reqOpts = {
|
|
58
|
-
hostname: 'cliq.zoho.com',
|
|
59
|
-
path: `/company/64396901/api/v2/channelsbyname/${channel}/message?zapikey=${API_KEY}`,
|
|
60
|
-
qs: {},
|
|
61
|
-
method: 'POST',
|
|
62
|
-
headers: {
|
|
63
|
-
'content-type': 'application/json'
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const req = HTTPS.request(reqOpts, async (res) => {
|
|
67
|
-
if (res.statusCode === 204) {
|
|
68
|
-
console.log('Notification successful: ' + channel);
|
|
69
|
-
return resolve();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const data = [];
|
|
73
|
-
res.on('data', (chunk) => {
|
|
74
|
-
data.push(chunk);
|
|
75
|
-
});
|
|
76
|
-
res.on('end', () => {
|
|
77
|
-
const resStr = Buffer.concat(data).toString();
|
|
78
|
-
reject(
|
|
79
|
-
new Error(
|
|
80
|
-
`API ERROR ::: ${req.method} ::: https://${req.host}${req.path} ::: ${res.statusCode} ::: ${resStr}`
|
|
81
|
-
)
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
req.on('error', reject);
|
|
86
|
-
req.write(JSON.stringify(message));
|
|
87
|
-
req.end();
|
|
88
|
-
} catch (er) {
|
|
89
|
-
if (er instanceof Error) {
|
|
90
|
-
return reject(er);
|
|
91
|
-
}
|
|
92
|
-
const error = new Error();
|
|
93
|
-
error.cause = er;
|
|
94
|
-
return reject(error);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
})
|
|
98
|
-
).catch((er) => {
|
|
99
|
-
console.error('Error sending notifications: ', er);
|
|
100
|
-
process.exit(1);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
console.log('All Notifications sent successfully');
|
|
104
|
-
process.exit(0);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
notify();
|