Socket
Socket
Sign inDemoInstall

cormo

Package Overview
Dependencies
32
Maintainers
15
Versions
169
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

3

.eslintrc.js

@@ -22,3 +22,6 @@ module.exports = {

'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
},
};

19

lib/adapters/base.js

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

/** @internal */
setValuesFromDB(instance, data, schema, selected_columns) {
setValuesFromDB(instance, data, schema, selected_columns, query_record_id_as_string) {
if (!selected_columns) {

@@ -226,5 +226,8 @@ selected_columns = Object.keys(schema);

const property = schema[column];
if (!property) {
continue;
}
let value = support_nested ? util.getPropertyOfPath(data, property._parts_db) : data[property._dbname_us];
if (value != null) {
value = this.valueToModel(value, property);
value = this.valueToModel(value, property, query_record_id_as_string);
}

@@ -265,3 +268,3 @@ else {

/** @internal */
valueToModel(value, property) {
valueToModel(value, property, _query_record_id_as_string) {
if (property.type_class === types.Object || property.array) {

@@ -282,5 +285,5 @@ return JSON.parse(value);

const instance = {};
this.setValuesFromDB(instance, data, model_class._schema, options.select);
this.setValuesFromDB(instance, data, model_class._schema, options.select, model_class.query_record_id_as_string);
model_class._collapseNestedNulls(instance, options.select_raw, null);
const id = this._getModelID(data);
const id = model_class.query_record_id_as_string ? String(this._getModelID(data)) : this._getModelID(data);
if (id) {

@@ -292,4 +295,4 @@ instance.id = id;

else {
const id = this._getModelID(data);
const model_class = this._connection.models[model_name];
const id = model_class.query_record_id_as_string ? String(this._getModelID(data)) : this._getModelID(data);
return new model_class(data, id, options.select, options.select_raw);

@@ -299,3 +302,3 @@ }

/** @internal */
_convertToGroupInstance(model_name, data, group_by, group_fields) {
_convertToGroupInstance(model_name, data, group_by, group_fields, query_record_id_as_string) {
const instance = {};

@@ -311,3 +314,3 @@ if (group_by) {

if (property) {
util.setPropertyOfPath(instance, property._parts, this.valueToModel(data[field], property));
util.setPropertyOfPath(instance, property._parts, this.valueToModel(data[field], property, query_record_id_as_string));
}

@@ -314,0 +317,0 @@ }

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

}
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields);
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields, model_class.query_record_id_as_string);
});

@@ -817,3 +817,3 @@ }

/** @internal */
valueToModel(value, property) {
valueToModel(value, property, _query_record_id_as_string) {
if (property.type_class === CormoTypesObjectId) {

@@ -820,0 +820,0 @@ if (property.array) {

@@ -597,4 +597,5 @@ "use strict";

if (options.group_fields) {
const model_class = this._connection.models[model_name];
return result.map((record) => {
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields);
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields, model_class?.query_record_id_as_string ?? false);
});

@@ -936,3 +937,3 @@ }

/** @internal */
valueToModel(value, property) {
valueToModel(value, property, query_record_id_as_string) {
if (property.type_class === types.Object || property.array) {

@@ -952,2 +953,5 @@ try {

}
else if (property.record_id && query_record_id_as_string) {
return String(value);
}
else {

@@ -954,0 +958,0 @@ return value;

@@ -421,4 +421,5 @@ "use strict";

if (options.group_fields) {
const model_class = this._connection.models[model_name];
return rows.map((record) => {
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields);
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields, model_class?.query_record_id_as_string ?? false);
});

@@ -655,6 +656,9 @@ }

/** @internal */
valueToModel(value, property) {
valueToModel(value, property, query_record_id_as_string) {
if (property.type_class === types.BigInteger) {
return Number(value);
}
else if (property.record_id && query_record_id_as_string) {
return String(value);
}
return value;

@@ -730,3 +734,5 @@ }

? new types.BigInteger()
: column.data_type === 'USER-DEFINED' && column.udt_schema === 'public' && column.udt_name === 'geometry'
: column.data_type === 'USER-DEFINED' &&
column.udt_schema === 'public' &&
column.udt_name === 'geometry'
? new types.GeoPoint()

@@ -733,0 +739,0 @@ : column.data_type === 'timestamp without time zone'

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

/** @internal */
valueToModel(value, property) {
valueToModel(value, property, query_record_id_as_string) {
switch (property.type_class) {

@@ -257,2 +257,5 @@ case types.Number:

default:
if (property.record_id && query_record_id_as_string) {
return String(value);
}
return value;

@@ -259,0 +262,0 @@ }

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

const key = keys[0];
if (key.substring(0, 1) === '$') {
if (key.startsWith('$')) {
switch (key) {

@@ -299,0 +299,0 @@ case '$and':

@@ -415,4 +415,5 @@ "use strict";

if (options.group_fields) {
const model_class = this._connection.models[model_name];
return result.map((record) => {
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields);
return this._convertToGroupInstance(model_name, record, options.group_by, options.group_fields, model_class?.query_record_id_as_string ?? false);
});

@@ -624,3 +625,3 @@ }

/** @internal */
valueToModel(value, property) {
valueToModel(value, property, query_record_id_as_string) {
if (property.type_class === types.Object || property.array) {

@@ -640,2 +641,5 @@ try {

}
else if (property.record_id && query_record_id_as_string) {
return String(value);
}
else {

@@ -642,0 +646,0 @@ return value;

@@ -8,2 +8,3 @@ import { Connection, AssociationBelongsToOptions, AssociationHasManyOptions, AssociationHasOneOptions } from './connection';

description?: string;
query_record_id_as_string?: boolean;
}): (ctor: typeof BaseModel) => void;

@@ -10,0 +11,0 @@ export declare function Column(column_property: types.ColumnType | types.ColumnType[] | ColumnProperty | ColumnNestedProperty): PropertyDecorator;

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

ctor.description = options.description;
ctor.query_record_id_as_string = options.query_record_id_as_string ?? false;
if (options.connection) {

@@ -13,0 +14,0 @@ ctor.connection(options.connection);

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColorConsoleLogger = void 0;
const chalk_1 = __importDefault(require("chalk"));
const tsimportlib_1 = require("tsimportlib");
let chalk;
class ColorConsoleLogger {
logQuery(text, values) {
console.log(' ', chalk_1.default.blue.bold(text), values);
if (chalk) {
console.log(' ', chalk.blue.bold(text), values);
}
}
}
exports.ColorConsoleLogger = ColorConsoleLogger;
(async () => {
chalk = (await (0, tsimportlib_1.dynamicImport)('chalk', module)).default;
})();

@@ -58,2 +58,7 @@ /// <reference types="node" />

static lean_query: boolean;
/**
* Forces to return record id as string.
* It remains as number on the persisted record if the adapter uses number for record id.
*/
static query_record_id_as_string: boolean;
static table_name: string;

@@ -60,0 +65,0 @@ static description?: string;

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

const [id, selected_columns, selected_columns_raw] = [arguments[1], arguments[2], arguments[3]];
adapter.setValuesFromDB(this, data, schema, selected_columns);
adapter.setValuesFromDB(this, data, schema, selected_columns, ctor.query_record_id_as_string);
ctor._collapseNestedNulls(this, selected_columns_raw, ctor.dirty_tracking ? this._intermediates : undefined);

@@ -1062,2 +1062,7 @@ Object.defineProperty(this, 'id', {

BaseModel.lean_query = false;
/**
* Forces to return record id as string.
* It remains as number on the persisted record if the adapter uses number for record id.
*/
BaseModel.query_record_id_as_string = false;
BaseModel._initialize_called = false;

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

IsolationLevel["SERIALIZABLE"] = "SERIALIZABLE";
})(IsolationLevel = exports.IsolationLevel || (exports.IsolationLevel = {}));
})(IsolationLevel || (exports.IsolationLevel = IsolationLevel = {}));
class Transaction {

@@ -13,0 +13,0 @@ /** @internal */

{
"name": "cormo",
"description": "ORM framework for Node.js",
"version": "1.1.0",
"version": "1.2.0",
"keywords": [

@@ -38,34 +38,35 @@ "orm",

"dependencies": {
"chalk": "^4.1.2",
"chalk": "^5.3.0",
"inflected": "^2.1.0",
"ioredis": "^5.2.4",
"ioredis": "^5.3.2",
"lodash": "^4.17.21",
"toposort-class": "^1.0.1",
"yargs": "^17.3.1"
"tsimportlib": "^0.0.5",
"yargs": "^17.7.2"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/inflected": "^1.1.29",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.11",
"@types/sinon": "^10.0.13",
"@types/yargs": "^17.0.17",
"@types/chai": "^4.3.11",
"@types/inflected": "^2.1.3",
"@types/lodash": "^4.14.202",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.4",
"@types/sinon": "^17.0.2",
"@types/yargs": "^17.0.32",
"benchmark": "^2.1.4",
"chai": "^4.3.7",
"chai": "^4.3.10",
"coffee-coverage": "^3.0.1",
"coffeescript": "^2.7.0",
"mocha": "^10.1.0",
"mocha": "^10.2.0",
"mongodb": "^4.3.1",
"mysql": "^2.18.1",
"mysql2": "^2.3.3",
"pg": "^8.8.0",
"pg-query-stream": "^4.2.4",
"rimraf": "^3.0.2",
"sinon": "^15.0.0",
"sqlite3": "^5.1.2",
"ts-node": "^10.9.1",
"typescript": "^4.9.3"
"mysql2": "^3.6.5",
"pg": "^8.11.3",
"pg-query-stream": "^4.5.3",
"rimraf": "^5.0.5",
"sinon": "^17.0.1",
"sqlite3": "^5.1.6",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"gitHead": "c7a2acac6a47457a8297b167b7d9770733c25490"
"gitHead": "0bf1748fc6e208bc8a364a63d0c0b63611f876f2"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc