atom.io 0.24.4 → 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.
@@ -1340,14 +1340,6 @@ var applyTransaction = (output, store) => {
1340
1340
  `Applying transaction with ${updates.length} updates:`,
1341
1341
  updates
1342
1342
  );
1343
- for (const tracker of child.trackers.values()) {
1344
- const mutableKey = tracker.mutableState.key;
1345
- if (!parent.atoms.has(mutableKey)) {
1346
- const atom = child.atoms.get(mutableKey);
1347
- atom == null ? void 0 : atom.install(parent);
1348
- }
1349
- tracker.dispose();
1350
- }
1351
1343
  ingestTransactionUpdate(`newValue`, child.transactionMeta.update, parent);
1352
1344
  if (isRootStore(parent)) {
1353
1345
  setEpochNumberOfAction(
@@ -1065,14 +1065,6 @@ var applyTransaction = (output, store) => {
1065
1065
  `Applying transaction with ${updates.length} updates:`,
1066
1066
  updates
1067
1067
  );
1068
- for (const tracker of child.trackers.values()) {
1069
- const mutableKey = tracker.mutableState.key;
1070
- if (!parent.atoms.has(mutableKey)) {
1071
- const atom = child.atoms.get(mutableKey);
1072
- atom == null ? void 0 : atom.install(parent);
1073
- }
1074
- tracker.dispose();
1075
- }
1076
1068
  ingestTransactionUpdate(`newValue`, child.transactionMeta.update, parent);
1077
1069
  if (isRootStore(parent)) {
1078
1070
  setEpochNumberOfAction(
@@ -38,14 +38,6 @@ export const applyTransaction = <F extends Func>(
38
38
  `Applying transaction with ${updates.length} updates:`,
39
39
  updates,
40
40
  )
41
- for (const tracker of child.trackers.values()) {
42
- const mutableKey = tracker.mutableState.key
43
- if (!parent.atoms.has(mutableKey)) {
44
- const atom = child.atoms.get(mutableKey)
45
- atom?.install(parent)
46
- }
47
- tracker.dispose()
48
- }
49
41
 
50
42
  ingestTransactionUpdate(`newValue`, child.transactionMeta.update, parent)
51
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.24.4",
3
+ "version": "0.24.5",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -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!`]]
@@ -1,11 +1,11 @@
1
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!`]]
@@ -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"
@@ -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
- // })