Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Replaces deprecated @objectql/sdk and @objectql/types dependencies with @objectstack/client to align with ObjectStack Protocol.

Changes

Dependencies

  • packages/data-objectql: Removed @objectql/sdk, @objectql/types → Added @objectstack/client
  • packages/plugin-object: Removed @objectql/sdk, @objectql/types

Implementation (ObjectQLDataSource)

  • Replaced DataApiClient + MetadataApiClient with unified ObjectStackClient
  • Updated query param conversion: ObjectQL-specific filters → ObjectStack Protocol format
  • Changed response handling: {items, meta.total}{value, count}
  • Updated error detection for 404 responses (message-based check)

Example

Before:

import { DataApiClient } from '@objectql/sdk';
const client = new DataApiClient(config);
const response = await client.list(resource, {
  filter: [['status', '=', 'active']],
  limit: 10
});
// response.items, response.meta.total

After:

import { ObjectStackClient } from '@objectstack/client';
const client = new ObjectStackClient(config);
const response = await client.data.find(resource, {
  filters: { status: 'active' },
  top: 10
});
// response.value, response.count

Public API

No breaking changes. The ObjectQLDataSource adapter maintains identical interface - consumers don't need code changes.

Original prompt

去除@objectql 包相关依赖,以后只用@objectstack


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
objectui-docs Error Error Jan 21, 2026 2:51am
objectui-site Ready Ready Preview, Comment Jan 21, 2026 2:51am

Request Review

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>
Copilot AI changed the title [WIP] Remove @objectql package dependencies Migrate from @objectql to @objectstack client Jan 21, 2026
Copilot AI requested a review from hotlong January 21, 2026 02:53
@github-actions github-actions bot added documentation Improvements or additions to documentation data-adapter dependencies plugin tests labels Jan 21, 2026
@github-actions
Copy link

📦 Bundle Size Report

Package Size Gzipped
components (index.js) 1553.12KB 365.90KB
core (index.js) 0.49KB 0.26KB
data-objectql (ObjectQLDataSource.js) 10.94KB 2.60KB
data-objectql (hooks.js) 5.62KB 1.43KB
data-objectql (index.js) 0.62KB 0.36KB
designer (index.js) 1.46KB 0.51KB
plugin-charts (AdvancedChartImpl-DazADGz5.js) 74.89KB 15.82KB
plugin-charts (BarChart-CRc8MAtI.js) 551.60KB 127.51KB
plugin-charts (ChartImpl-DVw_7KEd.js) 3.17KB 1.10KB
plugin-charts (index-CdgY2AuM.js) 12.39KB 3.83KB
plugin-charts (index.js) 0.21KB 0.16KB
plugin-editor (MonacoImpl-B7ZgZJJG.js) 18.15KB 5.59KB
plugin-editor (index-Dl3HAAqu.js) 10.07KB 3.31KB
plugin-editor (index.js) 0.19KB 0.15KB
plugin-kanban (KanbanImpl-CUWM-JC-.js) 76.50KB 20.46KB
plugin-kanban (index-BV3FWhCb.js) 11.86KB 3.67KB
plugin-kanban (index.js) 0.18KB 0.15KB
plugin-markdown (MarkdownImpl-BRkYjVWf.js) 256.79KB 64.50KB
plugin-markdown (index-D_CdfEXQ.js) 9.59KB 3.16KB
plugin-markdown (index.js) 0.19KB 0.15KB
react (SchemaRenderer.js) 1.44KB 0.73KB
react (index.js) 0.32KB 0.23KB
react (index.test.js) 0.34KB 0.26KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 0.20KB 0.18KB
types (base.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data.js) 0.20KB 0.18KB
types (disclosure.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (index.js) 0.34KB 0.25KB
types (layout.js) 0.20KB 0.18KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (registry.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@hotlong hotlong marked this pull request as ready for review January 21, 2026 03:45
Copilot AI review requested due to automatic review settings January 21, 2026 03:45
@github-actions
Copy link

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

Copy link
Contributor

Copilot AI left a 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 + MetadataApiClient with unified ObjectStackClient
  • Updated query parameter conversion to ObjectStack format (e.g., limittop, 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

Comment on lines 47 to 50
"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"
},
Copy link

Copilot AI Jan 21, 2026

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.

Copilot uses AI. Check for mistakes.
// 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) {
Copy link

Copilot AI Jan 21, 2026

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.

Suggested change
if (err.message?.includes('404') || err.status === 404) {
if (err.status === 404) {

Copilot uses AI. Check for mistakes.
Comment on lines 147 to 150
```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)
}
Copy link

Copilot AI Jan 21, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +201 to +202
page: params?.$skip && params?.$top
? Math.floor(params.$skip / params.$top) + 1
Copy link

Copilot AI Jan 21, 2026

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
const filtered: any = {};
for (const field of params.$select) {
if (field in response) {
if (response && typeof response === 'object' && field in response) {
Copy link

Copilot AI Jan 21, 2026

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.

Suggested change
if (response && typeof response === 'object' && field in response) {
if (typeof response === 'object' && field in response) {

Copilot uses AI. Check for mistakes.
? Math.floor(params.$skip / params.$top) + 1
: undefined,
pageSize: queryOptions.top,
hasMore: total !== undefined && data.length < total,
Copy link

Copilot AI Jan 21, 2026

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

Copilot uses AI. Check for mistakes.
@hotlong hotlong merged commit f0c1d9c into main Jan 21, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data-adapter dependencies documentation Improvements or additions to documentation plugin tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants