atom.io 0.30.0 → 0.30.2

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.
@@ -1,23 +1,35 @@
1
1
  import type { Refinement } from "atom.io/introspection"
2
2
  import type { Json } from "atom.io/json"
3
3
 
4
- export interface JunctionEntries<Content extends Json.Object | null>
5
- extends Json.Object {
6
- readonly relations: [string, string[]][]
4
+ export type JunctionEntriesBase<
5
+ AType extends string,
6
+ BType extends string,
7
+ Content extends Json.Object | null,
8
+ > = {
9
+ readonly relations: ([AType, BType[]] | [BType, AType[]])[]
7
10
  readonly contents: [string, Content][]
8
11
  }
9
- export interface JunctionSchema<ASide extends string, BSide extends string>
10
- extends Json.Object {
12
+ export interface JunctionEntries<
13
+ AType extends string,
14
+ BType extends string,
15
+ Content extends Json.Object | null,
16
+ > extends Json.Object,
17
+ JunctionEntriesBase<AType, BType, Content> {}
18
+
19
+ export type JunctionSchemaBase<ASide extends string, BSide extends string> = {
11
20
  readonly between: [a: ASide, b: BSide]
12
21
  readonly cardinality: `1:1` | `1:n` | `n:n`
13
22
  }
23
+ export interface JunctionSchema<ASide extends string, BSide extends string>
24
+ extends Json.Object,
25
+ JunctionSchemaBase<ASide, BSide> {}
14
26
 
15
27
  export type BaseExternalStoreConfiguration = {
16
28
  addRelation: (a: string, b: string) => void
17
29
  deleteRelation: (a: string, b: string) => void
18
30
  replaceRelationsSafely: (a: string, bs: string[]) => void
19
31
  replaceRelationsUnsafely: (a: string, bs: string[]) => void
20
- getRelatedKeys: (key: string) => Set<string> | undefined
32
+ getRelatedKeys(key: string): Set<string> | undefined
21
33
  has: (a: string, b?: string) => boolean
22
34
  }
23
35
 
@@ -39,41 +51,58 @@ export type ExternalStoreConfiguration<Content extends Json.Object | null> =
39
51
  : BaseExternalStoreConfiguration &
40
52
  Empty<ExternalStoreWithContentConfiguration<Json.Object>>
41
53
 
42
- export type JunctionAdvancedConfiguration<Content extends Json.Object | null> = {
54
+ export type JunctionAdvancedConfiguration<
55
+ AType extends string,
56
+ BType extends string,
57
+ Content extends Json.Object | null,
58
+ > = {
43
59
  warn?: (...args: any[]) => void
44
60
  externalStore?: ExternalStoreConfiguration<Content>
61
+ isAType?: Refinement<string, AType>
62
+ isBType?: Refinement<string, BType>
45
63
  isContent?: Refinement<unknown, Content>
46
- makeContentKey?: (a: string, b: string) => string
64
+ makeContentKey?: (a: AType, b: BType) => string
47
65
  }
48
66
 
49
67
  export type JunctionJSON<
50
68
  ASide extends string,
69
+ AType extends string,
51
70
  BSide extends string,
71
+ BType extends string,
52
72
  Content extends Json.Object | null,
53
- > = JunctionEntries<Content> & JunctionSchema<ASide, BSide>
73
+ > = JunctionEntries<AType, BType, Content> & JunctionSchema<ASide, BSide>
54
74
 
55
75
  export class Junction<
56
76
  const ASide extends string,
77
+ const AType extends string,
57
78
  const BSide extends string,
79
+ const BType extends string,
58
80
  const Content extends Json.Object | null = null,
59
81
  > {
60
82
  public readonly a: ASide
61
83
  public readonly b: BSide
62
84
  public readonly cardinality: `1:1` | `1:n` | `n:n`
63
- public readonly relations = new Map<string, Set<string>>()
85
+ public readonly relations = new Map<AType | BType, Set<AType> | Set<BType>>()
64
86
  public readonly contents = new Map<string, Content>()
65
87
 
88
+ public isAType?: Refinement<string, AType> | null
89
+ public isBType?: Refinement<string, BType> | null
66
90
  public isContent: Refinement<unknown, Content> | null
67
- public makeContentKey = (a: string, b: string): string => `${a}:${b}`
91
+ public makeContentKey = (a: AType, b: BType): string => `${a}:${b}`
68
92
 
69
93
  public warn?: (...args: any[]) => void
70
94
 
71
- public getRelatedKeys(key: string): Set<string> | undefined {
95
+ public getRelatedKeys(key: AType): Set<BType> | undefined
96
+ public getRelatedKeys(key: BType): Set<AType> | undefined
97
+ public getRelatedKeys(key: AType | BType): Set<AType> | Set<BType> | undefined
98
+ public getRelatedKeys(
99
+ key: AType | BType,
100
+ ): Set<AType> | Set<BType> | undefined {
72
101
  return this.relations.get(key)
73
102
  }
74
- protected addRelation(a: string, b: string): void {
75
- let aRelations = this.relations.get(a)
76
- let bRelations = this.relations.get(b)
103
+ protected addRelation(a: AType, b: BType): void {
104
+ let aRelations = this.relations.get(a) as Set<BType> | undefined
105
+ let bRelations = this.relations.get(b) as Set<AType> | undefined
77
106
  if (aRelations) {
78
107
  aRelations.add(b)
79
108
  } else {
@@ -87,14 +116,14 @@ export class Junction<
87
116
  this.relations.set(b, bRelations)
88
117
  }
89
118
  }
90
- protected deleteRelation(a: string, b: string): void {
91
- const aRelations = this.relations.get(a)
119
+ protected deleteRelation(a: AType, b: BType): void {
120
+ const aRelations = this.relations.get(a) as Set<BType> | undefined
92
121
  if (aRelations) {
93
122
  aRelations.delete(b)
94
123
  if (aRelations.size === 0) {
95
124
  this.relations.delete(a)
96
125
  }
97
- const bRelations = this.relations.get(b)
126
+ const bRelations = this.relations.get(b) as Set<AType> | undefined
98
127
  if (bRelations) {
99
128
  bRelations.delete(a)
100
129
  if (bRelations.size === 0) {
@@ -104,36 +133,50 @@ export class Junction<
104
133
  }
105
134
  }
106
135
 
107
- protected replaceRelationsUnsafely(a: string, bs: string[]): void {
108
- this.relations.set(a, new Set(bs))
109
- for (const b of bs) {
110
- const bRelations = new Set([a])
111
- this.relations.set(b, bRelations)
136
+ protected replaceRelationsUnsafely(a: AType, bs: BType[]): void
137
+ protected replaceRelationsUnsafely(b: BType, as: AType[]): void
138
+ protected replaceRelationsUnsafely(
139
+ x: AType | BType,
140
+ ys: AType[] | BType[],
141
+ ): void {
142
+ this.relations.set(x as AType, new Set(ys as BType[]))
143
+ for (const y of ys) {
144
+ const yRelations = new Set<AType>().add(x as AType)
145
+ this.relations.set(y, yRelations)
112
146
  }
113
147
  }
114
- protected replaceRelationsSafely(a: string, bs: string[]): void {
115
- const aRelationsPrev = this.relations.get(a)
116
- if (aRelationsPrev) {
117
- for (const b of aRelationsPrev) {
118
- const bRelations = this.relations.get(b)
119
- if (bRelations) {
120
- if (bRelations.size === 1) {
121
- this.relations.delete(b)
148
+ protected replaceRelationsSafely(a: AType, bs: BType[]): void
149
+ protected replaceRelationsSafely(b: BType, as: AType[]): void
150
+ protected replaceRelationsSafely<
151
+ XType extends AType | BType,
152
+ YType extends XType extends AType ? BType : AType,
153
+ >(x: XType, ys: YType[]): void {
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
157
+ if (xRelationsPrev) {
158
+ for (const y of xRelationsPrev) {
159
+ a ??= y as AType
160
+ b ??= y as BType
161
+ const yRelations = this.relations.get(y) as Set<XType> | undefined
162
+ if (yRelations) {
163
+ if (yRelations.size === 1) {
164
+ this.relations.delete(y)
122
165
  } else {
123
- bRelations.delete(a)
166
+ yRelations.delete(x)
124
167
  }
125
168
  this.contents.delete(this.makeContentKey(a, b))
126
169
  }
127
170
  }
128
171
  }
129
- this.relations.set(a, new Set(bs))
130
- for (const b of bs) {
131
- let bRelations = this.relations.get(b)
132
- if (bRelations) {
133
- bRelations.add(a)
172
+ this.relations.set(x, new Set(ys) as any)
173
+ for (const y of ys) {
174
+ let yRelations = this.relations.get(y) as Set<XType> | undefined
175
+ if (yRelations) {
176
+ yRelations.add(x)
134
177
  } else {
135
- bRelations = new Set([a])
136
- this.relations.set(b, bRelations)
178
+ yRelations = new Set<XType>().add(x)
179
+ this.relations.set(y, yRelations as any)
137
180
  }
138
181
  }
139
182
  }
@@ -149,17 +192,22 @@ export class Junction<
149
192
  }
150
193
 
151
194
  public constructor(
152
- data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>,
153
- config?: JunctionAdvancedConfiguration<Content>,
195
+ data: JunctionSchema<ASide, BSide> &
196
+ Partial<JunctionEntries<NoInfer<AType>, NoInfer<BType>, Content>>,
197
+ config?: JunctionAdvancedConfiguration<AType, BType, Content>,
154
198
  ) {
155
199
  this.a = data.between[0]
156
200
  this.b = data.between[1]
157
201
 
158
202
  this.cardinality = data.cardinality
159
203
  if (!config?.externalStore) {
160
- this.relations = new Map(data.relations?.map(([a, b]) => [a, new Set(b)]))
204
+ this.relations = new Map(
205
+ data.relations?.map(([x, ys]) => [x, new Set(ys as AType[])]),
206
+ )
161
207
  this.contents = new Map(data.contents)
162
208
  }
209
+ this.isAType = config?.isAType ?? null
210
+ this.isBType = config?.isBType ?? null
163
211
  this.isContent = config?.isContent ?? null
164
212
  if (config?.makeContentKey) {
165
213
  this.makeContentKey = config.makeContentKey
@@ -179,7 +227,10 @@ export class Junction<
179
227
  this.replaceRelationsUnsafely = (a, bs) => {
180
228
  externalStore.replaceRelationsUnsafely(a, bs)
181
229
  }
182
- this.getRelatedKeys = (key) => externalStore.getRelatedKeys(key)
230
+ this.getRelatedKeys = ((key) =>
231
+ externalStore.getRelatedKeys(
232
+ key,
233
+ )) as typeof Junction.prototype.getRelatedKeys
183
234
  if (externalStore.getContent) {
184
235
  this.getContentInternal = (contentKey) => {
185
236
  return externalStore.getContent(contentKey) as any
@@ -192,7 +243,13 @@ export class Junction<
192
243
  }
193
244
  }
194
245
  for (const [x, ys] of data.relations ?? []) {
195
- for (const y of ys) this.addRelation(x, y)
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
+ }
196
253
  }
197
254
  for (const [contentKey, content] of data.contents ?? []) {
198
255
  this.setContent(contentKey, content)
@@ -202,33 +259,35 @@ export class Junction<
202
259
  this.warn = config.warn
203
260
  }
204
261
  }
205
- public toJSON(): JunctionJSON<ASide, BSide, Content> {
262
+ public toJSON(): JunctionJSON<ASide, AType, BSide, BType, Content> {
206
263
  return {
207
264
  between: [this.a, this.b],
208
265
  cardinality: this.cardinality,
209
- relations: [...this.relations.entries()].map(([a, b]) => [a, [...b]]),
266
+ relations: [...this.relations.entries()].map(
267
+ ([a, b]) => [a, [...b]] as [AType, BType[]],
268
+ ),
210
269
  contents: [...this.contents.entries()],
211
270
  }
212
271
  }
213
272
 
214
273
  public set(
215
- a: string,
216
- ...rest: Content extends null ? [b: string] : [b: string, content: Content]
274
+ a: AType,
275
+ ...rest: Content extends null ? [b: BType] : [b: BType, content: Content]
217
276
  ): this
218
277
  public set(
219
- relation: { [Key in ASide | BSide]: string },
220
- ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]
278
+ relation: { [Key in ASide]: AType } & { [Key in BSide]: BType },
279
+ ...rest: Content extends null ? [] | [void?: undefined] : [content: Content]
221
280
  ): this
222
281
  public set(
223
- a: string | { [Key in ASide | BSide]: string },
282
+ a: AType | ({ [Key in ASide]: AType } & { [Key in BSide]: BType }),
224
283
  ...rest: Content extends null
225
- ? [] | [b?: string | undefined]
226
- : [b: string, content: Content] | [content: Content]
284
+ ? [] | [b?: BType | undefined]
285
+ : [b: BType, content: Content] | [content: Content]
227
286
  ): this {
228
- const b: string =
287
+ const b: BType =
229
288
  typeof rest[0] === `string`
230
289
  ? rest[0]
231
- : (a[this.b as keyof typeof a] as string)
290
+ : (a[this.b as keyof typeof a] as BType)
232
291
  const content: Content | undefined =
233
292
  (rest[1] ?? typeof rest[0] === `string`) ? undefined : (rest[0] as Content)
234
293
  a = typeof a === `string` ? a : a[this.a]
@@ -236,7 +295,7 @@ export class Junction<
236
295
  // biome-ignore lint/suspicious/noFallthroughSwitchClause: perfect here
237
296
  case `1:1`: {
238
297
  const bPrev = this.getRelatedKey(a)
239
- if (bPrev && bPrev !== b) this.delete(bPrev, a)
298
+ if (bPrev && bPrev !== b) this.delete(a, bPrev)
240
299
  }
241
300
  case `1:n`: {
242
301
  const aPrev = this.getRelatedKey(b)
@@ -251,29 +310,32 @@ export class Junction<
251
310
  return this
252
311
  }
253
312
 
254
- public delete(a: string, b?: string): this
313
+ public delete(a: AType, b?: BType): this
314
+ public delete(b: BType, a?: AType): this
255
315
  public delete(
256
316
  relation:
257
- | Record<ASide | BSide, string>
258
- | Record<ASide, string>
259
- | Record<BSide, string>,
317
+ | { [Key in ASide]: AType }
318
+ | { [Key in BSide]: BType }
319
+ | ({ [Key in ASide]: AType } & { [Key in BSide]: BType }),
260
320
  b?: undefined,
261
321
  ): this
262
322
  public delete(
263
323
  x:
324
+ | AType
325
+ | BType
264
326
  | Record<ASide | BSide, string>
265
327
  | Record<ASide, string>
266
- | Record<BSide, string>
267
- | string,
268
- b?: string,
328
+ | Record<BSide, string>,
329
+ b?: AType | BType,
269
330
  ): this {
270
331
  // @ts-expect-error we deduce that this.b may index x
271
- b = typeof b === `string` ? b : (x[this.b] as string | undefined)
272
- // @ts-expect-error we deduce that this.a may index x
273
- const a = typeof x === `string` ? x : (x[this.a] as string | undefined)
332
+ b = typeof b === `string` ? (b as BType) : (x[this.b] as BType | undefined)
333
+ const a =
334
+ // @ts-expect-error we deduce that this.a may index x
335
+ typeof x === `string` ? (x as AType) : (x[this.a] as AType | undefined)
274
336
 
275
337
  if (a === undefined && typeof b === `string`) {
276
- const bRelations = this.getRelatedKeys(b)
338
+ const bRelations = this.getRelatedKeys(b) as Set<AType>
277
339
  if (bRelations) {
278
340
  for (const bRelation of bRelations) {
279
341
  this.delete(bRelation, b)
@@ -296,7 +358,9 @@ export class Junction<
296
358
  return this
297
359
  }
298
360
 
299
- public getRelatedKey(key: string): string | undefined {
361
+ public getRelatedKey(key: AType): BType | undefined
362
+ public getRelatedKey(key: BType): AType | undefined
363
+ public getRelatedKey(key: AType | BType): AType | BType | undefined {
300
364
  const relations = this.getRelatedKeys(key)
301
365
  if (relations) {
302
366
  if (relations.size > 1) {
@@ -308,49 +372,67 @@ export class Junction<
308
372
  .join(`, `)}). Only one related key was expected.`,
309
373
  )
310
374
  }
375
+ let singleRelation: AType | BType | undefined
311
376
  for (const relation of relations) {
312
- return relation
377
+ singleRelation = relation
378
+ break
313
379
  }
380
+ return singleRelation
314
381
  }
315
382
  }
316
383
 
317
384
  public replaceRelations(
318
- a: string,
319
- relations: Content extends null ? string[] : Record<string, Content>,
385
+ a: AType,
386
+ relations: Content extends null ? BType[] : Record<BType, Content>,
387
+ config?: { reckless: boolean },
388
+ ): this
389
+ public replaceRelations(
390
+ b: BType,
391
+ relations: Content extends null ? AType[] : Record<AType, Content>,
392
+ config?: { reckless: boolean },
393
+ ): this
394
+ public replaceRelations<
395
+ XType extends AType | BType,
396
+ YType extends XType extends AType ? BType : AType,
397
+ >(
398
+ x: XType,
399
+ relations: Content extends null ? YType[] : Record<YType, Content>,
320
400
  config?: { reckless: boolean },
321
401
  ): this {
322
402
  const hasContent = !Array.isArray(relations)
323
- const bs = hasContent ? Object.keys(relations) : relations
403
+ const ys = (hasContent ? Object.keys(relations) : relations) as YType[]
324
404
  if (config?.reckless) {
325
- this.replaceRelationsUnsafely(a, bs)
405
+ this.replaceRelationsUnsafely(x as any, ys as any)
326
406
  } else {
327
- this.replaceRelationsSafely(a, bs)
407
+ this.replaceRelationsSafely(x as any, ys as any)
328
408
  }
329
409
  if (hasContent) {
330
- for (const b of bs) {
331
- const contentKey = this.makeContentKey(a, b)
332
- const content = relations[b] as Content
410
+ for (const y of ys) {
411
+ const contentKey = this.makeContentKey(x as any, y as any) // sort XY to AB ❗
412
+ const content = (relations as Record<YType, Content>)[y]
333
413
  this.setContent(contentKey, content)
334
414
  }
335
415
  }
336
416
  return this
337
417
  }
338
418
 
339
- public getContent(a: string, b: string): Content | undefined {
419
+ public getContent(a: AType, b: BType): Content | undefined {
340
420
  const contentKey = this.makeContentKey(a, b)
341
421
  return this.getContentInternal(contentKey)
342
422
  }
343
423
 
424
+ public getRelationEntries(input: Record<ASide, AType>): [BType, Content][]
425
+ public getRelationEntries(input: Record<BSide, BType>): [AType, Content][]
344
426
  public getRelationEntries(
345
- input: Record<ASide, string> | Record<BSide, string>,
346
- ): [string, Content][] {
347
- const a: string | undefined = (input as any)[this.a]
348
- const b: string | undefined = (input as any)[this.b]
427
+ input: Record<ASide, AType> | Record<BSide, BType>,
428
+ ): [AType | BType, Content][] {
429
+ const a: AType | undefined = (input as any)[this.a]
430
+ const b: BType | undefined = (input as any)[this.b]
349
431
  if (a !== undefined && b === undefined) {
350
432
  const aRelations = this.getRelatedKeys(a)
351
433
  if (aRelations) {
352
434
  return [...aRelations].map((aRelation) => {
353
- return [aRelation, this.getContent(a, aRelation) ?? (null as Content)]
435
+ return [aRelation, this.getContent(a, aRelation) as Content]
354
436
  })
355
437
  }
356
438
  }
@@ -358,17 +440,19 @@ export class Junction<
358
440
  const bRelations = this.getRelatedKeys(b)
359
441
  if (bRelations) {
360
442
  return [...bRelations].map((bRelation) => {
361
- return [bRelation, this.getContent(bRelation, b) ?? (null as Content)]
443
+ return [bRelation, this.getContent(bRelation, b) as Content]
362
444
  })
363
445
  }
364
446
  }
365
447
  return []
366
448
  }
367
449
 
368
- public has(a: string, b?: string): boolean {
450
+ public has(a: AType, b?: BType): boolean
451
+ public has(b: BType, a?: AType): boolean
452
+ public has(a: AType | BType, b?: AType | BType): boolean {
369
453
  if (b) {
370
454
  const setA = this.getRelatedKeys(a)
371
- return setA?.has(b) ?? false
455
+ return setA?.has(b as any) ?? false
372
456
  }
373
457
  return this.relations.has(a)
374
458
  }
@@ -82,7 +82,9 @@ export function makeMoleculeInStore<M extends MoleculeConstructor>(
82
82
  },
83
83
  env: () => getEnvironmentData(newest(rootStore)),
84
84
  bond: ((
85
- token: JoinToken<any, any, any, any> | ReadableFamilyToken<any, any>,
85
+ token:
86
+ | JoinToken<any, any, any, any, any, any>
87
+ | ReadableFamilyToken<any, any>,
86
88
  maybeRole,
87
89
  ) => {
88
90
  if (token.type === `join`) {
@@ -31,7 +31,7 @@ export class Molecule<M extends MoleculeConstructor>
31
31
  public tokens = new Map<string, ReadableToken<any>>()
32
32
  public above = new Map<string, Molecule<any>>()
33
33
  public below = new Map<string, Molecule<any>>()
34
- public joins = new Map<string, Join<any, any, any, any>>()
34
+ public joins = new Map<string, Join<any, any, any, any, any, any>>()
35
35
  public instance: InstanceType<M>
36
36
  public constructor(
37
37
  ctx: Molecule<any>[] | undefined,
@@ -7,7 +7,7 @@ import type {
7
7
  StateCreation,
8
8
  StateDisposal,
9
9
  } from "atom.io"
10
- import type { Json } from "atom.io/json"
10
+ import type { Canonical, Json } from "atom.io/json"
11
11
  import { selectJsonFamily, stringifyJson } from "atom.io/json"
12
12
 
13
13
  import { type MutableAtomFamily, prettyPrintTokenType } from ".."
@@ -21,7 +21,7 @@ import type { Transceiver } from "./transceiver"
21
21
  export function createMutableAtomFamily<
22
22
  T extends Transceiver<any>,
23
23
  J extends Json.Serializable,
24
- K extends string,
24
+ K extends Canonical,
25
25
  >(
26
26
  store: Store,
27
27
  options: MutableAtomFamilyOptions<T, J, K>,
@@ -1,5 +1,5 @@
1
1
  import type { MutableAtomFamilyToken } from "atom.io"
2
- import type { Json } from "atom.io/json"
2
+ import type { Canonical, Json } from "atom.io/json"
3
3
 
4
4
  import type { WritableSelectorFamily } from ".."
5
5
  import { newest } from "../lineage"
@@ -9,7 +9,7 @@ import type { Transceiver } from "./transceiver"
9
9
  export const getJsonFamily = <
10
10
  Core extends Transceiver<Json.Serializable>,
11
11
  SerializableCore extends Json.Serializable,
12
- Key extends string,
12
+ Key extends Canonical,
13
13
  >(
14
14
  mutableAtomFamily: MutableAtomFamilyToken<Core, SerializableCore, Key>,
15
15
  store: Store,
@@ -56,7 +56,9 @@ export class Store implements Lineage {
56
56
  })
57
57
  public selectorGraph = new Junction<
58
58
  `upstreamSelectorKey`,
59
+ string,
59
60
  `downstreamSelectorKey`,
61
+ string,
60
62
  { source: string }
61
63
  >(
62
64
  {
@@ -88,7 +90,9 @@ export class Store implements Lineage {
88
90
  public timelines = new Map<string, Timeline<any>>()
89
91
  public timelineTopics = new Junction<
90
92
  `timelineKey`,
93
+ string,
91
94
  `topicKey`,
95
+ string,
92
96
  { topicType: `atom_family` | `atom` | `molecule_family` | `molecule` }
93
97
  >({
94
98
  between: [`timelineKey`, `topicKey`],
@@ -24,5 +24,5 @@ export type TransactionProgress<F extends Func> = {
24
24
 
25
25
  export type TransactionEpoch = {
26
26
  epoch: Map<string, number>
27
- actionContinuities: Junction<`continuity`, `action`>
27
+ actionContinuities: Junction<`continuity`, string, `action`, string>
28
28
  }
@@ -1,5 +1,5 @@
1
- import { createWritableSelectorFamily } from '../../dist/chunk-7PUUHSXC.js';
2
- import '../../dist/chunk-ZKG6ZA4I.js';
1
+ import { createWritableSelectorFamily } from '../../dist/chunk-LSCRHXLI.js';
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';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.30.0",
3
+ "version": "0.30.2",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -57,34 +57,34 @@
57
57
  "@types/estree": "1.0.6",
58
58
  "@types/http-proxy": "1.17.15",
59
59
  "@types/npmlog": "7.0.0",
60
- "@types/react": "18.3.11",
60
+ "@types/react": "18.3.12",
61
61
  "@types/tmp": "0.2.6",
62
- "@typescript-eslint/parser": "8.8.0",
63
- "@typescript-eslint/rule-tester": "8.8.0",
64
- "@vitest/coverage-v8": "2.1.2",
65
- "@vitest/ui": "2.1.2",
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
66
  "concurrently": "9.0.1",
67
- "drizzle-kit": "0.24.2",
68
- "drizzle-orm": "0.33.0",
69
- "eslint": "9.11.1",
70
- "framer-motion": "11.11.0",
67
+ "drizzle-kit": "0.26.2",
68
+ "drizzle-orm": "0.35.3",
69
+ "eslint": "9.13.0",
70
+ "framer-motion": "11.11.9",
71
71
  "happy-dom": "15.7.4",
72
72
  "http-proxy": "1.18.1",
73
73
  "npmlog": "7.0.1",
74
74
  "postgres": "3.4.4",
75
- "preact": "10.24.2",
75
+ "preact": "10.24.3",
76
76
  "react": "18.3.1",
77
77
  "react-dom": "18.3.1",
78
- "react-router-dom": "6.26.2",
78
+ "react-router-dom": "6.27.0",
79
79
  "socket.io": "4.8.0",
80
80
  "socket.io-client": "4.8.0",
81
81
  "tmp": "0.2.3",
82
82
  "tsup": "8.3.0",
83
83
  "tsx": "4.19.1",
84
- "typescript": "5.6.2",
85
- "vite": "5.4.8",
84
+ "typescript": "5.6.3",
85
+ "vite": "5.4.10",
86
86
  "vite-tsconfig-paths": "5.0.1",
87
- "vitest": "2.1.2",
87
+ "vitest": "2.1.3",
88
88
  "zod": "3.23.8"
89
89
  },
90
90
  "main": "dist/index.js",
@@ -45,7 +45,7 @@ type UserInRoomMeta = {
45
45
  enteredAtEpoch: number;
46
46
  };
47
47
  declare const DEFAULT_USER_IN_ROOM_META: UserInRoomMeta;
48
- declare const usersInRooms: atom_io_data.JoinToken<"room", "user", "1:n", UserInRoomMeta>;
48
+ declare const usersInRooms: atom_io_data.JoinToken<"room", string, "user", string, "1:n", UserInRoomMeta>;
49
49
  declare const usersInMyRoomView: atom_io.ReadonlySelectorFamilyToken<MutableAtomToken<SetRTX<string>, SetRTXJson<string>>[], string>;
50
50
 
51
51
  export { type ContinuityOptions, type ContinuityToken, DEFAULT_USER_IN_ROOM_META, InvariantMap, type PerspectiveToken, SyncGroup, type UserInRoomMeta, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
@@ -90,7 +90,9 @@ var usersInRooms = join(
90
90
  {
91
91
  key: `usersInRooms`,
92
92
  between: [`room`, `user`],
93
- cardinality: `1:n`
93
+ cardinality: `1:n`,
94
+ isAType: (input) => typeof input === `string`,
95
+ isBType: (input) => typeof input === `string`
94
96
  },
95
97
  DEFAULT_USER_IN_ROOM_META
96
98
  );
@@ -31,6 +31,8 @@ export const usersInRooms = join(
31
31
  key: `usersInRooms`,
32
32
  between: [`room`, `user`],
33
33
  cardinality: `1:n`,
34
+ isAType: (input): input is string => typeof input === `string`,
35
+ isBType: (input): input is string => typeof input === `string`,
34
36
  },
35
37
  DEFAULT_USER_IN_ROOM_META,
36
38
  )