@owox/connectors 0.15.0-next-20251203015943 → 0.15.0-next-20251203124103

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.
package/dist/index.cjs CHANGED
@@ -2220,7 +2220,8 @@ const Snowflake = (function() {
2220
2220
  }
2221
2221
  let columnType = this.getColumnType(columnName);
2222
2222
  if ("description" in this.schema[columnName]) {
2223
- columnDescription = ` COMMENT '${this.schema[columnName]["description"]}'`;
2223
+ const escapedDescription = this.obfuscateSpecialCharacters(this.schema[columnName]["description"]);
2224
+ columnDescription = ` COMMENT '${escapedDescription}'`;
2224
2225
  }
2225
2226
  columns.push(`"${columnName}" ${columnType}${columnDescription}`);
2226
2227
  existingColumns[columnName] = { "name": columnName, "type": columnType };
@@ -2233,8 +2234,9 @@ const Snowflake = (function() {
2233
2234
  ${columnsStr}
2234
2235
  )`;
2235
2236
  if (this.description) {
2237
+ const escapedTableDescription = this.obfuscateSpecialCharacters(this.description);
2236
2238
  query += `
2237
- COMMENT = '${this.description}'`;
2239
+ COMMENT = '${escapedTableDescription}'`;
2238
2240
  }
2239
2241
  await this.executeQuery(query);
2240
2242
  this.config.logMessage(`Table ${this.config.SnowflakeDatabase.value}.${quotedSchema}.${quotedTable} was created`);
@@ -2255,7 +2257,8 @@ COMMENT = '${this.description}'`;
2255
2257
  let columnDescription = "";
2256
2258
  let columnType = this.getColumnType(columnName);
2257
2259
  if ("description" in this.schema[columnName]) {
2258
- columnDescription = ` COMMENT '${this.schema[columnName]["description"]}'`;
2260
+ const escapedDescription = this.obfuscateSpecialCharacters(this.schema[columnName]["description"]);
2261
+ columnDescription = ` COMMENT '${escapedDescription}'`;
2259
2262
  }
2260
2263
  columns.push(`ADD COLUMN IF NOT EXISTS "${columnName}" ${columnType}${columnDescription}`);
2261
2264
  this.existingColumns[columnName] = { "name": columnName, "type": columnType };
@@ -2434,7 +2437,7 @@ COMMENT = '${this.description}'`;
2434
2437
  sqlText: query,
2435
2438
  complete: (err, stmt, rows) => {
2436
2439
  if (err) {
2437
- reject(new Error(`Snowflake query failed: ${err.message}`));
2440
+ reject(new Error(`Snowflake query failed: ${err.message} in query: ${query}`));
2438
2441
  } else {
2439
2442
  resolve(rows || []);
2440
2443
  }
@@ -2450,7 +2453,7 @@ COMMENT = '${this.description}'`;
2450
2453
  * @return {string} - Escaped string
2451
2454
  */
2452
2455
  obfuscateSpecialCharacters(inputString) {
2453
- return String(inputString).replace(/\\/g, "\\\\").replace(/'/g, "''").replace(/"/g, '\\"').replace(/[\x00-\x1F]/g, " ");
2456
+ return String(inputString).replace(/\\/g, "\\\\").replace(/\r\n/g, " ").replace(/\n/g, " ").replace(/\r/g, " ").replace(/'/g, "''").replace(/"/g, '\\"').replace(/[\x00-\x1F]/g, " ");
2454
2457
  }
2455
2458
  //----------------------------------------------------------------
2456
2459
  //---- getColumnType -----------------------------------------------
package/dist/index.js CHANGED
@@ -2218,7 +2218,8 @@ const Snowflake = (function() {
2218
2218
  }
2219
2219
  let columnType = this.getColumnType(columnName);
2220
2220
  if ("description" in this.schema[columnName]) {
2221
- columnDescription = ` COMMENT '${this.schema[columnName]["description"]}'`;
2221
+ const escapedDescription = this.obfuscateSpecialCharacters(this.schema[columnName]["description"]);
2222
+ columnDescription = ` COMMENT '${escapedDescription}'`;
2222
2223
  }
2223
2224
  columns.push(`"${columnName}" ${columnType}${columnDescription}`);
2224
2225
  existingColumns[columnName] = { "name": columnName, "type": columnType };
@@ -2231,8 +2232,9 @@ const Snowflake = (function() {
2231
2232
  ${columnsStr}
2232
2233
  )`;
2233
2234
  if (this.description) {
2235
+ const escapedTableDescription = this.obfuscateSpecialCharacters(this.description);
2234
2236
  query += `
2235
- COMMENT = '${this.description}'`;
2237
+ COMMENT = '${escapedTableDescription}'`;
2236
2238
  }
2237
2239
  await this.executeQuery(query);
2238
2240
  this.config.logMessage(`Table ${this.config.SnowflakeDatabase.value}.${quotedSchema}.${quotedTable} was created`);
@@ -2253,7 +2255,8 @@ COMMENT = '${this.description}'`;
2253
2255
  let columnDescription = "";
2254
2256
  let columnType = this.getColumnType(columnName);
2255
2257
  if ("description" in this.schema[columnName]) {
2256
- columnDescription = ` COMMENT '${this.schema[columnName]["description"]}'`;
2258
+ const escapedDescription = this.obfuscateSpecialCharacters(this.schema[columnName]["description"]);
2259
+ columnDescription = ` COMMENT '${escapedDescription}'`;
2257
2260
  }
2258
2261
  columns.push(`ADD COLUMN IF NOT EXISTS "${columnName}" ${columnType}${columnDescription}`);
2259
2262
  this.existingColumns[columnName] = { "name": columnName, "type": columnType };
@@ -2432,7 +2435,7 @@ COMMENT = '${this.description}'`;
2432
2435
  sqlText: query,
2433
2436
  complete: (err, stmt, rows) => {
2434
2437
  if (err) {
2435
- reject(new Error(`Snowflake query failed: ${err.message}`));
2438
+ reject(new Error(`Snowflake query failed: ${err.message} in query: ${query}`));
2436
2439
  } else {
2437
2440
  resolve(rows || []);
2438
2441
  }
@@ -2448,7 +2451,7 @@ COMMENT = '${this.description}'`;
2448
2451
  * @return {string} - Escaped string
2449
2452
  */
2450
2453
  obfuscateSpecialCharacters(inputString) {
2451
- return String(inputString).replace(/\\/g, "\\\\").replace(/'/g, "''").replace(/"/g, '\\"').replace(/[\x00-\x1F]/g, " ");
2454
+ return String(inputString).replace(/\\/g, "\\\\").replace(/\r\n/g, " ").replace(/\n/g, " ").replace(/\r/g, " ").replace(/'/g, "''").replace(/"/g, '\\"').replace(/[\x00-\x1F]/g, " ");
2452
2455
  }
2453
2456
  //----------------------------------------------------------------
2454
2457
  //---- getColumnType -----------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owox/connectors",
3
- "version": "0.15.0-next-20251203015943",
3
+ "version": "0.15.0-next-20251203124103",
4
4
  "description": "Connectors and storages for different data sources",
5
5
  "license": "MIT",
6
6
  "publishConfig": {