better-sqlite3-schema
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -261,9 +261,12 @@ "use strict"; | ||
]; | ||
const hasCache = schemas.some(schema => { var _a; return (_a = schema.refFields) === null || _a === void 0 ? void 0 : _a.some(refField => { | ||
const hasCache = schemas.some(schema => { | ||
var _a; | ||
if (typeof refField === 'string') { | ||
return (_a = schema.cacheFields) === null || _a === void 0 ? void 0 : _a.includes(refField); | ||
} | ||
return refField.cacheSize; | ||
}); }); | ||
return (_a = schema.refFields) === null || _a === void 0 ? void 0 : _a.some(refField => { | ||
var _a; | ||
if (typeof refField === 'string') { | ||
return (_a = schema.cacheFields) === null || _a === void 0 ? void 0 : _a.includes(refField); | ||
} | ||
return refField.cacheSize; | ||
}); | ||
}); | ||
if (hasCache) { | ||
@@ -270,0 +273,0 @@ imports.push(`import { newCache } from 'better-sqlite3-schema'`); |
@@ -5,2 +5,3 @@ import { Statement } from 'better-sqlite3'; | ||
import { Cache } from './utils/cache'; | ||
import { Int } from './types'; | ||
export declare type DB = BetterSqlite3Helper.DBInstance; | ||
@@ -102,3 +103,3 @@ export declare type DBInstance = DB; | ||
export declare function makeSchemaScanner(): { | ||
fields: Record<string, string>; | ||
fields: TableFields; | ||
addRowFn: (row: any) => void; | ||
@@ -159,6 +160,6 @@ }; | ||
* */ | ||
export declare function makeCachedPreparedGetRefIdFn(db: DB, field: string, idFields?: string): (value: string) => IntLike; | ||
export declare function makeCachedPreparedGetRefIdFn(db: DB, field: string, idFields?: string): (value: string) => Int; | ||
export declare function makeCachedPreparedRefFns(db: DB, field: string, idFields?: string): { | ||
getRefValue: (id: IntLike) => any; | ||
getRefId: (value: string) => IntLike; | ||
getRefId: (value: string) => Int; | ||
populateCache: () => void; | ||
@@ -170,4 +171,4 @@ val_cache: any; | ||
getRefValue: (id: IntLike) => any; | ||
getRefId: (value: string) => IntLike; | ||
getRefId: (value: string) => Int; | ||
}; | ||
export {}; |
@@ -248,3 +248,3 @@ "use strict"; | ||
} | ||
return +refSqls.insert.run(fieldData).lastInsertRowid; | ||
return refSqls.insert.run(fieldData).lastInsertRowid; | ||
} | ||
@@ -251,0 +251,0 @@ function makeCachedGetRefIdFn(cache) { |
export * from './types'; | ||
export * from './helpers'; | ||
export * from './db'; | ||
export { chain } from './utils/function'; | ||
@@ -4,0 +5,0 @@ export { newCache, Cache } from './utils/cache'; |
@@ -7,2 +7,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./helpers"), exports); | ||
tslib_1.__exportStar(require("./db"), exports); | ||
var function_1 = require("./utils/function"); | ||
@@ -9,0 +10,0 @@ Object.defineProperty(exports, "chain", { enumerable: true, get: function () { return function_1.chain; } }); |
{ | ||
"name": "better-sqlite3-schema", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Migrate (nested and multi-dimensional) json data to/from sqlite database with better-sqlite3-helper", | ||
@@ -20,10 +20,10 @@ "keywords": [ | ||
"scripts": { | ||
"test": "npm run rawtest", | ||
"test": "run-s format build mocha", | ||
"clean": "rimraf dist", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"prebuild": "npm run clean", | ||
"build": "tsc -p tsconfig.build.json", | ||
"postbuild": "mk-package", | ||
"pretest": "npm run format && npm run build", | ||
"rawtest": "ts-node test/index.ts && jest" | ||
"build": "run-s clean tsc mk-package", | ||
"tsc": "tsc -p tsconfig.build.json", | ||
"tsc:watch": "tsc --noEmit --watch", | ||
"mk-package": "mk-package", | ||
"mocha": "ts-mocha test/*.spec.ts" | ||
}, | ||
@@ -34,5 +34,5 @@ "directories": { | ||
"dependencies": { | ||
"better-sqlite3": "^7.1.0", | ||
"better-sqlite3-helper": "^3.1.0", | ||
"tslib": "^2.0.1" | ||
"better-sqlite3": "^7.4.3", | ||
"better-sqlite3-helper": "^3.1.4", | ||
"tslib": "^2.3.1" | ||
}, | ||
@@ -39,0 +39,0 @@ "repository": { |
import Integer from 'integer'; | ||
export declare type SqliteDataType = number | string | null | undefined | Date | Integer.IntLike; | ||
export declare type Int = Integer.IntLike | bigint; | ||
export declare type SqliteDataType = number | string | null | undefined | Date | Int; |
55701
25
1292
Updatedbetter-sqlite3@^7.4.3
Updatedbetter-sqlite3-helper@^3.1.4
Updatedtslib@^2.3.1