effect 4.0.0-beta.87 → 4.0.0-beta.89
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/Effect.d.ts +5 -2
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +4 -1
- package/dist/Effect.js.map +1 -1
- package/dist/Latch.d.ts +19 -0
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +11 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Schema.d.ts +14 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +14 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +17 -5
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +22 -7
- package/dist/SchemaAST.js.map +1 -1
- package/dist/internal/effect.js +17 -15
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +4 -0
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +56 -20
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +2 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +106 -3
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +397 -5
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +4 -4
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/package.json +1 -1
- package/src/Effect.ts +10 -4
- package/src/Latch.ts +21 -0
- package/src/Schema.ts +14 -1
- package/src/SchemaAST.ts +23 -7
- package/src/internal/effect.ts +30 -18
- package/src/unstable/http/HttpClient.ts +115 -24
- package/src/unstable/observability/OtlpTracer.ts +2 -1
- package/src/unstable/persistence/RateLimiter.ts +599 -5
- package/src/unstable/rpc/RpcServer.ts +4 -4
package/dist/Effect.d.ts
CHANGED
|
@@ -2176,7 +2176,9 @@ export declare const fromResult: <A, E>(result: Result.Result<A, E>) => Effect<A
|
|
|
2176
2176
|
* **Details**
|
|
2177
2177
|
*
|
|
2178
2178
|
* `Option.some` becomes a successful effect with the contained value, while
|
|
2179
|
-
* `Option.none` becomes a failed effect
|
|
2179
|
+
* `Option.none` becomes a failed effect. By default the failure is a
|
|
2180
|
+
* `NoSuchElementError`, but you can provide an `onNone` callback to customize
|
|
2181
|
+
* the error value.
|
|
2180
2182
|
*
|
|
2181
2183
|
* **Example** (Converting an Option into an Effect)
|
|
2182
2184
|
*
|
|
@@ -2188,6 +2190,7 @@ export declare const fromResult: <A, E>(result: Result.Result<A, E>) => Effect<A
|
|
|
2188
2190
|
*
|
|
2189
2191
|
* const effect1 = Effect.fromOption(some)
|
|
2190
2192
|
* const effect2 = Effect.fromOption(none)
|
|
2193
|
+
* const effect3 = Effect.fromOption(none, () => new Error("missing"))
|
|
2191
2194
|
*
|
|
2192
2195
|
* Effect.runPromise(effect1).then(console.log) // 42
|
|
2193
2196
|
* Effect.runPromiseExit(effect2).then(console.log)
|
|
@@ -2197,7 +2200,7 @@ export declare const fromResult: <A, E>(result: Result.Result<A, E>) => Effect<A
|
|
|
2197
2200
|
* @category converting
|
|
2198
2201
|
* @since 4.0.0
|
|
2199
2202
|
*/
|
|
2200
|
-
export declare const fromOption: <A>(option: Option<A>) => Effect<A,
|
|
2203
|
+
export declare const fromOption: <Arg extends Option<unknown> | LazyArg<unknown>, E = Cause.NoSuchElementError>(arg: Arg, ...rest: [Arg] extends [Option<unknown>] ? [onNone?: LazyArg<E>] : []) => [Arg] extends [Option<infer A>] ? Effect<A, E> : [Arg] extends [LazyArg<infer E>] ? <A>(option: Option<A>) => Effect<A, E> : never;
|
|
2201
2204
|
/**
|
|
2202
2205
|
* Converts an `Option` of an `Effect` into an `Effect` of an `Option`.
|
|
2203
2206
|
*
|