atom.io 0.32.2 → 0.32.3
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/README.md +17 -37
- package/data/dist/index.js +1 -1
- package/dist/{chunk-YPME5OLO.js → chunk-2XDFCXGB.js} +1 -1
- package/dist/{chunk-RXQWAO26.js → chunk-35NB2XZU.js} +103 -109
- package/dist/{chunk-XN3EO2UT.js → chunk-EF4S7H42.js} +6 -3
- package/dist/{chunk-QRPY4LSO.js → chunk-LTLDKXDN.js} +3 -3
- package/dist/{chunk-HEEVASKG.js → chunk-MENOYVPP.js} +1 -1
- package/dist/{chunk-KMBRCA5Q.js → chunk-RGUNRT72.js} +33 -31
- package/dist/{chunk-NDTM5IY3.js → chunk-TS76LQVD.js} +2 -2
- package/dist/index.js +1 -1
- package/internal/dist/index.d.ts +7 -4
- package/internal/dist/index.js +1 -1
- package/internal/src/get-state/read-or-compute-value.ts +23 -13
- package/internal/src/index.ts +2 -1
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -12
- package/internal/src/reserved-keys.ts +7 -0
- package/internal/src/set-state/copy-mutable-if-needed.ts +12 -11
- package/internal/src/set-state/set-atom-or-selector.ts +1 -1
- package/internal/src/set-state/set-atom.ts +43 -21
- package/internal/src/store/store.ts +2 -1
- package/internal/src/transaction/get-epoch-number.ts +15 -19
- package/internal/src/transaction/set-epoch-number.ts +2 -2
- package/introspection/dist/index.js +2 -2
- package/introspection/src/attach-atom-index.ts +16 -14
- package/introspection/src/attach-selector-index.ts +16 -14
- package/json/dist/index.js +1 -1
- package/package.json +19 -17
- package/react/dist/index.js +2 -2
- package/react-devtools/dist/index.js +78 -66
- package/react-devtools/src/AtomIODevtools.tsx +10 -2
- package/react-devtools/src/error-boundary/ReactErrorBoundary.tsx +1 -1
- package/realtime/dist/index.js +2 -2
- package/realtime-client/dist/index.js +2 -2
- package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +5 -2
- package/realtime-react/dist/index.js +4 -4
- package/realtime-server/dist/index.js +3 -3
- package/realtime-testing/dist/index.js +6 -6
- package/transceivers/set-rtx/dist/index.js +1 -1
- package/internal/src/set-state/stow-update.ts +0 -60
package/README.md
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
<div align="center">
|
|
5
2
|
<picture>
|
|
6
3
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/jeremybanka/wayforge/main/packages/atom.io/__assets__/logo-dark-mode.png">
|
|
@@ -10,52 +7,35 @@
|
|
|
10
7
|
</div>
|
|
11
8
|
|
|
12
9
|
<h1 align="center">
|
|
13
|
-
atom.io
|
|
10
|
+
<code>atom.io</code>
|
|
14
11
|
</h1>
|
|
15
12
|
|
|
16
|
-
<h3 align="center">
|
|
17
|
-
Composable, high-performance reactivity for ECMAScript inspired by <a href="https://recoiljs.org/">Recoil</a> 💙
|
|
18
|
-
</h3>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<h3 align="center">
|
|
23
|
-
<a href="https://atom.io.fyi">📖 Read the docs at atom.io.fyi</a>
|
|
24
|
-
</h3>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
13
|
```shell
|
|
30
14
|
npm i atom.io
|
|
31
15
|
```
|
|
32
|
-
```shell
|
|
33
|
-
pnpm i atom.io
|
|
34
|
-
```
|
|
35
|
-
```shell
|
|
36
|
-
bun i atom.io
|
|
37
|
-
```
|
|
38
16
|
|
|
39
17
|
<p align="center">
|
|
40
|
-
<a href="https://
|
|
41
|
-
<img alt="
|
|
18
|
+
<a aria-label="NPM version" href="https://www.npmjs.com/package/atom.io">
|
|
19
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/atom.io?style=for-the-badge">
|
|
42
20
|
</a>
|
|
43
|
-
<a aria-label="
|
|
44
|
-
<img alt="
|
|
21
|
+
<a aria-label="Dependencies 0" href="https://www.npmjs.com/package/atom.io">
|
|
22
|
+
<img alt="Dependencies 0" src=" https://img.shields.io/badge/dependencies-0-0?style=for-the-badge">
|
|
45
23
|
</a>
|
|
46
|
-
<a aria-label="
|
|
47
|
-
<img alt="
|
|
24
|
+
<a aria-label="Types" href="https://www.npmjs.com/package/atom.io">
|
|
25
|
+
<img alt="Types" src="https://img.shields.io/npm/types/atom.io?style=for-the-badge">
|
|
48
26
|
</a>
|
|
49
|
-
<a
|
|
50
|
-
<img alt="
|
|
27
|
+
<a href="https://bundlephobia.com/result?p=atom.io">
|
|
28
|
+
<img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/atom.io?style=for-the-badge">
|
|
51
29
|
</a>
|
|
52
|
-
<a aria-label="Coverage" href="https://
|
|
53
|
-
<img alt="Coverage" src="https://img.shields.io/
|
|
30
|
+
<a aria-label="Coverage" href="https://recoverage.cloud/">
|
|
31
|
+
<img alt="Coverage" src="https://img.shields.io/endpoint?url=https%3A%2F%2Frecoverage.cloud%2Fshields%2FS1ikz1yFmk93qbAI7lLnu%2Fatom.io">
|
|
54
32
|
</a>
|
|
55
|
-
|
|
56
33
|
</p>
|
|
57
34
|
|
|
35
|
+
<h3 align="center">
|
|
36
|
+
Composable, high-performance reactivity for ECMAScript inspired by <a href="https://recoiljs.org/">Recoil</a> 💙
|
|
37
|
+
</h3>
|
|
58
38
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
<h3 align="center">
|
|
40
|
+
<a href="https://atom.io.fyi">📖 Read the docs at atom.io.fyi</a>
|
|
41
|
+
</h3>
|
package/data/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, createStandaloneSelector, findInStore, capitalize, createRegularAtom, createRegularAtomFamily, createSelectorFamily } from '../../dist/chunk-
|
|
1
|
+
import { IMPLICIT, createStandaloneSelector, findInStore, capitalize, createRegularAtom, createRegularAtomFamily, createSelectorFamily } from '../../dist/chunk-35NB2XZU.js';
|
|
2
2
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
3
3
|
|
|
4
4
|
// data/src/dict.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { atom, SetRTX, join, selectorFamily, getInternalRelations, assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from './chunk-
|
|
1
|
+
import { atom, SetRTX, join, selectorFamily, getInternalRelations, assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from './chunk-35NB2XZU.js';
|
|
2
2
|
|
|
3
3
|
// realtime/src/realtime-continuity.ts
|
|
4
4
|
var InvariantMap = class extends Map {
|
|
@@ -362,19 +362,30 @@ var readOrComputeValue = (target, state) => {
|
|
|
362
362
|
target.logger.info(`\u{1F4D6}`, state.type, state.key, `reading cached value`);
|
|
363
363
|
return readCachedValue(state, target);
|
|
364
364
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
switch (state.type) {
|
|
366
|
+
case `selector`:
|
|
367
|
+
case `readonly_selector`:
|
|
368
|
+
target.logger.info(`\u{1F9EE}`, state.type, state.key, `computing value`);
|
|
369
|
+
return state.get();
|
|
370
|
+
case `atom`:
|
|
371
|
+
case `mutable_atom`: {
|
|
372
|
+
const def = state.default;
|
|
373
|
+
let fallback;
|
|
374
|
+
if (def instanceof Function) {
|
|
375
|
+
fallback = def();
|
|
376
|
+
} else {
|
|
377
|
+
fallback = def;
|
|
378
|
+
}
|
|
379
|
+
target.logger.info(
|
|
380
|
+
`\u{1F481}`,
|
|
381
|
+
`atom`,
|
|
382
|
+
state.key,
|
|
383
|
+
`could not find cached value; using default`,
|
|
384
|
+
fallback
|
|
385
|
+
);
|
|
386
|
+
return fallback;
|
|
387
|
+
}
|
|
368
388
|
}
|
|
369
|
-
const fallback = state.default instanceof Function ? state.default() : state.default;
|
|
370
|
-
target.logger.info(
|
|
371
|
-
`\u{1F481}`,
|
|
372
|
-
`atom`,
|
|
373
|
-
state.key,
|
|
374
|
-
`could not find cached value; using default`,
|
|
375
|
-
fallback
|
|
376
|
-
);
|
|
377
|
-
return state.default instanceof Function ? state.default() : state.default;
|
|
378
389
|
};
|
|
379
390
|
|
|
380
391
|
// internal/src/operation.ts
|
|
@@ -502,55 +513,8 @@ var evictDownStream = (store, atom2) => {
|
|
|
502
513
|
}
|
|
503
514
|
};
|
|
504
515
|
|
|
505
|
-
// internal/src/set-state/stow-update.ts
|
|
506
|
-
function shouldUpdateBeStowed(key, update) {
|
|
507
|
-
if (isTransceiver(update.newValue)) {
|
|
508
|
-
return false;
|
|
509
|
-
}
|
|
510
|
-
if (key.includes(`\u{1F50D}`)) {
|
|
511
|
-
return false;
|
|
512
|
-
}
|
|
513
|
-
return true;
|
|
514
|
-
}
|
|
515
|
-
var stowUpdate = (store, state, update) => {
|
|
516
|
-
const { key } = state;
|
|
517
|
-
const target = newest(store);
|
|
518
|
-
if (!isChildStore(target) || target.transactionMeta.phase !== `building`) {
|
|
519
|
-
store.logger.error(
|
|
520
|
-
`\u{1F41E}`,
|
|
521
|
-
`atom`,
|
|
522
|
-
key,
|
|
523
|
-
`stowUpdate called outside of a transaction. This is probably a bug.`
|
|
524
|
-
);
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
const shouldStow = shouldUpdateBeStowed(key, update);
|
|
528
|
-
if (!shouldStow) {
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
const atomUpdate = {
|
|
532
|
-
type: `atom_update`,
|
|
533
|
-
key,
|
|
534
|
-
...update
|
|
535
|
-
};
|
|
536
|
-
if (state.family) {
|
|
537
|
-
atomUpdate.family = state.family;
|
|
538
|
-
}
|
|
539
|
-
target.transactionMeta.update.updates.push(atomUpdate);
|
|
540
|
-
store.logger.info(
|
|
541
|
-
`\u{1F4C1}`,
|
|
542
|
-
`atom`,
|
|
543
|
-
key,
|
|
544
|
-
`stowed (`,
|
|
545
|
-
update.oldValue,
|
|
546
|
-
`->`,
|
|
547
|
-
update.newValue,
|
|
548
|
-
`)`
|
|
549
|
-
);
|
|
550
|
-
};
|
|
551
|
-
|
|
552
516
|
// internal/src/set-state/set-atom.ts
|
|
553
|
-
var setAtom = (atom2, next
|
|
517
|
+
var setAtom = (target, atom2, next) => {
|
|
554
518
|
const oldValue = readOrComputeValue(target, atom2);
|
|
555
519
|
let newValue = oldValue;
|
|
556
520
|
if (atom2.type === `mutable_atom` && isChildStore(target)) {
|
|
@@ -567,23 +531,45 @@ var setAtom = (atom2, next, target) => {
|
|
|
567
531
|
markDone(target, atom2.key);
|
|
568
532
|
evictDownStream(target, atom2);
|
|
569
533
|
const update = { oldValue, newValue };
|
|
570
|
-
if (
|
|
534
|
+
if (!isChildStore(target)) {
|
|
571
535
|
emitUpdate(target, atom2, update);
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
let transceiver = target.valueMap.get(mutableKey);
|
|
579
|
-
if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
|
|
580
|
-
const { parent } = target;
|
|
581
|
-
const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent);
|
|
582
|
-
transceiver = copiedValue;
|
|
583
|
-
}
|
|
584
|
-
const accepted = transceiver.do(update.newValue) === null;
|
|
585
|
-
if (accepted) evictDownStream(target, mutableAtom);
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (target.on.transactionApplying.state === null) {
|
|
539
|
+
const { key } = atom2;
|
|
540
|
+
if (isTransceiver(update.newValue)) {
|
|
541
|
+
return;
|
|
586
542
|
}
|
|
543
|
+
const atomUpdate = {
|
|
544
|
+
type: `atom_update`,
|
|
545
|
+
key,
|
|
546
|
+
...update
|
|
547
|
+
};
|
|
548
|
+
if (atom2.family) {
|
|
549
|
+
atomUpdate.family = atom2.family;
|
|
550
|
+
}
|
|
551
|
+
target.transactionMeta.update.updates.push(atomUpdate);
|
|
552
|
+
target.logger.info(
|
|
553
|
+
`\u{1F4C1}`,
|
|
554
|
+
`atom`,
|
|
555
|
+
key,
|
|
556
|
+
`stowed (`,
|
|
557
|
+
update.oldValue,
|
|
558
|
+
`->`,
|
|
559
|
+
update.newValue,
|
|
560
|
+
`)`
|
|
561
|
+
);
|
|
562
|
+
} else if (atom2.key.startsWith(`*`)) {
|
|
563
|
+
const mutableKey = atom2.key.slice(1);
|
|
564
|
+
const mutableAtom = target.atoms.get(mutableKey);
|
|
565
|
+
let transceiver = target.valueMap.get(mutableKey);
|
|
566
|
+
if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
|
|
567
|
+
const { parent } = target;
|
|
568
|
+
const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent);
|
|
569
|
+
transceiver = copiedValue;
|
|
570
|
+
}
|
|
571
|
+
const accepted = transceiver.do(update.newValue) === null;
|
|
572
|
+
if (accepted) evictDownStream(target, mutableAtom);
|
|
587
573
|
}
|
|
588
574
|
};
|
|
589
575
|
|
|
@@ -592,7 +578,7 @@ var setAtomOrSelector = (store, state, value) => {
|
|
|
592
578
|
switch (state.type) {
|
|
593
579
|
case `atom`:
|
|
594
580
|
case `mutable_atom`:
|
|
595
|
-
setAtom(state, value
|
|
581
|
+
setAtom(store, state, value);
|
|
596
582
|
break;
|
|
597
583
|
case `selector`:
|
|
598
584
|
state.set(value);
|
|
@@ -1661,6 +1647,27 @@ function ingestTransactionUpdate(applying, transactionUpdate, store) {
|
|
|
1661
1647
|
}
|
|
1662
1648
|
}
|
|
1663
1649
|
|
|
1650
|
+
// internal/src/transaction/get-epoch-number.ts
|
|
1651
|
+
function getContinuityKey(store, transactionKey) {
|
|
1652
|
+
const continuity = store.transactionMeta.actionContinuities.getRelatedKey(transactionKey);
|
|
1653
|
+
return continuity;
|
|
1654
|
+
}
|
|
1655
|
+
function getEpochNumberOfContinuity(store, continuityKey) {
|
|
1656
|
+
const epoch = store.transactionMeta.epoch.get(continuityKey);
|
|
1657
|
+
return epoch;
|
|
1658
|
+
}
|
|
1659
|
+
function getEpochNumberOfAction(store, transactionKey) {
|
|
1660
|
+
const isRoot = isRootStore(store);
|
|
1661
|
+
if (!isRoot) {
|
|
1662
|
+
return void 0;
|
|
1663
|
+
}
|
|
1664
|
+
const continuityKey = getContinuityKey(store, transactionKey);
|
|
1665
|
+
if (continuityKey === void 0) {
|
|
1666
|
+
return void 0;
|
|
1667
|
+
}
|
|
1668
|
+
return getEpochNumberOfContinuity(store, continuityKey);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1664
1671
|
// internal/src/transaction/set-epoch-number.ts
|
|
1665
1672
|
function setEpochNumberOfContinuity(store, continuityKey, newEpoch) {
|
|
1666
1673
|
const isRoot = isRootStore(store);
|
|
@@ -1673,7 +1680,7 @@ function setEpochNumberOfAction(store, transactionKey, newEpoch) {
|
|
|
1673
1680
|
if (!isRoot) {
|
|
1674
1681
|
return;
|
|
1675
1682
|
}
|
|
1676
|
-
const continuityKey = store
|
|
1683
|
+
const continuityKey = getContinuityKey(store, transactionKey);
|
|
1677
1684
|
if (continuityKey !== void 0) {
|
|
1678
1685
|
store.transactionMeta.epoch.set(continuityKey, newEpoch);
|
|
1679
1686
|
}
|
|
@@ -2249,24 +2256,6 @@ function createTransaction(store, options) {
|
|
|
2249
2256
|
return token;
|
|
2250
2257
|
}
|
|
2251
2258
|
|
|
2252
|
-
// internal/src/transaction/get-epoch-number.ts
|
|
2253
|
-
function getContinuityKey(store, transactionKey) {
|
|
2254
|
-
const isRoot = isRootStore(store);
|
|
2255
|
-
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
|
|
2256
|
-
return continuity;
|
|
2257
|
-
}
|
|
2258
|
-
function getEpochNumberOfContinuity(store, continuityKey) {
|
|
2259
|
-
const isRoot = isRootStore(store);
|
|
2260
|
-
const epoch = isRoot && continuityKey ? store.transactionMeta.epoch.get(continuityKey) : void 0;
|
|
2261
|
-
return epoch;
|
|
2262
|
-
}
|
|
2263
|
-
function getEpochNumberOfAction(store, transactionKey) {
|
|
2264
|
-
const isRoot = isRootStore(store);
|
|
2265
|
-
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
|
|
2266
|
-
const epoch = isRoot && continuity !== void 0 ? store.transactionMeta.epoch.get(continuity) : void 0;
|
|
2267
|
-
return epoch;
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
2259
|
// internal/src/transaction/index.ts
|
|
2271
2260
|
var TRANSACTION_PHASES = [`idle`, `building`, `applying`];
|
|
2272
2261
|
|
|
@@ -2471,7 +2460,7 @@ var Store = class {
|
|
|
2471
2460
|
lifespan: `ephemeral`
|
|
2472
2461
|
};
|
|
2473
2462
|
loggers = [
|
|
2474
|
-
new AtomIOLogger(`warn`, (_, __, key) => !key
|
|
2463
|
+
new AtomIOLogger(`warn`, (_, __, key) => !isReservedIntrospectionKey(key))
|
|
2475
2464
|
];
|
|
2476
2465
|
logger = {
|
|
2477
2466
|
error: (...messages) => {
|
|
@@ -3100,18 +3089,18 @@ function isTransceiver(value) {
|
|
|
3100
3089
|
function copyMutableIfNeeded(target, atom2, origin) {
|
|
3101
3090
|
const originValue = origin.valueMap.get(atom2.key);
|
|
3102
3091
|
const targetValue = target.valueMap.get(atom2.key);
|
|
3103
|
-
if (originValue
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
return
|
|
3092
|
+
if (originValue !== targetValue) {
|
|
3093
|
+
return targetValue;
|
|
3094
|
+
}
|
|
3095
|
+
if (originValue === void 0) {
|
|
3096
|
+
return atom2.default();
|
|
3097
|
+
}
|
|
3098
|
+
origin.logger.info(`\u{1F4C3}`, `atom`, atom2.key, `copying`);
|
|
3099
|
+
const jsonValue = atom2.toJson(originValue);
|
|
3100
|
+
const copiedValue = atom2.fromJson(jsonValue);
|
|
3101
|
+
target.valueMap.set(atom2.key, copiedValue);
|
|
3102
|
+
new Tracker(atom2, origin);
|
|
3103
|
+
return copiedValue;
|
|
3115
3104
|
}
|
|
3116
3105
|
|
|
3117
3106
|
// internal/src/caching.ts
|
|
@@ -4039,6 +4028,11 @@ function getInternalRelationsFromStore(token, store) {
|
|
|
4039
4028
|
return family;
|
|
4040
4029
|
}
|
|
4041
4030
|
|
|
4031
|
+
// internal/src/reserved-keys.ts
|
|
4032
|
+
function isReservedIntrospectionKey(value) {
|
|
4033
|
+
return value.startsWith(`\u{1F50D} `);
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4042
4036
|
// internal/src/timeline/create-timeline.ts
|
|
4043
4037
|
function createTimeline(store, options, data) {
|
|
4044
4038
|
const tl = {
|
|
@@ -4504,4 +4498,4 @@ var JSON_DEFAULTS = {
|
|
|
4504
4498
|
string: ``
|
|
4505
4499
|
};
|
|
4506
4500
|
|
|
4507
|
-
export { $claim, Anarchy, AtomIOLogger, CircularBuffer, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, JSON_DEFAULTS, JSON_TYPE_NAMES, Join, Junction, LOG_LEVELS, LazyMap, NotFoundError, Realm, SetRTX, Silo, StatefulSubject, Store, Subject, T$, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, atom, atomFamily, become, belongsTo, buildTransaction, cacheValue, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, disposeState, editRelations, editRelationsInStore, evictCachedValue, findInStore, findRelations, findRelationsInStore, findState, fromEntries, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelations, getInternalRelationsFromStore, getJoin, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getState, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isJson, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isToken, isTransceiver, join, makeRootMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, parseJson, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, redo, registerSelector, runTransaction, seekInStore, selectJson, selectJsonFamily, selector, selectorFamily, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, setState, simpleLog, simpleLogger, stringifyJson, subscribe, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, timeline, toEntries, traceAllSelectorAtoms, traceSelectorAtoms, transaction, undo, updateSelectorAtoms, withdraw };
|
|
4501
|
+
export { $claim, Anarchy, AtomIOLogger, CircularBuffer, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, JSON_DEFAULTS, JSON_TYPE_NAMES, Join, Junction, LOG_LEVELS, LazyMap, NotFoundError, Realm, SetRTX, Silo, StatefulSubject, Store, Subject, T$, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, atom, atomFamily, become, belongsTo, buildTransaction, cacheValue, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, disposeState, editRelations, editRelationsInStore, evictCachedValue, findInStore, findRelations, findRelationsInStore, findState, fromEntries, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelations, getInternalRelationsFromStore, getJoin, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getState, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isJson, isReadonlySelectorKey, isReservedIntrospectionKey, isRootStore, isSelectorKey, isStateKey, isToken, isTransceiver, join, makeRootMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, parseJson, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, redo, registerSelector, runTransaction, seekInStore, selectJson, selectJsonFamily, selector, selectorFamily, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, setState, simpleLog, simpleLogger, stringifyJson, subscribe, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, timeline, toEntries, traceAllSelectorAtoms, traceSelectorAtoms, transaction, undo, updateSelectorAtoms, withdraw };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { persistSync } from './chunk-4LWKCEW3.js';
|
|
2
|
-
import { atom, selector, setIntoStore,
|
|
2
|
+
import { atom, selector, setIntoStore, isRootStore, getEpochNumberOfContinuity, ingestTransactionUpdate, setEpochNumberOfContinuity, disposeAtom, parseJson, getJsonToken, getUpdateToken, subscribeToState, subscribeToTransaction, getFromStore, assignTransactionToContinuity, actUponStore } from './chunk-35NB2XZU.js';
|
|
3
3
|
|
|
4
4
|
// realtime-client/src/continuity/register-and-attempt-confirmed-update.ts
|
|
5
5
|
var useRegisterAndAttemptConfirmedUpdate = (store, continuityKey, socket, optimisticUpdates, confirmedUpdates) => (confirmed) => {
|
|
@@ -150,9 +150,12 @@ var useRegisterAndAttemptConfirmedUpdate = (store, continuityKey, socket, optimi
|
|
|
150
150
|
continuityKey,
|
|
151
151
|
`has no optimistic updates to deal with`
|
|
152
152
|
);
|
|
153
|
-
const continuityEpoch = getEpochNumberOfContinuity(store, continuityKey);
|
|
154
153
|
const isRoot = isRootStore(store);
|
|
155
|
-
|
|
154
|
+
let continuityEpoch;
|
|
155
|
+
if (isRoot) {
|
|
156
|
+
continuityEpoch = getEpochNumberOfContinuity(store, continuityKey);
|
|
157
|
+
}
|
|
158
|
+
if (continuityEpoch === confirmed.epoch - 1) {
|
|
156
159
|
store.logger.info(
|
|
157
160
|
`\u2705`,
|
|
158
161
|
`continuity`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { myIdState__INTERNAL, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity } from './chunk-
|
|
2
|
-
import { useI, StoreContext, useO } from './chunk-
|
|
3
|
-
import { findInStore, actUponStore, arbitrary } from './chunk-
|
|
1
|
+
import { myIdState__INTERNAL, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity } from './chunk-EF4S7H42.js';
|
|
2
|
+
import { useI, StoreContext, useO } from './chunk-MENOYVPP.js';
|
|
3
|
+
import { findInStore, actUponStore, arbitrary } from './chunk-35NB2XZU.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, setIntoStore, subscribeToState, getFromStore, findInStore, getJsonToken, withdraw, subscribeToTimeline, redo, undo } from './chunk-
|
|
1
|
+
import { IMPLICIT, setIntoStore, subscribeToState, getFromStore, findInStore, getJsonToken, withdraw, subscribeToTimeline, redo, undo } from './chunk-35NB2XZU.js';
|
|
2
2
|
import * as React5 from 'react';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, getState, createReadonlySelectorFamily, createRegularAtomFamily, Subject, createSelectorFamily, createRegularAtom, createStandaloneSelector, deposit } from './chunk-
|
|
1
|
+
import { IMPLICIT, getState, createReadonlySelectorFamily, createRegularAtomFamily, Subject, createSelectorFamily, createRegularAtom, createStandaloneSelector, isReservedIntrospectionKey, deposit } from './chunk-35NB2XZU.js';
|
|
2
2
|
|
|
3
3
|
// introspection/src/attach-atom-index.ts
|
|
4
4
|
var attachAtomIndex = (store) => {
|
|
@@ -9,21 +9,22 @@ var attachAtomIndex = (store) => {
|
|
|
9
9
|
default: () => {
|
|
10
10
|
const base = /* @__PURE__ */ new Map();
|
|
11
11
|
for (const [key, val] of store.atoms) {
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
} else {
|
|
25
|
-
base.set(key, token);
|
|
12
|
+
if (isReservedIntrospectionKey(key)) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const token = deposit(val);
|
|
16
|
+
if (val.family) {
|
|
17
|
+
let familyNode = base.get(val.family.key);
|
|
18
|
+
if (!familyNode || !(`familyMembers` in familyNode)) {
|
|
19
|
+
familyNode = {
|
|
20
|
+
key: val.family.key,
|
|
21
|
+
familyMembers: /* @__PURE__ */ new Map()
|
|
22
|
+
};
|
|
23
|
+
base.set(val.family.key, familyNode);
|
|
26
24
|
}
|
|
25
|
+
familyNode.familyMembers.set(val.family.subKey, token);
|
|
26
|
+
} else {
|
|
27
|
+
base.set(key, token);
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
return base;
|
|
@@ -31,7 +32,7 @@ var attachAtomIndex = (store) => {
|
|
|
31
32
|
effects: [
|
|
32
33
|
({ setSelf }) => {
|
|
33
34
|
store.on.atomCreation.subscribe(`introspection`, (atomToken) => {
|
|
34
|
-
if (atomToken.key
|
|
35
|
+
if (isReservedIntrospectionKey(atomToken.key)) {
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
setSelf((self) => {
|
|
@@ -90,21 +91,22 @@ var attachSelectorIndex = (store) => {
|
|
|
90
91
|
const base = /* @__PURE__ */ new Map();
|
|
91
92
|
for (const map of [store.readonlySelectors, store.selectors]) {
|
|
92
93
|
for (const [key, val] of map) {
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
} else {
|
|
106
|
-
base.set(key, token);
|
|
94
|
+
if (isReservedIntrospectionKey(key)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const token = deposit(val);
|
|
98
|
+
if (val.family) {
|
|
99
|
+
let familyNode = base.get(val.family.key);
|
|
100
|
+
if (!familyNode || !(`familyMembers` in familyNode)) {
|
|
101
|
+
familyNode = {
|
|
102
|
+
key: val.family.key,
|
|
103
|
+
familyMembers: /* @__PURE__ */ new Map()
|
|
104
|
+
};
|
|
105
|
+
base.set(val.family.key, familyNode);
|
|
107
106
|
}
|
|
107
|
+
familyNode.familyMembers.set(val.family.subKey, token);
|
|
108
|
+
} else {
|
|
109
|
+
base.set(key, token);
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -115,7 +117,7 @@ var attachSelectorIndex = (store) => {
|
|
|
115
117
|
store.on.selectorCreation.subscribe(
|
|
116
118
|
`introspection`,
|
|
117
119
|
(selectorToken) => {
|
|
118
|
-
if (selectorToken.key
|
|
120
|
+
if (isReservedIntrospectionKey(selectorToken.key)) {
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
123
|
setSelf((self) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { roomIndex, usersInRooms } from './chunk-
|
|
2
|
-
import { atomFamily, selectorFamily, transaction, editRelationsInStore, atom, SetRTX, join, parseJson, Subject, stringifyJson, findRelationsInStore, IMPLICIT, getFromStore, subscribeToState, findInStore, getJsonToken, getUpdateToken, actUponStore, setIntoStore, subscribeToTransaction, isRootStore } from './chunk-
|
|
1
|
+
import { roomIndex, usersInRooms } from './chunk-2XDFCXGB.js';
|
|
2
|
+
import { atomFamily, selectorFamily, transaction, editRelationsInStore, atom, SetRTX, join, parseJson, Subject, stringifyJson, findRelationsInStore, IMPLICIT, getFromStore, subscribeToState, findInStore, getJsonToken, getUpdateToken, actUponStore, setIntoStore, subscribeToTransaction, isRootStore } from './chunk-35NB2XZU.js';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
|
|
5
5
|
// realtime-server/src/ipc-sockets/custom-socket.ts
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { $claim, Anarchy, AtomIOLogger, LOG_LEVELS, Realm, Silo, T$, atom, atomFamily, belongsTo, disposeState, editRelations, findRelations, findState, getInternalRelations, getState, isToken, join, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo } from './chunk-
|
|
1
|
+
export { $claim, Anarchy, AtomIOLogger, LOG_LEVELS, Realm, Silo, T$, atom, atomFamily, belongsTo, disposeState, editRelations, findRelations, findState, getInternalRelations, getState, isToken, join, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo } from './chunk-35NB2XZU.js';
|
|
2
2
|
import './chunk-XWL6SNVU.js';
|
package/internal/dist/index.d.ts
CHANGED
|
@@ -185,8 +185,8 @@ type Transaction<F extends Func> = {
|
|
|
185
185
|
};
|
|
186
186
|
declare function createTransaction<F extends Func>(store: Store, options: TransactionOptions<F>): TransactionToken<F>;
|
|
187
187
|
|
|
188
|
-
declare function getContinuityKey(store:
|
|
189
|
-
declare function getEpochNumberOfContinuity(store:
|
|
188
|
+
declare function getContinuityKey(store: RootStore, transactionKey: string): string | undefined;
|
|
189
|
+
declare function getEpochNumberOfContinuity(store: RootStore, continuityKey: string): number | undefined;
|
|
190
190
|
declare function getEpochNumberOfAction(store: Store, transactionKey: string): number | undefined;
|
|
191
191
|
|
|
192
192
|
declare function setEpochNumberOfContinuity(store: Store, continuityKey: string, newEpoch: number): void;
|
|
@@ -638,6 +638,9 @@ declare class NotFoundError extends Error {
|
|
|
638
638
|
|
|
639
639
|
declare function prettyPrintTokenType(token: AtomIOToken): string;
|
|
640
640
|
|
|
641
|
+
type ReservedIntrospectionKey = `🔍 ${string}`;
|
|
642
|
+
declare function isReservedIntrospectionKey(value: string): value is ReservedIntrospectionKey;
|
|
643
|
+
|
|
641
644
|
declare const createReadonlySelector: <T>(store: Store, options: ReadonlySelectorOptions<T>, family: FamilyMetadata | undefined) => ReadonlySelectorToken<T>;
|
|
642
645
|
|
|
643
646
|
declare function createStandaloneSelector<T>(store: Store, options: WritableSelectorOptions<T>): WritableSelectorToken<T>;
|
|
@@ -695,7 +698,7 @@ type RegularAtom<T> = AtomIOState & {
|
|
|
695
698
|
};
|
|
696
699
|
type MutableAtom<T extends Transceiver<any>, J extends Json.Serializable> = AtomIOState & JsonInterface<T, J> & {
|
|
697
700
|
type: `mutable_atom`;
|
|
698
|
-
default:
|
|
701
|
+
default: () => T;
|
|
699
702
|
cleanup?: () => void;
|
|
700
703
|
};
|
|
701
704
|
type Atom<T> = RegularAtom<T> | (T extends Transceiver<any> ? MutableAtom<T, any> : never);
|
|
@@ -741,4 +744,4 @@ type WritableFamily<T, K extends Canonical> = AtomFamily<T, K> | WritableSelecto
|
|
|
741
744
|
type ReadableFamily<T, K extends Canonical> = AtomFamily<T, K> | SelectorFamily<T, K>;
|
|
742
745
|
type AtomIOInternalResource = ReadableFamily<any, any> | ReadableState<any> | Timeline<any> | Transaction<any>;
|
|
743
746
|
|
|
744
|
-
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, Join, type JoinStateFamilies, 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, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, editRelationsInStore, evictCachedValue, findInStore, findRelationsInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelationsFromStore, getJoin, 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 };
|
|
747
|
+
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, Join, type JoinStateFamilies, 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 ReservedIntrospectionKey, 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, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, editRelationsInStore, evictCachedValue, findInStore, findRelationsInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelationsFromStore, getJoin, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isReservedIntrospectionKey, 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,2 +1,2 @@
|
|
|
1
|
-
export { CircularBuffer, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, Join, Junction, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, editRelationsInStore, evictCachedValue, findInStore, findRelationsInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelationsFromStore, getJoin, 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-
|
|
1
|
+
export { CircularBuffer, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, Join, Junction, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, editRelationsInStore, evictCachedValue, findInStore, findRelationsInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelationsFromStore, getJoin, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isReservedIntrospectionKey, 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-35NB2XZU.js';
|
|
2
2
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
@@ -10,18 +10,28 @@ export const readOrComputeValue = <T>(
|
|
|
10
10
|
target.logger.info(`📖`, state.type, state.key, `reading cached value`)
|
|
11
11
|
return readCachedValue(state, target)
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
switch (state.type) {
|
|
14
|
+
case `selector`:
|
|
15
|
+
case `readonly_selector`:
|
|
16
|
+
target.logger.info(`🧮`, state.type, state.key, `computing value`)
|
|
17
|
+
return state.get()
|
|
18
|
+
case `atom`:
|
|
19
|
+
case `mutable_atom`: {
|
|
20
|
+
const def = state.default
|
|
21
|
+
let fallback: T
|
|
22
|
+
if (def instanceof Function) {
|
|
23
|
+
fallback = def()
|
|
24
|
+
} else {
|
|
25
|
+
fallback = def
|
|
26
|
+
}
|
|
27
|
+
target.logger.info(
|
|
28
|
+
`💁`,
|
|
29
|
+
`atom`,
|
|
30
|
+
state.key,
|
|
31
|
+
`could not find cached value; using default`,
|
|
32
|
+
fallback,
|
|
33
|
+
)
|
|
34
|
+
return fallback
|
|
35
|
+
}
|
|
16
36
|
}
|
|
17
|
-
const fallback =
|
|
18
|
-
state.default instanceof Function ? state.default() : state.default
|
|
19
|
-
target.logger.info(
|
|
20
|
-
`💁`,
|
|
21
|
-
`atom`,
|
|
22
|
-
state.key,
|
|
23
|
-
`could not find cached value; using default`,
|
|
24
|
-
fallback,
|
|
25
|
-
)
|
|
26
|
-
return state.default instanceof Function ? state.default() : state.default
|
|
27
37
|
}
|