atom.io 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/index.d.mts +53 -8
  2. package/dist/index.d.ts +53 -8
  3. package/dist/index.js +56 -32
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +55 -33
  6. package/dist/index.mjs.map +1 -1
  7. package/internal/dist/index.js +239 -113
  8. package/internal/dist/index.js.map +1 -1
  9. package/internal/dist/index.mjs +239 -113
  10. package/internal/dist/index.mjs.map +1 -1
  11. package/internal/src/atom/create-atom.ts +15 -4
  12. package/internal/src/atom/delete-atom.ts +1 -1
  13. package/internal/src/caching.ts +4 -4
  14. package/internal/src/get-state-internal.ts +3 -5
  15. package/internal/src/mutable/create-mutable-atom.ts +4 -10
  16. package/internal/src/operation.ts +20 -7
  17. package/internal/src/selector/create-read-write-selector.ts +12 -2
  18. package/internal/src/selector/create-readonly-selector.ts +7 -1
  19. package/internal/src/selector/create-selector.ts +4 -5
  20. package/internal/src/selector/register-selector.ts +7 -1
  21. package/internal/src/selector/update-selector-atoms.ts +10 -3
  22. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  23. package/internal/src/set-state/copy-mutable-in-transaction.ts +0 -3
  24. package/internal/src/set-state/emit-update.ts +5 -5
  25. package/internal/src/set-state/evict-downstream.ts +10 -13
  26. package/internal/src/set-state/set-atom.ts +1 -1
  27. package/internal/src/set-state/stow-update.ts +9 -3
  28. package/internal/src/store/store.ts +8 -19
  29. package/internal/src/store/withdraw-new-family-member.ts +4 -1
  30. package/internal/src/store/withdraw.ts +6 -1
  31. package/internal/src/subscribe/recall-state.ts +4 -1
  32. package/internal/src/subscribe/subscribe-to-root-atoms.ts +11 -5
  33. package/internal/src/timeline/add-atom-to-timeline.ts +40 -9
  34. package/internal/src/timeline/time-travel-internal.ts +26 -8
  35. package/internal/src/timeline/timeline-internal.ts +8 -2
  36. package/internal/src/transaction/abort-transaction.ts +7 -2
  37. package/internal/src/transaction/apply-transaction.ts +21 -7
  38. package/internal/src/transaction/build-transaction.ts +5 -1
  39. package/internal/src/transaction/redo-transaction.ts +1 -1
  40. package/internal/src/transaction/transaction-internal.ts +1 -4
  41. package/internal/src/transaction/undo-transaction.ts +7 -1
  42. package/package.json +2 -2
  43. package/realtime-client/dist/index.js +24 -5
  44. package/realtime-client/dist/index.js.map +1 -1
  45. package/realtime-client/dist/index.mjs +24 -5
  46. package/realtime-client/dist/index.mjs.map +1 -1
  47. package/realtime-client/src/use-server-action.ts +24 -5
  48. package/src/logger.ts +82 -14
  49. package/src/subscribe.ts +22 -7
package/src/subscribe.ts CHANGED
@@ -32,7 +32,7 @@ export function subscribe<T>(
32
32
  )
33
33
  }
34
34
  const unsubFunction = state.subject.subscribe(key, handleUpdate)
35
- store.logger.info(`👀 Adding subscription "${key}" to "${state.key}"`)
35
+ store.logger.info(`👀`, state.type, state.key, `Adding subscription "${key}"`)
36
36
  const dependencyUnsubFunctions =
37
37
  state.type !== `atom` ? subscribeToRootAtoms(state, store) : null
38
38
 
@@ -40,13 +40,19 @@ export function subscribe<T>(
40
40
  dependencyUnsubFunctions === null
41
41
  ? () => {
42
42
  store.logger.info(
43
- `🙈 Removing subscription "${key}" from "${state.key}"`,
43
+ `🙈`,
44
+ state.type,
45
+ state.key,
46
+ `Removing subscription "${key}"`,
44
47
  )
45
48
  unsubFunction()
46
49
  }
47
50
  : () => {
48
51
  store.logger.info(
49
- `🙈 Removing subscription ${key} from "${state.key}" and its dependencies`,
52
+ `🙈`,
53
+ state.type,
54
+ state.key,
55
+ `Removing subscription "${key}"`,
50
56
  )
51
57
  unsubFunction()
52
58
  for (const unsubFromDependency of dependencyUnsubFunctions) {
@@ -74,12 +80,18 @@ export const subscribeToTransaction = <ƒ extends ƒn>(
74
80
  )
75
81
  }
76
82
  store.logger.info(
77
- `👀 Adding subscription "${key}" to transaction "${token.key}"`,
83
+ `👀`,
84
+ `transaction`,
85
+ token.key,
86
+ `Adding subscription "${key}"`,
78
87
  )
79
88
  const unsubscribe = tx.subject.subscribe(key, handleUpdate)
80
89
  return () => {
81
90
  store.logger.info(
82
- `🙈 Removing subscription "${key}" from transaction "${token.key}"`,
91
+ `🙈`,
92
+ `transaction`,
93
+ token.key,
94
+ `Removing subscription "${key}"`,
83
95
  )
84
96
  unsubscribe()
85
97
  }
@@ -97,11 +109,14 @@ export const subscribeToTimeline = (
97
109
  `Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`,
98
110
  )
99
111
  }
100
- store.logger.info(`👀 Adding subscription "${key}" to timeline "${token.key}"`)
112
+ store.logger.info(`👀`, `timeline`, token.key, `Adding subscription "${key}"`)
101
113
  const unsubscribe = tl.subject.subscribe(key, handleUpdate)
102
114
  return () => {
103
115
  store.logger.info(
104
- `🙈 Removing subscription "${key}" from timeline "${token.key}"`,
116
+ `🙈`,
117
+ `timeline`,
118
+ token.key,
119
+ `Removing subscription "${key}" from timeline`,
105
120
  )
106
121
  unsubscribe()
107
122
  }