@rh-support/utils 0.2.23 → 0.2.31
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/README.md +2 -0
- package/lib/cjs/productsUtils.d.ts +7 -0
- package/lib/cjs/productsUtils.d.ts.map +1 -1
- package/lib/cjs/productsUtils.js +21 -1
- package/lib/esm/productsUtils.d.ts +7 -0
- package/lib/esm/productsUtils.d.ts.map +1 -1
- package/lib/esm/productsUtils.js +18 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,6 +5,13 @@ export interface ITroubleshootProductResponse {
|
|
|
5
5
|
productsResult: Partial<ISEProduct>[];
|
|
6
6
|
}
|
|
7
7
|
export declare const handleProductSearchResponse: (productsResultAll: ISEProduct[], productsResultEntitled?: IProductV2[]) => ITroubleshootProductResponse;
|
|
8
|
+
/**
|
|
9
|
+
* This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
|
|
10
|
+
* and need to create partial response like method `handleProductSearchResponse`
|
|
11
|
+
* @param productsResultEntitled IProductV2[]
|
|
12
|
+
* @returns ITroubleshootProductResponse
|
|
13
|
+
*/
|
|
14
|
+
export declare const handleEntitledProductResponse: (productsResultEntitled?: IProductV2[]) => ITroubleshootProductResponse;
|
|
8
15
|
/**
|
|
9
16
|
* Tries to get top 5 products with priority given to recentlyFiledAgainst
|
|
10
17
|
* before checking general top products from un-authed SE API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productsUtils.d.ts","sourceRoot":"","sources":["../../src/productsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAWhF,MAAM,WAAW,4BAA4B;IACzC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;CACz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AED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAE/C;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAEzD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAEzD;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,MAAM,MAAM,eAmBnD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,EAAE,aAExC,CAAC;AAEF,UAAU,sBAAsB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAkBlE"}
|
package/lib/cjs/productsUtils.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleProductSearchResponse = void 0;
|
|
38
|
+
exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleEntitledProductResponse = exports.handleProductSearchResponse = void 0;
|
|
39
39
|
var difference_1 = __importDefault(require("lodash/difference"));
|
|
40
40
|
var forEach_1 = __importDefault(require("lodash/forEach"));
|
|
41
41
|
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
@@ -71,6 +71,26 @@ var handleProductSearchResponse = function (productsResultAll, productsResultEnt
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
exports.handleProductSearchResponse = handleProductSearchResponse;
|
|
74
|
+
/**
|
|
75
|
+
* This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
|
|
76
|
+
* and need to create partial response like method `handleProductSearchResponse`
|
|
77
|
+
* @param productsResultEntitled IProductV2[]
|
|
78
|
+
* @returns ITroubleshootProductResponse
|
|
79
|
+
*/
|
|
80
|
+
var handleEntitledProductResponse = function (productsResultEntitled) {
|
|
81
|
+
if (productsResultEntitled === void 0) { productsResultEntitled = []; }
|
|
82
|
+
var productsResult = productsResultEntitled.map(function (product) {
|
|
83
|
+
return __assign(__assign({}, product), { product: product.name });
|
|
84
|
+
});
|
|
85
|
+
var topProducts = getTopProducts(productsResult);
|
|
86
|
+
var productsResultSorted = orderBy_1.default(productsResult, ['product'], ['asc']);
|
|
87
|
+
return {
|
|
88
|
+
productsResult: productsResultSorted,
|
|
89
|
+
topProducts: topProducts,
|
|
90
|
+
otherProducts: difference_1.default(productsResultSorted, topProducts),
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
exports.handleEntitledProductResponse = handleEntitledProductResponse;
|
|
74
94
|
/**
|
|
75
95
|
* Tries to get top 5 products with priority given to recentlyFiledAgainst
|
|
76
96
|
* before checking general top products from un-authed SE API
|
|
@@ -5,6 +5,13 @@ export interface ITroubleshootProductResponse {
|
|
|
5
5
|
productsResult: Partial<ISEProduct>[];
|
|
6
6
|
}
|
|
7
7
|
export declare const handleProductSearchResponse: (productsResultAll: ISEProduct[], productsResultEntitled?: IProductV2[]) => ITroubleshootProductResponse;
|
|
8
|
+
/**
|
|
9
|
+
* This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
|
|
10
|
+
* and need to create partial response like method `handleProductSearchResponse`
|
|
11
|
+
* @param productsResultEntitled IProductV2[]
|
|
12
|
+
* @returns ITroubleshootProductResponse
|
|
13
|
+
*/
|
|
14
|
+
export declare const handleEntitledProductResponse: (productsResultEntitled?: IProductV2[]) => ITroubleshootProductResponse;
|
|
8
15
|
/**
|
|
9
16
|
* Tries to get top 5 products with priority given to recentlyFiledAgainst
|
|
10
17
|
* before checking general top products from un-authed SE API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productsUtils.d.ts","sourceRoot":"","sources":["../../src/productsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAWhF,MAAM,WAAW,4BAA4B;IACzC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;CACzC;AAED,eAAO,MAAM,2BAA2B,sBACjB,UAAU,EAAE,2BACP,UAAU,EAAE,KACrC,4BA6BF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,yBAO7D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAE/C;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAEzD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAEzD;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,MAAM,MAAM,eAmBnD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,EAAE,aAExC,CAAC;AAEF,UAAU,sBAAsB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAkBlE"}
|
|
1
|
+
{"version":3,"file":"productsUtils.d.ts","sourceRoot":"","sources":["../../src/productsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAWhF,MAAM,WAAW,4BAA4B;IACzC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;CACzC;AAED,eAAO,MAAM,2BAA2B,sBACjB,UAAU,EAAE,2BACP,UAAU,EAAE,KACrC,4BA6BF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,4BACd,UAAU,EAAE,KACrC,4BAcF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,yBAO7D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAE/C;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAEzD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAEzD;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,MAAM,MAAM,eAmBnD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,EAAE,aAExC,CAAC;AAEF,UAAU,sBAAsB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAkBlE"}
|
package/lib/esm/productsUtils.js
CHANGED
|
@@ -31,6 +31,24 @@ export const handleProductSearchResponse = (productsResultAll, productsResultEnt
|
|
|
31
31
|
otherProducts: difference(productsResultSorted, topProducts),
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
|
|
36
|
+
* and need to create partial response like method `handleProductSearchResponse`
|
|
37
|
+
* @param productsResultEntitled IProductV2[]
|
|
38
|
+
* @returns ITroubleshootProductResponse
|
|
39
|
+
*/
|
|
40
|
+
export const handleEntitledProductResponse = (productsResultEntitled = []) => {
|
|
41
|
+
const productsResult = productsResultEntitled.map((product) => {
|
|
42
|
+
return Object.assign(Object.assign({}, product), { product: product.name });
|
|
43
|
+
});
|
|
44
|
+
const topProducts = getTopProducts(productsResult);
|
|
45
|
+
const productsResultSorted = orderBy(productsResult, ['product'], ['asc']);
|
|
46
|
+
return {
|
|
47
|
+
productsResult: productsResultSorted,
|
|
48
|
+
topProducts,
|
|
49
|
+
otherProducts: difference(productsResultSorted, topProducts),
|
|
50
|
+
};
|
|
51
|
+
};
|
|
34
52
|
/**
|
|
35
53
|
* Tries to get top 5 products with priority given to recentlyFiledAgainst
|
|
36
54
|
* before checking general top products from un-authed SE API
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.31",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@cee-eng/hydrajs": "4.7.20",
|
|
65
65
|
"@cee-eng/ui-toolkit": "1.1.6",
|
|
66
|
-
"@rh-support/api": "
|
|
67
|
-
"@rh-support/types": "
|
|
66
|
+
"@rh-support/api": "0.3.10",
|
|
67
|
+
"@rh-support/types": "0.2.0",
|
|
68
68
|
"dompurify": "^2.2.6",
|
|
69
69
|
"dot": "^1.1.3",
|
|
70
70
|
"i18next": "^19.0.1",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"@types/react-dom": "^17.0.9",
|
|
88
88
|
"moment-timezone": "^0.5.32"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "274324da926ca7deeaeba9fe702cacd0129941a1"
|
|
91
91
|
}
|