zcatalyst-cli 1.18.1 → 1.20.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/commands/signals/generate/index.toml +19 -0
- package/lib/commands/event/generate/index.js +8 -2
- package/lib/commands/index.js +1 -0
- package/lib/commands/signals/generate/index.js +214 -0
- package/lib/event_generate/cache.js +35 -33
- package/lib/event_generate/custom.js +15 -19
- package/lib/event_generate/datastore.js +60 -56
- package/lib/event_generate/filestore.js +51 -47
- package/lib/event_generate/github.js +19 -18
- package/lib/event_generate/stratus.js +52 -38
- package/lib/event_generate/user.js +33 -29
- package/lib/event_generate/webapp.js +33 -32
- package/lib/init/features/appsail/index.js +1 -1
- package/lib/init/features/project.js +54 -3
- package/lib/serve/server/lib/master/appsail.js +7 -2
- package/lib/shell/dependencies/local-function.js +1 -1
- package/lib/util_modules/constants/index.js +7 -1
- package/lib/util_modules/constants/lib/placeholders.js +16 -0
- package/lib/util_modules/constants/lib/signals-api-names.js +19 -0
- package/lib/util_modules/constants/lib/signals-publishers-type.js +27 -0
- package/lib/util_modules/constants/lib/signals-publishers.js +10 -0
- package/lib/util_modules/constants/lib/template.js +1 -0
- package/package.json +1 -1
- package/scripts/send-notification.js +99 -0
- package/templates/event/signals.json +26 -0
- package/templates/projectSuccess.html +391 -0
|
@@ -12,23 +12,24 @@ 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
|
+
exports.getData = exports.sourceId = void 0;
|
|
15
16
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
16
|
-
const constants_1 = require("../util_modules/constants");
|
|
17
17
|
const js_1 = require("../util_modules/js");
|
|
18
|
-
exports.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
18
|
+
exports.sourceId = 'NULL';
|
|
19
|
+
function getData() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const repoName = js_1.JS.randomString(5);
|
|
22
|
+
const displayName = runtime_store_1.default.get('user.Display_Name');
|
|
23
|
+
return {
|
|
24
|
+
archive_url: `https://api.github.com/repos/${displayName}/${repoName}/`,
|
|
25
|
+
full_name: `${displayName}/${repoName}`,
|
|
26
|
+
clone_url: `https://github.com/${displayName}/${repoName}.git`,
|
|
27
|
+
name: `${repoName}`,
|
|
28
|
+
created_at: Date.now(),
|
|
29
|
+
deployment_status: 'none',
|
|
30
|
+
default_branch: 'master',
|
|
31
|
+
id: js_1.JS.randomNumber(15)
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.getData = getData;
|
|
@@ -1,52 +1,66 @@
|
|
|
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
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getData = exports.sourceId = void 0;
|
|
6
16
|
const moment_1 = __importDefault(require("moment"));
|
|
7
17
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
8
|
-
const constants_1 = require("../util_modules/constants");
|
|
9
18
|
const js_1 = require("../util_modules/js");
|
|
10
19
|
const project_1 = require("../util_modules/project");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
modified_by: userDetails,
|
|
32
|
-
modified_time: time,
|
|
33
|
-
bucket_meta: {
|
|
34
|
-
versioning: getRandomBoolean(),
|
|
35
|
-
caching: {
|
|
36
|
-
status: getRandomBoolean() ? 'Enabled' : 'Disabled'
|
|
20
|
+
exports.sourceId = 'NULL';
|
|
21
|
+
function getData() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const userDetails = {
|
|
24
|
+
email_id: runtime_store_1.default.get('user.Email'),
|
|
25
|
+
user_type: 'Admin',
|
|
26
|
+
user_id: js_1.JS.randomNumber(15),
|
|
27
|
+
is_confirmed: getRandomBoolean(),
|
|
28
|
+
last_name: js_1.JS.randomString(5),
|
|
29
|
+
first_name: js_1.JS.randomString(10),
|
|
30
|
+
zuid: js_1.JS.randomNumber(10)
|
|
31
|
+
};
|
|
32
|
+
const time = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
|
|
33
|
+
return {
|
|
34
|
+
action_time: js_1.JS.randomNumber(15),
|
|
35
|
+
bucket_details: {
|
|
36
|
+
project_details: {
|
|
37
|
+
id: (0, project_1.getProjectId)(),
|
|
38
|
+
project_name: (0, project_1.getProjectName)(),
|
|
39
|
+
project_type: 'Live'
|
|
37
40
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
created_time: time,
|
|
42
|
+
modified_time: time,
|
|
43
|
+
bucket_name: 'sample-bucket',
|
|
44
|
+
modified_by: userDetails,
|
|
45
|
+
created_by: userDetails,
|
|
46
|
+
bucket_meta: {
|
|
47
|
+
versioning: getRandomBoolean(),
|
|
48
|
+
encryption: getRandomBoolean(),
|
|
49
|
+
audit_consent: getRandomBoolean(),
|
|
50
|
+
caching: {
|
|
51
|
+
status: getRandomBoolean() ? 'Enabled' : 'Disabled'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
object_details: [
|
|
56
|
+
{
|
|
57
|
+
key: 'sample.txt'
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
});
|
|
48
62
|
}
|
|
49
|
-
exports.
|
|
63
|
+
exports.getData = getData;
|
|
50
64
|
function getRandomBoolean() {
|
|
51
65
|
return js_1.JS.random(0, 1) === 1;
|
|
52
66
|
}
|
|
@@ -12,36 +12,40 @@ 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
|
+
exports.getData = exports.sourceId = void 0;
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
17
|
-
const constants_1 = require("../util_modules/constants");
|
|
18
18
|
const js_1 = require("../util_modules/js");
|
|
19
|
-
exports.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
exports.sourceId = 'NULL';
|
|
20
|
+
function getData() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mockTime = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
|
|
23
|
+
return {
|
|
24
|
+
platform_type: 'web',
|
|
25
|
+
user_details: {
|
|
26
|
+
email_id: runtime_store_1.default.get('user.Email'),
|
|
27
|
+
created_time: mockTime,
|
|
28
|
+
is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
|
|
29
|
+
last_name: '',
|
|
30
|
+
source: '',
|
|
31
|
+
zuid: js_1.JS.randomNumber(10),
|
|
32
|
+
role_details: {
|
|
33
|
+
role_name: 'App User',
|
|
34
|
+
role_id: js_1.JS.randomNumber(10)
|
|
35
|
+
},
|
|
36
|
+
zaaid: js_1.JS.randomNumber(10),
|
|
37
|
+
invited_time: mockTime,
|
|
38
|
+
modified_time: mockTime,
|
|
39
|
+
user_type: 'App User',
|
|
40
|
+
user_id: js_1.JS.randomNumber(10),
|
|
41
|
+
org_id: js_1.JS.randomNumber(10),
|
|
42
|
+
first_name: js_1.JS.randomString(10),
|
|
43
|
+
status: 'ACTIVE'
|
|
28
44
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
first_name: js_1.JS.randomString(10),
|
|
37
|
-
zuid: js_1.JS.randomNumber(10),
|
|
38
|
-
status: 'ACTIVE'
|
|
39
|
-
},
|
|
40
|
-
org_id: js_1.JS.randomNumber(10),
|
|
41
|
-
zaid: js_1.JS.randomNumber(10),
|
|
42
|
-
redirect_url: null
|
|
43
|
-
};
|
|
44
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
|
|
45
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
|
|
46
|
-
return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
|
|
47
|
-
});
|
|
45
|
+
org_id: js_1.JS.randomNumber(10),
|
|
46
|
+
zaid: js_1.JS.randomNumber(10),
|
|
47
|
+
redirect_url: ''
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.getData = getData;
|
|
@@ -12,41 +12,42 @@ 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
|
+
exports.getData = exports.sourceId = void 0;
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const endpoints_1 = require("../endpoints");
|
|
17
18
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
18
|
-
const constants_1 = require("../util_modules/constants");
|
|
19
19
|
const js_1 = require("../util_modules/js");
|
|
20
20
|
const project_1 = require("../util_modules/project");
|
|
21
|
-
exports.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
exports.sourceId = 'NULL';
|
|
22
|
+
function getData() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const webappDetails = (yield (yield (0, endpoints_1.clientAPI)()).getWebappDetails());
|
|
25
|
+
const selectedWebapp = webappDetails !== undefined && Object.keys(webappDetails).length > 0
|
|
26
|
+
? webappDetails
|
|
27
|
+
: {
|
|
28
|
+
app_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
|
|
29
|
+
app_id: js_1.JS.randomNumber(15),
|
|
30
|
+
url_prefix: (0, project_1.getDomainPrefix)()
|
|
31
|
+
};
|
|
32
|
+
const userDetails = {
|
|
33
|
+
email_id: runtime_store_1.default.get('user.Email'),
|
|
34
|
+
user_id: js_1.JS.randomNumber(15),
|
|
35
|
+
is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
|
|
36
|
+
last_name: js_1.JS.randomString(5),
|
|
37
|
+
first_name: js_1.JS.randomString(10),
|
|
38
|
+
zuid: js_1.JS.randomNumber(10)
|
|
29
39
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
app_name: selectedWebapp.app_name,
|
|
45
|
-
uploaded_by: userDetails,
|
|
46
|
-
app_id: selectedWebapp.app_id,
|
|
47
|
-
url_prefix: selectedWebapp.url_prefix
|
|
48
|
-
};
|
|
49
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
|
|
50
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
|
|
51
|
-
return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
|
|
52
|
-
});
|
|
40
|
+
return {
|
|
41
|
+
uploaded_time: (0, moment_1.default)().format('MMM DD, YYYY hh:mm A'),
|
|
42
|
+
project_details: {
|
|
43
|
+
id: (0, project_1.getProjectId)(),
|
|
44
|
+
project_name: (0, project_1.getProjectName)()
|
|
45
|
+
},
|
|
46
|
+
app_name: selectedWebapp.app_name,
|
|
47
|
+
uploaded_by: userDetails,
|
|
48
|
+
app_id: selectedWebapp.app_id,
|
|
49
|
+
url_prefix: selectedWebapp.url_prefix
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.getData = getData;
|
|
@@ -114,7 +114,7 @@ function getAppSailZip() {
|
|
|
114
114
|
}
|
|
115
115
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
116
|
const curCommand = (0, option_1.getCurrentCommand)();
|
|
117
|
-
const gitPrompt = yield prompt_1.default.ask(prompt_1.default.question('gitClone', 'Do you want to get-started with a list of
|
|
117
|
+
const gitPrompt = yield prompt_1.default.ask(prompt_1.default.question('gitClone', 'Do you want to get-started with a list of example AppSails?', {
|
|
118
118
|
type: 'confirm',
|
|
119
119
|
default: true,
|
|
120
120
|
when: curCommand === 'init'
|
|
@@ -31,6 +31,11 @@ const client_1 = require("../util/client");
|
|
|
31
31
|
const runtime_1 = __importDefault(require("../../util_modules/constants/lib/runtime"));
|
|
32
32
|
const fn_utils_1 = require("../../fn-utils");
|
|
33
33
|
const client_utils_1 = require("../../client-utils");
|
|
34
|
+
const port_resolver_1 = __importDefault(require("../../port-resolver"));
|
|
35
|
+
const http_1 = require("http");
|
|
36
|
+
const fs_1 = require("../../util_modules/fs");
|
|
37
|
+
const server_1 = require("../../util_modules/server");
|
|
38
|
+
const open_1 = __importDefault(require("open"));
|
|
34
39
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
40
|
var _a, _b;
|
|
36
41
|
const orgAPI = yield (0, endpoints_1.orgAPI)();
|
|
@@ -95,10 +100,56 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
95
100
|
return (0, project_2.fillProjectPayload)(selectedOrg, selectedProject);
|
|
96
101
|
}
|
|
97
102
|
if (selectedProject === 0) {
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
let projectId = null;
|
|
104
|
+
const userActionError = yield new Promise((res, rej) => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
+
const callbackPort = yield port_resolver_1.default.getFreePort(3000, 10, false);
|
|
106
|
+
const accessUrl = new URL(`/baas/${(0, project_1.getEnvId)()}/index#/?port=${callbackPort}&type=cli`, `${constants_1.ORIGIN.admin}`);
|
|
107
|
+
const server = (0, http_1.createServer)((req, resp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
var _c, _d;
|
|
109
|
+
try {
|
|
110
|
+
if (!((_c = req.url) === null || _c === void 0 ? void 0 : _c.includes('/success'))) {
|
|
111
|
+
resp.writeHead(404);
|
|
112
|
+
resp.end();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const htmlFile = yield fs_1.ASYNC.readFile((0, path_1.join)(__dirname, '../../../templates/projectSuccess.html'));
|
|
116
|
+
projectId = (_d = req.url) === null || _d === void 0 ? void 0 : _d.split('?')[1].split('=')[1];
|
|
117
|
+
resp.setHeader('Content-Type', 'text/html');
|
|
118
|
+
resp.writeHead(200);
|
|
119
|
+
resp.end(htmlFile, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
+
req.socket.destroy();
|
|
121
|
+
yield destroyer.destroy().catch((err) => (0, logger_1.debug)(err));
|
|
122
|
+
res();
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
yield destroyer.destroy().catch((err) => (0, logger_1.debug)(err));
|
|
127
|
+
res(e);
|
|
128
|
+
}
|
|
129
|
+
}));
|
|
130
|
+
const destroyer = new server_1.ConnectionDestroyer(server);
|
|
131
|
+
server.listen(callbackPort, '127.0.0.1', () => {
|
|
132
|
+
const urlString = accessUrl.toString();
|
|
133
|
+
(0, logger_1.info)();
|
|
134
|
+
(0, logger_1.info)('Visit this URL on this device to proceed:');
|
|
135
|
+
(0, logger_1.info)(ansi_colors_1.bold.underline(urlString));
|
|
136
|
+
(0, logger_1.info)();
|
|
137
|
+
(0, open_1.default)(urlString).catch();
|
|
138
|
+
});
|
|
139
|
+
server.on('error', (err) => {
|
|
140
|
+
rej(err);
|
|
141
|
+
});
|
|
100
142
|
}));
|
|
101
|
-
|
|
143
|
+
if (userActionError) {
|
|
144
|
+
throw new error_1.default('Error while verifying user action', {
|
|
145
|
+
original: userActionError,
|
|
146
|
+
exit: 2
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (projectId === null) {
|
|
150
|
+
throw new error_1.default('Project ID not found', { exit: 2 });
|
|
151
|
+
}
|
|
152
|
+
selectedProject = yield projectAPI.getProject(projectId);
|
|
102
153
|
return (0, project_2.fillProjectPayload)(selectedOrg, selectedProject, true);
|
|
103
154
|
}
|
|
104
155
|
const [zipArchive, template, importRes] = yield (0, import_1.iacImport)();
|
|
@@ -36,6 +36,7 @@ function addAppSailRoutes(app, details, proxy, unknownProxy) {
|
|
|
36
36
|
req.url = req.originalUrl;
|
|
37
37
|
unknownProxy(req, res);
|
|
38
38
|
});
|
|
39
|
+
const targetUrl = `http://127.0.0.1:${details.target.port.appsail}`;
|
|
39
40
|
app.use('/', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
var _c, _d;
|
|
41
42
|
if (req.header('catalyst-component') === 'true') {
|
|
@@ -45,9 +46,13 @@ function addAppSailRoutes(app, details, proxy, unknownProxy) {
|
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
proxy.web(req, res, {
|
|
48
|
-
target:
|
|
49
|
-
ws: true
|
|
49
|
+
target: targetUrl
|
|
50
50
|
});
|
|
51
51
|
}));
|
|
52
|
+
app.addListener('upgrade', (req, socket, head) => {
|
|
53
|
+
proxy.ws(req, socket, head, {
|
|
54
|
+
target: targetUrl
|
|
55
|
+
});
|
|
56
|
+
});
|
|
52
57
|
}
|
|
53
58
|
exports.addAppSailRoutes = addAppSailRoutes;
|
|
@@ -76,7 +76,7 @@ class LocalFunction {
|
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case constants_1.FN_TYPE.event:
|
|
79
|
-
if (!('event_bus_details' in rawData)) {
|
|
79
|
+
if (!('event_bus_details' in rawData) && !('events' in rawData)) {
|
|
80
80
|
(0, logger_1.info)('For event function kindly use event:generate command to generate the input json.');
|
|
81
81
|
(0, logger_1.info)('You can also provide event details as per documentation.');
|
|
82
82
|
return new error_1.default('Event bus details missing');
|
|
@@ -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.NEEDED_SCOPES = exports.ENVPATH = exports.RUNTIME = 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.SIGNALS_API_NAMES = exports.SIGNALS_PUBLISHERS = exports.SIGNALS_PUBLISHERS_TYPE = exports.NEEDED_SCOPES = exports.ENVPATH = exports.RUNTIME = 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");
|
|
@@ -50,3 +50,9 @@ var env_path_1 = require("./lib/env-path");
|
|
|
50
50
|
Object.defineProperty(exports, "ENVPATH", { enumerable: true, get: function () { return __importDefault(env_path_1).default; } });
|
|
51
51
|
var needed_scopes_1 = require("./lib/needed-scopes");
|
|
52
52
|
Object.defineProperty(exports, "NEEDED_SCOPES", { enumerable: true, get: function () { return __importDefault(needed_scopes_1).default; } });
|
|
53
|
+
var signals_publishers_type_1 = require("./lib/signals-publishers-type");
|
|
54
|
+
Object.defineProperty(exports, "SIGNALS_PUBLISHERS_TYPE", { enumerable: true, get: function () { return __importDefault(signals_publishers_type_1).default; } });
|
|
55
|
+
var signals_publishers_1 = require("./lib/signals-publishers");
|
|
56
|
+
Object.defineProperty(exports, "SIGNALS_PUBLISHERS", { enumerable: true, get: function () { return __importDefault(signals_publishers_1).default; } });
|
|
57
|
+
var signals_api_names_1 = require("./lib/signals-api-names");
|
|
58
|
+
Object.defineProperty(exports, "SIGNALS_API_NAMES", { enumerable: true, get: function () { return __importDefault(signals_api_names_1).default; } });
|
|
@@ -39,6 +39,22 @@ exports.default = Object.freeze({
|
|
|
39
39
|
data: '{{__DATA__}}',
|
|
40
40
|
rule_id: '{{__RULE_ID__}}'
|
|
41
41
|
},
|
|
42
|
+
signal_event_data: {
|
|
43
|
+
version: '{{__VERSION__}}',
|
|
44
|
+
org_id: '{{__ORG_ID__}}',
|
|
45
|
+
project_id: '{{__PROJECT_ID__}}',
|
|
46
|
+
project_name: '{{__PROJECT_NAME__}}',
|
|
47
|
+
environment: '{{__ENVIRONMENT__}}',
|
|
48
|
+
uuid: '{{__UUID__}}',
|
|
49
|
+
source: '{{__SOURCE__}}',
|
|
50
|
+
signal_id: '{{__SIGNAL_ID__}}',
|
|
51
|
+
signal_api_name: '{{__SIGNAL_API_NAME__}}',
|
|
52
|
+
data: '{{__DATA__}}',
|
|
53
|
+
time_in_ms: '{{__TIME_IN_MS__}}',
|
|
54
|
+
rule_id: '{{__RULE_ID__}}',
|
|
55
|
+
target_id: '{{__TARGET_ID__}}',
|
|
56
|
+
attempt: '{{__ATTEMPT__}}'
|
|
57
|
+
},
|
|
42
58
|
init_js: {
|
|
43
59
|
project_id: '{{__PROJECT_ID__}}',
|
|
44
60
|
zaid: '{{__ZAID__}}',
|
|
@@ -0,0 +1,19 @@
|
|
|
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 signals_publishers_1 = __importDefault(require("./signals-publishers"));
|
|
7
|
+
exports.default = Object.freeze({
|
|
8
|
+
[signals_publishers_1.default.datastore]: ['row_inserted', 'row_updated', 'row_deleted'],
|
|
9
|
+
[signals_publishers_1.default.cache]: ['cache_item_created', 'cache_item_updated'],
|
|
10
|
+
[signals_publishers_1.default.authentication]: ['user_signedup', 'user_deleted', 'user_confirmed'],
|
|
11
|
+
[signals_publishers_1.default.filestore]: ['filestore_file_uploaded'],
|
|
12
|
+
[signals_publishers_1.default.stratus]: [
|
|
13
|
+
'stratus_object_uploaded',
|
|
14
|
+
'stratus_object_downloaded',
|
|
15
|
+
'stratus_object_updated',
|
|
16
|
+
'stratus_object_deleted'
|
|
17
|
+
],
|
|
18
|
+
[signals_publishers_1.default.custom]: ['deploy_success']
|
|
19
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Object.freeze({
|
|
4
|
+
zoho: [
|
|
5
|
+
'bigin',
|
|
6
|
+
'billing',
|
|
7
|
+
'books',
|
|
8
|
+
'commerce',
|
|
9
|
+
'crm',
|
|
10
|
+
'expense',
|
|
11
|
+
'inventory',
|
|
12
|
+
'invoice',
|
|
13
|
+
'meeting',
|
|
14
|
+
'survey'
|
|
15
|
+
],
|
|
16
|
+
cloudscale: [
|
|
17
|
+
'authentication',
|
|
18
|
+
'datastore',
|
|
19
|
+
'filestore',
|
|
20
|
+
'cache',
|
|
21
|
+
'stratus',
|
|
22
|
+
'webapp',
|
|
23
|
+
'github'
|
|
24
|
+
],
|
|
25
|
+
saas: ['shopify'],
|
|
26
|
+
custom: ['custom']
|
|
27
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Object.freeze({
|
|
4
|
+
authentication: 'authentication',
|
|
5
|
+
datastore: 'datastore',
|
|
6
|
+
filestore: 'filestore',
|
|
7
|
+
cache: 'cache',
|
|
8
|
+
stratus: 'stratus',
|
|
9
|
+
custom: 'custom'
|
|
10
|
+
});
|
|
@@ -69,6 +69,7 @@ exports.default = Object.freeze({
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
event_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'data.json'),
|
|
72
|
+
signal_event_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'signals.json'),
|
|
72
73
|
job_data: (0, path_1.join)(TEMPLATE_ROOT, 'event', 'job.json'),
|
|
73
74
|
init_js: (0, path_1.join)(TEMPLATE_ROOT, 'init.txt')
|
|
74
75
|
});
|
package/package.json
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
|
|
11
|
+
const INSTALL_COMMAND = `npm install -g zcatalyst-cli@${VERSION}`;
|
|
12
|
+
const CHANNEL_NAMES = (process.env.CHANNEL_NAMES || '').split(',');
|
|
13
|
+
|
|
14
|
+
const notify = async () => {
|
|
15
|
+
const message = {
|
|
16
|
+
text: `Hey Team, we've released a new version of [ZCatalyst-CLI](${NPM_REGISTRY_LINK}) :fireworks: \n\n *Version:* \`v${VERSION}\``,
|
|
17
|
+
bot: {
|
|
18
|
+
name: 'Dx Tools Update',
|
|
19
|
+
image: 'https://www.zohowebstatic.com/sites/default/files/catalyst/catalyst-logo.svg'
|
|
20
|
+
},
|
|
21
|
+
card: {
|
|
22
|
+
title: 'Announcement',
|
|
23
|
+
thumbnail: 'https://public-catlab-development.zohostratus.in/megaphone.gif',
|
|
24
|
+
theme: 'modern-inline'
|
|
25
|
+
},
|
|
26
|
+
slides: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
title: 'Installation Command',
|
|
30
|
+
data: '```' + INSTALL_COMMAND + '```'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
title: 'Release Notes',
|
|
35
|
+
data: `${RELEASE_NOTES_LINK}`
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
if (!CHANNEL_NAMES || !Array.isArray(CHANNEL_NAMES) || CHANNEL_NAMES.length === 0) {
|
|
41
|
+
console.error('Invalid channels: ' + process.env.CHANNEL_NAMES);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
await Promise.all(
|
|
46
|
+
CHANNEL_NAMES.map((channel) => {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
try {
|
|
49
|
+
const reqOpts = {
|
|
50
|
+
hostname: 'cliq.zoho.com',
|
|
51
|
+
path: `/company/64396901/api/v2/channelsbyname/${channel}/message?zapikey=${API_KEY}`,
|
|
52
|
+
qs: {},
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'content-type': 'application/json'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const req = HTTPS.request(reqOpts, async (res) => {
|
|
59
|
+
if (res.statusCode === 204) {
|
|
60
|
+
console.log('Notification successful: ' + channel);
|
|
61
|
+
return resolve();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const data = [];
|
|
65
|
+
res.on('data', (chunk) => {
|
|
66
|
+
data.push(chunk);
|
|
67
|
+
});
|
|
68
|
+
res.on('end', () => {
|
|
69
|
+
const resStr = Buffer.concat(data).toString();
|
|
70
|
+
reject(
|
|
71
|
+
new Error(
|
|
72
|
+
`API ERROR ::: ${req.method} ::: https://${req.host}${req.path} ::: ${res.statusCode} ::: ${resStr}`
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
req.on('error', reject);
|
|
78
|
+
req.write(JSON.stringify(message));
|
|
79
|
+
req.end();
|
|
80
|
+
} catch (er) {
|
|
81
|
+
if (er instanceof Error) {
|
|
82
|
+
return reject(er);
|
|
83
|
+
}
|
|
84
|
+
const error = new Error();
|
|
85
|
+
error.cause = er;
|
|
86
|
+
return reject(error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
})
|
|
90
|
+
).catch((er) => {
|
|
91
|
+
console.error('Error sending notifications: ', er);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
console.log('All Notifications sent successfully');
|
|
96
|
+
process.exit(0);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
notify();
|