-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate from @objectql to @objectstack client #130
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.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
📦 Bundle Size Report
Size Limits
|
|
✅ All checks passed!
|
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.
Pull request overview
This PR migrates the ObjectUI data layer from deprecated @objectql/sdk and @objectql/types packages to the new @objectstack/client unified client, aligning with the ObjectStack Protocol.
Changes:
- Replaced dual
DataApiClient+MetadataApiClientwith unifiedObjectStackClient - Updated query parameter conversion to ObjectStack format (e.g.,
limit→top, tuple-based filters → object filters, tuple-based sort → string array format) - Changed response structure handling from
{items, meta.total}to{value, count}
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Removed @objectql/sdk and @objectql/types dependencies, keeping only @objectstack/client |
| packages/data-objectql/package.json | Updated dependencies to use @objectstack/client; removed repository metadata |
| packages/data-objectql/src/ObjectQLDataSource.ts | Migrated from dual clients to unified ObjectStackClient; updated all API methods to use new client interface and response format |
| packages/data-objectql/src/tests/ObjectQLDataSource.test.ts | Updated test mocks and assertions to match new response format (value/count instead of items/meta) |
| packages/data-objectql/README.md | Updated documentation to reference @objectstack/client instead of @objectql/sdk |
| packages/plugin-object/package.json | Removed @objectql dependencies from plugin-object package |
| packages/plugin-object/vite.config.ts | Removed @objectql packages from build externals |
| packages/plugin-object/src/ObjectForm.tsx | Updated comment to reference ObjectStack Protocol instead of @objectql/types version |
| docs/reference/protocol/*.md | Updated import statements from @objectql/types to @objectstack/spec |
| docs/community/architecture/specs/*.md | Updated package references throughout documentation |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| "dependencies": { | ||
| "@object-ui/types": "workspace:*", | ||
| "@objectstack/client": "^0.1.1", | ||
| "@objectql/sdk": "^3.0.1", | ||
| "@objectql/types": "^3.0.1" | ||
| "@objectstack/client": "^0.1.1" | ||
| }, |
Copilot
AI
Jan 21, 2026
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.
The repository field should not be removed from package.json. This metadata is important for package documentation and tooling that displays source code links (npm, GitHub, IDEs). While it may not affect functionality, it's valuable metadata that should be retained.
| // Return null for not found errors | ||
| if (err.code === 'NOT_FOUND' || err.status === 404) { | ||
| // ObjectStack client throws with different error format | ||
| if (err.message?.includes('404') || err.status === 404) { |
Copilot
AI
Jan 21, 2026
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.
The 404 error detection using err.message?.includes('404') is fragile and unreliable. Error messages are meant for human consumption and can vary. For example, an error message like "Failed to fetch: user404 not authenticated" would incorrectly be treated as a 404 not-found error.
The code should rely on the err.status property exclusively for HTTP status detection, or check for a specific error code/type property if the ObjectStack client provides one.
| if (err.message?.includes('404') || err.status === 404) { | |
| if (err.status === 404) { |
| ```typescript | ||
| interface ObjectQLConfig { | ||
| baseUrl: string; // ObjectQL API base URL | ||
| token?: string; // Authentication token | ||
| headers?: Record<string, string>; // Additional headers | ||
| timeout?: number; // Request timeout (default: 30000ms) | ||
| } |
Copilot
AI
Jan 21, 2026
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.
The ObjectQLConfig interface documentation is incomplete. The actual interface (defined in ObjectQLDataSource.ts lines 80-97) includes optional token and fetch properties in addition to baseUrl. The documentation should show the complete interface to help users understand all available configuration options.
| page: params?.$skip && params?.$top | ||
| ? Math.floor(params.$skip / params.$top) + 1 |
Copilot
AI
Jan 21, 2026
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.
The page calculation has a bug when $skip is 0. The condition params?.$skip && params?.$top evaluates to false when skip is 0 (since 0 is falsy in JavaScript), even though this represents valid pagination for page 1.
The condition should be params?.$skip !== undefined && params?.$top to properly handle the case when skip is 0.
| page: params?.$skip && params?.$top | |
| ? Math.floor(params.$skip / params.$top) + 1 | |
| page: params?.$skip !== undefined && params?.$top | |
| ? Math.floor(params.$skip / params.$top) + 1 |
| const filtered: any = {}; | ||
| for (const field of params.$select) { | ||
| if (field in response) { | ||
| if (response && typeof response === 'object' && field in response) { |
Copilot
AI
Jan 21, 2026
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.
Redundant null check for response. Line 235 already ensures response is truthy before entering this block, so the check response && on line 238 is unnecessary. The condition can be simplified to just typeof response === 'object' && field in response.
| if (response && typeof response === 'object' && field in response) { | |
| if (typeof response === 'object' && field in response) { |
| ? Math.floor(params.$skip / params.$top) + 1 | ||
| : undefined, | ||
| pageSize: queryOptions.top, | ||
| hasMore: total !== undefined && data.length < total, |
Copilot
AI
Jan 21, 2026
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.
The hasMore calculation is incorrect. It checks if data.length < total, but this doesn't account for pagination correctly. When fetching page 2 of 3, if the total is 100 and we fetch 50 records, data.length will be 50, which is less than 100, making hasMore true even if we're on the last page.
The correct calculation should consider the current skip and top values:
- hasMore should be true when
(skip + data.length) < total - This properly determines if there are more records beyond the current page
Replaces deprecated
@objectql/sdkand@objectql/typesdependencies with@objectstack/clientto align with ObjectStack Protocol.Changes
Dependencies
packages/data-objectql: Removed@objectql/sdk,@objectql/types→ Added@objectstack/clientpackages/plugin-object: Removed@objectql/sdk,@objectql/typesImplementation (
ObjectQLDataSource)DataApiClient+MetadataApiClientwith unifiedObjectStackClient{items, meta.total}→{value, count}Example
Before:
After:
Public API
No breaking changes. The
ObjectQLDataSourceadapter maintains identical interface - consumers don't need code changes.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.