-
Notifications
You must be signed in to change notification settings - Fork 517
feat(cli): generate types natively with postgrest-typegen #6404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
avallete
wants to merge
19
commits into
develop
Choose a base branch
from
claude/postgrest-typegen-cli-wud64e
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
039866a
feat(cli): generate types natively with postgrest-typegen (CLI-2279)
claude 6d8c60d
fix(cli): adapt gen types TLS to the server and bundle prettier cleanly
claude d522373
Merge origin/develop into claude/postgrest-typegen-cli-wud64e
claude ebb449b
feat(cli): upgrade postgrest-typegen to 0.2.0 (oxfmt formatter)
claude 282b509
Merge origin/develop into claude/postgrest-typegen-cli-wud64e
avallete 446f55d
fix(cli): restore gen types TLS pinning and timeout parity
avallete 2d2cd81
fix(cli): pin gen types CA only when the SSL probe reports TLS
avallete 39cb157
chore(cli): trim leftover gen types review nits
avallete 9e2e29d
fix(cli): mark oxfmt optional plugins external on musl builds
avallete b3fd2dc
fix(cli): retry gen types pooler fallback on native ENOTFOUND
avallete 2edc793
fix(cli): typecheck published typegen types instead of bun source
avallete ff72277
merge: origin/develop into claude/postgrest-typegen-cli-wud64e
avallete 4894323
fix(cli): keep typegen type pins off bun's tsconfig
avallete 4eb2b6e
fix(cli): generate types with postgrest-typegen 0.2.1
avallete abdb6aa
merge: origin/develop into claude/postgrest-typegen-cli-wud64e
avallete 8ce5cfa
fix(cli): reject sub-second gen types timeouts that disable the bound
avallete 5b2115a
fix(cli): warn when gen types ignores --network-id
avallete baea74f
Merge branch 'develop' into claude/postgrest-typegen-cli-wud64e
avallete 174ebfd
fix(cli): fail closed on gen types TLS probe and warn pre-path --netw…
avallete File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,22 @@ | ||
| /** | ||
| * Optional prettier plugins that `oxfmt`'s dist lazily `import()`s for | ||
| * non-TypeScript file types (liquid, pug, astro, …). They are not installed — | ||
| * gen types only ever formats generated TypeScript, through the statically | ||
| * embedded binding in `src/legacy/commands/gen/types/types.oxfmt.ts` — but | ||
| * `bun build` still tries to resolve every analyzable dynamic import, so each | ||
| * one must be marked external for the compile to succeed. Shared by the dev | ||
| * build (`build-binary.ts`) and the multi-target release build (`build.ts`). | ||
| */ | ||
| export const OXFMT_OPTIONAL_PLUGIN_EXTERNALS = [ | ||
| "@prettier/plugin-hermes", | ||
| "@prettier/plugin-oxc", | ||
| "@prettier/plugin-pug", | ||
| "@shopify/prettier-plugin-liquid", | ||
| "@zackad/prettier-plugin-twig", | ||
| "prettier-plugin-astro", | ||
| "prettier-plugin-marko", | ||
| ] as const; | ||
|
|
||
| export const oxfmtExternalArgs = OXFMT_OPTIONAL_PLUGIN_EXTERNALS.map( | ||
| (name) => `--external=${name}`, | ||
| ); |
165 changes: 112 additions & 53 deletions
165
apps/cli/src/legacy/commands/gen/types/SIDE_EFFECTS.md
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
apps/cli/src/legacy/commands/gen/types/templates/prod-ca-2021.ts
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
apps/cli/src/legacy/commands/gen/types/templates/prod-ca-2025.ts
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
apps/cli/src/legacy/commands/gen/types/templates/staging-ca-2021.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
54 changes: 54 additions & 0 deletions
54
apps/cli/src/legacy/commands/gen/types/types.generator.layer.integration.test.ts
This file contains hidden or 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,54 @@ | ||
| import { describe, expect, it } from "@effect/vitest"; | ||
| import { BunServices } from "@effect/platform-bun"; | ||
| import { Effect, Exit, Layer } from "effect"; | ||
|
|
||
| import { | ||
| LegacyPgDeltaSslProbe, | ||
| LegacyPgDeltaSslProbeError, | ||
| } from "../../../shared/legacy-pgdelta-ssl-probe.service.ts"; | ||
| import { legacyGenTypesGeneratorLayer } from "./types.generator.layer.ts"; | ||
| import { LegacyGenTypesGenerator } from "./types.generator.ts"; | ||
|
|
||
| function failingProbeLayer(message: string) { | ||
| return Layer.succeed(LegacyPgDeltaSslProbe, { | ||
| requireSsl: () => Effect.fail(new LegacyPgDeltaSslProbeError({ message })), | ||
| requireSslForHost: () => Effect.fail(new LegacyPgDeltaSslProbeError({ message })), | ||
| }); | ||
| } | ||
|
|
||
| describe("legacyGenTypesGeneratorLayer", () => { | ||
| it.live("fails closed when the remote SSL probe cannot determine TLS capability", () => { | ||
| const layer = legacyGenTypesGeneratorLayer.pipe( | ||
| Layer.provide(failingProbeLayer("connection refused")), | ||
| Layer.provide(BunServices.layer), | ||
| ); | ||
|
|
||
| return Effect.gen(function* () { | ||
| const generator = yield* LegacyGenTypesGenerator; | ||
| const exit = yield* generator | ||
| .generate({ | ||
| conn: { | ||
| host: "db.example.com", | ||
| port: 5432, | ||
| user: "postgres", | ||
| password: "secret", | ||
| database: "postgres", | ||
| }, | ||
| isLocal: false, | ||
| dnsResolver: "https", | ||
| lang: "go", | ||
| includedSchemas: [], | ||
| postgrestV9Compat: false, | ||
| swiftAccessControl: "internal", | ||
| queryTimeoutSeconds: 15, | ||
| }) | ||
| .pipe(Effect.exit); | ||
|
|
||
| expect(Exit.isFailure(exit)).toBe(true); | ||
| if (Exit.isFailure(exit)) { | ||
| expect(String(exit.cause)).toContain("LegacyPgDeltaSslProbeError"); | ||
| expect(String(exit.cause)).toContain("connection refused"); | ||
| } | ||
| }).pipe(Effect.provide(layer)); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.