atom.io 0.27.2 → 0.27.4

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.d.ts +12 -12
  2. package/data/dist/index.js +20 -14
  3. package/data/src/dict.ts +4 -4
  4. package/data/src/join.ts +23 -18
  5. package/data/src/struct-family.ts +2 -2
  6. package/dist/chunk-JRENM6KL.js +3148 -0
  7. package/dist/index.d.ts +3 -30
  8. package/eslint-plugin/dist/index.js +8 -0
  9. package/eslint-plugin/src/walk.ts +8 -0
  10. package/internal/dist/index.d.ts +55 -25
  11. package/internal/dist/index.js +2 -3044
  12. package/internal/src/families/create-atom-family.ts +6 -5
  13. package/internal/src/families/create-readonly-selector-family.ts +54 -28
  14. package/internal/src/families/create-regular-atom-family.ts +41 -31
  15. package/internal/src/families/create-selector-family.ts +6 -5
  16. package/internal/src/families/create-writable-selector-family.ts +55 -29
  17. package/internal/src/families/dispose-from-store.ts +11 -2
  18. package/internal/src/families/seek-in-store.ts +0 -3
  19. package/internal/src/families/throw-in-case-of-conflicting-family.ts +18 -0
  20. package/internal/src/get-state/get-from-store.ts +26 -2
  21. package/internal/src/get-state/read-or-compute-value.ts +1 -1
  22. package/internal/src/index.ts +78 -2
  23. package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -1
  24. package/internal/src/ingest-updates/ingest-selector-update.ts +1 -1
  25. package/internal/src/molecule/dispose-molecule.ts +0 -1
  26. package/internal/src/molecule/grow-molecule-in-store.ts +27 -17
  27. package/internal/src/mutable/create-mutable-atom-family.ts +41 -32
  28. package/internal/src/mutable/get-json-family.ts +2 -1
  29. package/internal/src/mutable/get-update-family.ts +23 -0
  30. package/internal/src/mutable/index.ts +1 -0
  31. package/internal/src/mutable/tracker-family.ts +5 -3
  32. package/internal/src/not-found-error.ts +2 -35
  33. package/internal/src/pretty-print.ts +37 -0
  34. package/internal/src/selector/create-writable-selector.ts +6 -6
  35. package/internal/src/set-state/set-into-store.ts +13 -2
  36. package/internal/src/store/deposit.ts +11 -10
  37. package/internal/src/store/store.ts +11 -4
  38. package/internal/src/store/withdraw.ts +8 -8
  39. package/internal/src/transaction/build-transaction.ts +1 -0
  40. package/introspection/dist/index.js +3 -3
  41. package/introspection/src/attach-timeline-family.ts +1 -1
  42. package/introspection/src/attach-transaction-logs.ts +2 -2
  43. package/json/dist/index.d.ts +2 -2
  44. package/json/dist/index.js +16 -12
  45. package/json/src/select-json-family.ts +21 -18
  46. package/package.json +7 -7
  47. package/realtime-server/dist/index.d.ts +1 -1
  48. package/src/atom.ts +2 -32
  49. package/src/index.ts +1 -10
  50. package/src/logger.ts +4 -0
  51. package/src/selector.ts +1 -26
  52. package/src/silo.ts +7 -5
@@ -1,8 +1,9 @@
1
1
  import type {
2
- MutableAtomFamily,
2
+ AtomFamilyToken,
3
3
  MutableAtomFamilyOptions,
4
- RegularAtomFamily,
4
+ MutableAtomFamilyToken,
5
5
  RegularAtomFamilyOptions,
6
+ RegularAtomFamilyToken,
6
7
  } from "atom.io"
7
8
  import type { Canonical, Json } from "atom.io/json"
8
9
 
@@ -17,17 +18,17 @@ export function createAtomFamily<
17
18
  >(
18
19
  options: MutableAtomFamilyOptions<T, J, K>,
19
20
  store: Store,
20
- ): MutableAtomFamily<T, J, K>
21
+ ): MutableAtomFamilyToken<T, J, K>
21
22
  export function createAtomFamily<T, K extends Canonical>(
22
23
  options: RegularAtomFamilyOptions<T, K>,
23
24
  store: Store,
24
- ): RegularAtomFamily<T, K>
25
+ ): RegularAtomFamilyToken<T, K>
25
26
  export function createAtomFamily<T, K extends Canonical>(
26
27
  options:
27
28
  | MutableAtomFamilyOptions<any, any, any>
28
29
  | RegularAtomFamilyOptions<T, K>,
29
30
  store: Store,
30
- ): MutableAtomFamily<any, any, any> | RegularAtomFamily<T, K> {
31
+ ): AtomFamilyToken<any, any> {
31
32
  const isMutable = `mutable` in options
32
33
 
33
34
  if (isMutable) {
@@ -1,54 +1,80 @@
1
1
  import type {
2
2
  FamilyMetadata,
3
- ReadonlySelectorFamily,
4
3
  ReadonlySelectorFamilyOptions,
4
+ ReadonlySelectorFamilyToken,
5
5
  ReadonlySelectorToken,
6
6
  StateCreation,
7
7
  StateDisposal,
8
8
  } from "atom.io"
9
+ import type { findState } from "atom.io/ephemeral"
10
+ import type { seekState } from "atom.io/immortal"
9
11
  import type { Canonical } from "atom.io/json"
10
12
  import { stringifyJson } from "atom.io/json"
11
13
 
14
+ import {
15
+ findInStore,
16
+ getFromStore,
17
+ getJsonToken,
18
+ type ReadonlySelectorFamily,
19
+ seekInStore,
20
+ } from ".."
12
21
  import { newest } from "../lineage"
13
22
  import { createReadonlySelector } from "../selector"
14
23
  import type { Store } from "../store"
15
24
  import { Subject } from "../subject"
25
+ import { throwInCaseOfConflictingFamily } from "./throw-in-case-of-conflicting-family"
16
26
 
17
27
  export function createReadonlySelectorFamily<T, K extends Canonical>(
18
28
  options: ReadonlySelectorFamilyOptions<T, K>,
19
29
  store: Store,
20
- ): ReadonlySelectorFamily<T, K> {
30
+ internalRoles?: string[],
31
+ ): ReadonlySelectorFamilyToken<T, K> {
32
+ const familyToken = {
33
+ key: options.key,
34
+ type: `readonly_selector_family`,
35
+ } as const satisfies ReadonlySelectorFamilyToken<T, K>
36
+
37
+ throwInCaseOfConflictingFamily(familyToken, store)
38
+
21
39
  const subject = new Subject<
22
40
  | StateCreation<ReadonlySelectorToken<T>>
23
41
  | StateDisposal<ReadonlySelectorToken<T>>
24
42
  >()
25
43
 
26
- const readonlySelectorFamily = Object.assign(
27
- (key: K): ReadonlySelectorToken<T> => {
28
- const subKey = stringifyJson(key)
29
- const family: FamilyMetadata = { key: options.key, subKey }
30
- const fullKey = `${options.key}(${subKey})`
31
- const target = newest(store)
32
-
33
- const token = createReadonlySelector(
34
- {
35
- key: fullKey,
36
- get: options.get(key),
37
- },
38
- family,
39
- target,
40
- )
41
-
42
- subject.next({ type: `state_creation`, token })
43
- return token
44
+ const familyFunction = (key: K): ReadonlySelectorToken<T> => {
45
+ const subKey = stringifyJson(key)
46
+ const family: FamilyMetadata = { key: options.key, subKey }
47
+ const fullKey = `${options.key}(${subKey})`
48
+ const target = newest(store)
49
+
50
+ const token = createReadonlySelector(
51
+ {
52
+ key: fullKey,
53
+ get: options.get(key),
54
+ },
55
+ family,
56
+ target,
57
+ )
58
+
59
+ subject.next({ type: `state_creation`, token })
60
+ return token
61
+ }
62
+
63
+ const readonlySelectorFamily = Object.assign(familyFunction, familyToken, {
64
+ internalRoles,
65
+ subject,
66
+ install: (s: Store) => createReadonlySelectorFamily(options, s),
67
+ default: (key: K) => {
68
+ const getFn = options.get(key)
69
+ return getFn({
70
+ get: (token) => getFromStore(token, store),
71
+ find: ((token, k) => findInStore(token, k, store)) as typeof findState,
72
+ seek: ((token, k) => seekInStore(token, k, store)) as typeof seekState,
73
+ json: (token) => getJsonToken(token, store),
74
+ })
44
75
  },
45
- {
46
- key: options.key,
47
- type: `readonly_selector_family`,
48
- subject,
49
- install: (s: Store) => createReadonlySelectorFamily(options, s),
50
- } as const,
51
- ) satisfies ReadonlySelectorFamily<T, K>
76
+ }) satisfies ReadonlySelectorFamily<T, K>
77
+
52
78
  store.families.set(options.key, readonlySelectorFamily)
53
- return readonlySelectorFamily
79
+ return familyToken
54
80
  }
@@ -1,7 +1,7 @@
1
1
  import type {
2
2
  FamilyMetadata,
3
- RegularAtomFamily,
4
3
  RegularAtomFamilyOptions,
4
+ RegularAtomFamilyToken,
5
5
  RegularAtomOptions,
6
6
  RegularAtomToken,
7
7
  StateCreation,
@@ -10,47 +10,57 @@ import type {
10
10
  import type { Canonical } from "atom.io/json"
11
11
  import { stringifyJson } from "atom.io/json"
12
12
 
13
+ import type { RegularAtomFamily } from ".."
13
14
  import { createRegularAtom } from "../atom"
14
15
  import { newest } from "../lineage"
15
16
  import type { Store } from "../store"
16
17
  import { Subject } from "../subject"
18
+ import { throwInCaseOfConflictingFamily } from "./throw-in-case-of-conflicting-family"
17
19
 
18
20
  export function createRegularAtomFamily<T, K extends Canonical>(
19
21
  options: RegularAtomFamilyOptions<T, K>,
20
22
  store: Store,
21
- ): RegularAtomFamily<T, K> {
23
+ internalRoles?: string[],
24
+ ): RegularAtomFamilyToken<T, K> {
25
+ const familyToken = {
26
+ key: options.key,
27
+ type: `atom_family`,
28
+ } as const satisfies RegularAtomFamilyToken<T, K>
29
+
30
+ throwInCaseOfConflictingFamily(familyToken, store)
31
+
22
32
  const subject = new Subject<
23
33
  StateCreation<RegularAtomToken<T>> | StateDisposal<RegularAtomToken<T>>
24
34
  >()
25
35
 
26
- const atomFamily: RegularAtomFamily<T, K> = Object.assign(
27
- (key: K): RegularAtomToken<any> => {
28
- const subKey = stringifyJson(key)
29
- const family: FamilyMetadata = { key: options.key, subKey }
30
- const fullKey = `${options.key}(${subKey})`
31
- const target = newest(store)
32
-
33
- const def = options.default
34
- const individualOptions: RegularAtomOptions<T> = {
35
- key: fullKey,
36
- default: def instanceof Function ? def(key) : def,
37
- }
38
- if (options.effects) {
39
- individualOptions.effects = options.effects(key)
40
- }
41
-
42
- const token = createRegularAtom(individualOptions, family, target)
43
-
44
- subject.next({ type: `state_creation`, token })
45
- return token
46
- },
47
- {
48
- key: options.key,
49
- type: `atom_family`,
50
- subject,
51
- install: (s: Store) => createRegularAtomFamily(options, s),
52
- } as const,
53
- ) satisfies RegularAtomFamily<T, K>
36
+ const familyFunction = (key: K): RegularAtomToken<any> => {
37
+ const subKey = stringifyJson(key)
38
+ const family: FamilyMetadata = { key: options.key, subKey }
39
+ const fullKey = `${options.key}(${subKey})`
40
+ const target = newest(store)
41
+
42
+ const def = options.default
43
+ const individualOptions: RegularAtomOptions<T> = {
44
+ key: fullKey,
45
+ default: def instanceof Function ? def(key) : def,
46
+ }
47
+ if (options.effects) {
48
+ individualOptions.effects = options.effects(key)
49
+ }
50
+
51
+ const token = createRegularAtom(individualOptions, family, target)
52
+
53
+ subject.next({ type: `state_creation`, token })
54
+ return token
55
+ }
56
+
57
+ const atomFamily = Object.assign(familyFunction, familyToken, {
58
+ subject,
59
+ install: (s: Store) => createRegularAtomFamily(options, s),
60
+ internalRoles,
61
+ }) satisfies RegularAtomFamily<T, K>
62
+
54
63
  store.families.set(options.key, atomFamily)
55
- return atomFamily
64
+ store.defaults.set(options.key, options.default)
65
+ return familyToken
56
66
  }
@@ -1,8 +1,9 @@
1
1
  import type {
2
- ReadonlySelectorFamily,
3
2
  ReadonlySelectorFamilyOptions,
4
- WritableSelectorFamily,
3
+ ReadonlySelectorFamilyToken,
4
+ SelectorFamilyToken,
5
5
  WritableSelectorFamilyOptions,
6
+ WritableSelectorFamilyToken,
6
7
  } from "atom.io"
7
8
  import type { Canonical } from "atom.io/json"
8
9
 
@@ -13,17 +14,17 @@ import { createWritableSelectorFamily } from "./create-writable-selector-family"
13
14
  export function createSelectorFamily<T, K extends Canonical>(
14
15
  options: WritableSelectorFamilyOptions<T, K>,
15
16
  store: Store,
16
- ): WritableSelectorFamily<T, K>
17
+ ): WritableSelectorFamilyToken<T, K>
17
18
  export function createSelectorFamily<T, K extends Canonical>(
18
19
  options: ReadonlySelectorFamilyOptions<T, K>,
19
20
  store: Store,
20
- ): ReadonlySelectorFamily<T, K>
21
+ ): ReadonlySelectorFamilyToken<T, K>
21
22
  export function createSelectorFamily<T, K extends Canonical>(
22
23
  options:
23
24
  | ReadonlySelectorFamilyOptions<T, K>
24
25
  | WritableSelectorFamilyOptions<T, K>,
25
26
  store: Store,
26
- ): ReadonlySelectorFamily<T, K> | WritableSelectorFamily<T, K> {
27
+ ): SelectorFamilyToken<T, K> {
27
28
  const isWritable = `set` in options
28
29
 
29
30
  if (isWritable) {
@@ -2,54 +2,80 @@ import type {
2
2
  FamilyMetadata,
3
3
  StateCreation,
4
4
  StateDisposal,
5
- WritableSelectorFamily,
6
5
  WritableSelectorFamilyOptions,
6
+ WritableSelectorFamilyToken,
7
7
  WritableSelectorToken,
8
8
  } from "atom.io"
9
+ import type { findState } from "atom.io/ephemeral"
10
+ import type { seekState } from "atom.io/immortal"
9
11
  import type { Canonical } from "atom.io/json"
10
12
  import { stringifyJson } from "atom.io/json"
11
13
 
14
+ import {
15
+ findInStore,
16
+ getFromStore,
17
+ getJsonToken,
18
+ seekInStore,
19
+ type WritableSelectorFamily,
20
+ } from ".."
12
21
  import { newest } from "../lineage"
13
22
  import { createWritableSelector } from "../selector"
14
23
  import type { Store } from "../store"
15
24
  import { Subject } from "../subject"
25
+ import { throwInCaseOfConflictingFamily } from "./throw-in-case-of-conflicting-family"
16
26
 
17
27
  export function createWritableSelectorFamily<T, K extends Canonical>(
18
28
  options: WritableSelectorFamilyOptions<T, K>,
19
29
  store: Store,
20
- ): WritableSelectorFamily<T, K> {
30
+ internalRoles?: string[],
31
+ ): WritableSelectorFamilyToken<T, K> {
32
+ const familyToken = {
33
+ key: options.key,
34
+ type: `selector_family`,
35
+ } as const satisfies WritableSelectorFamilyToken<T, K>
36
+
37
+ throwInCaseOfConflictingFamily(familyToken, store)
38
+
21
39
  const subject = new Subject<
22
40
  | StateCreation<WritableSelectorToken<T>>
23
41
  | StateDisposal<WritableSelectorToken<T>>
24
42
  >()
25
43
 
26
- const selectorFamily = Object.assign(
27
- (key: K): WritableSelectorToken<T> => {
28
- const subKey = stringifyJson(key)
29
- const family: FamilyMetadata = { key: options.key, subKey }
30
- const fullKey = `${options.key}(${subKey})`
31
- const target = newest(store)
32
-
33
- const token = createWritableSelector(
34
- {
35
- key: fullKey,
36
- get: options.get(key),
37
- set: options.set(key),
38
- },
39
- family,
40
- target,
41
- )
42
-
43
- subject.next({ type: `state_creation`, token })
44
- return token
44
+ const familyFunction = (key: K): WritableSelectorToken<T> => {
45
+ const subKey = stringifyJson(key)
46
+ const family: FamilyMetadata = { key: options.key, subKey }
47
+ const fullKey = `${options.key}(${subKey})`
48
+ const target = newest(store)
49
+
50
+ const token = createWritableSelector(
51
+ {
52
+ key: fullKey,
53
+ get: options.get(key),
54
+ set: options.set(key),
55
+ },
56
+ family,
57
+ target,
58
+ )
59
+
60
+ subject.next({ type: `state_creation`, token })
61
+ return token
62
+ }
63
+
64
+ const selectorFamily = Object.assign(familyFunction, familyToken, {
65
+ internalRoles,
66
+ subject,
67
+ install: (s: Store) => createWritableSelectorFamily(options, s),
68
+ default: (key: K) => {
69
+ const getFn = options.get(key)
70
+ return getFn({
71
+ get: (...params: [any]) => getFromStore(...params, store), // TODO: make store zero-arg
72
+ find: ((token, k) => findInStore(token, k, store)) as typeof findState,
73
+ seek: ((token, k) => seekInStore(token, k, store)) as typeof seekState,
74
+ json: (token) => getJsonToken(token, store),
75
+ })
45
76
  },
46
- {
47
- key: options.key,
48
- type: `selector_family`,
49
- subject,
50
- install: (s: Store) => createWritableSelectorFamily(options, s),
51
- } as const,
52
- ) satisfies WritableSelectorFamily<T, K>
77
+ }) satisfies WritableSelectorFamily<T, K>
78
+
53
79
  store.families.set(options.key, selectorFamily)
54
- return selectorFamily
80
+ return familyToken
55
81
  }
@@ -6,7 +6,7 @@ import type {
6
6
  ReadableFamilyToken,
7
7
  ReadableToken,
8
8
  } from "atom.io"
9
- import type { Canonical } from "atom.io/json"
9
+ import { type Canonical, stringifyJson } from "atom.io/json"
10
10
 
11
11
  import { disposeAtom } from "../atom"
12
12
  import { disposeMolecule } from "../molecule/dispose-molecule"
@@ -55,7 +55,16 @@ export function disposeFromStore(
55
55
  ? seekInStore(family, key, store)
56
56
  : findInStore(family, key, store)
57
57
  if (!maybeToken) {
58
- throw new NotFoundError(family, key, store)
58
+ store.logger.error(
59
+ `❗`,
60
+ family.type,
61
+ family.key,
62
+ `tried to dispose of member`,
63
+ stringifyJson(key),
64
+ `but it was not found in store`,
65
+ store.config.name,
66
+ )
67
+ return
59
68
  }
60
69
  token = maybeToken
61
70
  }
@@ -109,9 +109,6 @@ export function seekInStore(
109
109
  break
110
110
  case `molecule_family`:
111
111
  state = target.molecules.get(stringifyJson(key))
112
- if (state) {
113
- return deposit(state)
114
- }
115
112
  }
116
113
  if (state) {
117
114
  return deposit(state)
@@ -0,0 +1,18 @@
1
+ import type { AtomFamilyToken, SelectorFamilyToken } from "atom.io"
2
+
3
+ import { prettyPrintTokenType } from "../pretty-print"
4
+ import type { Store } from "../store"
5
+
6
+ export function throwInCaseOfConflictingFamily(
7
+ family: AtomFamilyToken<any, any> | SelectorFamilyToken<any, any>,
8
+ store: Store,
9
+ ): void {
10
+ const existingFamily = store.families.get(family.key)
11
+ if (existingFamily) {
12
+ throw new Error(
13
+ `Tried to create ${family.type === `atom_family` ? `an` : `a`} ${prettyPrintTokenType(family)} with key "${family.key}", but "${family.key}" already exists in store "${store.config.name}" as ${existingFamily.type === `atom_family` ? `an` : `a`} ${prettyPrintTokenType(
14
+ existingFamily,
15
+ )}`,
16
+ )
17
+ }
18
+ }
@@ -6,7 +6,7 @@ import type {
6
6
  ReadableFamilyToken,
7
7
  ReadableToken,
8
8
  } from "atom.io"
9
- import type { Canonical } from "atom.io/json"
9
+ import { type Canonical, stringifyJson } from "atom.io/json"
10
10
 
11
11
  import { findInStore, seekInStore } from "../families"
12
12
  import { NotFoundError } from "../not-found-error"
@@ -56,7 +56,31 @@ export function getFromStore<T>(
56
56
  ? seekInStore(family, key, store)
57
57
  : findInStore(family, key, store)
58
58
  if (!maybeToken) {
59
- throw new NotFoundError(family, key, store)
59
+ store.logger.error(
60
+ `❗`,
61
+ family.type,
62
+ family.key,
63
+ `tried to get member`,
64
+ stringifyJson(key),
65
+ `but it was not found in store`,
66
+ store.config.name,
67
+ )
68
+ switch (family.type) {
69
+ case `atom_family`:
70
+ case `mutable_atom_family`:
71
+ return store.defaults.get(family.key)
72
+ case `selector_family`:
73
+ case `readonly_selector_family`: {
74
+ if (store.defaults.has(family.key)) {
75
+ return store.defaults.get(family.key)
76
+ }
77
+ const defaultValue = withdraw(family, store).default(key)
78
+ store.defaults.set(family.key, defaultValue)
79
+ return defaultValue
80
+ }
81
+ case `molecule_family`:
82
+ throw new NotFoundError(family, key, store)
83
+ }
60
84
  }
61
85
  token = maybeToken
62
86
  }
@@ -10,7 +10,7 @@ export const readOrComputeValue = <T>(
10
10
  target.logger.info(`📖`, state.type, state.key, `reading cached value`)
11
11
  return readCachedValue(state, target)
12
12
  }
13
- if (state.type !== `atom` && state.type !== `mutable_atom`) {
13
+ if (state.type === `selector` || state.type === `readonly_selector`) {
14
14
  target.logger.info(`🧮`, state.type, state.key, `computing value`)
15
15
  return state.get()
16
16
  }
@@ -1,5 +1,18 @@
1
- import type { FamilyMetadata } from "atom.io"
2
- import type { Json, JsonInterface } from "atom.io/json"
1
+ import type {
2
+ AtomToken,
3
+ FamilyMetadata,
4
+ MutableAtomFamilyToken,
5
+ MutableAtomToken,
6
+ ReadonlySelectorFamilyToken,
7
+ ReadonlySelectorToken,
8
+ RegularAtomFamilyToken,
9
+ RegularAtomToken,
10
+ StateCreation,
11
+ StateDisposal,
12
+ WritableSelectorFamilyToken,
13
+ WritableSelectorToken,
14
+ } from "atom.io"
15
+ import type { Canonical, Json, JsonInterface } from "atom.io/json"
3
16
 
4
17
  import type { Transceiver } from "./mutable"
5
18
  import type { Store } from "./store"
@@ -20,6 +33,7 @@ export * from "./molecule"
20
33
  export * from "./mutable"
21
34
  export * from "./not-found-error"
22
35
  export * from "./operation"
36
+ export * from "./pretty-print"
23
37
  export * from "./selector"
24
38
  export * from "./set-state"
25
39
  export * from "./store"
@@ -67,3 +81,65 @@ export type Selector<T> = ReadonlySelector<T> | WritableSelector<T>
67
81
 
68
82
  export type WritableState<T> = Atom<T> | WritableSelector<T>
69
83
  export type ReadableState<T> = Atom<T> | Selector<T>
84
+
85
+ // biome-ignore format: intersection
86
+ export type RegularAtomFamily<T, K extends Canonical> =
87
+ & RegularAtomFamilyToken<T, K>
88
+ & {
89
+ (key: K): RegularAtomToken<T>
90
+ subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>
91
+ install: (store: Store) => void
92
+ internalRoles: string[] | undefined
93
+ }
94
+
95
+ // biome-ignore format: intersection
96
+ export type MutableAtomFamily<
97
+ T extends Transceiver<any>,
98
+ J extends Json.Serializable,
99
+ K extends Canonical,
100
+ > =
101
+ & JsonInterface<T, J>
102
+ & MutableAtomFamilyToken<T, J, K>
103
+ & {
104
+ (key: K): MutableAtomToken<T, J>
105
+ subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>
106
+ install: (store: Store) => void
107
+ internalRoles: string[] | undefined
108
+ }
109
+
110
+ export type AtomFamily<T, K extends Canonical = Canonical> =
111
+ | MutableAtomFamily<T extends Transceiver<any> ? T : never, any, K>
112
+ | RegularAtomFamily<T, K>
113
+
114
+ // biome-ignore format: intersection
115
+ export type WritableSelectorFamily<T, K extends Canonical> =
116
+ & WritableSelectorFamilyToken<T, K>
117
+ & ((key: K) => WritableSelectorToken<T>)
118
+ & {
119
+ default: (key: K) => T,
120
+ subject: Subject<StateCreation<WritableSelectorToken<T>> | StateDisposal<WritableSelectorToken<T>>>
121
+ install: (store: Store) => void
122
+ internalRoles : string[] | undefined
123
+ }
124
+
125
+ // biome-ignore format: intersection
126
+ export type ReadonlySelectorFamily<T, K extends Canonical> =
127
+ & ReadonlySelectorFamilyToken<T, K>
128
+ & ((key: K) => ReadonlySelectorToken<T>)
129
+ & {
130
+ default: (key: K) => T,
131
+ subject: Subject<StateCreation<ReadonlySelectorToken<T>> | StateDisposal<ReadonlySelectorToken<T>>>
132
+ install: (store: Store) => void
133
+ internalRoles : string[] | undefined
134
+ }
135
+
136
+ export type SelectorFamily<T, K extends Canonical> =
137
+ | ReadonlySelectorFamily<T, K>
138
+ | WritableSelectorFamily<T, K>
139
+
140
+ export type WritableFamily<T, K extends Canonical> =
141
+ | AtomFamily<T, K>
142
+ | WritableSelectorFamily<T, K>
143
+ export type ReadableFamily<T, K extends Canonical> =
144
+ | AtomFamily<T, K>
145
+ | SelectorFamily<T, K>
@@ -9,7 +9,6 @@ import { parseJson, stringifyJson } from "atom.io/json"
9
9
 
10
10
  import { disposeFromStore, initFamilyMemberInStore } from "../families"
11
11
  import { growMoleculeInStore, makeMoleculeInStore } from "../molecule"
12
- import { setIntoStore } from "../set-state"
13
12
  import { type Store, withdraw } from "../store"
14
13
 
15
14
  export function ingestCreationEvent(
@@ -10,7 +10,7 @@ export function ingestSelectorUpdate(
10
10
  const updates =
11
11
  applying === `newValue`
12
12
  ? selectorUpdate.atomUpdates
13
- : [...selectorUpdate.atomUpdates].reverse()
13
+ : selectorUpdate.atomUpdates.toReversed()
14
14
  for (const atomUpdate of updates) {
15
15
  ingestAtomUpdate(applying, atomUpdate, store)
16
16
  }
@@ -1,4 +1,3 @@
1
- import { stringifyJson } from "anvl/json"
2
1
  import type {
3
2
  MoleculeConstructor,
4
3
  MoleculeDisposal,