Comparing version 0.0.11 to 0.0.12
@@ -22,5 +22,7 @@ "use strict"; | ||
.argument('[id]', "the id of the primary key in the first table in the path") | ||
.option('-p, --plan', "show the plan", false) | ||
// .allowUnknownOption ( true ) | ||
.version(version) | ||
.action((path, id, options) => { | ||
const errorsOrresult = (0, path_1.processPathString)(config.tables, path, id); | ||
const errorsOrresult = (0, path_1.processPathString)(config.tables, path, id, options, options.plan); | ||
if ((0, utils_1.hasErrors)(errorsOrresult)) { | ||
@@ -32,2 +34,3 @@ (0, utils_1.reportErrors)(errorsOrresult); | ||
}); | ||
(0, tables_1.findQueryParams)(config.tables).forEach(param => program.option('--' + param.name + " <" + param.name + ">", param.description)); | ||
const mock = program | ||
@@ -34,0 +37,0 @@ .command('mocks') |
@@ -61,1 +61,13 @@ "use strict"; | ||
}); | ||
describe('db-auto path --help', () => { | ||
it("should include the queries as options", () => __awaiter(void 0, void 0, void 0, function* () { | ||
const expected = (0, files_1.readTestFile)(mockTestDir, 'help.expected.txt'); | ||
expect(yield (0, integration_fixture_1.executeDbAuto)(mockTestDir, `--help`)).toEqual(expected); | ||
})); | ||
}); | ||
describe('db-auto path --options that are query params', () => { | ||
it("should db-auto driver --name fred", () => __awaiter(void 0, void 0, void 0, function* () { | ||
const expected = (0, files_1.readTestFile)(mockTestDir, 'pathWithQueryParams.driver.name.fred.expected.txt'); | ||
expect(yield (0, integration_fixture_1.executeDbAuto)(mockTestDir, `driver --name fred`)).toEqual(expected); | ||
})); | ||
}); |
@@ -16,4 +16,4 @@ import { ErrorsAnd, NameAnd } from "@db-auto/utils"; | ||
type PP = SelectDataPP | LinksPP | SqlPP; | ||
export declare function processPathString(tables: NameAnd<CleanTable>, path: string, id: string | undefined, showPlan?: boolean): ErrorsAnd<PP>; | ||
export declare function processPathString(tables: NameAnd<CleanTable>, path: string, id: string | undefined, queryParams: NameAnd<string>, showPlan?: boolean): ErrorsAnd<PP>; | ||
export declare function prettyPrintPP(pp: PP): string[]; | ||
export {}; |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
function processPathString(tables, path, id, showPlan) { | ||
function processPathString(tables, path, id, queryParams, showPlan) { | ||
const parts = path.split('.'); | ||
@@ -24,3 +24,3 @@ if (parts.length === 0) | ||
return processQueryPP(tables, parts); | ||
let plan = (0, tables_1.buildPlan)(tables_1.clean, parts, id); | ||
let plan = (0, tables_1.buildPlan)(tables_1.clean, parts, id, queryParams); | ||
if ((0, utils_1.hasErrors)(plan)) | ||
@@ -27,0 +27,0 @@ return plan; |
{ | ||
"name": "db-auto", | ||
"description": "", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "dist/index", | ||
@@ -24,9 +24,9 @@ "types": "dist/index", | ||
"commander": "^10.0.0", | ||
"@db-auto/oracle": "0.0.11", | ||
"@db-auto/mysql": "0.0.11", | ||
"@db-auto/tables": "0.0.11", | ||
"@db-auto/utils": "0.0.11", | ||
"@db-auto/files": "0.0.11", | ||
"@db-auto/mocks": "0.0.11", | ||
"@db-auto/environments": "0.0.11" | ||
"@db-auto/oracle": "0.0.12", | ||
"@db-auto/mysql": "0.0.12", | ||
"@db-auto/tables": "0.0.12", | ||
"@db-auto/utils": "0.0.12", | ||
"@db-auto/files": "0.0.12", | ||
"@db-auto/mocks": "0.0.12", | ||
"@db-auto/environments": "0.0.12" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
20071
347
+ Added@db-auto/environments@0.0.12(transitive)
+ Added@db-auto/files@0.0.12(transitive)
+ Added@db-auto/mocks@0.0.12(transitive)
+ Added@db-auto/mysql@0.0.12(transitive)
+ Added@db-auto/oracle@0.0.12(transitive)
+ Added@db-auto/tables@0.0.12(transitive)
+ Added@db-auto/utils@0.0.12(transitive)
- Removed@db-auto/environments@0.0.11(transitive)
- Removed@db-auto/files@0.0.11(transitive)
- Removed@db-auto/mocks@0.0.11(transitive)
- Removed@db-auto/mysql@0.0.11(transitive)
- Removed@db-auto/oracle@0.0.11(transitive)
- Removed@db-auto/tables@0.0.11(transitive)
- Removed@db-auto/utils@0.0.11(transitive)
Updated@db-auto/environments@0.0.12
Updated@db-auto/files@0.0.12
Updated@db-auto/mocks@0.0.12
Updated@db-auto/mysql@0.0.12
Updated@db-auto/oracle@0.0.12
Updated@db-auto/tables@0.0.12
Updated@db-auto/utils@0.0.12