vinmonopolet-ts 5.2.9 → 5.2.10

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.
@@ -13,7 +13,7 @@ exports.PopulatedProduct = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const BaseProduct_1 = __importDefault(require("./BaseProduct"));
15
15
  class PopulatedProduct extends BaseProduct_1.default {
16
- constructor(code, name, url, price, pricePerLiter, images, volume, mainCategory, subCategory, country, district, subDistrict, productSeelection, buyable, status, abv, allergens, bioDynamic, color, eco, environmentalPackaging, expired, fairTrade, gluten, foodPairing, kosher, storable, containerType, taste, aroma, rawMaterial, sugar, acid, tannins, bitterness, freshness, fullness, ageLimit, description, summary, method, producer, distributor, distributorId, wholesaler, vintage) {
16
+ constructor(code, name, url, price, pricePerLiter, images, volume, mainCategory, subCategory, country, district, subDistrict, productSeelection, buyable, status, abv, allergens, bioDynamic, color, eco, environmentalPackaging, expired, fairTrade, gluten, foodPairing, kosher, storable, containerType, taste, aroma, rawMaterial, sugar, acid, tannins, bitterness, freshness, fullness, ageLimit, description, summary, method, producer, distributor, distributorId, wholesaler, vintage, storeCategories) {
17
17
  super(code, name, url, price, pricePerLiter, images, volume, mainCategory, subCategory, country, district, subDistrict, productSeelection, undefined, buyable, status);
18
18
  this.abv = abv;
19
19
  this.allergens = allergens;
@@ -46,6 +46,7 @@ class PopulatedProduct extends BaseProduct_1.default {
46
46
  this.distributorId = distributorId;
47
47
  this.wholesaler = wholesaler;
48
48
  this.vintage = vintage;
49
+ this.storeCategories = storeCategories ?? [];
49
50
  }
50
51
  }
51
52
  __decorate([
@@ -17,9 +17,14 @@ function fromDTOToBaseProduct(dto) {
17
17
  }
18
18
  exports.fromDTOToBaseProduct = fromDTOToBaseProduct;
19
19
  function fromDTOToPopulatedProduct(dto) {
20
- return new PopulatedProduct_1.PopulatedProduct(dto.code, dto.name, dto.url, dto.price?.value ?? 0, calculatePricePerLiter(dto.price?.value, dto.volume), dto.images?.map(mapToProductImage) ?? [], mapToVolume(dto.volume), mapToCategory(dto.main_category), mapToCategory(dto.main_sub_category), mapToCategory(dto.main_country), mapToCategory(dto.district), mapToCategory(dto.sub_District), dto.product_selection, dto.buyable, dto.status, getAbvFromTraits(dto.content?.traits), dto.allergens, dto.bioDynamic, dto.color, dto.eco, dto.environmentalPackaging, dto.expired, dto.fairTrade, dto.gluten, dto.content?.isGoodFor?.map(mapToFoodPairing) ?? [], dto.kosher, dto.content?.storagePotential?.formattedValue, dto.packageType, dto.taste, dto.smell, dto.content?.ingredients?.map(mapToRawMaterial) ?? [], getSugarFromTraits(dto.content?.traits), getAcidFromTraits(dto.content?.traits), getPropertyFromCharacteristics(dto.content?.characteristics, "Garvestoffer"), getPropertyFromCharacteristics(dto.content?.characteristics, "Bitterhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Friskhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Fylde"), dto.ageLimit, dto.description, dto.summary, dto.method, mapToCategory(dto.main_producer), dto.distributor, dto.distributorId?.toString(), dto.wholeSaler, dto.year ? parseInt(dto.year) : undefined);
20
+ return new PopulatedProduct_1.PopulatedProduct(dto.code, dto.name, dto.url, dto.price?.value ?? 0, calculatePricePerLiter(dto.price?.value, dto.volume), dto.images?.map(mapToProductImage) ?? [], mapToVolume(dto.volume), mapToCategory(dto.main_category), mapToCategory(dto.main_sub_category), mapToCategory(dto.main_country), mapToCategory(dto.district), mapToCategory(dto.sub_District), dto.product_selection, dto.buyable, dto.status, getAbvFromTraits(dto.content?.traits), dto.allergens, dto.bioDynamic, dto.color, dto.eco, dto.environmentalPackaging, dto.expired, dto.fairTrade, dto.gluten, dto.content?.isGoodFor?.map(mapToFoodPairing) ?? [], dto.kosher, dto.content?.storagePotential?.formattedValue, dto.packageType, dto.taste, dto.smell, dto.content?.ingredients?.map(mapToRawMaterial) ?? [], getSugarFromTraits(dto.content?.traits), getAcidFromTraits(dto.content?.traits), getPropertyFromCharacteristics(dto.content?.characteristics, "Garvestoffer"), getPropertyFromCharacteristics(dto.content?.characteristics, "Bitterhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Friskhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Fylde"), dto.ageLimit, dto.description, dto.summary, dto.method, mapToCategory(dto.main_producer), dto.distributor, dto.distributorId?.toString(), dto.wholeSaler, dto.year ? parseInt(dto.year) : undefined, parseStoreCategory(dto.storeCategory));
21
21
  }
22
22
  exports.fromDTOToPopulatedProduct = fromDTOToPopulatedProduct;
23
+ function parseStoreCategory(storeCategory) {
24
+ if (!storeCategory)
25
+ return [];
26
+ return storeCategory.split(",").map((s) => s.trim()).filter(Boolean);
27
+ }
23
28
  function calculatePricePerLiter(price, volume) {
24
29
  if (price === undefined ||
25
30
  volume == undefined ||
@@ -103,6 +103,13 @@ export class PopulatedProduct extends BaseProduct {
103
103
  * The minimum age limit in order to buy this product.
104
104
  */
105
105
  ageLimit;
106
+ /**
107
+ * Store categories for this product.
108
+ * The number (1-6) indicates which category the product belongs to. Category 6 means that a product is only sold in category 6 stores. Category 3 means that the product is sold in category 3, 4, 5 and 6 stores.
109
+ * The suffix letter indicates store type: L = Lyst og Lett (LL), R = Rødt og Mørkt (RM).
110
+ * Example: "SB6L" = category 6 in Lyst og Lett stores, "SB5R" = category 5 in Rødt og Mørkt stores.
111
+ */
112
+ storeCategories;
106
113
  // These tend to not be set
107
114
  description;
108
115
  summary;
@@ -113,7 +120,7 @@ export class PopulatedProduct extends BaseProduct {
113
120
  distributorId;
114
121
  wholesaler;
115
122
  vintage;
116
- constructor(code, name, url, price, pricePerLiter, images, volume, mainCategory, subCategory, country, district, subDistrict, productSeelection, buyable, status, abv, allergens, bioDynamic, color, eco, environmentalPackaging, expired, fairTrade, gluten, foodPairing, kosher, storable, containerType, taste, aroma, rawMaterial, sugar, acid, tannins, bitterness, freshness, fullness, ageLimit, description, summary, method, producer, distributor, distributorId, wholesaler, vintage) {
123
+ constructor(code, name, url, price, pricePerLiter, images, volume, mainCategory, subCategory, country, district, subDistrict, productSeelection, buyable, status, abv, allergens, bioDynamic, color, eco, environmentalPackaging, expired, fairTrade, gluten, foodPairing, kosher, storable, containerType, taste, aroma, rawMaterial, sugar, acid, tannins, bitterness, freshness, fullness, ageLimit, description, summary, method, producer, distributor, distributorId, wholesaler, vintage, storeCategories) {
117
124
  super(code, name, url, price, pricePerLiter, images, volume, mainCategory, subCategory, country, district, subDistrict, productSeelection, undefined, buyable, status);
118
125
  this.abv = abv;
119
126
  this.allergens = allergens;
@@ -146,6 +153,7 @@ export class PopulatedProduct extends BaseProduct {
146
153
  this.distributorId = distributorId;
147
154
  this.wholesaler = wholesaler;
148
155
  this.vintage = vintage;
156
+ this.storeCategories = storeCategories ?? [];
149
157
  }
150
158
  }
151
159
  __decorate([
@@ -10,7 +10,12 @@ export function fromDTOToBaseProduct(dto) {
10
10
  return new BaseProduct(dto.code, dto.name, dto.url, dto.price?.value ?? 0, calculatePricePerLiter(dto.price?.value, dto.volume), dto.images.map(mapToProductImage), mapToVolume(dto.volume), mapToCategory(dto.main_category), mapToCategory(dto.main_sub_category), mapToCategory(dto.main_country), mapToCategory(dto.district), mapToCategory(dto.sub_District), dto.product_selection, dto.productAvailability, dto.buyable, dto.status);
11
11
  }
12
12
  export function fromDTOToPopulatedProduct(dto) {
13
- return new PopulatedProduct(dto.code, dto.name, dto.url, dto.price?.value ?? 0, calculatePricePerLiter(dto.price?.value, dto.volume), dto.images?.map(mapToProductImage) ?? [], mapToVolume(dto.volume), mapToCategory(dto.main_category), mapToCategory(dto.main_sub_category), mapToCategory(dto.main_country), mapToCategory(dto.district), mapToCategory(dto.sub_District), dto.product_selection, dto.buyable, dto.status, getAbvFromTraits(dto.content?.traits), dto.allergens, dto.bioDynamic, dto.color, dto.eco, dto.environmentalPackaging, dto.expired, dto.fairTrade, dto.gluten, dto.content?.isGoodFor?.map(mapToFoodPairing) ?? [], dto.kosher, dto.content?.storagePotential?.formattedValue, dto.packageType, dto.taste, dto.smell, dto.content?.ingredients?.map(mapToRawMaterial) ?? [], getSugarFromTraits(dto.content?.traits), getAcidFromTraits(dto.content?.traits), getPropertyFromCharacteristics(dto.content?.characteristics, "Garvestoffer"), getPropertyFromCharacteristics(dto.content?.characteristics, "Bitterhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Friskhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Fylde"), dto.ageLimit, dto.description, dto.summary, dto.method, mapToCategory(dto.main_producer), dto.distributor, dto.distributorId?.toString(), dto.wholeSaler, dto.year ? parseInt(dto.year) : undefined);
13
+ return new PopulatedProduct(dto.code, dto.name, dto.url, dto.price?.value ?? 0, calculatePricePerLiter(dto.price?.value, dto.volume), dto.images?.map(mapToProductImage) ?? [], mapToVolume(dto.volume), mapToCategory(dto.main_category), mapToCategory(dto.main_sub_category), mapToCategory(dto.main_country), mapToCategory(dto.district), mapToCategory(dto.sub_District), dto.product_selection, dto.buyable, dto.status, getAbvFromTraits(dto.content?.traits), dto.allergens, dto.bioDynamic, dto.color, dto.eco, dto.environmentalPackaging, dto.expired, dto.fairTrade, dto.gluten, dto.content?.isGoodFor?.map(mapToFoodPairing) ?? [], dto.kosher, dto.content?.storagePotential?.formattedValue, dto.packageType, dto.taste, dto.smell, dto.content?.ingredients?.map(mapToRawMaterial) ?? [], getSugarFromTraits(dto.content?.traits), getAcidFromTraits(dto.content?.traits), getPropertyFromCharacteristics(dto.content?.characteristics, "Garvestoffer"), getPropertyFromCharacteristics(dto.content?.characteristics, "Bitterhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Friskhet"), getPropertyFromCharacteristics(dto.content?.characteristics, "Fylde"), dto.ageLimit, dto.description, dto.summary, dto.method, mapToCategory(dto.main_producer), dto.distributor, dto.distributorId?.toString(), dto.wholeSaler, dto.year ? parseInt(dto.year) : undefined, parseStoreCategory(dto.storeCategory));
14
+ }
15
+ function parseStoreCategory(storeCategory) {
16
+ if (!storeCategory)
17
+ return [];
18
+ return storeCategory.split(",").map((s) => s.trim()).filter(Boolean);
14
19
  }
15
20
  function calculatePricePerLiter(price, volume) {
16
21
  if (price === undefined ||
@@ -97,6 +97,13 @@ export declare class PopulatedProduct extends BaseProduct {
97
97
  * The minimum age limit in order to buy this product.
98
98
  */
99
99
  ageLimit: number;
100
+ /**
101
+ * Store categories for this product.
102
+ * The number (1-6) indicates which category the product belongs to. Category 6 means that a product is only sold in category 6 stores. Category 3 means that the product is sold in category 3, 4, 5 and 6 stores.
103
+ * The suffix letter indicates store type: L = Lyst og Lett (LL), R = Rødt og Mørkt (RM).
104
+ * Example: "SB6L" = category 6 in Lyst og Lett stores, "SB5R" = category 5 in Rødt og Mørkt stores.
105
+ */
106
+ storeCategories: string[];
100
107
  description?: string;
101
108
  summary?: string;
102
109
  method?: string;
@@ -105,6 +112,6 @@ export declare class PopulatedProduct extends BaseProduct {
105
112
  distributorId?: string;
106
113
  wholesaler?: string;
107
114
  vintage?: number;
108
- constructor(code: string, name: string, url: string, price: number, pricePerLiter: number, images: ProductImage[], volume: Volume | undefined, mainCategory: Category | undefined, subCategory: Category | undefined, country: Category | undefined, district: Category | undefined, subDistrict: Category | undefined, productSeelection: string, buyable: boolean, status: string, abv: number, allergens: string | undefined, bioDynamic: boolean, color: string | undefined, eco: boolean, environmentalPackaging: boolean, expired: boolean, fairTrade: boolean, gluten: boolean, foodPairing: FoodPairing[], kosher: boolean, storable: string | undefined, containerType: string | undefined, taste: string | undefined, aroma: string | undefined, rawMaterial: RawMaterial[], sugar: number | undefined, acid: number | undefined, tannins: number | undefined, bitterness: number | undefined, freshness: number | undefined, fullness: number | undefined, ageLimit: number, description: string | undefined, summary: string | undefined, method: string | undefined, producer: Category | undefined, distributor: string | undefined, distributorId: string | undefined, wholesaler: string | undefined, vintage: number | undefined);
115
+ constructor(code: string, name: string, url: string, price: number, pricePerLiter: number, images: ProductImage[], volume: Volume | undefined, mainCategory: Category | undefined, subCategory: Category | undefined, country: Category | undefined, district: Category | undefined, subDistrict: Category | undefined, productSeelection: string, buyable: boolean, status: string, abv: number, allergens: string | undefined, bioDynamic: boolean, color: string | undefined, eco: boolean, environmentalPackaging: boolean, expired: boolean, fairTrade: boolean, gluten: boolean, foodPairing: FoodPairing[], kosher: boolean, storable: string | undefined, containerType: string | undefined, taste: string | undefined, aroma: string | undefined, rawMaterial: RawMaterial[], sugar: number | undefined, acid: number | undefined, tannins: number | undefined, bitterness: number | undefined, freshness: number | undefined, fullness: number | undefined, ageLimit: number, description: string | undefined, summary: string | undefined, method: string | undefined, producer: Category | undefined, distributor: string | undefined, distributorId: string | undefined, wholesaler: string | undefined, vintage: number | undefined, storeCategories?: string[]);
109
116
  }
110
117
  export default PopulatedProduct;
@@ -72,6 +72,7 @@ export type PopulatedProductDTO = {
72
72
  releaseMode: boolean;
73
73
  similarProducts: boolean;
74
74
  smell: string;
75
+ storeCategory: string;
75
76
  status: string;
76
77
  statusNotification: boolean;
77
78
  stickers: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vinmonopolet-ts",
3
3
  "description": "Extracts information on products, categories and stores from Vinmonopolet",
4
- "version": "5.2.9",
4
+ "version": "5.2.10",
5
5
  "keywords": [
6
6
  "vinmonopolet",
7
7
  "beer",