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
@@ -369,67 +369,6 @@ function realtimeActionReceiver({
369
369
  };
370
370
  };
371
371
  }
372
- AtomIO.selectorFamily({
373
- key: `perspectiveRedactor`,
374
- get: ({ userId, syncGroupKey }) => ({ get, find }) => {
375
- const syncGroup = realtime.SyncGroup.existing.get(syncGroupKey);
376
- if (!syncGroup) {
377
- throw new Error(
378
- `Tried to create a synchronizer for a sync group that does not exist.`
379
- );
380
- }
381
- const userPerspectiveTokens = syncGroup.perspectives.flatMap(
382
- ({ viewAtoms }) => {
383
- const userPerspectiveToken = find(viewAtoms, userId);
384
- const userPerspective = get(userPerspectiveToken);
385
- const visibleTokens = [...userPerspective].map((token) => {
386
- return token.type === `mutable_atom` ? internal.getUpdateToken(token).key : token.key;
387
- });
388
- internal.IMPLICIT.STORE.logger.info(
389
- `\u{1F52D}`,
390
- `continuity`,
391
- syncGroupKey,
392
- `${userId} can see ${visibleTokens.length} tokens in ${viewAtoms.key}`,
393
- visibleTokens
394
- );
395
- return visibleTokens;
396
- }
397
- );
398
- const filterTransactionUpdate = (visible, transactionUpdate) => {
399
- internal.IMPLICIT.STORE.logger.info(
400
- `\u{1F58C}`,
401
- `continuity`,
402
- syncGroupKey,
403
- `redacting updates from ${transactionUpdate.epoch}:${transactionUpdate.key}:${transactionUpdate.id}`,
404
- visible,
405
- transactionUpdate.updates
406
- );
407
- const updates = transactionUpdate.updates.filter((update) => {
408
- if (`newValue` in update) {
409
- return visible.includes(update.key);
410
- }
411
- return true;
412
- }).map((update) => {
413
- if (`updates` in update) {
414
- return filterTransactionUpdate(visible, update);
415
- }
416
- return update;
417
- });
418
- const filtered = __spreadProps(__spreadValues({}, transactionUpdate), {
419
- updates
420
- });
421
- return filtered;
422
- };
423
- const filter = (update) => {
424
- const visibleKeys = syncGroup.globals.map(
425
- (atomToken) => atomToken.type === `mutable_atom` ? internal.getUpdateToken(atomToken).key : atomToken.key
426
- );
427
- visibleKeys.push(...userPerspectiveTokens);
428
- return filterTransactionUpdate(visibleKeys, update);
429
- };
430
- return filter;
431
- }
432
- });
433
372
  var roomArgumentsAtoms = AtomIO.atomFamily({
434
373
  key: `roomArguments`,
435
374
  default: [`echo`, [`Hello World!`]]
@@ -669,8 +608,7 @@ function realtimeContinuitySynchronizer({
669
608
  unsubFns.push(unsubscribe);
670
609
  }
671
610
  return () => {
672
- for (const unsubscribe of unsubFns)
673
- unsubscribe();
611
+ for (const unsubscribe of unsubFns) unsubscribe();
674
612
  };
675
613
  };
676
614
  const unsubscribeFromPerspectives = revealPerspectives();
@@ -808,8 +746,7 @@ function realtimeContinuitySynchronizer({
808
746
  socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
809
747
  socket.on(`tx-run:${continuityKey}`, fillTransactionRequest);
810
748
  return () => {
811
- for (const unsubscribe of unsubscribeFunctions)
812
- unsubscribe();
749
+ for (const unsubscribe of unsubscribeFunctions) unsubscribe();
813
750
  unsubscribeFromPerspectives();
814
751
  socket == null ? void 0 : socket.off(`get:${continuityKey}`, sendInitialPayload);
815
752
  socket == null ? void 0 : socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
@@ -1,11 +1,11 @@
1
- import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
1
+ import { __spreadProps, __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
2
2
  import { parseJson, stringifyJson } from 'atom.io/json';
3
- import { getUpdateToken, IMPLICIT, Subject, getFromStore, subscribeToState, findInStore, getJsonToken, actUponStore, isRootStore, subscribeToTransaction, setIntoStore } from 'atom.io/internal';
3
+ import { Subject, IMPLICIT, getFromStore, subscribeToState, findInStore, getJsonToken, getUpdateToken, actUponStore, isRootStore, subscribeToTransaction, setIntoStore } from 'atom.io/internal';
4
4
  import { SetRTX } from 'atom.io/transceivers/set-rtx';
5
5
  import { editRelationsInStore, join, findRelationsInStore } from 'atom.io/data';
6
6
  import * as AtomIO from 'atom.io';
7
- import { selectorFamily, atomFamily, atom } from 'atom.io';
8
- import { SyncGroup, roomIndex, usersInRooms } from 'atom.io/realtime';
7
+ import { atomFamily, selectorFamily, atom } from 'atom.io';
8
+ import { roomIndex, usersInRooms } from 'atom.io/realtime';
9
9
  import { spawn } from 'child_process';
10
10
 
11
11
  // realtime-server/src/ipc-sockets/custom-socket.ts
@@ -329,67 +329,6 @@ function realtimeActionReceiver({
329
329
  };
330
330
  };
331
331
  }
332
- selectorFamily({
333
- key: `perspectiveRedactor`,
334
- get: ({ userId, syncGroupKey }) => ({ get, find }) => {
335
- const syncGroup = SyncGroup.existing.get(syncGroupKey);
336
- if (!syncGroup) {
337
- throw new Error(
338
- `Tried to create a synchronizer for a sync group that does not exist.`
339
- );
340
- }
341
- const userPerspectiveTokens = syncGroup.perspectives.flatMap(
342
- ({ viewAtoms }) => {
343
- const userPerspectiveToken = find(viewAtoms, userId);
344
- const userPerspective = get(userPerspectiveToken);
345
- const visibleTokens = [...userPerspective].map((token) => {
346
- return token.type === `mutable_atom` ? getUpdateToken(token).key : token.key;
347
- });
348
- IMPLICIT.STORE.logger.info(
349
- `\u{1F52D}`,
350
- `continuity`,
351
- syncGroupKey,
352
- `${userId} can see ${visibleTokens.length} tokens in ${viewAtoms.key}`,
353
- visibleTokens
354
- );
355
- return visibleTokens;
356
- }
357
- );
358
- const filterTransactionUpdate = (visible, transactionUpdate) => {
359
- IMPLICIT.STORE.logger.info(
360
- `\u{1F58C}`,
361
- `continuity`,
362
- syncGroupKey,
363
- `redacting updates from ${transactionUpdate.epoch}:${transactionUpdate.key}:${transactionUpdate.id}`,
364
- visible,
365
- transactionUpdate.updates
366
- );
367
- const updates = transactionUpdate.updates.filter((update) => {
368
- if (`newValue` in update) {
369
- return visible.includes(update.key);
370
- }
371
- return true;
372
- }).map((update) => {
373
- if (`updates` in update) {
374
- return filterTransactionUpdate(visible, update);
375
- }
376
- return update;
377
- });
378
- const filtered = __spreadProps(__spreadValues({}, transactionUpdate), {
379
- updates
380
- });
381
- return filtered;
382
- };
383
- const filter = (update) => {
384
- const visibleKeys = syncGroup.globals.map(
385
- (atomToken) => atomToken.type === `mutable_atom` ? getUpdateToken(atomToken).key : atomToken.key
386
- );
387
- visibleKeys.push(...userPerspectiveTokens);
388
- return filterTransactionUpdate(visibleKeys, update);
389
- };
390
- return filter;
391
- }
392
- });
393
332
  var roomArgumentsAtoms = atomFamily({
394
333
  key: `roomArguments`,
395
334
  default: [`echo`, [`Hello World!`]]
@@ -629,8 +568,7 @@ function realtimeContinuitySynchronizer({
629
568
  unsubFns.push(unsubscribe);
630
569
  }
631
570
  return () => {
632
- for (const unsubscribe of unsubFns)
633
- unsubscribe();
571
+ for (const unsubscribe of unsubFns) unsubscribe();
634
572
  };
635
573
  };
636
574
  const unsubscribeFromPerspectives = revealPerspectives();
@@ -768,8 +706,7 @@ function realtimeContinuitySynchronizer({
768
706
  socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
769
707
  socket.on(`tx-run:${continuityKey}`, fillTransactionRequest);
770
708
  return () => {
771
- for (const unsubscribe of unsubscribeFunctions)
772
- unsubscribe();
709
+ for (const unsubscribe of unsubscribeFunctions) unsubscribe();
773
710
  unsubscribeFromPerspectives();
774
711
  socket == null ? void 0 : socket.off(`get:${continuityKey}`, sendInitialPayload);
775
712
  socket == null ? void 0 : socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
@@ -1,4 +1,3 @@
1
- export * from "./realtime-continuity-store"
2
1
  export * from "./server-room-external-actions"
3
2
  export * from "./server-room-external-store"
4
3
  export * from "./server-sync-store"
@@ -74,8 +74,7 @@ var setupRealtimeTestServer = (options) => {
74
74
  const httpServer = http__namespace.createServer((_, res) => res.end(`Hello World!`));
75
75
  const address = httpServer.listen(options.port).address();
76
76
  const port = typeof address === `string` ? null : address === null ? null : address.port;
77
- if (port === null)
78
- throw new Error(`Could not determine port for test server`);
77
+ if (port === null) throw new Error(`Could not determine port for test server`);
79
78
  const server = new SocketIO__namespace.Server(httpServer).use((socket, next) => {
80
79
  const { token, username } = socket.handshake.auth;
81
80
  if (token === `test` && socket.id) {
@@ -1,5 +1,5 @@
1
- import { recordToEntries } from '../../dist/chunk-3V3VWQ7X.js';
2
- import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
1
+ import { recordToEntries } from '../../dist/chunk-MR5NETHW.js';
2
+ import { __spreadProps, __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
3
3
  import * as http from 'http';
4
4
  import { render, prettyDOM } from '@testing-library/react';
5
5
  import * as AtomIO from 'atom.io';
@@ -25,8 +25,7 @@ var setupRealtimeTestServer = (options) => {
25
25
  const httpServer = http.createServer((_, res) => res.end(`Hello World!`));
26
26
  const address = httpServer.listen(options.port).address();
27
27
  const port = typeof address === `string` ? null : address === null ? null : address.port;
28
- if (port === null)
29
- throw new Error(`Could not determine port for test server`);
28
+ if (port === null) throw new Error(`Could not determine port for test server`);
30
29
  const server = new SocketIO.Server(httpServer).use((socket, next) => {
31
30
  const { token, username } = socket.handshake.auth;
32
31
  if (token === `test` && socket.id) {
package/src/molecule.ts CHANGED
@@ -39,7 +39,7 @@ export type MoleculeTransactors<K extends Json.Serializable> = Flat<
39
39
 
40
40
  claim(below: MoleculeToken<any>, options: { exclusive: boolean })
41
41
 
42
- join(joinToken: JoinToken<any, any, any, any>): void
42
+ join<J extends JoinToken<any, any, any, any>>(joinToken: J): J
43
43
 
44
44
  spawn<Key extends Json.Serializable, Ctor extends MoleculeConstructor>(
45
45
  family: MoleculeFamilyToken<Ctor>,
@@ -186,8 +186,7 @@ var SetRTX = class _SetRTX extends Set {
186
186
  break;
187
187
  case `clear`: {
188
188
  const values = JSON.parse(value);
189
- for (const v of values)
190
- this.add(v);
189
+ for (const v of values) this.add(v);
191
190
  break;
192
191
  }
193
192
  case `tx`: {
@@ -1,4 +1,4 @@
1
- import '../../../dist/chunk-F2X4B4VY.js';
1
+ import '../../../dist/chunk-S4N6XNPH.js';
2
2
  import { Subject } from 'atom.io/internal';
3
3
  import { stringifyJson, parseJson } from 'atom.io/json';
4
4
 
@@ -184,8 +184,7 @@ var SetRTX = class _SetRTX extends Set {
184
184
  break;
185
185
  case `clear`: {
186
186
  const values = JSON.parse(value);
187
- for (const v of values)
188
- this.add(v);
187
+ for (const v of values) this.add(v);
189
188
  break;
190
189
  }
191
190
  case `tx`: {
@@ -1,109 +0,0 @@
1
- import type { TransactionUpdate } from "atom.io"
2
- import { selectorFamily } from "atom.io"
3
- import { getJsonToken, getUpdateToken, IMPLICIT } from "atom.io/internal"
4
- import type { JsonIO } from "atom.io/json"
5
- import { SyncGroup } from "atom.io/realtime"
6
- // import { completeUpdateAtoms } from "atom.io/realtime-server"
7
-
8
- const redactorAtoms = selectorFamily<
9
- (update: TransactionUpdate<any>) => TransactionUpdate<any>,
10
- { userId: string; syncGroupKey: string }
11
- >({
12
- key: `perspectiveRedactor`,
13
- get:
14
- ({ userId, syncGroupKey }) =>
15
- ({ get, find }) => {
16
- const syncGroup = SyncGroup.existing.get(syncGroupKey)
17
- if (!syncGroup) {
18
- throw new Error(
19
- `Tried to create a synchronizer for a sync group that does not exist.`,
20
- )
21
- }
22
-
23
- const userPerspectiveTokens = syncGroup.perspectives.flatMap(
24
- ({ viewAtoms }) => {
25
- const userPerspectiveToken = find(viewAtoms, userId)
26
- const userPerspective = get(userPerspectiveToken)
27
- const visibleTokens = [...userPerspective].map((token) => {
28
- return token.type === `mutable_atom`
29
- ? getUpdateToken(token).key
30
- : token.key
31
- })
32
- IMPLICIT.STORE.logger.info(
33
- `🔭`,
34
- `continuity`,
35
- syncGroupKey,
36
- `${userId} can see ${visibleTokens.length} tokens in ${viewAtoms.key}`,
37
- visibleTokens,
38
- )
39
- return visibleTokens
40
- },
41
- )
42
-
43
- const filterTransactionUpdate = (
44
- visible: string[],
45
- transactionUpdate: TransactionUpdate<any>,
46
- ): TransactionUpdate<any> => {
47
- IMPLICIT.STORE.logger.info(
48
- `🖌`,
49
- `continuity`,
50
- syncGroupKey,
51
- `redacting updates from ${transactionUpdate.epoch}:${transactionUpdate.key}:${transactionUpdate.id}`,
52
- visible,
53
- transactionUpdate.updates,
54
- )
55
- const updates = transactionUpdate.updates
56
- .filter((update) => {
57
- if (`newValue` in update) {
58
- return visible.includes(update.key)
59
- }
60
- return true
61
- })
62
- .map((update) => {
63
- if (`updates` in update) {
64
- return filterTransactionUpdate(visible, update)
65
- }
66
- return update
67
- })
68
- const filtered: TransactionUpdate<any> = {
69
- ...transactionUpdate,
70
- updates,
71
- }
72
- return filtered
73
- }
74
- const filter: (updates: TransactionUpdate<any>) => TransactionUpdate<any> =
75
- (update) => {
76
- const visibleKeys: string[] = syncGroup.globals.map((atomToken) =>
77
- atomToken.type === `mutable_atom`
78
- ? getUpdateToken(atomToken).key
79
- : atomToken.key,
80
- )
81
- visibleKeys.push(...userPerspectiveTokens)
82
- return filterTransactionUpdate(visibleKeys, update)
83
- }
84
- return filter
85
- },
86
- })
87
- // export const occludedUpdateSelectors = selectorFamily<
88
- // Pick<
89
- // TransactionUpdate<JsonIO>,
90
- // `epoch` | `id` | `key` | `output` | `updates`
91
- // > | null,
92
- // { userId: string; syncGroupKey: string; updateId: string }
93
- // >({
94
- // key: `occludedUpdate`,
95
- // get:
96
- // ({ userId, syncGroupKey, updateId }) =>
97
- // ({ get, find }) => {
98
- // const updateState = find(completeUpdateAtoms, updateId)
99
- // const update = get(updateState)
100
- // const redactorKey = { userId, syncGroupKey }
101
- // const redactorState = find(redactorAtoms, redactorKey)
102
- // const redact = get(redactorState)
103
- // if (update) {
104
- // // return redact(update)
105
- // return update
106
- // }
107
- // return null
108
- // },
109
- // })
File without changes