effect 4.0.0-beta.82 → 4.0.0-beta.84
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/Array.d.ts +64 -64
- package/dist/Array.js +26 -26
- package/dist/Cache.d.ts +1 -1
- package/dist/Cache.js +1 -1
- package/dist/Cause.d.ts +68 -68
- package/dist/Cause.js +47 -47
- package/dist/Channel.d.ts +5 -5
- package/dist/Channel.js +3 -3
- package/dist/Clock.d.ts +1 -1
- package/dist/Clock.js +1 -1
- package/dist/Combiner.d.ts +9 -9
- package/dist/Combiner.js +8 -8
- package/dist/Config.d.ts +15 -94
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +22 -70
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +58 -74
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +66 -41
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +1 -1
- package/dist/Console.js +1 -1
- package/dist/Data.d.ts +15 -15
- package/dist/Data.js +3 -3
- package/dist/DateTime.d.ts +6 -6
- package/dist/DateTime.js +2 -2
- package/dist/Duration.d.ts +3 -3
- package/dist/Duration.js +3 -3
- package/dist/Effect.d.ts +84 -45
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +72 -33
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +7 -7
- package/dist/Equal.js +5 -5
- package/dist/Equivalence.d.ts +17 -17
- package/dist/Equivalence.js +13 -13
- package/dist/Exit.d.ts +3 -3
- package/dist/Exit.js +3 -3
- package/dist/Formatter.d.ts +5 -5
- package/dist/Formatter.js +4 -4
- package/dist/Function.d.ts +10 -10
- package/dist/Function.js +3 -3
- package/dist/HashMap.d.ts +3 -3
- package/dist/HashMap.js +1 -1
- package/dist/Iterable.d.ts +6 -6
- package/dist/Iterable.js +2 -2
- package/dist/JsonPatch.d.ts +2 -2
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.js +1 -1
- package/dist/Logger.d.ts +1 -1
- package/dist/Logger.js +1 -1
- package/dist/Match.d.ts +8 -8
- package/dist/Match.js +8 -8
- package/dist/Metric.d.ts +3 -3
- package/dist/Metric.js +3 -3
- package/dist/Optic.d.ts +30 -30
- package/dist/Optic.js +12 -12
- package/dist/Option.d.ts +7 -7
- package/dist/Option.js +7 -7
- package/dist/Order.d.ts +23 -23
- package/dist/Order.js +20 -20
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.js +1 -1
- package/dist/Predicate.d.ts +88 -88
- package/dist/Predicate.js +47 -47
- package/dist/PubSub.d.ts +3 -3
- package/dist/PubSub.js +3 -3
- package/dist/Reducer.d.ts +1 -1
- package/dist/Reducer.js +1 -1
- package/dist/Result.d.ts +18 -18
- package/dist/Result.js +8 -8
- package/dist/Runtime.d.ts +1 -1
- package/dist/Runtime.js +1 -1
- package/dist/Schema.d.ts +265 -120
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +285 -116
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +48 -48
- package/dist/SchemaGetter.js +44 -44
- package/dist/SchemaIssue.d.ts +3 -3
- package/dist/SchemaIssue.js +3 -3
- package/dist/SchemaParser.d.ts +122 -22
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +186 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +96 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +20 -20
- package/dist/SchemaTransformation.js +18 -18
- package/dist/Stream.d.ts +3 -3
- package/dist/Stream.js +2 -2
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +1 -1
- package/dist/String.js +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js +1 -1
- package/dist/Types.d.ts +13 -13
- package/dist/internal/effect.js +23 -10
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/cause.d.ts +2 -0
- package/dist/internal/schema/cause.d.ts.map +1 -0
- package/dist/internal/schema/cause.js +24 -0
- package/dist/internal/schema/cause.js.map +1 -0
- package/dist/internal/schema/schema.d.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +21 -8
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +3 -3
- package/dist/testing/TestSchema.js +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/cli/Prompt.js +2 -2
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +39 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -4
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +15 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +65 -65
- package/src/Cache.ts +1 -1
- package/src/Cause.ts +68 -68
- package/src/Channel.ts +5 -5
- package/src/Clock.ts +1 -1
- package/src/Combiner.ts +9 -9
- package/src/Config.ts +40 -108
- package/src/ConfigProvider.ts +139 -100
- package/src/Console.ts +1 -1
- package/src/Data.ts +15 -15
- package/src/DateTime.ts +6 -6
- package/src/Duration.ts +3 -3
- package/src/Effect.ts +89 -45
- package/src/Equal.ts +7 -7
- package/src/Equivalence.ts +17 -17
- package/src/Exit.ts +3 -3
- package/src/Formatter.ts +5 -5
- package/src/Function.ts +10 -10
- package/src/HashMap.ts +3 -3
- package/src/Iterable.ts +6 -6
- package/src/JsonPatch.ts +2 -2
- package/src/Layer.ts +1 -1
- package/src/Logger.ts +1 -1
- package/src/Match.ts +8 -8
- package/src/Metric.ts +3 -3
- package/src/Optic.ts +30 -30
- package/src/Option.ts +7 -7
- package/src/Order.ts +23 -23
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +88 -88
- package/src/PubSub.ts +3 -3
- package/src/Reducer.ts +1 -1
- package/src/Result.ts +20 -20
- package/src/Runtime.ts +1 -1
- package/src/Schema.ts +314 -131
- package/src/SchemaAST.ts +20 -11
- package/src/SchemaGetter.ts +48 -48
- package/src/SchemaIssue.ts +3 -3
- package/src/SchemaParser.ts +197 -58
- package/src/SchemaRepresentation.ts +73 -3
- package/src/SchemaTransformation.ts +20 -20
- package/src/Stream.ts +4 -4
- package/src/String.ts +1 -1
- package/src/Struct.ts +1 -1
- package/src/Types.ts +13 -13
- package/src/internal/effect.ts +29 -10
- package/src/internal/schema/cause.ts +26 -0
- package/src/internal/schema/schema.ts +36 -10
- package/src/testing/TestSchema.ts +3 -3
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/cli/Prompt.ts +1 -1
- package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
- package/src/unstable/httpapi/HttpApiSchema.ts +18 -6
- package/src/unstable/rpc/Rpc.ts +1 -1
- package/src/unstable/rpc/RpcGroup.ts +3 -4
- package/src/unstable/sql/SqlResolver.ts +15 -2
- package/src/unstable/workflow/Activity.ts +2 -0
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
|
@@ -371,7 +371,7 @@ export declare function trim(): Transformation<string, string>;
|
|
|
371
371
|
* Encoding converts values such as `"myFieldName"` back to `"my_field_name"`.
|
|
372
372
|
* The transformation is round-trippable for standard snake_case and camelCase.
|
|
373
373
|
*
|
|
374
|
-
* **Example** (
|
|
374
|
+
* **Example** (Converting snake case to camel case)
|
|
375
375
|
*
|
|
376
376
|
* ```ts
|
|
377
377
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -603,7 +603,7 @@ export declare function passthrough<T>(): Transformation<T, T>;
|
|
|
603
603
|
* Both decode and encode are no-ops and return a shared singleton
|
|
604
604
|
* transformation.
|
|
605
605
|
*
|
|
606
|
-
* **Example** (
|
|
606
|
+
* **Example** (Passing through supertypes)
|
|
607
607
|
*
|
|
608
608
|
* ```ts
|
|
609
609
|
* import { SchemaTransformation } from "effect"
|
|
@@ -632,7 +632,7 @@ export declare function passthroughSupertype<T extends E, E>(): Transformation<T
|
|
|
632
632
|
* - Both decode and encode are no-ops (same as {@link passthrough}).
|
|
633
633
|
* - Returns a shared singleton instance.
|
|
634
634
|
*
|
|
635
|
-
* **Example** (
|
|
635
|
+
* **Example** (Passing through subtypes)
|
|
636
636
|
*
|
|
637
637
|
* ```ts
|
|
638
638
|
* import { SchemaTransformation } from "effect"
|
|
@@ -663,7 +663,7 @@ export declare function passthroughSubtype<T, E extends T>(): Transformation<T,
|
|
|
663
663
|
* result is finite; combine with `Schema.Finite` or `Schema.Int` for stricter
|
|
664
664
|
* checks.
|
|
665
665
|
*
|
|
666
|
-
* **Example** (
|
|
666
|
+
* **Example** (Converting a string to a number)
|
|
667
667
|
*
|
|
668
668
|
* ```ts
|
|
669
669
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -695,7 +695,7 @@ export declare const numberFromString: Transformation<number, string, never, nev
|
|
|
695
695
|
* the bigint to a string like `String(n)`. Decoding fails if the string is not
|
|
696
696
|
* a valid bigint representation.
|
|
697
697
|
*
|
|
698
|
-
* **Example** (
|
|
698
|
+
* **Example** (Converting a string to a BigInt)
|
|
699
699
|
*
|
|
700
700
|
* ```ts
|
|
701
701
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -726,7 +726,7 @@ export declare const bigintFromString: Transformation<bigint, string, never, nev
|
|
|
726
726
|
* converts the `Date` to an ISO string like `date.toISOString()`, returning
|
|
727
727
|
* `"Invalid Date"` for invalid dates.
|
|
728
728
|
*
|
|
729
|
-
* **Example** (
|
|
729
|
+
* **Example** (Converting a string to a Date)
|
|
730
730
|
*
|
|
731
731
|
* ```ts
|
|
732
732
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -759,7 +759,7 @@ export declare const dateFromString: Transformation<globalThis.Date, string>;
|
|
|
759
759
|
* producing strings such as `"2000 millis"` or `"10 nanos"` that round-trip
|
|
760
760
|
* through the parser.
|
|
761
761
|
*
|
|
762
|
-
* **Example** (
|
|
762
|
+
* **Example** (Converting a string to a Duration)
|
|
763
763
|
*
|
|
764
764
|
* ```ts
|
|
765
765
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -791,7 +791,7 @@ export declare const durationFromString: Transformation<Duration.Duration, strin
|
|
|
791
791
|
* fails with `InvalidValue` if the `Duration` cannot be represented as a
|
|
792
792
|
* `bigint`, such as `Duration.infinity`.
|
|
793
793
|
*
|
|
794
|
-
* **Example** (
|
|
794
|
+
* **Example** (Converting nanoseconds to a Duration)
|
|
795
795
|
*
|
|
796
796
|
* ```ts
|
|
797
797
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -821,7 +821,7 @@ export declare const durationFromNanos: Transformation<Duration.Duration, bigint
|
|
|
821
821
|
* Decode creates a duration from the number, and encode returns the duration
|
|
822
822
|
* length in milliseconds.
|
|
823
823
|
*
|
|
824
|
-
* **Example** (
|
|
824
|
+
* **Example** (Converting milliseconds to a Duration)
|
|
825
825
|
*
|
|
826
826
|
* ```ts
|
|
827
827
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -852,7 +852,7 @@ export declare const durationFromMillis: Transformation<Duration.Duration, numbe
|
|
|
852
852
|
* `Option.some(value)`. Encoding maps `Option.none()` to `null` and
|
|
853
853
|
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
854
854
|
*
|
|
855
|
-
* **Example** (
|
|
855
|
+
* **Example** (Converting nullable values to an Option)
|
|
856
856
|
*
|
|
857
857
|
* ```ts
|
|
858
858
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -886,7 +886,7 @@ export declare function optionFromNullOr<T>(): Transformation<Option.Option<T>,
|
|
|
886
886
|
* `Option.some(value)`. Encoding maps `Option.none()` to `undefined` and
|
|
887
887
|
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
888
888
|
*
|
|
889
|
-
* **Example** (
|
|
889
|
+
* **Example** (Converting undefined-or values to an Option)
|
|
890
890
|
*
|
|
891
891
|
* ```ts
|
|
892
892
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -923,7 +923,7 @@ export declare function optionFromUndefinedOr<T>(): Transformation<Option.Option
|
|
|
923
923
|
* `undefined` according to `options.onNoneEncoding`, and maps
|
|
924
924
|
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
925
925
|
*
|
|
926
|
-
* **Example** (Option
|
|
926
|
+
* **Example** (Converting nullish values to an Option and encoding None as null)
|
|
927
927
|
*
|
|
928
928
|
* ```ts
|
|
929
929
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -961,7 +961,7 @@ export declare function optionFromNullishOr<T>(options?: {
|
|
|
961
961
|
* the key, and maps `Some(Some(v))` to `Some(v)`. This uses
|
|
962
962
|
* `transformOptional` under the hood.
|
|
963
963
|
*
|
|
964
|
-
* **Example** (
|
|
964
|
+
* **Example** (Converting an optional key to an Option)
|
|
965
965
|
*
|
|
966
966
|
* ```ts
|
|
967
967
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1000,7 +1000,7 @@ export declare function optionFromOptionalKey<T>(): Transformation<Option.Option
|
|
|
1000
1000
|
* value, and maps `Some(Some(v))` to `Some(v)`. This uses
|
|
1001
1001
|
* `transformOptional` under the hood and filters out `undefined` on decode.
|
|
1002
1002
|
*
|
|
1003
|
-
* **Example** (
|
|
1003
|
+
* **Example** (Converting an optional value to an Option)
|
|
1004
1004
|
*
|
|
1005
1005
|
* ```ts
|
|
1006
1006
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1037,7 +1037,7 @@ export declare function optionFromOptional<T>(): Transformation<Option.Option<T>
|
|
|
1037
1037
|
* Decoding calls `new URL(s)` and fails with `InvalidValue` if the string is
|
|
1038
1038
|
* not a valid URL. Encoding returns `url.href`.
|
|
1039
1039
|
*
|
|
1040
|
-
* **Example** (
|
|
1040
|
+
* **Example** (Converting a string to a URL)
|
|
1041
1041
|
*
|
|
1042
1042
|
* ```ts
|
|
1043
1043
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1087,7 +1087,7 @@ export declare const bigDecimalFromString: Transformation<BigDecimal.BigDecimal,
|
|
|
1087
1087
|
* Decoding parses the Base64 string into bytes. Encoding writes the byte array
|
|
1088
1088
|
* as a Base64 string.
|
|
1089
1089
|
*
|
|
1090
|
-
* **Example** (
|
|
1090
|
+
* **Example** (Converting Base64 to a Uint8Array)
|
|
1091
1091
|
*
|
|
1092
1092
|
* ```ts
|
|
1093
1093
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1118,7 +1118,7 @@ export declare const uint8ArrayFromBase64String: Transformation<Uint8Array<Array
|
|
|
1118
1118
|
* Decoding parses the Base64 string into a UTF-8 string. Encoding writes the
|
|
1119
1119
|
* string as a Base64 string.
|
|
1120
1120
|
*
|
|
1121
|
-
* **Example** (
|
|
1121
|
+
* **Example** (Converting Base64 to a string)
|
|
1122
1122
|
*
|
|
1123
1123
|
* ```ts
|
|
1124
1124
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1148,7 +1148,7 @@ export declare const stringFromBase64String: Transformation<string, string>;
|
|
|
1148
1148
|
* Decoding parses the Base64 URL string into a UTF-8 string. Encoding writes
|
|
1149
1149
|
* the string as a Base64 URL string.
|
|
1150
1150
|
*
|
|
1151
|
-
* **Example** (
|
|
1151
|
+
* **Example** (Converting Base64Url to a string)
|
|
1152
1152
|
*
|
|
1153
1153
|
* ```ts
|
|
1154
1154
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1178,7 +1178,7 @@ export declare const stringFromBase64UrlString: Transformation<string, string>;
|
|
|
1178
1178
|
* Decoding parses the hex string into a UTF-8 string. Encoding writes the
|
|
1179
1179
|
* string as a hex string.
|
|
1180
1180
|
*
|
|
1181
|
-
* **Example** (
|
|
1181
|
+
* **Example** (Converting hex to a string)
|
|
1182
1182
|
*
|
|
1183
1183
|
* ```ts
|
|
1184
1184
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1210,7 +1210,7 @@ export declare const stringFromHexString: Transformation<string, string>;
|
|
|
1210
1210
|
* Decoding calls `decodeURIComponent` and fails if the input contains malformed
|
|
1211
1211
|
* percent-encoding sequences. Encoding calls `encodeURIComponent`.
|
|
1212
1212
|
*
|
|
1213
|
-
* **Example** (URI component schema)
|
|
1213
|
+
* **Example** (Defining a URI component schema)
|
|
1214
1214
|
*
|
|
1215
1215
|
* ```ts
|
|
1216
1216
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -387,7 +387,7 @@ export function trim() {
|
|
|
387
387
|
* Encoding converts values such as `"myFieldName"` back to `"my_field_name"`.
|
|
388
388
|
* The transformation is round-trippable for standard snake_case and camelCase.
|
|
389
389
|
*
|
|
390
|
-
* **Example** (
|
|
390
|
+
* **Example** (Converting snake case to camel case)
|
|
391
391
|
*
|
|
392
392
|
* ```ts
|
|
393
393
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -603,7 +603,7 @@ export function passthroughSubtype() {
|
|
|
603
603
|
* result is finite; combine with `Schema.Finite` or `Schema.Int` for stricter
|
|
604
604
|
* checks.
|
|
605
605
|
*
|
|
606
|
-
* **Example** (
|
|
606
|
+
* **Example** (Converting a string to a number)
|
|
607
607
|
*
|
|
608
608
|
* ```ts
|
|
609
609
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -635,7 +635,7 @@ export const numberFromString = /*#__PURE__*/new Transformation(/*#__PURE__*/Sch
|
|
|
635
635
|
* the bigint to a string like `String(n)`. Decoding fails if the string is not
|
|
636
636
|
* a valid bigint representation.
|
|
637
637
|
*
|
|
638
|
-
* **Example** (
|
|
638
|
+
* **Example** (Converting a string to a BigInt)
|
|
639
639
|
*
|
|
640
640
|
* ```ts
|
|
641
641
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -666,7 +666,7 @@ export const bigintFromString = /*#__PURE__*/new Transformation(/*#__PURE__*/Sch
|
|
|
666
666
|
* converts the `Date` to an ISO string like `date.toISOString()`, returning
|
|
667
667
|
* `"Invalid Date"` for invalid dates.
|
|
668
668
|
*
|
|
669
|
-
* **Example** (
|
|
669
|
+
* **Example** (Converting a string to a Date)
|
|
670
670
|
*
|
|
671
671
|
* ```ts
|
|
672
672
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -699,7 +699,7 @@ export const dateFromString = /*#__PURE__*/new Transformation(/*#__PURE__*/Schem
|
|
|
699
699
|
* producing strings such as `"2000 millis"` or `"10 nanos"` that round-trip
|
|
700
700
|
* through the parser.
|
|
701
701
|
*
|
|
702
|
-
* **Example** (
|
|
702
|
+
* **Example** (Converting a string to a Duration)
|
|
703
703
|
*
|
|
704
704
|
* ```ts
|
|
705
705
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -739,7 +739,7 @@ export const durationFromString = /*#__PURE__*/transformOrFail({
|
|
|
739
739
|
* fails with `InvalidValue` if the `Duration` cannot be represented as a
|
|
740
740
|
* `bigint`, such as `Duration.infinity`.
|
|
741
741
|
*
|
|
742
|
-
* **Example** (
|
|
742
|
+
* **Example** (Converting nanoseconds to a Duration)
|
|
743
743
|
*
|
|
744
744
|
* ```ts
|
|
745
745
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -777,7 +777,7 @@ export const durationFromNanos = /*#__PURE__*/transformOrFail({
|
|
|
777
777
|
* Decode creates a duration from the number, and encode returns the duration
|
|
778
778
|
* length in milliseconds.
|
|
779
779
|
*
|
|
780
|
-
* **Example** (
|
|
780
|
+
* **Example** (Converting milliseconds to a Duration)
|
|
781
781
|
*
|
|
782
782
|
* ```ts
|
|
783
783
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -869,7 +869,7 @@ export const defectFromJson = options => transform({
|
|
|
869
869
|
* `Option.some(value)`. Encoding maps `Option.none()` to `null` and
|
|
870
870
|
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
871
871
|
*
|
|
872
|
-
* **Example** (
|
|
872
|
+
* **Example** (Converting nullable values to an Option)
|
|
873
873
|
*
|
|
874
874
|
* ```ts
|
|
875
875
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -908,7 +908,7 @@ export function optionFromNullOr() {
|
|
|
908
908
|
* `Option.some(value)`. Encoding maps `Option.none()` to `undefined` and
|
|
909
909
|
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
910
910
|
*
|
|
911
|
-
* **Example** (
|
|
911
|
+
* **Example** (Converting undefined-or values to an Option)
|
|
912
912
|
*
|
|
913
913
|
* ```ts
|
|
914
914
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -950,7 +950,7 @@ export function optionFromUndefinedOr() {
|
|
|
950
950
|
* `undefined` according to `options.onNoneEncoding`, and maps
|
|
951
951
|
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
952
952
|
*
|
|
953
|
-
* **Example** (Option
|
|
953
|
+
* **Example** (Converting nullish values to an Option and encoding None as null)
|
|
954
954
|
*
|
|
955
955
|
* ```ts
|
|
956
956
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -991,7 +991,7 @@ export function optionFromNullishOr(options) {
|
|
|
991
991
|
* the key, and maps `Some(Some(v))` to `Some(v)`. This uses
|
|
992
992
|
* `transformOptional` under the hood.
|
|
993
993
|
*
|
|
994
|
-
* **Example** (
|
|
994
|
+
* **Example** (Converting an optional key to an Option)
|
|
995
995
|
*
|
|
996
996
|
* ```ts
|
|
997
997
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1035,7 +1035,7 @@ export function optionFromOptionalKey() {
|
|
|
1035
1035
|
* value, and maps `Some(Some(v))` to `Some(v)`. This uses
|
|
1036
1036
|
* `transformOptional` under the hood and filters out `undefined` on decode.
|
|
1037
1037
|
*
|
|
1038
|
-
* **Example** (
|
|
1038
|
+
* **Example** (Converting an optional value to an Option)
|
|
1039
1039
|
*
|
|
1040
1040
|
* ```ts
|
|
1041
1041
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1077,7 +1077,7 @@ export function optionFromOptional() {
|
|
|
1077
1077
|
* Decoding calls `new URL(s)` and fails with `InvalidValue` if the string is
|
|
1078
1078
|
* not a valid URL. Encoding returns `url.href`.
|
|
1079
1079
|
*
|
|
1080
|
-
* **Example** (
|
|
1080
|
+
* **Example** (Converting a string to a URL)
|
|
1081
1081
|
*
|
|
1082
1082
|
* ```ts
|
|
1083
1083
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1143,7 +1143,7 @@ export const bigDecimalFromString = /*#__PURE__*/transformOrFail({
|
|
|
1143
1143
|
* Decoding parses the Base64 string into bytes. Encoding writes the byte array
|
|
1144
1144
|
* as a Base64 string.
|
|
1145
1145
|
*
|
|
1146
|
-
* **Example** (
|
|
1146
|
+
* **Example** (Converting Base64 to a Uint8Array)
|
|
1147
1147
|
*
|
|
1148
1148
|
* ```ts
|
|
1149
1149
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1174,7 +1174,7 @@ export const uint8ArrayFromBase64String = /*#__PURE__*/new Transformation(/*#__P
|
|
|
1174
1174
|
* Decoding parses the Base64 string into a UTF-8 string. Encoding writes the
|
|
1175
1175
|
* string as a Base64 string.
|
|
1176
1176
|
*
|
|
1177
|
-
* **Example** (
|
|
1177
|
+
* **Example** (Converting Base64 to a string)
|
|
1178
1178
|
*
|
|
1179
1179
|
* ```ts
|
|
1180
1180
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1204,7 +1204,7 @@ export const stringFromBase64String = /*#__PURE__*/new Transformation(/*#__PURE_
|
|
|
1204
1204
|
* Decoding parses the Base64 URL string into a UTF-8 string. Encoding writes
|
|
1205
1205
|
* the string as a Base64 URL string.
|
|
1206
1206
|
*
|
|
1207
|
-
* **Example** (
|
|
1207
|
+
* **Example** (Converting Base64Url to a string)
|
|
1208
1208
|
*
|
|
1209
1209
|
* ```ts
|
|
1210
1210
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1234,7 +1234,7 @@ export const stringFromBase64UrlString = /*#__PURE__*/new Transformation(/*#__PU
|
|
|
1234
1234
|
* Decoding parses the hex string into a UTF-8 string. Encoding writes the
|
|
1235
1235
|
* string as a hex string.
|
|
1236
1236
|
*
|
|
1237
|
-
* **Example** (
|
|
1237
|
+
* **Example** (Converting hex to a string)
|
|
1238
1238
|
*
|
|
1239
1239
|
* ```ts
|
|
1240
1240
|
* import { Schema, SchemaTransformation } from "effect"
|
|
@@ -1266,7 +1266,7 @@ export const stringFromHexString = /*#__PURE__*/new Transformation(/*#__PURE__*/
|
|
|
1266
1266
|
* Decoding calls `decodeURIComponent` and fails if the input contains malformed
|
|
1267
1267
|
* percent-encoding sequences. Encoding calls `encodeURIComponent`.
|
|
1268
1268
|
*
|
|
1269
|
-
* **Example** (URI component schema)
|
|
1269
|
+
* **Example** (Defining a URI component schema)
|
|
1270
1270
|
*
|
|
1271
1271
|
* ```ts
|
|
1272
1272
|
* import { Schema, SchemaTransformation } from "effect"
|
package/dist/Stream.d.ts
CHANGED
|
@@ -2440,7 +2440,7 @@ export declare const tapSink: {
|
|
|
2440
2440
|
* multiple inner streams may run at the same time and their outputs are merged
|
|
2441
2441
|
* as they arrive.
|
|
2442
2442
|
*
|
|
2443
|
-
* **Example** (
|
|
2443
|
+
* **Example** (Flat mapping stream values)
|
|
2444
2444
|
*
|
|
2445
2445
|
* ```ts
|
|
2446
2446
|
* import { Console, Effect, Stream } from "effect"
|
|
@@ -2471,7 +2471,7 @@ export declare const flatMap: {
|
|
|
2471
2471
|
* multiple inner streams may run at the same time and their outputs are merged
|
|
2472
2472
|
* as they arrive.
|
|
2473
2473
|
*
|
|
2474
|
-
* **Example** (
|
|
2474
|
+
* **Example** (Flat mapping stream values)
|
|
2475
2475
|
*
|
|
2476
2476
|
* ```ts
|
|
2477
2477
|
* import { Console, Effect, Stream } from "effect"
|
|
@@ -2505,7 +2505,7 @@ export declare const flatMap: {
|
|
|
2505
2505
|
* multiple inner streams may run at the same time and their outputs are merged
|
|
2506
2506
|
* as they arrive.
|
|
2507
2507
|
*
|
|
2508
|
-
* **Example** (
|
|
2508
|
+
* **Example** (Flat mapping stream values)
|
|
2509
2509
|
*
|
|
2510
2510
|
* ```ts
|
|
2511
2511
|
* import { Console, Effect, Stream } from "effect"
|
package/dist/Stream.js
CHANGED
|
@@ -1817,7 +1817,7 @@ export const tapSink = /*#__PURE__*/dual(2, (self, sink) => transformPullBracket
|
|
|
1817
1817
|
* multiple inner streams may run at the same time and their outputs are merged
|
|
1818
1818
|
* as they arrive.
|
|
1819
1819
|
*
|
|
1820
|
-
* **Example** (
|
|
1820
|
+
* **Example** (Flat mapping stream values)
|
|
1821
1821
|
*
|
|
1822
1822
|
* ```ts
|
|
1823
1823
|
* import { Console, Effect, Stream } from "effect"
|
|
@@ -7383,7 +7383,7 @@ export const runForEachWhile = /*#__PURE__*/dual(2, (self, f) => Channel.runForE
|
|
|
7383
7383
|
i++;
|
|
7384
7384
|
if (!b) done = true;
|
|
7385
7385
|
}
|
|
7386
|
-
}), () => done);
|
|
7386
|
+
}), () => !done);
|
|
7387
7387
|
}));
|
|
7388
7388
|
/**
|
|
7389
7389
|
* Consumes the stream in chunks, passing each non-empty array to the callback.
|