@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/.changeset/search-input-bounds.md +5 -0
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/escape-regex.util.test.mjs +26 -0
package/dist/index.js
CHANGED
|
@@ -1002,6 +1002,11 @@ function capitalizeText(text) {
|
|
|
1002
1002
|
return text.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
|
+
// src/utils/escape-regex.util.ts
|
|
1006
|
+
function escapeRegex(value) {
|
|
1007
|
+
return String(value ?? "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1005
1010
|
// src/repositories/hygiene-area.repository.ts
|
|
1006
1011
|
function useAreaRepo() {
|
|
1007
1012
|
const db = import_node_server_utils4.useAtlas.getDb();
|
|
@@ -1098,7 +1103,7 @@ function useAreaRepo() {
|
|
|
1098
1103
|
cacheOptions.type = type;
|
|
1099
1104
|
}
|
|
1100
1105
|
if (search) {
|
|
1101
|
-
query.$or = [{ name: { $regex: search, $options: "i" } }];
|
|
1106
|
+
query.$or = [{ name: { $regex: escapeRegex(search), $options: "i" } }];
|
|
1102
1107
|
cacheOptions.search = search;
|
|
1103
1108
|
}
|
|
1104
1109
|
const cacheKey = (0, import_node_server_utils4.makeCacheKey)(namespace_collection, cacheOptions);
|
|
@@ -1560,7 +1565,7 @@ function useUnitRepository() {
|
|
|
1560
1565
|
throw new import_node_server_utils7.BadRequestError("Invalid site ID format.");
|
|
1561
1566
|
}
|
|
1562
1567
|
if (search) {
|
|
1563
|
-
query.$or = [{ name: { $regex: search, $options: "i" } }];
|
|
1568
|
+
query.$or = [{ name: { $regex: escapeRegex(search), $options: "i" } }];
|
|
1564
1569
|
cacheOptions.search = search;
|
|
1565
1570
|
}
|
|
1566
1571
|
const cacheKey = (0, import_node_server_utils7.makeCacheKey)(namespace_collection, cacheOptions);
|
|
@@ -5360,7 +5365,7 @@ function useSupplyRepository() {
|
|
|
5360
5365
|
throw new import_node_server_utils22.BadRequestError("Invalid site ID format.");
|
|
5361
5366
|
}
|
|
5362
5367
|
if (search) {
|
|
5363
|
-
query.name = { $regex: search, $options: "i" };
|
|
5368
|
+
query.name = { $regex: escapeRegex(search), $options: "i" };
|
|
5364
5369
|
cacheOptions.search = search;
|
|
5365
5370
|
}
|
|
5366
5371
|
const cacheKey = (0, import_node_server_utils22.makeCacheKey)(namespace_collection, cacheOptions);
|
|
@@ -6126,7 +6131,7 @@ function useCheckOutItemRepository() {
|
|
|
6126
6131
|
throw new import_node_server_utils29.BadRequestError("Invalid site ID format.");
|
|
6127
6132
|
}
|
|
6128
6133
|
if (search) {
|
|
6129
|
-
query.supplyName = { $regex: search, $options: "i" };
|
|
6134
|
+
query.supplyName = { $regex: escapeRegex(search), $options: "i" };
|
|
6130
6135
|
cacheOptions.search = search;
|
|
6131
6136
|
}
|
|
6132
6137
|
const cacheKey = (0, import_node_server_utils29.makeCacheKey)(namespace_collection, cacheOptions);
|
|
@@ -6817,7 +6822,7 @@ function useScheduleTaskRepository() {
|
|
|
6817
6822
|
throw new import_node_server_utils33.BadRequestError("Invalid site ID format.");
|
|
6818
6823
|
}
|
|
6819
6824
|
if (search) {
|
|
6820
|
-
query.$or = [{ title: { $regex: search, $options: "i" } }];
|
|
6825
|
+
query.$or = [{ title: { $regex: escapeRegex(search), $options: "i" } }];
|
|
6821
6826
|
cacheOptions.search = search;
|
|
6822
6827
|
}
|
|
6823
6828
|
const cacheKey = (0, import_node_server_utils33.makeCacheKey)(namespace_collection, cacheOptions);
|