@unchainedshop/mongodb 2.17.0 → 2.18.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"email-regex-operator.d.ts","sourceRoot":"","sources":["../src/email-regex-operator.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,MAAM,KAAA;;EAMxC"}
1
+ {"version":3,"file":"email-regex-operator.d.ts","sourceRoot":"","sources":["../src/email-regex-operator.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,MAAM,KAAA;;EAUxC"}
@@ -2,7 +2,11 @@ export function emailRegexOperator(string) {
2
2
  if (typeof string !== 'string') {
3
3
  throw new TypeError('Expected a string');
4
4
  }
5
- const escappedEmail = string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
6
- return { $regex: new RegExp(`${escappedEmail}$`, 'i') };
5
+ const escapped = string.trim().replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
6
+ if (escapped.length === 0)
7
+ throw new Error('String is empty after trimming');
8
+ if (escapped.length > 255)
9
+ throw new Error('String exceeds maximum allowed length');
10
+ return { $regex: new RegExp(`^${escapped}$`, 'i') };
7
11
  }
8
12
  //# sourceMappingURL=email-regex-operator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-regex-operator.js","sourceRoot":"","sources":["../src/email-regex-operator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,MAAM;IACvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3F,OAAO,EAAE,MAAM,EAAE,IAAI,MAAM,CAAC,GAAG,aAAa,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;AAC1D,CAAC"}
1
+ {"version":3,"file":"email-regex-operator.js","sourceRoot":"","sources":["../src/email-regex-operator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,MAAM;IACvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IAExE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC7E,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAEpF,OAAO,EAAE,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,QAAQ,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;AACtD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/mongodb",
3
- "version": "2.17.0",
3
+ "version": "2.18.1",
4
4
  "description": "MongoDB provider for unchained platform",
5
5
  "main": "lib/mongodb-index.js",
6
6
  "exports": {
@@ -31,16 +31,16 @@
31
31
  },
32
32
  "homepage": "https://github.com/unchainedshop/unchained#readme",
33
33
  "dependencies": {
34
- "@unchainedshop/utils": "^2.17.0"
34
+ "@unchainedshop/utils": "^2.18.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@mongodb-js/zstd": "^1.2.2",
38
- "mongodb": "^6.10.0"
37
+ "@mongodb-js/zstd": "^2.0.0",
38
+ "mongodb": "^6.12.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@types/node": "^22.9.0",
42
- "@unchainedshop/types": "^2.17.0",
41
+ "@types/node": "^22.10.2",
42
+ "@unchainedshop/types": "^2.18.0",
43
43
  "jest": "^29.7.0",
44
- "typescript": "^5.6.3"
44
+ "typescript": "^5.7.2"
45
45
  }
46
46
  }
@@ -2,6 +2,10 @@ export function emailRegexOperator(string) {
2
2
  if (typeof string !== 'string') {
3
3
  throw new TypeError('Expected a string');
4
4
  }
5
- const escappedEmail = string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
6
- return { $regex: new RegExp(`${escappedEmail}$`, 'i') };
5
+ const escapped = string.trim().replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
6
+
7
+ if (escapped.length === 0) throw new Error('String is empty after trimming');
8
+ if (escapped.length > 255) throw new Error('String exceeds maximum allowed length');
9
+
10
+ return { $regex: new RegExp(`^${escapped}$`, 'i') };
7
11
  }