@haus-tech/product-import-export-plugin 3.0.4 → 3.0.6

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.
@@ -51,7 +51,8 @@ let ExtendedAssetImporter = class ExtendedAssetImporter {
51
51
  for (const assetPath of uniqueAssetPaths.values()) {
52
52
  const cachedAsset = this.assetMap.get(assetPath.url);
53
53
  if (cachedAsset) {
54
- if (cachedAsset.channels.some((channel) => channel.id !== ctx?.channelId)) {
54
+ if (ctx?.channelId &&
55
+ cachedAsset.channels.some((channel) => channel.id !== ctx?.channelId)) {
55
56
  await this.connection
56
57
  .getRepository(ctx, core_1.Asset)
57
58
  .createQueryBuilder()
@@ -708,6 +708,7 @@ let ProductImporter = class ProductImporter {
708
708
  const product = (await this.connection.getRepository(ctx, core_1.Product).findOne({
709
709
  where: { id },
710
710
  withDeleted: true,
711
+ relations: ['featuredAsset'],
711
712
  })) ?? undefined;
712
713
  if (product) {
713
714
  const [facetValues, optionGroups, variants, assets, featuredAsset] = await Promise.all([
@@ -723,7 +724,7 @@ let ProductImporter = class ProductImporter {
723
724
  this.connection.getRepository(ctx, core_1.ProductAsset).find({ where: { productId: product.id } }),
724
725
  this.connection
725
726
  .getRepository(ctx, core_1.Asset)
726
- .findOne({ where: { id: product.featuredAssetId } }),
727
+ .findOne({ where: { id: product.featuredAsset?.id } }),
727
728
  ]);
728
729
  product.facetValues = facetValues;
729
730
  product.optionGroups = optionGroups;
@@ -143,6 +143,9 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
143
143
  input: { ...(0, lodash_1.omit)(input, 'options') },
144
144
  entityType: core_1.ProductOptionGroup,
145
145
  translationType: core_1.ProductOptionGroupTranslation,
146
+ beforeSave: (group) => {
147
+ group.deletedAt = null;
148
+ },
146
149
  });
147
150
  return group.id;
148
151
  }
@@ -159,6 +162,9 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
159
162
  input: { ...(0, lodash_1.omit)(input, 'options'), id: groupExists.id },
160
163
  entityType: core_1.ProductOptionGroup,
161
164
  translationType: core_1.ProductOptionGroupTranslation,
165
+ beforeSave: (group) => {
166
+ group.deletedAt = null;
167
+ },
162
168
  });
163
169
  return groupExists.id;
164
170
  }
@@ -183,7 +189,10 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
183
189
  input: { ...input, id: optionsExist.id },
184
190
  entityType: core_1.ProductOption,
185
191
  translationType: core_1.ProductOptionTranslation,
186
- beforeSave: (po) => (po.group = { id: input.productOptionGroupId }),
192
+ beforeSave: (po) => {
193
+ po.group = { id: input.productOptionGroupId };
194
+ po.deletedAt = null;
195
+ },
187
196
  });
188
197
  return updatedOption.id;
189
198
  }
@@ -192,7 +201,10 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
192
201
  input,
193
202
  entityType: core_1.ProductOption,
194
203
  translationType: core_1.ProductOptionTranslation,
195
- beforeSave: (po) => (po.group = { id: input.productOptionGroupId }),
204
+ beforeSave: (po) => {
205
+ po.group = { id: input.productOptionGroupId };
206
+ po.deletedAt = null;
207
+ },
196
208
  });
197
209
  return option.id;
198
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-tech/product-import-export-plugin",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "A Vendure plugin for importing and exporting products using a CSV file",
5
5
  "author": "Haus Tech",
6
6
  "repository": {