Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
d27dafba2b | |||
b6594de18c | |||
d9246cbeac |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartdata",
|
"name": "@push.rocks/smartdata",
|
||||||
"version": "5.2.1",
|
"version": "5.2.2",
|
||||||
"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.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -13,14 +13,14 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+ssh://git@gitlab.com/pushrocks/smartdata.git"
|
"url": "https://code.foss.global/push.rocks/smartdata.git"
|
||||||
},
|
},
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/smartdata/issues"
|
"url": "https://gitlab.com/pushrocks/smartdata/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartdata#README",
|
"homepage": "https://code.foss.global/push.rocks/smartdata",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/lik": "^6.0.14",
|
"@push.rocks/lik": "^6.0.14",
|
||||||
"@push.rocks/smartdelay": "^3.0.1",
|
"@push.rocks/smartdelay": "^3.0.1",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartdata',
|
name: '@push.rocks/smartdata',
|
||||||
version: '5.2.1',
|
version: '5.2.2',
|
||||||
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.'
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@ export type TDocCreation = 'db' | 'new' | 'mixed';
|
|||||||
export function svDb() {
|
export function svDb() {
|
||||||
return (target: SmartDataDbDoc<unknown, unknown>, key: string) => {
|
return (target: SmartDataDbDoc<unknown, unknown>, key: string) => {
|
||||||
console.log(`called svDb() on >${target.constructor.name}.${key}<`);
|
console.log(`called svDb() on >${target.constructor.name}.${key}<`);
|
||||||
if (!target.saveableProperties) {
|
if (!target.constructor.prototype.saveableProperties) {
|
||||||
target.saveableProperties = [];
|
target.constructor.prototype.saveableProperties = [];
|
||||||
}
|
}
|
||||||
target.saveableProperties.push(key);
|
target.constructor.prototype.saveableProperties.push(key);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,16 +28,16 @@ export function unI() {
|
|||||||
console.log(`called unI on >>${target.constructor.name}.${key}<<`);
|
console.log(`called unI on >>${target.constructor.name}.${key}<<`);
|
||||||
|
|
||||||
// mark the index as unique
|
// mark the index as unique
|
||||||
if (!target.uniqueIndexes) {
|
if (!target.constructor.prototype.uniqueIndexes) {
|
||||||
target.uniqueIndexes = [];
|
target.constructor.prototype.uniqueIndexes = [];
|
||||||
}
|
}
|
||||||
target.uniqueIndexes.push(key);
|
target.constructor.prototype.uniqueIndexes.push(key);
|
||||||
|
|
||||||
// and also save it
|
// and also save it
|
||||||
if (!target.saveableProperties) {
|
if (!target.constructor.prototype.saveableProperties) {
|
||||||
target.saveableProperties = [];
|
target.constructor.prototype.saveableProperties = [];
|
||||||
}
|
}
|
||||||
target.saveableProperties.push(key);
|
target.constructor.prototype.saveableProperties.push(key);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
|
|||||||
*/
|
*/
|
||||||
public async createSavableObject(): Promise<TImplements> {
|
public async createSavableObject(): Promise<TImplements> {
|
||||||
const saveableObject: unknown = {}; // is not exposed to outside, so any is ok here
|
const saveableObject: unknown = {}; // is not exposed to outside, so any is ok here
|
||||||
for (const propertyNameString of this.saveableProperties) {
|
for (const propertyNameString of this.constructor.prototype.saveableProperties) {
|
||||||
saveableObject[propertyNameString] = this[propertyNameString];
|
saveableObject[propertyNameString] = this[propertyNameString];
|
||||||
}
|
}
|
||||||
return saveableObject as TImplements;
|
return saveableObject as TImplements;
|
||||||
|
Reference in New Issue
Block a user