@ibgib/core-gib 0.1.21 → 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.
- package/dist/common/other/graph-helper.d.mts +8 -0
- package/dist/common/other/graph-helper.d.mts.map +1 -1
- package/dist/common/other/graph-helper.mjs +31 -1
- package/dist/common/other/graph-helper.mjs.map +1 -1
- package/dist/sync/sync-conflict.respec.mjs +31 -28
- package/dist/sync/sync-conflict.respec.mjs.map +1 -1
- package/dist/sync/sync-constants.d.mts +21 -11
- package/dist/sync/sync-constants.d.mts.map +1 -1
- package/dist/sync/sync-constants.mjs +18 -6
- package/dist/sync/sync-constants.mjs.map +1 -1
- package/dist/sync/sync-helpers.d.mts +24 -15
- package/dist/sync/sync-helpers.d.mts.map +1 -1
- package/dist/sync/sync-helpers.mjs +163 -92
- package/dist/sync/sync-helpers.mjs.map +1 -1
- package/dist/sync/sync-innerspace-constants.respec.mjs +12 -7
- package/dist/sync/sync-innerspace-constants.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs +12 -7
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-dest-ahead.respec.mjs +15 -10
- package/dist/sync/sync-innerspace-dest-ahead.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs +13 -7
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-partial-update.respec.mjs +15 -7
- package/dist/sync/sync-innerspace-partial-update.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace.respec.mjs +13 -7
- package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-constants.d.mts +2 -0
- package/dist/sync/sync-peer/sync-peer-constants.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-constants.mjs +2 -0
- package/dist/sync/sync-peer/sync-peer-constants.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-helpers.d.mts +2 -0
- package/dist/sync/sync-peer/sync-peer-helpers.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-helpers.mjs +2 -0
- package/dist/sync/sync-peer/sync-peer-helpers.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.d.mts +8 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs +8 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.d.mts +18 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.mjs +54 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts +65 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mjs +5 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts +44 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs +183 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-types.d.mts +28 -0
- package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.d.mts +51 -9
- package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.mjs +244 -26
- package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +26 -10
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +119 -30
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +31 -22
- package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-types.mjs +1 -9
- package/dist/sync/sync-saga-context/sync-saga-context-types.mjs.map +1 -1
- package/dist/sync/sync-saga-coordinator.d.mts +81 -87
- package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
- package/dist/sync/sync-saga-coordinator.mjs +627 -571
- package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +105 -22
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
- package/dist/sync/sync-types.d.mts +56 -76
- package/dist/sync/sync-types.d.mts.map +1 -1
- package/dist/sync/sync-types.mjs +5 -0
- package/dist/sync/sync-types.mjs.map +1 -1
- package/dist/timeline/timeline-api.d.mts.map +1 -1
- package/dist/timeline/timeline-api.mjs +15 -8
- package/dist/timeline/timeline-api.mjs.map +1 -1
- package/dist/witness/light-witness-base-v1.d.mts.map +1 -1
- package/dist/witness/light-witness-base-v1.mjs +2 -0
- package/dist/witness/light-witness-base-v1.mjs.map +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.mjs +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.mjs.map +1 -1
- package/package.json +1 -1
- package/src/common/other/graph-helper.mts +26 -1
- package/src/sync/README.md +31 -22
- package/src/sync/sync-conflict.respec.mts +31 -26
- package/src/sync/sync-constants.mts +19 -9
- package/src/sync/sync-helpers.mts +173 -97
- package/src/sync/sync-innerspace-constants.respec.mts +12 -7
- package/src/sync/sync-innerspace-deep-updates.respec.mts +12 -7
- package/src/sync/sync-innerspace-dest-ahead.respec.mts +14 -9
- package/src/sync/sync-innerspace-multiple-timelines.respec.mts +13 -7
- package/src/sync/sync-innerspace-partial-update.respec.mts +15 -7
- package/src/sync/sync-innerspace.respec.mts +13 -7
- package/src/sync/sync-peer/sync-peer-constants.mts +0 -0
- package/src/sync/sync-peer/sync-peer-helpers.mts +0 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mts +8 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.mts +72 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mts +72 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +193 -0
- package/src/sync/sync-peer/sync-peer-types.mts +30 -1
- package/src/sync/sync-peer/sync-peer-v1.mts +229 -30
- package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +140 -43
- package/src/sync/sync-saga-context/sync-saga-context-types.mts +34 -30
- package/src/sync/sync-saga-coordinator.mts +678 -660
- package/src/sync/sync-saga-message/sync-saga-message-types.mts +106 -22
- package/src/sync/sync-types.mts +59 -87
- package/src/timeline/timeline-api.mts +17 -10
- package/src/witness/light-witness-base-v1.mts +2 -1
- package/src/witness/space/inner-space/inner-space-v1.mts +1 -1
- package/test_output.log +0 -0
- package/tmp.md +62 -44
- package/dist/sync/sync-local-spaces.respec.d.mts +0 -2
- package/dist/sync/sync-local-spaces.respec.d.mts.map +0 -1
- package/dist/sync/sync-local-spaces.respec.mjs +0 -159
- package/dist/sync/sync-local-spaces.respec.mjs.map +0 -1
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.d.mts +0 -42
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.d.mts.map +0 -1
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.mjs +0 -194
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.mjs.map +0 -1
- package/dist/sync/sync-saga-coordinator.respec.d.mts +0 -2
- package/dist/sync/sync-saga-coordinator.respec.d.mts.map +0 -1
- package/dist/sync/sync-saga-coordinator.respec.mjs +0 -40
- package/dist/sync/sync-saga-coordinator.respec.mjs.map +0 -1
- package/src/sync/sync-local-spaces.respec.mts +0 -200
- package/src/sync/sync-peer/sync-peer-innerspace-v1.mts +0 -240
- package/src/sync/sync-saga-coordinator.respec.mts +0 -52
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
* @module sync peer witness types
|
|
3
3
|
*/
|
|
4
4
|
import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
5
|
+
import { SubjectWitness } from '../../common/pubsub/subject/subject-types.mjs';
|
|
5
6
|
import { SyncSagaContextData_V1, SyncSagaContextIbGib_V1, SyncSagaContextRel8ns_V1 } from '../sync-saga-context/sync-saga-context-types.mjs';
|
|
6
7
|
import { Witness_V1 } from '../../witness/witness-types.mjs';
|
|
8
|
+
import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
|
|
7
9
|
/**
|
|
8
10
|
* Data for the SyncPeer witness.
|
|
9
11
|
*/
|
|
10
12
|
export interface SyncPeerData_V1 extends IbGibData_V1 {
|
|
13
|
+
/**
|
|
14
|
+
* Concrete peer instance
|
|
15
|
+
*/
|
|
16
|
+
classname: string;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
19
|
* Relations for the SyncPeer witness.
|
|
@@ -26,5 +32,27 @@ export interface SyncPeerIbGib_V1 extends IbGib_V1<SyncPeerData_V1, SyncPeerRel8
|
|
|
26
32
|
export interface SyncPeerWitness extends Witness_V1<SyncSagaContextData_V1, SyncSagaContextRel8ns_V1, SyncSagaContextIbGib_V1, // Input
|
|
27
33
|
SyncSagaContextData_V1, SyncSagaContextRel8ns_V1, SyncSagaContextIbGib_V1, // Output
|
|
28
34
|
SyncPeerData_V1, SyncPeerRel8ns_V1> {
|
|
35
|
+
/**
|
|
36
|
+
* sender's durable space.
|
|
37
|
+
*
|
|
38
|
+
* will store control ibgibs (context, sync saga ibgib, control msg stones)
|
|
39
|
+
* here (and in {@link senderTempSpace}) throughout the process for audit trail.
|
|
40
|
+
*/
|
|
41
|
+
senderSpace: IbGibSpaceAny;
|
|
42
|
+
/**
|
|
43
|
+
* sender's temporary space for the entire sync transaction.
|
|
44
|
+
*
|
|
45
|
+
* In addition to control ibgibs which are stored in both temp and durable
|
|
46
|
+
* spaces, this temp space will be where domain ibgibs are stored that are
|
|
47
|
+
* received/created throughout the transaction until commit.
|
|
48
|
+
*/
|
|
49
|
+
senderTempSpace: IbGibSpaceAny;
|
|
50
|
+
/**
|
|
51
|
+
* Observable for streaming large domain payloads asynchronously.
|
|
52
|
+
*
|
|
53
|
+
* Implementations should publish domain ibgibs to this observable as they are received.
|
|
54
|
+
* The handling code (e.g. SyncSagaCoordinator) will subscribe to this.
|
|
55
|
+
*/
|
|
56
|
+
payloadIbGibsDomainReceived$: SubjectWitness<IbGib_V1>;
|
|
29
57
|
}
|
|
30
58
|
//# sourceMappingURL=sync-peer-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-peer-types.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-types.mts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"sync-peer-types.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-types.mts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAC7I,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACjD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;CAAI;AAE1F;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,UAAU,CAC/C,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EAAE,QAAQ;AACjC,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EAAE,SAAS;AAClC,eAAe,EACf,iBAAiB,CACpB;IAGG;;;;;OAKG;IACH,WAAW,EAAE,aAAa,CAAC;IAC3B;;;;;;OAMG;IACH,eAAe,EAAE,aAAa,CAAC;IAE/B;;;;;OAKG;IACH,4BAA4B,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CAC1D"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module SyncPeer_V1 witness class
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
6
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
7
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
8
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
9
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
10
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
11
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
12
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
13
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
14
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
3
15
|
*/
|
|
4
16
|
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
17
|
+
import { IbGibAddr } from '@ibgib/ts-gib/dist/types.mjs';
|
|
18
|
+
import { SubjectWitness } from '../../common/pubsub/subject/subject-types.mjs';
|
|
5
19
|
import { SyncSagaContextIbGib_V1 } from '../sync-saga-context/sync-saga-context-types.mjs';
|
|
6
20
|
import { SyncPeerData_V1, SyncPeerRel8ns_V1, SyncPeerWitness } from './sync-peer-types.mjs';
|
|
7
21
|
import { LightWitnessBase_V1 } from '../../witness/light-witness-base-v1.mjs';
|
|
22
|
+
import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
|
|
8
23
|
/**
|
|
9
24
|
* Abstract witness for talking to a Sync Peer (e.g. Remote Node or Local Simulator).
|
|
10
25
|
*
|
|
@@ -17,26 +32,51 @@ import { LightWitnessBase_V1 } from '../../witness/light-witness-base-v1.mjs';
|
|
|
17
32
|
*/
|
|
18
33
|
export declare abstract class SyncPeer_V1 extends LightWitnessBase_V1<SyncPeerData_V1, SyncPeerRel8ns_V1> implements SyncPeerWitness {
|
|
19
34
|
protected lc: string;
|
|
35
|
+
senderSpace: IbGibSpaceAny;
|
|
36
|
+
senderTempSpace: IbGibSpaceAny;
|
|
37
|
+
payloadIbGibsDomainReceived$: SubjectWitness<IbGib_V1>;
|
|
38
|
+
get classname(): string;
|
|
39
|
+
constructor(senderSpace: IbGibSpaceAny, senderTempSpace: IbGibSpaceAny, initialData: SyncPeerData_V1, initialRel8ns?: SyncPeerRel8ns_V1);
|
|
40
|
+
initialize(): Promise<void>;
|
|
41
|
+
protected abstract ensureReceiverTempSpace(): Promise<IbGibSpaceAny>;
|
|
20
42
|
/**
|
|
21
43
|
* Witness the synchronization context (Send/Receive).
|
|
22
44
|
*
|
|
45
|
+
* At this point in code, we are sending the context OUTGOING. The {@link context} should
|
|
46
|
+
* have a fully populated {@link SyncSagaContextIbGib_V1.sagaFrame}
|
|
47
|
+
*
|
|
23
48
|
* @param arg The OUTGOING context (Request).
|
|
24
49
|
* @returns The INCOMING context (Response), or undefined if failed/empty.
|
|
25
50
|
*/
|
|
26
|
-
witness(
|
|
51
|
+
witness(context: SyncSagaContextIbGib_V1): Promise<SyncSagaContextIbGib_V1 | undefined>;
|
|
27
52
|
/**
|
|
28
|
-
*
|
|
53
|
+
* Transmits the Context IbGib itself to the Peer.
|
|
29
54
|
*/
|
|
30
|
-
protected abstract
|
|
55
|
+
protected abstract sendContextRequest(context: SyncSagaContextIbGib_V1): Promise<SyncSagaContextIbGib_V1 | undefined>;
|
|
31
56
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
57
|
+
* Pushes specific IbGib(s) (by address) from Local to Remote.
|
|
58
|
+
*
|
|
59
|
+
* Should NOT have to handle identifying if the remote already has it
|
|
60
|
+
* (optimization), because the sync coordinator should be doing this in
|
|
61
|
+
* its diffing algorithm.
|
|
34
62
|
*/
|
|
35
|
-
protected abstract push(
|
|
63
|
+
protected abstract push(addrs: IbGibAddr[]): Promise<void>;
|
|
36
64
|
/**
|
|
37
|
-
* Primitive: Pulls
|
|
65
|
+
* Primitive: Pulls specific IbGib(s) (by address) from Remote to Local.
|
|
38
66
|
*/
|
|
39
|
-
protected abstract pull(
|
|
67
|
+
protected abstract pull(addrs: IbGibAddr[]): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* move to sync-peer-helpers.mts as a pure function?
|
|
70
|
+
*/
|
|
71
|
+
protected authenticateContext({ context }: {
|
|
72
|
+
context: SyncSagaContextIbGib_V1;
|
|
73
|
+
}): Promise<string[]>;
|
|
74
|
+
/**
|
|
75
|
+
* move to sync-peer-helpers.mts as a pure function?
|
|
76
|
+
*/
|
|
77
|
+
protected authorizeContext({ context }: {
|
|
78
|
+
context: SyncSagaContextIbGib_V1;
|
|
79
|
+
}): Promise<string[]>;
|
|
40
80
|
/**
|
|
41
81
|
* Helper to orchestrate the PUSH of a Context's dependency graph.
|
|
42
82
|
*/
|
|
@@ -52,7 +92,9 @@ export declare abstract class SyncPeer_V1 extends LightWitnessBase_V1<SyncPeerDa
|
|
|
52
92
|
/**
|
|
53
93
|
* Abstract accessor to get an IbGib from the Local space/store.
|
|
54
94
|
* Needed for inspecting rela8ns during the graph walk.
|
|
95
|
+
*
|
|
96
|
+
* Default implementation simply looks in senderSpace
|
|
55
97
|
*/
|
|
56
|
-
protected
|
|
98
|
+
protected getLocalIbGib(addr: string): Promise<IbGib_V1 | undefined>;
|
|
57
99
|
}
|
|
58
100
|
//# sourceMappingURL=sync-peer-v1.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-peer-v1.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-v1.mts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sync-peer-v1.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-v1.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAKzD,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAStE;;;;;;;;;GASG;AACH,8BAAsB,WAAY,SAAQ,mBAAmB,CAAC,eAAe,EAAE,iBAAiB,CAC5F,Y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CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAuElG;;OAEG;cACa,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,uBAAuB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2DlG;;;;;OAKG;cACa,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;CAsB7E"}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module SyncPeer_V1 witness class
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
6
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
7
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
8
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
9
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
10
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
11
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
12
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
13
|
+
* NOTE: All push/pulls in this were done to get to compile. These should mostly
|
|
14
|
+
* not be single push/pull calls but should be batched with multiple addresses
|
|
3
15
|
*/
|
|
4
16
|
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
5
17
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
6
18
|
import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
|
|
7
|
-
import { SYNC_MSG_REL8N_NAME,
|
|
19
|
+
import { SYNC_MSG_REL8N_NAME, SYNC_SAGA_PAYLOAD_ADDRS_DOMAIN } from '../sync-constants.mjs';
|
|
8
20
|
import { LightWitnessBase_V1 } from '../../witness/light-witness-base-v1.mjs';
|
|
21
|
+
import { newupSubject } from '../../common/pubsub/subject/subject-helper.mjs';
|
|
22
|
+
import { validateContext } from '../sync-saga-context/sync-saga-context-helpers.mjs';
|
|
23
|
+
import { getFromSpace } from '../../witness/space/space-helper.mjs';
|
|
9
24
|
const logalot = GLOBAL_LOG_A_LOT || true;
|
|
25
|
+
const logalotControlDomain = true;
|
|
26
|
+
const lcControlDomain = '[ControlDomain]';
|
|
10
27
|
/**
|
|
11
28
|
* Abstract witness for talking to a Sync Peer (e.g. Remote Node or Local Simulator).
|
|
12
29
|
*
|
|
@@ -19,28 +36,89 @@ const logalot = GLOBAL_LOG_A_LOT || true;
|
|
|
19
36
|
*/
|
|
20
37
|
export class SyncPeer_V1 extends LightWitnessBase_V1 {
|
|
21
38
|
lc = `[${SyncPeer_V1.name}]`;
|
|
39
|
+
senderSpace;
|
|
40
|
+
senderTempSpace;
|
|
41
|
+
payloadIbGibsDomainReceived$;
|
|
42
|
+
get classname() {
|
|
43
|
+
if (!this.data) {
|
|
44
|
+
throw new Error(`(UNEXPECTED) this.data falsy? (E: 1ab1841e9338b54f3aa615fa37024826)`);
|
|
45
|
+
}
|
|
46
|
+
if (!this.data.classname) {
|
|
47
|
+
throw new Error(`invalid peer. this.data.classname is falsy (E: b0ee28a0abb84a06588d9de7afcef826)`);
|
|
48
|
+
}
|
|
49
|
+
return this.data.classname;
|
|
50
|
+
}
|
|
51
|
+
constructor(senderSpace, senderTempSpace, initialData, initialRel8ns) {
|
|
52
|
+
super(initialData, initialRel8ns);
|
|
53
|
+
this.senderSpace = senderSpace;
|
|
54
|
+
this.senderTempSpace = senderTempSpace;
|
|
55
|
+
}
|
|
56
|
+
async initialize() {
|
|
57
|
+
this.payloadIbGibsDomainReceived$ = await newupSubject();
|
|
58
|
+
}
|
|
22
59
|
/**
|
|
23
60
|
* Witness the synchronization context (Send/Receive).
|
|
24
61
|
*
|
|
62
|
+
* At this point in code, we are sending the context OUTGOING. The {@link context} should
|
|
63
|
+
* have a fully populated {@link SyncSagaContextIbGib_V1.sagaFrame}
|
|
64
|
+
*
|
|
25
65
|
* @param arg The OUTGOING context (Request).
|
|
26
66
|
* @returns The INCOMING context (Response), or undefined if failed/empty.
|
|
27
67
|
*/
|
|
28
|
-
async witness(
|
|
68
|
+
async witness(context) {
|
|
29
69
|
const lc = `${this.lc}[${this.witness.name}]`;
|
|
30
70
|
try {
|
|
31
71
|
if (logalot) {
|
|
32
72
|
console.log(`${lc} starting...`);
|
|
33
73
|
}
|
|
74
|
+
if (logalot) {
|
|
75
|
+
console.log(`${lc} starting...`);
|
|
76
|
+
}
|
|
77
|
+
// validate, authenticate, and authorize the context, sagaFrame, and identity(s)
|
|
78
|
+
const validationErrors = await validateContext({ context });
|
|
79
|
+
if (validationErrors.length > 0) {
|
|
80
|
+
throw new Error(`invalid context received. validationErrors: ${validationErrors} (E: 8b34c875c968af29bc433138e57a7826)`);
|
|
81
|
+
}
|
|
82
|
+
const authenticationErrors = await this.authenticateContext({ context });
|
|
83
|
+
if (authenticationErrors.length > 0) {
|
|
84
|
+
throw new Error(`invalid context authentication. authenticationErrors: ${authenticationErrors} (E: da89da5ee1269aeb78952d475d607526)`);
|
|
85
|
+
}
|
|
86
|
+
const authorizationErrors = await this.authorizeContext({ context });
|
|
87
|
+
if (authorizationErrors.length > 0) {
|
|
88
|
+
throw new Error(`invalid context authorization. authorizationErrors: ${authorizationErrors} (E: 8ddc284a758cf10ba829334c1babb826)`);
|
|
89
|
+
}
|
|
90
|
+
// at this point, we have a valid, authenticated, authorized context
|
|
91
|
+
// persist the context, sagaframe, identity(s) ONLY in the receiver's durable space
|
|
92
|
+
// if sending domain ibgibs...
|
|
93
|
+
// verify the domain ibgibs intrinsically.
|
|
94
|
+
// persist the domain ibgibs in the receiver's temp space (push all addrs?)
|
|
95
|
+
// await until all domain ibgibs are in receiver's temp space
|
|
96
|
+
// process the context with the receiver's coordinator to get a new response context
|
|
97
|
+
// analyze the response context
|
|
98
|
+
// validate context intrinsically
|
|
99
|
+
// validate return identity if present
|
|
100
|
+
// persist the response context's dependency graph (context, saga frame and msg(s), identities)
|
|
101
|
+
// if response has payload domain ibgibs,
|
|
102
|
+
// spin off...
|
|
103
|
+
// pull domain ibgibs to local temp space
|
|
104
|
+
// publish domain ibgibs to observable
|
|
105
|
+
// when all domain ibgibs are pulled, publish complete to the observable
|
|
106
|
+
// return resulting context ibgib (which the caller should get BEFORE the domain ibgibs observable completes)
|
|
34
107
|
// 1. PUSH: Ensure Request Data is available on Receiver
|
|
35
|
-
await this.pushContextGraph({ context
|
|
108
|
+
await this.pushContextGraph({ context }); // ???
|
|
36
109
|
// 2. EXECUTE: Trigger Remote Processing
|
|
37
|
-
const response = await this.
|
|
110
|
+
const response = await this.sendContextRequest(context);
|
|
38
111
|
if (!response) {
|
|
39
112
|
if (logalot) {
|
|
40
113
|
console.log(`${lc} No response from peer.`);
|
|
41
114
|
}
|
|
42
115
|
return undefined;
|
|
43
116
|
}
|
|
117
|
+
// at this point, we have received the response context, sync saga
|
|
118
|
+
// frame/msg stones, and any keystones should be evolved. Depending
|
|
119
|
+
// on the concrete implementation, if there are domain ibgibs to
|
|
120
|
+
// receive, they may already be coming.
|
|
121
|
+
// todo: this pull is a
|
|
44
122
|
// 3. PULL: Ensure Response Data is available on Sender (Local)
|
|
45
123
|
await this.pullContextGraph({ context: response });
|
|
46
124
|
return response;
|
|
@@ -55,38 +133,100 @@ export class SyncPeer_V1 extends LightWitnessBase_V1 {
|
|
|
55
133
|
}
|
|
56
134
|
}
|
|
57
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* move to sync-peer-helpers.mts as a pure function?
|
|
138
|
+
*/
|
|
139
|
+
async authenticateContext({ context }) {
|
|
140
|
+
const lc = `${this.lc}[${this.authenticateContext.name}]`;
|
|
141
|
+
try {
|
|
142
|
+
if (logalot) {
|
|
143
|
+
console.log(`${lc} starting... (I: 2677a482dfa873dcd1aa04a3031ff826)`);
|
|
144
|
+
}
|
|
145
|
+
console.error(`${lc} NAG ERROR (NOT THROWN): not implemented. // todo: authenticate (v1 must have this after we get merge logic workflow going) (E: bc3a78f2dab18ab64c36d055a4b50526)`);
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
if (logalot) {
|
|
154
|
+
console.log(`${lc} complete.`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* move to sync-peer-helpers.mts as a pure function?
|
|
160
|
+
*/
|
|
161
|
+
async authorizeContext({ context }) {
|
|
162
|
+
const lc = `${this.lc}[${this.authorizeContext.name}]`;
|
|
163
|
+
try {
|
|
164
|
+
if (logalot) {
|
|
165
|
+
console.log(`${lc} starting... (I: 48c918b41ceec0cd489ca3b8819e6826)`);
|
|
166
|
+
}
|
|
167
|
+
console.error(`${lc} NAG ERROR (NOT THROWN): not implemented. authorize business logic (v1 must have this, but later when we are working on admin vs. student)(E: bc3a78f2dab18ab64c36d055a4b50526)`);
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
if (logalot) {
|
|
176
|
+
console.log(`${lc} complete.`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
58
180
|
/**
|
|
59
181
|
* Helper to orchestrate the PUSH of a Context's dependency graph.
|
|
60
182
|
*/
|
|
61
183
|
async pushContextGraph({ context }) {
|
|
184
|
+
const lc = `[${SyncPeer_V1.name}][pushContextGraph]`;
|
|
62
185
|
// A. Push Context Envelope
|
|
63
186
|
const contextAddr = getIbGibAddr({ ibGib: context });
|
|
64
|
-
|
|
187
|
+
if (logalotControlDomain) {
|
|
188
|
+
console.log(`${lc}${lcControlDomain} PUSH Context Envelope -> ${contextAddr} (I: 3f4e5a6b7c8d9e0f)`);
|
|
189
|
+
}
|
|
190
|
+
await this.push([contextAddr]);
|
|
65
191
|
// B. Push Saga Frame & Immediate Deps (Msg, Identity)
|
|
66
192
|
const frameAddr = context.rel8ns?.sagaFrame?.[0];
|
|
67
193
|
if (frameAddr) {
|
|
68
|
-
|
|
194
|
+
if (logalotControlDomain) {
|
|
195
|
+
console.log(`${lc}${lcControlDomain} PUSH CONTROL: Saga Frame -> ${frameAddr} (I: 4a5b6c7d8e9f0a1b)`);
|
|
196
|
+
}
|
|
197
|
+
await this.push([frameAddr]);
|
|
69
198
|
// We inspect the local frame to find its immediate deps
|
|
70
199
|
const frame = await this.getLocalIbGib(frameAddr);
|
|
71
200
|
if (frame) {
|
|
72
201
|
// Msg Stone
|
|
73
202
|
const msgAddrs = frame.rel8ns?.[SYNC_MSG_REL8N_NAME];
|
|
74
203
|
if (msgAddrs) {
|
|
75
|
-
for (const addr of msgAddrs)
|
|
76
|
-
|
|
204
|
+
for (const addr of msgAddrs) {
|
|
205
|
+
if (logalotControlDomain) {
|
|
206
|
+
console.log(`${lc}${lcControlDomain} PUSH CONTROL: Msg Stone -> ${addr} (I: 5b6c7d8e9f0a1b2c)`);
|
|
207
|
+
}
|
|
208
|
+
await this.push([addr]);
|
|
209
|
+
}
|
|
77
210
|
}
|
|
78
211
|
// Identity
|
|
79
212
|
const idAddrs = frame.rel8ns?.identity;
|
|
80
213
|
if (idAddrs) {
|
|
81
|
-
for (const addr of idAddrs)
|
|
82
|
-
|
|
214
|
+
for (const addr of idAddrs) {
|
|
215
|
+
if (logalotControlDomain) {
|
|
216
|
+
console.log(`${lc}${lcControlDomain} PUSH CONTROL: Identity -> ${addr} (I: 6c7d8e9f0a1b2c3d)`);
|
|
217
|
+
}
|
|
218
|
+
await this.push([addr]);
|
|
219
|
+
}
|
|
83
220
|
}
|
|
84
221
|
}
|
|
85
222
|
}
|
|
86
223
|
// C. Push Session Identity
|
|
87
224
|
const sessionKeystoneAddr = context.rel8ns?.sessionKeystone?.[0];
|
|
88
225
|
if (sessionKeystoneAddr) {
|
|
89
|
-
|
|
226
|
+
if (logalotControlDomain) {
|
|
227
|
+
console.log(`${lc}${lcControlDomain} PUSH CONTROL: Session Keystone -> ${sessionKeystoneAddr} (I: 7d8e9f0a1b2c3d4e)`);
|
|
228
|
+
}
|
|
229
|
+
await this.push([sessionKeystoneAddr]);
|
|
90
230
|
}
|
|
91
231
|
// D. Push Payloads (Deep/Soft)
|
|
92
232
|
// For payloads, the Peer is just a transport. It doesn't know the structure.
|
|
@@ -95,49 +235,127 @@ export class SyncPeer_V1 extends LightWitnessBase_V1 {
|
|
|
95
235
|
// Or do we need to be explicit?
|
|
96
236
|
// User said: "payloads should be flat... sync coordinator is the one doing the heavy lifting".
|
|
97
237
|
// So we just push the addrs listed.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
238
|
+
// 1. Control Payloads
|
|
239
|
+
// const controlAddrs = context.data?.[SYNC_SAGA_PAYLOAD_ADDRS_CONTROL];
|
|
240
|
+
// if (controlAddrs && controlAddrs.length > 0) {
|
|
241
|
+
// if (logalotControlDomain) { console.log(`${lc}${lcControlDomain} PUSH CONTROL PAYLOADS (${controlAddrs.length}): ${controlAddrs.join(', ')} (I: 8e9f0a1b2c3d4e5f)`); }
|
|
242
|
+
// for (const addr of controlAddrs) {
|
|
243
|
+
// await this.push(addr);
|
|
244
|
+
// }
|
|
245
|
+
// }
|
|
246
|
+
// 2. Domain Payloads
|
|
247
|
+
const domainAddrs = context.data?.[SYNC_SAGA_PAYLOAD_ADDRS_DOMAIN];
|
|
248
|
+
if (domainAddrs && domainAddrs.length > 0) {
|
|
249
|
+
if (logalotControlDomain) {
|
|
250
|
+
console.log(`${lc}${lcControlDomain} PUSH DOMAIN PAYLOADS (${domainAddrs.length}): ${domainAddrs.join(', ')} (I: 9f0a1b2c3d4e5f6a)`);
|
|
251
|
+
}
|
|
252
|
+
for (const addr of domainAddrs) {
|
|
253
|
+
await this.push([addr]);
|
|
102
254
|
}
|
|
103
255
|
}
|
|
256
|
+
if (logalotControlDomain) {
|
|
257
|
+
console.log(`${lc}${lcControlDomain} PUSH COMPLETE for context ${contextAddr} (I: a0b1c2d3e4f5a6b7)`);
|
|
258
|
+
}
|
|
104
259
|
}
|
|
105
260
|
/**
|
|
106
261
|
* Helper to orchestrate the PULL of a Context's dependency graph.
|
|
107
262
|
*/
|
|
108
263
|
async pullContextGraph({ context }) {
|
|
264
|
+
const lc = `[${SyncPeer_V1.name}][pullContextGraph]`;
|
|
109
265
|
// A. Pull Context Envelope
|
|
110
266
|
const contextAddr = getIbGibAddr({ ibGib: context });
|
|
111
|
-
|
|
267
|
+
if (logalotControlDomain) {
|
|
268
|
+
console.log(`${lc}${lcControlDomain} PULL Context Envelope <- ${contextAddr} (I: b1c2d3e4f5a6b7c8)`);
|
|
269
|
+
}
|
|
270
|
+
await this.pull([contextAddr]);
|
|
112
271
|
// B. Pull Saga Frame & Immediate Deps
|
|
113
272
|
const frameAddr = context.rel8ns?.sagaFrame?.[0];
|
|
114
273
|
if (frameAddr) {
|
|
115
|
-
|
|
274
|
+
if (logalotControlDomain) {
|
|
275
|
+
console.log(`${lc}${lcControlDomain} PULL CONTROL: Saga Frame <- ${frameAddr} (I: c2d3e4f5a6b7c8d9)`);
|
|
276
|
+
}
|
|
277
|
+
await this.pull([frameAddr]);
|
|
116
278
|
// Inspect REMOTE frame? We need to have pulled it first.
|
|
117
279
|
const frame = await this.getLocalIbGib(frameAddr); // Should be local now
|
|
118
280
|
if (frame) {
|
|
119
281
|
const msgAddrs = frame.rel8ns?.[SYNC_MSG_REL8N_NAME];
|
|
120
282
|
if (msgAddrs) {
|
|
121
|
-
for (const addr of msgAddrs)
|
|
122
|
-
|
|
283
|
+
for (const addr of msgAddrs) {
|
|
284
|
+
if (logalotControlDomain) {
|
|
285
|
+
console.log(`${lc}${lcControlDomain} PULL CONTROL: Msg Stone <- ${addr} (I: d3e4f5a6b7c8d9e0)`);
|
|
286
|
+
}
|
|
287
|
+
await this.pull([addr]);
|
|
288
|
+
}
|
|
123
289
|
}
|
|
124
290
|
const idAddrs = frame.rel8ns?.identity;
|
|
125
291
|
if (idAddrs) {
|
|
126
|
-
for (const addr of idAddrs)
|
|
127
|
-
|
|
292
|
+
for (const addr of idAddrs) {
|
|
293
|
+
if (logalotControlDomain) {
|
|
294
|
+
console.log(`${lc}${lcControlDomain} PULL CONTROL: Identity <- ${addr} (I: e4f5a6b7c8d9e0f1)`);
|
|
295
|
+
}
|
|
296
|
+
await this.pull([addr]);
|
|
297
|
+
}
|
|
128
298
|
}
|
|
129
299
|
}
|
|
130
300
|
}
|
|
131
301
|
// C. Pull Session Identity
|
|
132
302
|
const sessionKeystoneAddr = context.rel8ns?.sessionKeystone?.[0];
|
|
133
303
|
if (sessionKeystoneAddr) {
|
|
134
|
-
|
|
304
|
+
if (logalotControlDomain) {
|
|
305
|
+
console.log(`${lc}${lcControlDomain} PULL CONTROL: Session Keystone <- ${sessionKeystoneAddr} (I: f5a6b7c8d9e0f1a2)`);
|
|
306
|
+
}
|
|
307
|
+
await this.pull([sessionKeystoneAddr]);
|
|
135
308
|
}
|
|
136
309
|
// D. Pull Payloads
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
310
|
+
// const controlAddrs = context.data?.[SYNC_SAGA_PAYLOAD_ADDRS_CONTROL];
|
|
311
|
+
// if (controlAddrs && controlAddrs.length > 0) {
|
|
312
|
+
// if (logalotControlDomain) { console.log(`${lc}${lcControlDomain} PULL CONTROL PAYLOADS (${controlAddrs.length}): ${controlAddrs.join(', ')} (I: a6b7c8d9e0f1a2b3)`); }
|
|
313
|
+
// for (const addr of controlAddrs) {
|
|
314
|
+
// await this.pull(addr);
|
|
315
|
+
// }
|
|
316
|
+
// }
|
|
317
|
+
const domainAddrs = context.data?.[SYNC_SAGA_PAYLOAD_ADDRS_DOMAIN];
|
|
318
|
+
if (domainAddrs && domainAddrs.length > 0) {
|
|
319
|
+
if (logalotControlDomain) {
|
|
320
|
+
console.log(`${lc}${lcControlDomain} PULL DOMAIN PAYLOADS (${domainAddrs.length}): ${domainAddrs.join(', ')} (I: b7c8d9e0f1a2b3c4)`);
|
|
321
|
+
}
|
|
322
|
+
for (const addr of domainAddrs) {
|
|
323
|
+
await this.pull([addr]);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (logalotControlDomain) {
|
|
327
|
+
console.log(`${lc}${lcControlDomain} PULL COMPLETE for context ${contextAddr} (I: c8d9e0f1a2b3c4d5)`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Abstract accessor to get an IbGib from the Local space/store.
|
|
332
|
+
* Needed for inspecting rela8ns during the graph walk.
|
|
333
|
+
*
|
|
334
|
+
* Default implementation simply looks in senderSpace
|
|
335
|
+
*/
|
|
336
|
+
async getLocalIbGib(addr) {
|
|
337
|
+
const lc = `${this.lc}[${this.getLocalIbGib.name}]`;
|
|
338
|
+
try {
|
|
339
|
+
if (logalot) {
|
|
340
|
+
console.log(`${lc} starting... (I: 27b248cb9801eeb2386b71485389a826)`);
|
|
341
|
+
}
|
|
342
|
+
console.warn(`${lc} possibly a bottleneck here, getLocalIbGib only gets a single ibgib... (W: 2fd448a435480e6b128f6b8bcbef4826)`);
|
|
343
|
+
const resGet = await getFromSpace({ space: this.senderSpace, addr });
|
|
344
|
+
if (resGet.success && resGet.ibGibs && resGet.ibGibs.length === 1) {
|
|
345
|
+
const ibGib = resGet.ibGibs[0];
|
|
346
|
+
return ibGib;
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
throw new Error(`couldn't get addr (${addr}) from local space ${this.senderSpace}. reason: ${resGet.errorMsg ?? 'unknown error (E: 926ef8bf4fcc299ab89dba34ea691a26)'} (E: d8a89807e471d3f8b938ab21df44cb26)`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
finally {
|
|
357
|
+
if (logalot) {
|
|
358
|
+
console.log(`${lc} complete.`);
|
|
141
359
|
}
|
|
142
360
|
}
|
|
143
361
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-peer-v1.mjs","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-v1.mts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sync-peer-v1.mjs","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-v1.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAI5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,MAAM,OAAO,GAAG,gBAAgB,IAAI,IAAI,CAAC;AACzC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,OAAgB,WAAY,SAAQ,mBAAuD;IAGnF,EAAE,GAAW,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC;IAExC,WAAW,CAAgB;IAC3B,eAAe,CAAgB;IAC/B,4BAA4B,CAA4B;IAE/D,IAAI,SAAS;QACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK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AAC;YACD,IAAI,OAAO,EAAE,CAAC;gBAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,oDAAoD,CAAC,CAAC;YAAC,CAAC;YAExF,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,8GAA8G,CAAC,CAAC;YAElI,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;YAErE,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,sBAAsB,IAAI,CAAC,WAAW,aAAa,MAAM,CAAC,QAAQ,IAAI,qDAAqD,wCAAwC,CAAC,CAAC;YACnN,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACjD,MAAM,KAAK,CAAC;QAChB,CAAC;gBAAS,CAAC;YACP,IAAI,OAAO,EAAE,CAAC;gBAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAAC,CAAC;QACpD,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -3,27 +3,31 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
5
5
|
import { Ib } from '@ibgib/ts-gib/dist/types.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { SyncSagaContextData_V1, SyncSagaContextIbGib_V1, SyncSagaContextIb_V1 } from './sync-saga-context-types.mjs';
|
|
7
|
+
import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
|
|
8
|
+
import { SyncIbGib_V1 } from '../sync-types.mjs';
|
|
7
9
|
/**
|
|
8
10
|
* Options for creating a SyncSagaContext ibgib.
|
|
9
11
|
*/
|
|
10
12
|
export interface CreateSyncSagaContextOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Optional command string (e.g. 'process').
|
|
13
|
-
*/
|
|
14
|
-
cmd?: SyncSagaContextCmd | string;
|
|
15
13
|
/**
|
|
16
14
|
* The main saga frame (Init, Ack, etc.).
|
|
17
15
|
*/
|
|
18
|
-
sagaFrame:
|
|
16
|
+
sagaFrame: SyncIbGib_V1;
|
|
19
17
|
/**
|
|
20
18
|
* Session identity keystones.
|
|
21
19
|
*/
|
|
22
20
|
sessionKeystones?: IbGib_V1[];
|
|
23
21
|
/**
|
|
24
|
-
*
|
|
22
|
+
* Domain payload ibgibs when the sync saga frame includes actual domain
|
|
23
|
+
* payloads to send, e.g., in a Delta frame.
|
|
24
|
+
*/
|
|
25
|
+
payloadIbGibsDomain?: IbGib_V1[];
|
|
26
|
+
/**
|
|
27
|
+
* we persist the context in the local/sender space (relative to our
|
|
28
|
+
* execution POV) right when we create it.
|
|
25
29
|
*/
|
|
26
|
-
|
|
30
|
+
localSpace: IbGibSpaceAny;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* Constructs the standard 'ib' string for a Sync Saga Context stone.
|
|
@@ -38,9 +42,21 @@ export declare function parseSyncSagaContextIb({ ib, }: {
|
|
|
38
42
|
ib: Ib;
|
|
39
43
|
}): Promise<SyncSagaContextIb_V1>;
|
|
40
44
|
/**
|
|
41
|
-
* Creates
|
|
45
|
+
* Creates new SyncSagaContext stone. Puts/registers in {@link localSpace}
|
|
46
|
+
* immediately after creation.
|
|
42
47
|
*
|
|
43
48
|
* @returns The context ibGib.
|
|
49
|
+
*
|
|
50
|
+
* ## notes
|
|
51
|
+
*
|
|
52
|
+
* the other ibgibs that are related to this context stone should already be
|
|
53
|
+
* put/registered in {@link localSpace}.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createSyncSagaContext({ sagaFrame, sessionKeystones, payloadIbGibsDomain, localSpace, }: CreateSyncSagaContextOptions): Promise<SyncSagaContextIbGib_V1>;
|
|
56
|
+
/**
|
|
57
|
+
* move to sync-peer-helpers.mts as a pure function?
|
|
44
58
|
*/
|
|
45
|
-
export declare function
|
|
59
|
+
export declare function validateContext({ context }: {
|
|
60
|
+
context: SyncSagaContextIbGib_V1;
|
|
61
|
+
}): Promise<string[]>;
|
|
46
62
|
//# sourceMappingURL=sync-saga-context-helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-saga-context-helpers.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-saga-context/sync-saga-context-helpers.mts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,QAAQ,EAAG,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"sync-saga-context-helpers.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-saga-context/sync-saga-context-helpers.mts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,QAAQ,EAAG,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,8BAA8B,CAAC;AAMlD,OAAO,EACH,sBAAsB,EAAE,uBAAuB,EAAE,oBAAoB,EAExE,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,SAAS,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,QAAQ,EAAE,CAAC;IACjC;;;OAGG;IACH,UAAU,EAAE,aAAa,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,EACvC,IAAI,GACP,EAAE;IACC,IAAI,EAAE,sBAAsB,CAAC;CAChC,GAAG,OAAO,CAAC,EAAE,CAAC,CAiBd;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,EACzC,EAAE,GACL,EAAE;IACC,EAAE,EAAE,EAAE,CAAC;CACV,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA2BhC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CAAC,EACxC,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,GACb,EAAE,4BAA4B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA8DjE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,uBAAuB,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAmC1G"}
|