Skip to content

Commit e132220

Browse files
committed
Improve logging and update workspace dependencies
Enhanced logging in SchemaRegistry and ObjectStackRuntimeProtocol for better traceability. Updated scripts in docs package and switched @objectstack/runtime dependency to workspace reference in plugin-hono-server. Cleaned up pnpm-lock.yaml accordingly.
1 parent 74ada0d commit e132220

File tree

5 files changed

+19
-25
lines changed

5 files changed

+19
-25
lines changed

apps/docs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"private": true,
55
"description": "ObjectStack Protocol Documentation Site",
66
"scripts": {
7-
"dev": "next dev",
8-
"build": "next build",
9-
"start": "next start",
10-
"lint": "next lint"
7+
"site:dev": "next dev",
8+
"site:build": "next build",
9+
"site:start": "next start",
10+
"site:lint": "next lint"
1111
},
1212
"dependencies": {
1313
"class-variance-authority": "^0.7.1",

packages/objectql/src/registry.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ServiceObject, App, ObjectStackManifest } from '@objectstack/spec';
77
export class SchemaRegistry {
88
// Nested Map: Type -> Name/ID -> MetadataItem
99
private static metadata = new Map<string, Map<string, any>>();
10+
private static _id = Math.random().toString(36).substring(7);
1011

1112
/**
1213
* Universal Register Method
@@ -22,17 +23,23 @@ export class SchemaRegistry {
2223
const key = String(item[keyField]);
2324

2425
if (collection.has(key)) {
25-
console.warn(`[Registry] Overwriting ${type}: ${key}`);
26+
console.warn(`[Registry:${this._id}] Overwriting ${type}: ${key}`);
2627
}
2728
collection.set(key, item);
28-
console.log(`[Registry] Registered ${type}: ${key}`);
29+
console.log(`[Registry:${this._id}] Registered ${type}: ${key}`);
2930
}
3031

3132
/**
3233
* Universal Get Method
3334
*/
3435
static getItem<T>(type: string, name: string): T | undefined {
35-
return this.metadata.get(type)?.get(name) as T;
36+
const item = this.metadata.get(type)?.get(name) as T;
37+
if (!item) {
38+
console.log(`[Registry:${this._id}] MISSING ${type}: ${name}. Available: ${Array.from(this.metadata.get(type)?.keys() || [])}`);
39+
} else {
40+
console.log(`[Registry:${this._id}] FOUND ${type}: ${name}`);
41+
}
42+
return item;
3643
}
3744

3845
/**

packages/plugin-hono-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"hono": "^4.0.0"
1515
},
1616
"devDependencies": {
17-
"@objectstack/runtime": "^0.1.0",
17+
"@objectstack/runtime": "workspace:*",
1818
"@types/node": "^20.0.0",
1919
"typescript": "^5.0.0"
2020
},

packages/runtime/src/protocol.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class ObjectStackRuntimeProtocol {
7676

7777
// 4. Metadata: Get Single Item
7878
getMetaItem(typePlural: string, name: string) {
79+
console.log(`[Protocol] getMetaItem called for ${typePlural}/${name}`);
7980
const typeMap: Record<string, string> = {
8081
'objects': 'object',
8182
'apps': 'app',
@@ -85,6 +86,7 @@ export class ObjectStackRuntimeProtocol {
8586
'kinds': 'kind'
8687
};
8788
const type = typeMap[typePlural] || typePlural;
89+
console.log(`[Protocol] Resolved type: ${type}`);
8890
const item = SchemaRegistry.getItem(type, name);
8991
if (!item) throw new Error(`Metadata not found: ${type}/${name}`);
9092
return item;

pnpm-lock.yaml

Lines changed: 2 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)