@medusajs/product 2.10.2-snapshot-20250903100537 → 2.10.2-snapshot-20250903132457

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.
@@ -11,13 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var _a;
14
+ var _a, _b;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  const types_1 = require("@medusajs/framework/types");
17
17
  const _models_1 = require("../models");
18
18
  const utils_1 = require("@medusajs/framework/utils");
19
+ const utils_2 = require("../utils");
19
20
  const joiner_config_1 = require("./../joiner-config");
20
- const events_1 = require("../utils/events");
21
21
  class ProductModuleService extends (0, utils_1.MedusaService)({
22
22
  Product: _models_1.Product,
23
23
  ProductCategory: _models_1.ProductCategory,
@@ -107,6 +107,10 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
107
107
  const productVariantsWithOptions = ProductModuleService.assignOptionsToVariants(data, productOptions);
108
108
  ProductModuleService.checkIfVariantWithOptionsAlreadyExists(productVariantsWithOptions, variants);
109
109
  const createdVariants = await this.productVariantService_.create(productVariantsWithOptions, sharedContext);
110
+ utils_2.eventBuilders.createdProductVariant({
111
+ data: createdVariants,
112
+ sharedContext,
113
+ });
110
114
  return createdVariants;
111
115
  }
112
116
  async upsertProductVariants(data, sharedContext = {}) {
@@ -116,7 +120,7 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
116
120
  let created = [];
117
121
  let updated = [];
118
122
  if (forCreate.length) {
119
- created = await this.createProductVariants(forCreate, sharedContext);
123
+ created = await this.createVariants_(forCreate, sharedContext);
120
124
  }
121
125
  if (forUpdate.length) {
122
126
  updated = await this.updateVariants_(forUpdate, sharedContext);
@@ -163,9 +167,21 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
163
167
  if (data.some((d) => !!d.options)) {
164
168
  ProductModuleService.checkIfVariantWithOptionsAlreadyExists(productVariantsWithOptions, allVariants);
165
169
  }
166
- const { entities: productVariants } = await this.productVariantService_.upsertWithReplace(productVariantsWithOptions, {
170
+ const { entities: productVariants, performedActions } = await this.productVariantService_.upsertWithReplace(productVariantsWithOptions, {
167
171
  relations: ["options"],
168
172
  }, sharedContext);
173
+ utils_2.eventBuilders.createdProductVariant({
174
+ data: performedActions.created[_models_1.ProductVariant.name] ?? [],
175
+ sharedContext,
176
+ });
177
+ utils_2.eventBuilders.updatedProductVariant({
178
+ data: performedActions.updated[_models_1.ProductVariant.name] ?? [],
179
+ sharedContext,
180
+ });
181
+ utils_2.eventBuilders.deletedProductVariant({
182
+ data: performedActions.deleted[_models_1.ProductVariant.name] ?? [],
183
+ sharedContext,
184
+ });
169
185
  return productVariants;
170
186
  }
171
187
  // @ts-expect-error
@@ -173,14 +189,13 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
173
189
  const input = Array.isArray(data) ? data : [data];
174
190
  const tags = await this.productTagService_.create(input, sharedContext);
175
191
  const createdTags = await this.baseRepository_.serialize(tags);
192
+ utils_2.eventBuilders.createdProductTag({
193
+ data: createdTags,
194
+ sharedContext,
195
+ });
176
196
  return Array.isArray(data) ? createdTags : createdTags[0];
177
197
  }
178
198
  async upsertProductTags(data, sharedContext = {}) {
179
- const tags = await this.upsertProductTags_(data, sharedContext);
180
- const allTags = await this.baseRepository_.serialize(Array.isArray(data) ? tags : tags[0]);
181
- return allTags;
182
- }
183
- async upsertProductTags_(data, sharedContext = {}) {
184
199
  const input = Array.isArray(data) ? data : [data];
185
200
  const forUpdate = input.filter((tag) => !!tag.id);
186
201
  const forCreate = input.filter((tag) => !tag.id);
@@ -188,11 +203,21 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
188
203
  let updated = [];
189
204
  if (forCreate.length) {
190
205
  created = await this.productTagService_.create(forCreate, sharedContext);
206
+ utils_2.eventBuilders.createdProductTag({
207
+ data: created,
208
+ sharedContext,
209
+ });
191
210
  }
192
211
  if (forUpdate.length) {
193
212
  updated = await this.productTagService_.update(forUpdate, sharedContext);
213
+ utils_2.eventBuilders.updatedProductTag({
214
+ data: updated,
215
+ sharedContext,
216
+ });
194
217
  }
195
- return [...created, ...updated];
218
+ const result = [...created, ...updated];
219
+ const allTags = await this.baseRepository_.serialize(result);
220
+ return Array.isArray(data) ? allTags : allTags[0];
196
221
  }
197
222
  // @ts-expect-error
198
223
  async updateProductTags(idOrSelector, data, sharedContext = {}) {
@@ -211,6 +236,10 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
211
236
  }
212
237
  const tags = await this.productTagService_.update(normalizedInput, sharedContext);
213
238
  const updatedTags = await this.baseRepository_.serialize(tags);
239
+ utils_2.eventBuilders.updatedProductTag({
240
+ data: updatedTags,
241
+ sharedContext,
242
+ });
214
243
  return (0, utils_1.isString)(idOrSelector) ? updatedTags[0] : updatedTags;
215
244
  }
216
245
  // @ts-expect-error
@@ -221,11 +250,6 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
221
250
  return Array.isArray(data) ? createdTypes : createdTypes[0];
222
251
  }
223
252
  async upsertProductTypes(data, sharedContext = {}) {
224
- const types = await this.upsertProductTypes_(data, sharedContext);
225
- const result = await this.baseRepository_.serialize(types);
226
- return Array.isArray(data) ? result : result[0];
227
- }
228
- async upsertProductTypes_(data, sharedContext) {
229
253
  const input = Array.isArray(data) ? data : [data];
230
254
  const forUpdate = input.filter((type) => !!type.id);
231
255
  const forCreate = input.filter((type) => !type.id);
@@ -237,7 +261,9 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
237
261
  if (forUpdate.length) {
238
262
  updated = await this.productTypeService_.update(forUpdate, sharedContext);
239
263
  }
240
- return [...created, ...updated];
264
+ const result = [...created, ...updated];
265
+ const allTypes = await this.baseRepository_.serialize(result);
266
+ return Array.isArray(data) ? allTypes : allTypes[0];
241
267
  }
242
268
  // @ts-expect-error
243
269
  async updateProductTypes(idOrSelector, data, sharedContext = {}) {
@@ -358,6 +384,10 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
358
384
  const input = Array.isArray(data) ? data : [data];
359
385
  const collections = await this.createCollections_(input, sharedContext);
360
386
  const createdCollections = await this.baseRepository_.serialize(collections);
387
+ utils_2.eventBuilders.createdProductCollection({
388
+ data: collections,
389
+ sharedContext,
390
+ });
361
391
  return Array.isArray(data) ? createdCollections : createdCollections[0];
362
392
  }
363
393
  async createCollections_(data, sharedContext = {}) {
@@ -368,13 +398,6 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
368
398
  return productCollections;
369
399
  }
370
400
  async upsertProductCollections(data, sharedContext = {}) {
371
- const collections = await this.upsertCollections_(data, sharedContext);
372
- const serializedCollections = await this.baseRepository_.serialize(collections);
373
- return Array.isArray(data)
374
- ? serializedCollections
375
- : serializedCollections[0];
376
- }
377
- async upsertCollections_(data, sharedContext = {}) {
378
401
  const input = Array.isArray(data) ? data : [data];
379
402
  const forUpdate = input.filter((collection) => !!collection.id);
380
403
  const forCreate = input.filter((collection) => !collection.id);
@@ -386,7 +409,21 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
386
409
  if (forUpdate.length) {
387
410
  updated = await this.updateCollections_(forUpdate, sharedContext);
388
411
  }
389
- return [...created, ...updated];
412
+ const result = [...created, ...updated];
413
+ const allCollections = await this.baseRepository_.serialize(result);
414
+ if (created.length) {
415
+ utils_2.eventBuilders.createdProductCollection({
416
+ data: created,
417
+ sharedContext,
418
+ });
419
+ }
420
+ if (updated.length) {
421
+ utils_2.eventBuilders.updatedProductCollection({
422
+ data: updated,
423
+ sharedContext,
424
+ });
425
+ }
426
+ return Array.isArray(data) ? allCollections : allCollections[0];
390
427
  }
391
428
  // @ts-expect-error
392
429
  async updateProductCollections(idOrSelector, data, sharedContext = {}) {
@@ -404,6 +441,10 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
404
441
  }
405
442
  const collections = await this.updateCollections_(normalizedInput, sharedContext);
406
443
  const updatedCollections = await this.baseRepository_.serialize(collections);
444
+ utils_2.eventBuilders.updatedProductCollection({
445
+ data: updatedCollections,
446
+ sharedContext,
447
+ });
407
448
  return (0, utils_1.isString)(idOrSelector) ? updatedCollections[0] : updatedCollections;
408
449
  }
409
450
  async updateCollections_(data, sharedContext = {}) {
@@ -459,65 +500,39 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
459
500
  });
460
501
  const categories = await this.productCategoryService_.create(input, sharedContext);
461
502
  const createdCategories = await this.baseRepository_.serialize(categories);
462
- // TODO: Same as the update categories, for some reason I cant get the tree repository update
463
- events_1.eventBuilders.createdProductCategory({
503
+ utils_2.eventBuilders.createdProductCategory({
464
504
  data: createdCategories,
465
505
  sharedContext,
466
506
  });
467
507
  return Array.isArray(data) ? createdCategories : createdCategories[0];
468
508
  }
469
509
  async upsertProductCategories(data, sharedContext = {}) {
470
- const categories = await this.upsertProductCategories_(data, sharedContext);
471
- const serializedCategories = await this.baseRepository_.serialize(categories);
472
- return Array.isArray(data) ? serializedCategories : serializedCategories[0];
473
- }
474
- async upsertProductCategories_(data, sharedContext = {}) {
475
510
  const input = Array.isArray(data) ? data : [data];
476
511
  const forUpdate = input.filter((category) => !!category.id);
477
- let forCreate = input.filter((category) => !category.id);
512
+ const forCreate = input.filter((category) => !category.id);
478
513
  let created = [];
479
514
  let updated = [];
480
515
  if (forCreate.length) {
481
- forCreate = forCreate.map((productCategory) => {
482
- productCategory.handle ??= (0, utils_1.kebabCase)(productCategory.name);
483
- return productCategory;
484
- });
485
516
  created = await this.productCategoryService_.create(forCreate, sharedContext);
486
517
  }
487
518
  if (forUpdate.length) {
488
519
  updated = await this.productCategoryService_.update(forUpdate, sharedContext);
489
520
  }
490
- // TODO: Same as the update categories, for some reason I cant get the tree repository update
491
- // event. I ll need to investigate this
492
- if (created.length) {
493
- events_1.eventBuilders.createdProductCategory({
494
- data: created,
495
- sharedContext,
496
- });
497
- }
498
- if (updated.length) {
499
- events_1.eventBuilders.updatedProductCategory({
500
- data: updated,
501
- sharedContext,
502
- });
503
- }
504
- return [...created, ...updated];
505
- }
506
- // @ts-expect-error
507
- async updateProductCategories(idOrSelector, data, sharedContext = {}) {
508
- const categories = await this.updateProductCategories_(idOrSelector, data, sharedContext);
509
- const serializedCategories = await this.baseRepository_.serialize(categories);
510
- // TODO: for some reason I cant get the tree repository update
511
- // event. I ll need to investigate this
512
- events_1.eventBuilders.updatedProductCategory({
513
- data: serializedCategories,
521
+ const createdCategories = await this.baseRepository_.serialize(created);
522
+ const updatedCategories = await this.baseRepository_.serialize(updated);
523
+ utils_2.eventBuilders.createdProductCategory({
524
+ data: createdCategories,
514
525
  sharedContext,
515
526
  });
516
- return (0, utils_1.isString)(idOrSelector)
517
- ? serializedCategories[0]
518
- : serializedCategories;
527
+ utils_2.eventBuilders.updatedProductCategory({
528
+ data: updatedCategories,
529
+ sharedContext,
530
+ });
531
+ const result = [...createdCategories, ...updatedCategories];
532
+ return Array.isArray(data) ? result : result[0];
519
533
  }
520
- async updateProductCategories_(idOrSelector, data, sharedContext = {}) {
534
+ // @ts-expect-error
535
+ async updateProductCategories(idOrSelector, data, sharedContext = {}) {
521
536
  let normalizedInput = [];
522
537
  if ((0, utils_1.isString)(idOrSelector)) {
523
538
  // Check if the type exists in the first place
@@ -532,13 +547,22 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
532
547
  }));
533
548
  }
534
549
  const categories = await this.productCategoryService_.update(normalizedInput, sharedContext);
535
- return categories;
550
+ const updatedCategories = await this.baseRepository_.serialize(categories);
551
+ utils_2.eventBuilders.updatedProductCategory({
552
+ data: updatedCategories,
553
+ sharedContext,
554
+ });
555
+ return (0, utils_1.isString)(idOrSelector) ? updatedCategories[0] : updatedCategories;
536
556
  }
537
557
  // @ts-expect-error
538
558
  async createProducts(data, sharedContext = {}) {
539
559
  const input = Array.isArray(data) ? data : [data];
540
560
  const products = await this.createProducts_(input, sharedContext);
541
561
  const createdProducts = await this.baseRepository_.serialize(products);
562
+ utils_2.eventBuilders.createdProduct({
563
+ data: createdProducts,
564
+ sharedContext,
565
+ });
542
566
  return Array.isArray(data) ? createdProducts : createdProducts[0];
543
567
  }
544
568
  async upsertProducts(data, sharedContext = {}) {
@@ -548,13 +572,25 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
548
572
  let created = [];
549
573
  let updated = [];
550
574
  if (forCreate.length) {
551
- created = await this.createProducts(forCreate, sharedContext);
575
+ created = await this.createProducts_(forCreate, sharedContext);
552
576
  }
553
577
  if (forUpdate.length) {
554
578
  updated = await this.updateProducts_(forUpdate, sharedContext);
555
579
  }
556
580
  const result = [...created, ...updated];
557
581
  const allProducts = await this.baseRepository_.serialize(result);
582
+ if (created.length) {
583
+ utils_2.eventBuilders.createdProduct({
584
+ data: created,
585
+ sharedContext,
586
+ });
587
+ }
588
+ if (updated.length) {
589
+ utils_2.eventBuilders.updatedProduct({
590
+ data: updated,
591
+ sharedContext,
592
+ });
593
+ }
558
594
  return Array.isArray(data) ? allProducts : allProducts[0];
559
595
  }
560
596
  // @ts-expect-error
@@ -574,6 +610,10 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
574
610
  }
575
611
  const products = await this.updateProducts_(normalizedInput, sharedContext);
576
612
  const updatedProducts = await this.baseRepository_.serialize(products);
613
+ utils_2.eventBuilders.updatedProduct({
614
+ data: updatedProducts,
615
+ sharedContext,
616
+ });
577
617
  return (0, utils_1.isString)(idOrSelector) ? updatedProducts[0] : updatedProducts;
578
618
  }
579
619
  async createProducts_(data, sharedContext = {}) {
@@ -629,34 +669,14 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
629
669
  return createdProducts;
630
670
  }
631
671
  async updateProducts_(data, sharedContext = {}) {
632
- // We have to do that manually because this method is bypassing the product service and goes
633
- // directly to the custom product repository
634
- const manager = (sharedContext.transactionManager ??
635
- sharedContext.manager);
636
- const subscriber = (0, utils_1.createMedusaMikroOrmEventSubscriber)(["updateProducts_"], this);
637
- if (manager && subscriber) {
638
- manager
639
- .getEventManager()
640
- .registerSubscriber(new subscriber(sharedContext));
641
- }
642
- const originalProducts = await this.productService_.list({
643
- id: data.map((d) => d.id),
644
- }, {
645
- relations: ["options", "options.values", "variants", "images", "tags"],
646
- }, sharedContext);
647
- const normalizedProducts = await this.normalizeUpdateProductInput(data, originalProducts);
672
+ const normalizedProducts = await this.normalizeUpdateProductInput(data, sharedContext);
648
673
  for (const product of normalizedProducts) {
649
674
  this.validateProductUpdatePayload(product);
650
675
  }
651
- const updatedProducts = await this.productRepository_.deepUpdate(normalizedProducts, ProductModuleService.validateVariantOptions, sharedContext);
652
- return updatedProducts;
676
+ return this.productRepository_.deepUpdate(normalizedProducts, ProductModuleService.validateVariantOptions, sharedContext);
653
677
  }
654
678
  // @ts-expect-error
655
679
  async updateProductOptionValues(idOrSelector, data, sharedContext = {}) {
656
- // TODO: There is a missmatch in the API which lead to function with different number of
657
- // arguments. Therefore, applying the MedusaContext() decorator to the function will not work
658
- // because the context arg index will differ from method to method.
659
- sharedContext.messageAggregator ??= new utils_1.MessageAggregator();
660
680
  let normalizedInput = [];
661
681
  if ((0, utils_1.isString)(idOrSelector)) {
662
682
  // This will throw if the product option value does not exist
@@ -670,29 +690,16 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
670
690
  ...data,
671
691
  }));
672
692
  }
673
- const productOptionValues = await this.updateProductOptionValues_(normalizedInput, sharedContext);
693
+ const productOptionValues = await super.updateProductOptionValues(normalizedInput, sharedContext);
674
694
  const updatedProductOptionValues = await this.baseRepository_.serialize(productOptionValues);
675
- // TODO: Because of the wrong method override, we have to compensate to prevent breaking
676
- // changes right now
677
- const groupedEvents = sharedContext.messageAggregator.getMessages();
678
- if (Object.values(groupedEvents).flat().length > 0 &&
679
- this.eventBusModuleService_) {
680
- const promises = [];
681
- for (const group of Object.keys(groupedEvents)) {
682
- promises.push(this.eventBusModuleService_.emit(groupedEvents[group], {
683
- internal: true,
684
- }));
685
- }
686
- await Promise.all(promises);
687
- sharedContext.messageAggregator.clearMessages();
688
- }
695
+ utils_2.eventBuilders.updatedProductOptionValue({
696
+ data: updatedProductOptionValues,
697
+ sharedContext: sharedContext,
698
+ });
689
699
  return (0, utils_1.isString)(idOrSelector)
690
700
  ? updatedProductOptionValues[0]
691
701
  : updatedProductOptionValues;
692
702
  }
693
- async updateProductOptionValues_(normalizedInput, sharedContext = {}) {
694
- return await this.productOptionValueService_.update(normalizedInput, sharedContext);
695
- }
696
703
  /**
697
704
  * Validates the manually provided handle value of the product
698
705
  * to be URL-safe
@@ -727,7 +734,7 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
727
734
  }
728
735
  async normalizeCreateProductInput(products, sharedContext = {}) {
729
736
  const products_ = Array.isArray(products) ? products : [products];
730
- const normalizedProducts = (await this.normalizeUpdateProductInput(products_));
737
+ const normalizedProducts = (await this.normalizeUpdateProductInput(products_, sharedContext));
731
738
  for (const productData of normalizedProducts) {
732
739
  if (!productData.handle && productData.title) {
733
740
  productData.handle = (0, utils_1.toHandle)(productData.title);
@@ -749,23 +756,12 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
749
756
  }
750
757
  return (Array.isArray(products) ? normalizedProducts : normalizedProducts[0]);
751
758
  }
752
- /**
753
- * Normalizes the input for the update product input
754
- * @param products - The products to normalize
755
- * @param originalProducts - The original products to use for the normalization (must include options and option values relations)
756
- * @returns The normalized products
757
- */
758
- async normalizeUpdateProductInput(products, originalProducts) {
759
+ async normalizeUpdateProductInput(products, sharedContext = {}) {
759
760
  const products_ = Array.isArray(products) ? products : [products];
760
761
  const productsIds = products_.map((p) => p.id).filter(Boolean);
761
762
  let dbOptions = [];
762
763
  if (productsIds.length) {
763
- // Re map options to handle non serialized data as well
764
- dbOptions =
765
- originalProducts
766
- ?.map((originalProduct) => originalProduct.options.map((option) => option))
767
- .flat()
768
- .filter(Boolean) ?? [];
764
+ dbOptions = await this.productOptionService_.list({ product_id: productsIds }, { relations: ["values"] }, sharedContext);
769
765
  }
770
766
  const normalizedProducts = [];
771
767
  for (const product of products_) {
@@ -776,8 +772,7 @@ class ProductModuleService extends (0, utils_1.MedusaService)({
776
772
  if (productData.options?.length) {
777
773
  ;
778
774
  productData.options = productData.options?.map((option) => {
779
- const dbOption = dbOptions.find((o) => (o.title === option.title || o.id === option.id) &&
780
- o.product_id === productData.id);
775
+ const dbOption = dbOptions.find((o) => o.title === option.title && o.product_id === productData.id);
781
776
  return {
782
777
  title: option.title,
783
778
  values: option.values?.map((value) => {
@@ -988,20 +983,13 @@ __decorate([
988
983
  __metadata("design:returntype", Promise)
989
984
  ], ProductModuleService.prototype, "createProductTags", null);
990
985
  __decorate([
991
- (0, utils_1.InjectManager)(),
986
+ (0, utils_1.InjectTransactionManager)(),
992
987
  (0, utils_1.EmitEvents)(),
993
988
  __param(1, (0, utils_1.MedusaContext)()),
994
989
  __metadata("design:type", Function),
995
990
  __metadata("design:paramtypes", [Object, Object]),
996
991
  __metadata("design:returntype", Promise)
997
992
  ], ProductModuleService.prototype, "upsertProductTags", null);
998
- __decorate([
999
- (0, utils_1.InjectTransactionManager)(),
1000
- __param(1, (0, utils_1.MedusaContext)()),
1001
- __metadata("design:type", Function),
1002
- __metadata("design:paramtypes", [Object, Object]),
1003
- __metadata("design:returntype", Promise)
1004
- ], ProductModuleService.prototype, "upsertProductTags_", null);
1005
993
  __decorate([
1006
994
  (0, utils_1.InjectManager)(),
1007
995
  (0, utils_1.EmitEvents)()
@@ -1013,8 +1001,7 @@ __decorate([
1013
1001
  __metadata("design:returntype", Promise)
1014
1002
  ], ProductModuleService.prototype, "updateProductTags", null);
1015
1003
  __decorate([
1016
- (0, utils_1.InjectManager)(),
1017
- (0, utils_1.EmitEvents)()
1004
+ (0, utils_1.InjectManager)()
1018
1005
  // @ts-expect-error
1019
1006
  ,
1020
1007
  __param(1, (0, utils_1.MedusaContext)()),
@@ -1023,22 +1010,14 @@ __decorate([
1023
1010
  __metadata("design:returntype", Promise)
1024
1011
  ], ProductModuleService.prototype, "createProductTypes", null);
1025
1012
  __decorate([
1026
- (0, utils_1.InjectManager)(),
1027
- (0, utils_1.EmitEvents)(),
1013
+ (0, utils_1.InjectTransactionManager)(),
1028
1014
  __param(1, (0, utils_1.MedusaContext)()),
1029
1015
  __metadata("design:type", Function),
1030
1016
  __metadata("design:paramtypes", [Object, Object]),
1031
1017
  __metadata("design:returntype", Promise)
1032
1018
  ], ProductModuleService.prototype, "upsertProductTypes", null);
1033
1019
  __decorate([
1034
- (0, utils_1.InjectTransactionManager)(),
1035
- __metadata("design:type", Function),
1036
- __metadata("design:paramtypes", [Object, Object]),
1037
- __metadata("design:returntype", Promise)
1038
- ], ProductModuleService.prototype, "upsertProductTypes_", null);
1039
- __decorate([
1040
- (0, utils_1.InjectManager)(),
1041
- (0, utils_1.EmitEvents)()
1020
+ (0, utils_1.InjectManager)()
1042
1021
  // @ts-expect-error
1043
1022
  ,
1044
1023
  __param(2, (0, utils_1.MedusaContext)()),
@@ -1047,8 +1026,7 @@ __decorate([
1047
1026
  __metadata("design:returntype", Promise)
1048
1027
  ], ProductModuleService.prototype, "updateProductTypes", null);
1049
1028
  __decorate([
1050
- (0, utils_1.InjectManager)(),
1051
- (0, utils_1.EmitEvents)()
1029
+ (0, utils_1.InjectManager)()
1052
1030
  // @ts-expect-error
1053
1031
  ,
1054
1032
  __param(1, (0, utils_1.MedusaContext)()),
@@ -1065,15 +1043,13 @@ __decorate([
1065
1043
  ], ProductModuleService.prototype, "createOptions_", null);
1066
1044
  __decorate([
1067
1045
  (0, utils_1.InjectTransactionManager)(),
1068
- (0, utils_1.EmitEvents)(),
1069
1046
  __param(1, (0, utils_1.MedusaContext)()),
1070
1047
  __metadata("design:type", Function),
1071
1048
  __metadata("design:paramtypes", [Object, Object]),
1072
1049
  __metadata("design:returntype", Promise)
1073
1050
  ], ProductModuleService.prototype, "upsertProductOptions", null);
1074
1051
  __decorate([
1075
- (0, utils_1.InjectManager)(),
1076
- (0, utils_1.EmitEvents)()
1052
+ (0, utils_1.InjectManager)()
1077
1053
  // @ts-expect-error
1078
1054
  ,
1079
1055
  __param(2, (0, utils_1.MedusaContext)()),
@@ -1106,20 +1082,13 @@ __decorate([
1106
1082
  __metadata("design:returntype", Promise)
1107
1083
  ], ProductModuleService.prototype, "createCollections_", null);
1108
1084
  __decorate([
1109
- (0, utils_1.InjectManager)(),
1085
+ (0, utils_1.InjectTransactionManager)(),
1110
1086
  (0, utils_1.EmitEvents)(),
1111
1087
  __param(1, (0, utils_1.MedusaContext)()),
1112
1088
  __metadata("design:type", Function),
1113
1089
  __metadata("design:paramtypes", [Object, Object]),
1114
1090
  __metadata("design:returntype", Promise)
1115
1091
  ], ProductModuleService.prototype, "upsertProductCollections", null);
1116
- __decorate([
1117
- (0, utils_1.InjectTransactionManager)(),
1118
- __param(1, (0, utils_1.MedusaContext)()),
1119
- __metadata("design:type", Function),
1120
- __metadata("design:paramtypes", [Object, Object]),
1121
- __metadata("design:returntype", Promise)
1122
- ], ProductModuleService.prototype, "upsertCollections_", null);
1123
1092
  __decorate([
1124
1093
  (0, utils_1.InjectManager)(),
1125
1094
  (0, utils_1.EmitEvents)()
@@ -1148,20 +1117,13 @@ __decorate([
1148
1117
  __metadata("design:returntype", Promise)
1149
1118
  ], ProductModuleService.prototype, "createProductCategories", null);
1150
1119
  __decorate([
1151
- (0, utils_1.InjectManager)(),
1120
+ (0, utils_1.InjectTransactionManager)(),
1152
1121
  (0, utils_1.EmitEvents)(),
1153
1122
  __param(1, (0, utils_1.MedusaContext)()),
1154
1123
  __metadata("design:type", Function),
1155
1124
  __metadata("design:paramtypes", [Object, Object]),
1156
1125
  __metadata("design:returntype", Promise)
1157
1126
  ], ProductModuleService.prototype, "upsertProductCategories", null);
1158
- __decorate([
1159
- (0, utils_1.InjectTransactionManager)(),
1160
- __param(1, (0, utils_1.MedusaContext)()),
1161
- __metadata("design:type", Function),
1162
- __metadata("design:paramtypes", [Object, Object]),
1163
- __metadata("design:returntype", Promise)
1164
- ], ProductModuleService.prototype, "upsertProductCategories_", null);
1165
1127
  __decorate([
1166
1128
  (0, utils_1.InjectManager)(),
1167
1129
  (0, utils_1.EmitEvents)()
@@ -1172,13 +1134,6 @@ __decorate([
1172
1134
  __metadata("design:paramtypes", [Object, Object, Object]),
1173
1135
  __metadata("design:returntype", Promise)
1174
1136
  ], ProductModuleService.prototype, "updateProductCategories", null);
1175
- __decorate([
1176
- (0, utils_1.InjectTransactionManager)(),
1177
- __param(2, (0, utils_1.MedusaContext)()),
1178
- __metadata("design:type", Function),
1179
- __metadata("design:paramtypes", [Object, Object, Object]),
1180
- __metadata("design:returntype", Promise)
1181
- ], ProductModuleService.prototype, "updateProductCategories_", null);
1182
1137
  __decorate([
1183
1138
  (0, utils_1.InjectManager)(),
1184
1139
  (0, utils_1.EmitEvents)()
@@ -1222,16 +1177,15 @@ __decorate([
1222
1177
  __metadata("design:returntype", Promise)
1223
1178
  ], ProductModuleService.prototype, "updateProducts_", null);
1224
1179
  __decorate([
1225
- (0, utils_1.InjectTransactionManager)(),
1226
1180
  __param(1, (0, utils_1.MedusaContext)()),
1227
1181
  __metadata("design:type", Function),
1228
- __metadata("design:paramtypes", [Array, Object]),
1182
+ __metadata("design:paramtypes", [typeof (_a = typeof T !== "undefined" && T) === "function" ? _a : Object, Object]),
1229
1183
  __metadata("design:returntype", Promise)
1230
- ], ProductModuleService.prototype, "updateProductOptionValues_", null);
1184
+ ], ProductModuleService.prototype, "normalizeCreateProductInput", null);
1231
1185
  __decorate([
1232
1186
  __param(1, (0, utils_1.MedusaContext)()),
1233
1187
  __metadata("design:type", Function),
1234
- __metadata("design:paramtypes", [typeof (_a = typeof T !== "undefined" && T) === "function" ? _a : Object, Object]),
1188
+ __metadata("design:paramtypes", [typeof (_b = typeof T !== "undefined" && T) === "function" ? _b : Object, Object]),
1235
1189
  __metadata("design:returntype", Promise)
1236
- ], ProductModuleService.prototype, "normalizeCreateProductInput", null);
1190
+ ], ProductModuleService.prototype, "normalizeUpdateProductInput", null);
1237
1191
  //# sourceMappingURL=product-module-service.js.map