-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(core): decompose @objectql/core into plugin-query and plugin-optimizations #373
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
75b09cd
Initial plan
Copilot 3a53c24
feat: create @objectql/plugin-optimizations package (Phase 1 core ref…
Copilot 2000351
feat: create @objectql/plugin-query package with query modules from core
Copilot aa5d789
feat: slim @objectql/core - delegate to plugin packages, add kernel-f…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * ObjectQL Kernel Factory | ||
| * Copyright (c) 2026-present ObjectStack Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import { ObjectKernel } from '@objectstack/runtime'; | ||
| import { ObjectQLPlugin as UpstreamObjectQLPlugin } from '@objectstack/objectql'; | ||
| import type { Plugin } from '@objectstack/core'; | ||
|
|
||
| /** | ||
| * Options for creating an ObjectQL Kernel | ||
| */ | ||
| export interface ObjectQLKernelOptions { | ||
| /** | ||
| * Additional plugins to register with the kernel | ||
| */ | ||
| plugins?: Plugin[]; | ||
| } | ||
|
|
||
| /** | ||
| * Convenience factory for creating an ObjectQL-ready kernel. | ||
| * | ||
| * Creates an ObjectStackKernel pre-configured with the upstream ObjectQLPlugin | ||
| * (data engine, schema registry, protocol implementation) plus any additional | ||
| * plugins provided. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * import { createObjectQLKernel } from '@objectql/core'; | ||
| * import { QueryPlugin } from '@objectql/plugin-query'; | ||
| * import { OptimizationsPlugin } from '@objectql/plugin-optimizations'; | ||
| * | ||
| * const kernel = createObjectQLKernel({ | ||
| * plugins: [new QueryPlugin(), new OptimizationsPlugin()], | ||
| * }); | ||
| * await kernel.start(); | ||
| * ``` | ||
| */ | ||
| export function createObjectQLKernel(options: ObjectQLKernelOptions = {}): ObjectKernel { | ||
| return new (ObjectKernel as any)([ | ||
| new UpstreamObjectQLPlugin(), | ||
| ...(options.plugins || []), | ||
| ]); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,30 +11,12 @@ import { ConsoleLogger, ObjectQLError } from '@objectql/types'; | |||||||||||
| import type { Logger } from '@objectql/types'; | ||||||||||||
| import { ValidatorPlugin, ValidatorPluginConfig } from '@objectql/plugin-validator'; | ||||||||||||
| import { FormulaPlugin, FormulaPluginConfig } from '@objectql/plugin-formula'; | ||||||||||||
| import { QueryService } from './query/query-service'; | ||||||||||||
| import { QueryAnalyzer } from './query/query-analyzer'; | ||||||||||||
| import { QueryPlugin } from '@objectql/plugin-query'; | ||||||||||||
| import { ObjectStackProtocolImplementation } from './protocol'; | ||||||||||||
| import type { Driver } from '@objectql/types'; | ||||||||||||
| import { createDefaultAiRegistry } from './ai'; | ||||||||||||
| import { SchemaRegistry } from '@objectstack/objectql'; | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * Extended kernel with ObjectQL services | ||||||||||||
| */ | ||||||||||||
| interface ExtendedKernel { | ||||||||||||
| metadata?: any; | ||||||||||||
| actions?: any; | ||||||||||||
| hooks?: any; | ||||||||||||
| getAllDrivers?: () => Driver[]; | ||||||||||||
| create?: (objectName: string, data: any) => Promise<any>; | ||||||||||||
| update?: (objectName: string, id: string, data: any) => Promise<any>; | ||||||||||||
| delete?: (objectName: string, id: string) => Promise<any>; | ||||||||||||
| find?: (objectName: string, query: any) => Promise<any>; | ||||||||||||
| get?: (objectName: string, id: string) => Promise<any>; | ||||||||||||
| queryService?: QueryService; | ||||||||||||
| queryAnalyzer?: QueryAnalyzer; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * Configuration for the ObjectQL Plugin | ||||||||||||
| */ | ||||||||||||
|
|
@@ -91,12 +73,15 @@ export interface ObjectQLPluginConfig { | |||||||||||
| /** | ||||||||||||
| * ObjectQL Plugin | ||||||||||||
| * | ||||||||||||
| * Implements the RuntimePlugin interface to provide ObjectQL's enhanced features | ||||||||||||
| * (Repository, Validator, Formula, AI) on top of the microkernel. | ||||||||||||
| * Thin orchestrator that composes ObjectQL's extension plugins | ||||||||||||
| * (QueryPlugin, ValidatorPlugin, FormulaPlugin, AI) on top of the microkernel. | ||||||||||||
| * | ||||||||||||
| * Delegates query execution to @objectql/plugin-query and provides | ||||||||||||
| * repository-pattern CRUD bridging to the kernel. | ||||||||||||
| */ | ||||||||||||
| export class ObjectQLPlugin implements RuntimePlugin { | ||||||||||||
| name = '@objectql/core'; | ||||||||||||
| version = '4.0.2'; | ||||||||||||
| version = '4.2.0'; | ||||||||||||
| private logger: Logger; | ||||||||||||
|
|
||||||||||||
| constructor(private config: ObjectQLPluginConfig = {}, _ql?: any) { | ||||||||||||
|
Comment on lines
86
to
87
|
||||||||||||
| constructor(private config: ObjectQLPluginConfig = {}, _ql?: any) { | |
| private config: ObjectQLPluginConfig; | |
| constructor(config: ObjectQLPluginConfig = {}, _ql?: any) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "name": "@objectql/plugin-optimizations", | ||
| "version": "4.2.0", | ||
| "description": "Performance optimization plugins for ObjectQL - connection pooling, LRU cache, compiled hooks", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "sideEffects": false, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, | ||
| "files": ["dist"], | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "test": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@objectql/types": "workspace:*", | ||
| "@objectstack/core": "^2.0.6", | ||
| "@objectstack/spec": "^2.0.6" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "^5.3.0" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Pluginis imported from@objectstack/corehere, but elsewhere (e.g.app.ts)Pluginis imported from@objectstack/runtimealongsideObjectKernel. Using differentPlugintypes can create assignability issues foroptions.plugins. ImportPluginfrom the same package asObjectKernel(or use a shared upstream type) to keep the factory’s API consistent.