@softwear/latestcollectioncore 1.0.44 → 1.0.45

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.
@@ -61,6 +61,19 @@ function default_1(brands, strategy) {
61
61
  });
62
62
  return sku;
63
63
  };
64
+ if (strategy == 'markMissingMapping')
65
+ return function (sku) {
66
+ const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
67
+ const mapping = indexedByBrandPropertyMapping[brand];
68
+ mappingPairs.forEach((pair) => {
69
+ var _a;
70
+ const from = sku[pair.from] || '';
71
+ const to = (_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a[from];
72
+ if (to == undefined)
73
+ sku[pair.to] = '***';
74
+ });
75
+ return sku;
76
+ };
64
77
  return function (sku) {
65
78
  const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
66
79
  const mapping = indexedByBrandPropertyMapping[brand];
package/dist/types.d.ts CHANGED
@@ -208,6 +208,7 @@ interface BrandSettingI {
208
208
  }
209
209
  declare enum mappingStrategyE {
210
210
  MAP = "map",
211
- CLEAN = "clean"
211
+ CLEAN = "clean",
212
+ MARK = "markMissingMapping"
212
213
  }
213
214
  export { RowI, StockTransferSelectionI, MarkedSkuI, vatCategoryE, tagTypeE, SkuI, GroupI, ProductI, ImageI, AttributeI, ColorI, MatrixI, StockTransferDataI, StockTransferMatrixI, BrandSettingI, mappingStrategyE, };
package/dist/types.js CHANGED
@@ -18,5 +18,6 @@ var mappingStrategyE;
18
18
  (function (mappingStrategyE) {
19
19
  mappingStrategyE["MAP"] = "map";
20
20
  mappingStrategyE["CLEAN"] = "clean";
21
+ mappingStrategyE["MARK"] = "markMissingMapping";
21
22
  })(mappingStrategyE || (mappingStrategyE = {}));
22
23
  exports.mappingStrategyE = mappingStrategyE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -56,6 +56,17 @@ export default function (brands: Array<BrandSettingI>, strategy: mappingStrategy
56
56
  })
57
57
  return sku
58
58
  }
59
+ if (strategy == 'markMissingMapping')
60
+ return function (sku: SkuI): SkuI {
61
+ const brand = sku.BRANDHASH || hashBrand(sku.brand)
62
+ const mapping = indexedByBrandPropertyMapping[brand]
63
+ mappingPairs.forEach((pair) => {
64
+ const from = sku[pair.from] || ''
65
+ const to = mapping?.[pair.category]?.[from]
66
+ if (to == undefined) sku[pair.to] = '***'
67
+ })
68
+ return sku
69
+ }
59
70
  return function (sku: SkuI): SkuI {
60
71
  const brand = sku.BRANDHASH || hashBrand(sku.brand)
61
72
  const mapping = indexedByBrandPropertyMapping[brand]
package/src/types.ts CHANGED
@@ -1,71 +1,71 @@
1
1
  enum vatCategoryE {
2
- LOW = "low",
3
- HIGH = "high",
4
- ZERO = "zero",
2
+ LOW = 'low',
3
+ HIGH = 'high',
4
+ ZERO = 'zero',
5
5
  }
6
6
 
7
7
  enum tagTypeE {
8
- STICKER = "stikker",
9
- LABEL = "label",
8
+ STICKER = 'stikker',
9
+ LABEL = 'label',
10
10
  }
11
11
 
12
12
  interface ImageI {
13
- name: string;
14
- url: string;
13
+ name: string
14
+ url: string
15
15
  }
16
16
 
17
17
  interface GroupI {
18
- name: string;
19
- value: string;
18
+ name: string
19
+ value: string
20
20
  }
21
21
 
22
22
  interface CareI {
23
- temperature: number;
24
- bleach: number;
25
- iron: number;
26
- chemical: number;
27
- dryer: number;
23
+ temperature: number
24
+ bleach: number
25
+ iron: number
26
+ chemical: number
27
+ dryer: number
28
28
  }
29
29
 
30
30
  interface AttributeI {
31
- key: string;
32
- value: string;
31
+ key: string
32
+ value: string
33
33
  }
34
34
  // better represents what the key is in MatrixI
35
- type barcode = string;
35
+ type barcode = string
36
36
 
37
37
  interface RowI {
38
- cells: { key?: barcode | undefined; value: number; state?: string }[]; // uses the barcode for backtracking of each cell
39
- group: string; // first column of a row, could be a grouper or a color
40
- initialIndex?: number; // used for filtered data
41
- filteredOut?: boolean; // used for filtered data
42
- warehouse?: string; // used for stock management, the actual string might be in the group key as well
43
- selected?: boolean; // used for UI
38
+ cells: { key?: barcode | undefined; value: number; state?: string }[] // uses the barcode for backtracking of each cell
39
+ group: string // first column of a row, could be a grouper or a color
40
+ initialIndex?: number // used for filtered data
41
+ filteredOut?: boolean // used for filtered data
42
+ warehouse?: string // used for stock management, the actual string might be in the group key as well
43
+ selected?: boolean // used for UI
44
44
  }
45
45
 
46
46
  interface MatrixI {
47
- matrixMetadata: string | string[];
48
- headers: string[];
49
- rows: RowI[];
47
+ matrixMetadata: string | string[]
48
+ headers: string[]
49
+ rows: RowI[]
50
50
  }
51
51
 
52
52
  interface StockTransferMatrixI {
53
- rows: RowI[];
54
- selection: StockTransferSelectionI;
53
+ rows: RowI[]
54
+ selection: StockTransferSelectionI
55
55
  }
56
56
 
57
57
  interface StockTransferDataI extends StockTransferMatrixI {
58
- rowIndex: number;
59
- cellIndex: number | undefined;
60
- value: number | undefined;
58
+ rowIndex: number
59
+ cellIndex: number | undefined
60
+ value: number | undefined
61
61
  }
62
62
 
63
63
  interface StockTransferSelectionI {
64
64
  cells: {
65
- cellIndex: number;
66
- value: number;
67
- }[];
68
- rowIndex: number | null;
65
+ cellIndex: number
66
+ value: number
67
+ }[]
68
+ rowIndex: number | null
69
69
  }
70
70
 
71
71
  /**
@@ -79,80 +79,80 @@ interface StockTransferSelectionI {
79
79
  * They are not part of the persistent data model
80
80
  */
81
81
  interface SkuI {
82
- barcode?: barcode;
83
- id?: barcode;
84
- primary?: boolean;
85
- articleCode: string;
86
- articleDescription: string;
87
- pricetagLayouts?: string;
88
- brand: string;
89
- articleGroup?: string;
90
- articleGroupSupplier?: string;
91
- campaigns?: string;
92
- images?: string;
93
- vat?: number;
94
- vatCategory?: vatCategoryE;
95
- supplierName?: string;
96
- size: string;
97
- sizeSupplier?: string;
98
- mainSize?: string;
99
- subSize?: string;
100
- subSizeSupplier?: string;
101
- sizeIndex?: number;
102
- sizes?: Array<string>;
103
- sizeRange?: string;
104
- colorCode?: string;
105
- colorDescription?: string;
106
- colorSupplier?: string;
107
- colorCodeSupplier?: string;
108
- colorFamily: string;
109
- mainColorCode?: string;
110
- mainColorDescription?: string;
111
- subColorCode?: string;
112
- subColorDescription?: string;
113
- articleCodeSupplier?: string;
114
- price?: number;
115
- buyPrice?: number;
116
- suggestedRetailPrice?: number;
117
- valuePrice?: number;
118
- salePrice?: number;
119
- prices?: unknown;
120
- year?: string;
121
- season?: string;
122
- collection?: string;
123
- collectionSupplier?: string;
124
- active?: boolean;
125
- skuActive?: boolean;
126
- warehouseLocation?: string;
127
- tagType?: tagTypeE;
128
- directDelivery?: boolean;
129
- care?: CareI;
130
- BRANDHASH?: string;
131
- ATTRIBUTES?: object;
132
- IMAGES?: Array<ImageI>;
133
- SIZES?: unknown;
134
- FOOTPRINT?: number;
135
- quickPick?: number;
136
- gln?: string;
137
- set?: string;
138
- erpSource?: string;
82
+ barcode?: barcode
83
+ id?: barcode
84
+ primary?: boolean
85
+ articleCode: string
86
+ articleDescription: string
87
+ pricetagLayouts?: string
88
+ brand: string
89
+ articleGroup?: string
90
+ articleGroupSupplier?: string
91
+ campaigns?: string
92
+ images?: string
93
+ vat?: number
94
+ vatCategory?: vatCategoryE
95
+ supplierName?: string
96
+ size: string
97
+ sizeSupplier?: string
98
+ mainSize?: string
99
+ subSize?: string
100
+ subSizeSupplier?: string
101
+ sizeIndex?: number
102
+ sizes?: Array<string>
103
+ sizeRange?: string
104
+ colorCode?: string
105
+ colorDescription?: string
106
+ colorSupplier?: string
107
+ colorCodeSupplier?: string
108
+ colorFamily: string
109
+ mainColorCode?: string
110
+ mainColorDescription?: string
111
+ subColorCode?: string
112
+ subColorDescription?: string
113
+ articleCodeSupplier?: string
114
+ price?: number
115
+ buyPrice?: number
116
+ suggestedRetailPrice?: number
117
+ valuePrice?: number
118
+ salePrice?: number
119
+ prices?: unknown
120
+ year?: string
121
+ season?: string
122
+ collection?: string
123
+ collectionSupplier?: string
124
+ active?: boolean
125
+ skuActive?: boolean
126
+ warehouseLocation?: string
127
+ tagType?: tagTypeE
128
+ directDelivery?: boolean
129
+ care?: CareI
130
+ BRANDHASH?: string
131
+ ATTRIBUTES?: object
132
+ IMAGES?: Array<ImageI>
133
+ SIZES?: unknown
134
+ FOOTPRINT?: number
135
+ quickPick?: number
136
+ gln?: string
137
+ set?: string
138
+ erpSource?: string
139
139
  }
140
140
 
141
141
  interface MarkedSkuI extends SkuI {
142
- SOURCE?: string;
143
- groups?: Array<GroupI>;
144
- usedByTenant?: boolean;
145
- warehouse?: string;
146
- qty?: number;
142
+ SOURCE?: string
143
+ groups?: Array<GroupI>
144
+ usedByTenant?: boolean
145
+ warehouse?: string
146
+ qty?: number
147
147
  }
148
148
 
149
149
  interface ColorI {
150
- color: string;
151
- subColors: Array<string>;
152
- IMAGES: Array<ImageI>;
153
- colorCodeSupplier: string;
154
- colorSupplier: string;
155
- newColor?: boolean;
150
+ color: string
151
+ subColors: Array<string>
152
+ IMAGES: Array<ImageI>
153
+ colorCodeSupplier: string
154
+ colorSupplier: string
155
+ newColor?: boolean
156
156
  }
157
157
 
158
158
  /**
@@ -162,66 +162,67 @@ interface ColorI {
162
162
  *
163
163
  */
164
164
  interface ProductI {
165
- ATTRIBUTES: object;
166
- COLORS: Array<ColorI>;
167
- IMAGES?: unknown;
168
- INDEX: object;
169
- MATRIX?: MatrixI;
170
- SIZES: Array<string>;
171
- SKUS: Array<MarkedSkuI>;
172
- active: boolean;
173
- articleCode: string;
174
- articleCodeSupplier?: string;
175
- articleDescription: string;
176
- articleGroup: string;
177
- articleGroupSupplier: string;
178
- brand: string;
179
- buyPrice: number;
180
- care?: CareI;
181
- collection: string;
182
- collectionSupplier: string;
183
- groups: Array<GroupI>;
184
- price: number;
185
- prices?: unknown;
186
- pricetagLayouts: Array<string>;
187
- season?: string;
188
- suggestedRetailPrice: number;
189
- supplierName?: string;
190
- tagType?: tagTypeE;
191
- valuePrice: number;
192
- vat: number;
193
- vatCategory: vatCategoryE;
194
- warehouseLocation: string;
195
- year?: string;
165
+ ATTRIBUTES: object
166
+ COLORS: Array<ColorI>
167
+ IMAGES?: unknown
168
+ INDEX: object
169
+ MATRIX?: MatrixI
170
+ SIZES: Array<string>
171
+ SKUS: Array<MarkedSkuI>
172
+ active: boolean
173
+ articleCode: string
174
+ articleCodeSupplier?: string
175
+ articleDescription: string
176
+ articleGroup: string
177
+ articleGroupSupplier: string
178
+ brand: string
179
+ buyPrice: number
180
+ care?: CareI
181
+ collection: string
182
+ collectionSupplier: string
183
+ groups: Array<GroupI>
184
+ price: number
185
+ prices?: unknown
186
+ pricetagLayouts: Array<string>
187
+ season?: string
188
+ suggestedRetailPrice: number
189
+ supplierName?: string
190
+ tagType?: tagTypeE
191
+ valuePrice: number
192
+ vat: number
193
+ vatCategory: vatCategoryE
194
+ warehouseLocation: string
195
+ year?: string
196
196
  }
197
197
 
198
198
  interface BrandSettingI {
199
- id: string;
200
- name: string;
201
- collection: string;
202
- count?: number;
203
- lasttime?: number;
204
- hideBrand?: boolean;
205
- dataProviders?: object[];
206
- url?: string;
207
- www?: string;
208
- externalLink?: string;
209
- aliases?: string[];
210
- email?: string;
211
- purchaseOrderEmail?: string;
212
- gln?: string;
213
- ownerTenantId?: string;
214
- orderMethods?: string[];
215
- whiteListTenants?: string[];
216
- associates?: object[];
217
- authGroups?: string[];
218
- propertyMapping?: object[];
219
- fashionCloudId?: string;
199
+ id: string
200
+ name: string
201
+ collection: string
202
+ count?: number
203
+ lasttime?: number
204
+ hideBrand?: boolean
205
+ dataProviders?: object[]
206
+ url?: string
207
+ www?: string
208
+ externalLink?: string
209
+ aliases?: string[]
210
+ email?: string
211
+ purchaseOrderEmail?: string
212
+ gln?: string
213
+ ownerTenantId?: string
214
+ orderMethods?: string[]
215
+ whiteListTenants?: string[]
216
+ associates?: object[]
217
+ authGroups?: string[]
218
+ propertyMapping?: object[]
219
+ fashionCloudId?: string
220
220
  }
221
221
 
222
222
  enum mappingStrategyE {
223
- MAP = "map",
224
- CLEAN = "clean",
223
+ MAP = 'map',
224
+ CLEAN = 'clean',
225
+ MARK = 'markMissingMapping',
225
226
  }
226
227
  export {
227
228
  RowI,
@@ -240,4 +241,4 @@ export {
240
241
  StockTransferMatrixI,
241
242
  BrandSettingI,
242
243
  mappingStrategyE,
243
- };
244
+ }