atom.io 0.25.6 → 0.26.0

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 (52) hide show
  1. package/data/dist/index.js +33 -25
  2. package/data/package.json +1 -4
  3. package/dist/{chunk-HYXKCFVY.js → chunk-IBTHB2PI.js} +59 -60
  4. package/dist/{chunk-MR5NETHW.js → chunk-IW6WYRS7.js} +4 -5
  5. package/dist/chunk-XWL6SNVU.js +7 -0
  6. package/dist/index.js +33 -21
  7. package/ephemeral/dist/index.js +1 -1
  8. package/ephemeral/package.json +1 -4
  9. package/eslint-plugin/dist/index.js +7 -8
  10. package/eslint-plugin/package.json +1 -4
  11. package/immortal/dist/index.js +1 -1
  12. package/immortal/package.json +1 -4
  13. package/internal/dist/index.js +173 -160
  14. package/internal/package.json +1 -4
  15. package/introspection/dist/index.js +32 -30
  16. package/introspection/package.json +1 -4
  17. package/json/dist/index.js +1 -1
  18. package/json/package.json +1 -4
  19. package/package.json +18 -50
  20. package/react/dist/index.js +2 -2
  21. package/react/package.json +1 -4
  22. package/react-devtools/dist/index.js +75 -68
  23. package/react-devtools/package.json +1 -4
  24. package/realtime/dist/index.js +8 -9
  25. package/realtime/package.json +1 -4
  26. package/realtime-client/dist/index.js +6 -6
  27. package/realtime-client/package.json +1 -4
  28. package/realtime-react/dist/index.js +9 -11
  29. package/realtime-react/package.json +1 -4
  30. package/realtime-server/dist/index.js +59 -54
  31. package/realtime-server/package.json +1 -4
  32. package/realtime-testing/dist/index.js +3 -3
  33. package/realtime-testing/package.json +1 -4
  34. package/transceivers/set-rtx/dist/index.js +11 -11
  35. package/transceivers/set-rtx/package.json +1 -4
  36. package/data/dist/index.cjs +0 -953
  37. package/dist/chunk-S4N6XNPH.js +0 -38
  38. package/dist/index.cjs +0 -215
  39. package/ephemeral/dist/index.cjs +0 -11
  40. package/eslint-plugin/dist/index.cjs +0 -388
  41. package/immortal/dist/index.cjs +0 -14
  42. package/internal/dist/index.cjs +0 -3405
  43. package/introspection/dist/index.cjs +0 -449
  44. package/json/dist/index.cjs +0 -128
  45. package/react/dist/index.cjs +0 -118
  46. package/react-devtools/dist/index.cjs +0 -2191
  47. package/realtime/dist/index.cjs +0 -120
  48. package/realtime-client/dist/index.cjs +0 -569
  49. package/realtime-react/dist/index.cjs +0 -189
  50. package/realtime-server/dist/index.cjs +0 -965
  51. package/realtime-testing/dist/index.cjs +0 -201
  52. package/transceivers/set-rtx/dist/index.cjs +0 -215
@@ -1,4 +1,4 @@
1
- import { __spreadProps, __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
1
+ import '../../dist/chunk-XWL6SNVU.js';
2
2
  import { parseJson, stringifyJson } from 'atom.io/json';
3
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';
@@ -12,10 +12,11 @@ import { spawn } from 'child_process';
12
12
  var CustomSocket = class {
13
13
  constructor(emit) {
14
14
  this.emit = emit;
15
- this.id = `no_id_retrieved`;
16
15
  this.listeners = /* @__PURE__ */ new Map();
17
16
  this.globalListeners = /* @__PURE__ */ new Set();
18
17
  }
18
+ listeners;
19
+ globalListeners;
19
20
  handleEvent(event, ...args) {
20
21
  for (const listener of this.globalListeners) {
21
22
  listener(event, ...args);
@@ -27,6 +28,7 @@ var CustomSocket = class {
27
28
  }
28
29
  }
29
30
  }
31
+ id = `no_id_retrieved`;
30
32
  on(event, listener) {
31
33
  const listeners = this.listeners.get(event);
32
34
  if (listeners) {
@@ -75,11 +77,6 @@ var ChildSocket = class extends CustomSocket {
75
77
  this.process = process2;
76
78
  this.key = key;
77
79
  this.logger = logger;
78
- this.incompleteData = ``;
79
- this.unprocessedEvents = [];
80
- this.incompleteLog = ``;
81
- this.unprocessedLogs = [];
82
- this.id = `#####`;
83
80
  this.process = process2;
84
81
  this.process.stdout.on(
85
82
  `data`,
@@ -90,7 +87,7 @@ var ChildSocket = class extends CustomSocket {
90
87
  }
91
88
  this.unprocessedEvents.push(...chunk.split(``));
92
89
  const newInput = this.unprocessedEvents.shift();
93
- this.incompleteData += newInput != null ? newInput : ``;
90
+ this.incompleteData += newInput ?? ``;
94
91
  try {
95
92
  if (this.incompleteData.startsWith(`error`)) {
96
93
  console.log(`\u2757`, this.incompleteData);
@@ -117,16 +114,15 @@ var ChildSocket = class extends CustomSocket {
117
114
  }
118
115
  );
119
116
  this.process.stderr.on(`data`, (buf) => {
120
- var _a;
121
117
  const chunk = buf.toString();
122
118
  this.unprocessedLogs.push(...chunk.split(``));
123
119
  const newInput = this.unprocessedLogs.shift();
124
- this.incompleteLog += newInput != null ? newInput : ``;
120
+ this.incompleteLog += newInput ?? ``;
125
121
  try {
126
122
  let parsedLog = parseJson(this.incompleteLog);
127
123
  this.handleLog(parsedLog);
128
124
  while (this.unprocessedLogs.length > 0) {
129
- this.incompleteLog = (_a = this.unprocessedLogs.shift()) != null ? _a : ``;
125
+ this.incompleteLog = this.unprocessedLogs.shift() ?? ``;
130
126
  if (this.incompleteLog) {
131
127
  parsedLog = parseJson(this.incompleteLog);
132
128
  this.handleLog(parsedLog);
@@ -143,6 +139,11 @@ var ChildSocket = class extends CustomSocket {
143
139
  this.id = process2.pid.toString();
144
140
  }
145
141
  }
142
+ incompleteData = ``;
143
+ unprocessedEvents = [];
144
+ incompleteLog = ``;
145
+ unprocessedLogs = [];
146
+ id = `#####`;
146
147
  handleLog(arg) {
147
148
  if (Array.isArray(arg)) {
148
149
  const [level, ...rest] = arg;
@@ -161,13 +162,15 @@ var ChildSocket = class extends CustomSocket {
161
162
  }
162
163
  };
163
164
  var SubjectSocket = class extends CustomSocket {
165
+ in;
166
+ out;
167
+ id = `no_id_retrieved`;
168
+ disposalFunctions = [];
164
169
  constructor(id) {
165
170
  super((...args) => {
166
171
  this.out.next(args);
167
172
  return this;
168
173
  });
169
- this.id = `no_id_retrieved`;
170
- this.disposalFunctions = [];
171
174
  this.id = id;
172
175
  this.in = new Subject();
173
176
  this.out = new Subject();
@@ -182,27 +185,38 @@ var SubjectSocket = class extends CustomSocket {
182
185
  }
183
186
  };
184
187
  var ParentSocket = class extends CustomSocket {
188
+ incompleteData = ``;
189
+ unprocessedEvents = [];
190
+ relays;
191
+ relayServices;
192
+ process;
193
+ id = `#####`;
194
+ log(...args) {
195
+ this.process.stderr.write(
196
+ stringifyJson(
197
+ args.map(
198
+ (arg) => arg instanceof SetRTX ? `{ ${arg.toJSON().members.join(` | `)} }` : arg
199
+ )
200
+ ) + ``
201
+ );
202
+ }
203
+ logger = {
204
+ info: (...args) => {
205
+ this.log(`i`, ...args);
206
+ },
207
+ warn: (...args) => {
208
+ this.log(`w`, ...args);
209
+ },
210
+ error: (...args) => {
211
+ this.log(`e`, ...args);
212
+ }
213
+ };
185
214
  constructor() {
186
- var _a;
187
215
  super((event, ...args) => {
188
216
  const stringifiedEvent = JSON.stringify([event, ...args]);
189
217
  this.process.stdout.write(stringifiedEvent + ``);
190
218
  return this;
191
219
  });
192
- this.incompleteData = ``;
193
- this.unprocessedEvents = [];
194
- this.id = `#####`;
195
- this.logger = {
196
- info: (...args) => {
197
- this.log(`i`, ...args);
198
- },
199
- warn: (...args) => {
200
- this.log(`w`, ...args);
201
- },
202
- error: (...args) => {
203
- this.log(`e`, ...args);
204
- }
205
- };
206
220
  this.process = process;
207
221
  this.process.stdin.resume();
208
222
  this.relays = /* @__PURE__ */ new Map();
@@ -213,7 +227,7 @@ var ParentSocket = class extends CustomSocket {
213
227
  const chunk = buffer.toString();
214
228
  this.unprocessedEvents.push(...chunk.split(``));
215
229
  const newInput = this.unprocessedEvents.shift();
216
- this.incompleteData += newInput != null ? newInput : ``;
230
+ this.incompleteData += newInput ?? ``;
217
231
  try {
218
232
  const parsedData = parseJson(this.incompleteData);
219
233
  this.logger.info(`\u{1F3B0}`, `received`, parsedData);
@@ -256,7 +270,7 @@ var ParentSocket = class extends CustomSocket {
256
270
  process.exit(0);
257
271
  });
258
272
  if (process.pid) {
259
- this.id = (_a = process.pid) == null ? void 0 : _a.toString();
273
+ this.id = process.pid?.toString();
260
274
  }
261
275
  this.on(`user-joins`, (username) => {
262
276
  this.logger.info(`\u{1F464}`, `user`, username, `joined`);
@@ -290,15 +304,6 @@ var ParentSocket = class extends CustomSocket {
290
304
  });
291
305
  process.stdout.write(`\u2728`);
292
306
  }
293
- log(...args) {
294
- this.process.stderr.write(
295
- stringifyJson(
296
- args.map(
297
- (arg) => arg instanceof SetRTX ? `{ ${arg.toJSON().members.join(` | `)} }` : arg
298
- )
299
- ) + ``
300
- );
301
- }
302
307
  relay(attachServices) {
303
308
  this.logger.info(`\u{1F517}`, `running relay method`);
304
309
  this.relayServices.push(attachServices);
@@ -321,7 +326,7 @@ function realtimeActionReceiver({
321
326
  performanceKeyStart,
322
327
  performanceKeyEnd
323
328
  );
324
- store == null ? void 0 : store.logger.info(`\u{1F680}`, `transaction`, tx.key, update.id, metric.duration);
329
+ store?.logger.info(`\u{1F680}`, `transaction`, tx.key, update.id, metric.duration);
325
330
  };
326
331
  socket.on(`tx-run:${tx.key}`, fillTransactionRequest);
327
332
  return () => {
@@ -415,7 +420,7 @@ function redactTransactionUpdateContent(visibleStateKeys, updates) {
415
420
  visibleStateKeys,
416
421
  update.updates
417
422
  );
418
- return __spreadProps(__spreadValues({}, update), { updates: redacted });
423
+ return { ...update, updates: redacted };
419
424
  }
420
425
  default:
421
426
  return update;
@@ -556,10 +561,10 @@ function realtimeContinuitySynchronizer({
556
561
  { oldKeys, newKeys, revealed, concealed }
557
562
  );
558
563
  if (revealed.length > 0) {
559
- socket == null ? void 0 : socket.emit(`reveal:${continuityKey}`, revealed);
564
+ socket?.emit(`reveal:${continuityKey}`, revealed);
560
565
  }
561
566
  if (concealed.length > 0) {
562
- socket == null ? void 0 : socket.emit(`conceal:${continuityKey}`, concealed);
567
+ socket?.emit(`conceal:${continuityKey}`, concealed);
563
568
  }
564
569
  },
565
570
  `sync-continuity:${continuityKey}:${userKey}:perspective:${perspective.resourceAtoms.key}`,
@@ -573,7 +578,6 @@ function realtimeContinuitySynchronizer({
573
578
  };
574
579
  const unsubscribeFromPerspectives = revealPerspectives();
575
580
  const sendInitialPayload = () => {
576
- var _a;
577
581
  const initialPayload = [];
578
582
  for (const atom2 of continuity.globals) {
579
583
  const resourceToken = atom2.type === `mutable_atom` ? getJsonToken(atom2, store) : atom2;
@@ -594,8 +598,8 @@ function realtimeContinuitySynchronizer({
594
598
  initialPayload.push(resourceToken, resource);
595
599
  }
596
600
  }
597
- const epoch = isRootStore(store) ? (_a = store.transactionMeta.epoch.get(continuityKey)) != null ? _a : null : null;
598
- socket == null ? void 0 : socket.emit(`continuity-init:${continuityKey}`, epoch, initialPayload);
601
+ const epoch = isRootStore(store) ? store.transactionMeta.epoch.get(continuityKey) ?? null : null;
602
+ socket?.emit(`continuity-init:${continuityKey}`, epoch, initialPayload);
599
603
  for (const transaction2 of continuity.actions) {
600
604
  const unsubscribeFromTransaction = subscribeToTransaction(
601
605
  transaction2,
@@ -623,10 +627,11 @@ function realtimeContinuitySynchronizer({
623
627
  visibleKeys,
624
628
  update.updates
625
629
  );
626
- const redactedUpdate = __spreadProps(__spreadValues({}, update), {
630
+ const redactedUpdate = {
631
+ ...update,
627
632
  updates: redactedUpdates
628
- });
629
- socket == null ? void 0 : socket.emit(
633
+ };
634
+ socket?.emit(
630
635
  `tx-new:${continuityKey}`,
631
636
  redactedUpdate
632
637
  );
@@ -681,7 +686,7 @@ function realtimeContinuitySynchronizer({
681
686
  performanceKeyStart,
682
687
  performanceKeyEnd
683
688
  );
684
- store == null ? void 0 : store.logger.info(
689
+ store?.logger.info(
685
690
  `\u{1F680}`,
686
691
  `transaction`,
687
692
  transactionKey,
@@ -708,8 +713,8 @@ function realtimeContinuitySynchronizer({
708
713
  return () => {
709
714
  for (const unsubscribe of unsubscribeFunctions) unsubscribe();
710
715
  unsubscribeFromPerspectives();
711
- socket == null ? void 0 : socket.off(`get:${continuityKey}`, sendInitialPayload);
712
- socket == null ? void 0 : socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
716
+ socket?.off(`get:${continuityKey}`, sendInitialPayload);
717
+ socket?.off(`tx-run:${continuityKey}`, fillTransactionRequest);
713
718
  };
714
719
  };
715
720
  }
@@ -818,7 +823,7 @@ function realtimeMutableProvider({
818
823
  const trackerToken = getUpdateToken(token);
819
824
  const fillUnsubRequest = () => {
820
825
  socket.off(`unsub:${token.key}`, fillUnsubRequest);
821
- unsubscribeFromStateUpdates == null ? void 0 : unsubscribeFromStateUpdates();
826
+ unsubscribeFromStateUpdates?.();
822
827
  unsubscribeFromStateUpdates = null;
823
828
  };
824
829
  const fillSubRequest = () => {
@@ -836,7 +841,7 @@ function realtimeMutableProvider({
836
841
  socket.on(`sub:${token.key}`, fillSubRequest);
837
842
  return () => {
838
843
  socket.off(`sub:${token.key}`, fillSubRequest);
839
- unsubscribeFromStateUpdates == null ? void 0 : unsubscribeFromStateUpdates();
844
+ unsubscribeFromStateUpdates?.();
840
845
  };
841
846
  };
842
847
  }
@@ -2,14 +2,11 @@
2
2
  "name": "atom.io-realtime-server",
3
3
  "type": "module",
4
4
  "private": true,
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
9
  "import": "./dist/index.js",
11
- "browser": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
10
  "types": "./dist/index.d.ts"
14
11
  }
15
12
  }
@@ -1,5 +1,5 @@
1
- import { recordToEntries } from '../../dist/chunk-MR5NETHW.js';
2
- import { __spreadProps, __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
1
+ import { recordToEntries } from '../../dist/chunk-IW6WYRS7.js';
2
+ import '../../dist/chunk-XWL6SNVU.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';
@@ -126,7 +126,7 @@ var multiClient = (options) => {
126
126
  const clients = recordToEntries(options.clients).reduce(
127
127
  (clientRecord, [name, client]) => {
128
128
  clientRecord[name] = setupRealtimeTestClient(
129
- __spreadProps(__spreadValues({}, options), { client }),
129
+ { ...options, client },
130
130
  name,
131
131
  server.port
132
132
  );
@@ -2,14 +2,11 @@
2
2
  "name": "atom.io-realtime-testing",
3
3
  "type": "module",
4
4
  "private": true,
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
9
  "import": "./dist/index.js",
11
- "browser": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
10
  "types": "./dist/index.d.ts"
14
11
  }
15
12
  }
@@ -1,18 +1,16 @@
1
- import '../../../dist/chunk-S4N6XNPH.js';
1
+ import '../../../dist/chunk-XWL6SNVU.js';
2
2
  import { Subject } from 'atom.io/internal';
3
3
  import { stringifyJson, parseJson } from 'atom.io/json';
4
4
 
5
5
  var SetRTX = class _SetRTX extends Set {
6
+ mode = `record`;
7
+ subject = new Subject();
8
+ cacheLimit = 0;
9
+ cache = [];
10
+ cacheIdx = -1;
11
+ cacheUpdateNumber = -1;
6
12
  constructor(values, cacheLimit = 0) {
7
13
  super(values);
8
- this.mode = `record`;
9
- this.subject = new Subject();
10
- this.cacheLimit = 0;
11
- this.cache = [];
12
- this.cacheIdx = -1;
13
- this.cacheUpdateNumber = -1;
14
- this.child = null;
15
- this.transactionUpdates = null;
16
14
  if (values instanceof _SetRTX) {
17
15
  this.parent = values;
18
16
  this.cacheUpdateNumber = values.cacheUpdateNumber;
@@ -67,13 +65,15 @@ var SetRTX = class _SetRTX extends Set {
67
65
  }
68
66
  return result;
69
67
  }
68
+ parent;
69
+ child = null;
70
+ transactionUpdates = null;
70
71
  transaction(run) {
71
72
  this.mode = `transaction`;
72
73
  this.transactionUpdates = [];
73
74
  this.child = new _SetRTX(this);
74
75
  const unsubscribe = this.child._subscribe(`transaction`, (update) => {
75
- var _a;
76
- (_a = this.transactionUpdates) == null ? void 0 : _a.push(update);
76
+ this.transactionUpdates?.push(update);
77
77
  });
78
78
  try {
79
79
  const shouldCommit = run(this.child);
@@ -2,14 +2,11 @@
2
2
  "name": "atom.io-transceivers-set-rtx",
3
3
  "type": "module",
4
4
  "private": true,
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
9
  "import": "./dist/index.js",
11
- "browser": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
10
  "types": "./dist/index.d.ts"
14
11
  }
15
12
  }