@dbpath/dal
Advanced tools
Comparing version 0.2.18 to 0.2.19
@@ -8,4 +8,6 @@ import { NameAnd } from "@dbpath/utils"; | ||
} | ||
export type LimitFn = (pageNum: number, pageSize: number, s: string[]) => string[]; | ||
export declare function checkLimitOrThrow(l: LimitFn): LimitFn; | ||
export interface DalDialect { | ||
limitFn: (pageNum: number, pageSize: number, s: string[]) => string[]; | ||
limitFn: LimitFn; | ||
safeQuery: string; | ||
@@ -12,0 +14,0 @@ } |
@@ -12,3 +12,13 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useDal = void 0; | ||
exports.useDal = exports.checkLimitOrThrow = void 0; | ||
function checkLimitOrThrow(l) { | ||
return (pageNum, pageSize, s) => { | ||
if (typeof pageNum !== 'number' || pageNum < 1) | ||
throw new Error(`Invalid page number (${typeof pageNum}) ${pageNum}`); | ||
if (typeof pageSize !== 'number' || pageSize < 1) | ||
throw new Error(`Invalid page size (${typeof pageSize}) ${pageSize}`); | ||
return l(pageNum, pageSize, s); | ||
}; | ||
} | ||
exports.checkLimitOrThrow = checkLimitOrThrow; | ||
function useDal(dal, fn) { | ||
@@ -15,0 +25,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -17,2 +17,3 @@ import { Summary } from "@dbpath/config"; | ||
actualTableName(tableName: string): string; | ||
pkFor(tableName: string): string[]; | ||
} | ||
@@ -19,0 +20,0 @@ export declare const PathValidatorAlwaysOK: PathValidator; |
@@ -12,3 +12,4 @@ "use strict"; | ||
}, | ||
actualTableName: t => t | ||
actualTableName: t => t, | ||
pkFor: t => ['id'] | ||
}; | ||
@@ -108,5 +109,6 @@ function checkFullTableName(m, tableName) { | ||
useIdsOrSingleFkLinkOrError: (0, exports.useIdsOrSingleFkLinkOrError)(summary, m), | ||
actualTableName: t => fullTableName(summary, t) | ||
actualTableName: t => fullTableName(summary, t), | ||
pkFor: t => { var _a; return (_a = m.tables[t]) === null || _a === void 0 ? void 0 : _a.pk.map(c => c.name); } | ||
}; | ||
} | ||
exports.DalPathValidator = DalPathValidator; |
{ | ||
"name": "@dbpath/dal", | ||
"description": "", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"main": "dist/index", | ||
@@ -20,4 +20,4 @@ "types": "dist/index", | ||
"dependencies": { | ||
"@dbpath/config": "0.2.18", | ||
"@dbpath/fixtures": "0.2.18" | ||
"@dbpath/config": "0.2.19", | ||
"@dbpath/fixtures": "0.2.19" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
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
19890
15
365
+ Added@dbpath/config@0.2.19(transitive)
+ Added@dbpath/fixtures@0.2.19(transitive)
+ Added@dbpath/types@0.2.19(transitive)
+ Added@dbpath/utils@0.2.19(transitive)
- Removed@dbpath/config@0.2.18(transitive)
- Removed@dbpath/fixtures@0.2.18(transitive)
- Removed@dbpath/types@0.2.18(transitive)
- Removed@dbpath/utils@0.2.18(transitive)
Updated@dbpath/config@0.2.19
Updated@dbpath/fixtures@0.2.19