atom.io 0.16.3 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/dist/index.cjs +62 -40
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.ts +8 -2
- package/data/dist/index.js +64 -42
- package/data/dist/index.js.map +1 -1
- package/data/src/dict.ts +8 -4
- package/data/src/join.ts +74 -33
- package/data/src/struct-family.ts +18 -17
- package/dist/chunk-OEVFAUPE.js +289 -0
- package/dist/chunk-OEVFAUPE.js.map +1 -0
- package/dist/index.cjs +36 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +64 -53
- package/dist/index.js +15 -36
- package/dist/index.js.map +1 -1
- package/internal/dist/index.cjs +211 -81
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.ts +100 -72
- package/internal/dist/index.js +200 -75
- package/internal/dist/index.js.map +1 -1
- package/internal/src/arbitrary.ts +3 -0
- package/internal/src/atom/create-regular-atom.ts +2 -3
- package/internal/src/caching.ts +8 -6
- package/internal/src/families/find-in-store.ts +16 -0
- package/internal/src/get-environment-data.ts +4 -7
- package/internal/src/get-state/get-from-store.ts +14 -0
- package/internal/src/get-state/index.ts +2 -0
- package/internal/src/{read-or-compute-value.ts → get-state/read-or-compute-value.ts} +3 -3
- package/internal/src/index.ts +7 -6
- package/internal/src/ingest-updates/ingest-atom-update.ts +2 -2
- package/internal/src/ingest-updates/ingest-transaction-update.ts +0 -1
- package/internal/src/mutable/create-mutable-atom.ts +3 -4
- package/internal/src/mutable/tracker.ts +18 -13
- package/internal/src/selector/create-standalone-selector.ts +0 -2
- package/internal/src/selector/register-selector.ts +1 -1
- package/internal/src/set-state/index.ts +1 -0
- package/internal/src/set-state/set-atom.ts +15 -19
- package/internal/src/set-state/set-into-store.ts +24 -0
- package/internal/src/store/store.ts +14 -2
- package/internal/src/store/withdraw.ts +72 -2
- package/internal/src/subscribe/subscribe-to-root-atoms.ts +1 -1
- package/internal/src/subscribe/subscribe-to-timeline.ts +2 -2
- package/internal/src/subscribe/subscribe-to-transaction.ts +2 -2
- package/internal/src/timeline/create-timeline.ts +12 -1
- package/internal/src/transaction/act-upon-store.ts +19 -0
- package/internal/src/transaction/apply-transaction.ts +7 -1
- package/internal/src/transaction/assign-transaction-to-continuity.ts +18 -0
- package/internal/src/transaction/build-transaction.ts +11 -8
- package/internal/src/transaction/create-transaction.ts +1 -1
- package/internal/src/transaction/get-epoch-number.ts +40 -0
- package/internal/src/transaction/index.ts +10 -1
- package/internal/src/transaction/set-epoch-number.ts +31 -0
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.ts +3 -3
- package/introspection/dist/index.js.map +1 -1
- package/introspection/src/attach-introspection-states.ts +6 -2
- package/introspection/src/attach-timeline-family.ts +5 -2
- package/introspection/src/attach-transaction-logs.ts +2 -2
- package/json/dist/index.d.ts +3 -1
- package/json/src/index.ts +6 -2
- package/package.json +24 -13
- package/react/dist/index.cjs +3 -3
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.ts +1 -1
- package/react/dist/index.js +5 -5
- package/react/dist/index.js.map +1 -1
- package/react/src/use-i.ts +2 -3
- package/react/src/use-json.ts +1 -1
- package/react/src/use-o.ts +3 -4
- package/react-devtools/dist/index.cjs +131 -134
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.css +2 -2
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.ts +3 -3
- package/react-devtools/dist/index.js +103 -106
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/src/StateEditor.tsx +6 -6
- package/react-devtools/src/StateIndex.tsx +2 -5
- package/react-devtools/src/TimelineIndex.tsx +3 -3
- package/react-devtools/src/TransactionIndex.tsx +9 -8
- package/react-devtools/src/Updates.tsx +1 -1
- package/react-devtools/src/index.ts +4 -4
- package/realtime/dist/index.cjs +72 -0
- package/realtime/dist/index.cjs.map +1 -0
- package/realtime/dist/index.d.ts +39 -0
- package/realtime/dist/index.js +68 -0
- package/realtime/dist/index.js.map +1 -0
- package/realtime/package.json +16 -0
- package/realtime/src/index.ts +1 -0
- package/realtime/src/realtime-continuity.ts +152 -0
- package/realtime-client/dist/index.cjs +403 -59
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.ts +16 -9
- package/realtime-client/dist/index.js +114 -48
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/src/index.ts +8 -5
- package/realtime-client/src/{pull-family-member.ts → pull-atom-family-member.ts} +5 -5
- package/realtime-client/src/{pull-state.ts → pull-atom.ts} +5 -5
- package/realtime-client/src/{pull-mutable-family-member.ts → pull-mutable-atom-family-member.ts} +5 -5
- package/realtime-client/src/{pull-mutable.ts → pull-mutable-atom.ts} +5 -5
- package/realtime-client/src/pull-selector-family-member.ts +42 -0
- package/realtime-client/src/pull-selector.ts +38 -0
- package/realtime-client/src/realtime-client-stores/client-main-store.ts +2 -2
- package/realtime-client/src/realtime-client-stores/client-sync-store.ts +7 -7
- package/realtime-client/src/sync-continuity.ts +321 -0
- package/realtime-client/src/sync-server-action.ts +22 -21
- package/realtime-client/src/sync-state.ts +3 -3
- package/realtime-react/dist/index.cjs +330 -15
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.ts +26 -6
- package/realtime-react/dist/index.js +43 -12
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/src/index.ts +6 -3
- package/realtime-react/src/use-pull-atom-family-member.ts +21 -0
- package/realtime-react/src/{use-pull.ts → use-pull-atom.ts} +6 -5
- package/realtime-react/src/{use-pull-mutable.ts → use-pull-mutable-atom.ts} +4 -3
- package/realtime-react/src/use-pull-mutable-family-member.ts +9 -4
- package/realtime-react/src/use-pull-selector-family-member.ts +21 -0
- package/realtime-react/src/{use-pull-family-member.ts → use-pull-selector.ts} +7 -5
- package/realtime-react/src/use-push.ts +3 -2
- package/realtime-react/src/use-server-action.ts +3 -2
- package/realtime-react/src/use-sync-continuity.ts +12 -0
- package/realtime-react/src/use-sync-server-action.ts +3 -2
- package/realtime-server/dist/index.cjs +582 -256
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.ts +124 -49
- package/realtime-server/dist/index.js +566 -249
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/src/index.ts +18 -2
- package/realtime-server/src/ipc-socket.ts +230 -0
- package/realtime-server/src/realtime-action-receiver.ts +8 -5
- package/realtime-server/src/realtime-action-synchronizer.ts +53 -35
- package/realtime-server/src/realtime-continuity-synchronizer.ts +247 -0
- package/realtime-server/src/realtime-family-provider.ts +37 -73
- package/realtime-server/src/realtime-mutable-family-provider.ts +26 -87
- package/realtime-server/src/realtime-mutable-provider.ts +3 -2
- package/realtime-server/src/realtime-server-stores/index.ts +3 -1
- package/realtime-server/src/realtime-server-stores/realtime-continuity-store.ts +90 -0
- package/realtime-server/src/realtime-server-stores/server-room-store.ts +97 -0
- package/realtime-server/src/realtime-server-stores/server-sync-store.ts +2 -72
- package/realtime-server/src/realtime-server-stores/server-user-store.ts +14 -29
- package/realtime-server/src/realtime-state-provider.ts +3 -3
- package/realtime-server/src/realtime-state-receiver.ts +2 -3
- package/realtime-server/src/realtime-state-synchronizer.ts +3 -3
- package/realtime-testing/dist/index.cjs +28 -28
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.js +28 -27
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/src/setup-realtime-test.tsx +38 -28
- package/src/atom.ts +49 -31
- package/src/get-state.ts +2 -11
- package/src/logger.ts +10 -5
- package/src/selector.ts +44 -25
- package/src/set-state.ts +1 -13
- package/src/silo.ts +7 -3
- package/src/subscribe.ts +2 -1
- package/src/timeline.ts +4 -4
- package/src/transaction.ts +13 -17
- package/src/validators.ts +15 -9
- package/dist/chunk-H4Q5FTPZ.js +0 -11
- package/dist/chunk-H4Q5FTPZ.js.map +0 -1
- package/internal/src/set-state/copy-mutable-in-transaction.ts +0 -19
package/internal/dist/index.d.ts
CHANGED
|
@@ -1,64 +1,5 @@
|
|
|
1
|
-
import { ƒn as _n, TransactionUpdate, TransactionOptions,
|
|
1
|
+
import { ƒn as _n, TransactionToken, TransactionUpdate, TransactionOptions, TransactorsWithRunAndEnv, RegularAtomToken, MutableAtomToken, WritableSelectorToken, ReadonlySelectorToken, WritableToken, ReadableToken, TimelineManageable, StateUpdate, TokenType, FamilyMetadata, TimelineUpdate, TimelineOptions, TimelineToken, AtomToken, WritableSelectorFamily, MutableAtomFamily, RegularAtomFamily, ReadonlySelectorFamily, AtomIOLogger, Logger, AtomFamily, SelectorFamily, SelectorToken, RegularAtomFamilyToken, MutableAtomFamilyToken, AtomFamilyToken, ReadonlySelectorFamilyToken, WritableSelectorFamilyToken, SelectorFamilyToken, MutableAtomOptions, MutableAtomFamilyOptions, RegularAtomOptions, RegularAtomFamilyOptions, ReadonlySelectorFamilyOptions, WritableSelectorFamilyOptions, WritableFamilyToken, ReadableFamilyToken, KeyedStateUpdate, ReadonlySelectorOptions, WritableSelectorOptions, Transactors, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
|
|
2
2
|
import { Json, JsonInterface } from 'atom.io/json';
|
|
3
|
-
import { Store as Store$1 } from 'atom.io/internal';
|
|
4
|
-
|
|
5
|
-
declare const abortTransaction: (store: Store) => void;
|
|
6
|
-
|
|
7
|
-
declare const applyTransaction: <ƒ extends _n>(output: ReturnType<ƒ>, store: Store) => void;
|
|
8
|
-
|
|
9
|
-
interface RootStore extends Store {
|
|
10
|
-
transactionMeta: TransactionEpoch;
|
|
11
|
-
parent: null;
|
|
12
|
-
child: ChildStore | null;
|
|
13
|
-
}
|
|
14
|
-
interface ChildStore extends Store {
|
|
15
|
-
transactionMeta: TransactionProgress<_n>;
|
|
16
|
-
parent: ChildStore | RootStore;
|
|
17
|
-
child: ChildStore | null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare const buildTransaction: (key: string, params: any[], store: Store, id?: string) => ChildStore;
|
|
21
|
-
|
|
22
|
-
declare class Subject<T> {
|
|
23
|
-
Subscriber: (value: T) => void;
|
|
24
|
-
subscribers: Map<string, this[`Subscriber`]>;
|
|
25
|
-
subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
|
|
26
|
-
private unsubscribe;
|
|
27
|
-
next(value: T): void;
|
|
28
|
-
}
|
|
29
|
-
declare class StatefulSubject<T> extends Subject<T> {
|
|
30
|
-
state: T;
|
|
31
|
-
constructor(initialState: T);
|
|
32
|
-
next(value: T): void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type Transaction<ƒ extends _n> = {
|
|
36
|
-
key: string;
|
|
37
|
-
type: `transaction`;
|
|
38
|
-
install: (store: Store) => void;
|
|
39
|
-
subject: Subject<TransactionUpdate<ƒ>>;
|
|
40
|
-
run: (parameters: Parameters<ƒ>, id?: string) => ReturnType<ƒ>;
|
|
41
|
-
};
|
|
42
|
-
declare function createTransaction<ƒ extends _n>(options: TransactionOptions<ƒ>, store: Store): TransactionToken<ƒ>;
|
|
43
|
-
|
|
44
|
-
declare const TRANSACTION_PHASES: readonly ["idle", "building", "applying"];
|
|
45
|
-
type TransactionPhase = (typeof TRANSACTION_PHASES)[number];
|
|
46
|
-
type TransactionProgress<ƒ extends _n> = {
|
|
47
|
-
phase: `applying` | `building`;
|
|
48
|
-
update: TransactionUpdate<ƒ>;
|
|
49
|
-
transactors: TransactorsWithRunAndEnv;
|
|
50
|
-
};
|
|
51
|
-
type TransactionEpoch = {
|
|
52
|
-
epoch: number;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
declare function deposit<T>(state: RegularAtom<T>): RegularAtomToken<T>;
|
|
56
|
-
declare function deposit<T extends Transceiver<any>>(state: MutableAtom<T, any>): MutableAtomToken<T, any>;
|
|
57
|
-
declare function deposit<T>(state: WritableSelector<T>): WritableSelectorToken<T>;
|
|
58
|
-
declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
|
|
59
|
-
declare function deposit<T>(state: WritableState<T>): WritableToken<T>;
|
|
60
|
-
declare function deposit<T>(state: Transaction<T extends _n ? T : never>): TransactionToken<T>;
|
|
61
|
-
declare function deposit<T>(state: ReadableState<T>): ReadableToken<T>;
|
|
62
3
|
|
|
63
4
|
type primitive = boolean | number | string | null;
|
|
64
5
|
|
|
@@ -134,6 +75,78 @@ declare class Junction<const ASide extends string, const BSide extends string, c
|
|
|
134
75
|
has(a: string, b?: string): boolean;
|
|
135
76
|
}
|
|
136
77
|
|
|
78
|
+
declare const abortTransaction: (store: Store) => void;
|
|
79
|
+
|
|
80
|
+
declare function actUponStore<ƒ extends _n>(token: TransactionToken<ƒ>, id: string, store: Store): (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
81
|
+
|
|
82
|
+
declare const applyTransaction: <ƒ extends _n>(output: ReturnType<ƒ>, store: Store) => void;
|
|
83
|
+
|
|
84
|
+
declare function assignTransactionToContinuity(continuityKey: string, transactionKey: string, store: Store): void;
|
|
85
|
+
|
|
86
|
+
interface RootStore extends Store {
|
|
87
|
+
transactionMeta: TransactionEpoch;
|
|
88
|
+
parent: null;
|
|
89
|
+
child: ChildStore | null;
|
|
90
|
+
}
|
|
91
|
+
interface ChildStore extends Store {
|
|
92
|
+
transactionMeta: TransactionProgress<_n>;
|
|
93
|
+
parent: ChildStore | RootStore;
|
|
94
|
+
child: ChildStore | null;
|
|
95
|
+
}
|
|
96
|
+
declare function isRootStore(store: Store): store is RootStore;
|
|
97
|
+
declare function isChildStore(store: Store): store is ChildStore;
|
|
98
|
+
|
|
99
|
+
declare const buildTransaction: (key: string, params: any[], store: Store, id: string) => ChildStore;
|
|
100
|
+
|
|
101
|
+
declare class Subject<T> {
|
|
102
|
+
Subscriber: (value: T) => void;
|
|
103
|
+
subscribers: Map<string, this[`Subscriber`]>;
|
|
104
|
+
subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
|
|
105
|
+
private unsubscribe;
|
|
106
|
+
next(value: T): void;
|
|
107
|
+
}
|
|
108
|
+
declare class StatefulSubject<T> extends Subject<T> {
|
|
109
|
+
state: T;
|
|
110
|
+
constructor(initialState: T);
|
|
111
|
+
next(value: T): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type Transaction<ƒ extends _n> = {
|
|
115
|
+
key: string;
|
|
116
|
+
type: `transaction`;
|
|
117
|
+
install: (store: Store) => void;
|
|
118
|
+
subject: Subject<TransactionUpdate<ƒ>>;
|
|
119
|
+
run: (parameters: Parameters<ƒ>, id?: string) => ReturnType<ƒ>;
|
|
120
|
+
};
|
|
121
|
+
declare function createTransaction<ƒ extends _n>(options: TransactionOptions<ƒ>, store: Store): TransactionToken<ƒ>;
|
|
122
|
+
|
|
123
|
+
declare function getContinuityKey(transactionKey: string, store: Store): string | undefined;
|
|
124
|
+
declare function getEpochNumberOfContinuity(continuityKey: string, store: Store): number | undefined;
|
|
125
|
+
declare function getEpochNumberOfAction(transactionKey: string, store: Store): number | undefined;
|
|
126
|
+
|
|
127
|
+
declare function setEpochNumberOfContinuity(continuityKey: string, newEpoch: number, store: Store): void;
|
|
128
|
+
declare function setEpochNumberOfAction(transactionKey: string, newEpoch: number, store: Store): void;
|
|
129
|
+
|
|
130
|
+
declare const TRANSACTION_PHASES: readonly ["idle", "building", "applying"];
|
|
131
|
+
type TransactionPhase = (typeof TRANSACTION_PHASES)[number];
|
|
132
|
+
type TransactionProgress<ƒ extends _n> = {
|
|
133
|
+
phase: `applying` | `building`;
|
|
134
|
+
update: TransactionUpdate<ƒ>;
|
|
135
|
+
transactors: TransactorsWithRunAndEnv;
|
|
136
|
+
};
|
|
137
|
+
type TransactionEpoch = {
|
|
138
|
+
epoch: Map<string, number>;
|
|
139
|
+
actionContinuities: Junction<`continuity`, `action`>;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
declare function deposit<T>(state: RegularAtom<T>): RegularAtomToken<T>;
|
|
143
|
+
declare function deposit<T extends Transceiver<any>>(state: MutableAtom<T, any>): MutableAtomToken<T, any>;
|
|
144
|
+
declare function deposit<T>(state: WritableSelector<T>): WritableSelectorToken<T>;
|
|
145
|
+
declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
|
|
146
|
+
declare function deposit<T>(state: WritableState<T>): WritableToken<T>;
|
|
147
|
+
declare function deposit<T>(state: Transaction<T extends _n ? T : never>): TransactionToken<T>;
|
|
148
|
+
declare function deposit<T>(state: ReadableState<T>): ReadableToken<T>;
|
|
149
|
+
|
|
137
150
|
interface Lineage {
|
|
138
151
|
parent: typeof this | null;
|
|
139
152
|
child: typeof this | null;
|
|
@@ -229,7 +242,7 @@ declare const IMPLICIT: {
|
|
|
229
242
|
};
|
|
230
243
|
declare const clearStore: (store: Store) => void;
|
|
231
244
|
|
|
232
|
-
type Withdrawable = ReadableState<any> | Timeline<any> | Transaction<any>;
|
|
245
|
+
type Withdrawable = Atom<any> | AtomFamily<any, any> | MutableAtom<any, any> | MutableAtomFamily<any, any, any> | ReadableState<any> | ReadableState<any> | ReadonlySelector<any> | ReadonlySelectorFamily<any, any> | RegularAtom<any> | RegularAtomFamily<any, any> | Selector<any> | SelectorFamily<any, any> | Timeline<any> | Transaction<any> | WritableSelector<any> | WritableSelectorFamily<any, any> | WritableState<any>;
|
|
233
246
|
declare function withdraw<T>(token: RegularAtomToken<T>, store: Store): RegularAtom<T> | undefined;
|
|
234
247
|
declare function withdraw<T extends Transceiver<any>>(token: MutableAtomToken<T, any>, store: Store): MutableAtom<T, any> | undefined;
|
|
235
248
|
declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
|
|
@@ -238,6 +251,12 @@ declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): Rea
|
|
|
238
251
|
declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
|
|
239
252
|
declare function withdraw<T>(token: WritableToken<T>, store: Store): WritableState<T> | undefined;
|
|
240
253
|
declare function withdraw<T>(token: ReadableToken<T>, store: Store): ReadableState<T> | undefined;
|
|
254
|
+
declare function withdraw<T, K extends Json.Serializable>(token: RegularAtomFamilyToken<T, K>, store: Store): RegularAtomFamily<T, K> | undefined;
|
|
255
|
+
declare function withdraw<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(token: MutableAtomFamilyToken<T, J, K>, store: Store): MutableAtomFamily<T, J, K> | undefined;
|
|
256
|
+
declare function withdraw<T, K extends Json.Serializable>(token: AtomFamilyToken<T>, store: Store): AtomFamily<T, any> | undefined;
|
|
257
|
+
declare function withdraw<T, K extends Json.Serializable>(token: ReadonlySelectorFamilyToken<T, K>, store: Store): ReadonlySelectorFamily<T, any> | undefined;
|
|
258
|
+
declare function withdraw<T, K extends Json.Serializable>(token: WritableSelectorFamilyToken<T, K>, store: Store): WritableSelectorFamily<T, any> | undefined;
|
|
259
|
+
declare function withdraw<T, K extends Json.Serializable>(token: SelectorFamilyToken<T, K>, store: Store): SelectorFamily<T, any> | undefined;
|
|
241
260
|
declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transaction<T extends _n ? T : never> | undefined;
|
|
242
261
|
declare function withdraw<T>(token: TimelineToken<T>, store: Store): Timeline<T extends TimelineManageable ? T : never> | undefined;
|
|
243
262
|
|
|
@@ -307,6 +326,8 @@ declare const isAtomDefault: (key: string, store: Store) => boolean;
|
|
|
307
326
|
declare const markAtomAsDefault: (key: string, store: Store) => void;
|
|
308
327
|
declare const markAtomAsNotDefault: (key: string, store: Store) => void;
|
|
309
328
|
|
|
329
|
+
declare function arbitrary(random?: () => number): string;
|
|
330
|
+
|
|
310
331
|
/**
|
|
311
332
|
* A Promise that can be canceled.
|
|
312
333
|
* @internal
|
|
@@ -339,17 +360,24 @@ declare function createSelectorFamily<T, K extends Json.Serializable>(options: R
|
|
|
339
360
|
|
|
340
361
|
declare function findInStore<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable, Key extends K>(token: MutableAtomFamilyToken<T, J, K>, key: Key, store: Store): MutableAtomToken<T, J>;
|
|
341
362
|
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key, store: Store): RegularAtomToken<T>;
|
|
363
|
+
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: AtomFamilyToken<T, K>, key: Key, store: Store): AtomToken<T>;
|
|
342
364
|
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: WritableSelectorFamilyToken<T, K>, key: Key, store: Store): WritableSelectorToken<T>;
|
|
343
365
|
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: ReadonlySelectorFamilyToken<T, K>, key: Key, store: Store): ReadonlySelectorToken<T>;
|
|
366
|
+
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: SelectorFamilyToken<T, K>, key: Key, store: Store): SelectorToken<T>;
|
|
344
367
|
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: WritableFamilyToken<T, K>, key: Key, store: Store): WritableToken<T>;
|
|
345
368
|
declare function findInStore<T, K extends Json.Serializable, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key, store: Store): ReadableToken<T>;
|
|
346
369
|
|
|
347
370
|
type EnvironmentData = {
|
|
348
|
-
|
|
371
|
+
window: typeof window | undefined;
|
|
372
|
+
global: typeof global | undefined;
|
|
349
373
|
store: Store;
|
|
350
374
|
};
|
|
351
375
|
declare function getEnvironmentData(store: Store): EnvironmentData;
|
|
352
376
|
|
|
377
|
+
declare function getFromStore<T>(token: ReadableToken<T>, store: Store): T;
|
|
378
|
+
|
|
379
|
+
declare const readOrComputeValue: <T>(state: ReadableState<T>, target: Store) => T;
|
|
380
|
+
|
|
353
381
|
declare function ingestAtomUpdate(applying: `newValue` | `oldValue`, atomUpdate: KeyedStateUpdate<any>, store: Store): void;
|
|
354
382
|
|
|
355
383
|
declare function ingestSelectorUpdate(applying: `newValue` | `oldValue`, selectorUpdate: TimelineSelectorUpdate<any>, store: Store): void;
|
|
@@ -390,8 +418,6 @@ declare class NotFoundError extends Error {
|
|
|
390
418
|
constructor(token: AtomIOToken, store: Store);
|
|
391
419
|
}
|
|
392
420
|
|
|
393
|
-
declare const readOrComputeValue: <T>(state: ReadableState<T>, target: Store) => T;
|
|
394
|
-
|
|
395
421
|
declare const createReadonlySelector: <T>(options: ReadonlySelectorOptions<T>, family: FamilyMetadata | undefined, store: Store) => ReadonlySelectorToken<T>;
|
|
396
422
|
|
|
397
423
|
declare function createStandaloneSelector<T>(options: WritableSelectorOptions<T>, store: Store): WritableSelectorToken<T>;
|
|
@@ -415,15 +441,17 @@ declare const become: <T>(nextVersionOfThing: T | Modify<T>) => (originalThing:
|
|
|
415
441
|
|
|
416
442
|
declare const setAtomOrSelector: <T>(state: WritableState<T>, value: T | ((oldValue: T) => T), store: Store) => void;
|
|
417
443
|
|
|
444
|
+
declare function setIntoStore<T, New extends T>(token: WritableToken<T>, value: New | ((oldValue: T) => New), store: Store): void;
|
|
445
|
+
|
|
418
446
|
declare const subscribeToRootAtoms: <T>(selector: Selector<T>, store: Store) => (() => void)[] | null;
|
|
419
447
|
|
|
420
448
|
declare function subscribeToState<T>(token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
|
|
421
449
|
|
|
422
|
-
declare const subscribeToTimeline: <ManagedAtom extends TimelineManageable>(token: TimelineToken<ManagedAtom>, handleUpdate: (update: TimelineUpdate<any> | `redo` | `undo`) => void, key: string, store: Store
|
|
450
|
+
declare const subscribeToTimeline: <ManagedAtom extends TimelineManageable>(token: TimelineToken<ManagedAtom>, handleUpdate: (update: TimelineUpdate<any> | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
|
|
423
451
|
|
|
424
|
-
declare const subscribeToTransaction: <ƒ extends _n>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store
|
|
452
|
+
declare const subscribeToTransaction: <ƒ extends _n>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store) => (() => void);
|
|
425
453
|
|
|
426
|
-
type
|
|
454
|
+
type AtomIOState = {
|
|
427
455
|
key: string;
|
|
428
456
|
family?: FamilyMetadata;
|
|
429
457
|
install: (store: Store) => void;
|
|
@@ -432,23 +460,23 @@ type BaseStateData = {
|
|
|
432
460
|
oldValue: any;
|
|
433
461
|
}>;
|
|
434
462
|
};
|
|
435
|
-
type RegularAtom<T> =
|
|
463
|
+
type RegularAtom<T> = AtomIOState & {
|
|
436
464
|
type: `atom`;
|
|
437
465
|
default: T | (() => T);
|
|
438
466
|
cleanup?: () => void;
|
|
439
467
|
};
|
|
440
|
-
type MutableAtom<T extends Transceiver<any>, J extends Json.Serializable> =
|
|
468
|
+
type MutableAtom<T extends Transceiver<any>, J extends Json.Serializable> = AtomIOState & JsonInterface<T, J> & {
|
|
441
469
|
type: `mutable_atom`;
|
|
442
470
|
default: T | (() => T);
|
|
443
471
|
cleanup?: () => void;
|
|
444
472
|
};
|
|
445
473
|
type Atom<T> = RegularAtom<T> | (T extends Transceiver<any> ? MutableAtom<T, any> : never);
|
|
446
|
-
type WritableSelector<T> =
|
|
474
|
+
type WritableSelector<T> = AtomIOState & {
|
|
447
475
|
type: `selector`;
|
|
448
476
|
get: () => T;
|
|
449
477
|
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
450
478
|
};
|
|
451
|
-
type ReadonlySelector<T> =
|
|
479
|
+
type ReadonlySelector<T> = AtomIOState & {
|
|
452
480
|
type: `readonly_selector`;
|
|
453
481
|
get: () => T;
|
|
454
482
|
};
|
|
@@ -456,4 +484,4 @@ type Selector<T> = ReadonlySelector<T> | WritableSelector<T>;
|
|
|
456
484
|
type WritableState<T> = Atom<T> | WritableSelector<T>;
|
|
457
485
|
type ReadableState<T> = Atom<T> | Selector<T>;
|
|
458
486
|
|
|
459
|
-
export { type Atom, type AtomKey, type
|
|
487
|
+
export { type Atom, type AtomIOState, type AtomKey, type ChildStore, type EnvironmentData, FamilyTracker, Future, IMPLICIT, LazyMap, type Lineage, type Modify, type MutableAtom, NotFoundError, type OperationProgress, type ReadableState, type ReadonlySelector, type ReadonlySelectorKey, type RegularAtom, type RootStore, 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 TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type Withdrawable, type WritableSelector, type WritableState, abortTransaction, actUponStore, addAtomToTimeline, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deleteAtom, deleteSelector, deposit, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, ingestAtomUpdate, ingestSelectorUpdate, ingestTransactionUpdate, isAtomDefault, isAtomKey, isChildStore, isDone, isMutable, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
|