chore: upgrade Effect to beta.98 (#37498)

This commit is contained in:
Kit Langton 2026-07-17 10:31:27 -04:00 committed by GitHub
commit 44f7bb71c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 316 additions and 138 deletions

View file

@ -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",