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.
Files changed (117) hide show
  1. package/data/dist/index.cjs +99 -79
  2. package/data/dist/index.js +3 -3
  3. package/data/package.json +1 -1
  4. package/data/src/join.ts +67 -50
  5. package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
  6. package/dist/{chunk-7VCCW45K.js → chunk-CC7IF7QF.js} +4 -3
  7. package/dist/{chunk-U2IICNHQ.js → chunk-F2X4B4VY.js} +5 -1
  8. package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
  9. package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
  10. package/dist/index.cjs +14 -7
  11. package/dist/index.d.ts +23 -35
  12. package/dist/index.js +15 -8
  13. package/eslint-plugin/dist/index.cjs +180 -0
  14. package/eslint-plugin/dist/index.js +171 -0
  15. package/eslint-plugin/package.json +16 -0
  16. package/eslint-plugin/src/index.ts +11 -0
  17. package/eslint-plugin/src/rules/index.ts +1 -0
  18. package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +190 -0
  19. package/internal/dist/index.cjs +55 -43
  20. package/internal/dist/index.d.ts +20 -20
  21. package/internal/dist/index.js +49 -37
  22. package/internal/package.json +1 -1
  23. package/internal/src/atom/create-regular-atom.ts +7 -5
  24. package/internal/src/atom/delete-atom.ts +2 -2
  25. package/internal/src/families/create-readonly-selector-family.ts +2 -2
  26. package/internal/src/families/create-regular-atom-family.ts +1 -1
  27. package/internal/src/families/create-writable-selector-family.ts +1 -1
  28. package/internal/src/future.ts +4 -2
  29. package/internal/src/lineage.ts +1 -0
  30. package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
  31. package/internal/src/mutable/create-mutable-atom.ts +7 -5
  32. package/internal/src/mutable/tracker.ts +3 -3
  33. package/internal/src/mutable/transceiver.ts +2 -2
  34. package/internal/src/selector/delete-selector.ts +1 -1
  35. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  36. package/internal/src/store/deposit.ts +5 -5
  37. package/internal/src/store/store.ts +5 -5
  38. package/internal/src/store/withdraw.ts +4 -5
  39. package/internal/src/subject.ts +3 -1
  40. package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
  41. package/internal/src/timeline/add-atom-to-timeline.ts +13 -8
  42. package/internal/src/timeline/create-timeline.ts +3 -4
  43. package/internal/src/transaction/act-upon-store.ts +5 -5
  44. package/internal/src/transaction/apply-transaction.ts +4 -4
  45. package/internal/src/transaction/build-transaction.ts +9 -6
  46. package/internal/src/transaction/create-transaction.ts +10 -10
  47. package/internal/src/transaction/index.ts +3 -3
  48. package/internal/src/transaction/is-root-store.ts +2 -2
  49. package/introspection/dist/index.d.ts +3 -3
  50. package/introspection/dist/index.js +1 -1
  51. package/introspection/package.json +1 -1
  52. package/introspection/src/attach-introspection-states.ts +3 -3
  53. package/introspection/src/attach-transaction-index.ts +4 -4
  54. package/introspection/src/attach-transaction-logs.ts +8 -4
  55. package/json/dist/index.cjs +6 -2
  56. package/json/dist/index.js +7 -3
  57. package/json/package.json +1 -1
  58. package/json/src/select-json-family.ts +3 -2
  59. package/json/src/select-json.ts +3 -1
  60. package/package.json +258 -241
  61. package/react/dist/index.cjs +9 -3
  62. package/react/dist/index.js +10 -4
  63. package/react/package.json +1 -1
  64. package/react/src/use-i.ts +3 -1
  65. package/react/src/use-tl.ts +6 -2
  66. package/react-devtools/dist/index.cjs +205 -155
  67. package/react-devtools/dist/index.d.ts +3 -5
  68. package/react-devtools/dist/index.js +182 -133
  69. package/react-devtools/package.json +1 -1
  70. package/react-devtools/src/AtomIODevtools.tsx +3 -1
  71. package/react-devtools/src/Button.tsx +3 -1
  72. package/react-devtools/src/StateIndex.tsx +6 -2
  73. package/react-devtools/src/TimelineIndex.tsx +6 -2
  74. package/react-devtools/src/TransactionIndex.tsx +3 -3
  75. package/react-devtools/src/Updates.tsx +24 -13
  76. package/realtime/dist/index.cjs +1 -0
  77. package/realtime/dist/index.d.ts +2 -2
  78. package/realtime/dist/index.js +2 -1
  79. package/realtime/package.json +1 -1
  80. package/realtime/src/realtime-continuity.ts +4 -3
  81. package/realtime-client/dist/index.cjs +29 -29
  82. package/realtime-client/dist/index.d.ts +2 -2
  83. package/realtime-client/dist/index.js +2 -2
  84. package/realtime-client/package.json +1 -1
  85. package/realtime-client/src/server-action.ts +2 -2
  86. package/realtime-client/src/sync-continuity.ts +23 -23
  87. package/realtime-react/dist/index.cjs +29 -29
  88. package/realtime-react/dist/index.d.ts +2 -2
  89. package/realtime-react/dist/index.js +2 -2
  90. package/realtime-react/package.json +1 -1
  91. package/realtime-react/src/use-server-action.ts +3 -3
  92. package/realtime-server/dist/index.cjs +54 -44
  93. package/realtime-server/dist/index.d.ts +5 -5
  94. package/realtime-server/dist/index.js +35 -25
  95. package/realtime-server/package.json +1 -1
  96. package/realtime-server/src/ipc-sockets/child-socket.ts +6 -6
  97. package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
  98. package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
  99. package/realtime-server/src/realtime-action-receiver.ts +7 -5
  100. package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
  101. package/realtime-server/src/realtime-state-receiver.ts +3 -1
  102. package/realtime-testing/dist/index.cjs +15 -13
  103. package/realtime-testing/dist/index.js +10 -8
  104. package/realtime-testing/package.json +1 -1
  105. package/realtime-testing/src/setup-realtime-test.tsx +6 -4
  106. package/src/atom.ts +4 -8
  107. package/src/dispose.ts +1 -0
  108. package/src/index.ts +2 -9
  109. package/src/selector.ts +4 -8
  110. package/src/silo.ts +9 -3
  111. package/src/subscribe.ts +6 -6
  112. package/src/timeline.ts +4 -4
  113. package/src/transaction.ts +24 -24
  114. package/transceivers/set-rtx/dist/index.cjs +11 -12
  115. package/transceivers/set-rtx/dist/index.js +12 -13
  116. package/transceivers/set-rtx/package.json +1 -1
  117. package/transceivers/set-rtx/src/set-rtx.ts +10 -10
@@ -194,8 +194,8 @@ function syncContinuity(continuity, socket, store) {
194
194
  };
195
195
  socket.off(`continuity-init:${continuityKey}`);
196
196
  socket.on(`continuity-init:${continuityKey}`, initializeContinuity);
197
- const registerAndAttemptConfirmedUpdate = (confirmedUpdate) => {
198
- function reconcileEpoch(optimisticUpdate, confirmedUpdate2) {
197
+ const registerAndAttemptConfirmedUpdate = (confirmed) => {
198
+ function reconcileEpoch(optimisticUpdate, confirmedUpdate) {
199
199
  store.logger.info(
200
200
  `\u{1F9D1}\u200D\u2696\uFE0F`,
201
201
  `continuity`,
@@ -210,9 +210,9 @@ function syncContinuity(continuity, socket, store) {
210
210
  },
211
211
  store
212
212
  );
213
- if (optimisticUpdate.id === confirmedUpdate2.id) {
213
+ if (optimisticUpdate.id === confirmedUpdate.id) {
214
214
  const clientResult = JSON.stringify(optimisticUpdate.updates);
215
- const serverResult = JSON.stringify(confirmedUpdate2.updates);
215
+ const serverResult = JSON.stringify(confirmedUpdate.updates);
216
216
  if (clientResult === serverResult) {
217
217
  store.logger.info(
218
218
  `\u2705`,
@@ -220,7 +220,7 @@ function syncContinuity(continuity, socket, store) {
220
220
  continuityKey,
221
221
  `results for ${optimisticUpdate.id} match between client and server`
222
222
  );
223
- socket.emit(`ack:${continuityKey}`, confirmedUpdate2.epoch);
223
+ socket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch);
224
224
  return;
225
225
  }
226
226
  } else {
@@ -228,7 +228,7 @@ function syncContinuity(continuity, socket, store) {
228
228
  `\u274C`,
229
229
  `continuity`,
230
230
  continuityKey,
231
- `thought update #${confirmedUpdate2.epoch} was ${optimisticUpdate.key}:${optimisticUpdate.id}, but it was actually ${confirmedUpdate2.key}:${confirmedUpdate2.id}`
231
+ `thought update #${confirmedUpdate.epoch} was ${optimisticUpdate.key}:${optimisticUpdate.id}, but it was actually ${confirmedUpdate.key}:${confirmedUpdate.id}`
232
232
  );
233
233
  }
234
234
  store.logger.info(
@@ -237,7 +237,7 @@ function syncContinuity(continuity, socket, store) {
237
237
  continuityKey,
238
238
  `updates do not match`,
239
239
  optimisticUpdate,
240
- confirmedUpdate2
240
+ confirmedUpdate
241
241
  );
242
242
  const reversedOptimisticUpdates = optimisticUpdates.toReversed();
243
243
  for (const subsequentOptimistic of reversedOptimisticUpdates) {
@@ -258,15 +258,15 @@ function syncContinuity(continuity, socket, store) {
258
258
  `undid zeroth optimistic update`,
259
259
  optimisticUpdate
260
260
  );
261
- internal.ingestTransactionUpdate(`newValue`, confirmedUpdate2, store);
261
+ internal.ingestTransactionUpdate(`newValue`, confirmedUpdate, store);
262
262
  store.logger.info(
263
263
  `\u23E9`,
264
264
  `continuity`,
265
265
  continuityKey,
266
266
  `applied confirmed update`,
267
- confirmedUpdate2
267
+ confirmedUpdate
268
268
  );
269
- socket.emit(`ack:${continuityKey}`, confirmedUpdate2.epoch);
269
+ socket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch);
270
270
  for (const subsequentOptimistic of optimisticUpdates) {
271
271
  const token = {
272
272
  type: `transaction`,
@@ -288,7 +288,7 @@ function syncContinuity(continuity, socket, store) {
288
288
  `continuity`,
289
289
  continuityKey,
290
290
  `integrating confirmed update`,
291
- { confirmedUpdate, confirmedUpdates, optimisticUpdates }
291
+ { confirmedUpdate: confirmed, confirmedUpdates, optimisticUpdates }
292
292
  );
293
293
  const zerothOptimisticUpdate = optimisticUpdates[0];
294
294
  if (zerothOptimisticUpdate) {
@@ -298,14 +298,14 @@ function syncContinuity(continuity, socket, store) {
298
298
  continuityKey,
299
299
  `has optimistic updates to reconcile`
300
300
  );
301
- if (confirmedUpdate.epoch === zerothOptimisticUpdate.epoch) {
301
+ if (confirmed.epoch === zerothOptimisticUpdate.epoch) {
302
302
  store.logger.info(
303
303
  `\u{1F9D1}\u200D\u2696\uFE0F`,
304
304
  `continuity`,
305
305
  continuityKey,
306
- `epoch of confirmed update #${confirmedUpdate.epoch} matches zeroth optimistic update`
306
+ `epoch of confirmed update #${confirmed.epoch} matches zeroth optimistic update`
307
307
  );
308
- reconcileEpoch(zerothOptimisticUpdate, confirmedUpdate);
308
+ reconcileEpoch(zerothOptimisticUpdate, confirmed);
309
309
  for (const nextConfirmed of confirmedUpdates) {
310
310
  const nextOptimistic = optimisticUpdates[0];
311
311
  if (nextConfirmed.epoch === (nextOptimistic == null ? void 0 : nextOptimistic.epoch)) {
@@ -319,10 +319,10 @@ function syncContinuity(continuity, socket, store) {
319
319
  `\u{1F9D1}\u200D\u2696\uFE0F`,
320
320
  `continuity`,
321
321
  continuityKey,
322
- `epoch of confirmed update #${confirmedUpdate.epoch} does not match zeroth optimistic update #${zerothOptimisticUpdate.epoch}`
322
+ `epoch of confirmed update #${confirmed.epoch} does not match zeroth optimistic update #${zerothOptimisticUpdate.epoch}`
323
323
  );
324
324
  const confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(
325
- (update) => update.epoch === confirmedUpdate.epoch
325
+ (update) => update.epoch === confirmed.epoch
326
326
  );
327
327
  if (!confirmedUpdateIsAlreadyEnqueued) {
328
328
  store.logger.info(
@@ -330,12 +330,12 @@ function syncContinuity(continuity, socket, store) {
330
330
  `continuity`,
331
331
  continuityKey,
332
332
  `pushing confirmed update to queue`,
333
- confirmedUpdate
333
+ confirmed
334
334
  );
335
335
  internal.setIntoStore(
336
336
  RTC.confirmedUpdateQueue,
337
337
  (queue) => {
338
- queue.push(confirmedUpdate);
338
+ queue.push(confirmed);
339
339
  queue.sort((a, b) => a.epoch - b.epoch);
340
340
  return queue;
341
341
  },
@@ -352,48 +352,48 @@ function syncContinuity(continuity, socket, store) {
352
352
  );
353
353
  const continuityEpoch = internal.getEpochNumberOfContinuity(continuityKey, store);
354
354
  const isRoot = internal.isRootStore(store);
355
- if (isRoot && continuityEpoch === confirmedUpdate.epoch - 1) {
355
+ if (isRoot && continuityEpoch === confirmed.epoch - 1) {
356
356
  store.logger.info(
357
357
  `\u2705`,
358
358
  `continuity`,
359
359
  continuityKey,
360
- `integrating update #${confirmedUpdate.epoch} (${confirmedUpdate.key} ${confirmedUpdate.id})`
360
+ `integrating update #${confirmed.epoch} (${confirmed.key} ${confirmed.id})`
361
361
  );
362
- internal.ingestTransactionUpdate(`newValue`, confirmedUpdate, store);
363
- socket.emit(`ack:${continuityKey}`, confirmedUpdate.epoch);
364
- internal.setEpochNumberOfContinuity(continuityKey, confirmedUpdate.epoch, store);
362
+ internal.ingestTransactionUpdate(`newValue`, confirmed, store);
363
+ socket.emit(`ack:${continuityKey}`, confirmed.epoch);
364
+ internal.setEpochNumberOfContinuity(continuityKey, confirmed.epoch, store);
365
365
  } else if (isRoot && continuityEpoch !== void 0) {
366
366
  store.logger.info(
367
367
  `\u{1F9D1}\u200D\u2696\uFE0F`,
368
368
  `continuity`,
369
369
  continuityKey,
370
- `received update #${confirmedUpdate.epoch} but still waiting for update #${continuityEpoch + 1}`,
370
+ `received update #${confirmed.epoch} but still waiting for update #${continuityEpoch + 1}`,
371
371
  {
372
372
  clientEpoch: continuityEpoch,
373
- serverEpoch: confirmedUpdate.epoch
373
+ serverEpoch: confirmed.epoch
374
374
  }
375
375
  );
376
376
  const confirmedUpdateIsAlreadyEnqueued = confirmedUpdates.some(
377
- (update) => update.epoch === confirmedUpdate.epoch
377
+ (update) => update.epoch === confirmed.epoch
378
378
  );
379
379
  if (confirmedUpdateIsAlreadyEnqueued) {
380
380
  store.logger.info(
381
381
  `\u{1F44D}`,
382
382
  `continuity`,
383
383
  continuityKey,
384
- `confirmed update #${confirmedUpdate.epoch} is already enqueued`
384
+ `confirmed update #${confirmed.epoch} is already enqueued`
385
385
  );
386
386
  } else {
387
387
  store.logger.info(
388
388
  `\u{1F448}`,
389
389
  `continuity`,
390
390
  continuityKey,
391
- `pushing confirmed update #${confirmedUpdate.epoch} to queue`
391
+ `pushing confirmed update #${confirmed.epoch} to queue`
392
392
  );
393
393
  internal.setIntoStore(
394
394
  RTC.confirmedUpdateQueue,
395
395
  (queue) => {
396
- queue.push(confirmedUpdate);
396
+ queue.push(confirmed);
397
397
  queue.sort((a, b) => a.epoch - b.epoch);
398
398
  return queue;
399
399
  },
@@ -32,9 +32,9 @@ declare function usePullSelectorFamilyMember<T, K extends Json.Serializable, Key
32
32
 
33
33
  declare function usePush<J extends Json.Serializable>(token: AtomIO.WritableToken<J>): <New extends J>(next: New | ((old: J) => New)) => void;
34
34
 
35
- declare function useServerAction extends AtomIO.ƒn>(token: AtomIO.TransactionToken<ƒ>): (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
35
+ declare function useServerAction<F extends AtomIO.Func>(token: AtomIO.TransactionToken<F>): (...parameters: Parameters<F>) => ReturnType<F>;
36
36
 
37
- type PerspectiveToken<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer T, any> ? T : never> = {
37
+ type PerspectiveToken<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer U, any> ? U : never> = {
38
38
  type: `realtime_perspective`;
39
39
  resourceAtoms: F;
40
40
  viewAtoms: ReadableFamilyToken<ReadableToken<T>[], string>;
@@ -1,5 +1,5 @@
1
- import { syncContinuity } from '../../dist/chunk-YDOGCZ53.js';
2
- import '../../dist/chunk-U2IICNHQ.js';
1
+ import { syncContinuity } from '../../dist/chunk-ATKDGVTV.js';
2
+ import '../../dist/chunk-F2X4B4VY.js';
3
3
  import { useI, StoreContext, useO } from 'atom.io/react';
4
4
  import * as RTC from 'atom.io/realtime-client';
5
5
  import * as React from 'react';
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "private": true,
5
5
  "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
6
+ "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
@@ -6,9 +6,9 @@ import * as React from "react"
6
6
 
7
7
  import { useRealtimeService } from "./use-realtime-service"
8
8
 
9
- export function useServerAction extends AtomIO.ƒn>(
10
- token: AtomIO.TransactionToken<ƒ>,
11
- ): (...parameters: Parameters<ƒ>) => ReturnType<ƒ> {
9
+ export function useServerAction<F extends AtomIO.Func>(
10
+ token: AtomIO.TransactionToken<F>,
11
+ ): (...parameters: Parameters<F>) => ReturnType<F> {
12
12
  const store = React.useContext(StoreContext)
13
13
 
14
14
  useRealtimeService(`tx:${token.key}`, (socket) =>
@@ -130,12 +130,12 @@ var ChildSocket = class extends CustomSocket {
130
130
  }
131
131
  this.unprocessedEvents.push(...chunk.split(``));
132
132
  const newInput = this.unprocessedEvents.shift();
133
- this.incompleteData += newInput || ``;
133
+ this.incompleteData += newInput != null ? newInput : ``;
134
134
  try {
135
135
  if (this.incompleteData.startsWith(`error`)) {
136
136
  console.log(`\u2757`, this.incompleteData);
137
137
  }
138
- const parsedEvent = json.parseJson(this.incompleteData);
138
+ let parsedEvent = json.parseJson(this.incompleteData);
139
139
  this.handleEvent(...parsedEvent);
140
140
  while (this.unprocessedEvents.length > 0) {
141
141
  const event = this.unprocessedEvents.shift();
@@ -143,8 +143,8 @@ var ChildSocket = class extends CustomSocket {
143
143
  if (this.unprocessedEvents.length === 0) {
144
144
  this.incompleteData = event;
145
145
  }
146
- const parsedEvent2 = json.parseJson(event);
147
- this.handleEvent(...parsedEvent2);
146
+ parsedEvent = json.parseJson(event);
147
+ this.handleEvent(...parsedEvent);
148
148
  }
149
149
  }
150
150
  this.incompleteData = ``;
@@ -161,15 +161,15 @@ var ChildSocket = class extends CustomSocket {
161
161
  const chunk = buf.toString();
162
162
  this.unprocessedLogs.push(...chunk.split(``));
163
163
  const newInput = this.unprocessedLogs.shift();
164
- this.incompleteLog += newInput || ``;
164
+ this.incompleteLog += newInput != null ? newInput : ``;
165
165
  try {
166
- const parsedLog = json.parseJson(this.incompleteLog);
166
+ let parsedLog = json.parseJson(this.incompleteLog);
167
167
  this.handleLog(parsedLog);
168
168
  while (this.unprocessedLogs.length > 0) {
169
169
  this.incompleteLog = (_a = this.unprocessedLogs.shift()) != null ? _a : ``;
170
170
  if (this.incompleteLog) {
171
- const parsedLog2 = json.parseJson(this.incompleteLog);
172
- this.handleLog(parsedLog2);
171
+ parsedLog = json.parseJson(this.incompleteLog);
172
+ this.handleLog(parsedLog);
173
173
  }
174
174
  }
175
175
  } catch (error) {
@@ -233,9 +233,15 @@ var ParentSocket = class extends CustomSocket {
233
233
  this.unprocessedEvents = [];
234
234
  this.id = `#####`;
235
235
  this.logger = {
236
- info: (...args) => this.log(`i`, ...args),
237
- warn: (...args) => this.log(`w`, ...args),
238
- error: (...args) => this.log(`e`, ...args)
236
+ info: (...args) => {
237
+ this.log(`i`, ...args);
238
+ },
239
+ warn: (...args) => {
240
+ this.log(`w`, ...args);
241
+ },
242
+ error: (...args) => {
243
+ this.log(`e`, ...args);
244
+ }
239
245
  };
240
246
  this.process = process;
241
247
  this.process.stdin.resume();
@@ -247,19 +253,19 @@ var ParentSocket = class extends CustomSocket {
247
253
  const chunk = buffer.toString();
248
254
  this.unprocessedEvents.push(...chunk.split(``));
249
255
  const newInput = this.unprocessedEvents.shift();
250
- this.incompleteData += newInput || ``;
256
+ this.incompleteData += newInput != null ? newInput : ``;
251
257
  try {
252
- const parsedEvent = json.parseJson(this.incompleteData);
253
- this.logger.info(`\u{1F3B0}`, `received`, parsedEvent);
254
- this.handleEvent(...parsedEvent);
258
+ const parsedData = json.parseJson(this.incompleteData);
259
+ this.logger.info(`\u{1F3B0}`, `received`, parsedData);
260
+ this.handleEvent(...parsedData);
255
261
  while (this.unprocessedEvents.length > 0) {
256
262
  const event = this.unprocessedEvents.shift();
257
263
  if (event) {
258
264
  if (this.unprocessedEvents.length === 0) {
259
265
  this.incompleteData = event;
260
266
  }
261
- const parsedEvent2 = json.parseJson(event);
262
- this.handleEvent(...parsedEvent2);
267
+ const parsedEvent = json.parseJson(event);
268
+ this.handleEvent(...parsedEvent);
263
269
  }
264
270
  }
265
271
  this.incompleteData = ``;
@@ -352,21 +358,21 @@ function getJoinMap(store) {
352
358
  function getJoin(token, store) {
353
359
  var _a;
354
360
  const joinMap = getJoinMap(store);
355
- let join2 = joinMap.get(token.key);
356
- if (join2 === void 0) {
361
+ let myJoin = joinMap.get(token.key);
362
+ if (myJoin === void 0) {
357
363
  const rootJoinMap = getJoinMap(internal.IMPLICIT.STORE);
358
- join2 = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
359
- if (join2 === void 0) {
364
+ myJoin = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
365
+ if (myJoin === void 0) {
360
366
  throw new Error(
361
367
  `Join "${token.key}" not found in store "${store.config.name}"`
362
368
  );
363
369
  }
364
- joinMap.set(token.key, join2);
370
+ joinMap.set(token.key, myJoin);
365
371
  }
366
- return join2;
372
+ return myJoin;
367
373
  }
368
374
  function findRelationsInStore(token, key, store) {
369
- const join2 = getJoin(token, store);
375
+ const myJoin = getJoin(token, store);
370
376
  let relations;
371
377
  switch (token.cardinality) {
372
378
  case `1:1`: {
@@ -374,27 +380,27 @@ function findRelationsInStore(token, key, store) {
374
380
  const keyBA = `${token.b}KeyOf${capitalize(token.a)}`;
375
381
  relations = {
376
382
  get [keyAB]() {
377
- const familyAB = join2.states[keyAB];
383
+ const familyAB = myJoin.states[keyAB];
378
384
  const state = internal.findInStore(familyAB, key, store);
379
385
  return state;
380
386
  },
381
387
  get [keyBA]() {
382
- const familyBA = join2.states[keyBA];
388
+ const familyBA = myJoin.states[keyBA];
383
389
  const state = internal.findInStore(familyBA, key, store);
384
390
  return state;
385
391
  }
386
392
  };
387
393
  const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
388
- if (entryAB in join2.states) {
394
+ if (entryAB in myJoin.states) {
389
395
  const entryBA = `${token.b}EntryOf${capitalize(token.a)}`;
390
396
  Object.assign(relations, {
391
397
  get [entryAB]() {
392
- const familyAB = join2.states[entryAB];
398
+ const familyAB = myJoin.states[entryAB];
393
399
  const state = internal.findInStore(familyAB, key, store);
394
400
  return state;
395
401
  },
396
402
  get [entryBA]() {
397
- const familyBA = join2.states[entryBA];
403
+ const familyBA = myJoin.states[entryBA];
398
404
  const state = internal.findInStore(familyBA, key, store);
399
405
  return state;
400
406
  }
@@ -407,27 +413,27 @@ function findRelationsInStore(token, key, store) {
407
413
  const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
408
414
  relations = {
409
415
  get [keyAB]() {
410
- const familyAB = join2.states[keyAB];
416
+ const familyAB = myJoin.states[keyAB];
411
417
  const state = internal.findInStore(familyAB, key, store);
412
418
  return state;
413
419
  },
414
420
  get [keysBA]() {
415
- const familyBA = join2.states[keysBA];
421
+ const familyBA = myJoin.states[keysBA];
416
422
  const state = internal.findInStore(familyBA, key, store);
417
423
  return state;
418
424
  }
419
425
  };
420
426
  const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
421
- if (entryAB in join2.states) {
427
+ if (entryAB in myJoin.states) {
422
428
  const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
423
429
  Object.assign(relations, {
424
430
  get [entryAB]() {
425
- const familyAB = join2.states[entryAB];
431
+ const familyAB = myJoin.states[entryAB];
426
432
  const state = internal.findInStore(familyAB, key, store);
427
433
  return state;
428
434
  },
429
435
  get [entriesBA]() {
430
- const familyBA = join2.states[entriesBA];
436
+ const familyBA = myJoin.states[entriesBA];
431
437
  const state = internal.findInStore(familyBA, key, store);
432
438
  return state;
433
439
  }
@@ -440,27 +446,27 @@ function findRelationsInStore(token, key, store) {
440
446
  const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
441
447
  relations = {
442
448
  get [keysAB]() {
443
- const familyAB = join2.states[keysAB];
449
+ const familyAB = myJoin.states[keysAB];
444
450
  const state = internal.findInStore(familyAB, key, store);
445
451
  return state;
446
452
  },
447
453
  get [keysBA]() {
448
- const familyBA = join2.states[keysBA];
454
+ const familyBA = myJoin.states[keysBA];
449
455
  const state = internal.findInStore(familyBA, key, store);
450
456
  return state;
451
457
  }
452
458
  };
453
459
  const entriesAB = `${token.a}EntriesOf${capitalize(token.b)}`;
454
- if (entriesAB in join2.states) {
460
+ if (entriesAB in myJoin.states) {
455
461
  const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
456
462
  Object.assign(relations, {
457
463
  get [entriesAB]() {
458
- const familyAB = join2.states[entriesAB];
464
+ const familyAB = myJoin.states[entriesAB];
459
465
  const state = internal.findInStore(familyAB, key, store);
460
466
  return state;
461
467
  },
462
468
  get [entriesBA]() {
463
- const familyBA = join2.states[entriesBA];
469
+ const familyBA = myJoin.states[entriesBA];
464
470
  const state = internal.findInStore(familyBA, key, store);
465
471
  return state;
466
472
  }
@@ -723,7 +729,7 @@ function realtimeContinuitySynchronizer({
723
729
  );
724
730
  const unsubscribeFunctions = [];
725
731
  const revealPerspectives = () => {
726
- const unsubscribeFunctions2 = [];
732
+ const unsubFns = [];
727
733
  for (const perspective of continuity.perspectives) {
728
734
  const { viewAtoms } = perspective;
729
735
  const userViewState = internal.findInStore(viewAtoms, userKey, store);
@@ -757,10 +763,10 @@ function realtimeContinuitySynchronizer({
757
763
  `sync-continuity:${continuityKey}:${userKey}:perspective:${perspective.resourceAtoms.key}`,
758
764
  store
759
765
  );
760
- unsubscribeFunctions2.push(unsubscribe);
766
+ unsubFns.push(unsubscribe);
761
767
  }
762
768
  return () => {
763
- for (const unsubscribe of unsubscribeFunctions2)
769
+ for (const unsubscribe of unsubFns)
764
770
  unsubscribe();
765
771
  };
766
772
  };
@@ -1087,7 +1093,9 @@ function realtimeStateReceiver({
1087
1093
  store = internal.IMPLICIT.STORE
1088
1094
  }) {
1089
1095
  return function stateReceiver(token) {
1090
- const publish = (newValue) => internal.setIntoStore(token, newValue, store);
1096
+ const publish = (newValue) => {
1097
+ internal.setIntoStore(token, newValue, store);
1098
+ };
1091
1099
  const fillPubUnclaim = () => {
1092
1100
  socket.off(`pub:${token.key}`, publish);
1093
1101
  socket.off(`unclaim:${token.key}`, fillPubUnclaim);
@@ -1123,7 +1131,9 @@ function realtimeActionReceiver({
1123
1131
  store == null ? void 0 : store.logger.info(`\u{1F680}`, `transaction`, tx.key, update.id, metric.duration);
1124
1132
  };
1125
1133
  socket.on(`tx-run:${tx.key}`, fillTransactionRequest);
1126
- return () => socket.off(`tx-run:${tx.key}`, fillTransactionRequest);
1134
+ return () => {
1135
+ socket.off(`tx-run:${tx.key}`, fillTransactionRequest);
1136
+ };
1127
1137
  };
1128
1138
  }
1129
1139
 
@@ -21,10 +21,10 @@ declare class CustomSocket<I extends Events, O extends Events> implements Socket
21
21
  protected handleEvent<Event extends keyof I>(event: string, ...args: I[Event]): void;
22
22
  id: string;
23
23
  constructor(emit: <Event extends keyof O>(event: Event, ...args: O[Event]) => CustomSocket<I, O>);
24
- on<Event extends keyof I>(event: Event, listener: (...args: I[Event]) => void): CustomSocket<I, O>;
25
- onAny(listener: (event: string, ...args: Json.Array) => void): CustomSocket<I, O>;
26
- off<Event extends keyof I>(event: Event, listener?: (...args: I[Event]) => void): CustomSocket<I, O>;
27
- offAny(listener: (event: string, ...args: Json.Array) => void): CustomSocket<I, O>;
24
+ on<Event extends keyof I>(event: Event, listener: (...args: I[Event]) => void): this;
25
+ onAny(listener: (event: string, ...args: Json.Array) => void): this;
26
+ off<Event extends keyof I>(event: Event, listener?: (...args: I[Event]) => void): this;
27
+ offAny(listener: (event: string, ...args: Json.Array) => void): this;
28
28
  }
29
29
 
30
30
  declare class ChildSocket<I extends Events, O extends Events & {
@@ -126,7 +126,7 @@ type StateReceiver = ReturnType<typeof realtimeStateReceiver>;
126
126
  declare function realtimeStateReceiver({ socket, store, }: ServerConfig): <J extends Json.Serializable>(token: WritableToken<J>) => () => void;
127
127
 
128
128
  type ActionReceiver = ReturnType<typeof realtimeActionReceiver>;
129
- declare function realtimeActionReceiver({ socket, store, }: ServerConfig): extends JsonIO>(tx: AtomIO.TransactionToken<ƒ>) => () => void;
129
+ declare function realtimeActionReceiver({ socket, store, }: ServerConfig): <F extends JsonIO>(tx: AtomIO.TransactionToken<F>) => () => void;
130
130
 
131
131
  type Socket = {
132
132
  id: string;
@@ -1,6 +1,6 @@
1
- import { findRelationsInStore } from '../../dist/chunk-7ZR244C2.js';
2
- import '../../dist/chunk-WX2NCOZR.js';
3
- import { __spreadProps, __spreadValues } from '../../dist/chunk-U2IICNHQ.js';
1
+ import { findRelationsInStore } from '../../dist/chunk-MSCJWACE.js';
2
+ import '../../dist/chunk-FTONNX2R.js';
3
+ import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
4
4
  import { parseJson, stringifyJson } from 'atom.io/json';
5
5
  import { getUpdateToken, IMPLICIT, Subject, getFromStore, subscribeToState, findInStore, getJsonToken, isRootStore, subscribeToTransaction, actUponStore, setIntoStore } from 'atom.io/internal';
6
6
  import { SetRTX } from 'atom.io/transceivers/set-rtx';
@@ -92,12 +92,12 @@ var ChildSocket = class extends CustomSocket {
92
92
  }
93
93
  this.unprocessedEvents.push(...chunk.split(``));
94
94
  const newInput = this.unprocessedEvents.shift();
95
- this.incompleteData += newInput || ``;
95
+ this.incompleteData += newInput != null ? newInput : ``;
96
96
  try {
97
97
  if (this.incompleteData.startsWith(`error`)) {
98
98
  console.log(`\u2757`, this.incompleteData);
99
99
  }
100
- const parsedEvent = parseJson(this.incompleteData);
100
+ let parsedEvent = parseJson(this.incompleteData);
101
101
  this.handleEvent(...parsedEvent);
102
102
  while (this.unprocessedEvents.length > 0) {
103
103
  const event = this.unprocessedEvents.shift();
@@ -105,8 +105,8 @@ var ChildSocket = class extends CustomSocket {
105
105
  if (this.unprocessedEvents.length === 0) {
106
106
  this.incompleteData = event;
107
107
  }
108
- const parsedEvent2 = parseJson(event);
109
- this.handleEvent(...parsedEvent2);
108
+ parsedEvent = parseJson(event);
109
+ this.handleEvent(...parsedEvent);
110
110
  }
111
111
  }
112
112
  this.incompleteData = ``;
@@ -123,15 +123,15 @@ var ChildSocket = class extends CustomSocket {
123
123
  const chunk = buf.toString();
124
124
  this.unprocessedLogs.push(...chunk.split(``));
125
125
  const newInput = this.unprocessedLogs.shift();
126
- this.incompleteLog += newInput || ``;
126
+ this.incompleteLog += newInput != null ? newInput : ``;
127
127
  try {
128
- const parsedLog = parseJson(this.incompleteLog);
128
+ let parsedLog = parseJson(this.incompleteLog);
129
129
  this.handleLog(parsedLog);
130
130
  while (this.unprocessedLogs.length > 0) {
131
131
  this.incompleteLog = (_a = this.unprocessedLogs.shift()) != null ? _a : ``;
132
132
  if (this.incompleteLog) {
133
- const parsedLog2 = parseJson(this.incompleteLog);
134
- this.handleLog(parsedLog2);
133
+ parsedLog = parseJson(this.incompleteLog);
134
+ this.handleLog(parsedLog);
135
135
  }
136
136
  }
137
137
  } catch (error) {
@@ -195,9 +195,15 @@ var ParentSocket = class extends CustomSocket {
195
195
  this.unprocessedEvents = [];
196
196
  this.id = `#####`;
197
197
  this.logger = {
198
- info: (...args) => this.log(`i`, ...args),
199
- warn: (...args) => this.log(`w`, ...args),
200
- error: (...args) => this.log(`e`, ...args)
198
+ info: (...args) => {
199
+ this.log(`i`, ...args);
200
+ },
201
+ warn: (...args) => {
202
+ this.log(`w`, ...args);
203
+ },
204
+ error: (...args) => {
205
+ this.log(`e`, ...args);
206
+ }
201
207
  };
202
208
  this.process = process;
203
209
  this.process.stdin.resume();
@@ -209,19 +215,19 @@ var ParentSocket = class extends CustomSocket {
209
215
  const chunk = buffer.toString();
210
216
  this.unprocessedEvents.push(...chunk.split(``));
211
217
  const newInput = this.unprocessedEvents.shift();
212
- this.incompleteData += newInput || ``;
218
+ this.incompleteData += newInput != null ? newInput : ``;
213
219
  try {
214
- const parsedEvent = parseJson(this.incompleteData);
215
- this.logger.info(`\u{1F3B0}`, `received`, parsedEvent);
216
- this.handleEvent(...parsedEvent);
220
+ const parsedData = parseJson(this.incompleteData);
221
+ this.logger.info(`\u{1F3B0}`, `received`, parsedData);
222
+ this.handleEvent(...parsedData);
217
223
  while (this.unprocessedEvents.length > 0) {
218
224
  const event = this.unprocessedEvents.shift();
219
225
  if (event) {
220
226
  if (this.unprocessedEvents.length === 0) {
221
227
  this.incompleteData = event;
222
228
  }
223
- const parsedEvent2 = parseJson(event);
224
- this.handleEvent(...parsedEvent2);
229
+ const parsedEvent = parseJson(event);
230
+ this.handleEvent(...parsedEvent);
225
231
  }
226
232
  }
227
233
  this.incompleteData = ``;
@@ -553,7 +559,7 @@ function realtimeContinuitySynchronizer({
553
559
  );
554
560
  const unsubscribeFunctions = [];
555
561
  const revealPerspectives = () => {
556
- const unsubscribeFunctions2 = [];
562
+ const unsubFns = [];
557
563
  for (const perspective of continuity.perspectives) {
558
564
  const { viewAtoms } = perspective;
559
565
  const userViewState = findInStore(viewAtoms, userKey, store);
@@ -587,10 +593,10 @@ function realtimeContinuitySynchronizer({
587
593
  `sync-continuity:${continuityKey}:${userKey}:perspective:${perspective.resourceAtoms.key}`,
588
594
  store
589
595
  );
590
- unsubscribeFunctions2.push(unsubscribe);
596
+ unsubFns.push(unsubscribe);
591
597
  }
592
598
  return () => {
593
- for (const unsubscribe of unsubscribeFunctions2)
599
+ for (const unsubscribe of unsubFns)
594
600
  unsubscribe();
595
601
  };
596
602
  };
@@ -917,7 +923,9 @@ function realtimeStateReceiver({
917
923
  store = IMPLICIT.STORE
918
924
  }) {
919
925
  return function stateReceiver(token) {
920
- const publish = (newValue) => setIntoStore(token, newValue, store);
926
+ const publish = (newValue) => {
927
+ setIntoStore(token, newValue, store);
928
+ };
921
929
  const fillPubUnclaim = () => {
922
930
  socket.off(`pub:${token.key}`, publish);
923
931
  socket.off(`unclaim:${token.key}`, fillPubUnclaim);
@@ -953,7 +961,9 @@ function realtimeActionReceiver({
953
961
  store == null ? void 0 : store.logger.info(`\u{1F680}`, `transaction`, tx.key, update.id, metric.duration);
954
962
  };
955
963
  socket.on(`tx-run:${tx.key}`, fillTransactionRequest);
956
- return () => socket.off(`tx-run:${tx.key}`, fillTransactionRequest);
964
+ return () => {
965
+ socket.off(`tx-run:${tx.key}`, fillTransactionRequest);
966
+ };
957
967
  };
958
968
  }
959
969
 
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "private": true,
5
5
  "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
6
+ "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {