Skip to content

Commit 2dd826b

Browse files
committed
更新内存驱动的 package.json,修正主入口和类型定义路径;重构 DataEngine 类,添加更新和删除方法,移除插件加载逻辑
1 parent bd269bb commit 2dd826b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

examples/plugin-driver-memory/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@objectstack/plugin-driver-memory",
33
"version": "0.0.1",
44
"description": "Example: In-Memory Database Driver for ObjectStack",
5-
"main": "dist/index.js",
6-
"types": "dist/index.d.ts",
5+
"main": "dist/src/index.js",
6+
"types": "dist/src/index.d.ts",
77
"scripts": {
88
"build": "tsc",
99
"dev": "tsc -w"

examples/server/src/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,8 @@ const port = 3004;
185185

186186
(async () => {
187187
console.log('--- Starting ObjectStack Server ---');
188-
try {
189-
await loadPlugins();
190-
console.log('--- Plugins Loaded ---');
191-
} catch (err) {
192-
console.error('Failed to load plugins:', err);
193-
}
194-
188+
// Plugin loading is now handled by DataEngine constructor/init
189+
195190
console.log(`Server is running on http://localhost:${port}`);
196191

197192
serve({

examples/server/src/kernel/engine.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ export class DataEngine {
8585
return this.ql.insert(objectName, data);
8686
}
8787

88+
async update(objectName: string, id: string, data: any) {
89+
this.ensureSchema(objectName);
90+
return this.ql.update(objectName, id, data);
91+
}
92+
93+
async delete(objectName: string, id: string) {
94+
this.ensureSchema(objectName);
95+
return this.ql.delete(objectName, id);
96+
}
97+
8898
private ensureSchema(name: string): ServiceObject {
8999
const schema = SchemaRegistry.getObject(name);
90100
if (!schema) throw new Error(`Unknown object: ${name}`);

0 commit comments

Comments
 (0)