tempest.games 0.2.75 → 0.2.77

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.
@@ -42,8 +42,8 @@ function getState(...params) {
42
42
  function join(options) {
43
43
  return createJoin(IMPLICIT.STORE, options);
44
44
  }
45
- function getInternalRelations(token) {
46
- return getInternalRelationsFromStore(token, IMPLICIT.STORE);
45
+ function getInternalRelations(token, split) {
46
+ return getInternalRelationsFromStore(IMPLICIT.STORE, token, split);
47
47
  }
48
48
  var PRETTY_TOKEN_TYPES = {
49
49
  atom_family: `atom family`,
@@ -2615,7 +2615,7 @@ var Join = class {
2615
2615
  }
2616
2616
  store;
2617
2617
  [Symbol.dispose]() {}
2618
- constructor(options, store = IMPLICIT.STORE) {
2618
+ constructor(store, options) {
2619
2619
  this.store = store;
2620
2620
  this.options = options;
2621
2621
  this.store.miscResources.set(`join:${options.key}`, this);
@@ -2790,7 +2790,7 @@ var Join = class {
2790
2790
  }
2791
2791
  };
2792
2792
  function createJoin(store, options) {
2793
- store.joins.set(options.key, new Join(options));
2793
+ store.joins.set(options.key, new Join(store, options));
2794
2794
  return {
2795
2795
  key: options.key,
2796
2796
  type: `join`,
@@ -2799,20 +2799,19 @@ function createJoin(store, options) {
2799
2799
  cardinality: options.cardinality
2800
2800
  };
2801
2801
  }
2802
- function getJoin(token, store) {
2802
+ function getJoin(store, token) {
2803
2803
  let myJoin = store.joins.get(token.key);
2804
2804
  if (myJoin === undefined) {
2805
2805
  const rootJoin = IMPLICIT.STORE.joins.get(token.key);
2806
2806
  if (rootJoin === undefined)
2807
2807
  throw new Error(`Join "${token.key}" not found in store "${store.config.name}"`);
2808
- const root = eldest(store);
2809
- myJoin = new Join(rootJoin.options, root);
2808
+ myJoin = new Join(eldest(store), rootJoin.options);
2810
2809
  store.joins.set(token.key, myJoin);
2811
2810
  }
2812
2811
  return myJoin;
2813
2812
  }
2814
- function editRelationsInStore(token, change, store) {
2815
- const myJoin = getJoin(token, store);
2813
+ function editRelationsInStore(store, token, change) {
2814
+ const myJoin = getJoin(store, token);
2816
2815
  const target = newest(store);
2817
2816
  if (isChildStore(target)) {
2818
2817
  const { toolkit } = target.transactionMeta;
@@ -2822,8 +2821,8 @@ function editRelationsInStore(token, change, store) {
2822
2821
  } else
2823
2822
  change(myJoin.relations);
2824
2823
  }
2825
- function findRelationsInStore(token, key, store) {
2826
- const myJoin = getJoin(token, store);
2824
+ function findRelationsInStore(store, token, key) {
2825
+ const myJoin = getJoin(store, token);
2827
2826
  let relations;
2828
2827
  switch (token.cardinality) {
2829
2828
  case `1:1`: {
@@ -2873,8 +2872,11 @@ function findRelationsInStore(token, key, store) {
2873
2872
  }
2874
2873
  return relations;
2875
2874
  }
2876
- function getInternalRelationsFromStore(token, store) {
2877
- return getJoin(token, store).relatedKeysAtoms;
2875
+ function getInternalRelationsFromStore(store, token, split) {
2876
+ const myJoin = getJoin(store, token);
2877
+ if (split === `split`)
2878
+ return [myJoin.relatedKeysAtoms, myJoin.relatedKeysAtoms];
2879
+ return myJoin.relatedKeysAtoms;
2878
2880
  }
2879
2881
 
2880
2882
  // ../../packages/atom.io/dist/realtime/index.js
@@ -2957,7 +2959,8 @@ var usersInRooms = join({
2957
2959
  var usersInMyRoomView = selectorFamily({
2958
2960
  key: `usersInMyRoomView`,
2959
2961
  get: (myUsername) => ({ find }) => {
2960
- return [find(getInternalRelations(usersInRooms), myUsername)];
2962
+ const [, roomsOfUsersAtoms] = getInternalRelations(usersInRooms, `split`);
2963
+ return [find(roomsOfUsersAtoms, myUsername)];
2961
2964
  }
2962
2965
  });
2963
2966