Skip to content

Commit

Permalink
Merge Schema into Effect (#3772)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored and tim-smart committed Oct 20, 2024
1 parent 5388832 commit bff0e80
Show file tree
Hide file tree
Showing 540 changed files with 4,057 additions and 5,229 deletions.
75 changes: 75 additions & 0 deletions .changeset/six-crabs-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
"effect": minor
---

Merge Schema into Effect.

### Modules

Before

```ts
import {
Arbitrary,
AST,
FastCheck,
JSONSchema,
ParseResult,
Pretty,
Schema
} from "@effect/schema"
```

After

```ts
import {
Arbitrary,
SchemaAST, // changed
FastCheck,
JSONSchema,
ParseResult,
Pretty,
Schema
} from "effect"
```

### Formatters

`ArrayFormatter` / `TreeFormatter` merged into `ParseResult` module.

Before

```ts
import { ArrayFormatter, TreeFormatter } from "@effect/schema"
```

After

```ts
import { ArrayFormatter, TreeFormatter } from "effect/ParseResult"
```

### Serializable

Merged into `Schema` module.

### Equivalence

Merged into `Schema` module.

Before

```ts
import { Equivalence } from "@effect/schema"

Equivalence.make(myschema)
```

After

```ts
import { Schema } from "@effect/schema"

Schema.equivalence(myschema)
```
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
/packages/printer-ansi/ @IMax153
/packages/rpc/ @tim-smart
/packages/rpc-http/ @tim-smart
/packages/schema/ @gcanti
/packages/sql/ @tim-smart
/packages/sql-mssql/ @tim-smart
/packages/sql-mysql2/ @tim-smart
Expand Down
48 changes: 10 additions & 38 deletions packages/ai/ai/docgen.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
{
"$schema": "../../../node_modules/@effect/docgen/schema.json",
"exclude": [
"src/internal/**/*.ts"
],
"exclude": ["src/internal/**/*.ts"],
"examplesCompilerOptions": {
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"moduleResolution": "Bundler",
"module": "ES2022",
"target": "ES2022",
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"paths": {
"effect": [
"../../../../effect/src/index.js"
],
"effect/*": [
"../../../../effect/src/*.js"
],
"@effect/platform": [
"../../../../platform/src/index.js"
],
"@effect/platform/*": [
"../../../../platform/src/*.js"
],
"@effect/schema": [
"../../../../schema/src/index.js"
],
"@effect/schema/*": [
"../../../../schema/src/*.js"
],
"@effect/ai": [
"../../../ai/src/index.js"
],
"@effect/ai/*": [
"../../../ai/src/*.js"
],
"@effect/ai-openai": [
"../../../ai-openai/src/index.js"
],
"@effect/ai-openai/*": [
"../../../ai-openai/src/*.js"
]
"effect": ["../../../../effect/src/index.js"],
"effect/*": ["../../../../effect/src/*.js"],
"@effect/platform": ["../../../../platform/src/index.js"],
"@effect/platform/*": ["../../../../platform/src/*.js"],
"@effect/ai": ["../../../ai/src/index.js"],
"@effect/ai/*": ["../../../ai/src/*.js"],
"@effect/ai-openai": ["../../../ai-openai/src/index.js"],
"@effect/ai-openai/*": ["../../../ai-openai/src/*.js"]
}
}
}
2 changes: 0 additions & 2 deletions packages/ai/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@
"dependencies": {},
"peerDependencies": {
"@effect/platform": "workspace:^",
"@effect/schema": "workspace:^",
"effect": "workspace:^"
},
"devDependencies": {
"@effect/platform": "workspace:^",
"@effect/schema": "workspace:^",
"effect": "workspace:^"
}
}
4 changes: 2 additions & 2 deletions packages/ai/ai/src/AiChat.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @since 1.0.0
*/
import type { ParseError } from "@effect/schema/ParseResult"
import * as Schema from "@effect/schema/Schema"
import * as Channel from "effect/Channel"
import * as Chunk from "effect/Chunk"
import * as Effect from "effect/Effect"
import type { ParseError } from "effect/ParseResult"
import * as Ref from "effect/Ref"
import * as Schema from "effect/Schema"
import * as Stream from "effect/Stream"
import type { Concurrency } from "effect/Types"
import type { AiError } from "./AiError.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/ai/src/AiError.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @since 1.0.0
*/
import * as Schema from "@effect/schema/Schema"
import * as Schema from "effect/Schema"

/**
* @since 1.0.0
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/ai/src/AiInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import type { PlatformError } from "@effect/platform/Error"
import * as FileSystem from "@effect/platform/FileSystem"
import * as Path from "@effect/platform/Path"
import * as ParseResult from "@effect/schema/ParseResult"
import * as Schema_ from "@effect/schema/Schema"
import * as Chunk from "effect/Chunk"
import * as Context from "effect/Context"
import * as Effect from "effect/Effect"
import * as Encoding from "effect/Encoding"
import { dual } from "effect/Function"
import * as Option from "effect/Option"
import * as ParseResult from "effect/ParseResult"
import * as Predicate from "effect/Predicate"
import * as Schema_ from "effect/Schema"
import { AiResponse, ToolCallId, WithResolved } from "./AiResponse.js"
import * as AiRole from "./AiRole.js"

Expand Down
2 changes: 1 addition & 1 deletion packages/ai/ai/src/AiResponse.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* @since 1.0.0
*/
import * as Schema from "@effect/schema/Schema"
import * as Chunk from "effect/Chunk"
import * as Data from "effect/Data"
import * as Effect from "effect/Effect"
import * as Iterable from "effect/Iterable"
import * as Option from "effect/Option"
import * as Predicate from "effect/Predicate"
import * as Schema from "effect/Schema"
import { AiError } from "./AiError.js"
import * as AiRole from "./AiRole.js"

Expand Down
2 changes: 1 addition & 1 deletion packages/ai/ai/src/AiRole.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @since 1.0.0
*/
import * as Schema from "@effect/schema/Schema"
import * as Option from "effect/Option"
import * as Schema from "effect/Schema"

/**
* @since 1.0.0
Expand Down
11 changes: 5 additions & 6 deletions packages/ai/ai/src/AiToolkit.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* @since 1.0.0
*/
import type * as Schema from "@effect/schema/Schema"
import type * as Serializable from "@effect/schema/Serializable"
import * as Context from "effect/Context"
import * as Effect from "effect/Effect"
import * as Effectable from "effect/Effectable"
Expand All @@ -11,6 +9,7 @@ import * as HashMap from "effect/HashMap"
import * as Inspectable from "effect/Inspectable"
import * as Layer from "effect/Layer"
import { pipeArguments } from "effect/Pipeable"
import type * as Schema from "effect/Schema"
import type { Scope } from "effect/Scope"
import type * as Types from "effect/Types"

Expand Down Expand Up @@ -82,27 +81,27 @@ export declare namespace Tool {
export interface AnySchema {
readonly [Schema.TypeId]: any
readonly _tag: string
readonly Type: Serializable.SerializableWithResult.All
readonly Type: Schema.SerializableWithResult.All
readonly success: Schema.Schema.Any
}

/**
* @since 1.0.0
* @category tool
*/
export type Success<Tool extends AnySchema> = Serializable.WithResult.Success<Tool["Type"]>
export type Success<Tool extends AnySchema> = Schema.WithResult.Success<Tool["Type"]>

/**
* @since 1.0.0
* @category tool
*/
export type Failure<Tool extends AnySchema> = Serializable.WithResult.Failure<Tool["Type"]>
export type Failure<Tool extends AnySchema> = Schema.WithResult.Failure<Tool["Type"]>

/**
* @since 1.0.0
* @category tool
*/
export type Context<Tool extends AnySchema> = Serializable.WithResult.Context<Tool["Type"]>
export type Context<Tool extends AnySchema> = Schema.WithResult.Context<Tool["Type"]>

/**
* @since 1.0.0
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/ai/src/Completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* @since 1.0.0
*/
import * as JsonSchema from "@effect/platform/OpenApiJsonSchema"
import * as AST from "@effect/schema/AST"
import * as Schema from "@effect/schema/Schema"
import * as Chunk from "effect/Chunk"
import * as Context from "effect/Context"
import * as Effect from "effect/Effect"
import * as HashMap from "effect/HashMap"
import * as Option from "effect/Option"
import * as Schema from "effect/Schema"
import * as AST from "effect/SchemaAST"
import * as Stream from "effect/Stream"
import type { Concurrency } from "effect/Types"
import { AiError } from "./AiError.js"
Expand Down
3 changes: 1 addition & 2 deletions packages/ai/ai/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"extends": "./tsconfig.src.json",
"references": [
{ "path": "../../effect/tsconfig.build.json" },
{ "path": "../../platform/tsconfig.build.json" },
{ "path": "../../schema/tsconfig.build.json" }
{ "path": "../../platform/tsconfig.build.json" }
],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo",
Expand Down
6 changes: 1 addition & 5 deletions packages/ai/ai/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"references": [
{ "path": "../../effect" },
{ "path": "../../platform" },
{ "path": "../../schema" }
],
"references": [{ "path": "../../effect" }, { "path": "../../platform" }],
"compilerOptions": {
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
"rootDir": "src",
Expand Down
1 change: 0 additions & 1 deletion packages/ai/ai/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{ "path": "tsconfig.src.json" },
{ "path": "../../effect" },
{ "path": "../../platform" },
{ "path": "../../schema" },
{ "path": "../../vitest" }
],
"compilerOptions": {
Expand Down
57 changes: 12 additions & 45 deletions packages/ai/openai/docgen.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,25 @@
{
"$schema": "../../../node_modules/@effect/docgen/schema.json",
"exclude": [
"src/Generated.ts",
"src/internal/**/*.ts"
],
"exclude": ["src/Generated.ts", "src/internal/**/*.ts"],
"examplesCompilerOptions": {
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"moduleResolution": "Bundler",
"module": "ES2022",
"target": "ES2022",
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"paths": {
"effect": [
"../../../../effect/src/index.js"
],
"effect/*": [
"../../../../effect/src/*.js"
],
"@effect/experimental": [
"../../../../experimental/src/index.js"
],
"@effect/experimental/*": [
"../../../../experimental/src/*.js"
],
"@effect/platform": [
"../../../../platform/src/index.js"
],
"@effect/platform/*": [
"../../../../platform/src/*.js"
],
"@effect/schema": [
"../../../../schema/src/index.js"
],
"@effect/schema/*": [
"../../../../schema/src/*.js"
],
"@effect/ai": [
"../../../ai/src/index.js"
],
"@effect/ai/*": [
"../../../ai/src/*.js"
],
"@effect/ai-openai": [
"../../../ai-openai/src/index.js"
],
"@effect/ai-openai/*": [
"../../../ai-openai/src/*.js"
]
"effect": ["../../../../effect/src/index.js"],
"effect/*": ["../../../../effect/src/*.js"],
"@effect/experimental": ["../../../../experimental/src/index.js"],
"@effect/experimental/*": ["../../../../experimental/src/*.js"],
"@effect/platform": ["../../../../platform/src/index.js"],
"@effect/platform/*": ["../../../../platform/src/*.js"],
"@effect/ai": ["../../../ai/src/index.js"],
"@effect/ai/*": ["../../../ai/src/*.js"],
"@effect/ai-openai": ["../../../ai-openai/src/index.js"],
"@effect/ai-openai/*": ["../../../ai-openai/src/*.js"]
}
}
}
Loading

0 comments on commit bff0e80

Please sign in to comment.