@ibgib/core-gib 0.1.22 → 0.1.23

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 (78) hide show
  1. package/dist/common/other/graph-helper.d.mts +8 -0
  2. package/dist/common/other/graph-helper.d.mts.map +1 -1
  3. package/dist/common/other/graph-helper.mjs +31 -1
  4. package/dist/common/other/graph-helper.mjs.map +1 -1
  5. package/dist/sync/sync-conflict.respec.mjs +12 -11
  6. package/dist/sync/sync-conflict.respec.mjs.map +1 -1
  7. package/dist/sync/sync-constants.d.mts +14 -4
  8. package/dist/sync/sync-constants.d.mts.map +1 -1
  9. package/dist/sync/sync-constants.mjs +15 -3
  10. package/dist/sync/sync-constants.mjs.map +1 -1
  11. package/dist/sync/sync-helpers.d.mts +22 -15
  12. package/dist/sync/sync-helpers.d.mts.map +1 -1
  13. package/dist/sync/sync-helpers.mjs +159 -90
  14. package/dist/sync/sync-helpers.mjs.map +1 -1
  15. package/dist/sync/sync-innerspace-constants.respec.mjs +11 -10
  16. package/dist/sync/sync-innerspace-constants.respec.mjs.map +1 -1
  17. package/dist/sync/sync-innerspace-deep-updates.respec.mjs +11 -10
  18. package/dist/sync/sync-innerspace-deep-updates.respec.mjs.map +1 -1
  19. package/dist/sync/sync-innerspace-dest-ahead.respec.mjs +11 -10
  20. package/dist/sync/sync-innerspace-dest-ahead.respec.mjs.map +1 -1
  21. package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs +12 -10
  22. package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
  23. package/dist/sync/sync-innerspace-partial-update.respec.mjs +14 -10
  24. package/dist/sync/sync-innerspace-partial-update.respec.mjs.map +1 -1
  25. package/dist/sync/sync-innerspace.respec.mjs +12 -10
  26. package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
  27. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts +0 -15
  28. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts.map +1 -1
  29. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts +15 -14
  30. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts.map +1 -1
  31. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs +9 -55
  32. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -1
  33. package/dist/sync/sync-peer/sync-peer-types.d.mts +16 -0
  34. package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
  35. package/dist/sync/sync-peer/sync-peer-v1.d.mts +39 -5
  36. package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
  37. package/dist/sync/sync-peer/sync-peer-v1.mjs +141 -4
  38. package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
  39. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +22 -3
  40. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -1
  41. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +104 -31
  42. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -1
  43. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +5 -0
  44. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -1
  45. package/dist/sync/sync-saga-coordinator.d.mts +74 -70
  46. package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
  47. package/dist/sync/sync-saga-coordinator.mjs +475 -527
  48. package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
  49. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +105 -22
  50. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
  51. package/dist/sync/sync-types.d.mts +56 -88
  52. package/dist/sync/sync-types.d.mts.map +1 -1
  53. package/dist/sync/sync-types.mjs +5 -0
  54. package/dist/sync/sync-types.mjs.map +1 -1
  55. package/dist/timeline/timeline-api.d.mts.map +1 -1
  56. package/dist/timeline/timeline-api.mjs +15 -8
  57. package/dist/timeline/timeline-api.mjs.map +1 -1
  58. package/package.json +1 -1
  59. package/src/common/other/graph-helper.mts +26 -1
  60. package/src/sync/sync-conflict.respec.mts +12 -11
  61. package/src/sync/sync-constants.mts +15 -4
  62. package/src/sync/sync-helpers.mts +167 -95
  63. package/src/sync/sync-innerspace-constants.respec.mts +11 -10
  64. package/src/sync/sync-innerspace-deep-updates.respec.mts +11 -10
  65. package/src/sync/sync-innerspace-dest-ahead.respec.mts +11 -10
  66. package/src/sync/sync-innerspace-multiple-timelines.respec.mts +12 -10
  67. package/src/sync/sync-innerspace-partial-update.respec.mts +14 -12
  68. package/src/sync/sync-innerspace.respec.mts +12 -10
  69. package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mts +0 -15
  70. package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +16 -65
  71. package/src/sync/sync-peer/sync-peer-types.mts +17 -0
  72. package/src/sync/sync-peer/sync-peer-v1.mts +141 -8
  73. package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +116 -37
  74. package/src/sync/sync-saga-context/sync-saga-context-types.mts +5 -0
  75. package/src/sync/sync-saga-coordinator.mts +525 -617
  76. package/src/sync/sync-saga-message/sync-saga-message-types.mts +106 -22
  77. package/src/sync/sync-types.mts +59 -101
  78. package/src/timeline/timeline-api.mts +17 -10
@@ -1,13 +1,15 @@
1
- import { extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
1
+ import { extractErrorMsg, getUUID } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
2
  import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
3
3
  import { Ib } from "@ibgib/ts-gib/dist/types.mjs";
4
+ import { validateIbGibIntrinsically } from "@ibgib/ts-gib/dist/V1/validate-helper.mjs";
4
5
 
5
6
  import { GLOBAL_LOG_A_LOT } from "../core-constants.mjs";
6
7
  import { SYNC_ATOM, SYNC_MSG_REL8N_NAME } from "./sync-constants.mjs";
7
- import { SyncData_V1, SyncIb_V1, SyncIbGib_V1 } from "./sync-types.mjs";
8
+ import { isValidSyncConflictStrategy, SYNC_CONFLICT_STRATEGY_VALID_VALUES, SyncData_V1, SyncIb_V1, SyncIbGib_V1, SyncSagaFrameDependencyGraph } from "./sync-types.mjs";
8
9
  import { IbGibSpaceAny } from "../witness/space/space-base-v1.mjs";
9
10
  import { getFromSpace } from "../witness/space/space-helper.mjs";
10
11
  import { IbGibSpaceResultData, IbGibSpaceResultIbGib, IbGibSpaceResultRel8ns } from "../witness/space/space-types.mjs";
12
+ import { KeystoneIbGib_V1 } from "../keystone/keystone-types.mjs";
11
13
 
12
14
  const logalot = GLOBAL_LOG_A_LOT;
13
15
 
@@ -69,94 +71,79 @@ export async function parseSyncIb({
69
71
  }
70
72
 
71
73
  /**
72
- * Checks if an address (`olderAddr`) is in the past frames of another (`newerAddr`).
74
+ * @returns the name for a tempSpace in the sync
75
+ */
76
+ export async function getTempSpaceName(): Promise<string> {
77
+ const uuid = await getUUID();
78
+ return `tmp_sync_space_${uuid.substring(0, 8)}`;
79
+ }
80
+
81
+ /**
82
+ * UNTESTED
73
83
  *
74
- * Efficiently uses `inMemoryGraph` if provided to avoid Space I/O.
75
- * Otherwise falls back to traversing using `space`.
84
+ * Checks if an {@link olderAddr} is the address of a past frame in the ibgib
85
+ * with {@link newerAddr}.
76
86
  */
77
87
  export async function isPastFrame({
78
88
  olderAddr,
79
89
  newerAddr,
80
90
  space,
81
- inMemoryGraph,
82
91
  }: {
83
92
  olderAddr: string, // Was ancestorAddr
84
93
  newerAddr: string, // Was descendantAddr
85
- space?: IbGibSpaceAny,
86
- inMemoryGraph?: { [addr: string]: IbGib_V1 },
94
+ space: IbGibSpaceAny,
87
95
  }): Promise<boolean> {
88
- if (olderAddr === newerAddr) return true;
89
-
90
- // Quick check if optimization allowed
91
- if (inMemoryGraph) {
92
- // Optimization: Iterate the graph values (or keys) and see if olderAddr is in any 'past'
93
- // Actually we need to traverse from newerAddr back to olderAddr using the graph.
94
-
95
- const queue = [newerAddr];
96
- const visited = new Set<string>();
97
-
98
- while (queue.length > 0) {
99
- const currentAddr = queue.shift()!;
100
- if (visited.has(currentAddr)) continue;
101
- visited.add(currentAddr);
102
-
103
- if (currentAddr === olderAddr) return true;
104
-
105
- const node = inMemoryGraph[currentAddr];
106
- // If node not in memory graph, we can't traverse further in memory.
107
- // If we have space, we could fallback, but usually mixed mode is tricky.
108
- // For now, if provided inMemoryGraph, assume it contains the relevant segment.
109
- if (!node && space) {
110
- // optional fallback to space if allowed?
111
- // User requirement: "at most we are looking... in dependency graph".
112
- // So let's fallback if space provided.
113
- const res = await getFromSpace({ space, addr: currentAddr });
114
- if (res.success && res.ibGibs?.length) {
115
- const spaceNode = res.ibGibs[0];
116
- if (spaceNode.rel8ns && spaceNode.rel8ns.past) {
117
- for (const pastAddr of spaceNode.rel8ns.past) {
118
- if (!visited.has(pastAddr)) queue.push(pastAddr);
119
- }
120
- }
121
- }
122
- continue;
123
- } else if (!node) {
124
- continue; // Dead end in memory
125
- }
96
+ const lc = `[${isPastFrame.name}]`;
97
+ try {
98
+ if (logalot) { console.log(`${lc} starting... (I: 4b3548cbc9a2eb749f447ed82fdcf826)`); }
126
99
 
127
- if (node.rel8ns && node.rel8ns.past) {
128
- for (const pastAddr of node.rel8ns.past) {
129
- if (!visited.has(pastAddr)) queue.push(pastAddr);
130
- }
131
- }
100
+ // quick check...
101
+ if (olderAddr === newerAddr) {
102
+ return true; /* <<<< returns early */
132
103
  }
133
- return false;
134
- }
135
-
136
- // Fallback to purely space-based traversal if no memory graph
137
- if (!space) { throw new Error(`Must provide either space or inMemoryGraph for ancestry check.`); }
138
104
 
139
- const queue = [newerAddr];
140
- const visited = new Set<string>();
105
+ // diff, so get the actual ibGib
106
+ let newerIbGib: IbGib_V1;
107
+ const res = await getFromSpace({ space, addr: newerAddr });
108
+ if (res.success && res.ibGibs?.length === 1) {
109
+ newerIbGib = res.ibGibs[0];
110
+ } else {
111
+ throw new Error(`couldn't get newerAddr (${newerAddr}) from space (${space.ib}). (E: 36c758c22b181b2c89a1cd28937a6826)`);
112
+ }
141
113
 
142
- while (queue.length > 0) {
143
- const currentAddr = queue.shift()!;
144
- if (visited.has(currentAddr)) continue;
145
- visited.add(currentAddr);
114
+ if (!newerIbGib.rel8ns) {
115
+ console.warn(`${lc} newerIbGib.rel8ns falsy? newerAddr: ${newerAddr}. (W: 6f920811f7080281189f767813814826)`);
116
+ return false; /* <<<< returns early */
117
+ }
146
118
 
147
- if (currentAddr === olderAddr) return true;
119
+ const pastAddrs = newerIbGib.rel8ns.past ?? [];
120
+ if (pastAddrs.length === 0) {
121
+ return false; /* <<<< returns early */
122
+ }
148
123
 
149
- const res = await getFromSpace({ space, addr: currentAddr });
150
- if (!res.success || !res.ibGibs || res.ibGibs.length === 0) continue;
151
- const node = res.ibGibs[0];
152
- if (node.rel8ns && node.rel8ns.past) {
153
- for (const pastAddr of node.rel8ns.past) {
154
- if (!visited.has(pastAddr)) queue.push(pastAddr);
155
- }
124
+ if (pastAddrs.includes(olderAddr)) {
125
+ return true; /* <<<< returns early */
156
126
  }
127
+
128
+ // at this point, for most ibgibs we could leave it here. But
129
+ // conceivably, the past could be a linked rel8n. so recurse on the
130
+ // oldest in the past
131
+
132
+ const oldestAddrInThisPast = pastAddrs[0];
133
+ const resRecurse = await isPastFrame({
134
+ olderAddr,
135
+ newerAddr: oldestAddrInThisPast,
136
+ space,
137
+ });
138
+
139
+ return resRecurse;
140
+ } catch (error) {
141
+ console.error(`${lc} ${extractErrorMsg(error)}`);
142
+ throw error;
143
+ } finally {
144
+ if (logalot) { console.log(`${lc} complete.`); }
157
145
  }
158
146
 
159
- return false;
160
147
  }
161
148
 
162
149
  /**
@@ -168,43 +155,128 @@ export async function isPastFrame({
168
155
  * It only retrieves the *content* of the current frame:
169
156
  * 1. The Frame itself.
170
157
  * 2. The Message Stone(s) (`rel8ns.msg`).
171
- * 3. The Identity (`rel8ns.identity`).
158
+ * 3. The Identity(s) (`rel8ns.identity`).
172
159
  *
173
160
  * This is used for efficient transmission of the "Current Step" without re-sending the entire history.
174
161
  */
175
- export async function getSyncSagaDependencyGraph({
176
- ibGib,
177
- space,
162
+ export async function getSyncSagaFrameDependencyGraph({
163
+ sagaIbGib,
164
+ localSpace,
178
165
  }: {
179
- ibGib: IbGib_V1,
180
- space: IbGibSpaceAny,
181
- }): Promise<IbGib_V1[]> {
182
- const lc = `[${getSyncSagaDependencyGraph.name}]`;
183
- const result: IbGib_V1[] = [ibGib];
166
+ sagaIbGib: SyncIbGib_V1,
167
+ localSpace: IbGibSpaceAny,
168
+ }): Promise<SyncSagaFrameDependencyGraph> {
169
+ const lc = `[${getSyncSagaFrameDependencyGraph.name}]`;
184
170
 
185
171
  // Helper to fetch and push
186
- const fetchAndPush = async (addrs: string[]) => {
187
- const res = await getFromSpace({ space, addrs });
188
- if (res.success && res.ibGibs?.length === addrs.length) {
189
- res.ibGibs!.forEach(x => result.push(x));
172
+ const fnGet = async (addrs: string[]) => {
173
+ const resGet = await getFromSpace({ space: localSpace, addrs });
174
+ if (resGet.success && resGet.ibGibs?.length === addrs.length) {
175
+ return resGet.ibGibs!;
190
176
  } else {
191
177
  const resIbGib =
192
- res.rawResultIbGib as IbGibSpaceResultIbGib<IbGib_V1, IbGibSpaceResultData, IbGibSpaceResultRel8ns>
193
- if (!resIbGib.data) { throw new Error(`(UNEXPECTED) res.rawResultIbGib.data falsy? (E: c26c681d2f831fc537ba6f48fee36d26)`); }
178
+ resGet.rawResultIbGib as IbGibSpaceResultIbGib<IbGib_V1, IbGibSpaceResultData, IbGibSpaceResultRel8ns>
179
+ if (!resIbGib.data) { throw new Error(`(UNEXPECTED) resGet.rawResultIbGib.data falsy? (E: c26c681d2f831fc537ba6f48fee36d26)`); }
194
180
  throw new Error(`(UNEXPECTED) couldn't find addrs? addrsNotFound: ${resIbGib.data.addrsNotFound}? (E: 43b7b5a6ad982715c8f3eed69bfa0d26)`);
195
181
  }
196
182
  };
197
183
 
198
- if (ibGib.rel8ns) {
199
- // 1. Message Stones (Payload of the frame)
200
- if (ibGib.rel8ns[SYNC_MSG_REL8N_NAME] && ibGib.rel8ns[SYNC_MSG_REL8N_NAME].length > 0) {
201
- await fetchAndPush(ibGib.rel8ns[SYNC_MSG_REL8N_NAME]);
184
+ const validationErrors = await validateSyncSagaFrame({ sagaIbGib });
185
+ if (validationErrors.length > 0) {
186
+ throw new Error(`invalid sync sagaIbGib. validationErrors: ${validationErrors} (E: 19f9e8c9643858ff41312b62293d2126)`);
187
+ }
188
+
189
+ if (!sagaIbGib.rel8ns) { throw new Error(`(UNEXPECTED) validated sagaIbGib.rel8ns falsy? (E: 73af48be8bbf271ec5cf78187ce8c826)`); }
190
+
191
+ // msg stones
192
+ const msgStoneAddrs = sagaIbGib.rel8ns[SYNC_MSG_REL8N_NAME]!;
193
+ const msgStones = await fnGet(msgStoneAddrs);
194
+
195
+ // identities
196
+ const identities = sagaIbGib.rel8ns.identity && sagaIbGib.rel8ns.identity.length > 0 ?
197
+ await fnGet(sagaIbGib.rel8ns.identity) as KeystoneIbGib_V1[] :
198
+ [];
199
+
200
+ return { sagaIbGib, msgStones, identities, };
201
+ }
202
+
203
+ /**
204
+ * only validates this single frame. does not validate any dependencies or past.
205
+ * @returns array of errors, empty if valid
206
+ */
207
+ export async function validateSyncSagaFrame({
208
+ sagaIbGib
209
+ }: {
210
+ sagaIbGib: SyncIbGib_V1;
211
+ }): Promise<string[]> {
212
+ const lc = `[${validateSyncSagaFrame.name}]`;
213
+ try {
214
+ if (logalot) { console.log(`${lc} starting... (I: dac978e9ec5820f128fbbff817b82826)`); }
215
+
216
+ const errors: string[] = await validateIbGibIntrinsically({ ibGib: sagaIbGib }) ?? [];
217
+
218
+ // intrinsic errors are a non-starter
219
+ if (errors.length > 0) { return errors; /* <<<< returns early */ }
220
+
221
+ if (sagaIbGib.data) {
222
+ const { data } = sagaIbGib;
223
+
224
+ if (data.uuid) {
225
+ // todo: validate uuid
226
+ } else {
227
+ errors.push(`data.uuid required (E: aa24eeda7b88d22e5832a2e8083c0826)`);
228
+ }
229
+ if (data.timestamp) {
230
+ // todo: validate timestamp
231
+ } else {
232
+ errors.push(`data.timestamp required (E: 9c82a88548f4b63c38687428754b3826)`);
233
+ }
234
+ if (data.timestampMs || data.timestampMs === 0) {
235
+ // todo: validate timestampMs
236
+ } else {
237
+ errors.push(`data.timestampMs required (E: 9c82a88548f4b63c38687428754b3826)`);
238
+ }
239
+
240
+ if (data.conflictStrategy) {
241
+ if (!isValidSyncConflictStrategy(data.conflictStrategy)) {
242
+ errors.push(`data.conflictStrategy (${data.conflictStrategy}) is invalid. Must be one of "${SYNC_CONFLICT_STRATEGY_VALID_VALUES}". (E: 6223a8813b688fa2c8644fa8a491bf26)`)
243
+ }
244
+ } else {
245
+ errors.push(`data.conflictStrategy required (E: 9c82a88548f4b63c38687428754b3826)`);
246
+ }
247
+
248
+ if (data.expirationTimestamp) {
249
+ // todo: validate expirationTimestamp
250
+ }
251
+
252
+ if (data.errors) {
253
+ // todo: validate errors?
254
+ }
255
+
256
+ if (data.successCount) {
257
+ // todo: validate successCount
258
+ }
259
+
260
+ } else {
261
+ errors.push(`sagaIbGib.data falsy (E: 4de5e8de589d0af7245600fb4fe30926)`);
202
262
  }
203
- // 2. Identity (Signer)
204
- if (ibGib.rel8ns.identity && ibGib.rel8ns.identity.length > 0) {
205
- await fetchAndPush(ibGib.rel8ns.identity);
263
+
264
+ if (sagaIbGib.rel8ns) {
265
+ const msgAddrs = sagaIbGib.rel8ns[SYNC_MSG_REL8N_NAME];
266
+ if (msgAddrs && msgAddrs.length > 0) {
267
+ // todo: validate the syncmsg addr?
268
+ } else {
269
+ errors.push(`sagaIbGib.rel8ns[SYNC_MSG_REL8N_NAME] required. (E: df648dc18148e718682acb4842ecf826)`);
270
+ }
271
+ } else {
272
+ errors.push(`sagaIbGib.rel8ns falsy (E: da37aa492a7275b68a5e1912c7a5e126)`);
206
273
  }
207
- }
208
274
 
209
- return result;
275
+ return errors;
276
+ } catch (error) {
277
+ console.error(`${lc} ${extractErrorMsg(error)}`);
278
+ throw error;
279
+ } finally {
280
+ if (logalot) { console.log(`${lc} complete.`); }
281
+ }
210
282
  }
@@ -69,16 +69,17 @@ await respecfully(sir, `Sync Constants (No TJP)`, async () => {
69
69
  const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
70
70
  const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
71
71
 
72
- const peer = new SyncPeerInnerspace_V1({
73
- senderSpace: sourceSpace,
74
- receiverSpace: destSpace,
75
- receiverCoordinator: receiverCoordinator,
76
- receiverMetaspace: metaspace,
77
- receiverTempSpace: 0 as any, // placeholder this is wrong
78
- senderTempSpace: 0 as any, // placeholder this is wrong
79
- }, {
80
- classname: SyncPeerInnerspace_V1.name,
81
- });
72
+ // const peer = new SyncPeerInnerspace_V1({
73
+ // senderSpace: sourceSpace,
74
+ // receiverSpace: destSpace,
75
+ // receiverCoordinator: receiverCoordinator,
76
+ // receiverMetaspace: metaspace,
77
+ // receiverTempSpace: 0 as any, // placeholder this is wrong // just to get to compile
78
+ // senderTempSpace: 0 as any, // placeholder this is wrong // just to get to compile
79
+ // }, {
80
+ // classname: SyncPeerInnerspace_V1.name,
81
+ // });
82
+ const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
82
83
 
83
84
  // 4. Sync C1 (First Pass)
84
85
  let resSync = await senderCoordinator.sync({
@@ -100,16 +100,17 @@ await respecfully(sir, `Sync InnerSpaces (Deep Updates)`, async () => {
100
100
  const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
101
101
  const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
102
102
 
103
- const peer = new SyncPeerInnerspace_V1({
104
- senderSpace: sourceSpace,
105
- receiverSpace: destSpace,
106
- receiverCoordinator: receiverCoordinator,
107
- receiverMetaspace: metaspace,
108
- receiverTempSpace: 0 as any,
109
- senderTempSpace: 0 as any,
110
- }, {
111
- classname: SyncPeerInnerspace_V1.name,
112
- });
103
+ // const peer = new SyncPeerInnerspace_V1(
104
+ // senderSpace: sourceSpace,
105
+ // receiverSpace: destSpace,
106
+ // receiverCoordinator: receiverCoordinator,
107
+ // receiverMetaspace: metaspace,
108
+ // receiverTempSpace: 0 as any, // just to get to compile
109
+ // senderTempSpace: 0 as any, // just to get to compile
110
+ // }, {
111
+ // classname: SyncPeerInnerspace_V1.name,
112
+ // });
113
+ const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
113
114
 
114
115
  // 4. Run Sync
115
116
  console.log(`${lc} Running Sync...`);
@@ -110,16 +110,17 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
110
110
  const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
111
111
  const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
112
112
 
113
- const peer = new SyncPeerInnerspace_V1({
114
- senderSpace: sourceSpace,
115
- receiverSpace: destSpace,
116
- receiverCoordinator: receiverCoordinator,
117
- receiverMetaspace: metaspace,
118
- receiverTempSpace: 0 as any,// this is wrong just getting to build
119
- senderTempSpace: 0 as any, // this is wrong just getting to build
120
- }, {
121
- classname: SyncPeerInnerspace_V1.name
122
- });
113
+ // const peer = new SyncPeerInnerspace_V1({
114
+ // senderSpace: sourceSpace,
115
+ // receiverSpace: destSpace,
116
+ // receiverCoordinator: receiverCoordinator,
117
+ // receiverMetaspace: metaspace,
118
+ // receiverTempSpace: 0 as any,// this is wrong just getting to build
119
+ // senderTempSpace: 0 as any, // this is wrong just getting to build
120
+ // }, {
121
+ // classname: SyncPeerInnerspace_V1.name
122
+ // });
123
+ const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
123
124
 
124
125
  // 4. Run Sync (Source Pushes V1)
125
126
  console.log(`${lc} Running Sync...`);
@@ -104,16 +104,18 @@ await respecfully(sir, `Sync InnerSpaces (Multiple Timelines)`, async () => {
104
104
  const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
105
105
  const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
106
106
 
107
- const peer = new SyncPeerInnerspace_V1({
108
- senderSpace: sourceSpace,
109
- receiverSpace: destSpace,
110
- receiverCoordinator: receiverCoordinator,
111
- receiverMetaspace: metaspace,
112
- receiverTempSpace: 0 as any,
113
- senderTempSpace: 0 as any,
114
- }, {
115
- classname: SyncPeerInnerspace_V1.name,
116
- });
107
+ // const peer = new SyncPeerInnerspace_V1({
108
+ // senderSpace: sourceSpace,
109
+ // receiverSpace: destSpace,
110
+ // receiverCoordinator: receiverCoordinator,
111
+ // receiverMetaspace: metaspace,
112
+ // receiverTempSpace: 0 as any, // just to get to compile
113
+ // senderTempSpace: 0 as any, // just to get to compile
114
+ // }, {
115
+ // classname: SyncPeerInnerspace_V1.name,
116
+ // });
117
+ const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
118
+ await peer.initialized;
117
119
 
118
120
  // 4. Run Sync (Push Both)
119
121
  console.log(`${lc} Running Sync...`);
@@ -112,18 +112,20 @@ await respecfully(sir, `Sync InnerSpaces (Partial Update)`, async () => {
112
112
  const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
113
113
  const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
114
114
 
115
- const peer = new SyncPeerInnerspace_V1({
116
- senderSpace: sourceSpace,
117
- receiverSpace: destSpace,
118
- receiverCoordinator: receiverCoordinator,
119
- receiverMetaspace: metaspace,
120
- receiverTempSpace: 0 as any,
121
- senderTempSpace: 0 as any,
122
- },
123
- {
124
- classname: SyncPeerInnerspace_V1.name,
125
- }
126
- );
115
+ // const peer = new SyncPeerInnerspace_V1({
116
+ // senderSpace: sourceSpace,
117
+ // receiverSpace: destSpace,
118
+ // receiverCoordinator: receiverCoordinator,
119
+ // receiverMetaspace: metaspace,
120
+ // receiverTempSpace: 0 as any, // just to get to compile
121
+ // senderTempSpace: 0 as any, // just to get to compile
122
+ // },
123
+ // {
124
+ // classname: SyncPeerInnerspace_V1.name,
125
+ // }
126
+ // );
127
+ const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
128
+ await peer.initialized;
127
129
 
128
130
  // 4. Run Sync (Source Pushes V2)
129
131
  console.log(`${lc} Running Sync...`);
@@ -103,16 +103,18 @@ await respecfully(sir, `Sync InnerSpaces`, async () => {
103
103
  const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
104
104
 
105
105
  // Peer (The "Network")
106
- const peer = new SyncPeerInnerspace_V1({
107
- senderSpace: sourceSpace, // "Client"
108
- receiverSpace: destSpace, // "Server"
109
- receiverCoordinator: receiverCoordinator,
110
- receiverMetaspace: metaspace,
111
- senderTempSpace: 0 as any,
112
- receiverTempSpace: 0 as any,
113
- }, {
114
- classname: SyncPeerInnerspace_V1.name,
115
- });
106
+ // const peer = new SyncPeerInnerspace_V1({
107
+ // senderSpace: sourceSpace, // "Client"
108
+ // receiverSpace: destSpace, // "Server"
109
+ // receiverCoordinator: receiverCoordinator,
110
+ // receiverMetaspace: metaspace,
111
+ // senderTempSpace: 0 as any,
112
+ // receiverTempSpace: 0 as any,
113
+ // }, {
114
+ // classname: SyncPeerInnerspace_V1.name,
115
+ // });
116
+ const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
117
+ await peer.initialized;
116
118
 
117
119
  // 4. Run Sync
118
120
  console.log(`${lc} Running Sync...`);
@@ -14,21 +14,6 @@ import { SyncPeerData_V1, SyncPeerRel8ns_V1 } from '../sync-peer-types.mjs';
14
14
  * Options for creating a SyncPeerInnerspace instance.
15
15
  */
16
16
  export interface SyncPeerInnerspaceOptions {
17
- /**
18
- * sender's durable space.
19
- *
20
- * will store control ibgibs (context, sync saga ibgib, control msg stones)
21
- * here (and in {@link senderTempSpace}) throughout the process for audit trail.
22
- */
23
- senderSpace: IbGibSpaceAny;
24
- /**
25
- * sender's temporary space for the entire sync transaction.
26
- *
27
- * In addition to control ibgibs which are stored in both temp and durable
28
- * spaces, this temp space will be where domain ibgibs are stored that are
29
- * received/created throughout the transaction until commit.
30
- */
31
- senderTempSpace: IbGibSpaceAny;
32
17
  /**
33
18
  * The "receiver" durable space (not temp).
34
19
  *