@ibgib/core-gib 0.1.12 → 0.1.14
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/keystone/keystone-helpers.mjs +3 -3
- package/dist/keystone/keystone-helpers.mjs.map +1 -1
- package/dist/sync/sync-constants.d.mts +4 -1
- package/dist/sync/sync-constants.d.mts.map +1 -1
- package/dist/sync/sync-constants.mjs +3 -0
- package/dist/sync/sync-constants.mjs.map +1 -1
- package/dist/sync/sync-helpers.d.mts +18 -2
- package/dist/sync/sync-helpers.d.mts.map +1 -1
- package/dist/sync/sync-helpers.mjs +84 -3
- package/dist/sync/sync-helpers.mjs.map +1 -1
- package/dist/sync/sync-innerspace.respec.d.mts +0 -6
- package/dist/sync/sync-innerspace.respec.d.mts.map +1 -1
- package/dist/sync/sync-innerspace.respec.mjs +395 -241
- package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-types.d.mts +31 -0
- package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-types.mjs +5 -0
- package/dist/sync/sync-peer/sync-peer-types.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-v1.d.mts +22 -0
- package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-v1.mjs +13 -0
- package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -0
- package/dist/sync/sync-saga-context/sync-saga-context-constants.d.mts +8 -0
- package/dist/sync/sync-saga-context/sync-saga-context-constants.d.mts.map +1 -0
- package/dist/sync/sync-saga-context/sync-saga-context-constants.mjs +8 -0
- package/dist/sync/sync-saga-context/sync-saga-context-constants.mjs.map +1 -0
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +54 -0
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -0
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +87 -0
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -0
- package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +66 -0
- package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -0
- package/dist/sync/sync-saga-context/sync-saga-context-types.mjs +12 -0
- package/dist/sync/sync-saga-context/sync-saga-context-types.mjs.map +1 -0
- package/dist/sync/sync-saga-coordinator.d.mts +136 -91
- package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
- package/dist/sync/sync-saga-coordinator.mjs +563 -287
- package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
- package/dist/sync/sync-saga-coordinator.respec.mjs +7 -7
- package/dist/sync/sync-saga-coordinator.respec.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-constants.d.mts +2 -0
- package/dist/sync/sync-saga-message/sync-saga-message-constants.d.mts.map +1 -0
- package/dist/sync/sync-saga-message/sync-saga-message-constants.mjs +2 -0
- package/dist/sync/sync-saga-message/sync-saga-message-constants.mjs.map +1 -0
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.d.mts +15 -0
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.d.mts.map +1 -0
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.mjs +43 -0
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.mjs.map +1 -0
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +39 -0
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -0
- package/dist/sync/sync-saga-message/sync-saga-message-types.mjs +2 -0
- package/dist/sync/sync-saga-message/sync-saga-message-types.mjs.map +1 -0
- package/dist/sync/sync-types.d.mts +81 -3
- package/dist/sync/sync-types.d.mts.map +1 -1
- package/dist/sync/sync-types.mjs +27 -1
- package/dist/sync/sync-types.mjs.map +1 -1
- package/dist/timeline/timeline-api.d.mts +16 -3
- package/dist/timeline/timeline-api.d.mts.map +1 -1
- package/dist/timeline/timeline-api.mjs +7 -7
- package/dist/timeline/timeline-api.mjs.map +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.d.mts.map +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.mjs +3 -4
- package/dist/witness/space/inner-space/inner-space-v1.mjs.map +1 -1
- package/dist/witness/space/outer-space/outer-space-types.d.mts +2 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -1
- package/dist/witness/space/space-base-v1.d.mts +19 -1
- package/dist/witness/space/space-base-v1.d.mts.map +1 -1
- package/dist/witness/space/space-base-v1.mjs +66 -6
- package/dist/witness/space/space-base-v1.mjs.map +1 -1
- package/dist/witness/space/space-helper.d.mts +14 -0
- package/dist/witness/space/space-helper.d.mts.map +1 -1
- package/dist/witness/space/space-helper.mjs +44 -1
- 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 +1 -1
- package/dist/witness/space/space-respec-helper.mjs.map +1 -1
- package/dist/witness/space/space-types.d.mts +12 -1
- package/dist/witness/space/space-types.d.mts.map +1 -1
- package/dist/witness/space/space-types.mjs +4 -0
- package/dist/witness/space/space-types.mjs.map +1 -1
- package/package.json +2 -2
- package/src/keystone/keystone-helpers.mts +3 -3
- package/src/sync/README.md +275 -0
- package/src/sync/sync-constants.mts +5 -0
- package/src/sync/sync-helpers.mts +105 -6
- package/src/sync/sync-innerspace.respec.mts +458 -289
- package/src/sync/sync-peer/sync-peer-types.mts +43 -0
- package/src/sync/sync-peer/sync-peer-v1.mts +28 -0
- package/src/sync/sync-saga-context/sync-saga-context-constants.mts +8 -0
- package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +147 -0
- package/src/sync/sync-saga-context/sync-saga-context-types.mts +80 -0
- package/src/sync/sync-saga-coordinator.mts +762 -329
- package/src/sync/sync-saga-coordinator.respec.mts +7 -7
- package/src/sync/sync-saga-message/sync-saga-message-constants.mts +1 -0
- package/src/sync/sync-saga-message/sync-saga-message-helpers.mts +59 -0
- package/src/sync/sync-saga-message/sync-saga-message-types.mts +53 -0
- package/src/sync/sync-types.mts +103 -3
- package/src/timeline/timeline-api.mts +20 -4
- package/src/witness/space/inner-space/inner-space-v1.mts +3 -2
- package/src/witness/space/reconciliation-space/reconciliation-space-base.mts.OLD.md +884 -0
- package/src/witness/space/reconciliation-space/reconciliation-space-helper.mts.OLD.md +125 -0
- package/src/witness/space/space-base-v1.mts +62 -12
- package/src/witness/space/space-helper.mts +50 -1
- package/src/witness/space/space-respec-helper.mts +2 -1
- package/src/witness/space/space-types.mts +13 -1
- package/tmp.md +3 -9
|
@@ -33,13 +33,13 @@ await respecfully(sir, 'SyncSagaCoordinator', async () => {
|
|
|
33
33
|
const identitySecret = 'secret';
|
|
34
34
|
|
|
35
35
|
// Execute Sync
|
|
36
|
-
await coordinator.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
36
|
+
// await coordinator.deprecated_sync({
|
|
37
|
+
// source: sourceSpace,
|
|
38
|
+
// dest: destSpace,
|
|
39
|
+
// identity,
|
|
40
|
+
// domainIbGibs: [], // Empty for test
|
|
41
|
+
// identitySecret
|
|
42
|
+
// });
|
|
43
43
|
|
|
44
44
|
// Verify Dest has received frames
|
|
45
45
|
// We look for any ibgibs in the destSpace witness output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SYNC_SAGA_MSG_ATOM = 'sync_sagamsg';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
|
+
import { Ib } from "@ibgib/ts-gib/dist/types.mjs";
|
|
3
|
+
import { SYNC_SAGA_MSG_ATOM } from "./sync-saga-message-constants.mjs";
|
|
4
|
+
import { SyncSagaMessageData_V1, SyncSagaMessageIb_V1 } from "./sync-saga-message-types.mjs";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Constructs the standard 'ib' string for a Sync Saga Message stone.
|
|
8
|
+
*/
|
|
9
|
+
export async function getSyncSagaMessageIb({
|
|
10
|
+
data,
|
|
11
|
+
}: {
|
|
12
|
+
data: SyncSagaMessageData_V1,
|
|
13
|
+
}): Promise<Ib> {
|
|
14
|
+
const lc = `[${getSyncSagaMessageIb.name}]`;
|
|
15
|
+
try {
|
|
16
|
+
// sync_saga_msg sagaId stage
|
|
17
|
+
const ib = [
|
|
18
|
+
SYNC_SAGA_MSG_ATOM,
|
|
19
|
+
data.sagaId,
|
|
20
|
+
data.stage
|
|
21
|
+
].join(' ');
|
|
22
|
+
|
|
23
|
+
return ib;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parses a standard Sync Saga Message 'ib' string.
|
|
32
|
+
*/
|
|
33
|
+
export async function parseSyncSagaMessageIb({
|
|
34
|
+
ib,
|
|
35
|
+
}: {
|
|
36
|
+
ib: Ib,
|
|
37
|
+
}): Promise<SyncSagaMessageIb_V1> {
|
|
38
|
+
const lc = `[${parseSyncSagaMessageIb.name}]`;
|
|
39
|
+
try {
|
|
40
|
+
const parts = ib.split(' ');
|
|
41
|
+
if (parts.length !== 3) {
|
|
42
|
+
throw new Error(`Invalid sync saga message ib. Expected 3 parts [atom sagaId stage]. Got ${parts.length}. (E: 7abec847426bd8f41a475cafcc118826)`);
|
|
43
|
+
}
|
|
44
|
+
const [
|
|
45
|
+
atom,
|
|
46
|
+
sagaId,
|
|
47
|
+
stage
|
|
48
|
+
] = parts;
|
|
49
|
+
|
|
50
|
+
if (atom !== SYNC_SAGA_MSG_ATOM) {
|
|
51
|
+
throw new Error(`Atom mismatch. Expected ${SYNC_SAGA_MSG_ATOM}. Got ${atom}. (E: 1b4ddf426ed87e474816ed48cedb8a26)`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return { atom, sagaId, stage };
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IbGib_V1, IbGibData_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
2
|
+
import { KeystoneIbGib_V1 } from "../../keystone/keystone-types.mjs";
|
|
3
|
+
import { SyncStage } from "../sync-constants.mjs";
|
|
4
|
+
import { SyncMode, SyncConflictStrategy, SyncInitData, SyncRequestData, SyncDeltaData, SyncCommitData } from "../sync-types.mjs";
|
|
5
|
+
import { SYNC_SAGA_MSG_ATOM } from "./sync-saga-message-constants.mjs";
|
|
6
|
+
|
|
7
|
+
export interface SyncSagaMessageIb_V1 {
|
|
8
|
+
atom: typeof SYNC_SAGA_MSG_ATOM;
|
|
9
|
+
sagaId: string;
|
|
10
|
+
stage: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SyncSagaMessageData_V1 extends IbGibData_V1 {
|
|
14
|
+
/**
|
|
15
|
+
* Unique ID for the synchronization session (saga).
|
|
16
|
+
*/
|
|
17
|
+
sagaId: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Current stage of the protocol.
|
|
21
|
+
*/
|
|
22
|
+
stage: SyncStage;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SyncSagaMessageRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
26
|
+
// potentially link to previous message in chain if we wanted chain-of-stones?
|
|
27
|
+
// For now, stones are independent or linked by the saga frame.
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface SyncSagaMessageIbGib_V1 extends IbGib_V1<SyncSagaMessageData_V1, SyncSagaMessageRel8ns_V1> { }
|
|
31
|
+
|
|
32
|
+
// ===========================================================================
|
|
33
|
+
// CONCRETE MESSAGE PAYLOADS (EXTENDING DATA)
|
|
34
|
+
// ===========================================================================
|
|
35
|
+
|
|
36
|
+
export interface SyncSagaMessageInitData_V1 extends SyncSagaMessageData_V1, SyncInitData {
|
|
37
|
+
stage: typeof SyncStage.init;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SyncSagaMessageAckData_V1 extends SyncSagaMessageData_V1 {
|
|
41
|
+
stage: typeof SyncStage.ack;
|
|
42
|
+
deltaReqAddrs: string[];
|
|
43
|
+
pushOfferAddrs: string[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface SyncSagaMessageDeltaData_V1 extends SyncSagaMessageData_V1, SyncDeltaData {
|
|
47
|
+
stage: typeof SyncStage.delta;
|
|
48
|
+
requests?: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface SyncSagaMessageCommitData_V1 extends SyncSagaMessageData_V1, SyncCommitData {
|
|
52
|
+
stage: typeof SyncStage.commit;
|
|
53
|
+
}
|
package/src/sync/sync-types.mts
CHANGED
|
@@ -1,6 +1,82 @@
|
|
|
1
1
|
import { IbGib_V1, IbGibData_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
2
|
+
|
|
2
3
|
import { KeystoneIbGib_V1, KeystoneProof } from "../keystone/keystone-types.mjs";
|
|
3
4
|
import { SYNC_ATOM, SyncStage } from "./sync-constants.mjs";
|
|
5
|
+
import { IbGibSpaceAny } from "../witness/space/space-base-v1.mjs";
|
|
6
|
+
import { MetaspaceService } from "../witness/space/metaspace/metaspace-types.mjs";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// #region SyncMode
|
|
10
|
+
export const SYNC_MODE_PUSH = 'push';
|
|
11
|
+
export const SYNC_MODE_PULL = 'pull';
|
|
12
|
+
export const SYNC_MODE_SYNC = 'sync';
|
|
13
|
+
export type SyncMode =
|
|
14
|
+
| typeof SYNC_MODE_PUSH
|
|
15
|
+
| typeof SYNC_MODE_PULL
|
|
16
|
+
| typeof SYNC_MODE_SYNC;
|
|
17
|
+
export const SyncMode = {
|
|
18
|
+
push: SYNC_MODE_PUSH,
|
|
19
|
+
pull: SYNC_MODE_PULL,
|
|
20
|
+
sync: SYNC_MODE_SYNC,
|
|
21
|
+
} satisfies { [key in SyncMode]: SyncMode };
|
|
22
|
+
export const SYNC_MODE_VALID_VALUES = Object.values(SyncMode);
|
|
23
|
+
export function isValidSyncMode(mode: string): mode is SyncMode {
|
|
24
|
+
return SYNC_MODE_VALID_VALUES.includes(mode as SyncMode);
|
|
25
|
+
}
|
|
26
|
+
// #endregion SyncMode
|
|
27
|
+
|
|
28
|
+
// #region SyncConflictStrategy
|
|
29
|
+
export const SYNC_CONFLICT_STRATEGY_ABORT = 'abort';
|
|
30
|
+
export const SYNC_CONFLICT_STRATEGY_OPTIMISTIC = 'optimistic';
|
|
31
|
+
export const SYNC_CONFLICT_STRATEGY_MANUAL = 'manual';
|
|
32
|
+
export type SyncConflictStrategy =
|
|
33
|
+
| typeof SYNC_CONFLICT_STRATEGY_ABORT
|
|
34
|
+
| typeof SYNC_CONFLICT_STRATEGY_OPTIMISTIC
|
|
35
|
+
| typeof SYNC_CONFLICT_STRATEGY_MANUAL;
|
|
36
|
+
export const SyncConflictStrategy = {
|
|
37
|
+
abort: SYNC_CONFLICT_STRATEGY_ABORT,
|
|
38
|
+
optimistic: SYNC_CONFLICT_STRATEGY_OPTIMISTIC,
|
|
39
|
+
manual: SYNC_CONFLICT_STRATEGY_MANUAL,
|
|
40
|
+
} satisfies { [key in SyncConflictStrategy]: SyncConflictStrategy };
|
|
41
|
+
export const SYNC_CONFLICT_STRATEGY_VALID_VALUES = Object.values(SyncConflictStrategy);
|
|
42
|
+
export function isValidSyncConflictStrategy(strategy: string): strategy is SyncConflictStrategy {
|
|
43
|
+
return SYNC_CONFLICT_STRATEGY_VALID_VALUES.includes(strategy as SyncConflictStrategy);
|
|
44
|
+
}
|
|
45
|
+
// #endregion SyncConflictStrategy
|
|
46
|
+
|
|
47
|
+
export interface SyncOptions {
|
|
48
|
+
/**
|
|
49
|
+
* The ibgibs we wish to sync.
|
|
50
|
+
*
|
|
51
|
+
* These should all exist in {@link source}
|
|
52
|
+
*/
|
|
53
|
+
domainIbGibs: IbGib_V1[],
|
|
54
|
+
/**
|
|
55
|
+
* The space containing the data we want to send.
|
|
56
|
+
*/
|
|
57
|
+
source: IbGibSpaceAny;
|
|
58
|
+
/**
|
|
59
|
+
* The space receiving the data.
|
|
60
|
+
*/
|
|
61
|
+
dest: IbGibSpaceAny;
|
|
62
|
+
/**
|
|
63
|
+
* The metaspace context (for registering sync sagas locally).
|
|
64
|
+
*/
|
|
65
|
+
metaspace: MetaspaceService;
|
|
66
|
+
/**
|
|
67
|
+
* The identity authorizing this sync.
|
|
68
|
+
*/
|
|
69
|
+
identity: KeystoneIbGib_V1;
|
|
70
|
+
/**
|
|
71
|
+
* The secret for the identity (to sign the commit).
|
|
72
|
+
*/
|
|
73
|
+
identitySecret: string;
|
|
74
|
+
/**
|
|
75
|
+
* How to handle conflicts when both Source and Dest have diverged on the same timeline.
|
|
76
|
+
* @default 'abort'
|
|
77
|
+
*/
|
|
78
|
+
conflictStrategy?: SyncConflictStrategy;
|
|
79
|
+
}
|
|
4
80
|
|
|
5
81
|
// ===========================================================================
|
|
6
82
|
// PROTOCOL PAYLOADS
|
|
@@ -28,7 +104,7 @@ export interface SyncInitData {
|
|
|
28
104
|
* e.g. "push" (I have data for you) or "pull" (Give me data).
|
|
29
105
|
* @default 'push'
|
|
30
106
|
*/
|
|
31
|
-
mode?:
|
|
107
|
+
mode?: SyncMode;
|
|
32
108
|
}
|
|
33
109
|
|
|
34
110
|
/**
|
|
@@ -77,7 +153,7 @@ export interface SyncCommitData {
|
|
|
77
153
|
// IBGIB DATA STRUCTURES
|
|
78
154
|
// ===========================================================================
|
|
79
155
|
|
|
80
|
-
export interface
|
|
156
|
+
export interface SyncIb_V1 {
|
|
81
157
|
atom: typeof SYNC_ATOM;
|
|
82
158
|
uuid: string;
|
|
83
159
|
stage: SyncStage;
|
|
@@ -106,7 +182,7 @@ export interface SyncData_V1 extends IbGibData_V1 {
|
|
|
106
182
|
/**
|
|
107
183
|
* Polymorphic payload based on stage.
|
|
108
184
|
*/
|
|
109
|
-
payload
|
|
185
|
+
payload?: SyncInitData | SyncRequestData | SyncDeltaData | SyncCommitData;
|
|
110
186
|
}
|
|
111
187
|
|
|
112
188
|
export interface SyncRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
@@ -118,3 +194,27 @@ export interface SyncRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
|
118
194
|
}
|
|
119
195
|
|
|
120
196
|
export interface SyncIbGib_V1 extends IbGib_V1<SyncData_V1, SyncRel8ns_V1> { }
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Information returned when starting a Sync Saga.
|
|
200
|
+
* Allows the caller to subscribe to updates and await completion.
|
|
201
|
+
*/
|
|
202
|
+
import { SubjectWitness } from "../common/pubsub/subject/subject-types.mjs";
|
|
203
|
+
import { SyncSagaContextIbGib_V1 } from "./sync-saga-context/sync-saga-context-types.mjs";
|
|
204
|
+
|
|
205
|
+
export interface SyncSagaInfo {
|
|
206
|
+
/**
|
|
207
|
+
* The unique ID of the saga.
|
|
208
|
+
*/
|
|
209
|
+
sagaId: string;
|
|
210
|
+
/**
|
|
211
|
+
* Stream of context updates happening during the saga.
|
|
212
|
+
* Subscribe to this to receive real-time progress.
|
|
213
|
+
*/
|
|
214
|
+
updates$: SubjectWitness<SyncSagaContextIbGib_V1>;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Promise that resolves when the saga completes successfully.
|
|
218
|
+
*/
|
|
219
|
+
done: Promise<void>;
|
|
220
|
+
}
|
|
@@ -36,6 +36,19 @@ export interface Rel8nInfo {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface CommonTimelineOptsSansSkipLock {
|
|
39
|
+
/**
|
|
40
|
+
* If true, dna will not be created when executing transforms.
|
|
41
|
+
*
|
|
42
|
+
* ## intent / driving use case
|
|
43
|
+
*
|
|
44
|
+
* We want to use the timeline api in working with the new sync saga code.
|
|
45
|
+
* However, we do not want dna, because the sync saga should not be merged
|
|
46
|
+
* and there should be no dynamic composition required from dna.
|
|
47
|
+
*
|
|
48
|
+
* But the default for this api should be for dna to be created, so we add
|
|
49
|
+
* this negative flag.
|
|
50
|
+
*/
|
|
51
|
+
noDna?: boolean,
|
|
39
52
|
/**
|
|
40
53
|
* space of spaces. Should be a singleton. @see {@link MetaspaceService}
|
|
41
54
|
*/
|
|
@@ -144,6 +157,7 @@ export async function appendToTimeline({
|
|
|
144
157
|
metaspace,
|
|
145
158
|
space,
|
|
146
159
|
skipLock,
|
|
160
|
+
noDna,
|
|
147
161
|
}: {
|
|
148
162
|
timeline: IbGib_V1,
|
|
149
163
|
/**
|
|
@@ -222,7 +236,7 @@ export async function appendToTimeline({
|
|
|
222
236
|
type: 'rel8', // assuming rel8 is the transform type
|
|
223
237
|
src: latestTimelineIbGibDto, // Use the latest as the source
|
|
224
238
|
rel8nsToAddByAddr,
|
|
225
|
-
dna: true,
|
|
239
|
+
dna: noDna ? false : true,
|
|
226
240
|
nCounter: true,
|
|
227
241
|
});
|
|
228
242
|
const newTimelineIbGib = resRel8.newIbGib;
|
|
@@ -550,6 +564,7 @@ export async function mut8Timeline<TData extends IbGibData_V1 = any>({
|
|
|
550
564
|
space,
|
|
551
565
|
skipLock,
|
|
552
566
|
timelineIndexInfo,
|
|
567
|
+
noDna,
|
|
553
568
|
}: {
|
|
554
569
|
/**
|
|
555
570
|
* timeline ibgib whose `data` we're mutating.
|
|
@@ -619,7 +634,7 @@ export async function mut8Timeline<TData extends IbGibData_V1 = any>({
|
|
|
619
634
|
const resMut8 = await mut8({
|
|
620
635
|
...mut8Opts,
|
|
621
636
|
src: latestTimelineIbGibDto,
|
|
622
|
-
dna: true,
|
|
637
|
+
dna: noDna ? false : true,
|
|
623
638
|
nCounter: true,
|
|
624
639
|
}) as TransformResult<IbGib_V1<TData, any>>;
|
|
625
640
|
const newTimelineIbGib = resMut8.newIbGib;
|
|
@@ -728,6 +743,7 @@ export async function createTimeline<TData extends IbGibData_V1 = IbGibData_V1>(
|
|
|
728
743
|
ib,
|
|
729
744
|
data,
|
|
730
745
|
rel8ns,
|
|
746
|
+
noDna,
|
|
731
747
|
parentIb,
|
|
732
748
|
parentIbGib,
|
|
733
749
|
metaspace,
|
|
@@ -790,9 +806,9 @@ export async function createTimeline<TData extends IbGibData_V1 = IbGibData_V1>(
|
|
|
790
806
|
ib,
|
|
791
807
|
data,
|
|
792
808
|
rel8ns,
|
|
793
|
-
|
|
794
|
-
dna: true,
|
|
809
|
+
dna: noDna ? false : true,
|
|
795
810
|
nCounter: true,
|
|
811
|
+
squash: noDna ? true : false,
|
|
796
812
|
tjp: { timestamp: true, uuid: true },
|
|
797
813
|
});
|
|
798
814
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clone, extractErrorMsg, groupBy, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
1
|
+
import { clone, extractErrorMsg, getUUID, groupBy, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
2
2
|
import { IbGibAddr } from '@ibgib/ts-gib/dist/types.mjs';
|
|
3
3
|
import { getIbGibAddr, } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
4
4
|
import { validateIbGibIntrinsically } from '@ibgib/ts-gib/dist/V1/validate-helper.mjs';
|
|
@@ -85,7 +85,8 @@ export class InnerSpace_V1<
|
|
|
85
85
|
}
|
|
86
86
|
this.data!.classname = InnerSpace_V1.name; // always set?
|
|
87
87
|
}
|
|
88
|
-
if (!this.data.uuid) { throw new Error(`this.data.uuid is falsy. right now i'm assuming data.uuid is truthy. this is what i'm using atow (12/2024) (E: e531e3c812c22324e856cf219e337825)`); }
|
|
88
|
+
// if (!this.data.uuid) { throw new Error(`this.data.uuid is falsy. right now i'm assuming data.uuid is truthy. this is what i'm using atow (12/2024) (E: e531e3c812c22324e856cf219e337825)`); }
|
|
89
|
+
this.data.uuid ??= await getUUID();
|
|
89
90
|
|
|
90
91
|
this.ib = getSpaceIb({ space: this, classname: this.data!.classname });
|
|
91
92
|
this.gib = await getGib({ ibGib: this });
|