Skip to content

Commit 573ddd8

Browse files
committed
feat: 移除应用注册相关方法,添加驱动程序和自定义字段类型注册功能
1 parent 6106a33 commit 573ddd8

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

packages/objectql/src/registry.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@ export class SchemaRegistry {
7070
return this.listItems<ServiceObject>('object');
7171
}
7272

73-
/**
74-
* App Helpers
75-
*/
76-
static registerApp(app: App) {
77-
this.registerItem('app', app, 'name');
78-
}
79-
80-
static getApp(name: string): App | undefined {
81-
return this.getItem<App>('app', name);
82-
}
83-
84-
static getAllApps(): App[] {
85-
return this.listItems<App>('app');
86-
}
87-
8873
/**
8974
* Plugin Helpers
9075
*/

packages/spec/src/system/manifest.zod.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,37 @@ export const ManifestSchema = z.object({
137137
input: z.any().optional().describe('Input validation schema'),
138138
output: z.any().optional().describe('Output schema'),
139139
})).optional().describe('Exposed server actions'),
140+
141+
/**
142+
* Register Storage Drivers.
143+
* Enables connecting to new types of datasources.
144+
*/
145+
drivers: z.array(z.object({
146+
id: z.string().describe('Driver unique identifier (e.g. "postgres", "mongo")'),
147+
label: z.string().describe('Human readable name'),
148+
description: z.string().optional(),
149+
})).optional().describe('Driver contributions'),
150+
151+
/**
152+
* Register Custom Field Types.
153+
* Extends the data model with new widget types.
154+
*/
155+
fieldTypes: z.array(z.object({
156+
name: z.string().describe('Unique field type name (e.g. "vector")'),
157+
label: z.string().describe('Display label'),
158+
description: z.string().optional(),
159+
})).optional().describe('Field Type contributions'),
160+
161+
/**
162+
* Register Custom Query Operators/Functions.
163+
* Extends ObjectQL with new functions (e.g. distance()).
164+
*/
165+
functions: z.array(z.object({
166+
name: z.string().describe('Function name (e.g. "distance")'),
167+
description: z.string().optional(),
168+
args: z.array(z.string()).optional().describe('Argument types'),
169+
returnType: z.string().optional(),
170+
})).optional().describe('Query Function contributions'),
140171
}).optional().describe('Platform contributions'),
141172

142173
/**

packages/spec/src/system/plugin.zod.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,20 @@ export const PluginContextSchema = z.object({
132132
router: RouterSchema,
133133
scheduler: SchedulerSchema.optional(),
134134
}).describe('App Runtime Capabilities'),
135+
136+
/**
137+
* Driver Registry.
138+
* Allows plugins to register new storage drivers.
139+
*
140+
* @example
141+
* context.drivers.register(new MongoDriver());
142+
*/
143+
drivers: z.object({
144+
register: z.function()
145+
//.args(DriverInterfaceSchema) // Avoid circular dependency, use any or runtime check
146+
.args(z.any())
147+
.describe('Register a new driver instance'),
148+
}).describe('Driver Management'),
135149
});
136150

137151
/**

0 commit comments

Comments
 (0)