atom.io 0.33.21 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/eslint-plugin/index.js +1 -2
  2. package/dist/eslint-plugin/index.js.map +1 -1
  3. package/dist/internal/index.d.ts +10 -6
  4. package/dist/internal/index.d.ts.map +1 -1
  5. package/dist/internal/index.js +1262 -1253
  6. package/dist/internal/index.js.map +1 -1
  7. package/dist/json/index.d.ts +3 -0
  8. package/dist/json/index.d.ts.map +1 -1
  9. package/dist/json/index.js.map +1 -1
  10. package/dist/main/index.d.ts +405 -23
  11. package/dist/main/index.d.ts.map +1 -1
  12. package/dist/main/index.js +107 -11
  13. package/dist/main/index.js.map +1 -1
  14. package/dist/realtime-client/index.js +6 -10
  15. package/dist/realtime-client/index.js.map +1 -1
  16. package/dist/realtime-server/index.js +1 -1
  17. package/dist/realtime-server/index.js.map +1 -1
  18. package/dist/realtime-testing/index.d.ts.map +1 -1
  19. package/dist/realtime-testing/index.js +0 -1
  20. package/dist/realtime-testing/index.js.map +1 -1
  21. package/package.json +6 -6
  22. package/src/internal/atom/create-regular-atom.ts +6 -7
  23. package/src/internal/caching.ts +9 -9
  24. package/src/internal/future.ts +3 -0
  25. package/src/internal/get-state/read-or-compute-value.ts +12 -7
  26. package/src/internal/join/create-join.ts +27 -0
  27. package/src/internal/join/index.ts +1 -0
  28. package/src/internal/junction.ts +2 -0
  29. package/src/internal/mutable/create-mutable-atom.ts +2 -4
  30. package/src/internal/selector/create-readonly-held-selector.ts +10 -0
  31. package/src/internal/selector/create-readonly-pure-selector.ts +13 -4
  32. package/src/internal/selector/create-writable-held-selector.ts +11 -2
  33. package/src/internal/selector/create-writable-pure-selector.ts +11 -1
  34. package/src/internal/selector/trace-selector-atoms.ts +18 -40
  35. package/src/internal/selector/update-selector-atoms.ts +5 -5
  36. package/src/internal/set-state/evict-downstream.ts +2 -2
  37. package/src/internal/set-state/reset-atom-or-selector.ts +3 -3
  38. package/src/internal/store/store.ts +0 -1
  39. package/src/internal/subscribe/subscribe-to-root-atoms.ts +42 -38
  40. package/src/internal/subscribe/subscribe-to-state.ts +23 -11
  41. package/src/json/index.ts +3 -0
  42. package/src/main/atom.ts +54 -13
  43. package/src/main/dispose-state.ts +8 -2
  44. package/src/main/find-state.ts +44 -14
  45. package/src/main/get-state.ts +2 -2
  46. package/src/main/index.ts +8 -0
  47. package/src/main/join.ts +79 -22
  48. package/src/main/realm.ts +50 -4
  49. package/src/main/selector.ts +116 -6
  50. package/src/main/subscribe.ts +31 -1
  51. package/src/main/timeline.ts +17 -0
  52. package/src/main/transaction.ts +39 -3
  53. package/src/realtime-client/realtime-client-stores/client-sync-store.ts +2 -2
  54. package/src/realtime-testing/setup-realtime-test.tsx +0 -5
@@ -1,6 +1,6 @@
1
1
  import { Each, EnvironmentData, Flat, Func, Junction, JunctionEntriesBase, JunctionSchemaBase, Refinement, Store, Timeline, TimelineAtomUpdate, TimelineMoleculeCreation, TimelineMoleculeDisposal, TimelineSelectorUpdate, TimelineStateCreation, TimelineStateDisposal, TimelineTransactionUpdate, Transceiver } from "atom.io/internal";
2
2
  import { Canonical, Json, JsonInterface, stringified } from "atom.io/json";
3
- import { MutableAtomFamilyToken as MutableAtomFamilyToken$1, MutableAtomToken as MutableAtomToken$1, ReadableFamilyToken as ReadableFamilyToken$1, ReadableToken as ReadableToken$1, ReadonlyPureSelectorFamilyToken as ReadonlyPureSelectorFamilyToken$1, ReadonlyPureSelectorToken as ReadonlyPureSelectorToken$1, RegularAtomFamilyToken as RegularAtomFamilyToken$1, RegularAtomToken as RegularAtomToken$1, WritableFamilyToken as WritableFamilyToken$1, WritablePureSelectorFamilyToken as WritablePureSelectorFamilyToken$1, WritablePureSelectorToken as WritablePureSelectorToken$1, WritableToken as WritableToken$1, findState as findState$1, getState as getState$1, setState as setState$1 } from "atom.io";
3
+ import { MutableAtomFamilyToken as MutableAtomFamilyToken$1, MutableAtomToken as MutableAtomToken$1, ReadableFamilyToken as ReadableFamilyToken$1, ReadableToken as ReadableToken$1, ReadonlyPureSelectorFamilyToken as ReadonlyPureSelectorFamilyToken$1, ReadonlyPureSelectorToken as ReadonlyPureSelectorToken$1, ReadonlySelectorFamilyToken as ReadonlySelectorFamilyToken$1, ReadonlySelectorToken as ReadonlySelectorToken$1, RegularAtomFamilyToken as RegularAtomFamilyToken$1, RegularAtomToken as RegularAtomToken$1, WritableFamilyToken as WritableFamilyToken$1, WritablePureSelectorFamilyToken as WritablePureSelectorFamilyToken$1, WritablePureSelectorToken as WritablePureSelectorToken$1, WritableSelectorFamilyToken as WritableSelectorFamilyToken$1, WritableSelectorToken as WritableSelectorToken$1, WritableToken as WritableToken$1, findState as findState$1, getState as getState$1, setState as setState$1 } from "atom.io";
4
4
  import { SetRTX, SetRTXJson } from "atom.io/transceivers/set-rtx";
5
5
 
6
6
  //#region src/main/atom.d.ts
@@ -60,9 +60,16 @@ type RegularAtomOptions<T> = {
60
60
  /** Hooks used to run side effects when the atom is set */
61
61
  effects?: AtomEffect<T>[];
62
62
  };
63
- type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & Omit<RegularAtomOptions<T>, `default`> & {
64
- default: () => T;
63
+ /** @public */
64
+ type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & {
65
+ /** Used to signal that the atom is mutable */
65
66
  mutable: true;
67
+ /** The unique identifier of the atom */
68
+ key: string;
69
+ /** A function to create an initial value for the atom */
70
+ default: () => T;
71
+ /** Hooks used to run side effects when the atom is set */
72
+ effects?: AtomEffect<T>[];
66
73
  };
67
74
  /** @public */
68
75
  type RegularAtomFamilyOptions<T, K extends Canonical> = {
@@ -74,26 +81,59 @@ type RegularAtomFamilyOptions<T, K extends Canonical> = {
74
81
  effects?: (key: K) => AtomEffect<T>[];
75
82
  };
76
83
  type RegularAtomFamilyToken<T, K extends Canonical> = {
84
+ /** The unique identifier of the atom family */
77
85
  key: string;
86
+ /** Discriminator */
78
87
  type: `atom_family`;
88
+ /** Never present. This is a marker that preserves the type of atoms in this family */
79
89
  __T?: T;
90
+ /** Never present. This is a marker that preserves the type of keys used for atoms in this family */
80
91
  __K?: K;
81
92
  };
93
+ /** @public */
82
94
  type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = JsonInterface<T, J> & {
95
+ /** Used to signal that the atoms created from this family are mutable */
96
+ mutable: true;
97
+ /** The unique identifier of the atom family */
83
98
  key: string;
99
+ /** A function to create an initial value for each atom in the family */
84
100
  default: (key: K) => T;
101
+ /** Hooks used to run side effects when an atom in the family is set */
85
102
  effects?: (key: K) => AtomEffect<T>[];
86
- mutable: true;
87
103
  };
88
104
  type MutableAtomFamilyToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = {
105
+ /** The unique identifier of the atom family */
89
106
  key: string;
107
+ /** Discriminator */
90
108
  type: `mutable_atom_family`;
109
+ /** Never present. This is a marker that preserves the type of atoms in this family */
91
110
  __T?: T;
111
+ /** Never present. This is a marker that preserves the type of the JSON form of atoms in this family */
92
112
  __J?: J;
113
+ /** Never present. This is a marker that preserves the type of keys used for atoms in this family */
93
114
  __K?: K;
94
115
  };
95
116
  type AtomFamilyToken<T, K extends Canonical = Canonical> = MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomFamilyToken<T, K>;
117
+ /**
118
+ * @public
119
+ * Create a family of mutable atoms, allowing for the dynamic creation and disposal of atoms.
120
+ *
121
+ * The value of a mutable atom must be some kind of {@link Transceiver}.
122
+ *
123
+ * @param options - {@link MutableAtomFamilyOptions}
124
+ * @returns
125
+ * A reference to the atom family created: a {@link MutableAtomFamilyToken}
126
+ * @overload Mutable
127
+ */
96
128
  declare function atomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamilyToken<T, J, K>;
129
+ /**
130
+ * @public
131
+ * Create a family of regular atoms, allowing for the dynamic creation and disposal of atoms.
132
+ * @param options - {@link RegularAtomFamilyOptions}
133
+ * @returns
134
+ * A reference to the atom family created: a {@link RegularAtomFamilyToken}
135
+ * @overload Regular
136
+ */
97
137
  declare function atomFamily<T, K extends Canonical>(options: RegularAtomFamilyOptions<T, K>): RegularAtomFamilyToken<T, K>;
98
138
  //#endregion
99
139
  //#region src/main/reset-state.d.ts
@@ -115,45 +155,58 @@ declare function resetState(token: WritableToken<any>): void;
115
155
  declare function resetState<K extends Canonical>(token: WritableFamilyToken<any, K>, key: K): void;
116
156
  //#endregion
117
157
  //#region src/main/transaction.d.ts
158
+ /** @public */
118
159
  type TransactionToken<F extends Func> = {
160
+ /** The unique identifier of the transaction */
119
161
  key: string;
162
+ /** Discriminator */
120
163
  type: `transaction`;
164
+ /** Never present. This is a marker that preserves the type of the transaction function */
121
165
  __F?: F;
122
166
  };
167
+ /** @public */
123
168
  type StateCreation<Token extends ReadableToken<any>> = {
124
169
  type: `state_creation`;
125
170
  token: Token;
126
171
  };
172
+ /** @public */
127
173
  type AtomDisposal<Token extends ReadableToken<any>> = {
128
174
  type: `state_disposal`;
129
175
  subType: `atom`;
130
176
  token: Token;
131
177
  value: TokenType<Token>;
132
178
  };
179
+ /** @public */
133
180
  type SelectorDisposal<Token extends ReadableToken<any>> = {
134
181
  type: `state_disposal`;
135
182
  subType: `selector`;
136
183
  token: Token;
137
184
  };
185
+ /** @public */
138
186
  type StateDisposal<Token extends ReadableToken<any>> = AtomDisposal<Token> | SelectorDisposal<Token>;
187
+ /** @public */
139
188
  type MoleculeCreation = {
140
189
  type: `molecule_creation`;
141
190
  key: Canonical;
142
191
  provenance: Canonical;
143
192
  };
193
+ /** @public */
144
194
  type MoleculeDisposal = {
145
195
  type: `molecule_disposal`;
146
196
  key: Canonical;
147
197
  provenance: stringified<Canonical>[];
148
198
  values: [key: string, value: any][];
149
199
  };
200
+ /** @public */
150
201
  type MoleculeTransfer = {
151
202
  type: `molecule_transfer`;
152
203
  key: Canonical;
153
204
  from: Canonical[];
154
205
  to: Canonical[];
155
206
  };
207
+ /** @public */
156
208
  type TransactionUpdateContent = KeyedStateUpdate<unknown> | MoleculeCreation | MoleculeDisposal | MoleculeTransfer | StateCreation<ReadableToken<unknown>> | StateDisposal<ReadableToken<unknown>> | TransactionUpdate<Func>;
209
+ /** @public */
157
210
  type TransactionUpdate<F extends Func> = {
158
211
  type: `transaction_update`;
159
212
  key: string;
@@ -163,13 +216,16 @@ type TransactionUpdate<F extends Func> = {
163
216
  params: Parameters<F>;
164
217
  output: ReturnType<F>;
165
218
  };
219
+ /** @public */
166
220
  type GetterToolkit = Pick<SetterToolkit, `find` | `get` | `json`>;
221
+ /** @public */
167
222
  type SetterToolkit = Readonly<{
168
223
  get: typeof getState$1;
169
224
  set: typeof setState$1;
170
225
  find: typeof findState$1;
171
226
  json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritablePureSelectorToken<J>;
172
227
  }>;
228
+ /** @public */
173
229
  type ActorToolkit = Readonly<{
174
230
  get: typeof getState$1;
175
231
  set: typeof setState$1;
@@ -180,36 +236,68 @@ type ActorToolkit = Readonly<{
180
236
  run: typeof runTransaction;
181
237
  env: () => EnvironmentData;
182
238
  }>;
239
+ /** @public */
183
240
  type Read<F extends Func> = (toolkit: GetterToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
241
+ /** @public */
184
242
  type Write<F extends Func> = (toolkit: SetterToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
243
+ /** @public */
185
244
  type Transact<F extends Func> = (toolkit: ActorToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
245
+ /** @public */
246
+ type TransactionIO<Token extends TransactionToken<any>> = Token extends TransactionToken<infer F> ? F : never;
247
+ /** @public */
186
248
  type TransactionOptions<F extends Func> = {
249
+ /** The unique identifier of the transaction */
187
250
  key: string;
251
+ /** The operation to perform */
188
252
  do: Transact<F>;
189
253
  };
190
- type TransactionIO<Token extends TransactionToken<any>> = Token extends TransactionToken<infer F> ? F : never;
254
+ /**
255
+ * @public
256
+ * Create a transaction, a mechanism for batching updates multiple states in a single, all-or-nothing operation
257
+ * @param options - {@link TransactionOptions}
258
+ * @returns A reference to the transaction created: a {@link TransactionToken}
259
+ */
191
260
  declare function transaction<F extends Func>(options: TransactionOptions<F>): TransactionToken<F>;
261
+ /**
262
+ * @public
263
+ * Execute a {@link transaction}
264
+ * @param token - A {@link TransactionToken}
265
+ * @param id - A unique identifier for the transaction. If not provided, a random identifier will be generated
266
+ * @returns A function that can be called to run the transaction with its {@link TransactionIO} parameters
267
+ */
192
268
  declare function runTransaction<F extends Func>(token: TransactionToken<F>, id?: string): (...parameters: Parameters<F>) => ReturnType<F>;
193
269
  //#endregion
194
270
  //#region src/main/selector.d.ts
195
271
  type WritablePureSelectorOptions<T> = {
272
+ /** The unique identifier of the selector */
196
273
  key: string;
274
+ /** For each instantiated selector, a function that computes its value */
197
275
  get: Read<() => T>;
276
+ /** For each instantiated selector, a function that sets its value */
198
277
  set: Write<(newValue: T) => void>;
199
278
  };
200
279
  type ReadonlyPureSelectorOptions<T> = {
280
+ /** The unique identifier of the selector */
201
281
  key: string;
282
+ /** For each instantiated selector, a function that computes its value */
202
283
  get: Read<() => T>;
203
284
  };
204
285
  type ReadonlyHeldSelectorOptions<T extends object> = {
286
+ /** The unique identifier of the selector */
205
287
  key: string;
288
+ /** For each instantiated selector, a constant reference to a value that will not be replaced */
206
289
  const: T;
290
+ /** For each instantiated selector, a function that computes its value */
207
291
  get: Read<(permanent: T) => void>;
208
292
  };
209
293
  type WritableHeldSelectorOptions<T extends object> = {
294
+ /** The unique identifier of the selector */
210
295
  key: string;
296
+ /** For each instantiated selector, a constant reference to a value that will not be replaced */
211
297
  const: T;
298
+ /** For each instantiated selector, a function that computes its value */
212
299
  get: Read<(permanent: T) => void>;
300
+ /** For each instantiated selector, a function that sets its value */
213
301
  set: Write<(newValue: T) => void>;
214
302
  };
215
303
  /**
@@ -222,7 +310,7 @@ type WritableHeldSelectorOptions<T extends object> = {
222
310
  * The reference to that object is permanent and will not be replaced.
223
311
  *
224
312
  * A writable selector can be "set" to a new value.
225
- * It is advised to set its dependencies to values
313
+ * It is strongly advised to set its dependencies to values
226
314
  * that would produce the new value of the selector.
227
315
  *
228
316
  * @param options - {@link WritableHeldSelectorOptions}.
@@ -257,7 +345,7 @@ declare function selector<T extends object>(options: ReadonlyHeldSelectorOptions
257
345
  * in order to be garbage collected when a root atom of the selector is set.
258
346
  *
259
347
  * A writable selector can be "set" to a new value.
260
- * It is advised to set its dependencies to values
348
+ * It is strongly advised to set its dependencies to values
261
349
  * that would produce the new value of the selector.
262
350
  *
263
351
  * @param options - {@link TransientWritableSelectorOptions}.
@@ -282,48 +370,80 @@ declare function selector<T>(options: WritablePureSelectorOptions<T>): WritableP
282
370
  * @overload ReadonlyPure
283
371
  */
284
372
  declare function selector<T>(options: ReadonlyPureSelectorOptions<T>): ReadonlyPureSelectorToken<T>;
373
+ /** @public */
285
374
  type WritablePureSelectorFamilyOptions<T, K extends Canonical> = {
375
+ /** The unique identifier of the family */
286
376
  key: string;
377
+ /** For each instantiated family member, a function that computes its value */
287
378
  get: (key: K) => Read<() => T>;
379
+ /** For each instantiated family member, a function that sets its value */
288
380
  set: (key: K) => Write<(newValue: T) => void>;
289
381
  };
382
+ /** @public */
290
383
  type ReadonlyPureSelectorFamilyOptions<T, K extends Canonical> = {
384
+ /** The unique identifier of the family */
291
385
  key: string;
386
+ /** For each instantiated family member, a function that computes its value */
292
387
  get: (key: K) => Read<() => T>;
293
388
  };
389
+ /** @public */
294
390
  type WritableHeldSelectorFamilyOptions<T extends object, K extends Canonical> = {
391
+ /** The unique identifier of the family */
295
392
  key: string;
393
+ /** For each instantiated family member, a constant reference to a value that will not be replaced */
296
394
  const: (key: K) => T;
395
+ /** For each instantiated family member, a function that computes its value */
297
396
  get: (key: K) => Read<(permanent: T) => void>;
397
+ /** For each instantiated family member, a function that sets its value */
298
398
  set: (key: K) => Write<(newValue: T) => void>;
299
399
  };
400
+ /** @public */
300
401
  type ReadonlyHeldSelectorFamilyOptions<T extends object, K extends Canonical> = {
402
+ /** The unique identifier of the family */
301
403
  key: string;
404
+ /** For each instantiated family member, a constant reference to a value that will not be replaced */
302
405
  const: (key: K) => T;
406
+ /** For each instantiated family member, a function that computes its value */
303
407
  get: (key: K) => Read<(permanent: T) => void>;
304
408
  };
305
409
  type WritablePureSelectorFamilyToken<T, K extends Canonical> = {
410
+ /** The unique identifier of the family */
306
411
  key: string;
412
+ /** Discriminator */
307
413
  type: `writable_pure_selector_family`;
414
+ /** Never present. This is a marker that preserves the type of the value of each family member */
308
415
  __T?: T;
416
+ /** Never present. This is a marker that preserves the type of keys used for each family member */
309
417
  __K?: K;
310
418
  };
311
419
  type ReadonlyPureSelectorFamilyToken<T, K extends Canonical> = {
420
+ /** The unique identifier of the family */
312
421
  key: string;
422
+ /** Discriminator */
313
423
  type: `readonly_pure_selector_family`;
424
+ /** Never present. This is a marker that preserves the type of the value of each family member */
314
425
  __T?: T;
426
+ /** Never present. This is a marker that preserves the type of keys used for each family member */
315
427
  __K?: K;
316
428
  };
317
429
  type WritableHeldSelectorFamilyToken<T, K extends Canonical> = {
430
+ /** The unique identifier of the family */
318
431
  key: string;
432
+ /** Discriminator */
319
433
  type: `writable_held_selector_family`;
434
+ /** Never present. This is a marker that preserves the type of the value of each family member */
320
435
  __T?: T;
436
+ /** Never present. This is a marker that preserves the type of keys used for each family member */
321
437
  __K?: K;
322
438
  };
323
439
  type ReadonlyHeldSelectorFamilyToken<T, K extends Canonical> = {
440
+ /** The unique identifier of the family */
324
441
  key: string;
442
+ /** Discriminator */
325
443
  type: `readonly_held_selector_family`;
444
+ /** Never present. This is a marker that preserves the type of the value of each family member */
326
445
  __T?: T;
446
+ /** Never present. This is a marker that preserves the type of keys used for each family member */
327
447
  __K?: K;
328
448
  };
329
449
  type PureSelectorFamilyToken<T, K extends Canonical> = ReadonlyPureSelectorFamilyToken<T, K> | WritablePureSelectorFamilyToken<T, K>;
@@ -331,25 +451,112 @@ type HeldSelectorFamilyToken<T, K extends Canonical> = ReadonlyHeldSelectorFamil
331
451
  type ReadonlySelectorFamilyToken<T, K extends Canonical> = ReadonlyHeldSelectorFamilyToken<T, K> | ReadonlyPureSelectorFamilyToken<T, K>;
332
452
  type WritableSelectorFamilyToken<T, K extends Canonical> = WritableHeldSelectorFamilyToken<T, K> | WritablePureSelectorFamilyToken<T, K>;
333
453
  type SelectorFamilyToken<T, K extends Canonical> = HeldSelectorFamilyToken<T, K> | PureSelectorFamilyToken<T, K>;
454
+ /**
455
+ * @public
456
+ * Create a family of selectors, allowing for the dynamic creation and disposal of selectors.
457
+ *
458
+ * The value of a held selector should depend on the value of atoms or other selectors in the store,
459
+ * and should be recycled when a root atom of the selector is set.
460
+ *
461
+ * A held selector's value must be some object.
462
+ * The reference to that object is permanent and will not be replaced.
463
+ *
464
+ * A writable selector can be "set" to a new value.
465
+ * It is advised to set its dependencies to values
466
+ * that would produce the new value of the selector.
467
+ *
468
+ * @param options - {@link WritableHeldSelectorFamilyOptions}.
469
+ * @returns
470
+ * A reference to the selector family created: a {@link WritableHeldSelectorFamilyToken}
471
+ * @overload WritableHeld
472
+ */
334
473
  declare function selectorFamily<T extends object, K extends Canonical>(options: WritableHeldSelectorFamilyOptions<T, K>): WritableHeldSelectorFamilyToken<T, K>;
474
+ /**
475
+ * @public
476
+ * Create a family of selectors, allowing for the dynamic creation and disposal of selectors.
477
+ *
478
+ * The value of a held selector should depend on the value of atoms or other selectors in the store,
479
+ * and should be recycled when a root atom of the selector is set.
480
+ *
481
+ * A held selector's value must be some object.
482
+ * The reference to that object is permanent and will not be replaced.
483
+ *
484
+ * A readonly selector can be "gotten" but not "set".
485
+ *
486
+ * @param options - {@link ReadonlyHeldSelectorFamilyOptions}.
487
+ * @returns
488
+ * A reference to the selector family created: a {@link ReadonlyHeldSelectorFamilyToken}
489
+ * @overload ReadonlyHeld
490
+ */
335
491
  declare function selectorFamily<T extends object, K extends Canonical>(options: ReadonlyHeldSelectorFamilyOptions<T, K>): ReadonlyHeldSelectorFamilyToken<T, K>;
492
+ /**
493
+ * @public
494
+ * Create a family of selectors, allowing for the dynamic creation and disposal of selectors.
495
+ *
496
+ * The value of a selector should depend on the value of atoms or other selectors in the store.
497
+ *
498
+ * A pure selector's current value is evicted from the store
499
+ * in order to be garbage collected when a root atom of the selector is set.
500
+ *
501
+ * A writable selector can be "set" to a new value.
502
+ * It is advised to set its dependencies to values
503
+ * that would produce the new value of the selector.
504
+ *
505
+ * @param options - {@link TransientWritableSelectorFamilyOptions}.
506
+ * @returns
507
+ * A reference to the selector family created: a {@link TransientWritableSelectorFamilyToken}
508
+ * @overload WritablePure
509
+ */
336
510
  declare function selectorFamily<T, K extends Canonical>(options: WritablePureSelectorFamilyOptions<T, K>): WritablePureSelectorFamilyToken<T, K>;
511
+ /**
512
+ * @public
513
+ * Create a family of selectors, allowing for the dynamic creation and disposal of selectors.
514
+ *
515
+ * The value of a selector should depend on the value of atoms or other selectors in the store.
516
+ *
517
+ * A pure selector's current value is evicted from the store
518
+ * in order to be garbage collected when a root atom of the selector is set.
519
+ *
520
+ * A readonly selector can be "gotten" but not "set".
521
+ *
522
+ * @param options - {@link ReadonlyPureSelectorFamilyOptions}.
523
+ * @returns
524
+ * A reference to the selector family created: a {@link ReadonlyPureSelectorFamilyToken}
525
+ * @overload ReadonlyPure
526
+ */
337
527
  declare function selectorFamily<T, K extends Canonical>(options: ReadonlyPureSelectorFamilyOptions<T, K>): ReadonlyPureSelectorFamilyToken<T, K>;
338
528
  //#endregion
339
529
  //#region src/main/timeline.d.ts
530
+ /** @public */
340
531
  type TimelineManageable = AtomFamilyToken<any, any> | AtomToken<any>;
532
+ /** @public */
341
533
  type AtomOnly<M extends TimelineManageable> = M extends AtomFamilyToken<any, any> ? AtomToken<any> : M extends AtomToken<any> ? M : never;
534
+ /** @public */
342
535
  type TimelineToken<M> = {
536
+ /** The unique identifier of the timeline */
343
537
  key: string;
538
+ /** Discriminator */
344
539
  type: `timeline`;
540
+ /** Never present. This is a marker that preserves the type of the managed atoms */
345
541
  __M?: M;
346
542
  };
543
+ /** @public */
347
544
  type TimelineOptions<ManagedAtom extends TimelineManageable> = {
545
+ /** The unique identifier of the timeline */
348
546
  key: string;
547
+ /** The managed atoms (and families of atoms) to record */
349
548
  scope: ManagedAtom[];
549
+ /** A function that determines whether a given update should be recorded */
350
550
  shouldCapture?: (update: TimelineUpdate<ManagedAtom>, timeline: Timeline<TimelineManageable>) => boolean;
351
551
  };
552
+ /** @public */
352
553
  type TimelineUpdate<ManagedAtom extends TimelineManageable> = TimelineAtomUpdate<ManagedAtom> | TimelineMoleculeCreation | TimelineMoleculeDisposal | TimelineSelectorUpdate<ManagedAtom> | TimelineStateCreation<AtomOnly<ManagedAtom>> | TimelineStateDisposal<AtomOnly<ManagedAtom>> | TimelineTransactionUpdate;
554
+ /**
555
+ * @public
556
+ * Create a timeline, a mechanism for recording, undoing, and replaying changes to groups of atoms.
557
+ * @param options - {@link TimelineOptions}
558
+ * @returns A reference to the timeline created: a {@link TimelineToken}
559
+ */
353
560
  declare const timeline: <ManagedAtom extends TimelineManageable>(options: TimelineOptions<ManagedAtom>) => TimelineToken<ManagedAtom>;
354
561
  declare const redo: (tl: TimelineToken<any>) => void;
355
562
  declare const undo: (tl: TimelineToken<any>) => void;
@@ -357,14 +564,20 @@ declare const undo: (tl: TimelineToken<any>) => void;
357
564
  //#region src/main/dispose-state.d.ts
358
565
  /**
359
566
  * @public
360
- * Disposes of a state in the implicit store
567
+ * Disposes of a state in the implicit store.
568
+ *
569
+ * Only family members can be disposed of.
570
+ *
361
571
  * @param token - The token of the state to dispose
362
572
  * @overload Default
363
573
  */
364
574
  declare function disposeState(token: ReadableToken<any>): void;
365
575
  /**
366
576
  * @public
367
- * Disposes of a state family in the implicit store
577
+ * Disposes of a state in the implicit store.
578
+ *
579
+ * Only family members can be disposed of.
580
+ *
368
581
  * @param token - The token of the state family to dispose
369
582
  * @param key - The unique key of the state to dispose
370
583
  */
@@ -373,7 +586,12 @@ declare function disposeState<K extends Canonical>(token: ReadableFamilyToken<an
373
586
  //#region src/main/find-state.d.ts
374
587
  /**
375
588
  * @public
376
- * Finds a {@link MutableAtomToken} in the store
589
+ * Finds a {@link MutableAtomToken} in the store, without accessing its value.
590
+ *
591
+ * In an ephemeral store, this will create a new atom if one does not exist with the given key.
592
+ *
593
+ * In an immortal store, a "counterfeit" atom token will be returned in this case and a warning will be logged.
594
+ *
377
595
  * @param token - A {@link MutableAtomFamilyToken}
378
596
  * @param key - The key of the state
379
597
  * @returns
@@ -383,7 +601,12 @@ declare function disposeState<K extends Canonical>(token: ReadableFamilyToken<an
383
601
  declare function findState<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical, Key extends K>(token: MutableAtomFamilyToken$1<T, J, K>, key: Key): MutableAtomToken$1<T, J, K>;
384
602
  /**
385
603
  * @public
386
- * Finds a state in the store
604
+ * Finds a {@link RegularAtomToken} in the store, without accessing its value.
605
+ *
606
+ * In an ephemeral store, this will create a new atom if one does not exist with the given key.
607
+ *
608
+ * In an immortal store, a "counterfeit" atom token will be returned in this case and a warning will be logged.
609
+ *
387
610
  * @param token - The token of the state family
388
611
  * @param key - The key of the state
389
612
  * @returns
@@ -393,27 +616,42 @@ declare function findState<T extends Transceiver<any>, J extends Json.Serializab
393
616
  declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken$1<T, K>, key: Key): RegularAtomToken$1<T, K>;
394
617
  /**
395
618
  * @public
396
- * Finds a state in the store
619
+ * Finds a {@link WritableSelectorToken} in the store, without accessing its value.
620
+ *
621
+ * In an ephemeral store, this will create a new selector if one does not exist with the given key.
622
+ *
623
+ * In an immortal store, a "counterfeit" selector token will be returned in this case and a warning will be logged.
624
+ *
397
625
  * @param token - The token of the state family
398
626
  * @param key - The key of the state
399
627
  * @returns
400
628
  * The current value of the state
401
629
  * @overload Writable Selector
402
630
  */
403
- declare function findState<T, K extends Canonical, Key extends K>(token: WritablePureSelectorFamilyToken$1<T, K>, key: Key): WritablePureSelectorToken$1<T, K>;
631
+ declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken$1<T, K>, key: Key): WritableSelectorToken$1<T, K>;
404
632
  /**
405
633
  * @public
406
- * Finds a state in the store
634
+ * Finds a {@link ReadonlySelectorToken} in the store, without accessing its value.
635
+ *
636
+ * In an ephemeral store, this will create a new selector if one does not exist with the given key.
637
+ *
638
+ * In an immortal store, a "counterfeit" selector token will be returned in this case and a warning will be logged.
639
+ *
407
640
  * @param token - The token of the state family
408
641
  * @param key - The key of the state
409
642
  * @returns
410
643
  * The current value of the state
411
644
  * @overload Readonly Selector
412
645
  */
413
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlyPureSelectorFamilyToken$1<T, K>, key: Key): ReadonlyPureSelectorToken$1<T, K>;
646
+ declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken$1<T, K>, key: Key): ReadonlySelectorToken$1<T, K>;
414
647
  /**
415
648
  * @public
416
- * Finds a state in the store
649
+ * Finds a {@link WritableToken} in the store, without accessing its value.
650
+ *
651
+ * In an ephemeral store, this will create a new atom or selector if one does not exist with the given key.
652
+ *
653
+ * In an immortal store, a "counterfeit" token will be returned in this case and a warning will be logged.
654
+ *
417
655
  * @param token - The token of the state family
418
656
  * @param key - The key of the state
419
657
  * @returns
@@ -423,7 +661,12 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Readonl
423
661
  declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken$1<T, K>, key: Key): WritableToken$1<T, K>;
424
662
  /**
425
663
  * @public
426
- * Finds a {@link ReadableToken} in the store
664
+ * Finds a {@link MutableAtomToken} in the store, without accessing its value.
665
+ *
666
+ * In an ephemeral store, this will create a new atom or selector if one does not exist with the given key.
667
+ *
668
+ * In an immortal store, a "counterfeit" token will be returned in this case and a warning will be logged.
669
+ *
427
670
  * @param token - A {@link ReadableFamilyToken}
428
671
  * @param key - The key of the state
429
672
  * @returns
@@ -436,7 +679,7 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Readabl
436
679
  //#region src/main/get-state.d.ts
437
680
  /**
438
681
  * @public
439
- * Get the current value of a state
682
+ * Read or compute the current value of a state
440
683
  * @param token - The token of the state to get
441
684
  * @return The current value of the state
442
685
  * @overload Default
@@ -445,7 +688,7 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Readabl
445
688
  declare function getState<T>(token: ReadableToken<T>): T;
446
689
  /**
447
690
  * @public
448
- * Get the current value of a state family
691
+ * Read or compute the current value of a state
449
692
  * @param token - The token of a state family
450
693
  * @param key - The unique key of the state to get
451
694
  * @return The current value of the state
@@ -454,27 +697,77 @@ declare function getState<T>(token: ReadableToken<T>): T;
454
697
  declare function getState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): T;
455
698
  //#endregion
456
699
  //#region src/main/join.d.ts
457
- 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>> {
700
+ /** @public */
701
+ type 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> = Flat<JunctionSchemaBase<ASide, BSide> & {
702
+ /** Unique identifier of the join */
458
703
  readonly key: string;
704
+ /** How many relations are allowed in each direction? */
459
705
  readonly cardinality: Cardinality;
706
+ /** Type guard for the type of the left side */
460
707
  readonly isAType: Refinement<string, AType>;
708
+ /** Type guard for the type of the right side */
461
709
  readonly isBType: Refinement<string, BType>;
462
- }
710
+ }> & Partial<JunctionEntriesBase<AType, BType, Content>>;
711
+ /** @public */
463
712
  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> = {
713
+ /** Unique identifier of the join */
464
714
  key: string;
715
+ /** Discriminator */
465
716
  type: `join`;
717
+ /** How many relations are allowed in each direction? */
466
718
  cardinality: Cardinality;
719
+ /** Name of the join's left side */
467
720
  a: ASide;
721
+ /** Name of the join's right side */
468
722
  b: BSide;
723
+ /** Never present. This is a marker that preserves the type of the left side's keys */
469
724
  __aType?: AType;
725
+ /** Never present. This is a marker that preserves the type of the right side's keys */
470
726
  __bType?: BType;
727
+ /** Never present. This is a marker that preserves the type of the data present for each relation */
471
728
  __content?: Content;
472
729
  };
473
- declare function 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`>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, null>, defaultContent?: undefined, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, null>;
474
- declare function 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>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, Content>;
730
+ /**
731
+ * @public
732
+ * Create a join, an interface for managing relations between two sets of keys.
733
+ *
734
+ * Use joins when it is important to view relationships from either side.
735
+ *
736
+ * Under the hood, joins coordinate changes of multiple atoms to support that the desired relationships stay consistent.
737
+ *
738
+ * @param options - {@link JoinOptions}
739
+ * @param defaultContent - (undefined)
740
+ * @returns
741
+ * A reference to the join created: a {@link JoinToken}
742
+ * @overload No Content
743
+ */
744
+ declare function 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`>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, null>, defaultContent?: undefined): JoinToken<ASide, AType, BSide, BType, Cardinality, null>;
745
+ declare function 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>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content): JoinToken<ASide, AType, BSide, BType, Cardinality, Content>;
746
+ /** @public */
475
747
  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 ? { readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlyPureSelectorToken$1<[AType, Content] | null, BType> } & { readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlyPureSelectorToken$1<[BType, Content] | null, AType> } : {}) & { readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlyPureSelectorToken$1<AType | null, BType> } & { readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlyPureSelectorToken$1<BType | null, AType> } : Cardinality extends `1:n` ? (Content extends Json.Object ? { readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlyPureSelectorToken$1<[AType, Content] | null, BType> } & { readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlyPureSelectorToken$1<[BType, Content][], AType> } : {}) & { readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlyPureSelectorToken$1<AType | null, BType> } & { readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlyPureSelectorToken$1<BType[], AType> } : Cardinality extends `n:n` ? (Content extends Json.Object ? { readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlyPureSelectorToken$1<[AType, Content][], BType> } & { readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlyPureSelectorToken$1<[BType, Content][], AType> } : {}) & { readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlyPureSelectorToken$1<AType[], BType> } & { readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlyPureSelectorToken$1<BType[], AType> } : never;
748
+ /**
749
+ * @public
750
+ * Find the current value of a relation owned by a {@link join}
751
+ * @param token - The token of the join
752
+ * @param key - The key of the relation to find
753
+ * @returns
754
+ * A {@link JoinStates} interface to access the relation
755
+ * @overload Default
756
+ */
476
757
  declare function findRelations<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): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
758
+ /**
759
+ * @public
760
+ * Change one or multiple relations owned by a {@link join}
761
+ * @param token - The token of the join
762
+ * @param change - A function that takes a {@link Junction} interface to edit the relations
763
+ */
477
764
  declare function editRelations<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): void;
765
+ /**
766
+ * @public
767
+ * @param token - The token of the join
768
+ * @returns
769
+ * A {@link MutableAtomFamilyToken} to access the internal relations
770
+ */
478
771
  declare function getInternalRelations<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>): MutableAtomFamilyToken$1<SetRTX<string>, SetRTXJson<string>, string>;
479
772
  //#endregion
480
773
  //#region src/main/logger.d.ts
@@ -555,18 +848,68 @@ type Claim<K extends Canonical> = K & {
555
848
  };
556
849
  declare class Realm<H extends Hierarchy> {
557
850
  store: Store;
851
+ /**
852
+ * @param store - The store to which the realm will be attached
853
+ */
558
854
  constructor(store?: Store);
855
+ /**
856
+ * Make space for a new subject of the realm
857
+ * @param provenance - A key for an owner {@link Above} the new subject in the realm's {@link Hierarchy}
858
+ * @param key - A unique identifier for the new subject
859
+ * @param attachmentStyle - The attachment style of new subject to its owner(s). `any` means that if any owners remain, the subject will be retained. `all` means that the subject be retained only if all owners remain .
860
+ * @returns
861
+ * The subject's key, given status as a true {@link Claim}
862
+ */
559
863
  allocate<V extends Vassal<H>, A extends Above<V, H>>(provenance: A, key: V, attachmentStyle?: `all` | `any`): Claim<V>;
864
+ /**
865
+ * Fuse two reagents into a compound
866
+ * @param type - the name of the compound that is being fused
867
+ * @param reagentA - the left reagent of the compound
868
+ * @param reagentB - the right reagent of the compound
869
+ * @returns
870
+ * The compound's key, given status as a true {@link Claim}
871
+ */
560
872
  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>>;
873
+ /**
874
+ * Remove a subject from the realm
875
+ * @param claim - The subject to be deallocated
876
+ */
561
877
  deallocate<V extends Vassal<H>>(claim: Claim<V>): void;
878
+ /**
879
+ * Transfer a subject of the realm from one owner to another
880
+ * @param newProvenance - A key for an owner {@link Above} the new subject in the realm's {@link Hierarchy}
881
+ * @param claim - The subject to be claimed
882
+ * @param exclusive - Whether the subjects previous owners should be detached from it
883
+ * @returns
884
+ * The subject's key, given status as a true {@link Claim}
885
+ */
562
886
  claim<V extends Exclude<Vassal<H>, CompoundTypedKey>, A extends Above<V, H>>(newProvenance: A, claim: Claim<V>, exclusive?: `exclusive`): Claim<V>;
563
887
  }
564
888
  declare class Anarchy {
565
889
  store: Store;
566
890
  realm: Realm<any>;
891
+ /**
892
+ * @param store - The store to which the anarchy-realm will be attached
893
+ */
567
894
  constructor(store?: Store);
895
+ /**
896
+ * Declare a new entity
897
+ * @param provenance - A key for an owner of the entity
898
+ * @param key - A unique identifier for the new entity
899
+ * @param attachmentStyle - The attachment style of new entity to its owner(s). `any` means that if any owners remain, the subject will be retained. `all` means that the subject be retained only if all owners remain .
900
+ */
568
901
  allocate(provenance: Canonical, key: Canonical, attachmentStyle?: `all` | `any`): void;
902
+ /**
903
+ * Remove an entity
904
+ * @param key - The entity to be deallocated
905
+ */
569
906
  deallocate(key: Canonical): void;
907
+ /**
908
+ * Transfer an entity from one owner to another
909
+ * @param newProvenance - A key for an owner of the entity
910
+ * @param key - The entity to be claimed
911
+ * @param exclusive - Whether the entity's previous owners should be detached from it
912
+ */
570
913
  claim(newProvenance: Canonical, key: Canonical, exclusive?: `exclusive`): void;
571
914
  }
572
915
  declare const T$ = "T$";
@@ -649,19 +992,50 @@ declare class Silo {
649
992
  }
650
993
  //#endregion
651
994
  //#region src/main/subscribe.d.ts
995
+ /** @public */
652
996
  type StateUpdate<T> = {
653
997
  newValue: T;
654
998
  oldValue: T;
655
999
  };
1000
+ /** @public */
656
1001
  type KeyedStateUpdate<T> = Flat<StateUpdate<T> & {
657
1002
  key: string;
658
1003
  type: `atom_update` | `selector_update`;
659
1004
  family?: FamilyMetadata;
660
1005
  }>;
1006
+ /** @public */
661
1007
  type UpdateHandler<T> = (update: StateUpdate<T>) => void;
1008
+ /** @public */
662
1009
  type TransactionUpdateHandler<F extends Func> = (data: TransactionUpdate<F>) => void;
1010
+ /**
1011
+ * @public
1012
+ * Subscribe to a state in the implicit store
1013
+ * @param token - The token of the state to subscribe to
1014
+ * @param handleUpdate - A function that will be called when the state is updated
1015
+ * @param key - A unique key for the subscription. If not provided, a random key will be generated.
1016
+ * @returns A function that can be called to unsubscribe from the state
1017
+ * @overload State
1018
+ */
663
1019
  declare function subscribe<T>(token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key?: string): () => void;
1020
+ /**
1021
+ * @public
1022
+ * Subscribe to a transaction in the implicit store
1023
+ * @param token - The token of the transaction to subscribe to
1024
+ * @param handleUpdate - A function that will be called when the transaction succeeds
1025
+ * @param key - A unique key for the subscription. If not provided, a random key will be generated.
1026
+ * @returns A function that can be called to unsubscribe from the transaction
1027
+ * @overload Transaction
1028
+ */
664
1029
  declare function subscribe<F extends Func>(token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key?: string): () => void;
1030
+ /**
1031
+ * @public
1032
+ * Subscribe to a timeline in the implicit store
1033
+ * @param token - The token of the timeline to subscribe to
1034
+ * @param handleUpdate - A function that will be called when a new update is available
1035
+ * @param key - A unique key for the subscription. If not provided, a random key will be generated.
1036
+ * @returns A function that can be called to unsubscribe from the timeline
1037
+ * @overload Timeline
1038
+ */
665
1039
  declare function subscribe<M extends TimelineManageable>(token: TimelineToken<M>, handleUpdate: (update: TimelineUpdate<M> | `redo` | `undo`) => void, key?: string): () => void;
666
1040
  //#endregion
667
1041
  //#region src/main/validators.d.ts
@@ -803,6 +1177,14 @@ type FamilyMetadata<K extends Canonical = any> = {
803
1177
  /** The family member's unique identifier, in the form of a string. */
804
1178
  subKey: stringified<K>;
805
1179
  };
1180
+ /**
1181
+ * @public
1182
+ * Loadable is used to type atoms or selectors that may at some point be initialized to or set to a {@link Promise}.
1183
+ *
1184
+ * When a Promise is cached as the value of a state in atom.io, that state will be automatically set to the resolved value of the Promise when it is resolved.
1185
+ *
1186
+ * As a result, we consider any state that can be a set to a Promise to be a "loadable" state, whose value may or may not be a Promise at any given time.
1187
+ */
806
1188
  type Loadable<T> = Promise<T> | T;
807
1189
  //#endregion
808
1190
  export { $claim, Above, ActorToolkit, Anarchy, AtomDisposal, AtomEffect, AtomFamilyToken, AtomIOLogger, AtomIOToken, AtomOnly, AtomToken, Below, Claim, CompoundFrom, CompoundTypedKey, Effectors, FamilyMetadata, GetterToolkit, HeldSelectorFamilyToken, HeldSelectorToken, Hierarchy, JoinOptions, JoinStates, JoinToken, KeyedStateUpdate, LOG_LEVELS, Loadable, LogFilter, LogFn, LogLevel, Logger, LoggerIcon, MoleculeCreation, MoleculeDisposal, MoleculeTransfer, MutableAtomFamilyOptions, MutableAtomFamilyToken, MutableAtomOptions, MutableAtomToken, Mutuals, PureSelectorFamilyToken, PureSelectorToken, Read, ReadableFamilyToken, ReadableToken, ReadonlyHeldSelectorFamilyOptions, ReadonlyHeldSelectorFamilyToken, ReadonlyHeldSelectorOptions, ReadonlyHeldSelectorToken, ReadonlyPureSelectorFamilyOptions, ReadonlyPureSelectorFamilyToken, ReadonlyPureSelectorOptions, ReadonlyPureSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, Realm, RegularAtomFamilyOptions, RegularAtomFamilyToken, RegularAtomOptions, RegularAtomToken, SelectorDisposal, SelectorFamilyToken, SelectorToken, Setter, SetterToolkit, Silo, SingularTypedKey, StateCreation, StateDisposal, StateUpdate, T$, TimelineManageable, TimelineOptions, TimelineToken, TimelineUpdate, TokenDenomination, TokenType, Transact, TransactionIO, TransactionOptions, TransactionToken, TransactionUpdate, TransactionUpdateContent, TransactionUpdateHandler, TypeTag, TypedKey, UpdateHandler, Vassal, WritableFamilyToken, WritableHeldSelectorFamilyOptions, WritableHeldSelectorFamilyToken, WritableHeldSelectorOptions, WritableHeldSelectorToken, WritablePureSelectorFamilyOptions, WritablePureSelectorFamilyToken, WritablePureSelectorOptions, WritablePureSelectorToken, WritableSelectorFamilyToken, WritableSelectorToken, WritableToken, Write, atom, atomFamily, belongsTo, disposeState, editRelations, findRelations, findState, getInternalRelations, getState, isToken, join, redo, resetState, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo };