@restura/core 2.0.1 → 2.0.2

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.js CHANGED
@@ -506,8 +506,9 @@ var ResponseValidator = class _ResponseValidator {
506
506
  static isCustomRoute(route) {
507
507
  return route.type === "CUSTOM_ONE" || route.type === "CUSTOM_ARRAY" || route.type === "CUSTOM_PAGED";
508
508
  }
509
+ static VALIDATOR_STRINGS = ["boolean", "string", "number", "object", "any"];
509
510
  static validatorIsValidString(validator) {
510
- return !validator.includes("|");
511
+ return _ResponseValidator.VALIDATOR_STRINGS.includes(validator);
511
512
  }
512
513
  };
513
514
 
@@ -3952,7 +3953,7 @@ async function introspectDatabase(pool) {
3952
3953
  const order = row.indexdef.toUpperCase().includes(" DESC") ? "DESC" : "ASC";
3953
3954
  const columnMatch = row.indexdef.match(/\((.+?)\)(?:\s+WHERE\s+(.+))?$/i);
3954
3955
  const columns = columnMatch ? columnMatch[1].split(",").map(
3955
- (colExpr) => colExpr.trim().replace(/^"(.*)"$/, "$1").replace(/\s+(ASC|DESC)$/i, "")
3956
+ (colExpr) => colExpr.trim().replace(/\s+(ASC|DESC)$/i, "").replace(/^"(.*)"$/, "$1")
3956
3957
  ) : [];
3957
3958
  const whereClause = columnMatch?.[2] ?? null;
3958
3959
  table.indexes.push({
@@ -4354,6 +4355,7 @@ function normalizeCheckExpression(expr) {
4354
4355
  normalized = normalized.replace(/::\w+(\[\])?/g, "");
4355
4356
  normalized = normalized.replace(/=\s*ANY\s*\(\s*\(\s*ARRAY\s*\[([^\]]*)\]\s*\)\s*\)/gi, "IN ($1)");
4356
4357
  normalized = normalized.replace(/=\s*ANY\s*\(\s*ARRAY\s*\[([^\]]*)\]\s*\)/gi, "IN ($1)");
4358
+ normalized = normalized.replace(/\bIN\s*\(\s*('(?:[^']|'')*')\s*\)/gi, "= $1");
4357
4359
  normalized = normalized.replace(/"(\w+)"/g, "$1");
4358
4360
  normalized = normalized.replace(/\((\w+)\)/g, "$1");
4359
4361
  normalized = normalized.replace(/\s+/g, " ").trim();