atom.io 0.27.2 → 0.27.4
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.d.ts +12 -12
- package/data/dist/index.js +20 -14
- package/data/src/dict.ts +4 -4
- package/data/src/join.ts +23 -18
- package/data/src/struct-family.ts +2 -2
- package/dist/chunk-JRENM6KL.js +3148 -0
- package/dist/index.d.ts +3 -30
- package/eslint-plugin/dist/index.js +8 -0
- package/eslint-plugin/src/walk.ts +8 -0
- package/internal/dist/index.d.ts +55 -25
- package/internal/dist/index.js +2 -3044
- package/internal/src/families/create-atom-family.ts +6 -5
- package/internal/src/families/create-readonly-selector-family.ts +54 -28
- package/internal/src/families/create-regular-atom-family.ts +41 -31
- package/internal/src/families/create-selector-family.ts +6 -5
- package/internal/src/families/create-writable-selector-family.ts +55 -29
- package/internal/src/families/dispose-from-store.ts +11 -2
- package/internal/src/families/seek-in-store.ts +0 -3
- package/internal/src/families/throw-in-case-of-conflicting-family.ts +18 -0
- package/internal/src/get-state/get-from-store.ts +26 -2
- package/internal/src/get-state/read-or-compute-value.ts +1 -1
- package/internal/src/index.ts +78 -2
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -1
- package/internal/src/ingest-updates/ingest-selector-update.ts +1 -1
- package/internal/src/molecule/dispose-molecule.ts +0 -1
- package/internal/src/molecule/grow-molecule-in-store.ts +27 -17
- package/internal/src/mutable/create-mutable-atom-family.ts +41 -32
- package/internal/src/mutable/get-json-family.ts +2 -1
- package/internal/src/mutable/get-update-family.ts +23 -0
- package/internal/src/mutable/index.ts +1 -0
- package/internal/src/mutable/tracker-family.ts +5 -3
- package/internal/src/not-found-error.ts +2 -35
- package/internal/src/pretty-print.ts +37 -0
- package/internal/src/selector/create-writable-selector.ts +6 -6
- package/internal/src/set-state/set-into-store.ts +13 -2
- package/internal/src/store/deposit.ts +11 -10
- package/internal/src/store/store.ts +11 -4
- package/internal/src/store/withdraw.ts +8 -8
- package/internal/src/transaction/build-transaction.ts +1 -0
- package/introspection/dist/index.js +3 -3
- package/introspection/src/attach-timeline-family.ts +1 -1
- package/introspection/src/attach-transaction-logs.ts +2 -2
- package/json/dist/index.d.ts +2 -2
- package/json/dist/index.js +16 -12
- package/json/src/select-json-family.ts +21 -18
- package/package.json +7 -7
- package/realtime-server/dist/index.d.ts +1 -1
- package/src/atom.ts +2 -32
- package/src/index.ts +1 -10
- package/src/logger.ts +4 -0
- package/src/selector.ts +1 -26
- package/src/silo.ts +7 -5
package/json/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { stringifyJson, parseJson } from '../../dist/chunk-AK23DRMD.js';
|
|
2
2
|
export { parseJson, stringifyJson } from '../../dist/chunk-AK23DRMD.js';
|
|
3
|
+
import { createWritableSelectorFamily } from '../../dist/chunk-JRENM6KL.js';
|
|
4
|
+
import '../../dist/chunk-IBTHB2PI.js';
|
|
3
5
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
4
|
-
import { createStandaloneSelector, IMPLICIT,
|
|
6
|
+
import { createStandaloneSelector, IMPLICIT, growMoleculeInStore, initFamilyMemberInStore, withdraw, seekInStore } from 'atom.io/internal';
|
|
5
7
|
|
|
6
8
|
// json/src/entries.ts
|
|
7
9
|
function fromEntries(entries) {
|
|
@@ -19,52 +21,54 @@ var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
|
19
21
|
store
|
|
20
22
|
);
|
|
21
23
|
};
|
|
22
|
-
function selectJsonFamily(
|
|
23
|
-
const jsonFamily =
|
|
24
|
+
function selectJsonFamily(atomFamilyToken, transform, store = IMPLICIT.STORE) {
|
|
25
|
+
const jsonFamily = createWritableSelectorFamily(
|
|
24
26
|
{
|
|
25
|
-
key: `${
|
|
27
|
+
key: `${atomFamilyToken.key}:JSON`,
|
|
26
28
|
get: (key) => ({ seek, get }) => {
|
|
27
|
-
const existingState = seek(
|
|
29
|
+
const existingState = seek(atomFamilyToken, key);
|
|
28
30
|
if (existingState) {
|
|
29
31
|
return transform.toJson(get(existingState));
|
|
30
32
|
}
|
|
31
33
|
const stringKey = stringifyJson(key);
|
|
32
34
|
const molecule = store.molecules.get(stringKey);
|
|
33
35
|
if (molecule) {
|
|
34
|
-
const atom = growMoleculeInStore(molecule,
|
|
36
|
+
const atom = growMoleculeInStore(molecule, atomFamilyToken, store);
|
|
35
37
|
return transform.toJson(get(atom));
|
|
36
38
|
}
|
|
37
39
|
if (store.config.lifespan === `immortal`) {
|
|
38
40
|
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
39
41
|
}
|
|
40
|
-
const newToken = initFamilyMemberInStore(
|
|
42
|
+
const newToken = initFamilyMemberInStore(atomFamilyToken, key, store);
|
|
41
43
|
return transform.toJson(get(newToken));
|
|
42
44
|
},
|
|
43
45
|
set: (key) => ({ seek, set }, newValue) => {
|
|
44
|
-
const existingState = seek(
|
|
46
|
+
const existingState = seek(atomFamilyToken, key);
|
|
45
47
|
if (existingState) {
|
|
46
48
|
set(existingState, transform.fromJson(newValue));
|
|
47
49
|
} else {
|
|
48
50
|
const stringKey = stringifyJson(key);
|
|
49
51
|
const molecule = store.molecules.get(stringKey);
|
|
50
52
|
if (molecule) {
|
|
51
|
-
const atom = growMoleculeInStore(molecule,
|
|
53
|
+
const atom = growMoleculeInStore(molecule, atomFamilyToken, store);
|
|
52
54
|
set(atom, transform.fromJson(newValue));
|
|
53
55
|
} else {
|
|
54
56
|
if (store.config.lifespan === `immortal`) {
|
|
55
57
|
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
56
58
|
}
|
|
57
59
|
set(
|
|
58
|
-
initFamilyMemberInStore(
|
|
60
|
+
initFamilyMemberInStore(atomFamilyToken, key, store),
|
|
59
61
|
transform.fromJson(newValue)
|
|
60
62
|
);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
|
-
store
|
|
67
|
+
store,
|
|
68
|
+
[`mutable`, `json`]
|
|
66
69
|
);
|
|
67
|
-
|
|
70
|
+
const atomFamily = withdraw(atomFamilyToken, store);
|
|
71
|
+
atomFamily.subject.subscribe(
|
|
68
72
|
`store=${store.config.name}::json-selector-family`,
|
|
69
73
|
(event) => {
|
|
70
74
|
if (event.token.family) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type * as AtomIO from "atom.io"
|
|
2
2
|
import type { Store, Transceiver } from "atom.io/internal"
|
|
3
3
|
import {
|
|
4
|
-
createSelectorFamily,
|
|
5
4
|
growMoleculeInStore,
|
|
6
5
|
IMPLICIT,
|
|
7
6
|
initFamilyMemberInStore,
|
|
8
7
|
seekInStore,
|
|
8
|
+
withdraw,
|
|
9
9
|
} from "atom.io/internal"
|
|
10
10
|
|
|
11
|
+
import { createWritableSelectorFamily } from "../../internal/src/families/create-writable-selector-family"
|
|
11
12
|
import type { Canonical, Json, JsonInterface } from "."
|
|
12
13
|
import { parseJson, stringifyJson } from "."
|
|
13
14
|
|
|
@@ -16,70 +17,70 @@ export function selectJsonFamily<
|
|
|
16
17
|
J extends Json.Serializable,
|
|
17
18
|
K extends Canonical,
|
|
18
19
|
>(
|
|
19
|
-
|
|
20
|
+
atomFamilyToken: AtomIO.MutableAtomFamilyToken<T, J, K>,
|
|
20
21
|
transform: JsonInterface<T, J>,
|
|
21
22
|
store: Store,
|
|
22
|
-
): AtomIO.
|
|
23
|
+
): AtomIO.WritableSelectorFamilyToken<J, K>
|
|
23
24
|
export function selectJsonFamily<
|
|
24
25
|
T,
|
|
25
26
|
J extends Json.Serializable,
|
|
26
27
|
K extends Canonical,
|
|
27
28
|
>(
|
|
28
|
-
|
|
29
|
+
atomFamilyToken: AtomIO.RegularAtomFamilyToken<T, K>,
|
|
29
30
|
transform: JsonInterface<T, J>,
|
|
30
31
|
store: Store,
|
|
31
|
-
): AtomIO.
|
|
32
|
+
): AtomIO.WritableSelectorFamilyToken<J, K>
|
|
32
33
|
export function selectJsonFamily<
|
|
33
34
|
T,
|
|
34
35
|
J extends Json.Serializable,
|
|
35
36
|
K extends Canonical,
|
|
36
37
|
>(
|
|
37
|
-
|
|
38
|
-
| AtomIO.
|
|
39
|
-
| AtomIO.
|
|
38
|
+
atomFamilyToken:
|
|
39
|
+
| AtomIO.MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, J, K>
|
|
40
|
+
| AtomIO.RegularAtomFamilyToken<T, K>,
|
|
40
41
|
transform: JsonInterface<T, J>,
|
|
41
42
|
store: Store = IMPLICIT.STORE,
|
|
42
|
-
): AtomIO.
|
|
43
|
-
const jsonFamily =
|
|
43
|
+
): AtomIO.WritableSelectorFamilyToken<J, K> {
|
|
44
|
+
const jsonFamily = createWritableSelectorFamily<J, K>(
|
|
44
45
|
{
|
|
45
|
-
key: `${
|
|
46
|
+
key: `${atomFamilyToken.key}:JSON`,
|
|
46
47
|
get:
|
|
47
48
|
(key) =>
|
|
48
49
|
({ seek, get }) => {
|
|
49
|
-
const existingState = seek(
|
|
50
|
+
const existingState = seek(atomFamilyToken, key)
|
|
50
51
|
if (existingState) {
|
|
51
52
|
return transform.toJson(get(existingState))
|
|
52
53
|
}
|
|
53
54
|
const stringKey = stringifyJson(key)
|
|
54
55
|
const molecule = store.molecules.get(stringKey)
|
|
55
56
|
if (molecule) {
|
|
56
|
-
const atom = growMoleculeInStore(molecule,
|
|
57
|
+
const atom = growMoleculeInStore(molecule, atomFamilyToken, store)
|
|
57
58
|
return transform.toJson(get(atom))
|
|
58
59
|
}
|
|
59
60
|
if (store.config.lifespan === `immortal`) {
|
|
60
61
|
throw new Error(`No molecule found for key "${stringKey}"`)
|
|
61
62
|
}
|
|
62
|
-
const newToken = initFamilyMemberInStore(
|
|
63
|
+
const newToken = initFamilyMemberInStore(atomFamilyToken, key, store)
|
|
63
64
|
return transform.toJson(get(newToken))
|
|
64
65
|
},
|
|
65
66
|
set:
|
|
66
67
|
(key) =>
|
|
67
68
|
({ seek, set }, newValue) => {
|
|
68
|
-
const existingState = seek(
|
|
69
|
+
const existingState = seek(atomFamilyToken, key)
|
|
69
70
|
if (existingState) {
|
|
70
71
|
set(existingState, transform.fromJson(newValue))
|
|
71
72
|
} else {
|
|
72
73
|
const stringKey = stringifyJson(key)
|
|
73
74
|
const molecule = store.molecules.get(stringKey)
|
|
74
75
|
if (molecule) {
|
|
75
|
-
const atom = growMoleculeInStore(molecule,
|
|
76
|
+
const atom = growMoleculeInStore(molecule, atomFamilyToken, store)
|
|
76
77
|
set(atom, transform.fromJson(newValue))
|
|
77
78
|
} else {
|
|
78
79
|
if (store.config.lifespan === `immortal`) {
|
|
79
80
|
throw new Error(`No molecule found for key "${stringKey}"`)
|
|
80
81
|
}
|
|
81
82
|
set(
|
|
82
|
-
initFamilyMemberInStore(
|
|
83
|
+
initFamilyMemberInStore(atomFamilyToken, key, store),
|
|
83
84
|
transform.fromJson(newValue),
|
|
84
85
|
)
|
|
85
86
|
}
|
|
@@ -87,8 +88,10 @@ export function selectJsonFamily<
|
|
|
87
88
|
},
|
|
88
89
|
},
|
|
89
90
|
store,
|
|
91
|
+
[`mutable`, `json`],
|
|
90
92
|
)
|
|
91
|
-
|
|
93
|
+
const atomFamily = withdraw(atomFamilyToken, store)
|
|
94
|
+
atomFamily.subject.subscribe(
|
|
92
95
|
`store=${store.config.name}::json-selector-family`,
|
|
93
96
|
(event) => {
|
|
94
97
|
if (event.token.family) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.4",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -59,30 +59,30 @@
|
|
|
59
59
|
"@types/npmlog": "7.0.0",
|
|
60
60
|
"@types/react": "18.3.3",
|
|
61
61
|
"@types/tmp": "0.2.6",
|
|
62
|
-
"@typescript-eslint/parser": "8.0
|
|
63
|
-
"@typescript-eslint/rule-tester": "8.0
|
|
62
|
+
"@typescript-eslint/parser": "8.1.0",
|
|
63
|
+
"@typescript-eslint/rule-tester": "8.1.0",
|
|
64
64
|
"@vitest/coverage-v8": "2.0.5",
|
|
65
65
|
"@vitest/ui": "2.0.5",
|
|
66
66
|
"concurrently": "8.2.2",
|
|
67
67
|
"drizzle-kit": "0.24.0",
|
|
68
68
|
"drizzle-orm": "0.33.0",
|
|
69
69
|
"eslint": "9.9.0",
|
|
70
|
-
"framer-motion": "11.3.
|
|
70
|
+
"framer-motion": "11.3.28",
|
|
71
71
|
"happy-dom": "14.12.3",
|
|
72
72
|
"http-proxy": "1.18.1",
|
|
73
73
|
"npmlog": "7.0.1",
|
|
74
74
|
"postgres": "3.4.4",
|
|
75
|
-
"preact": "10.23.
|
|
75
|
+
"preact": "10.23.2",
|
|
76
76
|
"react": "18.3.1",
|
|
77
77
|
"react-dom": "18.3.1",
|
|
78
|
-
"react-router-dom": "6.26.
|
|
78
|
+
"react-router-dom": "6.26.1",
|
|
79
79
|
"socket.io": "4.7.5",
|
|
80
80
|
"socket.io-client": "4.7.5",
|
|
81
81
|
"tmp": "0.2.3",
|
|
82
82
|
"tsup": "8.2.4",
|
|
83
83
|
"tsx": "4.17.0",
|
|
84
84
|
"typescript": "5.5.4",
|
|
85
|
-
"vite": "5.4.
|
|
85
|
+
"vite": "5.4.1",
|
|
86
86
|
"vite-tsconfig-paths": "5.0.1",
|
|
87
87
|
"vitest": "2.0.5"
|
|
88
88
|
},
|
|
@@ -112,7 +112,7 @@ declare function redactTransactionUpdateContent(visibleStateKeys: string[], upda
|
|
|
112
112
|
declare const actionOcclusionAtoms: AtomIO.RegularAtomFamilyToken<{
|
|
113
113
|
occlude: (updates: TransactionUpdateContent[]) => TransactionUpdateContent[];
|
|
114
114
|
}, string>;
|
|
115
|
-
declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyToken<Pick<TransactionUpdate<any>, "key" | "
|
|
115
|
+
declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyToken<Pick<TransactionUpdate<any>, "key" | "epoch" | "id" | "updates" | "output">[], string>;
|
|
116
116
|
|
|
117
117
|
declare const socketAtoms: AtomIO.RegularAtomFamilyToken<Socket | null, string>;
|
|
118
118
|
declare const socketIndex: AtomIO.MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
|
package/src/atom.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Transceiver } from "atom.io/internal"
|
|
2
2
|
import {
|
|
3
3
|
createAtomFamily,
|
|
4
4
|
createStandaloneAtom,
|
|
@@ -6,13 +6,7 @@ import {
|
|
|
6
6
|
} from "atom.io/internal"
|
|
7
7
|
import type { Canonical, Json, JsonInterface } from "atom.io/json"
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
AtomToken,
|
|
11
|
-
MutableAtomToken,
|
|
12
|
-
RegularAtomToken,
|
|
13
|
-
StateCreation,
|
|
14
|
-
StateDisposal,
|
|
15
|
-
} from "."
|
|
9
|
+
import type { AtomToken, MutableAtomToken, RegularAtomToken } from "."
|
|
16
10
|
|
|
17
11
|
export type Effectors<T> = {
|
|
18
12
|
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void
|
|
@@ -74,14 +68,6 @@ export type RegularAtomFamilyToken<T, K extends Canonical> = {
|
|
|
74
68
|
__T?: T
|
|
75
69
|
__K?: K
|
|
76
70
|
}
|
|
77
|
-
// biome-ignore format: intersection
|
|
78
|
-
export type RegularAtomFamily<T, K extends Canonical> =
|
|
79
|
-
& RegularAtomFamilyToken<T, K>
|
|
80
|
-
& {
|
|
81
|
-
(key: K): RegularAtomToken<T>
|
|
82
|
-
subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>
|
|
83
|
-
install: (store: Store) => void
|
|
84
|
-
}
|
|
85
71
|
|
|
86
72
|
// biome-ignore format: intersection
|
|
87
73
|
export type MutableAtomFamilyOptions<
|
|
@@ -108,23 +94,7 @@ export type MutableAtomFamilyToken<
|
|
|
108
94
|
__J?: J
|
|
109
95
|
__K?: K
|
|
110
96
|
}
|
|
111
|
-
// biome-ignore format: intersection
|
|
112
|
-
export type MutableAtomFamily<
|
|
113
|
-
T extends Transceiver<any>,
|
|
114
|
-
J extends Json.Serializable,
|
|
115
|
-
K extends Canonical,
|
|
116
|
-
> =
|
|
117
|
-
& JsonInterface<T, J>
|
|
118
|
-
& MutableAtomFamilyToken<T, J, K>
|
|
119
|
-
& {
|
|
120
|
-
(key: K): MutableAtomToken<T, J>
|
|
121
|
-
subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>
|
|
122
|
-
install: (store: Store) => void
|
|
123
|
-
}
|
|
124
97
|
|
|
125
|
-
export type AtomFamily<T, K extends Canonical = Canonical> =
|
|
126
|
-
| MutableAtomFamily<T extends Transceiver<any> ? T : never, any, K>
|
|
127
|
-
| RegularAtomFamily<T, K>
|
|
128
98
|
export type AtomFamilyToken<T, K extends Canonical = Canonical> =
|
|
129
99
|
| MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, any, K>
|
|
130
100
|
| RegularAtomFamilyToken<T, K>
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Transceiver } from "atom.io/internal"
|
|
2
2
|
import type { Canonical, Json } from "atom.io/json"
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { AtomFamilyToken } from "./atom"
|
|
5
5
|
import type {
|
|
6
|
-
SelectorFamily,
|
|
7
6
|
SelectorFamilyToken,
|
|
8
|
-
WritableSelectorFamily,
|
|
9
7
|
WritableSelectorFamilyToken,
|
|
10
8
|
} from "./selector"
|
|
11
9
|
|
|
@@ -61,13 +59,6 @@ export type SelectorToken<T> =
|
|
|
61
59
|
export type WritableToken<T> = AtomToken<T> | WritableSelectorToken<T>
|
|
62
60
|
export type ReadableToken<T> = AtomToken<T> | SelectorToken<T>
|
|
63
61
|
|
|
64
|
-
export type WritableFamily<T, K extends Canonical> =
|
|
65
|
-
| AtomFamily<T, K>
|
|
66
|
-
| WritableSelectorFamily<T, K>
|
|
67
|
-
export type ReadableFamily<T, K extends Canonical> =
|
|
68
|
-
| AtomFamily<T, K>
|
|
69
|
-
| SelectorFamily<T, K>
|
|
70
|
-
|
|
71
62
|
export type WritableFamilyToken<T, K extends Canonical> =
|
|
72
63
|
| AtomFamilyToken<T, K>
|
|
73
64
|
| WritableSelectorFamilyToken<T, K>
|
package/src/logger.ts
CHANGED
|
@@ -52,12 +52,16 @@ const LoggerIconDictionary = {
|
|
|
52
52
|
} as const
|
|
53
53
|
export type LoggerIcon = keyof typeof LoggerIconDictionary
|
|
54
54
|
export type TokenDenomination =
|
|
55
|
+
| `atom_family`
|
|
55
56
|
| `atom`
|
|
56
57
|
| `continuity`
|
|
57
58
|
| `molecule_family`
|
|
58
59
|
| `molecule`
|
|
60
|
+
| `mutable_atom_family`
|
|
59
61
|
| `mutable_atom`
|
|
62
|
+
| `readonly_selector_family`
|
|
60
63
|
| `readonly_selector`
|
|
64
|
+
| `selector_family`
|
|
61
65
|
| `selector`
|
|
62
66
|
| `state`
|
|
63
67
|
| `timeline`
|
package/src/selector.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Store, Subject } from "atom.io/internal"
|
|
2
1
|
import {
|
|
3
2
|
createSelectorFamily,
|
|
4
3
|
createStandaloneSelector,
|
|
@@ -7,7 +6,7 @@ import {
|
|
|
7
6
|
import type { Canonical } from "atom.io/json"
|
|
8
7
|
|
|
9
8
|
import type { ReadonlySelectorToken, WritableSelectorToken } from "."
|
|
10
|
-
import type { Read,
|
|
9
|
+
import type { Read, Write } from "./transaction"
|
|
11
10
|
|
|
12
11
|
export type WritableSelectorOptions<T> = {
|
|
13
12
|
key: string
|
|
@@ -48,15 +47,6 @@ export type WritableSelectorFamilyToken<T, K extends Canonical> = {
|
|
|
48
47
|
__K?: K
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
// biome-ignore format: intersection
|
|
52
|
-
export type WritableSelectorFamily<T, K extends Canonical> =
|
|
53
|
-
& WritableSelectorFamilyToken<T, K>
|
|
54
|
-
& {
|
|
55
|
-
(key: K): WritableSelectorToken<T>
|
|
56
|
-
subject: Subject<StateCreation<WritableSelectorToken<T>> | StateDisposal<WritableSelectorToken<T>>>
|
|
57
|
-
install: (store: Store) => void
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
export type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
|
|
61
51
|
key: string
|
|
62
52
|
type: `readonly_selector_family`
|
|
@@ -64,21 +54,6 @@ export type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
|
|
|
64
54
|
__K?: K
|
|
65
55
|
}
|
|
66
56
|
|
|
67
|
-
// biome-ignore format: intersection
|
|
68
|
-
export type ReadonlySelectorFamily<T, K extends Canonical> =
|
|
69
|
-
& ((key: K) => ReadonlySelectorToken<T>)
|
|
70
|
-
& {
|
|
71
|
-
key: string
|
|
72
|
-
type: `readonly_selector_family`
|
|
73
|
-
subject: Subject<StateCreation<ReadonlySelectorToken<T>> | StateDisposal<ReadonlySelectorToken<T>>>
|
|
74
|
-
install: (store: Store) => void
|
|
75
|
-
__T?: T
|
|
76
|
-
__K?: K
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type SelectorFamily<T, K extends Canonical> =
|
|
80
|
-
| ReadonlySelectorFamily<T, K>
|
|
81
|
-
| WritableSelectorFamily<T, K>
|
|
82
57
|
export type SelectorFamilyToken<T, K extends Canonical> =
|
|
83
58
|
| ReadonlySelectorFamilyToken<T, K>
|
|
84
59
|
| WritableSelectorFamilyToken<T, K>
|
package/src/silo.ts
CHANGED
|
@@ -24,13 +24,13 @@ import type {
|
|
|
24
24
|
getState,
|
|
25
25
|
makeMolecule,
|
|
26
26
|
moleculeFamily,
|
|
27
|
-
MutableAtomFamily,
|
|
28
27
|
MutableAtomFamilyOptions,
|
|
28
|
+
MutableAtomFamilyToken,
|
|
29
29
|
MutableAtomOptions,
|
|
30
30
|
MutableAtomToken,
|
|
31
31
|
redo,
|
|
32
|
-
RegularAtomFamily,
|
|
33
32
|
RegularAtomFamilyOptions,
|
|
33
|
+
RegularAtomFamilyToken,
|
|
34
34
|
RegularAtomOptions,
|
|
35
35
|
RegularAtomToken,
|
|
36
36
|
setState,
|
|
@@ -74,15 +74,17 @@ export class Silo {
|
|
|
74
74
|
T extends Transceiver<any>,
|
|
75
75
|
J extends Json.Serializable,
|
|
76
76
|
K extends Canonical,
|
|
77
|
-
>(
|
|
77
|
+
>(
|
|
78
|
+
options: MutableAtomFamilyOptions<T, J, K>,
|
|
79
|
+
): MutableAtomFamilyToken<T, J, K>
|
|
78
80
|
function _atomFamily<T, K extends Canonical>(
|
|
79
81
|
options: RegularAtomFamilyOptions<T, K>,
|
|
80
|
-
):
|
|
82
|
+
): RegularAtomFamilyToken<T, K>
|
|
81
83
|
function _atomFamily<T, K extends Canonical>(
|
|
82
84
|
options:
|
|
83
85
|
| MutableAtomFamilyOptions<any, any, any>
|
|
84
86
|
| RegularAtomFamilyOptions<T, K>,
|
|
85
|
-
):
|
|
87
|
+
): MutableAtomFamilyToken<any, any, any> | RegularAtomFamilyToken<T, K> {
|
|
86
88
|
return createAtomFamily(options, s)
|
|
87
89
|
}
|
|
88
90
|
this.store = s
|