@ibgib/space-gib 0.0.6 → 0.0.7

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 (37) hide show
  1. package/README.md +20 -0
  2. package/dist/client/bootstrap.mjs +31 -31
  3. package/dist/client/bootstrap.mjs.map +3 -3
  4. package/dist/client/chunk-RXFIBFRK.mjs +42 -0
  5. package/dist/client/chunk-RXFIBFRK.mjs.map +7 -0
  6. package/dist/client/chunk-ULFNE26Y.mjs +2216 -0
  7. package/dist/client/chunk-ULFNE26Y.mjs.map +7 -0
  8. package/dist/client/index.mjs +1 -1
  9. package/dist/client/script.mjs +1 -1
  10. package/dist/server/server.mjs +1346 -245
  11. package/dist/server/server.mjs.map +4 -4
  12. package/package.json +5 -5
  13. package/space-gib.localhost-1783713259760.log +45 -0
  14. package/src/client/AUTO-GENERATED-version.mts +1 -1
  15. package/src/client/bootstrap.mts +9 -0
  16. package/src/client/components/identity-header/identity-header.mts +43 -26
  17. package/src/client/components/identity-manager/identity-manager.css +57 -392
  18. package/src/client/components/identity-manager/identity-manager.html +0 -114
  19. package/src/client/components/identity-manager/identity-manager.mts +356 -543
  20. package/src/client/components/keystone-creator/keystone-creator.mts +4 -3
  21. package/src/client/components/keystone-details/keystone-details.css +472 -0
  22. package/src/client/components/keystone-details/keystone-details.html +99 -0
  23. package/src/client/components/keystone-details/keystone-details.mts +821 -0
  24. package/src/client/components/keystone-scrubber/SCRUBBER_IMPLEMENTATION.md +33 -0
  25. package/src/client/components/keystone-scrubber/keystone-scrubber.css +46 -0
  26. package/src/client/components/keystone-scrubber/keystone-scrubber.html +15 -0
  27. package/src/client/components/keystone-scrubber/keystone-scrubber.mts +356 -0
  28. package/src/client/ui/shell/space-gib-shell-service.mts +4 -0
  29. package/src/server/path-constants.mts +12 -0
  30. package/src/server/serve-gib/handlers/api/keystone/sso-config.handler.mts +66 -0
  31. package/src/server/serve-gib/handlers/api/keystone/sso-link.handler.mts +119 -0
  32. package/src/server/serve-gib/handlers/api/keystone/sso-login.handler.mts +189 -0
  33. package/src/server/server.mts +6 -0
  34. package/dist/client/chunk-734MMI4C.mjs +0 -42
  35. package/dist/client/chunk-734MMI4C.mjs.map +0 -7
  36. package/dist/client/chunk-SMOZ2D5E.mjs +0 -2049
  37. package/dist/client/chunk-SMOZ2D5E.mjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibgib/space-gib",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
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.63",
15
+ "@ibgib/core-gib": "^0.1.64",
16
16
  "@ibgib/helper-gib": "^0.0.36",
17
- "@ibgib/ts-gib": "^0.5.32",
18
- "@ibgib/web-gib": "^0.0.49",
19
- "@ibgib/node-gib": "^0.0.7"
17
+ "@ibgib/ts-gib": "^0.5.33",
18
+ "@ibgib/web-gib": "^0.0.50",
19
+ "@ibgib/node-gib": "^0.0.8"
20
20
  },
21
21
  "engines": {
22
22
  "node": ">=20.0.0"
@@ -0,0 +1,45 @@
1
+ script.mjs:7 space-gib early script executing...
2
+ chunk-OVS3VYAL.mjs:27047 [getSpaceGibShellSvc] initializing SpaceGibShellService singleton on globalThis... (I: genuuid)
3
+ chunk-OVS3VYAL.mjs:108 [initialize] does nothing atow (I: 65bb46c88c82b637ad928b8bf1a07225)
4
+ index.mjs:24 [spinOffStartup]: 0.134033203125 ms DOMContentLoaded fired
5
+ index.mjs:26 [spinOffStartup]: 57.553955078125 ms initIbGibStorage complete
6
+ bootstrap.mjs:9643 [space-gib bootstrap] version: 0.0.6
7
+ bootstrap.mjs:7586 [bootstrapIbGibApp] starting...
8
+ bootstrap.mjs:366 [buildArgInfos] starting... (I: f389aaa490796dfd823bc7b9d4e58b23)
9
+ bootstrap.mjs:376 identifier: interactive (I: 519ce129a1e34753a9070d3a205c9a8b)
10
+ bootstrap.mjs:462 [buildArgInfos] complete.
11
+ bootstrap.mjs:7639 [execFromArgs] starting...
12
+ bootstrap.mjs:7681 [initMetaspace] starting...
13
+ chunk-D2MM5RDN.mjs:72 [Violation] 'setTimeout' handler took 70ms
14
+ bootstrap.mjs:2495 [Metaspace_Webspace][initialize] initialized (I: e3b3a9652c09445cb055013166ff089c)
15
+ bootstrap.mjs:7708 [initMetaspace] complete.
16
+ chunk-OVS3VYAL.mjs:20874 [registerFunctionInfos] starting... (I: 14fee8e27384a040494542182031ae25)
17
+ chunk-OVS3VYAL.mjs:20893 [registerFunctionInfos] complete.
18
+ bootstrap.mjs:7725 [execInteractive] starting...
19
+ bootstrap.mjs:7758 [defaultGetOrCreateApp] starting...
20
+ bootstrap.mjs:7826 [defaultGetOrCreateApp] complete.
21
+ bootstrap.mjs:8503 [SpaceGibApp_V1] space-gib initialized and ready.
22
+ bootstrap.mjs:7748 [execInteractive] complete.
23
+ bootstrap.mjs:7671
24
+ [execFromArgs] complete.
25
+ chunk-OVS3VYAL.mjs:27020 [SpaceGibShellService][onEngineReady] SpaceGib Shell Service is ready.
26
+ bootstrap.mjs:7629
27
+ [bootstrapIbGibApp] complete.
28
+ index.mjs:28 [spinOffStartup]: 920.193115234375 ms dynamicallyLoadBootstrapScript complete
29
+ index.mjs:30 [spinOffStartup]: 924.22314453125 ms initDevTools complete
30
+ index.mjs:31 [spinOffStartup]: 924.443115234375 ms
31
+ chunk-OVS3VYAL.mjs:26572 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)
32
+ chunk-OVS3VYAL.mjs:26575 KeystoneScrubberComponentInstance[ctor] (I: 3adca837d5c898d8e839d23c59538126)
33
+ chunk-OVS3VYAL.mjs:26583 [KeystoneScrubberComponentInstance][initialize] starting... (I: 75eecfc01af7f3fa9897932ec5457526)
34
+ chunk-OVS3VYAL.mjs:26638 [KeystoneScrubberComponentInstance][loadIbGib] starting... (I: a4a9181bbb58a22cc71c8745a91ec426)
35
+ chunk-OVS3VYAL.mjs:26648 [KeystoneScrubberComponentInstance][loadIbGib] complete.
36
+ chunk-OVS3VYAL.mjs:26592 [KeystoneScrubberComponentInstance][initialize] complete.
37
+ chunk-OVS3VYAL.mjs:26600 [KeystoneScrubberComponentInstance][created] starting... (I: bc16e6212928658ed8034c75b6279526)
38
+ chunk-OVS3VYAL.mjs:26572 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)
39
+ chunk-OVS3VYAL.mjs:26575 KeystoneScrubberComponentInstance[ctor] (I: 3adca837d5c898d8e839d23c59538126)
40
+ chunk-OVS3VYAL.mjs:26583 [KeystoneScrubberComponentInstance][initialize] starting... (I: 75eecfc01af7f3fa9897932ec5457526)
41
+ chunk-OVS3VYAL.mjs:26638 [KeystoneScrubberComponentInstance][loadIbGib] starting... (I: a4a9181bbb58a22cc71c8745a91ec426)
42
+ chunk-OVS3VYAL.mjs:26648 [KeystoneScrubberComponentInstance][loadIbGib] complete.
43
+ chunk-OVS3VYAL.mjs:26592 [KeystoneScrubberComponentInstance][initialize] complete.
44
+ chunk-OVS3VYAL.mjs:26600 [KeystoneScrubberComponentInstance][created] starting... (I: bc16e6212928658ed8034c75b6279526)
45
+ chunk-OVS3VYAL.mjs:24584 [IdentityManagerComponentInstance][activateIbGib] same tab already active. returning early. childInfo.addr: keystone^442D637B4066E3D0A73A467C14F71FE9FDAA5C5A7FC7EA28064877A63A914C44.5D0EC2067890F88736364BBE9BD59C80DCB99FC85132B3637072D274077D8CA6 (user just clicked on the same tab) (I: e67c0d02f3143c49c7a20c82d0730225)
@@ -8,4 +8,4 @@
8
8
  /**
9
9
  * Version of space-gib, auto-updated by the build process.
10
10
  */
11
- export const AUTO_GENERATED_VERSION = '0.0.6';
11
+ export const AUTO_GENERATED_VERSION = '0.0.7';
@@ -23,6 +23,15 @@ import { registerDeprecatedFunctionNamesAndFunctionInfos_Web } from "./api/funct
23
23
 
24
24
  import { getSpaceGibShellSvc } from "./ui/shell/space-gib-shell-service.mjs";
25
25
 
26
+ // Early check: if we are in an OAuth callback popup redirect, notify parent window and close immediately.
27
+ const urlParams = new URLSearchParams(window.location.search);
28
+ if (urlParams.has('code') && urlParams.has('state') && window.opener) {
29
+ const code = urlParams.get('code');
30
+ const state = urlParams.get('state');
31
+ window.opener.postMessage({ type: 'sso-oauth-callback', code, state }, window.location.origin);
32
+ window.close();
33
+ }
34
+
26
35
  console.log(`[space-gib bootstrap] version: ${AUTO_GENERATED_VERSION}`);
27
36
 
28
37
  // ---------------------------------------------------------------------------
@@ -84,34 +84,34 @@ export class IdentityHeaderComponentInstance
84
84
  protected lc: string = `[IdentityHeaderComponentInstance]`;
85
85
  private activeAddr: string | null = null;
86
86
  private _onRequestIdentityChange: ((e: any) => void) | null = null;
87
- private keystoneCache: Map<string, { username: string, description: string }> = new Map();
87
+ private keystoneCache: Map<string, { username: string, description: string, isPrimary: boolean }> = new Map();
88
88
 
89
89
  constructor() {
90
90
  super();
91
91
  }
92
92
 
93
- private async getKeystoneDetails(addr: string): Promise<{ username: string, description: string }> {
93
+ private async getKeystoneDetails(addr: string): Promise<{ username: string, description: string, isPrimary: boolean }> {
94
94
  const cached = this.keystoneCache.get(addr);
95
95
  if (cached) return cached;
96
96
 
97
97
  const metaspace = getIbGibGlobalThis_SpaceGib(APP_CONFIG).metaspace;
98
- if (!metaspace) return { username: '', description: '' };
98
+ if (!metaspace) return { username: '', description: '', isPrimary: false };
99
99
  const space = await metaspace.getLocalUserSpace({ lock: false });
100
- if (!space) return { username: '', description: '' };
100
+ if (!space) return { username: '', description: '', isPrimary: false };
101
101
 
102
102
  try {
103
- const res = await metaspace.get({ addr, space });
104
- if (res.success && res.ibGibs && res.ibGibs.length > 0) {
105
- const keystone = res.ibGibs[0] as KeystoneIbGib_V1;
106
- const keystoneSvc = new KeystoneService_V1();
107
- const aggregated = await keystoneSvc.getAggregateDetails({
108
- latestKeystone: keystone,
109
- metaspace,
110
- space
111
- });
112
- const username = aggregated?.username || aggregated?.profile?.name || aggregated?.name || '';
113
- const description = aggregated?.description || aggregated?.profile?.description || '';
114
- const details = { username, description };
103
+ const keystoneSvc = new KeystoneService_V1();
104
+ const info = await keystoneSvc.getKeystoneCommonInfo({
105
+ addr,
106
+ metaspace,
107
+ space
108
+ });
109
+ if (info) {
110
+ const details = {
111
+ username: info.name,
112
+ description: info.description,
113
+ isPrimary: info.isPrimary
114
+ };
115
115
  this.keystoneCache.set(addr, details);
116
116
  return details;
117
117
  }
@@ -119,7 +119,7 @@ export class IdentityHeaderComponentInstance
119
119
  console.warn(`Error getting details for keystone ${addr}: ${extractErrorMsg(err)}`);
120
120
  }
121
121
 
122
- return { username: '', description: '' };
122
+ return { username: '', description: '', isPrimary: false };
123
123
  }
124
124
 
125
125
 
@@ -230,10 +230,19 @@ export class IdentityHeaderComponentInstance
230
230
 
231
231
  // Verify it is actually one of the registered keystones in the index relations
232
232
  const registeredKeystones = this.ibGib?.rel8ns?.keystone ?? [];
233
- if (activeAddrInSettings && registeredKeystones.includes(activeAddrInSettings)) {
233
+ const detailsPromises = registeredKeystones.map(async addr => {
234
+ const details = await this.getKeystoneDetails(addr);
235
+ return { addr, isPrimary: details?.isPrimary ?? false };
236
+ });
237
+ const resolvedDetails = await Promise.all(detailsPromises);
238
+ const primaryKeystones = resolvedDetails
239
+ .filter(item => item.isPrimary)
240
+ .map(item => item.addr);
241
+
242
+ if (activeAddrInSettings && primaryKeystones.includes(activeAddrInSettings)) {
234
243
  this.activeAddr = activeAddrInSettings;
235
- } else if (registeredKeystones.length > 0) {
236
- this.activeAddr = registeredKeystones[0];
244
+ } else if (primaryKeystones.length > 0) {
245
+ this.activeAddr = primaryKeystones[0];
237
246
  } else {
238
247
  this.activeAddr = null;
239
248
  }
@@ -295,14 +304,22 @@ export class IdentityHeaderComponentInstance
295
304
  }
296
305
 
297
306
  protected override async renderUI(): Promise<void> {
298
- if (!this.elements) return;
307
+ if (!this.elements) { return; }
299
308
 
300
309
  // Double check state on render
301
310
  await this.resolveActiveIdentity();
302
311
 
303
312
  const keystones = this.ibGib?.rel8ns?.keystone ?? [];
313
+ const detailsPromises = keystones.map(async addr => {
314
+ const details = await this.getKeystoneDetails(addr);
315
+ return { addr, isPrimary: details?.isPrimary ?? false };
316
+ });
317
+ const resolvedDetails = await Promise.all(detailsPromises);
318
+ const primaryKeystones = resolvedDetails
319
+ .filter(item => item.isPrimary)
320
+ .map(item => item.addr);
304
321
 
305
- if (this.activeAddr && keystones.length > 0) {
322
+ if (this.activeAddr && primaryKeystones.length > 0) {
306
323
  this.elements.activeIdentityPillEl.classList.remove('hidden');
307
324
  this.elements.btnCreateIdentityEl.classList.add('hidden');
308
325
 
@@ -310,7 +327,7 @@ export class IdentityHeaderComponentInstance
310
327
 
311
328
  // Populate the dropdown selector
312
329
  this.elements.identitySelectorEl.innerHTML = '';
313
- for (const kAddr of keystones) {
330
+ for (const kAddr of primaryKeystones) {
314
331
  const option = document.createElement('option');
315
332
  option.value = kAddr;
316
333
 
@@ -329,7 +346,7 @@ export class IdentityHeaderComponentInstance
329
346
  }
330
347
  option.textContent = name;
331
348
  }
332
- }).catch(err => {});
349
+ }).catch(err => { });
333
350
 
334
351
  this.elements.identitySelectorEl.appendChild(option);
335
352
  }
@@ -384,10 +401,10 @@ export class IdentityHeaderComponentInstance
384
401
  private async handleRequestIdentityChange(e: any) {
385
402
  const lc = `${this.lc}[handleRequestIdentityChange]`;
386
403
  const addr = e.detail?.activeIdentityAddr;
387
- if (!addr) return;
404
+ if (!addr) { return; }
388
405
  devLog(`${lc} Request to change active identity to: ${addr}`);
389
406
  try {
390
- if (!this.settings) return;
407
+ if (!this.settings) { return; }
391
408
  const generalSettings = await this.getSettings<Settings_General>({
392
409
  settingsType: SettingsType.general,
393
410
  useCase: 'current',