@vendure/elasticsearch-plugin 3.2.0 → 3.2.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/LICENSE.md +42 -42
- package/README.md +9 -9
- package/lib/src/api/api-extensions.js +89 -89
- package/package.json +8 -4
package/LICENSE.md
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
# License
|
|
2
|
-
Copyright (C) Vendure GmbH
|
|
3
|
-
|
|
4
|
-
This software is available under two different licenses:
|
|
5
|
-
* GNU General Public License version 3 (GPLv3) as Vendure Community Edition
|
|
6
|
-
* Vendure Commercial License (VCL)
|
|
7
|
-
|
|
8
|
-
The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
|
|
9
|
-
|
|
10
|
-
## GNU General Public License version 3 (GPLv3)
|
|
11
|
-
|
|
12
|
-
If you decide to choose the GPLv3 license, you must comply with the following terms:
|
|
13
|
-
|
|
14
|
-
This program is free software: you can redistribute it and/or modify
|
|
15
|
-
it under the terms of the GNU General Public License as published by
|
|
16
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
17
|
-
(at your option) any later version.
|
|
18
|
-
|
|
19
|
-
This program is distributed in the hope that it will be useful,
|
|
20
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
-
GNU General Public License for more details.
|
|
23
|
-
|
|
24
|
-
You should have received a copy of the GNU General Public License
|
|
25
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
26
|
-
|
|
27
|
-
Additional permission under GNU GPL version 3 section 7:
|
|
28
|
-
|
|
29
|
-
An additional exception under section 7 of the GPL is included in the plugin-exception.txt file,
|
|
30
|
-
which allows you to distribute Vendure plugins (i.e. extensions) under a different license.
|
|
31
|
-
|
|
32
|
-
## Vendure Commercial License (VCL)
|
|
33
|
-
|
|
34
|
-
Alternatively, commercial and supported versions of the program - also known as
|
|
35
|
-
Commercial Distributions - must be used in accordance with the terms and conditions
|
|
36
|
-
contained in a separate written agreement between you and Vendure GmbH.
|
|
37
|
-
For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
|
|
38
|
-
|
|
39
|
-
Please see also:
|
|
40
|
-
|
|
41
|
-
- [Licensing FAQ - license-faq.md](license/license-faq.md)
|
|
42
|
-
- [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](license/gpl-3.0.txt)
|
|
1
|
+
# License
|
|
2
|
+
Copyright (C) Vendure GmbH
|
|
3
|
+
|
|
4
|
+
This software is available under two different licenses:
|
|
5
|
+
* GNU General Public License version 3 (GPLv3) as Vendure Community Edition
|
|
6
|
+
* Vendure Commercial License (VCL)
|
|
7
|
+
|
|
8
|
+
The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
|
|
9
|
+
|
|
10
|
+
## GNU General Public License version 3 (GPLv3)
|
|
11
|
+
|
|
12
|
+
If you decide to choose the GPLv3 license, you must comply with the following terms:
|
|
13
|
+
|
|
14
|
+
This program is free software: you can redistribute it and/or modify
|
|
15
|
+
it under the terms of the GNU General Public License as published by
|
|
16
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
17
|
+
(at your option) any later version.
|
|
18
|
+
|
|
19
|
+
This program is distributed in the hope that it will be useful,
|
|
20
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
+
GNU General Public License for more details.
|
|
23
|
+
|
|
24
|
+
You should have received a copy of the GNU General Public License
|
|
25
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
26
|
+
|
|
27
|
+
Additional permission under GNU GPL version 3 section 7:
|
|
28
|
+
|
|
29
|
+
An additional exception under section 7 of the GPL is included in the plugin-exception.txt file,
|
|
30
|
+
which allows you to distribute Vendure plugins (i.e. extensions) under a different license.
|
|
31
|
+
|
|
32
|
+
## Vendure Commercial License (VCL)
|
|
33
|
+
|
|
34
|
+
Alternatively, commercial and supported versions of the program - also known as
|
|
35
|
+
Commercial Distributions - must be used in accordance with the terms and conditions
|
|
36
|
+
contained in a separate written agreement between you and Vendure GmbH.
|
|
37
|
+
For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
|
|
38
|
+
|
|
39
|
+
Please see also:
|
|
40
|
+
|
|
41
|
+
- [Licensing FAQ - license-faq.md](license/license-faq.md)
|
|
42
|
+
- [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](license/gpl-3.0.txt)
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Vendure Elasticsearch Plugin
|
|
2
|
-
|
|
3
|
-
The `ElasticsearchPlugin` uses Elasticsearch to power the Vendure product search.
|
|
4
|
-
|
|
5
|
-
**Requires Elasticsearch v7.0 or higher.**
|
|
6
|
-
|
|
7
|
-
`npm install @vendure/elasticsearch-plugin`
|
|
8
|
-
|
|
9
|
-
For documentation, see [docs.vendure.io/reference/core-plugins/elasticsearch-plugin/](https://docs.vendure.io/reference/core-plugins/elasticsearch-plugin/)
|
|
1
|
+
# Vendure Elasticsearch Plugin
|
|
2
|
+
|
|
3
|
+
The `ElasticsearchPlugin` uses Elasticsearch to power the Vendure product search.
|
|
4
|
+
|
|
5
|
+
**Requires Elasticsearch v7.0 or higher.**
|
|
6
|
+
|
|
7
|
+
`npm install @vendure/elasticsearch-plugin`
|
|
8
|
+
|
|
9
|
+
For documentation, see [docs.vendure.io/reference/core-plugins/elasticsearch-plugin/](https://docs.vendure.io/reference/core-plugins/elasticsearch-plugin/)
|
|
@@ -6,46 +6,46 @@ function generateSchemaExtensions(options) {
|
|
|
6
6
|
const customMappingTypes = generateCustomMappingTypes(options);
|
|
7
7
|
const inputExtensions = Object.entries(options.extendSearchInputType || {});
|
|
8
8
|
const sortExtensions = options.extendSearchSortType || [];
|
|
9
|
-
const sortExtensionGql = `
|
|
10
|
-
extend input SearchResultSortParameter {
|
|
11
|
-
${sortExtensions.map(key => `${key}: SortOrder`).join('\n ')}
|
|
9
|
+
const sortExtensionGql = `
|
|
10
|
+
extend input SearchResultSortParameter {
|
|
11
|
+
${sortExtensions.map(key => `${key}: SortOrder`).join('\n ')}
|
|
12
12
|
}`;
|
|
13
|
-
return (0, graphql_tag_1.gql) `
|
|
14
|
-
extend type SearchResponse {
|
|
15
|
-
prices: SearchResponsePriceData!
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
extend type SearchResult {
|
|
19
|
-
inStock: Boolean
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
type SearchResponsePriceData {
|
|
23
|
-
range: PriceRange!
|
|
24
|
-
rangeWithTax: PriceRange!
|
|
25
|
-
buckets: [PriceRangeBucket!]!
|
|
26
|
-
bucketsWithTax: [PriceRangeBucket!]!
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type PriceRangeBucket {
|
|
30
|
-
to: Int!
|
|
31
|
-
count: Int!
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
extend input SearchInput {
|
|
35
|
-
priceRange: PriceRangeInput
|
|
36
|
-
priceRangeWithTax: PriceRangeInput
|
|
37
|
-
inStock: Boolean
|
|
38
|
-
${inputExtensions.map(([name, type]) => `${name}: ${type}`).join('\n ')}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
${sortExtensions.length > 0 ? sortExtensionGql : ''}
|
|
42
|
-
|
|
43
|
-
input PriceRangeInput {
|
|
44
|
-
min: Int!
|
|
45
|
-
max: Int!
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
${customMappingTypes ? customMappingTypes : ''}
|
|
13
|
+
return (0, graphql_tag_1.gql) `
|
|
14
|
+
extend type SearchResponse {
|
|
15
|
+
prices: SearchResponsePriceData!
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
extend type SearchResult {
|
|
19
|
+
inStock: Boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type SearchResponsePriceData {
|
|
23
|
+
range: PriceRange!
|
|
24
|
+
rangeWithTax: PriceRange!
|
|
25
|
+
buckets: [PriceRangeBucket!]!
|
|
26
|
+
bucketsWithTax: [PriceRangeBucket!]!
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type PriceRangeBucket {
|
|
30
|
+
to: Int!
|
|
31
|
+
count: Int!
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
extend input SearchInput {
|
|
35
|
+
priceRange: PriceRangeInput
|
|
36
|
+
priceRangeWithTax: PriceRangeInput
|
|
37
|
+
inStock: Boolean
|
|
38
|
+
${inputExtensions.map(([name, type]) => `${name}: ${type}`).join('\n ')}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${sortExtensions.length > 0 ? sortExtensionGql : ''}
|
|
42
|
+
|
|
43
|
+
input PriceRangeInput {
|
|
44
|
+
min: Int!
|
|
45
|
+
max: Int!
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
${customMappingTypes ? customMappingTypes : ''}
|
|
49
49
|
`;
|
|
50
50
|
}
|
|
51
51
|
function generateCustomMappingTypes(options) {
|
|
@@ -58,89 +58,89 @@ function generateCustomMappingTypes(options) {
|
|
|
58
58
|
let sdl = '';
|
|
59
59
|
if (scriptProductFields.length || scriptVariantFields.length) {
|
|
60
60
|
if (scriptProductFields.length) {
|
|
61
|
-
sdl += `
|
|
62
|
-
type CustomProductScriptFields {
|
|
63
|
-
${scriptProductFields.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
64
|
-
}
|
|
61
|
+
sdl += `
|
|
62
|
+
type CustomProductScriptFields {
|
|
63
|
+
${scriptProductFields.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
64
|
+
}
|
|
65
65
|
`;
|
|
66
66
|
}
|
|
67
67
|
if (scriptVariantFields.length) {
|
|
68
|
-
sdl += `
|
|
69
|
-
type CustomProductVariantScriptFields {
|
|
70
|
-
${scriptVariantFields.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
71
|
-
}
|
|
68
|
+
sdl += `
|
|
69
|
+
type CustomProductVariantScriptFields {
|
|
70
|
+
${scriptVariantFields.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
71
|
+
}
|
|
72
72
|
`;
|
|
73
73
|
}
|
|
74
74
|
if (scriptProductFields.length && scriptVariantFields.length) {
|
|
75
|
-
sdl += `
|
|
76
|
-
union CustomScriptFields = CustomProductScriptFields | CustomProductVariantScriptFields
|
|
77
|
-
|
|
78
|
-
extend type SearchResult {
|
|
79
|
-
customScriptFields: CustomScriptFields!
|
|
80
|
-
}
|
|
75
|
+
sdl += `
|
|
76
|
+
union CustomScriptFields = CustomProductScriptFields | CustomProductVariantScriptFields
|
|
77
|
+
|
|
78
|
+
extend type SearchResult {
|
|
79
|
+
customScriptFields: CustomScriptFields!
|
|
80
|
+
}
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
else if (scriptProductFields.length) {
|
|
84
|
-
sdl += `
|
|
85
|
-
extend type SearchResult {
|
|
86
|
-
customScriptFields: CustomProductScriptFields!
|
|
87
|
-
}
|
|
84
|
+
sdl += `
|
|
85
|
+
extend type SearchResult {
|
|
86
|
+
customScriptFields: CustomProductScriptFields!
|
|
87
|
+
}
|
|
88
88
|
`;
|
|
89
89
|
}
|
|
90
90
|
else if (scriptVariantFields.length) {
|
|
91
|
-
sdl += `
|
|
92
|
-
extend type SearchResult {
|
|
93
|
-
customScriptFields: CustomProductVariantScriptFields!
|
|
94
|
-
}
|
|
91
|
+
sdl += `
|
|
92
|
+
extend type SearchResult {
|
|
93
|
+
customScriptFields: CustomProductVariantScriptFields!
|
|
94
|
+
}
|
|
95
95
|
`;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
if (productMappings.length || variantMappings.length) {
|
|
99
99
|
if (productMappings.length) {
|
|
100
|
-
sdl += `
|
|
101
|
-
type CustomProductMappings {
|
|
102
|
-
${productMappings.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
103
|
-
}
|
|
100
|
+
sdl += `
|
|
101
|
+
type CustomProductMappings {
|
|
102
|
+
${productMappings.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
103
|
+
}
|
|
104
104
|
`;
|
|
105
105
|
}
|
|
106
106
|
if (variantMappings.length) {
|
|
107
|
-
sdl += `
|
|
108
|
-
type CustomProductVariantMappings {
|
|
109
|
-
${variantMappings.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
110
|
-
}
|
|
107
|
+
sdl += `
|
|
108
|
+
type CustomProductVariantMappings {
|
|
109
|
+
${variantMappings.map(([name, def]) => `${name}: ${def.graphQlType}`).join('\n')}
|
|
110
|
+
}
|
|
111
111
|
`;
|
|
112
112
|
}
|
|
113
113
|
if (productMappings.length && variantMappings.length) {
|
|
114
|
-
sdl += `
|
|
115
|
-
union CustomMappings = CustomProductMappings | CustomProductVariantMappings
|
|
116
|
-
|
|
117
|
-
extend type SearchResult {
|
|
118
|
-
customMappings: CustomMappings! @deprecated(reason: "Use customProductMappings or customProductVariantMappings")
|
|
119
|
-
customProductMappings: CustomProductMappings!
|
|
120
|
-
customProductVariantMappings: CustomProductVariantMappings!
|
|
121
|
-
}
|
|
114
|
+
sdl += `
|
|
115
|
+
union CustomMappings = CustomProductMappings | CustomProductVariantMappings
|
|
116
|
+
|
|
117
|
+
extend type SearchResult {
|
|
118
|
+
customMappings: CustomMappings! @deprecated(reason: "Use customProductMappings or customProductVariantMappings")
|
|
119
|
+
customProductMappings: CustomProductMappings!
|
|
120
|
+
customProductVariantMappings: CustomProductVariantMappings!
|
|
121
|
+
}
|
|
122
122
|
`;
|
|
123
123
|
}
|
|
124
124
|
else if (productMappings.length) {
|
|
125
|
-
sdl += `
|
|
126
|
-
extend type SearchResult {
|
|
127
|
-
customMappings: CustomProductMappings! @deprecated(reason: "Use customProductMappings or customProductVariantMappings")
|
|
128
|
-
customProductMappings: CustomProductMappings!
|
|
129
|
-
}
|
|
125
|
+
sdl += `
|
|
126
|
+
extend type SearchResult {
|
|
127
|
+
customMappings: CustomProductMappings! @deprecated(reason: "Use customProductMappings or customProductVariantMappings")
|
|
128
|
+
customProductMappings: CustomProductMappings!
|
|
129
|
+
}
|
|
130
130
|
`;
|
|
131
131
|
}
|
|
132
132
|
else if (variantMappings.length) {
|
|
133
|
-
sdl += `
|
|
134
|
-
extend type SearchResult {
|
|
135
|
-
customMappings: CustomProductVariantMappings! @deprecated(reason: "Use customProductMappings or customProductVariantMappings")
|
|
136
|
-
customProductVariantMappings: CustomProductVariantMappings!
|
|
137
|
-
}
|
|
133
|
+
sdl += `
|
|
134
|
+
extend type SearchResult {
|
|
135
|
+
customMappings: CustomProductVariantMappings! @deprecated(reason: "Use customProductMappings or customProductVariantMappings")
|
|
136
|
+
customProductVariantMappings: CustomProductVariantMappings!
|
|
137
|
+
}
|
|
138
138
|
`;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
return sdl.length
|
|
142
|
-
? (0, graphql_tag_1.gql) `
|
|
143
|
-
${sdl}
|
|
142
|
+
? (0, graphql_tag_1.gql) `
|
|
143
|
+
${sdl}
|
|
144
144
|
`
|
|
145
145
|
: undefined;
|
|
146
146
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/elasticsearch-plugin",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib/**/*"
|
|
9
9
|
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/vendure-ecommerce/vendure"
|
|
13
|
+
},
|
|
10
14
|
"scripts": {
|
|
11
15
|
"watch": "tsc -p ./tsconfig.build.json --watch",
|
|
12
16
|
"build": "rimraf lib && tsc -p ./tsconfig.build.json",
|
|
@@ -26,10 +30,10 @@
|
|
|
26
30
|
"fast-deep-equal": "^3.1.3"
|
|
27
31
|
},
|
|
28
32
|
"devDependencies": {
|
|
29
|
-
"@vendure/common": "
|
|
30
|
-
"@vendure/core": "
|
|
33
|
+
"@vendure/common": "3.2.2",
|
|
34
|
+
"@vendure/core": "3.2.2",
|
|
31
35
|
"rimraf": "^5.0.5",
|
|
32
36
|
"typescript": "5.8.2"
|
|
33
37
|
},
|
|
34
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "8729e7f8f028be556543c8e971e750228e516919"
|
|
35
39
|
}
|