From d2092cc5f32b38213e0c1ac1640b43cbbafcff47 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Fri, 28 Nov 2025 11:17:25 +0000 Subject: [PATCH] chore(debug): Add metadata debug logging to Collection decorator --- ts/classes.collection.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ts/classes.collection.ts b/ts/classes.collection.ts index 9b87d69..a5169bb 100644 --- a/ts/classes.collection.ts +++ b/ts/classes.collection.ts @@ -93,17 +93,22 @@ export function Collection(dbArg: SmartdataDb | TDelayed) { // Initialize prototype properties from context.metadata (TC39 decorator metadata) // This ensures prototype properties are available before any instance is created const metadata = context.metadata as any; + logger.log('debug', `Collection decorator: metadata keys = ${metadata ? Object.keys(metadata).join(', ') : 'null'}`); + logger.log('debug', `Collection decorator: saveableProperties in metadata = ${metadata?.saveableProperties?.length ?? 0}`); + logger.log('debug', `Collection decorator: globalSaveableProperties in metadata = ${metadata?.globalSaveableProperties?.length ?? 0}`); if (metadata) { const proto = decoratedClass.prototype; // Initialize globalSaveableProperties if (metadata.globalSaveableProperties && !proto.globalSaveableProperties) { proto.globalSaveableProperties = [...metadata.globalSaveableProperties]; + logger.log('debug', `Collection decorator: initialized globalSaveableProperties with ${proto.globalSaveableProperties.length} properties`); } // Initialize saveableProperties if (metadata.saveableProperties && !proto.saveableProperties) { proto.saveableProperties = [...metadata.saveableProperties]; + logger.log('debug', `Collection decorator: initialized saveableProperties with ${proto.saveableProperties.length} properties`); } // Initialize uniqueIndexes