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,23 +1,33 @@
1
1
  import type {
2
- AtomFamily,
2
+ AtomFamilyToken,
3
3
  AtomToken,
4
- MutableAtomFamily,
4
+ MutableAtomFamilyToken,
5
5
  MutableAtomToken,
6
- ReadableFamily,
6
+ ReadableFamilyToken,
7
7
  ReadableToken,
8
- ReadonlySelectorFamily,
8
+ ReadonlySelectorFamilyToken,
9
9
  ReadonlySelectorToken,
10
- RegularAtomFamily,
10
+ RegularAtomFamilyToken,
11
11
  RegularAtomToken,
12
- SelectorFamily,
12
+ SelectorFamilyToken,
13
13
  SelectorToken,
14
- WritableFamily,
15
- WritableSelectorFamily,
14
+ WritableFamilyToken,
15
+ WritableSelectorFamilyToken,
16
16
  WritableSelectorToken,
17
17
  WritableToken,
18
18
  } from "atom.io"
19
19
  import type { Canonical, Json } from "atom.io/json"
20
20
 
21
+ import type {
22
+ AtomFamily,
23
+ MutableAtomFamily,
24
+ ReadableFamily,
25
+ ReadonlySelectorFamily,
26
+ RegularAtomFamily,
27
+ SelectorFamily,
28
+ WritableFamily,
29
+ WritableSelectorFamily,
30
+ } from ".."
21
31
  import { initFamilyMemberInStore } from "../families"
22
32
  import type { Transceiver } from "../mutable"
23
33
  import type { Store } from "../store"
@@ -30,47 +40,47 @@ export function growMoleculeInStore<
30
40
  K extends Canonical,
31
41
  >(
32
42
  molecule: Molecule<any>,
33
- family: MutableAtomFamily<T, J, K>,
43
+ family: MutableAtomFamilyToken<T, J, K>,
34
44
  store: Store,
35
45
  ): MutableAtomToken<T, J>
36
46
  export function growMoleculeInStore<T, K extends Canonical>(
37
47
  molecule: Molecule<any>,
38
- family: RegularAtomFamily<T, K>,
48
+ family: RegularAtomFamilyToken<T, K>,
39
49
  store: Store,
40
50
  ): RegularAtomToken<T>
41
51
  export function growMoleculeInStore<T, K extends Canonical>(
42
52
  molecule: Molecule<any>,
43
- family: AtomFamily<T, K>,
53
+ family: AtomFamilyToken<T, K>,
44
54
  store: Store,
45
55
  ): AtomToken<T>
46
56
  export function growMoleculeInStore<T, K extends Canonical>(
47
57
  molecule: Molecule<any>,
48
- family: WritableSelectorFamily<T, K>,
58
+ family: WritableSelectorFamilyToken<T, K>,
49
59
  store: Store,
50
60
  ): WritableSelectorToken<T>
51
61
  export function growMoleculeInStore<T, K extends Canonical>(
52
62
  molecule: Molecule<any>,
53
- family: ReadonlySelectorFamily<T, K>,
63
+ family: ReadonlySelectorFamilyToken<T, K>,
54
64
  store: Store,
55
65
  ): ReadonlySelectorToken<T>
56
66
  export function growMoleculeInStore<T, K extends Canonical>(
57
67
  molecule: Molecule<any>,
58
- family: SelectorFamily<T, K>,
68
+ family: SelectorFamilyToken<T, K>,
59
69
  store: Store,
60
70
  ): SelectorToken<T>
61
71
  export function growMoleculeInStore<T, K extends Canonical>(
62
72
  molecule: Molecule<any>,
63
- family: WritableFamily<T, K>,
73
+ family: WritableFamilyToken<T, K>,
64
74
  store: Store,
65
75
  ): WritableToken<T>
66
76
  export function growMoleculeInStore<T, K extends Canonical>(
67
77
  molecule: Molecule<any>,
68
- family: ReadableFamily<T, K>,
78
+ family: ReadableFamilyToken<T, K>,
69
79
  store: Store,
70
80
  ): ReadableToken<T>
71
81
  export function growMoleculeInStore(
72
82
  molecule: Molecule<any>,
73
- family: ReadableFamily<any, any>,
83
+ family: ReadableFamilyToken<any, any>,
74
84
  store: Store,
75
85
  ): ReadableToken<any> {
76
86
  const stateToken = initFamilyMemberInStore(family, molecule.key, store)
@@ -1,7 +1,7 @@
1
1
  import type {
2
2
  FamilyMetadata,
3
- MutableAtomFamily,
4
3
  MutableAtomFamilyOptions,
4
+ MutableAtomFamilyToken,
5
5
  MutableAtomOptions,
6
6
  MutableAtomToken,
7
7
  StateCreation,
@@ -10,6 +10,8 @@ import type {
10
10
  import type { Json } from "atom.io/json"
11
11
  import { selectJsonFamily, stringifyJson } from "atom.io/json"
12
12
 
13
+ import type { MutableAtomFamily } from ".."
14
+ import { throwInCaseOfConflictingFamily } from "../families/throw-in-case-of-conflicting-family"
13
15
  import { newest } from "../lineage"
14
16
  import { createMutableAtom } from "../mutable"
15
17
  import type { Store } from "../store"
@@ -24,45 +26,52 @@ export function createMutableAtomFamily<
24
26
  >(
25
27
  options: MutableAtomFamilyOptions<T, J, K>,
26
28
  store: Store,
27
- ): MutableAtomFamily<T, J, K> {
29
+ internalRoles?: string[],
30
+ ): MutableAtomFamilyToken<T, J, K> {
31
+ const familyToken = {
32
+ key: options.key,
33
+ type: `mutable_atom_family`,
34
+ } as const satisfies MutableAtomFamilyToken<T, J, K>
35
+
36
+ throwInCaseOfConflictingFamily(familyToken, store)
37
+
28
38
  const subject = new Subject<
29
39
  StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>
30
40
  >()
31
41
 
32
- const atomFamily = Object.assign(
33
- (key: K): MutableAtomToken<T, J> => {
34
- const subKey = stringifyJson(key)
35
- const family: FamilyMetadata = { key: options.key, subKey }
36
- const fullKey = `${options.key}(${subKey})`
37
- const target = newest(store)
38
-
39
- const individualOptions: MutableAtomOptions<T, J> = {
40
- key: fullKey,
41
- default: () => options.default(key),
42
- toJson: options.toJson,
43
- fromJson: options.fromJson,
44
- mutable: true,
45
- }
46
- if (options.effects) {
47
- individualOptions.effects = options.effects(key)
48
- }
49
-
50
- const token = createMutableAtom(individualOptions, family, target)
42
+ const familyFunction = (key: K): MutableAtomToken<T, J> => {
43
+ const subKey = stringifyJson(key)
44
+ const family: FamilyMetadata = { key: options.key, subKey }
45
+ const fullKey = `${options.key}(${subKey})`
46
+ const target = newest(store)
51
47
 
52
- subject.next({ type: `state_creation`, token })
53
- return token
54
- },
55
- {
56
- key: options.key,
57
- type: `mutable_atom_family`,
58
- subject,
59
- install: (s: Store) => createMutableAtomFamily(options, s),
48
+ const individualOptions: MutableAtomOptions<T, J> = {
49
+ key: fullKey,
50
+ default: () => options.default(key),
60
51
  toJson: options.toJson,
61
52
  fromJson: options.fromJson,
62
- } as const,
63
- ) satisfies MutableAtomFamily<T, J, K>
53
+ mutable: true,
54
+ }
55
+ if (options.effects) {
56
+ individualOptions.effects = options.effects(key)
57
+ }
58
+
59
+ const token = createMutableAtom(individualOptions, family, target)
60
+
61
+ subject.next({ type: `state_creation`, token })
62
+ return token
63
+ }
64
+
65
+ const atomFamily = Object.assign(familyFunction, familyToken, {
66
+ subject,
67
+ install: (s: Store) => createMutableAtomFamily(options, s),
68
+ toJson: options.toJson,
69
+ fromJson: options.fromJson,
70
+ internalRoles,
71
+ }) satisfies MutableAtomFamily<T, J, K>
72
+
64
73
  store.families.set(options.key, atomFamily)
65
74
  selectJsonFamily(atomFamily, options, store)
66
75
  new FamilyTracker(atomFamily, store)
67
- return atomFamily
76
+ return familyToken
68
77
  }
@@ -1,6 +1,7 @@
1
- import type { MutableAtomFamilyToken, WritableSelectorFamily } from "atom.io"
1
+ import type { MutableAtomFamilyToken } from "atom.io"
2
2
  import type { Json } from "atom.io/json"
3
3
 
4
+ import type { WritableSelectorFamily } from ".."
4
5
  import { newest } from "../lineage"
5
6
  import type { Store } from "../store"
6
7
  import type { Transceiver } from "./transceiver"
@@ -0,0 +1,23 @@
1
+ import type { MutableAtomFamilyToken } from "atom.io"
2
+ import type { Json } from "atom.io/json"
3
+
4
+ import type { AtomFamily } from ".."
5
+ import { newest } from "../lineage"
6
+ import type { Store } from "../store"
7
+ import type { Signal, Transceiver } from "./transceiver"
8
+
9
+ export const getUpdateFamily = <
10
+ Core extends Transceiver<Json.Serializable>,
11
+ SerializableCore extends Json.Serializable,
12
+ Key extends string,
13
+ >(
14
+ mutableAtomFamily: MutableAtomFamilyToken<Core, SerializableCore, Key>,
15
+ store: Store,
16
+ ): AtomFamily<Signal<Core>, Key> => {
17
+ const target = newest(store)
18
+ const key = `*${mutableAtomFamily.key}`
19
+ const updateFamily: AtomFamily<Signal<Core>, Key> = target.families.get(
20
+ key,
21
+ ) as AtomFamily<Signal<Core>, Key>
22
+ return updateFamily
23
+ }
@@ -2,6 +2,7 @@ export * from "./create-mutable-atom"
2
2
  export * from "./create-mutable-atom-family"
3
3
  export * from "./get-json-family"
4
4
  export * from "./get-json-token"
5
+ export * from "./get-update-family"
5
6
  export * from "./get-update-token"
6
7
  export * from "./tracker"
7
8
  export * from "./tracker-family"
@@ -1,9 +1,9 @@
1
- import type { MutableAtomFamily, RegularAtomFamily } from "atom.io"
2
1
  import type { Canonical } from "atom.io/json"
3
2
  import { parseJson } from "atom.io/json"
4
3
 
4
+ import type { MutableAtomFamily, RegularAtomFamily } from ".."
5
5
  import { createRegularAtomFamily, seekInStore } from "../families"
6
- import type { Store } from "../store"
6
+ import { type Store, withdraw } from "../store"
7
7
  import { Tracker } from "./tracker"
8
8
  import type { Transceiver } from "./transceiver"
9
9
 
@@ -25,7 +25,7 @@ export class FamilyTracker<
25
25
  mutableAtoms: MutableAtomFamily<Core, any, FamilyMemberKey>,
26
26
  store: Store,
27
27
  ) {
28
- this.latestUpdateAtoms = createRegularAtomFamily<
28
+ const updateAtoms = createRegularAtomFamily<
29
29
  typeof this.Update | null,
30
30
  FamilyMemberKey
31
31
  >(
@@ -34,7 +34,9 @@ export class FamilyTracker<
34
34
  default: null,
35
35
  },
36
36
  store,
37
+ [`mutable`, `updates`],
37
38
  )
39
+ this.latestUpdateAtoms = withdraw(updateAtoms, store)
38
40
  this.mutableAtoms = mutableAtoms
39
41
  this.mutableAtoms.subject.subscribe(
40
42
  `store=${store.config.name}::tracker-atom-family`,
@@ -1,42 +1,9 @@
1
- import type {
2
- MoleculeFamilyToken,
3
- MoleculeToken,
4
- ReadableFamilyToken,
5
- ReadableToken,
6
- TimelineToken,
7
- TransactionToken,
8
- } from "atom.io"
9
1
  import { type Json, stringifyJson } from "atom.io/json"
10
2
 
3
+ import type { AtomIOToken } from "./pretty-print"
4
+ import { prettyPrintTokenType } from "./pretty-print"
11
5
  import type { Store } from "./store"
12
6
 
13
- const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)
14
-
15
- type AtomIOToken =
16
- | MoleculeFamilyToken<any>
17
- | MoleculeToken<any>
18
- | ReadableFamilyToken<any, any>
19
- | ReadableToken<any>
20
- | TimelineToken<any>
21
- | TransactionToken<any>
22
-
23
- function prettyPrintTokenType(token: AtomIOToken) {
24
- switch (token.type) {
25
- case `atom_family`:
26
- return `Atom Family`
27
- case `molecule_family`:
28
- return `Molecule Family`
29
- case `readonly_selector`:
30
- return `Readonly Selector`
31
- case `readonly_selector_family`:
32
- return `Readonly Selector Family`
33
- case `selector_family`:
34
- return `Selector Family`
35
- default:
36
- return capitalize(token.type)
37
- }
38
- }
39
-
40
7
  export class NotFoundError extends Error {
41
8
  public constructor(token: AtomIOToken, store: Store)
42
9
  public constructor(
@@ -0,0 +1,37 @@
1
+ import type {
2
+ MoleculeFamilyToken,
3
+ MoleculeToken,
4
+ ReadableFamilyToken,
5
+ ReadableToken,
6
+ TimelineToken,
7
+ TransactionToken,
8
+ } from "atom.io"
9
+
10
+ const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)
11
+
12
+ export type AtomIOToken =
13
+ | MoleculeFamilyToken<any>
14
+ | MoleculeToken<any>
15
+ | ReadableFamilyToken<any, any>
16
+ | ReadableToken<any>
17
+ | TimelineToken<any>
18
+ | TransactionToken<any>
19
+
20
+ export function prettyPrintTokenType(token: AtomIOToken): string {
21
+ switch (token.type) {
22
+ case `atom_family`:
23
+ return `Atom Family`
24
+ case `molecule_family`:
25
+ return `Molecule Family`
26
+ case `mutable_atom_family`:
27
+ return `Mutable Atom Family`
28
+ case `readonly_selector`:
29
+ return `Readonly Selector`
30
+ case `readonly_selector_family`:
31
+ return `Readonly Selector Family`
32
+ case `selector_family`:
33
+ return `Selector Family`
34
+ default:
35
+ return capitalize(token.type)
36
+ }
37
+ }
@@ -22,12 +22,12 @@ export const createWritableSelector = <T>(
22
22
  const target = newest(store)
23
23
  const subject = new Subject<{ newValue: T; oldValue: T }>()
24
24
  const covered = new Set<string>()
25
- const toolkit = registerSelector(options.key, covered, target)
26
- const { find, get, seek, json } = toolkit
25
+ const setterToolkit = registerSelector(options.key, covered, target)
26
+ const { find, get, seek, json } = setterToolkit
27
27
  const getterToolkit = { find, get, seek, json }
28
28
 
29
- const getSelf = (innerTarget = newest(store)): T => {
30
- const value = options.get(getterToolkit)
29
+ const getSelf = (getFn = options.get, innerTarget = newest(store)): T => {
30
+ const value = getFn(getterToolkit)
31
31
  cacheValue(options.key, value, subject, innerTarget)
32
32
  covered.clear()
33
33
  return value
@@ -35,7 +35,7 @@ export const createWritableSelector = <T>(
35
35
 
36
36
  const setSelf = (next: T | ((oldValue: T) => T)): void => {
37
37
  const innerTarget = newest(store)
38
- const oldValue = getSelf(innerTarget)
38
+ const oldValue = getSelf(options.get, innerTarget)
39
39
  const newValue = become(next)(oldValue)
40
40
  store.logger.info(
41
41
  `📝`,
@@ -52,7 +52,7 @@ export const createWritableSelector = <T>(
52
52
  if (isRootStore(innerTarget)) {
53
53
  subject.next({ newValue, oldValue })
54
54
  }
55
- options.set(toolkit, newValue)
55
+ options.set(setterToolkit, newValue)
56
56
  }
57
57
  const mySelector: WritableSelector<T> = {
58
58
  ...options,
@@ -1,5 +1,5 @@
1
1
  import type { WritableFamilyToken, WritableToken } from "atom.io"
2
- import type { Canonical } from "atom.io/json"
2
+ import { type Canonical, stringifyJson } from "atom.io/json"
3
3
 
4
4
  import { findInStore, seekInStore } from "../families"
5
5
  import { NotFoundError } from "../not-found-error"
@@ -52,7 +52,18 @@ export function setIntoStore<T, New extends T>(
52
52
  ? findInStore(family, key, store)
53
53
  : seekInStore(family, key, store)
54
54
  if (!maybeToken) {
55
- throw new NotFoundError(family, key, store)
55
+ store.logger.error(
56
+ `❗`,
57
+ family.type,
58
+ family.key,
59
+ `tried to set member`,
60
+ stringifyJson(key),
61
+ `to`,
62
+ value,
63
+ `but it was not found in store`,
64
+ store.config.name,
65
+ )
66
+ return
56
67
  }
57
68
  token = maybeToken
58
69
  }
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  AtomToken,
3
+ MoleculeConstructor,
3
4
  MoleculeFamily,
4
5
  MoleculeFamilyToken,
5
6
  MoleculeToken,
@@ -38,20 +39,20 @@ export function deposit<T>(state: WritableSelector<T>): WritableSelectorToken<T>
38
39
  export function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>
39
40
  export function deposit<T>(state: Selector<T>): SelectorToken<T>
40
41
  export function deposit<T>(state: WritableState<T>): WritableToken<T>
41
- export function deposit<
42
- K extends Canonical,
43
- S extends { [key: string]: any },
44
- P extends any[],
45
- >(state: Molecule<any>): MoleculeToken<any>
46
- export function deposit<
47
- K extends Canonical,
48
- S extends { [key: string]: any },
49
- P extends any[],
50
- >(state: MoleculeFamily<any>): MoleculeFamilyToken<any>
42
+ export function deposit<M extends MoleculeConstructor>(
43
+ state: MoleculeFamily<M>,
44
+ ): MoleculeFamilyToken<M>
45
+ export function deposit<M extends MoleculeConstructor>(
46
+ state: Molecule<M>,
47
+ ): MoleculeToken<M>
51
48
  export function deposit<T extends Func>(
52
49
  state: Transaction<T>,
53
50
  ): TransactionToken<T>
54
51
  export function deposit<T>(state: ReadableState<T>): ReadableToken<T>
52
+ export function deposit(
53
+ state: Molecule<any> | ReadableState<any>,
54
+ ): MoleculeToken<any> | ReadableToken<any>
55
+
55
56
  export function deposit<T>(
56
57
  state:
57
58
  | Molecule<any>
@@ -3,13 +3,9 @@ import type {
3
3
  Logger,
4
4
  MoleculeFamily,
5
5
  MoleculeToken,
6
- MutableAtomFamily,
7
- ReadonlySelectorFamily,
8
6
  ReadonlySelectorToken,
9
- RegularAtomFamily,
10
7
  TimelineToken,
11
8
  TransactionToken,
12
- WritableSelectorFamily,
13
9
  WritableSelectorToken,
14
10
  } from "atom.io"
15
11
  import { AtomIOLogger } from "atom.io"
@@ -20,10 +16,14 @@ import type {
20
16
  Atom,
21
17
  Func,
22
18
  Molecule,
19
+ MutableAtomFamily,
23
20
  ReadonlySelector,
21
+ ReadonlySelectorFamily,
22
+ RegularAtomFamily,
24
23
  Tracker,
25
24
  Transceiver,
26
25
  WritableSelector,
26
+ WritableSelectorFamily,
27
27
  } from ".."
28
28
  import type { Lineage } from "../lineage"
29
29
  import { getJsonToken, getUpdateToken } from "../mutable"
@@ -42,6 +42,7 @@ export class Store implements Lineage {
42
42
  public child: Store | null = null
43
43
 
44
44
  public valueMap = new Map<string, any>()
45
+ public defaults = new Map<string, any>()
45
46
 
46
47
  public atoms = new Map<string, Atom<any>>()
47
48
  public selectors = new Map<string, WritableSelector<any>>()
@@ -160,6 +161,12 @@ export class Store implements Lineage {
160
161
  }
161
162
 
162
163
  for (const [, family] of store.families) {
164
+ if (
165
+ family.internalRoles?.includes(`mutable`) ||
166
+ family.internalRoles?.includes(`join`)
167
+ ) {
168
+ continue
169
+ }
163
170
  family.install(this)
164
171
  }
165
172
  const mutableHelpers = new Set<string>()
@@ -1,32 +1,24 @@
1
1
  import type {
2
- AtomFamily,
3
2
  AtomFamilyToken,
4
3
  AtomToken,
5
4
  MoleculeConstructor,
6
5
  MoleculeFamily,
7
6
  MoleculeFamilyToken,
8
7
  MoleculeToken,
9
- MutableAtomFamily,
10
8
  MutableAtomFamilyToken,
11
9
  MutableAtomToken,
12
- ReadableFamily,
13
10
  ReadableFamilyToken,
14
11
  ReadableToken,
15
- ReadonlySelectorFamily,
16
12
  ReadonlySelectorFamilyToken,
17
13
  ReadonlySelectorToken,
18
- RegularAtomFamily,
19
14
  RegularAtomFamilyToken,
20
15
  RegularAtomToken,
21
- SelectorFamily,
22
16
  SelectorFamilyToken,
23
17
  SelectorToken,
24
18
  TimelineManageable,
25
19
  TimelineToken,
26
20
  TransactionToken,
27
- WritableFamily,
28
21
  WritableFamilyToken,
29
- WritableSelectorFamily,
30
22
  WritableSelectorFamilyToken,
31
23
  WritableSelectorToken,
32
24
  WritableToken,
@@ -36,15 +28,23 @@ import { stringifyJson } from "atom.io/json"
36
28
 
37
29
  import type {
38
30
  Atom,
31
+ AtomFamily,
39
32
  Func,
40
33
  Molecule,
41
34
  MutableAtom,
35
+ MutableAtomFamily,
36
+ ReadableFamily,
42
37
  ReadableState,
43
38
  ReadonlySelector,
39
+ ReadonlySelectorFamily,
44
40
  RegularAtom,
41
+ RegularAtomFamily,
45
42
  Selector,
43
+ SelectorFamily,
46
44
  Transceiver,
45
+ WritableFamily,
47
46
  WritableSelector,
47
+ WritableSelectorFamily,
48
48
  WritableState,
49
49
  } from ".."
50
50
  import { NotFoundError } from ".."
@@ -48,6 +48,7 @@ export const buildTransaction = (
48
48
  }),
49
49
  selectors: new LazyMap(parent.selectors),
50
50
  valueMap: new LazyMap(parent.valueMap),
51
+ defaults: parent.defaults,
51
52
  molecules: new LazyMap(parent.molecules),
52
53
  moleculeFamilies: new LazyMap(parent.moleculeFamilies),
53
54
  moleculeInProgress: parent.moleculeInProgress,
@@ -204,7 +204,7 @@ var attachTimelineFamily = (store = IMPLICIT.STORE) => {
204
204
  const findTimelineLogState = createSelectorFamily(
205
205
  {
206
206
  key: `\u{1F441}\u200D\u{1F5E8} Timeline Update Log`,
207
- get: (key) => ({ get }) => get(findTimelineLogState__INTERNAL(key))
207
+ get: (key) => ({ get }) => get(findTimelineLogState__INTERNAL, key)
208
208
  },
209
209
  store
210
210
  );
@@ -271,7 +271,7 @@ var attachTransactionIndex = (store = IMPLICIT.STORE) => {
271
271
  return transactionTokenIndex;
272
272
  };
273
273
  var attachTransactionLogs = (store = IMPLICIT.STORE) => {
274
- const findTransactionUpdateLog = createRegularAtomFamily(
274
+ const transactionUpdateLogAtoms = createRegularAtomFamily(
275
275
  {
276
276
  key: `\u{1F441}\u200D\u{1F5E8} Transaction Update Log (Internal)`,
277
277
  default: () => [],
@@ -291,7 +291,7 @@ var attachTransactionLogs = (store = IMPLICIT.STORE) => {
291
291
  const findTransactionUpdateLogState = createSelectorFamily(
292
292
  {
293
293
  key: `\u{1F441}\u200D\u{1F5E8} Transaction Update Log`,
294
- get: (key) => ({ get }) => get(findTransactionUpdateLog(key))
294
+ get: (key) => ({ get }) => get(transactionUpdateLogAtoms, key)
295
295
  },
296
296
  store
297
297
  );
@@ -46,7 +46,7 @@ export const attachTimelineFamily = (
46
46
  get:
47
47
  (key) =>
48
48
  ({ get }) =>
49
- get(findTimelineLogState__INTERNAL(key)),
49
+ get(findTimelineLogState__INTERNAL, key),
50
50
  },
51
51
  store,
52
52
  )
@@ -9,7 +9,7 @@ import {
9
9
  export const attachTransactionLogs = (
10
10
  store: Store = IMPLICIT.STORE,
11
11
  ): ReadonlySelectorFamilyToken<TransactionUpdate<Func>[], string> => {
12
- const findTransactionUpdateLog = createRegularAtomFamily<
12
+ const transactionUpdateLogAtoms = createRegularAtomFamily<
13
13
  TransactionUpdate<Func>[],
14
14
  string
15
15
  >(
@@ -38,7 +38,7 @@ export const attachTransactionLogs = (
38
38
  get:
39
39
  (key) =>
40
40
  ({ get }) =>
41
- get(findTransactionUpdateLog(key)),
41
+ get(transactionUpdateLogAtoms, key),
42
42
  },
43
43
  store,
44
44
  )
@@ -38,8 +38,8 @@ declare function fromEntries<E extends Entries>(entries: E): FromEntries<E>;
38
38
 
39
39
  declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
40
40
 
41
- declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
42
- declare function selectJsonFamily<T, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
41
+ declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Canonical>(atomFamilyToken: AtomIO.MutableAtomFamilyToken<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamilyToken<J, K>;
42
+ declare function selectJsonFamily<T, J extends Serializable, K extends Canonical>(atomFamilyToken: AtomIO.RegularAtomFamilyToken<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamilyToken<J, K>;
43
43
 
44
44
  type Canonical = primitive | ReadonlyArray<Canonical>;
45
45
  type JsonIO = (...params: Serializable[]) => Serializable | void;