@unchainedshop/plugins 2.1.0 → 2.1.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,4 +1,5 @@
|
|
|
1
1
|
import { FilterDirector, FilterAdapter } from '@unchainedshop/core-filters';
|
|
2
|
+
import escapeStringRegexp from 'escape-string-regexp';
|
|
2
3
|
const { AMAZON_DOCUMENTDB_COMPAT_MODE } = process.env;
|
|
3
4
|
const LocalSearch = {
|
|
4
5
|
...FilterAdapter,
|
|
@@ -17,12 +18,12 @@ const LocalSearch = {
|
|
|
17
18
|
const selector = AMAZON_DOCUMENTDB_COMPAT_MODE
|
|
18
19
|
? {
|
|
19
20
|
$or: [
|
|
20
|
-
{ title: { $regex: `${queryString}`, $options: 'im' } },
|
|
21
|
-
{ subtitle: { $regex: `${queryString}`, $options: 'im' } },
|
|
22
|
-
{ vendor: { $regex: `${queryString}`, $options: 'im' } },
|
|
23
|
-
{ brand: { $regex: `${queryString}`, $options: 'im' } },
|
|
24
|
-
{ description: { $regex: `${queryString}`, $options: 'im' } },
|
|
25
|
-
{ labels: { $regex: `${queryString}`, $options: 'im' } },
|
|
21
|
+
{ title: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
22
|
+
{ subtitle: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
23
|
+
{ vendor: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
24
|
+
{ brand: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
25
|
+
{ description: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
26
|
+
{ labels: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
26
27
|
],
|
|
27
28
|
}
|
|
28
29
|
: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-search.js","sourceRoot":"","sources":["../../src/filters/local-search.ts"],"names":[],"mappings":"AAAA,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AAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE;oBAC7E,UAAU,EAAE;wBACV,YAAY,EAAE,CAAC;qBAChB;iBACF,CAAC,CAAC;gBAEH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC;YAC7D,CAAC;YAED,KAAK,CAAC,uBAAuB,CAAC,IAAI;gBAChC,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;gBAE1D,IAAI,WAAW,IAAI,CAAC,SAAS,EAAE;oBAC7B,0CAA0C;oBAC1C,qBAAqB;oBACrB,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;oBAC7B,IAAI,QAAQ,EAAE,GAAG,EAAE;wBACjB,0BAA0B;wBAC1B,OAAO,QAAQ,CAAC,GAAG,CAAC;qBACrB;oBACD,IAAI,CAAC,eAAe,EAAE;wBACpB,8BAA8B;wBAC9B,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;qBAC1B;oBACD,OAAO,QAAQ,CAAC;iBACjB;gBAED,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,WAAW,CAAC;AAE3B,cAAc,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/plugins",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "lib/plugins-index.js",
|
|
5
5
|
"types": "lib/plugins-index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -72,32 +72,33 @@
|
|
|
72
72
|
},
|
|
73
73
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
74
74
|
"optionalDependencies": {
|
|
75
|
+
"escape-string-regexp": "^5.0.0",
|
|
75
76
|
"express": "^4.18.2"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
|
-
"@types/node": "^18.
|
|
79
|
-
"@unchainedshop/api": "^2.1.
|
|
80
|
-
"@unchainedshop/core-delivery": "^2.1.
|
|
81
|
-
"@unchainedshop/core-enrollments": "^2.1.
|
|
82
|
-
"@unchainedshop/core-filters": "^2.1.
|
|
83
|
-
"@unchainedshop/core-messaging": "^2.1.
|
|
84
|
-
"@unchainedshop/core-orders": "^2.1.
|
|
85
|
-
"@unchainedshop/core-payment": "^2.1.
|
|
86
|
-
"@unchainedshop/core-products": "^2.1.
|
|
87
|
-
"@unchainedshop/core-quotations": "^2.1.
|
|
88
|
-
"@unchainedshop/core-warehousing": "^2.1.
|
|
89
|
-
"@unchainedshop/core-worker": "^2.1.
|
|
90
|
-
"@unchainedshop/events": "^2.1.
|
|
91
|
-
"@unchainedshop/file-upload": "^2.1.
|
|
92
|
-
"@unchainedshop/logger": "^2.1.
|
|
93
|
-
"@unchainedshop/types": "^2.1.
|
|
94
|
-
"@unchainedshop/utils": "^2.1.
|
|
79
|
+
"@types/node": "^18.15.11",
|
|
80
|
+
"@unchainedshop/api": "^2.1.1",
|
|
81
|
+
"@unchainedshop/core-delivery": "^2.1.1",
|
|
82
|
+
"@unchainedshop/core-enrollments": "^2.1.1",
|
|
83
|
+
"@unchainedshop/core-filters": "^2.1.1",
|
|
84
|
+
"@unchainedshop/core-messaging": "^2.1.1",
|
|
85
|
+
"@unchainedshop/core-orders": "^2.1.1",
|
|
86
|
+
"@unchainedshop/core-payment": "^2.1.1",
|
|
87
|
+
"@unchainedshop/core-products": "^2.1.1",
|
|
88
|
+
"@unchainedshop/core-quotations": "^2.1.1",
|
|
89
|
+
"@unchainedshop/core-warehousing": "^2.1.1",
|
|
90
|
+
"@unchainedshop/core-worker": "^2.1.1",
|
|
91
|
+
"@unchainedshop/events": "^2.1.1",
|
|
92
|
+
"@unchainedshop/file-upload": "^2.1.1",
|
|
93
|
+
"@unchainedshop/logger": "^2.1.1",
|
|
94
|
+
"@unchainedshop/types": "^2.1.1",
|
|
95
|
+
"@unchainedshop/utils": "^2.1.1",
|
|
95
96
|
"bluebird": "^3.7.2",
|
|
96
97
|
"event-iterator": "^2.0.0",
|
|
97
98
|
"express": "^4.18.2",
|
|
98
|
-
"jest": "^29.
|
|
99
|
+
"jest": "^29.5.0",
|
|
99
100
|
"JSONStream": "^1.3.5",
|
|
100
|
-
"minio": "^7.0.
|
|
101
|
+
"minio": "^7.0.33",
|
|
101
102
|
"mongodb": "^4.14.0",
|
|
102
103
|
"node-sheets": "^1.2.0",
|
|
103
104
|
"nodemailer": "^6.9.1",
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
"redis": "^4.6.5",
|
|
106
107
|
"request": "^2.88.2",
|
|
107
108
|
"stripe": "^10.17.0",
|
|
108
|
-
"ts-jest": "^29.0
|
|
109
|
+
"ts-jest": "^29.1.0",
|
|
109
110
|
"typescript": "^4.9.5",
|
|
110
111
|
"web-push": "^3.5.0",
|
|
111
112
|
"xml-js": "^1.6.11",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FilterDirector, FilterAdapter } from '@unchainedshop/core-filters';
|
|
2
2
|
import { IFilterAdapter } from '@unchainedshop/types/filters.js';
|
|
3
3
|
import { Query } from '@unchainedshop/types/common.js';
|
|
4
|
+
import escapeStringRegexp from 'escape-string-regexp';
|
|
4
5
|
|
|
5
6
|
const { AMAZON_DOCUMENTDB_COMPAT_MODE } = process.env;
|
|
6
7
|
|
|
@@ -25,12 +26,12 @@ const LocalSearch: IFilterAdapter = {
|
|
|
25
26
|
const selector: Query = AMAZON_DOCUMENTDB_COMPAT_MODE
|
|
26
27
|
? {
|
|
27
28
|
$or: [
|
|
28
|
-
{ title: { $regex: `${queryString}`, $options: 'im' } },
|
|
29
|
-
{ subtitle: { $regex: `${queryString}`, $options: 'im' } },
|
|
30
|
-
{ vendor: { $regex: `${queryString}`, $options: 'im' } },
|
|
31
|
-
{ brand: { $regex: `${queryString}`, $options: 'im' } },
|
|
32
|
-
{ description: { $regex: `${queryString}`, $options: 'im' } },
|
|
33
|
-
{ labels: { $regex: `${queryString}`, $options: 'im' } },
|
|
29
|
+
{ title: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
30
|
+
{ subtitle: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
31
|
+
{ vendor: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
32
|
+
{ brand: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
33
|
+
{ description: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
34
|
+
{ labels: { $regex: `${escapeStringRegexp(queryString)}`, $options: 'im' } },
|
|
34
35
|
],
|
|
35
36
|
}
|
|
36
37
|
: {
|