Compare commits

...

2 Commits

Author SHA1 Message Date
8a3425e554 7.0.10
Some checks failed
Default (tags) / security (push) Successful in 58s
Default (tags) / test (push) Failing after 1m20s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-11-28 11:17:25 +00:00
d2092cc5f3 chore(debug): Add metadata debug logging to Collection decorator 2025-11-28 11:17:25 +00:00
2 changed files with 6 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartdata",
"version": "7.0.9",
"version": "7.0.10",
"private": false,
"description": "An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.",
"exports": {

View File

@@ -93,17 +93,22 @@ export function Collection(dbArg: SmartdataDb | TDelayed<SmartdataDb>) {
// 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