Comparing version 0.16.12 to 0.16.13
@@ -21,3 +21,4 @@ module.exports = { | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
}, | ||
}; |
@@ -413,3 +413,3 @@ "use strict"; | ||
} | ||
const id = _objectIdToString(result.ops[0]._id); | ||
const id = _objectIdToString(result.insertedId); | ||
if (id) { | ||
@@ -446,8 +446,5 @@ delete data._id; | ||
let error; | ||
const ids = result.ops.map((doc) => { | ||
const id = _objectIdToString(doc._id); | ||
if (id) { | ||
delete doc._id; | ||
} | ||
else { | ||
const ids = Object.values(result.insertedIds).map((inserted_id) => { | ||
const id = _objectIdToString(inserted_id); | ||
if (!id) { | ||
error = new Error('unexpected result'); | ||
@@ -499,3 +496,3 @@ } | ||
const result = await this._collection(model).updateMany(conditions, update_ops, { safe: true, multi: true }); | ||
return result.result.n; | ||
return result.modifiedCount; | ||
} | ||
@@ -664,7 +661,4 @@ catch (error) { | ||
}; | ||
this._collection(model).find(conditions, client_options, (error, cursor) => { | ||
if (error || !cursor) { | ||
transformer.emit('error', MongoDBAdapter.wrapError('unknown error', error)); | ||
return; | ||
} | ||
try { | ||
const cursor = this._collection(model).find(conditions, client_options).stream(); | ||
cursor | ||
@@ -675,3 +669,6 @@ .on('error', (e) => { | ||
.pipe(transformer); | ||
}); | ||
} | ||
catch (error) { | ||
transformer.emit('error', MongoDBAdapter.wrapError('unknown error', error)); | ||
} | ||
return transformer; | ||
@@ -724,3 +721,3 @@ } | ||
const result = await this._collection(model).deleteMany(conditions, { safe: true }); | ||
return result.result.n; | ||
return result.deletedCount; | ||
} | ||
@@ -727,0 +724,0 @@ catch (error) { |
@@ -85,3 +85,3 @@ "use strict"; | ||
try { | ||
id = await this._client.incrAsync(`${inflector_1.tableize(model)}:_lastid`); | ||
id = await this._client.incrAsync(`${(0, inflector_1.tableize)(model)}:_lastid`); | ||
} | ||
@@ -92,3 +92,3 @@ catch (error) { | ||
try { | ||
await this._client.hmsetAsync(`${inflector_1.tableize(model)}:${id}`, data); | ||
await this._client.hmsetAsync(`${(0, inflector_1.tableize)(model)}:${id}`, data); | ||
} | ||
@@ -106,3 +106,3 @@ catch (error) { | ||
async update(model, data, options) { | ||
const key = `${inflector_1.tableize(model)}:${data.id}`; | ||
const key = `${(0, inflector_1.tableize)(model)}:${data.id}`; | ||
delete data.id; | ||
@@ -140,3 +140,3 @@ data.$_$ = ''; // ensure that there is one argument(one field) at least | ||
fields_to_del.push('$_$'); // ensure that there is one argument at least | ||
const table = inflector_1.tableize(model); | ||
const table = (0, inflector_1.tableize)(model); | ||
data.$_$ = ''; // ensure that there is one argument(one field) at least | ||
@@ -170,3 +170,3 @@ const keys = await this._getKeys(table, conditions); | ||
try { | ||
result = await this._client.hgetallAsync(`${inflector_1.tableize(model)}:${id}`); | ||
result = await this._client.hgetallAsync(`${(0, inflector_1.tableize)(model)}:${id}`); | ||
} | ||
@@ -186,3 +186,3 @@ catch (error) { | ||
async find(model, conditions, options) { | ||
const table = inflector_1.tableize(model); | ||
const table = (0, inflector_1.tableize)(model); | ||
const keys = await this._getKeys(table, conditions); | ||
@@ -211,3 +211,3 @@ let records = await Promise.all(keys.map(async (key) => { | ||
async delete(model, conditions, options) { | ||
const keys = await this._getKeys(inflector_1.tableize(model), conditions); | ||
const keys = await this._getKeys((0, inflector_1.tableize)(model), conditions); | ||
if (keys.length === 0) { | ||
@@ -214,0 +214,0 @@ return 0; |
@@ -6,3 +6,3 @@ "use strict"; | ||
function createAdapter(connection) { | ||
const adapter = sqlite3_1.createAdapter(connection); | ||
const adapter = (0, sqlite3_1.createAdapter)(connection); | ||
const _super_connect = adapter.connect; | ||
@@ -9,0 +9,0 @@ adapter.connect = async function () { |
@@ -435,3 +435,3 @@ "use strict"; | ||
[util_1.inspect.custom]() { | ||
return util_1.inspect(this.models); | ||
return (0, util_1.inspect)(this.models); | ||
} | ||
@@ -438,0 +438,0 @@ /** |
@@ -178,3 +178,3 @@ "use strict"; | ||
if (!this.table_name) { | ||
this.table_name = inflector_1.tableize(name); | ||
this.table_name = (0, inflector_1.tableize)(name); | ||
} | ||
@@ -366,3 +366,3 @@ this.column('id', 'recordid'); | ||
const redis = await this._connection._connectRedisCache(); | ||
key = 'CC.' + inflector_1.tableize(this._name) + ':' + key; | ||
key = 'CC.' + (0, inflector_1.tableize)(this._name) + ':' + key; | ||
const value = await new Promise((resolve, reject) => { | ||
@@ -384,3 +384,3 @@ redis.get(key, (error, v) => { | ||
const redis = await this._connection._connectRedisCache(); | ||
key = 'CC.' + inflector_1.tableize(this._name) + ':' + key; | ||
key = 'CC.' + (0, inflector_1.tableize)(this._name) + ':' + key; | ||
await new Promise((resolve, reject) => { | ||
@@ -398,3 +398,3 @@ redis.setex(key, ttl, JSON.stringify(data), (error) => { | ||
const redis = await this._connection._connectRedisCache(); | ||
key = 'CC.' + inflector_1.tableize(this._name) + ':' + key; | ||
key = 'CC.' + (0, inflector_1.tableize)(this._name) + ':' + key; | ||
await new Promise((resolve) => { | ||
@@ -401,0 +401,0 @@ redis.del(key, () => { |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.16.12", | ||
"version": "0.16.13", | ||
"keywords": [ | ||
@@ -38,36 +38,35 @@ "orm", | ||
"dependencies": { | ||
"chalk": "^4.1.1", | ||
"chalk": "^4.1.2", | ||
"inflected": "^2.1.0", | ||
"lodash": "^4.17.21", | ||
"toposort-class": "^1.0.1", | ||
"yargs": "^17.0.1" | ||
"yargs": "^17.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.21", | ||
"@types/chai": "^4.2.22", | ||
"@types/inflected": "^1.1.29", | ||
"@types/lodash": "^4.14.171", | ||
"@types/lodash": "^4.14.176", | ||
"@types/mocha": "^9.0.0", | ||
"@types/mongodb": "^3.6.20", | ||
"@types/node": "^16.4.3", | ||
"@types/sinon": "^10.0.2", | ||
"@types/yargs": "^17.0.2", | ||
"@types/node": "^16.11.6", | ||
"@types/sinon": "^10.0.6", | ||
"@types/yargs": "^17.0.5", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.3.4", | ||
"coffee-coverage": "^3.0.1", | ||
"coffeescript": "^2.5.1", | ||
"coffeescript": "^2.6.1", | ||
"microtime": "^3.0.0", | ||
"mocha": "^9.0.3", | ||
"mongodb": "^3.6.10", | ||
"mocha": "^9.1.3", | ||
"mongodb": "^4.1.3", | ||
"mysql": "^2.18.1", | ||
"mysql2": "^2.2.5", | ||
"pg": "^8.6.0", | ||
"pg-query-stream": "^4.1.0", | ||
"mysql2": "^2.3.2", | ||
"pg": "^8.7.1", | ||
"pg-query-stream": "^4.2.1", | ||
"redis": "^3.1.2", | ||
"rimraf": "^3.0.2", | ||
"sinon": "^11.1.1", | ||
"sinon": "^11.1.2", | ||
"sqlite3": "^5.0.2", | ||
"ts-node": "^10.1.0", | ||
"typescript": "^4.3.5" | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.4.4" | ||
}, | ||
"gitHead": "78a75130658a1768fdb443903ba9a14fac0ef2e1" | ||
"gitHead": "1ff8c0c42d91179954061a916377ea6a107e8279" | ||
} |
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
351752
24
9597
Updatedchalk@^4.1.2
Updatedyargs@^17.2.1