@vendure/elasticsearch-plugin 2.0.0-next.8 → 2.0.0

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,26 +1,26 @@
1
1
  import { Coordinate, CurrencyCode, LanguageCode, PriceRange, SearchInput, SearchResponse, SearchResult } from '@vendure/common/lib/generated-types';
2
2
  import { ID, JsonCompatible } from '@vendure/common/lib/shared-types';
3
3
  import { Asset, SerializedRequestContext } from '@vendure/core';
4
- export declare type ElasticSearchResult = SearchResult & {
4
+ export type ElasticSearchResult = SearchResult & {
5
5
  inStock: boolean;
6
6
  };
7
- export declare type ElasticSearchInput = SearchInput & {
7
+ export type ElasticSearchInput = SearchInput & {
8
8
  priceRange?: PriceRange;
9
9
  priceRangeWithTax?: PriceRange;
10
10
  inStock?: boolean;
11
11
  [extendedInputField: string]: any;
12
12
  };
13
- export declare type ElasticSearchResponse = SearchResponse & {
13
+ export type ElasticSearchResponse = SearchResponse & {
14
14
  priceRange: SearchPriceData;
15
15
  items: ElasticSearchResult[];
16
16
  };
17
- export declare type SearchPriceData = {
17
+ export type SearchPriceData = {
18
18
  range: PriceRange;
19
19
  rangeWithTax: PriceRange;
20
20
  buckets: PriceRangeBucket[];
21
21
  bucketsWithTax: PriceRangeBucket[];
22
22
  };
23
- export declare type PriceRangeBucket = {
23
+ export type PriceRangeBucket = {
24
24
  to: number;
25
25
  count: number;
26
26
  };
@@ -36,17 +36,17 @@ export declare enum ElasticSearchSortMode {
36
36
  /** Use the median of all values as sort value. Only applicable for number based array fields */
37
37
  MEDIAN = "median"
38
38
  }
39
- export declare type ElasticSearchSortParameter = {
39
+ export type ElasticSearchSortParameter = {
40
40
  missing?: '_last' | '_first' | string;
41
41
  mode?: ElasticSearchSortMode;
42
42
  order: 'asc' | 'desc';
43
43
  } & {
44
44
  [key: string]: any;
45
45
  };
46
- export declare type ElasticSearchSortInput = Array<{
46
+ export type ElasticSearchSortInput = Array<{
47
47
  [key: string]: ElasticSearchSortParameter;
48
48
  }>;
49
- export declare type IndexItemAssets = {
49
+ export type IndexItemAssets = {
50
50
  productAssetId: ID | undefined;
51
51
  productPreview: string;
52
52
  productPreviewFocalPoint: Coordinate | undefined;
@@ -54,7 +54,7 @@ export declare type IndexItemAssets = {
54
54
  productVariantPreview: string;
55
55
  productVariantPreviewFocalPoint: Coordinate | undefined;
56
56
  };
57
- export declare type VariantIndexItem = Omit<SearchResult, 'score' | 'price' | 'priceWithTax' | 'productAsset' | 'productVariantAsset'> & IndexItemAssets & {
57
+ export type VariantIndexItem = Omit<SearchResult, 'score' | 'price' | 'priceWithTax' | 'productAsset' | 'productVariantAsset'> & IndexItemAssets & {
58
58
  channelId: ID;
59
59
  languageCode: LanguageCode;
60
60
  price: number;
@@ -74,7 +74,7 @@ export declare type VariantIndexItem = Omit<SearchResult, 'score' | 'price' | 'p
74
74
  inStock: boolean;
75
75
  productInStock: boolean;
76
76
  };
77
- export declare type ProductIndexItem = IndexItemAssets & {
77
+ export type ProductIndexItem = IndexItemAssets & {
78
78
  sku: string;
79
79
  slug: string;
80
80
  productId: ID;
@@ -98,7 +98,7 @@ export declare type ProductIndexItem = IndexItemAssets & {
98
98
  priceWithTaxMax: number;
99
99
  [customMapping: string]: any;
100
100
  };
101
- export declare type SearchHit<T> = {
101
+ export type SearchHit<T> = {
102
102
  _id: string;
103
103
  _index: string;
104
104
  _score: number;
@@ -106,7 +106,7 @@ export declare type SearchHit<T> = {
106
106
  _type: string;
107
107
  fields?: any;
108
108
  };
109
- export declare type SearchRequestBody = {
109
+ export type SearchRequestBody = {
110
110
  query?: any;
111
111
  sort?: any[];
112
112
  from?: number;
@@ -117,7 +117,7 @@ export declare type SearchRequestBody = {
117
117
  _source?: boolean;
118
118
  script_fields?: any;
119
119
  };
120
- export declare type SearchResponseBody<T = any> = {
120
+ export type SearchResponseBody<T = any> = {
121
121
  hits: {
122
122
  hits: Array<SearchHit<T>>;
123
123
  total: {
@@ -149,17 +149,17 @@ export declare type SearchResponseBody<T = any> = {
149
149
  };
150
150
  };
151
151
  };
152
- export declare type BulkOperationType = 'index' | 'update' | 'delete';
153
- export declare type BulkOperation = {
152
+ export type BulkOperationType = 'index' | 'update' | 'delete';
153
+ export type BulkOperation = {
154
154
  [operation in BulkOperationType]?: {
155
155
  _id: string;
156
156
  };
157
157
  };
158
- export declare type BulkOperationDoc<T> = T | {
158
+ export type BulkOperationDoc<T> = T | {
159
159
  doc: T;
160
160
  doc_as_upsert?: boolean;
161
161
  };
162
- export declare type BulkResponseResult = {
162
+ export type BulkResponseResult = {
163
163
  [operation in BulkOperationType]?: {
164
164
  _index: string;
165
165
  _type: string;
@@ -177,7 +177,7 @@ export declare type BulkResponseResult = {
177
177
  error?: any;
178
178
  };
179
179
  };
180
- export declare type BulkResponseBody = {
180
+ export type BulkResponseBody = {
181
181
  took: number;
182
182
  errors: boolean;
183
183
  items: BulkResponseResult[];
@@ -187,14 +187,14 @@ export interface ReindexMessageResponse {
187
187
  completed: number;
188
188
  duration: number;
189
189
  }
190
- export declare type ReindexMessageData = {
190
+ export type ReindexMessageData = {
191
191
  ctx: SerializedRequestContext;
192
192
  };
193
- export declare type UpdateProductMessageData = {
193
+ export type UpdateProductMessageData = {
194
194
  ctx: SerializedRequestContext;
195
195
  productId: ID;
196
196
  };
197
- export declare type UpdateVariantMessageData = {
197
+ export type UpdateVariantMessageData = {
198
198
  ctx: SerializedRequestContext;
199
199
  variantIds: ID[];
200
200
  };
@@ -207,7 +207,7 @@ export interface ProductChannelMessageData {
207
207
  productId: ID;
208
208
  channelId: ID;
209
209
  }
210
- export declare type VariantChannelMessageData = {
210
+ export type VariantChannelMessageData = {
211
211
  ctx: SerializedRequestContext;
212
212
  productVariantId: ID;
213
213
  channelId: ID;
@@ -216,47 +216,47 @@ export interface UpdateAssetMessageData {
216
216
  ctx: SerializedRequestContext;
217
217
  asset: JsonCompatible<Required<Asset>>;
218
218
  }
219
- declare type Maybe<T> = T | undefined;
220
- declare type NamedJobData<Type extends string, MessageData> = {
219
+ type Maybe<T> = T | undefined;
220
+ type NamedJobData<Type extends string, MessageData> = {
221
221
  type: Type;
222
222
  } & MessageData;
223
- export declare type ReindexJobData = NamedJobData<'reindex', ReindexMessageData>;
224
- declare type UpdateProductJobData = NamedJobData<'update-product', UpdateProductMessageData>;
225
- declare type UpdateVariantsJobData = NamedJobData<'update-variants', UpdateVariantMessageData>;
226
- declare type DeleteProductJobData = NamedJobData<'delete-product', UpdateProductMessageData>;
227
- declare type DeleteVariantJobData = NamedJobData<'delete-variant', UpdateVariantMessageData>;
228
- declare type UpdateVariantsByIdJobData = NamedJobData<'update-variants-by-id', UpdateVariantsByIdMessageData>;
229
- declare type UpdateAssetJobData = NamedJobData<'update-asset', UpdateAssetMessageData>;
230
- declare type DeleteAssetJobData = NamedJobData<'delete-asset', UpdateAssetMessageData>;
231
- declare type AssignProductToChannelJobData = NamedJobData<'assign-product-to-channel', ProductChannelMessageData>;
232
- declare type RemoveProductFromChannelJobData = NamedJobData<'remove-product-from-channel', ProductChannelMessageData>;
233
- declare type AssignVariantToChannelJobData = NamedJobData<'assign-variant-to-channel', VariantChannelMessageData>;
234
- declare type RemoveVariantFromChannelJobData = NamedJobData<'remove-variant-from-channel', VariantChannelMessageData>;
235
- export declare type UpdateIndexQueueJobData = ReindexJobData | UpdateProductJobData | UpdateVariantsJobData | DeleteProductJobData | DeleteVariantJobData | UpdateVariantsByIdJobData | UpdateAssetJobData | DeleteAssetJobData | AssignProductToChannelJobData | RemoveProductFromChannelJobData | AssignVariantToChannelJobData | RemoveVariantFromChannelJobData;
236
- export declare type GraphQlPrimitive = 'ID' | 'String' | 'Int' | 'Float' | 'Boolean';
237
- export declare type PrimitiveTypeVariations<T extends GraphQlPrimitive> = T | `${T}!` | `[${T}!]` | `[${T}!]!`;
238
- declare type GraphQlPermittedReturnType = PrimitiveTypeVariations<GraphQlPrimitive>;
239
- declare type CustomMappingDefinition<Args extends any[], T extends GraphQlPermittedReturnType, R> = {
223
+ export type ReindexJobData = NamedJobData<'reindex', ReindexMessageData>;
224
+ type UpdateProductJobData = NamedJobData<'update-product', UpdateProductMessageData>;
225
+ type UpdateVariantsJobData = NamedJobData<'update-variants', UpdateVariantMessageData>;
226
+ type DeleteProductJobData = NamedJobData<'delete-product', UpdateProductMessageData>;
227
+ type DeleteVariantJobData = NamedJobData<'delete-variant', UpdateVariantMessageData>;
228
+ type UpdateVariantsByIdJobData = NamedJobData<'update-variants-by-id', UpdateVariantsByIdMessageData>;
229
+ type UpdateAssetJobData = NamedJobData<'update-asset', UpdateAssetMessageData>;
230
+ type DeleteAssetJobData = NamedJobData<'delete-asset', UpdateAssetMessageData>;
231
+ type AssignProductToChannelJobData = NamedJobData<'assign-product-to-channel', ProductChannelMessageData>;
232
+ type RemoveProductFromChannelJobData = NamedJobData<'remove-product-from-channel', ProductChannelMessageData>;
233
+ type AssignVariantToChannelJobData = NamedJobData<'assign-variant-to-channel', VariantChannelMessageData>;
234
+ type RemoveVariantFromChannelJobData = NamedJobData<'remove-variant-from-channel', VariantChannelMessageData>;
235
+ export type UpdateIndexQueueJobData = ReindexJobData | UpdateProductJobData | UpdateVariantsJobData | DeleteProductJobData | DeleteVariantJobData | UpdateVariantsByIdJobData | UpdateAssetJobData | DeleteAssetJobData | AssignProductToChannelJobData | RemoveProductFromChannelJobData | AssignVariantToChannelJobData | RemoveVariantFromChannelJobData;
236
+ export type GraphQlPrimitive = 'ID' | 'String' | 'Int' | 'Float' | 'Boolean';
237
+ export type PrimitiveTypeVariations<T extends GraphQlPrimitive> = T | `${T}!` | `[${T}!]` | `[${T}!]!`;
238
+ type GraphQlPermittedReturnType = PrimitiveTypeVariations<GraphQlPrimitive>;
239
+ type CustomMappingDefinition<Args extends any[], T extends GraphQlPermittedReturnType, R> = {
240
240
  graphQlType: T;
241
241
  public?: boolean;
242
242
  valueFn: (...args: Args) => R;
243
243
  };
244
- declare type TypeVariationMap<GqlType extends GraphQlPrimitive, TsType> = {
244
+ type TypeVariationMap<GqlType extends GraphQlPrimitive, TsType> = {
245
245
  [Key in PrimitiveTypeVariations<GqlType>]: Key extends `[${string}!]!` ? TsType[] : Key extends `[${string}!]` ? Maybe<TsType[]> : Key extends `${string}!` ? TsType : Maybe<TsType>;
246
246
  };
247
- declare type GraphQlTypeMap = TypeVariationMap<'ID', ID> & TypeVariationMap<'String', string> & TypeVariationMap<'Int', number> & TypeVariationMap<'Float', number> & TypeVariationMap<'Boolean', boolean>;
248
- export declare type CustomMapping<Args extends any[]> = {
247
+ type GraphQlTypeMap = TypeVariationMap<'ID', ID> & TypeVariationMap<'String', string> & TypeVariationMap<'Int', number> & TypeVariationMap<'Float', number> & TypeVariationMap<'Boolean', boolean>;
248
+ export type CustomMapping<Args extends any[]> = {
249
249
  [Type in GraphQlPermittedReturnType]: CustomMappingDefinition<Args, Type, GraphQlTypeMap[Type]>;
250
250
  }[GraphQlPermittedReturnType];
251
- export declare type CustomScriptContext = 'product' | 'variant' | 'both';
252
- declare type CustomScriptMappingDefinition<Args extends any[], T extends GraphQlPermittedReturnType> = {
251
+ export type CustomScriptContext = 'product' | 'variant' | 'both';
252
+ type CustomScriptMappingDefinition<Args extends any[], T extends GraphQlPermittedReturnType> = {
253
253
  graphQlType: T;
254
254
  context: CustomScriptContext;
255
255
  scriptFn: (...args: Args) => {
256
256
  script: string;
257
257
  };
258
258
  };
259
- export declare type CustomScriptMapping<Args extends any[]> = {
259
+ export type CustomScriptMapping<Args extends any[]> = {
260
260
  [Type in GraphQlPermittedReturnType]: CustomScriptMappingDefinition<Args, Type>;
261
261
  }[GraphQlPermittedReturnType];
262
262
  export {};
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
1
  {
2
- "name": "@vendure/elasticsearch-plugin",
3
- "version": "2.0.0-next.8",
4
- "license": "MIT",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "files": [
8
- "lib/**/*"
9
- ],
10
- "scripts": {
11
- "watch": "tsc -p ./tsconfig.build.json --watch",
12
- "build": "rimraf lib && tsc -p ./tsconfig.build.json",
13
- "lint": "tslint --fix --project ./",
14
- "test": "jest --config ./jest.config.js",
15
- "e2e": "node e2e/check-connection.js || jest --config ../../e2e-common/jest-config.js --package=elasticsearch-plugin"
16
- },
17
- "homepage": "https://www.vendure.io/",
18
- "funding": "https://github.com/sponsors/michaelbromley",
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
- "dependencies": {
23
- "@elastic/elasticsearch": "^7.9.1",
24
- "deepmerge": "^4.2.2",
25
- "fast-deep-equal": "^3.1.3"
26
- },
27
- "devDependencies": {
28
- "@vendure/common": "^2.0.0-next.8",
29
- "@vendure/core": "^2.0.0-next.8",
30
- "rimraf": "^3.0.2",
31
- "typescript": "4.5.5"
32
- },
33
- "gitHead": "817b49e80bbfe6f1feeda1cdab0be45d887e689f"
2
+ "name": "@vendure/elasticsearch-plugin",
3
+ "version": "2.0.0",
4
+ "license": "MIT",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "files": [
8
+ "lib/**/*"
9
+ ],
10
+ "scripts": {
11
+ "watch": "tsc -p ./tsconfig.build.json --watch",
12
+ "build": "rimraf lib && tsc -p ./tsconfig.build.json",
13
+ "lint": "eslint --fix .",
14
+ "test": "vitest --run",
15
+ "e2e": "cross-env PACKAGE=elasticsearch-plugin vitest --config ../../e2e-common/vitest.config.ts --run",
16
+ "e2e:watch": "cross-env PACKAGE=elasticsearch-plugin vitest --config ../../e2e-common/vitest.config.ts"
17
+ },
18
+ "homepage": "https://www.vendure.io/",
19
+ "funding": "https://github.com/sponsors/michaelbromley",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "dependencies": {
24
+ "@elastic/elasticsearch": "~7.9.1",
25
+ "deepmerge": "^4.2.2",
26
+ "fast-deep-equal": "^3.1.3"
27
+ },
28
+ "devDependencies": {
29
+ "@vendure/common": "^2.0.0",
30
+ "@vendure/core": "^2.0.0",
31
+ "rimraf": "^3.0.2",
32
+ "typescript": "4.9.5"
33
+ },
34
+ "gitHead": "302bd68796e0136f70dd199369616d362c920ea4"
34
35
  }