effect 4.0.0-beta.35 → 4.0.0-beta.37

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.
Files changed (99) hide show
  1. package/dist/Cause.d.ts +31 -0
  2. package/dist/Cause.d.ts.map +1 -1
  3. package/dist/Cause.js +19 -0
  4. package/dist/Cause.js.map +1 -1
  5. package/dist/Channel.d.ts +2 -2
  6. package/dist/Channel.d.ts.map +1 -1
  7. package/dist/Channel.js +9 -7
  8. package/dist/Channel.js.map +1 -1
  9. package/dist/Cron.d.ts +7 -0
  10. package/dist/Cron.d.ts.map +1 -1
  11. package/dist/Cron.js +109 -45
  12. package/dist/Cron.js.map +1 -1
  13. package/dist/Effect.d.ts +1 -16
  14. package/dist/Effect.d.ts.map +1 -1
  15. package/dist/Effect.js.map +1 -1
  16. package/dist/Equivalence.d.ts +52 -0
  17. package/dist/Equivalence.d.ts.map +1 -1
  18. package/dist/Equivalence.js +52 -0
  19. package/dist/Equivalence.js.map +1 -1
  20. package/dist/LayerMap.d.ts +5 -4
  21. package/dist/LayerMap.d.ts.map +1 -1
  22. package/dist/LayerMap.js.map +1 -1
  23. package/dist/PubSub.d.ts.map +1 -1
  24. package/dist/PubSub.js +9 -3
  25. package/dist/PubSub.js.map +1 -1
  26. package/dist/Schedule.d.ts.map +1 -1
  27. package/dist/Schedule.js +19 -1
  28. package/dist/Schedule.js.map +1 -1
  29. package/dist/Schema.d.ts +37 -41
  30. package/dist/Schema.d.ts.map +1 -1
  31. package/dist/Schema.js +20 -0
  32. package/dist/Schema.js.map +1 -1
  33. package/dist/SchemaParser.d.ts +39 -54
  34. package/dist/SchemaParser.d.ts.map +1 -1
  35. package/dist/SchemaParser.js +38 -0
  36. package/dist/SchemaParser.js.map +1 -1
  37. package/dist/Sink.d.ts +5 -2
  38. package/dist/Sink.d.ts.map +1 -1
  39. package/dist/Sink.js.map +1 -1
  40. package/dist/Stream.d.ts +1 -1
  41. package/dist/Stream.d.ts.map +1 -1
  42. package/dist/internal/effect.js +18 -3
  43. package/dist/internal/effect.js.map +1 -1
  44. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  45. package/dist/unstable/ai/LanguageModel.js +15 -3
  46. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  47. package/dist/unstable/cli/Prompt.js +158 -15
  48. package/dist/unstable/cli/Prompt.js.map +1 -1
  49. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  50. package/dist/unstable/devtools/DevToolsClient.js +4 -3
  51. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  52. package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -3
  53. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  54. package/dist/unstable/devtools/DevToolsSchema.js +11 -1
  55. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  56. package/dist/unstable/http/HttpClientRequest.d.ts +24 -2
  57. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  58. package/dist/unstable/http/HttpClientRequest.js +97 -0
  59. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  60. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  61. package/dist/unstable/http/HttpServerResponse.js +2 -1
  62. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  63. package/dist/unstable/httpapi/HttpApiEndpoint.js +2 -2
  64. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  65. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +15 -13
  66. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  67. package/dist/unstable/httpapi/HttpApiMiddleware.js +5 -3
  68. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  69. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  70. package/dist/unstable/sql/Migrator.js +2 -2
  71. package/dist/unstable/sql/Migrator.js.map +1 -1
  72. package/dist/unstable/sql/SqlError.d.ts +229 -9
  73. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  74. package/dist/unstable/sql/SqlError.js +256 -6
  75. package/dist/unstable/sql/SqlError.js.map +1 -1
  76. package/package.json +1 -1
  77. package/src/Cause.ts +35 -0
  78. package/src/Channel.ts +14 -12
  79. package/src/Cron.ts +142 -45
  80. package/src/Effect.ts +1 -16
  81. package/src/Equivalence.ts +56 -0
  82. package/src/LayerMap.ts +7 -5
  83. package/src/PubSub.ts +13 -5
  84. package/src/Schedule.ts +20 -8
  85. package/src/Schema.ts +38 -18
  86. package/src/SchemaParser.ts +74 -25
  87. package/src/Sink.ts +5 -2
  88. package/src/Stream.ts +1 -1
  89. package/src/internal/effect.ts +30 -4
  90. package/src/unstable/ai/LanguageModel.ts +17 -2
  91. package/src/unstable/cli/Prompt.ts +158 -16
  92. package/src/unstable/devtools/DevToolsClient.ts +23 -18
  93. package/src/unstable/devtools/DevToolsSchema.ts +13 -1
  94. package/src/unstable/http/HttpClientRequest.ts +104 -2
  95. package/src/unstable/http/HttpServerResponse.ts +8 -4
  96. package/src/unstable/httpapi/HttpApiEndpoint.ts +2 -2
  97. package/src/unstable/httpapi/HttpApiMiddleware.ts +36 -20
  98. package/src/unstable/sql/Migrator.ts +7 -5
  99. package/src/unstable/sql/SqlError.ts +360 -8
package/dist/Schema.d.ts CHANGED
@@ -527,9 +527,7 @@ export declare namespace Codec {
527
527
  *
528
528
  * @since 4.0.0
529
529
  */
530
- type ToAsserts<S extends Top & {
531
- readonly DecodingServices: never;
532
- }> = <I>(input: I) => asserts input is I & S["Type"];
530
+ type ToAsserts<S extends Top> = <I>(input: I) => asserts input is I & S["Type"];
533
531
  }
534
532
  /**
535
533
  * A schema that additionally supports optic (lens/prism) operations.
@@ -776,9 +774,7 @@ export declare function isSchemaError(u: unknown): u is SchemaError;
776
774
  * @category Standard Schema
777
775
  * @since 4.0.0
778
776
  */
779
- export declare function toStandardSchemaV1<S extends Top & {
780
- readonly DecodingServices: never;
781
- }>(self: S, options?: {
777
+ export declare function toStandardSchemaV1<S extends Decoder<unknown>>(self: S, options?: {
782
778
  readonly leafHook?: Issue.LeafHook | undefined;
783
779
  readonly checkHook?: Issue.CheckHook | undefined;
784
780
  readonly parseOptions?: AST.ParseOptions | undefined;
@@ -890,9 +886,7 @@ export declare const decodeEffect: <S extends Top>(schema: S) => (input: S["Enco
890
886
  * @category Decoding
891
887
  * @since 4.0.0
892
888
  */
893
- export declare function decodeUnknownExit<S extends Top & {
894
- readonly DecodingServices: never;
895
- }>(schema: S): (input: unknown, options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
889
+ export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S): (input: unknown, options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
896
890
  /**
897
891
  * Decodes a typed input (the schema's `Encoded` type) against a schema
898
892
  * synchronously, returning an `Exit` that is either a `Success` with the
@@ -903,9 +897,7 @@ export declare function decodeUnknownExit<S extends Top & {
903
897
  * @category Decoding
904
898
  * @since 4.0.0
905
899
  */
906
- export declare const decodeExit: <S extends Top & {
907
- readonly DecodingServices: never;
908
- }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
900
+ export declare const decodeExit: <S extends Decoder<unknown>>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
909
901
  /**
910
902
  * Decodes an `unknown` input against a schema, returning an `Option` that is
911
903
  * `Some` with the decoded value on success or `None` on failure. Prefer this
@@ -925,9 +917,7 @@ export declare const decodeUnknownOption: typeof Parser.decodeUnknownOption;
925
917
  * @category Decoding
926
918
  * @since 4.0.0
927
919
  */
928
- export declare const decodeOption: <S extends Top & {
929
- readonly DecodingServices: never;
930
- }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Option_.Option<S["Type"]>;
920
+ export declare const decodeOption: <S extends Decoder<unknown>>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Option_.Option<S["Type"]>;
931
921
  /**
932
922
  * Decodes an `unknown` input against a schema, returning a `Promise` that
933
923
  * resolves with the decoded value or rejects with a {@link SchemaError}. Useful
@@ -937,6 +927,16 @@ export declare const decodeOption: <S extends Top & {
937
927
  * @category Decoding
938
928
  * @since 4.0.0
939
929
  */
930
+ export declare const decodeUnknownResult: typeof Parser.decodeUnknownResult;
931
+ /**
932
+ * @category Decoding
933
+ * @since 4.0.0
934
+ */
935
+ export declare const decodeResult: <S extends Decoder<unknown>>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Result_.Result<S["Type"], Issue.Issue>;
936
+ /**
937
+ * @category Decoding
938
+ * @since 4.0.0
939
+ */
940
940
  export declare const decodeUnknownPromise: typeof Parser.decodeUnknownPromise;
941
941
  /**
942
942
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
@@ -984,9 +984,7 @@ export declare const decodeUnknownSync: typeof Parser.decodeUnknownSync;
984
984
  * @category Decoding
985
985
  * @since 4.0.0
986
986
  */
987
- export declare const decodeSync: <S extends Top & {
988
- readonly DecodingServices: never;
989
- }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => S["Type"];
987
+ export declare const decodeSync: <S extends Decoder<unknown>>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => S["Type"];
990
988
  /**
991
989
  * Encodes an `unknown` input against a schema, returning an `Effect` that
992
990
  * succeeds with the encoded value or fails with a {@link SchemaError}. Use this
@@ -1028,9 +1026,7 @@ export declare const encodeEffect: <S extends Top>(schema: S) => (input: S["Type
1028
1026
  * @category Encoding
1029
1027
  * @since 4.0.0
1030
1028
  */
1031
- export declare function encodeUnknownExit<S extends Top & {
1032
- readonly EncodingServices: never;
1033
- }>(schema: S): (input: unknown, options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1029
+ export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S): (input: unknown, options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1034
1030
  /**
1035
1031
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1036
1032
  * returning an `Exit` that is either a `Success` with the encoded value or a
@@ -1041,9 +1037,7 @@ export declare function encodeUnknownExit<S extends Top & {
1041
1037
  * @category Encoding
1042
1038
  * @since 4.0.0
1043
1039
  */
1044
- export declare const encodeExit: <S extends Top & {
1045
- readonly EncodingServices: never;
1046
- }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1040
+ export declare const encodeExit: <S extends Encoder<unknown>>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1047
1041
  /**
1048
1042
  * Encodes an `unknown` input against a schema, returning an `Option` that is
1049
1043
  * `Some` with the encoded value on success or `None` on failure. Prefer this
@@ -1063,9 +1057,7 @@ export declare const encodeUnknownOption: typeof Parser.encodeUnknownOption;
1063
1057
  * @category Encoding
1064
1058
  * @since 4.0.0
1065
1059
  */
1066
- export declare const encodeOption: <S extends Top & {
1067
- readonly EncodingServices: never;
1068
- }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Option_.Option<S["Encoded"]>;
1060
+ export declare const encodeOption: <S extends Encoder<unknown>>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Option_.Option<S["Encoded"]>;
1069
1061
  /**
1070
1062
  * Encodes an `unknown` input against a schema, returning a `Promise` that
1071
1063
  * resolves with the encoded value or rejects with a {@link SchemaError}. Useful
@@ -1075,9 +1067,17 @@ export declare const encodeOption: <S extends Top & {
1075
1067
  * @category Encoding
1076
1068
  * @since 4.0.0
1077
1069
  */
1078
- export declare const encodeUnknownPromise: <S extends Top & {
1079
- readonly EncodingServices: never;
1080
- }>(schema: S) => (input: unknown, options?: AST.ParseOptions) => Promise<S["Encoded"]>;
1070
+ export declare const encodeUnknownResult: typeof Parser.encodeUnknownResult;
1071
+ /**
1072
+ * @category Encoding
1073
+ * @since 4.0.0
1074
+ */
1075
+ export declare const encodeResult: <S extends Encoder<unknown>>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Result_.Result<S["Encoded"], Issue.Issue>;
1076
+ /**
1077
+ * @category Encoding
1078
+ * @since 4.0.0
1079
+ */
1080
+ export declare const encodeUnknownPromise: <S extends Encoder<unknown>>(schema: S) => (input: unknown, options?: AST.ParseOptions) => Promise<S["Encoded"]>;
1081
1081
  /**
1082
1082
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1083
1083
  * `Promise` that resolves with the encoded value or rejects with a
@@ -1086,9 +1086,7 @@ export declare const encodeUnknownPromise: <S extends Top & {
1086
1086
  * @category Encoding
1087
1087
  * @since 4.0.0
1088
1088
  */
1089
- export declare const encodePromise: <S extends Top & {
1090
- readonly EncodingServices: never;
1091
- }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Promise<S["Encoded"]>;
1089
+ export declare const encodePromise: <S extends Encoder<unknown>>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Promise<S["Encoded"]>;
1092
1090
  /**
1093
1091
  * Encodes an `unknown` input against a schema synchronously, throwing a
1094
1092
  * {@link SchemaError} on failure. Use this when you want to serialize data at a
@@ -1109,9 +1107,7 @@ export declare const encodeUnknownSync: typeof Parser.encodeUnknownSync;
1109
1107
  * @category Encoding
1110
1108
  * @since 4.0.0
1111
1109
  */
1112
- export declare const encodeSync: <S extends Top & {
1113
- readonly EncodingServices: never;
1114
- }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => S["Encoded"];
1110
+ export declare const encodeSync: <S extends Encoder<unknown>>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => S["Encoded"];
1115
1111
  /**
1116
1112
  * Creates a schema from an AST (Abstract Syntax Tree) node.
1117
1113
  *
@@ -1756,7 +1752,7 @@ export declare namespace Struct {
1756
1752
  /**
1757
1753
  * @since 4.0.0
1758
1754
  */
1759
- type Type<F extends Fields> = Type_<F>;
1755
+ type Type<F extends Fields> = Simplify<Type_<F>>;
1760
1756
  type Iso_<F extends Fields, O extends keyof F = TypeOptionalKeys<F>, M extends keyof F = TypeMutableKeys<F>> = {
1761
1757
  readonly [K in Exclude<keyof F, M | O>]: F[K]["Iso"];
1762
1758
  } & {
@@ -1769,7 +1765,7 @@ export declare namespace Struct {
1769
1765
  /**
1770
1766
  * @since 4.0.0
1771
1767
  */
1772
- type Iso<F extends Fields> = Iso_<F>;
1768
+ type Iso<F extends Fields> = Simplify<Iso_<F>>;
1773
1769
  type EncodedOptionalKeys<Fields extends Struct.Fields> = {
1774
1770
  [K in keyof Fields]: Fields[K] extends {
1775
1771
  readonly "~encoded.optionality": "optional";
@@ -1792,7 +1788,7 @@ export declare namespace Struct {
1792
1788
  /**
1793
1789
  * @since 4.0.0
1794
1790
  */
1795
- type Encoded<F extends Fields> = Encoded_<F>;
1791
+ type Encoded<F extends Fields> = Simplify<Encoded_<F>>;
1796
1792
  /**
1797
1793
  * @since 4.0.0
1798
1794
  */
@@ -1818,12 +1814,12 @@ export declare namespace Struct {
1818
1814
  /**
1819
1815
  * @since 4.0.0
1820
1816
  */
1821
- type MakeIn<F extends Fields> = MakeIn_<F>;
1817
+ type MakeIn<F extends Fields> = Simplify<MakeIn_<F>>;
1822
1818
  }
1823
1819
  /**
1824
1820
  * @since 4.0.0
1825
1821
  */
1826
- export interface Struct<Fields extends Struct.Fields> extends Bottom<Simplify<Struct.Type<Fields>>, Simplify<Struct.Encoded<Fields>>, Struct.DecodingServices<Fields>, Struct.EncodingServices<Fields>, AST.Objects, Struct<Fields>, Simplify<Struct.MakeIn<Fields>>, Simplify<Struct.Iso<Fields>>> {
1822
+ export interface Struct<Fields extends Struct.Fields> extends Bottom<Struct.Type<Fields>, Struct.Encoded<Fields>, Struct.DecodingServices<Fields>, Struct.EncodingServices<Fields>, AST.Objects, Struct<Fields>, Struct.MakeIn<Fields>, Struct.Iso<Fields>> {
1827
1823
  readonly "~rebuild.out": this;
1828
1824
  /**
1829
1825
  * The field definitions of this struct. Spread them into a new struct to