atom.io 0.19.0 → 0.19.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.
Files changed (110) hide show
  1. package/data/dist/index.cjs +99 -79
  2. package/data/dist/index.js +2 -2
  3. package/data/src/join.ts +91 -74
  4. package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
  5. package/dist/{chunk-CVBEVTM5.js → chunk-CC7IF7QF.js} +5 -42
  6. package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
  7. package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
  8. package/dist/index.cjs +15 -7
  9. package/dist/index.d.ts +24 -35
  10. package/dist/index.js +15 -7
  11. package/internal/dist/index.cjs +56 -44
  12. package/internal/dist/index.d.ts +21 -21
  13. package/internal/dist/index.js +49 -37
  14. package/internal/src/atom/create-regular-atom.ts +7 -5
  15. package/internal/src/atom/delete-atom.ts +2 -2
  16. package/internal/src/families/create-readonly-selector-family.ts +2 -2
  17. package/internal/src/families/create-regular-atom-family.ts +1 -1
  18. package/internal/src/families/create-writable-selector-family.ts +1 -1
  19. package/internal/src/future.ts +4 -2
  20. package/internal/src/lineage.ts +1 -0
  21. package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
  22. package/internal/src/mutable/create-mutable-atom.ts +7 -5
  23. package/internal/src/mutable/tracker.ts +4 -4
  24. package/internal/src/mutable/transceiver.ts +2 -2
  25. package/internal/src/selector/delete-selector.ts +1 -1
  26. package/internal/src/set-state/become.ts +1 -1
  27. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  28. package/internal/src/store/deposit.ts +5 -5
  29. package/internal/src/store/store.ts +5 -5
  30. package/internal/src/store/withdraw.ts +4 -5
  31. package/internal/src/subject.ts +3 -1
  32. package/internal/src/subscribe/subscribe-to-state.ts +2 -2
  33. package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
  34. package/internal/src/timeline/add-atom-to-timeline.ts +16 -11
  35. package/internal/src/timeline/create-timeline.ts +3 -4
  36. package/internal/src/transaction/act-upon-store.ts +5 -5
  37. package/internal/src/transaction/apply-transaction.ts +4 -4
  38. package/internal/src/transaction/build-transaction.ts +10 -7
  39. package/internal/src/transaction/create-transaction.ts +10 -10
  40. package/internal/src/transaction/index.ts +3 -3
  41. package/internal/src/transaction/is-root-store.ts +2 -2
  42. package/introspection/dist/index.cjs +3 -2
  43. package/introspection/dist/index.d.ts +6 -6
  44. package/introspection/dist/index.js +3 -2
  45. package/introspection/src/attach-atom-index.ts +5 -4
  46. package/introspection/src/attach-introspection-states.ts +3 -3
  47. package/introspection/src/attach-transaction-index.ts +4 -4
  48. package/introspection/src/attach-transaction-logs.ts +8 -4
  49. package/introspection/src/index.ts +3 -3
  50. package/json/dist/index.cjs +6 -2
  51. package/json/dist/index.d.ts +1 -1
  52. package/json/dist/index.js +8 -4
  53. package/json/src/select-json-family.ts +3 -2
  54. package/json/src/select-json.ts +3 -1
  55. package/package.json +243 -242
  56. package/react/dist/index.cjs +9 -3
  57. package/react/dist/index.js +9 -3
  58. package/react/src/use-i.ts +3 -1
  59. package/react/src/use-tl.ts +6 -2
  60. package/react-devtools/dist/index.cjs +332 -978
  61. package/react-devtools/dist/index.css +0 -18
  62. package/react-devtools/dist/index.d.ts +7 -9
  63. package/react-devtools/dist/index.js +291 -881
  64. package/react-devtools/src/AtomIODevtools.tsx +5 -2
  65. package/react-devtools/src/Button.tsx +6 -2
  66. package/react-devtools/src/StateEditor.tsx +13 -16
  67. package/react-devtools/src/StateIndex.tsx +28 -21
  68. package/react-devtools/src/TimelineIndex.tsx +17 -6
  69. package/react-devtools/src/TransactionIndex.tsx +13 -6
  70. package/react-devtools/src/Updates.tsx +24 -9
  71. package/realtime/dist/index.cjs +1 -0
  72. package/realtime/dist/index.d.ts +2 -2
  73. package/realtime/dist/index.js +1 -0
  74. package/realtime/src/realtime-continuity.ts +4 -3
  75. package/realtime-client/dist/index.cjs +29 -29
  76. package/realtime-client/dist/index.d.ts +2 -2
  77. package/realtime-client/dist/index.js +1 -1
  78. package/realtime-client/src/server-action.ts +2 -2
  79. package/realtime-client/src/sync-continuity.ts +23 -23
  80. package/realtime-react/dist/index.cjs +30 -30
  81. package/realtime-react/dist/index.d.ts +2 -2
  82. package/realtime-react/dist/index.js +2 -2
  83. package/realtime-react/src/use-server-action.ts +3 -3
  84. package/realtime-react/src/use-single-effect.ts +1 -1
  85. package/realtime-server/dist/index.cjs +54 -44
  86. package/realtime-server/dist/index.d.ts +6 -6
  87. package/realtime-server/dist/index.js +34 -24
  88. package/realtime-server/src/ipc-sockets/child-socket.ts +7 -7
  89. package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
  90. package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
  91. package/realtime-server/src/realtime-action-receiver.ts +7 -5
  92. package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
  93. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +2 -2
  94. package/realtime-server/src/realtime-state-receiver.ts +3 -1
  95. package/realtime-testing/dist/index.cjs +15 -13
  96. package/realtime-testing/dist/index.js +9 -7
  97. package/realtime-testing/src/setup-realtime-test.tsx +7 -5
  98. package/src/atom.ts +4 -8
  99. package/src/dispose.ts +1 -0
  100. package/src/index.ts +2 -9
  101. package/src/selector.ts +4 -8
  102. package/src/silo.ts +13 -3
  103. package/src/subscribe.ts +6 -6
  104. package/src/timeline.ts +4 -4
  105. package/src/transaction.ts +24 -24
  106. package/src/validators.ts +2 -2
  107. package/transceivers/set-rtx/dist/index.cjs +11 -12
  108. package/transceivers/set-rtx/dist/index.js +11 -12
  109. package/transceivers/set-rtx/src/set-rtx.ts +10 -10
  110. /package/dist/{chunk-VAE5OCKN.js → chunk-BF4MVQF6.js} +0 -0
@@ -1,4 +1,9 @@
1
- import type { AtomToken, TransactionToken, TransactionUpdate, ƒn } from "atom.io"
1
+ import type {
2
+ AtomToken,
3
+ TransactionToken,
4
+ TransactionUpdate,
5
+ Func,
6
+ } from "atom.io"
2
7
  import type { TimelineUpdate } from "atom.io"
3
8
 
4
9
  import { newest } from "../lineage"
@@ -51,8 +56,8 @@ export const addAtomToTimeline = (
51
56
  currentTransactionKey
52
57
  ? `in transaction "${currentTransactionKey}"`
53
58
  : currentSelectorKey
54
- ? `in selector "${currentSelectorKey}"`
55
- : ``,
59
+ ? `in selector "${currentSelectorKey}"`
60
+ : ``,
56
61
  )
57
62
  if (tl.timeTraveling === null) {
58
63
  if (tl.selectorTime && tl.selectorTime !== currentSelectorTime) {
@@ -82,7 +87,7 @@ export const addAtomToTimeline = (
82
87
  tl.transactionKey = currentTransactionKey
83
88
  const unsubscribe = currentTransaction.subject.subscribe(
84
89
  `timeline:${tl.key}`,
85
- (update) => {
90
+ (transactionUpdate) => {
86
91
  unsubscribe()
87
92
  if (tl.timeTraveling === null && currentTransactionInstanceId) {
88
93
  if (tl.at !== tl.history.length) {
@@ -90,23 +95,23 @@ export const addAtomToTimeline = (
90
95
  }
91
96
 
92
97
  const filterUpdates = (
93
- updates: TransactionUpdate<ƒn>[`updates`],
98
+ updates: TransactionUpdate<Func>[`updates`],
94
99
  ) =>
95
100
  updates
96
101
  .filter((updateFromTx) => {
97
- const target = newest(store)
102
+ const newestStore = newest(store)
98
103
  if (`updates` in updateFromTx) {
99
104
  return true
100
105
  }
101
106
  const atomOrFamilyKeys =
102
- target.timelineAtoms.getRelatedKeys(tl.key)
107
+ newestStore.timelineAtoms.getRelatedKeys(tl.key)
103
108
 
104
109
  return atomOrFamilyKeys
105
110
  ? [...atomOrFamilyKeys].some(
106
111
  (key) =>
107
112
  key === updateFromTx.key ||
108
113
  key === updateFromTx.family?.key,
109
- )
114
+ )
110
115
  : false
111
116
  })
112
117
  .map((updateFromTx) => {
@@ -119,12 +124,12 @@ export const addAtomToTimeline = (
119
124
  return updateFromTx
120
125
  })
121
126
 
122
- const updates = filterUpdates(update.updates)
127
+ const updates = filterUpdates(transactionUpdate.updates)
123
128
 
124
129
  const timelineTransactionUpdate: TimelineTransactionUpdate = {
125
130
  type: `transaction_update`,
126
131
  timestamp: Date.now(),
127
- ...update,
132
+ ...transactionUpdate,
128
133
  updates,
129
134
  }
130
135
  const willCapture =
@@ -140,7 +145,7 @@ export const addAtomToTimeline = (
140
145
  `⌛`,
141
146
  `timeline`,
142
147
  tl.key,
143
- `got a transaction_update "${update.key}"`,
148
+ `got a transaction_update "${transactionUpdate.key}"`,
144
149
  )
145
150
  },
146
151
  )
@@ -1,5 +1,4 @@
1
1
  import type {
2
- AtomFamily,
3
2
  AtomFamilyToken,
4
3
  FamilyMetadata,
5
4
  StateUpdate,
@@ -9,7 +8,7 @@ import type {
9
8
  TimelineUpdate,
10
9
  TokenType,
11
10
  TransactionUpdate,
12
- ƒn,
11
+ Func,
13
12
  } from "atom.io"
14
13
 
15
14
  import { newest } from "../lineage"
@@ -31,7 +30,7 @@ export type TimelineSelectorUpdate<ManagedAtom extends TimelineManageable> = {
31
30
  timestamp: number
32
31
  atomUpdates: Omit<TimelineAtomUpdate<ManagedAtom>, `timestamp`>[]
33
32
  }
34
- export type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
33
+ export type TimelineTransactionUpdate = TransactionUpdate<Func> & {
35
34
  key: string
36
35
  type: `transaction_update`
37
36
  timestamp: number
@@ -73,7 +72,7 @@ export function createTimeline<ManagedAtom extends TimelineManageable>(
73
72
  transactionKey: null,
74
73
  ...data,
75
74
  history: data?.history.map((update) => ({ ...update })) ?? [],
76
- install: (store) => createTimeline(options, store, tl),
75
+ install: (s) => createTimeline(options, s, tl),
77
76
  subject: new Subject(),
78
77
  }
79
78
  if (options.shouldCapture) {
@@ -1,15 +1,15 @@
1
- import type { TransactionToken, ƒn } from "atom.io"
1
+ import type { TransactionToken, Func } from "atom.io"
2
2
 
3
3
  import { NotFoundError } from "../not-found-error"
4
4
  import type { Store } from "../store"
5
5
  import { withdraw } from "../store"
6
6
 
7
- export function actUponStore extends ƒn>(
8
- token: TransactionToken<ƒ>,
7
+ export function actUponStore<F extends Func>(
8
+ token: TransactionToken<F>,
9
9
  id: string,
10
10
  store: Store,
11
- ): (...parameters: Parameters<ƒ>) => ReturnType<ƒ> {
12
- return (...parameters: Parameters<ƒ>): ReturnType<ƒ> => {
11
+ ): (...parameters: Parameters<F>) => ReturnType<F> {
12
+ return (...parameters: Parameters<F>): ReturnType<F> => {
13
13
  const tx = withdraw(token, store)
14
14
  if (tx) {
15
15
  return tx.run(parameters, id)
@@ -1,4 +1,4 @@
1
- import type { ƒn } from "atom.io"
1
+ import type { Func } from "atom.io"
2
2
 
3
3
  import { ingestTransactionUpdate } from "../ingest-updates"
4
4
  import { newest } from "../lineage"
@@ -7,8 +7,8 @@ import type { Store } from "../store"
7
7
  import { isChildStore, isRootStore } from "./is-root-store"
8
8
  import { setEpochNumberOfAction } from "./set-epoch-number"
9
9
 
10
- export const applyTransaction = extends ƒn>(
11
- output: ReturnType<ƒ>,
10
+ export const applyTransaction = <F extends Func>(
11
+ output: ReturnType<F>,
12
12
  store: Store,
13
13
  ): void => {
14
14
  const child = newest(store)
@@ -65,7 +65,7 @@ export const applyTransaction = <ƒ extends ƒn>(
65
65
  child.transactionMeta.update.epoch,
66
66
  parent,
67
67
  )
68
- const myTransaction = withdraw<ƒ>(
68
+ const myTransaction = withdraw<F>(
69
69
  { key: child.transactionMeta.update.key, type: `transaction` },
70
70
  store,
71
71
  )
@@ -1,4 +1,4 @@
1
- import type { findState, ƒn } from "atom.io"
1
+ import type { findState, Func } from "atom.io"
2
2
 
3
3
  import { Junction } from "~/packages/rel8/junction/src"
4
4
 
@@ -45,21 +45,24 @@ export const buildTransaction = (
45
45
  valueMap: new LazyMap(parent.valueMap),
46
46
  }
47
47
  const epoch = getEpochNumberOfAction(key, store)
48
- const transactionMeta: TransactionProgress<ƒn> = {
49
- phase: `building` as const,
48
+ const transactionMeta: TransactionProgress<Func> = {
49
+ phase: `building`,
50
50
  update: {
51
51
  key,
52
52
  id,
53
- epoch: epoch === undefined ? NaN : epoch + 1,
53
+ epoch: epoch === undefined ? Number.NaN : epoch + 1,
54
54
  updates: [],
55
55
  params,
56
56
  output: undefined,
57
57
  },
58
58
  transactors: {
59
59
  get: (token) => getFromStore(token, child),
60
- set: (token, value) => setIntoStore(token, value, child),
61
- run: (token, id = arbitrary()) => actUponStore(token, id, child),
62
- find: ((token, key) => findInStore(token, key, child)) as typeof findState,
60
+ set: (token, value) => {
61
+ setIntoStore(token, value, child)
62
+ },
63
+ run: (token, identifier = arbitrary()) =>
64
+ actUponStore(token, identifier, child),
65
+ find: ((token, k) => findInStore(token, k, child)) as typeof findState,
63
66
  env: () => getEnvironmentData(child),
64
67
  },
65
68
  }
@@ -2,7 +2,7 @@ import type {
2
2
  TransactionOptions,
3
3
  TransactionToken,
4
4
  TransactionUpdate,
5
- ƒn,
5
+ Func,
6
6
  } from "atom.io"
7
7
 
8
8
  import { newest } from "../lineage"
@@ -13,22 +13,22 @@ import { abortTransaction } from "./abort-transaction"
13
13
  import { applyTransaction } from "./apply-transaction"
14
14
  import { buildTransaction } from "./build-transaction"
15
15
 
16
- export type Transaction extends ƒn> = {
16
+ export type Transaction<F extends Func> = {
17
17
  key: string
18
18
  type: `transaction`
19
19
  install: (store: Store) => void
20
- subject: Subject<TransactionUpdate<ƒ>>
21
- run: (parameters: Parameters<ƒ>, id?: string) => ReturnType<ƒ>
20
+ subject: Subject<TransactionUpdate<F>>
21
+ run: (parameters: Parameters<F>, id?: string) => ReturnType<F>
22
22
  }
23
23
 
24
- export function createTransaction extends ƒn>(
25
- options: TransactionOptions<ƒ>,
24
+ export function createTransaction<F extends Func>(
25
+ options: TransactionOptions<F>,
26
26
  store: Store,
27
- ): TransactionToken<ƒ> {
28
- const newTransaction: Transaction<ƒ> = {
27
+ ): TransactionToken<F> {
28
+ const newTransaction: Transaction<F> = {
29
29
  key: options.key,
30
30
  type: `transaction`,
31
- run: (params: Parameters<ƒ>, id: string) => {
31
+ run: (params: Parameters<F>, id: string) => {
32
32
  const childStore = buildTransaction(options.key, params, store, id)
33
33
  try {
34
34
  const target = newest(store)
@@ -42,7 +42,7 @@ export function createTransaction<ƒ extends ƒn>(
42
42
  throw thrown
43
43
  }
44
44
  },
45
- install: (store) => createTransaction(options, store),
45
+ install: (s) => createTransaction(options, s),
46
46
  subject: new Subject(),
47
47
  }
48
48
  const target = newest(store)
@@ -1,4 +1,4 @@
1
- import type { TransactionUpdate, TransactorsWithRunAndEnv, ƒn } from "atom.io"
1
+ import type { TransactionUpdate, TransactorsWithRunAndEnv, Func } from "atom.io"
2
2
  import type { Junction } from "rel8/junction"
3
3
 
4
4
  export * from "./abort-transaction"
@@ -14,9 +14,9 @@ export * from "./set-epoch-number"
14
14
  export const TRANSACTION_PHASES = [`idle`, `building`, `applying`] as const
15
15
  export type TransactionPhase = (typeof TRANSACTION_PHASES)[number]
16
16
 
17
- export type TransactionProgress extends ƒn> = {
17
+ export type TransactionProgress<F extends Func> = {
18
18
  phase: `applying` | `building`
19
- update: TransactionUpdate<ƒ>
19
+ update: TransactionUpdate<F>
20
20
  transactors: TransactorsWithRunAndEnv
21
21
  }
22
22
 
@@ -1,4 +1,4 @@
1
- import type { ƒn } from "atom.io"
1
+ import type { Func } from "atom.io"
2
2
 
3
3
  import type { TransactionEpoch, TransactionProgress } from "."
4
4
  import type { Store } from "../store"
@@ -9,7 +9,7 @@ export interface RootStore extends Store {
9
9
  child: ChildStore | null
10
10
  }
11
11
  export interface ChildStore extends Store {
12
- transactionMeta: TransactionProgress<ƒn>
12
+ transactionMeta: TransactionProgress<Func>
13
13
  parent: ChildStore | RootStore
14
14
  child: ChildStore | null
15
15
  }
@@ -42,12 +42,13 @@ var __spreadValues = (a, b) => {
42
42
  };
43
43
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
44
44
  var attachAtomIndex = (store = Internal.IMPLICIT.STORE) => {
45
+ console.log(store.config);
45
46
  const atomTokenIndexState__INTERNAL = Internal.createRegularAtom(
46
47
  {
47
48
  key: `\u{1F441}\u200D\u{1F5E8} Atom Token Index (Internal)`,
48
49
  default: () => {
49
- const defaultAtomIndex = [...store.atoms].filter(([key]) => !key.includes(`\u{1F441}\u200D\u{1F5E8}`)).reduce((acc, [key]) => {
50
- acc[key] = { key, type: `atom` };
50
+ const defaultAtomIndex = [...store.atoms].filter(([key]) => !key.includes(`\u{1F441}\u200D\u{1F5E8}`)).reduce((acc, [key, atom]) => {
51
+ acc[key] = { key, type: atom.type };
51
52
  return acc;
52
53
  }, {});
53
54
  return defaultAtomIndex;
@@ -1,24 +1,24 @@
1
- import { RegularAtomToken, ReadonlySelectorToken, WritableSelectorToken, TransactionToken, ƒn as _n, ReadonlySelectorFamilyToken, TransactionUpdate, TimelineToken } from 'atom.io';
1
+ import { AtomToken, ReadonlySelectorToken, WritableSelectorToken, TransactionToken, Func, ReadonlySelectorFamilyToken, TransactionUpdate, TimelineToken } from 'atom.io';
2
2
  import * as Internal from 'atom.io/internal';
3
3
  import { Timeline } from 'atom.io/internal';
4
4
 
5
- type AtomTokenIndex = WritableTokenIndex<RegularAtomToken<unknown>>;
5
+ type AtomTokenIndex = WritableTokenIndex<AtomToken<unknown>>;
6
6
 
7
7
  type SelectorTokenIndex = WritableTokenIndex<ReadonlySelectorToken<unknown> | WritableSelectorToken<unknown>>;
8
8
 
9
9
  declare const attachIntrospectionStates: (store?: Internal.Store) => {
10
10
  atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
11
11
  selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
12
- transactionIndex: ReadonlySelectorToken<TransactionToken<_n>[]>;
13
- findTransactionLogState: ReadonlySelectorFamilyToken<TransactionUpdate<_n>[], string>;
12
+ transactionIndex: ReadonlySelectorToken<TransactionToken<Func>[]>;
13
+ findTransactionLogState: ReadonlySelectorFamilyToken<TransactionUpdate<Func>[], string>;
14
14
  timelineIndex: ReadonlySelectorToken<TimelineToken<any>[]>;
15
15
  findTimelineState: ReadonlySelectorFamilyToken<Timeline<any>, string>;
16
16
  };
17
17
 
18
- type FamilyNode<Token extends ReadonlySelectorToken<unknown> | RegularAtomToken<unknown> | WritableSelectorToken<unknown>> = {
18
+ type FamilyNode<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | WritableSelectorToken<unknown>> = {
19
19
  key: string;
20
20
  familyMembers: Record<string, Token>;
21
21
  };
22
- type WritableTokenIndex<Token extends ReadonlySelectorToken<unknown> | RegularAtomToken<unknown> | WritableSelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
22
+ type WritableTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | WritableSelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
23
23
 
24
24
  export { type FamilyNode, type WritableTokenIndex, attachIntrospectionStates };
@@ -3,12 +3,13 @@ import * as Internal from 'atom.io/internal';
3
3
  import { createRegularAtom, newest, createStandaloneSelector, IMPLICIT, createRegularAtomFamily, Subject, createSelectorFamily } from 'atom.io/internal';
4
4
 
5
5
  var attachAtomIndex = (store = IMPLICIT.STORE) => {
6
+ console.log(store.config);
6
7
  const atomTokenIndexState__INTERNAL = createRegularAtom(
7
8
  {
8
9
  key: `\u{1F441}\u200D\u{1F5E8} Atom Token Index (Internal)`,
9
10
  default: () => {
10
- const defaultAtomIndex = [...store.atoms].filter(([key]) => !key.includes(`\u{1F441}\u200D\u{1F5E8}`)).reduce((acc, [key]) => {
11
- acc[key] = { key, type: `atom` };
11
+ const defaultAtomIndex = [...store.atoms].filter(([key]) => !key.includes(`\u{1F441}\u200D\u{1F5E8}`)).reduce((acc, [key, atom]) => {
12
+ acc[key] = { key, type: atom.type };
12
13
  return acc;
13
14
  }, {});
14
15
  return defaultAtomIndex;
@@ -1,4 +1,4 @@
1
- import type { ReadonlySelectorToken, RegularAtomToken } from "atom.io"
1
+ import type { AtomToken, ReadonlySelectorToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import {
4
4
  IMPLICIT,
@@ -9,19 +9,20 @@ import {
9
9
 
10
10
  import type { WritableTokenIndex } from "."
11
11
 
12
- export type AtomTokenIndex = WritableTokenIndex<RegularAtomToken<unknown>>
12
+ export type AtomTokenIndex = WritableTokenIndex<AtomToken<unknown>>
13
13
 
14
14
  export const attachAtomIndex = (
15
15
  store: Store = IMPLICIT.STORE,
16
16
  ): ReadonlySelectorToken<AtomTokenIndex> => {
17
+ console.log(store.config)
17
18
  const atomTokenIndexState__INTERNAL = createRegularAtom<AtomTokenIndex>(
18
19
  {
19
20
  key: `👁‍🗨 Atom Token Index (Internal)`,
20
21
  default: () => {
21
22
  const defaultAtomIndex = [...store.atoms]
22
23
  .filter(([key]) => !key.includes(`👁‍🗨`))
23
- .reduce<AtomTokenIndex>((acc, [key]) => {
24
- acc[key] = { key, type: `atom` }
24
+ .reduce<AtomTokenIndex>((acc, [key, atom]) => {
25
+ acc[key] = { key, type: atom.type }
25
26
  return acc
26
27
  }, {})
27
28
  return defaultAtomIndex
@@ -5,7 +5,7 @@ import type {
5
5
  TimelineToken,
6
6
  TransactionToken,
7
7
  TransactionUpdate,
8
- ƒn,
8
+ Func,
9
9
  } from "atom.io"
10
10
  import * as Internal from "atom.io/internal"
11
11
  import type { Timeline } from "atom.io/internal"
@@ -23,9 +23,9 @@ export const attachIntrospectionStates = (
23
23
  ): {
24
24
  atomIndex: ReadonlySelectorToken<AtomTokenIndex>
25
25
  selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>
26
- transactionIndex: ReadonlySelectorToken<TransactionToken<ƒn>[]>
26
+ transactionIndex: ReadonlySelectorToken<TransactionToken<Func>[]>
27
27
  findTransactionLogState: ReadonlySelectorFamilyToken<
28
- TransactionUpdate<ƒn>[],
28
+ TransactionUpdate<Func>[],
29
29
  string
30
30
  >
31
31
  timelineIndex: ReadonlySelectorToken<TimelineToken<any>[]>
@@ -1,4 +1,4 @@
1
- import type { ReadonlySelectorToken, TransactionToken, ƒn } from "atom.io"
1
+ import type { ReadonlySelectorToken, TransactionToken, Func } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import {
4
4
  IMPLICIT,
@@ -8,14 +8,14 @@ import {
8
8
 
9
9
  export const attachTransactionIndex = (
10
10
  store: Store = IMPLICIT.STORE,
11
- ): ReadonlySelectorToken<TransactionToken<ƒn>[]> => {
11
+ ): ReadonlySelectorToken<TransactionToken<Func>[]> => {
12
12
  const transactionTokenIndexState__INTERNAL = createRegularAtom<
13
- TransactionToken<ƒn>[]
13
+ TransactionToken<Func>[]
14
14
  >(
15
15
  {
16
16
  key: `👁‍🗨 Transaction Token Index (Internal)`,
17
17
  default: () =>
18
- [...store.transactions].map(([key]): TransactionToken<ƒn> => {
18
+ [...store.transactions].map(([key]): TransactionToken<Func> => {
19
19
  return { key, type: `transaction` }
20
20
  }),
21
21
  effects: [
@@ -1,4 +1,8 @@
1
- import type { ReadonlySelectorFamilyToken, TransactionUpdate, ƒn } from "atom.io"
1
+ import type {
2
+ ReadonlySelectorFamilyToken,
3
+ TransactionUpdate,
4
+ Func,
5
+ } from "atom.io"
2
6
  import type { Store } from "atom.io/internal"
3
7
  import {
4
8
  IMPLICIT,
@@ -8,9 +12,9 @@ import {
8
12
 
9
13
  export const attachTransactionLogs = (
10
14
  store: Store = IMPLICIT.STORE,
11
- ): ReadonlySelectorFamilyToken<TransactionUpdate<ƒn>[], string> => {
15
+ ): ReadonlySelectorFamilyToken<TransactionUpdate<Func>[], string> => {
12
16
  const findTransactionUpdateLog = createRegularAtomFamily<
13
- TransactionUpdate<ƒn>[],
17
+ TransactionUpdate<Func>[],
14
18
  string
15
19
  >(
16
20
  {
@@ -30,7 +34,7 @@ export const attachTransactionLogs = (
30
34
  store,
31
35
  )
32
36
  const findTransactionUpdateLogState = createSelectorFamily<
33
- TransactionUpdate<ƒn>[],
37
+ TransactionUpdate<Func>[],
34
38
  string
35
39
  >(
36
40
  {
@@ -1,6 +1,6 @@
1
1
  import type {
2
+ AtomToken,
2
3
  ReadonlySelectorToken,
3
- RegularAtomToken,
4
4
  WritableSelectorToken,
5
5
  } from "atom.io"
6
6
 
@@ -8,8 +8,8 @@ export * from "./attach-introspection-states"
8
8
 
9
9
  export type FamilyNode<
10
10
  Token extends
11
+ | AtomToken<unknown>
11
12
  | ReadonlySelectorToken<unknown>
12
- | RegularAtomToken<unknown>
13
13
  | WritableSelectorToken<unknown>,
14
14
  > = {
15
15
  key: string
@@ -18,7 +18,7 @@ export type FamilyNode<
18
18
 
19
19
  export type WritableTokenIndex<
20
20
  Token extends
21
+ | AtomToken<unknown>
21
22
  | ReadonlySelectorToken<unknown>
22
- | RegularAtomToken<unknown>
23
23
  | WritableSelectorToken<unknown>,
24
24
  > = Record<string, FamilyNode<Token> | Token>
@@ -49,7 +49,9 @@ var selectJson = (atom, transform, store = internal.IMPLICIT.STORE) => {
49
49
  {
50
50
  key: `${atom.key}:JSON`,
51
51
  get: ({ get }) => transform.toJson(get(atom)),
52
- set: ({ set }, newValue) => set(atom, transform.fromJson(newValue))
52
+ set: ({ set }, newValue) => {
53
+ set(atom, transform.fromJson(newValue));
54
+ }
53
55
  },
54
56
  store
55
57
  );
@@ -59,7 +61,9 @@ function selectJsonFamily(atomFamily, transform, store = internal.IMPLICIT.STORE
59
61
  {
60
62
  key: `${atomFamily.key}:JSON`,
61
63
  get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
62
- set: (key) => ({ set }, newValue) => set(atomFamily(key), transform.fromJson(newValue))
64
+ set: (key) => ({ set }, newValue) => {
65
+ set(atomFamily(key), transform.fromJson(newValue));
66
+ }
63
67
  },
64
68
  store
65
69
  );
@@ -26,7 +26,7 @@ declare namespace json {
26
26
  export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
27
27
  }
28
28
 
29
- declare const parseJson: <S extends Stringified<Serializable>>(str: string | S) => S extends Stringified<infer J extends Serializable> ? J : Serializable;
29
+ declare const parseJson: <S extends Stringified<Serializable>>(str: S | string) => S extends Stringified<infer J extends Serializable> ? J : Serializable;
30
30
  type Stringified<J extends Serializable> = string & {
31
31
  __json: J;
32
32
  };
@@ -1,5 +1,5 @@
1
- import { parseJson } from '../../dist/chunk-VAE5OCKN.js';
2
- export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-VAE5OCKN.js';
1
+ import { parseJson } from '../../dist/chunk-BF4MVQF6.js';
2
+ export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-BF4MVQF6.js';
3
3
  import '../../dist/chunk-U2IICNHQ.js';
4
4
  import { createStandaloneSelector, IMPLICIT, createSelectorFamily } from 'atom.io/internal';
5
5
 
@@ -8,7 +8,9 @@ var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
8
8
  {
9
9
  key: `${atom.key}:JSON`,
10
10
  get: ({ get }) => transform.toJson(get(atom)),
11
- set: ({ set }, newValue) => set(atom, transform.fromJson(newValue))
11
+ set: ({ set }, newValue) => {
12
+ set(atom, transform.fromJson(newValue));
13
+ }
12
14
  },
13
15
  store
14
16
  );
@@ -18,7 +20,9 @@ function selectJsonFamily(atomFamily, transform, store = IMPLICIT.STORE) {
18
20
  {
19
21
  key: `${atomFamily.key}:JSON`,
20
22
  get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
21
- set: (key) => ({ set }, newValue) => set(atomFamily(key), transform.fromJson(newValue))
23
+ set: (key) => ({ set }, newValue) => {
24
+ set(atomFamily(key), transform.fromJson(newValue));
25
+ }
22
26
  },
23
27
  store
24
28
  );
@@ -43,8 +43,9 @@ export function selectJsonFamily<
43
43
  transform.toJson(get(atomFamily(key))),
44
44
  set:
45
45
  (key) =>
46
- ({ set }, newValue) =>
47
- set(atomFamily(key), transform.fromJson(newValue)),
46
+ ({ set }, newValue) => {
47
+ set(atomFamily(key), transform.fromJson(newValue))
48
+ },
48
49
  },
49
50
  store,
50
51
  )
@@ -14,7 +14,9 @@ export const selectJson = <T, J extends Json.Serializable>(
14
14
  {
15
15
  key: `${atom.key}:JSON`,
16
16
  get: ({ get }) => transform.toJson(get(atom)),
17
- set: ({ set }, newValue) => set(atom, transform.fromJson(newValue)),
17
+ set: ({ set }, newValue) => {
18
+ set(atom, transform.fromJson(newValue))
19
+ },
18
20
  },
19
21
  store,
20
22
  )