Skip to content

Commit e076df5

Browse files
committed
Expose triggerHooks method and add unregisterItem method to SchemaRegistry
1 parent e56e987 commit e076df5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/objectql/src/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class ObjectQL implements IDataEngine {
8282
console.log(`[ObjectQL] Registered hook for ${event}`);
8383
}
8484

85-
private async triggerHooks(event: string, context: HookContext) {
85+
public async triggerHooks(event: string, context: HookContext) {
8686
const handlers = this.hooks[event] || [];
8787
for (const handler of handlers) {
8888
// In a real system, we might want to catch errors here or allow them to bubble up

packages/objectql/src/registry.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ export class SchemaRegistry {
2929
console.log(`[Registry] Registered ${type}: ${key}`);
3030
}
3131

32+
/**
33+
* Universal Unregister Method
34+
*/
35+
static unregisterItem(type: string, name: string) {
36+
const collection = this.metadata.get(type);
37+
if (collection && collection.has(name)) {
38+
collection.delete(name);
39+
console.log(`[Registry] Unregistered ${type}: ${name}`);
40+
} else {
41+
console.warn(`[Registry] Attempted to unregister non-existent ${type}: ${name}`);
42+
}
43+
}
44+
3245
/**
3346
* Universal Get Method
3447
*/

0 commit comments

Comments
 (0)