biz-a-cli 2.3.71 → 2.3.73

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.
@@ -1,220 +1,231 @@
1
- import { Server as ioServer } from 'socket.io';
2
- import { createServer } from 'node:http';
3
- import { io as ioClient } from 'socket.io-client';
4
- import { jest } from '@jest/globals';
1
+ import { Server as ioServer } from "socket.io";
2
+ import { createServer } from "node:http";
3
+ import { io as ioClient } from "socket.io-client";
4
+ import { jest } from "@jest/globals";
5
5
 
6
6
  const mockAddApp = jest.fn().mockResolvedValue({ success: true, data: { uploaded: true } });
7
- jest.unstable_mockModule('../bin/app.js', () => ({
8
- addApp: mockAddApp
7
+ jest.unstable_mockModule("../bin/app.js", () => ({
8
+ addApp: mockAddApp,
9
9
  }));
10
10
 
11
- const { streamEvent } = await import('../bin/hubEvent.js');
11
+ const { streamEvent } = await import("../bin/hubEvent.js");
12
12
 
13
13
  let socketsBySubdomain = {};
14
14
 
15
15
  const createSockTunnel2CLI = (socket) => {
16
- return (subdomain, responseCb) => {
17
- const responseCallback = (error) => { if (responseCb) responseCb(error) }
18
- let subdomainStr = subdomain.toString();
16
+ return (subdomain, responseCb) => {
17
+ const responseCallback = (error) => {
18
+ if (responseCb) responseCb(error);
19
+ };
20
+ let subdomainStr = subdomain.toString();
19
21
 
20
- socketsBySubdomain[subdomainStr] = socket;
21
- socket.subdomain = subdomainStr;
22
+ socketsBySubdomain[subdomainStr] = socket;
23
+ socket.subdomain = subdomainStr;
22
24
 
23
- responseCallback(null);
24
- }
25
- }
25
+ responseCallback(null);
26
+ };
27
+ };
26
28
 
27
29
  const deleteSubdomain = (socket) => () => {
28
- if (socket.subdomain) {
29
- delete socketsBySubdomain[socket.subdomain];
30
- }
31
- }
32
-
33
- const toPromise = (cb) => new Promise((resolve, reject) => {
34
- cb(resolve)
35
- setTimeout(() => reject(new Error('timeout')), 1000)
36
- })
37
-
38
- describe('Hub publish request tests', () => {
39
- let bizAServerSocket, httpServer, port;
40
-
41
- beforeAll((done) => {
42
- httpServer = createServer();
43
- bizAServerSocket = new ioServer(httpServer);
44
- bizAServerSocket.on('connection', (socket) => {
45
- socket.on('createTunnel', createSockTunnel2CLI(socket));
46
- socket.on('disconnect', deleteSubdomain(socket));
47
- });
48
- httpServer.listen(() => {
49
- port = httpServer.address().port;
50
- done();
51
- });
52
- });
53
-
54
- beforeEach(() => {
55
- mockAddApp.mockClear();
56
- delete process.env.BIZA_APP_SKIP_PARSE;
57
- });
58
-
59
- afterAll(() => {
60
- bizAServerSocket.close();
61
- httpServer.close();
62
- });
63
-
64
- test('publish-req should execute addApp and pass body scripts', async () => {
65
- const subdomain = 'publish-room';
66
- const socket = ioClient(`http://localhost:${port}`);
67
- await streamEvent(socket, {
68
- server: `http://localhost:${port}`,
69
- subdomain,
70
- hostname: 'localhost',
71
- port: 212,
72
- serverport: 3002,
73
- dbindex: 7
74
- });
75
-
76
- const publishBody = {
77
- options: {
78
- workingDir: 'c:/tmp/app',
79
- verbose: true,
80
- server: 'https://srv',
81
- apiPort: '1205',
82
- dbIndex: '2',
83
- sub: 'unit-sub',
84
- files: [{ name: 'a.js' }]
85
- },
86
- scripts: {
87
- 'a.js': 'get = function () { return {unit: true} }'
88
- }
89
- };
90
-
91
- const response = await toPromise(resolve => socketsBySubdomain[subdomain].emit(
92
- 'publish-req',
93
- {
94
- path: '/publish',
95
- method: 'POST',
96
- query: { subdomain },
97
- body: publishBody,
98
- headers: { 'content-type': 'application/json' }
99
- },
100
- (cb) => resolve(cb)
101
- ));
102
-
103
- expect(mockAddApp).toHaveBeenCalledTimes(1);
104
- expect(mockAddApp).toHaveBeenCalledWith({
105
- workingDir: 'c:/tmp/app',
106
- verbose: true,
107
- server: 'https://srv',
108
- apiPort: 1205,
109
- dbIndex: 2,
110
- sub: 'unit-sub',
111
- files: [{ name: 'a.js' }],
112
- body: publishBody
113
- });
114
- expect(response).toStrictEqual({ success: true, data: { uploaded: true } });
115
- expect(process.env.BIZA_APP_SKIP_PARSE).toBeUndefined();
116
-
117
- socket.disconnect();
118
- });
119
-
120
- test('publish-req should treat data.body as direct addApp http payload', async () => {
121
- const subdomain = 'publish-room-http';
122
- const socket = ioClient(`http://localhost:${port}`);
123
- await streamEvent(socket, {
124
- server: `http://localhost:${port}`,
125
- subdomain,
126
- hostname: 'localhost',
127
- port: 212,
128
- serverport: 3002,
129
- dbindex: 7
130
- });
131
-
132
- const publishBody = {
133
- verbose: false,
134
- fileList: [{ name: 'a.js' }],
135
- scripts: {
136
- 'a.js': 'get = function () { return {direct: true} }'
137
- }
138
- };
139
-
140
- const response = await toPromise(resolve => socketsBySubdomain[subdomain].emit(
141
- 'publish-req',
142
- {
143
- path: '/publish',
144
- method: 'POST',
145
- query: { subdomain },
146
- body: publishBody,
147
- headers: { 'content-type': 'application/json' }
148
- },
149
- (cb) => resolve(cb)
150
- ));
151
-
152
- expect(mockAddApp).toHaveBeenCalledTimes(1);
153
- expect(mockAddApp).toHaveBeenCalledWith({
154
- workingDir: expect.any(String),
155
- verbose: false,
156
- server: `http://localhost:${port}`,
157
- apiPort: 212,
158
- dbIndex: 7,
159
- sub: subdomain,
160
- files: [{ name: 'a.js' }],
161
- body: publishBody
162
- });
163
- expect(response).toStrictEqual({ success: true, data: { uploaded: true } });
164
- expect(process.env.BIZA_APP_SKIP_PARSE).toBeUndefined();
165
-
166
- socket.disconnect();
167
- });
168
-
169
- test('publish-req should support double-wrapper payload from HTTP client', async () => {
170
- const subdomain = 'publish-room-double-wrapper';
171
- const socket = ioClient(`http://localhost:${port}`);
172
- await streamEvent(socket, {
173
- server: `http://localhost:${port}`,
174
- subdomain,
175
- hostname: 'localhost',
176
- port: 212,
177
- serverport: 3002,
178
- dbindex: 7
179
- });
180
-
181
- const publishBody = {
182
- fileList: [{ name: 'menu.json' }, { name: 'loginform.js' }],
183
- scripts: {
184
- 'menu.json': '[{"menuName":"","caption":"Home","link":["./main"],"subMenu":[]}]',
185
- 'loginform.js': 'get = function () { return {model:{}, tableName:"", fields:[], functions:{ beforeLoadData: function (id) {} }}; };'
186
- }
187
- };
188
-
189
- const response = await toPromise(resolve => socketsBySubdomain[subdomain].emit(
190
- 'publish-req',
191
- {
192
- path: '/publish',
193
- method: 'POST',
194
- query: { subdomain },
195
- headers: { 'content-type': 'application/json' },
196
- body: {
197
- method: 'POST',
198
- query: { subdomain },
199
- body: publishBody
200
- }
201
- },
202
- (cb) => resolve(cb)
203
- ));
204
-
205
- expect(mockAddApp).toHaveBeenCalledTimes(1);
206
- expect(mockAddApp).toHaveBeenCalledWith({
207
- workingDir: expect.any(String),
208
- verbose: false,
209
- server: `http://localhost:${port}`,
210
- apiPort: 212,
211
- dbIndex: 7,
212
- sub: subdomain,
213
- files: [{ name: 'menu.json' }, { name: 'loginform.js' }],
214
- body: publishBody
215
- });
216
- expect(response).toStrictEqual({ success: true, data: { uploaded: true } });
217
-
218
- socket.disconnect();
219
- });
30
+ if (socket.subdomain) {
31
+ delete socketsBySubdomain[socket.subdomain];
32
+ }
33
+ };
34
+
35
+ const toPromise = (cb) =>
36
+ new Promise((resolve, reject) => {
37
+ cb(resolve);
38
+ setTimeout(() => reject(new Error("timeout")), 1000);
39
+ });
40
+
41
+ describe("Hub publish request tests", () => {
42
+ let bizAServerSocket, httpServer, port, logSpy;
43
+
44
+ beforeAll((done) => {
45
+ logSpy = jest.spyOn(console, "log").mockImplementation(() => {});
46
+ httpServer = createServer();
47
+ bizAServerSocket = new ioServer(httpServer);
48
+ bizAServerSocket.on("connection", (socket) => {
49
+ socket.on("createTunnel", createSockTunnel2CLI(socket));
50
+ socket.on("disconnect", deleteSubdomain(socket));
51
+ });
52
+ httpServer.listen(() => {
53
+ port = httpServer.address().port;
54
+ done();
55
+ });
56
+ });
57
+
58
+ beforeEach(() => {
59
+ mockAddApp.mockClear();
60
+ delete process.env.BIZA_APP_SKIP_PARSE;
61
+ });
62
+
63
+ afterAll(() => {
64
+ bizAServerSocket.close();
65
+ httpServer.close();
66
+ logSpy.mockRestore();
67
+ });
68
+
69
+ test("publish-req should execute addApp and pass body scripts", async () => {
70
+ const subdomain = "publish-room";
71
+ const socket = ioClient(`http://localhost:${port}`);
72
+ await streamEvent(socket, {
73
+ server: `http://localhost:${port}`,
74
+ subdomain,
75
+ hostname: "localhost",
76
+ port: 212,
77
+ serverport: 3002,
78
+ dbindex: 7,
79
+ });
80
+
81
+ const publishBody = {
82
+ options: {
83
+ workingDir: "c:/tmp/app",
84
+ verbose: true,
85
+ server: "https://srv",
86
+ apiPort: "1205",
87
+ dbIndex: "2",
88
+ sub: "unit-sub",
89
+ files: [{ name: "a.js" }],
90
+ },
91
+ scripts: {
92
+ "a.js": "get = function () { return {unit: true} }",
93
+ },
94
+ };
95
+
96
+ const response = await toPromise((resolve) =>
97
+ socketsBySubdomain[subdomain].emit(
98
+ "publish-req",
99
+ {
100
+ path: "/publish",
101
+ method: "POST",
102
+ query: { subdomain },
103
+ body: publishBody,
104
+ headers: { "content-type": "application/json" },
105
+ },
106
+ (cb) => resolve(cb)
107
+ )
108
+ );
109
+
110
+ expect(mockAddApp).toHaveBeenCalledTimes(1);
111
+ expect(mockAddApp).toHaveBeenCalledWith({
112
+ workingDir: "c:/tmp/app",
113
+ verbose: true,
114
+ server: "https://srv",
115
+ apiPort: 1205,
116
+ dbIndex: 2,
117
+ sub: "unit-sub",
118
+ files: [{ name: "a.js" }],
119
+ body: publishBody,
120
+ });
121
+ expect(response).toStrictEqual({ success: true, data: { uploaded: true } });
122
+ expect(process.env.BIZA_APP_SKIP_PARSE).toBeUndefined();
123
+
124
+ socket.disconnect();
125
+ });
126
+
127
+ test("publish-req should treat data.body as direct addApp http payload", async () => {
128
+ const subdomain = "publish-room-http";
129
+ const socket = ioClient(`http://localhost:${port}`);
130
+ await streamEvent(socket, {
131
+ server: `http://localhost:${port}`,
132
+ subdomain,
133
+ hostname: "localhost",
134
+ port: 212,
135
+ serverport: 3002,
136
+ dbindex: 7,
137
+ });
138
+
139
+ const publishBody = {
140
+ verbose: false,
141
+ fileList: [{ name: "a.js" }],
142
+ scripts: {
143
+ "a.js": "get = function () { return {direct: true} }",
144
+ },
145
+ };
146
+
147
+ const response = await toPromise((resolve) =>
148
+ socketsBySubdomain[subdomain].emit(
149
+ "publish-req",
150
+ {
151
+ path: "/publish",
152
+ method: "POST",
153
+ query: { subdomain },
154
+ body: publishBody,
155
+ headers: { "content-type": "application/json" },
156
+ },
157
+ (cb) => resolve(cb)
158
+ )
159
+ );
160
+
161
+ expect(mockAddApp).toHaveBeenCalledTimes(1);
162
+ expect(mockAddApp).toHaveBeenCalledWith({
163
+ workingDir: expect.any(String),
164
+ verbose: false,
165
+ server: `http://localhost:${port}`,
166
+ apiPort: 212,
167
+ dbIndex: 7,
168
+ sub: subdomain,
169
+ files: [{ name: "a.js" }],
170
+ body: publishBody,
171
+ });
172
+ expect(response).toStrictEqual({ success: true, data: { uploaded: true } });
173
+ expect(process.env.BIZA_APP_SKIP_PARSE).toBeUndefined();
174
+
175
+ socket.disconnect();
176
+ });
177
+
178
+ test("publish-req should support double-wrapper payload from HTTP client", async () => {
179
+ const subdomain = "publish-room-double-wrapper";
180
+ const socket = ioClient(`http://localhost:${port}`);
181
+ await streamEvent(socket, {
182
+ server: `http://localhost:${port}`,
183
+ subdomain,
184
+ hostname: "localhost",
185
+ port: 212,
186
+ serverport: 3002,
187
+ dbindex: 7,
188
+ });
189
+
190
+ const publishBody = {
191
+ fileList: [{ name: "menu.json" }, { name: "loginform.js" }],
192
+ scripts: {
193
+ "menu.json": '[{"menuName":"","caption":"Home","link":["./main"],"subMenu":[]}]',
194
+ "loginform.js": 'get = function () { return {model:{}, tableName:"", fields:[], functions:{ beforeLoadData: function (id) {} }}; };',
195
+ },
196
+ };
197
+
198
+ const response = await toPromise((resolve) =>
199
+ socketsBySubdomain[subdomain].emit(
200
+ "publish-req",
201
+ {
202
+ path: "/publish",
203
+ method: "POST",
204
+ query: { subdomain },
205
+ headers: { "content-type": "application/json" },
206
+ body: {
207
+ method: "POST",
208
+ query: { subdomain },
209
+ body: publishBody,
210
+ },
211
+ },
212
+ (cb) => resolve(cb)
213
+ )
214
+ );
215
+
216
+ expect(mockAddApp).toHaveBeenCalledTimes(1);
217
+ expect(mockAddApp).toHaveBeenCalledWith({
218
+ workingDir: expect.any(String),
219
+ verbose: false,
220
+ server: `http://localhost:${port}`,
221
+ apiPort: 212,
222
+ dbIndex: 7,
223
+ sub: subdomain,
224
+ files: [{ name: "menu.json" }, { name: "loginform.js" }],
225
+ body: publishBody,
226
+ });
227
+ expect(response).toStrictEqual({ success: true, data: { uploaded: true } });
228
+
229
+ socket.disconnect();
230
+ });
220
231
  });
@@ -0,0 +1,30 @@
1
+ import workerpool from 'workerpool';
2
+ import { loadCliScript, extractFunctionScript } from "../scheduler/datalib.js";
3
+ import { createLogger, transports, format } from "winston";
4
+
5
+ const logger = createLogger({ // logger must used worker thread context
6
+ level: 'info',
7
+ transports: [
8
+ new transports.File({ filename: 'log/error.log', level: 'error' }),
9
+ new transports.File({ filename: 'log/debug.log', level: 'debug' }),
10
+ new transports.File({ filename: 'log/info.log', level: 'info' }),
11
+ ],
12
+ });
13
+
14
+ if (process.env.NODE_ENV !== 'production') {
15
+ logger.add(new transports.Console({ format: format.simple(), level: 'info' }))
16
+ };
17
+
18
+ export const run = async (apiConfig, scriptName, scriptData)=>{
19
+ try {
20
+ const functions = await extractFunctionScript(apiConfig, await loadCliScript(apiConfig, 'SCRIPT_NAME', scriptName));
21
+ const result = (functions && functions.onInit) ? await functions.onInit(scriptData) : "'onInit' not found. Nothing to execute";
22
+ logger.info(`CLI script '${scriptName}' success. Result : ${result} ${process.env.NODE_ENV}`);
23
+ return result;
24
+ } catch (err) {
25
+ logger.error(`CLI script '${scriptName}' fail. Error : ${err.message || err}`);
26
+ throw new Error(err);
27
+ };
28
+ };
29
+
30
+ workerpool.worker({run}, {onTerminate: (code)=>{logger.info(`CLI script worker terminated. Exit code : (${code})`)}});
@@ -0,0 +1,18 @@
1
+ import workerpool from 'workerpool';
2
+
3
+ export const cliScriptWorkerPool = workerpool.pool(
4
+ "./worker/cliScriptWorker.js",
5
+ {
6
+ workerType: 'thread',
7
+ emitStdStreams: true, // the worker will emit stdout and stderr events instead of passing it through to the parent streams
8
+ workerThreadOpts: {env: {NODE_ENV: process.env.NODE_ENV || 'production'}}
9
+ });
10
+
11
+ export const execCLIScriptWorker = async (apiConfig, scriptName, scriptData)=>cliScriptWorkerPool.exec('run', [apiConfig, scriptName, scriptData]);
12
+
13
+ export const workerStats = ()=>{return {cliScript: cliScriptWorkerPool.stats()}};
14
+
15
+ // note: if process.exit is explicitly executed by internal code, then
16
+ // ensure to manually call workerpool.terminate() if available
17
+ // ortherwise ensure Operating system clean up worker when main thread terminated
18
+ process.on('beforeexit', async ()=>{await cliScriptWorkerPool.terminate()});
package/bin/log/debug.log DELETED
@@ -1,12 +0,0 @@
1
- {"level":"error","message":"Unhandled Rejection: Error: querySrv EREFUSED _mongodb._tcp.imm-cdm.ohcqt.mongodb.net","stack":"Error: Error: querySrv EREFUSED _mongodb._tcp.imm-cdm.ohcqt.mongodb.net\n at fetchCompanyObjectId (file:///c:/SourceCode/biz-a/cli/scheduler/configController.js:92:15)\n at async getCompanyObjectId (file:///c:/SourceCode/biz-a/cli/scheduler/configController.js:107:29)\n at async Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:51:21)"}
2
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:70:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:77:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:86:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:85:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
3
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
4
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
5
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:72:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
6
- {"level":"error","message":"Unhandled Rejection: TypeError: Cannot read properties of undefined (reading 'scriptid')","stack":"Error: TypeError: Cannot read properties of undefined (reading 'scriptid')\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:40:15)\n at file:///C:/SourceCode/biz-a/cli/bin/hub.js:137:5\n at Layer.handle [as handle_request] (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:328:13)\n at C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:286:9\n at router.process_params (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:346:12)\n at next (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:280:10)\n at jsonParser (C:\\SourceCode\\biz-a\\cli\\node_modules\\body-parser\\lib\\types\\json.js:113:7)\n at Layer.handle [as handle_request] (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:328:13)"}
7
- {"code":"ERR_INVALID_ARG_TYPE","level":"error","message":"Unhandled Exception: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket","stack":"TypeError [ERR_INVALID_ARG_TYPE]: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket\n at eos (node:internal/streams/end-of-stream:86:11)\n at IncomingMessage._destroy (node:_http_incoming:231:21)\n at _destroy (node:internal/streams/destroy:122:10)\n at IncomingMessage.destroy (node:internal/streams/destroy:84:5)\n at abortIncoming (node:_http_server:836:9)\n at socketOnClose (node:_http_server:830:3)\n at Socket.emit (node:events:520:35)\n at TCP.<anonymous> (node:net:346:12)"}
8
- {"level":"error","message":"Unhandled Exception:"}
9
- {"level":"error","message":"Unhandled Exception:"}
10
- {"level":"error","message":"Unhandled Exception:"}
11
- {"level":"error","message":"Unhandled Exception:"}
12
- {"level":"error","message":"Unhandled Exception:"}
package/bin/log/error.log DELETED
@@ -1,12 +0,0 @@
1
- {"level":"error","message":"Unhandled Rejection: Error: querySrv EREFUSED _mongodb._tcp.imm-cdm.ohcqt.mongodb.net","stack":"Error: Error: querySrv EREFUSED _mongodb._tcp.imm-cdm.ohcqt.mongodb.net\n at fetchCompanyObjectId (file:///c:/SourceCode/biz-a/cli/scheduler/configController.js:92:15)\n at async getCompanyObjectId (file:///c:/SourceCode/biz-a/cli/scheduler/configController.js:107:29)\n at async Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:51:21)"}
2
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:70:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:77:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:86:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:85:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
3
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
4
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
5
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:72:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
6
- {"level":"error","message":"Unhandled Rejection: TypeError: Cannot read properties of undefined (reading 'scriptid')","stack":"Error: TypeError: Cannot read properties of undefined (reading 'scriptid')\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:40:15)\n at file:///C:/SourceCode/biz-a/cli/bin/hub.js:137:5\n at Layer.handle [as handle_request] (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:328:13)\n at C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:286:9\n at router.process_params (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:346:12)\n at next (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:280:10)\n at jsonParser (C:\\SourceCode\\biz-a\\cli\\node_modules\\body-parser\\lib\\types\\json.js:113:7)\n at Layer.handle [as handle_request] (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:328:13)"}
7
- {"code":"ERR_INVALID_ARG_TYPE","level":"error","message":"Unhandled Exception: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket","stack":"TypeError [ERR_INVALID_ARG_TYPE]: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket\n at eos (node:internal/streams/end-of-stream:86:11)\n at IncomingMessage._destroy (node:_http_incoming:231:21)\n at _destroy (node:internal/streams/destroy:122:10)\n at IncomingMessage.destroy (node:internal/streams/destroy:84:5)\n at abortIncoming (node:_http_server:836:9)\n at socketOnClose (node:_http_server:830:3)\n at Socket.emit (node:events:520:35)\n at TCP.<anonymous> (node:net:346:12)"}
8
- {"level":"error","message":"Unhandled Exception:"}
9
- {"level":"error","message":"Unhandled Exception:"}
10
- {"level":"error","message":"Unhandled Exception:"}
11
- {"level":"error","message":"Unhandled Exception:"}
12
- {"level":"error","message":"Unhandled Exception:"}
@@ -1,6 +0,0 @@
1
- {"date":"Thu Mar 05 2026 17:59:10 GMT+0700 (Indochina Time)","error":{"code":"ERR_INVALID_ARG_TYPE"},"exception":true,"level":"error","message":"uncaughtException: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket\nTypeError [ERR_INVALID_ARG_TYPE]: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket\n at eos (node:internal/streams/end-of-stream:86:11)\n at IncomingMessage._destroy (node:_http_incoming:231:21)\n at _destroy (node:internal/streams/destroy:122:10)\n at IncomingMessage.destroy (node:internal/streams/destroy:84:5)\n at abortIncoming (node:_http_server:836:9)\n at socketOnClose (node:_http_server:830:3)\n at Socket.emit (node:events:520:35)\n at TCP.<anonymous> (node:net:346:12)","os":{"loadavg":[0,0,0],"uptime":10823.218},"process":{"argv":["C:\\nvm4w\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","https://devserver.biz-a.id","--sub","scydev","--hostname","localhost","--port","212","--publish","true"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\nvm4w\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":42160,"external":3925800,"heapTotal":24539136,"heapUsed":21219944,"rss":76513280},"pid":8104,"uid":null,"version":"v24.9.0"},"stack":"TypeError [ERR_INVALID_ARG_TYPE]: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket\n at eos (node:internal/streams/end-of-stream:86:11)\n at IncomingMessage._destroy (node:_http_incoming:231:21)\n at _destroy (node:internal/streams/destroy:122:10)\n at IncomingMessage.destroy (node:internal/streams/destroy:84:5)\n at abortIncoming (node:_http_server:836:9)\n at socketOnClose (node:_http_server:830:3)\n at Socket.emit (node:events:520:35)\n at TCP.<anonymous> (node:net:346:12)","trace":[{"column":11,"file":"node:internal/streams/end-of-stream","function":"eos","line":86,"method":null,"native":false},{"column":21,"file":"node:_http_incoming","function":"IncomingMessage._destroy","line":231,"method":"_destroy","native":false},{"column":10,"file":"node:internal/streams/destroy","function":"_destroy","line":122,"method":null,"native":false},{"column":5,"file":"node:internal/streams/destroy","function":"IncomingMessage.destroy","line":84,"method":"destroy","native":false},{"column":9,"file":"node:_http_server","function":"abortIncoming","line":836,"method":null,"native":false},{"column":3,"file":"node:_http_server","function":"socketOnClose","line":830,"method":null,"native":false},{"column":35,"file":"node:events","function":"Socket.emit","line":520,"method":"emit","native":false},{"column":12,"file":"node:net","function":null,"line":346,"method":null,"native":false}]}
2
- {"date":"Tue Mar 10 2026 16:32:59 GMT+0700 (Indochina Time)","error":"subdomain already claimed","exception":true,"level":"error","message":"uncaughtException: subdomain already claimed\n No stack trace","os":{"loadavg":[0,0,0],"uptime":21495.281},"process":{"argv":["C:\\nvm4w\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","https://devserver.biz-a.id","--sub","scydev","--hostname","localhost","--port","212","--publish","false"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\nvm4w\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":59701,"external":3958329,"heapTotal":23490560,"heapUsed":21529216,"rss":75493376},"pid":12400,"uid":null,"version":"v24.9.0"},"trace":[]}
3
- {"date":"Tue Mar 10 2026 16:33:18 GMT+0700 (Indochina Time)","error":"subdomain already claimed","exception":true,"level":"error","message":"uncaughtException: subdomain already claimed\n No stack trace","os":{"loadavg":[0,0,0],"uptime":21514.375},"process":{"argv":["C:\\nvm4w\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","https://devserver.biz-a.id","--sub","scydev","--hostname","localhost","--port","212","--publish","false"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\nvm4w\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":55841,"external":3954469,"heapTotal":38895616,"heapUsed":24237224,"rss":87363584},"pid":1084,"uid":null,"version":"v24.9.0"},"trace":[]}
4
- {"date":"Tue Mar 10 2026 16:33:38 GMT+0700 (Indochina Time)","error":"subdomain already claimed","exception":true,"level":"error","message":"uncaughtException: subdomain already claimed\n No stack trace","os":{"loadavg":[0,0,0],"uptime":21533.64},"process":{"argv":["C:\\nvm4w\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","https://devserver.biz-a.id","--sub","scydev","--hostname","localhost","--port","212","--publish","false"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\nvm4w\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":51015,"external":3944647,"heapTotal":38633472,"heapUsed":24112424,"rss":85905408},"pid":10868,"uid":null,"version":"v24.9.0"},"trace":[]}
5
- {"date":"Thu Mar 12 2026 11:26:48 GMT+0700 (Indochina Time)","error":"subdomain already claimed","exception":true,"level":"error","message":"uncaughtException: subdomain already claimed\n No stack trace","os":{"loadavg":[0,0,0],"uptime":7485.546},"process":{"argv":["C:\\nvm4w\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","https://devserver.biz-a.id","--sub","scydev","--hostname","localhost","--port","212","--publish","false","--hub"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\nvm4w\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":64622,"external":3965748,"heapTotal":23228416,"heapUsed":22045744,"rss":78213120},"pid":3108,"uid":null,"version":"v24.9.0"},"trace":[]}
6
- {"date":"Thu Mar 12 2026 11:26:59 GMT+0700 (Indochina Time)","error":"subdomain already claimed","exception":true,"level":"error","message":"uncaughtException: subdomain already claimed\n No stack trace","os":{"loadavg":[0,0,0],"uptime":7496.515},"process":{"argv":["C:\\nvm4w\\nodejs\\node.exe","C:\\SourceCode\\biz-a\\cli\\bin\\hub","--server","https://devserver.biz-a.id","--sub","scydev","--hostname","localhost","--port","212","--publish","false"],"cwd":"C:\\SourceCode\\biz-a\\cli\\bin","execPath":"C:\\nvm4w\\nodejs\\node.exe","gid":null,"memoryUsage":{"arrayBuffers":46355,"external":3942485,"heapTotal":38895616,"heapUsed":24416256,"rss":86667264},"pid":1948,"uid":null,"version":"v24.9.0"},"trace":[]}
package/bin/log/info.log DELETED
@@ -1,12 +0,0 @@
1
- {"level":"error","message":"Unhandled Rejection: Error: querySrv EREFUSED _mongodb._tcp.imm-cdm.ohcqt.mongodb.net","stack":"Error: Error: querySrv EREFUSED _mongodb._tcp.imm-cdm.ohcqt.mongodb.net\n at fetchCompanyObjectId (file:///c:/SourceCode/biz-a/cli/scheduler/configController.js:92:15)\n at async getCompanyObjectId (file:///c:/SourceCode/biz-a/cli/scheduler/configController.js:107:29)\n at async Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:51:21)"}
2
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:70:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:77:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:86:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:85:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
3
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
4
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:70:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
5
- {"level":"error","message":"Unhandled Rejection: Invalid time zone specified: null","stack":"RangeError: Invalid time zone specified: null\n at Date.toLocaleString (<anonymous>)\n at f.tz (c:\\SourceCode\\biz-a\\cli\\node_modules\\dayjs\\plugin\\timezone.js:1:1041)\n at setTimeZoneDate (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:79:23)\n at isItTime (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:84:26)\n at file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:93:33\n at Array.map (<anonymous>)\n at loopTimer (file:///c:/SourceCode/biz-a/cli/scheduler/watcherlib.js:92:27)\n at Module.runScheduler (file:///c:/SourceCode/biz-a/cli/scheduler/timer.js:72:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
6
- {"level":"error","message":"Unhandled Rejection: TypeError: Cannot read properties of undefined (reading 'scriptid')","stack":"Error: TypeError: Cannot read properties of undefined (reading 'scriptid')\n at runCliScript (file:///C:/SourceCode/biz-a/cli/callbackController.js:40:15)\n at file:///C:/SourceCode/biz-a/cli/bin/hub.js:137:5\n at Layer.handle [as handle_request] (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:328:13)\n at C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:286:9\n at router.process_params (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:346:12)\n at next (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:280:10)\n at jsonParser (C:\\SourceCode\\biz-a\\cli\\node_modules\\body-parser\\lib\\types\\json.js:113:7)\n at Layer.handle [as handle_request] (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\layer.js:95:5)\n at trim_prefix (C:\\SourceCode\\biz-a\\cli\\node_modules\\express\\lib\\router\\index.js:328:13)"}
7
- {"code":"ERR_INVALID_ARG_TYPE","level":"error","message":"Unhandled Exception: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket","stack":"TypeError [ERR_INVALID_ARG_TYPE]: The \"stream\" argument must be an instance of ReadableStream, WritableStream, or Stream. Received an instance of Socket\n at eos (node:internal/streams/end-of-stream:86:11)\n at IncomingMessage._destroy (node:_http_incoming:231:21)\n at _destroy (node:internal/streams/destroy:122:10)\n at IncomingMessage.destroy (node:internal/streams/destroy:84:5)\n at abortIncoming (node:_http_server:836:9)\n at socketOnClose (node:_http_server:830:3)\n at Socket.emit (node:events:520:35)\n at TCP.<anonymous> (node:net:346:12)"}
8
- {"level":"error","message":"Unhandled Exception:"}
9
- {"level":"error","message":"Unhandled Exception:"}
10
- {"level":"error","message":"Unhandled Exception:"}
11
- {"level":"error","message":"Unhandled Exception:"}
12
- {"level":"error","message":"Unhandled Exception:"}