atom.io 0.32.2 → 0.32.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/README.md +17 -37
- package/data/dist/index.js +1 -1
- package/data/src/struct.ts +1 -0
- package/dist/{chunk-RXQWAO26.js → chunk-7SJVR7FZ.js} +111 -119
- package/dist/{chunk-XN3EO2UT.js → chunk-IR77IXS7.js} +6 -3
- package/dist/{chunk-NDTM5IY3.js → chunk-PG57JXN4.js} +2 -2
- package/dist/{chunk-QRPY4LSO.js → chunk-PXB4YZDI.js} +4 -4
- package/dist/{chunk-KMBRCA5Q.js → chunk-Q6OOJWM4.js} +33 -31
- package/dist/{chunk-HEEVASKG.js → chunk-TJPLOX7Z.js} +4 -6
- package/dist/{chunk-YPME5OLO.js → chunk-U4K63VLA.js} +1 -1
- package/dist/index.js +1 -1
- package/eslint-plugin/dist/index.d.ts +2 -15
- package/internal/dist/index.d.ts +10 -4
- package/internal/dist/index.js +1 -1
- package/internal/src/families/create-writable-selector-family.ts +4 -2
- 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/join/find-relations-in-store.ts +12 -0
- package/internal/src/reserved-keys.ts +7 -0
- package/internal/src/selector/register-selector.ts +2 -1
- 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 +11 -8
- package/internal/src/transaction/build-transaction.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 +26 -24
- package/react/dist/index.js +2 -2
- package/react/src/use-i.ts +3 -5
- package/react-devtools/dist/index.d.ts +12 -3
- package/react-devtools/dist/index.js +80 -68
- package/react-devtools/src/AtomIODevtools.tsx +10 -2
- package/react-devtools/src/error-boundary/ReactErrorBoundary.tsx +1 -1
- package/react-devtools/src/json-editor/developer-interface.tsx +2 -2
- package/react-devtools/src/json-editor/editors-by-type/utilities/cast-json.ts +2 -2
- package/react-devtools/src/json-editor/editors-by-type/utilities/object-properties.ts +3 -3
- package/react-devtools/src/json-editor/index.ts +2 -5
- package/react-devtools/src/json-editor/json-editor-internal.tsx +4 -2
- 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-react/src/use-single-effect.ts +2 -1
- package/realtime-server/dist/index.js +3 -3
- package/realtime-server/src/ipc-sockets/child-socket.ts +1 -1
- 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-7SJVR7FZ.js';
|
|
2
2
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
3
3
|
|
|
4
4
|
// data/src/dict.ts
|
package/data/src/struct.ts
CHANGED
|
@@ -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);
|
|
@@ -812,7 +798,7 @@ var registerSelector = (selectorKey, covered, store) => ({
|
|
|
812
798
|
const state = withdraw(target, token);
|
|
813
799
|
setAtomOrSelector(target, state, value);
|
|
814
800
|
},
|
|
815
|
-
find: (
|
|
801
|
+
find: (...args) => findInStore(store, ...args),
|
|
816
802
|
json: (token) => getJsonToken(store, token)
|
|
817
803
|
});
|
|
818
804
|
|
|
@@ -1084,8 +1070,8 @@ function createWritableSelectorFamily(store, options, internalRoles) {
|
|
|
1084
1070
|
default: (key) => {
|
|
1085
1071
|
const getFn = options.get(key);
|
|
1086
1072
|
return getFn({
|
|
1087
|
-
get: (...
|
|
1088
|
-
find: (
|
|
1073
|
+
get: (...args) => getFromStore(store, ...args),
|
|
1074
|
+
find: (...args) => findInStore(store, ...args),
|
|
1089
1075
|
json: (token) => getJsonToken(store, token)
|
|
1090
1076
|
});
|
|
1091
1077
|
}
|
|
@@ -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
|
}
|
|
@@ -2198,7 +2205,7 @@ var buildTransaction = (store, key, params, id) => {
|
|
|
2198
2205
|
setIntoStore(child, ...ps);
|
|
2199
2206
|
},
|
|
2200
2207
|
run: (token, identifier = arbitrary()) => actUponStore(child, token, identifier),
|
|
2201
|
-
find: (
|
|
2208
|
+
find: (...ps) => findInStore(store, ...ps),
|
|
2202
2209
|
json: (token) => getJsonToken(child, token),
|
|
2203
2210
|
dispose: (...ps) => {
|
|
2204
2211
|
disposeFromStore(child, ...ps);
|
|
@@ -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) => {
|
|
@@ -2539,12 +2528,10 @@ var Store = class {
|
|
|
2539
2528
|
};
|
|
2540
2529
|
var IMPLICIT = {
|
|
2541
2530
|
get STORE() {
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
});
|
|
2547
|
-
}
|
|
2531
|
+
globalThis.ATOM_IO_IMPLICIT_STORE ??= new Store({
|
|
2532
|
+
name: `IMPLICIT_STORE`,
|
|
2533
|
+
lifespan: `ephemeral`
|
|
2534
|
+
});
|
|
2548
2535
|
return globalThis.ATOM_IO_IMPLICIT_STORE;
|
|
2549
2536
|
}
|
|
2550
2537
|
};
|
|
@@ -3100,18 +3087,18 @@ function isTransceiver(value) {
|
|
|
3100
3087
|
function copyMutableIfNeeded(target, atom2, origin) {
|
|
3101
3088
|
const originValue = origin.valueMap.get(atom2.key);
|
|
3102
3089
|
const targetValue = target.valueMap.get(atom2.key);
|
|
3103
|
-
if (originValue
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
return
|
|
3090
|
+
if (originValue !== targetValue) {
|
|
3091
|
+
return targetValue;
|
|
3092
|
+
}
|
|
3093
|
+
if (originValue === void 0) {
|
|
3094
|
+
return atom2.default();
|
|
3095
|
+
}
|
|
3096
|
+
origin.logger.info(`\u{1F4C3}`, `atom`, atom2.key, `copying`);
|
|
3097
|
+
const jsonValue = atom2.toJson(originValue);
|
|
3098
|
+
const copiedValue = atom2.fromJson(jsonValue);
|
|
3099
|
+
target.valueMap.set(atom2.key, copiedValue);
|
|
3100
|
+
new Tracker(atom2, origin);
|
|
3101
|
+
return copiedValue;
|
|
3115
3102
|
}
|
|
3116
3103
|
|
|
3117
3104
|
// internal/src/caching.ts
|
|
@@ -4039,6 +4026,11 @@ function getInternalRelationsFromStore(token, store) {
|
|
|
4039
4026
|
return family;
|
|
4040
4027
|
}
|
|
4041
4028
|
|
|
4029
|
+
// internal/src/reserved-keys.ts
|
|
4030
|
+
function isReservedIntrospectionKey(value) {
|
|
4031
|
+
return value.startsWith(`\u{1F50D} `);
|
|
4032
|
+
}
|
|
4033
|
+
|
|
4042
4034
|
// internal/src/timeline/create-timeline.ts
|
|
4043
4035
|
function createTimeline(store, options, data) {
|
|
4044
4036
|
const tl = {
|
|
@@ -4504,4 +4496,4 @@ var JSON_DEFAULTS = {
|
|
|
4504
4496
|
string: ``
|
|
4505
4497
|
};
|
|
4506
4498
|
|
|
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 };
|
|
4499
|
+
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-7SJVR7FZ.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,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-U4K63VLA.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-7SJVR7FZ.js';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
|
|
5
5
|
// realtime-server/src/ipc-sockets/custom-socket.ts
|
|
@@ -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-IR77IXS7.js';
|
|
2
|
+
import { useI, StoreContext, useO } from './chunk-TJPLOX7Z.js';
|
|
3
|
+
import { findInStore, actUponStore, arbitrary } from './chunk-7SJVR7FZ.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ var RealtimeProvider = ({ children, socket }) => {
|
|
|
22
22
|
}, [socket, setMyId]);
|
|
23
23
|
return /* @__PURE__ */ jsx(RealtimeContext.Provider, { value: { socket, services }, children });
|
|
24
24
|
};
|
|
25
|
-
var { NODE_ENV } = globalThis
|
|
25
|
+
var { NODE_ENV } = globalThis[`env`] ?? {};
|
|
26
26
|
var IN_DEV = NODE_ENV === `development`;
|
|
27
27
|
function noop() {
|
|
28
28
|
}
|
|
@@ -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-7SJVR7FZ.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,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-7SJVR7FZ.js';
|
|
2
2
|
import * as React5 from 'react';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -23,11 +23,9 @@ function useI(...params) {
|
|
|
23
23
|
const store = React5.useContext(StoreContext);
|
|
24
24
|
const token = parseStateOverloads(store, ...params);
|
|
25
25
|
const setter = React5.useRef(null);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
}
|
|
26
|
+
setter.current ??= (next) => {
|
|
27
|
+
setIntoStore(store, token, next);
|
|
28
|
+
};
|
|
31
29
|
return setter.current;
|
|
32
30
|
}
|
|
33
31
|
function useO(...params) {
|
|
@@ -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-7SJVR7FZ.js';
|
|
2
2
|
|
|
3
3
|
// realtime/src/realtime-continuity.ts
|
|
4
4
|
var InvariantMap = class extends Map {
|
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-7SJVR7FZ.js';
|
|
2
2
|
import './chunk-XWL6SNVU.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _eslint_core from '@eslint/core';
|
|
2
1
|
import * as ESTree from 'estree';
|
|
3
2
|
import * as eslint from 'eslint';
|
|
4
3
|
import { Rule } from 'eslint';
|
|
@@ -17,13 +16,7 @@ declare const synchronousSelectorDependencies: {
|
|
|
17
16
|
};
|
|
18
17
|
schema: never[];
|
|
19
18
|
};
|
|
20
|
-
create(context:
|
|
21
|
-
LangOptions: eslint.Linter.LanguageOptions;
|
|
22
|
-
Code: eslint.SourceCode;
|
|
23
|
-
RuleOptions: any[];
|
|
24
|
-
Node: ESTree.Node;
|
|
25
|
-
MessageIds: string;
|
|
26
|
-
}>): {
|
|
19
|
+
create(context: Rule.RuleContext): {
|
|
27
20
|
CallExpression(node: ESTree.CallExpression & Rule.NodeParentExtension): void;
|
|
28
21
|
};
|
|
29
22
|
};
|
|
@@ -48,13 +41,7 @@ declare const _default: {
|
|
|
48
41
|
};
|
|
49
42
|
schema: never[];
|
|
50
43
|
};
|
|
51
|
-
create(context:
|
|
52
|
-
LangOptions: eslint.Linter.LanguageOptions;
|
|
53
|
-
Code: eslint.SourceCode;
|
|
54
|
-
RuleOptions: any[];
|
|
55
|
-
Node: ESTree.Node;
|
|
56
|
-
MessageIds: string;
|
|
57
|
-
}>): {
|
|
44
|
+
create(context: eslint.Rule.RuleContext): {
|
|
58
45
|
CallExpression(node: ESTree.CallExpression & eslint.Rule.NodeParentExtension): void;
|
|
59
46
|
};
|
|
60
47
|
};
|