New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongot

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongot - npm Package Compare versions

Comparing version 1.0.1 to 1.1.2

5

package.json
{
"name": "mongot",
"version": "1.0.1",
"version": "1.1.2",
"description": "MongoT is a modern ODM library for MongoDb.",

@@ -10,3 +10,2 @@ "main": "src/index.js",

"build": "tsc",
"watch": "tsc -w",
"test": "npm run build && tape -r source-map-support/register src/*.spec.js",

@@ -44,4 +43,4 @@ "version": "git add -A",

"tape": "^4.6.3",
"typescript": "^2.1.4"
"typescript": "^2.1.5"
}
}

2

src/collection.d.ts

@@ -252,4 +252,4 @@ import * as MongoDb from 'mongodb';

*/
updateOne(filter: Object | SchemaDocument, update: Object, options?: Object): Promise<UpdateResult>;
updateOne(filter: Object | SchemaDocument, update: Object | SchemaDocument, options?: Object): Promise<UpdateResult>;
}
export { Collection };

@@ -7,5 +7,14 @@ "use strict";

function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
const assert_1 = require("assert");

@@ -443,10 +452,23 @@ const document_1 = require("./document");

return this.queue((collection) => __awaiter(this, void 0, void 0, function* () {
let beforeUpdate = () => void 0;
let afterUpdate = () => void 0;
let updateSchema = update;
if (filter instanceof document_1.SchemaDocument) {
const listener = filter.getEventListener();
listener.emit(Events.beforeUpdate);
const updateResult = new helpers_1.UpdateResult(yield collection.updateOne(this.filter(filter), update, options));
listener.emit(Events.afterUpdate);
return updateResult;
beforeUpdate = () => listener.emit(Events.beforeUpdate);
afterUpdate = () => listener.emit(Events.afterUpdate);
}
return new helpers_1.UpdateResult(yield collection.updateOne(this.filter(filter), update, options));
if (update instanceof document_1.SchemaDocument) {
const listener = update.getEventListener();
beforeUpdate = () => listener.emit(Events.beforeUpdate);
afterUpdate = () => listener.emit(Events.afterUpdate);
}
beforeUpdate();
if (update instanceof document_1.SchemaDocument) {
const _a = update.toObject(), { _id } = _a, document = __rest(_a, ["_id"]);
updateSchema = document;
}
const updateResult = new helpers_1.UpdateResult(yield collection.updateOne(this.filter(filter), updateSchema, options));
afterUpdate();
return updateResult;
}));

@@ -453,0 +475,0 @@ }

@@ -0,0 +0,0 @@ import * as MongoDb from 'mongodb';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import * as MongoDb from 'mongodb';

@@ -0,0 +0,0 @@ "use strict";

@@ -10,18 +10,72 @@ /// <reference types="node" />

private cast;
/**
* @param cursor
* @param transform
*/
constructor(cursor: MongoDb.Cursor, transform?: <TNewDocument>(document: Object) => TNewDocument);
/**
* @returns {Cursor<T>}
*/
clone(): Cursor<T>;
/**
* @returns {Cursor}
*/
rewind(): this;
/**
* @param applySkipLimit
* @param options
* @returns {Promise<number>}
*/
count(applySkipLimit?: boolean, options?: MongoDb.CursorCommentOptions): Promise<number>;
/**
* @param fields
* @returns {Cursor}
*/
project(fields: Object | string): this;
/**
* @param value
* @returns {Cursor}
*/
limit(value: number): this;
/**
* @param value
* @returns {Cursor}
*/
skip(value: number): this;
/**
* @param fn
* @returns {Cursor<TMutate>}
*/
map<TMutate>(fn: Function): Cursor<TMutate>;
/**
* @param value
* @returns {Cursor}
*/
max(value: number): this;
/**
* @param value
* @returns {Cursor}
*/
min(value: number): this;
/**
* @param value
* @returns {Cursor}
*/
sort(value: {
[key: string]: number;
}): this;
/**
* @deprecated A hasNext() method in some combination with fetch causes error "cursor is exhausted".
*
* @returns {Promise<boolean>}
*/
hasNext(): Promise<boolean>;
/**
* @returns {Promise<T>}
*/
fetch(): Promise<T>;
/**
* @returns {Promise<T[]>}
*/
fetchAll(): Promise<T[]>;
}

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

function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
step((generator = generator.apply(thisArg, _arguments || [])).next());
});

@@ -14,2 +14,6 @@ };

class Cursor extends events_1.EventEmitter {
/**
* @param cursor
* @param transform
*/
constructor(cursor, transform) {

@@ -26,5 +30,11 @@ super();

}
/**
* @returns {Cursor<T>}
*/
clone() {
return new Cursor(this.cursor.clone(), this.cast);
}
/**
* @returns {Cursor}
*/
rewind() {

@@ -34,5 +44,14 @@ this.cursor.rewind();

}
/**
* @param applySkipLimit
* @param options
* @returns {Promise<number>}
*/
count(applySkipLimit, options) {
return this.cursor.count(applySkipLimit, options);
}
/**
* @param fields
* @returns {Cursor}
*/
project(fields) {

@@ -48,2 +67,6 @@ this.cast = x => document_1.PartialDocumentFragment.factory(x);

}
/**
* @param value
* @returns {Cursor}
*/
limit(value) {

@@ -53,2 +76,6 @@ this.cursor.limit(value);

}
/**
* @param value
* @returns {Cursor}
*/
skip(value) {

@@ -58,2 +85,6 @@ this.cursor.skip(value);

}
/**
* @param fn
* @returns {Cursor<TMutate>}
*/
map(fn) {

@@ -63,2 +94,6 @@ this.cursor.map(fn);

}
/**
* @param value
* @returns {Cursor}
*/
max(value) {

@@ -68,2 +103,6 @@ this.cursor.max(value);

}
/**
* @param value
* @returns {Cursor}
*/
min(value) {

@@ -73,2 +112,6 @@ this.cursor.min(value);

}
/**
* @param value
* @returns {Cursor}
*/
sort(value) {

@@ -78,2 +121,7 @@ this.cursor.sort(value);

}
/**
* @deprecated A hasNext() method in some combination with fetch causes error "cursor is exhausted".
*
* @returns {Promise<boolean>}
*/
hasNext() {

@@ -84,2 +132,5 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* @returns {Promise<T>}
*/
fetch() {

@@ -93,2 +144,5 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* @returns {Promise<T[]>}
*/
fetchAll() {

@@ -95,0 +149,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import * as MongoDb from 'mongodb';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { SchemaMetadata } from "../document";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare class Query {

@@ -0,0 +0,0 @@ "use strict";

import './metadata';
"use strict";
require("./metadata");
//# sourceMappingURL=index.js.map
import './reflect';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ declare namespace Reflect {

@@ -0,0 +0,0 @@ import "./reflect";

@@ -0,0 +0,0 @@ "use strict";

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc