@ibgib/space-gib 0.0.9 → 0.0.13
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/CHANGELOG.md +8 -0
- package/README.md +1 -0
- package/dist/client/bootstrap.mjs +33 -33
- package/dist/client/bootstrap.mjs.map +3 -3
- package/dist/client/chunk-ROJZUPPE.mjs +19 -0
- package/dist/client/chunk-ROJZUPPE.mjs.map +7 -0
- package/dist/client/chunk-WJHRARK6.mjs +2329 -0
- package/dist/client/chunk-WJHRARK6.mjs.map +7 -0
- package/dist/client/index.mjs +22 -1
- package/dist/client/index.mjs.map +4 -4
- package/dist/client/script.mjs +1 -1
- package/dist/server/server.mjs +19147 -18210
- package/dist/server/server.mjs.map +4 -4
- package/package.json +4 -4
- package/space-gib.localhost-1785337158142.log +75 -0
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/README.md +1 -1
- package/src/client/api/space-gib-api-bridge.mts +8 -224
- package/src/client/ui/shell/space-gib-shell-service.mts +68 -18
- package/src/common/keystone-policies.mts +1 -1
- package/src/server/README.md +3 -2
- package/src/server/server.mts +13 -32
- package/src/server/test.json +0 -0
- package/dist/client/chunk-ACIGPCQW.mjs +0 -2407
- package/dist/client/chunk-ACIGPCQW.mjs.map +0 -7
- package/dist/client/chunk-QRMTJE6M.mjs +0 -42
- package/dist/client/chunk-QRMTJE6M.mjs.map +0 -7
- package/space-gib.localhost-1783713259760.log +0 -45
- package/src/client/components/identity-header/IMPLEMENTATION.md +0 -45
- package/src/client/components/identity-header/identity-header.css +0 -112
- package/src/client/components/identity-header/identity-header.html +0 -11
- package/src/client/components/identity-header/identity-header.mts +0 -439
- package/src/client/components/identity-manager/IMPLEMENTATION.md +0 -100
- package/src/client/components/identity-manager/identity-manager.css +0 -171
- package/src/client/components/identity-manager/identity-manager.html +0 -19
- package/src/client/components/identity-manager/identity-manager.mts +0 -639
- package/src/client/components/keystone-creator/keystone-creator.css +0 -65
- package/src/client/components/keystone-creator/keystone-creator.html +0 -41
- package/src/client/components/keystone-creator/keystone-creator.mts +0 -443
- package/src/client/components/keystone-details/keystone-details.css +0 -611
- package/src/client/components/keystone-details/keystone-details.html +0 -151
- package/src/client/components/keystone-details/keystone-details.mts +0 -1213
- package/src/client/components/keystone-scrubber/SCRUBBER_IMPLEMENTATION.md +0 -33
- package/src/client/components/keystone-scrubber/keystone-scrubber.css +0 -46
- package/src/client/components/keystone-scrubber/keystone-scrubber.html +0 -15
- package/src/client/components/keystone-scrubber/keystone-scrubber.mts +0 -356
- package/src/server/bootstrap-helper.mts +0 -141
- package/src/server/bootstrap-helper.respec.mts +0 -100
- package/src/server/metaspace-nodeindexedspace/metaspace-nodeindexedspace.mts +0 -85
- package/src/server/path-constants.mts +0 -101
- package/src/server/path-helper.mts +0 -101
- package/src/server/path-helper.respec.mts +0 -99
- package/src/server/serve-gib/CHANGELOG.md +0 -29
- package/src/server/serve-gib/README.md +0 -43
- package/src/server/serve-gib/constants.mts +0 -1
- package/src/server/serve-gib/handlers/api/debug/ws-echo.handler.mts +0 -105
- package/src/server/serve-gib/handlers/api/health.handler.mts +0 -23
- package/src/server/serve-gib/handlers/api/health.respec.mts +0 -51
- package/src/server/serve-gib/handlers/api/ibgib/ibgib-handler-types.mts +0 -49
- package/src/server/serve-gib/handlers/api/ibgib/ibgib.handler.mts +0 -176
- package/src/server/serve-gib/handlers/api/keystone/keystone-evolve.handler.mts +0 -150
- package/src/server/serve-gib/handlers/api/keystone/keystone-genesis.handler.mts +0 -146
- package/src/server/serve-gib/handlers/api/keystone/keystone-get.handler.mts +0 -198
- package/src/server/serve-gib/handlers/api/keystone/keystone-get.respec.mts +0 -107
- package/src/server/serve-gib/handlers/api/keystone/keystone-handler-types.mts +0 -29
- package/src/server/serve-gib/handlers/api/keystone/keystone-post.handler.mts +0 -55
- package/src/server/serve-gib/handlers/api/keystone/keystone-post.respec.mts +0 -130
- package/src/server/serve-gib/handlers/api/keystone/sso-config.handler.mts +0 -66
- package/src/server/serve-gib/handlers/api/keystone/sso-link.handler.mts +0 -140
- package/src/server/serve-gib/handlers/api/keystone/sso-login.handler.mts +0 -190
- package/src/server/serve-gib/handlers/error-handler.mts +0 -36
- package/src/server/serve-gib/handlers/handler-base.mts +0 -383
- package/src/server/serve-gib/handlers/static-handler.mts +0 -82
- package/src/server/serve-gib/handlers/ws/sync-upgrade-handler-base.mts +0 -233
- package/src/server/serve-gib/handlers/ws/sync-upgrade.handler.mts +0 -24
- package/src/server/serve-gib/handlers/ws/ws-helper.mts +0 -216
- package/src/server/serve-gib/handlers/ws/ws-types.mts +0 -53
- package/src/server/serve-gib/serve-gib-helpers.mts +0 -32
- package/src/server/serve-gib/serve-gib-v1.mts +0 -172
- package/src/server/serve-gib/serve-gib.respec.mts +0 -90
- package/src/server/serve-gib/types.mts +0 -102
- package/src/server/server-constants.mts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibgib/space-gib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ibgib storage and provider service — SaaS at ibgib.space",
|
|
6
6
|
"scripts": {
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"build:test": "tsc -p tsconfig.test.json"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ibgib/core-gib": "^0.1.
|
|
15
|
+
"@ibgib/core-gib": "^0.1.70",
|
|
16
16
|
"@ibgib/helper-gib": "^0.0.36",
|
|
17
17
|
"@ibgib/ts-gib": "^0.5.33",
|
|
18
|
-
"@ibgib/web-gib": "^0.0.
|
|
19
|
-
"@ibgib/node-gib": "^0.0.
|
|
18
|
+
"@ibgib/web-gib": "^0.0.56",
|
|
19
|
+
"@ibgib/node-gib": "^0.0.14"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20.0.0"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
chunk-ZINPBU3N.mjs:26110 yes this is being updated! I am just wondering if I am seeing old code in the browser, i.e., if refresh is happening or just getting cache (I: 6599db11c1086062b8f5e86db89cba26)
|
|
2
|
+
chunk-ZINPBU3N.mjs:22339 [KeystoneScrubberComponentInstance][loadIbGib] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
3
|
+
loadIbGib @ chunk-ZINPBU3N.mjs:22339
|
|
4
|
+
await in loadIbGib
|
|
5
|
+
loadIbGib @ chunk-ZINPBU3N.mjs:26180
|
|
6
|
+
initialize @ chunk-ZINPBU3N.mjs:26124
|
|
7
|
+
await in initialize
|
|
8
|
+
createInstance @ chunk-ZINPBU3N.mjs:26092
|
|
9
|
+
getComponentInstance @ chunk-ZINPBU3N.mjs:155
|
|
10
|
+
fnCreateAndLoadChildComponent @ chunk-ZINPBU3N.mjs:23947
|
|
11
|
+
await in fnCreateAndLoadChildComponent
|
|
12
|
+
getLoadedChildInfo @ chunk-ZINPBU3N.mjs:23972
|
|
13
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:22821
|
|
14
|
+
await in activateIbGib
|
|
15
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23878
|
|
16
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
17
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
|
18
|
+
chunk-ZINPBU3N.mjs:26183 [KeystoneScrubberComponentInstance][loadIbGib] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
19
|
+
loadIbGib @ chunk-ZINPBU3N.mjs:26183
|
|
20
|
+
await in loadIbGib
|
|
21
|
+
initialize @ chunk-ZINPBU3N.mjs:26124
|
|
22
|
+
await in initialize
|
|
23
|
+
createInstance @ chunk-ZINPBU3N.mjs:26092
|
|
24
|
+
getComponentInstance @ chunk-ZINPBU3N.mjs:155
|
|
25
|
+
fnCreateAndLoadChildComponent @ chunk-ZINPBU3N.mjs:23947
|
|
26
|
+
await in fnCreateAndLoadChildComponent
|
|
27
|
+
getLoadedChildInfo @ chunk-ZINPBU3N.mjs:23972
|
|
28
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:22821
|
|
29
|
+
await in activateIbGib
|
|
30
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23878
|
|
31
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
32
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
|
33
|
+
chunk-ZINPBU3N.mjs:26126 [KeystoneScrubberComponentInstance][initialize] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
34
|
+
initialize @ chunk-ZINPBU3N.mjs:26126
|
|
35
|
+
await in initialize
|
|
36
|
+
createInstance @ chunk-ZINPBU3N.mjs:26092
|
|
37
|
+
getComponentInstance @ chunk-ZINPBU3N.mjs:155
|
|
38
|
+
fnCreateAndLoadChildComponent @ chunk-ZINPBU3N.mjs:23947
|
|
39
|
+
await in fnCreateAndLoadChildComponent
|
|
40
|
+
getLoadedChildInfo @ chunk-ZINPBU3N.mjs:23972
|
|
41
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:22821
|
|
42
|
+
await in activateIbGib
|
|
43
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23878
|
|
44
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
45
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
|
46
|
+
chunk-ZINPBU3N.mjs:164 [IbGibComponentService][getComponentInstance] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
47
|
+
getComponentInstance @ chunk-ZINPBU3N.mjs:164
|
|
48
|
+
await in getComponentInstance
|
|
49
|
+
fnCreateAndLoadChildComponent @ chunk-ZINPBU3N.mjs:23947
|
|
50
|
+
await in fnCreateAndLoadChildComponent
|
|
51
|
+
getLoadedChildInfo @ chunk-ZINPBU3N.mjs:23972
|
|
52
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:22821
|
|
53
|
+
await in activateIbGib
|
|
54
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23878
|
|
55
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
56
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
|
57
|
+
chunk-ZINPBU3N.mjs:23995 [IdentityManagerComponentInstance][getLoadedChildInfo] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
58
|
+
getLoadedChildInfo @ chunk-ZINPBU3N.mjs:23995
|
|
59
|
+
await in getLoadedChildInfo
|
|
60
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:22821
|
|
61
|
+
await in activateIbGib
|
|
62
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23878
|
|
63
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
64
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
|
65
|
+
chunk-ZINPBU3N.mjs:22849 [IdentityManagerComponentInstance][activateIbGib] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
66
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:22849
|
|
67
|
+
await in activateIbGib
|
|
68
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23878
|
|
69
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
70
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
|
71
|
+
chunk-ZINPBU3N.mjs:23932 [IdentityManagerComponentInstance][activateIbGib] couldn't get ibGib (keystone^28F26FB0EEA43E56968AA6BE6D0EC673AF13B3E3BCE26A32D7719402E0ADC71E) in space (witness space WebFilesystemSpace_V1 space_gib__yidcqwooervd 0e103ade06650512f06870e05f42b432a5045939c605dd46a5e75dcb51c10f3b undefined undefined) (E: 59c3461bebf3e0065df72bd1bd8dc125)
|
|
72
|
+
activateIbGib @ chunk-ZINPBU3N.mjs:23932
|
|
73
|
+
await in activateIbGib
|
|
74
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:23650
|
|
75
|
+
(anonymous) @ chunk-ZINPBU3N.mjs:25656
|
package/src/client/README.md
CHANGED
|
@@ -13,7 +13,7 @@ This directory contains the browser single-page application (SPA) frontend for `
|
|
|
13
13
|
* `index.html` & `style.css`: The static entry points.
|
|
14
14
|
* `index.mts`: The JS entry point that initializes the global context and bootstraps the SPA.
|
|
15
15
|
* `components/`: Contains dynamic UI components (`keystone-creator`, etc.).
|
|
16
|
-
* `api/`: REST and WebSocket API communication layers.
|
|
16
|
+
* `api/`: REST and WebSocket API communication layers (including email send/inbound handlers).
|
|
17
17
|
* `dev-tools.mts`: Utilities for rendering the local development test panel.
|
|
18
18
|
|
|
19
19
|
For local development commands, please refer to the [Root space-gib README](../../README.md).
|
|
@@ -1,230 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
3
|
-
|
|
4
|
-
import { GLOBAL_LOG_A_LOT } from '../constants.mjs';
|
|
5
|
-
|
|
6
|
-
const logalot = GLOBAL_LOG_A_LOT;
|
|
1
|
+
import { IbGibApiBridge, setApiBridge } from "@ibgib/web-gib/dist/api/ibgib-api-bridge.mjs";
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
|
-
*
|
|
4
|
+
* SpaceGib REST API bridge extending the upstream IbGibApiBridge.
|
|
10
5
|
*/
|
|
11
|
-
export class SpaceGibApiBridge {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Posts a single genesis keystone ibgib to the server to create a new domain.
|
|
16
|
-
*
|
|
17
|
-
* @param keystoneIbGib The genesis keystone ibgib.
|
|
18
|
-
* @returns Promise resolving to the server response containing the addr.
|
|
19
|
-
*/
|
|
20
|
-
public async postGenesisKeystone(keystoneIbGib: IbGib_V1): Promise<{ success: boolean; message?: string; addr?: string }> {
|
|
21
|
-
const lc = `${this.lc}[${this.postGenesisKeystone.name}]`;
|
|
22
|
-
try {
|
|
23
|
-
if (logalot) { console.log(`${lc} starting... (I: eecd082fc4a4381c8857928e8b090826)`); }
|
|
24
|
-
|
|
25
|
-
const response = await fetch('/api/keystone/genesis', {
|
|
26
|
-
method: 'POST',
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
},
|
|
30
|
-
body: JSON.stringify({ keystoneIbGib }),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const data = await response.json();
|
|
34
|
-
|
|
35
|
-
if (!response.ok) {
|
|
36
|
-
const errorMsg = data.message || data.error || 'Unknown error';
|
|
37
|
-
console.error(`${lc} [NAG][ibgib-paradigm] server rejected genesis keystone: ${errorMsg}`);
|
|
38
|
-
return { success: false, message: errorMsg, addr: data.addr };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (logalot) { console.log(`${lc} genesis keystone posted successfully.`); }
|
|
42
|
-
return { success: true, addr: data.addr };
|
|
43
|
-
|
|
44
|
-
} catch (error) {
|
|
45
|
-
const errorMsg = extractErrorMsg(error);
|
|
46
|
-
console.error(`${lc} error: ${errorMsg}`);
|
|
47
|
-
return { success: false, message: errorMsg };
|
|
48
|
-
} finally {
|
|
49
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* PUTs an evolved domain keystone and any related keystones (e.g., session
|
|
55
|
-
* keystones or delegate keystones) to the server.
|
|
56
|
-
*/
|
|
57
|
-
public async putEvolveKeystone({
|
|
58
|
-
domainAddr,
|
|
59
|
-
keystoneIbGib,
|
|
60
|
-
relatedKeystoneIbGibs = [],
|
|
61
|
-
revokeTokens
|
|
62
|
-
}: {
|
|
63
|
-
/**
|
|
64
|
-
* Address of the root parent domain identity keystone.
|
|
65
|
-
*/
|
|
66
|
-
domainAddr: string;
|
|
67
|
-
/**
|
|
68
|
-
* The main evolved keystone frame being synchronized.
|
|
69
|
-
*/
|
|
70
|
-
keystoneIbGib: IbGib_V1;
|
|
71
|
-
/**
|
|
72
|
-
* Array of other keystone frames related to this evolution.
|
|
73
|
-
* Distinction in intent:
|
|
74
|
-
* 1. Ephemeral Session Keystones: Temporary keystones generated to
|
|
75
|
-
* authorize a single sync session (under 'sync' claims, targeted via
|
|
76
|
-
* claim.target = sAddr).
|
|
77
|
-
* 2. Persistent Delegate Keystones: Long-lived sub-keystones registered
|
|
78
|
-
* in the parent's `delegates` dictionary that are evolved
|
|
79
|
-
* concurrently (e.g., during 'manage' password changes).
|
|
80
|
-
*/
|
|
81
|
-
relatedKeystoneIbGibs?: IbGib_V1[];
|
|
82
|
-
/**
|
|
83
|
-
* Optional map of providerId to token to revoke during unlinking.
|
|
84
|
-
*/
|
|
85
|
-
revokeTokens?: Record<string, string>;
|
|
86
|
-
}): Promise<{ success: boolean; message?: string }> {
|
|
87
|
-
const lc = `${this.lc}[${this.putEvolveKeystone.name}]`;
|
|
88
|
-
try {
|
|
89
|
-
console.log(`${lc} posting evolved keystone...`);
|
|
90
|
-
|
|
91
|
-
// Note: encodeURIComponent safely encodes the `^` if needed, though our regex handles both
|
|
92
|
-
const url = `/api/keystone/evolve/${encodeURIComponent(domainAddr)}`;
|
|
93
|
-
const response = await fetch(url, {
|
|
94
|
-
method: 'PUT',
|
|
95
|
-
headers: {
|
|
96
|
-
'Content-Type': 'application/json',
|
|
97
|
-
},
|
|
98
|
-
body: JSON.stringify({
|
|
99
|
-
keystoneIbGib,
|
|
100
|
-
relatedKeystoneIbGibs,
|
|
101
|
-
revokeTokens
|
|
102
|
-
}),
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
const data = await response.json();
|
|
106
|
-
|
|
107
|
-
if (!response.ok) {
|
|
108
|
-
const errorMsg = data.message || data.error || 'Unknown error';
|
|
109
|
-
console.error(`${lc} server rejected keystone evolution: ${errorMsg}`);
|
|
110
|
-
return { success: false, message: errorMsg };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
console.log(`${lc} keystone evolution accepted by server.`);
|
|
114
|
-
return { success: true };
|
|
115
|
-
|
|
116
|
-
} catch (error) {
|
|
117
|
-
const errorMsg = extractErrorMsg(error);
|
|
118
|
-
console.error(`${lc} fetch error: ${errorMsg}`);
|
|
119
|
-
return { success: false, message: errorMsg };
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* GETs the keystone graph for a domain from the server.
|
|
125
|
-
*/
|
|
126
|
-
public async getKeystoneGraph(domainAddr: string): Promise<{ success: boolean; message?: string; graph?: Record<string, any> }> {
|
|
127
|
-
const lc = `${this.lc}[${this.getKeystoneGraph.name}]`;
|
|
128
|
-
try {
|
|
129
|
-
console.log(`${lc} fetching keystone graph...`);
|
|
130
|
-
|
|
131
|
-
const url = `/api/keystone/${encodeURIComponent(domainAddr)}?getLatest=true&getGraph=true`;
|
|
132
|
-
const response = await fetch(url, {
|
|
133
|
-
method: 'GET',
|
|
134
|
-
headers: {
|
|
135
|
-
'Accept': 'application/json',
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
const data = await response.json();
|
|
140
|
-
|
|
141
|
-
console.log(`${lc} fetch keystone graph complete.`);
|
|
142
|
-
|
|
143
|
-
if (!response.ok) {
|
|
144
|
-
const errorMsg = data.message || data.error || 'Unknown error';
|
|
145
|
-
console.error(`${lc} server rejected keystone graph get: ${errorMsg}`);
|
|
146
|
-
return { success: false, message: errorMsg };
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return { success: true, graph: data.domainGraph };
|
|
150
|
-
|
|
151
|
-
} catch (error) {
|
|
152
|
-
const errorMsg = extractErrorMsg(error);
|
|
153
|
-
console.error(`${lc} fetch error: ${errorMsg}`);
|
|
154
|
-
return { success: false, message: errorMsg };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* GETs a single ibGib frame from the server's domain-specific space.
|
|
160
|
-
*/
|
|
161
|
-
public async getIbGib(domainAddr: string, ibGibAddr: string, getLatest = false): Promise<{ success: boolean; message?: string; ibGib?: IbGib_V1 }> {
|
|
162
|
-
const lc = `${this.lc}[${this.getIbGib.name}]`;
|
|
163
|
-
try {
|
|
164
|
-
console.log(`${lc} fetching single ibGib frame...`);
|
|
165
|
-
|
|
166
|
-
const url = `/api/ibgib/${encodeURIComponent(domainAddr)}/${encodeURIComponent(ibGibAddr)}?getLatest=${getLatest}&getGraph=false`;
|
|
167
|
-
const response = await fetch(url, {
|
|
168
|
-
method: 'GET',
|
|
169
|
-
headers: {
|
|
170
|
-
'Accept': 'application/json',
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const data = await response.json();
|
|
175
|
-
|
|
176
|
-
console.log(`${lc} fetching single ibGib frame complete.`);
|
|
177
|
-
|
|
178
|
-
if (!response.ok) {
|
|
179
|
-
const errorMsg = data.message || data.error || 'Unknown error';
|
|
180
|
-
console.error(`${lc} server rejected ibGib get: ${errorMsg}`);
|
|
181
|
-
return { success: false, message: errorMsg };
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return { success: true, ibGib: data };
|
|
185
|
-
|
|
186
|
-
} catch (error) {
|
|
187
|
-
const errorMsg = extractErrorMsg(error);
|
|
188
|
-
console.error(`${lc} fetch error: ${errorMsg}`);
|
|
189
|
-
return { success: false, message: errorMsg };
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* GETs the full dependency graph of an ibGib from the server's domain-specific space.
|
|
195
|
-
*/
|
|
196
|
-
public async getIbGibGraph(domainAddr: string, ibGibAddr: string, getLatest = false): Promise<{ success: boolean; message?: string; graph?: Record<string, IbGib_V1>; addr?: string }> {
|
|
197
|
-
const lc = `${this.lc}[${this.getIbGibGraph.name}]`;
|
|
198
|
-
try {
|
|
199
|
-
console.log(`${lc} fetching ibGib graph...`);
|
|
200
|
-
|
|
201
|
-
const url = `/api/ibgib/${encodeURIComponent(domainAddr)}/${encodeURIComponent(ibGibAddr)}?getLatest=${getLatest}&getGraph=true`;
|
|
202
|
-
const response = await fetch(url, {
|
|
203
|
-
method: 'GET',
|
|
204
|
-
headers: {
|
|
205
|
-
'Accept': 'application/json',
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
const data = await response.json();
|
|
210
|
-
|
|
211
|
-
console.log(`${lc} fetching ibGib graph complete.`);
|
|
212
|
-
|
|
213
|
-
if (!response.ok) {
|
|
214
|
-
const errorMsg = data.message || data.error || 'Unknown error';
|
|
215
|
-
console.error(`${lc} server rejected ibGib graph get: ${errorMsg}`);
|
|
216
|
-
return { success: false, message: errorMsg };
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return { success: true, graph: data.graph, addr: data.addr };
|
|
220
|
-
|
|
221
|
-
} catch (error) {
|
|
222
|
-
const errorMsg = extractErrorMsg(error);
|
|
223
|
-
console.error(`${lc} fetch error: ${errorMsg}`);
|
|
224
|
-
return { success: false, message: errorMsg };
|
|
225
|
-
}
|
|
226
|
-
}
|
|
6
|
+
export class SpaceGibApiBridge extends IbGibApiBridge {
|
|
7
|
+
protected override lc: string = `[SpaceGibApiBridge]`;
|
|
227
8
|
}
|
|
228
9
|
|
|
229
|
-
/** Singleton instance for
|
|
10
|
+
/** Singleton instance for space-gib API bridge. */
|
|
230
11
|
export const spaceGibApiBridge = new SpaceGibApiBridge();
|
|
12
|
+
|
|
13
|
+
// Register as active API bridge in web-gib
|
|
14
|
+
setApiBridge(spaceGibApiBridge);
|
|
@@ -11,14 +11,12 @@ import {
|
|
|
11
11
|
ID_FOOTER_RESIZER, ID_BTN_LEFT_PANEL_TOGGLE, ID_BTN_RIGHT_PANEL_TOGGLE,
|
|
12
12
|
ID_BTN_CREATE_KEYSTONE, ID_CENTER_PANEL_CONTENT
|
|
13
13
|
} from "./space-gib-shell-constants.mjs";
|
|
14
|
-
import { EVENT_IBGIB_SHELL_READY, EVENT_IBGIB_UI_BUSY } from "@ibgib/web-gib/dist/ui/ui-constants.mjs";
|
|
14
|
+
import { EVENT_IBGIB_SHELL_READY, EVENT_IBGIB_UI_BUSY, EVENT_IBGIB_UI_MESSAGE } from "@ibgib/web-gib/dist/ui/ui-constants.mjs";
|
|
15
15
|
import { showFullscreenDialog, FullscreenDialogController } from "@ibgib/web-gib/dist/ui/ui-helpers.mjs";
|
|
16
|
+
import { getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
17
|
+
import { getKeystoneSyncService } from "@ibgib/web-gib/dist/identity/keystone-sync-service.mjs";
|
|
16
18
|
import { PanelState } from "./space-gib-shell-types.mjs";
|
|
17
|
-
import {
|
|
18
|
-
import { IdentityManagerComponentMeta } from "../../components/identity-manager/identity-manager.mjs";
|
|
19
|
-
import { IdentityHeaderComponentMeta } from "../../components/identity-header/identity-header.mjs";
|
|
20
|
-
import { KeystoneDetailsComponentMeta } from "../../components/keystone-details/keystone-details.mjs";
|
|
21
|
-
import { KeystoneScrubberComponentMeta } from "../../components/keystone-scrubber/keystone-scrubber.mjs";
|
|
19
|
+
import { registerStandardIdentityComponents } from "@ibgib/web-gib/dist/ui/component/identity/index.mjs";
|
|
22
20
|
|
|
23
21
|
export class SpaceGibShellService {
|
|
24
22
|
private lc: string = `[SpaceGibShellService]`;
|
|
@@ -101,6 +99,17 @@ export class SpaceGibShellService {
|
|
|
101
99
|
btnCreate.addEventListener('click', () => this.showIdentityManager());
|
|
102
100
|
}
|
|
103
101
|
|
|
102
|
+
window.addEventListener(EVENT_IBGIB_UI_MESSAGE, (ev: any) => {
|
|
103
|
+
const action = ev.detail?.action;
|
|
104
|
+
if (action === 'show-identity-manager') {
|
|
105
|
+
this.showIdentityManager();
|
|
106
|
+
} else if (action === 'show-keystone-creator') {
|
|
107
|
+
this.showKeystoneCreator();
|
|
108
|
+
} else if (action === 'show-add-device') {
|
|
109
|
+
this.showAddDevice();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
104
113
|
// Listen for global busy events from components
|
|
105
114
|
let currentBusyOverlay: FullscreenDialogController | undefined;
|
|
106
115
|
let isShellBusy = false;
|
|
@@ -184,6 +193,26 @@ export class SpaceGibShellService {
|
|
|
184
193
|
}
|
|
185
194
|
}
|
|
186
195
|
|
|
196
|
+
public async showAddDevice() {
|
|
197
|
+
const lc = `${this.lc}[${this.showAddDevice.name}]`;
|
|
198
|
+
try {
|
|
199
|
+
const componentSvc = await getComponentSvc();
|
|
200
|
+
const component = await componentSvc.getComponentInstance({
|
|
201
|
+
path: 'ibgib-add-device',
|
|
202
|
+
ibGibAddr: ROOT_ADDR,
|
|
203
|
+
useRegExpPrefilter: true,
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
const centerPanel = document.getElementById(ID_CENTER_PANEL_CONTENT);
|
|
207
|
+
if (centerPanel && component) {
|
|
208
|
+
centerPanel.innerHTML = ''; // Clear hero section
|
|
209
|
+
centerPanel.appendChild(component as any);
|
|
210
|
+
}
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
187
216
|
private toggleLeftPanel() {
|
|
188
217
|
this.leftPanelState = this.leftPanelState === 'expanded' ? 'collapsed' : 'expanded';
|
|
189
218
|
const panel = document.getElementById(ID_LEFT_PANEL);
|
|
@@ -246,20 +275,9 @@ export class SpaceGibShellService {
|
|
|
246
275
|
private async registerComponents(): Promise<void> {
|
|
247
276
|
const lc = `${this.lc}[${this.registerComponents.name}]`;
|
|
248
277
|
try {
|
|
249
|
-
|
|
250
|
-
new KeystoneCreatorComponentMeta(),
|
|
251
|
-
new IdentityManagerComponentMeta(),
|
|
252
|
-
new IdentityHeaderComponentMeta(),
|
|
253
|
-
new KeystoneDetailsComponentMeta(),
|
|
254
|
-
new KeystoneScrubberComponentMeta(),
|
|
255
|
-
];
|
|
256
|
-
const componentSvc = await getComponentSvc();
|
|
257
|
-
for (let componentMeta of componentsMeta) {
|
|
258
|
-
componentSvc.registerComponentMeta(componentMeta);
|
|
259
|
-
}
|
|
278
|
+
registerStandardIdentityComponents();
|
|
260
279
|
} catch (error) {
|
|
261
280
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
262
|
-
throw error;
|
|
263
281
|
}
|
|
264
282
|
}
|
|
265
283
|
|
|
@@ -290,6 +308,38 @@ export class SpaceGibShellService {
|
|
|
290
308
|
}
|
|
291
309
|
|
|
292
310
|
window.dispatchEvent(new CustomEvent(EVENT_IBGIB_SHELL_READY, { detail: { timestamp: Date.now() } }));
|
|
311
|
+
|
|
312
|
+
// Trigger 1 (App Boot): On onEngineReady, if active identity exists, check for updates.
|
|
313
|
+
const domainIdentity = (globalThis as any).ibgib?.identity?.domainIdentity;
|
|
314
|
+
if (domainIdentity) {
|
|
315
|
+
const activePrimaryAddr = getIbGibAddr({ ibGib: domainIdentity });
|
|
316
|
+
const syncSvc = getKeystoneSyncService();
|
|
317
|
+
const updateCheck = await syncSvc.checkForKeystoneUpdate({ activePrimaryAddr });
|
|
318
|
+
if (updateCheck.hasUpdate) {
|
|
319
|
+
console.log(`${lc} 🔔 Keystone update available on app boot! Server n=${updateCheck.serverN}, Local n=${updateCheck.localN}`);
|
|
320
|
+
await syncSvc.updateActiveKeystone({ activePrimaryAddr });
|
|
321
|
+
} else {
|
|
322
|
+
console.log(`${lc} Keystone identity up to date on app boot (n=${updateCheck.localN}).`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Trigger 5 (30s Test Heartbeat): Start background 30-second setInterval heartbeat log nag
|
|
327
|
+
setInterval(async () => {
|
|
328
|
+
console.log(`[KeystoneSyncService] ⚠️ HEARTBEAT TEST MODE: Interval set to 30s for testing (MUST be changed to 5m for production)`);
|
|
329
|
+
try {
|
|
330
|
+
const currentDomainIdentity = (globalThis as any).ibgib?.identity?.domainIdentity;
|
|
331
|
+
if (currentDomainIdentity) {
|
|
332
|
+
const activeAddr = getIbGibAddr({ ibGib: currentDomainIdentity });
|
|
333
|
+
const syncSvc = getKeystoneSyncService();
|
|
334
|
+
const res = await syncSvc.checkForKeystoneUpdate({ activePrimaryAddr: activeAddr });
|
|
335
|
+
if (res.hasUpdate) {
|
|
336
|
+
console.log(`[KeystoneSyncService] 🔔 Heartbeat detected keystone update on server! Server n=${res.serverN}, Local n=${res.localN}`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
} catch (err) {
|
|
340
|
+
console.warn(`[KeystoneSyncService] Heartbeat update check error: ${extractErrorMsg(err)}`);
|
|
341
|
+
}
|
|
342
|
+
}, 30000);
|
|
293
343
|
} catch (error) {
|
|
294
344
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
295
345
|
}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import { createPoolConfigFromJson, KeystonePoolTemplate } from '@ibgib/core-gib/dist/keystone/keystone-config-builder.mjs';
|
|
20
20
|
import { KeystonePoolConfig } from '@ibgib/core-gib/dist/keystone/keystone-types.mjs';
|
|
21
21
|
|
|
22
|
-
import rawPolicies from './keystone-policies.json'
|
|
22
|
+
import rawPolicies from './keystone-policies.json' with { type: 'json' };
|
|
23
23
|
|
|
24
24
|
// ---------------------------------------------------------------------------
|
|
25
25
|
// 1. JSON Configuration Mapping & Hybrid Fallbacks
|
package/src/server/README.md
CHANGED
|
@@ -10,9 +10,10 @@ The server is built on a custom microframework called `serve-gib`. For details o
|
|
|
10
10
|
* **Hosting**: The server runs inside a Docker container orchestrated via `docker-compose`.
|
|
11
11
|
* **Build**: Compiled and bundled by `esbuild` using the monorepo's shared `build-space-gib.mts` script.
|
|
12
12
|
|
|
13
|
-
## Core Files
|
|
13
|
+
## Core Files & Endpoints
|
|
14
14
|
* `server.mts`: The main entry point that initializes the server, handles WebSocket upgrades, and defines the HTTP routing pipeline.
|
|
15
|
-
* `path-constants.mts`: Canonical definitions for all API regex routes.
|
|
15
|
+
* `path-constants.mts`: Canonical definitions for all API regex routes (`/api/health`, `/api/keystone/*`, `/api/email/inbound`, `/api/email/send`, etc.).
|
|
16
16
|
* `bootstrap-helper.mts`: Logic for initializing domain-isolated multitenant metaspaces.
|
|
17
|
+
* `handlers/api/email/`: Endpoint handlers for inbound SES webhook processing (`POST /api/email/inbound`) and outbound email dispatch (`POST /api/email/send`).
|
|
17
18
|
|
|
18
19
|
For local development commands, please refer to the [Root space-gib README](../../README.md).
|
package/src/server/server.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module server
|
|
3
3
|
*
|
|
4
|
-
* Native Node.js HTTP server for space-gib — using
|
|
4
|
+
* Native Node.js HTTP server for space-gib — using serve-gib from @ibgib/node-gib.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { createServer } from 'node:http';
|
|
@@ -9,21 +9,14 @@ import { join, dirname } from 'node:path';
|
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
10
|
|
|
11
11
|
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { StaticFileHandler } from './serve-gib/handlers/static-handler.mjs';
|
|
21
|
-
import { ErrorHandler } from './serve-gib/handlers/error-handler.mjs';
|
|
22
|
-
import { canHandleWsUpgrade, handleWsEchoUpgrade } from './serve-gib/handlers/api/debug/ws-echo.handler.mjs';
|
|
23
|
-
import { SyncUpgradeHandler } from './serve-gib/handlers/ws/sync-upgrade.handler.mjs';
|
|
24
|
-
import { SsoLinkHandler } from './serve-gib/handlers/api/keystone/sso-link.handler.mjs';
|
|
25
|
-
import { SsoLoginHandler } from './serve-gib/handlers/api/keystone/sso-login.handler.mjs';
|
|
26
|
-
import { SsoConfigHandler } from './serve-gib/handlers/api/keystone/sso-config.handler.mjs';
|
|
12
|
+
import {
|
|
13
|
+
ServeGib_V1,
|
|
14
|
+
ErrorHandler,
|
|
15
|
+
SyncUpgradeHandler,
|
|
16
|
+
canHandleWsUpgrade,
|
|
17
|
+
handleWsEchoUpgrade,
|
|
18
|
+
getStandardServeGibHandlers,
|
|
19
|
+
} from '@ibgib/node-gib/dist/serve-gib/index.mjs';
|
|
27
20
|
|
|
28
21
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
29
22
|
|
|
@@ -43,27 +36,15 @@ async function main(): Promise<void> {
|
|
|
43
36
|
const lc = '[space-gib server]';
|
|
44
37
|
try {
|
|
45
38
|
console.log(`${lc} starting...`);
|
|
46
|
-
|
|
47
39
|
console.log(`${lc} dataDir: ${DATA_DIR}`);
|
|
48
40
|
|
|
49
41
|
const syncUpgradeHandler = new SyncUpgradeHandler();
|
|
50
42
|
|
|
51
|
-
// Initialize serve-gib
|
|
43
|
+
// Initialize serve-gib using standard handler preset from @ibgib/node-gib
|
|
52
44
|
const serveGib = new ServeGib_V1({
|
|
53
45
|
port: PORT,
|
|
54
46
|
dataDir: DATA_DIR,
|
|
55
|
-
handlers:
|
|
56
|
-
new HealthHandler(),
|
|
57
|
-
new IbGibHandler(),
|
|
58
|
-
new KeystoneGenesisHandler(),
|
|
59
|
-
new KeystoneEvolveHandler(),
|
|
60
|
-
new KeystonePostHandler(),
|
|
61
|
-
new KeystoneGetHandler(),
|
|
62
|
-
new SsoLinkHandler(),
|
|
63
|
-
new SsoLoginHandler(),
|
|
64
|
-
new SsoConfigHandler(),
|
|
65
|
-
new StaticFileHandler(CLIENT_DIR),
|
|
66
|
-
],
|
|
47
|
+
handlers: getStandardServeGibHandlers({ clientDir: CLIENT_DIR }),
|
|
67
48
|
errorHandler: new ErrorHandler()
|
|
68
49
|
});
|
|
69
50
|
|
|
@@ -75,10 +56,10 @@ async function main(): Promise<void> {
|
|
|
75
56
|
// since Node.js fires `upgrade` events independently of `request` events.
|
|
76
57
|
server.on('upgrade', async (req, socket, head) => {
|
|
77
58
|
const reqCtx = await serveGib.prepareContext(req);
|
|
78
|
-
|
|
59
|
+
|
|
79
60
|
// Check sync upgrade handler first
|
|
80
61
|
const isSync = await syncUpgradeHandler.handleUpgrade(reqCtx, socket as any, head);
|
|
81
|
-
|
|
62
|
+
|
|
82
63
|
// Fallback to debug echo if not handled by sync
|
|
83
64
|
if (!isSync && canHandleWsUpgrade(req)) {
|
|
84
65
|
handleWsEchoUpgrade(req, socket as any, head);
|
|
File without changes
|