@exodus/atoms 2.9.1 → 2.10.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/atoms",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
4
4
  "main": "src/index.js",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "scripts": {
@@ -21,6 +21,7 @@
21
21
  "url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Aatom"
22
22
  },
23
23
  "dependencies": {
24
+ "events": "^1.1.1",
24
25
  "lodash": "^4.17.21",
25
26
  "make-concurrent": ">=4 <6",
26
27
  "p-defer": "^4.0.0",
@@ -31,5 +32,5 @@
31
32
  "delay": "^5.0.0",
32
33
  "jest": "^29.1.2"
33
34
  },
34
- "gitHead": "4c0fd59736ac29113f8b87c89ad3e8e87615b21b"
35
+ "gitHead": "a98fe18a3362a8006fad096cbc31360fa9ad7263"
35
36
  }
@@ -0,0 +1,11 @@
1
+ import enforceObservableRules from '../enforce-rules'
2
+
3
+ const readOnly = (atom) => {
4
+ const set = async () => {
5
+ throw new Error('selected atom does not support set')
6
+ }
7
+
8
+ return enforceObservableRules({ ...atom, set })
9
+ }
10
+
11
+ export default readOnly
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from 'events'
1
+ import EventEmitter from 'events/' // '/' forces it to use the module from node_modules
2
2
 
3
3
  import fromEventEmitter from '../event-emitter'
4
4
  import pDefer from 'p-defer'
package/src/index.js CHANGED
@@ -12,3 +12,4 @@ export { default as blockUntil } from './enhancers/block-until'
12
12
  export { default as difference } from './enhancers/difference'
13
13
  export { default as withSerialization } from './enhancers/with-serialization'
14
14
  export { default as combine } from './enhancers/combine'
15
+ export { default as readOnly } from './enhancers/read-only'