@7365admin1/module-hygiene 4.29.1-staging.14 → 4.29.1-staging.15

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.mjs CHANGED
@@ -930,6 +930,11 @@ function capitalizeText(text) {
930
930
  return text.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
931
931
  }
932
932
 
933
+ // src/utils/escape-regex.util.ts
934
+ function escapeRegex(value) {
935
+ return String(value ?? "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
936
+ }
937
+
933
938
  // src/repositories/hygiene-area.repository.ts
934
939
  function useAreaRepo() {
935
940
  const db = useAtlas2.getDb();
@@ -1026,7 +1031,7 @@ function useAreaRepo() {
1026
1031
  cacheOptions.type = type;
1027
1032
  }
1028
1033
  if (search) {
1029
- query.$or = [{ name: { $regex: search, $options: "i" } }];
1034
+ query.$or = [{ name: { $regex: escapeRegex(search), $options: "i" } }];
1030
1035
  cacheOptions.search = search;
1031
1036
  }
1032
1037
  const cacheKey = makeCacheKey2(namespace_collection, cacheOptions);
@@ -1500,7 +1505,7 @@ function useUnitRepository() {
1500
1505
  throw new BadRequestError6("Invalid site ID format.");
1501
1506
  }
1502
1507
  if (search) {
1503
- query.$or = [{ name: { $regex: search, $options: "i" } }];
1508
+ query.$or = [{ name: { $regex: escapeRegex(search), $options: "i" } }];
1504
1509
  cacheOptions.search = search;
1505
1510
  }
1506
1511
  const cacheKey = makeCacheKey3(namespace_collection, cacheOptions);
@@ -5338,7 +5343,7 @@ function useSupplyRepository() {
5338
5343
  throw new BadRequestError18("Invalid site ID format.");
5339
5344
  }
5340
5345
  if (search) {
5341
- query.name = { $regex: search, $options: "i" };
5346
+ query.name = { $regex: escapeRegex(search), $options: "i" };
5342
5347
  cacheOptions.search = search;
5343
5348
  }
5344
5349
  const cacheKey = makeCacheKey6(namespace_collection, cacheOptions);
@@ -6125,7 +6130,7 @@ function useCheckOutItemRepository() {
6125
6130
  throw new BadRequestError25("Invalid site ID format.");
6126
6131
  }
6127
6132
  if (search) {
6128
- query.supplyName = { $regex: search, $options: "i" };
6133
+ query.supplyName = { $regex: escapeRegex(search), $options: "i" };
6129
6134
  cacheOptions.search = search;
6130
6135
  }
6131
6136
  const cacheKey = makeCacheKey8(namespace_collection, cacheOptions);
@@ -6825,7 +6830,7 @@ function useScheduleTaskRepository() {
6825
6830
  throw new BadRequestError29("Invalid site ID format.");
6826
6831
  }
6827
6832
  if (search) {
6828
- query.$or = [{ title: { $regex: search, $options: "i" } }];
6833
+ query.$or = [{ title: { $regex: escapeRegex(search), $options: "i" } }];
6829
6834
  cacheOptions.search = search;
6830
6835
  }
6831
6836
  const cacheKey = makeCacheKey9(namespace_collection, cacheOptions);