rename @tool → @expose; codegen consistency check#77
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a broad cleanup/refactor that renames the exoeval surface decorator from @tool to @expose across the library, codegen output, tests, docs, and the playground/demo site, while also adding a Database.close() API and improving the playground UI (wire log + output diffing).
Changes:
- Rename the public decorator API from
tooltoexpose(includingexpose.unchecked) and update all call sites, codegen, and documentation accordingly. - Add
Database.close()to allow scripts to terminate cleanly by shutting down the underlying driver/pool. - Add/expand end-to-end validation (README usage snippet test) and enhance the playground UI (wire log panel, improved widget controls, output diff behavior).
Reviewed changes
Copilot reviewed 40 out of 121 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Update decorator name in SWC/decorator pipeline comment. |
| tsdown.config.ts | Update decorator name in SWC/decorator pipeline comment. |
| src/types/overrides/any.ts | Switch tool import/usage to expose for override methods. |
| src/types/generated/xml.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/xid8.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/xid.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/varchar.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/varbit.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/uuid.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/unknown.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/txid_snapshot.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/tsvector.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/timetz.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/time.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/tid.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regtype.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regrole.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regprocedure.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regproc.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regoperator.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regoper.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regnamespace.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regdictionary.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regconfig.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regcollation.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/regclass.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/refcursor.ts | Switch generated import from tool to expose. |
| src/types/generated/record.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/pg_snapshot.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/pg_node_tree.ts | Switch generated import from tool to expose. |
| src/types/generated/pg_ndistinct.ts | Switch generated import from tool to expose. |
| src/types/generated/pg_mcv_list.ts | Switch generated import from tool to expose. |
| src/types/generated/pg_lsn.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/pg_dependencies.ts | Switch generated import from tool to expose. |
| src/types/generated/pg_brin_minmax_multi_summary.ts | Switch generated import from tool to expose. |
| src/types/generated/pg_brin_bloom_summary.ts | Switch generated import from tool to expose. |
| src/types/generated/path.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/oid.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/macaddr8.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/macaddr.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/jsonpath.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/json.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/gtsvector.ts | Switch generated import from tool to expose. |
| src/types/generated/cidr.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/cid.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/char.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/bool.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/anynonarray.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/anyenum.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/anyelement.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/anycompatiblerange.ts | Switch generated import from tool to expose. |
| src/types/generated/anycompatiblenonarray.ts | Switch generated import from tool to expose. |
| src/types/generated/anycompatiblemultirange.ts | Switch generated import from tool to expose. |
| src/types/generated/anycompatiblearray.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/anycompatible.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/any.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generated/aclitem.ts | Replace @tool.unchecked() with @expose.unchecked() in generated type. |
| src/types/generate.ts | Update generator template to emit expose import and @expose.unchecked(). |
| src/tables/generate.ts | Update table codegen to emit @expose() decorators and preserve decoration state. |
| src/tables/generate.test.ts | Update snapshots/tests for the new decorator naming. |
| src/rpc.test.ts | Update test fixtures to use expose decorator. |
| src/readme.test.ts | Add an end-to-end test that compiles/runs the README Usage snippet in a fresh install. |
| src/index.ts | Re-export expose (instead of tool) and keep the convenience typegres() factory. |
| src/exoeval/tool.ts | Rename decorator export from tool to expose (including expose.unchecked). |
| src/exoeval/tool.test.ts | Update decorator tests to use expose. |
| src/exoeval/rpc.test.ts | Update RPC protocol tests and docs to use expose. |
| src/exoeval/index.ts | Re-export expose from the exoeval entrypoint. |
| src/exoeval/evaluator.test.ts | Update evaluator tests to use expose and adjust wording. |
| src/database.ts | Add Database.close() to shut down the underlying driver/pool. |
| src/builder/update.ts | Update builder method decorators from @tool to @expose. |
| src/builder/query.ts | Update builder method decorators from @tool to @expose. |
| src/builder/query.test.ts | Add a regression test around select callback return validation messaging. |
| src/builder/insert.ts | Update builder method decorators from @tool to @expose. |
| src/builder/delete.ts | Update builder method decorators from @tool to @expose. |
| site/src/pages/_PlayWidgets.tsx | Add manual “fire” buttons + auto toggles; adjust grouped query output. |
| site/src/pages/_PlayActiveArea.tsx | Add resizable wire log panel; improve output diffing/render lifecycle. |
| site/src/pages/_HomePage.tsx | Update landing-page snippets to new @expose API and updated db.Table usage. |
| site/src/demo/wire-log.ts | Add a bounded pub/sub store for wire traffic events. |
| site/src/demo/widgets/orders.ts | Update demo widget query to include aggregates and debugging. |
| site/src/demo/server/api.ts | Update demo API to expose; wrap channel to log requests/responses. |
| site/src/demo/schema/users.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/shipments.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/organizations.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/orders.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/order_lines.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/locations.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/inventory_positions.ts | Update generated schema decorators/imports to expose. |
| site/src/demo/schema/customers.ts | Update generated schema decorators/imports to expose. |
| site/src/components/WireLog.tsx | New UI component that renders wire log entries. |
| site/.gitignore | Ignore local-only working artifacts. |
| README.md | Refresh README with new API (@expose) and add explicit db.close() usage. |
| eslint.config.js | Update restricted-syntax rule from tool.unchecked to expose.unchecked. |
| docs/ISSUES.md | Mark the rename task done; minor doc maintenance. |
| docs/ARCHITECTURE.md | Add a new architecture doc describing the system and API surface. |
| docs/AGENTS.md | Document a repo convention for helper extraction/inlining. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const WireLog = () => { | ||
| const [entries, setEntries] = useState<WireEntry[]>([]); | ||
|
|
||
| useEffect(() => wireLog.subscribe(setEntries), []); |
- Rename: decorator export, namespace, all call sites, ESLint rule,
codegen template, regenerated outputs.
- Codegen template was emitting `import { tool }` alongside
`@expose()` in the body — visible only on a fresh `tg generate`.
Fixed.
- Inline snapshot tests in `src/tables/generate.test.ts` now pipe
each output through `swc.transform` + assert every `@<X>()` has
a matching import. Caught the above.
- Misc: site homepage code sample fixes (`@expose(z.string())`,
literal in `ilike`), README dev section + `.live()` references,
`pg_notify` planned-item phrasing.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
import { tool }alongside@expose()in the body — visible only on a freshtg generate. Fixed.src/tables/generate.test.tsnow pipe each output throughswc.transform+ assert every@<X>()has a matching import. Caught the above.@expose(z.string()), literal inilike), README dev section +.live()references,pg_notifyplanned-item phrasing.