@effect-atom/atom 0.4.10 → 0.4.12
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/dist/cjs/Atom.js +10 -12
- package/dist/cjs/Atom.js.map +1 -1
- package/dist/cjs/AtomRef.js +2 -6
- package/dist/cjs/AtomRef.js.map +1 -1
- package/dist/cjs/Registry.js +2 -6
- package/dist/cjs/Registry.js.map +1 -1
- package/dist/cjs/Result.js +2 -6
- package/dist/cjs/Result.js.map +1 -1
- package/dist/cjs/internal/registry.js +2 -3
- package/dist/cjs/internal/registry.js.map +1 -1
- package/dist/dts/Atom.d.ts +5 -20
- package/dist/dts/Atom.d.ts.map +1 -1
- package/dist/dts/AtomRef.d.ts +3 -10
- package/dist/dts/AtomRef.d.ts.map +1 -1
- package/dist/dts/Registry.d.ts +2 -10
- package/dist/dts/Registry.d.ts.map +1 -1
- package/dist/dts/Result.d.ts +3 -10
- package/dist/dts/Result.d.ts.map +1 -1
- package/dist/esm/Atom.js +9 -11
- package/dist/esm/Atom.js.map +1 -1
- package/dist/esm/AtomRef.js +1 -5
- package/dist/esm/AtomRef.js.map +1 -1
- package/dist/esm/Registry.js +1 -5
- package/dist/esm/Registry.js.map +1 -1
- package/dist/esm/Result.js +1 -5
- package/dist/esm/Result.js.map +1 -1
- package/dist/esm/internal/registry.js +1 -2
- package/dist/esm/internal/registry.js.map +1 -1
- package/package.json +1 -1
- package/src/Atom.ts +11 -23
- package/src/AtomRef.ts +2 -11
- package/src/Registry.ts +2 -11
- package/src/Result.ts +2 -11
- package/src/internal/registry.ts +3 -3
package/src/Atom.ts
CHANGED
|
@@ -40,17 +40,8 @@ import * as Registry from "./Registry.js"
|
|
|
40
40
|
import { AtomRegistry as AtomRegistry } from "./Registry.js"
|
|
41
41
|
import * as Result from "./Result.js"
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @category type ids
|
|
46
|
-
*/
|
|
47
|
-
export const TypeId: TypeId = "~effect-atom/atom/Atom"
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @since 1.0.0
|
|
51
|
-
* @category type ids
|
|
52
|
-
*/
|
|
53
|
-
export type TypeId = "~effect-atom/atom/Atom"
|
|
43
|
+
const TypeId: TypeId = "~effect-atom/atom/Atom"
|
|
44
|
+
type TypeId = "~effect-atom/atom/Atom"
|
|
54
45
|
|
|
55
46
|
/**
|
|
56
47
|
* @since 1.0.0
|
|
@@ -98,17 +89,8 @@ export type Failure<T extends Atom<any>> = T extends Atom<Result.Result<infer _,
|
|
|
98
89
|
export type WithoutSerializable<T extends Atom<any>> = T extends Writable<infer R, infer W> ? Writable<R, W>
|
|
99
90
|
: Atom<Type<T>>
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
* @category type ids
|
|
104
|
-
*/
|
|
105
|
-
export const WritableTypeId: WritableTypeId = "~effect-atom/atom/Atom/Writable"
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @since 1.0.0
|
|
109
|
-
* @category type ids
|
|
110
|
-
*/
|
|
111
|
-
export type WritableTypeId = "~effect-atom/atom/Atom/Writable"
|
|
92
|
+
type WritableTypeId = "~effect-atom/atom/Atom/Writable"
|
|
93
|
+
const WritableTypeId: WritableTypeId = "~effect-atom/atom/Atom/Writable"
|
|
112
94
|
|
|
113
95
|
/**
|
|
114
96
|
* @since 1.0.0
|
|
@@ -1826,7 +1808,13 @@ export const kvs = <A>(options: {
|
|
|
1826
1808
|
return writable(
|
|
1827
1809
|
(get) => {
|
|
1828
1810
|
get.mount(setAtom)
|
|
1829
|
-
|
|
1811
|
+
const value = Result.value(get(resultAtom))
|
|
1812
|
+
if (Option.isSome(value)) {
|
|
1813
|
+
return value.value
|
|
1814
|
+
}
|
|
1815
|
+
const defaultValue = options.defaultValue()
|
|
1816
|
+
get.set(setAtom, defaultValue)
|
|
1817
|
+
return defaultValue
|
|
1830
1818
|
},
|
|
1831
1819
|
(ctx, value: A) => {
|
|
1832
1820
|
ctx.set(setAtom, value as any)
|
package/src/AtomRef.ts
CHANGED
|
@@ -5,17 +5,8 @@ import * as Equal from "effect/Equal"
|
|
|
5
5
|
import { globalValue } from "effect/GlobalValue"
|
|
6
6
|
import * as Hash from "effect/Hash"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @category type ids
|
|
11
|
-
*/
|
|
12
|
-
export const TypeId: TypeId = "~effect-atom/atom/AtomRef"
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @since 1.0.0
|
|
16
|
-
* @category type ids
|
|
17
|
-
*/
|
|
18
|
-
export type TypeId = "~effect-atom/atom/AtomRef"
|
|
8
|
+
const TypeId: TypeId = "~effect-atom/atom/AtomRef"
|
|
9
|
+
type TypeId = "~effect-atom/atom/AtomRef"
|
|
19
10
|
|
|
20
11
|
/**
|
|
21
12
|
* @since 1.0.0
|
package/src/Registry.ts
CHANGED
|
@@ -15,17 +15,8 @@ import type { Registry } from "./index.js"
|
|
|
15
15
|
import * as internal from "./internal/registry.js"
|
|
16
16
|
import * as Result from "./Result.js"
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @category type ids
|
|
21
|
-
*/
|
|
22
|
-
export const TypeId: TypeId = "~effect-atom/atom/Registry"
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @since 1.0.0
|
|
26
|
-
* @category type ids
|
|
27
|
-
*/
|
|
28
|
-
export type TypeId = "~effect-atom/atom/Registry"
|
|
18
|
+
const TypeId: TypeId = "~effect-atom/atom/Registry"
|
|
19
|
+
type TypeId = "~effect-atom/atom/Registry"
|
|
29
20
|
|
|
30
21
|
/**
|
|
31
22
|
* @since 1.0.0
|
package/src/Result.ts
CHANGED
|
@@ -15,17 +15,8 @@ import { hasProperty, isIterable } from "effect/Predicate"
|
|
|
15
15
|
import * as Schema_ from "effect/Schema"
|
|
16
16
|
import type * as Types from "effect/Types"
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @category type ids
|
|
21
|
-
*/
|
|
22
|
-
export const TypeId = Symbol.for("@effect-atom/atom/Result")
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @since 1.0.0
|
|
26
|
-
* @category type ids
|
|
27
|
-
*/
|
|
28
|
-
export type TypeId = typeof TypeId
|
|
18
|
+
type TypeId = "~effect-atom/atom/Result"
|
|
19
|
+
const TypeId: TypeId = "~effect-atom/atom/Result"
|
|
29
20
|
|
|
30
21
|
/**
|
|
31
22
|
* @since 1.0.0
|
package/src/internal/registry.ts
CHANGED
|
@@ -12,8 +12,8 @@ import * as Result from "../Result.js"
|
|
|
12
12
|
|
|
13
13
|
const constImmediate = { immediate: true }
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type TypeId = "~effect-atom/atom/Registry"
|
|
16
|
+
const TypeId: TypeId = "~effect-atom/atom/Registry" as const
|
|
17
17
|
|
|
18
18
|
/** @internal */
|
|
19
19
|
export const make = (options?: {
|
|
@@ -34,7 +34,7 @@ const atomKey = <A>(atom: Atom.Atom<A>): Atom.Atom<A> | string =>
|
|
|
34
34
|
SerializableTypeId in atom ? (atom as Atom.Serializable<any>)[SerializableTypeId].key : atom
|
|
35
35
|
|
|
36
36
|
class RegistryImpl implements Registry.Registry {
|
|
37
|
-
readonly [TypeId]:
|
|
37
|
+
readonly [TypeId]: TypeId
|
|
38
38
|
readonly timeoutResolution: number
|
|
39
39
|
|
|
40
40
|
constructor(
|