atom.io 0.10.1 → 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 +64 -32
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +63 -33
  6. package/dist/index.mjs.map +1 -1
  7. package/internal/dist/index.js +251 -110
  8. package/internal/dist/index.js.map +1 -1
  9. package/internal/dist/index.mjs +251 -110
  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 +23 -4
  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 +6 -3
  25. package/internal/src/set-state/evict-downstream.ts +15 -14
  26. package/internal/src/set-state/set-atom.ts +1 -1
  27. package/internal/src/set-state/stow-update.ts +9 -4
  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 +10 -2
  37. package/internal/src/transaction/apply-transaction.ts +22 -5
  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 +3 -3
  43. package/realtime-client/dist/index.js +30 -5
  44. package/realtime-client/dist/index.js.map +1 -1
  45. package/realtime-client/dist/index.mjs +30 -5
  46. package/realtime-client/dist/index.mjs.map +1 -1
  47. package/realtime-client/src/use-server-action.ts +30 -5
  48. package/src/logger.ts +82 -14
  49. package/src/subscribe.ts +30 -7
package/src/subscribe.ts CHANGED
@@ -32,19 +32,27 @@ 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
 
39
39
  const unsubscribe =
40
40
  dependencyUnsubFunctions === null
41
41
  ? () => {
42
- store.logger.info(`🙈 unsubscribe from "${state.key}"`)
42
+ store.logger.info(
43
+ `🙈`,
44
+ state.type,
45
+ state.key,
46
+ `Removing subscription "${key}"`,
47
+ )
43
48
  unsubFunction()
44
49
  }
45
50
  : () => {
46
51
  store.logger.info(
47
- `🙈 unsubscribe from "${state.key}" and its dependencies`,
52
+ `🙈`,
53
+ state.type,
54
+ state.key,
55
+ `Removing subscription "${key}"`,
48
56
  )
49
57
  unsubFunction()
50
58
  for (const unsubFromDependency of dependencyUnsubFunctions) {
@@ -71,10 +79,20 @@ export const subscribeToTransaction = <ƒ extends ƒn>(
71
79
  `Cannot subscribe to transaction "${token.key}": transaction not found in store "${store.config.name}".`,
72
80
  )
73
81
  }
74
- store.logger.info(`👀 subscribe to transaction "${token.key}"`)
82
+ store.logger.info(
83
+ `👀`,
84
+ `transaction`,
85
+ token.key,
86
+ `Adding subscription "${key}"`,
87
+ )
75
88
  const unsubscribe = tx.subject.subscribe(key, handleUpdate)
76
89
  return () => {
77
- store.logger.info(`🙈 unsubscribe from transaction "${token.key}"`)
90
+ store.logger.info(
91
+ `🙈`,
92
+ `transaction`,
93
+ token.key,
94
+ `Removing subscription "${key}"`,
95
+ )
78
96
  unsubscribe()
79
97
  }
80
98
  }
@@ -91,10 +109,15 @@ export const subscribeToTimeline = (
91
109
  `Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`,
92
110
  )
93
111
  }
94
- store.logger.info(`👀 subscribe to timeline "${token.key}"`)
112
+ store.logger.info(`👀`, `timeline`, token.key, `Adding subscription "${key}"`)
95
113
  const unsubscribe = tl.subject.subscribe(key, handleUpdate)
96
114
  return () => {
97
- store.logger.info(`🙈 unsubscribe from timeline "${token.key}"`)
115
+ store.logger.info(
116
+ `🙈`,
117
+ `timeline`,
118
+ token.key,
119
+ `Removing subscription "${key}" from timeline`,
120
+ )
98
121
  unsubscribe()
99
122
  }
100
123
  }