Comparing version 0.11.2 to 0.12.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.12.0](https://github.com/waitingsong/kmore/compare/v0.11.2...v0.12.0) (2019-10-15) | ||
### Features | ||
* **kmore:** export genTbListFromType() from lib/tables.ts ([bfd8866](https://github.com/waitingsong/kmore/commit/bfd8866)) | ||
## [0.11.2](https://github.com/waitingsong/kmore/compare/v0.11.1...v0.11.2) (2019-10-14) | ||
@@ -8,0 +19,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 0.11.1 | ||
* @version 0.11.2 | ||
* @author waiting | ||
@@ -32,2 +32,19 @@ * @license MIT | ||
/** | ||
* Generate DbTables from generics type T | ||
* Loading compiled js file if prod env | ||
*/ | ||
function genTbListFromType( | ||
// options?: Partial<GenTbListFromTypeOpts>, | ||
options) { | ||
const opts = options | ||
? { ...kmoreTypes.initOptions, ...options } | ||
: { ...kmoreTypes.initOptions }; | ||
if (process.env.NODE_ENV === 'production') { | ||
opts.forceLoadTbListJs = true; | ||
} | ||
const caller = kmoreTypes.getCallerStack(opts.callerDistance); | ||
const ret = loadTbListParamFromCallerInfo(opts, caller); | ||
return ret; | ||
} | ||
function loadTbListParamFromCallerInfo(options, caller) { | ||
@@ -128,9 +145,4 @@ if (!options.forceLoadTbListJs && kmoreTypes.isTsFile(caller.path)) { | ||
Object.defineProperty(exports, 'genTbListFromType', { | ||
enumerable: true, | ||
get: function () { | ||
return kmoreTypes.genTbListFromType; | ||
} | ||
}); | ||
exports.genTbListFromType = genTbListFromType; | ||
exports.kmore = kmore; | ||
//# sourceMappingURL=index.cjs.js.map |
export * from './lib/index'; | ||
export * from './lib/model'; | ||
export { genTbListFromType } from 'kmore-types'; | ||
export { genTbListFromType } from './lib/tables'; |
export * from './lib/index'; | ||
export { genTbListFromType } from 'kmore-types'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsY0FBYyxhQUFhLENBQUE7QUFHM0IsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sYUFBYSxDQUFBIn0= | ||
// export { genTbListFromType } from 'kmore-types' | ||
export { genTbListFromType } from './lib/tables'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsY0FBYyxhQUFhLENBQUE7QUFHM0Isa0RBQWtEO0FBQ2xELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGNBQWMsQ0FBQSJ9 |
import { BuildSrcOpts } from 'kmore-types'; | ||
import { CallerInfo, DbTables, Options, TTableListModel } from './model'; | ||
/** | ||
* Generate DbTables from generics type T | ||
* Loading compiled js file if prod env | ||
*/ | ||
export declare function genTbListFromType<T extends TTableListModel>(options?: Partial<Options>): DbTables<T>; | ||
export declare function loadTbListParamFromCallerInfo<T extends TTableListModel>(options: Options, caller: CallerInfo): DbTables<T>; | ||
export declare function loadTbListFromTsTypeFile<T extends TTableListModel>(callerDistance: BuildSrcOpts['callerDistance']): DbTables<T>; | ||
export declare function loadTbListFromJsBuiltFile<T extends TTableListModel>(options: Options, caller: CallerInfo): DbTables<T>; |
import { accessSync, constants } from 'fs'; | ||
import { isTsFile, genTbListFromType, loadVarFromFile, reWriteLoadingPath, } from 'kmore-types'; | ||
import { getCallerStack, genTbListFromType as genTbListFromTypeOri, isTsFile, loadVarFromFile, reWriteLoadingPath, } from 'kmore-types'; | ||
import { initOptions } from './config'; | ||
/** | ||
* Generate DbTables from generics type T | ||
* Loading compiled js file if prod env | ||
*/ | ||
export function genTbListFromType( | ||
// options?: Partial<GenTbListFromTypeOpts>, | ||
options) { | ||
const opts = options | ||
? { ...initOptions, ...options } | ||
: { ...initOptions }; | ||
if (process.env.NODE_ENV === 'production') { | ||
opts.forceLoadTbListJs = true; | ||
} | ||
const caller = getCallerStack(opts.callerDistance); | ||
const ret = loadTbListParamFromCallerInfo(opts, caller); | ||
return ret; | ||
} | ||
export function loadTbListParamFromCallerInfo(options, caller) { | ||
@@ -12,3 +30,3 @@ if (!options.forceLoadTbListJs && isTsFile(caller.path)) { | ||
export function loadTbListFromTsTypeFile(callerDistance) { | ||
const ret = genTbListFromType({ callerDistance }); | ||
const ret = genTbListFromTypeOri({ callerDistance }); | ||
return ret; | ||
@@ -24,2 +42,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFibGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xpYi90YWJsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxTQUFTLEVBQUUsTUFBTSxJQUFJLENBQUE7QUFFMUMsT0FBTyxFQUVMLFFBQVEsRUFDUixpQkFBaUIsRUFDakIsZUFBZSxFQUNmLGtCQUFrQixHQUNuQixNQUFNLGFBQWEsQ0FBQTtBQVVwQixNQUFNLFVBQVUsNkJBQTZCLENBQzNDLE9BQWdCLEVBQ2hCLE1BQWtCO0lBR2xCLElBQUksQ0FBRSxPQUFPLENBQUMsaUJBQWlCLElBQUksUUFBUSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsRUFBRTtRQUN4RCxPQUFPLHdCQUF3QixDQUFJLE9BQU8sQ0FBQyxjQUFjLEdBQUcsQ0FBQyxDQUFDLENBQUE7S0FDL0Q7U0FDSSxFQUFFLDJCQUEyQjtRQUNoQyxPQUFPLHlCQUF5QixDQUFDLE9BQU8sRUFBRSxNQUFNLENBQUMsQ0FBQTtLQUNsRDtBQUNILENBQUM7QUFF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MsY0FBOEM7SUFHOUMsTUFBTSxHQUFHLEdBQUcsb0JBQW9CLENBQUksRUFBRSxjQUFjLEVBQUUsQ0FBQyxDQUFBO0lBQ3ZELE9BQU8sR0FBRyxDQUFBO0FBQ1osQ0FBQztBQUdELE1BQU0sVUFBVSx5QkFBeUIsQ0FDdkMsT0FBZ0IsRUFDaEIsTUFBa0I7SUFHbEIsTUFBTSxFQUFFLG9CQUFvQixFQUFFLGlDQUFpQyxFQUFFLEdBQUcsT0FBTyxDQUFBO0lBRTNFLElBQUksSUFBSSxHQUFHLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLElBQUksb0JBQW9CLEtBQUssQ0FBQTtJQUNuRSxJQUFJLEdBQUcsa0JBQWtCLENBQUMsSUFBSSxFQUFFLGlDQUFpQyxDQUFDLENBQUE7SUFFbEUsVUFBVSxDQUFDLElBQUksRUFBRSxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUE7SUFFaEMsTUFBTSxHQUFHLEdBQUcsZUFBZSxDQUFJLElBQUksRUFBRSxNQUFNLEVBQUUsT0FBTyxDQUFDLENBQUE7SUFDckQsT0FBTyxHQUFHLENBQUE7QUFDWixDQUFDIn0= |
{ | ||
"name": "kmore", | ||
"author": "waiting", | ||
"version": "0.11.2", | ||
"version": "0.12.0", | ||
"description": "A Knex little more factory of SQL query builder, with auto-generated type-safe tables accessor for Node.js", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"@waiting/shared-types": "1", | ||
"kmore-types": "^0.11.2" | ||
"kmore-types": "^0.12.0" | ||
}, | ||
@@ -92,3 +92,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "81e27579ae7741de5abcbaf1aa4621101118c38a" | ||
"gitHead": "e5ca90060deed16bb326ecd4bf0214ce97dcc816" | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
54278
339
4
+ Addedkmore-types@0.12.0(transitive)
- Removedkmore-types@0.11.2(transitive)
Updatedkmore-types@^0.12.0