Comparing version 0.16.1 to 0.16.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.16.2](https://github.com/waitingsong/kmore/compare/v0.16.1...v0.16.2) (2020-04-15) | ||
**Note:** Version bump only for package kmore | ||
## [0.16.1](https://github.com/waitingsong/kmore/compare/v0.16.0...v0.16.1) (2020-04-15) | ||
@@ -8,0 +16,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 0.16.0 | ||
* @version 0.16.1 | ||
* @author waiting | ||
@@ -298,5 +298,4 @@ * @license MIT | ||
} | ||
function hasScopedColumns(tables) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
return !!(tables && tables.hasOwnProperty(kmoreTypes.DbPropKeys.scopedColumns)); | ||
function hasExtColumns(tables, key) { | ||
return !!(tables && Object.prototype.hasOwnProperty.call(tables, key)); | ||
} | ||
@@ -310,3 +309,4 @@ /** | ||
createColumnNameFn = defaultCreateScopedColumnName) { | ||
if (hasScopedColumns(kTablesBase)) { | ||
if (hasExtColumns(kTablesBase, kmoreTypes.DbPropKeys.aliasColumns) | ||
&& hasExtColumns(kTablesBase, kmoreTypes.DbPropKeys.scopedColumns)) { | ||
return kTablesBase; | ||
@@ -423,3 +423,5 @@ } | ||
if (Object.keys(kTables).length) { | ||
ktbs = hasScopedColumns(kTables) ? kTables : genKTablesFromBase(kTables); | ||
ktbs = hasExtColumns(kTables, kmoreTypes.DbPropKeys.scopedColumns) && hasExtColumns(kTables, kmoreTypes.DbPropKeys.aliasColumns) | ||
? kTables | ||
: genKTablesFromBase(kTables); | ||
} | ||
@@ -426,0 +428,0 @@ else { |
@@ -1,5 +0,5 @@ | ||
import { createNullObject, getCallerStack } from 'kmore-types'; | ||
import { createNullObject, getCallerStack, DbPropKeys } from 'kmore-types'; | ||
import { defaultPropDescriptor, initOptions } from './config'; | ||
import { loadTbListParamFromCallerInfo } from './tables'; | ||
import { bindDbh, bindTables, bindTablesCols, bindRefTables, bindTablesScopedCols, hasScopedColumns, genKTablesFromBase, bindTablesAliasCols, } from './util'; | ||
import { bindDbh, bindTables, bindTablesCols, bindRefTables, bindTablesScopedCols, hasExtColumns, genKTablesFromBase, bindTablesAliasCols, } from './util'; | ||
/** | ||
@@ -34,3 +34,5 @@ * Knex factory with type-safe tables accessor | ||
if (Object.keys(kTables).length) { | ||
ktbs = hasScopedColumns(kTables) ? kTables : genKTablesFromBase(kTables); | ||
ktbs = hasExtColumns(kTables, DbPropKeys.scopedColumns) && hasExtColumns(kTables, DbPropKeys.aliasColumns) | ||
? kTables | ||
: genKTablesFromBase(kTables); | ||
} | ||
@@ -37,0 +39,0 @@ else { |
import { KTablesBase, LoadVarFromFileOpts } from 'kmore-types'; | ||
import * as Knex from 'knex'; | ||
import { DbPropKeys } from './config'; | ||
import { DbModel, Options, TTables, KTables, CreateColumnNameFn } from './model'; | ||
@@ -10,3 +11,3 @@ export declare function bindDbh<T extends TTables>(propDescriptor: PropertyDescriptor, db: DbModel<T>, config: Knex.Config): DbModel<T>; | ||
export declare function bindRefTables<T extends TTables>(options: Options, propDescriptor: PropertyDescriptor, db: DbModel<T>): DbModel<T>; | ||
export declare function hasScopedColumns<T extends TTables>(tables: KTablesBase<T> | KTables<T>): tables is KTables<T>; | ||
export declare function hasExtColumns<T extends TTables>(tables: KTablesBase<T> | KTables<T>, key: DbPropKeys): tables is KTables<T>; | ||
/** | ||
@@ -13,0 +14,0 @@ * Generate KTables from generics type T |
@@ -91,5 +91,4 @@ import { validateParamTables, createNullObject, genVarName, loadFile, } from 'kmore-types'; | ||
} | ||
export function hasScopedColumns(tables) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
return !!(tables && tables.hasOwnProperty(DbPropKeys.scopedColumns)); | ||
export function hasExtColumns(tables, key) { | ||
return !!(tables && Object.prototype.hasOwnProperty.call(tables, key)); | ||
} | ||
@@ -103,3 +102,4 @@ /** | ||
createColumnNameFn = defaultCreateScopedColumnName) { | ||
if (hasScopedColumns(kTablesBase)) { | ||
if (hasExtColumns(kTablesBase, DbPropKeys.aliasColumns) | ||
&& hasExtColumns(kTablesBase, DbPropKeys.scopedColumns)) { | ||
return kTablesBase; | ||
@@ -106,0 +106,0 @@ } |
{ | ||
"name": "kmore", | ||
"author": "waiting", | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"description": "A Knex little more typed factory of SQL query builder powed by TypeScript, with auto-generated type-safe tables accessor for Node.js", | ||
@@ -98,3 +98,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "9589273216b7de0ff2c92940220de2622895118d" | ||
"gitHead": "4366c04512f749a1d4f0fe4c82344f08f8e16baa" | ||
} |
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
100420
1143