Compare commits

..

2 Commits

Author SHA1 Message Date
477f446c34 v7.0.6
Some checks failed
Default (tags) / security (push) Successful in 49s
Default (tags) / test (push) Failing after 50s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-11-28 10:03:23 +00:00
fbb8bb685c fix(classes.collection): Guard against missing collection before attaching document constructor in Collection decorator 2025-11-28 10:03:23 +00:00
4 changed files with 9 additions and 3 deletions

View File

@@ -1,5 +1,11 @@
# Changelog # Changelog
## 2025-11-28 - 7.0.6 - fix(classes.collection)
Guard against missing collection before attaching document constructor in Collection decorator
- Added a truthy check for `coll` before setting `(coll as any).docCtor` in the Collection decorator (ts/classes.collection.ts).
- Prevents a potential TypeError when `collectionFactory.getCollection` returns null/undefined during decorator initialization.
## 2025-11-28 - 7.0.5 - fix(package) ## 2025-11-28 - 7.0.5 - fix(package)
Add package exports entry and remove legacy main/typings fields Add package exports entry and remove legacy main/typings fields

View File

@@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartdata", "name": "@push.rocks/smartdata",
"version": "7.0.5", "version": "7.0.6",
"private": false, "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.", "description": "An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.",
"exports": { "exports": {

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartdata', name: '@push.rocks/smartdata',
version: '7.0.5', version: '7.0.6',
description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.' description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.'
} }

View File

@@ -41,7 +41,7 @@ export function Collection(dbArg: SmartdataDb | TDelayed<SmartdataDb>) {
} }
const coll = collectionFactory.getCollection(constructor.name, dbArg); const coll = collectionFactory.getCollection(constructor.name, dbArg);
// Attach document constructor for searchableFields lookup // Attach document constructor for searchableFields lookup
if (!(coll as any).docCtor) { if (coll && !(coll as any).docCtor) {
(coll as any).docCtor = decoratedClass; (coll as any).docCtor = decoratedClass;
} }
return coll; return coll;