atom.io 0.30.1 → 0.30.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 (28) hide show
  1. package/data/dist/index.js +18 -16
  2. package/data/src/join.ts +18 -16
  3. package/dist/{chunk-SMKF3ZNG.js → chunk-LSCRHXLI.js} +22 -5
  4. package/internal/dist/index.d.ts +3 -1
  5. package/internal/dist/index.js +1 -1
  6. package/internal/src/junction.ts +23 -7
  7. package/json/dist/index.js +1 -1
  8. package/package.json +22 -22
  9. package/react-devtools/dist/index.js +1 -1
  10. package/react-devtools/src/AtomIODevtools.tsx +1 -1
  11. package/react-devtools/src/elastic-input/NumberInput.tsx +0 -1
  12. package/react-devtools/src/elastic-input/TextInput.tsx +0 -1
  13. package/realtime/dist/index.d.ts +2 -1
  14. package/realtime/src/realtime-continuity.ts +3 -2
  15. package/realtime-server/dist/index.d.ts +11 -10
  16. package/realtime-server/dist/index.js +279 -234
  17. package/realtime-server/src/continuity/prepare-to-send-initial-payload.ts +54 -0
  18. package/realtime-server/src/continuity/prepare-to-serve-transaction-request.ts +53 -0
  19. package/realtime-server/src/continuity/prepare-to-sync-realtime-continuity.ts +145 -0
  20. package/realtime-server/src/continuity/prepare-to-track-client-acknowledgement.ts +38 -0
  21. package/realtime-server/src/continuity/subscribe-to-continuity-actions.ts +106 -0
  22. package/realtime-server/src/continuity/subscribe-to-continuity-perpectives.ts +60 -0
  23. package/realtime-server/src/index.ts +1 -1
  24. package/realtime-server/src/realtime-server-stores/server-sync-store.ts +11 -5
  25. package/realtime-server/src/realtime-server-stores/server-user-store.ts +4 -4
  26. package/realtime-testing/dist/index.js +6 -2
  27. package/realtime-testing/src/setup-realtime-test.tsx +4 -2
  28. package/realtime-server/src/realtime-continuity-synchronizer.ts +0 -343
@@ -332,17 +332,18 @@ var Join = class _Join {
332
332
  store,
333
333
  {
334
334
  key: `${options.key}/singleRelatedEntry`,
335
- get: (key) => ({ get }) => {
336
- const relatedKeysState = this.retrieve(relatedKeysAtoms, key);
335
+ get: (x) => ({ get }) => {
336
+ const relatedKeysState = this.retrieve(relatedKeysAtoms, x);
337
337
  const relatedKeys = get(relatedKeysState);
338
- for (const relatedKey of relatedKeys) {
339
- const contentKey = relations.makeContentKey(
340
- key,
341
- relatedKey
342
- );
338
+ for (const y of relatedKeys) {
339
+ let a = relations.isAType?.(x) ? x : void 0;
340
+ let b = a === void 0 ? x : void 0;
341
+ a ??= y;
342
+ b ??= y;
343
+ const contentKey = relations.makeContentKey(a, b);
343
344
  const contentState = this.retrieve(contentAtoms, contentKey);
344
345
  const content = get(contentState);
345
- return [relatedKey, content];
346
+ return [y, content];
346
347
  }
347
348
  return null;
348
349
  }
@@ -353,18 +354,19 @@ var Join = class _Join {
353
354
  store,
354
355
  {
355
356
  key: `${options.key}/multipleRelatedEntries`,
356
- get: (key) => ({ get }) => {
357
+ get: (x) => ({ get }) => {
357
358
  const jsonFamily = getJsonFamily(relatedKeysAtoms, store);
358
- const jsonState = this.retrieve(jsonFamily, key);
359
+ const jsonState = this.retrieve(jsonFamily, x);
359
360
  const json = get(jsonState);
360
- return json.members.map((relatedKey) => {
361
- const contentKey = relations.makeContentKey(
362
- key,
363
- relatedKey
364
- );
361
+ return json.members.map((y) => {
362
+ let a = relations.isAType?.(x) ? x : void 0;
363
+ let b = a === void 0 ? x : void 0;
364
+ a ??= y;
365
+ b ??= y;
366
+ const contentKey = relations.makeContentKey(a, b);
365
367
  const contentState = this.retrieve(contentAtoms, contentKey);
366
368
  const content = get(contentState);
367
- return [relatedKey, content];
369
+ return [y, content];
368
370
  });
369
371
  }
370
372
  },
package/data/src/join.ts CHANGED
@@ -556,18 +556,19 @@ export class Join<
556
556
  {
557
557
  key: `${options.key}/singleRelatedEntry`,
558
558
  get:
559
- (key) =>
559
+ (x) =>
560
560
  ({ get }) => {
561
- const relatedKeysState = this.retrieve(relatedKeysAtoms, key)
561
+ const relatedKeysState = this.retrieve(relatedKeysAtoms, x)
562
562
  const relatedKeys = get(relatedKeysState)
563
- for (const relatedKey of relatedKeys) {
564
- const contentKey = relations.makeContentKey(
565
- key as any,
566
- relatedKey as any,
567
- ) // sort XY to AB ❗
563
+ for (const y of relatedKeys) {
564
+ let a = relations.isAType?.(x) ? x : undefined
565
+ let b = a === undefined ? (x as BType) : undefined
566
+ a ??= y as AType
567
+ b ??= y as BType
568
+ const contentKey = relations.makeContentKey(a, b)
568
569
  const contentState = this.retrieve(contentAtoms, contentKey)
569
570
  const content = get(contentState)
570
- return [relatedKey, content]
571
+ return [y, content]
571
572
  }
572
573
  return null
573
574
  },
@@ -580,19 +581,20 @@ export class Join<
580
581
  {
581
582
  key: `${options.key}/multipleRelatedEntries`,
582
583
  get:
583
- (key) =>
584
+ (x) =>
584
585
  ({ get }) => {
585
586
  const jsonFamily = getJsonFamily(relatedKeysAtoms, store)
586
- const jsonState = this.retrieve(jsonFamily, key)
587
+ const jsonState = this.retrieve(jsonFamily, x)
587
588
  const json = get(jsonState)
588
- return json.members.map((relatedKey) => {
589
- const contentKey = relations.makeContentKey(
590
- key as any,
591
- relatedKey as any,
592
- ) // sort XY to AB ❗
589
+ return json.members.map((y) => {
590
+ let a = relations.isAType?.(x) ? x : undefined
591
+ let b = a === undefined ? (x as BType) : undefined
592
+ a ??= y as AType
593
+ b ??= y as BType
594
+ const contentKey = relations.makeContentKey(a, b)
593
595
  const contentState = this.retrieve(contentAtoms, contentKey)
594
596
  const content = get(contentState)
595
- return [relatedKey, content]
597
+ return [y, content]
596
598
  })
597
599
  },
598
600
  },
@@ -121,6 +121,8 @@ var Junction = class {
121
121
  cardinality;
122
122
  relations = /* @__PURE__ */ new Map();
123
123
  contents = /* @__PURE__ */ new Map();
124
+ isAType;
125
+ isBType;
124
126
  isContent;
125
127
  makeContentKey = (a, b) => `${a}:${b}`;
126
128
  warn;
@@ -168,8 +170,12 @@ var Junction = class {
168
170
  }
169
171
  replaceRelationsSafely(x, ys) {
170
172
  const xRelationsPrev = this.relations.get(x);
173
+ let a = this.isAType?.(x) ? x : void 0;
174
+ let b = a === void 0 ? x : void 0;
171
175
  if (xRelationsPrev) {
172
176
  for (const y of xRelationsPrev) {
177
+ a ??= y;
178
+ b ??= y;
173
179
  const yRelations = this.relations.get(y);
174
180
  if (yRelations) {
175
181
  if (yRelations.size === 1) {
@@ -177,7 +183,7 @@ var Junction = class {
177
183
  } else {
178
184
  yRelations.delete(x);
179
185
  }
180
- this.contents.delete(this.makeContentKey(x, y));
186
+ this.contents.delete(this.makeContentKey(a, b));
181
187
  }
182
188
  }
183
189
  }
@@ -211,6 +217,8 @@ var Junction = class {
211
217
  );
212
218
  this.contents = new Map(data.contents);
213
219
  }
220
+ this.isAType = config?.isAType ?? null;
221
+ this.isBType = config?.isBType ?? null;
214
222
  this.isContent = config?.isContent ?? null;
215
223
  if (config?.makeContentKey) {
216
224
  this.makeContentKey = config.makeContentKey;
@@ -245,7 +253,13 @@ var Junction = class {
245
253
  };
246
254
  }
247
255
  for (const [x, ys] of data.relations ?? []) {
248
- for (const y of ys) this.addRelation(x, y);
256
+ let a = this.isAType?.(x) ? x : void 0;
257
+ let b = a === void 0 ? x : void 0;
258
+ for (const y of ys) {
259
+ a ??= y;
260
+ b ??= y;
261
+ this.addRelation(a, b);
262
+ }
249
263
  }
250
264
  for (const [contentKey, content] of data.contents ?? []) {
251
265
  this.setContent(contentKey, content);
@@ -326,9 +340,12 @@ var Junction = class {
326
340
  ].map((k) => `"${k}"`).join(`, `)}). Only one related key was expected.`
327
341
  );
328
342
  }
343
+ let singleRelation;
329
344
  for (const relation of relations) {
330
- return relation;
345
+ singleRelation = relation;
346
+ break;
331
347
  }
348
+ return singleRelation;
332
349
  }
333
350
  }
334
351
  replaceRelations(x, relations, config) {
@@ -359,7 +376,7 @@ var Junction = class {
359
376
  const aRelations = this.getRelatedKeys(a);
360
377
  if (aRelations) {
361
378
  return [...aRelations].map((aRelation) => {
362
- return [aRelation, this.getContent(a, aRelation) ?? null];
379
+ return [aRelation, this.getContent(a, aRelation)];
363
380
  });
364
381
  }
365
382
  }
@@ -367,7 +384,7 @@ var Junction = class {
367
384
  const bRelations = this.getRelatedKeys(b);
368
385
  if (bRelations) {
369
386
  return [...bRelations].map((bRelation) => {
370
- return [bRelation, this.getContent(bRelation, b) ?? null];
387
+ return [bRelation, this.getContent(bRelation, b)];
371
388
  });
372
389
  }
373
390
  }
@@ -66,6 +66,8 @@ declare class Junction<const ASide extends string, const AType extends string, c
66
66
  readonly cardinality: `1:1` | `1:n` | `n:n`;
67
67
  readonly relations: Map<AType | BType, Set<AType> | Set<BType>>;
68
68
  readonly contents: Map<string, Content>;
69
+ isAType?: Refinement<string, AType> | null;
70
+ isBType?: Refinement<string, BType> | null;
69
71
  isContent: Refinement<unknown, Content> | null;
70
72
  makeContentKey: (a: AType, b: BType) => string;
71
73
  warn?: (...args: any[]) => void;
@@ -81,7 +83,7 @@ declare class Junction<const ASide extends string, const AType extends string, c
81
83
  protected getContentInternal(contentKey: string): Content | undefined;
82
84
  protected setContent(contentKey: string, content: Content): void;
83
85
  protected deleteContent(contentKey: string): void;
84
- constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<AType, BType, Content>>, config?: JunctionAdvancedConfiguration<AType, BType, Content>);
86
+ constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<NoInfer<AType>, NoInfer<BType>, Content>>, config?: JunctionAdvancedConfiguration<AType, BType, Content>);
85
87
  toJSON(): JunctionJSON<ASide, AType, BSide, BType, Content>;
86
88
  set(a: AType, ...rest: Content extends null ? [b: BType] : [b: BType, content: Content]): this;
87
89
  set(relation: {
@@ -1,3 +1,3 @@
1
- export { FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, Junction, LazyMap, Molecule, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateFamily, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw } from '../../dist/chunk-SMKF3ZNG.js';
1
+ export { FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Future, IMPLICIT, Junction, LazyMap, Molecule, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, counterfeit, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateFamily, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw } from '../../dist/chunk-LSCRHXLI.js';
2
2
  import '../../dist/chunk-ADMEAXYU.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
@@ -1,6 +1,5 @@
1
1
  import type { Refinement } from "atom.io/introspection"
2
2
  import type { Json } from "atom.io/json"
3
- import { B } from "vitest/dist/chunks/benchmark.JVlTzojj.js"
4
3
 
5
4
  export type JunctionEntriesBase<
6
5
  AType extends string,
@@ -86,6 +85,8 @@ export class Junction<
86
85
  public readonly relations = new Map<AType | BType, Set<AType> | Set<BType>>()
87
86
  public readonly contents = new Map<string, Content>()
88
87
 
88
+ public isAType?: Refinement<string, AType> | null
89
+ public isBType?: Refinement<string, BType> | null
89
90
  public isContent: Refinement<unknown, Content> | null
90
91
  public makeContentKey = (a: AType, b: BType): string => `${a}:${b}`
91
92
 
@@ -151,8 +152,12 @@ export class Junction<
151
152
  YType extends XType extends AType ? BType : AType,
152
153
  >(x: XType, ys: YType[]): void {
153
154
  const xRelationsPrev = this.relations.get(x)
155
+ let a: AType | undefined = this.isAType?.(x) ? x : undefined
156
+ let b: BType | undefined = a === undefined ? (x as BType) : undefined
154
157
  if (xRelationsPrev) {
155
158
  for (const y of xRelationsPrev) {
159
+ a ??= y as AType
160
+ b ??= y as BType
156
161
  const yRelations = this.relations.get(y) as Set<XType> | undefined
157
162
  if (yRelations) {
158
163
  if (yRelations.size === 1) {
@@ -160,7 +165,7 @@ export class Junction<
160
165
  } else {
161
166
  yRelations.delete(x)
162
167
  }
163
- this.contents.delete(this.makeContentKey(x as any, y as any)) // sort XY to AB ❗
168
+ this.contents.delete(this.makeContentKey(a, b))
164
169
  }
165
170
  }
166
171
  }
@@ -188,7 +193,7 @@ export class Junction<
188
193
 
189
194
  public constructor(
190
195
  data: JunctionSchema<ASide, BSide> &
191
- Partial<JunctionEntries<AType, BType, Content>>,
196
+ Partial<JunctionEntries<NoInfer<AType>, NoInfer<BType>, Content>>,
192
197
  config?: JunctionAdvancedConfiguration<AType, BType, Content>,
193
198
  ) {
194
199
  this.a = data.between[0]
@@ -201,6 +206,8 @@ export class Junction<
201
206
  )
202
207
  this.contents = new Map(data.contents)
203
208
  }
209
+ this.isAType = config?.isAType ?? null
210
+ this.isBType = config?.isBType ?? null
204
211
  this.isContent = config?.isContent ?? null
205
212
  if (config?.makeContentKey) {
206
213
  this.makeContentKey = config.makeContentKey
@@ -236,7 +243,13 @@ export class Junction<
236
243
  }
237
244
  }
238
245
  for (const [x, ys] of data.relations ?? []) {
239
- for (const y of ys) this.addRelation(x as AType, y as BType) // sort XY to AB ❗
246
+ let a = this.isAType?.(x) ? x : undefined
247
+ let b = a === undefined ? (x as BType) : undefined
248
+ for (const y of ys) {
249
+ a ??= y as AType
250
+ b ??= y as BType
251
+ this.addRelation(a, b)
252
+ }
240
253
  }
241
254
  for (const [contentKey, content] of data.contents ?? []) {
242
255
  this.setContent(contentKey, content)
@@ -359,9 +372,12 @@ export class Junction<
359
372
  .join(`, `)}). Only one related key was expected.`,
360
373
  )
361
374
  }
375
+ let singleRelation: AType | BType | undefined
362
376
  for (const relation of relations) {
363
- return relation
377
+ singleRelation = relation
378
+ break
364
379
  }
380
+ return singleRelation
365
381
  }
366
382
  }
367
383
 
@@ -416,7 +432,7 @@ export class Junction<
416
432
  const aRelations = this.getRelatedKeys(a)
417
433
  if (aRelations) {
418
434
  return [...aRelations].map((aRelation) => {
419
- return [aRelation, this.getContent(a, aRelation) ?? (null as Content)]
435
+ return [aRelation, this.getContent(a, aRelation) as Content]
420
436
  })
421
437
  }
422
438
  }
@@ -424,7 +440,7 @@ export class Junction<
424
440
  const bRelations = this.getRelatedKeys(b)
425
441
  if (bRelations) {
426
442
  return [...bRelations].map((bRelation) => {
427
- return [bRelation, this.getContent(bRelation, b) ?? (null as Content)]
443
+ return [bRelation, this.getContent(bRelation, b) as Content]
428
444
  })
429
445
  }
430
446
  }
@@ -1,4 +1,4 @@
1
- import { createWritableSelectorFamily } from '../../dist/chunk-SMKF3ZNG.js';
1
+ import { createWritableSelectorFamily } from '../../dist/chunk-LSCRHXLI.js';
2
2
  import '../../dist/chunk-ADMEAXYU.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
4
4
  import { createStandaloneSelector, IMPLICIT, growMoleculeInStore, initFamilyMemberInStore, withdraw, seekInStore } from 'atom.io/internal';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.30.1",
3
+ "version": "0.30.3",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -20,7 +20,7 @@
20
20
  "@floating-ui/react-dom": ">=2.0.0",
21
21
  "@testing-library/react": ">=14.0.0",
22
22
  "eslint": ">=9.0.0",
23
- "framer-motion": ">=10.0.0",
23
+ "motion": ">=11.0.0",
24
24
  "react": ">=18.0.0",
25
25
  "socket.io": ">=4.0.0",
26
26
  "socket.io-client": ">=4.0.0"
@@ -41,7 +41,7 @@
41
41
  "eslint": {
42
42
  "optional": true
43
43
  },
44
- "framer-motion": {
44
+ "motion": {
45
45
  "optional": true
46
46
  },
47
47
  "socket.io": {
@@ -59,32 +59,32 @@
59
59
  "@types/npmlog": "7.0.0",
60
60
  "@types/react": "18.3.12",
61
61
  "@types/tmp": "0.2.6",
62
- "@typescript-eslint/parser": "8.10.0",
63
- "@typescript-eslint/rule-tester": "8.10.0",
64
- "@vitest/coverage-v8": "2.1.3",
65
- "@vitest/ui": "2.1.3",
66
- "concurrently": "9.0.1",
67
- "drizzle-kit": "0.26.2",
68
- "drizzle-orm": "0.35.3",
69
- "eslint": "9.13.0",
70
- "framer-motion": "11.11.9",
71
- "happy-dom": "15.7.4",
62
+ "@typescript-eslint/parser": "8.14.0",
63
+ "@typescript-eslint/rule-tester": "8.14.0",
64
+ "@vitest/coverage-v8": "2.1.5",
65
+ "@vitest/ui": "2.1.5",
66
+ "concurrently": "9.1.0",
67
+ "drizzle-kit": "0.28.0",
68
+ "drizzle-orm": "0.36.1",
69
+ "eslint": "9.14.0",
70
+ "happy-dom": "15.11.4",
72
71
  "http-proxy": "1.18.1",
72
+ "motion": "11.11.15",
73
73
  "npmlog": "7.0.1",
74
- "postgres": "3.4.4",
74
+ "postgres": "3.4.5",
75
75
  "preact": "10.24.3",
76
76
  "react": "18.3.1",
77
77
  "react-dom": "18.3.1",
78
- "react-router-dom": "6.27.0",
79
- "socket.io": "4.8.0",
80
- "socket.io-client": "4.8.0",
78
+ "react-router-dom": "6.28.0",
79
+ "socket.io": "4.8.1",
80
+ "socket.io-client": "4.8.1",
81
81
  "tmp": "0.2.3",
82
- "tsup": "8.3.0",
83
- "tsx": "4.19.1",
82
+ "tsup": "8.3.5",
83
+ "tsx": "4.19.2",
84
84
  "typescript": "5.6.3",
85
- "vite": "5.4.10",
86
- "vite-tsconfig-paths": "5.0.1",
87
- "vitest": "2.1.3",
85
+ "vite": "5.4.11",
86
+ "vite-tsconfig-paths": "5.1.2",
87
+ "vitest": "2.1.5",
88
88
  "zod": "3.23.8"
89
89
  },
90
90
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  import '../../dist/chunk-XWL6SNVU.js';
2
2
  import { StoreContext, useI, useO } from 'atom.io/react';
3
- import { motion, spring, LayoutGroup } from 'framer-motion';
3
+ import { motion, spring, LayoutGroup } from 'motion/react';
4
4
  import { forwardRef, useRef, useState, useImperativeHandle, useLayoutEffect, createContext, useId, Component, useContext, Fragment as Fragment$1 } from 'react';
5
5
  import { undo, redo, getState } from 'atom.io';
6
6
  import { IMPLICIT, createStandaloneAtom, createAtomFamily, findInStore, become } from 'atom.io/internal';
@@ -1,7 +1,7 @@
1
1
  import "./devtools.scss"
2
2
 
3
3
  import { StoreContext, useI, useO } from "atom.io/react"
4
- import { LayoutGroup, motion, spring } from "framer-motion"
4
+ import { LayoutGroup, motion, spring } from "motion/react"
5
5
  import { useContext, useRef } from "react"
6
6
 
7
7
  import { StateIndex } from "./StateIndex"
@@ -166,7 +166,6 @@ export const NumberInput: FC<NumberInputProps> = ({
166
166
 
167
167
  return (
168
168
  <span>
169
- {/* biome-ignore lint/a11y/noLabelWithoutControl: it's associated via htmlFor */}
170
169
  {label ? <label htmlFor={htmlId}>{label}</label> : null}
171
170
  {autoSize ? (
172
171
  <ElasticInput
@@ -23,7 +23,6 @@ export const TextInput: FC<TextInputProps> = ({
23
23
  const htmlId = useId()
24
24
  return (
25
25
  <span>
26
- {/* biome-ignore lint/a11y/noLabelWithoutControl: it's associated via htmlFor */}
27
26
  {label ? <label htmlFor={htmlId}>{label}</label> : null}
28
27
  {autoSize ? (
29
28
  <ElasticInput
@@ -1,6 +1,7 @@
1
1
  import * as atom_io from 'atom.io';
2
2
  import { AtomFamilyToken, ReadableFamilyToken, ReadableToken, TokenType, AtomToken, TransactionToken, MutableAtomToken } from 'atom.io';
3
3
  import { Canonical } from 'atom.io/json';
4
+ import { UserKey } from 'atom.io/realtime-server';
4
5
  import * as atom_io_data from 'atom.io/data';
5
6
  import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
6
7
 
@@ -11,7 +12,7 @@ declare class InvariantMap<K, V> extends Map<K, V> {
11
12
  type PerspectiveToken<F extends AtomFamilyToken<any>> = {
12
13
  type: `realtime_perspective`;
13
14
  resourceAtoms: F;
14
- viewAtoms: ReadableFamilyToken<ReadableToken<TokenType<F>>[], string>;
15
+ viewAtoms: ReadableFamilyToken<ReadableToken<TokenType<F>>[], UserKey>;
15
16
  };
16
17
  type ContinuityToken = {
17
18
  readonly type: `continuity`;
@@ -12,6 +12,7 @@ import {
12
12
  setEpochNumberOfContinuity,
13
13
  } from "atom.io/internal"
14
14
  import type { Canonical } from "atom.io/json"
15
+ import type { UserKey } from "atom.io/realtime-server"
15
16
 
16
17
  /* eslint-disable no-console */
17
18
 
@@ -35,7 +36,7 @@ export class InvariantMap<K, V> extends Map<K, V> {
35
36
  export type PerspectiveToken<F extends AtomFamilyToken<any>> = {
36
37
  type: `realtime_perspective`
37
38
  resourceAtoms: F
38
- viewAtoms: ReadableFamilyToken<ReadableToken<TokenType<F>>[], string>
39
+ viewAtoms: ReadableFamilyToken<ReadableToken<TokenType<F>>[], UserKey>
39
40
  }
40
41
 
41
42
  export type ContinuityToken = {
@@ -96,7 +97,7 @@ export class SyncGroup {
96
97
  {
97
98
  const [family, index] = args as [
98
99
  AtomFamilyToken<any, any>,
99
- ReadableFamilyToken<ReadableToken<any>[], string>,
100
+ ReadableFamilyToken<ReadableToken<any>[], UserKey>,
100
101
  ]
101
102
  this.perspectives.push({
102
103
  type: `realtime_perspective`,
@@ -1,13 +1,16 @@
1
1
  import { Subject, Transceiver, Store } from 'atom.io/internal';
2
2
  import { Json, stringified, JsonIO, Canonical } from 'atom.io/json';
3
+ import { ContinuityToken, UserInRoomMeta } from 'atom.io/realtime';
3
4
  import { ChildProcessWithoutNullStreams } from 'node:child_process';
4
5
  import * as AtomIO from 'atom.io';
5
6
  import { TransactionUpdateContent, TransactionUpdate, Hierarchy, WritableToken } from 'atom.io';
6
- import { ContinuityToken, UserInRoomMeta } from 'atom.io/realtime';
7
7
  import * as atom_io_data from 'atom.io/data';
8
8
  import { Loadable } from 'atom.io/data';
9
9
  import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
10
10
 
11
+ type ExposeRealtimeContinuity = (continuity: ContinuityToken) => () => void;
12
+ declare function prepareToExposeRealtimeContinuity({ socket: initialSocket, store, }: ServerConfig): ExposeRealtimeContinuity;
13
+
11
14
  type Events = Json.Object<string, Json.Serializable[]>;
12
15
  type StringifiedEvent<Key extends string, Params extends Json.Serializable[]> = stringified<[Key, ...Params]>;
13
16
  interface EventBuffer<Key extends string, Params extends Json.Serializable[]> extends Buffer {
@@ -82,9 +85,6 @@ declare class ParentSocket<I extends Events & {
82
85
  type ActionReceiver = ReturnType<typeof realtimeActionReceiver>;
83
86
  declare function realtimeActionReceiver({ socket, store, }: ServerConfig): <F extends JsonIO>(tx: AtomIO.TransactionToken<F>) => () => void;
84
87
 
85
- type RealtimeContinuitySynchronizer = ReturnType<typeof realtimeContinuitySynchronizer>;
86
- declare function realtimeContinuitySynchronizer({ socket: initialSocket, store, }: ServerConfig): (continuity: ContinuityToken) => () => void;
87
-
88
88
  type FamilyProvider = ReturnType<typeof realtimeAtomFamilyProvider>;
89
89
  declare function realtimeAtomFamilyProvider({ socket, store, }: ServerConfig): <J extends Json.Serializable, K extends Canonical>(family: AtomIO.RegularAtomFamilyToken<J, K>, index: AtomIO.ReadableToken<Iterable<K>>) => () => void;
90
90
 
@@ -107,10 +107,11 @@ declare const roomArgumentsAtoms: AtomIO.RegularAtomFamilyToken<RoomArguments, s
107
107
  declare const roomSelectors: AtomIO.ReadonlySelectorFamilyToken<Loadable<ChildSocket<any, any>>, string>;
108
108
 
109
109
  declare function redactTransactionUpdateContent(visibleStateKeys: string[], updates: TransactionUpdateContent[]): TransactionUpdateContent[];
110
- declare const actionOcclusionAtoms: AtomIO.RegularAtomFamilyToken<{
110
+ declare const redactorAtoms: AtomIO.RegularAtomFamilyToken<{
111
111
  occlude: (updates: TransactionUpdateContent[]) => TransactionUpdateContent[];
112
- }, string>;
113
- declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyToken<Pick<TransactionUpdate<any>, "key" | "epoch" | "id" | "updates" | "output">[], string>;
112
+ }, `user::${string}`>;
113
+ type ContinuitySyncTransactionUpdate = Pick<TransactionUpdate<any>, `epoch` | `id` | `key` | `output` | `updates`>;
114
+ declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyToken<ContinuitySyncTransactionUpdate[], `user::${string}`>;
114
115
 
115
116
  type SocketKey = `socket::${string}`;
116
117
  type UserKey = `user::${string}`;
@@ -122,8 +123,8 @@ type SocketSystemHierarchy = Hierarchy<[
122
123
  }
123
124
  ]>;
124
125
  declare const socketAtoms: AtomIO.RegularAtomFamilyToken<Socket | null, `socket::${string}`>;
125
- declare const socketIndex: AtomIO.MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
126
- declare const userIndex: AtomIO.MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
126
+ declare const socketIndex: AtomIO.MutableAtomToken<SetRTX<`socket::${string}`>, SetRTXJson<`socket::${string}`>>;
127
+ declare const userIndex: AtomIO.MutableAtomToken<SetRTX<`user::${string}`>, SetRTXJson<`user::${string}`>>;
127
128
  declare const usersOfSockets: atom_io_data.JoinToken<"user", `user::${string}`, "socket", `socket::${string}`, "1:1", null>;
128
129
 
129
130
  type StateProvider = ReturnType<typeof realtimeStateProvider>;
@@ -145,4 +146,4 @@ type ServerConfig = {
145
146
  store?: Store;
146
147
  };
147
148
 
148
- export { type ActionReceiver, ChildSocket, type CreateRoomIO, CustomSocket, type EventBuffer, type Events, type FamilyProvider, type JoinRoomIO, type LeaveRoomIO, type MutableFamilyProvider, type MutableProvider, ParentSocket, type RealtimeContinuitySynchronizer, type RoomArguments, type RoomKey, type ServerConfig, type Socket, type SocketKey, type SocketSystemHierarchy, type StateProvider, type StateReceiver, type StringifiedEvent, SubjectSocket, type UserKey, actionOcclusionAtoms, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeContinuitySynchronizer, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, redactTransactionUpdateContent, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets };
149
+ export { type ActionReceiver, ChildSocket, type ContinuitySyncTransactionUpdate, type CreateRoomIO, CustomSocket, type EventBuffer, type Events, type ExposeRealtimeContinuity, type FamilyProvider, type JoinRoomIO, type LeaveRoomIO, type MutableFamilyProvider, type MutableProvider, ParentSocket, type RoomArguments, type RoomKey, type ServerConfig, type Socket, type SocketKey, type SocketSystemHierarchy, type StateProvider, type StateReceiver, type StringifiedEvent, SubjectSocket, type UserKey, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, prepareToExposeRealtimeContinuity, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, redactTransactionUpdateContent, redactorAtoms, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets };