Comparing version 5.2.0 to 5.2.1
@@ -9,2 +9,3 @@ "use strict"; | ||
key: String, | ||
rawKey: String, | ||
book: String, | ||
@@ -36,3 +37,3 @@ account: String, | ||
// Example of a complex key: "My book;Liabilities:Client,Liabilities:Client Pending;clientId.$in.0:12345,clientId.$in.1:67890" | ||
const key = [ | ||
return [ | ||
book, | ||
@@ -47,9 +48,10 @@ account, | ||
.join(";"); | ||
return hashKey(key); | ||
} | ||
exports.constructKey = constructKey; | ||
async function snapshotBalance(balanceData, options = {}) { | ||
const key = constructKey(balanceData.book, balanceData.account, balanceData.meta); | ||
const rawKey = constructKey(balanceData.book, balanceData.account, balanceData.meta); | ||
const key = hashKey(rawKey); | ||
const balanceDoc = { | ||
key, | ||
rawKey, | ||
book: balanceData.book, | ||
@@ -74,5 +76,5 @@ account: balanceData.account, | ||
const { book, account, meta, ...extras } = query; | ||
const key = constructKey(book, account, { ...meta, ...extras }); | ||
const key = hashKey(constructKey(book, account, { ...meta, ...extras })); | ||
return exports.balanceModel.collection.findOne({ key }, { sort: { _id: -1 }, session: options.session }); | ||
} | ||
exports.getBestSnapshot = getBestSnapshot; |
{ | ||
"name": "medici", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "Simple double-entry accounting for Node + Mongoose", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
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
78240
1161