biz-a-cli 2.3.15 → 2.3.16

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/bin/hubEvent.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Axios } from 'axios-observable';
1
+ import axios from 'axios';
2
2
  import net from 'node:net';
3
3
  import { createRequire } from "module";
4
4
  const require = createRequire(import.meta.url);
@@ -57,16 +57,17 @@ export default async (socket, argv) => new Promise((resolve, reject) => {
57
57
  s.end();
58
58
  });
59
59
  }
60
- const cliReqCb = (data, callback) => {
60
+ const cliReqCb = async (data, callback) => {
61
61
  const { path, method, ...remainData } = data;
62
62
 
63
- Axios.request({
63
+ const result = await axios.request({
64
64
  method: data.method,
65
65
  url: `${process.env.HOST || 'http://localhost'}:${argv.serverport}/cb${path || ''}`,
66
66
  data: remainData
67
- }).subscribe(result => callback(result.data));
67
+ })
68
+ callback(result.data);
68
69
  }
69
70
  socket.on('connect', connectCb);
70
71
  socket.on('incomingClient', incomingHubCb)
71
- socket.on('cli-req', cliReqCb );
72
+ socket.on('cli-req', cliReqCb);
72
73
  })
@@ -10,7 +10,7 @@ export function getInputScript(req) {
10
10
  path: req.path,
11
11
  query: req.body.query,
12
12
  headers: req.body.headers,
13
- socket : req.app.settings.socket,
13
+ socket: req.app.settings.socket,
14
14
  },
15
15
  selectedConfig: {
16
16
  url: `http://${args.hostname}:${args.port}`,
@@ -21,22 +21,19 @@ export function getInputScript(req) {
21
21
  }
22
22
 
23
23
  export async function runCliScript(req, res) {
24
-
25
- const { data, selectedConfig } = getInputScript(req);
26
- loadCliScript(selectedConfig, req.body.query).subscribe({
27
- next: async script => {
28
- let functions = extractFunctionScript(script);
29
- if (functions) {
30
- let respon = await functions.onInit(data);
31
- res.send(respon);
32
- console.log(`Run Callback Successfully!`);
33
- } else {
34
- res.send('CLI Script does not exist.');
35
- }
36
- },
37
- error: error => {
38
- console.error(error);
39
- throw new Error(error);
24
+ try {
25
+ const { data, selectedConfig } = getInputScript(req);
26
+ let script = await loadCliScript(selectedConfig, req.body.query);
27
+ let functions = extractFunctionScript(script);
28
+ if (functions) {
29
+ let respon = await functions.onInit(data);
30
+ res.send(respon);
31
+ console.log(`Run Callback Successfully!`);
32
+ } else {
33
+ res.send('CLI Script does not exist.');
40
34
  }
41
- })
35
+ } catch (error) {
36
+ console.error(error);
37
+ throw new Error(error);
38
+ }
42
39
  }
package/mailController.js CHANGED
@@ -15,12 +15,12 @@ export function sendMailWatcher(req) {
15
15
  console.log(err.message);
16
16
  return err.message;
17
17
  } else {
18
- console.log(info);
18
+ console.log('Info:' + info);
19
19
  return info;
20
20
  }
21
21
  })
22
22
  } catch (err) {
23
- console.log(err.message);
23
+ console.log('Error: ' + err.message);
24
24
  return err.message;
25
25
  }
26
26
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "biz-a-cli",
3
3
  "nameDev": "biz-a-cli-dev",
4
- "version": "2.3.15",
5
- "versionDev": "0.0.29",
4
+ "version": "2.3.16",
5
+ "versionDev": "0.0.30",
6
6
  "description": "",
7
7
  "main": "bin/index.js",
8
8
  "type": "module",
@@ -28,7 +28,6 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "axios": "^1.6.8",
31
- "axios-observable": "^2.0.0",
32
31
  "cors": "^2.8.5",
33
32
  "dayjs": "^1.11.10",
34
33
  "express": "^4.18.3",
@@ -1,5 +1,3 @@
1
- import { map, tap } from "rxjs";
2
- import { Axios } from 'axios-observable';
3
1
  import { runInThisContext, constants } from "vm";
4
2
  import { insertHistory } from "./watcherController.js";
5
3
  import axios from "axios";
@@ -7,7 +5,7 @@ import * as dayjs from "dayjs";
7
5
  import timezone from "dayjs/plugin/timezone.js";
8
6
  import utc from "dayjs/plugin/utc.js"
9
7
  import crypto from "crypto";
10
- import {createLogger, transports, format, config} from "winston";
8
+ import { createLogger, transports, format } from "winston";
11
9
 
12
10
  import customParseFormat from 'dayjs/plugin/customParseFormat.js'
13
11
  dayjs.default.extend(customParseFormat)
@@ -15,16 +13,16 @@ dayjs.default.extend(timezone)
15
13
  dayjs.default.extend(utc)
16
14
 
17
15
  const logger = createLogger({
18
- level:'info',
19
- transports:[
20
- new transports.File({filename:'log/error.log', level:'error'}),
21
- new transports.File({filename:'log/debug.log', level:'debug'}),
22
- new transports.File({filename:'log/info.log', level:'info'}),
23
- new transports.File({filename:'log/exception.log', handleExceptions:true})
16
+ level: 'info',
17
+ transports: [
18
+ new transports.File({ filename: 'log/error.log', level: 'error' }),
19
+ new transports.File({ filename: 'log/debug.log', level: 'debug' }),
20
+ new transports.File({ filename: 'log/info.log', level: 'info' }),
21
+ new transports.File({ filename: 'log/exception.log', handleExceptions: true })
24
22
  ],
25
23
  })
26
- if (process.env.NODE_ENV !== 'production'){
27
- logger.add(new transports.Console({format: format.simple(), level:'info'}))
24
+ if (process.env.NODE_ENV !== 'production') {
25
+ logger.add(new transports.Console({ format: format.simple(), level: 'info' }))
28
26
  }
29
27
 
30
28
 
@@ -40,7 +38,7 @@ if (process.env.NODE_ENV !== 'production'){
40
38
 
41
39
  function mapData2Key(res, cols) {
42
40
  return res.map(e => {
43
- return cols.reduce((o, k) => {
41
+ return cols.reduce((o, k) => {
44
42
  o[k.key ? k.key : k.data] = e[k.data]
45
43
  return o;
46
44
  }, {})
@@ -92,10 +90,10 @@ export function sendModel(model, apiConfig, tableName) {
92
90
  params: { subdomain: apiConfig.subdomain }
93
91
  }
94
92
 
95
- return Axios.post(url, params, options)
93
+ return axios.post(url, params, options)
96
94
  }
97
95
 
98
- export function queryData(param, apiConfig, mapField) {
96
+ export async function queryData(param, apiConfig, mapField) {
99
97
  const defaultParam = {
100
98
  start: 0, length: -1, order: [], filter: [], columns: []
101
99
  };
@@ -112,17 +110,12 @@ export function queryData(param, apiConfig, mapField) {
112
110
  params: { subdomain: apiConfig.subdomain }
113
111
  }
114
112
 
115
- return Axios.post(url, params, options).pipe(
116
- // tap(res=>console.log(res, 'res')),
117
- map(res => res.data?.data ? JSON.parse(res.data.data) : res.data),
118
- map(res => {
119
- if (!mapField || res.error) return res;
120
- return mapData2Key(res, param.columns)
121
- })
122
- )
113
+ let res = await axios.post(url, params, options);
114
+ res = res.data?.data ? JSON.parse(res.data.data) : res.data;
115
+ return (!mapField || res.error) ? res : mapData2Key(res, param.columns);
123
116
  }
124
117
 
125
- export function crudData(param, apiConfig, method, path) {
118
+ export async function crudData(param, apiConfig, method, path) {
126
119
  const { url, params } = getUrlAndParam(
127
120
  apiConfig,
128
121
  method,
@@ -135,20 +128,18 @@ export function crudData(param, apiConfig, method, path) {
135
128
  params: { subdomain: apiConfig.subdomain }
136
129
  }
137
130
 
138
- return Axios.post(url, params, options).pipe(
139
- map(res => res.data?.data ? JSON.parse(res.data.data) : res.data),
140
- )
131
+ const res = await axios.post(url, params, options);
132
+ return res.data?.data ? JSON.parse(res.data.data) : res.data;
141
133
  }
142
134
 
143
- export function genId(apiConfig, genName) {
135
+ export async function genId(apiConfig, genName) {
144
136
  const url = `${getUrlApi(apiConfig, 'genId', false)}/${genName}/${apiConfig.dbindex}`;
145
137
  const options = {
146
138
  headers: { 'content-type': 'text/plain' },
147
139
  params: { subdomain: apiConfig.subdomain }
148
140
  }
149
- return Axios.get(url, options).pipe(
150
- map(res => res.data?.data ? JSON.parse(res.data.data) : res.data),
151
- )
141
+ const res = await axios.get(url, options);
142
+ return res.data?.data ? JSON.parse(res.data.data) : res.data;
152
143
  }
153
144
 
154
145
  export function extractFunctionScript(data) {
@@ -161,13 +152,12 @@ export function extractFunctionScript(data) {
161
152
  const scriptFn = runInThisContext(data[0].script, { importModuleDynamically: constants.USE_MAIN_CONTEXT_DEFAULT_LOADER });
162
153
  if (!scriptFn().functions) return
163
154
  let lib = {
164
- axios : axios.default,
165
- dayjs : dayjs.default,
155
+ axios: axios.default,
156
+ dayjs: dayjs.default,
166
157
  crypto: crypto,
167
- log : logger,
158
+ log: logger,
168
159
  }
169
160
  return scriptFn(lib).functions;
170
- // return JSON.parse(JSON.stringify(scriptFn.functions), deserialise)
171
161
  }
172
162
 
173
163
  export function getQueryDataObsParameters(trigger) {
@@ -178,7 +168,7 @@ export function getQueryDataObsParameters(trigger) {
178
168
  }
179
169
  }
180
170
 
181
- export function queryDataObservable(config, trigger) {
171
+ export function queryDataPromise(config, trigger) {
182
172
  let param = getQueryDataObsParameters(trigger);
183
173
 
184
174
  return queryData(param, config, true);
@@ -191,9 +181,7 @@ export function getConfig(config) {
191
181
  export function loadCliScript(selectedConfig, trigger) {
192
182
  const config = getConfig(selectedConfig);
193
183
 
194
- return queryDataObservable(config, trigger).pipe(
195
- // throttleTime(100)
196
- )
184
+ return queryDataPromise(config, trigger);
197
185
  }
198
186
 
199
187
  export function getInputData(config, trigger) {
@@ -203,13 +191,21 @@ export function getInputData(config, trigger) {
203
191
  hostname: urlAndPort[1].split('//')[1],
204
192
  port: +urlAndPort[2],
205
193
  dbindex: config.dbindex,
206
- subdomain: config.subdomain
194
+ finaDbIndex: config.finaDbIndex,
195
+ subdomain: config.subdomain,
196
+ smtp: {
197
+ user: config.smtp.auth.user,
198
+ pass:config.smtp.auth.pass,
199
+ host: config.smtp.host,
200
+ port: config.smtp.port,
201
+ secure: config.smtp.secure
202
+ }
207
203
  },
208
204
  body: trigger.data
209
205
  }
210
206
  }
211
207
 
212
- export function scheduleSubscription(config, data, trigger, needSetHistory, isTest = false) {
208
+ export async function scheduleSubscription(config, data, trigger, needSetHistory, isTest = false) {
213
209
  try {
214
210
  let functions = extractFunctionScript(data);
215
211
  if (functions) {
@@ -218,7 +214,7 @@ export function scheduleSubscription(config, data, trigger, needSetHistory, isTe
218
214
  }
219
215
 
220
216
  if (needSetHistory) {
221
- insertHistory(config, trigger._id, new Date());
217
+ await insertHistory(config, trigger._id, new Date());
222
218
  console.log(`Run Recent Schedule : ${trigger.name}`);
223
219
  } else {
224
220
  console.log(`Run Schedule : ${trigger.name}`);
@@ -232,12 +228,12 @@ export function scheduleSubscription(config, data, trigger, needSetHistory, isTe
232
228
  }
233
229
  }
234
230
 
235
- export function checkSchedule(selectedConfig, trigger, needSetHistory) {
236
- loadCliScript(selectedConfig, trigger).subscribe({
237
- next: data => scheduleSubscription(selectedConfig, data, trigger, needSetHistory),
238
- error: error => {
239
- console.error(error);
240
- throw new Error(error);
241
- }
242
- })
231
+ export async function checkSchedule(selectedConfig, trigger, needSetHistory) {
232
+ try {
233
+ const data = await loadCliScript(selectedConfig, trigger);
234
+ await scheduleSubscription(selectedConfig, data, trigger, needSetHistory);
235
+ } catch (error) {
236
+ console.error(error);
237
+ throw new Error(error);
238
+ }
243
239
  }
@@ -3,7 +3,6 @@ import { getWatchers, getHistories } from "./watcherController.js";
3
3
  import { isItTime, loopTimer } from "./watcherlib.js"
4
4
  import { setInterval } from 'timers/promises';
5
5
  import { getCompanyObjectId, getSelectedConfig } from "../scheduler/configController.js";
6
- import { forkJoin } from 'rxjs';
7
6
  import { historyRecordToJson, watcherRecordToJson, setUtcDate } from "./converter.js";
8
7
 
9
8
  export const delay = ms => new Promise(res => setTimeout(res, ms));
@@ -22,7 +21,6 @@ export function getSelectedData(data, field, compareData) {
22
21
 
23
22
  async function executeHistory(config, timer, rawLatestRun, currentTime) {
24
23
  let latestRun = setUtcDate(rawLatestRun);
25
- console.log(latestRun);
26
24
 
27
25
  while ((latestRun < currentTime) &&
28
26
  ((currentTime - latestRun) >= SCHEDULE_INTERVAL)) {
@@ -53,26 +51,22 @@ export const runScheduler = async (companyName) => {
53
51
  const company = await getCompanyObjectId(companyName);
54
52
  const config = await getSelectedConfig(company._id);
55
53
 
56
- forkJoin([getHistories(config), getWatchers(config)]).subscribe({
57
- next: ([historyResult, watcherResult]) => {
54
+ Promise.all([getHistories(config), getWatchers(config)])
55
+ .then(([historyResult, watcherResult]) => {
58
56
  const histories = historyRecordToJson(historyResult);
59
57
  const watchers = watcherRecordToJson(watcherResult);
60
58
  runHistory(histories, config, watchers, new Date());
61
- }
62
- });
59
+ });
63
60
 
64
61
  for await (const startTime of setInterval(SCHEDULE_INTERVAL, Date.now())) {
65
62
  // if ((now - startTime) > 1000)
66
63
  // break;
67
64
 
68
- getWatchers(config).subscribe({
69
- next: result => {
70
- const watchers = watcherRecordToJson(result);
71
- for (const watcher of watchers) {
72
- loopTimer(watcher.timer, Date.now(), config, true);
73
- }
74
- }
75
- });
65
+ const result = await getWatchers(config);
66
+ const watchers = watcherRecordToJson(result);
67
+ for (const watcher of watchers) {
68
+ loopTimer(watcher.timer, Date.now(), config, true);
69
+ }
76
70
 
77
71
  // // reload == true ?
78
72
  }
@@ -1,6 +1,3 @@
1
- import { from, tap } from 'rxjs';
2
- import { concatMap, map, catchError } from 'rxjs/operators';
3
-
4
1
  import { crudData, genId, queryData } from '../scheduler/datalib.js';
5
2
 
6
3
  //LIST
@@ -15,7 +12,6 @@ export function getWatcherParameters(watcherFilter) {
15
12
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.NAME", key: 'name' },
16
13
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.ACTIVE", key: 'active' },
17
14
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.TIME_ZONE", key: 'timezone' },
18
- // { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.SCRIPT_NAME", key: 'templateName' },
19
15
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.SEQ", key: 'seq' },
20
16
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.SCRIPT_ID", key: 'scriptid' },
21
17
  { data: "SYS$TIMER.ID.TIMER_ID.SYS$DAILY.DAYS", key: 'daily_days' },
@@ -66,25 +62,19 @@ export function getHistoryField(timerObjectId, historyId, currentDate) {
66
62
  }
67
63
  }
68
64
 
69
- export function insertHistory(config, timerObjectId, currentDate) {
70
- const listData = getInsertHistoryParameters(timerObjectId);
71
-
72
- queryData(listData, config, true, 'list', 'list')
73
- .pipe(
74
- concatMap(historyResponse => {
75
- const history = historyResponse[0];
65
+ export async function insertHistory(config, timerObjectId, currentDate) {
66
+ try {
67
+ const listData = getInsertHistoryParameters(timerObjectId);
76
68
 
77
- return history ? from([parseInt(history.history_id)]) : genId(config, 'SYS$HISTORY_GEN');
78
- }),
79
- map(historyId => {
80
- return getHistoryField(timerObjectId, historyId, currentDate);
81
- }),
82
- concatMap(param => crudData(param, config, 'put', 'orm')),
83
- catchError(error => {
84
- console.error(error);
85
- return new Error(error);
86
- })
87
- ).subscribe();
69
+ const historyResponse = await queryData(listData, config, true, 'list', 'list')
70
+ const history = historyResponse[0];
71
+ const historyId = history ? parseInt(history.history_id) : await genId(config, 'SYS$HISTORY_GEN');
72
+ const param = getHistoryField(timerObjectId, historyId, currentDate);
73
+ await crudData(param, config, 'put', 'orm')
74
+ } catch (error) {
75
+ console.error(error);
76
+ return new Error(error);
77
+ }
88
78
  }
89
79
 
90
80
  export function getHistoryParameters() {
@@ -1,10 +1,3 @@
1
- // import { jest } from '@jest/globals'
2
-
3
- // const mockInsertHistory = jest.fn();
4
- // jest.unstable_mockModule("../scheduler/watcherController.js", () => ({
5
- // insertHistory: mockInsertHistory.mockResolvedValue('OK')
6
- // }))
7
-
8
1
  const {
9
2
  getInputScript
10
3
  } = await import('../callbackController.js');
@@ -20,24 +13,23 @@ describe('callback test', () => {
20
13
 
21
14
  const request = {
22
15
  app: { settings: { args: args } },
23
- body: {
16
+ body: {
24
17
  body: { body1: 'value1' },
25
- headers:{connection:'keep-alive'}
18
+ headers: { connection: 'keep-alive' }
26
19
  },
27
- path:'pqr',
28
-
20
+ path: 'pqr',
29
21
  }
30
22
 
31
23
  expect(getInputScript(request)).toStrictEqual({
32
24
  data: {
33
25
  arguments: args,
34
26
  body: { body1: 'value1' },
35
- path:'pqr',
36
- query:undefined,
37
- headers:{
38
- connection:'keep-alive'
27
+ path: 'pqr',
28
+ query: undefined,
29
+ headers: {
30
+ connection: 'keep-alive'
39
31
  },
40
- socket:undefined,
32
+ socket: undefined,
41
33
 
42
34
  },
43
35
  selectedConfig: {
@@ -48,6 +40,5 @@ describe('callback test', () => {
48
40
  });
49
41
  });
50
42
 
51
-
52
43
  })
53
44
 
@@ -75,7 +75,17 @@ describe('data test', () => {
75
75
  _id: 'ffffffff2ae49fab9ea654e1',
76
76
  url: 'http://localhost:212',
77
77
  dbindex: 2,
78
- subdomain: 'abc'
78
+ finaDbIndex: 1,
79
+ subdomain: 'abc',
80
+ smtp: {
81
+ auth: {
82
+ user: 'abc',
83
+ pass: '123'
84
+ },
85
+ host: 'mail.imamatek.com',
86
+ port: 465,
87
+ secure: true
88
+ }
79
89
  }
80
90
  const trigger = {
81
91
  data: {
@@ -89,7 +99,15 @@ describe('data test', () => {
89
99
  hostname: 'localhost',
90
100
  port: 212,
91
101
  dbindex: 2,
92
- subdomain: 'abc'
102
+ finaDbIndex: 1,
103
+ subdomain: 'abc',
104
+ smtp: {
105
+ user: 'abc',
106
+ pass: '123',
107
+ host: 'mail.imamatek.com',
108
+ port: 465,
109
+ secure: true
110
+ }
93
111
  },
94
112
  body: {
95
113
  _id: 1,
package/tests/hub.test.js CHANGED
@@ -3,8 +3,7 @@ import { createServer } from 'node:http'
3
3
  import hubEvent from '../bin/hubEvent.js'
4
4
  import { io as ioc } from "socket.io-client";
5
5
  import { jest } from '@jest/globals';
6
- import { of } from "rxjs";
7
- import { Axios } from "axios-observable";
6
+ import axios from "axios";
8
7
 
9
8
  let socketsBySubdomain = {};
10
9
 
@@ -15,7 +14,6 @@ const createSocket2CLI = (socket) => {
15
14
 
16
15
  socketsBySubdomain[subdomainStr] = socket;
17
16
  socket.subdomain = subdomainStr;
18
- // console.log(new Date() + ': ' + subdomainStr + ' registered successfully');
19
17
 
20
18
  responseCallback(null);
21
19
  }
@@ -38,7 +36,6 @@ describe('cli req test', () => {
38
36
  const startSocket = function startSocket(server) {
39
37
  let io = new Server(server);
40
38
  io.on('connection', (socket) => {
41
- // console.log('socket client connect')
42
39
  socket.on('createTunnel', createSocket2CLI(socket));
43
40
  socket.on('disconnect', deleteSubdomain(socket));
44
41
  });
@@ -61,7 +58,7 @@ describe('cli req test', () => {
61
58
  })
62
59
 
63
60
  test('request to cli', async () => {
64
- let mockedRequest = jest.spyOn(Axios, 'request').mockReturnValue(of({ data: 'OK' }));
61
+ let mockedRequest = jest.spyOn(axios, 'request').mockReturnValue({ data: 'OK' });
65
62
 
66
63
  let socket;
67
64
  try {
@@ -75,12 +72,11 @@ describe('cli req test', () => {
75
72
  });
76
73
 
77
74
  let result = await toPromise(resolve => socketsBySubdomain['scy'].emit(
78
- 'cli-req',
75
+ 'cli-req',
79
76
  {
80
- // path: '/a/b',
81
77
  method: 'POST',
82
78
  query: { subdomain: 'abc' }, body: { data: 'xyz' }
83
- },
79
+ },
84
80
  cb => resolve(cb)
85
81
  ))
86
82
 
@@ -1,12 +1,11 @@
1
1
  import { jest } from '@jest/globals';
2
- import { of } from "rxjs";
3
2
 
4
3
  let mockQueryData = jest.fn();
5
- let mockCrudData = jest.fn().mockImplementation(param => of(param));
4
+ let mockCrudData = jest.fn().mockImplementation(param => param);
6
5
 
7
6
  jest.unstable_mockModule('../scheduler/datalib.js', () => ({
8
7
  queryData: mockQueryData,
9
- genId: jest.fn().mockReturnValue(of(20)),
8
+ genId: jest.fn().mockReturnValue(20),
10
9
  crudData: mockCrudData
11
10
  }));
12
11
 
@@ -22,7 +21,6 @@ const {
22
21
  describe('Get Watcher Parameters', () => {
23
22
  test('get parameters', () => {
24
23
  expect(getWatcherParameters()).toStrictEqual({
25
- // filter: [{ junction: '', column: 'ID', operator: '=', value1: `'${watcherFilter?.companyObjectId}'` }],
26
24
  columns: [
27
25
  { data: "SYS$WATCHER.ID", key: 'watcher_id' },
28
26
  { data: "SYS$WATCHER.COMPANY_OBJ_ID", key: 'company_id' },
@@ -31,7 +29,6 @@ describe('Get Watcher Parameters', () => {
31
29
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.NAME", key: 'name' },
32
30
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.ACTIVE", key: 'active' },
33
31
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.TIME_ZONE", key: 'timezone' },
34
- // { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.SCRIPT_NAME", key: 'templateName' },
35
32
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.SEQ", key: 'seq' },
36
33
  { data: "SYS$WATCHER.ID.WATCHER_ID.SYS$TIMER.SCRIPT_ID", key: 'scriptid' },
37
34
  { data: "SYS$TIMER.ID.TIMER_ID.SYS$DAILY.DAYS", key: 'daily_days' },
@@ -95,10 +92,10 @@ describe('Get History Parameters', () => {
95
92
  })
96
93
 
97
94
  describe('Insert History', () => {
98
- test('has history', () => {
99
- mockQueryData.mockReturnValue(of([{ history_id: '10' }]));
95
+ test('has history', async() => {
96
+ mockQueryData.mockReturnValue([{ history_id: '10' }]);
100
97
 
101
- insertHistory({}, '1', '2024-03-06T14:37:16.610Z');
98
+ await insertHistory({}, '1', '2024-03-06T14:37:16.610Z');
102
99
  expect(mockCrudData).toHaveBeenCalledWith(
103
100
  {
104
101
  "SYS$HISTORY": {
@@ -109,11 +106,11 @@ describe('Insert History', () => {
109
106
  }, {}, "put", "orm");
110
107
  })
111
108
 
112
- test('no history', () => {
109
+ test('no history', async () => {
113
110
  jest.clearAllMocks();
114
- mockQueryData.mockReturnValue(of([]));
115
-
116
- insertHistory({}, '1', '2024-03-06T14:37:16.610Z');
111
+ mockQueryData.mockReturnValue([]);
112
+
113
+ await insertHistory({}, '1', '2024-03-06T14:37:16.610Z');
117
114
  expect(mockCrudData).toHaveBeenCalledWith(
118
115
  {
119
116
  "SYS$HISTORY": {
package/bin/log/debug.log DELETED
File without changes
package/bin/log/error.log DELETED
File without changes