atom.io 0.13.0 → 0.14.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 (141) hide show
  1. package/data/dist/index.cjs +1473 -52
  2. package/data/dist/index.cjs.map +1 -1
  3. package/data/dist/index.d.cts +315 -16
  4. package/data/dist/index.js +10 -267
  5. package/data/dist/index.js.map +1 -1
  6. package/data/package.json +5 -5
  7. package/data/src/join.ts +3 -3
  8. package/dist/chunk-5VJ77LZE.js +176 -0
  9. package/dist/chunk-5VJ77LZE.js.map +1 -0
  10. package/dist/chunk-CK7GNCU5.js +309 -0
  11. package/dist/chunk-CK7GNCU5.js.map +1 -0
  12. package/dist/chunk-KW7RA7IM.js +67 -0
  13. package/dist/chunk-KW7RA7IM.js.map +1 -0
  14. package/dist/chunk-LFXB7Y6M.js +68 -0
  15. package/dist/chunk-LFXB7Y6M.js.map +1 -0
  16. package/dist/chunk-NYCVSXQB.js +181 -0
  17. package/dist/chunk-NYCVSXQB.js.map +1 -0
  18. package/dist/chunk-TE3ZSTQ6.js +2516 -0
  19. package/dist/chunk-TE3ZSTQ6.js.map +1 -0
  20. package/dist/index.cjs +2250 -126
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +272 -25
  23. package/dist/index.js +1 -215
  24. package/dist/index.js.map +1 -1
  25. package/dist/metafile-cjs.json +1 -1
  26. package/internal/dist/index.cjs +885 -684
  27. package/internal/dist/index.cjs.map +1 -1
  28. package/internal/dist/index.d.cts +230 -24
  29. package/internal/dist/index.js +1 -2171
  30. package/internal/dist/index.js.map +1 -1
  31. package/internal/package.json +5 -5
  32. package/internal/src/atom/create-atom.ts +3 -2
  33. package/internal/src/mutable/create-mutable-atom.ts +3 -2
  34. package/internal/src/mutable/tracker.ts +6 -4
  35. package/internal/src/selector/register-selector.ts +1 -1
  36. package/internal/src/selector/update-selector-atoms.ts +3 -3
  37. package/internal/src/subscribe/index.ts +3 -0
  38. package/internal/src/subscribe/recall-state.ts +0 -6
  39. package/internal/src/subscribe/subscribe-to-state.ts +47 -0
  40. package/internal/src/subscribe/subscribe-to-timeline.ts +28 -0
  41. package/internal/src/subscribe/subscribe-to-transaction.ts +33 -0
  42. package/introspection/dist/index.cjs +1618 -46
  43. package/introspection/dist/index.cjs.map +1 -1
  44. package/introspection/dist/index.d.cts +374 -4
  45. package/introspection/dist/index.js +2 -316
  46. package/introspection/dist/index.js.map +1 -1
  47. package/introspection/package.json +5 -5
  48. package/json/dist/index.cjs +1560 -8
  49. package/json/dist/index.cjs.map +1 -1
  50. package/json/dist/index.d.cts +371 -7
  51. package/json/dist/index.js +1 -76
  52. package/json/dist/index.js.map +1 -1
  53. package/json/package.json +5 -5
  54. package/package.json +10 -9
  55. package/react/dist/index.cjs +1638 -10
  56. package/react/dist/index.cjs.map +1 -1
  57. package/react/dist/index.d.cts +383 -5
  58. package/react/dist/index.js +2 -31
  59. package/react/dist/index.js.map +1 -1
  60. package/react/package.json +5 -5
  61. package/react/src/store-hooks.ts +52 -3
  62. package/react-devtools/dist/index.cjs +2268 -198
  63. package/react-devtools/dist/index.cjs.map +1 -1
  64. package/react-devtools/dist/index.css +2 -2
  65. package/react-devtools/dist/index.d.cts +148 -24
  66. package/react-devtools/dist/index.js +57 -297
  67. package/react-devtools/dist/index.js.map +1 -1
  68. package/react-devtools/package.json +5 -5
  69. package/realtime-client/dist/index.cjs +1585 -34
  70. package/realtime-client/dist/index.cjs.map +1 -1
  71. package/realtime-client/dist/index.d.cts +382 -11
  72. package/realtime-client/dist/index.js +2 -164
  73. package/realtime-client/dist/index.js.map +1 -1
  74. package/realtime-client/package.json +5 -5
  75. package/realtime-client/src/use-push.ts +4 -4
  76. package/realtime-client/src/use-server-action.ts +4 -4
  77. package/realtime-react/dist/index.cjs +1782 -35
  78. package/realtime-react/dist/index.cjs.map +1 -1
  79. package/realtime-react/dist/index.d.cts +49 -9
  80. package/realtime-react/dist/index.js +4 -66
  81. package/realtime-react/dist/index.js.map +1 -1
  82. package/realtime-react/package.json +5 -5
  83. package/realtime-server/dist/index.cjs +1627 -60
  84. package/realtime-server/dist/index.cjs.map +1 -1
  85. package/realtime-server/dist/index.d.cts +391 -11
  86. package/realtime-server/dist/index.js +59 -32
  87. package/realtime-server/dist/index.js.map +1 -1
  88. package/realtime-server/package.json +6 -6
  89. package/realtime-server/src/hook-composition/expose-family.ts +7 -3
  90. package/realtime-server/src/hook-composition/expose-mutable-family.ts +13 -5
  91. package/realtime-server/src/hook-composition/expose-mutable.ts +11 -3
  92. package/realtime-server/src/hook-composition/expose-single.ts +6 -2
  93. package/realtime-server/src/hook-composition/receive-transaction.ts +14 -5
  94. package/realtime-testing/dist/index.cjs +2352 -16
  95. package/realtime-testing/dist/index.cjs.map +1 -1
  96. package/realtime-testing/dist/index.d.cts +486 -3
  97. package/realtime-testing/dist/index.js +10 -31
  98. package/realtime-testing/dist/index.js.map +1 -1
  99. package/realtime-testing/package.json +5 -5
  100. package/src/subscribe.ts +37 -91
  101. package/transceivers/set-rtx/dist/index.cjs +31 -10
  102. package/transceivers/set-rtx/dist/index.cjs.map +1 -1
  103. package/transceivers/set-rtx/dist/index.d.cts +29 -3
  104. package/transceivers/set-rtx/dist/index.js +2 -3
  105. package/transceivers/set-rtx/dist/index.js.map +1 -1
  106. package/transceivers/set-rtx/package.json +6 -6
  107. package/data/dist/index.d.ts +0 -158
  108. package/data/dist/metafile-cjs.json +0 -1
  109. package/data/dist/metafile-esm.json +0 -1
  110. package/dist/index.d.ts +0 -243
  111. package/dist/metafile-esm.json +0 -1
  112. package/internal/dist/index.d.ts +0 -414
  113. package/internal/dist/metafile-cjs.json +0 -1
  114. package/internal/dist/metafile-esm.json +0 -1
  115. package/introspection/dist/index.d.ts +0 -24
  116. package/introspection/dist/metafile-cjs.json +0 -1
  117. package/introspection/dist/metafile-esm.json +0 -1
  118. package/json/dist/index.d.ts +0 -51
  119. package/json/dist/metafile-cjs.json +0 -1
  120. package/json/dist/metafile-esm.json +0 -1
  121. package/react/dist/index.d.ts +0 -16
  122. package/react/dist/metafile-cjs.json +0 -1
  123. package/react/dist/metafile-esm.json +0 -1
  124. package/react-devtools/dist/index.d.ts +0 -341
  125. package/react-devtools/dist/metafile-cjs.json +0 -1
  126. package/react-devtools/dist/metafile-esm.json +0 -1
  127. package/realtime-client/dist/index.d.ts +0 -21
  128. package/realtime-client/dist/metafile-cjs.json +0 -1
  129. package/realtime-client/dist/metafile-esm.json +0 -1
  130. package/realtime-react/dist/index.d.ts +0 -27
  131. package/realtime-react/dist/metafile-cjs.json +0 -1
  132. package/realtime-react/dist/metafile-esm.json +0 -1
  133. package/realtime-server/dist/index.d.ts +0 -25
  134. package/realtime-server/dist/metafile-cjs.json +0 -1
  135. package/realtime-server/dist/metafile-esm.json +0 -1
  136. package/realtime-testing/dist/index.d.ts +0 -49
  137. package/realtime-testing/dist/metafile-cjs.json +0 -1
  138. package/realtime-testing/dist/metafile-esm.json +0 -1
  139. package/transceivers/set-rtx/dist/index.d.ts +0 -40
  140. package/transceivers/set-rtx/dist/metafile-cjs.json +0 -1
  141. package/transceivers/set-rtx/dist/metafile-esm.json +0 -1
package/dist/index.d.ts DELETED
@@ -1,243 +0,0 @@
1
- import * as Internal from 'atom.io/internal';
2
- import { Transceiver, Subject, Store, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate } from 'atom.io/internal';
3
- import { Json, JsonInterface } from 'atom.io/json';
4
-
5
- type Effectors<T> = {
6
- setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void;
7
- onSet: (callback: (options: {
8
- newValue: T;
9
- oldValue: T;
10
- }) => void) => void;
11
- };
12
- type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
13
- type AtomOptions<T> = {
14
- key: string;
15
- default: T | (() => T);
16
- effects?: AtomEffect<T>[];
17
- };
18
- type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & Omit<AtomOptions<T>, `default`> & {
19
- default: () => T;
20
- mutable: true;
21
- };
22
- declare function atom<T extends Transceiver<any>, J extends Json.Serializable>(options: MutableAtomOptions<T, J>): MutableAtomToken<T, J>;
23
- declare function atom<T>(options: AtomOptions<T>): AtomToken<T>;
24
- type AtomFamilyOptions<T, K extends Json.Serializable> = {
25
- key: string;
26
- default: T | ((key: K) => T);
27
- effects?: (key: K) => AtomEffect<T>[];
28
- };
29
- type AtomFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => AtomToken<T>) & {
30
- key: string;
31
- type: `atom_family`;
32
- subject: Subject<AtomToken<T>>;
33
- };
34
- type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
35
- mutable: true;
36
- };
37
- type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Json.Serializable, Key extends Json.Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
38
- key: `${string}::mutable`;
39
- type: `atom_family`;
40
- subject: Subject<MutableAtomToken<Core, SerializableCore>>;
41
- };
42
- declare function atomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamily<T, J, K>;
43
- declare function atomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>): AtomFamily<T, K>;
44
-
45
- declare function dispose(token: ReadonlySelectorToken<any> | StateToken<any>, store?: Internal.Store): void;
46
-
47
- declare function getState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store): T;
48
-
49
- declare const LoggerIconDictionary: {
50
- readonly "\u231B": "Timeline event fully captured";
51
- readonly "\u23E9": "Timeline redo";
52
- readonly "\u23EA": "Timeline undo";
53
- readonly "\u23ED\uFE0F": "Transaction redo";
54
- readonly "\u23EE\uFE0F": "Transaction undo";
55
- readonly "\u23F3": "Timeline event partially captured";
56
- readonly "\u23F9\uFE0F": "Time-travel complete";
57
- readonly "\uD83D\uDC81": "Notice";
58
- readonly "\uD83D\uDD04": "Realtime transaction synchronized";
59
- readonly "\u2705": "Realtime transaction success";
60
- readonly "\u2728": "Computation complete";
61
- readonly "\u274C": "Conflict prevents attempted action";
62
- readonly "\u2B55": "Operation start";
63
- readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
64
- readonly "\uD83D\uDC40": "Subscription added";
65
- readonly "\uD83D\uDC6A": "Family member added";
66
- readonly "\uD83D\uDCC1": "Stow update";
67
- readonly "\uD83D\uDCC3": "Copy mutable";
68
- readonly "\uD83D\uDCD6": "Read state";
69
- readonly "\uD83D\uDCDD": "Write state";
70
- readonly "\uD83D\uDCE2": "Notify subscribers";
71
- readonly "\uD83D\uDD0C": "Register dependency";
72
- readonly "\uD83D\uDD0D": "Discover root";
73
- readonly "\uD83D\uDD25": "Delete state";
74
- readonly "\uD83D\uDD27": "Create mutable atom";
75
- readonly "\uD83D\uDD28": "Create immutable atom";
76
- readonly "\uD83D\uDD34": "Operation complete";
77
- readonly "\uD83D\uDDD1": "Evict cached value";
78
- readonly "\uD83D\uDCA5": "Caught";
79
- readonly "\uD83D\uDE48": "Subscription canceled";
80
- readonly "\uD83D\uDEC4": "Apply transaction";
81
- readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
82
- readonly "\uD83D\uDEEB": "Begin transaction";
83
- readonly "\uD83D\uDEEC": "Complete transaction";
84
- readonly "\uD83E\uDDEE": "Computing selector";
85
- readonly "\uD83E\uDDF9": "Prepare to evict";
86
- readonly "\uD83E\uDE82": "Abort transaction";
87
- };
88
- type LoggerIcon = keyof typeof LoggerIconDictionary;
89
- declare const LOG_LEVELS: readonly ["info", "warn", "error"];
90
- type LogLevel = (typeof LOG_LEVELS)[number];
91
- type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
92
- type LogFilter = (...params: Parameters<LogFn>) => boolean;
93
- type Logger = Record<LogLevel, LogFn>;
94
- declare const simpleLog: (logLevel: keyof Logger) => LogFn;
95
- declare const simpleLogger: Logger;
96
- declare class AtomIOLogger implements Logger {
97
- logLevel: `error` | `info` | `warn` | null;
98
- private readonly filter?;
99
- private readonly logger;
100
- constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
101
- error: LogFn;
102
- info: LogFn;
103
- warn: LogFn;
104
- }
105
-
106
- type TransactionToken<_> = {
107
- key: string;
108
- type: `transaction`;
109
- __brand?: _;
110
- };
111
- type TransactionUpdate<ƒ extends ƒn> = {
112
- key: string;
113
- updates: (KeyedStateUpdate<unknown> | TransactionUpdate<ƒn>)[];
114
- params: Parameters<ƒ>;
115
- output: ReturnType<ƒ>;
116
- };
117
- type Transactors = {
118
- get: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S;
119
- set: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void;
120
- };
121
- type ReadonlyTransactors = Pick<Transactors, `get`>;
122
- type Read<ƒ extends ƒn> = (transactors: ReadonlyTransactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
123
- type Write<ƒ extends ƒn> = (transactors: Transactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
124
- type Act<ƒ extends ƒn> = (transactors: Transactors & {
125
- run: typeof runTransaction;
126
- }, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
127
- type TransactionOptions<ƒ extends ƒn> = {
128
- key: string;
129
- do: Act<ƒ>;
130
- };
131
- type TransactionIO<Token extends TransactionToken<any>> = Token extends TransactionToken<infer ƒ> ? ƒ : never;
132
- declare function transaction<ƒ extends ƒn>(options: TransactionOptions<ƒ>): TransactionToken<ƒ>;
133
- declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
134
-
135
- type SelectorOptions<T> = {
136
- key: string;
137
- get: Read<() => T>;
138
- set: Write<(newValue: T) => void>;
139
- };
140
- type ReadonlySelectorOptions<T> = {
141
- key: string;
142
- get: Read<() => T>;
143
- };
144
- declare function selector<T>(options: SelectorOptions<T>): SelectorToken<T>;
145
- declare function selector<T>(options: ReadonlySelectorOptions<T>): ReadonlySelectorToken<T>;
146
- type SelectorFamilyOptions<T, K extends Json.Serializable> = {
147
- key: string;
148
- get: (key: K) => Read<() => T>;
149
- set: (key: K) => Write<(newValue: T) => void>;
150
- };
151
- type ReadonlySelectorFamilyOptions<T, K extends Json.Serializable> = {
152
- key: string;
153
- get: (key: K) => Read<() => T>;
154
- };
155
- type SelectorFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => SelectorToken<T>) & {
156
- key: string;
157
- type: `selector_family`;
158
- subject: Subject<SelectorToken<T>>;
159
- };
160
- type ReadonlySelectorFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
161
- key: string;
162
- type: `readonly_selector_family`;
163
- subject: Subject<ReadonlySelectorToken<T>>;
164
- };
165
- declare function selectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>): SelectorFamily<T, K>;
166
- declare function selectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>): ReadonlySelectorFamily<T, K>;
167
-
168
- declare function setState<T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store): void;
169
-
170
- declare class Silo {
171
- store: Store;
172
- atom: typeof atom;
173
- atomFamily: typeof atomFamily;
174
- selector: typeof selector;
175
- selectorFamily: typeof selectorFamily;
176
- transaction: typeof transaction;
177
- timeline: typeof timeline;
178
- getState: typeof getState;
179
- setState: typeof setState;
180
- subscribe: typeof subscribe;
181
- undo: typeof undo;
182
- redo: typeof redo;
183
- constructor(name: string, fromStore?: Store | null);
184
- }
185
-
186
- type StateUpdate<T> = {
187
- newValue: T;
188
- oldValue: T;
189
- };
190
- type KeyedStateUpdate<T> = StateUpdate<T> & {
191
- key: string;
192
- family?: FamilyMetadata;
193
- };
194
- type UpdateHandler<T> = (update: StateUpdate<T>) => void;
195
- declare function subscribe<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key?: string, store?: Store): () => void;
196
- type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
197
- declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key?: string, store?: Store) => (() => void);
198
- declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key?: string, store?: Store) => (() => void);
199
-
200
- type TimelineToken = {
201
- key: string;
202
- type: `timeline`;
203
- };
204
- type TimelineOptions = {
205
- key: string;
206
- atoms: (AtomFamily<any, any> | AtomToken<any>)[];
207
- shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
208
- };
209
- type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
210
- declare const timeline: (options: TimelineOptions) => TimelineToken;
211
- declare const redo: (timeline: TimelineToken) => void;
212
- declare const undo: (timeline: TimelineToken) => void;
213
-
214
- type ƒn = (...parameters: any[]) => any;
215
- type AtomToken<_> = {
216
- key: string;
217
- type: `atom`;
218
- family?: FamilyMetadata;
219
- __brand?: _;
220
- };
221
- interface MutableAtomToken<T extends Transceiver<any>, J extends Json.Serializable> extends AtomToken<T> {
222
- __asJSON?: J;
223
- __update?: T extends Transceiver<infer Update> ? Update : never;
224
- }
225
- type SelectorToken<_> = {
226
- key: string;
227
- type: `selector`;
228
- family?: FamilyMetadata;
229
- __brand?: _;
230
- };
231
- type StateToken<T> = AtomToken<T> | SelectorToken<T>;
232
- type ReadonlySelectorToken<_> = {
233
- key: string;
234
- type: `readonly_selector`;
235
- family?: FamilyMetadata;
236
- __brand?: _;
237
- };
238
- type FamilyMetadata = {
239
- key: string;
240
- subKey: string;
241
- };
242
-
243
- export { type Act, type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, dispose, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, type ƒn };
@@ -1 +0,0 @@
1
- {"inputs":{"src/atom.ts":{"bytes":2963,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/dispose.ts":{"bytes":431,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/get-state.ts":{"bytes":475,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/logger.ts":{"bytes":2714,"imports":[],"format":"esm"},"src/selector.ts":{"bytes":2080,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/set-state.ts":{"bytes":598,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/silo.ts":{"bytes":1914,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"src/index.ts","kind":"import-statement","original":"."}],"format":"esm"},"src/subscribe.ts":{"bytes":3215,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/timeline.ts":{"bytes":928,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/transaction.ts":{"bytes":1822,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1053,"imports":[{"path":"src/atom.ts","kind":"import-statement","original":"./atom"},{"path":"src/dispose.ts","kind":"import-statement","original":"./dispose"},{"path":"src/get-state.ts","kind":"import-statement","original":"./get-state"},{"path":"src/logger.ts","kind":"import-statement","original":"./logger"},{"path":"src/selector.ts","kind":"import-statement","original":"./selector"},{"path":"src/set-state.ts","kind":"import-statement","original":"./set-state"},{"path":"src/silo.ts","kind":"import-statement","original":"./silo"},{"path":"src/subscribe.ts","kind":"import-statement","original":"./subscribe"},{"path":"src/timeline.ts","kind":"import-statement","original":"./timeline"},{"path":"src/transaction.ts","kind":"import-statement","original":"./transaction"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":25049},"dist/index.js":{"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true}],"exports":["AtomIOLogger","LOG_LEVELS","Silo","atom","atomFamily","dispose","getState","redo","runTransaction","selector","selectorFamily","setState","simpleLog","simpleLogger","subscribe","subscribeToTimeline","subscribeToTransaction","timeline","transaction","undo"],"entryPoint":"src/index.ts","inputs":{"src/atom.ts":{"bytesInOutput":479},"src/index.ts":{"bytesInOutput":0},"src/dispose.ts":{"bytesInOutput":315},"src/get-state.ts":{"bytesInOutput":376},"src/logger.ts":{"bytesInOutput":1203},"src/selector.ts":{"bytesInOutput":280},"src/set-state.ts":{"bytesInOutput":511},"src/silo.ts":{"bytesInOutput":1431},"src/subscribe.ts":{"bytesInOutput":2517},"src/timeline.ts":{"bytesInOutput":376},"src/transaction.ts":{"bytesInOutput":504}},"bytes":8474}}}
@@ -1,414 +0,0 @@
1
- import { FamilyMetadata, SelectorOptions, SelectorToken, ReadonlySelectorOptions, ReadonlySelectorToken, Transactors, StateToken, ƒn, TransactionUpdate, TransactionOptions, TransactionToken, AtomToken, MutableAtomOptions, MutableAtomToken, MutableAtomFamilyOptions, MutableAtomFamily, SelectorFamily, AtomFamily, StateUpdate, TimelineUpdate, TimelineOptions, TimelineToken, ReadonlySelectorFamily, AtomIOLogger, Logger, AtomOptions, AtomFamilyOptions, ReadonlySelectorFamilyOptions, SelectorFamilyOptions } from 'atom.io';
2
- import { Json } from 'atom.io/json';
3
-
4
- declare class Subject<T> {
5
- Subscriber: (value: T) => void;
6
- subscribers: Map<string, this[`Subscriber`]>;
7
- subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
8
- private unsubscribe;
9
- next(value: T): void;
10
- }
11
- declare class StatefulSubject<T> extends Subject<T> {
12
- state: T;
13
- constructor(initialState: T);
14
- next(value: T): void;
15
- }
16
-
17
- type Selector<T> = {
18
- key: string;
19
- type: `selector`;
20
- family?: FamilyMetadata;
21
- install: (store: Store) => void;
22
- subject: Subject<{
23
- newValue: T;
24
- oldValue: T;
25
- }>;
26
- get: () => T;
27
- set: (newValue: T | ((oldValue: T) => T)) => void;
28
- };
29
- type ReadonlySelector<T> = {
30
- key: string;
31
- type: `readonly_selector`;
32
- family?: FamilyMetadata;
33
- install: (store: Store) => void;
34
- subject: Subject<{
35
- newValue: T;
36
- oldValue: T;
37
- }>;
38
- get: () => T;
39
- };
40
- declare function createSelector<T>(options: SelectorOptions<T>, family: FamilyMetadata | undefined, store: Store): SelectorToken<T>;
41
- declare function createSelector<T>(options: ReadonlySelectorOptions<T>, family: FamilyMetadata | undefined, store: Store): ReadonlySelectorToken<T>;
42
-
43
- declare function deleteSelector(selectorToken: ReadonlySelectorToken<unknown> | SelectorToken<unknown>, store: Store): void;
44
-
45
- type AtomKey<T> = string & {
46
- __atomKey?: never;
47
- __brand?: T;
48
- };
49
- type SelectorKey<T> = string & {
50
- __selectorKey?: never;
51
- __brand?: T;
52
- };
53
- type ReadonlySelectorKey<T> = string & {
54
- __readonlySelectorKey?: never;
55
- __brand?: T;
56
- };
57
- declare const isAtomKey: (key: string, store: Store) => key is AtomKey<unknown>;
58
- declare const isSelectorKey: (key: string, store: Store) => key is SelectorKey<unknown>;
59
- declare const isReadonlySelectorKey: (key: string, store: Store) => key is ReadonlySelectorKey<unknown>;
60
- type StateKey<T> = AtomKey<T> | ReadonlySelectorKey<T> | SelectorKey<T>;
61
- declare const isStateKey: (key: string, store: Store) => key is StateKey<unknown>;
62
-
63
- declare const getSelectorDependencyKeys: (key: string, store: Store) => (AtomKey<unknown> | ReadonlySelectorKey<unknown> | SelectorKey<unknown>)[];
64
-
65
- declare const registerSelector: (selectorKey: string, store: Store) => Transactors;
66
-
67
- declare const traceSelectorAtoms: (selectorKey: string, directDependencyKey: StateKey<unknown>, store: Store) => AtomKey<unknown>[];
68
- declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomKey<unknown>[];
69
-
70
- declare const updateSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => void;
71
-
72
- declare const abortTransaction: (store: Store) => void;
73
-
74
- declare const applyTransaction: <ƒ extends ƒn>(output: ReturnType<ƒ>, store: Store) => void;
75
-
76
- declare const buildTransaction: (key: string, params: any[], store: Store) => void;
77
-
78
- type Transaction<ƒ extends ƒn> = {
79
- key: string;
80
- type: `transaction`;
81
- install: (store: Store) => void;
82
- subject: Subject<TransactionUpdate<ƒ>>;
83
- run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
84
- };
85
- declare function createTransaction<ƒ extends ƒn>(options: TransactionOptions<ƒ>, store: Store): TransactionToken<ƒ>;
86
-
87
- declare const redoTransactionUpdate: <ƒ extends ƒn>(transactionUpdate: TransactionUpdate<ƒ>, store: Store) => void;
88
-
89
- declare const undoTransactionUpdate: <ƒ extends ƒn>(transactionUpdate: TransactionUpdate<ƒ>, store: Store) => void;
90
-
91
- declare const TRANSACTION_PHASES: readonly ["idle", "building", "applying"];
92
- type TransactionPhase = (typeof TRANSACTION_PHASES)[number];
93
- type TransactionMeta<ƒ extends ƒn> = {
94
- phase: `applying` | `building`;
95
- time: number;
96
- update: TransactionUpdate<ƒ>;
97
- };
98
-
99
- declare function deposit<T>(state: Atom<T>): AtomToken<T>;
100
- declare function deposit<T>(state: Selector<T>): SelectorToken<T>;
101
- declare function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>;
102
- declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
103
- declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
104
- declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
105
-
106
- type primitive = boolean | number | string | null;
107
-
108
- type Serializable = primitive | Readonly<{
109
- [key: string]: Serializable;
110
- }> | ReadonlyArray<Serializable>;
111
- type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
112
-
113
- type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
114
- type Cardinality = `1:1` | `1:n` | `n:n`;
115
-
116
- interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
117
- readonly relations: [string, string[]][];
118
- readonly contents: [string, Content][];
119
- }
120
- interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
121
- readonly between: [a: ASide, b: BSide];
122
- readonly cardinality: Cardinality;
123
- }
124
- type BaseExternalStoreConfiguration = {
125
- addRelation: (a: string, b: string) => void;
126
- deleteRelation: (a: string, b: string) => void;
127
- replaceRelationsSafely: (a: string, bs: string[]) => void;
128
- replaceRelationsUnsafely: (a: string, bs: string[]) => void;
129
- getRelatedKeys: (key: string) => Set<string> | undefined;
130
- has: (a: string, b?: string) => boolean;
131
- };
132
- type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
133
- getContent: (contentKey: string) => Content | undefined;
134
- setContent: (contentKey: string, content: Content) => void;
135
- deleteContent: (contentKey: string) => void;
136
- };
137
- type Empty<Obj extends object> = {
138
- [Key in keyof Obj]?: undefined;
139
- };
140
- type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
141
- type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
142
- externalStore?: ExternalStoreConfiguration<Content>;
143
- isContent?: Refinement<unknown, Content>;
144
- makeContentKey?: (a: string, b: string) => string;
145
- };
146
- type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
147
- declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
148
- readonly a: ASide;
149
- readonly b: BSide;
150
- readonly cardinality: Cardinality;
151
- readonly relations: Map<string, Set<string>>;
152
- readonly contents: Map<string, Content>;
153
- isContent: Refinement<unknown, Content> | null;
154
- makeContentKey: (a: string, b: string) => string;
155
- getRelatedKeys(key: string): Set<string> | undefined;
156
- protected addRelation(a: string, b: string): void;
157
- protected deleteRelation(a: string, b: string): void;
158
- protected replaceRelationsUnsafely(a: string, bs: string[]): void;
159
- protected replaceRelationsSafely(a: string, bs: string[]): void;
160
- protected getContentInternal(contentKey: string): Content | undefined;
161
- protected setContent(contentKey: string, content: Content): void;
162
- protected deleteContent(contentKey: string): void;
163
- constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
164
- toJSON(): JunctionJSON<ASide, BSide, Content>;
165
- set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
166
- set(relation: {
167
- [Key in ASide | BSide]: string;
168
- }, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
169
- delete(a: string, b?: string): this;
170
- delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
171
- getRelatedKey(key: string): string | undefined;
172
- replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
173
- reckless: boolean;
174
- }): this;
175
- getContent(a: string, b: string): Content | undefined;
176
- getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
177
- has(a: string, b?: string): boolean;
178
- }
179
-
180
- interface Lineage {
181
- parent: typeof this | null;
182
- child: typeof this | null;
183
- }
184
- declare function newest<T extends Lineage>(scion: T): T;
185
- declare function eldest<T extends Lineage>(scion: T): T;
186
-
187
- interface Transceiver<Signal extends Json.Serializable> {
188
- do: (update: Signal) => void;
189
- undo: (update: Signal) => void;
190
- subscribe: (key: string, fn: (update: Signal) => void) => () => void;
191
- cacheUpdateNumber: number;
192
- getUpdateNumber: (update: Signal) => number;
193
- }
194
- declare function isTransceiver(value: unknown): value is Transceiver<Json.Serializable>;
195
- type TransceiverMode = `playback` | `record` | `transaction`;
196
- type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
197
-
198
- declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Json.Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
199
-
200
- declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Json.Serializable, Key extends string>(options: MutableAtomFamilyOptions<Core, SerializableCore, Key>, store: Store): MutableAtomFamily<Core, SerializableCore, Key>;
201
-
202
- declare const getJsonFamily: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
203
-
204
- declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
205
-
206
- declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
207
-
208
- declare function isAtomTokenMutable(token: AtomToken<any>): token is MutableAtomToken<any, any>;
209
-
210
- /**
211
- * @internal Give the tracker a transceiver state and a store, and it will
212
- * subscribe to the transceiver's inner value. When the inner value changes,
213
- * the tracker will update its own state to reflect the change.
214
- */
215
- declare class Tracker<Mutable extends Transceiver<any>> {
216
- private Update;
217
- private initializeState;
218
- private unsubscribeFromInnerValue;
219
- private observeCore;
220
- private updateCore;
221
- mutableState: MutableAtomToken<Mutable, Json.Serializable>;
222
- latestUpdateState: AtomToken<typeof this.Update | null>;
223
- constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
224
- }
225
-
226
- declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Json.Serializable> {
227
- private readonly Update;
228
- readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
229
- readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
230
- constructor(findMutableState: AtomFamily<Core, FamilyMemberKey>, store: Store);
231
- }
232
-
233
- interface MutableAtom<T> extends Atom<T> {
234
- mutable: true;
235
- }
236
- declare const isAtomMutable: <T>(atom: Atom<T>) => atom is MutableAtom<T>;
237
-
238
- type OperationProgress = {
239
- open: false;
240
- } | {
241
- open: true;
242
- done: Set<string>;
243
- prev: Map<string, any>;
244
- time: number;
245
- token: StateToken<any>;
246
- };
247
- declare const openOperation: (token: StateToken<any>, store: Store) => `rejection` | undefined;
248
- declare const closeOperation: (store: Store) => void;
249
- declare const isDone: (key: string, store: Store) => boolean;
250
- declare const markDone: (key: string, store: Store) => void;
251
-
252
- type TimelineAtomUpdate = StateUpdate<unknown> & {
253
- key: string;
254
- type: `atom_update`;
255
- timestamp: number;
256
- family?: FamilyMetadata;
257
- };
258
- type TimelineSelectorUpdate = {
259
- key: string;
260
- type: `selector_update`;
261
- timestamp: number;
262
- atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
263
- };
264
- type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
265
- key: string;
266
- type: `transaction_update`;
267
- timestamp: number;
268
- };
269
- type Timeline = {
270
- type: `timeline`;
271
- key: string;
272
- at: number;
273
- shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
274
- timeTraveling: `into_future` | `into_past` | null;
275
- history: TimelineUpdate[];
276
- selectorTime: number | null;
277
- transactionKey: string | null;
278
- install: (store: Store) => void;
279
- subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
280
- };
281
- declare function createTimeline(options: TimelineOptions, store: Store, data?: Timeline): TimelineToken;
282
-
283
- declare const addAtomToTimeline: (atomToken: AtomToken<any>, tl: Timeline, store: Store) => void;
284
-
285
- declare const timeTravel: (direction: `backward` | `forward`, token: TimelineToken, store: Store) => void;
286
-
287
- declare class Store implements Lineage {
288
- parent: Store | null;
289
- child: Store | null;
290
- valueMap: Map<string, any>;
291
- atoms: Map<string, Atom<any> | MutableAtom<any>>;
292
- selectors: Map<string, Selector<any>>;
293
- readonlySelectors: Map<string, ReadonlySelector<any>>;
294
- trackers: Map<string, Tracker<Transceiver<any>>>;
295
- families: Map<string, AtomFamily<any, any> | ReadonlySelectorFamily<any, any> | SelectorFamily<any, any>>;
296
- timelines: Map<string, Timeline>;
297
- transactions: Map<string, Transaction<ƒn>>;
298
- atomsThatAreDefault: Set<string>;
299
- timelineAtoms: Junction<"timelineKey", "atomKey", null>;
300
- selectorAtoms: Junction<"selectorKey", "atomKey", null>;
301
- selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
302
- source: string;
303
- }>;
304
- subject: {
305
- atomCreation: Subject<AtomToken<unknown>>;
306
- selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
307
- transactionCreation: Subject<TransactionToken<ƒn>>;
308
- timelineCreation: Subject<TimelineToken>;
309
- transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
310
- operationStatus: Subject<OperationProgress>;
311
- };
312
- operation: OperationProgress;
313
- transactionMeta: TransactionMeta<ƒn> | null;
314
- config: {
315
- name: string;
316
- };
317
- loggers: AtomIOLogger[];
318
- logger: Logger;
319
- constructor(name: string, store?: Store | null);
320
- }
321
- declare const IMPLICIT: {
322
- STORE_INTERNAL: Store | undefined;
323
- readonly STORE: Store;
324
- };
325
- declare const clearStore: (store: Store) => void;
326
-
327
- declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
328
- declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
329
- declare function withdraw<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
330
- declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
331
- declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transaction<T extends ƒn ? T : never> | undefined;
332
- declare function withdraw<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T> | undefined;
333
- declare function withdraw<T>(token: TimelineToken, store: Store): Timeline | undefined;
334
-
335
- declare function withdrawNewFamilyMember<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
336
- declare function withdrawNewFamilyMember<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
337
- declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
338
- declare function withdrawNewFamilyMember<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
339
- declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T> | undefined;
340
-
341
- type Atom<T> = {
342
- key: string;
343
- type: `atom`;
344
- family?: FamilyMetadata;
345
- install: (store: Store) => void;
346
- subject: Subject<{
347
- newValue: T;
348
- oldValue: T;
349
- }>;
350
- default: T | (() => T);
351
- cleanup?: () => void;
352
- };
353
- declare function createAtom<T>(options: AtomOptions<T> | MutableAtomOptions<any, any>, family: FamilyMetadata | undefined, store: Store): AtomToken<T>;
354
-
355
- declare function deleteAtom(atomToken: AtomToken<unknown>, store: Store): void;
356
-
357
- declare const isAtomDefault: (key: string, store: Store) => boolean;
358
- declare const markAtomAsDefault: (key: string, store: Store) => void;
359
- declare const markAtomAsNotDefault: (key: string, store: Store) => void;
360
- declare const isSelectorDefault: (key: string, store: Store) => boolean;
361
-
362
- /**
363
- * A Promise that can be canceled.
364
- * @internal
365
- * @private
366
- * @typeParam T The type of the value that the promise will resolve to.
367
- *
368
- * @remarks
369
- * Can be constructed like a Promise, or from an existing Promise.
370
- */
371
- declare class Future<T> extends Promise<T> {
372
- isCanceled: boolean;
373
- constructor(executor: Promise<T> | ((resolve: (value: T) => void, reject: (reason?: any) => void) => void));
374
- cancel(): void;
375
- }
376
-
377
- declare function cacheValue<T>(key: string, value: T, subject: Subject<StateUpdate<unknown>>, store: Store): T;
378
- declare function cacheValue<T extends Promise<any>>(key: string, value: T, subject: Subject<StateUpdate<unknown>>, store: Store): Future<T>;
379
- declare const readCachedValue: <T>(key: string, store: Store) => T;
380
- declare const isValueCached: (key: string, store: Store) => boolean;
381
- declare const evictCachedValue: (key: string, store: Store) => void;
382
-
383
- declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
384
-
385
- declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
386
-
387
- declare function createSelectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
388
- declare function createSelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
389
-
390
- declare class LazyMap<K, V> extends Map<K, V> {
391
- protected readonly source: Map<K, V>;
392
- deleted: Set<K>;
393
- constructor(source: Map<K, V>);
394
- get(key: K): V | undefined;
395
- set(key: K, value: V): this;
396
- hasOwn(key: K): boolean;
397
- has(key: K): boolean;
398
- delete(key: K): boolean;
399
- }
400
-
401
- declare class NotFoundError extends Error {
402
- constructor(token: ReadonlySelectorToken<any> | StateToken<any>, store: Store);
403
- }
404
-
405
- declare const readOrComputeValue: <T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>, store: Store) => T;
406
-
407
- type Modify<T> = (thing: T) => T;
408
- declare const become: <T>(nextVersionOfThing: T | Modify<T>) => (originalThing: T) => T;
409
-
410
- declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((oldValue: T) => T), store: Store) => void;
411
-
412
- declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
413
-
414
- export { type Atom, type AtomKey, FamilyTracker, Future, IMPLICIT, LazyMap, type Lineage, type Modify, type MutableAtom, NotFoundError, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionMeta, type TransactionPhase, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, createTimeline, createTransaction, deleteAtom, deleteSelector, deposit, eldest, evictCachedValue, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, redoTransactionUpdate, registerSelector, setAtomOrSelector, subscribeToRootAtoms, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, undoTransactionUpdate, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };