atom.io 0.24.3 → 0.24.5

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 (36) hide show
  1. package/data/dist/index.cjs +3 -6
  2. package/data/dist/index.js +2 -2
  3. package/dist/{chunk-BWWVY5O5.js → chunk-H6EDLPKH.js} +1 -2
  4. package/dist/{chunk-FTONNX2R.js → chunk-HYXKCFVY.js} +3 -6
  5. package/dist/{chunk-3V3VWQ7X.js → chunk-MR5NETHW.js} +1 -2
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +1 -1
  8. package/ephemeral/dist/index.js +1 -1
  9. package/eslint-plugin/dist/index.js +1 -1
  10. package/immortal/dist/index.js +1 -1
  11. package/internal/dist/index.cjs +8 -22
  12. package/internal/dist/index.d.ts +1 -1
  13. package/internal/dist/index.js +7 -18
  14. package/internal/src/molecule/make-molecule-in-store.ts +2 -1
  15. package/internal/src/transaction/apply-transaction.ts +0 -8
  16. package/introspection/dist/index.js +1 -1
  17. package/json/dist/index.d.ts +1 -1
  18. package/json/dist/index.js +1 -1
  19. package/package.json +12 -12
  20. package/react/dist/index.js +1 -1
  21. package/react-devtools/dist/index.cjs +44 -60
  22. package/react-devtools/dist/index.js +43 -57
  23. package/realtime/dist/index.js +1 -1
  24. package/realtime-client/dist/index.cjs +2 -4
  25. package/realtime-client/dist/index.js +3 -4
  26. package/realtime-react/dist/index.js +1 -1
  27. package/realtime-server/dist/index.cjs +2 -65
  28. package/realtime-server/dist/index.js +6 -69
  29. package/realtime-server/src/realtime-server-stores/index.ts +0 -1
  30. package/realtime-testing/dist/index.cjs +1 -2
  31. package/realtime-testing/dist/index.js +3 -4
  32. package/src/molecule.ts +1 -1
  33. package/transceivers/set-rtx/dist/index.cjs +1 -2
  34. package/transceivers/set-rtx/dist/index.js +2 -3
  35. package/realtime-server/src/realtime-server-stores/realtime-continuity-store.ts +0 -109
  36. /package/dist/{chunk-F2X4B4VY.js → chunk-S4N6XNPH.js} +0 -0
@@ -67,8 +67,7 @@ var Junction = class {
67
67
  };
68
68
  }
69
69
  for (const [x, ys] of (_c = data.relations) != null ? _c : []) {
70
- for (const y of ys)
71
- this.addRelation(x, y);
70
+ for (const y of ys) this.addRelation(x, y);
72
71
  }
73
72
  for (const [contentKey, content] of (_d = data.contents) != null ? _d : []) {
74
73
  this.setContent(contentKey, content);
@@ -168,13 +167,11 @@ var Junction = class {
168
167
  switch (this.cardinality) {
169
168
  case `1:1`: {
170
169
  const bPrev = this.getRelatedKey(a);
171
- if (bPrev && bPrev !== b)
172
- this.delete(bPrev, a);
170
+ if (bPrev && bPrev !== b) this.delete(bPrev, a);
173
171
  }
174
172
  case `1:n`: {
175
173
  const aPrev = this.getRelatedKey(b);
176
- if (aPrev && aPrev !== a)
177
- this.delete(aPrev, b);
174
+ if (aPrev && aPrev !== a) this.delete(aPrev, b);
178
175
  }
179
176
  }
180
177
  if (content) {
@@ -1,5 +1,5 @@
1
- import { Junction } from '../../dist/chunk-FTONNX2R.js';
2
- import '../../dist/chunk-F2X4B4VY.js';
1
+ import { Junction } from '../../dist/chunk-HYXKCFVY.js';
2
+ import '../../dist/chunk-S4N6XNPH.js';
3
3
  import { createStandaloneSelector, findInStore, IMPLICIT, getFromStore, setIntoStore, seekInStore, getJsonToken, disposeFromStore, withdraw, growMoleculeInStore, initFamilyMemberInStore, createMutableAtomFamily, createRegularAtomFamily, createMoleculeFamily, newest, makeMoleculeInStore, isChildStore, createRegularAtom, createSelectorFamily, getJsonFamily } from 'atom.io/internal';
4
4
  import { stringifyJson } from 'atom.io/json';
5
5
  import { SetRTX } from 'atom.io/transceivers/set-rtx';
@@ -1,8 +1,7 @@
1
1
  // __unstable__/web-effects/src/storage.ts
2
2
  var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, onSet }) => {
3
3
  const savedValue = storage.getItem(key);
4
- if (savedValue != null)
5
- setSelf(parse(savedValue));
4
+ if (savedValue != null) setSelf(parse(savedValue));
6
5
  onSet(({ newValue }) => {
7
6
  if (newValue == null) {
8
7
  storage.removeItem(key);
@@ -44,8 +44,7 @@ var Junction = class {
44
44
  };
45
45
  }
46
46
  for (const [x, ys] of (_c = data.relations) != null ? _c : []) {
47
- for (const y of ys)
48
- this.addRelation(x, y);
47
+ for (const y of ys) this.addRelation(x, y);
49
48
  }
50
49
  for (const [contentKey, content] of (_d = data.contents) != null ? _d : []) {
51
50
  this.setContent(contentKey, content);
@@ -145,13 +144,11 @@ var Junction = class {
145
144
  switch (this.cardinality) {
146
145
  case `1:1`: {
147
146
  const bPrev = this.getRelatedKey(a);
148
- if (bPrev && bPrev !== b)
149
- this.delete(bPrev, a);
147
+ if (bPrev && bPrev !== b) this.delete(bPrev, a);
150
148
  }
151
149
  case `1:n`: {
152
150
  const aPrev = this.getRelatedKey(b);
153
- if (aPrev && aPrev !== a)
154
- this.delete(aPrev, b);
151
+ if (aPrev && aPrev !== a) this.delete(aPrev, b);
155
152
  }
156
153
  }
157
154
  if (content) {
@@ -113,8 +113,7 @@ var sprawl = (tree, inspector) => {
113
113
  var _a;
114
114
  const inspect = (p, n) => {
115
115
  const result2 = inspector(p, n);
116
- if (result2)
117
- return result2;
116
+ if (result2) return result2;
118
117
  return null;
119
118
  };
120
119
  const result = inspect(path, node);
package/dist/index.d.ts CHANGED
@@ -207,7 +207,7 @@ type MoleculeTransactors<K extends Json.Serializable> = Flat$1<Omit<TransactorsW
207
207
  claim(below: MoleculeToken<any>, options: {
208
208
  exclusive: boolean;
209
209
  }): any;
210
- join(joinToken: JoinToken<any, any, any, any>): void;
210
+ join<J extends JoinToken<any, any, any, any>>(joinToken: J): J;
211
211
  spawn<Key extends Json.Serializable, Ctor extends MoleculeConstructor>(family: MoleculeFamilyToken<Ctor>, key: Key, ...params: MoleculeParams<Ctor>): MoleculeToken<Ctor>;
212
212
  }>;
213
213
  type MoleculeConstructor = new (transactors: MoleculeTransactors<any>, key: any, ...params: any) => any;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import './chunk-F2X4B4VY.js';
1
+ import './chunk-S4N6XNPH.js';
2
2
  import * as Internal from 'atom.io/internal';
3
3
  import { createStandaloneAtom, IMPLICIT, createAtomFamily, createMoleculeFamily, makeMoleculeInStore, Molecule, createStandaloneSelector, createSelectorFamily, Store, createTransaction, createTimeline, findInStore, getFromStore, setIntoStore, timeTravel, subscribeToTimeline, subscribeToTransaction, subscribeToState, arbitrary, actUponStore } from 'atom.io/internal';
4
4
  import { stringifyJson } from 'atom.io/json';
@@ -1,4 +1,4 @@
1
- import '../../dist/chunk-F2X4B4VY.js';
1
+ import '../../dist/chunk-S4N6XNPH.js';
2
2
  import { findInStore, IMPLICIT } from 'atom.io/internal';
3
3
 
4
4
  function findState(token, key) {
@@ -1,4 +1,4 @@
1
- import { __export } from '../../dist/chunk-F2X4B4VY.js';
1
+ import { __export } from '../../dist/chunk-S4N6XNPH.js';
2
2
  import { ESLintUtils } from '@typescript-eslint/utils';
3
3
 
4
4
  // eslint-plugin/src/rules/index.ts
@@ -1,4 +1,4 @@
1
- import '../../dist/chunk-F2X4B4VY.js';
1
+ import '../../dist/chunk-S4N6XNPH.js';
2
2
  import { seekInStore, IMPLICIT } from 'atom.io/internal';
3
3
 
4
4
  function seekState(token, key) {
@@ -137,8 +137,7 @@ var Junction = class {
137
137
  };
138
138
  }
139
139
  for (const [x, ys] of (_c = data.relations) != null ? _c : []) {
140
- for (const y of ys)
141
- this.addRelation(x, y);
140
+ for (const y of ys) this.addRelation(x, y);
142
141
  }
143
142
  for (const [contentKey, content] of (_d = data.contents) != null ? _d : []) {
144
143
  this.setContent(contentKey, content);
@@ -238,13 +237,11 @@ var Junction = class {
238
237
  switch (this.cardinality) {
239
238
  case `1:1`: {
240
239
  const bPrev = this.getRelatedKey(a);
241
- if (bPrev && bPrev !== b)
242
- this.delete(bPrev, a);
240
+ if (bPrev && bPrev !== b) this.delete(bPrev, a);
243
241
  }
244
242
  case `1:n`: {
245
243
  const aPrev = this.getRelatedKey(b);
246
- if (aPrev && aPrev !== a)
247
- this.delete(aPrev, b);
244
+ if (aPrev && aPrev !== a) this.delete(aPrev, b);
248
245
  }
249
246
  }
250
247
  if (content) {
@@ -456,16 +453,13 @@ var Store = class {
456
453
  ];
457
454
  this.logger = {
458
455
  error: (...messages) => {
459
- for (const logger of this.loggers)
460
- logger.error(...messages);
456
+ for (const logger of this.loggers) logger.error(...messages);
461
457
  },
462
458
  info: (...messages) => {
463
- for (const logger of this.loggers)
464
- logger.info(...messages);
459
+ for (const logger of this.loggers) logger.info(...messages);
465
460
  },
466
461
  warn: (...messages) => {
467
- for (const logger of this.loggers)
468
- logger.warn(...messages);
462
+ for (const logger of this.loggers) logger.warn(...messages);
469
463
  }
470
464
  };
471
465
  if (store !== null) {
@@ -966,8 +960,7 @@ var setAtom = (atom, next, target) => {
966
960
  transceiver = copiedValue;
967
961
  }
968
962
  const accepted = transceiver.do(update.newValue) === null;
969
- if (accepted)
970
- evictDownStream(mutableAtom, target);
963
+ if (accepted) evictDownStream(mutableAtom, target);
971
964
  }
972
965
  }
973
966
  };
@@ -1165,6 +1158,7 @@ function makeMoleculeInStore(store, context, familyToken, key, ...params) {
1165
1158
  const join = data.getJoin(joinToken, store);
1166
1159
  join.molecules.set(json.stringifyJson(key), molecule);
1167
1160
  molecule.joins.set(joinToken.key, join);
1161
+ return joinToken;
1168
1162
  },
1169
1163
  spawn: (f, k, ...p) => makeMoleculeInStore(
1170
1164
  newest(store),
@@ -1346,14 +1340,6 @@ var applyTransaction = (output, store) => {
1346
1340
  `Applying transaction with ${updates.length} updates:`,
1347
1341
  updates
1348
1342
  );
1349
- for (const tracker of child.trackers.values()) {
1350
- const mutableKey = tracker.mutableState.key;
1351
- if (!parent.atoms.has(mutableKey)) {
1352
- const atom = child.atoms.get(mutableKey);
1353
- atom == null ? void 0 : atom.install(parent);
1354
- }
1355
- tracker.dispose();
1356
- }
1357
1343
  ingestTransactionUpdate(`newValue`, child.transactionMeta.update, parent);
1358
1344
  if (isRootStore(parent)) {
1359
1345
  setEpochNumberOfAction(
@@ -245,7 +245,7 @@ declare class Store implements Lineage {
245
245
  molecules: Map<string, Molecule<any>>;
246
246
  moleculeFamilies: Map<string, atom_io.Flat<atom_io.MoleculeFamilyToken<any> & {
247
247
  subject: Subject<atom_io.MoleculeDisposal | atom_io.MoleculeCreation<any>>;
248
- dependsOn: "all" | "any";
248
+ dependsOn: `all` | `any`;
249
249
  new: any;
250
250
  }>>;
251
251
  miscResources: Map<string, Disposable>;
@@ -1,5 +1,5 @@
1
- import { Junction } from '../../dist/chunk-FTONNX2R.js';
2
- import { __spreadValues, __spreadProps } from '../../dist/chunk-F2X4B4VY.js';
1
+ import { Junction } from '../../dist/chunk-HYXKCFVY.js';
2
+ import { __spreadValues, __spreadProps } from '../../dist/chunk-S4N6XNPH.js';
3
3
  import { stringifyJson, parseJson, selectJson, selectJsonFamily } from 'atom.io/json';
4
4
  import { AtomIOLogger } from 'atom.io';
5
5
  import { getJoin } from 'atom.io/data';
@@ -178,16 +178,13 @@ var Store = class {
178
178
  ];
179
179
  this.logger = {
180
180
  error: (...messages) => {
181
- for (const logger of this.loggers)
182
- logger.error(...messages);
181
+ for (const logger of this.loggers) logger.error(...messages);
183
182
  },
184
183
  info: (...messages) => {
185
- for (const logger of this.loggers)
186
- logger.info(...messages);
184
+ for (const logger of this.loggers) logger.info(...messages);
187
185
  },
188
186
  warn: (...messages) => {
189
- for (const logger of this.loggers)
190
- logger.warn(...messages);
187
+ for (const logger of this.loggers) logger.warn(...messages);
191
188
  }
192
189
  };
193
190
  if (store !== null) {
@@ -688,8 +685,7 @@ var setAtom = (atom, next, target) => {
688
685
  transceiver = copiedValue;
689
686
  }
690
687
  const accepted = transceiver.do(update.newValue) === null;
691
- if (accepted)
692
- evictDownStream(mutableAtom, target);
688
+ if (accepted) evictDownStream(mutableAtom, target);
693
689
  }
694
690
  }
695
691
  };
@@ -887,6 +883,7 @@ function makeMoleculeInStore(store, context, familyToken, key, ...params) {
887
883
  const join = getJoin(joinToken, store);
888
884
  join.molecules.set(stringifyJson(key), molecule);
889
885
  molecule.joins.set(joinToken.key, join);
886
+ return joinToken;
890
887
  },
891
888
  spawn: (f, k, ...p) => makeMoleculeInStore(
892
889
  newest(store),
@@ -1068,14 +1065,6 @@ var applyTransaction = (output, store) => {
1068
1065
  `Applying transaction with ${updates.length} updates:`,
1069
1066
  updates
1070
1067
  );
1071
- for (const tracker of child.trackers.values()) {
1072
- const mutableKey = tracker.mutableState.key;
1073
- if (!parent.atoms.has(mutableKey)) {
1074
- const atom = child.atoms.get(mutableKey);
1075
- atom == null ? void 0 : atom.install(parent);
1076
- }
1077
- tracker.dispose();
1078
- }
1079
1068
  ingestTransactionUpdate(`newValue`, child.transactionMeta.update, parent);
1080
1069
  if (isRootStore(parent)) {
1081
1070
  setEpochNumberOfAction(
@@ -101,10 +101,11 @@ export function makeMoleculeInStore<M extends MoleculeConstructor>(
101
101
  }
102
102
  }
103
103
  },
104
- join: (joinToken: JoinToken<any, any, any, any>) => {
104
+ join: <J extends JoinToken<any, any, any, any>>(joinToken: J) => {
105
105
  const join = getJoin(joinToken, store)
106
106
  join.molecules.set(stringifyJson(key), molecule)
107
107
  molecule.joins.set(joinToken.key, join)
108
+ return joinToken
108
109
  },
109
110
  spawn: (f: MoleculeFamilyToken<any>, k: any, ...p: any[]) =>
110
111
  makeMoleculeInStore(
@@ -38,14 +38,6 @@ export const applyTransaction = <F extends Func>(
38
38
  `Applying transaction with ${updates.length} updates:`,
39
39
  updates,
40
40
  )
41
- for (const tracker of child.trackers.values()) {
42
- const mutableKey = tracker.mutableState.key
43
- if (!parent.atoms.has(mutableKey)) {
44
- const atom = child.atoms.get(mutableKey)
45
- atom?.install(parent)
46
- }
47
- tracker.dispose()
48
- }
49
41
 
50
42
  ingestTransactionUpdate(`newValue`, child.transactionMeta.update, parent)
51
43
 
@@ -1,4 +1,4 @@
1
- import { __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
1
+ import { __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
2
2
  import * as Internal from 'atom.io/internal';
3
3
  import { createRegularAtom, deposit, createStandaloneSelector, IMPLICIT, createRegularAtomFamily, Subject, createSelectorFamily } from 'atom.io/internal';
4
4
  import { getState } from 'atom.io';
@@ -31,7 +31,7 @@ declare namespace json {
31
31
  export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
32
32
  }
33
33
 
34
- declare const parseJson: <S extends Stringified<Serializable>>(str: S | string) => S extends Stringified<infer J extends Serializable> ? J : Serializable;
34
+ declare const parseJson: <S extends Stringified<Serializable>>(str: S | string) => S extends Stringified<infer J> ? J : Serializable;
35
35
  type Stringified<J extends Serializable> = string & {
36
36
  __json: J;
37
37
  };
@@ -1,6 +1,6 @@
1
1
  import { stringifyJson, parseJson } from '../../dist/chunk-BF4MVQF6.js';
2
2
  export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-BF4MVQF6.js';
3
- import '../../dist/chunk-F2X4B4VY.js';
3
+ import '../../dist/chunk-S4N6XNPH.js';
4
4
  import { createStandaloneSelector, IMPLICIT, createSelectorFamily, growMoleculeInStore, initFamilyMemberInStore, seekInStore } from 'atom.io/internal';
5
5
 
6
6
  var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.24.3",
3
+ "version": "0.24.5",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@testing-library/react": "15.0.7",
51
+ "@testing-library/react": "16.0.0",
52
52
  "@types/eslint": "npm:@types/eslint@8.56.10",
53
53
  "@types/eslint-v9": "npm:@types/eslint@8.56.10",
54
54
  "@types/estree": "1.0.5",
@@ -56,17 +56,17 @@
56
56
  "@types/npmlog": "7.0.0",
57
57
  "@types/react": "18.3.3",
58
58
  "@types/tmp": "0.2.6",
59
- "@typescript-eslint/parser": "7.11.0",
60
- "@typescript-eslint/rule-tester": "7.11.0",
59
+ "@typescript-eslint/parser": "7.13.1",
60
+ "@typescript-eslint/rule-tester": "7.13.1",
61
61
  "@vitest/coverage-v8": "1.6.0",
62
62
  "@vitest/ui": "1.6.0",
63
63
  "concurrently": "8.2.2",
64
- "drizzle-kit": "0.21.4",
65
- "drizzle-orm": "0.30.10",
64
+ "drizzle-kit": "0.22.7",
65
+ "drizzle-orm": "0.31.2",
66
66
  "eslint": "npm:eslint@8.57.0",
67
- "eslint-v9": "npm:eslint@9.3.0",
68
- "framer-motion": "11.2.9",
69
- "happy-dom": "14.11.4",
67
+ "eslint-v9": "npm:eslint@9.5.0",
68
+ "framer-motion": "11.2.11",
69
+ "happy-dom": "14.12.3",
70
70
  "http-proxy": "1.18.1",
71
71
  "npmlog": "7.0.1",
72
72
  "postgres": "3.4.4",
@@ -77,9 +77,9 @@
77
77
  "socket.io": "4.7.5",
78
78
  "socket.io-client": "4.7.5",
79
79
  "tmp": "0.2.3",
80
- "tsup": "8.0.2",
81
- "typescript": "5.4.5",
82
- "vite": "5.2.12",
80
+ "tsup": "8.1.0",
81
+ "typescript": "5.5.2",
82
+ "vite": "5.3.1",
83
83
  "vite-tsconfig-paths": "4.3.2",
84
84
  "vitest": "1.6.0"
85
85
  },
@@ -1,4 +1,4 @@
1
- import '../../dist/chunk-F2X4B4VY.js';
1
+ import '../../dist/chunk-S4N6XNPH.js';
2
2
  import { IMPLICIT, findInStore, setIntoStore, subscribeToState, getFromStore, getJsonToken, withdraw, subscribeToTimeline } from 'atom.io/internal';
3
3
  import * as React5 from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';