Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Server functionality completely migrated to @objectql/plugin-server package, enabling framework-agnostic HTTP server implementations. The existing @objectql/server package is now a thin compatibility wrapper. Addresses request to refactor server using plugin approach with Hono framework support.

Architecture Changes

  • New Package: @objectql/plugin-server with complete server implementation including ServerPlugin class implementing ObjectQLPlugin interface
  • Hono Adapter: createHonoAdapter() function for Hono framework integration (edge/serverless deployments)
  • Legacy Package: @objectql/server converted to thin wrapper that re-exports from @objectql/plugin-server for backward compatibility; no implementation code remains

Core Implementation

Server capabilities now pluggable:

// Plugin-based approach
const app = new ObjectQL({
    datasources: { /* ... */ },
    plugins: [
        new ServerPlugin({
            port: 3000,
            enableREST: true,
            enableRPC: true,
            autoStart: true
        })
    ]
});

Hono integration for modern runtime environments:

// Hono adapter (Cloudflare Workers, Deno, Bun, Node.js)
import { Hono } from 'hono';
import { createHonoAdapter } from '@objectql/plugin-server';

const server = new Hono();
server.all('/api/*', createHonoAdapter(app));

Traditional Express integration (via compatibility layer):

// Express adapter (existing code continues to work via re-export)
import { createNodeHandler } from '@objectql/server';  // Deprecated, use @objectql/plugin-server

const server = express();
server.all('/api/*', createNodeHandler(app));

Package Structure

Primary Implementation (packages/plugins/server/):

packages/plugins/server/
├── src/
│   ├── plugin.ts              # ServerPlugin implementation
│   ├── adapters/
│   │   ├── node.ts            # Node.js HTTP adapter
│   │   ├── rest.ts            # REST API adapter
│   │   ├── graphql.ts         # GraphQL adapter
│   │   └── hono.ts            # Hono framework adapter (new)
│   ├── server.ts              # Core ObjectQLServer
│   └── [metadata, file-handler, storage, openapi, types, utils]
└── test/                      # All tests (129 tests)

Compatibility Wrapper (packages/runtime/server/):

packages/runtime/server/
└── src/
    └── index.ts               # Re-exports from @objectql/plugin-server

Migration

All implementation has been moved to @objectql/plugin-server. The @objectql/server package now serves as a compatibility layer with deprecation notices. Users are encouraged to migrate:

// Old (still works)
import { createNodeHandler } from '@objectql/server';

// New (recommended)
import { createNodeHandler } from '@objectql/plugin-server';

Example implementations at examples/integrations/hono-server/ and examples/integrations/express-server/.

Testing

  • ✅ All 129 tests migrated to @objectql/plugin-server and passing
  • ✅ Compatibility layer verified with 7 re-export tests
  • ✅ Examples updated and tested
Original prompt

参考这个包以插件的方式重构服务端,@objectstack/plugin-hono-server


✨ 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)
objectql-site Ready Ready Preview, Comment Jan 21, 2026 9:08am

Request Review

@github-actions
Copy link
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
import { IObjectQL, ObjectQLPlugin, ApiRouteConfig } from '@objectql/types';
import { IncomingMessage, ServerResponse, createServer, Server } from 'http';
import { createNodeHandler, NodeHandlerOptions } from './adapters/node';
import { createRESTHandler, RESTHandlerOptions } from './adapters/rest';
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>
@github-actions
Copy link
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

1 similar comment
@github-actions
Copy link
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

@hotlong
Copy link
Contributor

hotlong commented Jan 21, 2026

@copilot 我是希望能够作废现有的server的逻辑,直接按照新的方式重购

完全移除现有的 server 实现逻辑,按照新的插件方式重构。

- 删除 @objectql/server 中的所有实现文件
- 将 @objectql/server 改为仅从 @objectql/plugin-server 重新导出的兼容层
- 将所有测试移至 @objectql/plugin-server 包
- 更新示例使用新的 @objectql/plugin-server 包
- 所有 129 个测试仍然通过

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot 我是希望能够作废现有的server的逻辑,直接按照新的方式重购

已完成重构!现有的 server 逻辑已完全移除,所有实现都已迁移到新的 @objectql/plugin-server 包。

主要更改:

  • ✅ 删除 @objectql/server 中的所有实现文件(server.ts, adapters/, metadata.ts 等)
  • @objectql/server 现在只是一个薄包装层,从 @objectql/plugin-server 重新导出
  • ✅ 所有测试(129 个)移至 @objectql/plugin-server 并全部通过
  • ✅ 示例已更新为使用新的 @objectql/plugin-server

向后兼容性:现有代码继续工作,因为 @objectql/server 透明地重新导出所有功能。

Commit: 00c7c22

@hotlong
Copy link
Contributor

hotlong commented Jan 21, 2026

@copilot 删除所有的自定义逻辑,统一使用objectstack标准的服务端

Copy link
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot 删除所有的自定义逻辑,统一使用objectstack标准的服务端

需要澄清一下:您指的"objectstack标准的服务端"具体是指哪个包或实现?

我看到代码库中有这些 ObjectStack 包:

  • @objectstack/spec - 协议规范
  • @objectstack/objectql - 核心引擎
  • @objectstack/runtime - 运行时内核

但我没有找到标准的服务端实现包(如 @objectstack/server@objectstack/plugin-server)。

您是希望:

  1. 使用某个现有的 ObjectStack 服务端包?
  2. 还是完全移除当前的 @objectql/plugin-server 包,不提供任何服务端功能?
  3. 或者是其他的意思?

请告诉我具体应该如何修改,我会立即执行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants