dobo 2.37.1 → 2.37.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/index.js CHANGED
@@ -613,12 +613,33 @@ async function factory (pkgName) {
613
613
  }
614
614
 
615
615
  reviveRegexInJson = (input, returnObject = true) => {
616
- const { isPlainObject } = this.app.lib._
616
+ const { isPlainObject, isArray } = this.app.lib._
617
617
  if (isPlainObject(input)) input = JSON.stringify(input)
618
618
  const result = JSON.parse(input, (key, value) => {
619
- if (Array.isArray(value) && value[0] === '__REGEXP__') return new RegExp(value[1], value[2])
619
+ if (Array.isArray(value) && value[0] === '__REGEXP__') {
620
+ return { $regex: new RegExp(value[1], value[2]) }
621
+ }
620
622
  return value
621
623
  })
624
+
625
+ const cleanRegex = (obj) => {
626
+ const keys = Object.keys(obj)
627
+ keys.forEach(k => {
628
+ const v = obj[k]
629
+ if (isPlainObject(v)) {
630
+ if (k === '$regex' && isPlainObject(v) && v.$regex) obj[k] = v.$regex
631
+ else obj[k] = cleanRegex(v)
632
+ } else if (isArray(v)) {
633
+ v.forEach((i, idx) => {
634
+ if (isPlainObject(i) && i.$regex && i.$regex.$regex) obj[k][idx] = i.$regex.$regex
635
+ else obj[k][idx] = cleanRegex(i)
636
+ })
637
+ }
638
+ })
639
+ return obj
640
+ }
641
+ cleanRegex(result)
642
+
622
643
  return returnObject ? result : JSON.stringify(result)
623
644
  }
624
645
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "2.37.1",
3
+ "version": "2.37.2",
4
4
  "description": "DBMS for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/ardhi/dobo#readme",
34
34
  "dependencies": {
35
- "@tryghost/nql": "^0.12.7",
35
+ "@tryghost/nql": "^0.13.2",
36
36
  "joi": "^18.0.2",
37
37
  "mingo": "^6.5.1",
38
38
  "ulid": "^3.0.2",
package/wiki/CHANGES.md CHANGED
@@ -5,6 +5,7 @@
5
5
  - [2.37.1] Bug fix in `adapter.js` to pass options when calling `getRecord()`
6
6
  - [2.37.1] Bug fix in `model._simpleLookup()` to return `null` if query string is not right
7
7
  - [2.37.1] Bug fix in `model.sanitizeFixture()` to not sanitize value that is `null` or `undefined`
8
+ - [2.37.2] Bug fix in `reviveRegexInJson()` when handling with regex
8
9
 
9
10
  ## 2026-08-06
10
11