chore: upgrade Effect to beta.98 (#37498)
This commit is contained in:
parent
b26d948b76
commit
44f7bb71c1
37 changed files with 316 additions and 138 deletions
|
|
@ -3,7 +3,14 @@ import { mkdtemp, rm } from "node:fs/promises"
|
|||
import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { Effect, FileSystem, Schema, SchemaAST, SchemaGetter } from "effect"
|
||||
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi"
|
||||
import {
|
||||
HttpApi,
|
||||
HttpApiEndpoint,
|
||||
HttpApiGroup,
|
||||
HttpApiMiddleware,
|
||||
HttpApiSchema,
|
||||
OpenApi,
|
||||
} from "effect/unstable/httpapi"
|
||||
import { format } from "prettier"
|
||||
import {
|
||||
compile as compileContract,
|
||||
|
|
@ -17,11 +24,11 @@ import {
|
|||
import { it } from "./effect"
|
||||
import { Api as FixtureApi, Missing } from "./fixture"
|
||||
|
||||
function api(endpoint: HttpApiEndpoint.Any) {
|
||||
function api(endpoint: HttpApiEndpoint.Constraint) {
|
||||
return HttpApi.make("test").add(HttpApiGroup.make("session").add(endpoint))
|
||||
}
|
||||
|
||||
function compile<Id extends string, Groups extends HttpApiGroup.Any>(source: HttpApi.HttpApi<Id, Groups>) {
|
||||
function compile<Id extends string, Groups extends HttpApiGroup.Constraint>(source: HttpApi.HttpApi<Id, Groups>) {
|
||||
return emitEffect(compileContract(source))
|
||||
}
|
||||
|
||||
|
|
@ -385,7 +392,7 @@ describe("HttpApiCodegen.generate", () => {
|
|||
)
|
||||
const contract = compileContract(source, { omitEndpoints: new Set(["pty.connect"]) })
|
||||
|
||||
expect(contract.groups[0]?.endpoints.map((endpoint) => endpoint.endpoint.name)).toEqual(["pty.get"])
|
||||
expect(contract.groups[0]?.endpoints.map((endpoint) => endpoint.endpoint.identifier)).toEqual(["pty.get"])
|
||||
})
|
||||
|
||||
test("uses bracket access for input field names", () => {
|
||||
|
|
@ -528,7 +535,9 @@ describe("HttpApiCodegen.generate", () => {
|
|||
const types = output.files.find((file) => file.path === "types.ts")?.content
|
||||
|
||||
expect(types).toContain('readonly "values": ReadonlyArray<string>')
|
||||
expect(types).toContain('export type SessionCreateOutput = ({ "data": Array<{ "values": Array<string> }> })["data"]')
|
||||
expect(types).toContain(
|
||||
'export type SessionCreateOutput = ({ "data": Array<{ "values": Array<string> }> })["data"]',
|
||||
)
|
||||
})
|
||||
|
||||
test("retains distinct Promise references at identifier boundaries", () => {
|
||||
|
|
@ -1193,7 +1202,7 @@ describe("HttpApiCodegen.generate", () => {
|
|||
new SchemaAST.Link(Schema.String.check(Schema.isMinLength(2)).ast, link.transformation),
|
||||
])
|
||||
if (!SchemaAST.isAST(ast)) throw new Error("Expected altered schema AST")
|
||||
const Altered = Schema.make(ast)
|
||||
const Altered = Schema.make<Schema.Top>(ast)
|
||||
|
||||
expect(() => compile(api(HttpApiEndpoint.get("get", "/session", { success: Altered })))).toThrow(
|
||||
"Effect schema requires authoritative import: session.get",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export const Group1 = HttpApiGroup.make("event", { topLevel: false }).add(
|
|||
}),
|
||||
)
|
||||
|
||||
type RawGroup = HttpApiClient.Client.Group<typeof Group1, "event", never, never>
|
||||
type RawGroup = HttpApiClient.Client.Group<typeof Group1, never, never>
|
||||
|
||||
const Endpoint0DeclaredError = Schema.Union([Endpoint0SuccessError])
|
||||
const mapEndpoint0Error = (error: unknown) =>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const Group0 = HttpApiGroup.make("session", { topLevel: false })
|
|||
}),
|
||||
)
|
||||
|
||||
type RawGroup = HttpApiClient.Client.Group<typeof Group0, "session", never, never>
|
||||
type RawGroup = HttpApiClient.Client.Group<typeof Group0, never, never>
|
||||
|
||||
const Endpoint0DeclaredError = Schema.Never
|
||||
const mapEndpoint0Error = (error: unknown) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue