effect 4.0.0-beta.1 → 4.0.0-beta.2
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 +27 -0
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +27 -0
- package/dist/Effect.js.map +1 -1
- package/dist/internal/effect.js +6 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +4 -4
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +2 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +13 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/sql/SqlModel.js +3 -3
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +13 -1
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +12 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/Effect.ts +30 -0
- package/src/internal/effect.ts +13 -0
- package/src/unstable/schema/VariantSchema.ts +36 -7
- package/src/unstable/sql/SqlModel.ts +3 -3
- package/src/unstable/sql/SqlSchema.ts +34 -1
package/dist/Effect.d.ts
CHANGED
|
@@ -4704,6 +4704,33 @@ export declare const catchIf: {
|
|
|
4704
4704
|
*/
|
|
4705
4705
|
<A, E, R, Result extends Filter.ResultOrBool, A2, E2, R2, A3 = never, E3 = Filter.Fail<E, Result>, R3 = never>(self: Effect<A, E, R>, filter: Filter.OrPredicate<NoInfer<E>, Result>, f: (e: Filter.Pass<E, Result>) => Effect<A2, E2, R2>, orElse?: ((e: Filter.Fail<E, Result>) => Effect<A3, E3, R3>) | undefined): Effect<A | A2 | A3, E2 | E3, R | R2 | R3>;
|
|
4706
4706
|
};
|
|
4707
|
+
/**
|
|
4708
|
+
* Catches `NoSuchElementError` failures and converts them to `Option.none`.
|
|
4709
|
+
*
|
|
4710
|
+
* Success values become `Option.some`, `NoSuchElementError` becomes
|
|
4711
|
+
* `Option.none`, and all other errors are preserved.
|
|
4712
|
+
*
|
|
4713
|
+
* @example
|
|
4714
|
+
* ```ts
|
|
4715
|
+
* import { Effect, Option } from "effect"
|
|
4716
|
+
*
|
|
4717
|
+
* const some = Effect.fromNullishOr(1).pipe(Effect.catchNoSuchElement)
|
|
4718
|
+
* const none = Effect.fromNullishOr(null).pipe(Effect.catchNoSuchElement)
|
|
4719
|
+
*
|
|
4720
|
+
* Effect.runPromise(some).then(console.log) // { _id: 'Option', _tag: 'Some', value: 1 }
|
|
4721
|
+
* Effect.runPromise(none).then(console.log) // { _id: 'Option', _tag: 'None' }
|
|
4722
|
+
* ```
|
|
4723
|
+
*
|
|
4724
|
+
* **Previously Known As**
|
|
4725
|
+
*
|
|
4726
|
+
* This API replaces the following from Effect 3.x:
|
|
4727
|
+
*
|
|
4728
|
+
* - `Effect.optionFromOptional`
|
|
4729
|
+
*
|
|
4730
|
+
* @since 2.0.0
|
|
4731
|
+
* @category Error Handling
|
|
4732
|
+
*/
|
|
4733
|
+
export declare const catchNoSuchElement: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A>, Exclude<E, Cause.NoSuchElementError>, R>;
|
|
4707
4734
|
/**
|
|
4708
4735
|
* Recovers from specific failures based on a predicate.
|
|
4709
4736
|
*
|