sqljson-query
Advanced tools
Comparing version 1.7.20 to 1.7.21
@@ -424,3 +424,3 @@ import { z } from 'zod'; | ||
export declare function makeRelId(tableMaybeQualified: string, defaultSchema: Nullable<string>, caseSensitivity: CaseSensitivity): RelId; | ||
export declare function readDatabaseMetadata(dbmdFile: string): Promise<DatabaseMetadata>; | ||
export declare function parseStoredDatabaseMetadata(s: string): StoredDatabaseMetadata; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readDatabaseMetadata = exports.makeRelId = exports.relIdsEqual = exports.relIdKey = exports.foreignKeyFieldNames = exports.getPrimaryKeyFields = exports.DatabaseMetadata = void 0; | ||
exports.parseStoredDatabaseMetadata = exports.makeRelId = exports.relIdsEqual = exports.relIdKey = exports.foreignKeyFieldNames = exports.getPrimaryKeyFields = exports.DatabaseMetadata = void 0; | ||
const zod_1 = require("zod"); | ||
@@ -183,8 +183,7 @@ const mod_1 = require("../util/mod"); | ||
exports.makeRelId = makeRelId; | ||
async function readDatabaseMetadata(dbmdFile) { | ||
const obj = JSON.parse(await (0, mod_1.readTextFile)(dbmdFile)); | ||
const dbmdStoredProps = StoredDatabaseMetadataDef.parse(obj); | ||
return new DatabaseMetadata(dbmdStoredProps); | ||
function parseStoredDatabaseMetadata(s) { | ||
const obj = JSON.parse(s); | ||
return StoredDatabaseMetadataDef.parse(obj); | ||
} | ||
exports.readDatabaseMetadata = readDatabaseMetadata; | ||
exports.parseStoredDatabaseMetadata = parseStoredDatabaseMetadata; | ||
//# sourceMappingURL=database-metadata.js.map |
@@ -33,3 +33,3 @@ "use strict"; | ||
const mod_1 = require("./util/mod"); | ||
const dbmd_1 = require("./dbmd"); | ||
// import { readDatabaseMetadata } from './dbmd'; TODO | ||
const query_specs_1 = require("./query-specs"); | ||
@@ -90,3 +90,3 @@ const lib_1 = require("./lib"); | ||
// Generate SQL source files if specified. | ||
const dbmd = await (0, dbmd_1.readDatabaseMetadata)(opts.dbmdFile); | ||
const dbmd = await readDatabaseMetadata(opts.dbmdFile); | ||
const srcGenOpts = { | ||
@@ -156,2 +156,7 @@ resultTypeLanguages: resultTypeLanguages(opts), | ||
} | ||
async function readDatabaseMetadata(dbmdFile) { | ||
const jsonText = await (0, mod_1.readTextFile)(dbmdFile); | ||
const dbmdStoredProps = (0, lib_1.parseStoredDatabaseMetadata)(jsonText); | ||
return new lib_1.DatabaseMetadata(dbmdStoredProps); | ||
} | ||
async function createOutputDirs(opts) { | ||
@@ -158,0 +163,0 @@ await fs_1.promises.mkdir(opts.sqlOutputDir, { recursive: true }); |
@@ -6,2 +6,3 @@ import { Nullable } from './util/mod'; | ||
defaultSchema?: Nullable<string>; | ||
description?: Nullable<string>; | ||
propertyNameDefault?: Nullable<PropertyNameDefault>; | ||
@@ -13,2 +14,3 @@ generateUnqualifiedNamesForSchemas?: string[]; | ||
queryName: string; | ||
description?: Nullable<string>; | ||
tableJson: TableJsonSpec; | ||
@@ -15,0 +17,0 @@ resultRepresentations?: Nullable<ResultRepr[]>; |
{ | ||
"name": "sqljson-query", | ||
"version": "1.7.20", | ||
"version": "1.7.21", | ||
"description": "Command line tool to generate SQL/JSON queries and Typescript types for query results.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,3 +8,2 @@ import { z } from 'zod'; | ||
exactUnquotedName, | ||
readTextFile, | ||
Nullable, | ||
@@ -326,7 +325,6 @@ } from '../util/mod'; | ||
export async function readDatabaseMetadata(dbmdFile: string): Promise<DatabaseMetadata> | ||
export function parseStoredDatabaseMetadata(s: string): StoredDatabaseMetadata | ||
{ | ||
const obj = JSON.parse(await readTextFile(dbmdFile)); | ||
const dbmdStoredProps = StoredDatabaseMetadataDef.parse(obj); | ||
return new DatabaseMetadata(dbmdStoredProps); | ||
} | ||
const obj = JSON.parse(s); | ||
return StoredDatabaseMetadataDef.parse(obj); | ||
} |
@@ -6,7 +6,7 @@ import * as path from 'path'; | ||
} from './util/mod'; | ||
import { readDatabaseMetadata } from './dbmd'; | ||
// import { readDatabaseMetadata } from './dbmd'; TODO | ||
import { QueryGroupSpec, ResultRepr, SpecError } from './query-specs'; | ||
import { SourceGenerationOptions, SourceLanguage } from './source-generation-options'; | ||
import { QueryPropertiesMetadata } from './query-properties-metadata-generation'; | ||
import { GeneratedResultTypes, GeneratedSql, generateQueryGroupSources } from './lib'; | ||
import { DatabaseMetadata, GeneratedResultTypes, GeneratedSql, generateQueryGroupSources, parseStoredDatabaseMetadata } from './lib'; | ||
@@ -223,2 +223,9 @@ export * from './lib'; | ||
async function readDatabaseMetadata(dbmdFile: string): Promise<DatabaseMetadata> | ||
{ | ||
const jsonText = await readTextFile(dbmdFile); | ||
const dbmdStoredProps = parseStoredDatabaseMetadata(jsonText); | ||
return new DatabaseMetadata(dbmdStoredProps); | ||
} | ||
async function createOutputDirs(opts: QueryGenerationOptions): Promise<void> | ||
@@ -225,0 +232,0 @@ { |
@@ -8,2 +8,3 @@ import { caseNormalizeName, Nullable, relIdDescn } from './util/mod'; | ||
defaultSchema?: Nullable<string>; | ||
description?: Nullable<string>; | ||
propertyNameDefault?: Nullable<PropertyNameDefault>; | ||
@@ -17,2 +18,3 @@ generateUnqualifiedNamesForSchemas?: string[]; | ||
queryName: string; | ||
description?: Nullable<string>; | ||
tableJson: TableJsonSpec; | ||
@@ -19,0 +21,0 @@ resultRepresentations?: Nullable<ResultRepr[]>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
511051
8950