Skip to content

Remove built-in plugin types, adopt @objectstack/spec protocol exclusively#153

Merged
huangyiirene merged 8 commits intomainfrom
copilot/remove-objectql-plugin-types
Jan 21, 2026
Merged

Remove built-in plugin types, adopt @objectstack/spec protocol exclusively#153
huangyiirene merged 8 commits intomainfrom
copilot/remove-objectql-plugin-types

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 21, 2026

Replaces ObjectQL's internal plugin type definitions with types from @objectstack/spec@0.2.0, aligning with the protocol standard defined in the spec repository.

Changes

Type System

  • Deleted packages/foundation/types/src/plugin.ts file completely
  • All plugin types (PluginContextData, PluginLifecycleHooks, PluginDefinition) are now imported directly from @objectstack/spec throughout the codebase
  • Removed ObjectQLPlugin interface completely (breaking change)
  • Update ObjectQLConfig.plugins to accept only PluginDefinition | string
  • Eliminated intermediate re-export layer - types flow directly from protocol to consumers

Runtime Support

  • Core directly supports PluginDefinition with lifecycle hooks (onEnable, onDisable, etc.)
  • Added createPluginContext() adapter: IObjectQLPluginContextData
  • Platform-node loader only loads PluginDefinition plugins
  • Added @objectstack/spec as direct dependency where needed (platform-node, examples)

Breaking Changes

The legacy ObjectQLPlugin interface has been completely removed. All plugins must now implement the PluginDefinition interface from @objectstack/spec:

// New plugin format (required)
import type { PluginDefinition, PluginContextData } from '@objectstack/spec';

export default {
  id: 'audit-log',
  onEnable: async (context: PluginContextData) => {
    context.ql.object('logs').create({ ... });
    context.events.on('record.created', handler);
  }
} satisfies PluginDefinition;

The new plugin system provides richer lifecycle hooks (onInstall, onEnable, onDisable, onUninstall, onUpgrade) and structured context with capabilities like scoped storage, logging, i18n, and router access.

Testing

  • All 235 tests pass
  • All tests and examples updated to use PluginDefinition directly from @objectstack/spec
  • No security vulnerabilities detected (CodeQL)
Original prompt

作废 objectql 内置的plugin types,改用 "@objectstack/spec/src/system/plugin.zod


✨ 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
Copy Markdown

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 4:44pm

Request Review

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove built-in objectql plugin types and switch to zod Deprecate built-in plugin types, adopt @objectstack/spec protocol Jan 21, 2026
Copilot AI requested a review from huangyiirene January 21, 2026 15:54
@huangyiirene
Copy link
Copy Markdown
Contributor

@copilot 不需要保留向前兼容,删除之前所有的业务逻辑

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot 不需要保留向前兼容,删除之前所有的业务逻辑

已完成。已删除所有向前兼容代码和旧的 ObjectQLPlugin 接口,现在只使用 @objectstack/spec 的 PluginDefinition 类型。所有测试通过 (235 tests)。

Commit: 4dfbede

…n status

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
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

Copilot AI changed the title Deprecate built-in plugin types, adopt @objectstack/spec protocol Remove built-in plugin types, adopt @objectstack/spec protocol exclusively Jan 21, 2026
@huangyiirene
Copy link
Copy Markdown
Contributor

删除 types/src/plugin.ts @copilot

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 21, 2026

删除 types/src/plugin.ts @copilot

已完成。已删除 types/src/plugin.ts 文件,所有插件类型现在直接从 @objectstack/spec 导入。所有测试通过 (235 tests)。

Commit: 8ede2cd

@github-actions
Copy link
Copy Markdown
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

@huangyiirene huangyiirene merged commit ff5525c into main Jan 21, 2026
10 checks passed
@huangyiirene huangyiirene deleted the copilot/remove-objectql-plugin-types branch January 21, 2026 17:16
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