@ibgib/core-gib 0.0.113 → 0.1.2
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/common/comment/comment-constants.d.mts +1 -1
- package/dist/common/comment/comment-constants.d.mts.map +1 -1
- package/dist/common/comment/comment-constants.mjs +1 -1
- package/dist/common/comment/comment-constants.mjs.map +1 -1
- package/dist/timeline/timeline-api.d.mts +297 -0
- package/dist/timeline/timeline-api.d.mts.map +1 -0
- package/dist/timeline/timeline-api.mjs +725 -0
- package/dist/timeline/timeline-api.mjs.map +1 -0
- package/dist/timeline/timeline-types.d.mts +42 -0
- package/dist/timeline/timeline-types.d.mts.map +1 -0
- package/dist/timeline/timeline-types.mjs +2 -0
- package/dist/timeline/timeline-types.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts +0 -1
- package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts.map +1 -1
- package/dist/witness/space/filesystem-space/filesystem-space-v1.mjs +0 -3
- package/dist/witness/space/filesystem-space/filesystem-space-v1.mjs.map +1 -1
- package/dist/witness/space/inner-space/inner-space-constants.d.mts +2 -0
- package/dist/witness/space/inner-space/inner-space-constants.d.mts.map +1 -0
- package/dist/witness/space/inner-space/inner-space-constants.mjs +2 -0
- package/dist/witness/space/inner-space/inner-space-constants.mjs.map +1 -0
- package/dist/witness/space/inner-space/inner-space-types.d.mts +23 -0
- package/dist/witness/space/inner-space/inner-space-types.d.mts.map +1 -0
- package/dist/witness/space/inner-space/inner-space-types.mjs +32 -0
- package/dist/witness/space/inner-space/inner-space-types.mjs.map +1 -0
- package/dist/witness/space/inner-space/inner-space-v1.d.mts +13 -7
- package/dist/witness/space/inner-space/inner-space-v1.d.mts.map +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.mjs +159 -8
- package/dist/witness/space/inner-space/inner-space-v1.mjs.map +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs +206 -52
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs.map +1 -1
- package/dist/witness/space/metaspace/metaspace-base.d.mts.map +1 -1
- package/dist/witness/space/metaspace/metaspace-base.mjs +4 -2
- package/dist/witness/space/metaspace/metaspace-base.mjs.map +1 -1
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.d.mts.map +1 -1
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs +28 -9
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs.map +1 -1
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.d.mts.map +1 -1
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs +27 -3
- package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs.map +1 -1
- package/dist/witness/space/reconciliation-space/reconciliation-space-base.d.mts +100 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-base.d.mts.map +1 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-base.mjs +758 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-base.mjs.map +1 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-helper.d.mts +40 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-helper.d.mts.map +1 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-helper.mjs +90 -0
- package/dist/witness/space/reconciliation-space/reconciliation-space-helper.mjs.map +1 -0
- package/dist/witness/space/space-helper.d.mts.map +1 -1
- package/dist/witness/space/space-helper.mjs +10 -2
- package/dist/witness/space/space-helper.mjs.map +1 -1
- package/dist/witness/space/space-respec-helper.d.mts.map +1 -1
- package/dist/witness/space/space-respec-helper.mjs +3 -0
- package/dist/witness/space/space-respec-helper.mjs.map +1 -1
- package/package.json +1 -1
- package/src/common/comment/comment-constants.mts +1 -1
- package/src/timeline/timeline-api.mts +943 -0
- package/src/timeline/timeline-types.mts +38 -0
- package/src/witness/space/filesystem-space/filesystem-space-v1.mts +0 -3
- package/src/witness/space/inner-space/inner-space-constants.mts +1 -0
- package/src/witness/space/inner-space/inner-space-types.mts +44 -0
- package/src/witness/space/inner-space/inner-space-v1.mts +157 -28
- package/src/witness/space/inner-space/inner-space-v1.respec.mts +242 -58
- package/src/witness/space/metaspace/metaspace-base.mts +7 -1
- package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mts +32 -10
- package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mts +76 -53
- package/src/witness/space/reconciliation-space/reconciliation-space-base.mts +884 -0
- package/src/witness/space/reconciliation-space/reconciliation-space-helper.mts +125 -0
- package/src/witness/space/space-helper.mts +5 -2
- package/src/witness/space/space-respec-helper.mts +4 -4
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { extractErrorMsg, getUUID, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
|
-
import { getGib } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
2
|
+
import { getGib, getGibInfo } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
3
3
|
import { GIB } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
4
4
|
|
|
5
5
|
import { IbGibSpaceAny } from "../../../../witness/space/space-base-v1.mjs";
|
|
6
6
|
import { DtoToSpaceFunction, LocalSpaceFactoryFunction } from "../metaspace-types.mjs";
|
|
7
7
|
import { spaceNameIsValid } from "../../../../witness/space/space-helper.mjs";
|
|
8
8
|
import { DEFAULT_LOCAL_SPACE_POLLING_INTERVAL_MS, } from "../../../../witness/space/space-constants.mjs";
|
|
9
|
-
import { InnerSpace_V1,
|
|
9
|
+
import { InnerSpace_V1, } from "../../inner-space/inner-space-v1.mjs";
|
|
10
|
+
import { InnerSpaceData_V1 } from "../../inner-space/inner-space-types.mjs";
|
|
11
|
+
|
|
12
|
+
const innerSpaces: { [tjpGib: string]: IbGibSpaceAny } = {};
|
|
10
13
|
|
|
11
14
|
export const fnCreateNewLocalSpace: LocalSpaceFactoryFunction = async ({
|
|
12
15
|
allowCancel,
|
|
@@ -49,7 +52,7 @@ Enter space name:
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
// ...create in memory with defaults
|
|
52
|
-
const data:
|
|
55
|
+
const data: InnerSpaceData_V1 = {
|
|
53
56
|
version: '1',
|
|
54
57
|
name: spaceName || ('in-memory-space_' + (await getUUID()).slice(0, 10)),
|
|
55
58
|
uuid: await getUUID(),
|
|
@@ -70,6 +73,10 @@ Enter space name:
|
|
|
70
73
|
if (newLocalSpace.gib === GIB) { throw new Error(`localSpace.gib not updated correctly.`); }
|
|
71
74
|
if (logalot) { console.log(`${lc} localSpace.gib: ${newLocalSpace.gib} (after sha256v1)`); }
|
|
72
75
|
|
|
76
|
+
const gibInfo = getGibInfo({ gib: newLocalSpace.gib });
|
|
77
|
+
const tjpGib = gibInfo.tjpGib ?? newLocalSpace.gib!;
|
|
78
|
+
innerSpaces[tjpGib] = newLocalSpace;
|
|
79
|
+
|
|
73
80
|
return newLocalSpace as IbGibSpaceAny;
|
|
74
81
|
} catch (error) {
|
|
75
82
|
console.error(`${lc} ${error.message}`);
|
|
@@ -79,6 +86,7 @@ Enter space name:
|
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
|
|
89
|
+
|
|
82
90
|
export const fnDtoToSpace: DtoToSpaceFunction = async (spaceDto) => {
|
|
83
91
|
const lc = `[fnDtoToSpace]`;
|
|
84
92
|
|
|
@@ -87,14 +95,28 @@ export const fnDtoToSpace: DtoToSpaceFunction = async (spaceDto) => {
|
|
|
87
95
|
// return the reference itself.
|
|
88
96
|
if ((spaceDto as InnerSpace_V1).ibGibs) {
|
|
89
97
|
return spaceDto as InnerSpace_V1;
|
|
90
|
-
}
|
|
98
|
+
} else {
|
|
99
|
+
console.log(`${lc} spaceDto: ${pretty(spaceDto)} (I: d69ab87f2fa8360ff8e60e78aa15c825)`);
|
|
100
|
+
|
|
101
|
+
if (!spaceDto.data) { throw new Error(`invalid spaceDto. InnerSpace_V1 should have truthy data. (E: d402fda7a6a53668b655c2885029a423)`); }
|
|
102
|
+
console.dir(spaceDto);
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
const gibInfo = getGibInfo({ gib: spaceDto.gib });
|
|
105
|
+
const tjpGib = gibInfo.tjpGib ?? spaceDto.gib!;
|
|
106
|
+
const existingSpace = innerSpaces[tjpGib];
|
|
107
|
+
if (existingSpace) {
|
|
108
|
+
return existingSpace;
|
|
109
|
+
} else {
|
|
110
|
+
// it's not the reference and nothing registered so far, so make a new one? (but warn)
|
|
111
|
+
console.warn(`${lc} in memory innerspace dto that isnt' the reference to the object itself in memory, and we don't have it in the inner spaces map? i guess we'll create a new one from the dto (W: b8973f3a43f546eeaf59f60331896e75)`)
|
|
112
|
+
let space = new InnerSpace_V1(spaceDto.data as InnerSpaceData_V1, spaceDto.rel8ns);
|
|
113
|
+
await space.initialized;
|
|
114
|
+
const gibInfo = getGibInfo({ gib: space.gib });
|
|
115
|
+
const tjpGib = gibInfo.tjpGib ?? space.gib!;
|
|
116
|
+
innerSpaces[tjpGib] = space;
|
|
117
|
+
return space;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
98
120
|
} catch (error) {
|
|
99
121
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
100
122
|
throw error;
|
|
@@ -23,66 +23,89 @@ const logalot = GLOBAL_LOG_A_LOT;
|
|
|
23
23
|
*/
|
|
24
24
|
export class Metaspace_Innerspace extends MetaspaceBase {
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// we won't get an object back, only a DTO ibGib essentially
|
|
27
|
+
protected lc: string = `[${Metaspace_Innerspace.name}]`;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
/**
|
|
30
|
+
* since this is an in-memory metaspace, we always return the same instance
|
|
31
|
+
* for the zero space.
|
|
32
|
+
*/
|
|
33
|
+
private _zeroSpace: InnerSpace_V1 | undefined;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
/**
|
|
36
|
+
* since this is an in-memory metaspace, we always return the same instance
|
|
37
|
+
*
|
|
38
|
+
* returns this._zeroSpace
|
|
39
|
+
*/
|
|
40
|
+
get zeroSpace(): IbGibSpaceAny {
|
|
41
|
+
const lc = `${this.lc}[get zeroSpace]`;
|
|
42
|
+
if (!this._zeroSpace) { throw new Error(`${lc} this._zeroSpace falsy. should have been created on this.initialize (E: e723177fd2a74e25eb25e2299dfa4d23)`); }
|
|
43
|
+
return this._zeroSpace;
|
|
44
|
+
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
constructor(
|
|
47
|
+
protected cacheSvc: IbGibCacheService | undefined,
|
|
48
|
+
) {
|
|
49
|
+
super(cacheSvc);
|
|
50
|
+
const lc = `${this.lc}[ctor]`;
|
|
51
|
+
if (logalot) {
|
|
52
|
+
console.log(`${lc} ${GLOBAL_TIMER_NAME}`);
|
|
53
|
+
console.timeLog(GLOBAL_TIMER_NAME);
|
|
54
|
+
console.log(`${lc} created.`);
|
|
55
|
+
}
|
|
55
56
|
}
|
|
56
|
-
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
protected async initializeMetaspaceFactory({ metaspaceFactory }: {
|
|
59
|
+
metaspaceFactory: MetaspaceFactory,
|
|
60
|
+
}): Promise<void> {
|
|
61
|
+
const lc = `[${this.initializeMetaspaceFactory.name}]`;
|
|
62
|
+
try {
|
|
63
|
+
if (logalot) { console.log(`${lc} starting... (I: 5a29670439ac47634dcdfe25225c8223)`); }
|
|
64
|
+
|
|
65
|
+
metaspaceFactory ??= {}
|
|
66
|
+
metaspaceFactory.fnDefaultLocalSpaceFactory ??=
|
|
67
|
+
(opts) => fnCreateNewLocalSpace(opts);
|
|
68
|
+
metaspaceFactory.fnDtoToSpace ??=
|
|
69
|
+
(spaceDto) => fnDtoToSpace(spaceDto);
|
|
70
|
+
metaspaceFactory.fnZeroSpaceFactory ??= () => {
|
|
71
|
+
if (this._zeroSpace) {
|
|
72
|
+
return this._zeroSpace;
|
|
73
|
+
} else {
|
|
74
|
+
// return this._zeroSpace!
|
|
75
|
+
const zeroSpace = new InnerSpace_V1(/*initialData*/ undefined as any, /*initialRel8ns*/ undefined);
|
|
76
|
+
zeroSpace.gib = 'gib';
|
|
77
|
+
this._zeroSpace = zeroSpace;
|
|
78
|
+
return zeroSpace;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
64
81
|
|
|
65
|
-
|
|
82
|
+
await super.initializeMetaspaceFactory({ metaspaceFactory });
|
|
66
83
|
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
if (this.metaspaceFactory.fnZeroSpaceFactory) {
|
|
85
|
+
this._zeroSpace = this.metaspaceFactory.fnZeroSpaceFactory!() as InnerSpace_V1;
|
|
86
|
+
} else {
|
|
87
|
+
this._zeroSpace = await fnCreateNewLocalSpace({
|
|
88
|
+
allowCancel: false,
|
|
89
|
+
spaceName: 'in-memory-space_' + (await getUUID()).slice(0, 10),
|
|
90
|
+
logalot,
|
|
91
|
+
getFnPrompt: () => this.getFnPrompt!(),
|
|
92
|
+
}) as InnerSpace_V1;
|
|
93
|
+
if (!this._zeroSpace) { throw new Error(`(UNEXPECTED) create this._zeroSpace is falsy but no error after create? (E: 63c27616be41564377f843baa6725423)`); }
|
|
69
94
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
95
|
+
// don't think this is necessary but...
|
|
96
|
+
// metaspaceFactory.fnZeroSpaceFactory = () => {
|
|
97
|
+
// // return this._zeroSpace!
|
|
98
|
+
// const zeroSpace = new InnerSpace_V1(/*initialData*/ undefined as any, /*initialRel8ns*/ undefined);
|
|
99
|
+
// zeroSpace.gib = 'gib';
|
|
100
|
+
// return zeroSpace;
|
|
101
|
+
// };
|
|
102
|
+
}
|
|
103
|
+
await this._zeroSpace.initialized;
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error(`${lc} ${error.message}`);
|
|
106
|
+
throw error;
|
|
107
|
+
} finally {
|
|
108
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
109
|
+
}
|
|
86
110
|
}
|
|
87
|
-
}
|
|
88
111
|
}
|