atom.io 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/data/dist/index.d.ts +867 -101
  2. package/data/dist/index.js +10 -558
  3. package/data/src/index.ts +0 -2
  4. package/data/src/struct-family.ts +1 -1
  5. package/data/src/struct.ts +1 -2
  6. package/dist/chunk-354XQWHH.js +153 -0
  7. package/dist/chunk-4LWKCEW3.js +14 -0
  8. package/dist/chunk-5F2V7S3B.js +83 -0
  9. package/dist/chunk-ECOMOMUN.js +631 -0
  10. package/dist/{chunk-42UH5F5Q.js → chunk-GY2XQYZY.js} +2051 -755
  11. package/dist/chunk-NF7FJKJD.js +107 -0
  12. package/dist/chunk-R3ZUK5EH.js +1024 -0
  13. package/dist/chunk-Z2UJW4NQ.js +523 -0
  14. package/dist/index.d.ts +855 -127
  15. package/dist/index.js +1 -143
  16. package/eslint-plugin/dist/index.d.ts +1 -30
  17. package/eslint-plugin/dist/index.js +0 -146
  18. package/eslint-plugin/src/index.ts +0 -1
  19. package/eslint-plugin/src/rules/index.ts +0 -1
  20. package/internal/dist/index.d.ts +794 -70
  21. package/internal/dist/index.js +1 -2
  22. package/internal/src/atom/create-regular-atom.ts +3 -3
  23. package/internal/src/atom/dispose-atom.ts +4 -13
  24. package/internal/src/atom/is-default.ts +3 -3
  25. package/internal/src/caching.ts +5 -5
  26. package/internal/src/capitalize.ts +3 -0
  27. package/internal/src/families/create-readonly-selector-family.ts +5 -6
  28. package/internal/src/families/create-writable-selector-family.ts +1 -4
  29. package/internal/src/families/dispose-from-store.ts +3 -13
  30. package/internal/src/families/find-in-store.ts +1 -6
  31. package/internal/src/get-state/get-from-store.ts +2 -2
  32. package/internal/src/get-state/read-or-compute-value.ts +1 -1
  33. package/internal/src/index.ts +19 -9
  34. package/internal/src/ingest-updates/ingest-creation-disposal.ts +2 -3
  35. package/internal/src/install-into-store.ts +48 -0
  36. package/internal/src/join/edit-relations-in-store.ts +32 -0
  37. package/internal/src/join/find-relations-in-store.ts +124 -0
  38. package/internal/src/join/get-internal-relations-from-store.ts +14 -0
  39. package/internal/src/join/get-join.ts +31 -0
  40. package/internal/src/join/index.ts +5 -0
  41. package/{data/src/join.ts → internal/src/join/join-internal.ts} +20 -429
  42. package/internal/src/keys.ts +7 -7
  43. package/internal/src/molecule.ts +299 -0
  44. package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
  45. package/internal/src/mutable/create-mutable-atom.ts +3 -3
  46. package/internal/src/mutable/get-json-token.ts +1 -1
  47. package/internal/src/mutable/tracker-family.ts +19 -17
  48. package/internal/src/mutable/tracker.ts +8 -8
  49. package/internal/src/not-found-error.ts +8 -30
  50. package/internal/src/pretty-print.ts +2 -13
  51. package/internal/src/selector/create-readonly-selector.ts +3 -7
  52. package/internal/src/selector/create-writable-selector.ts +4 -4
  53. package/internal/src/selector/dispose-selector.ts +20 -11
  54. package/internal/src/selector/get-selector-dependency-keys.ts +1 -1
  55. package/internal/src/selector/register-selector.ts +7 -17
  56. package/internal/src/selector/trace-selector-atoms.ts +2 -2
  57. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  58. package/internal/src/set-state/emit-update.ts +1 -1
  59. package/internal/src/set-state/evict-downstream.ts +1 -1
  60. package/internal/src/set-state/set-atom-or-selector.ts +1 -1
  61. package/internal/src/set-state/set-atom.ts +10 -10
  62. package/internal/src/set-state/set-into-store.ts +2 -2
  63. package/internal/src/set-state/stow-update.ts +1 -1
  64. package/internal/src/store/deposit.ts +10 -8
  65. package/internal/src/store/store.ts +1 -1
  66. package/internal/src/store/withdraw.ts +34 -53
  67. package/internal/src/subscribe/recall-state.ts +1 -1
  68. package/internal/src/subscribe/subscribe-in-store.ts +3 -3
  69. package/internal/src/subscribe/subscribe-to-root-atoms.ts +3 -3
  70. package/internal/src/subscribe/subscribe-to-state.ts +5 -5
  71. package/internal/src/subscribe/subscribe-to-timeline.ts +3 -3
  72. package/internal/src/subscribe/subscribe-to-transaction.ts +3 -3
  73. package/internal/src/timeline/create-timeline.ts +17 -37
  74. package/internal/src/transaction/act-upon-store.ts +2 -2
  75. package/internal/src/transaction/apply-transaction.ts +5 -5
  76. package/internal/src/transaction/assign-transaction-to-continuity.ts +1 -1
  77. package/internal/src/transaction/build-transaction.ts +5 -8
  78. package/internal/src/transaction/create-transaction.ts +3 -3
  79. package/internal/src/transaction/get-epoch-number.ts +3 -3
  80. package/internal/src/transaction/set-epoch-number.ts +2 -2
  81. package/introspection/dist/index.d.ts +922 -6
  82. package/introspection/dist/index.js +2 -620
  83. package/json/dist/index.d.ts +899 -5
  84. package/json/dist/index.js +1 -81
  85. package/json/src/select-json-family.ts +3 -14
  86. package/package.json +27 -45
  87. package/react/dist/index.d.ts +921 -3
  88. package/react/dist/index.js +2 -82
  89. package/react/src/use-o.ts +1 -1
  90. package/react/src/use-tl.ts +2 -2
  91. package/react-devtools/dist/index.css +16 -14
  92. package/react-devtools/dist/index.d.ts +26 -1
  93. package/react-devtools/dist/index.js +6 -6
  94. package/react-devtools/src/devtools.scss +16 -14
  95. package/realtime/dist/index.d.ts +202 -8
  96. package/realtime/dist/index.js +2 -107
  97. package/realtime/src/realtime-continuity.ts +2 -2
  98. package/realtime/src/shared-room-store.ts +1 -2
  99. package/realtime-client/dist/index.d.ts +960 -22
  100. package/realtime-client/dist/index.js +3 -509
  101. package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +3 -3
  102. package/realtime-client/src/continuity/use-conceal-state.ts +1 -1
  103. package/realtime-client/src/pull-atom-family-member.ts +2 -2
  104. package/realtime-client/src/pull-atom.ts +2 -2
  105. package/realtime-client/src/pull-mutable-atom-family-member.ts +2 -2
  106. package/realtime-client/src/pull-mutable-atom.ts +2 -2
  107. package/realtime-client/src/pull-selector-family-member.ts +4 -4
  108. package/realtime-client/src/pull-selector.ts +4 -4
  109. package/realtime-client/src/push-state.ts +5 -10
  110. package/realtime-client/src/server-action.ts +4 -4
  111. package/realtime-client/src/sync-continuity.ts +6 -6
  112. package/realtime-react/dist/index.d.ts +166 -12
  113. package/realtime-react/dist/index.js +5 -154
  114. package/realtime-react/src/use-pull-atom-family-member.ts +1 -1
  115. package/realtime-react/src/use-pull-atom.ts +1 -1
  116. package/realtime-react/src/use-pull-mutable-atom.ts +1 -1
  117. package/realtime-react/src/use-pull-mutable-family-member.ts +1 -1
  118. package/realtime-react/src/use-pull-selector-family-member.ts +1 -1
  119. package/realtime-react/src/use-pull-selector.ts +1 -1
  120. package/realtime-react/src/use-push.ts +1 -1
  121. package/realtime-react/src/use-server-action.ts +2 -2
  122. package/realtime-react/src/use-sync-continuity.ts +1 -1
  123. package/realtime-server/dist/index.d.ts +971 -28
  124. package/realtime-server/dist/index.js +3 -1001
  125. package/realtime-server/src/continuity/prepare-to-serve-transaction-request.ts +1 -1
  126. package/realtime-server/src/continuity/prepare-to-sync-realtime-continuity.ts +3 -3
  127. package/realtime-server/src/continuity/subscribe-to-continuity-actions.ts +2 -2
  128. package/realtime-server/src/continuity/subscribe-to-continuity-perpectives.ts +2 -2
  129. package/realtime-server/src/ipc-sockets/child-socket.ts +0 -1
  130. package/realtime-server/src/realtime-action-receiver.ts +1 -1
  131. package/realtime-server/src/realtime-family-provider.ts +2 -2
  132. package/realtime-server/src/realtime-mutable-family-provider.ts +2 -2
  133. package/realtime-server/src/realtime-mutable-provider.ts +2 -2
  134. package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +2 -1
  135. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +1 -1
  136. package/realtime-server/src/realtime-server-stores/server-user-store.ts +1 -2
  137. package/realtime-server/src/realtime-state-provider.ts +2 -2
  138. package/realtime-testing/dist/index.d.ts +1091 -3
  139. package/realtime-testing/dist/index.js +23 -26
  140. package/realtime-testing/src/setup-realtime-test.tsx +6 -5
  141. package/src/atom.ts +53 -29
  142. package/src/dispose-state.ts +12 -2
  143. package/{ephemeral/src → src}/find-state.ts +35 -25
  144. package/src/get-state.ts +16 -0
  145. package/src/index.ts +77 -3
  146. package/src/join.ts +218 -0
  147. package/src/realm.ts +169 -0
  148. package/src/selector.ts +20 -0
  149. package/src/set-state.ts +16 -8
  150. package/src/silo.ts +13 -7
  151. package/src/timeline.ts +1 -1
  152. package/src/transaction.ts +4 -8
  153. package/transceivers/set-rtx/dist/index.d.ts +37 -2
  154. package/transceivers/set-rtx/dist/index.js +1 -212
  155. package/transceivers/set-rtx/src/set-rtx.ts +4 -1
  156. package/web/dist/index.d.ts +30 -1
  157. package/web/dist/index.js +1 -15
  158. package/data/src/until.ts +0 -15
  159. package/dist/chunk-ICGFFQ3H.js +0 -272
  160. package/ephemeral/dist/index.d.ts +0 -57
  161. package/ephemeral/dist/index.js +0 -9
  162. package/ephemeral/package.json +0 -13
  163. package/ephemeral/src/index.ts +0 -1
  164. package/eslint-plugin/src/rules/lifespan.ts +0 -203
  165. package/immortal/dist/index.d.ts +0 -12
  166. package/immortal/dist/index.js +0 -9
  167. package/immortal/package.json +0 -13
  168. package/immortal/src/index.ts +0 -1
  169. package/immortal/src/seek-state.ts +0 -60
  170. package/src/allocate.ts +0 -443
  171. package/src/molecule.ts +0 -16
@@ -1,7 +1,655 @@
1
- import { MutableAtomFamilyToken, MutableAtomToken, RegularAtomFamilyToken, RegularAtomToken, AtomFamilyToken, AtomToken, WritableSelectorFamilyToken, WritableSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, SelectorFamilyToken, SelectorToken, WritableFamilyToken, WritableToken, ReadableFamilyToken, ReadableToken, TransactionToken, TransactionUpdate, TransactionOptions, ActorToolkit, TimelineManageable, StateUpdate, TokenType, FamilyMetadata, StateCreation, StateDisposal, MoleculeCreation, MoleculeDisposal, TimelineUpdate, TimelineOptions, TimelineToken, AtomIOLogger, Logger, MutableAtomOptions, MutableAtomFamilyOptions, RegularAtomOptions, RegularAtomFamilyOptions, ReadonlySelectorFamilyOptions, WritableSelectorFamilyOptions, KeyedStateUpdate, MoleculeTransfer, ReadonlySelectorOptions, WritableSelectorOptions, SetterToolkit, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
2
- import { Json, Canonical, stringified, JsonInterface } from 'atom.io/json';
3
- import { Join } from 'atom.io/data';
4
- import { Store as Store$1, Func as Func$1 } from 'atom.io/internal';
1
+ type primitive = boolean | number | string | null;
2
+ declare namespace Json {
3
+ namespace Tree {
4
+ type Array<Element = unknown> = ReadonlyArray<Element>;
5
+ type Object<K extends string = string, V = unknown> = Record<K, V>;
6
+ type Fork = Array | Object;
7
+ type Leaf = primitive;
8
+ type Node = Fork | Leaf;
9
+ }
10
+ type Serializable = primitive | Readonly<{
11
+ [key: string]: Serializable;
12
+ }> | ReadonlyArray<Serializable>;
13
+ type Object<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
14
+ type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
15
+ }
16
+ type stringified<J extends Json.Serializable> = J extends string ? `"${J}"` : J extends number ? `${J}` : J extends true ? `true` : J extends false ? `false` : J extends boolean ? `false` | `true` : J extends null ? `null` : string & {
17
+ __json?: J;
18
+ };
19
+ type Canonical = primitive | ReadonlyArray<Canonical>;
20
+ type JsonInterface<T, J extends Json.Serializable = Json.Serializable> = {
21
+ toJson: (t: T) => J;
22
+ fromJson: (json: J) => T;
23
+ };
24
+
25
+ /** @public */
26
+ type Effectors<T> = {
27
+ /**
28
+ * Set the value of the atom
29
+ * @param next - The new value of the atom, or a setter function
30
+ */
31
+ setSelf: <New extends T>(next: New | Setter<T, New>) => void;
32
+ /** Subscribe to changes to the atom */
33
+ onSet: (callback: (options: {
34
+ newValue: T;
35
+ oldValue: T;
36
+ }) => void) => void;
37
+ };
38
+ /**
39
+ * @public
40
+ * A function that runs side effects when the atom is set
41
+ * @param tools - {@link Effectors} that can be used to run side effects
42
+ * @returns
43
+ * Optionally, a cleanup function that will be called when the atom is disposed
44
+ */
45
+ type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
46
+ /** @public */
47
+ type RegularAtomOptions<T> = {
48
+ /** The unique identifier of the atom */
49
+ key: string;
50
+ /** The starting value of the atom */
51
+ default: T | (() => T);
52
+ /** Hooks used to run side effects when the atom is set */
53
+ effects?: AtomEffect<T>[];
54
+ };
55
+ type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & Omit<RegularAtomOptions<T>, `default`> & {
56
+ default: () => T;
57
+ mutable: true;
58
+ };
59
+ /** @public */
60
+ type RegularAtomFamilyOptions<T, K extends Canonical> = {
61
+ /** The unique identifier of the atom family */
62
+ key: string;
63
+ /** The starting value of the atom family */
64
+ default: T | ((key: K) => T);
65
+ /** Hooks used to run side effects when an atom in the family is set */
66
+ effects?: (key: K) => AtomEffect<T>[];
67
+ };
68
+ type RegularAtomFamilyToken<T, K extends Canonical> = {
69
+ key: string;
70
+ type: `atom_family`;
71
+ __T?: T;
72
+ __K?: K;
73
+ };
74
+ type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = JsonInterface<T, J> & {
75
+ key: string;
76
+ default: (key: K) => T;
77
+ effects?: (key: K) => AtomEffect<T>[];
78
+ mutable: true;
79
+ };
80
+ type MutableAtomFamilyToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = {
81
+ key: string;
82
+ type: `mutable_atom_family`;
83
+ __T?: T;
84
+ __J?: J;
85
+ __K?: K;
86
+ };
87
+ type AtomFamilyToken<T, K extends Canonical = Canonical> = MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomFamilyToken<T, K>;
88
+
89
+ type TransactionToken<F extends Func> = {
90
+ key: string;
91
+ type: `transaction`;
92
+ __F?: F;
93
+ };
94
+ type StateCreation<Token extends ReadableToken<any>> = {
95
+ type: `state_creation`;
96
+ token: Token;
97
+ };
98
+ type AtomDisposal<Token extends ReadableToken<any>> = {
99
+ type: `state_disposal`;
100
+ subType: `atom`;
101
+ token: Token;
102
+ value: TokenType<Token>;
103
+ };
104
+ type SelectorDisposal<Token extends ReadableToken<any>> = {
105
+ type: `state_disposal`;
106
+ subType: `selector`;
107
+ token: Token;
108
+ };
109
+ type StateDisposal<Token extends ReadableToken<any>> = AtomDisposal<Token> | SelectorDisposal<Token>;
110
+ type MoleculeCreation = {
111
+ type: `molecule_creation`;
112
+ key: Canonical;
113
+ provenance: Canonical;
114
+ };
115
+ type MoleculeDisposal = {
116
+ type: `molecule_disposal`;
117
+ key: Canonical;
118
+ provenance: stringified<Canonical>[];
119
+ values: [key: string, value: any][];
120
+ };
121
+ type MoleculeTransfer = {
122
+ type: `molecule_transfer`;
123
+ key: Canonical;
124
+ from: Canonical[];
125
+ to: Canonical[];
126
+ };
127
+ type TransactionUpdateContent = KeyedStateUpdate<unknown> | MoleculeCreation | MoleculeDisposal | MoleculeTransfer | StateCreation<ReadableToken<unknown>> | StateDisposal<ReadableToken<unknown>> | TransactionUpdate<Func>;
128
+ type TransactionUpdate<F extends Func> = {
129
+ type: `transaction_update`;
130
+ key: string;
131
+ id: string;
132
+ epoch: number;
133
+ updates: TransactionUpdateContent[];
134
+ params: Parameters<F>;
135
+ output: ReturnType<F>;
136
+ };
137
+ type GetterToolkit = Pick<SetterToolkit, `find` | `get` | `json`>;
138
+ type SetterToolkit = Readonly<{
139
+ get: typeof getState;
140
+ set: typeof setState;
141
+ find: typeof findState;
142
+ json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
143
+ }>;
144
+ type ActorToolkit = Readonly<{
145
+ get: typeof getState;
146
+ set: typeof setState;
147
+ find: typeof findState;
148
+ json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
149
+ dispose: typeof disposeState;
150
+ run: typeof runTransaction;
151
+ env: () => EnvironmentData;
152
+ }>;
153
+ type Read<F extends Func> = (toolkit: GetterToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
154
+ type Write<F extends Func> = (toolkit: SetterToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
155
+ type Transact<F extends Func> = (toolkit: ActorToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
156
+ type TransactionOptions<F extends Func> = {
157
+ key: string;
158
+ do: Transact<F>;
159
+ };
160
+ declare function runTransaction<F extends Func>(token: TransactionToken<F>, id?: string): (...parameters: Parameters<F>) => ReturnType<F>;
161
+
162
+ type WritableSelectorOptions<T> = {
163
+ key: string;
164
+ get: Read<() => T>;
165
+ set: Write<(newValue: T) => void>;
166
+ };
167
+ type ReadonlySelectorOptions<T> = {
168
+ key: string;
169
+ get: Read<() => T>;
170
+ };
171
+ type WritableSelectorFamilyOptions<T, K extends Canonical> = {
172
+ key: string;
173
+ get: (key: K) => Read<() => T>;
174
+ set: (key: K) => Write<(newValue: T) => void>;
175
+ };
176
+ type ReadonlySelectorFamilyOptions<T, K extends Canonical> = {
177
+ key: string;
178
+ get: (key: K) => Read<() => T>;
179
+ };
180
+ type WritableSelectorFamilyToken<T, K extends Canonical> = {
181
+ key: string;
182
+ type: `selector_family`;
183
+ __T?: T;
184
+ __K?: K;
185
+ };
186
+ type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
187
+ key: string;
188
+ type: `readonly_selector_family`;
189
+ __T?: T;
190
+ __K?: K;
191
+ };
192
+ type SelectorFamilyToken<T, K extends Canonical> = ReadonlySelectorFamilyToken<T, K> | WritableSelectorFamilyToken<T, K>;
193
+
194
+ type TimelineManageable = AtomFamilyToken<any, any> | AtomToken<any>;
195
+ type AtomOnly<M extends TimelineManageable> = M extends AtomFamilyToken<any, any> ? AtomToken<any> : M extends AtomToken<any> ? M : never;
196
+ type TimelineToken<M> = {
197
+ key: string;
198
+ type: `timeline`;
199
+ __M?: M;
200
+ };
201
+ type TimelineOptions<ManagedAtom extends TimelineManageable> = {
202
+ key: string;
203
+ scope: ManagedAtom[];
204
+ shouldCapture?: (update: TimelineUpdate<ManagedAtom>, timeline: Timeline<TimelineManageable>) => boolean;
205
+ };
206
+ type TimelineUpdate<ManagedAtom extends TimelineManageable> = TimelineAtomUpdate<ManagedAtom> | TimelineMoleculeCreation | TimelineMoleculeDisposal | TimelineSelectorUpdate<ManagedAtom> | TimelineStateCreation<AtomOnly<ManagedAtom>> | TimelineStateDisposal<AtomOnly<ManagedAtom>> | TimelineTransactionUpdate;
207
+
208
+ /**
209
+ * @public
210
+ * Disposes of a state in the implicit store
211
+ * @param token - The token of the state to dispose
212
+ * @overload Default
213
+ */
214
+ declare function disposeState(token: ReadableToken<any>): void;
215
+ /**
216
+ * @public
217
+ * Disposes of a state family in the implicit store
218
+ * @param token - The token of the state family to dispose
219
+ * @param key - The unique key of the state to dispose
220
+ */
221
+ declare function disposeState<K extends Canonical>(token: ReadableFamilyToken<any, K>, key: K): void;
222
+
223
+ /**
224
+ * @public
225
+ * Finds a {@link MutableAtomToken} in the store
226
+ * @param token - A {@link MutableAtomFamilyToken}
227
+ * @param key - The key of the state
228
+ * @returns
229
+ * The current value of the state
230
+ * @overload Mutable Atom
231
+ */
232
+ declare function findState<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical, Key extends K>(token: MutableAtomFamilyToken<T, J, K>, key: Key): MutableAtomToken<T, J, K>;
233
+ /**
234
+ * @public
235
+ * Finds a state in the store
236
+ * @param token - The token of the state family
237
+ * @param key - The key of the state
238
+ * @returns
239
+ * The current value of the state
240
+ * @overload Regular Atom
241
+ */
242
+ declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
243
+ /**
244
+ * @public
245
+ * Finds a state in the store
246
+ * @param token - The token of the state family
247
+ * @param key - The key of the state
248
+ * @returns
249
+ * The current value of the state
250
+ * @overload Writable Selector
251
+ */
252
+ declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken<T, K>, key: Key): WritableSelectorToken<T, K>;
253
+ /**
254
+ * @public
255
+ * Finds a state in the store
256
+ * @param token - The token of the state family
257
+ * @param key - The key of the state
258
+ * @returns
259
+ * The current value of the state
260
+ * @overload Readonly Selector
261
+ */
262
+ declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken<T, K>, key: Key): ReadonlySelectorToken<T, K>;
263
+ /**
264
+ * @public
265
+ * Finds a state in the store
266
+ * @param token - The token of the state family
267
+ * @param key - The key of the state
268
+ * @returns
269
+ * The current value of the state
270
+ * @overload Writable State
271
+ */
272
+ declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken<T, K>, key: Key): WritableToken<T, K>;
273
+ /**
274
+ * @public
275
+ * Finds a {@link ReadableToken} in the store
276
+ * @param token - A {@link ReadableFamilyToken}
277
+ * @param key - The key of the state
278
+ * @returns
279
+ * The current value of the state
280
+ * @overload Unknown
281
+ * @default
282
+ */
283
+ declare function findState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
284
+
285
+ /**
286
+ * @public
287
+ * Get the current value of a state
288
+ * @param token - The token of the state to get
289
+ * @return The current value of the state
290
+ * @overload Default
291
+ * @default
292
+ */
293
+ declare function getState<T>(token: ReadableToken<T>): T;
294
+ /**
295
+ * @public
296
+ * Get the current value of a state family
297
+ * @param token - The token of a state family
298
+ * @param key - The unique key of the state to get
299
+ * @return The current value of the state
300
+ * @overload Streamlined
301
+ */
302
+ declare function getState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): T;
303
+
304
+ type SetUpdate = `add:${string}` | `clear:${string}` | `del:${string}` | `tx:${string}`;
305
+ type NumberedSetUpdate = `${number}=${SetUpdate}`;
306
+ interface SetRTXJson<P extends primitive> extends Json.Object {
307
+ members: P[];
308
+ cache: (NumberedSetUpdate | null)[];
309
+ cacheLimit: number;
310
+ cacheIdx: number;
311
+ cacheUpdateNumber: number;
312
+ }
313
+ declare class SetRTX<P extends primitive> extends Set<P> implements Transceiver<NumberedSetUpdate>, Lineage {
314
+ mode: TransceiverMode;
315
+ readonly subject: Subject<SetUpdate>;
316
+ cacheLimit: number;
317
+ cache: (NumberedSetUpdate | null)[];
318
+ cacheIdx: number;
319
+ cacheUpdateNumber: number;
320
+ constructor(values?: Iterable<P>, cacheLimit?: number);
321
+ toJSON(): SetRTXJson<P>;
322
+ static fromJSON<P extends primitive>(json: SetRTXJson<P>): SetRTX<P>;
323
+ add(value: P): this;
324
+ clear(): void;
325
+ delete(value: P): boolean;
326
+ readonly parent: SetRTX<P> | null;
327
+ child: SetRTX<P> | null;
328
+ transactionUpdates: SetUpdate[] | null;
329
+ transaction(run: (child: SetRTX<P>) => boolean): void;
330
+ protected _subscribe(key: string, fn: (update: SetUpdate) => void): () => void;
331
+ subscribe(key: string, fn: (update: NumberedSetUpdate) => void): () => void;
332
+ emit(update: SetUpdate): void;
333
+ private doStep;
334
+ getUpdateNumber(update: NumberedSetUpdate): number;
335
+ do(update: NumberedSetUpdate): number | `OUT_OF_RANGE` | null;
336
+ undoStep(update: SetUpdate): void;
337
+ undo(update: NumberedSetUpdate): number | null;
338
+ }
339
+
340
+ interface JoinOptions<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> extends JunctionSchemaBase<ASide, BSide>, Partial<JunctionEntriesBase<AType, BType, Content>> {
341
+ readonly key: string;
342
+ readonly cardinality: Cardinality;
343
+ readonly isAType: Refinement<string, AType>;
344
+ readonly isBType: Refinement<string, BType>;
345
+ }
346
+ type JoinToken<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null = null> = {
347
+ key: string;
348
+ type: `join`;
349
+ cardinality: Cardinality;
350
+ a: ASide;
351
+ b: BSide;
352
+ __aType?: AType;
353
+ __bType?: BType;
354
+ __content?: Content;
355
+ };
356
+ type JoinStates<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
357
+ readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
358
+ AType,
359
+ Content
360
+ ] | null, BType>;
361
+ } & {
362
+ readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
363
+ BType,
364
+ Content
365
+ ] | null, AType>;
366
+ } : {}) & {
367
+ readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
368
+ } & {
369
+ readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType | null, AType>;
370
+ } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
371
+ readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
372
+ AType,
373
+ Content
374
+ ] | null, BType>;
375
+ } & {
376
+ readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
377
+ BType,
378
+ Content
379
+ ][], AType>;
380
+ } : {}) & {
381
+ readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
382
+ } & {
383
+ readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
384
+ } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
385
+ readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
386
+ AType,
387
+ Content
388
+ ][], BType>;
389
+ } & {
390
+ readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
391
+ BType,
392
+ Content
393
+ ][], AType>;
394
+ } : {}) & {
395
+ readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType[], BType>;
396
+ } & {
397
+ readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
398
+ } : never;
399
+
400
+ declare const LoggerIconDictionary: {
401
+ readonly "\u231B": "Timeline event fully captured";
402
+ readonly "\u23E9": "Timeline redo";
403
+ readonly "\u23EA": "Timeline undo";
404
+ readonly "\u23ED\uFE0F": "Transaction redo";
405
+ readonly "\u23EE\uFE0F": "Transaction undo";
406
+ readonly "\u23F3": "Timeline event partially captured";
407
+ readonly "\u23F9\uFE0F": "Time-travel complete";
408
+ readonly "\u2705": "Realtime transaction success";
409
+ readonly "\u2728": "Computation complete";
410
+ readonly "\u274C": "Conflict prevents attempted action";
411
+ readonly "\u2B55": "Operation start";
412
+ readonly "\uD83D\uDD34": "Operation complete";
413
+ readonly "\u2757": "Operation blocked";
414
+ readonly "\uD83D\uDFE2": "Operation unblocked";
415
+ readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
416
+ readonly "\uD83D\uDC40": "Subscription added";
417
+ readonly "\uD83D\uDC4B": "Greeting";
418
+ readonly "\uD83D\uDC4D": "Realtime acknowledgment";
419
+ readonly "\uD83D\uDC6A": "Family member added";
420
+ readonly "\uD83D\uDC81": "Notice";
421
+ readonly "\uD83D\uDCA5": "Caught";
422
+ readonly "\uD83D\uDCC1": "Stow update";
423
+ readonly "\uD83D\uDCC3": "Copy mutable";
424
+ readonly "\uD83D\uDCD6": "Read state";
425
+ readonly "\uD83D\uDCDD": "Write state";
426
+ readonly "\uD83D\uDCE2": "Notify subscribers";
427
+ readonly "\uD83D\uDD04": "Realtime transaction synchronized";
428
+ readonly "\uD83D\uDD0C": "Register dependency";
429
+ readonly "\uD83D\uDD0D": "Discover root";
430
+ readonly "\uD83D\uDD25": "Delete state";
431
+ readonly "\uD83D\uDD27": "Create mutable atom";
432
+ readonly "\uD83D\uDD28": "Create immutable atom";
433
+ readonly "\uD83D\uDDD1": "Evict cached value";
434
+ readonly "\uD83D\uDE48": "Subscription canceled";
435
+ readonly "\uD83D\uDE80": "Performance measure";
436
+ readonly "\uD83D\uDEC4": "Apply transaction";
437
+ readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
438
+ readonly "\uD83D\uDEEB": "Begin transaction";
439
+ readonly "\uD83D\uDEEC": "Complete transaction";
440
+ readonly "\uD83E\uDDEE": "Computing selector";
441
+ readonly "\uD83E\uDDF9": "Prepare to evict";
442
+ readonly "\uD83E\uDE82": "Abort transaction";
443
+ readonly "\uD83E\uDD1E": "Realtime optimistic update enqueued";
444
+ readonly "\uD83D\uDC48": "Realtime confirmed update enqueued";
445
+ readonly "\uD83E\uDDD1\u200D\u2696\uFE0F": "Realtime update beginning reconciliation";
446
+ readonly "\uD83D\uDECE\uFE0F": "Realtime transaction received";
447
+ readonly "\uD83D\uDD2D": "Determining realtime perspective";
448
+ readonly "\uD83D\uDD8C": "Redacting realtime update";
449
+ readonly "\uD83D\uDC41": "Determining perspective";
450
+ };
451
+ type LoggerIcon = keyof typeof LoggerIconDictionary;
452
+ type TokenDenomination = `atom_family` | `atom` | `continuity` | `molecule_family` | `molecule` | `mutable_atom_family` | `mutable_atom` | `readonly_selector_family` | `readonly_selector` | `selector_family` | `selector` | `state` | `timeline` | `transaction` | `unknown`;
453
+ declare const LOG_LEVELS: readonly ["info", "warn", "error"];
454
+ type LogLevel = (typeof LOG_LEVELS)[number];
455
+ type LogFn = (icon: LoggerIcon, denomination: TokenDenomination, tokenKey: string, message: string, ...rest: unknown[]) => void;
456
+ type LogFilter = (...params: Parameters<LogFn>) => boolean;
457
+ type Logger = Record<LogLevel, LogFn>;
458
+ declare class AtomIOLogger implements Logger {
459
+ logLevel: `error` | `info` | `warn` | null;
460
+ private readonly filter?;
461
+ private readonly logger;
462
+ constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
463
+ error: LogFn;
464
+ info: LogFn;
465
+ warn: LogFn;
466
+ }
467
+
468
+ declare const $claim: unique symbol;
469
+ type Claim<K extends Canonical> = K & {
470
+ [$claim]?: true;
471
+ };
472
+ declare class Realm<H extends Hierarchy> {
473
+ store: Store;
474
+ constructor(store?: Store);
475
+ allocate<V extends Vassal<H>, A extends Above<V, H>>(provenance: A, key: V, attachmentStyle?: `all` | `any`): Claim<V>;
476
+ fuse<C extends CompoundFrom<H>, T extends C extends CompoundTypedKey<infer t, any, any> ? t : never, A extends C extends CompoundTypedKey<any, infer v, any> ? v : never, B extends C extends CompoundTypedKey<any, any, infer m> ? m : never>(type: T, reagentA: SingularTypedKey<A>, reagentB: SingularTypedKey<B>): Claim<CompoundTypedKey<T, A, B>>;
477
+ deallocate<V extends Vassal<H>>(claim: Claim<V>): void;
478
+ claim<V extends Exclude<Vassal<H>, CompoundTypedKey>, A extends Above<V, H>>(newProvenance: A, claim: Claim<V>, exclusive?: `exclusive`): Claim<V>;
479
+ }
480
+ declare class Anarchy {
481
+ store: Store;
482
+ realm: Realm<any>;
483
+ constructor(store?: Store);
484
+ allocate(provenance: Canonical, key: Canonical, attachmentStyle?: `all` | `any`): void;
485
+ deallocate(key: Canonical): void;
486
+ claim(newProvenance: Canonical, key: Canonical, exclusive?: `exclusive`): void;
487
+ }
488
+ declare const T$ = "T$";
489
+ type T$ = typeof T$;
490
+ type TypeTag<T extends string> = `${T$}--${T}`;
491
+ type SingularTypedKey<T extends string = string> = `${T}::${string}`;
492
+ type CompoundTypedKey<A extends string = string, B extends string = string, C extends string = string> = `${TypeTag<A>}==${SingularTypedKey<B>}++${SingularTypedKey<C>}`;
493
+ type TypedKey<A extends string = string, B extends string = string, C extends string = string> = CompoundTypedKey<A, B, C> | SingularTypedKey<A>;
494
+ type Scope = SingularTypedKey[];
495
+ type MutualFealty = {
496
+ above: Scope;
497
+ below: CompoundTypedKey;
498
+ };
499
+ type ExclusiveFealty = {
500
+ above: TypedKey | `root`;
501
+ below: Scope;
502
+ };
503
+ type Fealty = ExclusiveFealty | MutualFealty;
504
+ type Hierarchy<F extends Fealty[] = Fealty[]> = Each<F>;
505
+ type Vassal<H extends Hierarchy> = {
506
+ [K in keyof H]: H[K] extends MutualFealty ? H[K][`below`] : H[K] extends {
507
+ below: Array<infer V>;
508
+ } ? V extends TypedKey ? V : never : never;
509
+ }[keyof H];
510
+ type Above<TK extends TypedKey, H extends Hierarchy> = {
511
+ [K in keyof H]: H[K] extends MutualFealty ? TK extends H[K][`below`] ? H[K][`above`] : never : H[K] extends {
512
+ below: Array<infer V>;
513
+ } ? TK extends V ? H[K] extends ExclusiveFealty ? H[K][`above`] : never : never : never;
514
+ }[keyof H];
515
+ type CompoundFrom<H extends Hierarchy> = {
516
+ [K in keyof H]: H[K] extends MutualFealty ? H[K][`below`] : never;
517
+ }[keyof H];
518
+
519
+ /**
520
+ * @public
521
+ * A function that sets the value of a state.
522
+ * @param oldValue - The current value of the state.
523
+ * @returns
524
+ * The new value of the state.
525
+ */
526
+ type Setter<T, New extends T> = (oldValue: T) => New;
527
+ /**
528
+ * @public
529
+ * Set the value of a state into the implicit store.
530
+ * @param token - An atom or writable selector token.
531
+ * @param value - The new value of the state.
532
+ * @overload Default
533
+ * @default
534
+ */
535
+ declare function setState<T, New extends T>(token: WritableToken<T>, value: New | Setter<T, New>): void;
536
+ /**
537
+ * @public
538
+ * Set the value of a state into the implicit store.
539
+ * @param token - An atom family or writable selector family token.
540
+ * @param key - The unique key of the state to set.
541
+ * @param value - The new value of the state.
542
+ * @overload Streamlined
543
+ */
544
+ declare function setState<T, K extends Canonical, New extends T, Key extends K>(token: WritableFamilyToken<T, K>, key: Key, value: New | Setter<T, New>): void;
545
+
546
+ type StateUpdate<T> = {
547
+ newValue: T;
548
+ oldValue: T;
549
+ };
550
+ type KeyedStateUpdate<T> = Flat<StateUpdate<T> & {
551
+ key: string;
552
+ type: `atom_update` | `selector_update`;
553
+ family?: FamilyMetadata;
554
+ }>;
555
+ type UpdateHandler<T> = (update: StateUpdate<T>) => void;
556
+ type TransactionUpdateHandler<F extends Func> = (data: TransactionUpdate<F>) => void;
557
+
558
+ type TokenType<Comparison extends ReadableFamilyToken<any, any> | ReadableToken<any>> = Comparison extends ReadableToken<infer RepresentedValue> ? RepresentedValue : Comparison extends ReadableFamilyToken<infer RepresentedValue, any> ? RepresentedValue : never;
559
+
560
+ /**
561
+ * @public
562
+ * A token is an object that uniquely identifies a particular state, family, timeline, or transaction.
563
+ *
564
+ * While they represent one of these resources, they are not the resource itself. Think of them like paper currency representing money in the bank.
565
+ *
566
+ * Tokens are returned from resource creation functions, such as {@link atom} and {@link transaction}.
567
+ *
568
+ * Tokens can be used as parameters to functions that take a token, such as {@link getState}, {@link setState}, or {@link runTransaction}.
569
+ *
570
+ * Tokens are fully serializable, so they can be passed between processes.
571
+ */
572
+ type AtomIOToken = ReadableFamilyToken<any, any> | ReadableToken<any> | TimelineToken<any> | TransactionToken<any>;
573
+ /** @public */
574
+ type RegularAtomToken<T, K extends Canonical = any> = {
575
+ /** The unique identifier of the atom. */
576
+ key: string;
577
+ /** Discriminator. */
578
+ type: `atom`;
579
+ /** Present if the atom belongs to a family. */
580
+ family?: FamilyMetadata<K>;
581
+ /** Never present. This is a marker that preserves the type of the atom's value. */
582
+ __T?: T;
583
+ };
584
+ /** @public */
585
+ type MutableAtomToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical = any> = {
586
+ /** The unique identifier of the atom. */
587
+ key: string;
588
+ /** Discriminator. */
589
+ type: `mutable_atom`;
590
+ /** Present if the atom belongs to a family. */
591
+ family?: FamilyMetadata<K>;
592
+ /** Never present. This is a marker that preserves the JSON form of the atom's transceiver value. */
593
+ __J?: J;
594
+ /** Never present. This is a marker that preserves the type of the atom's transceiver value. */
595
+ __U?: T extends Transceiver<infer Update> ? Update : never;
596
+ };
597
+ /** @public */
598
+ type AtomToken<T, K extends Canonical = any> = MutableAtomToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomToken<T, K>;
599
+ /** @public */
600
+ type WritableSelectorToken<T, K extends Canonical = any> = {
601
+ /** The unique identifier of the selector. */
602
+ key: string;
603
+ /** Discriminator. */
604
+ type: `selector`;
605
+ /** Present if the selector belongs to a family. */
606
+ family?: FamilyMetadata<K>;
607
+ /** Never present. This is a marker that preserves the type of the selector's value. */
608
+ __T?: T;
609
+ };
610
+ /** @public */
611
+ type ReadonlySelectorToken<T, K extends Canonical = any> = {
612
+ /** The unique identifier of the selector. */
613
+ key: string;
614
+ /** Discriminator. */
615
+ type: `readonly_selector`;
616
+ /** Present if the selector belongs to a family. */
617
+ family?: FamilyMetadata<K>;
618
+ /** Never present. This is a marker that preserves the type of the selector's value. */
619
+ __T?: T;
620
+ };
621
+ /** @public */
622
+ type SelectorToken<T, K extends Canonical = any> = ReadonlySelectorToken<T, K> | WritableSelectorToken<T, K>;
623
+ /**
624
+ * @public
625
+ * These states can be set.
626
+ */
627
+ type WritableToken<T, K extends Canonical = any> = AtomToken<T, K> | WritableSelectorToken<T, K>;
628
+ /**
629
+ * @public
630
+ * These states cannot be set.
631
+ */
632
+ type ReadableToken<T, K extends Canonical = any> = AtomToken<T, K> | SelectorToken<T, K>;
633
+ /**
634
+ * @public
635
+ * States belonging to this family can be set.
636
+ */
637
+ type WritableFamilyToken<T, K extends Canonical> = AtomFamilyToken<T, K> | WritableSelectorFamilyToken<T, K>;
638
+ /**
639
+ * @public
640
+ * States belonging to this family cannot be set.
641
+ */
642
+ type ReadableFamilyToken<T, K extends Canonical> = AtomFamilyToken<T, K> | SelectorFamilyToken<T, K>;
643
+ /**
644
+ * @public
645
+ * Identifies a state's connection to its family.
646
+ */
647
+ type FamilyMetadata<K extends Canonical = any> = {
648
+ /** The family's unique key. */
649
+ key: string;
650
+ /** The family member's unique identifier, in the form of a string. */
651
+ subKey: stringified<K>;
652
+ };
5
653
 
6
654
  declare class CircularBuffer<T> {
7
655
  protected _buffer: T[];
@@ -142,11 +790,11 @@ declare class Junction<const ASide extends string, const AType extends string, c
142
790
 
143
791
  declare const abortTransaction: (store: Store) => void;
144
792
 
145
- declare function actUponStore<F extends Func>(token: TransactionToken<F>, id: string, store: Store): (...parameters: Parameters<F>) => ReturnType<F>;
793
+ declare function actUponStore<F extends Func>(store: Store, token: TransactionToken<F>, id: string): (...parameters: Parameters<F>) => ReturnType<F>;
146
794
 
147
795
  declare const applyTransaction: <F extends Func>(output: ReturnType<F>, store: Store) => void;
148
796
 
149
- declare function assignTransactionToContinuity(continuityKey: string, transactionKey: string, store: Store): void;
797
+ declare function assignTransactionToContinuity(store: Store, continuityKey: string, transactionKey: string): void;
150
798
 
151
799
  interface RootStore extends Store {
152
800
  transactionMeta: TransactionEpoch;
@@ -161,7 +809,7 @@ interface ChildStore extends Store {
161
809
  declare function isRootStore(store: Store): store is RootStore;
162
810
  declare function isChildStore(store: Store): store is ChildStore;
163
811
 
164
- declare const buildTransaction: (key: string, params: any[], store: Store, id: string) => ChildStore;
812
+ declare const buildTransaction: (store: Store, key: string, params: any[], id: string) => ChildStore;
165
813
 
166
814
  declare class Subject<T> {
167
815
  Subscriber: (value: T) => void;
@@ -183,14 +831,14 @@ type Transaction<F extends Func> = {
183
831
  subject: Subject<TransactionUpdate<F>>;
184
832
  run: (parameters: Parameters<F>, id?: string) => ReturnType<F>;
185
833
  };
186
- declare function createTransaction<F extends Func>(options: TransactionOptions<F>, store: Store): TransactionToken<F>;
834
+ declare function createTransaction<F extends Func>(store: Store, options: TransactionOptions<F>): TransactionToken<F>;
187
835
 
188
- declare function getContinuityKey(transactionKey: string, store: Store): string | undefined;
189
- declare function getEpochNumberOfContinuity(continuityKey: string, store: Store): number | undefined;
190
- declare function getEpochNumberOfAction(transactionKey: string, store: Store): number | undefined;
836
+ declare function getContinuityKey(store: Store, transactionKey: string): string | undefined;
837
+ declare function getEpochNumberOfContinuity(store: Store, continuityKey: string): number | undefined;
838
+ declare function getEpochNumberOfAction(store: Store, transactionKey: string): number | undefined;
191
839
 
192
- declare function setEpochNumberOfContinuity(continuityKey: string, newEpoch: number, store: Store): void;
193
- declare function setEpochNumberOfAction(transactionKey: string, newEpoch: number, store: Store): void;
840
+ declare function setEpochNumberOfContinuity(store: Store, continuityKey: string, newEpoch: number): void;
841
+ declare function setEpochNumberOfAction(store: Store, transactionKey: string, newEpoch: number): void;
194
842
 
195
843
  declare const TRANSACTION_PHASES: readonly ["idle", "building", "applying"];
196
844
  type TransactionPhase = (typeof TRANSACTION_PHASES)[number];
@@ -221,20 +869,93 @@ declare function deposit<T>(state: SelectorFamily<T, any>): SelectorFamilyToken<
221
869
  declare function deposit<T>(state: WritableFamily<T, any>): WritableFamilyToken<T, any>;
222
870
  declare function deposit<T>(state: ReadableFamily<T, any>): ReadableFamilyToken<T, any>;
223
871
  declare function deposit<T extends Func>(state: Transaction<T>): TransactionToken<T>;
224
- declare function deposit(state: ReadableState<any>): ReadableToken<any>;
225
- declare function deposit(state: ReadableFamily<any, any> | ReadableState<any> | Transaction<Func>): ReadableFamilyToken<any, any> | ReadableToken<any> | TransactionToken<Func>;
872
+ declare function deposit<M extends TimelineManageable>(state: Timeline<M>): TimelineToken<M>;
873
+ declare function deposit(resource: AtomIOInternalResource): AtomIOToken;
226
874
 
227
- interface Lineage {
228
- parent: typeof this | null;
229
- child: typeof this | null;
230
- }
231
- declare function newest<T extends Lineage>(scion: T): T;
875
+ declare function editRelationsInStore<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, change: (relations: Junction<ASide, AType, BSide, BType, Content>) => void, store: Store): void;
876
+
877
+ declare function findRelationsInStore<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, key: AType | BType, store: Store): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
878
+
879
+ declare function getInternalRelationsFromStore(token: JoinToken<any, any, any, any, any, any>, store: Store): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
232
880
 
233
881
  type Molecule<K extends Canonical> = {
234
882
  readonly key: K;
235
883
  readonly stringKey: stringified<K>;
236
884
  readonly dependsOn: `all` | `any`;
237
885
  };
886
+ declare function makeRootMoleculeInStore<S extends string>(key: S, store?: Store): S;
887
+ declare function allocateIntoStore<H extends Hierarchy, V extends Vassal<H>, A extends Above<V, H>>(store: Store, provenance: A, key: V, dependsOn?: `all` | `any`): Claim<V>;
888
+ declare function fuseWithinStore<H extends Hierarchy, C extends CompoundFrom<H>, T extends C extends CompoundTypedKey<infer t, any, any> ? t : never, A extends C extends CompoundTypedKey<any, infer a, any> ? a : never, B extends C extends CompoundTypedKey<any, any, infer b> ? b : never>(store: Store, type: T, sideA: SingularTypedKey<A>, sideB: SingularTypedKey<B>): Claim<CompoundTypedKey<T, A, B>>;
889
+ declare function deallocateFromStore<H extends Hierarchy, V extends Vassal<H>>(store: Store, claim: Claim<V>): void;
890
+ declare function claimWithinStore<H extends Hierarchy, V extends Exclude<Vassal<H>, CompoundTypedKey>, A extends Above<V, H>>(store: Store, newProvenance: A, claim: Claim<V>, exclusive?: `exclusive`): Claim<V>;
891
+
892
+ type JoinStateFamilies<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
893
+ readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
894
+ AType,
895
+ Content
896
+ ] | null, BType>;
897
+ } & {
898
+ readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
899
+ BType,
900
+ Content
901
+ ] | null, AType>;
902
+ } : {}) & {
903
+ readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
904
+ } & {
905
+ readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType | null, AType>;
906
+ } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
907
+ readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
908
+ AType,
909
+ Content
910
+ ] | null, BType>;
911
+ } & {
912
+ readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
913
+ BType,
914
+ Content
915
+ ][], AType>;
916
+ } : {}) & {
917
+ readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
918
+ } & {
919
+ readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
920
+ } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
921
+ readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
922
+ AType,
923
+ Content
924
+ ][], BType>;
925
+ } & {
926
+ readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
927
+ BType,
928
+ Content
929
+ ][], AType>;
930
+ } : {}) & {
931
+ readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType[], BType>;
932
+ } & {
933
+ readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
934
+ } : never;
935
+ declare class Join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object | null = null, const ContentKey extends CompoundTypedKey<`content`, ASide, BSide> = CompoundTypedKey<`content`, ASide, BSide>> {
936
+ private toolkit;
937
+ options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>;
938
+ defaultContent: Content | undefined;
939
+ molecules: Map<string, Molecule<any>>;
940
+ relations: Junction<ASide, AType, BSide, BType, Content>;
941
+ states: JoinStateFamilies<ASide, AType, BSide, BType, Cardinality, Content>;
942
+ core: {
943
+ relatedKeysAtoms: MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
944
+ };
945
+ transact(toolkit: SetterToolkit, run: (join: Join<ASide, AType, BSide, BType, Cardinality, Content>) => void): void;
946
+ store: Store;
947
+ realm: Anarchy;
948
+ [Symbol.dispose](): void;
949
+ constructor(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content | undefined, store?: Store);
950
+ }
951
+
952
+ declare function getJoin<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, store: Store): Join<ASide, AType, BSide, BType, Cardinality, Content>;
953
+
954
+ interface Lineage {
955
+ parent: typeof this | null;
956
+ child: typeof this | null;
957
+ }
958
+ declare function newest<T extends Lineage>(scion: T): T;
238
959
 
239
960
  type OperationProgress = {
240
961
  open: false;
@@ -292,7 +1013,7 @@ type Timeline<ManagedAtom extends TimelineManageable> = {
292
1013
  subject: Subject<TimelineUpdate<ManagedAtom> | `redo` | `undo`>;
293
1014
  subscriptions: Map<string, () => void>;
294
1015
  };
295
- declare function createTimeline<ManagedAtom extends TimelineManageable>(options: TimelineOptions<ManagedAtom>, store: Store, data?: Timeline<ManagedAtom>): TimelineToken<ManagedAtom>;
1016
+ declare function createTimeline<ManagedAtom extends TimelineManageable>(store: Store, options: TimelineOptions<ManagedAtom>, data?: Timeline<ManagedAtom>): TimelineToken<ManagedAtom>;
296
1017
 
297
1018
  declare const timeTravel: (store: Store, action: `redo` | `undo`, token: TimelineToken<any>) => void;
298
1019
 
@@ -310,7 +1031,7 @@ declare class Store implements Lineage {
310
1031
  source: string;
311
1032
  }>;
312
1033
  trackers: Map<string, Tracker<Transceiver<any>>>;
313
- families: Map<string, MutableAtomFamily<any, any, any> | ReadonlySelectorFamily<any, any> | RegularAtomFamily<any, any> | WritableSelectorFamily<any, any>>;
1034
+ families: Map<string, MutableAtomFamily<any, any, any> | RegularAtomFamily<any, any> | ReadonlySelectorFamily<any, any> | WritableSelectorFamily<any, any>>;
314
1035
  joins: Map<string, Join<any, any, any, any, any, any, `T$--content==${any}::${string}++${any}::${string}`>>;
315
1036
  transactions: Map<string, Transaction<Func>>;
316
1037
  transactionMeta: TransactionEpoch | TransactionProgress<Func>;
@@ -355,26 +1076,27 @@ declare const IMPLICIT: {
355
1076
  };
356
1077
  declare const clearStore: (store: Store) => void;
357
1078
 
358
- type Withdrawable = Atom<any> | AtomFamily<any, any> | Molecule<any> | MutableAtom<any, any> | MutableAtomFamily<any, any, any> | ReadableFamily<any, any> | ReadableState<any> | ReadonlySelector<any> | ReadonlySelectorFamily<any, any> | RegularAtom<any> | RegularAtomFamily<any, any> | Selector<any> | SelectorFamily<any, any> | Timeline<any> | Transaction<any> | WritableFamily<any, any> | WritableSelector<any> | WritableSelectorFamily<any, any> | WritableState<any>;
359
- declare function withdraw<T>(token: RegularAtomToken<T>, store: Store): RegularAtom<T>;
360
- declare function withdraw<T extends Transceiver<any>>(token: MutableAtomToken<T, any>, store: Store): MutableAtom<T, any>;
361
- declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T>;
362
- declare function withdraw<T>(token: WritableSelectorToken<T>, store: Store): WritableSelector<T>;
363
- declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T>;
364
- declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T>;
365
- declare function withdraw<T>(token: WritableToken<T>, store: Store): WritableState<T>;
366
- declare function withdraw<T>(token: ReadableToken<T>, store: Store): ReadableState<T>;
367
- declare function withdraw<T, K extends Canonical>(token: RegularAtomFamilyToken<T, K>, store: Store): RegularAtomFamily<T, K>;
368
- declare function withdraw<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical>(token: MutableAtomFamilyToken<T, J, K>, store: Store): MutableAtomFamily<T, J, K>;
369
- declare function withdraw<T, K extends Canonical>(token: AtomFamilyToken<T>, store: Store): AtomFamily<T, any>;
370
- declare function withdraw<T, K extends Canonical>(token: ReadonlySelectorFamilyToken<T, K>, store: Store): ReadonlySelectorFamily<T, any>;
371
- declare function withdraw<T, K extends Canonical>(token: WritableSelectorFamilyToken<T, K>, store: Store): WritableSelectorFamily<T, any>;
372
- declare function withdraw<T, K extends Canonical>(token: SelectorFamilyToken<T, K>, store: Store): SelectorFamily<T, any>;
373
- declare function withdraw<T, K extends Canonical>(token: ReadableFamilyToken<T, K>, store: Store): ReadableFamily<T, any>;
374
- declare function withdraw<T, K extends Canonical>(token: WritableFamilyToken<T, K>, store: Store): WritableFamily<T, any>;
375
- declare function withdraw<T extends Func>(token: TransactionToken<T>, store: Store): Transaction<T extends Func ? T : never>;
376
- declare function withdraw<T>(token: TimelineToken<T>, store: Store): Timeline<T extends TimelineManageable ? T : never>;
377
- declare function withdraw<T>(token: ReadableToken<T>, store: Store): ReadableState<T>;
1079
+ declare function withdraw<T>(store: Store, token: RegularAtomToken<T>): RegularAtom<T>;
1080
+ declare function withdraw<T extends Transceiver<any>>(store: Store, token: MutableAtomToken<T, any>): MutableAtom<T, any>;
1081
+ declare function withdraw<T>(store: Store, token: AtomToken<T>): Atom<T>;
1082
+ declare function withdraw<T>(store: Store, token: WritableSelectorToken<T>): WritableSelector<T>;
1083
+ declare function withdraw<T>(store: Store, token: ReadonlySelectorToken<T>): ReadonlySelector<T>;
1084
+ declare function withdraw<T>(store: Store, token: SelectorToken<T>): Selector<T>;
1085
+ declare function withdraw<T>(store: Store, token: WritableToken<T>): WritableState<T>;
1086
+ declare function withdraw<T>(store: Store, token: ReadableToken<T>): ReadableState<T>;
1087
+ declare function withdraw<T, K extends Canonical>(store: Store, token: RegularAtomFamilyToken<T, K>): RegularAtomFamily<T, K>;
1088
+ declare function withdraw<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical>(store: Store, token: MutableAtomFamilyToken<T, J, K>): MutableAtomFamily<T, J, K>;
1089
+ declare function withdraw<T, K extends Canonical>(store: Store, token: AtomFamilyToken<T>): AtomFamily<T, any>;
1090
+ declare function withdraw<T, K extends Canonical>(store: Store, token: ReadonlySelectorFamilyToken<T, K>): ReadonlySelectorFamily<T, any>;
1091
+ declare function withdraw<T, K extends Canonical>(store: Store, token: WritableSelectorFamilyToken<T, K>): WritableSelectorFamily<T, any>;
1092
+ declare function withdraw<T, K extends Canonical>(store: Store, token: SelectorFamilyToken<T, K>): SelectorFamily<T, any>;
1093
+ declare function withdraw<T, K extends Canonical>(store: Store, token: ReadableFamilyToken<T, K>): ReadableFamily<T, any>;
1094
+ declare function withdraw<T, K extends Canonical>(store: Store, token: WritableFamilyToken<T, K>): WritableFamily<T, any>;
1095
+ declare function withdraw<T extends Func>(store: Store, token: TransactionToken<T>): Transaction<T extends Func ? T : never>;
1096
+ declare function withdraw<T>(store: Store, token: TimelineToken<T>): Timeline<T extends TimelineManageable ? T : never>;
1097
+ declare function withdraw<T>(store: Store, token: WritableToken<T>): WritableState<T>;
1098
+ declare function withdraw<T>(store: Store, token: ReadableToken<T>): ReadableState<T>;
1099
+ declare function withdraw(store: Store, token: AtomIOToken): AtomIOInternalResource;
378
1100
 
379
1101
  interface Transceiver<S extends Json.Serializable> {
380
1102
  do: (update: S) => number | `OUT_OF_RANGE` | null;
@@ -413,11 +1135,12 @@ declare class Tracker<Mutable extends Transceiver<any>> {
413
1135
  private updateCore;
414
1136
  mutableState: MutableAtomToken<Mutable, Json.Serializable>;
415
1137
  latestUpdateState: RegularAtomToken<typeof this.Update | null>;
416
- dispose: () => void;
1138
+ [Symbol.dispose]: () => void;
417
1139
  constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
418
1140
  }
419
1141
 
420
1142
  declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Canonical> {
1143
+ private trackers;
421
1144
  private readonly Update;
422
1145
  readonly latestUpdateAtoms: RegularAtomFamily<typeof this.Update | null, FamilyMemberKey>;
423
1146
  readonly mutableAtoms: MutableAtomFamily<Core, any, FamilyMemberKey>;
@@ -431,11 +1154,11 @@ declare function createRegularAtom<T>(store: Store, options: RegularAtomOptions<
431
1154
  declare function createStandaloneAtom<T>(store: Store, options: RegularAtomOptions<T>): RegularAtomToken<T>;
432
1155
  declare function createStandaloneAtom<T extends Transceiver<any>, J extends Json.Serializable>(store: Store, options: MutableAtomOptions<T, J>): MutableAtomToken<T, J>;
433
1156
 
434
- declare function disposeAtom(atomToken: AtomToken<unknown>, store: Store): void;
1157
+ declare function disposeAtom(store: Store, atomToken: AtomToken<unknown>): void;
435
1158
 
436
- declare const isAtomDefault: (key: string, store: Store) => boolean;
437
- declare const markAtomAsDefault: (key: string, store: Store) => void;
438
- declare const markAtomAsNotDefault: (key: string, store: Store) => void;
1159
+ declare const isAtomDefault: (store: Store, key: string) => boolean;
1160
+ declare const markAtomAsDefault: (store: Store, key: string) => void;
1161
+ declare const markAtomAsNotDefault: (store: Store, key: string) => void;
439
1162
 
440
1163
  /**
441
1164
  * A Promise whose incoming value can be hot swapped.
@@ -457,11 +1180,13 @@ declare class Future<T> extends Promise<T> {
457
1180
  use(value: Promise<T> | T): void;
458
1181
  }
459
1182
 
460
- declare function cacheValue<T>(key: string, value: T, subject: Subject<StateUpdate<unknown>>, store: Store): T;
461
- declare function cacheValue<T extends Promise<any>>(key: string, value: T, subject: Subject<StateUpdate<unknown>>, store: Store): Future<T>;
1183
+ declare function cacheValue<T>(store: Store, key: string, value: T, subject: Subject<StateUpdate<unknown>>): T;
1184
+ declare function cacheValue<T extends Promise<any>>(store: Store, key: string, value: T, subject: Subject<StateUpdate<unknown>>): Future<T>;
462
1185
  declare const readCachedValue: <T>(token: ReadableState<any>, target: Store) => T;
463
1186
  declare const evictCachedValue: (key: string, target: Store) => void;
464
1187
 
1188
+ declare function capitalize<S extends string>(string: S): Capitalize<S>;
1189
+
465
1190
  declare function createAtomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical>(store: Store, options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamilyToken<T, J, K>;
466
1191
  declare function createAtomFamily<T, K extends Canonical>(store: Store, options: RegularAtomFamilyOptions<T, K>): RegularAtomFamilyToken<T, K>;
467
1192
 
@@ -510,7 +1235,7 @@ declare function getEnvironmentData(store: Store): EnvironmentData;
510
1235
  declare function getFromStore<T>(store: Store, token: ReadableToken<T>): T;
511
1236
  declare function getFromStore<T, K extends Canonical>(store: Store, token: ReadableFamilyToken<T, K>, key: K): T;
512
1237
 
513
- declare const readOrComputeValue: <T>(state: ReadableState<T>, target: Store) => T;
1238
+ declare const readOrComputeValue: <T>(target: Store, state: ReadableState<T>) => T;
514
1239
 
515
1240
  declare function getTrace(error: Error): string;
516
1241
 
@@ -538,11 +1263,11 @@ type ReadonlySelectorKey<T> = string & {
538
1263
  __readonlySelectorKey?: never;
539
1264
  __brand?: T;
540
1265
  };
541
- declare const isAtomKey: (key: string, store: Store) => key is AtomKey<unknown>;
542
- declare const isSelectorKey: (key: string, store: Store) => key is SelectorKey<unknown>;
543
- declare const isReadonlySelectorKey: (key: string, store: Store) => key is ReadonlySelectorKey<unknown>;
1266
+ declare const isAtomKey: (store: Store, key: string) => key is AtomKey<unknown>;
1267
+ declare const isSelectorKey: (store: Store, key: string) => key is SelectorKey<unknown>;
1268
+ declare const isReadonlySelectorKey: (store: Store, key: string) => key is ReadonlySelectorKey<unknown>;
544
1269
  type StateKey<T> = AtomKey<T> | ReadonlySelectorKey<T> | SelectorKey<T>;
545
- declare const isStateKey: (key: string, store: Store) => key is StateKey<unknown>;
1270
+ declare const isStateKey: (store: Store, key: string) => key is StateKey<unknown>;
546
1271
 
547
1272
  declare class LazyMap<K, V> extends Map<K, V> {
548
1273
  protected readonly source: Map<K, V>;
@@ -555,14 +1280,12 @@ declare class LazyMap<K, V> extends Map<K, V> {
555
1280
  delete(key: K): boolean;
556
1281
  }
557
1282
 
558
- type AtomIOToken = ReadableFamilyToken<any, any> | ReadableToken<any> | TimelineToken<any> | TransactionToken<any>;
559
- declare function prettyPrintTokenType(token: AtomIOToken): string;
560
-
561
1283
  declare class NotFoundError extends Error {
562
1284
  constructor(token: AtomIOToken, store: Store);
563
- constructor(familyToken: AtomIOToken, key: Json.Serializable, store: Store);
564
1285
  }
565
1286
 
1287
+ declare function prettyPrintTokenType(token: AtomIOToken): string;
1288
+
566
1289
  declare const createReadonlySelector: <T>(store: Store, options: ReadonlySelectorOptions<T>, family: FamilyMetadata | undefined) => ReadonlySelectorToken<T>;
567
1290
 
568
1291
  declare function createStandaloneSelector<T>(store: Store, options: WritableSelectorOptions<T>): WritableSelectorToken<T>;
@@ -570,7 +1293,7 @@ declare function createStandaloneSelector<T>(store: Store, options: ReadonlySele
570
1293
 
571
1294
  declare const createWritableSelector: <T>(store: Store, options: WritableSelectorOptions<T>, family: FamilyMetadata | undefined) => WritableSelectorToken<T>;
572
1295
 
573
- declare function disposeSelector(selectorToken: ReadonlySelectorToken<unknown> | WritableSelectorToken<unknown>, store: Store): void;
1296
+ declare function disposeSelector(store: Store, selectorToken: SelectorToken<unknown>): void;
574
1297
 
575
1298
  declare const getSelectorDependencyKeys: (key: string, store: Store) => (AtomKey<unknown> | ReadonlySelectorKey<unknown> | SelectorKey<unknown>)[];
576
1299
 
@@ -584,25 +1307,25 @@ declare const updateSelectorAtoms: (selectorKey: string, dependency: ReadonlySel
584
1307
  type Modify<T> = (thing: T) => T;
585
1308
  declare const become: <T>(nextVersionOfThing: Modify<T> | T) => (originalThing: T) => T;
586
1309
 
587
- declare const setAtomOrSelector: <T>(state: WritableState<T>, value: T | ((oldValue: T) => T), store: Store) => void;
1310
+ declare const setAtomOrSelector: <T>(store: Store, state: WritableState<T>, value: T | ((oldValue: T) => T)) => void;
588
1311
 
589
1312
  declare function setIntoStore<T, New extends T>(store: Store, token: WritableToken<T>, value: New | ((oldValue: T) => New)): void;
590
1313
  declare function setIntoStore<T, K extends Canonical, New extends T>(store: Store, token: WritableFamilyToken<T, K>, key: K, value: New | ((oldValue: T) => New)): void;
591
1314
 
592
- declare const recallState: <T>(state: ReadableState<T>, store: Store) => T;
1315
+ declare const recallState: <T>(store: Store, state: ReadableState<T>) => T;
593
1316
 
594
- declare function subscribeInStore<T>(store: Store$1, token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key?: string): () => void;
595
- declare function subscribeInStore<F extends Func$1>(store: Store$1, token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key?: string): () => void;
596
- declare function subscribeInStore<M extends TimelineManageable>(store: Store$1, token: TimelineToken<M>, handleUpdate: (update: TimelineUpdate<M> | `redo` | `undo`) => void, key?: string): () => void;
597
- declare function subscribeInStore<M extends TimelineManageable>(store: Store$1, token: ReadableToken<any> | TimelineToken<M> | TransactionToken<any>, handleUpdate: TransactionUpdateHandler<any> | UpdateHandler<any> | ((update: TimelineUpdate<M> | `redo` | `undo`) => void), key?: string): () => void;
1317
+ declare function subscribeInStore<T>(store: Store, token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key?: string): () => void;
1318
+ declare function subscribeInStore<F extends Func>(store: Store, token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key?: string): () => void;
1319
+ declare function subscribeInStore<M extends TimelineManageable>(store: Store, token: TimelineToken<M>, handleUpdate: (update: TimelineUpdate<M> | `redo` | `undo`) => void, key?: string): () => void;
1320
+ declare function subscribeInStore<M extends TimelineManageable>(store: Store, token: ReadableToken<any> | TimelineToken<M> | TransactionToken<any>, handleUpdate: TransactionUpdateHandler<any> | UpdateHandler<any> | ((update: TimelineUpdate<M> | `redo` | `undo`) => void), key?: string): () => void;
598
1321
 
599
- declare const subscribeToRootAtoms: <T>(selector: Selector<T>, store: Store) => (() => void)[];
1322
+ declare const subscribeToRootAtoms: <T>(store: Store, selector: Selector<T>) => (() => void)[];
600
1323
 
601
- declare function subscribeToState<T>(token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
1324
+ declare function subscribeToState<T>(store: Store, token: ReadableToken<T>, key: string, handleUpdate: UpdateHandler<T>): () => void;
602
1325
 
603
- declare const subscribeToTimeline: <ManagedAtom extends TimelineManageable>(token: TimelineToken<ManagedAtom>, handleUpdate: (update: TimelineUpdate<any> | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
1326
+ declare const subscribeToTimeline: <ManagedAtom extends TimelineManageable>(store: Store, token: TimelineToken<ManagedAtom>, key: string, handleUpdate: (update: TimelineUpdate<any> | `redo` | `undo`) => void) => (() => void);
604
1327
 
605
- declare const subscribeToTransaction: <F extends Func>(token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key: string, store: Store) => (() => void);
1328
+ declare const subscribeToTransaction: <F extends Func>(store: Store, token: TransactionToken<F>, key: string, handleUpdate: TransactionUpdateHandler<F>) => (() => void);
606
1329
 
607
1330
  type AtomIOState = {
608
1331
  key: string;
@@ -664,5 +1387,6 @@ type ReadonlySelectorFamily<T, K extends Canonical> = ReadonlySelectorFamilyToke
664
1387
  type SelectorFamily<T, K extends Canonical> = ReadonlySelectorFamily<T, K> | WritableSelectorFamily<T, K>;
665
1388
  type WritableFamily<T, K extends Canonical> = AtomFamily<T, K> | WritableSelectorFamily<T, K>;
666
1389
  type ReadableFamily<T, K extends Canonical> = AtomFamily<T, K> | SelectorFamily<T, K>;
1390
+ type AtomIOInternalResource = ReadableFamily<any, any> | ReadableState<any> | Timeline<any> | Transaction<any>;
667
1391
 
668
- export { type Atom, type AtomFamily, type AtomIOState, type AtomIOToken, type AtomKey, type BaseExternalStoreConfiguration, type ChildStore, CircularBuffer, type Count, type Each, type Empty, type EnvironmentData, type ExternalStoreConfiguration, type ExternalStoreWithContentConfiguration, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, type Flat, type Func, Future, IMPLICIT, Junction, type JunctionAdvancedConfiguration, type JunctionEntries, type JunctionEntriesBase, type JunctionJSON, type JunctionSchema, type JunctionSchemaBase, LazyMap, type Lineage, type Modify, type Molecule, type MutableAtom, type MutableAtomFamily, NotFoundError, type OperationProgress, type ReadableFamily, type ReadableState, type ReadonlySelector, type ReadonlySelectorFamily, type ReadonlySelectorKey, type Refinement, type RegularAtom, type RegularAtomFamily, type RootStore, type Selector, type SelectorFamily, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineMoleculeCreation, type TimelineMoleculeDisposal, type TimelineSelectorUpdate, type TimelineStateCreation, type TimelineStateDisposal, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type Withdrawable, type WritableFamily, type WritableSelector, type WritableSelectorFamily, type WritableState, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeSelector, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw };
1392
+ export { type Atom, type AtomFamily, type AtomIOInternalResource, type AtomIOState, type AtomKey, type BaseExternalStoreConfiguration, type ChildStore, CircularBuffer, type Count, type Each, type Empty, type EnvironmentData, type ExternalStoreConfiguration, type ExternalStoreWithContentConfiguration, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, type Flat, type Func, Future, IMPLICIT, Join, type JoinStateFamilies, Junction, type JunctionAdvancedConfiguration, type JunctionEntries, type JunctionEntriesBase, type JunctionJSON, type JunctionSchema, type JunctionSchemaBase, LazyMap, type Lineage, type Modify, type Molecule, type MutableAtom, type MutableAtomFamily, NotFoundError, type OperationProgress, type ReadableFamily, type ReadableState, type ReadonlySelector, type ReadonlySelectorFamily, type ReadonlySelectorKey, type Refinement, type RegularAtom, type RegularAtomFamily, type RootStore, type Selector, type SelectorFamily, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineMoleculeCreation, type TimelineMoleculeDisposal, type TimelineSelectorUpdate, type TimelineStateCreation, type TimelineStateDisposal, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type WritableFamily, type WritableSelector, type WritableSelectorFamily, type WritableState, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, editRelationsInStore, evictCachedValue, findInStore, findRelationsInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelationsFromStore, getJoin, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeRootMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw };