zcatalyst-cli 1.18.1 → 1.19.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.
@@ -0,0 +1,19 @@
1
+ [IDX-1]
2
+ context = '''The options provided ${arg[0]}(publisher_service) ${arg[1]}(event_name) are not in a pair.'''
3
+ aid = '''Please provide the options as key values in this format: ${arg[2]}'''
4
+ link = ''
5
+
6
+ [IDX-2]
7
+ context = '''The provided input for publisher service is invalid.'''
8
+ aid = '''The publisher service must be one of the following: \n${arg[0]}'''
9
+ link = ''
10
+
11
+ [IDX-3]
12
+ context = '''The options are provided in an invalid format: ${arg[0]}'''
13
+ aid = '''Please provide the options only in this format: ${arg[1]}'''
14
+ link = ''
15
+
16
+ [IDX-4]
17
+ context = '''The provided event is not compatible with the publisher service: ${arg[0]} ${arg[1]} ${arg[2]} '''
18
+ aid = '''The compatible events with the publisher service ${arg[2]} are: \n${arg[3]}'''
19
+ link = ''
@@ -188,8 +188,14 @@ exports.default = new command_1.default('event:generate <source> <action>')
188
188
  break;
189
189
  }
190
190
  });
191
- const sourceModule = (yield (_a = '../../../event_generate/' + source, Promise.resolve().then(() => __importStar(require(_a))))).default;
192
- eventJsonContent = yield sourceModule(eventJsonContent, optionMap, action);
191
+ const isCustomSource = source === 'custom';
192
+ const sourceModule = yield (_a = `../../../event_generate/${source}`, Promise.resolve().then(() => __importStar(require(_a))));
193
+ eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), isCustomSource ? yield sourceModule.getRuleId() : 'NULL');
194
+ const evenData = !isCustomSource
195
+ ? yield sourceModule.getData(optionMap)
196
+ : optionMap.payload;
197
+ eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(evenData));
198
+ eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), sourceModule.sourceId);
193
199
  const jsonContent = JSON.parse(eventJsonContent);
194
200
  Object.keys(jsonContent).forEach((key) => {
195
201
  if (jsonContent[key] === 'NULL') {
@@ -81,6 +81,7 @@ exports.default = (client) => {
81
81
  loadCommand('codelib:install'),
82
82
  loadCommand('event:generate'),
83
83
  loadCommand('event:generate:integ'),
84
+ loadCommand('signals:generate'),
84
85
  loadCommand('event:generate:job'),
85
86
  loadCommand('serve'),
86
87
  loadCommand('deploy'),
@@ -0,0 +1,214 @@
1
+ 'use strict';
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const ansi_colors_1 = require("ansi-colors");
39
+ const error_1 = __importDefault(require("../../../error"));
40
+ const command_1 = __importDefault(require("../../../internal/command"));
41
+ const constants_1 = require("../../../util_modules/constants");
42
+ const fs_1 = require("../../../util_modules/fs");
43
+ const logger_1 = require("../../../util_modules/logger");
44
+ const project_1 = require("../../../util_modules/project");
45
+ const js_1 = require("../../../util_modules/js");
46
+ const option_1 = require("../../../util_modules/option");
47
+ exports.default = new command_1.default('signals:generate <publisher_service> <event_name>')
48
+ .description('Generate sample payloads from different components or custom event publishers to test Event functions')
49
+ .allowUnknownOpts()
50
+ .needs('rc')
51
+ .needs('auth')
52
+ .action(function generate(publisher, event) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ var _a;
55
+ const unknownArgs = (0, option_1.getUnknownOpts)([]);
56
+ if (unknownArgs.length % 2 !== 0) {
57
+ throw new error_1.default('Unknown options are not provided as key value pairs', {
58
+ exit: 1,
59
+ errorId: 'IDX-1',
60
+ arg: [(0, ansi_colors_1.bold)(publisher), (0, ansi_colors_1.bold)(event), (0, ansi_colors_1.bold)('--key value')]
61
+ });
62
+ }
63
+ const remotePublisherName = constants_1.SIGNALS_PUBLISHERS[publisher];
64
+ if (remotePublisherName === undefined) {
65
+ throw new error_1.default('Invalid publisher service', {
66
+ exit: 1,
67
+ errorId: 'IDX-2',
68
+ arg: [
69
+ (0, ansi_colors_1.bold)(Object.keys(constants_1.SIGNALS_PUBLISHERS)
70
+ .map((src) => '* ' + src)
71
+ .join('\n'))
72
+ ]
73
+ });
74
+ }
75
+ if (constants_1.SIGNALS_API_NAMES[remotePublisherName] === undefined) {
76
+ throw new error_1.default('Signal reference is not found for the publisher service provided', {
77
+ exit: 2
78
+ });
79
+ }
80
+ let eventJsonContent = yield fs_1.ASYNC.readFile(constants_1.TEMPLATE.signal_event_data);
81
+ if (eventJsonContent === undefined) {
82
+ throw new error_1.default('Signal template json is undefined', { exit: 2 });
83
+ }
84
+ const eventDataPlaceHolder = constants_1.PLACEHOLDER.signal_event_data;
85
+ const optionMap = unknownArgs.reduce((previousValue, currentValue, currentIndex, optionArr) => {
86
+ if (currentIndex % 2 === 0) {
87
+ if (!currentValue.startsWith('--') &&
88
+ currentValue !== '-e' &&
89
+ currentValue !== '-rid' &&
90
+ currentValue !== '--verbose') {
91
+ const fault = unknownArgs === null || unknownArgs === void 0 ? void 0 : unknownArgs.map((arg) => {
92
+ if (arg === currentValue) {
93
+ return (0, ansi_colors_1.red)(arg);
94
+ }
95
+ return arg;
96
+ }).join(' ');
97
+ throw new error_1.default('Invalid option format detected', {
98
+ exit: 1,
99
+ errorId: 'IDX-3',
100
+ arg: [(0, ansi_colors_1.italic)(fault), (0, ansi_colors_1.bold)('--<option> <value>')]
101
+ });
102
+ }
103
+ previousValue[currentValue.slice(2)] = optionArr[currentIndex + 1];
104
+ }
105
+ return previousValue;
106
+ }, {});
107
+ let data = {};
108
+ if (publisher !== 'custom') {
109
+ const publisherModule = yield (_a = '../../../event_generate/' + (publisher === 'authentication' ? 'user' : publisher), Promise.resolve().then(() => __importStar(require(_a))));
110
+ data = yield publisherModule.getData(optionMap);
111
+ if (publisher === 'datastore') {
112
+ data = Object.assign(Object.assign({}, data), { table_details: {
113
+ table_id: publisherModule.sourceId,
114
+ table_name: 'Default'
115
+ } });
116
+ }
117
+ if (publisher === 'authentication' && event !== 'user_signedup') {
118
+ data = data.user_details;
119
+ }
120
+ }
121
+ Object.keys(eventDataPlaceHolder).forEach((placeholderKey) => {
122
+ switch (placeholderKey) {
123
+ case 'version':
124
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), 1 + '');
125
+ break;
126
+ case 'org_id':
127
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), (0, project_1.getEnvId)() + '');
128
+ break;
129
+ case 'project_id':
130
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), (0, project_1.getProjectId)() + '');
131
+ break;
132
+ case 'project_name':
133
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), (0, project_1.getProjectName)() + '');
134
+ break;
135
+ case 'environment':
136
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), (0, project_1.getEnvName)() + '');
137
+ break;
138
+ case 'rule_id':
139
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), js_1.JS.randomNumber(18) + '');
140
+ break;
141
+ case 'uuid':
142
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), js_1.JS.randomString(8) +
143
+ '-' +
144
+ js_1.JS.randomString(4) +
145
+ '-' +
146
+ js_1.JS.randomString(4) +
147
+ '-' +
148
+ js_1.JS.randomString(4) +
149
+ '-' +
150
+ js_1.JS.randomString(11));
151
+ break;
152
+ case 'target_id':
153
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), js_1.JS.randomNumber(8) + '');
154
+ break;
155
+ case 'signal_id':
156
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), js_1.JS.randomNumber(17) + '');
157
+ break;
158
+ case 'signal_api_name':
159
+ if (publisher !== 'custom') {
160
+ const eventRefArr = constants_1.SIGNALS_API_NAMES[remotePublisherName];
161
+ const remoteRefevent = event;
162
+ (0, logger_1.debug)(`event name provided is : ${remoteRefevent}`);
163
+ const indexOfevent = eventRefArr.indexOf(remoteRefevent);
164
+ if (indexOfevent < 0) {
165
+ const availableEvents = eventRefArr
166
+ .map((act) => {
167
+ return '* ' + act;
168
+ })
169
+ .join('\n');
170
+ throw new error_1.default('Event name incompatible with the publisher service' + eventRefArr, {
171
+ exit: 1,
172
+ errorId: 'IDX-4',
173
+ arg: [
174
+ (0, ansi_colors_1.bold)(event),
175
+ ansi_colors_1.bold.red('X'),
176
+ (0, ansi_colors_1.bold)(publisher),
177
+ (0, ansi_colors_1.bold)(availableEvents)
178
+ ]
179
+ });
180
+ }
181
+ event = constants_1.SIGNALS_API_NAMES[remotePublisherName][indexOfevent];
182
+ }
183
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), event);
184
+ break;
185
+ case 'attempt':
186
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), 1 + '');
187
+ break;
188
+ case 'source':
189
+ const publisherDetails = `publisher_id:${js_1.JS.randomNumber(17)}` +
190
+ `/service:${getPublisherType(publisher)}${publisher === 'custom'
191
+ ? ''
192
+ : publisher + '/account:' + js_1.JS.randomNumber(8)}`;
193
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), publisherDetails);
194
+ break;
195
+ case 'time_in_ms':
196
+ eventJsonContent = eventJsonContent === null || eventJsonContent === void 0 ? void 0 : eventJsonContent.replace(new RegExp(eventDataPlaceHolder[placeholderKey], 'g'), Date.now().toString());
197
+ break;
198
+ default:
199
+ break;
200
+ }
201
+ });
202
+ eventJsonContent = eventJsonContent.replace(new RegExp(constants_1.PLACEHOLDER.signal_event_data.data, 'g'), JSON.stringify(data));
203
+ const jsonContent = JSON.parse(eventJsonContent);
204
+ process.stdout.write(JSON.stringify(jsonContent) + '\n');
205
+ });
206
+ });
207
+ function getPublisherType(publisher) {
208
+ for (const [category, services] of Object.entries(constants_1.SIGNALS_PUBLISHERS_TYPE)) {
209
+ if (services.includes(publisher)) {
210
+ return category;
211
+ }
212
+ }
213
+ return null;
214
+ }
@@ -12,42 +12,44 @@ 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 ansi_colors_1 = require("ansi-colors");
16
17
  const moment_1 = __importDefault(require("moment"));
17
18
  const endpoints_1 = require("../endpoints");
18
19
  const error_1 = __importDefault(require("../error"));
19
- const constants_1 = require("../util_modules/constants");
20
20
  const js_1 = require("../util_modules/js");
21
- const project_1 = require("../util_modules/project");
22
- exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
23
- const segmentId = options.segment;
24
- const allSegments = (yield (yield (0, endpoints_1.cacheAPI)()).getAllSegments());
25
- const selectedSegment = segmentId !== undefined
26
- ? allSegments.find((segment) => segment.segment_name === segmentId || segment.id + '' === segmentId)
27
- : allSegments.find((segment) => segment.segment_name === 'Default');
28
- if (selectedSegment === undefined) {
29
- if (!allSegments.find((segment) => segment.segment_name === 'Default')) {
30
- throw new error_1.default('Default segment is missing !!!', { exit: 2 });
21
+ exports.sourceId = 'NULL';
22
+ function getData(options = {}) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const segmentId = options.segment;
25
+ const allSegments = (yield (yield (0, endpoints_1.cacheAPI)()).getAllSegments());
26
+ const selectedSegment = segmentId !== undefined
27
+ ? allSegments.find((segment) => segment.segment_name === segmentId || segment.id + '' === segmentId)
28
+ : allSegments.find((segment) => segment.segment_name === 'Default');
29
+ if (selectedSegment === undefined) {
30
+ if (!allSegments.find((segment) => segment.segment_name === 'Default')) {
31
+ throw new error_1.default('Default segment is missing !!!', { exit: 2 });
32
+ }
33
+ throw new error_1.default('Unknown segment identifier', {
34
+ exit: 1,
35
+ errorId: 'CACHE-1',
36
+ arg: [(0, ansi_colors_1.bold)(segmentId || ''), (0, ansi_colors_1.bold)('--segment')]
37
+ });
31
38
  }
32
- throw new error_1.default('Unknown segment identifier', {
33
- exit: 1,
34
- errorId: 'CACHE-1',
35
- arg: [(0, ansi_colors_1.bold)(segmentId || ''), (0, ansi_colors_1.bold)('--segment')]
36
- });
37
- }
38
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), selectedSegment.id);
39
- const expiryInHours = js_1.JS.random(1, 48);
40
- const data = {
41
- cache_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
42
- cache_value: js_1.JS.randomString(10),
43
- project_details: {
44
- id: (0, project_1.getProjectId)(),
45
- project_name: (0, project_1.getProjectName)()
46
- },
47
- segment_details: selectedSegment,
48
- expiry_in_hours: expiryInHours,
49
- expires_in: (0, moment_1.default)(moment_1.default.now() + expiryInHours * 60 * 60 * 1000).format('MMM DD, YYYY hh:mm A')
50
- };
51
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
52
- return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
53
- });
39
+ exports.sourceId = selectedSegment.id;
40
+ const expiryInHours = js_1.JS.random(1, 48);
41
+ return {
42
+ cache_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
43
+ cache_value: js_1.JS.randomString(10),
44
+ project_details: selectedSegment.project_details,
45
+ segment_details: {
46
+ segment_name: selectedSegment.segment_name,
47
+ id: selectedSegment.id
48
+ },
49
+ expiry_in_hours: expiryInHours,
50
+ expires_in: (0, moment_1.default)(moment_1.default.now() + expiryInHours * 60 * 60 * 1000).format('MMM DD, YYYY hh:mm A'),
51
+ ttl_in_milliseconds: expiryInHours * 60 * 60 * 1000 + ''
52
+ };
53
+ });
54
+ }
55
+ exports.getData = getData;
@@ -12,25 +12,21 @@ 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.getRuleId = void 0;
15
16
  const ansi_colors_1 = require("ansi-colors");
16
17
  const error_1 = __importDefault(require("../error"));
17
- const constants_1 = require("../util_modules/constants");
18
- const js_1 = require("../util_modules/js");
19
18
  const option_1 = require("../util_modules/option");
20
- exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
21
- let data = options.payload;
22
- if (data === undefined) {
23
- data = js_1.JS.randomString(15);
24
- }
25
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
26
- const ruleId = (0, option_1.getOptionValue)('ruleId', false);
27
- if (!ruleId) {
28
- throw new error_1.default('no rule-id provided', {
29
- exit: 1,
30
- errorId: 'CUSTOM-1',
31
- arg: [(0, ansi_colors_1.bold)('-rid'), (0, ansi_colors_1.bold)('--rule-id')]
32
- });
33
- }
34
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
35
- return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), ruleId);
36
- });
19
+ function getRuleId() {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const ruleId = (0, option_1.getOptionValue)('ruleId', false);
22
+ if (!ruleId) {
23
+ throw new error_1.default('no rule-id provided', {
24
+ exit: 1,
25
+ errorId: 'CUSTOM-1',
26
+ arg: [(0, ansi_colors_1.bold)('-rid'), (0, ansi_colors_1.bold)('--rule-id')]
27
+ });
28
+ }
29
+ return ruleId;
30
+ });
31
+ }
32
+ exports.getRuleId = getRuleId;
@@ -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
+ exports.getData = exports.sourceId = void 0;
15
16
  const ansi_colors_1 = require("ansi-colors");
16
17
  const moment_1 = __importDefault(require("moment"));
17
18
  const endpoints_1 = require("../endpoints");
@@ -19,63 +20,66 @@ const error_1 = __importDefault(require("../error"));
19
20
  const constants_1 = require("../util_modules/constants");
20
21
  const js_1 = require("../util_modules/js");
21
22
  const logger_1 = require("../util_modules/logger");
22
- exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
23
- const tableId = options.table;
24
- let columnDetails = constants_1.DEFAULT.datastore.column_details;
25
- if (tableId !== undefined) {
26
- columnDetails = (yield (yield (0, endpoints_1.datastoreAPI)()).getColumnDetails(tableId).catch((err) => {
27
- if (err.status && err.status === 404) {
28
- throw new error_1.default('Invalid table identifier', {
29
- exit: 1,
30
- errorId: 'DSTORE-1',
31
- arg: [(0, ansi_colors_1.bold)(tableId), (0, ansi_colors_1.bold)('--table')]
23
+ exports.sourceId = 'NULL';
24
+ function getData(options = {}) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const tableId = options.table;
27
+ let columnDetails = constants_1.DEFAULT.datastore.column_details;
28
+ if (tableId !== undefined) {
29
+ columnDetails = (yield (yield (0, endpoints_1.datastoreAPI)()).getColumnDetails(tableId).catch((err) => {
30
+ if (err.status && err.status === 404) {
31
+ throw new error_1.default('Invalid table identifier', {
32
+ exit: 1,
33
+ errorId: 'DSTORE-1',
34
+ arg: [(0, ansi_colors_1.bold)(tableId), (0, ansi_colors_1.bold)('--table')]
35
+ });
36
+ }
37
+ throw err;
38
+ }));
39
+ if (!Array.isArray(columnDetails)) {
40
+ throw new error_1.default('Invalid column details', { exit: 2 });
41
+ }
42
+ const rowColumn = columnDetails.find((col) => col.column_name === 'ROWID');
43
+ if (rowColumn === undefined) {
44
+ throw new error_1.default('There is no ROWID column present in the column details', {
45
+ exit: 2
32
46
  });
33
47
  }
34
- throw err;
35
- }));
36
- if (!Array.isArray(columnDetails)) {
37
- throw new error_1.default('Invalid column details', { exit: 2 });
38
- }
39
- const rowColumn = columnDetails.find((col) => col.column_name === 'ROWID');
40
- if (rowColumn === undefined) {
41
- throw new error_1.default('There is no ROWID column present in the column details', {
42
- exit: 2
43
- });
48
+ exports.sourceId = rowColumn.table_id;
44
49
  }
45
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), rowColumn.table_id);
46
- }
47
- else {
48
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), js_1.JS.randomNumber(15).toString());
49
- }
50
- const data = columnDetails.reduce((accumulator, current) => {
51
- switch (current.data_type) {
52
- case 'bigint':
53
- case 'foreignkey':
54
- accumulator[0][current.column_name] = js_1.JS.randomNumber(15);
55
- break;
56
- case 'datetime':
57
- accumulator[0][current.column_name] = (0, moment_1.default)().format('YYYY-MM-DD HH:mm:ss');
58
- break;
59
- case 'text':
60
- case 'varchar':
61
- accumulator[0][current.column_name] = js_1.JS.randomString(10);
62
- break;
63
- case 'date':
64
- accumulator[0][current.column_name] = (0, moment_1.default)().format('YYYY-MM-DD');
65
- break;
66
- case 'boolean':
67
- accumulator[0][current.column_name] = js_1.JS.random(0, 1) === 1 ? true : false;
68
- break;
69
- case 'int':
70
- case 'double':
71
- accumulator[0][current.column_name] = js_1.JS.randomNumber(5);
72
- break;
73
- default:
74
- (0, logger_1.debug)('Unknown data_type received: ' + current.data_type);
75
- break;
50
+ else {
51
+ exports.sourceId = js_1.JS.randomNumber(15).toString();
76
52
  }
77
- return accumulator;
78
- }, [{}]);
79
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
80
- return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
81
- });
53
+ return columnDetails.reduce((accumulator, current) => {
54
+ switch (current.data_type) {
55
+ case 'bigint':
56
+ case 'foreignkey':
57
+ accumulator[0][current.column_name] = js_1.JS.randomNumber(15);
58
+ break;
59
+ case 'datetime':
60
+ accumulator[0][current.column_name] =
61
+ (0, moment_1.default)().format('YYYY-MM-DD HH:mm:ss:SSS');
62
+ break;
63
+ case 'text':
64
+ case 'varchar':
65
+ accumulator[0][current.column_name] = js_1.JS.randomString(10);
66
+ break;
67
+ case 'date':
68
+ accumulator[0][current.column_name] = (0, moment_1.default)().format('YYYY-MM-DD');
69
+ break;
70
+ case 'boolean':
71
+ accumulator[0][current.column_name] = js_1.JS.random(0, 1) === 1 ? true : false;
72
+ break;
73
+ case 'int':
74
+ case 'double':
75
+ accumulator[0][current.column_name] = js_1.JS.randomNumber(5);
76
+ break;
77
+ default:
78
+ (0, logger_1.debug)('Unknown data_type received: ' + current.data_type);
79
+ break;
80
+ }
81
+ return accumulator;
82
+ }, [{}])[0];
83
+ });
84
+ }
85
+ exports.getData = getData;
@@ -12,58 +12,62 @@ 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 ansi_colors_1 = require("ansi-colors");
16
17
  const moment_1 = __importDefault(require("moment"));
17
18
  const endpoints_1 = require("../endpoints");
18
19
  const error_1 = __importDefault(require("../error"));
19
20
  const runtime_store_1 = __importDefault(require("../runtime-store"));
20
- const constants_1 = require("../util_modules/constants");
21
21
  const js_1 = require("../util_modules/js");
22
22
  const project_1 = require("../util_modules/project");
23
- exports.default = (eventJson, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
24
- const folderId = options.folder;
25
- const allFolders = (yield (yield (0, endpoints_1.filestoreAPI)()).getAllFolders());
26
- const selectedFolder = folderId !== undefined
27
- ? allFolders.find((folder) => folder.folder_name === folderId || folder.id + '' === folderId)
28
- : {
29
- folder_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
30
- id: js_1.JS.randomNumber(15) + ''
23
+ exports.sourceId = 'NULL';
24
+ function getData(options = {}) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const folderId = options.folder;
27
+ const allFolders = (yield (yield (0, endpoints_1.filestoreAPI)()).getAllFolders());
28
+ const selectedFolder = folderId !== undefined
29
+ ? allFolders.find((folder) => folder.folder_name === folderId || folder.id + '' === folderId)
30
+ : {
31
+ folder_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
32
+ id: js_1.JS.randomNumber(15) + ''
33
+ };
34
+ if (selectedFolder === undefined) {
35
+ const allFoldersFormatted = allFolders.length > 0
36
+ ? allFolders.map((folder) => '* ' + folder.folder_name).join('\n')
37
+ : 'None';
38
+ throw new error_1.default('Invalid folder identifier', {
39
+ exit: 1,
40
+ errorId: 'FSTORE-1',
41
+ arg: [(0, ansi_colors_1.bold)('--folder'), (0, ansi_colors_1.bold)(allFoldersFormatted)]
42
+ });
43
+ }
44
+ exports.sourceId = selectedFolder.id;
45
+ const userDetails = {
46
+ email_id: runtime_store_1.default.get('user.Email'),
47
+ user_type: 'Admin',
48
+ user_id: js_1.JS.randomNumber(15),
49
+ is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
50
+ last_name: js_1.JS.randomString(5),
51
+ first_name: js_1.JS.randomString(10),
52
+ zuid: js_1.JS.randomNumber(10)
31
53
  };
32
- if (selectedFolder === undefined) {
33
- const allFoldersFormatted = allFolders.length > 0
34
- ? allFolders.map((folder) => '* ' + folder.folder_name).join('\n')
35
- : 'None';
36
- throw new error_1.default('Invalid folder identifier', {
37
- exit: 1,
38
- errorId: 'FSTORE-1',
39
- arg: [(0, ansi_colors_1.bold)('--folder'), (0, ansi_colors_1.bold)(allFoldersFormatted)]
40
- });
41
- }
42
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), selectedFolder.id);
43
- const userDetails = {
44
- email_id: runtime_store_1.default.get('user.Email'),
45
- user_id: js_1.JS.randomNumber(15),
46
- is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
47
- last_name: js_1.JS.randomString(5),
48
- first_name: js_1.JS.randomString(10),
49
- zuid: js_1.JS.randomNumber(10)
50
- };
51
- const time = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
52
- const data = {
53
- project_details: {
54
- id: (0, project_1.getProjectId)(),
55
- project_name: (0, project_1.getProjectName)()
56
- },
57
- folder_details: selectedFolder.id,
58
- created_time: time,
59
- file_location: null,
60
- modified_time: time,
61
- file_name: js_1.JS.randomString(10) + (js_1.JS.random(0, 1) === 1) ? '.js' : '.txt',
62
- modified_by: userDetails,
63
- id: selectedFolder.id,
64
- created_by: userDetails,
65
- file_size: parseInt(js_1.JS.randomNumber(6), 10)
66
- };
67
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
68
- return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
69
- });
54
+ const time = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
55
+ return {
56
+ project_details: {
57
+ project_type: 'Live',
58
+ id: (0, project_1.getProjectId)(),
59
+ project_name: (0, project_1.getProjectName)()
60
+ },
61
+ folder_details: selectedFolder === null || selectedFolder === void 0 ? void 0 : selectedFolder.id,
62
+ created_time: time,
63
+ file_location: null,
64
+ modified_time: time,
65
+ file_name: js_1.JS.randomString(10) + (js_1.JS.random(0, 1) === 1) ? '.js' : '.txt',
66
+ modified_by: userDetails,
67
+ id: selectedFolder === null || selectedFolder === void 0 ? void 0 : selectedFolder.id,
68
+ created_by: userDetails,
69
+ file_size: parseInt(js_1.JS.randomNumber(6), 10) + ''
70
+ };
71
+ });
72
+ }
73
+ exports.getData = getData;
@@ -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.default = (eventJson) => __awaiter(void 0, void 0, void 0, function* () {
19
- const repoName = js_1.JS.randomString(5);
20
- const displayName = runtime_store_1.default.get('user.Display_Name');
21
- const data = {
22
- archive_url: `https://api.github.com/repos/${displayName}/${repoName}/`,
23
- full_name: `${displayName}/${repoName}`,
24
- clone_url: `https://github.com/${displayName}/${repoName}.git`,
25
- name: `${repoName}`,
26
- created_at: Date.now(),
27
- deployment_status: 'none',
28
- default_branch: 'master',
29
- id: js_1.JS.randomNumber(15)
30
- };
31
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
32
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
33
- return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
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
- function generateStratusEventJson(eventJson) {
12
- const userDetails = {
13
- email_id: runtime_store_1.default.get('user.Email'),
14
- user_id: js_1.JS.randomNumber(15),
15
- is_confirmed: getRandomBoolean(),
16
- last_name: js_1.JS.randomString(5),
17
- first_name: js_1.JS.randomString(10),
18
- zuid: js_1.JS.randomNumber(10)
19
- };
20
- const time = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
21
- const data = {
22
- bucket_details: {
23
- bucket_name: 'sample-bucket',
24
- project_details: {
25
- id: (0, project_1.getProjectId)(),
26
- project_name: (0, project_1.getProjectName)(),
27
- project_type: 'Live'
28
- },
29
- created_by: userDetails,
30
- created_time: time,
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
- encryption: getRandomBoolean(),
39
- audit_consent: getRandomBoolean()
40
- }
41
- },
42
- object_key: 'path1/path2/myfile.png'
43
- };
44
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
45
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
46
- eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
47
- return eventJson;
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.default = generateStratusEventJson;
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.default = (eventJson) => __awaiter(void 0, void 0, void 0, function* () {
20
- const mockTime = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
21
- const data = {
22
- platform_type: null,
23
- user_details: {
24
- email_id: runtime_store_1.default.get('user.Email'),
25
- role_details: {
26
- role_name: 'App User',
27
- role_id: js_1.JS.randomNumber(10)
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
- zaaid: js_1.JS.randomNumber(10),
30
- created_time: mockTime,
31
- invited_time: mockTime,
32
- modified_time: mockTime,
33
- user_id: js_1.JS.randomNumber(10),
34
- is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
35
- last_name: '',
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.default = (eventJson) => __awaiter(void 0, void 0, void 0, function* () {
22
- const webappDetails = (yield (yield (0, endpoints_1.clientAPI)()).getWebappDetails());
23
- const selectedWebapp = webappDetails !== undefined && Object.keys(webappDetails).length > 0
24
- ? webappDetails
25
- : {
26
- app_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
27
- app_id: js_1.JS.randomNumber(15),
28
- url_prefix: (0, project_1.getDomainPrefix)()
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
- const userDetails = {
31
- email_id: runtime_store_1.default.get('user.Email'),
32
- user_id: js_1.JS.randomNumber(15),
33
- is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
34
- last_name: js_1.JS.randomString(5),
35
- first_name: js_1.JS.randomString(10),
36
- zuid: js_1.JS.randomNumber(10)
37
- };
38
- const data = {
39
- uploaded_time: (0, moment_1.default)().format('MMM DD, YYYY hh:mm A'),
40
- project_details: {
41
- id: (0, project_1.getProjectId)(),
42
- project_name: (0, project_1.getProjectName)()
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 recommended projects?', {
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'
@@ -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: `http://127.0.0.1:${details.target.port.appsail}`,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.18.1",
3
+ "version": "1.19.0",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -0,0 +1,26 @@
1
+ {
2
+ "rule_id": "{{__RULE_ID__}}",
3
+ "target_id": "{{__TARGET_ID__}}",
4
+ "version": {{__VERSION__}},
5
+ "attempt": {{__ATTEMPT__}},
6
+ "account": {
7
+ "org_id": "{{__ORG_ID__}}",
8
+ "project": {
9
+ "environment": "{{__ENVIRONMENT__}}",
10
+ "name": "{{__PROJECT_NAME__}}",
11
+ "id": "{{__PROJECT_ID__}}"
12
+ }
13
+ },
14
+ "events": [
15
+ {
16
+ "data": {{__DATA__}},
17
+ "id": "{{__UUID__}}",
18
+ "time_in_ms": "{{__TIME_IN_MS__}}",
19
+ "source": "{{__SOURCE__}}",
20
+ "event_config": {
21
+ "api_name": "{{__SIGNAL_API_NAME__}}",
22
+ "id": "{{__SIGNAL_ID__}}"
23
+ }
24
+ }
25
+ ]
26
+ }