atom.io 0.40.5 → 0.40.7
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/README.md +1 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/employ-socket-D6wgByWh.js +12 -0
- package/dist/employ-socket-D6wgByWh.js.map +1 -0
- package/dist/has-role-hv4-hJMw.js +1149 -0
- package/dist/has-role-hv4-hJMw.js.map +1 -0
- package/dist/internal/index.d.ts +248 -248
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +570 -1712
- package/dist/internal/index.js.map +1 -1
- package/dist/introspection/index.d.ts +1 -1
- package/dist/is-fn-DY1wZ-md.js +10 -0
- package/dist/is-fn-DY1wZ-md.js.map +1 -0
- package/dist/main/index.d.ts +33 -33
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +2 -2
- package/dist/main/index.js.map +1 -1
- package/dist/mutex-store-CSvxY9i3.js +11 -0
- package/dist/mutex-store-CSvxY9i3.js.map +1 -0
- package/dist/react/index.d.ts +5 -21
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-devtools/index.js +7 -7
- package/dist/react-devtools/index.js.map +1 -1
- package/dist/realtime/index.d.ts +7 -15
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/index.js +3 -33
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime-client/index.d.ts +5 -5
- package/dist/realtime-client/index.d.ts.map +1 -1
- package/dist/realtime-client/index.js +92 -69
- package/dist/realtime-client/index.js.map +1 -1
- package/dist/realtime-react/index.d.ts +17 -10
- package/dist/realtime-react/index.d.ts.map +1 -1
- package/dist/realtime-react/index.js +41 -41
- package/dist/realtime-react/index.js.map +1 -1
- package/dist/realtime-server/index.d.ts +60 -53
- package/dist/realtime-server/index.d.ts.map +1 -1
- package/dist/realtime-server/index.js +592 -485
- package/dist/realtime-server/index.js.map +1 -1
- package/dist/realtime-testing/index.d.ts +1 -2
- package/dist/realtime-testing/index.d.ts.map +1 -1
- package/dist/realtime-testing/index.js +25 -18
- package/dist/realtime-testing/index.js.map +1 -1
- package/dist/shared-room-store-COGGKqes.js +32 -0
- package/dist/shared-room-store-COGGKqes.js.map +1 -0
- package/dist/shared-room-store-D2o4ZLjC.d.ts +15 -0
- package/dist/shared-room-store-D2o4ZLjC.d.ts.map +1 -0
- package/dist/web/index.d.ts +3 -3
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +4 -3
- package/dist/web/index.js.map +1 -1
- package/package.json +12 -12
- package/src/internal/atom/create-regular-atom.ts +5 -4
- package/src/internal/atom/dispose-atom.ts +7 -2
- package/src/internal/atom/has-role.ts +3 -3
- package/src/internal/caching.ts +4 -2
- package/src/internal/families/create-readonly-held-selector-family.ts +2 -1
- package/src/internal/families/create-readonly-pure-selector-family.ts +5 -2
- package/src/internal/families/create-regular-atom-family.ts +2 -1
- package/src/internal/families/create-writable-held-selector-family.ts +2 -1
- package/src/internal/families/create-writable-pure-selector-family.ts +5 -2
- package/src/internal/families/dispose-from-store.ts +4 -4
- package/src/internal/families/find-in-store.ts +10 -10
- package/src/internal/families/get-family-of-token.ts +2 -2
- package/src/internal/families/index.ts +1 -0
- package/src/internal/families/mint-in-store.ts +54 -19
- package/src/internal/families/seek-in-store.ts +1 -1
- package/src/internal/get-state/get-fallback.ts +2 -2
- package/src/internal/get-state/get-from-store.ts +5 -5
- package/src/internal/get-state/read-or-compute-value.ts +1 -1
- package/src/internal/get-state/reduce-reference.ts +8 -6
- package/src/internal/index.ts +2 -220
- package/src/internal/molecule.ts +1 -2
- package/src/internal/mutable/create-mutable-atom-family.ts +3 -2
- package/src/internal/mutable/create-mutable-atom.ts +4 -2
- package/src/internal/mutable/get-json-family.ts +1 -1
- package/src/internal/mutable/get-update-family.ts +1 -1
- package/src/internal/mutable/tracker-family.ts +2 -1
- package/src/internal/mutable/tracker.ts +5 -8
- package/src/internal/safe-compute.ts +1 -1
- package/src/internal/selector/create-readonly-held-selector.ts +2 -1
- package/src/internal/selector/create-readonly-pure-selector.ts +2 -1
- package/src/internal/selector/create-writable-held-selector.ts +2 -1
- package/src/internal/selector/create-writable-pure-selector.ts +2 -1
- package/src/internal/selector/dispose-selector.ts +3 -2
- package/src/internal/selector/register-selector.ts +8 -5
- package/src/internal/selector/trace-selector-atoms.ts +2 -1
- package/src/internal/set-state/dispatch-state-update.ts +3 -2
- package/src/internal/set-state/evict-downstream.ts +1 -1
- package/src/internal/set-state/operate-on-store.ts +16 -22
- package/src/internal/set-state/reset-atom-or-selector.ts +5 -3
- package/src/internal/set-state/reset-in-store.ts +5 -5
- package/src/internal/set-state/set-atom-or-selector.ts +2 -2
- package/src/internal/set-state/set-atom.ts +4 -2
- package/src/internal/set-state/set-into-store.ts +21 -39
- package/src/internal/set-state/set-selector.ts +3 -2
- package/src/internal/state-types.ts +228 -0
- package/src/internal/store/deposit.ts +4 -4
- package/src/internal/store/index.ts +0 -1
- package/src/internal/store/store.ts +9 -9
- package/src/internal/store/withdraw.ts +4 -4
- package/src/internal/subscribe/recall-state.ts +1 -1
- package/src/internal/subscribe/subscribe-to-root-atoms.ts +1 -12
- package/src/internal/subscribe/subscribe-to-transaction.ts +3 -2
- package/src/internal/transaction/build-transaction.ts +3 -2
- package/src/internal/transaction/index.ts +1 -23
- package/src/internal/transaction/is-root-store.ts +4 -1
- package/src/internal/transaction/transaction-meta-progress.ts +22 -0
- package/src/main/atom.ts +1 -2
- package/src/main/find-state.ts +5 -5
- package/src/main/get-state.ts +4 -4
- package/src/main/realm.ts +2 -2
- package/src/main/set-state.ts +10 -10
- package/src/react/parse-state-overloads.ts +3 -3
- package/src/react/use-i.ts +6 -4
- package/src/react/use-loadable.ts +4 -30
- package/src/react/use-o.ts +6 -4
- package/src/react-devtools/store.ts +6 -6
- package/src/realtime/index.ts +1 -0
- package/src/realtime/mutex-store.ts +11 -0
- package/src/realtime/realtime-continuity.ts +1 -5
- package/src/realtime-client/pull-atom-family-member.ts +14 -17
- package/src/realtime-client/pull-atom.ts +1 -1
- package/src/realtime-client/pull-mutable-atom-family-member.ts +16 -12
- package/src/realtime-client/pull-selector-family-member.ts +8 -35
- package/src/realtime-client/pull-selector-roots.ts +90 -0
- package/src/realtime-client/pull-selector.ts +2 -27
- package/src/realtime-client/push-state.ts +33 -5
- package/src/realtime-client/realtime-client-stores/client-main-store.ts +2 -5
- package/src/realtime-react/index.ts +2 -1
- package/src/realtime-react/realtime-context.tsx +9 -5
- package/src/realtime-react/use-pull-atom-family-member.ts +2 -3
- package/src/realtime-react/use-pull-mutable-family-member.ts +2 -3
- package/src/realtime-react/use-pull-selector-family-member.ts +5 -6
- package/src/realtime-react/use-push.ts +7 -3
- package/src/realtime-react/use-realtime-service.ts +11 -11
- package/src/realtime-react/use-single-effect.ts +11 -14
- package/src/realtime-server/{realtime-server-stores/server-sync-store.ts → continuity/continuity-store.ts} +1 -1
- package/src/realtime-server/continuity/prepare-to-sync-realtime-continuity.ts +1 -1
- package/src/realtime-server/continuity/prepare-to-track-client-acknowledgement.ts +3 -5
- package/src/realtime-server/continuity/subscribe-to-continuity-actions.ts +1 -1
- package/src/realtime-server/employ-socket.ts +14 -0
- package/src/realtime-server/index.ts +2 -20
- package/src/realtime-server/ipc-sockets/child-socket.ts +125 -66
- package/src/realtime-server/ipc-sockets/custom-socket.ts +16 -14
- package/src/realtime-server/ipc-sockets/parent-socket.ts +81 -58
- package/src/realtime-server/realtime-family-provider.ts +78 -29
- package/src/realtime-server/realtime-mutable-family-provider.ts +80 -31
- package/src/realtime-server/realtime-mutable-provider.ts +30 -22
- package/src/realtime-server/realtime-server-stores/index.ts +0 -2
- package/src/realtime-server/realtime-server-stores/server-room-external-store.ts +77 -36
- package/src/realtime-server/realtime-server-stores/server-user-store.ts +12 -1
- package/src/realtime-server/realtime-state-provider.ts +30 -29
- package/src/realtime-server/realtime-state-receiver.ts +62 -16
- package/src/realtime-server/server-config.ts +9 -0
- package/src/realtime-server/socket-interface.ts +14 -0
- package/src/realtime-testing/setup-realtime-test.tsx +56 -23
- package/src/web/index.ts +1 -1
- package/src/web/{persist-sync.ts → storage-sync.ts} +5 -2
- package/src/internal/store/mint-or-counterfeit.ts +0 -108
- package/src/realtime-react/on-mount.ts +0 -5
- package/src/realtime-server/realtime-server-stores/server-room-external-actions.ts +0 -79
package/dist/realtime/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { mutexAtoms } from "../mutex-store-CSvxY9i3.js";
|
|
2
|
+
import { DEFAULT_USER_IN_ROOM_META, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex } from "../shared-room-store-COGGKqes.js";
|
|
1
3
|
import { IMPLICIT, assignTransactionToContinuity, setEpochNumberOfContinuity } from "atom.io/internal";
|
|
2
|
-
import { getInternalRelations, join, mutableAtom, selectorFamily } from "atom.io";
|
|
3
|
-
import { SetRTX } from "atom.io/transceivers/set-rtx";
|
|
4
4
|
|
|
5
5
|
//#region src/realtime/realtime-continuity.ts
|
|
6
6
|
var InvariantMap = class extends Map {
|
|
@@ -14,9 +14,6 @@ var InvariantMap = class extends Map {
|
|
|
14
14
|
}
|
|
15
15
|
return super.set(key, value);
|
|
16
16
|
}
|
|
17
|
-
clear() {
|
|
18
|
-
throw new Error(`Cannot clear an InvariantMap`);
|
|
19
|
-
}
|
|
20
17
|
};
|
|
21
18
|
var SyncGroup = class SyncGroup {
|
|
22
19
|
type = `continuity`;
|
|
@@ -76,32 +73,5 @@ function continuity(options) {
|
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
//#endregion
|
|
79
|
-
|
|
80
|
-
const usersInThisRoomIndex = mutableAtom({
|
|
81
|
-
key: `usersInRoomIndex`,
|
|
82
|
-
class: SetRTX
|
|
83
|
-
});
|
|
84
|
-
const roomIndex = mutableAtom({
|
|
85
|
-
key: `roomIndex`,
|
|
86
|
-
class: SetRTX
|
|
87
|
-
});
|
|
88
|
-
const DEFAULT_USER_IN_ROOM_META = { enteredAtEpoch: 0 };
|
|
89
|
-
const usersInRooms = join({
|
|
90
|
-
key: `usersInRooms`,
|
|
91
|
-
between: [`room`, `user`],
|
|
92
|
-
cardinality: `1:n`,
|
|
93
|
-
isAType: (input) => typeof input === `string`,
|
|
94
|
-
isBType: (input) => typeof input === `string`
|
|
95
|
-
}, DEFAULT_USER_IN_ROOM_META);
|
|
96
|
-
const usersInMyRoomView = selectorFamily({
|
|
97
|
-
key: `usersInMyRoomView`,
|
|
98
|
-
get: (myUsername) => ({ find }) => {
|
|
99
|
-
const usersInRoomsAtoms = getInternalRelations(usersInRooms);
|
|
100
|
-
const myRoomIndex = find(usersInRoomsAtoms, myUsername);
|
|
101
|
-
return [myRoomIndex];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
//#endregion
|
|
106
|
-
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
|
|
76
|
+
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, mutexAtoms, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
|
|
107
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/realtime/realtime-continuity.ts"],"sourcesContent":["import type {\n\tAtomFamilyToken,\n\tAtomToken,\n\tReadableFamilyToken,\n\tReadableToken,\n\tTokenType,\n\tTransactionToken,\n} from \"atom.io\"\nimport {\n\tassignTransactionToContinuity,\n\tIMPLICIT,\n\tsetEpochNumberOfContinuity,\n} from \"atom.io/internal\"\nimport type { Canonical } from \"atom.io/json\"\nimport type { UserKey } from \"atom.io/realtime-server\"\n\n/* eslint-disable no-console */\n\nexport class InvariantMap<K, V> extends Map<K, V> implements ReadonlyMap<K, V> {\n\tpublic set(key: K, value: V): this {\n\t\tif (this.has(key)) {\n\t\t\tconsole.warn(`Tried to set a key that already exists in an InvariantMap`, {\n\t\t\t\tkey,\n\t\t\t\tvalue,\n\t\t\t})\n\t\t\treturn this\n\t\t}\n\t\treturn super.set(key, value)\n\t}\n}\n\nexport type PerspectiveToken<F extends AtomFamilyToken<any>> = {\n\ttype: `realtime_perspective`\n\tresourceAtoms: F\n\tviewAtoms: ReadableFamilyToken<ReadableToken<TokenType<F>>[], UserKey>\n}\n\nexport type ContinuityToken = {\n\treadonly type: `continuity`\n\treadonly key: string\n\treadonly globals: AtomToken<any>[]\n\treadonly actions: TransactionToken<any>[]\n\treadonly perspectives: PerspectiveToken<AtomFamilyToken<any, Canonical>>[]\n}\n\nexport class SyncGroup {\n\tpublic type = `continuity` as const\n\n\tprotected globals: AtomToken<any>[] = []\n\tprotected actions: TransactionToken<any>[] = []\n\tprotected perspectives: PerspectiveToken<any>[] = []\n\tprotected readonly key: string\n\n\tprotected constructor(key: string) {\n\t\tthis.key = key\n\t}\n\n\tpublic static existing: InvariantMap<string, ContinuityToken> =\n\t\tnew InvariantMap()\n\tpublic static create(\n\t\tkey: string,\n\t\tbuilder: (group: SyncGroup) => SyncGroup,\n\t): ContinuityToken {\n\t\tconst group = new SyncGroup(key)\n\t\tconst { type, globals, actions, perspectives } = builder(group)\n\t\tconst token = { type, key, globals, actions, perspectives }\n\t\tSyncGroup.existing.set(key, token)\n\t\treturn token\n\t}\n\n\tpublic add(...atoms: AtomToken<any>[]): SyncGroup\n\tpublic add(...args: TransactionToken<any>[]): SyncGroup\n\tpublic add<\n\t\tF extends AtomFamilyToken<any>,\n\t\tT extends F extends AtomFamilyToken<infer U> ? U : never,\n\t>(\n\t\tfamily: AtomFamilyToken<T, any>,\n\t\tindex: ReadableFamilyToken<Iterable<AtomToken<T>>, string>,\n\t): SyncGroup\n\tpublic add(\n\t\t...args:\n\t\t\t| readonly AtomToken<any>[]\n\t\t\t| readonly TransactionToken<any>[]\n\t\t\t| [AtomFamilyToken<any, any>, ReadableFamilyToken<Iterable<any>, string>]\n\t): this {\n\t\tconst zeroth = args[0]\n\t\tswitch (zeroth.type) {\n\t\t\tcase `atom`:\n\t\t\tcase `mutable_atom`:\n\t\t\t\tthis.globals.push(...(args as AtomToken<any>[]))\n\t\t\t\tbreak\n\t\t\tcase `transaction`:\n\t\t\t\tthis.actions.push(...(args as TransactionToken<any>[]))\n\t\t\t\tbreak\n\t\t\tcase `atom_family`:\n\t\t\tcase `mutable_atom_family`:\n\t\t\t\t{\n\t\t\t\t\tconst [family, index] = args as [\n\t\t\t\t\t\tAtomFamilyToken<any, any>,\n\t\t\t\t\t\tReadableFamilyToken<ReadableToken<any>[], UserKey>,\n\t\t\t\t\t]\n\t\t\t\t\tthis.perspectives.push({\n\t\t\t\t\t\ttype: `realtime_perspective`,\n\t\t\t\t\t\tresourceAtoms: family,\n\t\t\t\t\t\tviewAtoms: index,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t}\n\n\t\treturn this\n\t}\n}\n\nexport type ContinuityOptions = {\n\tkey: string\n\tconfig: (group: SyncGroup) => SyncGroup\n}\n\nexport function continuity(options: ContinuityOptions): ContinuityToken {\n\tconst { key, config } = options\n\tconst token = SyncGroup.create(key, config)\n\tconst { actions } = token\n\tfor (const action of actions) {\n\t\tassignTransactionToContinuity(IMPLICIT.STORE, key, action.key)\n\t}\n\tsetEpochNumberOfContinuity(IMPLICIT.STORE, key, -1)\n\treturn token\n}\n\n// const counterStates = atomFamily<number, { c: string }>({\n// \tkey: `counter`,\n// \tdefault: 0,\n// })\n// const counterIndices = atomFamily<{ c: string }[], string>({\n// \tkey: `counterIndex`,\n// \tdefault: [],\n// })\n// const nameStates = atomFamily<number, { n: string }>({\n// \tkey: `name`,\n// \tdefault: 0,\n// })\n// const nameIndices = atomFamily<{ n: string }[], string>({\n// \tkey: `nameIndex`,\n// \tdefault: [],\n// })\n\n// const counterContinuity = continuity({\n// \tkey: `counter`,\n// \tconfig: (group) =>\n// \t\tgroup\n// \t\t\t.add(counterStates, counterIndices)\n// \t\t\t.add(nameStates, nameIndices)\n// \t\t\t.add(nameStates, nameIndices)\n// \t\t\t.add(nameStates, nameIndices),\n// })\n"],"mappings":";;;;;AAkBA,IAAa,eAAb,cAAwC,IAAuC;CAC9E,AAAO,IAAI,KAAQ,OAAgB;AAClC,MAAI,KAAK,IAAI,MAAM;AAClB,WAAQ,KAAK,6DAA6D;IACzE;IACA;;AAED,UAAO;;AAER,SAAO,MAAM,IAAI,KAAK;;;AAkBxB,IAAa,YAAb,MAAa,UAAU;CACtB,AAAO,OAAO;CAEd,AAAU,UAA4B;CACtC,AAAU,UAAmC;CAC7C,AAAU,eAAwC;CAClD,AAAmB;CAEnB,AAAU,YAAY,KAAa;AAClC,OAAK,MAAM;;CAGZ,OAAc,WACb,IAAI;CACL,OAAc,OACb,KACA,SACkB;EAClB,MAAM,QAAQ,IAAI,UAAU;EAC5B,MAAM,EAAE,MAAM,SAAS,SAAS,iBAAiB,QAAQ;EACzD,MAAM,QAAQ;GAAE;GAAM;GAAK;GAAS;GAAS;;AAC7C,YAAU,SAAS,IAAI,KAAK;AAC5B,SAAO;;CAYR,AAAO,IACN,GAAG,MAII;EACP,MAAM,SAAS,KAAK;AACpB,UAAQ,OAAO,MAAf;GACC,KAAK;GACL,KAAK;AACJ,SAAK,QAAQ,KAAK,GAAI;AACtB;GACD,KAAK;AACJ,SAAK,QAAQ,KAAK,GAAI;AACtB;GACD,KAAK;GACL,KAAK;IACJ;KACC,MAAM,CAAC,QAAQ,SAAS;AAIxB,UAAK,aAAa,KAAK;MACtB,MAAM;MACN,eAAe;MACf,WAAW;;;AAGb;;AAGF,SAAO;;;AAST,SAAgB,WAAW,SAA6C;CACvE,MAAM,EAAE,KAAK,WAAW;CACxB,MAAM,QAAQ,UAAU,OAAO,KAAK;CACpC,MAAM,EAAE,YAAY;AACpB,MAAK,MAAM,UAAU,QACpB,+BAA8B,SAAS,OAAO,KAAK,OAAO;AAE3D,4BAA2B,SAAS,OAAO,KAAK;AAChD,QAAO"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fn, RootStore, Store, Transceiver } from "atom.io/internal";
|
|
2
|
-
import { Json } from "atom.io/json";
|
|
3
2
|
import * as AtomIO from "atom.io";
|
|
4
3
|
import { AtomToken, WritableToken } from "atom.io";
|
|
4
|
+
import { Canonical, Json } from "atom.io/json";
|
|
5
5
|
import { ContinuityToken } from "atom.io/realtime";
|
|
6
6
|
import { Socket } from "atom.io/realtime-server";
|
|
7
7
|
import { Socket as Socket$1 } from "socket.io-client";
|
|
@@ -16,22 +16,22 @@ declare function useConcealState(store: Store): (concealed: AtomToken<unknown>[]
|
|
|
16
16
|
declare function useRevealState(store: Store): (revealed: Json.Array) => void;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/realtime-client/pull-atom.d.ts
|
|
19
|
-
declare function pullAtom<J extends Json.Serializable>(store: Store, socket: Socket$1, token: AtomIO.RegularAtomToken<J>): () => void;
|
|
19
|
+
declare function pullAtom<J extends Json.Serializable>(store: Store, socket: Socket$1, token: AtomIO.RegularAtomToken<J, any, any>): () => void;
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/realtime-client/pull-atom-family-member.d.ts
|
|
22
|
-
declare function pullAtomFamilyMember<J extends Json.Serializable>(store: Store, socket: Socket$1,
|
|
22
|
+
declare function pullAtomFamilyMember<J extends Json.Serializable, K extends Canonical>(store: Store, socket: Socket$1, family: AtomIO.AtomFamilyToken<J, K, any>, key: NoInfer<K>): () => void;
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/realtime-client/pull-mutable-atom.d.ts
|
|
25
25
|
declare function pullMutableAtom<T extends Transceiver<any, any, any>>(store: Store, socket: Socket$1, token: AtomIO.MutableAtomToken<T>): () => void;
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/realtime-client/pull-mutable-atom-family-member.d.ts
|
|
28
|
-
declare function pullMutableAtomFamilyMember<T extends Transceiver<any, any, any
|
|
28
|
+
declare function pullMutableAtomFamilyMember<T extends Transceiver<any, any, any>, K extends Canonical>(store: Store, socket: Socket$1, family: AtomIO.MutableAtomFamilyToken<T, K>, key: NoInfer<K>): () => void;
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/realtime-client/pull-selector.d.ts
|
|
31
31
|
declare function pullSelector<T>(store: Store, socket: Socket$1, token: AtomIO.SelectorToken<T>): () => void;
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/realtime-client/pull-selector-family-member.d.ts
|
|
34
|
-
declare function pullSelectorFamilyMember<T>(store: Store, socket: Socket$1,
|
|
34
|
+
declare function pullSelectorFamilyMember<T, K extends Canonical>(store: Store, socket: Socket$1, familyToken: AtomIO.SelectorFamilyToken<T, K>, key: NoInfer<K>): () => void;
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/realtime-client/push-state.d.ts
|
|
37
37
|
declare function pushState<J extends Json.Serializable>(store: Store, socket: Socket$1, token: WritableToken<J>): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined>","myIdState: AtomIO.ReadonlyPureSelectorToken<string | undefined>","myUsernameState: AtomIO.RegularAtomToken<string | null>","optimisticUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>","confirmedUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>"],"sources":["../../src/realtime-client/continuity/register-and-attempt-confirmed-update.ts","../../src/realtime-client/continuity/use-conceal-state.ts","../../src/realtime-client/continuity/use-reveal-state.ts","../../src/realtime-client/pull-atom.ts","../../src/realtime-client/pull-atom-family-member.ts","../../src/realtime-client/pull-mutable-atom.ts","../../src/realtime-client/pull-mutable-atom-family-member.ts","../../src/realtime-client/pull-selector.ts","../../src/realtime-client/pull-selector-family-member.ts","../../src/realtime-client/push-state.ts","../../src/realtime-client/realtime-client-stores/client-main-store.ts","../../src/realtime-client/realtime-client-stores/client-sync-store.ts","../../src/realtime-client/server-action.ts","../../src/realtime-client/sync-continuity.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAea,8CAEJ,0CAEC,2BACW,MAAA,CAAO,wBACzB,MAAA,CAAO,iBAAiB,0BAEP,MAAA,CAAO,wBACxB,MAAA,CAAO,iBAAiB,uBAId,MAAA,CAAO,wBAAwB,MAAA,CAAO,iBAAiB;;;iBCxBpD,eAAA,QAAuB,oBACnB;;;iBCFJ,cAAA,QAAsB,mBACnB,IAAA,CAAK;;;iBCCR,mBAAmB,IAAA,CAAK,qBAChC,eACC,iBACD,MAAA,CAAO,iBAAiB;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined>","myIdState: AtomIO.ReadonlyPureSelectorToken<string | undefined>","myUsernameState: AtomIO.RegularAtomToken<string | null>","optimisticUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>","confirmedUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>"],"sources":["../../src/realtime-client/continuity/register-and-attempt-confirmed-update.ts","../../src/realtime-client/continuity/use-conceal-state.ts","../../src/realtime-client/continuity/use-reveal-state.ts","../../src/realtime-client/pull-atom.ts","../../src/realtime-client/pull-atom-family-member.ts","../../src/realtime-client/pull-mutable-atom.ts","../../src/realtime-client/pull-mutable-atom-family-member.ts","../../src/realtime-client/pull-selector.ts","../../src/realtime-client/pull-selector-family-member.ts","../../src/realtime-client/push-state.ts","../../src/realtime-client/realtime-client-stores/client-main-store.ts","../../src/realtime-client/realtime-client-stores/client-sync-store.ts","../../src/realtime-client/server-action.ts","../../src/realtime-client/sync-continuity.ts"],"sourcesContent":[],"mappings":";;;;;;;;;cAea,8CAEJ,0CAEC,2BACW,MAAA,CAAO,wBACzB,MAAA,CAAO,iBAAiB,0BAEP,MAAA,CAAO,wBACxB,MAAA,CAAO,iBAAiB,uBAId,MAAA,CAAO,wBAAwB,MAAA,CAAO,iBAAiB;;;iBCxBpD,eAAA,QAAuB,oBACnB;;;iBCFJ,cAAA,QAAsB,mBACnB,IAAA,CAAK;;;iBCCR,mBAAmB,IAAA,CAAK,qBAChC,eACC,iBACD,MAAA,CAAO,iBAAiB;;;iBCHhB,+BACL,IAAA,CAAK,wBACL,kBAEH,eACC,kBACA,MAAA,CAAO,gBAAgB,GAAG,cAC7B,QAAQ;;;iBCPE,0BAA0B,mCAClC,eACC,iBACD,MAAA,CAAO,iBAAiB;;;iBCGhB,sCACL,sCACA,kBAEH,eACC,kBACA,MAAA,CAAO,uBAAuB,GAAG,SACpC,QAAQ;;;iBCZE,uBACR,eACC,iBACD,MAAA,CAAO,cAAc;;;iBCDb,sCAAsC,kBAC9C,eACC,uBACK,MAAA,CAAO,oBAAoB,GAAG,SACtC,QAAQ;;;iBCJE,oBAAoB,IAAA,CAAK,qBACjC,eACC,iBACD,cAAc;;;cCRTA,qBAAqB,MAAA,CAAO;cAK5BC,WAAW,MAAA,CAAO;cAMlBC,iBAAiB,MAAA,CAAO;;;cCZxBC,uBAAuB,MAAA,CAAO,iBAC1C,MAAA,CAAO;cAMKC,sBAAsB,MAAA,CAAO,iBACzC,MAAA,CAAO;;;iBCLQ,uBAAuB,WAC/B,eACC,iBACD,MAAA,CAAO,iBAAiB;;;iBCahB,cAAA,QACR,mBACC,sBACI"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { mutexAtoms } from "../mutex-store-CSvxY9i3.js";
|
|
2
|
+
import { employSocket } from "../employ-socket-D6wgByWh.js";
|
|
3
|
+
import { actUponStore, assignTransactionToContinuity, disposeAtom, findInStore, getEpochNumberOfContinuity, getFamilyOfToken, getFromStore, getJsonToken, getUpdateToken, ingestTransactionOutcomeEvent, setEpochNumberOfContinuity, setIntoStore, subscribeToState, subscribeToTransaction } from "atom.io/internal";
|
|
3
4
|
import * as AtomIO from "atom.io";
|
|
4
|
-
import {
|
|
5
|
+
import { parseJson } from "atom.io/json";
|
|
6
|
+
import { storageSync } from "atom.io/web";
|
|
5
7
|
import { confirmedUpdateQueue as confirmedUpdateQueue$1, optimisticUpdateQueue as optimisticUpdateQueue$1 } from "atom.io/realtime-client";
|
|
6
8
|
|
|
7
9
|
//#region src/realtime-client/continuity/register-and-attempt-confirmed-update.ts
|
|
@@ -138,19 +140,15 @@ function pullAtom(store, socket, token) {
|
|
|
138
140
|
|
|
139
141
|
//#endregion
|
|
140
142
|
//#region src/realtime-client/pull-atom-family-member.ts
|
|
141
|
-
function pullAtomFamilyMember(store, socket,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return () => {};
|
|
145
|
-
}
|
|
146
|
-
const { key: familyKey, subKey: serializedSubKey } = token.family;
|
|
147
|
-
const subKey = parseJson(serializedSubKey);
|
|
148
|
-
socket?.on(`serve:${token.key}`, (data) => {
|
|
143
|
+
function pullAtomFamilyMember(store, socket, family, key) {
|
|
144
|
+
const token = findInStore(store, family, key);
|
|
145
|
+
const setServedValue = (data) => {
|
|
149
146
|
setIntoStore(store, token, data);
|
|
150
|
-
}
|
|
151
|
-
socket?.
|
|
147
|
+
};
|
|
148
|
+
socket?.on(`serve:${token.key}`, setServedValue);
|
|
149
|
+
socket?.emit(`sub:${family.key}`, key);
|
|
152
150
|
return () => {
|
|
153
|
-
socket?.off(`serve:${token.key}
|
|
151
|
+
socket?.off(`serve:${token.key}`, setServedValue);
|
|
154
152
|
socket?.emit(`unsub:${token.key}`);
|
|
155
153
|
};
|
|
156
154
|
}
|
|
@@ -176,13 +174,8 @@ function pullMutableAtom(store, socket, token) {
|
|
|
176
174
|
|
|
177
175
|
//#endregion
|
|
178
176
|
//#region src/realtime-client/pull-mutable-atom-family-member.ts
|
|
179
|
-
function pullMutableAtomFamilyMember(store, socket,
|
|
180
|
-
|
|
181
|
-
console.error(`Token is not a family member:`, token);
|
|
182
|
-
return () => {};
|
|
183
|
-
}
|
|
184
|
-
const { key: familyKey, subKey: serializedSubKey } = token.family;
|
|
185
|
-
const subKey = parseJson(serializedSubKey);
|
|
177
|
+
function pullMutableAtomFamilyMember(store, socket, family, key) {
|
|
178
|
+
const token = findInStore(store, family, key);
|
|
186
179
|
socket.on(`init:${token.key}`, (data) => {
|
|
187
180
|
const jsonToken = getJsonToken(store, token);
|
|
188
181
|
setIntoStore(store, jsonToken, data);
|
|
@@ -191,7 +184,7 @@ function pullMutableAtomFamilyMember(store, socket, token) {
|
|
|
191
184
|
const trackerToken = getUpdateToken(token);
|
|
192
185
|
setIntoStore(store, trackerToken, data);
|
|
193
186
|
});
|
|
194
|
-
socket.emit(`sub:${
|
|
187
|
+
socket.emit(`sub:${family.key}`, key);
|
|
195
188
|
return () => {
|
|
196
189
|
socket.off(`serve:${token.key}`);
|
|
197
190
|
socket.emit(`unsub:${token.key}`);
|
|
@@ -199,62 +192,92 @@ function pullMutableAtomFamilyMember(store, socket, token) {
|
|
|
199
192
|
}
|
|
200
193
|
|
|
201
194
|
//#endregion
|
|
202
|
-
//#region src/realtime-client/pull-selector.ts
|
|
203
|
-
function
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
195
|
+
//#region src/realtime-client/pull-selector-roots.ts
|
|
196
|
+
function pullSelectorRoots(store, socket, selectorToken) {
|
|
197
|
+
const atomSubscriptions = /* @__PURE__ */ new Map();
|
|
198
|
+
const clearAtomSubscriptions = () => {
|
|
199
|
+
for (const [, unsub] of atomSubscriptions) unsub();
|
|
200
|
+
atomSubscriptions.clear();
|
|
201
|
+
};
|
|
202
|
+
const start = () => {
|
|
203
|
+
const atomKeys = store.selectorAtoms.getRelatedKeys(selectorToken.key);
|
|
204
|
+
if (atomKeys) {
|
|
205
|
+
for (const [atomKey, unsub] of atomSubscriptions) if (!atomKeys.has(atomKey)) {
|
|
206
|
+
unsub();
|
|
207
|
+
atomSubscriptions.delete(atomKey);
|
|
208
|
+
}
|
|
209
|
+
for (const atomKey of atomKeys) {
|
|
210
|
+
if (atomSubscriptions.has(atomKey)) continue;
|
|
211
|
+
const atom = store.atoms.get(atomKey);
|
|
212
|
+
switch (atom.type) {
|
|
213
|
+
case `atom`:
|
|
214
|
+
if (atom.family) {
|
|
215
|
+
const { subKey: serializedSubKey } = atom.family;
|
|
216
|
+
const subKey = parseJson(serializedSubKey);
|
|
217
|
+
const family = getFamilyOfToken(store, atom);
|
|
218
|
+
atomSubscriptions.set(atomKey, pullAtomFamilyMember(store, socket, family, subKey));
|
|
219
|
+
} else atomSubscriptions.set(atomKey, pullAtom(store, socket, atom));
|
|
220
|
+
break;
|
|
221
|
+
case `mutable_atom`:
|
|
222
|
+
if (atom.family) {
|
|
223
|
+
const { subKey: serializedSubKey } = atom.family;
|
|
224
|
+
const subKey = parseJson(serializedSubKey);
|
|
225
|
+
const family = getFamilyOfToken(store, atom);
|
|
226
|
+
atomSubscriptions.set(atomKey, pullMutableAtomFamilyMember(store, socket, family, subKey));
|
|
227
|
+
} else atomSubscriptions.set(atomKey, pullMutableAtom(store, socket, atom));
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
216
231
|
}
|
|
217
|
-
}
|
|
232
|
+
};
|
|
233
|
+
const unsubFromSelector = subscribeToState(store, selectorToken, `pull-watches-dependencies`, () => {
|
|
234
|
+
start();
|
|
235
|
+
});
|
|
236
|
+
start();
|
|
218
237
|
return () => {
|
|
219
|
-
|
|
238
|
+
clearAtomSubscriptions();
|
|
239
|
+
unsubFromSelector();
|
|
220
240
|
};
|
|
221
241
|
}
|
|
222
242
|
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/realtime-client/pull-selector.ts
|
|
245
|
+
function pullSelector(store, socket, token) {
|
|
246
|
+
return pullSelectorRoots(store, socket, token);
|
|
247
|
+
}
|
|
248
|
+
|
|
223
249
|
//#endregion
|
|
224
250
|
//#region src/realtime-client/pull-selector-family-member.ts
|
|
225
|
-
function pullSelectorFamilyMember(store, socket,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return () => {};
|
|
229
|
-
}
|
|
230
|
-
const atomKeys = store.selectorAtoms.getRelatedKeys(token.key);
|
|
231
|
-
const unsubscribes = [];
|
|
232
|
-
if (atomKeys) for (const atomKey of atomKeys) {
|
|
233
|
-
const atom = store.atoms.get(atomKey);
|
|
234
|
-
if (!atom) continue;
|
|
235
|
-
switch (atom.type) {
|
|
236
|
-
case `atom`:
|
|
237
|
-
unsubscribes.push(pullAtomFamilyMember(store, socket, atom));
|
|
238
|
-
break;
|
|
239
|
-
case `mutable_atom`:
|
|
240
|
-
unsubscribes.push(pullMutableAtomFamilyMember(store, socket, atom));
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return () => {
|
|
245
|
-
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
246
|
-
};
|
|
251
|
+
function pullSelectorFamilyMember(store, socket, familyToken, key) {
|
|
252
|
+
const token = findInStore(store, familyToken, key);
|
|
253
|
+
return pullSelectorRoots(store, socket, token);
|
|
247
254
|
}
|
|
248
255
|
|
|
249
256
|
//#endregion
|
|
250
257
|
//#region src/realtime-client/push-state.ts
|
|
251
258
|
function pushState(store, socket, token) {
|
|
252
|
-
|
|
253
|
-
subscribeToState(store, token, `push`, ({ newValue }) => {
|
|
259
|
+
const publish = (newValue) => {
|
|
254
260
|
socket.emit(`pub:${token.key}`, newValue);
|
|
255
|
-
}
|
|
261
|
+
};
|
|
262
|
+
const subscriptions = /* @__PURE__ */ new Set();
|
|
263
|
+
const clearSubscriptions = () => {
|
|
264
|
+
for (const unsub of subscriptions) unsub();
|
|
265
|
+
subscriptions.clear();
|
|
266
|
+
};
|
|
267
|
+
const init = () => {
|
|
268
|
+
subscriptions.add(employSocket(socket, `claim-result:${token.key}`, (success) => {
|
|
269
|
+
if (!success) return;
|
|
270
|
+
clearSubscriptions();
|
|
271
|
+
setIntoStore(store, mutexAtoms, token.key, true);
|
|
272
|
+
subscriptions.add(subscribeToState(store, token, `push`, ({ newValue }) => {
|
|
273
|
+
publish(newValue);
|
|
274
|
+
}));
|
|
275
|
+
}));
|
|
276
|
+
socket.emit(`claim:${token.key}`);
|
|
277
|
+
};
|
|
278
|
+
init();
|
|
256
279
|
return () => {
|
|
257
|
-
|
|
280
|
+
clearSubscriptions();
|
|
258
281
|
socket.emit(`unclaim:${token.key}`);
|
|
259
282
|
};
|
|
260
283
|
}
|
|
@@ -272,7 +295,7 @@ const myIdState = AtomIO.selector({
|
|
|
272
295
|
const myUsernameState = AtomIO.atom({
|
|
273
296
|
key: `myName`,
|
|
274
297
|
default: null,
|
|
275
|
-
effects:
|
|
298
|
+
effects: [storageSync(globalThis.localStorage, JSON, `myUsername`)]
|
|
276
299
|
});
|
|
277
300
|
|
|
278
301
|
//#endregion
|
|
@@ -324,9 +347,9 @@ function syncContinuity(store, socket, continuity) {
|
|
|
324
347
|
const registerAndAttemptConfirmedUpdate = useRegisterAndAttemptConfirmedUpdate(store, continuityKey, socket, optimisticUpdates, confirmedUpdates);
|
|
325
348
|
socket.off(`tx-new:${continuityKey}`);
|
|
326
349
|
socket.on(`tx-new:${continuityKey}`, registerAndAttemptConfirmedUpdate);
|
|
327
|
-
const unsubscribeFunctions = continuity.actions.map((transaction) => {
|
|
328
|
-
assignTransactionToContinuity(store, continuityKey, transaction.key);
|
|
329
|
-
const unsubscribeFromTransactionUpdates = subscribeToTransaction(store, transaction, `tx-run:${continuityKey}`, (clientUpdate) => {
|
|
350
|
+
const unsubscribeFunctions = continuity.actions.map((transaction$1) => {
|
|
351
|
+
assignTransactionToContinuity(store, continuityKey, transaction$1.key);
|
|
352
|
+
const unsubscribeFromTransactionUpdates = subscribeToTransaction(store, transaction$1, `tx-run:${continuityKey}`, (clientUpdate) => {
|
|
330
353
|
store.logger.info(`🤞`, `continuity`, continuityKey, `enqueuing optimistic update`);
|
|
331
354
|
const optimisticUpdateIndex = optimisticUpdates.findIndex((update) => update.id === clientUpdate.id);
|
|
332
355
|
if (optimisticUpdateIndex === -1) {
|
|
@@ -345,7 +368,7 @@ function syncContinuity(store, socket, continuity) {
|
|
|
345
368
|
}
|
|
346
369
|
socket.emit(`tx-run:${continuityKey}`, {
|
|
347
370
|
id: clientUpdate.id,
|
|
348
|
-
token: transaction,
|
|
371
|
+
token: transaction$1,
|
|
349
372
|
params: clientUpdate.params
|
|
350
373
|
});
|
|
351
374
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["optimisticUpdateQueue","confirmedUpdateQueue","continuityEpoch: number | undefined","k: any","v: any","unsubscribes: Array<() => void>","unsubscribes: Array<() => void>","myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined>","myIdState: AtomIO.ReadonlyPureSelectorToken<string | undefined>","myUsernameState: AtomIO.RegularAtomToken<string | null>","optimisticUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>","confirmedUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>","optimisticUpdateQueue","confirmedUpdateQueue","k: any","v: any"],"sources":["../../src/realtime-client/continuity/register-and-attempt-confirmed-update.ts","../../src/realtime-client/continuity/use-conceal-state.ts","../../src/realtime-client/continuity/use-reveal-state.ts","../../src/realtime-client/pull-atom.ts","../../src/realtime-client/pull-atom-family-member.ts","../../src/realtime-client/pull-mutable-atom.ts","../../src/realtime-client/pull-mutable-atom-family-member.ts","../../src/realtime-client/pull-selector.ts","../../src/realtime-client/pull-selector-family-member.ts","../../src/realtime-client/push-state.ts","../../src/realtime-client/realtime-client-stores/client-main-store.ts","../../src/realtime-client/realtime-client-stores/client-sync-store.ts","../../src/realtime-client/server-action.ts","../../src/realtime-client/sync-continuity.ts"],"sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Fn, RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tgetEpochNumberOfContinuity,\n\tingestTransactionOutcomeEvent,\n\tsetEpochNumberOfContinuity,\n\tsetIntoStore,\n} from \"atom.io/internal\"\nimport {\n\tconfirmedUpdateQueue,\n\toptimisticUpdateQueue,\n} from \"atom.io/realtime-client\"\nimport type { Socket } from \"atom.io/realtime-server\"\n\nexport const useRegisterAndAttemptConfirmedUpdate =\n\t(\n\t\tstore: RootStore,\n\t\tcontinuityKey: string,\n\t\tsocket: Socket,\n\t\toptimisticUpdates: AtomIO.TransactionOutcomeEvent<\n\t\t\tAtomIO.TransactionToken<Fn>\n\t\t>[],\n\t\tconfirmedUpdates: AtomIO.TransactionOutcomeEvent<\n\t\t\tAtomIO.TransactionToken<Fn>\n\t\t>[],\n\t) =>\n\t(\n\t\tconfirmed: AtomIO.TransactionOutcomeEvent<AtomIO.TransactionToken<Fn>>,\n\t): void => {\n\t\tfunction reconcileEpoch(\n\t\t\toptimisticUpdate: AtomIO.TransactionOutcomeEvent<\n\t\t\t\tAtomIO.TransactionToken<Fn>\n\t\t\t>,\n\t\t\tconfirmedUpdate: AtomIO.TransactionOutcomeEvent<\n\t\t\t\tAtomIO.TransactionToken<Fn>\n\t\t\t>,\n\t\t): void {\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`reconciling updates`,\n\t\t\t)\n\t\t\tsetIntoStore(store, optimisticUpdateQueue, (queue) => {\n\t\t\t\tqueue.shift()\n\t\t\t\treturn queue\n\t\t\t})\n\t\t\tif (optimisticUpdate.id === confirmedUpdate.id) {\n\t\t\t\tconst clientResult = JSON.stringify(optimisticUpdate.subEvents)\n\t\t\t\tconst serverResult = JSON.stringify(confirmedUpdate.subEvents)\n\t\t\t\tif (clientResult === serverResult) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`✅`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`results for ${optimisticUpdate.id} match between client and server`,\n\t\t\t\t\t)\n\t\t\t\t\tsocket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// id mismatch\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`❌`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`thought update #${confirmedUpdate.epoch} was ${optimisticUpdate.token.key}:${optimisticUpdate.id}, but it was actually ${confirmedUpdate.token.key}:${confirmedUpdate.id}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`updates do not match`,\n\t\t\t\toptimisticUpdate,\n\t\t\t\tconfirmedUpdate,\n\t\t\t)\n\t\t\tconst reversedOptimisticUpdates = optimisticUpdates.toReversed()\n\t\t\tfor (const subsequentOptimistic of reversedOptimisticUpdates) {\n\t\t\t\tingestTransactionOutcomeEvent(store, subsequentOptimistic, `oldValue`)\n\t\t\t}\n\t\t\tstore.logger.info(\n\t\t\t\t`⏪`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`undid optimistic updates:`,\n\t\t\t\treversedOptimisticUpdates,\n\t\t\t)\n\t\t\tingestTransactionOutcomeEvent(store, optimisticUpdate, `oldValue`)\n\t\t\tstore.logger.info(\n\t\t\t\t`⏪`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`undid zeroth optimistic update`,\n\t\t\t\toptimisticUpdate,\n\t\t\t)\n\t\t\tingestTransactionOutcomeEvent(store, confirmedUpdate, `newValue`)\n\t\t\tstore.logger.info(\n\t\t\t\t`⏩`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`applied confirmed update`,\n\t\t\t\tconfirmedUpdate,\n\t\t\t)\n\t\t\tsocket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch)\n\n\t\t\tfor (const subsequentOptimistic of optimisticUpdates) {\n\t\t\t\tconst token = {\n\t\t\t\t\ttype: `transaction`,\n\t\t\t\t\tkey: subsequentOptimistic.token.key,\n\t\t\t\t} as const\n\t\t\t\tconst { id, params } = subsequentOptimistic\n\t\t\t\tactUponStore(store, token, id)(...params)\n\t\t\t}\n\t\t\tstore.logger.info(\n\t\t\t\t`⏩`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`reapplied subsequent optimistic updates:`,\n\t\t\t\toptimisticUpdates,\n\t\t\t)\n\t\t}\n\n\t\tstore.logger.info(\n\t\t\t`🧑⚖️`,\n\t\t\t`continuity`,\n\t\t\tcontinuityKey,\n\t\t\t`integrating confirmed update`,\n\t\t\t{ confirmedUpdate: confirmed, confirmedUpdates, optimisticUpdates },\n\t\t)\n\t\tconst zerothOptimisticUpdate = optimisticUpdates[0]\n\t\tif (zerothOptimisticUpdate) {\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`has optimistic updates to reconcile`,\n\t\t\t)\n\t\t\tif (confirmed.epoch === zerothOptimisticUpdate.epoch) {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🧑⚖️`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`epoch of confirmed update #${confirmed.epoch} matches zeroth optimistic update`,\n\t\t\t\t)\n\t\t\t\treconcileEpoch(zerothOptimisticUpdate, confirmed)\n\t\t\t\tfor (const nextConfirmed of confirmedUpdates) {\n\t\t\t\t\tconst nextOptimistic = optimisticUpdates[0]\n\t\t\t\t\tif (nextConfirmed.epoch === nextOptimistic?.epoch) {\n\t\t\t\t\t\treconcileEpoch(nextOptimistic, nextConfirmed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// epoch mismatch\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🧑⚖️`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`epoch of confirmed update #${confirmed.epoch} does not match zeroth optimistic update #${zerothOptimisticUpdate.epoch}`,\n\t\t\t\t)\n\t\t\t\tconst confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(\n\t\t\t\t\t(update) => update.epoch === confirmed.epoch,\n\t\t\t\t)\n\t\t\t\tif (!confirmedUpdateIsAlreadyEnqueued) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`👈`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`pushing confirmed update to queue`,\n\t\t\t\t\t\tconfirmed,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, confirmedUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue.push(confirmed)\n\t\t\t\t\t\tqueue.sort((a, b) => a.epoch - b.epoch)\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`has no optimistic updates to deal with`,\n\t\t\t)\n\t\t\tlet continuityEpoch: number | undefined\n\t\t\tcontinuityEpoch = getEpochNumberOfContinuity(store, continuityKey)\n\n\t\t\tif (continuityEpoch === confirmed.epoch - 1) {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`✅`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`integrating update #${confirmed.epoch} (${confirmed.token.key} ${confirmed.id})`,\n\t\t\t\t)\n\t\t\t\tingestTransactionOutcomeEvent(store, confirmed, `newValue`)\n\t\t\t\tsocket.emit(`ack:${continuityKey}`, confirmed.epoch)\n\t\t\t\tsetEpochNumberOfContinuity(store, continuityKey, confirmed.epoch)\n\t\t\t} else if (continuityEpoch !== undefined) {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🧑⚖️`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`received update #${confirmed.epoch} but still waiting for update #${\n\t\t\t\t\t\tcontinuityEpoch + 1\n\t\t\t\t\t}`,\n\t\t\t\t\t{\n\t\t\t\t\t\tclientEpoch: continuityEpoch,\n\t\t\t\t\t\tserverEpoch: confirmed.epoch,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tconst confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(\n\t\t\t\t\t(update) => update.epoch === confirmed.epoch,\n\t\t\t\t)\n\t\t\t\tif (confirmedUpdateIsAlreadyEnqueued) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`👍`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`confirmed update #${confirmed.epoch} is already enqueued`,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`👈`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`pushing confirmed update #${confirmed.epoch} to queue`,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, confirmedUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue.push(confirmed)\n\t\t\t\t\t\tqueue.sort((a, b) => a.epoch - b.epoch)\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n","import type { AtomToken } from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { disposeAtom } from \"atom.io/internal\"\n\nexport function useConcealState(store: Store) {\n\treturn (concealed: AtomToken<unknown>[]): void => {\n\t\tfor (const token of concealed) {\n\t\t\tdisposeAtom(store, token)\n\t\t}\n\t}\n}\n","import { setIntoStore, type Store } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\n\nexport function useRevealState(store: Store) {\n\treturn (revealed: Json.Array): void => {\n\t\tlet i = 0\n\t\tlet k: any\n\t\tlet v: any\n\t\tfor (const x of revealed) {\n\t\t\tif (i % 2 === 0) {\n\t\t\t\tk = x\n\t\t\t} else {\n\t\t\t\tv = x\n\t\t\t\tsetIntoStore(store, k, v)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport { setIntoStore, type Store } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pullAtom<J extends Json.Serializable>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.RegularAtomToken<J>,\n): () => void {\n\tconst setServedValue = (data: J) => {\n\t\tsetIntoStore(store, token, data)\n\t}\n\tsocket.on(`serve:${token.key}`, setServedValue)\n\tsocket.emit(`sub:${token.key}`)\n\treturn () => {\n\t\tsocket.off(`serve:${token.key}`, setServedValue)\n\t\tsocket.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport { setIntoStore, type Store } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport { parseJson } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\n/* eslint-disable no-console */\n\nexport function pullAtomFamilyMember<J extends Json.Serializable>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.RegularAtomToken<J>,\n): () => void {\n\tif (!(`family` in token)) {\n\t\tconsole.error(`Token is not a family member:`, token)\n\t\treturn () => {}\n\t}\n\tconst { key: familyKey, subKey: serializedSubKey } = token.family\n\tconst subKey = parseJson(serializedSubKey)\n\tsocket?.on(`serve:${token.key}`, (data: J) => {\n\t\tsetIntoStore(store, token, data)\n\t})\n\tsocket?.emit(`sub:${familyKey}`, subKey)\n\treturn () => {\n\t\tsocket?.off(`serve:${token.key}`)\n\t\tsocket?.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { AsJSON, SignalFrom, Store, Transceiver } from \"atom.io/internal\"\nimport { getJsonToken, getUpdateToken, setIntoStore } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pullMutableAtom<T extends Transceiver<any, any, any>>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.MutableAtomToken<T>,\n): () => void {\n\tconst jsonToken = getJsonToken(store, token)\n\tconst updateToken = getUpdateToken(token)\n\tsocket.on(`init:${token.key}`, (data: AsJSON<T>) => {\n\t\tsetIntoStore(store, jsonToken, data)\n\t})\n\tsocket.on(`next:${token.key}`, (data: SignalFrom<T>) => {\n\t\tsetIntoStore(store, updateToken, data)\n\t})\n\tsocket.emit(`sub:${token.key}`)\n\treturn () => {\n\t\tsocket.off(`init:${token.key}`)\n\t\tsocket.off(`next:${token.key}`)\n\t\tsocket.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { AsJSON, SignalFrom, Store, Transceiver } from \"atom.io/internal\"\nimport { getJsonToken, getUpdateToken, setIntoStore } from \"atom.io/internal\"\nimport { parseJson } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\n/* eslint-disable no-console */\n\nexport function pullMutableAtomFamilyMember<\n\tT extends Transceiver<any, any, any>,\n>(store: Store, socket: Socket, token: AtomIO.MutableAtomToken<T>): () => void {\n\tif (!(`family` in token)) {\n\t\tconsole.error(`Token is not a family member:`, token)\n\t\treturn () => {}\n\t}\n\tconst { key: familyKey, subKey: serializedSubKey } = token.family\n\tconst subKey = parseJson(serializedSubKey)\n\tsocket.on(`init:${token.key}`, (data: AsJSON<T>) => {\n\t\tconst jsonToken = getJsonToken(store, token)\n\t\tsetIntoStore(store, jsonToken, data)\n\t})\n\tsocket.on(`next:${token.key}`, (data: SignalFrom<T>) => {\n\t\tconst trackerToken = getUpdateToken(token)\n\t\tsetIntoStore(store, trackerToken, data)\n\t})\n\tsocket.emit(`sub:${familyKey}`, subKey)\n\treturn () => {\n\t\tsocket.off(`serve:${token.key}`)\n\t\tsocket.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { pullAtom } from \"./pull-atom\"\nimport { pullMutableAtom } from \"./pull-mutable-atom\"\n\nexport function pullSelector<T>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.SelectorToken<T>,\n): () => void {\n\tconst atomKeys = store.selectorAtoms.getRelatedKeys(token.key)\n\tconst unsubscribes: Array<() => void> = []\n\tif (atomKeys) {\n\t\tfor (const atomKey of atomKeys) {\n\t\t\tconst atom = store.atoms.get(atomKey)\n\t\t\tif (!atom) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch (atom.type) {\n\t\t\t\tcase `atom`: {\n\t\t\t\t\tunsubscribes.push(pullAtom(store, socket, atom))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase `mutable_atom`: {\n\t\t\t\t\tunsubscribes.push(pullMutableAtom(store, socket, atom))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn () => {\n\t\tfor (const unsubscribe of unsubscribes) {\n\t\t\tunsubscribe()\n\t\t}\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { pullAtomFamilyMember } from \"./pull-atom-family-member\"\nimport { pullMutableAtomFamilyMember } from \"./pull-mutable-atom-family-member\"\n\n/* eslint-disable no-console */\n\nexport function pullSelectorFamilyMember<T>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.SelectorToken<T>,\n): () => void {\n\tif (!(`family` in token)) {\n\t\tconsole.error(`Token is not a family member:`, token)\n\t\treturn () => {}\n\t}\n\tconst atomKeys = store.selectorAtoms.getRelatedKeys(token.key)\n\tconst unsubscribes: Array<() => void> = []\n\tif (atomKeys) {\n\t\tfor (const atomKey of atomKeys) {\n\t\t\tconst atom = store.atoms.get(atomKey)\n\t\t\tif (!atom) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch (atom.type) {\n\t\t\t\tcase `atom`: {\n\t\t\t\t\tunsubscribes.push(pullAtomFamilyMember(store, socket, atom))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase `mutable_atom`: {\n\t\t\t\t\tunsubscribes.push(pullMutableAtomFamilyMember(store, socket, atom))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn () => {\n\t\tfor (const unsubscribe of unsubscribes) {\n\t\t\tunsubscribe()\n\t\t}\n\t}\n}\n","import type { WritableToken } from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { subscribeToState } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pushState<J extends Json.Serializable>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: WritableToken<J>,\n): () => void {\n\tsocket.emit(`claim:${token.key}`)\n\tsubscribeToState(store, token, `push`, ({ newValue }) => {\n\t\tsocket.emit(`pub:${token.key}`, newValue)\n\t})\n\treturn () => {\n\t\tsocket.off(`pub:${token.key}`)\n\t\tsocket.emit(`unclaim:${token.key}`)\n\t}\n}\n","import * as AtomIO from \"atom.io\"\nimport { persistSync } from \"atom.io/web\"\n\nexport const myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined> =\n\tAtomIO.atom<string | undefined>({\n\t\tkey: `mySocketId__INTERNAL`,\n\t\tdefault: undefined,\n\t})\nexport const myIdState: AtomIO.ReadonlyPureSelectorToken<string | undefined> =\n\tAtomIO.selector<string | undefined>({\n\t\tkey: `mySocketId`,\n\t\tget: ({ get }) => get(myIdState__INTERNAL),\n\t})\n\nexport const myUsernameState: AtomIO.RegularAtomToken<string | null> =\n\tAtomIO.atom<string | null>({\n\t\tkey: `myName`,\n\t\tdefault: null,\n\t\teffects:\n\t\t\ttypeof window === `undefined`\n\t\t\t\t? []\n\t\t\t\t: [persistSync(window.localStorage, JSON, `myUsername`)],\n\t})\n","import * as AtomIO from \"atom.io\"\n\nexport const optimisticUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n> = AtomIO.atom<AtomIO.TransactionOutcomeEvent<any>[]>({\n\tkey: `updateQueue`,\n\tdefault: () => [],\n})\n\nexport const confirmedUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n> = AtomIO.atom<AtomIO.TransactionOutcomeEvent<any>[]>({\n\tkey: `serverConfirmedUpdateQueue`,\n\tdefault: () => [],\n})\n","import type * as AtomIO from \"atom.io\"\nimport type { Fn, Store } from \"atom.io/internal\"\nimport { subscribeToTransaction } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function serverAction<F extends Fn>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.TransactionToken<F>,\n): () => void {\n\tconst unsubscribeFromLocalUpdates = subscribeToTransaction(\n\t\tstore,\n\t\ttoken,\n\t\t`tx-run:${token.key}:${socket.id}`,\n\t\t(clientUpdate) => {\n\t\t\tsocket.emit(`tx-run:${token.key}`, clientUpdate)\n\t\t},\n\t)\n\n\treturn () => {\n\t\tunsubscribeFromLocalUpdates()\n\t}\n}\n","import type { RootStore } from \"atom.io/internal\"\nimport {\n\tassignTransactionToContinuity,\n\tgetFromStore,\n\tgetJsonToken,\n\tsetEpochNumberOfContinuity,\n\tsetIntoStore,\n\tsubscribeToTransaction,\n} from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport type { ContinuityToken } from \"atom.io/realtime\"\nimport {\n\tconfirmedUpdateQueue,\n\toptimisticUpdateQueue,\n} from \"atom.io/realtime-client\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { useRegisterAndAttemptConfirmedUpdate } from \"./continuity/register-and-attempt-confirmed-update\"\nimport { useConcealState } from \"./continuity/use-conceal-state\"\nimport { useRevealState } from \"./continuity/use-reveal-state\"\n\nexport function syncContinuity(\n\tstore: RootStore,\n\tsocket: Socket,\n\tcontinuity: ContinuityToken,\n): () => void {\n\tconst continuityKey = continuity.key\n\tconst optimisticUpdates = getFromStore(store, optimisticUpdateQueue)\n\tconst confirmedUpdates = getFromStore(store, confirmedUpdateQueue)\n\n\tconst initializeContinuity = (epoch: number, payload: Json.Array) => {\n\t\tsocket.off(`continuity-init:${continuityKey}`, initializeContinuity)\n\t\tlet i = 0\n\t\tlet k: any\n\t\tlet v: any\n\t\tfor (const x of payload) {\n\t\t\tif (i % 2 === 0) {\n\t\t\t\tk = x\n\t\t\t} else {\n\t\t\t\tv = x\n\t\t\t\tif (`type` in k && k.type === `mutable_atom`) {\n\t\t\t\t\tk = getJsonToken(store, k)\n\t\t\t\t}\n\t\t\t\tsetIntoStore(store, k, v)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tsetEpochNumberOfContinuity(store, continuityKey, epoch)\n\t}\n\tsocket.off(`continuity-init:${continuityKey}`)\n\tsocket.on(`continuity-init:${continuityKey}`, initializeContinuity)\n\n\tconst registerAndAttemptConfirmedUpdate = useRegisterAndAttemptConfirmedUpdate(\n\t\tstore,\n\t\tcontinuityKey,\n\t\tsocket,\n\t\toptimisticUpdates,\n\t\tconfirmedUpdates,\n\t)\n\tsocket.off(`tx-new:${continuityKey}`)\n\tsocket.on(`tx-new:${continuityKey}`, registerAndAttemptConfirmedUpdate)\n\n\tconst unsubscribeFunctions = continuity.actions.map((transaction) => {\n\t\tassignTransactionToContinuity(store, continuityKey, transaction.key)\n\t\tconst unsubscribeFromTransactionUpdates = subscribeToTransaction(\n\t\t\tstore,\n\t\t\ttransaction,\n\t\t\t`tx-run:${continuityKey}`,\n\t\t\t(clientUpdate) => {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🤞`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`enqueuing optimistic update`,\n\t\t\t\t)\n\t\t\t\tconst optimisticUpdateIndex = optimisticUpdates.findIndex(\n\t\t\t\t\t(update) => update.id === clientUpdate.id,\n\t\t\t\t)\n\t\t\t\tif (optimisticUpdateIndex === -1) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`🤞`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`enqueuing new optimistic update`,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, optimisticUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue.push(clientUpdate)\n\t\t\t\t\t\tqueue.sort((a, b) => a.epoch - b.epoch)\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`🤞`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`replacing existing optimistic update at index ${optimisticUpdateIndex}`,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, optimisticUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue[optimisticUpdateIndex] = clientUpdate\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tsocket.emit(`tx-run:${continuityKey}`, {\n\t\t\t\t\tid: clientUpdate.id,\n\t\t\t\t\ttoken: transaction,\n\t\t\t\t\tparams: clientUpdate.params,\n\t\t\t\t})\n\t\t\t},\n\t\t)\n\t\treturn unsubscribeFromTransactionUpdates\n\t})\n\n\tconst revealState = useRevealState(store)\n\tconst concealState = useConcealState(store)\n\tsocket.on(`reveal:${continuityKey}`, revealState)\n\tsocket.on(`conceal:${continuityKey}`, concealState)\n\n\tsocket.emit(`get:${continuityKey}`)\n\treturn () => {\n\t\tsocket.off(`continuity-init:${continuityKey}`)\n\t\tsocket.off(`tx-new:${continuityKey}`)\n\t\tfor (const unsubscribe of unsubscribeFunctions) unsubscribe()\n\t\t// socket.emit(`unsub:${continuityKey}`)\n\t}\n}\n"],"mappings":";;;;;;;AAeA,MAAa,wCAEX,OACA,eACA,QACA,mBAGA,sBAKA,cACU;CACV,SAAS,eACR,kBAGA,iBAGO;AACP,QAAM,OAAO,KACZ,SACA,cACA,eACA;AAED,eAAa,OAAOA,0BAAwB,UAAU;AACrD,SAAM;AACN,UAAO;;AAER,MAAI,iBAAiB,OAAO,gBAAgB,IAAI;GAC/C,MAAM,eAAe,KAAK,UAAU,iBAAiB;GACrD,MAAM,eAAe,KAAK,UAAU,gBAAgB;AACpD,OAAI,iBAAiB,cAAc;AAClC,UAAM,OAAO,KACZ,KACA,cACA,eACA,eAAe,iBAAiB,GAAG;AAEpC,WAAO,KAAK,OAAO,iBAAiB,gBAAgB;AACpD;;QAID,OAAM,OAAO,KACZ,KACA,cACA,eACA,mBAAmB,gBAAgB,MAAM,OAAO,iBAAiB,MAAM,IAAI,GAAG,iBAAiB,GAAG,wBAAwB,gBAAgB,MAAM,IAAI,GAAG,gBAAgB;AAGzK,QAAM,OAAO,KACZ,SACA,cACA,eACA,wBACA,kBACA;EAED,MAAM,4BAA4B,kBAAkB;AACpD,OAAK,MAAM,wBAAwB,0BAClC,+BAA8B,OAAO,sBAAsB;AAE5D,QAAM,OAAO,KACZ,KACA,cACA,eACA,6BACA;AAED,gCAA8B,OAAO,kBAAkB;AACvD,QAAM,OAAO,KACZ,KACA,cACA,eACA,kCACA;AAED,gCAA8B,OAAO,iBAAiB;AACtD,QAAM,OAAO,KACZ,KACA,cACA,eACA,4BACA;AAED,SAAO,KAAK,OAAO,iBAAiB,gBAAgB;AAEpD,OAAK,MAAM,wBAAwB,mBAAmB;GACrD,MAAM,QAAQ;IAC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A,eACA,iDAAiD;AAElD,iBAAa,OAAOA,0BAAwB,UAAU;AACrD,WAAM,yBAAyB;AAC/B,YAAO;;;AAGT,UAAO,KAAK,UAAU,iBAAiB;IACtC,IAAI,aAAa;IACjB,OAAO;IACP,QAAQ,aAAa;;;AAIxB,SAAO;;CAGR,MAAM,cAAc,eAAe;CACnC,MAAM,eAAe,gBAAgB;AACrC,QAAO,GAAG,UAAU,iBAAiB;AACrC,QAAO,GAAG,WAAW,iBAAiB;AAEtC,QAAO,KAAK,OAAO;AACnB,cAAa;AACZ,SAAO,IAAI,mBAAmB;AAC9B,SAAO,IAAI,UAAU;AACrB,OAAK,MAAM,eAAe,qBAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["optimisticUpdateQueue","confirmedUpdateQueue","continuityEpoch: number | undefined","k: any","v: any","myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined>","myIdState: AtomIO.ReadonlyPureSelectorToken<string | undefined>","myUsernameState: AtomIO.RegularAtomToken<string | null>","optimisticUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>","confirmedUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n>","optimisticUpdateQueue","confirmedUpdateQueue","k: any","v: any","transaction"],"sources":["../../src/realtime-client/continuity/register-and-attempt-confirmed-update.ts","../../src/realtime-client/continuity/use-conceal-state.ts","../../src/realtime-client/continuity/use-reveal-state.ts","../../src/realtime-client/pull-atom.ts","../../src/realtime-client/pull-atom-family-member.ts","../../src/realtime-client/pull-mutable-atom.ts","../../src/realtime-client/pull-mutable-atom-family-member.ts","../../src/realtime-client/pull-selector-roots.ts","../../src/realtime-client/pull-selector.ts","../../src/realtime-client/pull-selector-family-member.ts","../../src/realtime-client/push-state.ts","../../src/realtime-client/realtime-client-stores/client-main-store.ts","../../src/realtime-client/realtime-client-stores/client-sync-store.ts","../../src/realtime-client/server-action.ts","../../src/realtime-client/sync-continuity.ts"],"sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Fn, RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tgetEpochNumberOfContinuity,\n\tingestTransactionOutcomeEvent,\n\tsetEpochNumberOfContinuity,\n\tsetIntoStore,\n} from \"atom.io/internal\"\nimport {\n\tconfirmedUpdateQueue,\n\toptimisticUpdateQueue,\n} from \"atom.io/realtime-client\"\nimport type { Socket } from \"atom.io/realtime-server\"\n\nexport const useRegisterAndAttemptConfirmedUpdate =\n\t(\n\t\tstore: RootStore,\n\t\tcontinuityKey: string,\n\t\tsocket: Socket,\n\t\toptimisticUpdates: AtomIO.TransactionOutcomeEvent<\n\t\t\tAtomIO.TransactionToken<Fn>\n\t\t>[],\n\t\tconfirmedUpdates: AtomIO.TransactionOutcomeEvent<\n\t\t\tAtomIO.TransactionToken<Fn>\n\t\t>[],\n\t) =>\n\t(\n\t\tconfirmed: AtomIO.TransactionOutcomeEvent<AtomIO.TransactionToken<Fn>>,\n\t): void => {\n\t\tfunction reconcileEpoch(\n\t\t\toptimisticUpdate: AtomIO.TransactionOutcomeEvent<\n\t\t\t\tAtomIO.TransactionToken<Fn>\n\t\t\t>,\n\t\t\tconfirmedUpdate: AtomIO.TransactionOutcomeEvent<\n\t\t\t\tAtomIO.TransactionToken<Fn>\n\t\t\t>,\n\t\t): void {\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`reconciling updates`,\n\t\t\t)\n\t\t\tsetIntoStore(store, optimisticUpdateQueue, (queue) => {\n\t\t\t\tqueue.shift()\n\t\t\t\treturn queue\n\t\t\t})\n\t\t\tif (optimisticUpdate.id === confirmedUpdate.id) {\n\t\t\t\tconst clientResult = JSON.stringify(optimisticUpdate.subEvents)\n\t\t\t\tconst serverResult = JSON.stringify(confirmedUpdate.subEvents)\n\t\t\t\tif (clientResult === serverResult) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`✅`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`results for ${optimisticUpdate.id} match between client and server`,\n\t\t\t\t\t)\n\t\t\t\t\tsocket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// id mismatch\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`❌`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`thought update #${confirmedUpdate.epoch} was ${optimisticUpdate.token.key}:${optimisticUpdate.id}, but it was actually ${confirmedUpdate.token.key}:${confirmedUpdate.id}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`updates do not match`,\n\t\t\t\toptimisticUpdate,\n\t\t\t\tconfirmedUpdate,\n\t\t\t)\n\t\t\tconst reversedOptimisticUpdates = optimisticUpdates.toReversed()\n\t\t\tfor (const subsequentOptimistic of reversedOptimisticUpdates) {\n\t\t\t\tingestTransactionOutcomeEvent(store, subsequentOptimistic, `oldValue`)\n\t\t\t}\n\t\t\tstore.logger.info(\n\t\t\t\t`⏪`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`undid optimistic updates:`,\n\t\t\t\treversedOptimisticUpdates,\n\t\t\t)\n\t\t\tingestTransactionOutcomeEvent(store, optimisticUpdate, `oldValue`)\n\t\t\tstore.logger.info(\n\t\t\t\t`⏪`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`undid zeroth optimistic update`,\n\t\t\t\toptimisticUpdate,\n\t\t\t)\n\t\t\tingestTransactionOutcomeEvent(store, confirmedUpdate, `newValue`)\n\t\t\tstore.logger.info(\n\t\t\t\t`⏩`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`applied confirmed update`,\n\t\t\t\tconfirmedUpdate,\n\t\t\t)\n\t\t\tsocket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch)\n\n\t\t\tfor (const subsequentOptimistic of optimisticUpdates) {\n\t\t\t\tconst token = {\n\t\t\t\t\ttype: `transaction`,\n\t\t\t\t\tkey: subsequentOptimistic.token.key,\n\t\t\t\t} as const\n\t\t\t\tconst { id, params } = subsequentOptimistic\n\t\t\t\tactUponStore(store, token, id)(...params)\n\t\t\t}\n\t\t\tstore.logger.info(\n\t\t\t\t`⏩`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`reapplied subsequent optimistic updates:`,\n\t\t\t\toptimisticUpdates,\n\t\t\t)\n\t\t}\n\n\t\tstore.logger.info(\n\t\t\t`🧑⚖️`,\n\t\t\t`continuity`,\n\t\t\tcontinuityKey,\n\t\t\t`integrating confirmed update`,\n\t\t\t{ confirmedUpdate: confirmed, confirmedUpdates, optimisticUpdates },\n\t\t)\n\t\tconst zerothOptimisticUpdate = optimisticUpdates[0]\n\t\tif (zerothOptimisticUpdate) {\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`has optimistic updates to reconcile`,\n\t\t\t)\n\t\t\tif (confirmed.epoch === zerothOptimisticUpdate.epoch) {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🧑⚖️`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`epoch of confirmed update #${confirmed.epoch} matches zeroth optimistic update`,\n\t\t\t\t)\n\t\t\t\treconcileEpoch(zerothOptimisticUpdate, confirmed)\n\t\t\t\tfor (const nextConfirmed of confirmedUpdates) {\n\t\t\t\t\tconst nextOptimistic = optimisticUpdates[0]\n\t\t\t\t\tif (nextConfirmed.epoch === nextOptimistic?.epoch) {\n\t\t\t\t\t\treconcileEpoch(nextOptimistic, nextConfirmed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// epoch mismatch\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🧑⚖️`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`epoch of confirmed update #${confirmed.epoch} does not match zeroth optimistic update #${zerothOptimisticUpdate.epoch}`,\n\t\t\t\t)\n\t\t\t\tconst confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(\n\t\t\t\t\t(update) => update.epoch === confirmed.epoch,\n\t\t\t\t)\n\t\t\t\tif (!confirmedUpdateIsAlreadyEnqueued) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`👈`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`pushing confirmed update to queue`,\n\t\t\t\t\t\tconfirmed,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, confirmedUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue.push(confirmed)\n\t\t\t\t\t\tqueue.sort((a, b) => a.epoch - b.epoch)\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tstore.logger.info(\n\t\t\t\t`🧑⚖️`,\n\t\t\t\t`continuity`,\n\t\t\t\tcontinuityKey,\n\t\t\t\t`has no optimistic updates to deal with`,\n\t\t\t)\n\t\t\tlet continuityEpoch: number | undefined\n\t\t\tcontinuityEpoch = getEpochNumberOfContinuity(store, continuityKey)\n\n\t\t\tif (continuityEpoch === confirmed.epoch - 1) {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`✅`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`integrating update #${confirmed.epoch} (${confirmed.token.key} ${confirmed.id})`,\n\t\t\t\t)\n\t\t\t\tingestTransactionOutcomeEvent(store, confirmed, `newValue`)\n\t\t\t\tsocket.emit(`ack:${continuityKey}`, confirmed.epoch)\n\t\t\t\tsetEpochNumberOfContinuity(store, continuityKey, confirmed.epoch)\n\t\t\t} else if (continuityEpoch !== undefined) {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🧑⚖️`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`received update #${confirmed.epoch} but still waiting for update #${\n\t\t\t\t\t\tcontinuityEpoch + 1\n\t\t\t\t\t}`,\n\t\t\t\t\t{\n\t\t\t\t\t\tclientEpoch: continuityEpoch,\n\t\t\t\t\t\tserverEpoch: confirmed.epoch,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tconst confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(\n\t\t\t\t\t(update) => update.epoch === confirmed.epoch,\n\t\t\t\t)\n\t\t\t\tif (confirmedUpdateIsAlreadyEnqueued) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`👍`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`confirmed update #${confirmed.epoch} is already enqueued`,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`👈`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`pushing confirmed update #${confirmed.epoch} to queue`,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, confirmedUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue.push(confirmed)\n\t\t\t\t\t\tqueue.sort((a, b) => a.epoch - b.epoch)\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n","import type { AtomToken } from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { disposeAtom } from \"atom.io/internal\"\n\nexport function useConcealState(store: Store) {\n\treturn (concealed: AtomToken<unknown>[]): void => {\n\t\tfor (const token of concealed) {\n\t\t\tdisposeAtom(store, token)\n\t\t}\n\t}\n}\n","import { setIntoStore, type Store } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\n\nexport function useRevealState(store: Store) {\n\treturn (revealed: Json.Array): void => {\n\t\tlet i = 0\n\t\tlet k: any\n\t\tlet v: any\n\t\tfor (const x of revealed) {\n\t\t\tif (i % 2 === 0) {\n\t\t\t\tk = x\n\t\t\t} else {\n\t\t\t\tv = x\n\t\t\t\tsetIntoStore(store, k, v)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport { setIntoStore, type Store } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pullAtom<J extends Json.Serializable>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.RegularAtomToken<J, any, any>,\n): () => void {\n\tconst setServedValue = (data: J) => {\n\t\tsetIntoStore(store, token, data)\n\t}\n\tsocket.on(`serve:${token.key}`, setServedValue)\n\tsocket.emit(`sub:${token.key}`)\n\treturn () => {\n\t\tsocket.off(`serve:${token.key}`, setServedValue)\n\t\tsocket.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport { findInStore, setIntoStore, type Store } from \"atom.io/internal\"\nimport type { Canonical, Json } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pullAtomFamilyMember<\n\tJ extends Json.Serializable,\n\tK extends Canonical,\n>(\n\tstore: Store,\n\tsocket: Socket,\n\tfamily: AtomIO.AtomFamilyToken<J, K, any>,\n\tkey: NoInfer<K>,\n): () => void {\n\tconst token = findInStore(store, family, key)\n\tconst setServedValue = (data: J) => {\n\t\tsetIntoStore(store, token, data)\n\t}\n\tsocket?.on(`serve:${token.key}`, setServedValue)\n\tsocket?.emit(`sub:${family.key}`, key)\n\treturn () => {\n\t\tsocket?.off(`serve:${token.key}`, setServedValue)\n\t\tsocket?.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { AsJSON, SignalFrom, Store, Transceiver } from \"atom.io/internal\"\nimport { getJsonToken, getUpdateToken, setIntoStore } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pullMutableAtom<T extends Transceiver<any, any, any>>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.MutableAtomToken<T>,\n): () => void {\n\tconst jsonToken = getJsonToken(store, token)\n\tconst updateToken = getUpdateToken(token)\n\tsocket.on(`init:${token.key}`, (data: AsJSON<T>) => {\n\t\tsetIntoStore(store, jsonToken, data)\n\t})\n\tsocket.on(`next:${token.key}`, (data: SignalFrom<T>) => {\n\t\tsetIntoStore(store, updateToken, data)\n\t})\n\tsocket.emit(`sub:${token.key}`)\n\treturn () => {\n\t\tsocket.off(`init:${token.key}`)\n\t\tsocket.off(`next:${token.key}`)\n\t\tsocket.emit(`unsub:${token.key}`)\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { AsJSON, SignalFrom, Store, Transceiver } from \"atom.io/internal\"\nimport {\n\tfindInStore,\n\tgetJsonToken,\n\tgetUpdateToken,\n\tsetIntoStore,\n} from \"atom.io/internal\"\nimport type { Canonical } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pullMutableAtomFamilyMember<\n\tT extends Transceiver<any, any, any>,\n\tK extends Canonical,\n>(\n\tstore: Store,\n\tsocket: Socket,\n\tfamily: AtomIO.MutableAtomFamilyToken<T, K>,\n\tkey: NoInfer<K>,\n): () => void {\n\tconst token = findInStore(store, family, key)\n\tsocket.on(`init:${token.key}`, (data: AsJSON<T>) => {\n\t\tconst jsonToken = getJsonToken(store, token)\n\t\tsetIntoStore(store, jsonToken, data)\n\t})\n\tsocket.on(`next:${token.key}`, (data: SignalFrom<T>) => {\n\t\tconst trackerToken = getUpdateToken(token)\n\t\tsetIntoStore(store, trackerToken, data)\n\t})\n\tsocket.emit(`sub:${family.key}`, key)\n\treturn () => {\n\t\tsocket.off(`serve:${token.key}`)\n\t\tsocket.emit(`unsub:${token.key}`)\n\t}\n}\n","import type { AtomToken, SelectorToken } from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { getFamilyOfToken, subscribeToState } from \"atom.io/internal\"\nimport { parseJson } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { pullAtom } from \"./pull-atom\"\nimport { pullAtomFamilyMember } from \"./pull-atom-family-member\"\nimport { pullMutableAtom } from \"./pull-mutable-atom\"\nimport { pullMutableAtomFamilyMember } from \"./pull-mutable-atom-family-member\"\n\nexport function pullSelectorRoots(\n\tstore: Store,\n\tsocket: Socket,\n\tselectorToken: SelectorToken<any>,\n): () => void {\n\tconst atomSubscriptions = new Map<string, () => void>()\n\tconst clearAtomSubscriptions = () => {\n\t\tfor (const [, unsub] of atomSubscriptions) unsub()\n\t\tatomSubscriptions.clear()\n\t}\n\n\tconst start = () => {\n\t\tconst atomKeys = store.selectorAtoms.getRelatedKeys(selectorToken.key)\n\t\tif (atomKeys) {\n\t\t\tfor (const [atomKey, unsub] of atomSubscriptions) {\n\t\t\t\tif (!atomKeys.has(atomKey)) {\n\t\t\t\t\tunsub()\n\t\t\t\t\tatomSubscriptions.delete(atomKey)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const atomKey of atomKeys) {\n\t\t\t\tif (atomSubscriptions.has(atomKey)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst atom = store.atoms.get(atomKey) as AtomToken<any, any>\n\t\t\t\tswitch (atom.type) {\n\t\t\t\t\tcase `atom`: {\n\t\t\t\t\t\tif (atom.family) {\n\t\t\t\t\t\t\tconst { subKey: serializedSubKey } = atom.family\n\t\t\t\t\t\t\tconst subKey = parseJson(serializedSubKey)\n\t\t\t\t\t\t\tconst family = getFamilyOfToken(store, atom)\n\t\t\t\t\t\t\tatomSubscriptions.set(\n\t\t\t\t\t\t\t\tatomKey,\n\t\t\t\t\t\t\t\tpullAtomFamilyMember(store, socket, family, subKey),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tatomSubscriptions.set(atomKey, pullAtom(store, socket, atom))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase `mutable_atom`: {\n\t\t\t\t\t\tif (atom.family) {\n\t\t\t\t\t\t\tconst { subKey: serializedSubKey } = atom.family\n\t\t\t\t\t\t\tconst subKey = parseJson(serializedSubKey)\n\t\t\t\t\t\t\tconst family = getFamilyOfToken(store, atom)\n\t\t\t\t\t\t\tatomSubscriptions.set(\n\t\t\t\t\t\t\t\tatomKey,\n\t\t\t\t\t\t\t\tpullMutableAtomFamilyMember(store, socket, family, subKey),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tatomSubscriptions.set(\n\t\t\t\t\t\t\t\tatomKey,\n\t\t\t\t\t\t\t\tpullMutableAtom(store, socket, atom),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst unsubFromSelector = subscribeToState(\n\t\tstore,\n\t\tselectorToken,\n\t\t`pull-watches-dependencies`,\n\t\t() => {\n\t\t\tstart()\n\t\t},\n\t)\n\n\tstart()\n\n\treturn () => {\n\t\tclearAtomSubscriptions()\n\t\tunsubFromSelector()\n\t}\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { pullSelectorRoots } from \"./pull-selector-roots\"\n\nexport function pullSelector<T>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.SelectorToken<T>,\n): () => void {\n\treturn pullSelectorRoots(store, socket, token)\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { findInStore } from \"atom.io/internal\"\nimport type { Canonical } from \"atom.io/json\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { pullSelectorRoots } from \"./pull-selector-roots\"\n\nexport function pullSelectorFamilyMember<T, K extends Canonical>(\n\tstore: Store,\n\tsocket: Socket,\n\tfamilyToken: AtomIO.SelectorFamilyToken<T, K>,\n\tkey: NoInfer<K>,\n): () => void {\n\tconst token = findInStore(store, familyToken, key)\n\treturn pullSelectorRoots(store, socket, token)\n}\n","import type { WritableToken } from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { setIntoStore, subscribeToState } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport { mutexAtoms } from \"atom.io/realtime/mutex-store\"\nimport { employSocket } from \"atom.io/realtime-server/employ-socket\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function pushState<J extends Json.Serializable>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: WritableToken<J>,\n): () => void {\n\tconst publish = (newValue: J) => {\n\t\tsocket.emit(`pub:${token.key}`, newValue)\n\t}\n\n\tconst subscriptions = new Set<() => void>()\n\tconst clearSubscriptions = () => {\n\t\tfor (const unsub of subscriptions) unsub()\n\t\tsubscriptions.clear()\n\t}\n\n\tconst init = () => {\n\t\tsubscriptions.add(\n\t\t\temploySocket(socket, `claim-result:${token.key}`, (success: boolean) => {\n\t\t\t\tif (!success) return\n\n\t\t\t\tclearSubscriptions()\n\t\t\t\tsetIntoStore(store, mutexAtoms, token.key, true)\n\t\t\t\tsubscriptions.add(\n\t\t\t\t\tsubscribeToState(store, token, `push`, ({ newValue }) => {\n\t\t\t\t\t\tpublish(newValue)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}),\n\t\t)\n\n\t\tsocket.emit(`claim:${token.key}`)\n\t}\n\n\tinit()\n\n\treturn () => {\n\t\tclearSubscriptions()\n\t\tsocket.emit(`unclaim:${token.key}`)\n\t}\n}\n","import * as AtomIO from \"atom.io\"\nimport { storageSync } from \"atom.io/web\"\n\nexport const myIdState__INTERNAL: AtomIO.RegularAtomToken<string | undefined> =\n\tAtomIO.atom<string | undefined>({\n\t\tkey: `mySocketId__INTERNAL`,\n\t\tdefault: undefined,\n\t})\nexport const myIdState: AtomIO.ReadonlyPureSelectorToken<string | undefined> =\n\tAtomIO.selector<string | undefined>({\n\t\tkey: `mySocketId`,\n\t\tget: ({ get }) => get(myIdState__INTERNAL),\n\t})\n\nexport const myUsernameState: AtomIO.RegularAtomToken<string | null> =\n\tAtomIO.atom<string | null>({\n\t\tkey: `myName`,\n\t\tdefault: null,\n\t\teffects: [storageSync(globalThis.localStorage, JSON, `myUsername`)],\n\t})\n","import * as AtomIO from \"atom.io\"\n\nexport const optimisticUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n> = AtomIO.atom<AtomIO.TransactionOutcomeEvent<any>[]>({\n\tkey: `updateQueue`,\n\tdefault: () => [],\n})\n\nexport const confirmedUpdateQueue: AtomIO.RegularAtomToken<\n\tAtomIO.TransactionOutcomeEvent<any>[]\n> = AtomIO.atom<AtomIO.TransactionOutcomeEvent<any>[]>({\n\tkey: `serverConfirmedUpdateQueue`,\n\tdefault: () => [],\n})\n","import type * as AtomIO from \"atom.io\"\nimport type { Fn, Store } from \"atom.io/internal\"\nimport { subscribeToTransaction } from \"atom.io/internal\"\nimport type { Socket } from \"socket.io-client\"\n\nexport function serverAction<F extends Fn>(\n\tstore: Store,\n\tsocket: Socket,\n\ttoken: AtomIO.TransactionToken<F>,\n): () => void {\n\tconst unsubscribeFromLocalUpdates = subscribeToTransaction(\n\t\tstore,\n\t\ttoken,\n\t\t`tx-run:${token.key}:${socket.id}`,\n\t\t(clientUpdate) => {\n\t\t\tsocket.emit(`tx-run:${token.key}`, clientUpdate)\n\t\t},\n\t)\n\n\treturn () => {\n\t\tunsubscribeFromLocalUpdates()\n\t}\n}\n","import type { RootStore } from \"atom.io/internal\"\nimport {\n\tassignTransactionToContinuity,\n\tgetFromStore,\n\tgetJsonToken,\n\tsetEpochNumberOfContinuity,\n\tsetIntoStore,\n\tsubscribeToTransaction,\n} from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\nimport type { ContinuityToken } from \"atom.io/realtime\"\nimport {\n\tconfirmedUpdateQueue,\n\toptimisticUpdateQueue,\n} from \"atom.io/realtime-client\"\nimport type { Socket } from \"socket.io-client\"\n\nimport { useRegisterAndAttemptConfirmedUpdate } from \"./continuity/register-and-attempt-confirmed-update\"\nimport { useConcealState } from \"./continuity/use-conceal-state\"\nimport { useRevealState } from \"./continuity/use-reveal-state\"\n\nexport function syncContinuity(\n\tstore: RootStore,\n\tsocket: Socket,\n\tcontinuity: ContinuityToken,\n): () => void {\n\tconst continuityKey = continuity.key\n\tconst optimisticUpdates = getFromStore(store, optimisticUpdateQueue)\n\tconst confirmedUpdates = getFromStore(store, confirmedUpdateQueue)\n\n\tconst initializeContinuity = (epoch: number, payload: Json.Array) => {\n\t\tsocket.off(`continuity-init:${continuityKey}`, initializeContinuity)\n\t\tlet i = 0\n\t\tlet k: any\n\t\tlet v: any\n\t\tfor (const x of payload) {\n\t\t\tif (i % 2 === 0) {\n\t\t\t\tk = x\n\t\t\t} else {\n\t\t\t\tv = x\n\t\t\t\tif (`type` in k && k.type === `mutable_atom`) {\n\t\t\t\t\tk = getJsonToken(store, k)\n\t\t\t\t}\n\t\t\t\tsetIntoStore(store, k, v)\n\t\t\t}\n\t\t\ti++\n\t\t}\n\t\tsetEpochNumberOfContinuity(store, continuityKey, epoch)\n\t}\n\tsocket.off(`continuity-init:${continuityKey}`)\n\tsocket.on(`continuity-init:${continuityKey}`, initializeContinuity)\n\n\tconst registerAndAttemptConfirmedUpdate = useRegisterAndAttemptConfirmedUpdate(\n\t\tstore,\n\t\tcontinuityKey,\n\t\tsocket,\n\t\toptimisticUpdates,\n\t\tconfirmedUpdates,\n\t)\n\tsocket.off(`tx-new:${continuityKey}`)\n\tsocket.on(`tx-new:${continuityKey}`, registerAndAttemptConfirmedUpdate)\n\n\tconst unsubscribeFunctions = continuity.actions.map((transaction) => {\n\t\tassignTransactionToContinuity(store, continuityKey, transaction.key)\n\t\tconst unsubscribeFromTransactionUpdates = subscribeToTransaction(\n\t\t\tstore,\n\t\t\ttransaction,\n\t\t\t`tx-run:${continuityKey}`,\n\t\t\t(clientUpdate) => {\n\t\t\t\tstore.logger.info(\n\t\t\t\t\t`🤞`,\n\t\t\t\t\t`continuity`,\n\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t`enqueuing optimistic update`,\n\t\t\t\t)\n\t\t\t\tconst optimisticUpdateIndex = optimisticUpdates.findIndex(\n\t\t\t\t\t(update) => update.id === clientUpdate.id,\n\t\t\t\t)\n\t\t\t\tif (optimisticUpdateIndex === -1) {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`🤞`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`enqueuing new optimistic update`,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, optimisticUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue.push(clientUpdate)\n\t\t\t\t\t\tqueue.sort((a, b) => a.epoch - b.epoch)\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`🤞`,\n\t\t\t\t\t\t`continuity`,\n\t\t\t\t\t\tcontinuityKey,\n\t\t\t\t\t\t`replacing existing optimistic update at index ${optimisticUpdateIndex}`,\n\t\t\t\t\t)\n\t\t\t\t\tsetIntoStore(store, optimisticUpdateQueue, (queue) => {\n\t\t\t\t\t\tqueue[optimisticUpdateIndex] = clientUpdate\n\t\t\t\t\t\treturn queue\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tsocket.emit(`tx-run:${continuityKey}`, {\n\t\t\t\t\tid: clientUpdate.id,\n\t\t\t\t\ttoken: transaction,\n\t\t\t\t\tparams: clientUpdate.params,\n\t\t\t\t})\n\t\t\t},\n\t\t)\n\t\treturn unsubscribeFromTransactionUpdates\n\t})\n\n\tconst revealState = useRevealState(store)\n\tconst concealState = useConcealState(store)\n\tsocket.on(`reveal:${continuityKey}`, revealState)\n\tsocket.on(`conceal:${continuityKey}`, concealState)\n\n\tsocket.emit(`get:${continuityKey}`)\n\treturn () => {\n\t\tsocket.off(`continuity-init:${continuityKey}`)\n\t\tsocket.off(`tx-new:${continuityKey}`)\n\t\tfor (const unsubscribe of unsubscribeFunctions) unsubscribe()\n\t\t// socket.emit(`unsub:${continuityKey}`)\n\t}\n}\n"],"mappings":";;;;;;;;;AAeA,MAAa,wCAEX,OACA,eACA,QACA,mBAGA,sBAKA,cACU;CACV,SAAS,eACR,kBAGA,iBAGO;AACP,QAAM,OAAO,KACZ,SACA,cACA,eACA;AAED,eAAa,OAAOA,0BAAwB,UAAU;AACrD,SAAM;AACN,UAAO;;AAER,MAAI,iBAAiB,OAAO,gBAAgB,IAAI;GAC/C,MAAM,eAAe,KAAK,UAAU,iBAAiB;GACrD,MAAM,eAAe,KAAK,UAAU,gBAAgB;AACpD,OAAI,iBAAiB,cAAc;AAClC,UAAM,OAAO,KACZ,KACA,cACA,eACA,eAAe,iBAAiB,GAAG;AAEpC,WAAO,KAAK,OAAO,iBAAiB,gBAAgB;AACpD;;QAID,OAAM,OAAO,KACZ,KACA,cACA,eACA,mBAAmB,gBAAgB,MAAM,OAAO,iBAAiB,MAAM,IAAI,GAAG,iBAAiB,GAAG,wBAAwB,gBAAgB,MAAM,IAAI,GAAG,gBAAgB;AAGzK,QAAM,OAAO,KACZ,SACA,cACA,eACA,wBACA,kBACA;EAED,MAAM,4BAA4B,kBAAkB;AACpD,OAAK,MAAM,wBAAwB,0BAClC,+BAA8B,OAAO,sBAAsB;AAE5D,QAAM,OAAO,KACZ,KACA,cACA,eACA,6BACA;AAED,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;;AAExB;;AAED,6BAA2B,OAAO,eAAe;;AAElD,QAAO,IAAI,mBAAmB;AAC9B,QAAO,GAAG,mBAAmB,iBAAiB;CAE9C,MAAM,oCAAoC,qCACzC,OACA,eACA,QACA,mBACA;AAED,QAAO,IAAI,UAAU;AACrB,QAAO,GAAG,UAAU,iBAAiB;CAErC,MAAM,uBAAuB,WAAW,QAAQ,KAAK,kBAAgB;AACpE,gCAA8B,OAAO,eAAeC,cAAY;EAChE,MAAM,oCAAoC,uBACzC,OACAA,eACA,UAAU,kBACT,iBAAiB;AACjB,SAAM,OAAO,KACZ,MACA,cACA,eACA;GAED,MAAM,wBAAwB,kBAAkB,WAC9C,WAAW,OAAO,OAAO,aAAa;AAExC,OAAI,0BAA0B,IAAI;AACjC,UAAM,OAAO,KACZ,MACA,cACA,eACA;AAED,iBAAa,OAAOJ,0BAAwB,UAAU;AACrD,WAAM,KAAK;AACX,WAAM,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE;AACjC,YAAO;;UAEF;AACN,UAAM,OAAO,KACZ,MACA,cACA,eACA,iDAAiD;AAElD,iBAAa,OAAOA,0BAAwB,UAAU;AACrD,WAAM,yBAAyB;AAC/B,YAAO;;;AAGT,UAAO,KAAK,UAAU,iBAAiB;IACtC,IAAI,aAAa;IACjB,OAAOI;IACP,QAAQ,aAAa;;;AAIxB,SAAO;;CAGR,MAAM,cAAc,eAAe;CACnC,MAAM,eAAe,gBAAgB;AACrC,QAAO,GAAG,UAAU,iBAAiB;AACrC,QAAO,GAAG,WAAW,iBAAiB;AAEtC,QAAO,KAAK,OAAO;AACnB,cAAa;AACZ,SAAO,IAAI,mBAAmB;AAC9B,SAAO,IAAI,UAAU;AACrB,OAAK,MAAM,eAAe,qBAAsB"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Fn, Transceiver } from "atom.io/internal";
|
|
2
|
-
import { Canonical, Json } from "atom.io/json";
|
|
3
2
|
import * as AtomIO from "atom.io";
|
|
3
|
+
import { Canonical, Json } from "atom.io/json";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import { ContinuityToken } from "atom.io/realtime";
|
|
6
6
|
import { Socket } from "socket.io-client";
|
|
7
7
|
|
|
8
|
-
//#region src/realtime-react/on-mount.d.ts
|
|
9
|
-
declare function onMount(effect: () => (() => void) | undefined | void): void;
|
|
10
|
-
//#endregion
|
|
11
8
|
//#region src/realtime-react/realtime-context.d.ts
|
|
9
|
+
type RealtimeServiceCounter = {
|
|
10
|
+
consumerCount: number;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
};
|
|
12
13
|
type RealtimeReactStore = {
|
|
13
14
|
socket: Socket | null;
|
|
14
|
-
services: Map<string,
|
|
15
|
+
services: Map<string, RealtimeServiceCounter> | null;
|
|
15
16
|
};
|
|
16
17
|
declare const RealtimeContext: React$1.Context<RealtimeReactStore>;
|
|
17
18
|
declare const RealtimeProvider: React$1.FC<{
|
|
@@ -23,28 +24,34 @@ declare const RealtimeProvider: React$1.FC<{
|
|
|
23
24
|
declare function usePullAtom<J extends Json.Serializable>(token: AtomIO.RegularAtomToken<J>): J;
|
|
24
25
|
//#endregion
|
|
25
26
|
//#region src/realtime-react/use-pull-atom-family-member.d.ts
|
|
26
|
-
declare function usePullAtomFamilyMember<J extends Json.Serializable, K extends Canonical
|
|
27
|
+
declare function usePullAtomFamilyMember<J extends Json.Serializable, K extends Canonical>(family: AtomIO.RegularAtomFamilyToken<J, K>, subKey: NoInfer<K>): J;
|
|
27
28
|
//#endregion
|
|
28
29
|
//#region src/realtime-react/use-pull-mutable-atom.d.ts
|
|
29
30
|
declare function usePullMutable<T extends Transceiver<any, any, any>>(token: AtomIO.MutableAtomToken<T>): T;
|
|
30
31
|
//#endregion
|
|
31
32
|
//#region src/realtime-react/use-pull-mutable-family-member.d.ts
|
|
32
|
-
declare function usePullMutableAtomFamilyMember<T extends Transceiver<any, any, any>, K extends Canonical
|
|
33
|
+
declare function usePullMutableAtomFamilyMember<T extends Transceiver<any, any, any>, K extends Canonical>(familyToken: AtomIO.MutableAtomFamilyToken<T, K>, key: NoInfer<K>): T;
|
|
33
34
|
//#endregion
|
|
34
35
|
//#region src/realtime-react/use-pull-selector.d.ts
|
|
35
36
|
declare function usePullSelector<J extends Json.Serializable>(token: AtomIO.SelectorToken<J>): J;
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/realtime-react/use-pull-selector-family-member.d.ts
|
|
38
|
-
declare function usePullSelectorFamilyMember<T, K extends Canonical
|
|
39
|
+
declare function usePullSelectorFamilyMember<T, K extends Canonical>(familyToken: AtomIO.SelectorFamilyToken<T, K>, key: NoInfer<K>): T;
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/realtime-react/use-push.d.ts
|
|
41
|
-
declare function usePush<J extends Json.Serializable>(token: AtomIO.WritableToken<J>): <New extends J>(next: New | ((old: J) => New)) => void;
|
|
42
|
+
declare function usePush<J extends Json.Serializable>(token: AtomIO.WritableToken<J>): (<New extends J>(next: New | ((old: J) => New)) => void) | null;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/realtime-react/use-realtime-service.d.ts
|
|
45
|
+
declare function useRealtimeService(key: string, create: (socket: Socket) => () => void): void;
|
|
42
46
|
//#endregion
|
|
43
47
|
//#region src/realtime-react/use-server-action.d.ts
|
|
44
48
|
declare function useServerAction<F extends Fn>(token: AtomIO.TransactionToken<F>): (...parameters: Parameters<F>) => ReturnType<F>;
|
|
45
49
|
//#endregion
|
|
50
|
+
//#region src/realtime-react/use-single-effect.d.ts
|
|
51
|
+
declare function useSingleEffect(effect: () => (() => void) | undefined | void, deps: unknown[]): void;
|
|
52
|
+
//#endregion
|
|
46
53
|
//#region src/realtime-react/use-sync-continuity.d.ts
|
|
47
54
|
declare function useSyncContinuity(token: ContinuityToken): void;
|
|
48
55
|
//#endregion
|
|
49
|
-
export { RealtimeContext, RealtimeProvider, RealtimeReactStore,
|
|
56
|
+
export { RealtimeContext, RealtimeProvider, RealtimeReactStore, RealtimeServiceCounter, usePullAtom, usePullAtomFamilyMember, usePullMutable, usePullMutableAtomFamilyMember, usePullSelector, usePullSelectorFamilyMember, usePush, useRealtimeService, useServerAction, useSingleEffect, useSyncContinuity };
|
|
50
57
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["RealtimeContext: React.Context<RealtimeReactStore>","RealtimeProvider: React.FC<{\n\tchildren: React.ReactNode\n\tsocket: Socket | null\n}>"],"sources":["../../src/realtime-react/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["RealtimeContext: React.Context<RealtimeReactStore>","RealtimeProvider: React.FC<{\n\tchildren: React.ReactNode\n\tsocket: Socket | null\n}>"],"sources":["../../src/realtime-react/realtime-context.tsx","../../src/realtime-react/use-pull-atom.ts","../../src/realtime-react/use-pull-atom-family-member.ts","../../src/realtime-react/use-pull-mutable-atom.ts","../../src/realtime-react/use-pull-mutable-family-member.ts","../../src/realtime-react/use-pull-selector.ts","../../src/realtime-react/use-pull-selector-family-member.ts","../../src/realtime-react/use-push.ts","../../src/realtime-react/use-realtime-service.ts","../../src/realtime-react/use-server-action.ts","../../src/realtime-react/use-single-effect.ts","../../src/realtime-react/use-sync-continuity.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAKY,sBAAA;;;;KAKA,kBAAA;UACH;EANT,QAAY,EAOD,GAPC,CAAA,MAAA,EAOW,sBAPX,CAAA,GAAA,IAAA;AAKZ,CAAA;AAAY,cAKCA,eALD,EAKkB,OAAA,CAAM,OALxB,CAKgC,kBALhC,CAAA;AACH,cAUIC,gBAVJ,EAUsB,OAAA,CAAM,EAV5B,CAAA;UACc,EAUZ,OAAA,CAAM,SAVM;QAAZ,EAWF,MAXE,GAAA,IAAA;;;;iBCJK,sBAAsB,IAAA,CAAK,qBACnC,MAAA,CAAO,iBAAiB,KAC7B;;;iBCDa,kCACL,IAAA,CAAK,wBACL,mBACD,MAAA,CAAO,uBAAuB,GAAG,YAAY,QAAQ,KAAK;;;iBCJpD,yBAAyB,mCACjC,MAAA,CAAO,iBAAiB,KAC7B;;;iBCAa,yCACL,sCACA,wBACI,MAAA,CAAO,uBAAuB,GAAG,SAAS,QAAQ,KAAK;;;iBCLtD,0BAA0B,IAAA,CAAK,qBACvC,MAAA,CAAO,cAAc,KAC1B;;;iBCDa,yCAAyC,wBAC3C,MAAA,CAAO,oBAAoB,GAAG,SACtC,QAAQ,KACX;;;iBCHa,kBAAkB,IAAA,CAAK,qBAC/B,MAAA,CAAO,cAAc,mBACZ,SAAS,aAAa,MAAM;;;iBCL7B,kBAAA,+BAEE;;;iBCCF,0BAA0B,WAClC,MAAA,CAAO,iBAAiB,qBACb,WAAW,OAAO,WAAW;;;iBCNhC,eAAA;;;iBCEA,iBAAA,QAAyB"}
|