@haus-tech/product-import-export-plugin 3.0.13 → 3.0.14

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,6 +1,6 @@
1
1
  /// <reference types="Multer" />
2
2
  import { OnModuleInit } from '@nestjs/common';
3
- import { RequestContext, JobQueueService, SerializedRequestContext, SearchService, LanguageCode } from '@vendure/core';
3
+ import { RequestContext, JobQueueService, SerializedRequestContext, SearchService, LanguageCode, EventBus, CollectionService, ProductService } from '@vendure/core';
4
4
  import { PluginInitOptions, UpdatingStrategy } from '../types';
5
5
  import { ProductImporter } from '../providers/import-providers/product-importer';
6
6
  export declare class ProductImportService implements OnModuleInit {
@@ -8,8 +8,11 @@ export declare class ProductImportService implements OnModuleInit {
8
8
  private jobQueueService;
9
9
  private productImporter;
10
10
  private searchService;
11
+ private collectionService;
12
+ private productService;
13
+ private eventBus;
11
14
  private productImportQueue;
12
- constructor(options: PluginInitOptions, jobQueueService: JobQueueService, productImporter: ProductImporter, searchService: SearchService);
15
+ constructor(options: PluginInitOptions, jobQueueService: JobQueueService, productImporter: ProductImporter, searchService: SearchService, collectionService: CollectionService, productService: ProductService, eventBus: EventBus);
13
16
  onModuleInit(): Promise<void>;
14
17
  processFile(ctx: RequestContext, file: Express.Multer.File, updateProductSlug: boolean, mainLanguage: LanguageCode, updatingStrategy: UpdatingStrategy): Promise<import("@vendure/core/dist/job-queue/subscribable-job").SubscribableJob<{
15
18
  ctx: SerializedRequestContext;
@@ -23,12 +23,18 @@ let ProductImportService = class ProductImportService {
23
23
  jobQueueService;
24
24
  productImporter;
25
25
  searchService;
26
+ collectionService;
27
+ productService;
28
+ eventBus;
26
29
  productImportQueue;
27
- constructor(options, jobQueueService, productImporter, searchService) {
30
+ constructor(options, jobQueueService, productImporter, searchService, collectionService, productService, eventBus) {
28
31
  this.options = options;
29
32
  this.jobQueueService = jobQueueService;
30
33
  this.productImporter = productImporter;
31
34
  this.searchService = searchService;
35
+ this.collectionService = collectionService;
36
+ this.productService = productService;
37
+ this.eventBus = eventBus;
32
38
  }
33
39
  async onModuleInit() {
34
40
  this.productImportQueue = await this.jobQueueService.createQueue({
@@ -49,6 +55,12 @@ let ProductImportService = class ProductImportService {
49
55
  jobResult = result;
50
56
  },
51
57
  complete: async () => {
58
+ // Hack for triggering apply-collection-filters job
59
+ const firstProduct = await this.productService.findAll(ctx, {
60
+ take: 1,
61
+ });
62
+ this.eventBus.publish(new core_1.ProductEvent(ctx, firstProduct.items[0], 'updated'));
63
+ // Reindex the search index
52
64
  await this.searchService.reindex(ctx);
53
65
  resolve((0, lodash_1.omit)(jobResult, 'currentProduct'));
54
66
  },
@@ -79,6 +91,9 @@ ProductImportService = __decorate([
79
91
  __param(0, (0, common_1.Inject)(constants_1.PRODUCT_IMPORT_EXPORT_PLUGIN_OPTIONS)),
80
92
  __metadata("design:paramtypes", [Object, core_1.JobQueueService,
81
93
  product_importer_1.ProductImporter,
82
- core_1.SearchService])
94
+ core_1.SearchService,
95
+ core_1.CollectionService,
96
+ core_1.ProductService,
97
+ core_1.EventBus])
83
98
  ], ProductImportService);
84
99
  exports.ProductImportService = ProductImportService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-tech/product-import-export-plugin",
3
- "version": "3.0.13",
3
+ "version": "3.0.14",
4
4
  "description": "A Vendure plugin for importing and exporting products using a CSV file",
5
5
  "author": "Haus Tech",
6
6
  "repository": {