@ti-engine/web-framework 1.19.0 → 1.19.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.
Files changed (38) hide show
  1. package/.env +4 -4
  2. package/CHANGELOG.md +362 -353
  3. package/README.md +73 -73
  4. package/bin/build/post-install.js +18 -18
  5. package/bin/localization/web-server-labels.json +27 -27
  6. package/bin/static/.well-known/appspecific/com.chrome.devtools.json +5 -5
  7. package/bin/static/fragments/components/component-notification-bar.html +21 -21
  8. package/bin/static/fragments/components/component-sidebar.html +33 -33
  9. package/bin/static/fragments/components/component-tooltip.html +10 -10
  10. package/bin/static/fragments/components/component-topbar.html +5 -5
  11. package/bin/static/fragments/frame-administration.html +2 -2
  12. package/bin/static/fragments/frame-application.html +18 -18
  13. package/bin/static/fragments/frame-dashboard.html +2 -2
  14. package/bin/static/fragments/frame-login.html +119 -119
  15. package/bin/static/fragments/frame-not-found.html +2 -2
  16. package/bin/static/fragments/frame-profile.html +2 -2
  17. package/bin/static/index.html +22 -22
  18. package/bin/static/scripts/ti-charts.js +1591 -1591
  19. package/bin/static/scripts/ti-framework.css +3194 -3194
  20. package/bin/static/scripts/ti-framework.js +1427 -1427
  21. package/bin/static/scripts/ti-theme-black-glass.css +216 -216
  22. package/bin/static/scripts/ti-theme-daylight.css +87 -87
  23. package/bin/web-app-manager.js +663 -663
  24. package/bin/web-server.js +936 -936
  25. package/bin/web-server.json +48 -48
  26. package/components/admin-config-handlers.js +92 -92
  27. package/components/auth-manager.js +441 -441
  28. package/components/authorization.js +135 -135
  29. package/components/config-change-notifier.js +98 -98
  30. package/components/config-registry.js +260 -260
  31. package/components/config-service.js +360 -360
  32. package/components/config-store.js +246 -246
  33. package/components/definitions.types.js +26 -26
  34. package/components/session-store.js +110 -110
  35. package/components/user.js +132 -132
  36. package/components/web-config-env.js +85 -85
  37. package/components/web-handlers.js +800 -800
  38. package/package.json +76 -67
@@ -1,49 +1,49 @@
1
- {
2
- "api": {
3
- "endpointEnabled": true,
4
- "inventory": {
5
- "v1": {
6
- "test-1": {
7
- "serviceAlias": "service1",
8
- "serviceDomainName": "ti-tester-service",
9
- "serviceVersion": 1
10
- }
11
- }
12
- },
13
- "requestTimeout": 120000
14
- },
15
- "auth": {
16
- "enabledMethods": [
17
- "local",
18
- "openid-google"
19
- ],
20
- "admins": [],
21
- "oauth2": {
22
- "azure": {
23
- "tokenEndpointAuthMethod": "client_secret_post",
24
- "callbackUrl": "/login/azure-callback",
25
- "isPublic": false
26
- },
27
- "google": {
28
- "tokenEndpointAuthMethod": "client_secret_post",
29
- "callbackUrl": "/login/google-callback",
30
- "discoveryUrl": "https://accounts.google.com/.well-known/openid-configuration",
31
- "isPublic": false
32
- }
33
- }
34
- },
35
- "cookies": {
36
- "path": "/",
37
- "httpOnly": true,
38
- "sameSite": "lax",
39
- "maxAge": 604800
40
- },
41
- "host": "127.0.0.1",
42
- "language": "en",
43
- "port": 3000,
44
- "publicPath": "bin/static",
45
- "requestTimeout": 180000,
46
- "tlsCertPath": "bin/tls/localhost+2.pem",
47
- "tlsKeyPath": "bin/tls/localhost+2-key.pem",
48
- "useTLS": true
1
+ {
2
+ "api": {
3
+ "endpointEnabled": true,
4
+ "inventory": {
5
+ "v1": {
6
+ "test-1": {
7
+ "serviceAlias": "service1",
8
+ "serviceDomainName": "ti-tester-service",
9
+ "serviceVersion": 1
10
+ }
11
+ }
12
+ },
13
+ "requestTimeout": 120000
14
+ },
15
+ "auth": {
16
+ "enabledMethods": [
17
+ "local",
18
+ "openid-google"
19
+ ],
20
+ "admins": [],
21
+ "oauth2": {
22
+ "azure": {
23
+ "tokenEndpointAuthMethod": "client_secret_post",
24
+ "callbackUrl": "/login/azure-callback",
25
+ "isPublic": false
26
+ },
27
+ "google": {
28
+ "tokenEndpointAuthMethod": "client_secret_post",
29
+ "callbackUrl": "/login/google-callback",
30
+ "discoveryUrl": "https://accounts.google.com/.well-known/openid-configuration",
31
+ "isPublic": false
32
+ }
33
+ }
34
+ },
35
+ "cookies": {
36
+ "path": "/",
37
+ "httpOnly": true,
38
+ "sameSite": "lax",
39
+ "maxAge": 604800
40
+ },
41
+ "host": "127.0.0.1",
42
+ "language": "en",
43
+ "port": 3000,
44
+ "publicPath": "bin/static",
45
+ "requestTimeout": 180000,
46
+ "tlsCertPath": "bin/tls/localhost+2.pem",
47
+ "tlsKeyPath": "bin/tls/localhost+2-key.pem",
48
+ "useTLS": true
49
49
  }
@@ -1,92 +1,92 @@
1
- /*
2
- * The ti-engine is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using node.js.
3
- * Copyright © 2021-2026 Boris Kostadinov <kostadinov.boris@gmail.com>
4
- * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
6
- * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
7
- */
8
-
9
- /**
10
- * Express handler factories for the admin configuration-management API. Each factory takes the {@link ConfigService}
11
- * to delegate to (injected so the handlers are unit-testable), and returns an Express middleware that responds in the
12
- * framework's convention — `{ isSuccessful: true, data }` on success — forwarding errors to the error middleware.
13
- * Validation failures come back as `data` (`{ ok:false, errors }`) so the UI can render field-level messages; a
14
- * version conflict maps to `409` and an unknown editor/document/change-set to `404`. These routes are gated by the
15
- * `requireAdmin` guard and inherit the server's global auth + CSRF middleware.
16
- *
17
- * @module admin-config-handlers
18
- */
19
-
20
- const exceptions = require( "@ti-engine/core/exceptions" );
21
-
22
- function sendData( response, data ) {
23
- response.set( "Cache-Control", "no-store" );
24
- response.set( "Content-Type", "application/json; charset=utf-8" );
25
- response.status( exceptions.httpCode.C_200 ).send( { isSuccessful: true, data: data } );
26
- }
27
-
28
- function forward( next, error ) {
29
- const reason = error && error.data && error.data.reason;
30
- const raised = exceptions.raise( error );
31
- if ( reason === "version-conflict" ) {
32
- raised.httpCode = exceptions.httpCode.C_409;
33
- } else if ( reason === "unknown-editor" || reason === "unknown-changeset" || reason === "unknown-config" ) {
34
- raised.httpCode = exceptions.httpCode.C_404;
35
- }
36
- next( raised );
37
- }
38
-
39
- function adminID( request ) {
40
- return ( request.session && request.session.user ) ? request.session.user.userID : undefined;
41
- }
42
-
43
- /**
44
- * @param {ConfigService} service
45
- * @returns {ExpressHandler}
46
- */
47
- module.exports.listEditors = ( service ) => ( request, response, next ) => {
48
- try {
49
- sendData( response, service.listEditors() );
50
- } catch ( error ) {
51
- forward( next, error );
52
- }
53
- };
54
-
55
- module.exports.composeView = ( service ) => ( request, response, next ) => {
56
- service.composeView( request.params.editorKey ).then( ( view ) => sendData( response, view ) ).catch( ( error ) => forward( next, error ) );
57
- };
58
-
59
- module.exports.saveEditorEdit = ( service ) => ( request, response, next ) => {
60
- const body = request.body || {};
61
- service.saveEditorEdit( request.params.editorKey, body.edited, { adminID: adminID( request ), note: body.note }, body.expectedVersions ).then( ( result ) => sendData( response, result ) ).catch( ( error ) => forward( next, error ) );
62
- };
63
-
64
- module.exports.getCurrent = ( service ) => ( request, response, next ) => {
65
- service.getCurrent( request.params.configKey ).then( ( current ) => sendData( response, current ) ).catch( ( error ) => forward( next, error ) );
66
- };
67
-
68
- module.exports.getHistory = ( service ) => ( request, response, next ) => {
69
- service.getHistory( request.params.configKey ).then( ( history ) => sendData( response, history ) ).catch( ( error ) => forward( next, error ) );
70
- };
71
-
72
- module.exports.listChanges = ( service ) => ( request, response, next ) => {
73
- service.listChanges().then( ( changes ) => sendData( response, changes ) ).catch( ( error ) => forward( next, error ) );
74
- };
75
-
76
- module.exports.getChange = ( service ) => ( request, response, next ) => {
77
- service.getChange( request.params.changeSetID ).then( ( change ) => sendData( response, change ) ).catch( ( error ) => forward( next, error ) );
78
- };
79
-
80
- module.exports.restoreChangeSet = ( service ) => ( request, response, next ) => {
81
- const body = request.body || {};
82
- service.restoreChangeSet( request.params.changeSetID, { adminID: adminID( request ), note: body.note } ).then( ( result ) => sendData( response, result ) ).catch( ( error ) => forward( next, error ) );
83
- };
84
-
85
- module.exports.exportBundle = ( service ) => ( request, response, next ) => {
86
- service.exportBundle( { adminID: adminID( request ) } ).then( ( bundle ) => {
87
- response.set( "Cache-Control", "no-store" );
88
- response.set( "Content-Type", "application/json; charset=utf-8" );
89
- response.set( "Content-Disposition", "attachment; filename=\"config-export.json\"" );
90
- response.status( exceptions.httpCode.C_200 ).send( JSON.stringify( bundle, null, 2 ) );
91
- } ).catch( ( error ) => forward( next, error ) );
92
- };
1
+ /*
2
+ * The ti-engine is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using node.js.
3
+ * Copyright © 2021-2026 Boris Kostadinov <kostadinov.boris@gmail.com>
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
6
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
7
+ */
8
+
9
+ /**
10
+ * Express handler factories for the admin configuration-management API. Each factory takes the {@link ConfigService}
11
+ * to delegate to (injected so the handlers are unit-testable), and returns an Express middleware that responds in the
12
+ * framework's convention — `{ isSuccessful: true, data }` on success — forwarding errors to the error middleware.
13
+ * Validation failures come back as `data` (`{ ok:false, errors }`) so the UI can render field-level messages; a
14
+ * version conflict maps to `409` and an unknown editor/document/change-set to `404`. These routes are gated by the
15
+ * `requireAdmin` guard and inherit the server's global auth + CSRF middleware.
16
+ *
17
+ * @module admin-config-handlers
18
+ */
19
+
20
+ const exceptions = require( "@ti-engine/core/exceptions" );
21
+
22
+ function sendData( response, data ) {
23
+ response.set( "Cache-Control", "no-store" );
24
+ response.set( "Content-Type", "application/json; charset=utf-8" );
25
+ response.status( exceptions.httpCode.C_200 ).send( { isSuccessful: true, data: data } );
26
+ }
27
+
28
+ function forward( next, error ) {
29
+ const reason = error && error.data && error.data.reason;
30
+ const raised = exceptions.raise( error );
31
+ if ( reason === "version-conflict" ) {
32
+ raised.httpCode = exceptions.httpCode.C_409;
33
+ } else if ( reason === "unknown-editor" || reason === "unknown-changeset" || reason === "unknown-config" ) {
34
+ raised.httpCode = exceptions.httpCode.C_404;
35
+ }
36
+ next( raised );
37
+ }
38
+
39
+ function adminID( request ) {
40
+ return ( request.session && request.session.user ) ? request.session.user.userID : undefined;
41
+ }
42
+
43
+ /**
44
+ * @param {ConfigService} service
45
+ * @returns {ExpressHandler}
46
+ */
47
+ module.exports.listEditors = ( service ) => ( request, response, next ) => {
48
+ try {
49
+ sendData( response, service.listEditors() );
50
+ } catch ( error ) {
51
+ forward( next, error );
52
+ }
53
+ };
54
+
55
+ module.exports.composeView = ( service ) => ( request, response, next ) => {
56
+ service.composeView( request.params.editorKey ).then( ( view ) => sendData( response, view ) ).catch( ( error ) => forward( next, error ) );
57
+ };
58
+
59
+ module.exports.saveEditorEdit = ( service ) => ( request, response, next ) => {
60
+ const body = request.body || {};
61
+ service.saveEditorEdit( request.params.editorKey, body.edited, { adminID: adminID( request ), note: body.note }, body.expectedVersions ).then( ( result ) => sendData( response, result ) ).catch( ( error ) => forward( next, error ) );
62
+ };
63
+
64
+ module.exports.getCurrent = ( service ) => ( request, response, next ) => {
65
+ service.getCurrent( request.params.configKey ).then( ( current ) => sendData( response, current ) ).catch( ( error ) => forward( next, error ) );
66
+ };
67
+
68
+ module.exports.getHistory = ( service ) => ( request, response, next ) => {
69
+ service.getHistory( request.params.configKey ).then( ( history ) => sendData( response, history ) ).catch( ( error ) => forward( next, error ) );
70
+ };
71
+
72
+ module.exports.listChanges = ( service ) => ( request, response, next ) => {
73
+ service.listChanges().then( ( changes ) => sendData( response, changes ) ).catch( ( error ) => forward( next, error ) );
74
+ };
75
+
76
+ module.exports.getChange = ( service ) => ( request, response, next ) => {
77
+ service.getChange( request.params.changeSetID ).then( ( change ) => sendData( response, change ) ).catch( ( error ) => forward( next, error ) );
78
+ };
79
+
80
+ module.exports.restoreChangeSet = ( service ) => ( request, response, next ) => {
81
+ const body = request.body || {};
82
+ service.restoreChangeSet( request.params.changeSetID, { adminID: adminID( request ), note: body.note } ).then( ( result ) => sendData( response, result ) ).catch( ( error ) => forward( next, error ) );
83
+ };
84
+
85
+ module.exports.exportBundle = ( service ) => ( request, response, next ) => {
86
+ service.exportBundle( { adminID: adminID( request ) } ).then( ( bundle ) => {
87
+ response.set( "Cache-Control", "no-store" );
88
+ response.set( "Content-Type", "application/json; charset=utf-8" );
89
+ response.set( "Content-Disposition", "attachment; filename=\"config-export.json\"" );
90
+ response.status( exceptions.httpCode.C_200 ).send( JSON.stringify( bundle, null, 2 ) );
91
+ } ).catch( ( error ) => forward( next, error ) );
92
+ };