namespace-guard 0.22.0 → 0.23.0

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.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +50 -40
  3. package/THIRD-PARTY-NOTICES.md +120 -0
  4. package/dist/adapters/drizzle.js +6 -5
  5. package/dist/adapters/drizzle.mjs +6 -5
  6. package/dist/adapters/knex.js +1 -1
  7. package/dist/adapters/knex.mjs +1 -1
  8. package/dist/adapters/kysely.js +5 -2
  9. package/dist/adapters/kysely.mjs +5 -2
  10. package/dist/adapters/mikro-orm.js +5 -2
  11. package/dist/adapters/mikro-orm.mjs +5 -2
  12. package/dist/adapters/mongoose.js +4 -6
  13. package/dist/adapters/mongoose.mjs +4 -6
  14. package/dist/adapters/prisma.js +2 -4
  15. package/dist/adapters/prisma.mjs +2 -4
  16. package/dist/adapters/raw.js +1 -2
  17. package/dist/adapters/raw.mjs +1 -2
  18. package/dist/adapters/sequelize.js +1 -1
  19. package/dist/adapters/sequelize.mjs +1 -1
  20. package/dist/adapters/typeorm.js +5 -5
  21. package/dist/adapters/typeorm.mjs +5 -5
  22. package/dist/cli.js +8721 -5620
  23. package/dist/cli.mjs +8721 -5620
  24. package/dist/composability-vectors.js +7660 -5106
  25. package/dist/composability-vectors.mjs +7660 -5106
  26. package/dist/confusable-weights.d.mts +7 -1
  27. package/dist/confusable-weights.d.ts +7 -1
  28. package/dist/confusable-weights.js +4563 -378
  29. package/dist/confusable-weights.mjs +4563 -378
  30. package/dist/font-specific-weights.d.mts +8 -2
  31. package/dist/font-specific-weights.d.ts +8 -2
  32. package/dist/font-specific-weights.js +34890 -2492
  33. package/dist/font-specific-weights.mjs +34890 -2492
  34. package/dist/index.d.mts +162 -81
  35. package/dist/index.d.ts +162 -81
  36. package/dist/index.js +10927 -5776
  37. package/dist/index.mjs +10924 -5776
  38. package/dist/profanity-en.d.mts +5 -3
  39. package/dist/profanity-en.d.ts +5 -3
  40. package/dist/profanity-en.js +10306 -5304
  41. package/dist/profanity-en.mjs +10305 -5304
  42. package/package.json +10 -3
@@ -37,12 +37,9 @@ function createTypeORMAdapter(dataSource, entities, ilike) {
37
37
  if (!ilike) {
38
38
  throw new Error("caseInsensitive requires passing ILike to createTypeORMAdapter");
39
39
  }
40
- whereValue = ilike(value);
40
+ whereValue = ilike(escapeLike(value));
41
41
  }
42
- const select = {
43
- [idColumn]: true,
44
- ...source.scopeKey && source.scopeKey !== idColumn ? { [source.scopeKey]: true } : {}
45
- };
42
+ const select = { [idColumn]: true };
46
43
  return repository.findOne({
47
44
  where: { [source.column]: whereValue },
48
45
  select
@@ -50,6 +47,9 @@ function createTypeORMAdapter(dataSource, entities, ilike) {
50
47
  }
51
48
  };
52
49
  }
50
+ function escapeLike(value) {
51
+ return value.replace(/[\\%_]/g, "\\$&");
52
+ }
53
53
  // Annotate the CommonJS export names for ESM import in node:
54
54
  0 && (module.exports = {
55
55
  createTypeORMAdapter
@@ -13,12 +13,9 @@ function createTypeORMAdapter(dataSource, entities, ilike) {
13
13
  if (!ilike) {
14
14
  throw new Error("caseInsensitive requires passing ILike to createTypeORMAdapter");
15
15
  }
16
- whereValue = ilike(value);
16
+ whereValue = ilike(escapeLike(value));
17
17
  }
18
- const select = {
19
- [idColumn]: true,
20
- ...source.scopeKey && source.scopeKey !== idColumn ? { [source.scopeKey]: true } : {}
21
- };
18
+ const select = { [idColumn]: true };
22
19
  return repository.findOne({
23
20
  where: { [source.column]: whereValue },
24
21
  select
@@ -26,6 +23,9 @@ function createTypeORMAdapter(dataSource, entities, ilike) {
26
23
  }
27
24
  };
28
25
  }
26
+ function escapeLike(value) {
27
+ return value.replace(/[\\%_]/g, "\\$&");
28
+ }
29
29
  export {
30
30
  createTypeORMAdapter
31
31
  };