atom.io 0.23.5 → 0.24.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 +51 -27
- package/data/dist/index.d.ts +5 -4
- package/data/dist/index.js +625 -9
- package/data/src/join.ts +74 -46
- package/dist/chunk-BF4MVQF6.js +44 -0
- package/dist/index.cjs +27 -0
- package/dist/index.d.ts +63 -18
- package/dist/index.js +27 -3
- package/immortal/dist/index.cjs +4 -262
- package/immortal/dist/index.d.ts +4 -94
- package/immortal/dist/index.js +3 -215
- package/immortal/src/index.ts +0 -2
- package/immortal/src/seek-state.ts +10 -11
- package/internal/dist/index.cjs +279 -111
- package/internal/dist/index.d.ts +63 -93
- package/internal/dist/index.js +273 -88
- package/internal/src/families/dispose-from-store.ts +11 -7
- package/internal/src/families/find-in-store.ts +2 -2
- package/internal/src/families/init-family-member.ts +37 -25
- package/internal/src/families/seek-in-store.ts +11 -15
- package/internal/src/get-environment-data.ts +0 -4
- package/internal/src/index.ts +1 -0
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +8 -8
- package/internal/src/molecule/create-molecule-family.ts +30 -0
- package/internal/src/molecule/dispose-molecule.ts +76 -0
- package/internal/src/molecule/grow-molecule-in-store.ts +89 -0
- package/internal/src/molecule/index.ts +5 -0
- package/internal/src/molecule/make-molecule-in-store.ts +122 -0
- package/internal/src/molecule/molecule-internal.ts +48 -0
- package/internal/src/not-found-error.ts +4 -3
- package/internal/src/set-state/emit-update.ts +1 -2
- package/internal/src/store/deposit.ts +16 -30
- package/internal/src/store/store.ts +7 -12
- package/internal/src/store/withdraw.ts +30 -19
- package/internal/src/timeline/create-timeline.ts +7 -6
- package/internal/src/transaction/build-transaction.ts +2 -1
- package/introspection/dist/index.cjs +29 -33
- package/introspection/dist/index.js +1 -1
- package/introspection/src/auditor.ts +6 -6
- package/json/dist/index.cjs +4 -4
- package/json/dist/index.js +7 -8
- package/json/src/select-json-family.ts +6 -5
- package/package.json +2 -2
- package/react-devtools/dist/index.js +2 -3
- package/realtime-client/dist/index.js +362 -15
- package/realtime-react/dist/index.cjs +1 -326
- package/realtime-react/dist/index.d.ts +1 -14
- package/realtime-react/dist/index.js +1 -1
- package/realtime-react/src/use-sync-continuity.ts +2 -2
- package/realtime-server/dist/index.cjs +3 -151
- package/realtime-server/dist/index.d.ts +1 -3
- package/realtime-server/dist/index.js +2 -18
- package/realtime-server/src/index.ts +0 -2
- package/realtime-server/src/realtime-continuity-synchronizer.ts +1 -1
- package/realtime-testing/dist/index.cjs +4 -82
- package/realtime-testing/dist/index.js +2 -4
- package/realtime-testing/src/setup-realtime-test.tsx +2 -3
- package/src/dispose-state.ts +2 -2
- package/src/index.ts +1 -0
- package/src/logger.ts +2 -0
- package/src/molecule.ts +133 -0
- package/src/timeline.ts +3 -3
- package/src/transaction.ts +15 -13
- package/dist/chunk-6MLFYN32.js +0 -18
- package/dist/chunk-7DT3PVS3.js +0 -598
- package/dist/chunk-GVHKIJ3G.js +0 -329
- package/dist/chunk-O47EQUM6.js +0 -29
- package/dist/chunk-OAYGID5B.js +0 -27
- package/dist/chunk-PNIHPILQ.js +0 -8
- package/immortal/src/make-molecule.ts +0 -234
- package/immortal/src/molecule.ts +0 -167
- package/realtime-server/src/realtime-state-synchronizer.ts +0 -23
|
@@ -3,9 +3,15 @@ import type {
|
|
|
3
3
|
AtomFamilyToken,
|
|
4
4
|
AtomToken,
|
|
5
5
|
Func,
|
|
6
|
+
MoleculeConstructor,
|
|
7
|
+
MoleculeFamily,
|
|
8
|
+
MoleculeFamilyToken,
|
|
9
|
+
MoleculeToken,
|
|
6
10
|
MutableAtomFamily,
|
|
7
11
|
MutableAtomFamilyToken,
|
|
8
12
|
MutableAtomToken,
|
|
13
|
+
ReadableFamily,
|
|
14
|
+
ReadableFamilyToken,
|
|
9
15
|
ReadableToken,
|
|
10
16
|
ReadonlySelectorFamily,
|
|
11
17
|
ReadonlySelectorFamilyToken,
|
|
@@ -19,21 +25,18 @@ import type {
|
|
|
19
25
|
TimelineManageable,
|
|
20
26
|
TimelineToken,
|
|
21
27
|
TransactionToken,
|
|
28
|
+
WritableFamily,
|
|
29
|
+
WritableFamilyToken,
|
|
22
30
|
WritableSelectorFamily,
|
|
23
31
|
WritableSelectorFamilyToken,
|
|
24
32
|
WritableSelectorToken,
|
|
25
33
|
WritableToken,
|
|
26
34
|
} from "atom.io"
|
|
27
|
-
import type {
|
|
28
|
-
Molecule,
|
|
29
|
-
MoleculeFamily,
|
|
30
|
-
MoleculeFamilyToken,
|
|
31
|
-
MoleculeToken,
|
|
32
|
-
} from "atom.io/immortal"
|
|
33
35
|
import { type Json, stringifyJson } from "atom.io/json"
|
|
34
36
|
|
|
35
37
|
import type {
|
|
36
38
|
Atom,
|
|
39
|
+
Molecule,
|
|
37
40
|
MutableAtom,
|
|
38
41
|
ReadableState,
|
|
39
42
|
ReadonlySelector,
|
|
@@ -52,9 +55,10 @@ export type Withdrawable =
|
|
|
52
55
|
| Atom<any>
|
|
53
56
|
| AtomFamily<any, any>
|
|
54
57
|
| Molecule<any>
|
|
55
|
-
| MoleculeFamily<any
|
|
58
|
+
| MoleculeFamily<any>
|
|
56
59
|
| MutableAtom<any, any>
|
|
57
60
|
| MutableAtomFamily<any, any, any>
|
|
61
|
+
| ReadableFamily<any, any>
|
|
58
62
|
| ReadableState<any>
|
|
59
63
|
| ReadonlySelector<any>
|
|
60
64
|
| ReadonlySelectorFamily<any, any>
|
|
@@ -64,6 +68,7 @@ export type Withdrawable =
|
|
|
64
68
|
| SelectorFamily<any, any>
|
|
65
69
|
| Timeline<any>
|
|
66
70
|
| Transaction<any>
|
|
71
|
+
| WritableFamily<any, any>
|
|
67
72
|
| WritableSelector<any>
|
|
68
73
|
| WritableSelectorFamily<any, any>
|
|
69
74
|
| WritableState<any>
|
|
@@ -123,17 +128,23 @@ export function withdraw<T, K extends Json.Serializable>(
|
|
|
123
128
|
token: SelectorFamilyToken<T, K>,
|
|
124
129
|
store: Store,
|
|
125
130
|
): SelectorFamily<T, any>
|
|
131
|
+
export function withdraw<T, K extends Json.Serializable>(
|
|
132
|
+
token: ReadableFamilyToken<T, K>,
|
|
133
|
+
store: Store,
|
|
134
|
+
): ReadableFamily<T, any>
|
|
135
|
+
export function withdraw<T, K extends Json.Serializable>(
|
|
136
|
+
token: WritableFamilyToken<T, K>,
|
|
137
|
+
store: Store,
|
|
138
|
+
): WritableFamily<T, any>
|
|
126
139
|
|
|
127
|
-
export function withdraw<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
P extends any[],
|
|
136
|
-
>(token: MoleculeFamilyToken<K, S, P>, store: Store): MoleculeFamily<K, S, P>
|
|
140
|
+
export function withdraw<M extends MoleculeConstructor>(
|
|
141
|
+
token: MoleculeToken<M>,
|
|
142
|
+
store: Store,
|
|
143
|
+
): Molecule<M>
|
|
144
|
+
export function withdraw<M extends MoleculeConstructor>(
|
|
145
|
+
token: MoleculeFamilyToken<M>,
|
|
146
|
+
store: Store,
|
|
147
|
+
): MoleculeFamily<M>
|
|
137
148
|
|
|
138
149
|
export function withdraw<T extends Func>(
|
|
139
150
|
token: TransactionToken<T>,
|
|
@@ -145,8 +156,8 @@ export function withdraw<T>(
|
|
|
145
156
|
): Timeline<T extends TimelineManageable ? T : never>
|
|
146
157
|
export function withdraw<T>(
|
|
147
158
|
token:
|
|
148
|
-
| MoleculeFamilyToken<any
|
|
149
|
-
| MoleculeToken<any
|
|
159
|
+
| MoleculeFamilyToken<any>
|
|
160
|
+
| MoleculeToken<any>
|
|
150
161
|
| RegularAtomFamilyToken<T, any>
|
|
151
162
|
| RegularAtomToken<T>
|
|
152
163
|
| SelectorFamilyToken<T, any>
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
FamilyMetadata,
|
|
4
4
|
Flat,
|
|
5
5
|
Func,
|
|
6
|
+
MoleculeConstructor,
|
|
6
7
|
MoleculeCreation,
|
|
7
8
|
MoleculeDisposal,
|
|
8
9
|
ReadableToken,
|
|
@@ -16,7 +17,7 @@ import type {
|
|
|
16
17
|
TokenType,
|
|
17
18
|
TransactionUpdate,
|
|
18
19
|
} from "atom.io"
|
|
19
|
-
import {
|
|
20
|
+
import { stringifyJson } from "atom.io/json"
|
|
20
21
|
|
|
21
22
|
import { newest } from "../lineage"
|
|
22
23
|
import { getUpdateToken, isMutable } from "../mutable"
|
|
@@ -51,11 +52,11 @@ export type TimelineStateCreation<T extends ReadableToken<any>> = Flat<
|
|
|
51
52
|
export type TimelineStateDisposal<T extends ReadableToken<any>> = Flat<
|
|
52
53
|
StateDisposal<T> & { timestamp: number }
|
|
53
54
|
>
|
|
54
|
-
export type TimelineMoleculeCreation<
|
|
55
|
-
MoleculeCreation<
|
|
55
|
+
export type TimelineMoleculeCreation<M extends MoleculeConstructor> = Flat<
|
|
56
|
+
MoleculeCreation<M> & { timestamp: number }
|
|
56
57
|
>
|
|
57
|
-
export type TimelineMoleculeDisposal
|
|
58
|
-
MoleculeDisposal
|
|
58
|
+
export type TimelineMoleculeDisposal = Flat<
|
|
59
|
+
MoleculeDisposal & { timestamp: number }
|
|
59
60
|
>
|
|
60
61
|
|
|
61
62
|
export type Timeline<ManagedAtom extends TimelineManageable> = {
|
|
@@ -184,7 +185,7 @@ export function createTimeline<ManagedAtom extends TimelineManageable>(
|
|
|
184
185
|
tl.at = tl.history.length
|
|
185
186
|
tl.subject.next(event)
|
|
186
187
|
|
|
187
|
-
for (const token of molecule.tokens) {
|
|
188
|
+
for (const token of molecule.tokens.values()) {
|
|
188
189
|
switch (token.type) {
|
|
189
190
|
case `atom`:
|
|
190
191
|
case `mutable_atom`:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Func } from "atom.io"
|
|
2
2
|
import type { findState } from "atom.io/ephemeral"
|
|
3
|
-
import {
|
|
3
|
+
import type { seekState } from "atom.io/immortal"
|
|
4
4
|
|
|
5
5
|
import { Junction } from "~/packages/rel8/junction/src"
|
|
6
6
|
|
|
@@ -10,6 +10,7 @@ import { getEnvironmentData } from "../get-environment-data"
|
|
|
10
10
|
import { getFromStore } from "../get-state"
|
|
11
11
|
import { LazyMap } from "../lazy-map"
|
|
12
12
|
import { newest } from "../lineage"
|
|
13
|
+
import { makeMoleculeInStore } from "../molecule"
|
|
13
14
|
import { getJsonToken } from "../mutable"
|
|
14
15
|
import { setIntoStore } from "../set-state"
|
|
15
16
|
import type { Store } from "../store"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var Internal = require('atom.io/internal');
|
|
4
|
+
var atom_io = require('atom.io');
|
|
4
5
|
|
|
5
6
|
function _interopNamespace(e) {
|
|
6
7
|
if (e && e.__esModule) return e;
|
|
@@ -20,7 +21,7 @@ function _interopNamespace(e) {
|
|
|
20
21
|
return Object.freeze(n);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
var
|
|
24
|
+
var Internal__namespace = /*#__PURE__*/_interopNamespace(Internal);
|
|
24
25
|
|
|
25
26
|
var __defProp = Object.defineProperty;
|
|
26
27
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -38,15 +39,15 @@ var __spreadValues = (a, b) => {
|
|
|
38
39
|
}
|
|
39
40
|
return a;
|
|
40
41
|
};
|
|
41
|
-
var attachAtomIndex = (store =
|
|
42
|
-
const atomTokenIndexState__INTERNAL =
|
|
42
|
+
var attachAtomIndex = (store = Internal.IMPLICIT.STORE) => {
|
|
43
|
+
const atomTokenIndexState__INTERNAL = Internal.createRegularAtom(
|
|
43
44
|
{
|
|
44
45
|
key: `\u{1F441}\u200D\u{1F5E8} Atom Token Index (Internal)`,
|
|
45
46
|
default: () => {
|
|
46
47
|
const base = /* @__PURE__ */ new Map();
|
|
47
48
|
for (const [key, val] of store.atoms) {
|
|
48
49
|
if (!key.includes(`\u{1F441}\u200D\u{1F5E8}`)) {
|
|
49
|
-
const token =
|
|
50
|
+
const token = Internal.deposit(val);
|
|
50
51
|
if (val.family) {
|
|
51
52
|
let familyNode = base.get(val.family.key);
|
|
52
53
|
if (!familyNode || !(`familyMembers` in familyNode)) {
|
|
@@ -111,7 +112,7 @@ var attachAtomIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
111
112
|
void 0,
|
|
112
113
|
store
|
|
113
114
|
);
|
|
114
|
-
return
|
|
115
|
+
return Internal.createStandaloneSelector(
|
|
115
116
|
{
|
|
116
117
|
key: `\u{1F441}\u200D\u{1F5E8} Atom Token Index`,
|
|
117
118
|
get: ({ get }) => get(atomTokenIndexState__INTERNAL)
|
|
@@ -119,8 +120,8 @@ var attachAtomIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
119
120
|
store
|
|
120
121
|
);
|
|
121
122
|
};
|
|
122
|
-
var attachSelectorIndex = (store =
|
|
123
|
-
const readonlySelectorTokenIndexState__INTERNAL =
|
|
123
|
+
var attachSelectorIndex = (store = Internal.IMPLICIT.STORE) => {
|
|
124
|
+
const readonlySelectorTokenIndexState__INTERNAL = Internal.createRegularAtom(
|
|
124
125
|
{
|
|
125
126
|
key: `\u{1F441}\u200D\u{1F5E8} Selector Token Index (Internal)`,
|
|
126
127
|
default: () => {
|
|
@@ -128,7 +129,7 @@ var attachSelectorIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
128
129
|
for (const map of [store.readonlySelectors, store.selectors]) {
|
|
129
130
|
for (const [key, val] of map) {
|
|
130
131
|
if (!key.includes(`\u{1F441}\u200D\u{1F5E8}`)) {
|
|
131
|
-
const token =
|
|
132
|
+
const token = Internal.deposit(val);
|
|
132
133
|
if (val.family) {
|
|
133
134
|
let familyNode = base.get(val.family.key);
|
|
134
135
|
if (!familyNode || !(`familyMembers` in familyNode)) {
|
|
@@ -200,16 +201,16 @@ var attachSelectorIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
200
201
|
void 0,
|
|
201
202
|
store
|
|
202
203
|
);
|
|
203
|
-
return
|
|
204
|
+
return Internal.createStandaloneSelector(
|
|
204
205
|
{
|
|
205
206
|
key: `\u{1F441}\u200D\u{1F5E8} Selector Token Index`,
|
|
206
207
|
get: ({ get }) => get(readonlySelectorTokenIndexState__INTERNAL)
|
|
207
208
|
},
|
|
208
|
-
|
|
209
|
+
Internal.IMPLICIT.STORE
|
|
209
210
|
);
|
|
210
211
|
};
|
|
211
|
-
var attachTimelineFamily = (store =
|
|
212
|
-
const findTimelineLogState__INTERNAL =
|
|
212
|
+
var attachTimelineFamily = (store = Internal.IMPLICIT.STORE) => {
|
|
213
|
+
const findTimelineLogState__INTERNAL = Internal.createRegularAtomFamily(
|
|
213
214
|
{
|
|
214
215
|
key: `\u{1F441}\u200D\u{1F5E8} Timeline Update Log (Internal)`,
|
|
215
216
|
default: (key) => {
|
|
@@ -224,7 +225,7 @@ var attachTimelineFamily = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
224
225
|
transactionKey: null,
|
|
225
226
|
install: () => {
|
|
226
227
|
},
|
|
227
|
-
subject: new
|
|
228
|
+
subject: new Internal.Subject(),
|
|
228
229
|
subscriptions: /* @__PURE__ */ new Map()
|
|
229
230
|
};
|
|
230
231
|
},
|
|
@@ -239,7 +240,7 @@ var attachTimelineFamily = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
239
240
|
},
|
|
240
241
|
store
|
|
241
242
|
);
|
|
242
|
-
const findTimelineLogState =
|
|
243
|
+
const findTimelineLogState = Internal.createSelectorFamily(
|
|
243
244
|
{
|
|
244
245
|
key: `\u{1F441}\u200D\u{1F5E8} Timeline Update Log`,
|
|
245
246
|
get: (key) => ({ get }) => get(findTimelineLogState__INTERNAL(key))
|
|
@@ -248,8 +249,8 @@ var attachTimelineFamily = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
248
249
|
);
|
|
249
250
|
return findTimelineLogState;
|
|
250
251
|
};
|
|
251
|
-
var attachTimelineIndex = (store =
|
|
252
|
-
const timelineTokenIndexState__INTERNAL =
|
|
252
|
+
var attachTimelineIndex = (store = Internal.IMPLICIT.STORE) => {
|
|
253
|
+
const timelineTokenIndexState__INTERNAL = Internal.createRegularAtom(
|
|
253
254
|
{
|
|
254
255
|
key: `\u{1F441}\u200D\u{1F5E8} Timeline Token Index (Internal)`,
|
|
255
256
|
default: () => [...store.timelines].map(([key]) => {
|
|
@@ -269,7 +270,7 @@ var attachTimelineIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
269
270
|
void 0,
|
|
270
271
|
store
|
|
271
272
|
);
|
|
272
|
-
const timelineTokenIndex =
|
|
273
|
+
const timelineTokenIndex = Internal.createStandaloneSelector(
|
|
273
274
|
{
|
|
274
275
|
key: `\u{1F441}\u200D\u{1F5E8} Timeline Token Index`,
|
|
275
276
|
get: ({ get }) => get(timelineTokenIndexState__INTERNAL)
|
|
@@ -278,8 +279,8 @@ var attachTimelineIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
278
279
|
);
|
|
279
280
|
return timelineTokenIndex;
|
|
280
281
|
};
|
|
281
|
-
var attachTransactionIndex = (store =
|
|
282
|
-
const transactionTokenIndexState__INTERNAL =
|
|
282
|
+
var attachTransactionIndex = (store = Internal.IMPLICIT.STORE) => {
|
|
283
|
+
const transactionTokenIndexState__INTERNAL = Internal.createRegularAtom(
|
|
283
284
|
{
|
|
284
285
|
key: `\u{1F441}\u200D\u{1F5E8} Transaction Token Index (Internal)`,
|
|
285
286
|
default: () => [...store.transactions].map(([key]) => {
|
|
@@ -299,7 +300,7 @@ var attachTransactionIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
299
300
|
void 0,
|
|
300
301
|
store
|
|
301
302
|
);
|
|
302
|
-
const transactionTokenIndex =
|
|
303
|
+
const transactionTokenIndex = Internal.createStandaloneSelector(
|
|
303
304
|
{
|
|
304
305
|
key: `\u{1F441}\u200D\u{1F5E8} Transaction Token Index`,
|
|
305
306
|
get: ({ get }) => get(transactionTokenIndexState__INTERNAL)
|
|
@@ -308,8 +309,8 @@ var attachTransactionIndex = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
308
309
|
);
|
|
309
310
|
return transactionTokenIndex;
|
|
310
311
|
};
|
|
311
|
-
var attachTransactionLogs = (store =
|
|
312
|
-
const findTransactionUpdateLog =
|
|
312
|
+
var attachTransactionLogs = (store = Internal.IMPLICIT.STORE) => {
|
|
313
|
+
const findTransactionUpdateLog = Internal.createRegularAtomFamily(
|
|
313
314
|
{
|
|
314
315
|
key: `\u{1F441}\u200D\u{1F5E8} Transaction Update Log (Internal)`,
|
|
315
316
|
default: () => [],
|
|
@@ -326,7 +327,7 @@ var attachTransactionLogs = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
326
327
|
},
|
|
327
328
|
store
|
|
328
329
|
);
|
|
329
|
-
const findTransactionUpdateLogState =
|
|
330
|
+
const findTransactionUpdateLogState = Internal.createSelectorFamily(
|
|
330
331
|
{
|
|
331
332
|
key: `\u{1F441}\u200D\u{1F5E8} Transaction Update Log`,
|
|
332
333
|
get: (key) => ({ get }) => get(findTransactionUpdateLog(key))
|
|
@@ -337,7 +338,7 @@ var attachTransactionLogs = (store = Internal2.IMPLICIT.STORE) => {
|
|
|
337
338
|
};
|
|
338
339
|
|
|
339
340
|
// introspection/src/attach-introspection-states.ts
|
|
340
|
-
var attachIntrospectionStates = (store =
|
|
341
|
+
var attachIntrospectionStates = (store = Internal__namespace.IMPLICIT.STORE) => {
|
|
341
342
|
return {
|
|
342
343
|
atomIndex: attachAtomIndex(store),
|
|
343
344
|
selectorIndex: attachSelectorIndex(store),
|
|
@@ -347,16 +348,11 @@ var attachIntrospectionStates = (store = Internal2__namespace.IMPLICIT.STORE) =>
|
|
|
347
348
|
findTimelineState: attachTimelineFamily(store)
|
|
348
349
|
};
|
|
349
350
|
};
|
|
350
|
-
function getState(token) {
|
|
351
|
-
return Internal2__namespace.getFromStore(token, Internal2__namespace.IMPLICIT.STORE);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// introspection/src/auditor.ts
|
|
355
351
|
var _Auditor = class _Auditor {
|
|
356
352
|
/**
|
|
357
353
|
* @param {Store} store - The store to audit.
|
|
358
354
|
*/
|
|
359
|
-
constructor(store =
|
|
355
|
+
constructor(store = Internal__namespace.IMPLICIT.STORE) {
|
|
360
356
|
this.store = store;
|
|
361
357
|
this.auditorCreatedAt = performance.now();
|
|
362
358
|
this.statesCreatedAt = /* @__PURE__ */ new Map();
|
|
@@ -401,8 +397,8 @@ var _Auditor = class _Auditor {
|
|
|
401
397
|
if (this.disposed) {
|
|
402
398
|
throw new Error(`This Auditor has been disposed`);
|
|
403
399
|
}
|
|
404
|
-
const atoms = getState(this.atomIndex);
|
|
405
|
-
const selectors = getState(this.selectorIndex);
|
|
400
|
+
const atoms = atom_io.getState(this.atomIndex);
|
|
401
|
+
const selectors = atom_io.getState(this.selectorIndex);
|
|
406
402
|
const atomFamilyNodes = [...atoms.values()].filter(
|
|
407
403
|
(node) => `familyMembers` in node
|
|
408
404
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getState } from '../../dist/chunk-PNIHPILQ.js';
|
|
2
1
|
import { __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
|
|
3
2
|
import * as Internal from 'atom.io/internal';
|
|
4
3
|
import { createRegularAtom, deposit, createStandaloneSelector, IMPLICIT, createRegularAtomFamily, Subject, createSelectorFamily } from 'atom.io/internal';
|
|
4
|
+
import { getState } from 'atom.io';
|
|
5
5
|
|
|
6
6
|
var attachAtomIndex = (store = IMPLICIT.STORE) => {
|
|
7
7
|
const atomTokenIndexState__INTERNAL = createRegularAtom(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
AtomToken,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
type AtomToken,
|
|
3
|
+
getState,
|
|
4
|
+
type ReadableToken,
|
|
5
|
+
type ReadonlySelectorToken,
|
|
6
|
+
type SelectorToken,
|
|
6
7
|
} from "atom.io"
|
|
7
8
|
import * as Internal from "atom.io/internal"
|
|
8
9
|
|
|
9
|
-
import { getState } from "../../src/get-state"
|
|
10
10
|
import type { FamilyNode } from "."
|
|
11
11
|
import type { AtomTokenIndex } from "./attach-atom-index"
|
|
12
12
|
import { attachAtomIndex } from "./attach-atom-index"
|
package/json/dist/index.cjs
CHANGED
|
@@ -27,13 +27,13 @@ function selectJsonFamily(family, transform, store = internal.IMPLICIT.STORE) {
|
|
|
27
27
|
const stringKey = stringifyJson(key);
|
|
28
28
|
const molecule = store.molecules.get(stringKey);
|
|
29
29
|
if (molecule) {
|
|
30
|
-
const atom =
|
|
30
|
+
const atom = internal.growMoleculeInStore(molecule, family, store);
|
|
31
31
|
return transform.toJson(get(atom));
|
|
32
32
|
}
|
|
33
33
|
if (store.config.lifespan === `immortal`) {
|
|
34
34
|
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
35
35
|
}
|
|
36
|
-
const newToken = internal.
|
|
36
|
+
const newToken = internal.initFamilyMemberInStore(family, key, store);
|
|
37
37
|
return transform.toJson(get(newToken));
|
|
38
38
|
},
|
|
39
39
|
set: (key) => ({ seek, set }, newValue) => {
|
|
@@ -44,14 +44,14 @@ function selectJsonFamily(family, transform, store = internal.IMPLICIT.STORE) {
|
|
|
44
44
|
const stringKey = stringifyJson(key);
|
|
45
45
|
const molecule = store.molecules.get(stringKey);
|
|
46
46
|
if (molecule) {
|
|
47
|
-
const atom =
|
|
47
|
+
const atom = internal.growMoleculeInStore(molecule, family, store);
|
|
48
48
|
set(atom, transform.fromJson(newValue));
|
|
49
49
|
} else {
|
|
50
50
|
if (store.config.lifespan === `immortal`) {
|
|
51
51
|
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
52
52
|
}
|
|
53
53
|
set(
|
|
54
|
-
internal.
|
|
54
|
+
internal.initFamilyMemberInStore(family, key, store),
|
|
55
55
|
transform.fromJson(newValue)
|
|
56
56
|
);
|
|
57
57
|
}
|
package/json/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { JSON_DEFAULTS, JSON_TYPE_NAMES, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-OAYGID5B.js';
|
|
1
|
+
import { stringifyJson, parseJson } from '../../dist/chunk-BF4MVQF6.js';
|
|
2
|
+
export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-BF4MVQF6.js';
|
|
4
3
|
import '../../dist/chunk-F2X4B4VY.js';
|
|
5
|
-
import { createStandaloneSelector, IMPLICIT, createSelectorFamily,
|
|
4
|
+
import { createStandaloneSelector, IMPLICIT, createSelectorFamily, growMoleculeInStore, initFamilyMemberInStore, seekInStore } from 'atom.io/internal';
|
|
6
5
|
|
|
7
6
|
var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
8
7
|
return createStandaloneSelector(
|
|
@@ -28,13 +27,13 @@ function selectJsonFamily(family, transform, store = IMPLICIT.STORE) {
|
|
|
28
27
|
const stringKey = stringifyJson(key);
|
|
29
28
|
const molecule = store.molecules.get(stringKey);
|
|
30
29
|
if (molecule) {
|
|
31
|
-
const atom = molecule
|
|
30
|
+
const atom = growMoleculeInStore(molecule, family, store);
|
|
32
31
|
return transform.toJson(get(atom));
|
|
33
32
|
}
|
|
34
33
|
if (store.config.lifespan === `immortal`) {
|
|
35
34
|
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
36
35
|
}
|
|
37
|
-
const newToken =
|
|
36
|
+
const newToken = initFamilyMemberInStore(family, key, store);
|
|
38
37
|
return transform.toJson(get(newToken));
|
|
39
38
|
},
|
|
40
39
|
set: (key) => ({ seek, set }, newValue) => {
|
|
@@ -45,14 +44,14 @@ function selectJsonFamily(family, transform, store = IMPLICIT.STORE) {
|
|
|
45
44
|
const stringKey = stringifyJson(key);
|
|
46
45
|
const molecule = store.molecules.get(stringKey);
|
|
47
46
|
if (molecule) {
|
|
48
|
-
const atom = molecule
|
|
47
|
+
const atom = growMoleculeInStore(molecule, family, store);
|
|
49
48
|
set(atom, transform.fromJson(newValue));
|
|
50
49
|
} else {
|
|
51
50
|
if (store.config.lifespan === `immortal`) {
|
|
52
51
|
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
53
52
|
}
|
|
54
53
|
set(
|
|
55
|
-
|
|
54
|
+
initFamilyMemberInStore(family, key, store),
|
|
56
55
|
transform.fromJson(newValue)
|
|
57
56
|
);
|
|
58
57
|
}
|
|
@@ -2,8 +2,9 @@ import type * as AtomIO from "atom.io"
|
|
|
2
2
|
import type { Store, Transceiver } from "atom.io/internal"
|
|
3
3
|
import {
|
|
4
4
|
createSelectorFamily,
|
|
5
|
+
growMoleculeInStore,
|
|
5
6
|
IMPLICIT,
|
|
6
|
-
|
|
7
|
+
initFamilyMemberInStore,
|
|
7
8
|
seekInStore,
|
|
8
9
|
} from "atom.io/internal"
|
|
9
10
|
|
|
@@ -52,13 +53,13 @@ export function selectJsonFamily<
|
|
|
52
53
|
const stringKey = stringifyJson(key)
|
|
53
54
|
const molecule = store.molecules.get(stringKey)
|
|
54
55
|
if (molecule) {
|
|
55
|
-
const atom = molecule
|
|
56
|
+
const atom = growMoleculeInStore(molecule, family, store)
|
|
56
57
|
return transform.toJson(get(atom))
|
|
57
58
|
}
|
|
58
59
|
if (store.config.lifespan === `immortal`) {
|
|
59
60
|
throw new Error(`No molecule found for key "${stringKey}"`)
|
|
60
61
|
}
|
|
61
|
-
const newToken =
|
|
62
|
+
const newToken = initFamilyMemberInStore(family, key, store)
|
|
62
63
|
return transform.toJson(get(newToken))
|
|
63
64
|
},
|
|
64
65
|
set:
|
|
@@ -71,14 +72,14 @@ export function selectJsonFamily<
|
|
|
71
72
|
const stringKey = stringifyJson(key)
|
|
72
73
|
const molecule = store.molecules.get(stringKey)
|
|
73
74
|
if (molecule) {
|
|
74
|
-
const atom = molecule
|
|
75
|
+
const atom = growMoleculeInStore(molecule, family, store)
|
|
75
76
|
set(atom, transform.fromJson(newValue))
|
|
76
77
|
} else {
|
|
77
78
|
if (store.config.lifespan === `immortal`) {
|
|
78
79
|
throw new Error(`No molecule found for key "${stringKey}"`)
|
|
79
80
|
}
|
|
80
81
|
set(
|
|
81
|
-
|
|
82
|
+
initFamilyMemberInStore(family, key, store),
|
|
82
83
|
transform.fromJson(newValue),
|
|
83
84
|
)
|
|
84
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/estree": "1.0.5",
|
|
55
55
|
"@types/http-proxy": "1.17.14",
|
|
56
56
|
"@types/npmlog": "7.0.0",
|
|
57
|
-
"@types/react": "18.3.
|
|
57
|
+
"@types/react": "18.3.3",
|
|
58
58
|
"@types/tmp": "0.2.6",
|
|
59
59
|
"@typescript-eslint/parser": "7.10.0",
|
|
60
60
|
"@typescript-eslint/rule-tester": "7.10.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-3V3VWQ7X.js';
|
|
2
1
|
import { lazyLocalStorageEffect } from '../../dist/chunk-BWWVY5O5.js';
|
|
3
|
-
import {
|
|
4
|
-
import { JSON_TYPE_NAMES, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-
|
|
2
|
+
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-3V3VWQ7X.js';
|
|
3
|
+
import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-BF4MVQF6.js';
|
|
5
4
|
import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-F2X4B4VY.js';
|
|
6
5
|
import { selectorFamily, atom, atomFamily, undo, redo, getState } from 'atom.io';
|
|
7
6
|
import { attachIntrospectionStates } from 'atom.io/introspection';
|