Add critical protocol definitions: Field Widget, Plugin Lifecycle, Driver Interface, and Trigger Context#34
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…trigger Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
There was a problem hiding this comment.
Pull request overview
This PR implements four foundational Zod schemas that establish critical contracts for the ObjectStack protocol: Field Widget Props (custom UI components), Plugin Lifecycle (plugin ecosystem), Driver Interface (database abstraction), and Trigger Context (business logic execution). These schemas enable third-party development, multi-database support, and standardized trigger code generation.
Changes:
- Added Field Widget contract (
ui/widget.zod.ts) defining props interface for custom field components with value binding, validation state, and record context - Added Plugin Lifecycle interface (
system/plugin.zod.ts) with runtime context and hooks for install/enable/disable/uninstall/upgrade operations - Added Driver Interface (
system/driver.zod.ts) providing unified abstraction for CRUD, DDL, and transaction operations across SQL/NoSQL/SaaS databases with capability flags - Added Trigger Context protocol (
data/trigger.zod.ts) standardizing execution context for before/after triggers with validation helpers and data access APIs
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/spec/src/ui/widget.zod.ts |
Defines FieldWidgetProps schema for custom field component integration |
packages/spec/src/ui/widget.test.ts |
Comprehensive test coverage for widget props validation scenarios |
packages/spec/src/system/plugin.zod.ts |
Defines plugin context and lifecycle hooks for plugin ecosystem |
packages/spec/src/system/plugin.test.ts |
Tests for plugin context, lifecycle hooks, and integration scenarios |
packages/spec/src/system/driver.zod.ts |
Defines unified driver interface for multi-database support |
packages/spec/src/system/driver.test.ts |
Tests for driver capabilities, CRUD operations, and real-world driver examples |
packages/spec/src/data/trigger.zod.ts |
Defines trigger context for standardized business logic execution |
packages/spec/src/data/trigger.test.ts |
Tests for trigger actions, timing, context, and use case scenarios |
packages/spec/src/index.ts |
Exports new schemas for public API consumption |
packages/spec/json-schema/*.json |
Auto-generated JSON schemas for IDE support |
content/docs/references/**/*.mdx |
Generated documentation pages for new schema types |
| const plugin: Plugin = { | ||
| id: 'test.plugin', | ||
| version: '1.0.0', | ||
| onInstall: async (context) => { | ||
| installed = true; | ||
| await context.ql.object('test_object').syncSchema(); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
The type 'Plugin' is used but not defined in the imports. Should be 'PluginDefinition' to match the exported type from plugin.zod.ts.
There was a problem hiding this comment.
Fixed in ba9dd35 - changed type from Plugin to PluginDefinition
| const plugin: Plugin = { | ||
| onEnable: async (context) => { | ||
| enabled = true; | ||
| context.logger.info('Plugin enabled'); | ||
| }, | ||
| onDisable: async (context) => { | ||
| enabled = false; | ||
| context.logger.info('Plugin disabled'); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
The type 'Plugin' is used but not defined in the imports. Should be 'PluginDefinition' to match the exported type from plugin.zod.ts.
There was a problem hiding this comment.
Fixed in ba9dd35 - changed type from Plugin to PluginDefinition
| const plugin: Plugin = { | ||
| onUpgrade: async (context, from, to) => { | ||
| upgradeCalled = true; | ||
| upgradeFrom = from; | ||
| upgradeTo = to; | ||
| }, | ||
| }; |
There was a problem hiding this comment.
The type 'Plugin' is used but not defined in the imports. Should be 'PluginDefinition' to match the exported type from plugin.zod.ts.
There was a problem hiding this comment.
Fixed in ba9dd35 - changed type from Plugin to PluginDefinition
| const plugin: Plugin = { | ||
| onUninstall: async (context) => { | ||
| uninstalled = true; | ||
| await context.ql.object('test_object').dropTable(); | ||
| }, | ||
| }; |
There was a problem hiding this comment.
The type 'Plugin' is used but not defined in the imports. Should be 'PluginDefinition' to match the exported type from plugin.zod.ts.
There was a problem hiding this comment.
Fixed in ba9dd35 - changed type from Plugin to PluginDefinition
|
@copilot fix all |
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
Add $notContains to StringOperatorSchema, FieldOperatorsSchema, Filter<T>, FILTER_OPERATORS, VALID_AST_OPERATORS, and AST_OPERATOR_MAP with both 'notcontains' and 'not_contains' AST aliases. Fixes #34 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
✅ Implementation Complete: Critical Protocol Definitions
Successfully implemented 4 critical protocol definitions that unblock major ObjectStack features:
📦 Deliverables
1. Field Widget Contract⚠️ CRITICAL
packages/spec/src/ui/widget.zod.ts2. Plugin Lifecycle Interface⚠️ CRITICAL
packages/spec/src/system/plugin.zod.ts3. Driver Interface⚠️ CRITICAL
packages/spec/src/system/driver.zod.ts4. Trigger Context Protocol 🟡 HIGH
packages/spec/src/data/trigger.zod.ts📊 Quality Metrics
🎯 Impact
These protocol definitions unblock:
🏗️ Technical Implementation
z.infer<>Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.