atom.io 0.31.1 → 0.32.1
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/data/dist/index.d.ts +3 -154
- package/data/dist/index.js +11 -559
- package/data/src/index.ts +0 -2
- package/data/src/struct-family.ts +1 -1
- package/data/src/struct.ts +1 -2
- package/dist/chunk-3PQTWLQQ.js +83 -0
- package/dist/chunk-3ZFTRSNG.js +523 -0
- package/dist/chunk-4LWKCEW3.js +14 -0
- package/dist/chunk-KVI5OBF2.js +153 -0
- package/dist/{chunk-Y5MBNTVU.js → chunk-UQEYZ3OI.js} +1814 -721
- package/dist/chunk-UYYKOGZQ.js +1034 -0
- package/dist/chunk-VRJP2PCU.js +631 -0
- package/dist/chunk-X7SD2NXU.js +108 -0
- package/dist/index.d.ts +137 -12
- package/dist/index.js +1 -228
- package/eslint-plugin/dist/index.d.ts +1 -30
- package/eslint-plugin/dist/index.js +3 -149
- package/eslint-plugin/src/index.ts +0 -1
- package/eslint-plugin/src/rules/explicit-state-types.ts +1 -0
- package/eslint-plugin/src/rules/index.ts +0 -1
- package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +1 -0
- package/eslint-plugin/src/walk.ts +1 -0
- package/internal/dist/index.d.ts +129 -58
- package/internal/dist/index.js +1 -1
- package/internal/src/atom/create-regular-atom.ts +3 -3
- package/internal/src/atom/dispose-atom.ts +4 -13
- package/internal/src/atom/is-default.ts +3 -3
- package/internal/src/caching.ts +5 -5
- package/internal/src/capitalize.ts +3 -0
- package/internal/src/families/create-readonly-selector-family.ts +5 -6
- package/internal/src/families/create-writable-selector-family.ts +1 -4
- package/internal/src/families/dispose-from-store.ts +3 -13
- package/internal/src/get-state/get-from-store.ts +2 -2
- package/internal/src/get-state/read-or-compute-value.ts +1 -1
- package/internal/src/index.ts +2 -0
- package/internal/src/install-into-store.ts +1 -1
- package/internal/src/join/edit-relations-in-store.ts +32 -0
- package/internal/src/join/find-relations-in-store.ts +124 -0
- package/internal/src/join/get-internal-relations-from-store.ts +14 -0
- package/internal/src/join/get-join.ts +31 -0
- package/internal/src/join/index.ts +5 -0
- package/{data/src/join.ts → internal/src/join/join-internal.ts} +21 -430
- package/internal/src/junction.ts +7 -4
- package/internal/src/keys.ts +7 -7
- package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
- package/internal/src/mutable/create-mutable-atom.ts +3 -3
- package/internal/src/mutable/get-json-token.ts +1 -1
- package/internal/src/mutable/tracker-family.ts +19 -17
- package/internal/src/mutable/tracker.ts +8 -8
- package/internal/src/pretty-print.ts +1 -1
- package/internal/src/selector/create-readonly-selector.ts +3 -7
- package/internal/src/selector/create-writable-selector.ts +4 -4
- package/internal/src/selector/dispose-selector.ts +20 -11
- package/internal/src/selector/get-selector-dependency-keys.ts +1 -1
- package/internal/src/selector/register-selector.ts +6 -9
- package/internal/src/selector/trace-selector-atoms.ts +2 -2
- package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
- package/internal/src/set-state/emit-update.ts +4 -2
- package/internal/src/set-state/evict-downstream.ts +1 -1
- package/internal/src/set-state/set-atom-or-selector.ts +1 -1
- package/internal/src/set-state/set-atom.ts +10 -10
- package/internal/src/set-state/set-into-store.ts +2 -2
- package/internal/src/set-state/stow-update.ts +1 -1
- package/internal/src/store/store.ts +1 -1
- package/internal/src/store/withdraw.ts +22 -22
- package/internal/src/subscribe/recall-state.ts +1 -1
- package/internal/src/subscribe/subscribe-in-store.ts +3 -3
- package/internal/src/subscribe/subscribe-to-root-atoms.ts +3 -3
- package/internal/src/subscribe/subscribe-to-state.ts +5 -5
- package/internal/src/subscribe/subscribe-to-timeline.ts +3 -3
- package/internal/src/subscribe/subscribe-to-transaction.ts +3 -3
- package/internal/src/timeline/create-timeline.ts +19 -38
- package/internal/src/timeline/time-travel.ts +2 -1
- package/internal/src/transaction/act-upon-store.ts +2 -2
- package/internal/src/transaction/apply-transaction.ts +5 -5
- package/internal/src/transaction/assign-transaction-to-continuity.ts +1 -1
- package/internal/src/transaction/build-transaction.ts +5 -8
- package/internal/src/transaction/create-transaction.ts +3 -3
- package/internal/src/transaction/get-epoch-number.ts +3 -3
- package/internal/src/transaction/set-epoch-number.ts +2 -2
- package/introspection/dist/index.js +2 -620
- package/json/dist/index.d.ts +2 -2
- package/json/dist/index.js +1 -80
- package/json/src/select-json-family.ts +3 -14
- package/package.json +31 -49
- package/react/dist/index.js +2 -82
- package/react/src/use-o.ts +1 -1
- package/react/src/use-tl.ts +2 -2
- package/react-devtools/dist/index.css +16 -14
- package/react-devtools/dist/index.js +31 -18
- package/react-devtools/src/Updates.tsx +12 -0
- package/react-devtools/src/devtools.scss +16 -14
- package/react-devtools/src/json-editor/editors-by-type/utilities/cast-to-json.ts +2 -1
- package/realtime/dist/index.d.ts +1 -2
- package/realtime/dist/index.js +2 -107
- package/realtime/src/realtime-continuity.ts +3 -2
- package/realtime/src/shared-room-store.ts +1 -2
- package/realtime-client/dist/index.d.ts +9 -9
- package/realtime-client/dist/index.js +3 -509
- package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +3 -3
- package/realtime-client/src/continuity/use-conceal-state.ts +1 -1
- package/realtime-client/src/pull-atom-family-member.ts +2 -2
- package/realtime-client/src/pull-atom.ts +2 -2
- package/realtime-client/src/pull-mutable-atom-family-member.ts +2 -2
- package/realtime-client/src/pull-mutable-atom.ts +2 -2
- package/realtime-client/src/pull-selector-family-member.ts +4 -4
- package/realtime-client/src/pull-selector.ts +4 -4
- package/realtime-client/src/push-state.ts +5 -10
- package/realtime-client/src/server-action.ts +4 -4
- package/realtime-client/src/sync-continuity.ts +6 -6
- package/realtime-react/dist/index.js +5 -154
- package/realtime-react/src/use-pull-atom-family-member.ts +1 -1
- package/realtime-react/src/use-pull-atom.ts +1 -1
- package/realtime-react/src/use-pull-mutable-atom.ts +1 -1
- package/realtime-react/src/use-pull-mutable-family-member.ts +1 -1
- package/realtime-react/src/use-pull-selector-family-member.ts +1 -1
- package/realtime-react/src/use-pull-selector.ts +1 -1
- package/realtime-react/src/use-push.ts +1 -1
- package/realtime-react/src/use-server-action.ts +2 -2
- package/realtime-react/src/use-sync-continuity.ts +1 -1
- package/realtime-server/dist/index.d.ts +2 -4
- package/realtime-server/dist/index.js +3 -1001
- package/realtime-server/src/continuity/prepare-to-serve-transaction-request.ts +1 -1
- package/realtime-server/src/continuity/prepare-to-sync-realtime-continuity.ts +3 -3
- package/realtime-server/src/continuity/subscribe-to-continuity-actions.ts +2 -2
- package/realtime-server/src/continuity/subscribe-to-continuity-perpectives.ts +2 -2
- package/realtime-server/src/ipc-sockets/child-socket.ts +2 -0
- package/realtime-server/src/realtime-action-receiver.ts +1 -1
- package/realtime-server/src/realtime-family-provider.ts +2 -2
- package/realtime-server/src/realtime-mutable-family-provider.ts +2 -2
- package/realtime-server/src/realtime-mutable-provider.ts +2 -2
- package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +2 -1
- package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +1 -1
- package/realtime-server/src/realtime-server-stores/server-sync-store.ts +10 -2
- package/realtime-server/src/realtime-server-stores/server-user-store.ts +1 -2
- package/realtime-server/src/realtime-state-provider.ts +2 -2
- package/realtime-testing/dist/index.js +20 -22
- package/realtime-testing/src/setup-realtime-test.tsx +2 -1
- package/src/index.ts +4 -0
- package/src/join.ts +218 -0
- package/src/silo.ts +4 -4
- package/src/timeline.ts +1 -1
- package/src/transaction.ts +4 -8
- package/transceivers/set-rtx/dist/index.d.ts +4 -3
- package/transceivers/set-rtx/dist/index.js +1 -215
- package/transceivers/set-rtx/src/set-rtx.ts +4 -7
- package/web/dist/index.js +1 -15
- package/data/src/until.ts +0 -15
- package/ephemeral/dist/index.d.ts +0 -67
- package/ephemeral/dist/index.js +0 -9
- package/ephemeral/package.json +0 -13
- package/ephemeral/src/index.ts +0 -1
- package/eslint-plugin/src/rules/lifespan.ts +0 -203
- package/immortal/dist/index.d.ts +0 -12
- package/immortal/dist/index.js +0 -9
- package/immortal/package.json +0 -13
- package/immortal/src/index.ts +0 -1
- package/immortal/src/seek-state.ts +0 -60
- package/react-devtools/src/json-editor/assets/Untitled-1.ai +2 -1436
- package/react-devtools/src/json-editor/assets/data-vis.ai +1 -1548
- package/react-devtools/src/json-editor/comp/json-editor-sketches.ai +5 -1449
- /package/{ephemeral/src → src}/find-state.ts +0 -0
package/realtime/dist/index.js
CHANGED
|
@@ -1,108 +1,3 @@
|
|
|
1
|
+
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex } from '../../dist/chunk-X7SD2NXU.js';
|
|
2
|
+
import '../../dist/chunk-UQEYZ3OI.js';
|
|
1
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
2
|
-
import { assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from 'atom.io/internal';
|
|
3
|
-
import { atom, selectorFamily } from 'atom.io';
|
|
4
|
-
import { join, getInternalRelations } from 'atom.io/data';
|
|
5
|
-
import { SetRTX } from 'atom.io/transceivers/set-rtx';
|
|
6
|
-
|
|
7
|
-
var InvariantMap = class extends Map {
|
|
8
|
-
set(key, value) {
|
|
9
|
-
if (this.has(key)) {
|
|
10
|
-
console.warn(`Tried to set a key that already exists in an InvariantMap`, {
|
|
11
|
-
key,
|
|
12
|
-
value
|
|
13
|
-
});
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
return super.set(key, value);
|
|
17
|
-
}
|
|
18
|
-
clear() {
|
|
19
|
-
throw new Error(`Cannot clear an InvariantMap`);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var SyncGroup = class _SyncGroup {
|
|
23
|
-
constructor(key) {
|
|
24
|
-
this.key = key;
|
|
25
|
-
}
|
|
26
|
-
type = `continuity`;
|
|
27
|
-
globals = [];
|
|
28
|
-
actions = [];
|
|
29
|
-
perspectives = [];
|
|
30
|
-
static existing = new InvariantMap();
|
|
31
|
-
static create(key, builder) {
|
|
32
|
-
const group = new _SyncGroup(key);
|
|
33
|
-
const { type, globals, actions, perspectives } = builder(group);
|
|
34
|
-
const token = { type, key, globals, actions, perspectives };
|
|
35
|
-
_SyncGroup.existing.set(key, token);
|
|
36
|
-
return token;
|
|
37
|
-
}
|
|
38
|
-
add(...args) {
|
|
39
|
-
const zeroth = args[0];
|
|
40
|
-
switch (zeroth.type) {
|
|
41
|
-
case `atom`:
|
|
42
|
-
case `mutable_atom`:
|
|
43
|
-
this.globals.push(...args);
|
|
44
|
-
break;
|
|
45
|
-
case `transaction`:
|
|
46
|
-
this.actions.push(...args);
|
|
47
|
-
break;
|
|
48
|
-
case `atom_family`:
|
|
49
|
-
{
|
|
50
|
-
const [family, index] = args;
|
|
51
|
-
this.perspectives.push({
|
|
52
|
-
type: `realtime_perspective`,
|
|
53
|
-
resourceAtoms: family,
|
|
54
|
-
viewAtoms: index
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
function continuity(options) {
|
|
63
|
-
const { key, config } = options;
|
|
64
|
-
const token = SyncGroup.create(key, config);
|
|
65
|
-
const { actions } = token;
|
|
66
|
-
for (const action of actions) {
|
|
67
|
-
assignTransactionToContinuity(key, action.key, IMPLICIT.STORE);
|
|
68
|
-
}
|
|
69
|
-
setEpochNumberOfContinuity(key, -1, IMPLICIT.STORE);
|
|
70
|
-
return token;
|
|
71
|
-
}
|
|
72
|
-
var usersInThisRoomIndex = atom({
|
|
73
|
-
key: `usersInRoomIndex`,
|
|
74
|
-
mutable: true,
|
|
75
|
-
default: () => new SetRTX(),
|
|
76
|
-
toJson: (set) => set.toJSON(),
|
|
77
|
-
fromJson: (json) => SetRTX.fromJSON(json)
|
|
78
|
-
});
|
|
79
|
-
var roomIndex = atom({
|
|
80
|
-
key: `roomIndex`,
|
|
81
|
-
default: () => new SetRTX(),
|
|
82
|
-
mutable: true,
|
|
83
|
-
toJson: (set) => set.toJSON(),
|
|
84
|
-
fromJson: (json) => SetRTX.fromJSON(json)
|
|
85
|
-
});
|
|
86
|
-
var DEFAULT_USER_IN_ROOM_META = {
|
|
87
|
-
enteredAtEpoch: 0
|
|
88
|
-
};
|
|
89
|
-
var usersInRooms = join(
|
|
90
|
-
{
|
|
91
|
-
key: `usersInRooms`,
|
|
92
|
-
between: [`room`, `user`],
|
|
93
|
-
cardinality: `1:n`,
|
|
94
|
-
isAType: (input) => typeof input === `string`,
|
|
95
|
-
isBType: (input) => typeof input === `string`
|
|
96
|
-
},
|
|
97
|
-
DEFAULT_USER_IN_ROOM_META
|
|
98
|
-
);
|
|
99
|
-
var usersInMyRoomView = selectorFamily({
|
|
100
|
-
key: `usersInMyRoomView`,
|
|
101
|
-
get: (myUsername) => ({ find }) => {
|
|
102
|
-
const usersInRoomsAtoms = getInternalRelations(usersInRooms);
|
|
103
|
-
const myRoomIndex = find(usersInRoomsAtoms, myUsername);
|
|
104
|
-
return [myRoomIndex];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
|
|
@@ -94,6 +94,7 @@ export class SyncGroup {
|
|
|
94
94
|
this.actions.push(...(args as TransactionToken<any>[]))
|
|
95
95
|
break
|
|
96
96
|
case `atom_family`:
|
|
97
|
+
case `mutable_atom_family`:
|
|
97
98
|
{
|
|
98
99
|
const [family, index] = args as [
|
|
99
100
|
AtomFamilyToken<any, any>,
|
|
@@ -122,9 +123,9 @@ export function continuity(options: ContinuityOptions): ContinuityToken {
|
|
|
122
123
|
const token = SyncGroup.create(key, config)
|
|
123
124
|
const { actions } = token
|
|
124
125
|
for (const action of actions) {
|
|
125
|
-
assignTransactionToContinuity(key, action.key
|
|
126
|
+
assignTransactionToContinuity(IMPLICIT.STORE, key, action.key)
|
|
126
127
|
}
|
|
127
|
-
setEpochNumberOfContinuity(key, -1
|
|
128
|
+
setEpochNumberOfContinuity(IMPLICIT.STORE, key, -1)
|
|
128
129
|
return token
|
|
129
130
|
}
|
|
130
131
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MutableAtomToken } from "atom.io"
|
|
2
|
-
import { atom, selectorFamily } from "atom.io"
|
|
3
|
-
import { getInternalRelations, join } from "atom.io/data"
|
|
2
|
+
import { atom, getInternalRelations, join, selectorFamily } from "atom.io"
|
|
4
3
|
import type { SetRTXJson } from "atom.io/transceivers/set-rtx"
|
|
5
4
|
import { SetRTX } from "atom.io/transceivers/set-rtx"
|
|
6
5
|
|
|
@@ -13,19 +13,19 @@ declare function useConcealState(store: Store): (concealed: AtomToken<unknown>[]
|
|
|
13
13
|
|
|
14
14
|
declare function useRevealState(store: Store): (revealed: Json.Array) => void;
|
|
15
15
|
|
|
16
|
-
declare function pullAtom<J extends Json.Serializable>(
|
|
16
|
+
declare function pullAtom<J extends Json.Serializable>(store: Store, socket: Socket$1, token: AtomIO.RegularAtomToken<J>): () => void;
|
|
17
17
|
|
|
18
|
-
declare function pullAtomFamilyMember<J extends Json.Serializable>(
|
|
18
|
+
declare function pullAtomFamilyMember<J extends Json.Serializable>(store: Store, socket: Socket$1, token: AtomIO.RegularAtomToken<J>): () => void;
|
|
19
19
|
|
|
20
|
-
declare function pullMutableAtom<T extends Transceiver<any>, J extends Json.Serializable>(
|
|
20
|
+
declare function pullMutableAtom<T extends Transceiver<any>, J extends Json.Serializable>(store: Store, socket: Socket$1, token: AtomIO.MutableAtomToken<T, J>): () => void;
|
|
21
21
|
|
|
22
|
-
declare function pullMutableAtomFamilyMember<T extends Transceiver<any>, J extends Json.Serializable>(
|
|
22
|
+
declare function pullMutableAtomFamilyMember<T extends Transceiver<any>, J extends Json.Serializable>(store: Store, socket: Socket$1, token: AtomIO.MutableAtomToken<T, J>): () => void;
|
|
23
23
|
|
|
24
|
-
declare function pullSelector<T>(
|
|
24
|
+
declare function pullSelector<T>(store: Store, socket: Socket$1, token: AtomIO.SelectorToken<T>): () => void;
|
|
25
25
|
|
|
26
|
-
declare function pullSelectorFamilyMember<T>(
|
|
26
|
+
declare function pullSelectorFamilyMember<T>(store: Store, socket: Socket$1, token: AtomIO.SelectorToken<T>): () => void;
|
|
27
27
|
|
|
28
|
-
declare function pushState<J extends Json.Serializable>(
|
|
28
|
+
declare function pushState<J extends Json.Serializable>(store: Internal.Store, socket: Socket$1, token: AtomIO.WritableToken<J>): () => void;
|
|
29
29
|
|
|
30
30
|
declare const myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined>;
|
|
31
31
|
declare const myIdState: AtomIO.ReadonlySelectorToken<string | undefined>;
|
|
@@ -34,8 +34,8 @@ declare const myUsernameState: AtomIO.RegularAtomToken<string | null>;
|
|
|
34
34
|
declare const optimisticUpdateQueue: AtomIO.RegularAtomToken<AtomIO.TransactionUpdate<any>[]>;
|
|
35
35
|
declare const confirmedUpdateQueue: AtomIO.RegularAtomToken<AtomIO.TransactionUpdate<any>[]>;
|
|
36
36
|
|
|
37
|
-
declare function serverAction<F extends Internal.Func>(
|
|
37
|
+
declare function serverAction<F extends Internal.Func>(store: Internal.Store, socket: Socket$1, token: AtomIO.TransactionToken<F>): () => void;
|
|
38
38
|
|
|
39
|
-
declare function syncContinuity(
|
|
39
|
+
declare function syncContinuity(store: Store, socket: Socket$1, continuity: ContinuityToken): () => void;
|
|
40
40
|
|
|
41
41
|
export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState };
|
|
@@ -1,510 +1,4 @@
|
|
|
1
|
+
export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState } from '../../dist/chunk-3ZFTRSNG.js';
|
|
2
|
+
import '../../dist/chunk-4LWKCEW3.js';
|
|
3
|
+
import '../../dist/chunk-UQEYZ3OI.js';
|
|
1
4
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
2
|
-
import * as Internal from 'atom.io/internal';
|
|
3
|
-
import { setIntoStore, getEpochNumberOfContinuity, isRootStore, ingestTransactionUpdate, setEpochNumberOfContinuity, disposeAtom, getJsonToken, getUpdateToken, getFromStore, assignTransactionToContinuity, subscribeToTransaction, actUponStore } from 'atom.io/internal';
|
|
4
|
-
import { confirmedUpdateQueue, optimisticUpdateQueue } from 'atom.io/realtime-client';
|
|
5
|
-
import { parseJson } from 'atom.io/json';
|
|
6
|
-
import * as AtomIO from 'atom.io';
|
|
7
|
-
import { persistSync } from 'atom.io/web';
|
|
8
|
-
|
|
9
|
-
var useRegisterAndAttemptConfirmedUpdate = (store, continuityKey, socket, optimisticUpdates, confirmedUpdates) => (confirmed) => {
|
|
10
|
-
function reconcileEpoch(optimisticUpdate, confirmedUpdate) {
|
|
11
|
-
store.logger.info(
|
|
12
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
13
|
-
`continuity`,
|
|
14
|
-
continuityKey,
|
|
15
|
-
`reconciling updates`
|
|
16
|
-
);
|
|
17
|
-
setIntoStore(store, optimisticUpdateQueue, (queue) => {
|
|
18
|
-
queue.shift();
|
|
19
|
-
return queue;
|
|
20
|
-
});
|
|
21
|
-
if (optimisticUpdate.id === confirmedUpdate.id) {
|
|
22
|
-
const clientResult = JSON.stringify(optimisticUpdate.updates);
|
|
23
|
-
const serverResult = JSON.stringify(confirmedUpdate.updates);
|
|
24
|
-
if (clientResult === serverResult) {
|
|
25
|
-
store.logger.info(
|
|
26
|
-
`\u2705`,
|
|
27
|
-
`continuity`,
|
|
28
|
-
continuityKey,
|
|
29
|
-
`results for ${optimisticUpdate.id} match between client and server`
|
|
30
|
-
);
|
|
31
|
-
socket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
store.logger.info(
|
|
36
|
-
`\u274C`,
|
|
37
|
-
`continuity`,
|
|
38
|
-
continuityKey,
|
|
39
|
-
`thought update #${confirmedUpdate.epoch} was ${optimisticUpdate.key}:${optimisticUpdate.id}, but it was actually ${confirmedUpdate.key}:${confirmedUpdate.id}`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
store.logger.info(
|
|
43
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
44
|
-
`continuity`,
|
|
45
|
-
continuityKey,
|
|
46
|
-
`updates do not match`,
|
|
47
|
-
optimisticUpdate,
|
|
48
|
-
confirmedUpdate
|
|
49
|
-
);
|
|
50
|
-
const reversedOptimisticUpdates = optimisticUpdates.toReversed();
|
|
51
|
-
for (const subsequentOptimistic of reversedOptimisticUpdates) {
|
|
52
|
-
ingestTransactionUpdate(`oldValue`, subsequentOptimistic, store);
|
|
53
|
-
}
|
|
54
|
-
store.logger.info(
|
|
55
|
-
`\u23EA`,
|
|
56
|
-
`continuity`,
|
|
57
|
-
continuityKey,
|
|
58
|
-
`undid optimistic updates:`,
|
|
59
|
-
reversedOptimisticUpdates
|
|
60
|
-
);
|
|
61
|
-
ingestTransactionUpdate(`oldValue`, optimisticUpdate, store);
|
|
62
|
-
store.logger.info(
|
|
63
|
-
`\u23EA`,
|
|
64
|
-
`continuity`,
|
|
65
|
-
continuityKey,
|
|
66
|
-
`undid zeroth optimistic update`,
|
|
67
|
-
optimisticUpdate
|
|
68
|
-
);
|
|
69
|
-
ingestTransactionUpdate(`newValue`, confirmedUpdate, store);
|
|
70
|
-
store.logger.info(
|
|
71
|
-
`\u23E9`,
|
|
72
|
-
`continuity`,
|
|
73
|
-
continuityKey,
|
|
74
|
-
`applied confirmed update`,
|
|
75
|
-
confirmedUpdate
|
|
76
|
-
);
|
|
77
|
-
socket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch);
|
|
78
|
-
for (const subsequentOptimistic of optimisticUpdates) {
|
|
79
|
-
const token = {
|
|
80
|
-
type: `transaction`,
|
|
81
|
-
key: subsequentOptimistic.key
|
|
82
|
-
};
|
|
83
|
-
const { id, params } = subsequentOptimistic;
|
|
84
|
-
actUponStore(token, id, store)(...params);
|
|
85
|
-
}
|
|
86
|
-
store.logger.info(
|
|
87
|
-
`\u23E9`,
|
|
88
|
-
`continuity`,
|
|
89
|
-
continuityKey,
|
|
90
|
-
`reapplied subsequent optimistic updates:`,
|
|
91
|
-
optimisticUpdates
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
store.logger.info(
|
|
95
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
96
|
-
`continuity`,
|
|
97
|
-
continuityKey,
|
|
98
|
-
`integrating confirmed update`,
|
|
99
|
-
{ confirmedUpdate: confirmed, confirmedUpdates, optimisticUpdates }
|
|
100
|
-
);
|
|
101
|
-
const zerothOptimisticUpdate = optimisticUpdates[0];
|
|
102
|
-
if (zerothOptimisticUpdate) {
|
|
103
|
-
store.logger.info(
|
|
104
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
105
|
-
`continuity`,
|
|
106
|
-
continuityKey,
|
|
107
|
-
`has optimistic updates to reconcile`
|
|
108
|
-
);
|
|
109
|
-
if (confirmed.epoch === zerothOptimisticUpdate.epoch) {
|
|
110
|
-
store.logger.info(
|
|
111
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
112
|
-
`continuity`,
|
|
113
|
-
continuityKey,
|
|
114
|
-
`epoch of confirmed update #${confirmed.epoch} matches zeroth optimistic update`
|
|
115
|
-
);
|
|
116
|
-
reconcileEpoch(zerothOptimisticUpdate, confirmed);
|
|
117
|
-
for (const nextConfirmed of confirmedUpdates) {
|
|
118
|
-
const nextOptimistic = optimisticUpdates[0];
|
|
119
|
-
if (nextConfirmed.epoch === nextOptimistic?.epoch) {
|
|
120
|
-
reconcileEpoch(nextOptimistic, nextConfirmed);
|
|
121
|
-
} else {
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
store.logger.info(
|
|
127
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
128
|
-
`continuity`,
|
|
129
|
-
continuityKey,
|
|
130
|
-
`epoch of confirmed update #${confirmed.epoch} does not match zeroth optimistic update #${zerothOptimisticUpdate.epoch}`
|
|
131
|
-
);
|
|
132
|
-
const confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(
|
|
133
|
-
(update) => update.epoch === confirmed.epoch
|
|
134
|
-
);
|
|
135
|
-
if (!confirmedUpdateIsAlreadyEnqueued) {
|
|
136
|
-
store.logger.info(
|
|
137
|
-
`\u{1F448}`,
|
|
138
|
-
`continuity`,
|
|
139
|
-
continuityKey,
|
|
140
|
-
`pushing confirmed update to queue`,
|
|
141
|
-
confirmed
|
|
142
|
-
);
|
|
143
|
-
setIntoStore(store, confirmedUpdateQueue, (queue) => {
|
|
144
|
-
queue.push(confirmed);
|
|
145
|
-
queue.sort((a, b) => a.epoch - b.epoch);
|
|
146
|
-
return queue;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
} else {
|
|
151
|
-
store.logger.info(
|
|
152
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
153
|
-
`continuity`,
|
|
154
|
-
continuityKey,
|
|
155
|
-
`has no optimistic updates to deal with`
|
|
156
|
-
);
|
|
157
|
-
const continuityEpoch = getEpochNumberOfContinuity(continuityKey, store);
|
|
158
|
-
const isRoot = isRootStore(store);
|
|
159
|
-
if (isRoot && continuityEpoch === confirmed.epoch - 1) {
|
|
160
|
-
store.logger.info(
|
|
161
|
-
`\u2705`,
|
|
162
|
-
`continuity`,
|
|
163
|
-
continuityKey,
|
|
164
|
-
`integrating update #${confirmed.epoch} (${confirmed.key} ${confirmed.id})`
|
|
165
|
-
);
|
|
166
|
-
ingestTransactionUpdate(`newValue`, confirmed, store);
|
|
167
|
-
socket.emit(`ack:${continuityKey}`, confirmed.epoch);
|
|
168
|
-
setEpochNumberOfContinuity(continuityKey, confirmed.epoch, store);
|
|
169
|
-
} else if (isRoot && continuityEpoch !== undefined) {
|
|
170
|
-
store.logger.info(
|
|
171
|
-
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
172
|
-
`continuity`,
|
|
173
|
-
continuityKey,
|
|
174
|
-
`received update #${confirmed.epoch} but still waiting for update #${continuityEpoch + 1}`,
|
|
175
|
-
{
|
|
176
|
-
clientEpoch: continuityEpoch,
|
|
177
|
-
serverEpoch: confirmed.epoch
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
const confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(
|
|
181
|
-
(update) => update.epoch === confirmed.epoch
|
|
182
|
-
);
|
|
183
|
-
if (confirmedUpdateIsAlreadyEnqueued) {
|
|
184
|
-
store.logger.info(
|
|
185
|
-
`\u{1F44D}`,
|
|
186
|
-
`continuity`,
|
|
187
|
-
continuityKey,
|
|
188
|
-
`confirmed update #${confirmed.epoch} is already enqueued`
|
|
189
|
-
);
|
|
190
|
-
} else {
|
|
191
|
-
store.logger.info(
|
|
192
|
-
`\u{1F448}`,
|
|
193
|
-
`continuity`,
|
|
194
|
-
continuityKey,
|
|
195
|
-
`pushing confirmed update #${confirmed.epoch} to queue`
|
|
196
|
-
);
|
|
197
|
-
setIntoStore(store, confirmedUpdateQueue, (queue) => {
|
|
198
|
-
queue.push(confirmed);
|
|
199
|
-
queue.sort((a, b) => a.epoch - b.epoch);
|
|
200
|
-
return queue;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
function useConcealState(store) {
|
|
207
|
-
return (concealed) => {
|
|
208
|
-
for (const token of concealed) {
|
|
209
|
-
disposeAtom(token, store);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function useRevealState(store) {
|
|
214
|
-
return (revealed) => {
|
|
215
|
-
let i = 0;
|
|
216
|
-
let k;
|
|
217
|
-
let v;
|
|
218
|
-
for (const x of revealed) {
|
|
219
|
-
if (i % 2 === 0) {
|
|
220
|
-
k = x;
|
|
221
|
-
} else {
|
|
222
|
-
v = x;
|
|
223
|
-
setIntoStore(store, k, v);
|
|
224
|
-
}
|
|
225
|
-
i++;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
function pullAtom(token, socket, store) {
|
|
230
|
-
const setServedValue = (data) => {
|
|
231
|
-
setIntoStore(store, token, data);
|
|
232
|
-
};
|
|
233
|
-
socket.on(`serve:${token.key}`, setServedValue);
|
|
234
|
-
socket.emit(`sub:${token.key}`);
|
|
235
|
-
return () => {
|
|
236
|
-
socket.off(`serve:${token.key}`, setServedValue);
|
|
237
|
-
socket.emit(`unsub:${token.key}`);
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
function pullAtomFamilyMember(token, socket, store) {
|
|
241
|
-
if (!(`family` in token)) {
|
|
242
|
-
console.error(`Token is not a family member:`, token);
|
|
243
|
-
return () => {
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
const { key: familyKey, subKey: serializedSubKey } = token.family;
|
|
247
|
-
const subKey = parseJson(serializedSubKey);
|
|
248
|
-
socket?.on(`serve:${token.key}`, (data) => {
|
|
249
|
-
setIntoStore(store, token, data);
|
|
250
|
-
});
|
|
251
|
-
socket?.emit(`sub:${familyKey}`, subKey);
|
|
252
|
-
return () => {
|
|
253
|
-
socket?.off(`serve:${token.key}`);
|
|
254
|
-
socket?.emit(`unsub:${token.key}`);
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
function pullMutableAtom(token, socket, store) {
|
|
258
|
-
const jsonToken = getJsonToken(store, token);
|
|
259
|
-
const updateToken = getUpdateToken(token);
|
|
260
|
-
socket.on(`init:${token.key}`, (data) => {
|
|
261
|
-
setIntoStore(store, jsonToken, data);
|
|
262
|
-
});
|
|
263
|
-
socket.on(
|
|
264
|
-
`next:${token.key}`,
|
|
265
|
-
(data) => {
|
|
266
|
-
setIntoStore(store, updateToken, data);
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
socket.emit(`sub:${token.key}`);
|
|
270
|
-
return () => {
|
|
271
|
-
socket.off(`init:${token.key}`);
|
|
272
|
-
socket.off(`next:${token.key}`);
|
|
273
|
-
socket.emit(`unsub:${token.key}`);
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function pullMutableAtomFamilyMember(token, socket, store) {
|
|
277
|
-
if (!(`family` in token)) {
|
|
278
|
-
console.error(`Token is not a family member:`, token);
|
|
279
|
-
return () => {
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const { key: familyKey, subKey: serializedSubKey } = token.family;
|
|
283
|
-
const subKey = parseJson(serializedSubKey);
|
|
284
|
-
socket.on(`init:${token.key}`, (data) => {
|
|
285
|
-
const jsonToken = getJsonToken(store, token);
|
|
286
|
-
setIntoStore(store, jsonToken, data);
|
|
287
|
-
});
|
|
288
|
-
socket.on(
|
|
289
|
-
`next:${token.key}`,
|
|
290
|
-
(data) => {
|
|
291
|
-
const trackerToken = getUpdateToken(token);
|
|
292
|
-
setIntoStore(store, trackerToken, data);
|
|
293
|
-
}
|
|
294
|
-
);
|
|
295
|
-
socket.emit(`sub:${familyKey}`, subKey);
|
|
296
|
-
return () => {
|
|
297
|
-
socket.off(`serve:${token.key}`);
|
|
298
|
-
socket.emit(`unsub:${token.key}`);
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// realtime-client/src/pull-selector.ts
|
|
303
|
-
function pullSelector(token, socket, store) {
|
|
304
|
-
const atomKeys = store.selectorAtoms.getRelatedKeys(token.key);
|
|
305
|
-
const unsubscribes = [];
|
|
306
|
-
if (atomKeys) {
|
|
307
|
-
for (const atomKey of atomKeys) {
|
|
308
|
-
const atom3 = store.atoms.get(atomKey);
|
|
309
|
-
if (!atom3) {
|
|
310
|
-
continue;
|
|
311
|
-
}
|
|
312
|
-
switch (atom3.type) {
|
|
313
|
-
case `atom`: {
|
|
314
|
-
unsubscribes.push(pullAtom(atom3, socket, store));
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
case `mutable_atom`: {
|
|
318
|
-
unsubscribes.push(pullMutableAtom(atom3, socket, store));
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return () => {
|
|
325
|
-
for (const unsubscribe of unsubscribes) {
|
|
326
|
-
unsubscribe();
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// realtime-client/src/pull-selector-family-member.ts
|
|
332
|
-
function pullSelectorFamilyMember(token, socket, store) {
|
|
333
|
-
if (!(`family` in token)) {
|
|
334
|
-
console.error(`Token is not a family member:`, token);
|
|
335
|
-
return () => {
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
const atomKeys = store.selectorAtoms.getRelatedKeys(token.key);
|
|
339
|
-
const unsubscribes = [];
|
|
340
|
-
if (atomKeys) {
|
|
341
|
-
for (const atomKey of atomKeys) {
|
|
342
|
-
const atom3 = store.atoms.get(atomKey);
|
|
343
|
-
if (!atom3) {
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
switch (atom3.type) {
|
|
347
|
-
case `atom`: {
|
|
348
|
-
unsubscribes.push(pullAtomFamilyMember(atom3, socket, store));
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
case `mutable_atom`: {
|
|
352
|
-
unsubscribes.push(pullMutableAtomFamilyMember(atom3, socket, store));
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return () => {
|
|
359
|
-
for (const unsubscribe of unsubscribes) {
|
|
360
|
-
unsubscribe();
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
function pushState(token, socket, store) {
|
|
365
|
-
socket.emit(`claim:${token.key}`);
|
|
366
|
-
Internal.subscribeToState(
|
|
367
|
-
token,
|
|
368
|
-
({ newValue }) => {
|
|
369
|
-
socket.emit(`pub:${token.key}`, newValue);
|
|
370
|
-
},
|
|
371
|
-
`push`,
|
|
372
|
-
store
|
|
373
|
-
);
|
|
374
|
-
return () => {
|
|
375
|
-
socket.off(`pub:${token.key}`);
|
|
376
|
-
socket.emit(`unclaim:${token.key}`);
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
var myIdState__INTERNAL = AtomIO.atom({
|
|
380
|
-
key: `mySocketId__INTERNAL`,
|
|
381
|
-
default: undefined
|
|
382
|
-
});
|
|
383
|
-
var myIdState = AtomIO.selector({
|
|
384
|
-
key: `mySocketId`,
|
|
385
|
-
get: ({ get }) => get(myIdState__INTERNAL)
|
|
386
|
-
});
|
|
387
|
-
var myUsernameState = AtomIO.atom({
|
|
388
|
-
key: `myName`,
|
|
389
|
-
default: null,
|
|
390
|
-
effects: typeof window === `undefined` ? [] : [persistSync(window.localStorage, JSON, `myUsername`)]
|
|
391
|
-
});
|
|
392
|
-
var optimisticUpdateQueue2 = AtomIO.atom({
|
|
393
|
-
key: `updateQueue`,
|
|
394
|
-
default: []
|
|
395
|
-
});
|
|
396
|
-
var confirmedUpdateQueue2 = AtomIO.atom(
|
|
397
|
-
{
|
|
398
|
-
key: `serverConfirmedUpdateQueue`,
|
|
399
|
-
default: []
|
|
400
|
-
}
|
|
401
|
-
);
|
|
402
|
-
function serverAction(token, socket, store) {
|
|
403
|
-
const unsubscribeFromLocalUpdates = Internal.subscribeToTransaction(
|
|
404
|
-
token,
|
|
405
|
-
(clientUpdate) => {
|
|
406
|
-
socket.emit(`tx-run:${token.key}`, clientUpdate);
|
|
407
|
-
},
|
|
408
|
-
`tx-run:${token.key}:${socket.id}`,
|
|
409
|
-
store
|
|
410
|
-
);
|
|
411
|
-
return () => {
|
|
412
|
-
unsubscribeFromLocalUpdates();
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function syncContinuity(continuity, socket, store) {
|
|
416
|
-
const continuityKey = continuity.key;
|
|
417
|
-
const optimisticUpdates = getFromStore(store, optimisticUpdateQueue);
|
|
418
|
-
const confirmedUpdates = getFromStore(store, confirmedUpdateQueue);
|
|
419
|
-
const initializeContinuity = (epoch, payload) => {
|
|
420
|
-
socket.off(`continuity-init:${continuityKey}`, initializeContinuity);
|
|
421
|
-
let i = 0;
|
|
422
|
-
let k;
|
|
423
|
-
let v;
|
|
424
|
-
for (const x of payload) {
|
|
425
|
-
if (i % 2 === 0) {
|
|
426
|
-
k = x;
|
|
427
|
-
} else {
|
|
428
|
-
v = x;
|
|
429
|
-
if (`type` in k && k.type === `mutable_atom`) {
|
|
430
|
-
k = getJsonToken(store, k);
|
|
431
|
-
}
|
|
432
|
-
setIntoStore(store, k, v);
|
|
433
|
-
}
|
|
434
|
-
i++;
|
|
435
|
-
}
|
|
436
|
-
setEpochNumberOfContinuity(continuityKey, epoch, store);
|
|
437
|
-
};
|
|
438
|
-
socket.off(`continuity-init:${continuityKey}`);
|
|
439
|
-
socket.on(`continuity-init:${continuityKey}`, initializeContinuity);
|
|
440
|
-
const registerAndAttemptConfirmedUpdate = useRegisterAndAttemptConfirmedUpdate(
|
|
441
|
-
store,
|
|
442
|
-
continuityKey,
|
|
443
|
-
socket,
|
|
444
|
-
optimisticUpdates,
|
|
445
|
-
confirmedUpdates
|
|
446
|
-
);
|
|
447
|
-
socket.off(`tx-new:${continuityKey}`);
|
|
448
|
-
socket.on(`tx-new:${continuityKey}`, registerAndAttemptConfirmedUpdate);
|
|
449
|
-
const unsubscribeFunctions = continuity.actions.map((transaction) => {
|
|
450
|
-
assignTransactionToContinuity(continuityKey, transaction.key, store);
|
|
451
|
-
const unsubscribeFromTransactionUpdates = subscribeToTransaction(
|
|
452
|
-
transaction,
|
|
453
|
-
(clientUpdate) => {
|
|
454
|
-
store.logger.info(
|
|
455
|
-
`\u{1F91E}`,
|
|
456
|
-
`continuity`,
|
|
457
|
-
continuityKey,
|
|
458
|
-
`enqueuing optimistic update`
|
|
459
|
-
);
|
|
460
|
-
const optimisticUpdateIndex = optimisticUpdates.findIndex(
|
|
461
|
-
(update) => update.id === clientUpdate.id
|
|
462
|
-
);
|
|
463
|
-
if (optimisticUpdateIndex === -1) {
|
|
464
|
-
store.logger.info(
|
|
465
|
-
`\u{1F91E}`,
|
|
466
|
-
`continuity`,
|
|
467
|
-
continuityKey,
|
|
468
|
-
`enqueuing new optimistic update`
|
|
469
|
-
);
|
|
470
|
-
setIntoStore(store, optimisticUpdateQueue, (queue) => {
|
|
471
|
-
queue.push(clientUpdate);
|
|
472
|
-
queue.sort((a, b) => a.epoch - b.epoch);
|
|
473
|
-
return queue;
|
|
474
|
-
});
|
|
475
|
-
} else {
|
|
476
|
-
store.logger.info(
|
|
477
|
-
`\u{1F91E}`,
|
|
478
|
-
`continuity`,
|
|
479
|
-
continuityKey,
|
|
480
|
-
`replacing existing optimistic update at index ${optimisticUpdateIndex}`
|
|
481
|
-
);
|
|
482
|
-
setIntoStore(store, optimisticUpdateQueue, (queue) => {
|
|
483
|
-
queue[optimisticUpdateIndex] = clientUpdate;
|
|
484
|
-
return queue;
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
socket.emit(`tx-run:${continuityKey}`, {
|
|
488
|
-
id: clientUpdate.id,
|
|
489
|
-
key: transaction.key,
|
|
490
|
-
params: clientUpdate.params
|
|
491
|
-
});
|
|
492
|
-
},
|
|
493
|
-
`tx-run:${continuityKey}`,
|
|
494
|
-
store
|
|
495
|
-
);
|
|
496
|
-
return unsubscribeFromTransactionUpdates;
|
|
497
|
-
});
|
|
498
|
-
const revealState = useRevealState(store);
|
|
499
|
-
const concealState = useConcealState(store);
|
|
500
|
-
socket.on(`reveal:${continuityKey}`, revealState);
|
|
501
|
-
socket.on(`conceal:${continuityKey}`, concealState);
|
|
502
|
-
socket.emit(`get:${continuityKey}`);
|
|
503
|
-
return () => {
|
|
504
|
-
socket.off(`continuity-init:${continuityKey}`);
|
|
505
|
-
socket.off(`tx-new:${continuityKey}`);
|
|
506
|
-
for (const unsubscribe of unsubscribeFunctions) unsubscribe();
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
export { confirmedUpdateQueue2 as confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue2 as optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState };
|