@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.
Files changed (69) hide show
  1. package/dist/common/comment/comment-constants.d.mts +1 -1
  2. package/dist/common/comment/comment-constants.d.mts.map +1 -1
  3. package/dist/common/comment/comment-constants.mjs +1 -1
  4. package/dist/common/comment/comment-constants.mjs.map +1 -1
  5. package/dist/timeline/timeline-api.d.mts +297 -0
  6. package/dist/timeline/timeline-api.d.mts.map +1 -0
  7. package/dist/timeline/timeline-api.mjs +725 -0
  8. package/dist/timeline/timeline-api.mjs.map +1 -0
  9. package/dist/timeline/timeline-types.d.mts +42 -0
  10. package/dist/timeline/timeline-types.d.mts.map +1 -0
  11. package/dist/timeline/timeline-types.mjs +2 -0
  12. package/dist/timeline/timeline-types.mjs.map +1 -0
  13. package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts +0 -1
  14. package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts.map +1 -1
  15. package/dist/witness/space/filesystem-space/filesystem-space-v1.mjs +0 -3
  16. package/dist/witness/space/filesystem-space/filesystem-space-v1.mjs.map +1 -1
  17. package/dist/witness/space/inner-space/inner-space-constants.d.mts +2 -0
  18. package/dist/witness/space/inner-space/inner-space-constants.d.mts.map +1 -0
  19. package/dist/witness/space/inner-space/inner-space-constants.mjs +2 -0
  20. package/dist/witness/space/inner-space/inner-space-constants.mjs.map +1 -0
  21. package/dist/witness/space/inner-space/inner-space-types.d.mts +23 -0
  22. package/dist/witness/space/inner-space/inner-space-types.d.mts.map +1 -0
  23. package/dist/witness/space/inner-space/inner-space-types.mjs +32 -0
  24. package/dist/witness/space/inner-space/inner-space-types.mjs.map +1 -0
  25. package/dist/witness/space/inner-space/inner-space-v1.d.mts +13 -7
  26. package/dist/witness/space/inner-space/inner-space-v1.d.mts.map +1 -1
  27. package/dist/witness/space/inner-space/inner-space-v1.mjs +159 -8
  28. package/dist/witness/space/inner-space/inner-space-v1.mjs.map +1 -1
  29. package/dist/witness/space/inner-space/inner-space-v1.respec.mjs +206 -52
  30. package/dist/witness/space/inner-space/inner-space-v1.respec.mjs.map +1 -1
  31. package/dist/witness/space/metaspace/metaspace-base.d.mts.map +1 -1
  32. package/dist/witness/space/metaspace/metaspace-base.mjs +4 -2
  33. package/dist/witness/space/metaspace/metaspace-base.mjs.map +1 -1
  34. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.d.mts.map +1 -1
  35. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs +28 -9
  36. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs.map +1 -1
  37. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.d.mts.map +1 -1
  38. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs +27 -3
  39. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs.map +1 -1
  40. package/dist/witness/space/reconciliation-space/reconciliation-space-base.d.mts +100 -0
  41. package/dist/witness/space/reconciliation-space/reconciliation-space-base.d.mts.map +1 -0
  42. package/dist/witness/space/reconciliation-space/reconciliation-space-base.mjs +758 -0
  43. package/dist/witness/space/reconciliation-space/reconciliation-space-base.mjs.map +1 -0
  44. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.d.mts +40 -0
  45. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.d.mts.map +1 -0
  46. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.mjs +90 -0
  47. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.mjs.map +1 -0
  48. package/dist/witness/space/space-helper.d.mts.map +1 -1
  49. package/dist/witness/space/space-helper.mjs +10 -2
  50. package/dist/witness/space/space-helper.mjs.map +1 -1
  51. package/dist/witness/space/space-respec-helper.d.mts.map +1 -1
  52. package/dist/witness/space/space-respec-helper.mjs +3 -0
  53. package/dist/witness/space/space-respec-helper.mjs.map +1 -1
  54. package/package.json +1 -1
  55. package/src/common/comment/comment-constants.mts +1 -1
  56. package/src/timeline/timeline-api.mts +943 -0
  57. package/src/timeline/timeline-types.mts +38 -0
  58. package/src/witness/space/filesystem-space/filesystem-space-v1.mts +0 -3
  59. package/src/witness/space/inner-space/inner-space-constants.mts +1 -0
  60. package/src/witness/space/inner-space/inner-space-types.mts +44 -0
  61. package/src/witness/space/inner-space/inner-space-v1.mts +157 -28
  62. package/src/witness/space/inner-space/inner-space-v1.respec.mts +242 -58
  63. package/src/witness/space/metaspace/metaspace-base.mts +7 -1
  64. package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mts +32 -10
  65. package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mts +76 -53
  66. package/src/witness/space/reconciliation-space/reconciliation-space-base.mts +884 -0
  67. package/src/witness/space/reconciliation-space/reconciliation-space-helper.mts +125 -0
  68. package/src/witness/space/space-helper.mts +5 -2
  69. package/src/witness/space/space-respec-helper.mts +4 -4
@@ -0,0 +1,758 @@
1
+ import { extractErrorMsg, groupBy } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
2
+ import { Factory_V1 as factory, } from '@ibgib/ts-gib/dist/V1/factory.mjs';
3
+ import { getIbAndGib, getIbGibAddr, } from '@ibgib/ts-gib/dist/helper.mjs';
4
+ import { mut8 } from '@ibgib/ts-gib/dist/V1/transforms/mut8.mjs';
5
+ import { GLOBAL_LOG_A_LOT } from '../../../core-constants.mjs';
6
+ import { SpaceBase_V1 } from '../space-base-v1.mjs';
7
+ import { IbGibSpaceOptionsCmd, } from '../space-types.mjs';
8
+ import { execInSpaceWithLocking, throwIfDuplicates, } from '../space-helper.mjs';
9
+ import { getTjpAddr, splitPerTjpAndOrDna, } from '../../../common/other/ibgib-helper.mjs';
10
+ import { getStatusIb } from '../outer-space/outer-space-helper.mjs';
11
+ import { StatusCode } from '../outer-space/outer-space-types.mjs';
12
+ import { STATUS_UNDEFINED_TX_ID } from '../space-constants.mjs';
13
+ import { applyTransforms } from './reconciliation-space-helper.mjs';
14
+ const logalot = GLOBAL_LOG_A_LOT;
15
+ /**
16
+ * Base class for spaces that perform intelligent merging of ibgib timelines,
17
+ * whether it's a bi-directional sync, a one-way merge, or another custom
18
+ * reconciliation strategy.
19
+ *
20
+ * This class contains the core, backend-agnostic logic for timeline
21
+ * reconciliation. Concrete implementations must provide the primitive
22
+ * I/O functions for their specific backing store.
23
+ */
24
+ export class ReconciliationSpaceBase extends SpaceBase_V1 {
25
+ lc = `[ReconciliationSpaceBase]`;
26
+ // protected abstract spinOffToCompleteSync(arg: any): Promise<void>;
27
+ async spinOffToCompleteSync({ srcSpaceId, sagaId, ibGibs, statusStartIbGibs, syncStatusIbGib_Start, syncStatus$, errors, warnings, }) {
28
+ const lc = `${this.lc}[${this.spinOffToCompleteSync.name}]`;
29
+ errors = errors ?? [];
30
+ warnings = warnings ?? [];
31
+ const verbose = logalot;
32
+ let timeLogName = `[sync_log][${sagaId}][${ibGibs.length}]`;
33
+ if (verbose) {
34
+ console.time(timeLogName);
35
+ }
36
+ try {
37
+ if (verbose) {
38
+ console.timeLog(timeLogName, `${lc} starting...`);
39
+ }
40
+ let statusIbGib = syncStatusIbGib_Start;
41
+ statusIbGib.statusIbGibGraph = statusStartIbGibs;
42
+ await this.saveInStoreIfConfigAndPublishStatus({ statusIbGib, syncStatus$ });
43
+ if (verbose) {
44
+ console.timeLog(timeLogName, 'saveInStoreAndPublishStatus complete');
45
+ }
46
+ const ibGibsToStoreNotAlreadyStored = [];
47
+ const updates = {};
48
+ if (verbose) {
49
+ console.timeLog(timeLogName, '_getLatestAddrsInStore starting...');
50
+ }
51
+ const resLatestAddrsMap = await this._getLatestAddrsInStore(ibGibs);
52
+ if (verbose) {
53
+ console.timeLog(timeLogName, '_getLatestAddrsInStore complete');
54
+ }
55
+ let { mapWithTjp_YesDna, mapWithTjp_NoDna, mapWithoutTjps } = splitPerTjpAndOrDna({ ibGibs });
56
+ const mapIbGibsWithTjp = { ...mapWithTjp_YesDna, ...mapWithTjp_NoDna };
57
+ const stoneIbGibs = Object.values(mapWithoutTjps);
58
+ const stoneIbGibsAddrToIbGibMap = {};
59
+ stoneIbGibs.forEach(x => { stoneIbGibsAddrToIbGibMap[getIbGibAddr({ ibGib: x })] = x; });
60
+ const stoneAddrs = Object.keys(stoneIbGibsAddrToIbGibMap);
61
+ const stoneIbGibsNotInStore = stoneIbGibs.filter(x => !resLatestAddrsMap[getIbGibAddr({ ibGib: x })]);
62
+ const stoneAddrsNotInStore = stoneIbGibsNotInStore.map(x => getIbGibAddr({ ibGib: x }));
63
+ const ibGibsWithTjp = Object.values(mapIbGibsWithTjp);
64
+ const mapIbGibsWithTjpGroupedByTjpAddr = groupBy({
65
+ items: ibGibsWithTjp,
66
+ keyFn: x => getTjpAddr({ ibGib: x })
67
+ });
68
+ const tjpAddrs = Object.keys(mapIbGibsWithTjpGroupedByTjpAddr);
69
+ if (logalot) {
70
+ console.timeLog(timeLogName, `tjpAddrs.length: ${tjpAddrs.length}`);
71
+ }
72
+ const tjpOrStoneAddrs = [...tjpAddrs,];
73
+ if (stoneAddrsNotInStore.length > 0) {
74
+ tjpOrStoneAddrs.push(stoneAddrsNotInStore.at(0));
75
+ }
76
+ else if (stoneAddrs.length > 0) {
77
+ tjpOrStoneAddrs.push(stoneAddrs.at(0));
78
+ }
79
+ if (logalot) {
80
+ console.timeLog(timeLogName, `tjpOrStoneAddrs.length: ${tjpOrStoneAddrs.length}`);
81
+ }
82
+ for (let i = 0; i < tjpOrStoneAddrs.length; i++) {
83
+ let statusCode;
84
+ const tjpOrStoneAddr = tjpOrStoneAddrs[i];
85
+ const tjpGib = getIbAndGib({ ibGibAddr: tjpOrStoneAddr }).gib;
86
+ if (verbose) {
87
+ console.timeLog(timeLogName, `execInSpaceWithLocking tjpGib: ${tjpGib.slice(0, 16)} starting...`);
88
+ }
89
+ await execInSpaceWithLocking({
90
+ space: this,
91
+ scope: tjpGib,
92
+ secondsValid: 60 * 5,
93
+ maxDelayMs: 1000 * 60,
94
+ callerInstanceId: sagaId,
95
+ maxLockAttempts: 5,
96
+ fn: async () => {
97
+ const lcFn = `${lc}[fn][${tjpGib.slice(0, 5)}]`;
98
+ const ibGibsToStore_thisIteration = [];
99
+ const ibGibsCreated_thisTjp = [];
100
+ const ibGibsOnlyInStore_thisTjp = [];
101
+ const ibGibsMergeMap_thisTjp = {};
102
+ const latestAddr_Store = resLatestAddrsMap[tjpOrStoneAddr];
103
+ const tjpGroupIbGibs_Local_Ascending = tjpAddrs.includes(tjpOrStoneAddr) ?
104
+ mapIbGibsWithTjpGroupedByTjpAddr[tjpOrStoneAddr]
105
+ .filter(x => (x.data?.n ?? -1) >= 0)
106
+ .sort((a, b) => (a.data?.n ?? -1) > (b.data?.n ?? -1) ? 1 : -1) :
107
+ [];
108
+ if (latestAddr_Store) {
109
+ if (tjpAddrs.includes(tjpOrStoneAddr)) {
110
+ const tjpGroupAddrs_Local_Ascending = tjpGroupIbGibs_Local_Ascending.map(x => getIbGibAddr({ ibGib: x }));
111
+ const latestAddr_Local = tjpGroupAddrs_Local_Ascending[tjpGroupAddrs_Local_Ascending.length - 1];
112
+ if (latestAddr_Store === latestAddr_Local) {
113
+ statusCode = StatusCode.already_synced;
114
+ }
115
+ else if (tjpGroupAddrs_Local_Ascending.includes(latestAddr_Store)) {
116
+ this.reconcile_UpdateStoreWithMoreRecentLocal({
117
+ tjpAddr: tjpOrStoneAddr,
118
+ latestAddr_Store,
119
+ tjpGroupAddrs_Local_Ascending,
120
+ tjpGroupIbGibs_Local_Ascending,
121
+ ibGibsToStore: ibGibsToStore_thisIteration,
122
+ updates,
123
+ });
124
+ statusCode = StatusCode.updated;
125
+ }
126
+ else {
127
+ const latestIbGib_Local = tjpGroupIbGibs_Local_Ascending.find(x => getIbGibAddr({ ibGib: x }) === latestAddr_Local);
128
+ const latestIbGib_Local_HasDna = (latestIbGib_Local.rel8ns?.dna ?? []).length > 0;
129
+ const resGetStoreIbGib = await this._getIbGibsFromStore([latestAddr_Store]);
130
+ const latestIbGib_Store = resGetStoreIbGib[latestAddr_Store];
131
+ if (!latestIbGib_Store) {
132
+ throw new Error(`(UNEXPECTED) latestAddr_Store not found in store: ${latestAddr_Store}`);
133
+ }
134
+ const latestIbGib_Store_HasDna = (latestIbGib_Store.rel8ns?.dna ?? []).length > 0;
135
+ if (latestIbGib_Local_HasDna && latestIbGib_Store_HasDna) {
136
+ await this.reconcile_MergeLocalWithStore_ViaDna({
137
+ tjpAddr: tjpOrStoneAddr,
138
+ latestAddr_Local, latestIbGib_Local,
139
+ latestAddr_Store, latestIbGib_Store,
140
+ ibGibsCreated: ibGibsCreated_thisTjp,
141
+ ibGibMergeMap: ibGibsMergeMap_thisTjp,
142
+ ibGibsOnlyInStore: ibGibsOnlyInStore_thisTjp,
143
+ allLocalIbGibs: ibGibs,
144
+ updates,
145
+ timeLogName,
146
+ });
147
+ ibGibsCreated_thisTjp.forEach(x => ibGibsToStore_thisIteration.push(x));
148
+ statusCode = StatusCode.merged_dna;
149
+ }
150
+ else {
151
+ await this.reconcile_MergeLocalWithStore_ViaState({
152
+ tjpAddr: tjpOrStoneAddr,
153
+ latestIbGib_Local, latestAddr_Local, latestAddr_Store,
154
+ ibGibsCreated: ibGibsCreated_thisTjp,
155
+ ibGibMergeMap: ibGibsMergeMap_thisTjp,
156
+ updates,
157
+ });
158
+ ibGibsCreated_thisTjp.forEach(x => ibGibsToStore_thisIteration.push(x));
159
+ statusCode = StatusCode.merged_state;
160
+ }
161
+ }
162
+ }
163
+ else {
164
+ statusCode = StatusCode.already_synced;
165
+ }
166
+ }
167
+ else {
168
+ if (tjpAddrs.includes(tjpOrStoneAddr)) {
169
+ this.reconcile_InsertFirstTimeIntoStore({
170
+ tjpGroupIbGibs_Local_Ascending,
171
+ ibGibsToStore: ibGibsToStore_thisIteration,
172
+ });
173
+ }
174
+ else {
175
+ stoneAddrsNotInStore.forEach(stoneAddrNotInStore => {
176
+ ibGibsToStore_thisIteration.push(stoneIbGibsAddrToIbGibMap[stoneAddrNotInStore]);
177
+ });
178
+ }
179
+ statusCode = StatusCode.inserted;
180
+ }
181
+ const ibGibAddrsForSureAlreadyInStore = Object.values(resLatestAddrsMap);
182
+ for (let i = 0; i < ibGibsToStore_thisIteration.length; i++) {
183
+ const maybeIbGib = ibGibsToStore_thisIteration[i];
184
+ const maybeAddr = getIbGibAddr({ ibGib: maybeIbGib });
185
+ if (!ibGibAddrsForSureAlreadyInStore.includes(maybeAddr) &&
186
+ !ibGibsToStoreNotAlreadyStored.some(x => getIbGibAddr({ ibGib: x }) === maybeAddr)) {
187
+ ibGibsToStoreNotAlreadyStored.push(maybeIbGib);
188
+ }
189
+ }
190
+ if (ibGibsToStoreNotAlreadyStored.length > 0) {
191
+ await this._putIbGibsToStore(ibGibsToStoreNotAlreadyStored);
192
+ }
193
+ const ibGibAddrs_DidRxFromLocal = ibGibsToStoreNotAlreadyStored.length > 0 ?
194
+ ibGibsToStoreNotAlreadyStored.map(x => getIbGibAddr({ ibGib: x })) :
195
+ undefined;
196
+ const ibGibAddrsCreated = ibGibsCreated_thisTjp.length > 0 ?
197
+ ibGibsCreated_thisTjp.map(x => getIbGibAddr({ ibGib: x })) :
198
+ undefined;
199
+ const ibGibAddrs_DidTxToLocal = ibGibsOnlyInStore_thisTjp.length > 0 ?
200
+ ibGibsOnlyInStore_thisTjp.map(x => getIbGibAddr({ ibGib: x })) :
201
+ undefined;
202
+ const ibGibAddrsMergeMap = {};
203
+ for (const [oldAddr, newIbGib] of Object.entries(ibGibsMergeMap_thisTjp)) {
204
+ ibGibAddrsMergeMap[oldAddr] = getIbGibAddr({ ibGib: newIbGib });
205
+ }
206
+ const resSyncStatusIbGib = await mut8({
207
+ src: statusIbGib,
208
+ mut8Ib: getStatusIb({
209
+ spaceType: 'sync', spaceSubtype: 'aws-dynamodb', statusCode, sagaId,
210
+ }),
211
+ dataToAddOrPatch: {
212
+ statusCode: statusCode,
213
+ success: true,
214
+ errors: (errors ?? []).length > 0 ? errors.concat() : undefined,
215
+ warnings: (warnings ?? []).length > 0 ? warnings.concat() : undefined,
216
+ didRx: ibGibAddrs_DidRxFromLocal?.concat(),
217
+ didTx: ibGibAddrs_DidTxToLocal?.concat(),
218
+ didCreate: ibGibAddrsCreated?.concat(),
219
+ didMergeMap: ibGibAddrsMergeMap,
220
+ },
221
+ dna: false,
222
+ });
223
+ statusIbGib = resSyncStatusIbGib.newIbGib;
224
+ statusIbGib.statusIbGibGraph = resSyncStatusIbGib.intermediateIbGibs ?
225
+ [statusIbGib, ...resSyncStatusIbGib.intermediateIbGibs] :
226
+ [statusIbGib];
227
+ // if (ibGibsCreated_thisTjp.length >)
228
+ // stopped here...need to provide the rest of this code
229
+ // }
230
+ // });
231
+ // }
232
+ // } catch (error) {
233
+ // console.error(`${lc} ${extractErrorMsg(error)}`);
234
+ // throw error;
235
+ // }
236
+ // }
237
+ if (ibGibsCreated_thisTjp.length > 0) {
238
+ statusIbGib.createdIbGibs = ibGibsCreated_thisTjp.concat();
239
+ }
240
+ if (ibGibsOnlyInStore_thisTjp.length > 0) {
241
+ statusIbGib.storeOnlyIbGibs = ibGibsOnlyInStore_thisTjp.concat();
242
+ }
243
+ if (Object.keys(ibGibsMergeMap_thisTjp).length > 0) {
244
+ statusIbGib.ibGibsMergeMap = ibGibsMergeMap_thisTjp;
245
+ }
246
+ await this.saveInStoreIfConfigAndPublishStatus({ statusIbGib, syncStatus$ });
247
+ }, // end of fn for execInSpaceWithLocking
248
+ }); // end of execInSpaceWithLocking
249
+ if (verbose) {
250
+ console.timeLog(timeLogName, `execInSpaceWithLocking tjpGib: ${tjpGib.slice(0, 16)} complete.`);
251
+ }
252
+ } // end of for loop
253
+ if (verbose) {
254
+ console.timeLog(timeLogName, 'complete saga cleanup starting...');
255
+ }
256
+ const statusCode = StatusCode.completed;
257
+ const resSyncStatusIbGib_Complete = await mut8({
258
+ src: statusIbGib,
259
+ mut8Ib: getStatusIb({
260
+ spaceType: 'sync', spaceSubtype: this.data.subtype, statusCode, sagaId,
261
+ }),
262
+ dataToAddOrPatch: {
263
+ statusCode,
264
+ success: true,
265
+ errors: (errors ?? []).length > 0 ? errors.concat() : undefined,
266
+ warnings: (warnings ?? []).length > 0 ? warnings.concat() : undefined,
267
+ },
268
+ dna: false,
269
+ });
270
+ statusIbGib = resSyncStatusIbGib_Complete.newIbGib;
271
+ statusIbGib.statusIbGibGraph = resSyncStatusIbGib_Complete.intermediateIbGibs ?
272
+ [statusIbGib, ...resSyncStatusIbGib_Complete.intermediateIbGibs] :
273
+ [statusIbGib];
274
+ await this.saveInStoreIfConfigAndPublishStatus({ statusIbGib, syncStatus$ });
275
+ if (verbose) {
276
+ console.timeLog(timeLogName, 'complete saga cleanup complete.');
277
+ }
278
+ if (syncStatus$.complete && !syncStatus$.isCompleteOrErrored) {
279
+ if (timeLogName) {
280
+ if (verbose) {
281
+ console.timeEnd(timeLogName);
282
+ }
283
+ timeLogName = '';
284
+ }
285
+ await syncStatus$.complete();
286
+ }
287
+ else {
288
+ console.warn(`(UNEXPECTED) !syncStatus$.complete? this complete handler is expected to be truthy (W: e706de7fa3289194e59bee9ecf96c224)`);
289
+ }
290
+ }
291
+ catch (error) {
292
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
293
+ if (verbose) {
294
+ console.timeLog(timeLogName, `errored. emsg: ${emsg}`);
295
+ }
296
+ console.error(emsg);
297
+ if (!syncStatus$.isCompleteOrErrored) {
298
+ if (!syncStatus$.error) {
299
+ throw new Error(`(UNEXPECTED) !syncStatus$.error? (E: a26bfba7663301986c633c3c2c764824)`);
300
+ }
301
+ if (timeLogName) {
302
+ if (verbose) {
303
+ console.timeEnd(timeLogName);
304
+ }
305
+ timeLogName = '';
306
+ }
307
+ await syncStatus$.error(emsg);
308
+ }
309
+ }
310
+ }
311
+ async saveInStoreIfConfigAndPublishStatus({ statusIbGib, syncStatus$ }) {
312
+ const lc = `${this.lc}[${this.saveInStoreIfConfigAndPublishStatus.name}]`;
313
+ try {
314
+ if (this.data?.dontStoreStatusUpdatesInSyncSpace) {
315
+ if (logalot) {
316
+ console.log(`${lc} configured to NOT store status updates in this space. (I: 0166928761a34375b367b61f9d45398d)`);
317
+ }
318
+ }
319
+ else {
320
+ if ((statusIbGib.statusIbGibGraph ?? []).length === 0) {
321
+ throw new Error(`statusIbGib.statusIbGibGraph required. (E: 2a11a84f501243799b66a5b28b76b88b)`);
322
+ }
323
+ await this._putIbGibsToStore(statusIbGib.statusIbGibGraph);
324
+ }
325
+ if (syncStatus$.next && !syncStatus$.isCompleteOrErrored) {
326
+ await syncStatus$.next(statusIbGib);
327
+ }
328
+ else {
329
+ // just warn for now
330
+ console.warn(`${lc} (UNEXPECTED) syncStatus$ subject either does not have a next handler or is already completed/errored. (W: 489a580a563b4f6990264177d6118d53)`);
331
+ }
332
+ }
333
+ catch (error) {
334
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
335
+ console.error(emsg);
336
+ throw error;
337
+ }
338
+ }
339
+ // protected abstract reconcile_UpdateStoreWithMoreRecentLocal(arg: {
340
+ // tjpAddr: IbGibAddr,
341
+ // latestAddr_Store: IbGibAddr,
342
+ // tjpGroupAddrs_Local_Ascending: IbGibAddr[],
343
+ // tjpGroupIbGibs_Local_Ascending: TIbGib[],
344
+ // ibGibsToStore: TIbGib[],
345
+ // updates: { [tjpAddr: string]: IbGibAddr },
346
+ // }): void;
347
+ reconcile_UpdateStoreWithMoreRecentLocal({ tjpAddr, latestAddr_Store, tjpGroupAddrs_Local_Ascending, tjpGroupIbGibs_Local_Ascending, ibGibsToStore, updates, }) {
348
+ const lc = `${this.lc}[${this.reconcile_UpdateStoreWithMoreRecentLocal.name}]`;
349
+ try {
350
+ const lastSyncPoint_Local_Idx = tjpGroupAddrs_Local_Ascending.indexOf(latestAddr_Store);
351
+ if (lastSyncPoint_Local_Idx === -1) {
352
+ throw new Error(`(UNEXPECTED) latestAddr_Store not found in local ibGibs. latestAddr_Store: ${latestAddr_Store} (E: 8820c754d5d94ab4971d87af48a4369e)`);
353
+ }
354
+ if (lastSyncPoint_Local_Idx === tjpGroupAddrs_Local_Ascending.length - 1) {
355
+ // we thought we were out of sync, but we are not.
356
+ // this can happen in race conditions.
357
+ console.warn(`${lc} (UNEXPECTED) lastSyncPoint_Local_Idx is latest local ibgib index. This means we are already synced, but somehow thought we weren't. (W: 4927cf51c76a4e2e8509c25f46a9a0f7)`);
358
+ return;
359
+ }
360
+ const ibGibsToUpdate = tjpGroupIbGibs_Local_Ascending.slice(lastSyncPoint_Local_Idx + 1);
361
+ ibGibsToUpdate.forEach(x => ibGibsToStore.push(x));
362
+ updates[tjpAddr] = getIbGibAddr({ ibGib: ibGibsToUpdate[ibGibsToUpdate.length - 1] });
363
+ }
364
+ catch (error) {
365
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
366
+ console.error(emsg);
367
+ throw error;
368
+ }
369
+ }
370
+ async getDna(arg) {
371
+ const lc = `${this.lc}[${this.getDna.name}]`;
372
+ const { ibGib, throwOnDnaFail = true } = arg;
373
+ try {
374
+ const dnaAddrs = ibGib.rel8ns?.dna ?? [];
375
+ if (dnaAddrs.length === 0) {
376
+ // This would be unexpected for a dna'd ibgib, but we handle it.
377
+ return [];
378
+ }
379
+ // BATCH fetch all dna ibgibs from the store in a single call.
380
+ // This will return a map of { addr: ibGib }.
381
+ const dnaIbGibsMap = await this._getIbGibsFromStore(dnaAddrs);
382
+ // The order of the dnaAddrs array *is* the canonical order.
383
+ // We must reconstruct the array in that order from the map.
384
+ const orderedDnaIbGibs = dnaAddrs.map(addr => dnaIbGibsMap[addr]).filter(ibGib => !!ibGib);
385
+ if (orderedDnaIbGibs.length !== dnaAddrs.length) {
386
+ const emsg = `Mismatch in DNA. Requested ${dnaAddrs.length} addrs but only found ${orderedDnaIbGibs.length}. This may indicate a partial save or data loss. (E: 1ce346ba0fc88b71c6a399282d481825)`;
387
+ if (throwOnDnaFail) {
388
+ throw new Error(emsg);
389
+ }
390
+ else {
391
+ console.warn(`${lc} ${emsg}`);
392
+ }
393
+ }
394
+ return orderedDnaIbGibs;
395
+ }
396
+ catch (error) {
397
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
398
+ console.error(emsg);
399
+ throw error;
400
+ }
401
+ }
402
+ async reconcile_MergeLocalWithStore_ViaDna({ tjpAddr, latestAddr_Local, latestIbGib_Local, latestAddr_Store, latestIbGib_Store, ibGibsCreated, ibGibMergeMap, ibGibsOnlyInStore, allLocalIbGibs, updates, timeLogName, }) {
403
+ const lc = `${this.lc}[${this.reconcile_MergeLocalWithStore_ViaDna.name}]`;
404
+ const verbose = logalot;
405
+ try {
406
+ if (verbose) {
407
+ console.timeLog(timeLogName, 'getting full dna timeline for local and store...');
408
+ }
409
+ // get full dna timelines for both local and store versions
410
+ // TO THIS:
411
+ const dnaGraph_Local = await this.getDna({ ibGib: latestIbGib_Local });
412
+ const dnaAddrs_Local = dnaGraph_Local.map(x => getIbGibAddr({ ibGib: x }));
413
+ const dnaGraph_Store = await this.getDna({ ibGib: latestIbGib_Store });
414
+ const dnaAddrs_Store = dnaGraph_Store.map(x => getIbGibAddr({ ibGib: x }));
415
+ // const resGetDna_Local = await this.getDna({ ibGib: latestIbGib_Local, mode: 'all' });
416
+ // const dnaGraph_Local = resGetDna_Local.ibGibs;
417
+ // const dnaAddrs_Local = dnaGraph_Local.map(x => getIbGibAddr({ ibGib: x }));
418
+ // const resGetDna_Store = await this.getDna({ ibGib: latestIbGib_Store, mode: 'all' });
419
+ // const dnaGraph_Store = resGetDna_Store.ibGibs;
420
+ // const dnaAddrs_Store = dnaGraph_Store.map(x => getIbGibAddr({ ibGib: x }));
421
+ if (verbose) {
422
+ console.timeLog(timeLogName, 'getting full dna timeline for local and store...complete');
423
+ }
424
+ // find the common ancestor addr, if any.
425
+ // we start from the end of the shorter list and work our way backwards.
426
+ let commonAncestorAddr;
427
+ if (dnaAddrs_Local.length < dnaAddrs_Store.length) {
428
+ for (let i = dnaAddrs_Local.length - 1; i >= 0; i--) {
429
+ const addr = dnaAddrs_Local[i];
430
+ if (dnaAddrs_Store.includes(addr)) {
431
+ commonAncestorAddr = addr;
432
+ break;
433
+ }
434
+ }
435
+ }
436
+ else {
437
+ for (let i = dnaAddrs_Store.length - 1; i >= 0; i--) {
438
+ const addr = dnaAddrs_Store[i];
439
+ if (dnaAddrs_Local.includes(addr)) {
440
+ commonAncestorAddr = addr;
441
+ break;
442
+ }
443
+ }
444
+ }
445
+ if (!commonAncestorAddr) {
446
+ throw new Error(`Could not find common ancestor between local and store timelines. Local: ${latestAddr_Local}, Store: ${latestAddr_Store}. This timeline requires manual reconciliation. (E: 49219b101a9f4568bd740d046e30ea2d)`);
447
+ }
448
+ const commonAncestorIdx_Local = dnaAddrs_Local.indexOf(commonAncestorAddr);
449
+ const commonAncestorIdx_Store = dnaAddrs_Store.indexOf(commonAncestorAddr);
450
+ const dnaAddrsToApplyToStoreVersion = dnaAddrs_Local.slice(commonAncestorIdx_Local + 1);
451
+ const dnaAddrsToApplyToLocalVersion = dnaAddrs_Store.slice(commonAncestorIdx_Store + 1);
452
+ // get the ibGibs that are only in the store and send them to the local client
453
+ if (dnaAddrsToApplyToLocalVersion.length > 0) {
454
+ if (verbose) {
455
+ console.timeLog(timeLogName, `getting ${dnaAddrsToApplyToLocalVersion.length} ibgibs from store that do not exist locally...`);
456
+ }
457
+ const resGetIbGibs = await this._getIbGibsFromStore(dnaAddrsToApplyToLocalVersion);
458
+ Object.values(resGetIbGibs).forEach(x => ibGibsOnlyInStore.push(x));
459
+ if (verbose) {
460
+ console.timeLog(timeLogName, `getting ${dnaAddrsToApplyToLocalVersion.length} ibgibs from store that do not exist locally...complete`);
461
+ }
462
+ }
463
+ if (dnaAddrsToApplyToStoreVersion.length > 0) {
464
+ // this is the merge part, where we create new ibgibs that represent the merge
465
+ if (verbose) {
466
+ console.timeLog(timeLogName, `applying ${dnaAddrsToApplyToStoreVersion.length} transforms from local that do not exist in store...`);
467
+ }
468
+ const createdIbGibs_Running = [];
469
+ const resApply = await applyTransforms({
470
+ src: latestIbGib_Store,
471
+ createdIbGibs_Running,
472
+ dnaAddrsToApplyToStoreVersion,
473
+ allLocalIbGibs,
474
+ });
475
+ const mergedIbGib = resApply;
476
+ if (verbose) {
477
+ console.timeLog(timeLogName, `applying ${dnaAddrsToApplyToStoreVersion.length} transforms from local that do not exist in store...complete`);
478
+ }
479
+ if (verbose) {
480
+ console.timeLog(timeLogName, `applying ${dnaAddrsToApplyToLocalVersion.length} transforms from store that do not exist locally...`);
481
+ }
482
+ const resApply2 = await applyTransforms({
483
+ src: mergedIbGib,
484
+ createdIbGibs_Running,
485
+ dnaAddrsToApplyToStoreVersion: dnaAddrsToApplyToLocalVersion,
486
+ allLocalIbGibs: ibGibsOnlyInStore,
487
+ });
488
+ const finalMergedIbGib = resApply2;
489
+ if (verbose) {
490
+ console.timeLog(timeLogName, `applying ${dnaAddrsToApplyToLocalVersion.length} transforms from store that do not exist locally...complete`);
491
+ }
492
+ // gather all the created ibgibs (including intermediates)
493
+ createdIbGibs_Running.forEach(x => {
494
+ const addr = getIbGibAddr({ ibGib: x });
495
+ if (!ibGibsCreated.some(y => getIbGibAddr({ ibGib: y }) === addr)) {
496
+ ibGibsCreated.push(x);
497
+ }
498
+ });
499
+ const finalMergedAddr = getIbGibAddr({ ibGib: finalMergedIbGib });
500
+ if (!ibGibsCreated.some(y => getIbGibAddr({ ibGib: y }) === finalMergedAddr)) {
501
+ ibGibsCreated.push(finalMergedIbGib);
502
+ }
503
+ ibGibMergeMap[latestAddr_Local] = finalMergedIbGib;
504
+ ibGibMergeMap[latestAddr_Store] = finalMergedIbGib;
505
+ updates[tjpAddr] = finalMergedAddr;
506
+ }
507
+ }
508
+ catch (error) {
509
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
510
+ console.error(emsg);
511
+ throw error;
512
+ }
513
+ }
514
+ // protected abstract reconcile_MergeLocalWithStore_ViaState(arg: {
515
+ // tjpAddr: IbGibAddr,
516
+ // latestIbGib_Local: TIbGib,
517
+ // latestAddr_Local: IbGibAddr,
518
+ // latestAddr_Store: IbGibAddr,
519
+ // ibGibsCreated: TIbGib[],
520
+ // ibGibMergeMap: { [oldLatestAddr: string]: TIbGib },
521
+ // updates: { [tjpAddr: string]: IbGibAddr },
522
+ // }): Promise<void>;
523
+ async reconcile_MergeLocalWithStore_ViaState({ tjpAddr, latestIbGib_Local, latestAddr_Local, latestAddr_Store, ibGibsCreated, ibGibMergeMap, updates, }) {
524
+ const lc = `${this.lc}[${this.reconcile_MergeLocalWithStore_ViaState.name}]`;
525
+ try {
526
+ // we're essentially just creating a new ibgib with the merged data.
527
+ const resMut8 = await mut8({
528
+ src: latestIbGib_Local,
529
+ // we're just going to merge the data properties.
530
+ // this is a naive "last-write-wins" approach for non-dna timelines
531
+ dataToAddOrPatch: { ...latestIbGib_Local.data },
532
+ noTimestamp: true, // we want to control the ib and gib
533
+ });
534
+ const mergedIbGib = resMut8.newIbGib;
535
+ const mergedAddr = getIbGibAddr({ ibGib: mergedIbGib });
536
+ if (resMut8.intermediateIbGibs) {
537
+ resMut8.intermediateIbGibs.forEach(x => ibGibsCreated.push(x));
538
+ }
539
+ ibGibsCreated.push(mergedIbGib);
540
+ ibGibMergeMap[latestAddr_Local] = mergedIbGib;
541
+ ibGibMergeMap[latestAddr_Store] = mergedIbGib;
542
+ updates[tjpAddr] = mergedAddr;
543
+ }
544
+ catch (error) {
545
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
546
+ console.error(emsg);
547
+ throw error;
548
+ }
549
+ }
550
+ async reconcile_InsertFirstTimeIntoStore({ tjpGroupIbGibs_Local_Ascending, ibGibsToStore, }) {
551
+ const lc = `${this.lc}[${this.reconcile_InsertFirstTimeIntoStore.name}]`;
552
+ try {
553
+ // This is the first time we are seeing this tjp in the store.
554
+ // So we can just add the entire local timeline to the list of
555
+ // ibgibs to be persisted.
556
+ tjpGroupIbGibs_Local_Ascending.forEach(x => ibGibsToStore.push(x));
557
+ }
558
+ catch (error) {
559
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
560
+ console.error(emsg);
561
+ throw error;
562
+ }
563
+ }
564
+ // protected async applyTransforms({
565
+ // src,
566
+ // createdIbGibs_Running,
567
+ // dnaAddrsToApplyToStoreVersion,
568
+ // allLocalIbGibs,
569
+ // }: {
570
+ // src: TIbGib,
571
+ // createdIbGibs_Running: TIbGib[],
572
+ // dnaAddrsToApplyToStoreVersion: IbGibAddr[],
573
+ // allLocalIbGibs: TIbGib[],
574
+ // }): Promise<TIbGib> {
575
+ // const lc = `${this.lc}[${this.applyTransforms.name}]`;
576
+ // try {
577
+ // if (logalot) { console.log(`${lc} starting...`); }
578
+ // let currentSrc = src;
579
+ // // find the dna ibgibs from the local ibgibs that were passed in.
580
+ // const allLocalIbGibsMap = new Map<IbGibAddr, TIbGib>();
581
+ // allLocalIbGibs.forEach(x => allLocalIbGibsMap.set(getIbGibAddr({ ibGib: x }), x));
582
+ // for (const dnaAddr of dnaAddrsToApplyToStoreVersion) {
583
+ // const dnaIbGib = allLocalIbGibsMap.get(dnaAddr);
584
+ // if (!dnaIbGib) { throw new Error(`(UNEXPECTED) dnaIbGib not found in allLocalIbGibs. addr: ${dnaAddr} (E: 106402377a644e5989710f606e9323ff)`); }
585
+ // const resMut8 = await mut8({
586
+ // src: currentSrc,
587
+ // mut8Ib: dnaIbGib.ib,
588
+ // dataToAddOrPatch: { ...dnaIbGib.data }, // this is a transform, so we just care about data and ib
589
+ // noTimestamp: true,
590
+ // });
591
+ // currentSrc = resMut8.newIbGib as TIbGib;
592
+ // if (resMut8.intermediateIbGibs) {
593
+ // resMut8.intermediateIbGibs.forEach(x => createdIbGibs_Running.push(x as TIbGib));
594
+ // }
595
+ // createdIbGibs_Running.push(currentSrc);
596
+ // }
597
+ // return currentSrc;
598
+ // } catch (error) {
599
+ // const emsg = `${lc} ${extractErrorMsg(error)}`;
600
+ // console.error(emsg);
601
+ // throw error;
602
+ // }
603
+ // }
604
+ async routeAndDoCommand({ cmd, cmdModifiers, arg, }) {
605
+ const lc = `${this.lc}[${this.routeAndDoCommand.name}]`;
606
+ if ((cmdModifiers ?? []).length === 0 || !cmdModifiers.includes('sync')) {
607
+ return super.routeAndDoCommand({ cmd, cmdModifiers, arg });
608
+ }
609
+ switch (cmd) {
610
+ case IbGibSpaceOptionsCmd.put:
611
+ if (cmdModifiers.includes('sync')) {
612
+ if (logalot) {
613
+ console.log(`${lc} cmd is put and modifier includes sync. Routing to putSync function. (I: 2dc358c88a1746329b379d4e8ba7e09e)`);
614
+ }
615
+ let resPutSync = await this.putSync(arg);
616
+ return resPutSync;
617
+ }
618
+ else {
619
+ return super.routeAndDoCommand({ cmd, cmdModifiers, arg });
620
+ }
621
+ default:
622
+ return super.routeAndDoCommand({ cmd, cmdModifiers, arg });
623
+ }
624
+ }
625
+ async putSync(arg) {
626
+ let lc = `${this.lc}[${this.putSync.name}]`;
627
+ const resultData = { optsAddr: getIbGibAddr({ ibGib: arg }), };
628
+ let errors = [];
629
+ let warnings = [];
630
+ let syncSagaInfo = arg?.syncSagaInfo;
631
+ const verbose = logalot;
632
+ try {
633
+ // #region validation, initialize some variables
634
+ if (!arg.data) {
635
+ throw new Error(`arg.data required. (E: 847a1506e7054d53b7bf5ff87a4b32da)`);
636
+ }
637
+ if ((arg.data.ibGibAddrs ?? []).length === 0) {
638
+ throw new Error(`arg.data.ibGibAddrs required. (E: 6f2062572cc247f6a12b34759418c66b)`);
639
+ }
640
+ throwIfDuplicates({ ibGibAddrs: arg.data.ibGibAddrs });
641
+ if (!arg.data.sagaId) {
642
+ throw new Error(`sagaId required. (E: af30b1b3cf3a4676a89399514743da79)`);
643
+ }
644
+ const timeLogName = `[sync_log][${arg.data.sagaId}]`;
645
+ if (verbose) {
646
+ console.timeLog(timeLogName, `${lc} starting...`);
647
+ }
648
+ if ((arg.ibGibs ?? []).length === 0) {
649
+ throw new Error(`no ibgibs given. (E: 62ae74eab0434b90b866caa285403143)`);
650
+ }
651
+ throwIfDuplicates({ ibGibs: arg.ibGibs });
652
+ if (!arg.syncSagaInfo) {
653
+ throw new Error(`arg.syncSagaInfo required. (E: 33efb28789ff40b9b340eedcba0017f7)`);
654
+ }
655
+ if (!arg.syncSagaInfo.spaceId) {
656
+ throw new Error(`arg.syncSagaInfo.spaceId required. (E: b20f6dbf3c4a466c9ff5aa7488e903ee)`);
657
+ }
658
+ if ((arg.data.participants ?? []).length === 0) {
659
+ throw new Error(`arg.data.participants required. (E: 3e8121dc078342d18810a3e2c9671f98)`);
660
+ }
661
+ if (arg.data.participants.filter(x => x.s_d === "src").length === 0) {
662
+ throw new Error(`invalid participants. src required. (E: fbfcab1b8cf34d4a8d51a48a0a43e6af)`);
663
+ }
664
+ if (arg.data.participants.filter(x => x.s_d === "src").length > 1) {
665
+ throw new Error(`invalid participants. only 1 src allowed. (E: 9c2d76ab4dc141ce878de2649a68d4b6)`);
666
+ }
667
+ if (arg.data.participants.filter(x => x.s_d === "dest").length === 0) {
668
+ throw new Error(`invalid participants. at least 1 dest required. (E: 7d037be500844191b25655521eb4cde7)`);
669
+ }
670
+ const srcSpaceId = arg.data.participants.filter(p => p.s_d === "src")[0].id;
671
+ if (!srcSpaceId) {
672
+ throw new Error(`invalid participants. srcSpaceId required. (E: c55c96ebb1c9429fabb0e90adf5ce157)`);
673
+ }
674
+ if (!this.data) {
675
+ throw new Error(`(UNEXPECTED) !this.data? (E: 77163b8ffc7f439a8ba8b410db0071e7)`);
676
+ }
677
+ // #endregion validation, initialize some variables
678
+ const { statusIbGib: syncStatusIbGib_Start, statusIbGibsGraph: statusStartIbGibs } = await this.getStatusIbGibs_Start({
679
+ sagaId: arg.data.sagaId,
680
+ participants: arg.data.participants,
681
+ ibGibAddrs: arg.data.ibGibAddrs,
682
+ });
683
+ resultData.sagaId = arg.data.sagaId;
684
+ if (!syncStatusIbGib_Start.rel8ns?.tjp?.at(0)) {
685
+ throw new Error(`(UNEXPECTED) !syncStatusIbGib_Start.rel8ns?.tjp?.at(0)? (E: 7ab2b8efb18a446d8695a01cada13c24)`);
686
+ }
687
+ resultData.statusTjpAddr = syncStatusIbGib_Start.rel8ns.tjp[0];
688
+ this.spinOffToCompleteSync({
689
+ srcSpaceId,
690
+ sagaId: arg.data.sagaId,
691
+ ibGibs: arg.ibGibs.concat(),
692
+ statusStartIbGibs: statusStartIbGibs,
693
+ syncStatusIbGib_Start,
694
+ syncStatus$: syncSagaInfo.syncStatus$,
695
+ errors,
696
+ warnings,
697
+ });
698
+ }
699
+ catch (error) {
700
+ console.error(`${lc} error: ${extractErrorMsg(error)}`);
701
+ resultData.errors = [extractErrorMsg(error)];
702
+ }
703
+ try {
704
+ const result = await this.resulty({ resultData });
705
+ result.syncSagaInfo = syncSagaInfo;
706
+ return result;
707
+ }
708
+ catch (error) {
709
+ console.error(`${lc} ${extractErrorMsg(error)}`);
710
+ throw error;
711
+ }
712
+ }
713
+ async getStatusIbGibs_Start({ sagaId, participants, ibGibAddrs, }) {
714
+ const lc = `${this.lc}[${this.getStatusIbGibs_Start.name}]`;
715
+ try {
716
+ if ((participants ?? []).length === 0) {
717
+ throw new Error(`participants required. (E: a707efcdd7594a4aa70599e84ffa43c4)`);
718
+ }
719
+ const parentIb = getStatusIb({
720
+ spaceType: 'sync', spaceSubtype: 'aws-dynamodb',
721
+ statusCode: StatusCode.undefined,
722
+ sagaId: STATUS_UNDEFINED_TX_ID, // "undefined" means '0' atow!!
723
+ });
724
+ const parentIbGib = factory.primitive({ ib: parentIb });
725
+ const statusCode = StatusCode.started;
726
+ const tjpIb = getStatusIb({
727
+ statusCode,
728
+ spaceType: 'sync', spaceSubtype: 'aws-dynamodb',
729
+ sagaId,
730
+ });
731
+ const data = {
732
+ statusCode: statusCode,
733
+ participants,
734
+ toTx: ibGibAddrs,
735
+ };
736
+ const resTjp = await factory.firstGen({
737
+ parentIbGib,
738
+ ib: tjpIb,
739
+ data,
740
+ dna: false,
741
+ nCounter: true,
742
+ tjp: { uuid: true, timestamp: true },
743
+ });
744
+ const startIbGib = resTjp.newIbGib;
745
+ let statusIbGibsGraph = [
746
+ startIbGib,
747
+ ...(resTjp.intermediateIbGibs ?? []),
748
+ ];
749
+ return { statusIbGib: startIbGib, statusIbGibsGraph };
750
+ }
751
+ catch (error) {
752
+ const emsg = `${lc} ${extractErrorMsg(error)}`;
753
+ console.error(emsg);
754
+ throw error;
755
+ }
756
+ }
757
+ }
758
+ //# sourceMappingURL=reconciliation-space-base.mjs.map