Socket
Socket
Sign inDemoInstall

cormo

Package Overview
Dependencies
Maintainers
3
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cormo - npm Package Compare versions

Comparing version 0.13.0 to 0.13.1

5

lib/query.d.ts

@@ -28,2 +28,3 @@ /// <reference types="node" />

export interface IQuerySingle<M extends BaseModel, T = M> extends PromiseLike<T> {
clone(): IQuerySingle<M, T>;
find(id: RecordID): IQuerySingle<M, T>;

@@ -66,2 +67,3 @@ find(id: RecordID[]): IQueryArray<M, T>;

export interface IQueryArray<M extends BaseModel, T = M> extends PromiseLike<T[]> {
clone(): IQueryArray<M, T>;
find(id: RecordID): IQuerySingle<M, T>;

@@ -119,2 +121,3 @@ find(id: RecordID[]): IQueryArray<M, T>;

private _preserve_order_ids?;
private _used;
/**

@@ -124,2 +127,3 @@ * Creates a query instance

constructor(model: typeof BaseModel);
clone(): Query<M, T>;
/**

@@ -252,3 +256,4 @@ * Finds a record by id

private _addCondition;
private _setUsed;
}
export { Query };

@@ -17,2 +17,3 @@ "use strict";

this._find_single_id = false;
this._used = false;
this._model = model;

@@ -33,2 +34,13 @@ this._name = model._name;

}
clone() {
const cloned = new Query(this._model);
cloned._ifs = lodash_1.default.cloneDeep(this._ifs);
cloned._current_if = this._current_if;
cloned._conditions = lodash_1.default.cloneDeep(this._conditions);
cloned._includes = lodash_1.default.cloneDeep(this._includes);
cloned._options = lodash_1.default.cloneDeep(this._options);
cloned._find_single_id = this._find_single_id;
cloned._used = false;
return cloned;
}
find(id) {

@@ -241,2 +253,3 @@ if (!this._current_if) {

async exec(options) {
this._setUsed();
await this._model._checkReady();

@@ -266,2 +279,3 @@ if (this._options.cache && this._options.cache.key) {

stream() {
this._setUsed();
const transformer = new stream_1.default.Transform({ objectMode: true });

@@ -297,2 +311,3 @@ transformer._transform = function (chunk, encoding, callback) {

async count() {
this._setUsed();
await this._model._checkReady();

@@ -310,2 +325,3 @@ if (this._id || this._find_single_id) {

async update(updates) {
this._setUsed();
await this._model._checkReady();

@@ -330,2 +346,3 @@ const errors = [];

async upsert(updates) {
this._setUsed();
await this._model._checkReady();

@@ -350,2 +367,3 @@ const errors = [];

async delete(options) {
this._setUsed();
await this._model._checkReady();

@@ -590,3 +608,9 @@ if (this._id || this._find_single_id) {

}
_setUsed() {
if (this._used) {
throw new Error('Query object is already used');
}
this._used = true;
}
}
exports.Query = Query;

12

package.json
{
"name": "cormo",
"description": "ORM framework for Node.js",
"version": "0.13.0",
"version": "0.13.1",
"keywords": [

@@ -47,4 +47,4 @@ "orm",

"@types/mocha": "^5.2.7",
"@types/mongodb": "^3.3.12",
"@types/node": "^12.12.17",
"@types/mongodb": "^3.3.13",
"@types/node": "^12.12.21",
"@types/sinon": "^7.5.1",

@@ -58,5 +58,5 @@ "benchmark": "^2.1.4",

"mocha": "^6.2.2",
"mongodb": "^3.4.0",
"mongodb": "^3.4.1",
"mysql": "^2.17.1",
"pg": "^7.14.0",
"pg": "^7.15.1",
"pg-query-stream": "^2.0.1",

@@ -71,3 +71,3 @@ "redis": "^2.7.1",

},
"gitHead": "fd3b6d8510e206e7e97aa9b51fceeefe8492fc87"
"gitHead": "492d6d63ede118ee07a128321037855c4d038e2e"
}
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