atom.io 0.28.2 → 0.29.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/dist/{chunk-D3ZPRYEW.js → chunk-XPYU2HY2.js} +7 -40
- package/internal/dist/index.d.ts +1 -1
- package/internal/dist/index.js +1 -1
- package/internal/src/atom/dispose-atom.ts +0 -11
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +16 -25
- package/internal/src/selector/dispose-selector.ts +0 -13
- package/json/dist/index.js +1 -1
- package/package.json +8 -8
|
@@ -877,14 +877,6 @@ function disposeSelector(selectorToken, store) {
|
|
|
877
877
|
}
|
|
878
878
|
target.valueMap.delete(key);
|
|
879
879
|
target.selectorAtoms.delete(key);
|
|
880
|
-
const downstreamTokens = target.selectorGraph.getRelationEntries({ upstreamSelectorKey: key }).filter(([_, { source }]) => source === key).map(
|
|
881
|
-
([downstreamSelectorKey]) => target.selectors.get(downstreamSelectorKey) ?? target.readonlySelectors.get(downstreamSelectorKey)
|
|
882
|
-
);
|
|
883
|
-
for (const downstreamToken of downstreamTokens) {
|
|
884
|
-
if (downstreamToken) {
|
|
885
|
-
disposeSelector(downstreamToken, store);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
880
|
target.selectorGraph.delete(key);
|
|
889
881
|
store.logger.info(`\u{1F525}`, selectorToken.type, key, `deleted`);
|
|
890
882
|
if (isChildStore(target) && target.transactionMeta.phase === `building`) {
|
|
@@ -1447,7 +1439,7 @@ function ingestAtomUpdate(applying, atomUpdate, store) {
|
|
|
1447
1439
|
function ingestCreationEvent(update, applying, store) {
|
|
1448
1440
|
switch (applying) {
|
|
1449
1441
|
case `newValue`: {
|
|
1450
|
-
createInStore(update
|
|
1442
|
+
createInStore(update, store);
|
|
1451
1443
|
break;
|
|
1452
1444
|
}
|
|
1453
1445
|
case `oldValue`: {
|
|
@@ -1463,34 +1455,18 @@ function ingestDisposalEvent(update, applying, store) {
|
|
|
1463
1455
|
break;
|
|
1464
1456
|
}
|
|
1465
1457
|
case `oldValue`: {
|
|
1466
|
-
createInStore(update
|
|
1458
|
+
createInStore(update, store);
|
|
1467
1459
|
store.valueMap.set(update.token.key, update.value);
|
|
1468
1460
|
break;
|
|
1469
1461
|
}
|
|
1470
1462
|
}
|
|
1471
1463
|
}
|
|
1472
|
-
function createInStore(
|
|
1473
|
-
|
|
1474
|
-
|
|
1464
|
+
function createInStore(update, store) {
|
|
1465
|
+
const { family: familyMeta } = update.token;
|
|
1466
|
+
if (familyMeta) {
|
|
1467
|
+
const family = store.families.get(familyMeta.key);
|
|
1475
1468
|
if (family) {
|
|
1476
|
-
|
|
1477
|
-
if (molecule) {
|
|
1478
|
-
growMoleculeInStore(molecule, family, store);
|
|
1479
|
-
return;
|
|
1480
|
-
}
|
|
1481
|
-
if (store.config.lifespan === `immortal`) {
|
|
1482
|
-
store.logger.error(
|
|
1483
|
-
`\u{1F41E}`,
|
|
1484
|
-
`atom`,
|
|
1485
|
-
token.family.key,
|
|
1486
|
-
`tried to create member`,
|
|
1487
|
-
`"${token.family.subKey}"`,
|
|
1488
|
-
`but a molecule with that key was not found in store`,
|
|
1489
|
-
`"${store.config.name}"`
|
|
1490
|
-
);
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
initFamilyMemberInStore(store, family, parseJson(token.family.subKey));
|
|
1469
|
+
findInStore(store, family, parseJson(familyMeta.subKey));
|
|
1494
1470
|
}
|
|
1495
1471
|
}
|
|
1496
1472
|
}
|
|
@@ -2713,15 +2689,6 @@ function disposeAtom(atomToken, store) {
|
|
|
2713
2689
|
}
|
|
2714
2690
|
target.atoms.delete(key);
|
|
2715
2691
|
target.valueMap.delete(key);
|
|
2716
|
-
const selectorKeys = target.selectorAtoms.getRelatedKeys(key);
|
|
2717
|
-
if (selectorKeys) {
|
|
2718
|
-
for (const selectorKey of selectorKeys) {
|
|
2719
|
-
const token = target.selectors.get(selectorKey) ?? target.readonlySelectors.get(selectorKey);
|
|
2720
|
-
if (token) {
|
|
2721
|
-
disposeSelector(token, store);
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
}
|
|
2725
2692
|
target.selectorAtoms.delete(key);
|
|
2726
2693
|
target.atomsThatAreDefault.delete(key);
|
|
2727
2694
|
target.timelineTopics.delete(key);
|
package/internal/dist/index.d.ts
CHANGED
|
@@ -496,7 +496,7 @@ declare const readOrComputeValue: <T>(state: ReadableState<T>, target: Store) =>
|
|
|
496
496
|
declare function ingestAtomUpdate(applying: `newValue` | `oldValue`, atomUpdate: KeyedStateUpdate<any>, store: Store): void;
|
|
497
497
|
|
|
498
498
|
declare function ingestCreationEvent(update: StateCreation<any>, applying: `newValue` | `oldValue`, store: Store): void;
|
|
499
|
-
declare function ingestDisposalEvent(update: StateDisposal<any
|
|
499
|
+
declare function ingestDisposalEvent(update: StateDisposal<ReadableToken<any>>, applying: `newValue` | `oldValue`, store: Store): void;
|
|
500
500
|
declare function ingestMoleculeCreationEvent(update: MoleculeCreation<any>, applying: `newValue` | `oldValue`, store: Store): void;
|
|
501
501
|
declare function ingestMoleculeDisposalEvent(update: MoleculeDisposal, applying: `newValue` | `oldValue`, store: Store): void;
|
|
502
502
|
|
package/internal/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, LazyMap, Molecule, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateFamily, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, 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-
|
|
1
|
+
export { FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, LazyMap, Molecule, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateFamily, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, 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-XPYU2HY2.js';
|
|
2
2
|
import '../../dist/chunk-IBTHB2PI.js';
|
|
3
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -30,17 +30,6 @@ export function disposeAtom(atomToken: AtomToken<unknown>, store: Store): void {
|
|
|
30
30
|
}
|
|
31
31
|
target.atoms.delete(key)
|
|
32
32
|
target.valueMap.delete(key)
|
|
33
|
-
const selectorKeys = target.selectorAtoms.getRelatedKeys(key)
|
|
34
|
-
if (selectorKeys) {
|
|
35
|
-
for (const selectorKey of selectorKeys) {
|
|
36
|
-
const token =
|
|
37
|
-
target.selectors.get(selectorKey) ??
|
|
38
|
-
target.readonlySelectors.get(selectorKey)
|
|
39
|
-
if (token) {
|
|
40
|
-
disposeSelector(token, store)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
33
|
target.selectorAtoms.delete(key)
|
|
45
34
|
target.atomsThatAreDefault.delete(key)
|
|
46
35
|
target.timelineTopics.delete(key)
|
|
@@ -7,7 +7,11 @@ import type {
|
|
|
7
7
|
} from "atom.io"
|
|
8
8
|
import { parseJson, stringifyJson } from "atom.io/json"
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
disposeFromStore,
|
|
12
|
+
findInStore,
|
|
13
|
+
initFamilyMemberInStore,
|
|
14
|
+
} from "../families"
|
|
11
15
|
import { growMoleculeInStore, makeMoleculeInStore } from "../molecule"
|
|
12
16
|
import { type Store, withdraw } from "../store"
|
|
13
17
|
|
|
@@ -18,7 +22,7 @@ export function ingestCreationEvent(
|
|
|
18
22
|
): void {
|
|
19
23
|
switch (applying) {
|
|
20
24
|
case `newValue`: {
|
|
21
|
-
createInStore(update
|
|
25
|
+
createInStore(update, store)
|
|
22
26
|
break
|
|
23
27
|
}
|
|
24
28
|
case `oldValue`: {
|
|
@@ -29,7 +33,7 @@ export function ingestCreationEvent(
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
export function ingestDisposalEvent(
|
|
32
|
-
update: StateDisposal<any
|
|
36
|
+
update: StateDisposal<ReadableToken<any>>,
|
|
33
37
|
applying: `newValue` | `oldValue`,
|
|
34
38
|
store: Store,
|
|
35
39
|
): void {
|
|
@@ -39,35 +43,22 @@ export function ingestDisposalEvent(
|
|
|
39
43
|
break
|
|
40
44
|
}
|
|
41
45
|
case `oldValue`: {
|
|
42
|
-
createInStore(update
|
|
46
|
+
createInStore(update, store)
|
|
43
47
|
store.valueMap.set(update.token.key, update.value)
|
|
44
48
|
break
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
function createInStore(
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
function createInStore(
|
|
54
|
+
update: StateCreation<any> | StateDisposal<any>,
|
|
55
|
+
store: Store,
|
|
56
|
+
): void {
|
|
57
|
+
const { family: familyMeta } = update.token
|
|
58
|
+
if (familyMeta) {
|
|
59
|
+
const family = store.families.get(familyMeta.key)
|
|
52
60
|
if (family) {
|
|
53
|
-
|
|
54
|
-
if (molecule) {
|
|
55
|
-
growMoleculeInStore(molecule, family, store)
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
if (store.config.lifespan === `immortal`) {
|
|
59
|
-
store.logger.error(
|
|
60
|
-
`🐞`,
|
|
61
|
-
`atom`,
|
|
62
|
-
token.family.key,
|
|
63
|
-
`tried to create member`,
|
|
64
|
-
`"${token.family.subKey}"`,
|
|
65
|
-
`but a molecule with that key was not found in store`,
|
|
66
|
-
`"${store.config.name}"`,
|
|
67
|
-
)
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
initFamilyMemberInStore(store, family, parseJson(token.family.subKey))
|
|
61
|
+
findInStore(store, family, parseJson(familyMeta.subKey))
|
|
71
62
|
}
|
|
72
63
|
}
|
|
73
64
|
}
|
|
@@ -52,19 +52,6 @@ export function disposeSelector(
|
|
|
52
52
|
}
|
|
53
53
|
target.valueMap.delete(key)
|
|
54
54
|
target.selectorAtoms.delete(key)
|
|
55
|
-
const downstreamTokens = target.selectorGraph
|
|
56
|
-
.getRelationEntries({ upstreamSelectorKey: key })
|
|
57
|
-
.filter(([_, { source }]) => source === key)
|
|
58
|
-
.map(
|
|
59
|
-
([downstreamSelectorKey]) =>
|
|
60
|
-
target.selectors.get(downstreamSelectorKey) ??
|
|
61
|
-
target.readonlySelectors.get(downstreamSelectorKey),
|
|
62
|
-
)
|
|
63
|
-
for (const downstreamToken of downstreamTokens) {
|
|
64
|
-
if (downstreamToken) {
|
|
65
|
-
disposeSelector(downstreamToken, store)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
55
|
target.selectorGraph.delete(key)
|
|
69
56
|
store.logger.info(`🔥`, selectorToken.type, key, `deleted`)
|
|
70
57
|
if (isChildStore(target) && target.transactionMeta.phase === `building`) {
|
package/json/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createWritableSelectorFamily } from '../../dist/chunk-
|
|
1
|
+
import { createWritableSelectorFamily } from '../../dist/chunk-XPYU2HY2.js';
|
|
2
2
|
import '../../dist/chunk-IBTHB2PI.js';
|
|
3
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
4
4
|
import { createStandaloneSelector, IMPLICIT, growMoleculeInStore, initFamilyMemberInStore, withdraw, seekInStore } from 'atom.io/internal';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -52,23 +52,23 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@testing-library/react": "16.0.
|
|
55
|
+
"@testing-library/react": "16.0.1",
|
|
56
56
|
"@types/eslint": "9.6.1",
|
|
57
57
|
"@types/estree": "1.0.5",
|
|
58
58
|
"@types/http-proxy": "1.17.15",
|
|
59
59
|
"@types/npmlog": "7.0.0",
|
|
60
|
-
"@types/react": "18.3.
|
|
60
|
+
"@types/react": "18.3.5",
|
|
61
61
|
"@types/tmp": "0.2.6",
|
|
62
|
-
"@typescript-eslint/parser": "8.
|
|
63
|
-
"@typescript-eslint/rule-tester": "8.
|
|
62
|
+
"@typescript-eslint/parser": "8.4.0",
|
|
63
|
+
"@typescript-eslint/rule-tester": "8.4.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.2",
|
|
68
68
|
"drizzle-orm": "0.33.0",
|
|
69
69
|
"eslint": "9.9.1",
|
|
70
|
-
"framer-motion": "11.
|
|
71
|
-
"happy-dom": "15.
|
|
70
|
+
"framer-motion": "11.5.2",
|
|
71
|
+
"happy-dom": "15.7.3",
|
|
72
72
|
"http-proxy": "1.18.1",
|
|
73
73
|
"npmlog": "7.0.1",
|
|
74
74
|
"postgres": "3.4.4",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"tsup": "8.2.4",
|
|
83
83
|
"tsx": "4.19.0",
|
|
84
84
|
"typescript": "5.5.4",
|
|
85
|
-
"vite": "5.4.
|
|
85
|
+
"vite": "5.4.3",
|
|
86
86
|
"vite-tsconfig-paths": "5.0.1",
|
|
87
87
|
"vitest": "2.0.5"
|
|
88
88
|
},
|