diff --git a/packages/elasticsearch-plugin/src/indexing/indexer.controller.ts b/packages/elasticsearch-plugin/src/indexing/indexer.controller.ts index c20b59aff0..e3701198b2 100644 --- a/packages/elasticsearch-plugin/src/indexing/indexer.controller.ts +++ b/packages/elasticsearch-plugin/src/indexing/indexer.controller.ts @@ -892,12 +892,12 @@ export class ElasticsearchIndexerController implements OnModuleInit, OnModuleDes }; const variantCustomMappings = Object.entries(this.options.customProductVariantMappings); for (const [name, def] of variantCustomMappings) { - item[`variant-${name}`] = await def.valueFn(v, languageCode, this.injector); + item[`variant-${name}`] = await def.valueFn(v, languageCode, this.injector, ctx); } const productCustomMappings = Object.entries(this.options.customProductMappings); for (const [name, def] of productCustomMappings) { - item[`product-${name}`] = await def.valueFn(v.product, variants, languageCode, this.injector); + item[`product-${name}`] = await def.valueFn(v.product, variants, languageCode, this.injector, ctx); } return item; } catch (err: any) { @@ -971,7 +971,7 @@ export class ElasticsearchIndexerController implements OnModuleInit, OnModuleDes }; const productCustomMappings = Object.entries(this.options.customProductMappings); for (const [name, def] of productCustomMappings) { - item[`product-${name}`] = await def.valueFn(product, [], languageCode, this.injector); + item[`product-${name}`] = await def.valueFn(product, [], languageCode, this.injector, ctx); } return item; } diff --git a/packages/elasticsearch-plugin/src/options.ts b/packages/elasticsearch-plugin/src/options.ts index d72c01b30d..36a2114514 100644 --- a/packages/elasticsearch-plugin/src/options.ts +++ b/packages/elasticsearch-plugin/src/options.ts @@ -7,6 +7,7 @@ import { LanguageCode, Product, ProductVariant, + RequestContext } from '@vendure/core'; import deepmerge from 'deepmerge'; @@ -230,7 +231,7 @@ export interface ElasticsearchOptions { * ``` */ customProductMappings?: { - [fieldName: string]: CustomMapping<[Product, ProductVariant[], LanguageCode, Injector]>; + [fieldName: string]: CustomMapping<[Product, ProductVariant[], LanguageCode, Injector, RequestContext]>; }; /** * @description @@ -260,7 +261,7 @@ export interface ElasticsearchOptions { * ``` */ customProductVariantMappings?: { - [fieldName: string]: CustomMapping<[ProductVariant, LanguageCode, Injector]>; + [fieldName: string]: CustomMapping<[ProductVariant, LanguageCode, Injector, RequestContext]>; }; /** * @description