atom.io 0.32.1 → 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.
Files changed (47) hide show
  1. package/README.md +17 -37
  2. package/data/dist/index.js +1 -1
  3. package/dist/{chunk-X7SD2NXU.js → chunk-2XDFCXGB.js} +5 -4
  4. package/dist/{chunk-UQEYZ3OI.js → chunk-35NB2XZU.js} +108 -110
  5. package/dist/{chunk-3ZFTRSNG.js → chunk-EF4S7H42.js} +6 -3
  6. package/dist/{chunk-KVI5OBF2.js → chunk-LTLDKXDN.js} +3 -3
  7. package/dist/{chunk-3PQTWLQQ.js → chunk-MENOYVPP.js} +1 -1
  8. package/dist/{chunk-VRJP2PCU.js → chunk-RGUNRT72.js} +43 -40
  9. package/dist/{chunk-UYYKOGZQ.js → chunk-TS76LQVD.js} +8 -7
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +1 -1
  12. package/internal/dist/index.d.ts +8 -5
  13. package/internal/dist/index.js +1 -1
  14. package/internal/src/get-state/read-or-compute-value.ts +23 -13
  15. package/internal/src/index.ts +2 -1
  16. package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -12
  17. package/internal/src/lazy-map.ts +3 -1
  18. package/internal/src/reserved-keys.ts +7 -0
  19. package/internal/src/set-state/copy-mutable-if-needed.ts +12 -11
  20. package/internal/src/set-state/set-atom-or-selector.ts +1 -1
  21. package/internal/src/set-state/set-atom.ts +43 -21
  22. package/internal/src/store/store.ts +2 -1
  23. package/internal/src/transaction/get-epoch-number.ts +15 -19
  24. package/internal/src/transaction/set-epoch-number.ts +2 -2
  25. package/introspection/dist/index.js +2 -2
  26. package/introspection/src/attach-atom-index.ts +16 -14
  27. package/introspection/src/attach-selector-index.ts +16 -14
  28. package/introspection/src/auditor.ts +3 -3
  29. package/json/dist/index.js +1 -1
  30. package/package.json +19 -17
  31. package/react/dist/index.js +2 -2
  32. package/react-devtools/dist/index.js +78 -66
  33. package/react-devtools/src/AtomIODevtools.tsx +10 -2
  34. package/react-devtools/src/error-boundary/ReactErrorBoundary.tsx +1 -1
  35. package/realtime/dist/index.d.ts +1 -1
  36. package/realtime/dist/index.js +2 -2
  37. package/realtime/src/realtime-continuity.ts +4 -1
  38. package/realtime-client/dist/index.js +2 -2
  39. package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +5 -2
  40. package/realtime-react/dist/index.js +4 -4
  41. package/realtime-server/dist/index.d.ts +1 -1
  42. package/realtime-server/dist/index.js +3 -3
  43. package/realtime-server/src/ipc-sockets/custom-socket.ts +6 -1
  44. package/realtime-testing/dist/index.js +6 -6
  45. package/src/logger.ts +12 -4
  46. package/transceivers/set-rtx/dist/index.js +1 -1
  47. 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://bundlephobia.com/result?p=atom.io">
41
- <img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/atom.io?style=for-the-badge&labelColor=333">
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="Types" href="https://www.npmjs.com/package/atom.io">
44
- <img alt="Types" src="https://img.shields.io/npm/types/atom.io?style=for-the-badge&labelColor=333">
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="Build status" href="https://github.com/jeremybanka/wayforge/actions/workflows/integration.yml">
47
- <img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/jeremybanka/wayforge/integration.yml?branch=main&style=for-the-badge&labelColor=333">
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 aria-label="NPM version" href="https://www.npmjs.com/package/atom.io">
50
- <img alt="NPM Version" src="https://img.shields.io/npm/v/atom.io?style=for-the-badge&labelColor=333">
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://coveralls.io/github/jeremybanka/wayforge">
53
- <img alt="Coverage" src="https://img.shields.io/coverallsCoverage/github/jeremybanka/wayforge?style=for-the-badge&labelColor=333">
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>
@@ -1,4 +1,4 @@
1
- import { IMPLICIT, createStandaloneSelector, findInStore, capitalize, createRegularAtom, createRegularAtomFamily, createSelectorFamily } from '../../dist/chunk-UQEYZ3OI.js';
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-UQEYZ3OI.js';
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 {
@@ -17,13 +17,14 @@ var InvariantMap = class extends Map {
17
17
  }
18
18
  };
19
19
  var SyncGroup = class _SyncGroup {
20
- constructor(key) {
21
- this.key = key;
22
- }
23
20
  type = `continuity`;
24
21
  globals = [];
25
22
  actions = [];
26
23
  perspectives = [];
24
+ key;
25
+ constructor(key) {
26
+ this.key = key;
27
+ }
27
28
  static existing = new InvariantMap();
28
29
  static create(key, builder) {
29
30
  const group = new _SyncGroup(key);
@@ -202,6 +202,9 @@ var simpleLogger = {
202
202
  warn: simpleLog(`warn`)
203
203
  };
204
204
  var AtomIOLogger = class {
205
+ logLevel;
206
+ filter;
207
+ logger;
205
208
  constructor(logLevel, filter, logger = simpleLogger) {
206
209
  this.logLevel = logLevel;
207
210
  this.filter = filter;
@@ -359,19 +362,30 @@ var readOrComputeValue = (target, state) => {
359
362
  target.logger.info(`\u{1F4D6}`, state.type, state.key, `reading cached value`);
360
363
  return readCachedValue(state, target);
361
364
  }
362
- if (state.type === `selector` || state.type === `readonly_selector`) {
363
- target.logger.info(`\u{1F9EE}`, state.type, state.key, `computing value`);
364
- return state.get();
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
+ }
365
388
  }
366
- const fallback = state.default instanceof Function ? state.default() : state.default;
367
- target.logger.info(
368
- `\u{1F481}`,
369
- `atom`,
370
- state.key,
371
- `could not find cached value; using default`,
372
- fallback
373
- );
374
- return state.default instanceof Function ? state.default() : state.default;
375
389
  };
376
390
 
377
391
  // internal/src/operation.ts
@@ -499,55 +513,8 @@ var evictDownStream = (store, atom2) => {
499
513
  }
500
514
  };
501
515
 
502
- // internal/src/set-state/stow-update.ts
503
- function shouldUpdateBeStowed(key, update) {
504
- if (isTransceiver(update.newValue)) {
505
- return false;
506
- }
507
- if (key.includes(`\u{1F50D}`)) {
508
- return false;
509
- }
510
- return true;
511
- }
512
- var stowUpdate = (store, state, update) => {
513
- const { key } = state;
514
- const target = newest(store);
515
- if (!isChildStore(target) || target.transactionMeta.phase !== `building`) {
516
- store.logger.error(
517
- `\u{1F41E}`,
518
- `atom`,
519
- key,
520
- `stowUpdate called outside of a transaction. This is probably a bug.`
521
- );
522
- return;
523
- }
524
- const shouldStow = shouldUpdateBeStowed(key, update);
525
- if (!shouldStow) {
526
- return;
527
- }
528
- const atomUpdate = {
529
- type: `atom_update`,
530
- key,
531
- ...update
532
- };
533
- if (state.family) {
534
- atomUpdate.family = state.family;
535
- }
536
- target.transactionMeta.update.updates.push(atomUpdate);
537
- store.logger.info(
538
- `\u{1F4C1}`,
539
- `atom`,
540
- key,
541
- `stowed (`,
542
- update.oldValue,
543
- `->`,
544
- update.newValue,
545
- `)`
546
- );
547
- };
548
-
549
516
  // internal/src/set-state/set-atom.ts
550
- var setAtom = (atom2, next, target) => {
517
+ var setAtom = (target, atom2, next) => {
551
518
  const oldValue = readOrComputeValue(target, atom2);
552
519
  let newValue = oldValue;
553
520
  if (atom2.type === `mutable_atom` && isChildStore(target)) {
@@ -564,23 +531,45 @@ var setAtom = (atom2, next, target) => {
564
531
  markDone(target, atom2.key);
565
532
  evictDownStream(target, atom2);
566
533
  const update = { oldValue, newValue };
567
- if (isRootStore(target)) {
534
+ if (!isChildStore(target)) {
568
535
  emitUpdate(target, atom2, update);
569
- } else if (target.parent) {
570
- if (target.on.transactionApplying.state === null) {
571
- stowUpdate(target, atom2, update);
572
- } else if (atom2.key.startsWith(`*`)) {
573
- const mutableKey = atom2.key.slice(1);
574
- const mutableAtom = target.atoms.get(mutableKey);
575
- let transceiver = target.valueMap.get(mutableKey);
576
- if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
577
- const { parent } = target;
578
- const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent);
579
- transceiver = copiedValue;
580
- }
581
- const accepted = transceiver.do(update.newValue) === null;
582
- 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;
583
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);
584
573
  }
585
574
  };
586
575
 
@@ -589,7 +578,7 @@ var setAtomOrSelector = (store, state, value) => {
589
578
  switch (state.type) {
590
579
  case `atom`:
591
580
  case `mutable_atom`:
592
- setAtom(state, value, store);
581
+ setAtom(store, state, value);
593
582
  break;
594
583
  case `selector`:
595
584
  state.set(value);
@@ -1658,6 +1647,27 @@ function ingestTransactionUpdate(applying, transactionUpdate, store) {
1658
1647
  }
1659
1648
  }
1660
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
+
1661
1671
  // internal/src/transaction/set-epoch-number.ts
1662
1672
  function setEpochNumberOfContinuity(store, continuityKey, newEpoch) {
1663
1673
  const isRoot = isRootStore(store);
@@ -1670,7 +1680,7 @@ function setEpochNumberOfAction(store, transactionKey, newEpoch) {
1670
1680
  if (!isRoot) {
1671
1681
  return;
1672
1682
  }
1673
- const continuityKey = store.transactionMeta.actionContinuities.getRelatedKey(transactionKey);
1683
+ const continuityKey = getContinuityKey(store, transactionKey);
1674
1684
  if (continuityKey !== void 0) {
1675
1685
  store.transactionMeta.epoch.set(continuityKey, newEpoch);
1676
1686
  }
@@ -2104,11 +2114,12 @@ var Junction = class {
2104
2114
 
2105
2115
  // internal/src/lazy-map.ts
2106
2116
  var LazyMap = class extends Map {
2117
+ deleted = /* @__PURE__ */ new Set();
2118
+ source;
2107
2119
  constructor(source) {
2108
2120
  super();
2109
2121
  this.source = source;
2110
2122
  }
2111
- deleted = /* @__PURE__ */ new Set();
2112
2123
  get(key) {
2113
2124
  const has = super.has(key);
2114
2125
  if (has) {
@@ -2245,24 +2256,6 @@ function createTransaction(store, options) {
2245
2256
  return token;
2246
2257
  }
2247
2258
 
2248
- // internal/src/transaction/get-epoch-number.ts
2249
- function getContinuityKey(store, transactionKey) {
2250
- const isRoot = isRootStore(store);
2251
- const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
2252
- return continuity;
2253
- }
2254
- function getEpochNumberOfContinuity(store, continuityKey) {
2255
- const isRoot = isRootStore(store);
2256
- const epoch = isRoot && continuityKey ? store.transactionMeta.epoch.get(continuityKey) : void 0;
2257
- return epoch;
2258
- }
2259
- function getEpochNumberOfAction(store, transactionKey) {
2260
- const isRoot = isRootStore(store);
2261
- const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
2262
- const epoch = isRoot && continuity !== void 0 ? store.transactionMeta.epoch.get(continuity) : void 0;
2263
- return epoch;
2264
- }
2265
-
2266
2259
  // internal/src/transaction/index.ts
2267
2260
  var TRANSACTION_PHASES = [`idle`, `building`, `applying`];
2268
2261
 
@@ -2467,7 +2460,7 @@ var Store = class {
2467
2460
  lifespan: `ephemeral`
2468
2461
  };
2469
2462
  loggers = [
2470
- new AtomIOLogger(`warn`, (_, __, key) => !key.includes(`\u{1F50D}`))
2463
+ new AtomIOLogger(`warn`, (_, __, key) => !isReservedIntrospectionKey(key))
2471
2464
  ];
2472
2465
  logger = {
2473
2466
  error: (...messages) => {
@@ -3096,18 +3089,18 @@ function isTransceiver(value) {
3096
3089
  function copyMutableIfNeeded(target, atom2, origin) {
3097
3090
  const originValue = origin.valueMap.get(atom2.key);
3098
3091
  const targetValue = target.valueMap.get(atom2.key);
3099
- if (originValue === targetValue) {
3100
- if (originValue === void 0) {
3101
- return typeof atom2.default === `function` ? atom2.default() : atom2.default;
3102
- }
3103
- origin.logger.info(`\u{1F4C3}`, `atom`, atom2.key, `copying`);
3104
- const jsonValue = atom2.toJson(originValue);
3105
- const copiedValue = atom2.fromJson(jsonValue);
3106
- target.valueMap.set(atom2.key, copiedValue);
3107
- new Tracker(atom2, origin);
3108
- return copiedValue;
3109
- }
3110
- return targetValue;
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;
3111
3104
  }
3112
3105
 
3113
3106
  // internal/src/caching.ts
@@ -4035,6 +4028,11 @@ function getInternalRelationsFromStore(token, store) {
4035
4028
  return family;
4036
4029
  }
4037
4030
 
4031
+ // internal/src/reserved-keys.ts
4032
+ function isReservedIntrospectionKey(value) {
4033
+ return value.startsWith(`\u{1F50D} `);
4034
+ }
4035
+
4038
4036
  // internal/src/timeline/create-timeline.ts
4039
4037
  function createTimeline(store, options, data) {
4040
4038
  const tl = {
@@ -4500,4 +4498,4 @@ var JSON_DEFAULTS = {
4500
4498
  string: ``
4501
4499
  };
4502
4500
 
4503
- 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, getEpochNumberOfContinuity, isRootStore, ingestTransactionUpdate, setEpochNumberOfContinuity, disposeAtom, parseJson, getJsonToken, getUpdateToken, subscribeToState, subscribeToTransaction, getFromStore, assignTransactionToContinuity, actUponStore } from './chunk-UQEYZ3OI.js';
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
- if (isRoot && continuityEpoch === confirmed.epoch - 1) {
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-3ZFTRSNG.js';
2
- import { useI, StoreContext, useO } from './chunk-3PQTWLQQ.js';
3
- import { findInStore, actUponStore, arbitrary } from './chunk-UQEYZ3OI.js';
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-UQEYZ3OI.js';
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-UQEYZ3OI.js';
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 (!key.includes(`\u{1F50D}`)) {
13
- const token = deposit(val);
14
- if (val.family) {
15
- let familyNode = base.get(val.family.key);
16
- if (!familyNode || !(`familyMembers` in familyNode)) {
17
- familyNode = {
18
- key: val.family.key,
19
- familyMembers: /* @__PURE__ */ new Map()
20
- };
21
- base.set(val.family.key, familyNode);
22
- }
23
- familyNode.familyMembers.set(val.family.subKey, token);
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.includes(`\u{1F50D}`)) {
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 (!key.includes(`\u{1F50D}`)) {
94
- const token = deposit(val);
95
- if (val.family) {
96
- let familyNode = base.get(val.family.key);
97
- if (!familyNode || !(`familyMembers` in familyNode)) {
98
- familyNode = {
99
- key: val.family.key,
100
- familyMembers: /* @__PURE__ */ new Map()
101
- };
102
- base.set(val.family.key, familyNode);
103
- }
104
- familyNode.familyMembers.set(val.family.subKey, token);
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.includes(`\u{1F50D}`)) {
120
+ if (isReservedIntrospectionKey(selectorToken.key)) {
119
121
  return;
120
122
  }
121
123
  setSelf((self) => {
@@ -381,6 +383,16 @@ var attachIntrospectionStates = (store) => {
381
383
 
382
384
  // introspection/src/auditor.ts
383
385
  var Auditor = class _Auditor {
386
+ store;
387
+ auditorCreatedAt = performance.now();
388
+ statesCreatedAt = /* @__PURE__ */ new Map();
389
+ atomIndex;
390
+ selectorIndex;
391
+ disposed = false;
392
+ unsubscribeFromAtomCreation;
393
+ unsubscribeFromAtomDisposal;
394
+ unsubscribeFromSelectorCreation;
395
+ unsubscribeFromSelectorDisposal;
384
396
  /**
385
397
  * @param {Store} store - The store to audit.
386
398
  */
@@ -416,15 +428,6 @@ var Auditor = class _Auditor {
416
428
  }
417
429
  );
418
430
  }
419
- auditorCreatedAt = performance.now();
420
- statesCreatedAt = /* @__PURE__ */ new Map();
421
- atomIndex;
422
- selectorIndex;
423
- disposed = false;
424
- unsubscribeFromAtomCreation;
425
- unsubscribeFromAtomDisposal;
426
- unsubscribeFromSelectorCreation;
427
- unsubscribeFromSelectorDisposal;
428
431
  static DEFAULT_LIST_RESOURCES_PARAM = {
429
432
  atomFamilies: true,
430
433
  selectorFamilies: true
@@ -1,14 +1,9 @@
1
- import { roomIndex, usersInRooms } from './chunk-X7SD2NXU.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-UQEYZ3OI.js';
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
6
6
  var CustomSocket = class {
7
- constructor(emit) {
8
- this.emit = emit;
9
- this.listeners = /* @__PURE__ */ new Map();
10
- this.globalListeners = /* @__PURE__ */ new Set();
11
- }
12
7
  listeners;
13
8
  globalListeners;
14
9
  handleEvent(event, ...args) {
@@ -23,6 +18,12 @@ var CustomSocket = class {
23
18
  }
24
19
  }
25
20
  id = `no_id_retrieved`;
21
+ emit;
22
+ constructor(emit) {
23
+ this.emit = emit;
24
+ this.listeners = /* @__PURE__ */ new Map();
25
+ this.globalListeners = /* @__PURE__ */ new Set();
26
+ }
26
27
  on(event, listener) {
27
28
  const listeners = this.listeners.get(event);
28
29
  if (listeners) {
package/dist/index.d.ts CHANGED
@@ -460,9 +460,9 @@ declare const simpleLog: (logLevel: keyof Logger) => LogFn;
460
460
  declare const simpleLogger: Logger;
461
461
  declare class AtomIOLogger implements Logger {
462
462
  logLevel: `error` | `info` | `warn` | null;
463
- private readonly filter?;
463
+ private readonly filter;
464
464
  private readonly logger;
465
- constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
465
+ constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter, logger?: Logger);
466
466
  error: LogFn;
467
467
  info: LogFn;
468
468
  warn: LogFn;
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-UQEYZ3OI.js';
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';