atom.io 0.14.4 → 0.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/dist/index.cjs +47 -1416
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.cts +16 -317
- package/data/dist/index.d.ts +16 -317
- package/data/dist/index.js +4 -6
- package/data/dist/index.js.map +1 -1
- package/dist/chunk-NYTGCPHB.js +261 -0
- package/dist/chunk-NYTGCPHB.js.map +1 -0
- package/dist/chunk-PZLG2HP3.js +36 -0
- package/dist/chunk-PZLG2HP3.js.map +1 -0
- package/dist/chunk-XACXFU3B.js +46 -0
- package/dist/chunk-XACXFU3B.js.map +1 -0
- package/dist/index.cjs +55 -2330
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -269
- package/dist/index.d.ts +21 -269
- package/dist/index.js +152 -1
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/internal/dist/index.cjs +30 -159
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +28 -229
- package/internal/dist/index.d.ts +28 -229
- package/internal/dist/index.js +2027 -1
- package/internal/dist/index.js.map +1 -1
- package/introspection/dist/index.cjs +45 -1565
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.cts +4 -376
- package/introspection/dist/index.d.ts +4 -376
- package/introspection/dist/index.js +298 -2
- package/introspection/dist/index.js.map +1 -1
- package/json/dist/index.cjs +5 -1502
- package/json/dist/index.cjs.map +1 -1
- package/json/dist/index.d.cts +7 -373
- package/json/dist/index.d.ts +7 -373
- package/json/dist/index.js +37 -1
- package/json/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/react/dist/index.cjs +14 -1549
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.cts +4 -377
- package/react/dist/index.d.ts +4 -377
- package/react/dist/index.js +62 -2
- package/react/dist/index.js.map +1 -1
- package/react-devtools/dist/index.cjs +135 -2153
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.d.cts +24 -149
- package/react-devtools/dist/index.d.ts +24 -149
- package/react-devtools/dist/index.js +5 -3
- package/react-devtools/dist/index.js.map +1 -1
- package/realtime-client/dist/index.cjs +34 -1529
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.cts +12 -384
- package/realtime-client/dist/index.d.ts +12 -384
- package/realtime-client/dist/index.js +165 -2
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-react/dist/index.cjs +35 -1727
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.cts +9 -49
- package/realtime-react/dist/index.d.ts +9 -49
- package/realtime-react/dist/index.js +66 -4
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-server/dist/index.cjs +57 -1548
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.cts +11 -394
- package/realtime-server/dist/index.d.ts +11 -394
- package/realtime-server/dist/index.js +21 -27
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-testing/dist/index.cjs +15 -2376
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.d.cts +3 -489
- package/realtime-testing/dist/index.d.ts +3 -489
- package/realtime-testing/dist/index.js +10 -9
- package/realtime-testing/dist/index.js.map +1 -1
- package/transceivers/set-rtx/dist/index.cjs +9 -31
- package/transceivers/set-rtx/dist/index.cjs.map +1 -1
- package/transceivers/set-rtx/dist/index.d.cts +3 -29
- package/transceivers/set-rtx/dist/index.d.ts +3 -29
- package/transceivers/set-rtx/dist/index.js +3 -2
- package/transceivers/set-rtx/dist/index.js.map +1 -1
- package/dist/chunk-GMN5KH6A.js +0 -309
- package/dist/chunk-GMN5KH6A.js.map +0 -1
- package/dist/chunk-HQWWV67P.js +0 -62
- package/dist/chunk-HQWWV67P.js.map +0 -1
- package/dist/chunk-MK4OJD24.js +0 -67
- package/dist/chunk-MK4OJD24.js.map +0 -1
- package/dist/chunk-N7ADBQJG.js +0 -176
- package/dist/chunk-N7ADBQJG.js.map +0 -1
- package/dist/chunk-PURABO5G.js +0 -2581
- package/dist/chunk-PURABO5G.js.map +0 -1
|
@@ -1,214 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
type primitive = boolean | number | string | null;
|
|
7
|
-
|
|
8
|
-
type Serializable = primitive | Readonly<{
|
|
9
|
-
[key: string]: Serializable;
|
|
10
|
-
}> | ReadonlyArray<Serializable>;
|
|
11
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
12
|
-
|
|
13
|
-
type Effectors<T> = {
|
|
14
|
-
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void;
|
|
15
|
-
onSet: (callback: (options: {
|
|
16
|
-
newValue: T;
|
|
17
|
-
oldValue: T;
|
|
18
|
-
}) => void) => void;
|
|
19
|
-
};
|
|
20
|
-
type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
|
|
21
|
-
type AtomOptions<T> = {
|
|
22
|
-
key: string;
|
|
23
|
-
default: T | (() => T);
|
|
24
|
-
effects?: AtomEffect<T>[];
|
|
25
|
-
};
|
|
26
|
-
type MutableAtomOptions<T extends Transceiver<any>, J extends Serializable> = JsonInterface<T, J> & Omit<AtomOptions<T>, `default`> & {
|
|
27
|
-
default: () => T;
|
|
28
|
-
mutable: true;
|
|
29
|
-
};
|
|
30
|
-
type AtomFamilyOptions<T, K extends Serializable> = {
|
|
31
|
-
key: string;
|
|
32
|
-
default: T | ((key: K) => T);
|
|
33
|
-
effects?: (key: K) => AtomEffect<T>[];
|
|
34
|
-
};
|
|
35
|
-
type AtomFamily<T, K extends Serializable = Serializable> = ((key: K) => AtomToken<T>) & {
|
|
36
|
-
key: string;
|
|
37
|
-
type: `atom_family`;
|
|
38
|
-
subject: Subject<AtomToken<T>>;
|
|
39
|
-
mutable?: boolean;
|
|
40
|
-
};
|
|
41
|
-
type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Serializable, K extends Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
|
|
42
|
-
mutable: true;
|
|
43
|
-
};
|
|
44
|
-
type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
|
|
45
|
-
key: `${string}`;
|
|
46
|
-
type: `atom_family`;
|
|
47
|
-
subject: Subject<MutableAtomToken<Core, SerializableCore>>;
|
|
48
|
-
mutable: true;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
declare const LoggerIconDictionary: {
|
|
52
|
-
readonly "\u231B": "Timeline event fully captured";
|
|
53
|
-
readonly "\u23E9": "Timeline redo";
|
|
54
|
-
readonly "\u23EA": "Timeline undo";
|
|
55
|
-
readonly "\u23ED\uFE0F": "Transaction redo";
|
|
56
|
-
readonly "\u23EE\uFE0F": "Transaction undo";
|
|
57
|
-
readonly "\u23F3": "Timeline event partially captured";
|
|
58
|
-
readonly "\u23F9\uFE0F": "Time-travel complete";
|
|
59
|
-
readonly "\uD83D\uDC81": "Notice";
|
|
60
|
-
readonly "\uD83D\uDD04": "Realtime transaction synchronized";
|
|
61
|
-
readonly "\u2705": "Realtime transaction success";
|
|
62
|
-
readonly "\u2728": "Computation complete";
|
|
63
|
-
readonly "\u274C": "Conflict prevents attempted action";
|
|
64
|
-
readonly "\u2B55": "Operation start";
|
|
65
|
-
readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
|
|
66
|
-
readonly "\uD83D\uDC40": "Subscription added";
|
|
67
|
-
readonly "\uD83D\uDC6A": "Family member added";
|
|
68
|
-
readonly "\uD83D\uDCC1": "Stow update";
|
|
69
|
-
readonly "\uD83D\uDCC3": "Copy mutable";
|
|
70
|
-
readonly "\uD83D\uDCD6": "Read state";
|
|
71
|
-
readonly "\uD83D\uDCDD": "Write state";
|
|
72
|
-
readonly "\uD83D\uDCE2": "Notify subscribers";
|
|
73
|
-
readonly "\uD83D\uDD0C": "Register dependency";
|
|
74
|
-
readonly "\uD83D\uDD0D": "Discover root";
|
|
75
|
-
readonly "\uD83D\uDD25": "Delete state";
|
|
76
|
-
readonly "\uD83D\uDD27": "Create mutable atom";
|
|
77
|
-
readonly "\uD83D\uDD28": "Create immutable atom";
|
|
78
|
-
readonly "\uD83D\uDD34": "Operation complete";
|
|
79
|
-
readonly "\uD83D\uDDD1": "Evict cached value";
|
|
80
|
-
readonly "\uD83D\uDCA5": "Caught";
|
|
81
|
-
readonly "\uD83D\uDE48": "Subscription canceled";
|
|
82
|
-
readonly "\uD83D\uDEC4": "Apply transaction";
|
|
83
|
-
readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
|
|
84
|
-
readonly "\uD83D\uDEEB": "Begin transaction";
|
|
85
|
-
readonly "\uD83D\uDEEC": "Complete transaction";
|
|
86
|
-
readonly "\uD83E\uDDEE": "Computing selector";
|
|
87
|
-
readonly "\uD83E\uDDF9": "Prepare to evict";
|
|
88
|
-
readonly "\uD83E\uDE82": "Abort transaction";
|
|
89
|
-
};
|
|
90
|
-
type LoggerIcon = keyof typeof LoggerIconDictionary;
|
|
91
|
-
declare const LOG_LEVELS: readonly ["info", "warn", "error"];
|
|
92
|
-
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
93
|
-
type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
|
|
94
|
-
type LogFilter = (...params: Parameters<LogFn>) => boolean;
|
|
95
|
-
type Logger = Record<LogLevel, LogFn>;
|
|
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
|
-
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
132
|
-
|
|
133
|
-
type SelectorOptions<T> = {
|
|
134
|
-
key: string;
|
|
135
|
-
get: Read<() => T>;
|
|
136
|
-
set: Write<(newValue: T) => void>;
|
|
137
|
-
};
|
|
138
|
-
type ReadonlySelectorOptions<T> = {
|
|
139
|
-
key: string;
|
|
140
|
-
get: Read<() => T>;
|
|
141
|
-
};
|
|
142
|
-
type SelectorFamilyOptions<T, K extends Serializable> = {
|
|
143
|
-
key: string;
|
|
144
|
-
get: (key: K) => Read<() => T>;
|
|
145
|
-
set: (key: K) => Write<(newValue: T) => void>;
|
|
146
|
-
};
|
|
147
|
-
type ReadonlySelectorFamilyOptions<T, K extends Serializable> = {
|
|
148
|
-
key: string;
|
|
149
|
-
get: (key: K) => Read<() => T>;
|
|
150
|
-
};
|
|
151
|
-
type SelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
152
|
-
key: string;
|
|
153
|
-
type: `selector_family`;
|
|
154
|
-
subject: Subject<SelectorToken<T>>;
|
|
155
|
-
};
|
|
156
|
-
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
157
|
-
key: string;
|
|
158
|
-
type: `readonly_selector_family`;
|
|
159
|
-
subject: Subject<ReadonlySelectorToken<T>>;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
type StateUpdate<T> = {
|
|
163
|
-
newValue: T;
|
|
164
|
-
oldValue: T;
|
|
165
|
-
};
|
|
166
|
-
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
167
|
-
key: string;
|
|
168
|
-
family?: FamilyMetadata;
|
|
169
|
-
};
|
|
170
|
-
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
171
|
-
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
172
|
-
|
|
173
|
-
type TimelineToken = {
|
|
174
|
-
key: string;
|
|
175
|
-
type: `timeline`;
|
|
176
|
-
};
|
|
177
|
-
type TimelineOptions = {
|
|
178
|
-
key: string;
|
|
179
|
-
atoms: (AtomFamily<any, any> | AtomToken<any>)[];
|
|
180
|
-
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
181
|
-
};
|
|
182
|
-
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
183
|
-
|
|
184
|
-
type ƒn = (...parameters: any[]) => any;
|
|
185
|
-
type AtomToken<_> = {
|
|
186
|
-
key: string;
|
|
187
|
-
type: `atom`;
|
|
188
|
-
family?: FamilyMetadata;
|
|
189
|
-
__brand?: _;
|
|
190
|
-
};
|
|
191
|
-
interface MutableAtomToken<T extends Transceiver<any>, J extends Serializable> extends AtomToken<T> {
|
|
192
|
-
__asJSON?: J;
|
|
193
|
-
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
194
|
-
}
|
|
195
|
-
type SelectorToken<_> = {
|
|
196
|
-
key: string;
|
|
197
|
-
type: `selector`;
|
|
198
|
-
family?: FamilyMetadata;
|
|
199
|
-
__brand?: _;
|
|
200
|
-
};
|
|
201
|
-
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
202
|
-
type ReadonlySelectorToken<_> = {
|
|
203
|
-
key: string;
|
|
204
|
-
type: `readonly_selector`;
|
|
205
|
-
family?: FamilyMetadata;
|
|
206
|
-
__brand?: _;
|
|
207
|
-
};
|
|
208
|
-
type FamilyMetadata = {
|
|
209
|
-
key: string;
|
|
210
|
-
subKey: string;
|
|
211
|
-
};
|
|
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, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
|
|
2
|
+
import { Json } from 'atom.io/json';
|
|
3
|
+
import { Store as Store$1 } from 'atom.io/internal';
|
|
212
4
|
|
|
213
5
|
declare class Subject<T> {
|
|
214
6
|
Subscriber: (value: T) => void;
|
|
@@ -312,6 +104,13 @@ declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T
|
|
|
312
104
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
313
105
|
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
314
106
|
|
|
107
|
+
type primitive = boolean | number | string | null;
|
|
108
|
+
|
|
109
|
+
type Serializable = primitive | Readonly<{
|
|
110
|
+
[key: string]: Serializable;
|
|
111
|
+
}> | ReadonlyArray<Serializable>;
|
|
112
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
113
|
+
|
|
315
114
|
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
316
115
|
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
317
116
|
|
|
@@ -386,28 +185,28 @@ interface Lineage {
|
|
|
386
185
|
declare function newest<T extends Lineage>(scion: T): T;
|
|
387
186
|
declare function eldest<T extends Lineage>(scion: T): T;
|
|
388
187
|
|
|
389
|
-
interface Transceiver<Signal extends Serializable> {
|
|
188
|
+
interface Transceiver<Signal extends Json.Serializable> {
|
|
390
189
|
do: (update: Signal) => void;
|
|
391
190
|
undo: (update: Signal) => void;
|
|
392
191
|
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
393
192
|
cacheUpdateNumber: number;
|
|
394
193
|
getUpdateNumber: (update: Signal) => number;
|
|
395
194
|
}
|
|
396
|
-
declare function isTransceiver(value: unknown): value is Transceiver<Serializable>;
|
|
195
|
+
declare function isTransceiver(value: unknown): value is Transceiver<Json.Serializable>;
|
|
397
196
|
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
398
197
|
type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
|
|
399
198
|
|
|
400
|
-
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
199
|
+
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Json.Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
401
200
|
|
|
402
|
-
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends string>(options: MutableAtomFamilyOptions<Core, SerializableCore, Key>, store: Store): MutableAtomFamily<Core, SerializableCore, Key>;
|
|
201
|
+
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>;
|
|
403
202
|
|
|
404
|
-
declare const getJsonFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
|
|
203
|
+
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>;
|
|
405
204
|
|
|
406
|
-
declare const getJsonToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
205
|
+
declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
407
206
|
|
|
408
|
-
declare const getUpdateToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
207
|
+
declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
409
208
|
|
|
410
|
-
declare const getUpdateFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => AtomFamily<Signal<Core> | null, Key>;
|
|
209
|
+
declare const getUpdateFamily: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => AtomFamily<Signal<Core> | null, Key>;
|
|
411
210
|
|
|
412
211
|
/**
|
|
413
212
|
* @internal Give the tracker a transceiver state and a store, and it will
|
|
@@ -420,12 +219,12 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
420
219
|
private unsubscribeFromInnerValue;
|
|
421
220
|
private observeCore;
|
|
422
221
|
private updateCore;
|
|
423
|
-
mutableState: MutableAtomToken<Mutable, Serializable>;
|
|
222
|
+
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
424
223
|
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
425
|
-
constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
|
|
224
|
+
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
|
|
426
225
|
}
|
|
427
226
|
|
|
428
|
-
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Serializable> {
|
|
227
|
+
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Json.Serializable> {
|
|
429
228
|
private readonly Update;
|
|
430
229
|
readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
|
|
431
230
|
readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
|
|
@@ -582,12 +381,12 @@ declare const readCachedValue: <T>(key: string, store: Store) => T;
|
|
|
582
381
|
declare const isValueCached: (key: string, store: Store) => boolean;
|
|
583
382
|
declare const evictCachedValue: (key: string, store: Store) => void;
|
|
584
383
|
|
|
585
|
-
declare function createAtomFamily<T, K extends Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
384
|
+
declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
586
385
|
|
|
587
|
-
declare function createReadonlySelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
386
|
+
declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
588
387
|
|
|
589
|
-
declare function createSelectorFamily<T, K extends Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
590
|
-
declare function createSelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
388
|
+
declare function createSelectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
389
|
+
declare function createSelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
591
390
|
|
|
592
391
|
declare class LazyMap<K, V> extends Map<K, V> {
|
|
593
392
|
protected readonly source: Map<K, V>;
|
|
@@ -613,10 +412,10 @@ declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((
|
|
|
613
412
|
|
|
614
413
|
declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
|
|
615
414
|
|
|
616
|
-
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
|
|
415
|
+
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store$1): () => void;
|
|
617
416
|
|
|
618
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
|
|
417
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store$1) => (() => void);
|
|
619
418
|
|
|
620
|
-
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store) => (() => void);
|
|
419
|
+
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store$1) => (() => void);
|
|
621
420
|
|
|
622
421
|
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, getUpdateFamily, getUpdateToken, isAtomDefault, isAtomKey, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, redoTransactionUpdate, registerSelector, setAtomOrSelector, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, undoTransactionUpdate, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
|
package/internal/dist/index.d.ts
CHANGED
|
@@ -1,214 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
type primitive = boolean | number | string | null;
|
|
7
|
-
|
|
8
|
-
type Serializable = primitive | Readonly<{
|
|
9
|
-
[key: string]: Serializable;
|
|
10
|
-
}> | ReadonlyArray<Serializable>;
|
|
11
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
12
|
-
|
|
13
|
-
type Effectors<T> = {
|
|
14
|
-
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void;
|
|
15
|
-
onSet: (callback: (options: {
|
|
16
|
-
newValue: T;
|
|
17
|
-
oldValue: T;
|
|
18
|
-
}) => void) => void;
|
|
19
|
-
};
|
|
20
|
-
type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
|
|
21
|
-
type AtomOptions<T> = {
|
|
22
|
-
key: string;
|
|
23
|
-
default: T | (() => T);
|
|
24
|
-
effects?: AtomEffect<T>[];
|
|
25
|
-
};
|
|
26
|
-
type MutableAtomOptions<T extends Transceiver<any>, J extends Serializable> = JsonInterface<T, J> & Omit<AtomOptions<T>, `default`> & {
|
|
27
|
-
default: () => T;
|
|
28
|
-
mutable: true;
|
|
29
|
-
};
|
|
30
|
-
type AtomFamilyOptions<T, K extends Serializable> = {
|
|
31
|
-
key: string;
|
|
32
|
-
default: T | ((key: K) => T);
|
|
33
|
-
effects?: (key: K) => AtomEffect<T>[];
|
|
34
|
-
};
|
|
35
|
-
type AtomFamily<T, K extends Serializable = Serializable> = ((key: K) => AtomToken<T>) & {
|
|
36
|
-
key: string;
|
|
37
|
-
type: `atom_family`;
|
|
38
|
-
subject: Subject<AtomToken<T>>;
|
|
39
|
-
mutable?: boolean;
|
|
40
|
-
};
|
|
41
|
-
type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Serializable, K extends Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
|
|
42
|
-
mutable: true;
|
|
43
|
-
};
|
|
44
|
-
type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
|
|
45
|
-
key: `${string}`;
|
|
46
|
-
type: `atom_family`;
|
|
47
|
-
subject: Subject<MutableAtomToken<Core, SerializableCore>>;
|
|
48
|
-
mutable: true;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
declare const LoggerIconDictionary: {
|
|
52
|
-
readonly "\u231B": "Timeline event fully captured";
|
|
53
|
-
readonly "\u23E9": "Timeline redo";
|
|
54
|
-
readonly "\u23EA": "Timeline undo";
|
|
55
|
-
readonly "\u23ED\uFE0F": "Transaction redo";
|
|
56
|
-
readonly "\u23EE\uFE0F": "Transaction undo";
|
|
57
|
-
readonly "\u23F3": "Timeline event partially captured";
|
|
58
|
-
readonly "\u23F9\uFE0F": "Time-travel complete";
|
|
59
|
-
readonly "\uD83D\uDC81": "Notice";
|
|
60
|
-
readonly "\uD83D\uDD04": "Realtime transaction synchronized";
|
|
61
|
-
readonly "\u2705": "Realtime transaction success";
|
|
62
|
-
readonly "\u2728": "Computation complete";
|
|
63
|
-
readonly "\u274C": "Conflict prevents attempted action";
|
|
64
|
-
readonly "\u2B55": "Operation start";
|
|
65
|
-
readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
|
|
66
|
-
readonly "\uD83D\uDC40": "Subscription added";
|
|
67
|
-
readonly "\uD83D\uDC6A": "Family member added";
|
|
68
|
-
readonly "\uD83D\uDCC1": "Stow update";
|
|
69
|
-
readonly "\uD83D\uDCC3": "Copy mutable";
|
|
70
|
-
readonly "\uD83D\uDCD6": "Read state";
|
|
71
|
-
readonly "\uD83D\uDCDD": "Write state";
|
|
72
|
-
readonly "\uD83D\uDCE2": "Notify subscribers";
|
|
73
|
-
readonly "\uD83D\uDD0C": "Register dependency";
|
|
74
|
-
readonly "\uD83D\uDD0D": "Discover root";
|
|
75
|
-
readonly "\uD83D\uDD25": "Delete state";
|
|
76
|
-
readonly "\uD83D\uDD27": "Create mutable atom";
|
|
77
|
-
readonly "\uD83D\uDD28": "Create immutable atom";
|
|
78
|
-
readonly "\uD83D\uDD34": "Operation complete";
|
|
79
|
-
readonly "\uD83D\uDDD1": "Evict cached value";
|
|
80
|
-
readonly "\uD83D\uDCA5": "Caught";
|
|
81
|
-
readonly "\uD83D\uDE48": "Subscription canceled";
|
|
82
|
-
readonly "\uD83D\uDEC4": "Apply transaction";
|
|
83
|
-
readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
|
|
84
|
-
readonly "\uD83D\uDEEB": "Begin transaction";
|
|
85
|
-
readonly "\uD83D\uDEEC": "Complete transaction";
|
|
86
|
-
readonly "\uD83E\uDDEE": "Computing selector";
|
|
87
|
-
readonly "\uD83E\uDDF9": "Prepare to evict";
|
|
88
|
-
readonly "\uD83E\uDE82": "Abort transaction";
|
|
89
|
-
};
|
|
90
|
-
type LoggerIcon = keyof typeof LoggerIconDictionary;
|
|
91
|
-
declare const LOG_LEVELS: readonly ["info", "warn", "error"];
|
|
92
|
-
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
93
|
-
type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
|
|
94
|
-
type LogFilter = (...params: Parameters<LogFn>) => boolean;
|
|
95
|
-
type Logger = Record<LogLevel, LogFn>;
|
|
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
|
-
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
132
|
-
|
|
133
|
-
type SelectorOptions<T> = {
|
|
134
|
-
key: string;
|
|
135
|
-
get: Read<() => T>;
|
|
136
|
-
set: Write<(newValue: T) => void>;
|
|
137
|
-
};
|
|
138
|
-
type ReadonlySelectorOptions<T> = {
|
|
139
|
-
key: string;
|
|
140
|
-
get: Read<() => T>;
|
|
141
|
-
};
|
|
142
|
-
type SelectorFamilyOptions<T, K extends Serializable> = {
|
|
143
|
-
key: string;
|
|
144
|
-
get: (key: K) => Read<() => T>;
|
|
145
|
-
set: (key: K) => Write<(newValue: T) => void>;
|
|
146
|
-
};
|
|
147
|
-
type ReadonlySelectorFamilyOptions<T, K extends Serializable> = {
|
|
148
|
-
key: string;
|
|
149
|
-
get: (key: K) => Read<() => T>;
|
|
150
|
-
};
|
|
151
|
-
type SelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
152
|
-
key: string;
|
|
153
|
-
type: `selector_family`;
|
|
154
|
-
subject: Subject<SelectorToken<T>>;
|
|
155
|
-
};
|
|
156
|
-
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
157
|
-
key: string;
|
|
158
|
-
type: `readonly_selector_family`;
|
|
159
|
-
subject: Subject<ReadonlySelectorToken<T>>;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
type StateUpdate<T> = {
|
|
163
|
-
newValue: T;
|
|
164
|
-
oldValue: T;
|
|
165
|
-
};
|
|
166
|
-
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
167
|
-
key: string;
|
|
168
|
-
family?: FamilyMetadata;
|
|
169
|
-
};
|
|
170
|
-
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
171
|
-
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
172
|
-
|
|
173
|
-
type TimelineToken = {
|
|
174
|
-
key: string;
|
|
175
|
-
type: `timeline`;
|
|
176
|
-
};
|
|
177
|
-
type TimelineOptions = {
|
|
178
|
-
key: string;
|
|
179
|
-
atoms: (AtomFamily<any, any> | AtomToken<any>)[];
|
|
180
|
-
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
181
|
-
};
|
|
182
|
-
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
183
|
-
|
|
184
|
-
type ƒn = (...parameters: any[]) => any;
|
|
185
|
-
type AtomToken<_> = {
|
|
186
|
-
key: string;
|
|
187
|
-
type: `atom`;
|
|
188
|
-
family?: FamilyMetadata;
|
|
189
|
-
__brand?: _;
|
|
190
|
-
};
|
|
191
|
-
interface MutableAtomToken<T extends Transceiver<any>, J extends Serializable> extends AtomToken<T> {
|
|
192
|
-
__asJSON?: J;
|
|
193
|
-
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
194
|
-
}
|
|
195
|
-
type SelectorToken<_> = {
|
|
196
|
-
key: string;
|
|
197
|
-
type: `selector`;
|
|
198
|
-
family?: FamilyMetadata;
|
|
199
|
-
__brand?: _;
|
|
200
|
-
};
|
|
201
|
-
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
202
|
-
type ReadonlySelectorToken<_> = {
|
|
203
|
-
key: string;
|
|
204
|
-
type: `readonly_selector`;
|
|
205
|
-
family?: FamilyMetadata;
|
|
206
|
-
__brand?: _;
|
|
207
|
-
};
|
|
208
|
-
type FamilyMetadata = {
|
|
209
|
-
key: string;
|
|
210
|
-
subKey: string;
|
|
211
|
-
};
|
|
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, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
|
|
2
|
+
import { Json } from 'atom.io/json';
|
|
3
|
+
import { Store as Store$1 } from 'atom.io/internal';
|
|
212
4
|
|
|
213
5
|
declare class Subject<T> {
|
|
214
6
|
Subscriber: (value: T) => void;
|
|
@@ -312,6 +104,13 @@ declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T
|
|
|
312
104
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
313
105
|
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
314
106
|
|
|
107
|
+
type primitive = boolean | number | string | null;
|
|
108
|
+
|
|
109
|
+
type Serializable = primitive | Readonly<{
|
|
110
|
+
[key: string]: Serializable;
|
|
111
|
+
}> | ReadonlyArray<Serializable>;
|
|
112
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
113
|
+
|
|
315
114
|
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
316
115
|
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
317
116
|
|
|
@@ -386,28 +185,28 @@ interface Lineage {
|
|
|
386
185
|
declare function newest<T extends Lineage>(scion: T): T;
|
|
387
186
|
declare function eldest<T extends Lineage>(scion: T): T;
|
|
388
187
|
|
|
389
|
-
interface Transceiver<Signal extends Serializable> {
|
|
188
|
+
interface Transceiver<Signal extends Json.Serializable> {
|
|
390
189
|
do: (update: Signal) => void;
|
|
391
190
|
undo: (update: Signal) => void;
|
|
392
191
|
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
393
192
|
cacheUpdateNumber: number;
|
|
394
193
|
getUpdateNumber: (update: Signal) => number;
|
|
395
194
|
}
|
|
396
|
-
declare function isTransceiver(value: unknown): value is Transceiver<Serializable>;
|
|
195
|
+
declare function isTransceiver(value: unknown): value is Transceiver<Json.Serializable>;
|
|
397
196
|
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
398
197
|
type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
|
|
399
198
|
|
|
400
|
-
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
199
|
+
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Json.Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
401
200
|
|
|
402
|
-
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends string>(options: MutableAtomFamilyOptions<Core, SerializableCore, Key>, store: Store): MutableAtomFamily<Core, SerializableCore, Key>;
|
|
201
|
+
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>;
|
|
403
202
|
|
|
404
|
-
declare const getJsonFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
|
|
203
|
+
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>;
|
|
405
204
|
|
|
406
|
-
declare const getJsonToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
205
|
+
declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
407
206
|
|
|
408
|
-
declare const getUpdateToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
207
|
+
declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
409
208
|
|
|
410
|
-
declare const getUpdateFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => AtomFamily<Signal<Core> | null, Key>;
|
|
209
|
+
declare const getUpdateFamily: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => AtomFamily<Signal<Core> | null, Key>;
|
|
411
210
|
|
|
412
211
|
/**
|
|
413
212
|
* @internal Give the tracker a transceiver state and a store, and it will
|
|
@@ -420,12 +219,12 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
420
219
|
private unsubscribeFromInnerValue;
|
|
421
220
|
private observeCore;
|
|
422
221
|
private updateCore;
|
|
423
|
-
mutableState: MutableAtomToken<Mutable, Serializable>;
|
|
222
|
+
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
424
223
|
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
425
|
-
constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
|
|
224
|
+
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
|
|
426
225
|
}
|
|
427
226
|
|
|
428
|
-
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Serializable> {
|
|
227
|
+
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Json.Serializable> {
|
|
429
228
|
private readonly Update;
|
|
430
229
|
readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
|
|
431
230
|
readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
|
|
@@ -582,12 +381,12 @@ declare const readCachedValue: <T>(key: string, store: Store) => T;
|
|
|
582
381
|
declare const isValueCached: (key: string, store: Store) => boolean;
|
|
583
382
|
declare const evictCachedValue: (key: string, store: Store) => void;
|
|
584
383
|
|
|
585
|
-
declare function createAtomFamily<T, K extends Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
384
|
+
declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
586
385
|
|
|
587
|
-
declare function createReadonlySelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
386
|
+
declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
588
387
|
|
|
589
|
-
declare function createSelectorFamily<T, K extends Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
590
|
-
declare function createSelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
388
|
+
declare function createSelectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
389
|
+
declare function createSelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
591
390
|
|
|
592
391
|
declare class LazyMap<K, V> extends Map<K, V> {
|
|
593
392
|
protected readonly source: Map<K, V>;
|
|
@@ -613,10 +412,10 @@ declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((
|
|
|
613
412
|
|
|
614
413
|
declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
|
|
615
414
|
|
|
616
|
-
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
|
|
415
|
+
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store$1): () => void;
|
|
617
416
|
|
|
618
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
|
|
417
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store$1) => (() => void);
|
|
619
418
|
|
|
620
|
-
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store) => (() => void);
|
|
419
|
+
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store$1) => (() => void);
|
|
621
420
|
|
|
622
421
|
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, getUpdateFamily, getUpdateToken, isAtomDefault, isAtomKey, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, redoTransactionUpdate, registerSelector, setAtomOrSelector, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, undoTransactionUpdate, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
|