atom.io 0.9.9 → 0.10.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 (64) hide show
  1. package/dist/index.d.mts +11 -4
  2. package/dist/index.d.ts +11 -4
  3. package/dist/index.js +36 -56
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +34 -55
  6. package/dist/index.mjs.map +1 -1
  7. package/internal/dist/index.d.mts +52 -25
  8. package/internal/dist/index.d.ts +52 -25
  9. package/internal/dist/index.js +352 -385
  10. package/internal/dist/index.js.map +1 -1
  11. package/internal/dist/index.mjs +349 -385
  12. package/internal/dist/index.mjs.map +1 -1
  13. package/internal/src/atom/create-atom.ts +5 -5
  14. package/internal/src/atom/delete-atom.ts +9 -2
  15. package/internal/src/atom/is-default.ts +2 -2
  16. package/internal/src/caching.ts +7 -5
  17. package/internal/src/get-state-internal.ts +4 -4
  18. package/internal/src/index.ts +1 -0
  19. package/internal/src/keys.ts +30 -0
  20. package/internal/src/mutable/create-mutable-atom.ts +2 -2
  21. package/internal/src/mutable/tracker.ts +1 -1
  22. package/internal/src/operation.ts +7 -7
  23. package/internal/src/selector/create-read-write-selector.ts +2 -8
  24. package/internal/src/selector/create-readonly-selector.ts +1 -1
  25. package/internal/src/selector/create-selector.ts +5 -3
  26. package/internal/src/selector/get-selector-dependency-keys.ts +20 -0
  27. package/internal/src/selector/index.ts +1 -1
  28. package/internal/src/selector/register-selector.ts +4 -11
  29. package/internal/src/selector/trace-selector-atoms.ts +26 -26
  30. package/internal/src/selector/update-selector-atoms.ts +14 -14
  31. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  32. package/internal/src/set-state/copy-mutable-in-transaction.ts +1 -1
  33. package/internal/src/set-state/emit-update.ts +1 -1
  34. package/internal/src/set-state/evict-downstream.ts +5 -6
  35. package/internal/src/set-state/set-atom.ts +1 -4
  36. package/internal/src/set-state/stow-update.ts +10 -4
  37. package/internal/src/store/index.ts +0 -1
  38. package/internal/src/store/store.ts +27 -10
  39. package/internal/src/store/withdraw-new-family-member.ts +1 -1
  40. package/internal/src/store/withdraw.ts +1 -1
  41. package/internal/src/subscribe/recall-state.ts +2 -2
  42. package/internal/src/subscribe/subscribe-to-root-atoms.ts +7 -8
  43. package/internal/src/timeline/add-atom-to-timeline.ts +8 -8
  44. package/internal/src/timeline/time-travel-internal.ts +12 -12
  45. package/internal/src/timeline/timeline-internal.ts +2 -2
  46. package/internal/src/transaction/abort-transaction.ts +3 -3
  47. package/internal/src/transaction/apply-transaction.ts +6 -6
  48. package/internal/src/transaction/build-transaction.ts +2 -3
  49. package/internal/src/transaction/redo-transaction.ts +1 -1
  50. package/internal/src/transaction/transaction-internal.ts +2 -2
  51. package/internal/src/transaction/undo-transaction.ts +1 -1
  52. package/package.json +3 -3
  53. package/react-devtools/dist/index.d.mts +3 -3
  54. package/react-devtools/dist/index.d.ts +3 -3
  55. package/realtime-client/dist/index.js +6 -9
  56. package/realtime-client/dist/index.js.map +1 -1
  57. package/realtime-client/dist/index.mjs +6 -9
  58. package/realtime-client/dist/index.mjs.map +1 -1
  59. package/realtime-client/src/use-server-action.ts +6 -8
  60. package/src/atom.ts +3 -0
  61. package/src/logger.ts +25 -36
  62. package/src/subscribe.ts +7 -7
  63. package/internal/src/selector/lookup-selector-sources.ts +0 -20
  64. package/internal/src/store/lookup.ts +0 -26
@@ -1,7 +1,25 @@
1
- import { AtomToken, ReadonlySelectorToken, SelectorToken, Transactors, FamilyMetadata, SelectorOptions, ReadonlySelectorOptions, StateToken, ƒn, TransactionUpdate, TransactionOptions, TransactionToken, MutableAtomOptions, MutableAtomToken, MutableAtomFamilyOptions, MutableAtomFamily, AtomFamily, StateUpdate, TimelineUpdate, TimelineOptions, TimelineToken, ReadonlySelectorFamily, SelectorFamily, Logger, AtomOptions, AtomFamilyOptions, ReadonlySelectorFamilyOptions, SelectorFamilyOptions } from 'atom.io';
1
+ import { Transactors, FamilyMetadata as FamilyMetadata$1, SelectorOptions, SelectorToken, ReadonlySelectorOptions, ReadonlySelectorToken, StateToken, ƒn, TransactionUpdate, TransactionOptions, TransactionToken, AtomToken as AtomToken$1, MutableAtomOptions, MutableAtomToken, MutableAtomFamilyOptions, MutableAtomFamily, AtomFamily, StateUpdate, TimelineUpdate, TimelineOptions, TimelineToken, ReadonlySelectorFamily, SelectorFamily, AtomIOLogger, Logger, AtomOptions, AtomFamilyOptions, ReadonlySelectorFamilyOptions, SelectorFamilyOptions } from 'atom.io';
2
2
  import { Json } from 'atom.io/json';
3
3
 
4
- declare const lookupSelectorSources: (key: string, store: Store) => (AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>)[];
4
+ type AtomKey<T> = string & {
5
+ __atomKey?: never;
6
+ __brand?: T;
7
+ };
8
+ type SelectorKey<T> = string & {
9
+ __selectorKey?: never;
10
+ __brand?: T;
11
+ };
12
+ type ReadonlySelectorKey<T> = string & {
13
+ __readonlySelectorKey?: never;
14
+ __brand?: T;
15
+ };
16
+ declare const isAtomKey: (key: string, store: Store) => key is AtomKey<unknown>;
17
+ declare const isSelectorKey: (key: string, store: Store) => key is SelectorKey<unknown>;
18
+ declare const isReadonlySelectorKey: (key: string, store: Store) => key is ReadonlySelectorKey<unknown>;
19
+ type StateKey<T> = AtomKey<T> | ReadonlySelectorKey<T> | SelectorKey<T>;
20
+ declare const isStateKey: (key: string, store: Store) => key is StateKey<unknown>;
21
+
22
+ declare const getSelectorDependencyKeys: (key: string, store: Store) => (AtomKey<unknown> | ReadonlySelectorKey<unknown> | SelectorKey<unknown>)[];
5
23
 
6
24
  declare const registerSelector: (selectorKey: string, store?: Store) => Transactors;
7
25
 
@@ -16,7 +34,7 @@ declare class Subject<T> {
16
34
  type Selector<T> = {
17
35
  key: string;
18
36
  type: `selector`;
19
- family?: FamilyMetadata;
37
+ family?: FamilyMetadata$1;
20
38
  install: (store: Store) => void;
21
39
  subject: Subject<{
22
40
  newValue: T;
@@ -28,7 +46,7 @@ type Selector<T> = {
28
46
  type ReadonlySelector<T> = {
29
47
  key: string;
30
48
  type: `readonly_selector`;
31
- family?: FamilyMetadata;
49
+ family?: FamilyMetadata$1;
32
50
  install: (store: Store) => void;
33
51
  subject: Subject<{
34
52
  newValue: T;
@@ -36,11 +54,11 @@ type ReadonlySelector<T> = {
36
54
  }>;
37
55
  get: () => T;
38
56
  };
39
- declare function createSelector<T>(options: SelectorOptions<T>, family?: FamilyMetadata, store?: Store): SelectorToken<T>;
40
- declare function createSelector<T>(options: ReadonlySelectorOptions<T>, family?: FamilyMetadata, store?: Store): ReadonlySelectorToken<T>;
57
+ declare function createSelector<T>(options: SelectorOptions<T>, family?: FamilyMetadata$1, store?: Store): SelectorToken<T>;
58
+ declare function createSelector<T>(options: ReadonlySelectorOptions<T>, family?: FamilyMetadata$1, store?: Store): ReadonlySelectorToken<T>;
41
59
 
42
- declare const traceSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => AtomToken<unknown>[];
43
- declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomToken<unknown>[];
60
+ declare const traceSelectorAtoms: (selectorKey: string, directDependencyKey: StateKey<unknown>, store: Store) => AtomKey<unknown>[];
61
+ declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomKey<unknown>[];
44
62
 
45
63
  declare const updateSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => void;
46
64
 
@@ -76,7 +94,7 @@ type TransactionIdle = {
76
94
  };
77
95
  type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
78
96
 
79
- declare function deposit<T>(state: Atom<T>): AtomToken<T>;
97
+ declare function deposit<T>(state: Atom<T>): AtomToken$1<T>;
80
98
  declare function deposit<T>(state: Selector<T>): SelectorToken<T>;
81
99
  declare function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>;
82
100
  declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
@@ -163,9 +181,9 @@ declare function createMutableAtomFamily<Core extends Transceiver<any>, Serializ
163
181
 
164
182
  declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
165
183
 
166
- declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
184
+ declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken$1<Signal<Core>>;
167
185
 
168
- declare function isAtomTokenMutable(token: AtomToken<any>): token is MutableAtomToken<any, any>;
186
+ declare function isAtomTokenMutable(token: AtomToken$1<any>): token is MutableAtomToken<any, any>;
169
187
 
170
188
  /**
171
189
  * @internal Give the tracker a transceiver state and a store, and it will
@@ -179,7 +197,7 @@ declare class Tracker<Mutable extends Transceiver<any>> {
179
197
  private observeCore;
180
198
  private updateCore;
181
199
  mutableState: MutableAtomToken<Mutable, Json.Serializable>;
182
- latestUpdateState: AtomToken<typeof this.Update | null>;
200
+ latestUpdateState: AtomToken$1<typeof this.Update | null>;
183
201
  constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store?: Store);
184
202
  }
185
203
 
@@ -213,7 +231,7 @@ type TimelineAtomUpdate = StateUpdate<unknown> & {
213
231
  key: string;
214
232
  type: `atom_update`;
215
233
  timestamp: number;
216
- family?: FamilyMetadata;
234
+ family?: FamilyMetadata$1;
217
235
  };
218
236
  type TimelineSelectorUpdate = {
219
237
  key: string;
@@ -240,7 +258,7 @@ type Timeline = {
240
258
  };
241
259
  declare function timeline__INTERNAL(options: TimelineOptions, store?: Store, data?: Timeline | null): TimelineToken;
242
260
 
243
- declare const addAtomToTimeline: (atomToken: AtomToken<any>, tl: Timeline, store?: Store) => void;
261
+ declare const addAtomToTimeline: (atomToken: AtomToken$1<any>, tl: Timeline, store?: Store) => void;
244
262
 
245
263
  declare const redo__INTERNAL: (token: TimelineToken, store?: Store) => void;
246
264
  declare const undo__INTERNAL: (token: TimelineToken, store?: Store) => void;
@@ -262,7 +280,7 @@ declare class Store {
262
280
  source: string;
263
281
  }>;
264
282
  subject: {
265
- atomCreation: Subject<AtomToken<unknown>>;
283
+ atomCreation: Subject<AtomToken$1<unknown>>;
266
284
  selectorCreation: Subject<SelectorToken<unknown> | ReadonlySelectorToken<unknown>>;
267
285
  transactionCreation: Subject<TransactionToken<ƒn>>;
268
286
  timelineCreation: Subject<TimelineToken>;
@@ -272,9 +290,9 @@ declare class Store {
272
290
  transactionStatus: TransactionStatus<ƒn>;
273
291
  config: {
274
292
  name: string;
275
- logger: Logger | null;
276
- logger__INTERNAL: Logger;
277
293
  };
294
+ loggers: AtomIOLogger[];
295
+ logger: Logger;
278
296
  constructor(name: string, store?: Store | null);
279
297
  }
280
298
  declare const IMPLICIT: {
@@ -283,9 +301,7 @@ declare const IMPLICIT: {
283
301
  };
284
302
  declare const clearStore: (store?: Store) => void;
285
303
 
286
- declare function lookup(key: string, store: Store): AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>;
287
-
288
- declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
304
+ declare function withdraw<T>(token: AtomToken$1<T>, store: Store): Atom<T> | undefined;
289
305
  declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
290
306
  declare function withdraw<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
291
307
  declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
@@ -293,7 +309,7 @@ declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transact
293
309
  declare function withdraw<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T> | undefined;
294
310
  declare function withdraw<T>(token: TimelineToken, store: Store): Timeline | undefined;
295
311
 
296
- declare function withdrawNewFamilyMember<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
312
+ declare function withdrawNewFamilyMember<T>(token: AtomToken$1<T>, store: Store): Atom<T> | undefined;
297
313
  declare function withdrawNewFamilyMember<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
298
314
  declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
299
315
  declare function withdrawNewFamilyMember<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
@@ -302,7 +318,7 @@ declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T> | St
302
318
  type Atom<T> = {
303
319
  key: string;
304
320
  type: `atom`;
305
- family?: FamilyMetadata;
321
+ family?: FamilyMetadata$1;
306
322
  install: (store: Store) => void;
307
323
  subject: Subject<{
308
324
  newValue: T;
@@ -310,9 +326,20 @@ type Atom<T> = {
310
326
  }>;
311
327
  default: T;
312
328
  };
313
- declare function createAtom<T>(options: AtomOptions<T> | MutableAtomOptions<any, any>, family?: FamilyMetadata, store?: Store): AtomToken<T>;
329
+ declare function createAtom<T>(options: AtomOptions<T> | MutableAtomOptions<any, any>, family?: FamilyMetadata$1, store?: Store): AtomToken$1<T>;
330
+
331
+ type AtomToken<_> = {
332
+ key: string;
333
+ type: `atom`;
334
+ family?: FamilyMetadata;
335
+ __brand?: _;
336
+ };
337
+ type FamilyMetadata = {
338
+ key: string;
339
+ subKey: string;
340
+ };
314
341
 
315
- declare function deleteAtom(key: string, core?: StoreCore): void;
342
+ declare function deleteAtom(atomToken: AtomToken<unknown>, store?: Store): void;
316
343
 
317
344
  declare const isAtomDefault: (key: string, store?: Store) => boolean;
318
345
  declare const markAtomAsDefault: (key: string, store?: Store) => void;
@@ -357,4 +384,4 @@ declare const setState__INTERNAL: <T>(state: Atom<T> | Selector<T>, value: T | (
357
384
 
358
385
  declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
359
386
 
360
- export { type Atom, FamilyTracker, type Fated, Future, IMPLICIT, type Loadable, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type Selector, type Signal, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
387
+ export { type Atom, type AtomKey, FamilyTracker, type Fated, Future, IMPLICIT, type Loadable, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getSelectorDependencyKeys, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
@@ -1,7 +1,25 @@
1
- import { AtomToken, ReadonlySelectorToken, SelectorToken, Transactors, FamilyMetadata, SelectorOptions, ReadonlySelectorOptions, StateToken, ƒn, TransactionUpdate, TransactionOptions, TransactionToken, MutableAtomOptions, MutableAtomToken, MutableAtomFamilyOptions, MutableAtomFamily, AtomFamily, StateUpdate, TimelineUpdate, TimelineOptions, TimelineToken, ReadonlySelectorFamily, SelectorFamily, Logger, AtomOptions, AtomFamilyOptions, ReadonlySelectorFamilyOptions, SelectorFamilyOptions } from 'atom.io';
1
+ import { Transactors, FamilyMetadata as FamilyMetadata$1, SelectorOptions, SelectorToken, ReadonlySelectorOptions, ReadonlySelectorToken, StateToken, ƒn, TransactionUpdate, TransactionOptions, TransactionToken, AtomToken as AtomToken$1, MutableAtomOptions, MutableAtomToken, MutableAtomFamilyOptions, MutableAtomFamily, AtomFamily, StateUpdate, TimelineUpdate, TimelineOptions, TimelineToken, ReadonlySelectorFamily, SelectorFamily, AtomIOLogger, Logger, AtomOptions, AtomFamilyOptions, ReadonlySelectorFamilyOptions, SelectorFamilyOptions } from 'atom.io';
2
2
  import { Json } from 'atom.io/json';
3
3
 
4
- declare const lookupSelectorSources: (key: string, store: Store) => (AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>)[];
4
+ type AtomKey<T> = string & {
5
+ __atomKey?: never;
6
+ __brand?: T;
7
+ };
8
+ type SelectorKey<T> = string & {
9
+ __selectorKey?: never;
10
+ __brand?: T;
11
+ };
12
+ type ReadonlySelectorKey<T> = string & {
13
+ __readonlySelectorKey?: never;
14
+ __brand?: T;
15
+ };
16
+ declare const isAtomKey: (key: string, store: Store) => key is AtomKey<unknown>;
17
+ declare const isSelectorKey: (key: string, store: Store) => key is SelectorKey<unknown>;
18
+ declare const isReadonlySelectorKey: (key: string, store: Store) => key is ReadonlySelectorKey<unknown>;
19
+ type StateKey<T> = AtomKey<T> | ReadonlySelectorKey<T> | SelectorKey<T>;
20
+ declare const isStateKey: (key: string, store: Store) => key is StateKey<unknown>;
21
+
22
+ declare const getSelectorDependencyKeys: (key: string, store: Store) => (AtomKey<unknown> | ReadonlySelectorKey<unknown> | SelectorKey<unknown>)[];
5
23
 
6
24
  declare const registerSelector: (selectorKey: string, store?: Store) => Transactors;
7
25
 
@@ -16,7 +34,7 @@ declare class Subject<T> {
16
34
  type Selector<T> = {
17
35
  key: string;
18
36
  type: `selector`;
19
- family?: FamilyMetadata;
37
+ family?: FamilyMetadata$1;
20
38
  install: (store: Store) => void;
21
39
  subject: Subject<{
22
40
  newValue: T;
@@ -28,7 +46,7 @@ type Selector<T> = {
28
46
  type ReadonlySelector<T> = {
29
47
  key: string;
30
48
  type: `readonly_selector`;
31
- family?: FamilyMetadata;
49
+ family?: FamilyMetadata$1;
32
50
  install: (store: Store) => void;
33
51
  subject: Subject<{
34
52
  newValue: T;
@@ -36,11 +54,11 @@ type ReadonlySelector<T> = {
36
54
  }>;
37
55
  get: () => T;
38
56
  };
39
- declare function createSelector<T>(options: SelectorOptions<T>, family?: FamilyMetadata, store?: Store): SelectorToken<T>;
40
- declare function createSelector<T>(options: ReadonlySelectorOptions<T>, family?: FamilyMetadata, store?: Store): ReadonlySelectorToken<T>;
57
+ declare function createSelector<T>(options: SelectorOptions<T>, family?: FamilyMetadata$1, store?: Store): SelectorToken<T>;
58
+ declare function createSelector<T>(options: ReadonlySelectorOptions<T>, family?: FamilyMetadata$1, store?: Store): ReadonlySelectorToken<T>;
41
59
 
42
- declare const traceSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => AtomToken<unknown>[];
43
- declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomToken<unknown>[];
60
+ declare const traceSelectorAtoms: (selectorKey: string, directDependencyKey: StateKey<unknown>, store: Store) => AtomKey<unknown>[];
61
+ declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomKey<unknown>[];
44
62
 
45
63
  declare const updateSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => void;
46
64
 
@@ -76,7 +94,7 @@ type TransactionIdle = {
76
94
  };
77
95
  type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
78
96
 
79
- declare function deposit<T>(state: Atom<T>): AtomToken<T>;
97
+ declare function deposit<T>(state: Atom<T>): AtomToken$1<T>;
80
98
  declare function deposit<T>(state: Selector<T>): SelectorToken<T>;
81
99
  declare function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>;
82
100
  declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
@@ -163,9 +181,9 @@ declare function createMutableAtomFamily<Core extends Transceiver<any>, Serializ
163
181
 
164
182
  declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
165
183
 
166
- declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
184
+ declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken$1<Signal<Core>>;
167
185
 
168
- declare function isAtomTokenMutable(token: AtomToken<any>): token is MutableAtomToken<any, any>;
186
+ declare function isAtomTokenMutable(token: AtomToken$1<any>): token is MutableAtomToken<any, any>;
169
187
 
170
188
  /**
171
189
  * @internal Give the tracker a transceiver state and a store, and it will
@@ -179,7 +197,7 @@ declare class Tracker<Mutable extends Transceiver<any>> {
179
197
  private observeCore;
180
198
  private updateCore;
181
199
  mutableState: MutableAtomToken<Mutable, Json.Serializable>;
182
- latestUpdateState: AtomToken<typeof this.Update | null>;
200
+ latestUpdateState: AtomToken$1<typeof this.Update | null>;
183
201
  constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store?: Store);
184
202
  }
185
203
 
@@ -213,7 +231,7 @@ type TimelineAtomUpdate = StateUpdate<unknown> & {
213
231
  key: string;
214
232
  type: `atom_update`;
215
233
  timestamp: number;
216
- family?: FamilyMetadata;
234
+ family?: FamilyMetadata$1;
217
235
  };
218
236
  type TimelineSelectorUpdate = {
219
237
  key: string;
@@ -240,7 +258,7 @@ type Timeline = {
240
258
  };
241
259
  declare function timeline__INTERNAL(options: TimelineOptions, store?: Store, data?: Timeline | null): TimelineToken;
242
260
 
243
- declare const addAtomToTimeline: (atomToken: AtomToken<any>, tl: Timeline, store?: Store) => void;
261
+ declare const addAtomToTimeline: (atomToken: AtomToken$1<any>, tl: Timeline, store?: Store) => void;
244
262
 
245
263
  declare const redo__INTERNAL: (token: TimelineToken, store?: Store) => void;
246
264
  declare const undo__INTERNAL: (token: TimelineToken, store?: Store) => void;
@@ -262,7 +280,7 @@ declare class Store {
262
280
  source: string;
263
281
  }>;
264
282
  subject: {
265
- atomCreation: Subject<AtomToken<unknown>>;
283
+ atomCreation: Subject<AtomToken$1<unknown>>;
266
284
  selectorCreation: Subject<SelectorToken<unknown> | ReadonlySelectorToken<unknown>>;
267
285
  transactionCreation: Subject<TransactionToken<ƒn>>;
268
286
  timelineCreation: Subject<TimelineToken>;
@@ -272,9 +290,9 @@ declare class Store {
272
290
  transactionStatus: TransactionStatus<ƒn>;
273
291
  config: {
274
292
  name: string;
275
- logger: Logger | null;
276
- logger__INTERNAL: Logger;
277
293
  };
294
+ loggers: AtomIOLogger[];
295
+ logger: Logger;
278
296
  constructor(name: string, store?: Store | null);
279
297
  }
280
298
  declare const IMPLICIT: {
@@ -283,9 +301,7 @@ declare const IMPLICIT: {
283
301
  };
284
302
  declare const clearStore: (store?: Store) => void;
285
303
 
286
- declare function lookup(key: string, store: Store): AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>;
287
-
288
- declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
304
+ declare function withdraw<T>(token: AtomToken$1<T>, store: Store): Atom<T> | undefined;
289
305
  declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
290
306
  declare function withdraw<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
291
307
  declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
@@ -293,7 +309,7 @@ declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transact
293
309
  declare function withdraw<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T> | undefined;
294
310
  declare function withdraw<T>(token: TimelineToken, store: Store): Timeline | undefined;
295
311
 
296
- declare function withdrawNewFamilyMember<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
312
+ declare function withdrawNewFamilyMember<T>(token: AtomToken$1<T>, store: Store): Atom<T> | undefined;
297
313
  declare function withdrawNewFamilyMember<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
298
314
  declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
299
315
  declare function withdrawNewFamilyMember<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
@@ -302,7 +318,7 @@ declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T> | St
302
318
  type Atom<T> = {
303
319
  key: string;
304
320
  type: `atom`;
305
- family?: FamilyMetadata;
321
+ family?: FamilyMetadata$1;
306
322
  install: (store: Store) => void;
307
323
  subject: Subject<{
308
324
  newValue: T;
@@ -310,9 +326,20 @@ type Atom<T> = {
310
326
  }>;
311
327
  default: T;
312
328
  };
313
- declare function createAtom<T>(options: AtomOptions<T> | MutableAtomOptions<any, any>, family?: FamilyMetadata, store?: Store): AtomToken<T>;
329
+ declare function createAtom<T>(options: AtomOptions<T> | MutableAtomOptions<any, any>, family?: FamilyMetadata$1, store?: Store): AtomToken$1<T>;
330
+
331
+ type AtomToken<_> = {
332
+ key: string;
333
+ type: `atom`;
334
+ family?: FamilyMetadata;
335
+ __brand?: _;
336
+ };
337
+ type FamilyMetadata = {
338
+ key: string;
339
+ subKey: string;
340
+ };
314
341
 
315
- declare function deleteAtom(key: string, core?: StoreCore): void;
342
+ declare function deleteAtom(atomToken: AtomToken<unknown>, store?: Store): void;
316
343
 
317
344
  declare const isAtomDefault: (key: string, store?: Store) => boolean;
318
345
  declare const markAtomAsDefault: (key: string, store?: Store) => void;
@@ -357,4 +384,4 @@ declare const setState__INTERNAL: <T>(state: Atom<T> | Selector<T>, value: T | (
357
384
 
358
385
  declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
359
386
 
360
- export { type Atom, FamilyTracker, type Fated, Future, IMPLICIT, type Loadable, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type Selector, type Signal, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
387
+ export { type Atom, type AtomKey, FamilyTracker, type Fated, Future, IMPLICIT, type Loadable, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getSelectorDependencyKeys, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };