effect 4.0.0-beta.36 → 4.0.0-beta.38

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 (125) 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/Effect.d.ts +1 -16
  8. package/dist/Effect.d.ts.map +1 -1
  9. package/dist/Effect.js.map +1 -1
  10. package/dist/Schedule.d.ts.map +1 -1
  11. package/dist/Schedule.js +19 -1
  12. package/dist/Schedule.js.map +1 -1
  13. package/dist/Schema.d.ts +20 -48
  14. package/dist/Schema.d.ts.map +1 -1
  15. package/dist/Schema.js +9 -13
  16. package/dist/Schema.js.map +1 -1
  17. package/dist/SchemaAST.d.ts +5 -0
  18. package/dist/SchemaAST.d.ts.map +1 -1
  19. package/dist/SchemaAST.js.map +1 -1
  20. package/dist/SchemaParser.d.ts +22 -66
  21. package/dist/SchemaParser.d.ts.map +1 -1
  22. package/dist/SchemaParser.js +7 -2
  23. package/dist/SchemaParser.js.map +1 -1
  24. package/dist/Sink.d.ts +5 -2
  25. package/dist/Sink.d.ts.map +1 -1
  26. package/dist/Sink.js.map +1 -1
  27. package/dist/Stream.d.ts +1 -1
  28. package/dist/Stream.d.ts.map +1 -1
  29. package/dist/internal/effect.js +15 -1
  30. package/dist/internal/effect.js.map +1 -1
  31. package/dist/unstable/cli/Prompt.js +16 -6
  32. package/dist/unstable/cli/Prompt.js.map +1 -1
  33. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  34. package/dist/unstable/cluster/EntityAddress.js +1 -1
  35. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  36. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  37. package/dist/unstable/cluster/Runner.js +1 -1
  38. package/dist/unstable/cluster/Runner.js.map +1 -1
  39. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  40. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  41. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  42. package/dist/unstable/cluster/ShardId.js +3 -3
  43. package/dist/unstable/cluster/ShardId.js.map +1 -1
  44. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  45. package/dist/unstable/devtools/DevToolsClient.js +4 -3
  46. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  47. package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -3
  48. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  49. package/dist/unstable/devtools/DevToolsSchema.js +11 -1
  50. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  51. package/dist/unstable/eventlog/EventJournal.js +2 -2
  52. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  53. package/dist/unstable/eventlog/EventLog.js +1 -1
  54. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  55. package/dist/unstable/eventlog/SqlEventLogJournal.js +2 -2
  56. package/dist/unstable/eventlog/SqlEventLogJournal.js.map +1 -1
  57. package/dist/unstable/http/HttpClientRequest.d.ts +24 -2
  58. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  59. package/dist/unstable/http/HttpClientRequest.js +97 -0
  60. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  61. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  62. package/dist/unstable/http/HttpServerResponse.js +2 -1
  63. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  64. package/dist/unstable/httpapi/HttpApiBuilder.js +9 -8
  65. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  66. package/dist/unstable/httpapi/HttpApiClient.d.ts +36 -20
  67. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  68. package/dist/unstable/httpapi/HttpApiClient.js +49 -18
  69. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  70. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +186 -67
  71. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  72. package/dist/unstable/httpapi/HttpApiEndpoint.js +44 -29
  73. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  74. package/dist/unstable/httpapi/HttpApiSchema.d.ts +5 -0
  75. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  76. package/dist/unstable/httpapi/HttpApiSchema.js +20 -2
  77. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  78. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  79. package/dist/unstable/httpapi/OpenApi.js +2 -5
  80. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  81. package/dist/unstable/reactivity/AtomHttpApi.d.ts +11 -7
  82. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  83. package/dist/unstable/reactivity/AtomHttpApi.js +6 -6
  84. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  85. package/dist/unstable/schema/VariantSchema.d.ts +1 -1
  86. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  87. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  88. package/dist/unstable/sql/Migrator.js +2 -2
  89. package/dist/unstable/sql/Migrator.js.map +1 -1
  90. package/dist/unstable/sql/SqlError.d.ts +229 -9
  91. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  92. package/dist/unstable/sql/SqlError.js +256 -6
  93. package/dist/unstable/sql/SqlError.js.map +1 -1
  94. package/package.json +1 -1
  95. package/src/Cause.ts +35 -0
  96. package/src/Channel.ts +2 -2
  97. package/src/Effect.ts +1 -16
  98. package/src/Schedule.ts +20 -8
  99. package/src/Schema.ts +14 -22
  100. package/src/SchemaAST.ts +6 -0
  101. package/src/SchemaParser.ts +32 -31
  102. package/src/Sink.ts +5 -2
  103. package/src/Stream.ts +1 -1
  104. package/src/internal/effect.ts +27 -2
  105. package/src/unstable/cli/Prompt.ts +15 -6
  106. package/src/unstable/cluster/EntityAddress.ts +1 -1
  107. package/src/unstable/cluster/Runner.ts +1 -1
  108. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  109. package/src/unstable/cluster/ShardId.ts +2 -2
  110. package/src/unstable/devtools/DevToolsClient.ts +23 -18
  111. package/src/unstable/devtools/DevToolsSchema.ts +13 -1
  112. package/src/unstable/eventlog/EventJournal.ts +2 -2
  113. package/src/unstable/eventlog/EventLog.ts +1 -1
  114. package/src/unstable/eventlog/SqlEventLogJournal.ts +2 -2
  115. package/src/unstable/http/HttpClientRequest.ts +104 -2
  116. package/src/unstable/http/HttpServerResponse.ts +8 -4
  117. package/src/unstable/httpapi/HttpApiBuilder.ts +15 -9
  118. package/src/unstable/httpapi/HttpApiClient.ts +118 -55
  119. package/src/unstable/httpapi/HttpApiEndpoint.ts +164 -36
  120. package/src/unstable/httpapi/HttpApiSchema.ts +20 -2
  121. package/src/unstable/httpapi/OpenApi.ts +2 -6
  122. package/src/unstable/reactivity/AtomHttpApi.ts +22 -17
  123. package/src/unstable/schema/VariantSchema.ts +1 -1
  124. package/src/unstable/sql/Migrator.ts +7 -5
  125. package/src/unstable/sql/SqlError.ts +360 -8
package/dist/Schema.d.ts CHANGED
@@ -148,7 +148,7 @@ export type ConstructorDefault = "no-default" | "with-default";
148
148
  * Options for `makeUnsafe` and Class constructors.
149
149
  *
150
150
  * When to use:
151
- * - Pass `disableValidation: true` to skip validation when you trust the data.
151
+ * - Pass `disableChecks: true` to skip validation when you trust the data.
152
152
  * - Pass `parseOptions` to control error reporting behavior.
153
153
  *
154
154
  * @see {@link Bottom.makeUnsafe}
@@ -163,7 +163,7 @@ export interface MakeOptions {
163
163
  /**
164
164
  * Whether to disable validation for the schema.
165
165
  */
166
- readonly disableValidation?: boolean | undefined;
166
+ readonly disableChecks?: boolean | undefined;
167
167
  }
168
168
  /**
169
169
  * The fully-parameterized base interface for all schemas. Exposes all 14 type
@@ -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
@@ -942,9 +932,7 @@ export declare const decodeUnknownResult: typeof Parser.decodeUnknownResult;
942
932
  * @category Decoding
943
933
  * @since 4.0.0
944
934
  */
945
- export declare const decodeResult: <S extends Top & {
946
- readonly DecodingServices: never;
947
- }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Result_.Result<S["Type"], Issue.Issue>;
935
+ export declare const decodeResult: <S extends Decoder<unknown>>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Result_.Result<S["Type"], Issue.Issue>;
948
936
  /**
949
937
  * @category Decoding
950
938
  * @since 4.0.0
@@ -996,9 +984,7 @@ export declare const decodeUnknownSync: typeof Parser.decodeUnknownSync;
996
984
  * @category Decoding
997
985
  * @since 4.0.0
998
986
  */
999
- export declare const decodeSync: <S extends Top & {
1000
- readonly DecodingServices: never;
1001
- }>(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"];
1002
988
  /**
1003
989
  * Encodes an `unknown` input against a schema, returning an `Effect` that
1004
990
  * succeeds with the encoded value or fails with a {@link SchemaError}. Use this
@@ -1040,9 +1026,7 @@ export declare const encodeEffect: <S extends Top>(schema: S) => (input: S["Type
1040
1026
  * @category Encoding
1041
1027
  * @since 4.0.0
1042
1028
  */
1043
- export declare function encodeUnknownExit<S extends Top & {
1044
- readonly EncodingServices: never;
1045
- }>(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>;
1046
1030
  /**
1047
1031
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1048
1032
  * returning an `Exit` that is either a `Success` with the encoded value or a
@@ -1053,9 +1037,7 @@ export declare function encodeUnknownExit<S extends Top & {
1053
1037
  * @category Encoding
1054
1038
  * @since 4.0.0
1055
1039
  */
1056
- export declare const encodeExit: <S extends Top & {
1057
- readonly EncodingServices: never;
1058
- }>(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>;
1059
1041
  /**
1060
1042
  * Encodes an `unknown` input against a schema, returning an `Option` that is
1061
1043
  * `Some` with the encoded value on success or `None` on failure. Prefer this
@@ -1075,9 +1057,7 @@ export declare const encodeUnknownOption: typeof Parser.encodeUnknownOption;
1075
1057
  * @category Encoding
1076
1058
  * @since 4.0.0
1077
1059
  */
1078
- export declare const encodeOption: <S extends Top & {
1079
- readonly EncodingServices: never;
1080
- }>(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"]>;
1081
1061
  /**
1082
1062
  * Encodes an `unknown` input against a schema, returning a `Promise` that
1083
1063
  * resolves with the encoded value or rejects with a {@link SchemaError}. Useful
@@ -1092,16 +1072,12 @@ export declare const encodeUnknownResult: typeof Parser.encodeUnknownResult;
1092
1072
  * @category Encoding
1093
1073
  * @since 4.0.0
1094
1074
  */
1095
- export declare const encodeResult: <S extends Top & {
1096
- readonly EncodingServices: never;
1097
- }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Result_.Result<S["Encoded"], Issue.Issue>;
1075
+ export declare const encodeResult: <S extends Encoder<unknown>>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Result_.Result<S["Encoded"], Issue.Issue>;
1098
1076
  /**
1099
1077
  * @category Encoding
1100
1078
  * @since 4.0.0
1101
1079
  */
1102
- export declare const encodeUnknownPromise: <S extends Top & {
1103
- readonly EncodingServices: never;
1104
- }>(schema: S) => (input: unknown, options?: AST.ParseOptions) => Promise<S["Encoded"]>;
1080
+ export declare const encodeUnknownPromise: <S extends Encoder<unknown>>(schema: S) => (input: unknown, options?: AST.ParseOptions) => Promise<S["Encoded"]>;
1105
1081
  /**
1106
1082
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1107
1083
  * `Promise` that resolves with the encoded value or rejects with a
@@ -1110,9 +1086,7 @@ export declare const encodeUnknownPromise: <S extends Top & {
1110
1086
  * @category Encoding
1111
1087
  * @since 4.0.0
1112
1088
  */
1113
- export declare const encodePromise: <S extends Top & {
1114
- readonly EncodingServices: never;
1115
- }>(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"]>;
1116
1090
  /**
1117
1091
  * Encodes an `unknown` input against a schema synchronously, throwing a
1118
1092
  * {@link SchemaError} on failure. Use this when you want to serialize data at a
@@ -1133,9 +1107,7 @@ export declare const encodeUnknownSync: typeof Parser.encodeUnknownSync;
1133
1107
  * @category Encoding
1134
1108
  * @since 4.0.0
1135
1109
  */
1136
- export declare const encodeSync: <S extends Top & {
1137
- readonly EncodingServices: never;
1138
- }>(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"];
1139
1111
  /**
1140
1112
  * Creates a schema from an AST (Abstract Syntax Tree) node.
1141
1113
  *
@@ -6114,7 +6086,7 @@ export interface ExtendableClass<Self, S extends Top & {
6114
6086
  /**
6115
6087
  * Creates a schema-backed class whose constructor validates input against a
6116
6088
  * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6117
- * input (unless `disableValidation` is set in the options).
6089
+ * input (unless `disableChecks` is set in the options).
6118
6090
  *
6119
6091
  * Pass the desired class type as the first type parameter. The second optional
6120
6092
  * type parameter can be used to add nominal brands.
@@ -6159,7 +6131,7 @@ export declare const Class: {
6159
6131
  /**
6160
6132
  * Creates a schema-backed class whose constructor validates input against a
6161
6133
  * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6162
- * input (unless `disableValidation` is set in the options).
6134
+ * input (unless `disableChecks` is set in the options).
6163
6135
  *
6164
6136
  * Pass the desired class type as the first type parameter. The second optional
6165
6137
  * type parameter can be used to add nominal brands.
@@ -6204,7 +6176,7 @@ export declare const Class: {
6204
6176
  /**
6205
6177
  * Creates a schema-backed class whose constructor validates input against a
6206
6178
  * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6207
- * input (unless `disableValidation` is set in the options).
6179
+ * input (unless `disableChecks` is set in the options).
6208
6180
  *
6209
6181
  * Pass the desired class type as the first type parameter. The second optional
6210
6182
  * type parameter can be used to add nominal brands.
@@ -6249,7 +6221,7 @@ export declare const Class: {
6249
6221
  /**
6250
6222
  * Creates a schema-backed class whose constructor validates input against a
6251
6223
  * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6252
- * input (unless `disableValidation` is set in the options).
6224
+ * input (unless `disableChecks` is set in the options).
6253
6225
  *
6254
6226
  * Pass the desired class type as the first type parameter. The second optional
6255
6227
  * type parameter can be used to add nominal brands.