-
Notifications
You must be signed in to change notification settings - Fork 1
filtered metadata #80
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cursor review |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@proofkit/better-auth
@proofkit/cli
create-proofkit
@proofkit/fmdapi
@proofkit/fmodata
@proofkit/typegen
@proofkit/webviewer
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Schema extraction logic incompatible with new storage format
The schema storage format changed from a Zod object schema (with ~standard.schema.shape structure) to a plain Partial<Record<keyof TFields, StandardSchemaV1>> in table.ts. However, the extraction logic in entity-set.ts and response-processor.ts still tries to access tableSchema["~standard"]?.schema.shape, which doesn't exist on plain objects. This causes schema to always be undefined, silently disabling all field validation.
packages/fmodata/src/client/entity-set.ts#L126-L137
proofkit/packages/fmodata/src/client/entity-set.ts
Lines 126 to 137 in c4df417
| if (tableSchema) { | |
| // Extract schema from StandardSchemaV1 | |
| const zodSchema = tableSchema["~standard"]?.schema; | |
| if ( | |
| zodSchema && | |
| typeof zodSchema === "object" && | |
| "shape" in zodSchema | |
| ) { | |
| schema = zodSchema.shape as Record<string, StandardSchemaV1>; | |
| } | |
| } |
packages/fmodata/src/client/entity-set.ts#L231-L242
proofkit/packages/fmodata/src/client/entity-set.ts
Lines 231 to 242 in c4df417
| if (tableSchema) { | |
| // Extract schema from StandardSchemaV1 | |
| const zodSchema = tableSchema["~standard"]?.schema; | |
| if ( | |
| zodSchema && | |
| typeof zodSchema === "object" && | |
| "shape" in zodSchema | |
| ) { | |
| schema = zodSchema.shape as Record<string, StandardSchemaV1>; | |
| } | |
| } |
packages/fmodata/src/client/query/response-processor.ts#L198-L205
proofkit/packages/fmodata/src/client/query/response-processor.ts
Lines 198 to 205 in c4df417
| if (occurrence) { | |
| const tableSchema = (occurrence as any)[FMTableClass.Symbol.Schema]; | |
| if (tableSchema) { | |
| const zodSchema = tableSchema["~standard"]?.schema; | |
| if (zodSchema && typeof zodSchema === "object" && "shape" in zodSchema) { | |
| schema = zodSchema.shape as Partial<Record<string, StandardSchemaV1>>; | |
| } | |
| } |
c4df417 to
ed407b9
Compare
…tion testing - Introduced a new state to control loading of tables based on configuration. - Added connection testing logic to display appropriate messages for connection errors. - Updated useListTables hook to accept an enabled parameter for conditional querying. - Improved loading and error handling UI to provide better user feedback.
…ction - Added support for `reduceMetadata` option in the typegen configuration for `fmdapi_test` table, allowing for field-specific overrides. - Updated the `ConfigEditor` component to include a toggle for reducing metadata annotations. - Improved `MetadataFieldsDialog` to manage variable name and reduce metadata settings for individual tables. - Refactored `generateODataTablesSingle` to utilize the new `reduceMetadata` configuration.
- Deleted unused OData schema files: contacts, customer, related, user_customer, users, fmdapi_test, isolated_contacts, and their corresponding index entries. - Updated typegen configuration to include `alwaysOverrideFieldNames` option, allowing for more flexible field name management during schema generation. - Improved handling of existing fields in `generateODataTypes` to preserve user customizations and manage field name updates based on metadata.
This commit refactors the logic for preserving user-defined chained calls in generated types. It also updates dependencies in pnpm-lock.yaml and adds a new test file for preserving user customizations. Co-authored-by: eric.luce <eric.luce@proofgeist.com>
|
Cursor Agent can help with this pull request. Just |
| expect(regenerated).toContain(`textField as tf`); | ||
| expect(regenerated).toContain(`z as zod`); | ||
| // Verify the code still uses the aliases | ||
| expect(regenerated).toContain(`tf().entityId("F1")`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test expects behavior that implementation doesn't provide
Test 3 asserts that tf().entityId("F1") appears in the regenerated output, expecting the field builder alias from the existing file to be preserved. However, mapODataTypeToFieldBuilder always generates canonical function names like textField(), not aliases. The regenerated code will contain textField().entityId("F1")... instead of tf().entityId("F1"). This test will fail because the implementation preserves user method customizations (like .inputValidator()) but not field builder aliases.
Additional Locations (1)
| await fs.writeFile( | ||
| existingFilePath, | ||
| [ | ||
| `import { fmTableOccurrence, textField } from "@proofkit/fmdapi";`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test fixtures use wrong package name causing invalid output
All three tests create fixture files with imports from @proofkit/fmdapi, but the generator produces required imports from @proofkit/fmodata. The import merging logic keeps both since they're different modules, resulting in regenerated files with duplicate identifier declarations (fmTableOccurrence, textField). This produces invalid TypeScript that would fail compilation. The tests pass only because they check for substring presence rather than TypeScript validity.

Note
Adds
npx @proofkit/typegen uiweb UI for configuring/running typegen with (beta) OData support, introduces per‑table metadata/typegen flow, and updates fmodata client to fetch targeted/reduced metadata, list tables, and improve schema/comment handling.npx @proofkit/typegen@latest uilaunches a web UI to edit/save config, test connections, pick OData tables/fields, and run typegen.@proofkit/typegen/webui-serverfor the UI server; Vite config and path aliases wired.tableslist; addreduceMetadataandalwaysOverrideFieldNames; field-level exclude/type overrides; updated JSON schema/types./api/config,/api/run,/api/list-tables,/api/table-metadata,/api/test-connection, etc.Database.getMetadatasupportstableNameandreduceAnnotations; newlistTableNames().FieldBuilder.comment()and table comments; propagate through validation/expand/processing.getTableSchema; adjust validation types toPartial<Record<...>>.0.1.0-alpha.20.Written by Cursor Bugbot for commit 254538c. This will update automatically on new commits. Configure here.