@simplysm/sd-orm-common
Advanced tools
Comparing version 3.4.65 to 3.4.66
@@ -105,3 +105,3 @@ "use strict"; | ||
} | ||
else { | ||
else if (typeof arg1 === "string") { | ||
var chain = arg1.split(".").slice(0, -1); | ||
@@ -117,2 +117,9 @@ var asChainArr = []; | ||
} | ||
else { | ||
for (var _b = 0, arg1_1 = arg1; _b < arg1_1.length; _b++) { | ||
var orderingItem = arg1_1[_b]; | ||
result = result.orderBy(orderingItem.key, orderingItem.desc); | ||
} | ||
return result; | ||
} | ||
result._def.orderBy = (_a = result._def.orderBy) !== null && _a !== void 0 ? _a : []; | ||
@@ -119,0 +126,0 @@ var queryValue = QueryUtils_1.QueryUtils.getQueryValue(selectedColumn); |
@@ -139,4 +139,25 @@ "use strict"; | ||
}; | ||
QueryUtils.getValueFields = function (entity) { | ||
return Object.values(entity).filter(function (item) { return QueryUtils.canGetQueryValue(item); }); | ||
QueryUtils.getValueFields = function (entity, excludes) { | ||
var result = []; | ||
for (var _i = 0, _a = Object.keys(entity); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
if (excludes === null || excludes === void 0 ? void 0 : excludes.includes(key)) | ||
continue; | ||
if (QueryUtils.canGetQueryValue(entity[key])) { | ||
result.push(entity[key]); | ||
} | ||
else if (entity[key] instanceof Array) { | ||
for (var _b = 0, _c = entity[key]; _b < _c.length; _b++) { | ||
var itemItem = _c[_b]; | ||
result.push.apply(result, QueryUtils.getValueFields(itemItem)); | ||
} | ||
} | ||
else if (entity[key] != null && typeof entity[key] === "object") { | ||
for (var _d = 0, _e = Object.values(entity[key]); _d < _e.length; _d++) { | ||
var itemItem = _e[_d]; | ||
result.push.apply(result, QueryUtils.getValueFields(itemItem)); | ||
} | ||
} | ||
} | ||
return result; | ||
}; | ||
@@ -143,0 +164,0 @@ QueryUtils.parseQueryResult = function (orgResults, option) { |
@@ -25,2 +25,6 @@ import { IDeleteQueryDef, IInsertQueryDef, IJoinQueryDef, ISelectQueryDef, IUpdateQueryDef, IUpsertQueryDef } from "../query-definition"; | ||
orderBy(chain: string, desc?: boolean): Queryable<D, T>; | ||
orderBy(defs: { | ||
key: string; | ||
desc: boolean; | ||
}[]): Queryable<D, T>; | ||
limit(skip: number, take: number): Queryable<D, T>; | ||
@@ -27,0 +31,0 @@ groupBy(fwd: (entity: TEntity<T>) => TEntityValue<TQueryValue>[]): Queryable<D, T>; |
@@ -102,3 +102,3 @@ "use strict"; | ||
} | ||
else { | ||
else if (typeof arg1 === "string") { | ||
const chain = arg1.split(".").slice(0, -1); | ||
@@ -113,2 +113,8 @@ const asChainArr = []; | ||
} | ||
else { | ||
for (const orderingItem of arg1) { | ||
result = result.orderBy(orderingItem.key, orderingItem.desc); | ||
} | ||
return result; | ||
} | ||
result._def.orderBy = (_a = result._def.orderBy) !== null && _a !== void 0 ? _a : []; | ||
@@ -115,0 +121,0 @@ const queryValue = QueryUtils_1.QueryUtils.getQueryValue(selectedColumn); |
@@ -14,4 +14,4 @@ import { ITableNameDef } from "../definition"; | ||
static getDataType(type: Type<TQueryValue>): string; | ||
static getValueFields<T>(entity: TEntity<T>): TEntityValue<any>[]; | ||
static getValueFields<T>(entity: TEntity<T>, excludes?: string[]): TEntityValue<any>[]; | ||
static parseQueryResult<T>(orgResults: any[], option?: IQueryResultParseOption): T[]; | ||
} |
@@ -136,4 +136,22 @@ "use strict"; | ||
} | ||
static getValueFields(entity) { | ||
return Object.values(entity).filter(item => QueryUtils.canGetQueryValue(item)); | ||
static getValueFields(entity, excludes) { | ||
const result = []; | ||
for (const key of Object.keys(entity)) { | ||
if (excludes === null || excludes === void 0 ? void 0 : excludes.includes(key)) | ||
continue; | ||
if (QueryUtils.canGetQueryValue(entity[key])) { | ||
result.push(entity[key]); | ||
} | ||
else if (entity[key] instanceof Array) { | ||
for (const itemItem of entity[key]) { | ||
result.push(...QueryUtils.getValueFields(itemItem)); | ||
} | ||
} | ||
else if (entity[key] != null && typeof entity[key] === "object") { | ||
for (const itemItem of Object.values(entity[key])) { | ||
result.push(...QueryUtils.getValueFields(itemItem)); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
@@ -140,0 +158,0 @@ static parseQueryResult(orgResults, option) { |
{ | ||
"name": "@simplysm/sd-orm-common", | ||
"version": "3.4.65", | ||
"version": "3.4.66", | ||
"description": "심플리즘 패키지 - ORM 모듈 (browser/node)", | ||
@@ -13,4 +13,4 @@ "author": "김석래", | ||
"dependencies": { | ||
"@simplysm/sd-core-common": "3.4.65" | ||
"@simplysm/sd-core-common": "3.4.66" | ||
} | ||
} |
@@ -153,3 +153,4 @@ import { | ||
public orderBy(chain: string, desc?: boolean): Queryable<D, T>; | ||
public orderBy(arg1: ((entity: TEntity<T>) => TEntityValue<TQueryValue>) | string, desc?: boolean): Queryable<D, T> { | ||
public orderBy(defs: { key: string; desc: boolean }[]): Queryable<D, T>; | ||
public orderBy(arg1: ((entity: TEntity<T>) => TEntityValue<TQueryValue>) | string | { key: string; desc: boolean }[], desc?: boolean): Queryable<D, T> { | ||
let result = new Queryable(this._db, this); | ||
@@ -161,3 +162,3 @@ | ||
} | ||
else { | ||
else if (typeof arg1 === "string") { | ||
const chain = arg1.split(".").slice(0, -1); | ||
@@ -174,2 +175,8 @@ const asChainArr: string[] = []; | ||
} | ||
else { | ||
for (const orderingItem of arg1) { | ||
result = result.orderBy(orderingItem.key, orderingItem.desc); | ||
} | ||
return result; | ||
} | ||
@@ -176,0 +183,0 @@ result._def.orderBy = result._def.orderBy ?? []; |
@@ -153,4 +153,23 @@ import {ITableNameDef} from "../definition"; | ||
public static getValueFields<T>(entity: TEntity<T>): TEntityValue<any>[] { | ||
return Object.values(entity).filter(item => QueryUtils.canGetQueryValue(item)); | ||
public static getValueFields<T>(entity: TEntity<T>, excludes?: string[]): TEntityValue<any>[] { | ||
const result: TEntityValue<any>[] = []; | ||
for (const key of Object.keys(entity)) { | ||
if (excludes?.includes(key)) continue; | ||
if (QueryUtils.canGetQueryValue(entity[key])) { | ||
result.push(entity[key]); | ||
} | ||
else if (entity[key] instanceof Array) { | ||
for (const itemItem of entity[key]) { | ||
result.push(...QueryUtils.getValueFields(itemItem)); | ||
} | ||
} | ||
else if (entity[key] != null && typeof entity[key] === "object") { | ||
for (const itemItem of Object.values(entity[key] as object)) { | ||
result.push(...QueryUtils.getValueFields(itemItem)); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
@@ -157,0 +176,0 @@ |
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
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
7915
524926
95
+ Added@simplysm/sd-core-common@3.4.66(transitive)
- Removed@simplysm/sd-core-common@3.4.65(transitive)