-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
307 changed files
with
16,665 additions
and
6,893 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
--- | ||
"@effect/schema": minor | ||
--- | ||
|
||
# Breaking Changes | ||
|
||
- The `Format` module has been removed | ||
|
||
## `AST` module | ||
|
||
- `Tuple` has been refactored to `TupleType`, and its `_tag` has consequently been renamed. The type of its `rest` property has changed from `Option.Option<ReadonlyArray.NonEmptyReadonlyArray<AST>>` to `ReadonlyArray<AST>`. | ||
- `Transform` has been refactored to `Transformation`, and its `_tag` property has consequently been renamed. Its property `transformation` has now the type `TransformationKind = FinalTransformation | ComposeTransformation | TypeLiteralTransformation`. | ||
- `createRecord` has been removed | ||
- `AST.to` has been renamed to `AST.typeAST` | ||
- `AST.from` has been renamed to `AST.encodedAST` | ||
- `ExamplesAnnotation` and `DefaultAnnotation` now accept a type parameter | ||
- `format` has been removed: | ||
Before | ||
|
||
```ts | ||
AST.format(ast, verbose?) | ||
``` | ||
Now | ||
```ts | ||
ast.toString(verbose?) | ||
``` | ||
- `setAnnotation` has been removed (use `annotations` instead) | ||
- `mergeAnnotations` has been renamed to `annotations` | ||
- move `defaultParseOption` from `Parser.ts` to `AST.ts` | ||
## `ParseResult` module | ||
- The `ParseResult` module now uses classes and custom constructors have been removed: | ||
Before | ||
```ts | ||
import * as ParseResult from "@effect/schema/ParseResult"; | ||
|
||
ParseResult.type(ast, actual); | ||
``` | ||
Now | ||
```ts | ||
import * as ParseResult from "@effect/schema/ParseResult"; | ||
|
||
new ParseResult.Type(ast, actual); | ||
``` | ||
- `Transform` has been refactored to `Transformation`, and its `kind` property now accepts `"Encoded"`, `"Transformation"`, or `"Type"` as values | ||
## `Schema` module | ||
- `uniqueSymbol` has been renamed to `uniqueSymbolFromSelf` | ||
- `Schema.Schema.To` has been renamed to `Schema.Schema.Type`, and `Schema.to` to `Schema.typeSchema` | ||
- `Schema.Schema.From` has been renamed to `Schema.Schema.Encoded`, and `Schema.from` to `Schema.encodedSchema` | ||
- The type parameters of `TaggedRequest` have been swapped | ||
- The signature of `PropertySignature` has been changed from `PropertySignature<From, FromOptional, To, ToOptional>` to `PropertySignature<ToToken extends Token, To, Key extends PropertyKey, FromToken extends Token, From, R>` | ||
- Class APIs | ||
- Class APIs now expose `fields` and require an identifier | ||
```diff | ||
-class A extends S.Class<A>()({ a: S.string }) {} | ||
+class A extends S.Class<A>("A")({ a: S.string }) {} | ||
``` | ||
- `element` and `rest` have been removed in favor of `array` and `tuple`: | ||
Before | ||
```ts | ||
import * as S from "@effect/schema/Schema"; | ||
|
||
const schema1 = S.tuple().pipe(S.rest(S.number), S.element(S.boolean)); | ||
|
||
const schema2 = S.tuple(S.string).pipe( | ||
S.rest(S.number), | ||
S.element(S.boolean) | ||
); | ||
``` | ||
Now | ||
```ts | ||
import * as S from "@effect/schema/Schema"; | ||
|
||
const schema1 = S.array(S.number, S.boolean); | ||
|
||
const schema2 = S.tuple([S.string], S.number, S.boolean); | ||
``` | ||
- `optionalElement` has been refactored: | ||
Before | ||
```ts | ||
import * as S from "@effect/schema/Schema"; | ||
|
||
const schema = S.tuple(S.string).pipe(S.optionalElement(S.number)); | ||
``` | ||
Now | ||
```ts | ||
import * as S from "@effect/schema/Schema"; | ||
|
||
const schema = S.tuple(S.string, S.optionalElement(S.number)); | ||
``` | ||
- use `TreeFormatter` in `BrandSchema`s | ||
- Schema annotations interfaces have been refactored: | ||
- add `PropertySignatureAnnotations` (baseline) | ||
- remove `DocAnnotations` | ||
- rename `DeclareAnnotations` to `Annotations` | ||
- `propertySignatureAnnotations` has been replaced by the `propertySignature` constructor which owns a `annotations` method | ||
Before | ||
```ts | ||
S.string.pipe(S.propertySignatureAnnotations({ description: "description" })); | ||
|
||
S.optional(S.string, { | ||
exact: true, | ||
annotations: { description: "description" }, | ||
}); | ||
``` | ||
Now | ||
```ts | ||
S.propertySignatureDeclaration(S.string).annotations({ | ||
description: "description", | ||
}); | ||
|
||
S.optional(S.string, { exact: true }).annotations({ | ||
description: "description", | ||
}); | ||
``` | ||
## `Serializable` module | ||
- The type parameters of `SerializableWithResult` and `WithResult` have been swapped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"effect": patch | ||
--- | ||
|
||
Brand: add `refined` overload | ||
|
||
```ts | ||
export function refined<A extends Brand<any>>( | ||
f: (unbranded: Brand.Unbranded<A>) => Option.Option<Brand.BrandErrors> | ||
): Brand.Constructor<A>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
"@effect/schema": patch | ||
--- | ||
|
||
## `Schema` module | ||
|
||
- enhance the `struct` API to allow records: | ||
```ts | ||
const schema1 = S.struct({ a: S.number }, { key: S.string, value: S.number }); | ||
// or | ||
const schema2 = S.struct({ a: S.number }, S.record(S.string, S.number)); | ||
``` | ||
- enhance the `extend` API to allow nested (non-overlapping) fields: | ||
```ts | ||
const A = S.struct({ a: S.struct({ b: S.string }) }); | ||
const B = S.struct({ a: S.struct({ c: S.number }) }); | ||
const schema = S.extend(A, B); | ||
/* | ||
same as: | ||
const schema = S.struct({ | ||
a: S.struct({ | ||
b: S.string, | ||
c: S.number | ||
}) | ||
}) | ||
*/ | ||
``` | ||
- add `Annotable` interface | ||
- add `asSchema` | ||
- add add `Schema.Any`, `Schema.All`, `Schema.AnyNoContext` helpers | ||
- refactor `annotations` API to be a method within the `Schema` interface | ||
- add support for `AST.keyof`, `AST.getPropertySignatures`, `Parser.getSearchTree` to Classes | ||
- fix `BrandAnnotation` type and add `getBrandAnnotation` | ||
- add `annotations?` parameter to Class constructors: | ||
|
||
```ts | ||
import * as AST from "@effect/schema/AST"; | ||
import * as S from "@effect/schema/Schema"; | ||
|
||
class A extends S.Class<A>()( | ||
{ | ||
a: S.string, | ||
}, | ||
{ description: "some description..." } // <= annotations | ||
) {} | ||
|
||
console.log(AST.getDescriptionAnnotation((A.ast as AST.Transform).to)); | ||
// => { _id: 'Option', _tag: 'Some', value: 'some description...' } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@effect/experimental": minor | ||
--- | ||
|
||
- `src/DevTools/Domain.ts` | ||
- use `OptionEncoded` in `SpanFrom` | ||
- `src/Machine.ts` | ||
- use `ExitEncoded` in `SerializableActor` and `boot` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@effect/rpc": minor | ||
--- | ||
|
||
- `src/Router.ts` | ||
- use `ExitEncoded` in `Response` and `ResponseEffect` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@effect/platform": minor | ||
--- | ||
|
||
- `src/Worker.ts` | ||
- use `CauseEncoded` in `Worker` namespace | ||
- `src/WorkerError.ts` | ||
- use `CauseEncoded` in `Cause` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.