atom.io 0.14.3 → 0.14.5
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 +8 -134
- package/data/dist/index.d.ts +8 -134
- 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.js +152 -1
- package/dist/index.js.map +1 -1
- package/internal/dist/index.cjs +30 -159
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +8 -211
- package/internal/dist/index.d.ts +8 -211
- 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 +2 -129
- package/introspection/dist/index.d.ts +2 -129
- 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 +5 -131
- package/json/dist/index.d.ts +5 -131
- package/json/dist/index.js +37 -1
- package/json/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/react/dist/index.cjs +30 -1571
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.cts +8 -136
- package/react/dist/index.d.ts +8 -136
- package/react/dist/index.js +62 -2
- package/react/dist/index.js.map +1 -1
- package/react/src/store-hooks.ts +18 -20
- package/react-devtools/dist/index.cjs +135 -2153
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.d.cts +20 -146
- package/react-devtools/dist/index.d.ts +20 -146
- 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 +11 -138
- package/realtime-client/dist/index.d.ts +11 -138
- 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 +7 -35
- package/realtime-react/dist/index.d.ts +7 -35
- 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 +15 -153
- package/realtime-server/dist/index.d.ts +15 -153
- 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 +7 -7
- package/transceivers/set-rtx/dist/index.d.ts +7 -7
- package/transceivers/set-rtx/dist/index.js +3 -2
- package/transceivers/set-rtx/dist/index.js.map +1 -1
- package/dist/chunk-C4YZZNRH.js +0 -67
- package/dist/chunk-C4YZZNRH.js.map +0 -1
- package/dist/chunk-CWKKQKVQ.js +0 -68
- package/dist/chunk-CWKKQKVQ.js.map +0 -1
- package/dist/chunk-GMN5KH6A.js +0 -309
- package/dist/chunk-GMN5KH6A.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
- package/dist/index.d.cts +0 -493
- package/dist/index.d.ts +0 -493
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
|
@@ -1,214 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
toJson: (t: T) => J;
|
|
3
|
-
fromJson: (json: J) => T;
|
|
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';
|
|
212
2
|
|
|
213
3
|
declare class Subject<T> {
|
|
214
4
|
Subscriber: (value: T) => void;
|
|
@@ -312,6 +102,13 @@ declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T
|
|
|
312
102
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
313
103
|
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
314
104
|
|
|
105
|
+
type primitive = boolean | number | string | null;
|
|
106
|
+
|
|
107
|
+
type Serializable = primitive | Readonly<{
|
|
108
|
+
[key: string]: Serializable;
|
|
109
|
+
}> | ReadonlyArray<Serializable>;
|
|
110
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
111
|
+
|
|
315
112
|
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
316
113
|
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
317
114
|
|
package/internal/dist/index.d.ts
CHANGED
|
@@ -1,214 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
toJson: (t: T) => J;
|
|
3
|
-
fromJson: (json: J) => T;
|
|
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';
|
|
212
2
|
|
|
213
3
|
declare class Subject<T> {
|
|
214
4
|
Subscriber: (value: T) => void;
|
|
@@ -312,6 +102,13 @@ declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T
|
|
|
312
102
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
313
103
|
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
314
104
|
|
|
105
|
+
type primitive = boolean | number | string | null;
|
|
106
|
+
|
|
107
|
+
type Serializable = primitive | Readonly<{
|
|
108
|
+
[key: string]: Serializable;
|
|
109
|
+
}> | ReadonlyArray<Serializable>;
|
|
110
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
111
|
+
|
|
315
112
|
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
316
113
|
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
317
114
|
|