atom.io 0.18.2 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/data/dist/index.cjs +173 -3
  2. package/data/dist/index.d.ts +52 -21
  3. package/data/dist/index.js +13 -334
  4. package/data/src/join.ts +309 -41
  5. package/dist/chunk-7ZR244C2.js +489 -0
  6. package/dist/{chunk-A4ZCNKWQ.js → chunk-BWWVY5O5.js} +0 -2
  7. package/dist/{chunk-NYCVSXQB.js → chunk-CVBEVTM5.js} +0 -2
  8. package/dist/{chunk-3J2EGSBE.js → chunk-O47EQUM6.js} +1 -3
  9. package/dist/{chunk-PZLG2HP3.js → chunk-U2IICNHQ.js} +0 -2
  10. package/dist/{chunk-XACXFU3B.js → chunk-VAE5OCKN.js} +0 -2
  11. package/dist/{chunk-NYTGCPHB.js → chunk-WX2NCOZR.js} +0 -2
  12. package/dist/{chunk-IZHOMSXA.js → chunk-YDOGCZ53.js} +0 -2
  13. package/dist/index.cjs +0 -2
  14. package/dist/index.js +1 -3
  15. package/internal/dist/index.cjs +0 -2
  16. package/internal/dist/index.js +2 -4
  17. package/introspection/dist/index.cjs +0 -2
  18. package/introspection/dist/index.js +1 -3
  19. package/json/dist/index.cjs +0 -2
  20. package/json/dist/index.js +3 -5
  21. package/package.json +3 -3
  22. package/react/dist/index.cjs +0 -2
  23. package/react/dist/index.js +1 -3
  24. package/react-devtools/dist/index.cjs +0 -2
  25. package/react-devtools/dist/index.css +0 -1
  26. package/react-devtools/dist/index.js +4 -6
  27. package/realtime/dist/index.cjs +4 -4
  28. package/realtime/dist/index.d.ts +1 -96
  29. package/realtime/dist/index.js +6 -6
  30. package/realtime/src/shared-room-store.ts +5 -3
  31. package/realtime-client/dist/index.cjs +0 -2
  32. package/realtime-client/dist/index.js +4 -6
  33. package/realtime-react/dist/index.cjs +0 -2
  34. package/realtime-react/dist/index.js +2 -4
  35. package/realtime-server/dist/index.cjs +162 -20
  36. package/realtime-server/dist/index.d.ts +1 -91
  37. package/realtime-server/dist/index.js +32 -20
  38. package/realtime-server/src/realtime-continuity-synchronizer.ts +8 -6
  39. package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +22 -10
  40. package/realtime-testing/dist/index.cjs +48 -8
  41. package/realtime-testing/dist/index.js +13 -8
  42. package/realtime-testing/src/setup-realtime-test.tsx +8 -2
  43. package/transceivers/set-rtx/dist/index.cjs +0 -2
  44. package/transceivers/set-rtx/dist/index.js +1 -3
  45. package/data/dist/index.cjs.map +0 -1
  46. package/data/dist/index.js.map +0 -1
  47. package/dist/chunk-3J2EGSBE.js.map +0 -1
  48. package/dist/chunk-A4ZCNKWQ.js.map +0 -1
  49. package/dist/chunk-IZHOMSXA.js.map +0 -1
  50. package/dist/chunk-NYCVSXQB.js.map +0 -1
  51. package/dist/chunk-NYTGCPHB.js.map +0 -1
  52. package/dist/chunk-PZLG2HP3.js.map +0 -1
  53. package/dist/chunk-XACXFU3B.js.map +0 -1
  54. package/dist/index.cjs.map +0 -1
  55. package/dist/index.js.map +0 -1
  56. package/internal/dist/index.cjs.map +0 -1
  57. package/internal/dist/index.js.map +0 -1
  58. package/introspection/dist/index.cjs.map +0 -1
  59. package/introspection/dist/index.js.map +0 -1
  60. package/json/dist/index.cjs.map +0 -1
  61. package/json/dist/index.js.map +0 -1
  62. package/react/dist/index.cjs.map +0 -1
  63. package/react/dist/index.js.map +0 -1
  64. package/react-devtools/dist/index.cjs.map +0 -1
  65. package/react-devtools/dist/index.css.map +0 -1
  66. package/react-devtools/dist/index.js.map +0 -1
  67. package/realtime/dist/index.cjs.map +0 -1
  68. package/realtime/dist/index.js.map +0 -1
  69. package/realtime-client/dist/index.cjs.map +0 -1
  70. package/realtime-client/dist/index.js.map +0 -1
  71. package/realtime-react/dist/index.cjs.map +0 -1
  72. package/realtime-react/dist/index.js.map +0 -1
  73. package/realtime-server/dist/index.cjs.map +0 -1
  74. package/realtime-server/dist/index.js.map +0 -1
  75. package/realtime-testing/dist/index.cjs.map +0 -1
  76. package/realtime-testing/dist/index.js.map +0 -1
  77. package/transceivers/set-rtx/dist/index.cjs.map +0 -1
  78. package/transceivers/set-rtx/dist/index.js.map +0 -1
@@ -0,0 +1,489 @@
1
+ import { Junction } from './chunk-WX2NCOZR.js';
2
+ import { dispose } from 'atom.io';
3
+ import { getFromStore, setIntoStore, findInStore, createMutableAtomFamily, createRegularAtomFamily, IMPLICIT, newest, isChildStore, createSelectorFamily, getJsonFamily } from 'atom.io/internal';
4
+ import { SetRTX } from 'atom.io/transceivers/set-rtx';
5
+
6
+ function capitalize(string) {
7
+ return string[0].toUpperCase() + string.slice(1);
8
+ }
9
+ var Join = class _Join {
10
+ transact(transactors, run) {
11
+ const originalTransactors = this.transactors;
12
+ this.transactors = transactors;
13
+ run(this);
14
+ this.transactors = originalTransactors;
15
+ }
16
+ in(store) {
17
+ const key = store.config.name;
18
+ const alternate = this.alternates.get(key);
19
+ if (alternate) {
20
+ return alternate;
21
+ }
22
+ const join2 = new _Join(this.options, this.defaultContent, store);
23
+ this.alternates.set(key, join2);
24
+ join2.alternates = this.alternates;
25
+ return join2;
26
+ }
27
+ constructor(options, defaultContent, store = IMPLICIT.STORE) {
28
+ this.options = options;
29
+ this.defaultContent = defaultContent;
30
+ this.alternates = /* @__PURE__ */ new Map();
31
+ this.alternates.set(store.config.name, this);
32
+ this.transactors = {
33
+ get: (token) => getFromStore(token, store),
34
+ set: (token, value) => setIntoStore(token, value, store),
35
+ find: (token, key) => findInStore(token, key, store)
36
+ };
37
+ const a = options.between[0];
38
+ const b = options.between[1];
39
+ const relatedKeysAtoms = createMutableAtomFamily(
40
+ {
41
+ key: `${options.key}/relatedKeys`,
42
+ default: () => new SetRTX(),
43
+ mutable: true,
44
+ fromJson: (json) => SetRTX.fromJSON(json),
45
+ toJson: (set) => set.toJSON()
46
+ },
47
+ store
48
+ );
49
+ this.core = { findRelatedKeysState: relatedKeysAtoms };
50
+ const getRelatedKeys = ({ find, get }, key) => get(find(relatedKeysAtoms, key));
51
+ const addRelation = (transactors, a2, b2) => {
52
+ const { set, find } = transactors;
53
+ const aKeysState = find(relatedKeysAtoms, a2);
54
+ const bKeysState = find(relatedKeysAtoms, b2);
55
+ set(aKeysState, (aKeys) => aKeys.add(b2));
56
+ set(bKeysState, (bKeys) => bKeys.add(a2));
57
+ };
58
+ const deleteRelation = (transactors, a2, b2) => {
59
+ const { find, set } = transactors;
60
+ const aKeysState = find(relatedKeysAtoms, a2);
61
+ const bKeysState = find(relatedKeysAtoms, b2);
62
+ set(aKeysState, (aKeys) => (aKeys.delete(b2), aKeys));
63
+ set(bKeysState, (bKeys) => (bKeys.delete(a2), bKeys));
64
+ };
65
+ const replaceRelationsSafely = (transactors, a2, newRelationsOfA) => {
66
+ const { find, get, set } = transactors;
67
+ const relationsOfAState = find(relatedKeysAtoms, a2);
68
+ const currentRelationsOfA = get(relationsOfAState);
69
+ for (const currentRelationB of currentRelationsOfA) {
70
+ const remainsRelated = newRelationsOfA.includes(currentRelationB);
71
+ if (remainsRelated) {
72
+ continue;
73
+ }
74
+ const relationsOfBState = find(relatedKeysAtoms, currentRelationB);
75
+ set(relationsOfBState, (relationsOfB) => {
76
+ relationsOfB.delete(a2);
77
+ return relationsOfB;
78
+ });
79
+ }
80
+ set(relationsOfAState, (relationsOfA) => {
81
+ relationsOfA.transaction((nextRelationsOfA) => {
82
+ nextRelationsOfA.clear();
83
+ for (const newRelationB of newRelationsOfA) {
84
+ const relationsOfB = getRelatedKeys(transactors, newRelationB);
85
+ const newRelationBIsAlreadyRelated = relationsOfB.has(a2);
86
+ if (this.relations.cardinality === `1:n`) {
87
+ for (const previousOwner of relationsOfB) {
88
+ if (previousOwner === a2) {
89
+ continue;
90
+ }
91
+ const previousOwnerRelations = getRelatedKeys(
92
+ transactors,
93
+ previousOwner
94
+ );
95
+ previousOwnerRelations.delete(newRelationB);
96
+ }
97
+ if (!newRelationBIsAlreadyRelated && relationsOfB.size > 0) {
98
+ relationsOfB.clear();
99
+ }
100
+ }
101
+ if (!newRelationBIsAlreadyRelated) {
102
+ relationsOfB.add(a2);
103
+ }
104
+ nextRelationsOfA.add(newRelationB);
105
+ }
106
+ return true;
107
+ });
108
+ return relationsOfA;
109
+ });
110
+ };
111
+ const replaceRelationsUnsafely = (transactors, a2, newRelationsOfA) => {
112
+ const { find, set } = transactors;
113
+ const relationsOfAState = find(relatedKeysAtoms, a2);
114
+ set(relationsOfAState, (relationsOfA) => {
115
+ relationsOfA.transaction((nextRelationsOfA) => {
116
+ for (const newRelationB of newRelationsOfA) {
117
+ nextRelationsOfA.add(newRelationB);
118
+ }
119
+ return true;
120
+ });
121
+ return relationsOfA;
122
+ });
123
+ for (const newRelationB of newRelationsOfA) {
124
+ const newRelationsBState = find(relatedKeysAtoms, newRelationB);
125
+ set(newRelationsBState, (newRelationsB) => {
126
+ newRelationsB.add(a2);
127
+ return newRelationsB;
128
+ });
129
+ }
130
+ return true;
131
+ };
132
+ const has = (transactors, a2, b2) => {
133
+ const aKeys = getRelatedKeys(transactors, a2);
134
+ return b2 ? aKeys.has(b2) : aKeys.size > 0;
135
+ };
136
+ const baseExternalStoreConfiguration = {
137
+ getRelatedKeys: (key) => getRelatedKeys(this.transactors, key),
138
+ addRelation: (a2, b2) => addRelation(this.transactors, a2, b2),
139
+ deleteRelation: (a2, b2) => deleteRelation(this.transactors, a2, b2),
140
+ replaceRelationsSafely: (a2, bs) => replaceRelationsSafely(this.transactors, a2, bs),
141
+ replaceRelationsUnsafely: (a2, bs) => replaceRelationsUnsafely(this.transactors, a2, bs),
142
+ has: (a2, b2) => has(this.transactors, a2, b2)
143
+ };
144
+ let externalStore;
145
+ let contentAtoms;
146
+ if (defaultContent) {
147
+ contentAtoms = createRegularAtomFamily(
148
+ {
149
+ key: `${options.key}/content`,
150
+ default: defaultContent
151
+ },
152
+ store
153
+ );
154
+ const getContent = ({ find, get }, key) => get(find(contentAtoms, key));
155
+ const setContent = ({ find, set }, key, content) => set(find(contentAtoms, key), content);
156
+ const deleteContent = ({ find }, key) => dispose(find(contentAtoms, key));
157
+ const externalStoreWithContentConfiguration = {
158
+ getContent: (contentKey) => {
159
+ const content = getContent(this.transactors, contentKey);
160
+ return content;
161
+ },
162
+ setContent: (contentKey, content) => {
163
+ setContent(this.transactors, contentKey, content);
164
+ },
165
+ deleteContent: (contentKey) => {
166
+ deleteContent(this.transactors, contentKey);
167
+ }
168
+ };
169
+ externalStore = Object.assign(
170
+ baseExternalStoreConfiguration,
171
+ externalStoreWithContentConfiguration
172
+ );
173
+ } else {
174
+ externalStore = baseExternalStoreConfiguration;
175
+ }
176
+ const relations = new Junction(options, {
177
+ externalStore,
178
+ makeContentKey: (...args) => args.sort().join(`:`)
179
+ });
180
+ const createSingleKeyStateFamily = () => createSelectorFamily(
181
+ {
182
+ key: `${options.key}/singleRelatedKey`,
183
+ get: (key) => ({ find, get }) => {
184
+ const relatedKeysState = find(relatedKeysAtoms, key);
185
+ const relatedKeys = get(relatedKeysState);
186
+ for (const relatedKey of relatedKeys) {
187
+ return relatedKey;
188
+ }
189
+ return null;
190
+ }
191
+ },
192
+ store
193
+ );
194
+ const getMultipleKeyStateFamily = () => {
195
+ return createSelectorFamily(
196
+ {
197
+ key: `${options.key}/multipleRelatedKeys`,
198
+ get: (key) => ({ find, get }) => {
199
+ const jsonFamily = getJsonFamily(relatedKeysAtoms, store);
200
+ const jsonState = find(jsonFamily, key);
201
+ const json = get(jsonState);
202
+ return json.members;
203
+ }
204
+ },
205
+ store
206
+ );
207
+ };
208
+ const createSingleEntryStateFamily = () => createSelectorFamily(
209
+ {
210
+ key: `${options.key}/singleRelatedEntry`,
211
+ get: (key) => ({ find, get }) => {
212
+ const relatedKeysState = find(relatedKeysAtoms, key);
213
+ const relatedKeys = get(relatedKeysState);
214
+ for (const relatedKey of relatedKeys) {
215
+ const contentKey = relations.makeContentKey(key, relatedKey);
216
+ const contentState = find(contentAtoms, contentKey);
217
+ const content = get(contentState);
218
+ return [relatedKey, content];
219
+ }
220
+ return null;
221
+ }
222
+ },
223
+ store
224
+ );
225
+ const getMultipleEntryStateFamily = () => createSelectorFamily(
226
+ {
227
+ key: `${options.key}/multipleRelatedEntries`,
228
+ get: (key) => ({ find, get }) => {
229
+ const jsonFamily = getJsonFamily(relatedKeysAtoms, store);
230
+ const json = get(jsonFamily(key));
231
+ return json.members.map((relatedKey) => {
232
+ const contentKey = relations.makeContentKey(key, relatedKey);
233
+ const contentState = find(contentAtoms, contentKey);
234
+ const content = get(contentState);
235
+ return [relatedKey, content];
236
+ });
237
+ }
238
+ },
239
+ store
240
+ );
241
+ switch (options.cardinality) {
242
+ case `1:1`: {
243
+ const findSingleRelatedKeyState = createSingleKeyStateFamily();
244
+ const stateKeyA = `${a}KeyOf${capitalize(b)}`;
245
+ const stateKeyB = `${b}KeyOf${capitalize(a)}`;
246
+ const baseStates = {
247
+ [stateKeyA]: findSingleRelatedKeyState,
248
+ [stateKeyB]: findSingleRelatedKeyState
249
+ };
250
+ let states;
251
+ if (defaultContent) {
252
+ const findSingleRelatedEntryState = createSingleEntryStateFamily();
253
+ const entriesStateKeyA = `${a}EntryOf${capitalize(b)}`;
254
+ const entriesStateKeyB = `${b}EntryOf${capitalize(a)}`;
255
+ const contentStates = {
256
+ [entriesStateKeyA]: findSingleRelatedEntryState,
257
+ [entriesStateKeyB]: findSingleRelatedEntryState
258
+ };
259
+ states = Object.assign(baseStates, contentStates);
260
+ } else {
261
+ states = baseStates;
262
+ }
263
+ this.relations = relations;
264
+ this.states = states;
265
+ break;
266
+ }
267
+ case `1:n`: {
268
+ const findSingleRelatedKeyState = createSingleKeyStateFamily();
269
+ const findMultipleRelatedKeysState = getMultipleKeyStateFamily();
270
+ const stateKeyA = `${a}KeyOf${capitalize(b)}`;
271
+ const stateKeyB = `${b}KeysOf${capitalize(a)}`;
272
+ const baseStates = {
273
+ [stateKeyA]: findSingleRelatedKeyState,
274
+ [stateKeyB]: findMultipleRelatedKeysState
275
+ };
276
+ let states;
277
+ if (defaultContent) {
278
+ const findSingleRelatedEntryState = createSingleEntryStateFamily();
279
+ const findMultipleRelatedEntriesState = getMultipleEntryStateFamily();
280
+ const entriesStateKeyA = `${a}EntryOf${capitalize(b)}`;
281
+ const entriesStateKeyB = `${b}EntriesOf${capitalize(a)}`;
282
+ const contentStates = {
283
+ [entriesStateKeyA]: findSingleRelatedEntryState,
284
+ [entriesStateKeyB]: findMultipleRelatedEntriesState
285
+ };
286
+ states = Object.assign(baseStates, contentStates);
287
+ } else {
288
+ states = baseStates;
289
+ }
290
+ this.relations = relations;
291
+ this.states = states;
292
+ break;
293
+ }
294
+ default: {
295
+ const findMultipleRelatedKeysState = getMultipleKeyStateFamily();
296
+ const stateKeyA = `${a}KeysOf${capitalize(b)}`;
297
+ const stateKeyB = `${b}KeysOf${capitalize(a)}`;
298
+ const baseStates = {
299
+ [stateKeyA]: findMultipleRelatedKeysState,
300
+ [stateKeyB]: findMultipleRelatedKeysState
301
+ };
302
+ let states;
303
+ if (defaultContent) {
304
+ const findMultipleRelatedEntriesState = getMultipleEntryStateFamily();
305
+ const entriesStateKeyA = `${a}EntriesOf${capitalize(b)}`;
306
+ const entriesStateKeyB = `${b}EntriesOf${capitalize(a)}`;
307
+ const contentStates = {
308
+ [entriesStateKeyA]: findMultipleRelatedEntriesState,
309
+ [entriesStateKeyB]: findMultipleRelatedEntriesState
310
+ };
311
+ states = Object.assign(baseStates, contentStates);
312
+ } else {
313
+ states = baseStates;
314
+ }
315
+ this.relations = relations;
316
+ this.states = states;
317
+ }
318
+ }
319
+ }
320
+ };
321
+ function join(options, defaultContent, store = IMPLICIT.STORE) {
322
+ const joins = getJoinMap(store);
323
+ joins.set(options.key, new Join(options, defaultContent, store));
324
+ const token = {
325
+ key: options.key,
326
+ type: `join`,
327
+ a: options.between[0],
328
+ b: options.between[1],
329
+ cardinality: options.cardinality
330
+ };
331
+ return token;
332
+ }
333
+ function getJoinMap(store) {
334
+ if (`joins` in store && store.joins instanceof Map) {
335
+ return store.joins;
336
+ }
337
+ const joins = /* @__PURE__ */ new Map();
338
+ store.joins = joins;
339
+ return joins;
340
+ }
341
+ function getJoin(token, store) {
342
+ var _a;
343
+ const joinMap = getJoinMap(store);
344
+ let join2 = joinMap.get(token.key);
345
+ if (join2 === void 0) {
346
+ const rootJoinMap = getJoinMap(IMPLICIT.STORE);
347
+ join2 = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
348
+ if (join2 === void 0) {
349
+ throw new Error(
350
+ `Join "${token.key}" not found in store "${store.config.name}"`
351
+ );
352
+ }
353
+ joinMap.set(token.key, join2);
354
+ }
355
+ return join2;
356
+ }
357
+ function findRelationsInStore(token, key, store) {
358
+ const join2 = getJoin(token, store);
359
+ let relations;
360
+ switch (token.cardinality) {
361
+ case `1:1`: {
362
+ const keyAB = `${token.a}KeyOf${capitalize(token.b)}`;
363
+ const keyBA = `${token.b}KeyOf${capitalize(token.a)}`;
364
+ relations = {
365
+ get [keyAB]() {
366
+ const familyAB = join2.states[keyAB];
367
+ const state = findInStore(familyAB, key, store);
368
+ return state;
369
+ },
370
+ get [keyBA]() {
371
+ const familyBA = join2.states[keyBA];
372
+ const state = findInStore(familyBA, key, store);
373
+ return state;
374
+ }
375
+ };
376
+ const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
377
+ if (entryAB in join2.states) {
378
+ const entryBA = `${token.b}EntryOf${capitalize(token.a)}`;
379
+ Object.assign(relations, {
380
+ get [entryAB]() {
381
+ const familyAB = join2.states[entryAB];
382
+ const state = findInStore(familyAB, key, store);
383
+ return state;
384
+ },
385
+ get [entryBA]() {
386
+ const familyBA = join2.states[entryBA];
387
+ const state = findInStore(familyBA, key, store);
388
+ return state;
389
+ }
390
+ });
391
+ }
392
+ break;
393
+ }
394
+ case `1:n`: {
395
+ const keyAB = `${token.a}KeyOf${capitalize(token.b)}`;
396
+ const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
397
+ relations = {
398
+ get [keyAB]() {
399
+ const familyAB = join2.states[keyAB];
400
+ const state = findInStore(familyAB, key, store);
401
+ return state;
402
+ },
403
+ get [keysBA]() {
404
+ const familyBA = join2.states[keysBA];
405
+ const state = findInStore(familyBA, key, store);
406
+ return state;
407
+ }
408
+ };
409
+ const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
410
+ if (entryAB in join2.states) {
411
+ const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
412
+ Object.assign(relations, {
413
+ get [entryAB]() {
414
+ const familyAB = join2.states[entryAB];
415
+ const state = findInStore(familyAB, key, store);
416
+ return state;
417
+ },
418
+ get [entriesBA]() {
419
+ const familyBA = join2.states[entriesBA];
420
+ const state = findInStore(familyBA, key, store);
421
+ return state;
422
+ }
423
+ });
424
+ }
425
+ break;
426
+ }
427
+ case `n:n`: {
428
+ const keysAB = `${token.a}KeysOf${capitalize(token.b)}`;
429
+ const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
430
+ relations = {
431
+ get [keysAB]() {
432
+ const familyAB = join2.states[keysAB];
433
+ const state = findInStore(familyAB, key, store);
434
+ return state;
435
+ },
436
+ get [keysBA]() {
437
+ const familyBA = join2.states[keysBA];
438
+ const state = findInStore(familyBA, key, store);
439
+ return state;
440
+ }
441
+ };
442
+ const entriesAB = `${token.a}EntriesOf${capitalize(token.b)}`;
443
+ if (entriesAB in join2.states) {
444
+ const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
445
+ Object.assign(relations, {
446
+ get [entriesAB]() {
447
+ const familyAB = join2.states[entriesAB];
448
+ const state = findInStore(familyAB, key, store);
449
+ return state;
450
+ },
451
+ get [entriesBA]() {
452
+ const familyBA = join2.states[entriesBA];
453
+ const state = findInStore(familyBA, key, store);
454
+ return state;
455
+ }
456
+ });
457
+ }
458
+ }
459
+ }
460
+ return relations;
461
+ }
462
+ function findRelations(token, key) {
463
+ return findRelationsInStore(token, key, IMPLICIT.STORE);
464
+ }
465
+ function editRelationsInStore(token, change, store) {
466
+ const join2 = getJoin(token, store);
467
+ const target = newest(store);
468
+ if (isChildStore(target)) {
469
+ const { transactors } = target.transactionMeta;
470
+ join2.transact(transactors, ({ relations }) => {
471
+ change(relations);
472
+ });
473
+ } else {
474
+ change(join2.relations);
475
+ }
476
+ }
477
+ function editRelations(token, change) {
478
+ editRelationsInStore(token, change, IMPLICIT.STORE);
479
+ }
480
+ function getInternalRelationsFromStore(token, store) {
481
+ const join2 = getJoin(token, store);
482
+ const family = join2.core.findRelatedKeysState;
483
+ return family;
484
+ }
485
+ function getInternalRelations(token) {
486
+ return getInternalRelationsFromStore(token, IMPLICIT.STORE);
487
+ }
488
+
489
+ export { Join, editRelations, editRelationsInStore, findRelations, findRelationsInStore, getInternalRelations, getInternalRelationsFromStore, getJoin, getJoinMap, join };
@@ -14,5 +14,3 @@ var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, on
14
14
  var lazyLocalStorageEffect = persistAtom(window.localStorage)(JSON);
15
15
 
16
16
  export { lazyLocalStorageEffect };
17
- //# sourceMappingURL=out.js.map
18
- //# sourceMappingURL=chunk-A4ZCNKWQ.js.map
@@ -177,5 +177,3 @@ var delve = (obj, path) => {
177
177
  };
178
178
 
179
179
  export { addTo, become, comprises, delve, doNothing, doesExtend, entriesToRecord, fallback, hasExactProperties, ifDefined, isArray, isEmptyArray, isEmptyObject, isModifier, isOneOf, isPlainObject, isRecord, map, mapObject, pipe, raiseError, recordToEntries, sprawl, treeShake };
180
- //# sourceMappingURL=out.js.map
181
- //# sourceMappingURL=chunk-NYCVSXQB.js.map
@@ -1,4 +1,4 @@
1
- import { lazyLocalStorageEffect } from './chunk-A4ZCNKWQ.js';
1
+ import { lazyLocalStorageEffect } from './chunk-BWWVY5O5.js';
2
2
  import * as AtomIO from 'atom.io';
3
3
 
4
4
  var myIdState__INTERNAL = AtomIO.atom({
@@ -27,5 +27,3 @@ var confirmedUpdateQueue = AtomIO.atom(
27
27
  );
28
28
 
29
29
  export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue };
30
- //# sourceMappingURL=out.js.map
31
- //# sourceMappingURL=chunk-3J2EGSBE.js.map
@@ -32,5 +32,3 @@ var __objRest = (source, exclude) => {
32
32
  };
33
33
 
34
34
  export { __objRest, __restKey, __spreadProps, __spreadValues };
35
- //# sourceMappingURL=out.js.map
36
- //# sourceMappingURL=chunk-PZLG2HP3.js.map
@@ -42,5 +42,3 @@ var isPrimitive = (input) => {
42
42
  };
43
43
 
44
44
  export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson };
45
- //# sourceMappingURL=out.js.map
46
- //# sourceMappingURL=chunk-XACXFU3B.js.map
@@ -257,5 +257,3 @@ var Junction = class {
257
257
  };
258
258
 
259
259
  export { Junction };
260
- //# sourceMappingURL=out.js.map
261
- //# sourceMappingURL=chunk-NYTGCPHB.js.map
@@ -327,5 +327,3 @@ function syncContinuity(continuity, socket, store) {
327
327
  }
328
328
 
329
329
  export { syncContinuity };
330
- //# sourceMappingURL=out.js.map
331
- //# sourceMappingURL=chunk-IZHOMSXA.js.map
package/dist/index.cjs CHANGED
@@ -177,5 +177,3 @@ exports.subscribe = subscribe;
177
177
  exports.timeline = timeline;
178
178
  exports.transaction = transaction;
179
179
  exports.undo = undo;
180
- //# sourceMappingURL=out.js.map
181
- //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import './chunk-PZLG2HP3.js';
1
+ import './chunk-U2IICNHQ.js';
2
2
  import * as Internal from 'atom.io/internal';
3
3
  import { createStandaloneAtom, IMPLICIT, createAtomFamily, findInStore, createStandaloneSelector, createSelectorFamily, Store, createTransaction, createTimeline, getFromStore, setIntoStore, timeTravel, subscribeToTimeline, subscribeToTransaction, subscribeToState, arbitrary, actUponStore } from 'atom.io/internal';
4
4
 
@@ -136,5 +136,3 @@ function belongsTo(family, unknownToken) {
136
136
  }
137
137
 
138
138
  export { AtomIOLogger, LOG_LEVELS, Silo, atom, atomFamily, belongsTo, dispose, findState, getState, isToken, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo };
139
- //# sourceMappingURL=out.js.map
140
- //# sourceMappingURL=index.js.map
@@ -2584,5 +2584,3 @@ exports.traceSelectorAtoms = traceSelectorAtoms;
2584
2584
  exports.updateSelectorAtoms = updateSelectorAtoms;
2585
2585
  exports.withdraw = withdraw;
2586
2586
  exports.withdrawOrCreate = withdrawOrCreate;
2587
- //# sourceMappingURL=out.js.map
2588
- //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { Junction } from '../../dist/chunk-NYTGCPHB.js';
2
- import { __spreadValues, __spreadProps } from '../../dist/chunk-PZLG2HP3.js';
1
+ import { Junction } from '../../dist/chunk-WX2NCOZR.js';
2
+ import { __spreadValues, __spreadProps } from '../../dist/chunk-U2IICNHQ.js';
3
3
  import { stringifyJson, selectJson, parseJson, selectJsonFamily } from 'atom.io/json';
4
4
  import { AtomIOLogger } from 'atom.io';
5
5
 
@@ -2224,5 +2224,3 @@ function getEpochNumberOfAction(transactionKey, store) {
2224
2224
  var TRANSACTION_PHASES = [`idle`, `building`, `applying`];
2225
2225
 
2226
2226
  export { FamilyTracker, Future, IMPLICIT, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, addAtomToTimeline, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deleteAtom, deleteSelector, deposit, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, ingestAtomUpdate, ingestSelectorUpdate, ingestTransactionUpdate, isAtomDefault, isAtomKey, isChildStore, isDone, isMutable, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw, withdrawOrCreate };
2227
- //# sourceMappingURL=out.js.map
2228
- //# sourceMappingURL=index.js.map
@@ -331,5 +331,3 @@ var attachIntrospectionStates = (store = Internal__namespace.IMPLICIT.STORE) =>
331
331
  };
332
332
 
333
333
  exports.attachIntrospectionStates = attachIntrospectionStates;
334
- //# sourceMappingURL=out.js.map
335
- //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { __spreadValues, __spreadProps } from '../../dist/chunk-PZLG2HP3.js';
1
+ import { __spreadValues, __spreadProps } from '../../dist/chunk-U2IICNHQ.js';
2
2
  import * as Internal from 'atom.io/internal';
3
3
  import { createRegularAtom, newest, createStandaloneSelector, IMPLICIT, createRegularAtomFamily, Subject, createSelectorFamily } from 'atom.io/internal';
4
4
 
@@ -292,5 +292,3 @@ var attachIntrospectionStates = (store = Internal.IMPLICIT.STORE) => {
292
292
  };
293
293
 
294
294
  export { attachIntrospectionStates };
295
- //# sourceMappingURL=out.js.map
296
- //# sourceMappingURL=index.js.map
@@ -86,5 +86,3 @@ exports.selectJson = selectJson;
86
86
  exports.selectJsonFamily = selectJsonFamily;
87
87
  exports.stringSetJsonInterface = stringSetJsonInterface;
88
88
  exports.stringifyJson = stringifyJson;
89
- //# sourceMappingURL=out.js.map
90
- //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
- import { parseJson } from '../../dist/chunk-XACXFU3B.js';
2
- export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-XACXFU3B.js';
3
- import '../../dist/chunk-PZLG2HP3.js';
1
+ import { parseJson } from '../../dist/chunk-VAE5OCKN.js';
2
+ export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-VAE5OCKN.js';
3
+ import '../../dist/chunk-U2IICNHQ.js';
4
4
  import { createStandaloneSelector, IMPLICIT, createSelectorFamily } from 'atom.io/internal';
5
5
 
6
6
  var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
@@ -34,5 +34,3 @@ function selectJsonFamily(atomFamily, transform, store = IMPLICIT.STORE) {
34
34
  }
35
35
 
36
36
  export { selectJson, selectJsonFamily };
37
- //# sourceMappingURL=out.js.map
38
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.18.2",
3
+ "version": "0.19.0",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -78,7 +78,7 @@
78
78
  "@testing-library/react": "14.2.1",
79
79
  "@types/http-proxy": "1.17.14",
80
80
  "@types/npmlog": "7.0.0",
81
- "@types/react": "18.2.61",
81
+ "@types/react": "18.2.62",
82
82
  "@types/tmp": "0.2.6",
83
83
  "@vitest/coverage-v8": "1.3.1",
84
84
  "@vitest/ui": "1.3.1",
@@ -100,7 +100,7 @@
100
100
  "tmp": "0.2.3",
101
101
  "tsup": "8.0.2",
102
102
  "typescript": "5.3.3",
103
- "vite": "5.1.4",
103
+ "vite": "5.1.5",
104
104
  "vite-tsconfig-paths": "4.3.1",
105
105
  "vitest": "1.3.1"
106
106
  },
@@ -89,5 +89,3 @@ exports.useI = useI;
89
89
  exports.useJSON = useJSON;
90
90
  exports.useO = useO;
91
91
  exports.useTL = useTL;
92
- //# sourceMappingURL=out.js.map
93
- //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import '../../dist/chunk-PZLG2HP3.js';
1
+ import '../../dist/chunk-U2IICNHQ.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';
@@ -62,5 +62,3 @@ function useTL(token) {
62
62
  }
63
63
 
64
64
  export { StoreContext, StoreProvider, useI, useJSON, useO, useTL };
65
- //# sourceMappingURL=out.js.map
66
- //# sourceMappingURL=index.js.map