sqljson-query
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -110,5 +110,3 @@ "use strict"; | ||
const sqlSpecPath = path.join(outputDir, sqlSpecFileName); | ||
await (0, mod_1.writeTextFile)(sqlSpecPath, "-- [ THIS QUERY WAS AUTO-GENERATED, ANY CHANGES MADE HERE MAY BE LOST. ]\n" + | ||
"-- " + resultRepr + " results representation for " + queryName + "\n" + | ||
JSON.stringify(sqlSpec, null, 2) + "\n"); | ||
await (0, mod_1.writeTextFile)(sqlSpecPath, JSON.stringify(sqlSpec, null, 2) + "\n"); | ||
} | ||
@@ -115,0 +113,0 @@ } |
@@ -184,3 +184,2 @@ "use strict"; | ||
resultType, forceNullable) { | ||
props.tableExpressionProperties.push(...resultType.tableExpressionProperties); | ||
if (forceNullable) { | ||
@@ -187,0 +186,0 @@ // Add nullable form of each field. |
@@ -85,3 +85,2 @@ "use strict"; | ||
wrapPropertiesInJsonObject: !unwrap, | ||
selectEntriesLeadingComment: `aggregated row objects for table '${tj.table}'`, | ||
fromEntriesLeadingComment: `base query for table '${tj.table}'`, | ||
@@ -150,3 +149,3 @@ }; | ||
}, | ||
comment: `parent table ${parent.table}, joined for inlined fields` | ||
comment: `parent table '${parent.table}', joined for inlined fields` | ||
}); | ||
@@ -158,3 +157,3 @@ for (const [ix, parentSelectEntry] of parentPropsSql.propertySelectEntries.entries()) { | ||
parentAlias: parentAlias, | ||
comment: ix === 0 ? `field(s) inlined from parent table ${parent.table}` : null | ||
comment: ix === 0 ? `field(s) inlined from parent table '${parent.table}'` : null | ||
}); | ||
@@ -197,3 +196,3 @@ } | ||
parentRowObjectSql, | ||
comment: `parent table ${parent.table} referenced via ${parent.referenceName}` | ||
comment: `reference '${parent.referenceName}' to parent table '${parent.table}'` | ||
}]); | ||
@@ -217,3 +216,3 @@ } | ||
collectionSql, | ||
comment: `records from child table '${child.table}' as collection '${child.collectionName}'`, | ||
comment: `collection '${child.collectionName}' of records from child table '${child.table}'`, | ||
}; | ||
@@ -220,0 +219,0 @@ }); |
@@ -59,6 +59,6 @@ "use strict"; | ||
return ('select\n' + | ||
this.indent((baseTableDesc ? `-- row object for table ${baseTableDesc}\n` : '') + | ||
this.indent((baseTableDesc ? `-- row object for table '${baseTableDesc}'\n` : '') + | ||
this.sqlDialect.getRowObjectExpression(propertyNames, 'q') + ' json') + '\n' + | ||
'from (\n' + | ||
nlterm(this.indent((baseTableDesc ? `-- base query for table ${baseTableDesc}\n` : '') + | ||
nlterm(this.indent((baseTableDesc ? `-- base query for table '${baseTableDesc}'\n` : '') + | ||
baseSql)) + | ||
@@ -68,11 +68,11 @@ ') q' + | ||
} | ||
aggregateSql(sql, propertyNames, wrapPropertiesInJsonObject, orderBy, baseTableDesc) { | ||
aggregateSql(sql, propertyNames, wrapProps, orderBy, baseTableDesc) { | ||
const ordby = orderBy === null || orderBy === void 0 ? void 0 : orderBy.orderBy; | ||
return ('select\n' + | ||
this.indent((this.genComments ? `-- aggregated values for table ${baseTableDesc}\n` : '') + | ||
(wrapPropertiesInJsonObject | ||
this.indent((this.genComments ? `-- aggregated ${wrapProps ? 'rows' : 'values'} from table '${baseTableDesc}'\n` : '') + | ||
(wrapProps | ||
? this.sqlDialect.getAggregatedRowObjectsExpression(propertyNames, ordby, 'q') | ||
: this.sqlDialect.getAggregatedColumnValuesExpression(propertyNames[0], ordby, 'q')) + ' json\n') + | ||
'from (\n' + | ||
nlterm(this.indent((this.genComments ? `-- base query for table ${baseTableDesc}\n` : '') + | ||
nlterm(this.indent((this.genComments ? `-- base query for table '${baseTableDesc}'\n` : '') + | ||
sql)) + | ||
@@ -79,0 +79,0 @@ ') q'); |
@@ -54,3 +54,2 @@ "use strict"; | ||
exports.makeNameNotInSet = makeNameNotInSet; | ||
// TODO: Leave blank lines alone here. | ||
function indentLines(linesStr, spacesCount, indentFirstLine = true) { | ||
@@ -57,0 +56,0 @@ const sb = []; |
{ | ||
"name": "sqljson-query", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"description": "Command line tool to generate SQL/JSON queries and Typescript types for query results.", | ||
@@ -24,5 +24,5 @@ "keywords": [ | ||
"build-mysql": "docker build --platform linux/x86_64 -t drugs-mysql src/__tests__/db/mysql", | ||
"start-mysql": "npm run build-mysql && docker run --platform linux/x86_64 -d --name drugs-mysql -p 127.0.0.1:3306:3306 drugs-mysql", | ||
"start-mysql": "npm run build-mysql && docker run --platform linux/x86_64 -d --name drugs-mysql --rm -p 127.0.0.1:3306:3306 drugs-mysql", | ||
"mysql-cli": "docker exec -it drugs-mysql mysql --user=drugs --password=drugs drugs", | ||
"start-test-dbs": "npm run start-pg && npm run start-mysql", | ||
"start-test-dbs": "docker rm -vf drugs-mysql drugs-pg && npm run start-pg && npm run start-mysql", | ||
"typecheck": "tsc --noEmit # (compile without emitting outputs)", | ||
@@ -29,0 +29,0 @@ "build": "npm run clean && tsc", |
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
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
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
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
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
1658401
8745