effect 4.0.0-beta.93 → 4.0.0-beta.94
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/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js.map +1 -1
- package/dist/Effect.d.ts +130 -0
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +43 -0
- package/dist/Effect.js.map +1 -1
- package/dist/FileSystem.d.ts +7 -0
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +3 -0
- package/dist/FileSystem.js.map +1 -1
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +6 -3
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.js +1 -1
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +252 -0
- package/dist/LayerRef.d.ts.map +1 -0
- package/dist/LayerRef.js +171 -0
- package/dist/LayerRef.js.map +1 -0
- package/dist/Schema.d.ts +74 -30
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaParser.d.ts +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js.map +1 -1
- package/dist/internal/effect.js +2 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +2 -2
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +2 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -2
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +2 -2
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -0
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +5 -3
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -1
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +3 -2
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +39 -14
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +2 -2
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +4 -4
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +8 -8
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +2 -2
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +2 -4
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +7 -7
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +4 -4
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/package.json +1 -1
- package/src/Config.ts +1 -1
- package/src/Effect.ts +131 -0
- package/src/FileSystem.ts +13 -0
- package/src/Layer.ts +6 -6
- package/src/LayerMap.ts +1 -1
- package/src/LayerRef.ts +379 -0
- package/src/Schema.ts +80 -33
- package/src/SchemaParser.ts +2 -2
- package/src/internal/effect.ts +19 -0
- package/src/testing/TestSchema.ts +2 -2
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +3 -3
- package/src/unstable/cli/Argument.ts +14 -7
- package/src/unstable/cli/Flag.ts +6 -3
- package/src/unstable/cli/Param.ts +6 -3
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +1 -0
- package/src/unstable/cluster/Entity.ts +13 -14
- package/src/unstable/cluster/Sharding.ts +134 -131
- package/src/unstable/cluster/internal/entityManager.ts +11 -9
- package/src/unstable/cluster/internal/resourceMap.ts +59 -25
- package/src/unstable/encoding/Sse.ts +3 -3
- package/src/unstable/http/HttpClientResponse.ts +2 -3
- package/src/unstable/http/HttpIncomingMessage.ts +4 -5
- package/src/unstable/http/HttpRouter.ts +8 -10
- package/src/unstable/http/HttpServerRequest.ts +20 -19
- package/src/unstable/http/HttpServerResponse.ts +2 -2
- package/src/unstable/http/Multipart.ts +3 -3
- package/src/unstable/httpapi/HttpApi.ts +2 -4
- package/src/unstable/httpapi/HttpApiClient.ts +2 -2
- package/src/unstable/httpapi/HttpApiEndpoint.ts +7 -7
- package/src/unstable/httpapi/HttpApiSchema.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +10 -7
package/dist/Schema.d.ts
CHANGED
|
@@ -708,30 +708,6 @@ export declare namespace Codec {
|
|
|
708
708
|
readonly "EncodingServices": infer R;
|
|
709
709
|
} ? R : never;
|
|
710
710
|
}
|
|
711
|
-
/**
|
|
712
|
-
* A schema that additionally supports optic (lens/prism) operations.
|
|
713
|
-
*
|
|
714
|
-
* **Details**
|
|
715
|
-
*
|
|
716
|
-
* `Optic<T, Iso>` extends {@link Schema}`<T>` with an `Iso` type that
|
|
717
|
-
* describes the isomorphic counterpart used by the optic layer. Crucially,
|
|
718
|
-
* decoding and encoding require *no* Effect services (`DecodingServices` and
|
|
719
|
-
* `EncodingServices` are both `never`), which means the optic can operate
|
|
720
|
-
* purely without an Effect runtime.
|
|
721
|
-
*
|
|
722
|
-
* Most primitive schemas (e.g. `Schema.String`, `Schema.Number`) implement
|
|
723
|
-
* `Optic` automatically. You normally interact with this interface through
|
|
724
|
-
* {@link Optic_} utilities rather than constructing it directly.
|
|
725
|
-
*
|
|
726
|
-
* @category models
|
|
727
|
-
* @since 4.0.0
|
|
728
|
-
*/
|
|
729
|
-
export interface Optic<out T, out Iso> extends Schema<T> {
|
|
730
|
-
readonly "Iso": Iso;
|
|
731
|
-
readonly "DecodingServices": never;
|
|
732
|
-
readonly "EncodingServices": never;
|
|
733
|
-
readonly "Rebuild": Optic<T, Iso>;
|
|
734
|
-
}
|
|
735
711
|
/**
|
|
736
712
|
* A schema that tracks the decoded type `T`, the encoded type `E`, and the
|
|
737
713
|
* Effect services required during decoding (`RD`) and encoding (`RE`).
|
|
@@ -743,8 +719,8 @@ export interface Optic<out T, out Iso> extends Schema<T> {
|
|
|
743
719
|
* Most concrete schemas produced by this module implement `Codec`.
|
|
744
720
|
*
|
|
745
721
|
* For APIs that only need one direction, prefer the narrower views:
|
|
746
|
-
* - {@link
|
|
747
|
-
* - {@link
|
|
722
|
+
* - {@link Decoder}`<T, RD>` — decode-only
|
|
723
|
+
* - {@link Encoder}`<E, RE>` — encode-only
|
|
748
724
|
* - {@link Schema}`<T>` — type-only (no encoded representation)
|
|
749
725
|
*
|
|
750
726
|
* **Example** (Accepting a codec that decodes to `number` from `string`)
|
|
@@ -771,6 +747,50 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
|
|
|
771
747
|
readonly "EncodingServices": RE;
|
|
772
748
|
readonly "Rebuild": Codec<T, E, RD, RE>;
|
|
773
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* A schema that tracks the decoded type `T` and the Effect services required
|
|
752
|
+
* during decoding (`RD`).
|
|
753
|
+
*
|
|
754
|
+
* **When to use**
|
|
755
|
+
*
|
|
756
|
+
* Use when you need to preserve a schema's decoded type and decoding service
|
|
757
|
+
* requirements, but do not need to constrain its encoded representation or
|
|
758
|
+
* encoding services.
|
|
759
|
+
*
|
|
760
|
+
* @see {@link Codec} for preserving both decoded and encoded type information.
|
|
761
|
+
* @see {@link Encoder} for the encode-only view.
|
|
762
|
+
*
|
|
763
|
+
* @category models
|
|
764
|
+
* @since 4.0.0
|
|
765
|
+
*/
|
|
766
|
+
export interface Decoder<out T, out RD = never> extends Schema<T> {
|
|
767
|
+
readonly "Encoded": unknown;
|
|
768
|
+
readonly "DecodingServices": RD;
|
|
769
|
+
readonly "EncodingServices": unknown;
|
|
770
|
+
readonly "Rebuild": Decoder<T, RD>;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* A schema that tracks the encoded type `E` and the Effect services required
|
|
774
|
+
* during encoding (`RE`).
|
|
775
|
+
*
|
|
776
|
+
* **When to use**
|
|
777
|
+
*
|
|
778
|
+
* Use when you need to preserve a schema's encoded type and encoding service
|
|
779
|
+
* requirements, but do not need to constrain its decoded representation or
|
|
780
|
+
* decoding services.
|
|
781
|
+
*
|
|
782
|
+
* @see {@link Codec} for preserving both decoded and encoded type information.
|
|
783
|
+
* @see {@link Decoder} for the decode-only view.
|
|
784
|
+
*
|
|
785
|
+
* @category models
|
|
786
|
+
* @since 4.0.0
|
|
787
|
+
*/
|
|
788
|
+
export interface Encoder<out E, out RE = never> extends Schema<unknown> {
|
|
789
|
+
readonly "Encoded": E;
|
|
790
|
+
readonly "DecodingServices": unknown;
|
|
791
|
+
readonly "EncodingServices": RE;
|
|
792
|
+
readonly "Rebuild": Encoder<E, RE>;
|
|
793
|
+
}
|
|
774
794
|
/**
|
|
775
795
|
* Returns a codec widened to the full {@link Codec} interface, prompting
|
|
776
796
|
* TypeScript to infer all four type parameters (`T`, `E`, `RD`, `RE`).
|
|
@@ -797,6 +817,30 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
|
|
|
797
817
|
* @since 4.0.0
|
|
798
818
|
*/
|
|
799
819
|
export declare function revealCodec<T, E, RD, RE>(codec: Codec<T, E, RD, RE>): Codec<T, E, RD, RE>;
|
|
820
|
+
/**
|
|
821
|
+
* A schema that additionally supports optic (lens/prism) operations.
|
|
822
|
+
*
|
|
823
|
+
* **Details**
|
|
824
|
+
*
|
|
825
|
+
* `Optic<T, Iso>` extends {@link Schema}`<T>` with an `Iso` type that
|
|
826
|
+
* describes the isomorphic counterpart used by the optic layer. Crucially,
|
|
827
|
+
* decoding and encoding require *no* Effect services (`DecodingServices` and
|
|
828
|
+
* `EncodingServices` are both `never`), which means the optic can operate
|
|
829
|
+
* purely without an Effect runtime.
|
|
830
|
+
*
|
|
831
|
+
* Most primitive schemas (e.g. `Schema.String`, `Schema.Number`) implement
|
|
832
|
+
* `Optic` automatically. You normally interact with this interface through
|
|
833
|
+
* {@link Optic_} utilities rather than constructing it directly.
|
|
834
|
+
*
|
|
835
|
+
* @category models
|
|
836
|
+
* @since 4.0.0
|
|
837
|
+
*/
|
|
838
|
+
export interface Optic<out T, out Iso> extends Schema<T> {
|
|
839
|
+
readonly "Iso": Iso;
|
|
840
|
+
readonly "DecodingServices": never;
|
|
841
|
+
readonly "EncodingServices": never;
|
|
842
|
+
readonly "Rebuild": Optic<T, Iso>;
|
|
843
|
+
}
|
|
800
844
|
export {
|
|
801
845
|
/**
|
|
802
846
|
* Error thrown (or returned as the error channel value) when schema decoding
|
|
@@ -2145,7 +2189,7 @@ export declare namespace TemplateLiteralParser {
|
|
|
2145
2189
|
* @since 3.10.0
|
|
2146
2190
|
*/
|
|
2147
2191
|
type Type<Parts> = Parts extends readonly [infer Head, ...infer Tail] ? readonly [
|
|
2148
|
-
Head extends TemplateLiteral.LiteralPart ? Head : Head extends
|
|
2192
|
+
Head extends TemplateLiteral.LiteralPart ? Head : Head extends ConstraintDecoder<infer T, unknown> ? T : never,
|
|
2149
2193
|
...Type<Tail>
|
|
2150
2194
|
] : [];
|
|
2151
2195
|
}
|
|
@@ -9258,7 +9302,7 @@ type XmlEncoderOptions = {
|
|
|
9258
9302
|
* @category Canonical Codecs
|
|
9259
9303
|
* @since 4.0.0
|
|
9260
9304
|
*/
|
|
9261
|
-
export declare function toEncoderXml<T,
|
|
9305
|
+
export declare function toEncoderXml<T, RE>(codec: ConstraintCodec<T, unknown, unknown, RE>, options?: XmlEncoderOptions): (t: T) => Effect.Effect<string, SchemaError, RE>;
|
|
9262
9306
|
/**
|
|
9263
9307
|
* Derives an `Iso` optic from a schema that isomorphically converts between
|
|
9264
9308
|
* the schema's `Type` and its `Iso` (intermediate / serialized form).
|
|
@@ -9314,7 +9358,7 @@ export interface overrideToCodecIso<S extends Constraint, Iso> extends BottomLaz
|
|
|
9314
9358
|
* @category Optic
|
|
9315
9359
|
* @since 4.0.0
|
|
9316
9360
|
*/
|
|
9317
|
-
export declare function overrideToCodecIso<S extends Constraint, Iso>(to:
|
|
9361
|
+
export declare function overrideToCodecIso<S extends Constraint, Iso>(to: ConstraintCodec<Iso>, transformation: {
|
|
9318
9362
|
readonly decode: SchemaGetter.Getter<S["Type"], Iso>;
|
|
9319
9363
|
readonly encode: SchemaGetter.Getter<Iso, S["Type"]>;
|
|
9320
9364
|
}): (schema: S) => overrideToCodecIso<S, Iso>;
|
|
@@ -9326,7 +9370,7 @@ export declare function overrideToCodecIso<S extends Constraint, Iso>(to: Codec<
|
|
|
9326
9370
|
* @category converting
|
|
9327
9371
|
* @since 4.0.0
|
|
9328
9372
|
*/
|
|
9329
|
-
export declare function toDifferJsonPatch<T
|
|
9373
|
+
export declare function toDifferJsonPatch<T>(schema: ConstraintCodec<T, unknown>): Differ<T, JsonPatch.JsonPatch>;
|
|
9330
9374
|
/**
|
|
9331
9375
|
* Recursive tree type whose leaves are `Node` values and whose branches are
|
|
9332
9376
|
* readonly arrays or string-keyed records of child trees.
|