@tmlmobilidade/go-interfaces-labdb 20260719.2330.59 → 20260720.1222.32

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.
@@ -27,7 +27,7 @@ export class ClickHouseInterfaceTemplate {
27
27
  primaryKey: options.primaryKey ?? undefined,
28
28
  };
29
29
  this.init().catch((error) => {
30
- Logger.error({ error, message: `CLICKHOUSE [${this.databaseName}."${this.tableName}"]: Error @ constructor(): ${error.message}` });
30
+ Logger.error({ error, message: `LABDB [${this.databaseName}."${this.tableName}"]: Error @ constructor(): ${error.message}` });
31
31
  throw error;
32
32
  });
33
33
  }
@@ -180,14 +180,14 @@ export class ClickHouseInterfaceTemplate {
180
180
  async ensureDatabase() {
181
181
  // Validate the inputs are safe identifiers to prevent SQL injection
182
182
  if (!validateSqlParam(this.databaseName, false))
183
- throw new Error(`CLICKHOUSE [${this.databaseName}]: Unsafe database name provided.`);
183
+ throw new Error(`LABDB [${this.databaseName}]: Unsafe database name provided.`);
184
184
  // Perform the query to create the database if it does not exist
185
185
  try {
186
186
  await this.client.command({ query: `CREATE DATABASE IF NOT EXISTS "${this.databaseName}"` });
187
- Logger.info({ message: `CLICKHOUSE [${this.databaseName}]: Database created.` });
187
+ Logger.info({ message: `LABDB [${this.databaseName}]: Database created.` });
188
188
  }
189
189
  catch (error) {
190
- Logger.error({ error, message: `CLICKHOUSE [${this.databaseName}]: Error @ createDatabase(): ${error.message}` });
190
+ Logger.error({ error, message: `LABDB [${this.databaseName}]: Error @ createDatabase(): ${error.message}` });
191
191
  throw error;
192
192
  }
193
193
  }
@@ -201,13 +201,13 @@ export class ClickHouseInterfaceTemplate {
201
201
  async ensureTable() {
202
202
  // Validate the inputs are safe identifiers to prevent SQL injection
203
203
  if (!validateSqlParam(this.databaseName, false))
204
- throw new Error(`CLICKHOUSE [${this.databaseName}]: Unsafe database name provided.`);
204
+ throw new Error(`LABDB [${this.databaseName}]: Unsafe database name provided.`);
205
205
  if (!validateSqlParam(this.tableName, false))
206
- throw new Error(`CLICKHOUSE [${this.tableName}]: Unsafe table name provided.`);
206
+ throw new Error(`LABDB [${this.tableName}]: Unsafe table name provided.`);
207
207
  // Validate the schema columns are safe identifiers
208
208
  const unsafeColumns = Object.keys(this.schema).filter(key => !validateSqlParam(key, false));
209
209
  if (unsafeColumns.length > 0)
210
- throw new Error(`CLICKHOUSE [${this.tableName}]: Unsafe column names provided: ${unsafeColumns.join(', ')}.`);
210
+ throw new Error(`LABDB [${this.tableName}]: Unsafe column names provided: ${unsafeColumns.join(', ')}.`);
211
211
  // Ensure the database exists before creating the table
212
212
  await this.ensureDatabase();
213
213
  // Setup the full CREATE TABLE query
@@ -222,12 +222,12 @@ export class ClickHouseInterfaceTemplate {
222
222
  // Perform the query to create the table
223
223
  try {
224
224
  await this.client.command({ query: createTableQuery });
225
- Logger.info({ message: `CLICKHOUSE [${this.tableName}]: Table created.` });
225
+ Logger.info({ message: `LABDB [${this.tableName}]: Table created.` });
226
226
  }
227
227
  catch (error) {
228
228
  // If the error is not an ACCESS_DENIED, throw it right away
229
229
  if (!(error instanceof ClickHouseError) || error.code !== '497') {
230
- Logger.error({ error, message: `CLICKHOUSE [${this.tableName}]: Error @ createTable(): ${error.message}` });
230
+ Logger.error({ error, message: `LABDB [${this.tableName}]: Error @ createTable(): ${error.message}` });
231
231
  throw error;
232
232
  }
233
233
  // If the error is an ACCESS_DENIED, check if the table exists
@@ -239,12 +239,12 @@ export class ClickHouseInterfaceTemplate {
239
239
  const tables = await resultSet.json();
240
240
  if (Array.isArray(tables) && tables.length > 0)
241
241
  return;
242
- Logger.error({ error, message: `CLICKHOUSE [${this.tableName}]: ACCESS_DENIED and table does not exist. ${error.message}` });
242
+ Logger.error({ error, message: `LABDB [${this.tableName}]: ACCESS_DENIED and table does not exist. ${error.message}` });
243
243
  throw error;
244
244
  }
245
245
  catch (verifyError) {
246
246
  //
247
- Logger.error({ error: verifyError, message: `CLICKHOUSE [${this.tableName}]: Failed to verify table existence after ACCESS_DENIED: ${verifyError.message}` });
247
+ Logger.error({ error: verifyError, message: `LABDB [${this.tableName}]: Failed to verify table existence after ACCESS_DENIED: ${verifyError.message}` });
248
248
  throw verifyError;
249
249
  }
250
250
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/go-interfaces-labdb",
3
- "version": "20260719.2330.59",
3
+ "version": "20260720.1222.32",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"