You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@highoutput/repository

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highoutput/repository - npm Package Compare versions

Comparing version

to
0.4.0

1

dist/repository.d.ts

@@ -21,2 +21,3 @@ import { Model, Document, FilterQuery, Connection, Schema } from 'mongoose';

}>): Promise<TEntity>;
updateMany(filter: FilterQuery<TEntity>, data: Partial<Omit<TEntity, 'id'>>): Promise<void>;
deleteOne(filter: FilterQuery<TEntity>): Promise<void>;

@@ -23,0 +24,0 @@ deleteById(id: ObjectId): Promise<void>;

@@ -7,4 +7,4 @@ "use strict";

exports.Repository = void 0;
const object_id_1 = require("@highoutput/object-id");
const ramda_1 = __importDefault(require("ramda"));
const object_id_1 = require("@highoutput/object-id");
function deserialize(doc) {

@@ -51,3 +51,16 @@ if (!doc)

if (field === 'id') {
return Object.assign(Object.assign({}, accum), { _id: value.toBuffer() });
if (value instanceof object_id_1.ObjectId) {
return Object.assign(Object.assign({}, accum), { _id: value.toBuffer() });
}
return Object.assign(Object.assign({}, accum), { _id: ramda_1.default.mergeRight(ramda_1.default.reduce((accum, item) => {
if (value[item]) {
return Object.assign(Object.assign({}, accum), { [item]: ramda_1.default.map((id) => id.toBuffer(), value[item]) });
}
return accum;
}, {}, ['$in', '$nin']), ramda_1.default.reduce((accum, item) => {
if (value[item]) {
return Object.assign(Object.assign({}, accum), { [item]: value[item].toBuffer() });
}
return accum;
}, {}, ['$eq', '$ne'])) });
}

@@ -91,2 +104,5 @@ if (value instanceof object_id_1.ObjectId) {

}
async updateMany(filter, data) {
await this._model.updateMany(serializeFilter(filter), ramda_1.default.filter((value) => value !== undefined)(serialize(data)));
}
async deleteOne(filter) {

@@ -93,0 +109,0 @@ await this._model.deleteOne(serializeFilter(filter));

4

package.json
{
"name": "@highoutput/repository",
"version": "0.3.3",
"version": "0.4.0",
"description": "Repository class implementation",

@@ -52,3 +52,3 @@ "author": "High Output Ventures",

},
"gitHead": "2fb397b0059991cd2194972c6b8991533c0f7e95"
"gitHead": "05e1baba75919f00b263ca6142ff997fb4e01d43"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet