Comparing version 0.9.7 to 0.10.0
@@ -0,1 +1,8 @@ | ||
# [0.10.0](https://github.com/VaclavObornik/mongodash/compare/v0.9.7...v0.10.0) (2021-07-24) | ||
### Features | ||
* **mongodb driver version:** peer dependency updated to mongodb@4 ([c4ce719](https://github.com/VaclavObornik/mongodash/commit/c4ce7193b81b80f44eb2d1033c5ed8ad07004b36)) | ||
## [0.9.7](https://github.com/VaclavObornik/mongodash/compare/v0.9.6...v0.9.7) (2021-07-14) | ||
@@ -2,0 +9,0 @@ |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -4,0 +4,0 @@ * |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -98,12 +98,5 @@ * | ||
if (!state.ensureIndexPromise) { | ||
state.ensureIndexPromise = state.collection.createIndexes([ | ||
{ | ||
name: 'runSinceIndex', | ||
key: { runSince: 1, _id: 1, lockedTill: 1 }, | ||
}, | ||
{ | ||
name: 'runImmediatelyIndex', | ||
key: { runImmediately: 1, _id: 1, lockedTill: 1 }, | ||
partialFilterExpression: { runImmediately: { $eq: true } }, | ||
}, | ||
state.ensureIndexPromise = Promise.all([ | ||
state.collection.createIndex({ runSince: 1, _id: 1, lockedTill: 1 }, { name: 'runSinceIndex' }), | ||
state.collection.createIndex({ runImmediately: 1, _id: 1, lockedTill: 1 }, { name: 'runImmediatelyIndex', partialFilterExpression: { runImmediately: { $eq: true } } }), | ||
]); | ||
@@ -178,2 +171,3 @@ } | ||
let taskError = null; | ||
// todo solve the "any" | ||
const stopContinuousLock = createContinuousLock_1.createContinuousLock(state.collection, task.taskId, 'lockedTill', lockTime, _onError); | ||
@@ -180,0 +174,0 @@ try { |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -18,7 +18,7 @@ * | ||
let depthCallCounter = 0; | ||
function getCollection(name, options = {}) { | ||
function getCollection(name) { | ||
try { | ||
depthCallCounter++; | ||
if (collectionFactory && depthCallCounter === 1) { | ||
const collection = collectionFactory(name, options); | ||
const collection = collectionFactory(name); | ||
if (collection) { | ||
@@ -28,3 +28,3 @@ return collection; | ||
} | ||
return getMongoClient_1.getMongoClient().db().collection(name, options); | ||
return getMongoClient_1.getMongoClient().db().collection(name); | ||
} | ||
@@ -31,0 +31,0 @@ finally { |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -31,3 +31,3 @@ * | ||
else if ('uri' in options) { | ||
mongoClientInstance = new mongodb_1.MongoClient(options.uri, Object.assign({ useUnifiedTopology: true }, options.clientOptions)); | ||
mongoClientInstance = new mongodb_1.MongoClient(options.uri, options.clientOptions); | ||
} | ||
@@ -37,3 +37,3 @@ else { | ||
} | ||
if (!mongoClientInstance.isConnected() && options.autoConnect) { | ||
if (options.autoConnect) { | ||
await mongoClientInstance.connect(); | ||
@@ -40,0 +40,0 @@ } |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -4,0 +4,0 @@ * |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -4,0 +4,0 @@ * |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -72,2 +72,3 @@ * | ||
}); | ||
// todo solve the "any" | ||
const stopContinuousLock = createContinuousLock_1.createContinuousLock(collection, stringKey, expirationKey, expireIn, onError); | ||
@@ -74,0 +75,0 @@ try { |
/**! | ||
* mongodash v0.9.7 | ||
* mongodash v0.10.0 | ||
* https://github.com/VaclavObornik/mongodash.git | ||
@@ -4,0 +4,0 @@ * |
import { Collection } from 'mongodb'; | ||
import { OnError } from './OnError'; | ||
declare type StopContinuousLock = () => Promise<void>; | ||
export declare function createContinuousLock(collection: Collection, documentId: string, lockProperty: string, lockTime: number, onError: OnError): StopContinuousLock; | ||
declare type ObjectWithId = { | ||
_id: unknown; | ||
}; | ||
export declare function createContinuousLock(collection: Collection<ObjectWithId>, documentId: string, lockProperty: string, lockTime: number, onError: OnError): StopContinuousLock; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
import { Collection, DbCollectionOptions } from 'mongodb'; | ||
export declare type CollectionFactory = <T>(name: string, options?: DbCollectionOptions) => Collection<T> | null; | ||
import { Collection } from 'mongodb'; | ||
export declare type CollectionFactory = <T>(name: string) => Collection<T> | null; | ||
export declare type InitOptions = { | ||
@@ -14,2 +14,2 @@ /** | ||
export declare function init(options: InitOptions): void; | ||
export declare function getCollection<T>(name: string, options?: DbCollectionOptions): Collection<T>; | ||
export declare function getCollection<T>(name: string): Collection<T>; |
{ | ||
"name": "mongodash", | ||
"version": "0.9.7", | ||
"version": "0.10.0", | ||
"description": "An utility library delivering super-useful and super-simple tools using MongoDB", | ||
@@ -35,3 +35,3 @@ "main": "dist/lib/index.js", | ||
"peerDependencies": { | ||
"mongodb": ">=3 <4" | ||
"mongodb": ">=4 <5" | ||
}, | ||
@@ -72,3 +72,3 @@ "devDependencies": { | ||
"lodash": "^4.17.21", | ||
"mongodb": "^3.6.10", | ||
"mongodb": "^4.0.1", | ||
"node-sass": "^6.0.0", | ||
@@ -75,0 +75,0 @@ "npm-run-all": "^4.1.5", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50198
718