work-dispatcher 1.6.2 → 1.7.1
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/dist/dummyStart.js +2 -1
- package/dist/dummyStart.js.map +1 -1
- package/dist/server/router.d.ts.map +1 -1
- package/dist/server/router.js +6 -17
- package/dist/server/router.js.map +1 -1
- package/dist/work/dummyError.d.ts +3 -0
- package/dist/work/dummyError.d.ts.map +1 -0
- package/dist/work/dummyError.js +10 -0
- package/dist/work/dummyError.js.map +1 -0
- package/package.json +1 -4
- package/res/views/index.ejs +2 -2
- package/keycloak.json +0 -9
package/dist/dummyStart.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { init } from './server/init.js';
|
|
2
|
+
import { DUMMY_ERROR_FEATURE } from './work/dummyError.js';
|
|
2
3
|
function errorHandler(err) {
|
|
3
4
|
console.error('Oh no:', err);
|
|
4
5
|
}
|
|
5
6
|
init({
|
|
6
7
|
errorHandler: errorHandler,
|
|
7
8
|
}, {
|
|
8
|
-
ALL: [],
|
|
9
|
+
ALL: [DUMMY_ERROR_FEATURE],
|
|
9
10
|
STARTUP: [],
|
|
10
11
|
TRIGGERED: [],
|
|
11
12
|
DEBUG: [],
|
package/dist/dummyStart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dummyStart.js","sourceRoot":"","sources":["../src/dummyStart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"dummyStart.js","sourceRoot":"","sources":["../src/dummyStart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,SAAS,YAAY,CAAC,GAAU;IAC9B,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,IAAI,CACF;IACE,YAAY,EAAE,YAAY;CAC3B,EACD;IACE,GAAG,EAAE,CAAC,mBAAmB,CAAC;IAC1B,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;IACb,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,EAAE;IACf,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,EAAE;CACT,EACD,OAAO,EACP,aAAa,CACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,MAAM,4CAAW,CAAC"}
|
package/dist/server/router.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { info } from '../utils/logging.js';
|
|
3
|
-
import session from 'express-session';
|
|
4
|
-
import Keycloak from 'keycloak-connect';
|
|
5
3
|
import { getDispatcherVersion } from '../utils/version.js';
|
|
6
4
|
import { addEventToList, addFeaturesToQ, currentlyWorkingOn, getCurrentFeature, getCurrentQ, getPastQ, resetQ, skipCurrentlyWorkingFeature, terminate } from '../work/workQ.js';
|
|
7
5
|
import { dispatcherConfig } from '../config/config.js';
|
|
@@ -9,16 +7,7 @@ import { getHealth } from '../work/health.js';
|
|
|
9
7
|
import { FeatureCatalog } from '../work/featureCatalogClass.js';
|
|
10
8
|
const startupTime = Date.now();
|
|
11
9
|
export const router = Router();
|
|
12
|
-
|
|
13
|
-
router.use(session({
|
|
14
|
-
secret: 'ZortBVOnKsDsGNQZZ9cBrBZee0qxKKF2',
|
|
15
|
-
resave: false,
|
|
16
|
-
saveUninitialized: true,
|
|
17
|
-
store: memoryStore,
|
|
18
|
-
}));
|
|
19
|
-
const keycloak = new Keycloak({ store: memoryStore });
|
|
20
|
-
router.use(keycloak.middleware({ logout: '/logout' }));
|
|
21
|
-
router.get('/', keycloak.protect('admin'), (_req, res) => {
|
|
10
|
+
router.get('/', (_req, res) => {
|
|
22
11
|
res.render(import.meta.dirname + '/../../res/views/index', {
|
|
23
12
|
startupTime: new Date(startupTime).toLocaleString(),
|
|
24
13
|
pageTitle: dispatcherConfig.softwareName,
|
|
@@ -40,7 +29,7 @@ router.get('/', keycloak.protect('admin'), (_req, res) => {
|
|
|
40
29
|
},
|
|
41
30
|
});
|
|
42
31
|
});
|
|
43
|
-
router.get('/trigger',
|
|
32
|
+
router.get('/trigger', (_req, res) => {
|
|
44
33
|
info('ROUT', 'REST triggered');
|
|
45
34
|
addEventToList('REST', null);
|
|
46
35
|
if (process.env['DEBUG'])
|
|
@@ -49,26 +38,26 @@ router.get('/trigger', keycloak.protect('admin'), (_req, res) => {
|
|
|
49
38
|
addFeaturesToQ(dispatcherConfig.featureCatalog.TRIGGERED);
|
|
50
39
|
res.redirect('/');
|
|
51
40
|
});
|
|
52
|
-
router.get('/pause',
|
|
41
|
+
router.get('/pause', (_req, res) => {
|
|
53
42
|
info('ROUT', 'PAUSE via REST triggered');
|
|
54
43
|
addEventToList('Pause', null);
|
|
55
44
|
resetQ();
|
|
56
45
|
addFeaturesToQ(FeatureCatalog.PAUSE_SYSTEM);
|
|
57
46
|
res.redirect('/');
|
|
58
47
|
});
|
|
59
|
-
router.get('/reset',
|
|
48
|
+
router.get('/reset', (_req, res) => {
|
|
60
49
|
info('ROUT', 'RESET via REST triggered');
|
|
61
50
|
addEventToList('Reset', null);
|
|
62
51
|
resetQ();
|
|
63
52
|
res.redirect('/');
|
|
64
53
|
});
|
|
65
|
-
router.get('/reboot',
|
|
54
|
+
router.get('/reboot', (_req, res) => {
|
|
66
55
|
info('ROUT', 'REBOOT via REST triggered');
|
|
67
56
|
terminate();
|
|
68
57
|
process.kill(process.pid, 'SIGTERM');
|
|
69
58
|
res.redirect('/');
|
|
70
59
|
});
|
|
71
|
-
router.get('/skip',
|
|
60
|
+
router.get('/skip', (_req, res) => {
|
|
72
61
|
info('ROUT', 'SKIP via REST triggered');
|
|
73
62
|
skipCurrentlyWorkingFeature();
|
|
74
63
|
res.redirect('/');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChL,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAE/B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IAC5B,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,wBAAwB,EAAE;QACzD,WAAW,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,cAAc,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 @@
|
|
|
1
|
+
import { sleep } from '../utils/generalUtil.js';
|
|
2
|
+
import { error, info } from '../utils/logging.js';
|
|
3
|
+
import { Feature } from './featureClass.js';
|
|
4
|
+
export const DUMMY_ERROR_FEATURE = new Feature('DUMMY_ERROR_FEATURE', work);
|
|
5
|
+
async function work() {
|
|
6
|
+
info('ERRO', 'Starting dummy error feature that will throw an error after 6 seconds.');
|
|
7
|
+
await sleep(0.1);
|
|
8
|
+
error('ERRO', 'This is a dummy error.');
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=dummyError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dummyError.js","sourceRoot":"","sources":["../../src/work/dummyError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;AAE5E,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC,MAAM,EAAE,wEAAwE,CAAC,CAAC;IACvF,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,KAAK,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "work-dispatcher",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Typescript library to handle task or work scheduling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/cors": "^2.8.19",
|
|
35
35
|
"@types/express": "^5.0.6",
|
|
36
|
-
"@types/express-session": "^1.18.2",
|
|
37
36
|
"@types/node": "^25.3.3",
|
|
38
37
|
"@vitest/coverage-v8": "^4.0.18",
|
|
39
38
|
"semantic-release": "^25.0.2",
|
|
@@ -45,8 +44,6 @@
|
|
|
45
44
|
"cors": "^2.8.5",
|
|
46
45
|
"ejs": "^4.0.1",
|
|
47
46
|
"express": "^5.2.1",
|
|
48
|
-
"express-session": "^1.18.2",
|
|
49
|
-
"keycloak-connect": "^26.1.1",
|
|
50
47
|
"node-cron": "^4.2.1",
|
|
51
48
|
"redis": "^5.11.0"
|
|
52
49
|
}
|
package/res/views/index.ejs
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
setTimeout(function () {
|
|
16
16
|
localStorage.setItem('scrollpos', window.scrollY);
|
|
17
17
|
window.location.href = window.location.pathname; // This removes query parameters
|
|
18
|
-
},
|
|
18
|
+
}, 5000); // 5 seconds
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
window.onbeforeunload = function (e) {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
<ul>
|
|
99
99
|
<% for(var i=0; i < pastQ.length; i++) { %>
|
|
100
100
|
<li
|
|
101
|
-
class="flexContainer <%=
|
|
101
|
+
class="flexContainer <%= pastQ[i].errorForFeature ? 'pastError' : (pastQ[i].result && pastQ[i].result.length > 0) ? 'pastResult' : 'pastQ' %> <%= (pastQ[i].type === 'EVENT') ? ' eventType' : '' %>"
|
|
102
102
|
>
|
|
103
103
|
<span style="flex: 2 0 40%"> <%= pastQ[i].name; %> </span>
|
|
104
104
|
<span style="flex: 1 0 20%; text-align: right"><b> <%= pastQ[i].durationString; %> </b></span>
|