Socket
Socket
Sign inDemoInstall

sequelize

Package Overview
Dependencies
20
Maintainers
8
Versions
622
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.26.0 to 6.27.0

2

lib/data-types.js

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

_stringify(number) {
if (typeof number === "number" || typeof number === "boolean" || number === null || number === void 0) {
if (typeof number === "number" || typeof number === "bigint" || typeof number === "boolean" || number === null || number === void 0) {
return number;

@@ -170,0 +170,0 @@ }

"use strict";
const util = require("node:util");
const AbstractQuery = require("../abstract/query");

@@ -14,7 +15,8 @@ const sequelizeErrors = require("../../errors");

getSQLTypeFromJsType(value) {
const param = { ParamType: "INPUT", Data: value };
if (Buffer.isBuffer(value)) {
param.DataType = "BLOB";
return param;
return { ParamType: "INPUT", DataType: "BLOB", Data: value };
}
if (typeof value === "bigint") {
return value.toString();
}
return value;

@@ -92,5 +94,5 @@ }

stmt.execute(params, (err2, result, outparams) => {
debug(`executed(${this.connection.uuid || "default"}):${newSql} ${parameters ? JSON.stringify(parameters) : ""}`);
debug(`executed(${this.connection.uuid || "default"}):${newSql} ${parameters ? util.inspect(parameters, { compact: true, breakLength: Infinity }) : ""}`);
if (benchmark) {
this.sequelize.log(`Executed (${this.connection.uuid || "default"}): ${newSql} ${parameters ? JSON.stringify(parameters) : ""}`, Date.now() - queryBegin, this.options);
this.sequelize.log(`Executed (${this.connection.uuid || "default"}): ${newSql} ${parameters ? util.inspect(parameters, { compact: true, breakLength: Infinity }) : ""}`, Date.now() - queryBegin, this.options);
}

@@ -97,0 +99,0 @@ if (err2 && err2.message) {

@@ -103,2 +103,5 @@ "use strict";

}
if (error.message.includes("connect EAFNOSUPPORT")) {
throw new sequelizeErrors.HostNotReachableError(error);
}
if (error.message.includes("getaddrinfo ENOTFOUND")) {

@@ -105,0 +108,0 @@ throw new sequelizeErrors.HostNotFoundError(error);

@@ -8,2 +8,4 @@ "use strict";

const debug = logger.debugContext("sql:mssql");
const minSafeIntegerAsBigInt = BigInt(Number.MIN_SAFE_INTEGER);
const maxSafeIntegerAsBigInt = BigInt(Number.MAX_SAFE_INTEGER);
function getScale(aNum) {

@@ -22,4 +24,3 @@ if (!Number.isFinite(aNum))

getSQLTypeFromJsType(value, TYPES) {
const paramType = { type: TYPES.VarChar, typeOptions: {} };
paramType.type = TYPES.NVarChar;
const paramType = { type: TYPES.NVarChar, typeOptions: {}, value };
if (typeof value === "number") {

@@ -36,2 +37,9 @@ if (Number.isInteger(value)) {

}
} else if (typeof value === "bigint") {
if (value < minSafeIntegerAsBigInt || value > maxSafeIntegerAsBigInt) {
paramType.type = TYPES.VarChar;
paramType.value = value.toString();
} else {
return this.getSQLTypeFromJsType(Number(value), TYPES);
}
} else if (typeof value === "boolean") {

@@ -38,0 +46,0 @@ paramType.type = TYPES.Bit;

@@ -230,2 +230,8 @@ "use strict";

}
_sanitize(value) {
if (typeof value === "bigint" || typeof value === "number") {
return value.toString();
}
return value;
}
}

@@ -232,0 +238,0 @@ class NUMBER extends BaseTypes.NUMBER {

"use strict";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });

@@ -36,3 +54,3 @@ var __export = (target, all) => {

const oracledb = this.sequelize.connectionManager.lib;
if (this.isSelectQuery() && this.model) {
if (this.model && this.isSelectQuery()) {
const fInfo = {};

@@ -55,2 +73,19 @@ const keys = Object.keys(this.model.tableAttributes);

}
_convertBindAttributes(bindingDictionary, oracledb) {
if (this.model && this.options[bindingDictionary]) {
const keys = Object.keys(this.model.tableAttributes);
for (const key of keys) {
const keyValue = this.model.tableAttributes[key];
if (keyValue.type.key === "BIGINT") {
const oldBinding = this.options[bindingDictionary][key];
if (oldBinding) {
this.options[bindingDictionary][key] = __spreadProps(__spreadValues({}, oldBinding), {
type: oracledb.STRING,
maxSize: 1e7
});
}
}
}
}
}
async run(sql, parameters) {

@@ -68,2 +103,3 @@ const oracledb = this.sequelize.connectionManager.lib;

if (this.options.outBindAttributes && (Array.isArray(parameters) || _.isPlainObject(parameters))) {
this._convertBindAttributes("outBindAttributes", oracledb);
outParameters.push(...Object.values(this.options.outBindAttributes));

@@ -77,2 +113,3 @@ if (this.isUpsertQuery()) {

if (this.options.executeMany) {
this._convertBindAttributes("inbindAttributes", oracledb);
bindDef.push(...Object.values(this.options.inbindAttributes));

@@ -79,0 +116,0 @@ bindDef.push(...outParameters);

@@ -10,2 +10,8 @@ "use strict";

const debug = logger.debugContext("sql:sqlite");
function stringifyIfBigint(value) {
if (typeof value === "bigint") {
return value.toString();
}
return value;
}
class Query extends AbstractQuery {

@@ -197,2 +203,11 @@ getInsertIdField() {

parameters = [];
if (_.isPlainObject(parameters)) {
const newParameters = Object.create(null);
for (const key of Object.keys(parameters)) {
newParameters[`${key}`] = stringifyIfBigint(parameters[key]);
}
parameters = newParameters;
} else {
parameters = parameters.map(stringifyIfBigint);
}
conn[method](sql, parameters, afterExecute);

@@ -199,0 +214,0 @@ return null;

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

case "number":
case "bigint":
return val.toString();

@@ -32,0 +33,0 @@ case "string":

{
"name": "sequelize",
"description": "Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.",
"version": "6.26.0",
"version": "6.27.0",
"funding": [

@@ -6,0 +6,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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 too big to display

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 too big to display

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