atom.io 0.19.1 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/dist/index.cjs +99 -79
- package/data/dist/index.js +3 -3
- package/data/package.json +1 -1
- package/data/src/join.ts +67 -50
- package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
- package/dist/{chunk-7VCCW45K.js → chunk-CC7IF7QF.js} +4 -3
- package/dist/{chunk-U2IICNHQ.js → chunk-F2X4B4VY.js} +5 -1
- package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
- package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
- package/dist/index.cjs +14 -7
- package/dist/index.d.ts +23 -35
- package/dist/index.js +15 -8
- package/eslint-plugin/dist/index.cjs +180 -0
- package/eslint-plugin/dist/index.js +171 -0
- package/eslint-plugin/package.json +16 -0
- package/eslint-plugin/src/index.ts +11 -0
- package/eslint-plugin/src/rules/index.ts +1 -0
- package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +190 -0
- package/internal/dist/index.cjs +55 -43
- package/internal/dist/index.d.ts +20 -20
- package/internal/dist/index.js +49 -37
- package/internal/package.json +1 -1
- package/internal/src/atom/create-regular-atom.ts +7 -5
- package/internal/src/atom/delete-atom.ts +2 -2
- package/internal/src/families/create-readonly-selector-family.ts +2 -2
- package/internal/src/families/create-regular-atom-family.ts +1 -1
- package/internal/src/families/create-writable-selector-family.ts +1 -1
- package/internal/src/future.ts +4 -2
- package/internal/src/lineage.ts +1 -0
- package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
- package/internal/src/mutable/create-mutable-atom.ts +7 -5
- package/internal/src/mutable/tracker.ts +3 -3
- package/internal/src/mutable/transceiver.ts +2 -2
- package/internal/src/selector/delete-selector.ts +1 -1
- package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
- package/internal/src/store/deposit.ts +5 -5
- package/internal/src/store/store.ts +5 -5
- package/internal/src/store/withdraw.ts +4 -5
- package/internal/src/subject.ts +3 -1
- package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
- package/internal/src/timeline/add-atom-to-timeline.ts +13 -8
- package/internal/src/timeline/create-timeline.ts +3 -4
- package/internal/src/transaction/act-upon-store.ts +5 -5
- package/internal/src/transaction/apply-transaction.ts +4 -4
- package/internal/src/transaction/build-transaction.ts +9 -6
- package/internal/src/transaction/create-transaction.ts +10 -10
- package/internal/src/transaction/index.ts +3 -3
- package/internal/src/transaction/is-root-store.ts +2 -2
- package/introspection/dist/index.d.ts +3 -3
- package/introspection/dist/index.js +1 -1
- package/introspection/package.json +1 -1
- package/introspection/src/attach-introspection-states.ts +3 -3
- package/introspection/src/attach-transaction-index.ts +4 -4
- package/introspection/src/attach-transaction-logs.ts +8 -4
- package/json/dist/index.cjs +6 -2
- package/json/dist/index.js +7 -3
- package/json/package.json +1 -1
- package/json/src/select-json-family.ts +3 -2
- package/json/src/select-json.ts +3 -1
- package/package.json +258 -241
- package/react/dist/index.cjs +9 -3
- package/react/dist/index.js +10 -4
- package/react/package.json +1 -1
- package/react/src/use-i.ts +3 -1
- package/react/src/use-tl.ts +6 -2
- package/react-devtools/dist/index.cjs +205 -155
- package/react-devtools/dist/index.d.ts +3 -5
- package/react-devtools/dist/index.js +182 -133
- package/react-devtools/package.json +1 -1
- package/react-devtools/src/AtomIODevtools.tsx +3 -1
- package/react-devtools/src/Button.tsx +3 -1
- package/react-devtools/src/StateIndex.tsx +6 -2
- package/react-devtools/src/TimelineIndex.tsx +6 -2
- package/react-devtools/src/TransactionIndex.tsx +3 -3
- package/react-devtools/src/Updates.tsx +24 -13
- package/realtime/dist/index.cjs +1 -0
- package/realtime/dist/index.d.ts +2 -2
- package/realtime/dist/index.js +2 -1
- package/realtime/package.json +1 -1
- package/realtime/src/realtime-continuity.ts +4 -3
- package/realtime-client/dist/index.cjs +29 -29
- package/realtime-client/dist/index.d.ts +2 -2
- package/realtime-client/dist/index.js +2 -2
- package/realtime-client/package.json +1 -1
- package/realtime-client/src/server-action.ts +2 -2
- package/realtime-client/src/sync-continuity.ts +23 -23
- package/realtime-react/dist/index.cjs +29 -29
- package/realtime-react/dist/index.d.ts +2 -2
- package/realtime-react/dist/index.js +2 -2
- package/realtime-react/package.json +1 -1
- package/realtime-react/src/use-server-action.ts +3 -3
- package/realtime-server/dist/index.cjs +54 -44
- package/realtime-server/dist/index.d.ts +5 -5
- package/realtime-server/dist/index.js +35 -25
- package/realtime-server/package.json +1 -1
- package/realtime-server/src/ipc-sockets/child-socket.ts +6 -6
- package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
- package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
- package/realtime-server/src/realtime-action-receiver.ts +7 -5
- package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
- package/realtime-server/src/realtime-state-receiver.ts +3 -1
- package/realtime-testing/dist/index.cjs +15 -13
- package/realtime-testing/dist/index.js +10 -8
- package/realtime-testing/package.json +1 -1
- package/realtime-testing/src/setup-realtime-test.tsx +6 -4
- package/src/atom.ts +4 -8
- package/src/dispose.ts +1 -0
- package/src/index.ts +2 -9
- package/src/selector.ts +4 -8
- package/src/silo.ts +9 -3
- package/src/subscribe.ts +6 -6
- package/src/timeline.ts +4 -4
- package/src/transaction.ts +24 -24
- package/transceivers/set-rtx/dist/index.cjs +11 -12
- package/transceivers/set-rtx/dist/index.js +12 -13
- package/transceivers/set-rtx/package.json +1 -1
- package/transceivers/set-rtx/src/set-rtx.ts +10 -10
package/data/dist/index.cjs
CHANGED
|
@@ -190,16 +190,16 @@ var Junction = class {
|
|
|
190
190
|
if (a === void 0 && typeof b === `string`) {
|
|
191
191
|
const bRelations = this.getRelatedKeys(b);
|
|
192
192
|
if (bRelations) {
|
|
193
|
-
for (const
|
|
194
|
-
this.delete(
|
|
193
|
+
for (const bRelation of bRelations) {
|
|
194
|
+
this.delete(bRelation, b);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
if (typeof a === `string` && b === void 0) {
|
|
199
199
|
const aRelations = this.getRelatedKeys(a);
|
|
200
200
|
if (aRelations) {
|
|
201
|
-
for (const
|
|
202
|
-
this.delete(a,
|
|
201
|
+
for (const aRelation of aRelations) {
|
|
202
|
+
this.delete(a, aRelation);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -252,18 +252,18 @@ var Junction = class {
|
|
|
252
252
|
if (a !== void 0 && b === void 0) {
|
|
253
253
|
const aRelations = this.getRelatedKeys(a);
|
|
254
254
|
if (aRelations) {
|
|
255
|
-
return [...aRelations].map((
|
|
255
|
+
return [...aRelations].map((aRelation) => {
|
|
256
256
|
var _a;
|
|
257
|
-
return [
|
|
257
|
+
return [aRelation, (_a = this.getContent(a, aRelation)) != null ? _a : null];
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
if (a === void 0 && b !== void 0) {
|
|
262
262
|
const bRelations = this.getRelatedKeys(b);
|
|
263
263
|
if (bRelations) {
|
|
264
|
-
return [...bRelations].map((
|
|
264
|
+
return [...bRelations].map((bRelation) => {
|
|
265
265
|
var _a;
|
|
266
|
-
return [
|
|
266
|
+
return [bRelation, (_a = this.getContent(bRelation, b)) != null ? _a : null];
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
}
|
|
@@ -308,11 +308,13 @@ var Join = class _Join {
|
|
|
308
308
|
this.alternates.set(store.config.name, this);
|
|
309
309
|
this.transactors = {
|
|
310
310
|
get: (token) => internal.getFromStore(token, store),
|
|
311
|
-
set: (token, value) =>
|
|
311
|
+
set: (token, value) => {
|
|
312
|
+
internal.setIntoStore(token, value, store);
|
|
313
|
+
},
|
|
312
314
|
find: (token, key) => internal.findInStore(token, key, store)
|
|
313
315
|
};
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
+
const aSide = options.between[0];
|
|
317
|
+
const bSide = options.between[1];
|
|
316
318
|
const relatedKeysAtoms = internal.createMutableAtomFamily(
|
|
317
319
|
{
|
|
318
320
|
key: `${options.key}/relatedKeys`,
|
|
@@ -325,23 +327,23 @@ var Join = class _Join {
|
|
|
325
327
|
);
|
|
326
328
|
this.core = { findRelatedKeysState: relatedKeysAtoms };
|
|
327
329
|
const getRelatedKeys = ({ find, get }, key) => get(find(relatedKeysAtoms, key));
|
|
328
|
-
const addRelation = (transactors,
|
|
330
|
+
const addRelation = (transactors, a, b) => {
|
|
329
331
|
const { set, find } = transactors;
|
|
330
|
-
const aKeysState = find(relatedKeysAtoms,
|
|
331
|
-
const bKeysState = find(relatedKeysAtoms,
|
|
332
|
-
set(aKeysState, (aKeys) => aKeys.add(
|
|
333
|
-
set(bKeysState, (bKeys) => bKeys.add(
|
|
332
|
+
const aKeysState = find(relatedKeysAtoms, a);
|
|
333
|
+
const bKeysState = find(relatedKeysAtoms, b);
|
|
334
|
+
set(aKeysState, (aKeys) => aKeys.add(b));
|
|
335
|
+
set(bKeysState, (bKeys) => bKeys.add(a));
|
|
334
336
|
};
|
|
335
|
-
const deleteRelation = (transactors,
|
|
337
|
+
const deleteRelation = (transactors, a, b) => {
|
|
336
338
|
const { find, set } = transactors;
|
|
337
|
-
const aKeysState = find(relatedKeysAtoms,
|
|
338
|
-
const bKeysState = find(relatedKeysAtoms,
|
|
339
|
-
set(aKeysState, (aKeys) => (aKeys.delete(
|
|
340
|
-
set(bKeysState, (bKeys) => (bKeys.delete(
|
|
339
|
+
const aKeysState = find(relatedKeysAtoms, a);
|
|
340
|
+
const bKeysState = find(relatedKeysAtoms, b);
|
|
341
|
+
set(aKeysState, (aKeys) => (aKeys.delete(b), aKeys));
|
|
342
|
+
set(bKeysState, (bKeys) => (bKeys.delete(a), bKeys));
|
|
341
343
|
};
|
|
342
|
-
const replaceRelationsSafely = (transactors,
|
|
344
|
+
const replaceRelationsSafely = (transactors, a, newRelationsOfA) => {
|
|
343
345
|
const { find, get, set } = transactors;
|
|
344
|
-
const relationsOfAState = find(relatedKeysAtoms,
|
|
346
|
+
const relationsOfAState = find(relatedKeysAtoms, a);
|
|
345
347
|
const currentRelationsOfA = get(relationsOfAState);
|
|
346
348
|
for (const currentRelationB of currentRelationsOfA) {
|
|
347
349
|
const remainsRelated = newRelationsOfA.includes(currentRelationB);
|
|
@@ -350,7 +352,7 @@ var Join = class _Join {
|
|
|
350
352
|
}
|
|
351
353
|
const relationsOfBState = find(relatedKeysAtoms, currentRelationB);
|
|
352
354
|
set(relationsOfBState, (relationsOfB) => {
|
|
353
|
-
relationsOfB.delete(
|
|
355
|
+
relationsOfB.delete(a);
|
|
354
356
|
return relationsOfB;
|
|
355
357
|
});
|
|
356
358
|
}
|
|
@@ -359,10 +361,10 @@ var Join = class _Join {
|
|
|
359
361
|
nextRelationsOfA.clear();
|
|
360
362
|
for (const newRelationB of newRelationsOfA) {
|
|
361
363
|
const relationsOfB = getRelatedKeys(transactors, newRelationB);
|
|
362
|
-
const newRelationBIsAlreadyRelated = relationsOfB.has(
|
|
364
|
+
const newRelationBIsAlreadyRelated = relationsOfB.has(a);
|
|
363
365
|
if (this.relations.cardinality === `1:n`) {
|
|
364
366
|
for (const previousOwner of relationsOfB) {
|
|
365
|
-
if (previousOwner ===
|
|
367
|
+
if (previousOwner === a) {
|
|
366
368
|
continue;
|
|
367
369
|
}
|
|
368
370
|
const previousOwnerRelations = getRelatedKeys(
|
|
@@ -376,7 +378,7 @@ var Join = class _Join {
|
|
|
376
378
|
}
|
|
377
379
|
}
|
|
378
380
|
if (!newRelationBIsAlreadyRelated) {
|
|
379
|
-
relationsOfB.add(
|
|
381
|
+
relationsOfB.add(a);
|
|
380
382
|
}
|
|
381
383
|
nextRelationsOfA.add(newRelationB);
|
|
382
384
|
}
|
|
@@ -385,9 +387,9 @@ var Join = class _Join {
|
|
|
385
387
|
return relationsOfA;
|
|
386
388
|
});
|
|
387
389
|
};
|
|
388
|
-
const replaceRelationsUnsafely = (transactors,
|
|
390
|
+
const replaceRelationsUnsafely = (transactors, a, newRelationsOfA) => {
|
|
389
391
|
const { find, set } = transactors;
|
|
390
|
-
const relationsOfAState = find(relatedKeysAtoms,
|
|
392
|
+
const relationsOfAState = find(relatedKeysAtoms, a);
|
|
391
393
|
set(relationsOfAState, (relationsOfA) => {
|
|
392
394
|
relationsOfA.transaction((nextRelationsOfA) => {
|
|
393
395
|
for (const newRelationB of newRelationsOfA) {
|
|
@@ -400,23 +402,31 @@ var Join = class _Join {
|
|
|
400
402
|
for (const newRelationB of newRelationsOfA) {
|
|
401
403
|
const newRelationsBState = find(relatedKeysAtoms, newRelationB);
|
|
402
404
|
set(newRelationsBState, (newRelationsB) => {
|
|
403
|
-
newRelationsB.add(
|
|
405
|
+
newRelationsB.add(a);
|
|
404
406
|
return newRelationsB;
|
|
405
407
|
});
|
|
406
408
|
}
|
|
407
409
|
return true;
|
|
408
410
|
};
|
|
409
|
-
const has = (transactors,
|
|
410
|
-
const aKeys = getRelatedKeys(transactors,
|
|
411
|
-
return
|
|
411
|
+
const has = (transactors, a, b) => {
|
|
412
|
+
const aKeys = getRelatedKeys(transactors, a);
|
|
413
|
+
return b ? aKeys.has(b) : aKeys.size > 0;
|
|
412
414
|
};
|
|
413
415
|
const baseExternalStoreConfiguration = {
|
|
414
416
|
getRelatedKeys: (key) => getRelatedKeys(this.transactors, key),
|
|
415
|
-
addRelation: (
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
addRelation: (a, b) => {
|
|
418
|
+
addRelation(this.transactors, a, b);
|
|
419
|
+
},
|
|
420
|
+
deleteRelation: (a, b) => {
|
|
421
|
+
deleteRelation(this.transactors, a, b);
|
|
422
|
+
},
|
|
423
|
+
replaceRelationsSafely: (a, bs) => {
|
|
424
|
+
replaceRelationsSafely(this.transactors, a, bs);
|
|
425
|
+
},
|
|
426
|
+
replaceRelationsUnsafely: (a, bs) => {
|
|
427
|
+
replaceRelationsUnsafely(this.transactors, a, bs);
|
|
428
|
+
},
|
|
429
|
+
has: (a, b) => has(this.transactors, a, b)
|
|
420
430
|
};
|
|
421
431
|
let externalStore;
|
|
422
432
|
let contentAtoms;
|
|
@@ -429,8 +439,12 @@ var Join = class _Join {
|
|
|
429
439
|
store
|
|
430
440
|
);
|
|
431
441
|
const getContent = ({ find, get }, key) => get(find(contentAtoms, key));
|
|
432
|
-
const setContent = ({ find, set }, key, content) =>
|
|
433
|
-
|
|
442
|
+
const setContent = ({ find, set }, key, content) => {
|
|
443
|
+
set(find(contentAtoms, key), content);
|
|
444
|
+
};
|
|
445
|
+
const deleteContent = ({ find }, key) => {
|
|
446
|
+
atom_io.dispose(find(contentAtoms, key));
|
|
447
|
+
};
|
|
434
448
|
const externalStoreWithContentConfiguration = {
|
|
435
449
|
getContent: (contentKey) => {
|
|
436
450
|
const content = getContent(this.transactors, contentKey);
|
|
@@ -518,8 +532,8 @@ var Join = class _Join {
|
|
|
518
532
|
switch (options.cardinality) {
|
|
519
533
|
case `1:1`: {
|
|
520
534
|
const findSingleRelatedKeyState = createSingleKeyStateFamily();
|
|
521
|
-
const stateKeyA = `${
|
|
522
|
-
const stateKeyB = `${
|
|
535
|
+
const stateKeyA = `${aSide}KeyOf${capitalize(bSide)}`;
|
|
536
|
+
const stateKeyB = `${bSide}KeyOf${capitalize(aSide)}`;
|
|
523
537
|
const baseStates = {
|
|
524
538
|
[stateKeyA]: findSingleRelatedKeyState,
|
|
525
539
|
[stateKeyB]: findSingleRelatedKeyState
|
|
@@ -527,8 +541,8 @@ var Join = class _Join {
|
|
|
527
541
|
let states;
|
|
528
542
|
if (defaultContent) {
|
|
529
543
|
const findSingleRelatedEntryState = createSingleEntryStateFamily();
|
|
530
|
-
const entriesStateKeyA = `${
|
|
531
|
-
const entriesStateKeyB = `${
|
|
544
|
+
const entriesStateKeyA = `${aSide}EntryOf${capitalize(bSide)}`;
|
|
545
|
+
const entriesStateKeyB = `${bSide}EntryOf${capitalize(aSide)}`;
|
|
532
546
|
const contentStates = {
|
|
533
547
|
[entriesStateKeyA]: findSingleRelatedEntryState,
|
|
534
548
|
[entriesStateKeyB]: findSingleRelatedEntryState
|
|
@@ -544,8 +558,8 @@ var Join = class _Join {
|
|
|
544
558
|
case `1:n`: {
|
|
545
559
|
const findSingleRelatedKeyState = createSingleKeyStateFamily();
|
|
546
560
|
const findMultipleRelatedKeysState = getMultipleKeyStateFamily();
|
|
547
|
-
const stateKeyA = `${
|
|
548
|
-
const stateKeyB = `${
|
|
561
|
+
const stateKeyA = `${aSide}KeyOf${capitalize(bSide)}`;
|
|
562
|
+
const stateKeyB = `${bSide}KeysOf${capitalize(aSide)}`;
|
|
549
563
|
const baseStates = {
|
|
550
564
|
[stateKeyA]: findSingleRelatedKeyState,
|
|
551
565
|
[stateKeyB]: findMultipleRelatedKeysState
|
|
@@ -554,8 +568,10 @@ var Join = class _Join {
|
|
|
554
568
|
if (defaultContent) {
|
|
555
569
|
const findSingleRelatedEntryState = createSingleEntryStateFamily();
|
|
556
570
|
const findMultipleRelatedEntriesState = getMultipleEntryStateFamily();
|
|
557
|
-
const entriesStateKeyA = `${
|
|
558
|
-
const entriesStateKeyB = `${
|
|
571
|
+
const entriesStateKeyA = `${aSide}EntryOf${capitalize(bSide)}`;
|
|
572
|
+
const entriesStateKeyB = `${bSide}EntriesOf${capitalize(
|
|
573
|
+
aSide
|
|
574
|
+
)}`;
|
|
559
575
|
const contentStates = {
|
|
560
576
|
[entriesStateKeyA]: findSingleRelatedEntryState,
|
|
561
577
|
[entriesStateKeyB]: findMultipleRelatedEntriesState
|
|
@@ -570,8 +586,8 @@ var Join = class _Join {
|
|
|
570
586
|
}
|
|
571
587
|
default: {
|
|
572
588
|
const findMultipleRelatedKeysState = getMultipleKeyStateFamily();
|
|
573
|
-
const stateKeyA = `${
|
|
574
|
-
const stateKeyB = `${
|
|
589
|
+
const stateKeyA = `${aSide}KeysOf${capitalize(bSide)}`;
|
|
590
|
+
const stateKeyB = `${bSide}KeysOf${capitalize(aSide)}`;
|
|
575
591
|
const baseStates = {
|
|
576
592
|
[stateKeyA]: findMultipleRelatedKeysState,
|
|
577
593
|
[stateKeyB]: findMultipleRelatedKeysState
|
|
@@ -579,8 +595,12 @@ var Join = class _Join {
|
|
|
579
595
|
let states;
|
|
580
596
|
if (defaultContent) {
|
|
581
597
|
const findMultipleRelatedEntriesState = getMultipleEntryStateFamily();
|
|
582
|
-
const entriesStateKeyA = `${
|
|
583
|
-
|
|
598
|
+
const entriesStateKeyA = `${aSide}EntriesOf${capitalize(
|
|
599
|
+
bSide
|
|
600
|
+
)}`;
|
|
601
|
+
const entriesStateKeyB = `${bSide}EntriesOf${capitalize(
|
|
602
|
+
aSide
|
|
603
|
+
)}`;
|
|
584
604
|
const contentStates = {
|
|
585
605
|
[entriesStateKeyA]: findMultipleRelatedEntriesState,
|
|
586
606
|
[entriesStateKeyB]: findMultipleRelatedEntriesState
|
|
@@ -618,21 +638,21 @@ function getJoinMap(store) {
|
|
|
618
638
|
function getJoin(token, store) {
|
|
619
639
|
var _a;
|
|
620
640
|
const joinMap = getJoinMap(store);
|
|
621
|
-
let
|
|
622
|
-
if (
|
|
641
|
+
let myJoin = joinMap.get(token.key);
|
|
642
|
+
if (myJoin === void 0) {
|
|
623
643
|
const rootJoinMap = getJoinMap(internal.IMPLICIT.STORE);
|
|
624
|
-
|
|
625
|
-
if (
|
|
644
|
+
myJoin = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
|
|
645
|
+
if (myJoin === void 0) {
|
|
626
646
|
throw new Error(
|
|
627
647
|
`Join "${token.key}" not found in store "${store.config.name}"`
|
|
628
648
|
);
|
|
629
649
|
}
|
|
630
|
-
joinMap.set(token.key,
|
|
650
|
+
joinMap.set(token.key, myJoin);
|
|
631
651
|
}
|
|
632
|
-
return
|
|
652
|
+
return myJoin;
|
|
633
653
|
}
|
|
634
654
|
function findRelationsInStore(token, key, store) {
|
|
635
|
-
const
|
|
655
|
+
const myJoin = getJoin(token, store);
|
|
636
656
|
let relations;
|
|
637
657
|
switch (token.cardinality) {
|
|
638
658
|
case `1:1`: {
|
|
@@ -640,27 +660,27 @@ function findRelationsInStore(token, key, store) {
|
|
|
640
660
|
const keyBA = `${token.b}KeyOf${capitalize(token.a)}`;
|
|
641
661
|
relations = {
|
|
642
662
|
get [keyAB]() {
|
|
643
|
-
const familyAB =
|
|
663
|
+
const familyAB = myJoin.states[keyAB];
|
|
644
664
|
const state = internal.findInStore(familyAB, key, store);
|
|
645
665
|
return state;
|
|
646
666
|
},
|
|
647
667
|
get [keyBA]() {
|
|
648
|
-
const familyBA =
|
|
668
|
+
const familyBA = myJoin.states[keyBA];
|
|
649
669
|
const state = internal.findInStore(familyBA, key, store);
|
|
650
670
|
return state;
|
|
651
671
|
}
|
|
652
672
|
};
|
|
653
673
|
const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
|
|
654
|
-
if (entryAB in
|
|
674
|
+
if (entryAB in myJoin.states) {
|
|
655
675
|
const entryBA = `${token.b}EntryOf${capitalize(token.a)}`;
|
|
656
676
|
Object.assign(relations, {
|
|
657
677
|
get [entryAB]() {
|
|
658
|
-
const familyAB =
|
|
678
|
+
const familyAB = myJoin.states[entryAB];
|
|
659
679
|
const state = internal.findInStore(familyAB, key, store);
|
|
660
680
|
return state;
|
|
661
681
|
},
|
|
662
682
|
get [entryBA]() {
|
|
663
|
-
const familyBA =
|
|
683
|
+
const familyBA = myJoin.states[entryBA];
|
|
664
684
|
const state = internal.findInStore(familyBA, key, store);
|
|
665
685
|
return state;
|
|
666
686
|
}
|
|
@@ -673,27 +693,27 @@ function findRelationsInStore(token, key, store) {
|
|
|
673
693
|
const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
|
|
674
694
|
relations = {
|
|
675
695
|
get [keyAB]() {
|
|
676
|
-
const familyAB =
|
|
696
|
+
const familyAB = myJoin.states[keyAB];
|
|
677
697
|
const state = internal.findInStore(familyAB, key, store);
|
|
678
698
|
return state;
|
|
679
699
|
},
|
|
680
700
|
get [keysBA]() {
|
|
681
|
-
const familyBA =
|
|
701
|
+
const familyBA = myJoin.states[keysBA];
|
|
682
702
|
const state = internal.findInStore(familyBA, key, store);
|
|
683
703
|
return state;
|
|
684
704
|
}
|
|
685
705
|
};
|
|
686
706
|
const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
|
|
687
|
-
if (entryAB in
|
|
707
|
+
if (entryAB in myJoin.states) {
|
|
688
708
|
const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
|
|
689
709
|
Object.assign(relations, {
|
|
690
710
|
get [entryAB]() {
|
|
691
|
-
const familyAB =
|
|
711
|
+
const familyAB = myJoin.states[entryAB];
|
|
692
712
|
const state = internal.findInStore(familyAB, key, store);
|
|
693
713
|
return state;
|
|
694
714
|
},
|
|
695
715
|
get [entriesBA]() {
|
|
696
|
-
const familyBA =
|
|
716
|
+
const familyBA = myJoin.states[entriesBA];
|
|
697
717
|
const state = internal.findInStore(familyBA, key, store);
|
|
698
718
|
return state;
|
|
699
719
|
}
|
|
@@ -706,27 +726,27 @@ function findRelationsInStore(token, key, store) {
|
|
|
706
726
|
const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
|
|
707
727
|
relations = {
|
|
708
728
|
get [keysAB]() {
|
|
709
|
-
const familyAB =
|
|
729
|
+
const familyAB = myJoin.states[keysAB];
|
|
710
730
|
const state = internal.findInStore(familyAB, key, store);
|
|
711
731
|
return state;
|
|
712
732
|
},
|
|
713
733
|
get [keysBA]() {
|
|
714
|
-
const familyBA =
|
|
734
|
+
const familyBA = myJoin.states[keysBA];
|
|
715
735
|
const state = internal.findInStore(familyBA, key, store);
|
|
716
736
|
return state;
|
|
717
737
|
}
|
|
718
738
|
};
|
|
719
739
|
const entriesAB = `${token.a}EntriesOf${capitalize(token.b)}`;
|
|
720
|
-
if (entriesAB in
|
|
740
|
+
if (entriesAB in myJoin.states) {
|
|
721
741
|
const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
|
|
722
742
|
Object.assign(relations, {
|
|
723
743
|
get [entriesAB]() {
|
|
724
|
-
const familyAB =
|
|
744
|
+
const familyAB = myJoin.states[entriesAB];
|
|
725
745
|
const state = internal.findInStore(familyAB, key, store);
|
|
726
746
|
return state;
|
|
727
747
|
},
|
|
728
748
|
get [entriesBA]() {
|
|
729
|
-
const familyBA =
|
|
749
|
+
const familyBA = myJoin.states[entriesBA];
|
|
730
750
|
const state = internal.findInStore(familyBA, key, store);
|
|
731
751
|
return state;
|
|
732
752
|
}
|
|
@@ -740,23 +760,23 @@ function findRelations(token, key) {
|
|
|
740
760
|
return findRelationsInStore(token, key, internal.IMPLICIT.STORE);
|
|
741
761
|
}
|
|
742
762
|
function editRelationsInStore(token, change, store) {
|
|
743
|
-
const
|
|
763
|
+
const myJoin = getJoin(token, store);
|
|
744
764
|
const target = internal.newest(store);
|
|
745
765
|
if (internal.isChildStore(target)) {
|
|
746
766
|
const { transactors } = target.transactionMeta;
|
|
747
|
-
|
|
767
|
+
myJoin.transact(transactors, ({ relations }) => {
|
|
748
768
|
change(relations);
|
|
749
769
|
});
|
|
750
770
|
} else {
|
|
751
|
-
change(
|
|
771
|
+
change(myJoin.relations);
|
|
752
772
|
}
|
|
753
773
|
}
|
|
754
774
|
function editRelations(token, change) {
|
|
755
775
|
editRelationsInStore(token, change, internal.IMPLICIT.STORE);
|
|
756
776
|
}
|
|
757
777
|
function getInternalRelationsFromStore(token, store) {
|
|
758
|
-
const
|
|
759
|
-
const family =
|
|
778
|
+
const myJoin = getJoin(token, store);
|
|
779
|
+
const family = myJoin.core.findRelatedKeysState;
|
|
760
780
|
return family;
|
|
761
781
|
}
|
|
762
782
|
function getInternalRelations(token) {
|
package/data/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Join, editRelations, editRelationsInStore, findRelations, findRelationsInStore, getInternalRelations, getInternalRelationsFromStore, getJoin, getJoinMap, join } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
3
|
-
import '../../dist/chunk-
|
|
1
|
+
export { Join, editRelations, editRelationsInStore, findRelations, findRelationsInStore, getInternalRelations, getInternalRelationsFromStore, getJoin, getJoinMap, join } from '../../dist/chunk-MSCJWACE.js';
|
|
2
|
+
import '../../dist/chunk-FTONNX2R.js';
|
|
3
|
+
import '../../dist/chunk-F2X4B4VY.js';
|
|
4
4
|
import { createStandaloneSelector, findInStore, IMPLICIT, createRegularAtom, createRegularAtomFamily, createSelectorFamily } from 'atom.io/internal';
|
|
5
5
|
|
|
6
6
|
function dict(findState, index, store = IMPLICIT.STORE) {
|