Compare commits

..

6 Commits

Author SHA1 Message Date
f726cf4c5b 5.0.5 2022-06-05 17:19:12 +02:00
c198969fae fix(core): update 2022-06-05 17:19:12 +02:00
be1badeb23 5.0.4 2022-06-05 17:18:13 +02:00
fe065b966f fix(core): update 2022-06-05 17:18:13 +02:00
811e2490b8 5.0.3 2022-05-19 16:15:28 +02:00
206ccd40e9 fix(watcher.changeSubject): now emits correct type into observer functions 2022-05-19 16:15:28 +02:00
8 changed files with 28 additions and 49 deletions

34
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smartdata", "name": "@pushrocks/smartdata",
"version": "5.0.2", "version": "5.0.5",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smartdata", "name": "@pushrocks/smartdata",
"version": "5.0.2", "version": "5.0.5",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@pushrocks/lik": "^5.0.4", "@pushrocks/lik": "^5.0.4",
@ -17,7 +17,7 @@
"@pushrocks/smartrx": "^2.0.25", "@pushrocks/smartrx": "^2.0.25",
"@pushrocks/smartstring": "^4.0.2", "@pushrocks/smartstring": "^4.0.2",
"@pushrocks/smartunique": "^3.0.3", "@pushrocks/smartunique": "^3.0.3",
"@tsclass/tsclass": "^4.0.2", "@tsclass/tsclass": "^4.0.3",
"@types/lodash": "^4.14.182", "@types/lodash": "^4.14.182",
"@types/mongodb": "^4.0.7", "@types/mongodb": "^4.0.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
@ -1166,12 +1166,12 @@
} }
}, },
"node_modules/@tsclass/tsclass": { "node_modules/@tsclass/tsclass": {
"version": "4.0.2", "version": "4.0.3",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-4.0.2.tgz", "resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-4.0.3.tgz",
"integrity": "sha512-f3r1P2+h3upZboMrWqr9KrkK5V1DtiiSlImeHTQmnhdYlxRykarciV2ssDPGY0J8w44pkWKgYG2dkuypIbSj1w==", "integrity": "sha512-dvi+8IncskjJ2ApXg5AyqEa+C5KkXtRPXYmh3MKr5BCdBitJjPQ6Rni3EBaGlD9RTYMCvjmHUNjwJub0b3GDMA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"type-fest": "^2.9.0" "type-fest": "^2.13.0"
} }
}, },
"node_modules/@tsconfig/node10": { "node_modules/@tsconfig/node10": {
@ -5835,9 +5835,9 @@
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/type-fest": { "node_modules/type-fest": {
"version": "2.12.2", "version": "2.13.0",
"resolved": "https://verdaccio.lossless.one/type-fest/-/type-fest-2.12.2.tgz", "resolved": "https://verdaccio.lossless.one/type-fest/-/type-fest-2.13.0.tgz",
"integrity": "sha512-qt6ylCGpLjZ7AaODxbpyBZSs9fCI9SkL3Z9q2oxMBQhs/uyY+VD8jHA8ULCGmWQJlBgqvO3EJeAngOHD8zQCrQ==", "integrity": "sha512-lPfAm42MxE4/456+QyIaaVBAwgpJb6xZ8PRu09utnhPdWwcyj9vgy6Sq0Z5yNbJ21EdxB5dRU/Qg8bsyAMtlcw==",
"license": "(MIT OR CC0-1.0)", "license": "(MIT OR CC0-1.0)",
"engines": { "engines": {
"node": ">=12.20" "node": ">=12.20"
@ -7272,11 +7272,11 @@
} }
}, },
"@tsclass/tsclass": { "@tsclass/tsclass": {
"version": "4.0.2", "version": "4.0.3",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-4.0.2.tgz", "resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-4.0.3.tgz",
"integrity": "sha512-f3r1P2+h3upZboMrWqr9KrkK5V1DtiiSlImeHTQmnhdYlxRykarciV2ssDPGY0J8w44pkWKgYG2dkuypIbSj1w==", "integrity": "sha512-dvi+8IncskjJ2ApXg5AyqEa+C5KkXtRPXYmh3MKr5BCdBitJjPQ6Rni3EBaGlD9RTYMCvjmHUNjwJub0b3GDMA==",
"requires": { "requires": {
"type-fest": "^2.9.0" "type-fest": "^2.13.0"
} }
}, },
"@tsconfig/node10": { "@tsconfig/node10": {
@ -10489,9 +10489,9 @@
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
}, },
"type-fest": { "type-fest": {
"version": "2.12.2", "version": "2.13.0",
"resolved": "https://verdaccio.lossless.one/type-fest/-/type-fest-2.12.2.tgz", "resolved": "https://verdaccio.lossless.one/type-fest/-/type-fest-2.13.0.tgz",
"integrity": "sha512-qt6ylCGpLjZ7AaODxbpyBZSs9fCI9SkL3Z9q2oxMBQhs/uyY+VD8jHA8ULCGmWQJlBgqvO3EJeAngOHD8zQCrQ==" "integrity": "sha512-lPfAm42MxE4/456+QyIaaVBAwgpJb6xZ8PRu09utnhPdWwcyj9vgy6Sq0Z5yNbJ21EdxB5dRU/Qg8bsyAMtlcw=="
}, },
"type-is": { "type-is": {
"version": "1.6.18", "version": "1.6.18",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartdata", "name": "@pushrocks/smartdata",
"version": "5.0.2", "version": "5.0.5",
"private": false, "private": false,
"description": "do more with data", "description": "do more with data",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -29,7 +29,7 @@
"@pushrocks/smartrx": "^2.0.25", "@pushrocks/smartrx": "^2.0.25",
"@pushrocks/smartstring": "^4.0.2", "@pushrocks/smartstring": "^4.0.2",
"@pushrocks/smartunique": "^3.0.3", "@pushrocks/smartunique": "^3.0.3",
"@tsclass/tsclass": "^4.0.2", "@tsclass/tsclass": "^4.0.3",
"@types/lodash": "^4.14.182", "@types/lodash": "^4.14.182",
"@types/mongodb": "^4.0.7", "@types/mongodb": "^4.0.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartdata', name: '@pushrocks/smartdata',
version: '5.0.2', version: '5.0.5',
description: 'do more with data' description: 'do more with data'
} }

View File

@ -4,4 +4,7 @@ export * from './smartdata.classes.doc.js';
export * from './smartdata.classes.easystore.js'; export * from './smartdata.classes.easystore.js';
export * from './smartdata.classes.cursor.js'; export * from './smartdata.classes.cursor.js';
export type { IMongoDescriptor } from './interfaces/index.js'; // to be removed with the next breaking update
import * as plugins from './smartdata.plugins.js';
type IMongoDescriptor = plugins.tsclass.database.IMongoDescriptor;
export type { IMongoDescriptor }

View File

@ -1 +0,0 @@
export * from './mongodescriptor.js';

View File

@ -1,22 +0,0 @@
export interface IMongoDescriptor {
/**
* the URL to connect to
*/
mongoDbUrl: string;
/**
* the db to use for the project
*/
mongoDbName?: string;
/**
* a username to use to connect to the database
*/
mongoDbUser?: string;
/**
* an optional password that will be replace <PASSWORD> in the connection string
*/
mongoDbPass?: string;
}

View File

@ -5,7 +5,6 @@ import { SmartdataCollection } from './smartdata.classes.collection.js';
import { EasyStore } from './smartdata.classes.easystore.js'; import { EasyStore } from './smartdata.classes.easystore.js';
import { logger } from './smartdata.logging.js'; import { logger } from './smartdata.logging.js';
import { IMongoDescriptor } from './interfaces/index.js';
/** /**
* interface - indicates the connection status of the db * interface - indicates the connection status of the db
@ -13,13 +12,13 @@ import { IMongoDescriptor } from './interfaces/index.js';
export type TConnectionStatus = 'initial' | 'disconnected' | 'connected' | 'failed'; export type TConnectionStatus = 'initial' | 'disconnected' | 'connected' | 'failed';
export class SmartdataDb { export class SmartdataDb {
smartdataOptions: IMongoDescriptor; smartdataOptions: plugins.tsclass.database.IMongoDescriptor;
mongoDbClient: plugins.mongodb.MongoClient; mongoDbClient: plugins.mongodb.MongoClient;
mongoDb: plugins.mongodb.Db; mongoDb: plugins.mongodb.Db;
status: TConnectionStatus; status: TConnectionStatus;
smartdataCollectionMap = new ObjectMap<SmartdataCollection<any>>(); smartdataCollectionMap = new ObjectMap<SmartdataCollection<any>>();
constructor(smartdataOptions: IMongoDescriptor) { constructor(smartdataOptions: plugins.tsclass.database.IMongoDescriptor) {
this.smartdataOptions = smartdataOptions; this.smartdataOptions = smartdataOptions;
this.status = 'initial'; this.status = 'initial';
} }

View File

@ -11,11 +11,11 @@ export class SmartdataDbWatcher<T = any> {
// INSTANCE // INSTANCE
private changeStream: plugins.mongodb.ChangeStream<T>; private changeStream: plugins.mongodb.ChangeStream<T>;
public changeSubject = new plugins.smartrx.rxjs.Subject<SmartDataDbDoc<T, T>>(); public changeSubject = new plugins.smartrx.rxjs.Subject<T>();
constructor(changeStreamArg: plugins.mongodb.ChangeStream<T>, smartdataDbDocArg: typeof SmartDataDbDoc) { constructor(changeStreamArg: plugins.mongodb.ChangeStream<T>, smartdataDbDocArg: typeof SmartDataDbDoc) {
this.changeStream = changeStreamArg; this.changeStream = changeStreamArg;
this.changeStream.on('change', async (item: T) => { this.changeStream.on('change', async (item: T) => {
this.changeSubject.next(smartdataDbDocArg.createInstanceFromMongoDbNativeDoc(item)); this.changeSubject.next(smartdataDbDocArg.createInstanceFromMongoDbNativeDoc(item) as any as T);
}) })
plugins.smartdelay.delayFor(0).then(() => { plugins.smartdelay.delayFor(0).then(() => {
this.readyDeferred.resolve(); this.readyDeferred.resolve();