@softwear/latestcollectioncore 1.0.115 → 1.0.116
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.
package/dist/articleStatus.js
CHANGED
|
@@ -30,6 +30,7 @@ let globalNrAggegationExpressions = 0; // tracks the # aggregations rows so we c
|
|
|
30
30
|
* TODO: Functional: Experiment with curried functions
|
|
31
31
|
*/
|
|
32
32
|
function propFunction(propertyName, getPropertyName, obj) {
|
|
33
|
+
var _a, _b;
|
|
33
34
|
const positionOfDot = propertyName.indexOf('.');
|
|
34
35
|
if (positionOfDot < 0)
|
|
35
36
|
return obj[propertyName];
|
|
@@ -37,7 +38,7 @@ function propFunction(propertyName, getPropertyName, obj) {
|
|
|
37
38
|
const field = propertyName.substring(positionOfDot + 1);
|
|
38
39
|
if (table == 'transaction')
|
|
39
40
|
return obj[field];
|
|
40
|
-
return globalRelations[table]
|
|
41
|
+
return ((_b = (_a = globalRelations[table]) === null || _a === void 0 ? void 0 : _a[obj[globalJoinableTables[table]]]) === null || _b === void 0 ? void 0 : _b[field]) || '~ ?';
|
|
41
42
|
}
|
|
42
43
|
const lower = (s) => s.toLowerCase();
|
|
43
44
|
const upper = (s) => s.toUpperCase();
|
|
@@ -172,7 +173,7 @@ function aggregator({ beginTimestamp, endTimestamp, filterExpression, aggregatio
|
|
|
172
173
|
transaction.vector = tmp;
|
|
173
174
|
}
|
|
174
175
|
const v = transaction.vector;
|
|
175
|
-
v[AMOUNT_SOLD_MAX] = (0, index_1.round2)((sku
|
|
176
|
+
v[AMOUNT_SOLD_MAX] = (0, index_1.round2)(((sku === null || sku === void 0 ? void 0 : sku.price) || 0) * v[QTY_SOLD]);
|
|
176
177
|
v[AMOUNT_SOLD_DISCOUNT] = (0, index_1.round2)(v[AMOUNT_SOLD_MAX] - v[AMOUNT_SOLD]);
|
|
177
178
|
}
|
|
178
179
|
if (totals)
|
|
@@ -30,7 +30,7 @@ function default_1(brands, strategy) {
|
|
|
30
30
|
brands.forEach(({ id, propertyMapping }) => {
|
|
31
31
|
if (!indexedByBrandPropertyMapping[id])
|
|
32
32
|
indexedByBrandPropertyMapping[id] = {};
|
|
33
|
-
propertyMapping
|
|
33
|
+
propertyMapping === null || propertyMapping === void 0 ? void 0 : propertyMapping.forEach((mapping) => {
|
|
34
34
|
if (!indexedByBrandPropertyMapping[id][mapping.category])
|
|
35
35
|
indexedByBrandPropertyMapping[id][mapping.category] = {};
|
|
36
36
|
indexedByBrandPropertyMapping[id][mapping.category][mapping.from] = mapping.to;
|
|
@@ -41,8 +41,9 @@ function default_1(brands, strategy) {
|
|
|
41
41
|
const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
|
|
42
42
|
const mapping = indexedByBrandPropertyMapping[brand];
|
|
43
43
|
mappingPairs.forEach((pair) => {
|
|
44
|
+
var _a;
|
|
44
45
|
const from = evaluateFromExpr(sku, pair.from) || '';
|
|
45
|
-
const to = mapping
|
|
46
|
+
const to = (_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a[from];
|
|
46
47
|
if (!from || !to)
|
|
47
48
|
return;
|
|
48
49
|
if (sku[pair.to] == to || from == sku[pair.to])
|
|
@@ -55,10 +56,11 @@ function default_1(brands, strategy) {
|
|
|
55
56
|
const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
|
|
56
57
|
const mapping = indexedByBrandPropertyMapping[brand];
|
|
57
58
|
mappingPairs.forEach((pair) => {
|
|
59
|
+
var _a, _b, _c, _d, _e;
|
|
58
60
|
const from = evaluateFromExpr(sku, pair.from) || '';
|
|
59
|
-
const redirectedMappingSource = mapping
|
|
61
|
+
const redirectedMappingSource = ((_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a['~~']) || pair.defaultMappingSource;
|
|
60
62
|
const redirectedMapping = redirectedMappingSource ? indexedByBrandPropertyMapping[redirectedMappingSource] : {};
|
|
61
|
-
const to = mapping
|
|
63
|
+
const to = ((_b = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _b === void 0 ? void 0 : _b[from]) || ((_c = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _c === void 0 ? void 0 : _c['']) || ((_d = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _d === void 0 ? void 0 : _d[from]) || ((_e = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _e === void 0 ? void 0 : _e['']);
|
|
62
64
|
if (to == undefined)
|
|
63
65
|
sku[pair.to] = '***';
|
|
64
66
|
});
|
|
@@ -68,12 +70,13 @@ function default_1(brands, strategy) {
|
|
|
68
70
|
const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
|
|
69
71
|
const mapping = indexedByBrandPropertyMapping[brand];
|
|
70
72
|
mappingPairs.forEach((pair) => {
|
|
73
|
+
var _a, _b, _c, _d, _e;
|
|
71
74
|
if (sku[pair.to])
|
|
72
75
|
return; // Do not replace sku-level-user-supplied values
|
|
73
76
|
const from = evaluateFromExpr(sku, pair.from);
|
|
74
|
-
const redirectedMappingSource = mapping
|
|
77
|
+
const redirectedMappingSource = ((_a = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _a === void 0 ? void 0 : _a['~~']) || pair.defaultMappingSource;
|
|
75
78
|
const redirectedMapping = redirectedMappingSource ? indexedByBrandPropertyMapping[redirectedMappingSource] : {};
|
|
76
|
-
const to = mapping
|
|
79
|
+
const to = ((_b = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _b === void 0 ? void 0 : _b[from]) || ((_c = mapping === null || mapping === void 0 ? void 0 : mapping[pair.category]) === null || _c === void 0 ? void 0 : _c['']) || ((_d = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _d === void 0 ? void 0 : _d[from]) || ((_e = redirectedMapping === null || redirectedMapping === void 0 ? void 0 : redirectedMapping[pair.category]) === null || _e === void 0 ? void 0 : _e['']);
|
|
77
80
|
if (!from && !to)
|
|
78
81
|
return;
|
|
79
82
|
if (pair.mustMatch) {
|
package/dist/edifact.js
CHANGED
|
@@ -35,14 +35,15 @@ const skusToPricat = function (skus, fromGLN, toGLN, supplierGLN, refID, date) {
|
|
|
35
35
|
pricat.push(grp);
|
|
36
36
|
let lineNumber = 1;
|
|
37
37
|
skus.forEach((sku) => {
|
|
38
|
+
var _a;
|
|
38
39
|
const lin = {
|
|
39
40
|
Tag: 'LIN',
|
|
40
41
|
LineNumber: lineNumber++,
|
|
41
42
|
GTIN: sku.id || sku.barcode,
|
|
42
43
|
ItemNumberSupplier: sku.articleCode || sku.articleCodeSupplier,
|
|
43
44
|
ItemName: sku.articleDescription,
|
|
44
|
-
SupplierSize: (sku.mainSize || sku.sizeSupplier || '').
|
|
45
|
-
SupplierSubSize: sku.subSize
|
|
45
|
+
SupplierSize: (sku.mainSize || sku.sizeSupplier || '').replace('"', ''),
|
|
46
|
+
SupplierSubSize: ((_a = sku.subSize) === null || _a === void 0 ? void 0 : _a.replace('"', '')) || '',
|
|
46
47
|
'Purchase Price': sku.buyPrice || 0,
|
|
47
48
|
SuggestedRetailPrice: sku.price || 0,
|
|
48
49
|
BrandName: sku.brand,
|
package/dist/findSkuByBarcode.js
CHANGED
|
@@ -14,7 +14,7 @@ const lookupAlternativeSkuInArray = function (skus, barcodeToFind) {
|
|
|
14
14
|
if (barcodeToFind.length !== 13)
|
|
15
15
|
return null;
|
|
16
16
|
const prefix = barcodeToFind.substring(0, 12);
|
|
17
|
-
const foundSku = skus.find((sku) => sku.id
|
|
17
|
+
const foundSku = skus.find((sku) => { var _a; return ((_a = sku.id) === null || _a === void 0 ? void 0 : _a.substring(0, 12)) === prefix; });
|
|
18
18
|
return foundSku ? foundSku : null;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
// This function combined the 3 levels of property mapping into one mapping object
|
|
4
4
|
// Each level can be opted in/out in the tenantPreferences defined in the activeConfig parameter
|
|
5
5
|
function default_1(activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
7
|
let allMappings = [];
|
|
7
|
-
if (activeConfig
|
|
8
|
+
if ((_b = (_a = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _a === void 0 ? void 0 : _a.applyLatestCollectionMapping) === null || _b === void 0 ? void 0 : _b.value)
|
|
8
9
|
allMappings = metaBrandSetting;
|
|
9
|
-
if (activeConfig
|
|
10
|
+
if ((_d = (_c = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _c === void 0 ? void 0 : _c.applyDataProviderMapping) === null || _d === void 0 ? void 0 : _d.value)
|
|
10
11
|
activeConfig.products.applyDataProviderMapping.value.forEach((provider) => {
|
|
11
|
-
allMappings = allMappings.concat(dataProviderBrandSetting.filter((s) => s.dataProvider == provider).map((s) => ({
|
|
12
|
+
allMappings = allMappings.concat(dataProviderBrandSetting.filter((s) => s.dataProvider == provider).map((s) => (Object.assign(Object.assign({}, s), { id: s.id.split(":")[0] }))));
|
|
12
13
|
});
|
|
13
|
-
if (activeConfig
|
|
14
|
+
if ((_f = (_e = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _e === void 0 ? void 0 : _e.applyTenantMapping) === null || _f === void 0 ? void 0 : _f.value)
|
|
14
15
|
allMappings = allMappings.concat(tenantBrandSetting);
|
|
15
16
|
return allMappings;
|
|
16
17
|
}
|
package/package.json
CHANGED
package/src/edifact.ts
CHANGED
|
@@ -36,8 +36,8 @@ const skusToPricat = function (skus: MarkedSkuI[], fromGLN: string, toGLN: strin
|
|
|
36
36
|
GTIN: sku.id || sku.barcode,
|
|
37
37
|
ItemNumberSupplier: sku.articleCode || sku.articleCodeSupplier,
|
|
38
38
|
ItemName: sku.articleDescription,
|
|
39
|
-
SupplierSize: (sku.mainSize || sku.sizeSupplier || '').
|
|
40
|
-
SupplierSubSize: sku.subSize?.
|
|
39
|
+
SupplierSize: (sku.mainSize || sku.sizeSupplier || '').replace('"', ''),
|
|
40
|
+
SupplierSubSize: sku.subSize?.replace('"', '') || '',
|
|
41
41
|
'Purchase Price': sku.buyPrice || 0,
|
|
42
42
|
SuggestedRetailPrice: sku.price || 0,
|
|
43
43
|
BrandName: sku.brand,
|
package/tsconfig.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
/* Basic Options */
|
|
5
5
|
// "incremental": true, /* Enable incremental compilation */
|
|
6
|
-
"target": "
|
|
6
|
+
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
|
7
7
|
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
|
8
8
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
9
9
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|