diff --git a/packages/core/ext/Schema/Openapi/_openapi/index.ts b/packages/infra/Openapi/_openapi/index.ts similarity index 98% rename from packages/core/ext/Schema/Openapi/_openapi/index.ts rename to packages/infra/Openapi/_openapi/index.ts index 277b720..cf30cbe 100644 --- a/packages/core/ext/Schema/Openapi/_openapi/index.ts +++ b/packages/infra/Openapi/_openapi/index.ts @@ -11,9 +11,19 @@ import { referenced, StringSchema, } from "@atlas-ts/plutus" -import * as T from "@effect-ts/core/Effect" -import * as O from "@effect-ts/core/Option" import { + constrainedStringIdentifier, + EmailFromStringIdentifier, + EmailIdentifier, + PhoneNumberFromStringIdentifier, + PhoneNumberIdentifier, + boolIdentifier, + nullableIdentifier, + UUIDFromStringIdentifier, + hasContinuation, + intersectIdentifier, + SchemaContinuationSymbol, + unionIdentifier, arrayIdentifier, chunkIdentifier, dateIdentifier, @@ -28,25 +38,11 @@ import { positiveIntIdentifier, propertiesIdentifier, stringIdentifier, -} from "@effect-ts/schema" +} from "@effect-ts-demo/core/ext/Schema" +import * as T from "@effect-ts/core/Effect" +import * as O from "@effect-ts/core/Option" -import { - constrainedStringIdentifier, - EmailFromStringIdentifier, - EmailIdentifier, - PhoneNumberFromStringIdentifier, - PhoneNumberIdentifier, -} from "../../_api" import * as S from "../_schema" -import { - boolIdentifier, - nullableIdentifier, - UUIDFromStringIdentifier, - hasContinuation, - intersectIdentifier, - SchemaContinuationSymbol, - unionIdentifier, -} from "../_schema" export type Gen = T.UIO diff --git a/packages/core/ext/Schema/Openapi/_schema.ts b/packages/infra/Openapi/_schema.ts similarity index 76% rename from packages/core/ext/Schema/Openapi/_schema.ts rename to packages/infra/Openapi/_schema.ts index 94d92af..d2dd5dd 100644 --- a/packages/core/ext/Schema/Openapi/_schema.ts +++ b/packages/infra/Openapi/_schema.ts @@ -1,15 +1,21 @@ -import { HasContinuation, Schema, SchemaAny, SchemaContinuationSymbol } from "../vendor" +import { + AnyError, + HasContinuation, + Schema, + SchemaAny, + SchemaContinuationSymbol, +} from "@effect-ts-demo/core/ext/Schema" import type { JSONSchema } from "@atlas-ts/plutus" -export * from "../" +export * from "@effect-ts-demo/core/ext/Schema" export class SchemaOpenApi< ParserInput, - ParserError, + ParserError extends AnyError, ParsedShape, ConstructorInput, - ConstructorError, + ConstructorError extends AnyError, Encoded, Api > @@ -44,7 +50,14 @@ export class SchemaOpenApi< } export function openapi(f: () => JSONSchema) { - return ( + return < + ParserInput, + ParserError extends AnyError, + ConstructorInput, + ConstructorError extends AnyError, + Encoded, + Api + >( self: Schema< ParserInput, ParserError, @@ -67,10 +80,10 @@ export function openapi(f: () => JSONSchema) { export function openapi_< ParserInput, - ParserError, + ParserError extends AnyError, ParsedShape, ConstructorInput, - ConstructorError, + ConstructorError extends AnyError, Encoded, Api >( diff --git a/packages/core/ext/Schema/Openapi/index.ts b/packages/infra/Openapi/index.ts similarity index 100% rename from packages/core/ext/Schema/Openapi/index.ts rename to packages/infra/Openapi/index.ts diff --git a/packages/infra/context/schema.ts b/packages/infra/context/schema.ts index b19eb2c..85dcb0a 100644 --- a/packages/infra/context/schema.ts +++ b/packages/infra/context/schema.ts @@ -8,10 +8,10 @@ import * as Sy from "@effect-ts/core/Sync" export function makeCodec< ParserInput, - ParserError, // extends S.AnyError, + ParserError extends S.AnyError, ParsedShape extends { id: Id }, ConstructorInput, - ConstructorError, + ConstructorError extends S.AnyError, Encoded, Api, Id diff --git a/packages/infra/express/schema/routing.ts b/packages/infra/express/schema/routing.ts index a6a993e..e517fa3 100644 --- a/packages/infra/express/schema/routing.ts +++ b/packages/infra/express/schema/routing.ts @@ -7,13 +7,14 @@ import { } from "@atlas-ts/plutus" import * as EO from "@effect-ts-demo/core/ext/EffectOption" import * as S from "@effect-ts-demo/core/ext/Schema" -import * as OpenApi from "@effect-ts-demo/core/ext/Schema/Openapi" import { pipe } from "@effect-ts/core" import * as A from "@effect-ts/core/Collections/Immutable/Array" import * as T from "@effect-ts/core/Effect" import * as O from "@effect-ts/core/Option" import * as Ex from "@effect-ts/express" +import * as OpenApi from "../../Openapi" + import { makeRequestHandler, Middleware,