@openhi/constructs 0.0.174 → 0.0.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10754,6 +10754,8 @@ var DataApiPostgresQueryRunner = class {
|
|
|
10754
10754
|
}
|
|
10755
10755
|
async query(sql, params) {
|
|
10756
10756
|
await this.ensureSchemaBootstrapped();
|
|
10757
|
+
const qualifiedSql = qualifyResourcesTable(sql, this.schema);
|
|
10758
|
+
logDebugQuery(qualifiedSql, params);
|
|
10757
10759
|
const out = await this.client.send(
|
|
10758
10760
|
new import_client_rds_data.ExecuteStatementCommand({
|
|
10759
10761
|
resourceArn: this.clusterArn,
|
|
@@ -10764,7 +10766,7 @@ var DataApiPostgresQueryRunner = class {
|
|
|
10764
10766
|
// `ValidationException: The schema parameter isn't supported.`
|
|
10765
10767
|
// Instead, the SQL is rewritten to schema-qualify the `resources`
|
|
10766
10768
|
// table inline before being sent. See {@link qualifyResourcesTable}.
|
|
10767
|
-
sql:
|
|
10769
|
+
sql: qualifiedSql,
|
|
10768
10770
|
parameters: params.map(toSqlParameter),
|
|
10769
10771
|
// Results as named columns so we can map them back to JS objects.
|
|
10770
10772
|
includeResultMetadata: true,
|
|
@@ -10805,6 +10807,7 @@ var DataApiPostgresQueryRunner = class {
|
|
|
10805
10807
|
}
|
|
10806
10808
|
async runBootstrap() {
|
|
10807
10809
|
for (const statement of buildSchemaBootstrapStatements(this.schema)) {
|
|
10810
|
+
logDebugQuery(statement, []);
|
|
10808
10811
|
await this.client.send(
|
|
10809
10812
|
new import_client_rds_data.ExecuteStatementCommand({
|
|
10810
10813
|
resourceArn: this.clusterArn,
|
|
@@ -10816,6 +10819,18 @@ var DataApiPostgresQueryRunner = class {
|
|
|
10816
10819
|
}
|
|
10817
10820
|
}
|
|
10818
10821
|
};
|
|
10822
|
+
function logDebugQuery(sql, params) {
|
|
10823
|
+
if (process.env.DEBUG !== "true") {
|
|
10824
|
+
return;
|
|
10825
|
+
}
|
|
10826
|
+
console.log(
|
|
10827
|
+
"[pg-debug]",
|
|
10828
|
+
JSON.stringify({
|
|
10829
|
+
sql,
|
|
10830
|
+
params: params.map((p) => ({ name: p.name, value: p.value }))
|
|
10831
|
+
})
|
|
10832
|
+
);
|
|
10833
|
+
}
|
|
10819
10834
|
function qualifyResourcesTable(sql, schema) {
|
|
10820
10835
|
return sql.replace(
|
|
10821
10836
|
/(\b(?:FROM|JOIN)\s+)resources\b/gi,
|