tempest.games 0.2.97 → 0.2.99

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.
@@ -2940,7 +2940,7 @@ var isSocketKey = (key) => key.startsWith(`socket::`);
2940
2940
  var isUserKey = (key) => key.startsWith(`user::`);
2941
2941
  var isRoomKey = (key) => key.startsWith(`room::`);
2942
2942
  var roomKeysAtom = mutableAtom({
2943
- key: `roomIndex`,
2943
+ key: `roomKeys`,
2944
2944
  class: UList
2945
2945
  });
2946
2946
  var usersInRooms = join({
@@ -2951,12 +2951,29 @@ var usersInRooms = join({
2951
2951
  isBType: isUserKey
2952
2952
  });
2953
2953
  var visibleUsersInRoomsSelector = selectorFamily({
2954
- key: `selfList`,
2954
+ key: `visibleUsersInRooms`,
2955
2955
  get: (userKey) => ({ get }) => {
2956
2956
  const [, roomsOfUsersAtoms] = getInternalRelations(usersInRooms, `split`);
2957
2957
  return [userKey, ...get(roomsOfUsersAtoms, userKey)];
2958
2958
  }
2959
2959
  });
2960
+ var visibilityFromRoomSelector = selectorFamily({
2961
+ key: `visibilityFromRoom`,
2962
+ get: (roomKey) => ({ get }) => {
2963
+ const [usersOfRoomsAtoms] = getInternalRelations(usersInRooms, `split`);
2964
+ return [roomKey, ...get(usersOfRoomsAtoms, roomKey)];
2965
+ }
2966
+ });
2967
+ var mutualUsersSelector = selectorFamily({
2968
+ key: `mutualUsers`,
2969
+ get: (userKey) => ({ get }) => {
2970
+ const [usersOfRoomsAtoms, roomsOfUsersAtoms] = getInternalRelations(usersInRooms, `split`);
2971
+ const rooms = get(roomsOfUsersAtoms, userKey);
2972
+ for (const room of rooms)
2973
+ return [...get(usersOfRoomsAtoms, room)];
2974
+ return [];
2975
+ }
2976
+ });
2960
2977
  var ownersOfRooms = join({
2961
2978
  key: `ownersOfRooms`,
2962
2979
  between: [`user`, `room`],
@@ -2964,13 +2981,6 @@ var ownersOfRooms = join({
2964
2981
  isAType: isUserKey,
2965
2982
  isBType: isRoomKey
2966
2983
  });
2967
- var usersInMyRoomView = selectorFamily({
2968
- key: `usersInMyRoomView`,
2969
- get: (myUsername) => ({ find }) => {
2970
- const [, roomsOfUsersAtoms] = getInternalRelations(usersInRooms, `split`);
2971
- return [find(roomsOfUsersAtoms, myUsername)];
2972
- }
2973
- });
2974
2984
 
2975
2985
  // ../../packages/atom.io/dist/realtime-server/index.js
2976
2986
  var redactorAtoms = atomFamily({
@@ -3203,12 +3213,6 @@ var ChildSocket = class extends CustomSocket {
3203
3213
  constructor(proc, key, logger) {
3204
3214
  super((event, ...args) => {
3205
3215
  const stringifiedEvent = JSON.stringify([event, ...args]) + `\x03`;
3206
- const errorHandler = (err) => {
3207
- if (err.code === `EPIPE`)
3208
- console.error(`EPIPE error during write`, this.proc.stdin);
3209
- this.proc.stdin.removeListener(`error`, errorHandler);
3210
- };
3211
- this.proc.stdin.once(`error`, errorHandler);
3212
3216
  this.proc.stdin.write(stringifiedEvent);
3213
3217
  return this;
3214
3218
  });
@@ -3334,6 +3338,10 @@ var ChildSocket = class extends CustomSocket {
3334
3338
  ++idx;
3335
3339
  }
3336
3340
  });
3341
+ this.proc.stdin.once(`error`, (err) => {
3342
+ if (err.code === `EPIPE`)
3343
+ console.error(`EPIPE error during write`, this.proc.stdin);
3344
+ });
3337
3345
  if (proc.pid)
3338
3346
  this.id = proc.pid.toString();
3339
3347
  }
@@ -3344,11 +3352,11 @@ var socketAtoms = atomFamily({
3344
3352
  default: null
3345
3353
  });
3346
3354
  var socketKeysAtom = mutableAtom({
3347
- key: `socketsIndex`,
3355
+ key: `socketKeys`,
3348
3356
  class: UList
3349
3357
  });
3350
- var userKeysAtom = mutableAtom({
3351
- key: `usersIndex`,
3358
+ var onlineUsersAtom = mutableAtom({
3359
+ key: `onlineUsers`,
3352
3360
  class: UList
3353
3361
  });
3354
3362
  var usersOfSockets = join({