ueberdb2 3.0.0 → 3.0.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.
|
@@ -62,7 +62,7 @@ jobs:
|
|
|
62
62
|
- uses: actions/checkout@v3
|
|
63
63
|
- uses: actions/setup-node@v3
|
|
64
64
|
with:
|
|
65
|
-
node-version:
|
|
65
|
+
node-version: 14
|
|
66
66
|
- run: npm ci
|
|
67
67
|
# Optional dependencies must be installed manually.
|
|
68
68
|
- run: npm i sqlite3
|
|
@@ -92,7 +92,7 @@ jobs:
|
|
|
92
92
|
-
|
|
93
93
|
uses: actions/setup-node@v3
|
|
94
94
|
with:
|
|
95
|
-
node-version:
|
|
95
|
+
node-version: 14
|
|
96
96
|
registry-url: https://registry.npmjs.org/
|
|
97
97
|
cache: 'npm'
|
|
98
98
|
# This is required if the package has a prepare script that uses something
|
package/CHANGELOG.md
CHANGED
package/lib/AbstractDatabase.js
CHANGED
|
@@ -4,6 +4,11 @@ const logging = require('./logging');
|
|
|
4
4
|
|
|
5
5
|
const nullLogger = logging.normalizeLogger(null);
|
|
6
6
|
|
|
7
|
+
// Format: All characters match themselves except * matches any zero or more characters. No
|
|
8
|
+
// backslash escaping is supported, so it is impossible to create a pattern that matches only the
|
|
9
|
+
// '*' character.
|
|
10
|
+
const simpleGlobToRegExp = (s) => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
11
|
+
|
|
7
12
|
module.exports = class AbstractDatabase {
|
|
8
13
|
constructor() {
|
|
9
14
|
if (new.target === module.exports) {
|
|
@@ -19,13 +24,8 @@ module.exports = class AbstractDatabase {
|
|
|
19
24
|
* For findKey regex. Used by document dbs like mongodb or dirty.
|
|
20
25
|
*/
|
|
21
26
|
createFindRegex(key, notKey) {
|
|
22
|
-
let regex =
|
|
23
|
-
|
|
24
|
-
regex = `(?=^${key}$)`;
|
|
25
|
-
if (notKey != null) {
|
|
26
|
-
notKey = notKey.replace(/\*/g, '.*');
|
|
27
|
-
regex += `(?!${notKey}$)`;
|
|
28
|
-
}
|
|
27
|
+
let regex = `^(?=${simpleGlobToRegExp(key)}$)`;
|
|
28
|
+
if (notKey != null) regex += `(?!${simpleGlobToRegExp(notKey)}$)`;
|
|
29
29
|
return new RegExp(regex);
|
|
30
30
|
}
|
|
31
31
|
|