Comparing version 0.0.17 to 0.0.18
@@ -34,2 +34,3 @@ "use strict"; | ||
.option('-s, --sql', "show the sql instead of executing", false) | ||
.option('-t, --trace', "trace the results", false) | ||
.option('-w, --where [where...]', "a where clause added to the query. There is no syntax checking", []) | ||
@@ -40,3 +41,8 @@ // .allowUnknownOption ( true ) | ||
const where = options.where ? options.where : []; | ||
const errorsOrresult = (0, path_1.processPathString)(config.tables, (0, tables_1.makePathSpec)(path, id, options, where), options); | ||
let pathSpec = (0, tables_1.makePathSpec)(path, id, options, where); | ||
if (options.trace) { | ||
(0, path_1.tracePlan)(config.tables, pathSpec, options).forEach(line => console.log(line)); | ||
return; | ||
} | ||
const errorsOrresult = (0, path_1.processPathString)(config.tables, pathSpec, options); | ||
if ((0, utils_1.hasErrors)(errorsOrresult)) { | ||
@@ -43,0 +49,0 @@ (0, utils_1.reportErrors)(errorsOrresult); |
@@ -22,2 +22,4 @@ import { ErrorsAnd, NameAnd } from "@db-auto/utils"; | ||
export declare function prettyPrintPP(pp: PP): string[]; | ||
export declare function makeTracePlanSpecs(pathSpec: PathSpec): PathSpec[]; | ||
export declare function tracePlan(tables: NameAnd<CleanTable>, pathSpec: PathSpec, options: ProcessPathOptions): string[]; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.prettyPrintPP = exports.processPathString = void 0; | ||
exports.tracePlan = exports.makeTracePlanSpecs = exports.prettyPrintPP = exports.processPathString = void 0; | ||
const utils_1 = require("@db-auto/utils"); | ||
@@ -48,1 +48,22 @@ const tables_1 = require("@db-auto/tables"); | ||
exports.prettyPrintPP = prettyPrintPP; | ||
function makeTracePlanSpecs(pathSpec) { | ||
const path = pathSpec.path; | ||
const result = []; | ||
for (let i = 0; i < path.length; i++) { | ||
result.push(Object.assign(Object.assign({}, pathSpec), { path: path.slice(0, i + 1) })); | ||
} | ||
return result; | ||
} | ||
exports.makeTracePlanSpecs = makeTracePlanSpecs; | ||
function tracePlan(tables, pathSpec, options) { | ||
const result = []; | ||
const specs = makeTracePlanSpecs(pathSpec); | ||
for (let i = 0; i < specs.length; i++) { | ||
const pp = processPathString(tables, specs[i], options); | ||
if ((0, utils_1.hasErrors)(pp)) | ||
return pp; | ||
result.push(pp); | ||
} | ||
return (0, utils_1.flatMap)(result, (pp, i) => [`${specs[i].path}`, ...prettyPrintPP(pp), '']); | ||
} | ||
exports.tracePlan = tracePlan; |
{ | ||
"name": "db-auto", | ||
"description": "", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"main": "dist/index", | ||
@@ -24,10 +24,10 @@ "types": "dist/index", | ||
"commander": "^10.0.0", | ||
"@db-auto/oracle": "0.0.17", | ||
"@db-auto/mysql": "0.0.17", | ||
"@db-auto/postgres": "0.0.17", | ||
"@db-auto/tables": "0.0.17", | ||
"@db-auto/utils": "0.0.17", | ||
"@db-auto/files": "0.0.17", | ||
"@db-auto/mocks": "0.0.17", | ||
"@db-auto/environments": "0.0.17" | ||
"@db-auto/oracle": "0.0.18", | ||
"@db-auto/mysql": "0.0.18", | ||
"@db-auto/postgres": "0.0.18", | ||
"@db-auto/tables": "0.0.18", | ||
"@db-auto/utils": "0.0.18", | ||
"@db-auto/files": "0.0.18", | ||
"@db-auto/mocks": "0.0.18", | ||
"@db-auto/environments": "0.0.18" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
29868
542
+ Added@db-auto/dal@0.0.18(transitive)
+ Added@db-auto/environments@0.0.18(transitive)
+ Added@db-auto/files@0.0.18(transitive)
+ Added@db-auto/mocks@0.0.18(transitive)
+ Added@db-auto/mysql@0.0.18(transitive)
+ Added@db-auto/oracle@0.0.18(transitive)
+ Added@db-auto/postgres@0.0.18(transitive)
+ Added@db-auto/tables@0.0.18(transitive)
+ Added@db-auto/utils@0.0.18(transitive)
- Removed@db-auto/dal@0.0.17(transitive)
- Removed@db-auto/environments@0.0.17(transitive)
- Removed@db-auto/files@0.0.17(transitive)
- Removed@db-auto/mocks@0.0.17(transitive)
- Removed@db-auto/mysql@0.0.17(transitive)
- Removed@db-auto/oracle@0.0.17(transitive)
- Removed@db-auto/postgres@0.0.17(transitive)
- Removed@db-auto/tables@0.0.17(transitive)
- Removed@db-auto/utils@0.0.17(transitive)
Updated@db-auto/environments@0.0.18
Updated@db-auto/files@0.0.18
Updated@db-auto/mocks@0.0.18
Updated@db-auto/mysql@0.0.18
Updated@db-auto/oracle@0.0.18
Updated@db-auto/postgres@0.0.18
Updated@db-auto/tables@0.0.18
Updated@db-auto/utils@0.0.18