Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@simplysm/sd-orm-common

Package Overview
Dependencies
Maintainers
1
Versions
618
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplysm/sd-orm-common - npm Package Compare versions

Comparing version 3.5.30 to 3.5.31

9

dist-browser/Queryable.js

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

name: this._tableDef.name
}), columnDefs], records))];
}), columnDefs], records.map(function (item) {
var result = {};
for (var _i = 0, _a = Object.keys(item); _i < _a.length; _i++) {
var key = _a[_i];
result[key] = _this.db.qh.getBulkInsertQueryValue(item[key]);
}
return result;
})))];
case 1:

@@ -712,0 +719,0 @@ _d.sent();

@@ -348,2 +348,69 @@ "use strict";

};
QueryHelper.prototype.getBulkInsertQueryValue = function (value) {
if (value instanceof QueryUnit_1.QueryUnit) {
if (value.query instanceof Array) {
return this._getBulkInsertQueryValueArray(value.query);
}
else if (value.query instanceof QueryUnit_1.QueryUnit) {
return this.getBulkInsertQueryValue(value.query);
}
else if (value.query instanceof Queryable_1.Queryable) {
return this.getBulkInsertQueryValue(value.query);
}
else {
return value.query;
}
}
else if (typeof value === "string") {
return value;
}
else if (typeof value === "boolean") {
return value ? "1" : "0";
}
else if (value instanceof sd_core_common_1.DateTime) {
return value.date;
}
else if (value instanceof sd_core_common_1.DateOnly) {
return value.date;
}
else if (value instanceof sd_core_common_1.Time) {
return value.toFormatString("HH:mm:ss");
}
else if (value instanceof Buffer) {
return "0x" + value.toString("hex");
}
else if (value instanceof sd_core_common_1.Uuid) {
return value.toString();
}
else if (value instanceof Queryable_1.Queryable) {
var selectDef = value.getSelectDef();
if (selectDef.top !== 1) {
throw new Error("하나의 필드를 추출하기 위한 내부쿼리에서는 반드시 TOP 1 이 지정 되야 합니다.");
}
if (selectDef.select !== undefined || Object.keys(selectDef.select).length > 1) {
throw new Error("하나의 필드를 추출하기 위한 내부쿼리에서는 반드시 하나의 컬럼만 SELECT 되야 합니다.");
}
return selectDef;
}
else {
return value;
}
};
QueryHelper.prototype._getBulkInsertQueryValueArray = function (arr) {
var _this = this;
return arr.map(function (item) {
if (item instanceof Array) {
return _this._getBulkInsertQueryValueArray(item);
}
else if (item instanceof QueryUnit_1.QueryUnit) {
return _this.getBulkInsertQueryValue(item);
}
else if (item instanceof Queryable_1.Queryable) {
return _this.getBulkInsertQueryValue(item);
}
else {
return item;
}
});
};
QueryHelper.prototype._getQueryValueArray = function (arr) {

@@ -350,0 +417,0 @@ var _this = this;

@@ -630,3 +630,9 @@ "use strict";

name: this._tableDef.name
}), columnDefs, ...records);
}), columnDefs, ...records.map(item => {
const result = {};
for (const key of Object.keys(item)) {
result[key] = this.db.qh.getBulkInsertQueryValue(item[key]);
}
return result;
}));
}

@@ -633,0 +639,0 @@ async insertAsync(...records) {

@@ -49,2 +49,4 @@ import { ISelectQueryDef, TDbDateSeparator, TEntityValue, TEntityValueOrQueryableOrArray, TQueryBuilderValue, TQueryValue } from "./commons";

getQueryValue(value: Queryable<any, any>): ISelectQueryDef;
getBulkInsertQueryValue(value: TEntityValue<any>): any;
private _getBulkInsertQueryValueArray;
private _getQueryValueArray;

@@ -51,0 +53,0 @@ type(type: Type<TQueryValue> | TSdOrmDataType | string | undefined): string;

@@ -331,2 +331,68 @@ "use strict";

}
getBulkInsertQueryValue(value) {
if (value instanceof QueryUnit_1.QueryUnit) {
if (value.query instanceof Array) {
return this._getBulkInsertQueryValueArray(value.query);
}
else if (value.query instanceof QueryUnit_1.QueryUnit) {
return this.getBulkInsertQueryValue(value.query);
}
else if (value.query instanceof Queryable_1.Queryable) {
return this.getBulkInsertQueryValue(value.query);
}
else {
return value.query;
}
}
else if (typeof value === "string") {
return value;
}
else if (typeof value === "boolean") {
return value ? "1" : "0";
}
else if (value instanceof sd_core_common_1.DateTime) {
return value.date;
}
else if (value instanceof sd_core_common_1.DateOnly) {
return value.date;
}
else if (value instanceof sd_core_common_1.Time) {
return value.toFormatString("HH:mm:ss");
}
else if (value instanceof Buffer) {
return `0x${value.toString("hex")}`;
}
else if (value instanceof sd_core_common_1.Uuid) {
return value.toString();
}
else if (value instanceof Queryable_1.Queryable) {
const selectDef = value.getSelectDef();
if (selectDef.top !== 1) {
throw new Error("하나의 필드를 추출하기 위한 내부쿼리에서는 반드시 TOP 1 이 지정 되야 합니다.");
}
if (selectDef.select !== undefined || Object.keys(selectDef.select).length > 1) {
throw new Error("하나의 필드를 추출하기 위한 내부쿼리에서는 반드시 하나의 컬럼만 SELECT 되야 합니다.");
}
return selectDef;
}
else {
return value;
}
}
_getBulkInsertQueryValueArray(arr) {
return arr.map(item => {
if (item instanceof Array) {
return this._getBulkInsertQueryValueArray(item);
}
else if (item instanceof QueryUnit_1.QueryUnit) {
return this.getBulkInsertQueryValue(item);
}
else if (item instanceof Queryable_1.Queryable) {
return this.getBulkInsertQueryValue(item);
}
else {
return item;
}
});
}
_getQueryValueArray(arr) {

@@ -333,0 +399,0 @@ return arr.map(item => {

4

package.json
{
"name": "@simplysm/sd-orm-common",
"version": "3.5.30",
"version": "3.5.31",
"description": "심플리즘 패키지 - ORM 모듈 (browser/node)",

@@ -13,4 +13,4 @@ "author": "김석래",

"dependencies": {
"@simplysm/sd-core-common": "3.5.30"
"@simplysm/sd-core-common": "3.5.31"
}
}

@@ -856,2 +856,3 @@ import { DbContext } from "./DbContext";

await this.db.bulkInsertAsync(this.db.qb.getTableName({

@@ -861,3 +862,9 @@ database: this._tableDef.database ?? this.db.schema.database,

name: this._tableDef.name
}), columnDefs, ...records);
}), columnDefs, ...records.map(item => {
const result = {};
for (const key of Object.keys(item)) {
result[key] = this.db.qh.getBulkInsertQueryValue(item[key]);
}
return result;
}));
}

@@ -864,0 +871,0 @@

@@ -62,3 +62,3 @@ import {

}
public isNull<T extends TQueryValue>(source: TEntityValue<T>): TQueryBuilderValue[] {

@@ -416,2 +416,72 @@ return [this.getQueryValue(source), " IS ", "NULL"];

public getBulkInsertQueryValue(value: TEntityValue<any>): any {
if (value instanceof QueryUnit) {
if (value.query instanceof Array) {
return this._getBulkInsertQueryValueArray(value.query);
}
else if (value.query instanceof QueryUnit) {
return this.getBulkInsertQueryValue(value.query);
}
else if (value.query instanceof Queryable) {
return this.getBulkInsertQueryValue(value.query);
}
else {
return value.query;
}
}
else if (typeof value === "string") {
return value;
}
else if (typeof value === "boolean") {
return value ? "1" : "0";
}
else if (value instanceof DateTime) {
return value.date;
}
else if (value instanceof DateOnly) {
return value.date;
}
else if (value instanceof Time) {
return value.toFormatString("HH:mm:ss");
}
else if (value instanceof Buffer) {
return `0x${value.toString("hex")}`;
}
else if (value instanceof Uuid) {
return value.toString();
}
else if (value instanceof Queryable) {
const selectDef = value.getSelectDef();
if (selectDef.top !== 1) {
throw new Error("하나의 필드를 추출하기 위한 내부쿼리에서는 반드시 TOP 1 이 지정 되야 합니다.");
}
if (selectDef.select !== undefined || Object.keys(selectDef.select).length > 1) {
throw new Error("하나의 필드를 추출하기 위한 내부쿼리에서는 반드시 하나의 컬럼만 SELECT 되야 합니다.");
}
return selectDef;
}
else {
return value;
}
}
private _getBulkInsertQueryValueArray(arr: any[]): TEntityValueOrQueryableOrArray<any, any> {
return arr.map(item => {
if (item instanceof Array) {
return this._getBulkInsertQueryValueArray(item);
}
else if (item instanceof QueryUnit) {
return this.getBulkInsertQueryValue(item);
}
else if (item instanceof Queryable) {
return this.getBulkInsertQueryValue(item);
}
else {
return item;
}
});
}
private _getQueryValueArray(arr: any[]): TEntityValueOrQueryableOrArray<any, any> {

@@ -418,0 +488,0 @@ return arr.map(item => {

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