atom.io 0.31.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-42UH5F5Q.js → chunk-Y5MBNTVU.js} +240 -32
- package/dist/index.d.ts +236 -104
- package/dist/index.js +90 -5
- package/ephemeral/dist/index.d.ts +35 -25
- package/ephemeral/src/find-state.ts +35 -25
- package/internal/dist/index.d.ts +15 -10
- package/internal/dist/index.js +1 -2
- package/internal/src/families/find-in-store.ts +1 -6
- package/internal/src/index.ts +17 -9
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +2 -3
- package/internal/src/install-into-store.ts +48 -0
- package/internal/src/molecule.ts +299 -0
- package/internal/src/not-found-error.ts +8 -30
- package/internal/src/pretty-print.ts +1 -12
- package/internal/src/selector/register-selector.ts +1 -8
- package/internal/src/store/deposit.ts +10 -8
- package/internal/src/store/withdraw.ts +15 -34
- package/json/dist/index.js +1 -2
- package/package.json +5 -5
- package/realtime-server/src/ipc-sockets/child-socket.ts +0 -1
- package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +1 -1
- package/realtime-testing/dist/index.js +3 -4
- package/realtime-testing/src/setup-realtime-test.tsx +4 -4
- package/src/atom.ts +53 -29
- package/src/dispose-state.ts +12 -2
- package/src/get-state.ts +16 -0
- package/src/index.ts +73 -3
- package/src/realm.ts +169 -0
- package/src/selector.ts +20 -0
- package/src/set-state.ts +16 -8
- package/src/silo.ts +9 -3
- package/transceivers/set-rtx/dist/index.js +4 -1
- package/transceivers/set-rtx/src/set-rtx.ts +4 -1
- package/dist/chunk-ICGFFQ3H.js +0 -272
- package/src/allocate.ts +0 -443
- package/src/molecule.ts +0 -16
|
@@ -3,54 +3,64 @@ import { Transceiver } from 'atom.io/internal';
|
|
|
3
3
|
import { Json, Canonical } from 'atom.io/json';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
7
|
-
* Finds a {@link MutableAtomToken} in the store
|
|
8
|
-
* @param token - A {@link MutableAtomFamilyToken}
|
|
9
|
-
* @param key - The key of the state
|
|
6
|
+
* @public
|
|
7
|
+
* Finds a {@link MutableAtomToken} in the store
|
|
8
|
+
* @param token - A {@link MutableAtomFamilyToken}
|
|
9
|
+
* @param key - The key of the state
|
|
10
10
|
* @returns
|
|
11
|
-
* The current value of the state
|
|
11
|
+
* The current value of the state
|
|
12
|
+
* @overload Mutable Atom
|
|
12
13
|
*/
|
|
13
14
|
declare function findState<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical, Key extends K>(token: MutableAtomFamilyToken<T, J, K>, key: Key): MutableAtomToken<T, J, K>;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @param
|
|
16
|
+
* @public
|
|
17
|
+
* Finds a state in the store
|
|
18
|
+
* @param token - The token of the state family
|
|
19
|
+
* @param key - The key of the state
|
|
18
20
|
* @returns
|
|
19
|
-
* The current value of the state
|
|
21
|
+
* The current value of the state
|
|
22
|
+
* @overload Regular Atom
|
|
20
23
|
*/
|
|
21
24
|
declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
|
|
22
25
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param
|
|
26
|
+
* @public
|
|
27
|
+
* Finds a state in the store
|
|
28
|
+
* @param token - The token of the state family
|
|
29
|
+
* @param key - The key of the state
|
|
26
30
|
* @returns
|
|
27
|
-
* The current value of the state
|
|
31
|
+
* The current value of the state
|
|
32
|
+
* @overload Writable Selector
|
|
28
33
|
*/
|
|
29
34
|
declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken<T, K>, key: Key): WritableSelectorToken<T, K>;
|
|
30
35
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @param
|
|
36
|
+
* @public
|
|
37
|
+
* Finds a state in the store
|
|
38
|
+
* @param token - The token of the state family
|
|
39
|
+
* @param key - The key of the state
|
|
34
40
|
* @returns
|
|
35
|
-
* The current value of the state
|
|
41
|
+
* The current value of the state
|
|
42
|
+
* @overload Readonly Selector
|
|
36
43
|
*/
|
|
37
44
|
declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken<T, K>, key: Key): ReadonlySelectorToken<T, K>;
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param
|
|
46
|
+
* @public
|
|
47
|
+
* Finds a state in the store
|
|
48
|
+
* @param token - The token of the state family
|
|
49
|
+
* @param key - The key of the state
|
|
42
50
|
* @returns
|
|
43
|
-
* The current value of the state
|
|
51
|
+
* The current value of the state
|
|
52
|
+
* @overload Writable State
|
|
44
53
|
*/
|
|
45
54
|
declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken<T, K>, key: Key): WritableToken<T, K>;
|
|
46
55
|
/**
|
|
47
56
|
* @public
|
|
48
|
-
* Finds a {@link ReadableToken} in the store
|
|
49
|
-
* @param token - A {@link ReadableFamilyToken}
|
|
50
|
-
* @param key - The key of the state
|
|
57
|
+
* Finds a {@link ReadableToken} in the store
|
|
58
|
+
* @param token - A {@link ReadableFamilyToken}
|
|
59
|
+
* @param key - The key of the state
|
|
51
60
|
* @returns
|
|
52
|
-
* The current value of the state
|
|
61
|
+
* The current value of the state
|
|
53
62
|
* @overload Unknown
|
|
63
|
+
* @default
|
|
54
64
|
*/
|
|
55
65
|
declare function findState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
|
|
56
66
|
|
|
@@ -17,12 +17,13 @@ import { findInStore, IMPLICIT } from "atom.io/internal"
|
|
|
17
17
|
import type { Canonical, Json } from "atom.io/json"
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @
|
|
21
|
-
* Finds a {@link MutableAtomToken} in the store
|
|
22
|
-
* @param token - A {@link MutableAtomFamilyToken}
|
|
23
|
-
* @param key - The key of the state
|
|
20
|
+
* @public
|
|
21
|
+
* Finds a {@link MutableAtomToken} in the store
|
|
22
|
+
* @param token - A {@link MutableAtomFamilyToken}
|
|
23
|
+
* @param key - The key of the state
|
|
24
24
|
* @returns
|
|
25
|
-
* The current value of the state
|
|
25
|
+
* The current value of the state
|
|
26
|
+
* @overload Mutable Atom
|
|
26
27
|
*/
|
|
27
28
|
export function findState<
|
|
28
29
|
T extends Transceiver<any>,
|
|
@@ -31,44 +32,52 @@ export function findState<
|
|
|
31
32
|
Key extends K,
|
|
32
33
|
>(token: MutableAtomFamilyToken<T, J, K>, key: Key): MutableAtomToken<T, J, K>
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param
|
|
35
|
+
* @public
|
|
36
|
+
* Finds a state in the store
|
|
37
|
+
* @param token - The token of the state family
|
|
38
|
+
* @param key - The key of the state
|
|
37
39
|
* @returns
|
|
38
|
-
* The current value of the state
|
|
40
|
+
* The current value of the state
|
|
41
|
+
* @overload Regular Atom
|
|
39
42
|
*/
|
|
40
43
|
export function findState<T, K extends Canonical, Key extends K>(
|
|
41
44
|
token: RegularAtomFamilyToken<T, K>,
|
|
42
45
|
key: Key,
|
|
43
46
|
): RegularAtomToken<T, K>
|
|
44
47
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param
|
|
48
|
+
* @public
|
|
49
|
+
* Finds a state in the store
|
|
50
|
+
* @param token - The token of the state family
|
|
51
|
+
* @param key - The key of the state
|
|
48
52
|
* @returns
|
|
49
|
-
* The current value of the state
|
|
53
|
+
* The current value of the state
|
|
54
|
+
* @overload Writable Selector
|
|
50
55
|
*/
|
|
51
56
|
export function findState<T, K extends Canonical, Key extends K>(
|
|
52
57
|
token: WritableSelectorFamilyToken<T, K>,
|
|
53
58
|
key: Key,
|
|
54
59
|
): WritableSelectorToken<T, K>
|
|
55
60
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
61
|
+
* @public
|
|
62
|
+
* Finds a state in the store
|
|
63
|
+
* @param token - The token of the state family
|
|
64
|
+
* @param key - The key of the state
|
|
59
65
|
* @returns
|
|
60
|
-
* The current value of the state
|
|
66
|
+
* The current value of the state
|
|
67
|
+
* @overload Readonly Selector
|
|
61
68
|
*/
|
|
62
69
|
export function findState<T, K extends Canonical, Key extends K>(
|
|
63
70
|
token: ReadonlySelectorFamilyToken<T, K>,
|
|
64
71
|
key: Key,
|
|
65
72
|
): ReadonlySelectorToken<T, K>
|
|
66
73
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* @param
|
|
74
|
+
* @public
|
|
75
|
+
* Finds a state in the store
|
|
76
|
+
* @param token - The token of the state family
|
|
77
|
+
* @param key - The key of the state
|
|
70
78
|
* @returns
|
|
71
|
-
* The current value of the state
|
|
79
|
+
* The current value of the state
|
|
80
|
+
* @overload Writable State
|
|
72
81
|
*/
|
|
73
82
|
export function findState<T, K extends Canonical, Key extends K>(
|
|
74
83
|
token: WritableFamilyToken<T, K>,
|
|
@@ -76,12 +85,13 @@ export function findState<T, K extends Canonical, Key extends K>(
|
|
|
76
85
|
): WritableToken<T, K>
|
|
77
86
|
/**
|
|
78
87
|
* @public
|
|
79
|
-
* Finds a {@link ReadableToken} in the store
|
|
80
|
-
* @param token - A {@link ReadableFamilyToken}
|
|
81
|
-
* @param key - The key of the state
|
|
88
|
+
* Finds a {@link ReadableToken} in the store
|
|
89
|
+
* @param token - A {@link ReadableFamilyToken}
|
|
90
|
+
* @param key - The key of the state
|
|
82
91
|
* @returns
|
|
83
|
-
* The current value of the state
|
|
92
|
+
* The current value of the state
|
|
84
93
|
* @overload Unknown
|
|
94
|
+
* @default
|
|
85
95
|
*/
|
|
86
96
|
export function findState<T, K extends Canonical, Key extends K>(
|
|
87
97
|
token: ReadableFamilyToken<T, K>,
|
package/internal/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutableAtomFamilyToken, MutableAtomToken, RegularAtomFamilyToken, RegularAtomToken, AtomFamilyToken, AtomToken, WritableSelectorFamilyToken, WritableSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, SelectorFamilyToken, SelectorToken, WritableFamilyToken, WritableToken, ReadableFamilyToken, ReadableToken, TransactionToken, TransactionUpdate, TransactionOptions, ActorToolkit, TimelineManageable, StateUpdate, TokenType, FamilyMetadata, StateCreation, StateDisposal, MoleculeCreation, MoleculeDisposal, TimelineUpdate, TimelineOptions,
|
|
1
|
+
import { MutableAtomFamilyToken, MutableAtomToken, RegularAtomFamilyToken, RegularAtomToken, AtomFamilyToken, AtomToken, WritableSelectorFamilyToken, WritableSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, SelectorFamilyToken, SelectorToken, WritableFamilyToken, WritableToken, ReadableFamilyToken, ReadableToken, TransactionToken, TransactionUpdate, TransactionOptions, ActorToolkit, TimelineManageable, TimelineToken, AtomIOToken, Hierarchy, Vassal, Above, Claim, CompoundFrom, CompoundTypedKey, SingularTypedKey, StateUpdate, TokenType, FamilyMetadata, StateCreation, StateDisposal, MoleculeCreation, MoleculeDisposal, TimelineUpdate, TimelineOptions, AtomIOLogger, Logger, MutableAtomOptions, MutableAtomFamilyOptions, RegularAtomOptions, RegularAtomFamilyOptions, ReadonlySelectorFamilyOptions, WritableSelectorFamilyOptions, KeyedStateUpdate, MoleculeTransfer, ReadonlySelectorOptions, WritableSelectorOptions, SetterToolkit, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
|
|
2
2
|
import { Json, Canonical, stringified, JsonInterface } from 'atom.io/json';
|
|
3
3
|
import { Join } from 'atom.io/data';
|
|
4
4
|
import { Store as Store$1, Func as Func$1 } from 'atom.io/internal';
|
|
@@ -221,8 +221,8 @@ declare function deposit<T>(state: SelectorFamily<T, any>): SelectorFamilyToken<
|
|
|
221
221
|
declare function deposit<T>(state: WritableFamily<T, any>): WritableFamilyToken<T, any>;
|
|
222
222
|
declare function deposit<T>(state: ReadableFamily<T, any>): ReadableFamilyToken<T, any>;
|
|
223
223
|
declare function deposit<T extends Func>(state: Transaction<T>): TransactionToken<T>;
|
|
224
|
-
declare function deposit(state:
|
|
225
|
-
declare function deposit(
|
|
224
|
+
declare function deposit<M extends TimelineManageable>(state: Timeline<M>): TimelineToken<M>;
|
|
225
|
+
declare function deposit(resource: AtomIOInternalResource): AtomIOToken;
|
|
226
226
|
|
|
227
227
|
interface Lineage {
|
|
228
228
|
parent: typeof this | null;
|
|
@@ -235,6 +235,11 @@ type Molecule<K extends Canonical> = {
|
|
|
235
235
|
readonly stringKey: stringified<K>;
|
|
236
236
|
readonly dependsOn: `all` | `any`;
|
|
237
237
|
};
|
|
238
|
+
declare function makeRootMoleculeInStore<S extends string>(key: S, store?: Store): S;
|
|
239
|
+
declare function allocateIntoStore<H extends Hierarchy, V extends Vassal<H>, A extends Above<V, H>>(store: Store, provenance: A, key: V, dependsOn?: `all` | `any`): Claim<V>;
|
|
240
|
+
declare function fuseWithinStore<H extends Hierarchy, C extends CompoundFrom<H>, T extends C extends CompoundTypedKey<infer t, any, any> ? t : never, A extends C extends CompoundTypedKey<any, infer a, any> ? a : never, B extends C extends CompoundTypedKey<any, any, infer b> ? b : never>(store: Store, type: T, sideA: SingularTypedKey<A>, sideB: SingularTypedKey<B>): Claim<CompoundTypedKey<T, A, B>>;
|
|
241
|
+
declare function deallocateFromStore<H extends Hierarchy, V extends Vassal<H>>(store: Store, claim: Claim<V>): void;
|
|
242
|
+
declare function claimWithinStore<H extends Hierarchy, V extends Exclude<Vassal<H>, CompoundTypedKey>, A extends Above<V, H>>(store: Store, newProvenance: A, claim: Claim<V>, exclusive?: `exclusive`): Claim<V>;
|
|
238
243
|
|
|
239
244
|
type OperationProgress = {
|
|
240
245
|
open: false;
|
|
@@ -310,7 +315,7 @@ declare class Store implements Lineage {
|
|
|
310
315
|
source: string;
|
|
311
316
|
}>;
|
|
312
317
|
trackers: Map<string, Tracker<Transceiver<any>>>;
|
|
313
|
-
families: Map<string, MutableAtomFamily<any, any, any> |
|
|
318
|
+
families: Map<string, MutableAtomFamily<any, any, any> | RegularAtomFamily<any, any> | ReadonlySelectorFamily<any, any> | WritableSelectorFamily<any, any>>;
|
|
314
319
|
joins: Map<string, Join<any, any, any, any, any, any, `T$--content==${any}::${string}++${any}::${string}`>>;
|
|
315
320
|
transactions: Map<string, Transaction<Func>>;
|
|
316
321
|
transactionMeta: TransactionEpoch | TransactionProgress<Func>;
|
|
@@ -355,7 +360,6 @@ declare const IMPLICIT: {
|
|
|
355
360
|
};
|
|
356
361
|
declare const clearStore: (store: Store) => void;
|
|
357
362
|
|
|
358
|
-
type Withdrawable = Atom<any> | AtomFamily<any, any> | Molecule<any> | MutableAtom<any, any> | MutableAtomFamily<any, any, any> | ReadableFamily<any, any> | ReadableState<any> | ReadonlySelector<any> | ReadonlySelectorFamily<any, any> | RegularAtom<any> | RegularAtomFamily<any, any> | Selector<any> | SelectorFamily<any, any> | Timeline<any> | Transaction<any> | WritableFamily<any, any> | WritableSelector<any> | WritableSelectorFamily<any, any> | WritableState<any>;
|
|
359
363
|
declare function withdraw<T>(token: RegularAtomToken<T>, store: Store): RegularAtom<T>;
|
|
360
364
|
declare function withdraw<T extends Transceiver<any>>(token: MutableAtomToken<T, any>, store: Store): MutableAtom<T, any>;
|
|
361
365
|
declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T>;
|
|
@@ -374,7 +378,9 @@ declare function withdraw<T, K extends Canonical>(token: ReadableFamilyToken<T,
|
|
|
374
378
|
declare function withdraw<T, K extends Canonical>(token: WritableFamilyToken<T, K>, store: Store): WritableFamily<T, any>;
|
|
375
379
|
declare function withdraw<T extends Func>(token: TransactionToken<T>, store: Store): Transaction<T extends Func ? T : never>;
|
|
376
380
|
declare function withdraw<T>(token: TimelineToken<T>, store: Store): Timeline<T extends TimelineManageable ? T : never>;
|
|
381
|
+
declare function withdraw<T>(token: WritableToken<T>, store: Store): WritableState<T>;
|
|
377
382
|
declare function withdraw<T>(token: ReadableToken<T>, store: Store): ReadableState<T>;
|
|
383
|
+
declare function withdraw(token: AtomIOToken, store: Store): AtomIOInternalResource;
|
|
378
384
|
|
|
379
385
|
interface Transceiver<S extends Json.Serializable> {
|
|
380
386
|
do: (update: S) => number | `OUT_OF_RANGE` | null;
|
|
@@ -555,14 +561,12 @@ declare class LazyMap<K, V> extends Map<K, V> {
|
|
|
555
561
|
delete(key: K): boolean;
|
|
556
562
|
}
|
|
557
563
|
|
|
558
|
-
type AtomIOToken = ReadableFamilyToken<any, any> | ReadableToken<any> | TimelineToken<any> | TransactionToken<any>;
|
|
559
|
-
declare function prettyPrintTokenType(token: AtomIOToken): string;
|
|
560
|
-
|
|
561
564
|
declare class NotFoundError extends Error {
|
|
562
565
|
constructor(token: AtomIOToken, store: Store);
|
|
563
|
-
constructor(familyToken: AtomIOToken, key: Json.Serializable, store: Store);
|
|
564
566
|
}
|
|
565
567
|
|
|
568
|
+
declare function prettyPrintTokenType(token: AtomIOToken): string;
|
|
569
|
+
|
|
566
570
|
declare const createReadonlySelector: <T>(store: Store, options: ReadonlySelectorOptions<T>, family: FamilyMetadata | undefined) => ReadonlySelectorToken<T>;
|
|
567
571
|
|
|
568
572
|
declare function createStandaloneSelector<T>(store: Store, options: WritableSelectorOptions<T>): WritableSelectorToken<T>;
|
|
@@ -664,5 +668,6 @@ type ReadonlySelectorFamily<T, K extends Canonical> = ReadonlySelectorFamilyToke
|
|
|
664
668
|
type SelectorFamily<T, K extends Canonical> = ReadonlySelectorFamily<T, K> | WritableSelectorFamily<T, K>;
|
|
665
669
|
type WritableFamily<T, K extends Canonical> = AtomFamily<T, K> | WritableSelectorFamily<T, K>;
|
|
666
670
|
type ReadableFamily<T, K extends Canonical> = AtomFamily<T, K> | SelectorFamily<T, K>;
|
|
671
|
+
type AtomIOInternalResource = ReadableFamily<any, any> | ReadableState<any> | Timeline<any> | Transaction<any>;
|
|
667
672
|
|
|
668
|
-
export { type Atom, type AtomFamily, type
|
|
673
|
+
export { type Atom, type AtomFamily, type AtomIOInternalResource, type AtomIOState, type AtomKey, type BaseExternalStoreConfiguration, type ChildStore, CircularBuffer, type Count, type Each, type Empty, type EnvironmentData, type ExternalStoreConfiguration, type ExternalStoreWithContentConfiguration, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, type Flat, type Func, Future, IMPLICIT, Junction, type JunctionAdvancedConfiguration, type JunctionEntries, type JunctionEntriesBase, type JunctionJSON, type JunctionSchema, type JunctionSchemaBase, LazyMap, type Lineage, type Modify, type Molecule, type MutableAtom, type MutableAtomFamily, NotFoundError, type OperationProgress, type ReadableFamily, type ReadableState, type ReadonlySelector, type ReadonlySelectorFamily, type ReadonlySelectorKey, type Refinement, type RegularAtom, type RegularAtomFamily, type RootStore, type Selector, type SelectorFamily, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineMoleculeCreation, type TimelineMoleculeDisposal, type TimelineSelectorUpdate, type TimelineStateCreation, type TimelineStateDisposal, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type WritableFamily, type WritableSelector, type WritableSelectorFamily, type WritableState, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, evictCachedValue, findInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeRootMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw };
|
package/internal/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { CircularBuffer, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, Junction, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeSelector, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-ICGFFQ3H.js';
|
|
1
|
+
export { CircularBuffer, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, Junction, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, evictCachedValue, findInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeRootMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw } from '../../dist/chunk-Y5MBNTVU.js';
|
|
3
2
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -16,12 +16,7 @@ import type {
|
|
|
16
16
|
WritableSelectorToken,
|
|
17
17
|
WritableToken,
|
|
18
18
|
} from "atom.io"
|
|
19
|
-
import {
|
|
20
|
-
type Canonical,
|
|
21
|
-
type Json,
|
|
22
|
-
stringified,
|
|
23
|
-
stringifyJson,
|
|
24
|
-
} from "atom.io/json"
|
|
19
|
+
import { type Canonical, type Json, stringifyJson } from "atom.io/json"
|
|
25
20
|
|
|
26
21
|
import { newest } from "../lineage"
|
|
27
22
|
import type { Transceiver } from "../mutable"
|
package/internal/src/index.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type { Canonical, Json, JsonInterface } from "atom.io/json"
|
|
|
17
17
|
import type { Transceiver } from "./mutable"
|
|
18
18
|
import type { Store } from "./store"
|
|
19
19
|
import type { Subject } from "./subject"
|
|
20
|
+
import type { Timeline } from "./timeline"
|
|
21
|
+
import type { Transaction } from "./transaction"
|
|
20
22
|
|
|
21
23
|
export * from "./arbitrary"
|
|
22
24
|
export * from "./atom"
|
|
@@ -31,7 +33,7 @@ export * from "./junction"
|
|
|
31
33
|
export * from "./keys"
|
|
32
34
|
export * from "./lazy-map"
|
|
33
35
|
export * from "./lineage"
|
|
34
|
-
export
|
|
36
|
+
export * from "./molecule"
|
|
35
37
|
export * from "./mutable"
|
|
36
38
|
export * from "./not-found-error"
|
|
37
39
|
export * from "./operation"
|
|
@@ -100,14 +102,14 @@ T extends Transceiver<any>,
|
|
|
100
102
|
J extends Json.Serializable,
|
|
101
103
|
K extends Canonical,
|
|
102
104
|
> =
|
|
103
|
-
& JsonInterface<T, J>
|
|
104
|
-
& MutableAtomFamilyToken<T, J, K>
|
|
105
|
-
& {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
& JsonInterface<T, J>
|
|
106
|
+
& MutableAtomFamilyToken<T, J, K>
|
|
107
|
+
& {
|
|
108
|
+
(key: K): MutableAtomToken<T, J>
|
|
109
|
+
subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>
|
|
110
|
+
install: (store: Store) => void
|
|
111
|
+
internalRoles: string[] | undefined
|
|
112
|
+
}
|
|
111
113
|
|
|
112
114
|
export type AtomFamily<T, K extends Canonical = Canonical> =
|
|
113
115
|
| MutableAtomFamily<T extends Transceiver<any> ? T : never, any, K>
|
|
@@ -145,3 +147,9 @@ export type WritableFamily<T, K extends Canonical> =
|
|
|
145
147
|
export type ReadableFamily<T, K extends Canonical> =
|
|
146
148
|
| AtomFamily<T, K>
|
|
147
149
|
| SelectorFamily<T, K>
|
|
150
|
+
|
|
151
|
+
export type AtomIOInternalResource =
|
|
152
|
+
| ReadableFamily<any, any>
|
|
153
|
+
| ReadableState<any>
|
|
154
|
+
| Timeline<any>
|
|
155
|
+
| Transaction<any>
|
|
@@ -8,13 +8,12 @@ import type {
|
|
|
8
8
|
} from "atom.io"
|
|
9
9
|
import { parseJson, stringifyJson } from "atom.io/json"
|
|
10
10
|
|
|
11
|
+
import { disposeFromStore, findInStore } from "../families"
|
|
11
12
|
import {
|
|
12
13
|
allocateIntoStore,
|
|
13
14
|
claimWithinStore,
|
|
14
15
|
deallocateFromStore,
|
|
15
|
-
} from "
|
|
16
|
-
|
|
17
|
-
import { disposeFromStore, findInStore } from "../families"
|
|
16
|
+
} from "../molecule"
|
|
18
17
|
import type { Store } from "../store"
|
|
19
18
|
|
|
20
19
|
export function ingestCreationEvent(
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AtomIOToken } from "atom.io"
|
|
2
|
+
|
|
3
|
+
import { newest } from "./lineage"
|
|
4
|
+
import { type Store, withdraw } from "./store"
|
|
5
|
+
import { isChildStore } from "./transaction"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
* Install the given tokens into the target store
|
|
10
|
+
* @param tokens - States, families, transactions, and timelines to install into the target store
|
|
11
|
+
* @param target - The store to install the tokens into
|
|
12
|
+
* @param source - The store to install the tokens from
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export function installIntoStore(
|
|
16
|
+
tokens: AtomIOToken[],
|
|
17
|
+
target: Store,
|
|
18
|
+
source: Store,
|
|
19
|
+
): void {
|
|
20
|
+
const sourceNewest = newest(source)
|
|
21
|
+
if (isChildStore(sourceNewest)) {
|
|
22
|
+
source.logger.error(
|
|
23
|
+
`❌`,
|
|
24
|
+
`transaction`,
|
|
25
|
+
sourceNewest.transactionMeta.update.key,
|
|
26
|
+
`could not install the following tokens into store "${target.config.name} from "${source.config.name}":`,
|
|
27
|
+
tokens,
|
|
28
|
+
`${sourceNewest.config.name} is undergoing a transaction.`,
|
|
29
|
+
)
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
const targetNewest = newest(target)
|
|
33
|
+
if (isChildStore(targetNewest)) {
|
|
34
|
+
target.logger.error(
|
|
35
|
+
`❌`,
|
|
36
|
+
`transaction`,
|
|
37
|
+
targetNewest.transactionMeta.update.key,
|
|
38
|
+
`could not install the following tokens into store "${target.config.name} from "${source.config.name}":`,
|
|
39
|
+
tokens,
|
|
40
|
+
`${targetNewest.config.name} is undergoing a transaction.`,
|
|
41
|
+
)
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
for (const token of tokens) {
|
|
45
|
+
const resource = withdraw(token, source)
|
|
46
|
+
resource.install(target)
|
|
47
|
+
}
|
|
48
|
+
}
|