@rh-support/utils 2.4.10-beta.6 → 2.5.1
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 +0 -2
- package/lib/esm/apiUtils.d.ts +2 -2
- package/lib/esm/apiUtils.d.ts.map +1 -1
- package/lib/esm/apiUtils.js +18 -6
- package/lib/esm/csvUtils.d.ts +2 -2
- package/lib/esm/csvUtils.d.ts.map +1 -1
- package/lib/esm/csvUtils.js +9 -16
- package/lib/esm/dateUtils.d.ts +11 -9
- package/lib/esm/dateUtils.d.ts.map +1 -1
- package/lib/esm/dateUtils.js +96 -11
- package/lib/esm/dropdownUtils.d.ts +1 -1
- package/lib/esm/dropdownUtils.d.ts.map +1 -1
- package/lib/esm/eventUtils.d.ts +14 -2
- package/lib/esm/eventUtils.d.ts.map +1 -1
- package/lib/esm/eventUtils.js +101 -5
- package/lib/esm/hostNameUtils.d.ts.map +1 -1
- package/lib/esm/hydraConfigUtils.d.ts +1 -1
- package/lib/esm/hydraConfigUtils.d.ts.map +1 -1
- package/lib/esm/index.d.ts +0 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +0 -2
- package/lib/esm/outlier.d.ts.map +1 -1
- package/lib/esm/promiseUtils.d.ts.map +1 -1
- package/lib/esm/recommendationUtils.js +2 -2
- package/lib/esm/searchApiUtils.d.ts +2 -2
- package/lib/esm/searchApiUtils.d.ts.map +1 -1
- package/lib/esm/searchApiUtils.js +3 -3
- package/lib/esm/solrUtils.d.ts +4 -4
- package/lib/esm/solrUtils.d.ts.map +1 -1
- package/lib/esm/solrUtils.js +1 -2
- package/lib/esm/translation-helper.d.ts +5 -1
- package/lib/esm/translation-helper.d.ts.map +1 -1
- package/lib/esm/translation-helper.js +1 -1
- package/lib/esm/urlUtils.d.ts +3 -1
- package/lib/esm/urlUtils.d.ts.map +1 -1
- package/lib/esm/urlUtils.js +14 -5
- package/lib/esm/validatorUtils.js +1 -1
- package/package.json +17 -31
- package/lib/cjs/apiUtils.d.ts +0 -17
- package/lib/cjs/apiUtils.d.ts.map +0 -1
- package/lib/cjs/apiUtils.js +0 -52
- package/lib/cjs/appUtils.d.ts +0 -11
- package/lib/cjs/appUtils.d.ts.map +0 -1
- package/lib/cjs/appUtils.js +0 -67
- package/lib/cjs/browserDetectionUtils.d.ts +0 -3
- package/lib/cjs/browserDetectionUtils.d.ts.map +0 -1
- package/lib/cjs/browserDetectionUtils.js +0 -9
- package/lib/cjs/cacheUtils.d.ts +0 -27
- package/lib/cjs/cacheUtils.d.ts.map +0 -1
- package/lib/cjs/cacheUtils.js +0 -137
- package/lib/cjs/caseUtils.d.ts +0 -40
- package/lib/cjs/caseUtils.d.ts.map +0 -1
- package/lib/cjs/caseUtils.js +0 -225
- package/lib/cjs/constants/preferredLanguages.d.ts +0 -33
- package/lib/cjs/constants/preferredLanguages.d.ts.map +0 -1
- package/lib/cjs/constants/preferredLanguages.js +0 -35
- package/lib/cjs/csvUtils.d.ts +0 -24
- package/lib/cjs/csvUtils.d.ts.map +0 -1
- package/lib/cjs/csvUtils.js +0 -109
- package/lib/cjs/customElementUtils.d.ts +0 -20
- package/lib/cjs/customElementUtils.d.ts.map +0 -1
- package/lib/cjs/customElementUtils.js +0 -23
- package/lib/cjs/dateUtils.d.ts +0 -16
- package/lib/cjs/dateUtils.d.ts.map +0 -1
- package/lib/cjs/dateUtils.js +0 -78
- package/lib/cjs/dropdownUtils.d.ts +0 -18
- package/lib/cjs/dropdownUtils.d.ts.map +0 -1
- package/lib/cjs/dropdownUtils.js +0 -59
- package/lib/cjs/eventUtils.d.ts +0 -9
- package/lib/cjs/eventUtils.d.ts.map +0 -1
- package/lib/cjs/eventUtils.js +0 -32
- package/lib/cjs/hostNameUtils.d.ts +0 -7
- package/lib/cjs/hostNameUtils.d.ts.map +0 -1
- package/lib/cjs/hostNameUtils.js +0 -35
- package/lib/cjs/hydraConfigUtils.d.ts +0 -14
- package/lib/cjs/hydraConfigUtils.d.ts.map +0 -1
- package/lib/cjs/hydraConfigUtils.js +0 -83
- package/lib/cjs/index.d.ts +0 -30
- package/lib/cjs/index.d.ts.map +0 -1
- package/lib/cjs/index.js +0 -41
- package/lib/cjs/insightRuleInfoUtils.d.ts +0 -4
- package/lib/cjs/insightRuleInfoUtils.d.ts.map +0 -1
- package/lib/cjs/insightRuleInfoUtils.js +0 -31
- package/lib/cjs/lruCacheUtils.d.ts +0 -13
- package/lib/cjs/lruCacheUtils.d.ts.map +0 -1
- package/lib/cjs/lruCacheUtils.js +0 -45
- package/lib/cjs/outlier.d.ts +0 -16
- package/lib/cjs/outlier.d.ts.map +0 -1
- package/lib/cjs/outlier.js +0 -48
- package/lib/cjs/productsUtils.d.ts +0 -33
- package/lib/cjs/productsUtils.d.ts.map +0 -1
- package/lib/cjs/productsUtils.js +0 -138
- package/lib/cjs/promiseUtils.d.ts +0 -8
- package/lib/cjs/promiseUtils.d.ts.map +0 -1
- package/lib/cjs/promiseUtils.js +0 -23
- package/lib/cjs/recommendationUtils.d.ts +0 -14
- package/lib/cjs/recommendationUtils.d.ts.map +0 -1
- package/lib/cjs/recommendationUtils.js +0 -61
- package/lib/cjs/scrollUtils.d.ts +0 -11
- package/lib/cjs/scrollUtils.d.ts.map +0 -1
- package/lib/cjs/scrollUtils.js +0 -74
- package/lib/cjs/searchApiUtils.d.ts +0 -44
- package/lib/cjs/searchApiUtils.d.ts.map +0 -1
- package/lib/cjs/searchApiUtils.js +0 -48
- package/lib/cjs/sentry.d.ts +0 -14
- package/lib/cjs/sentry.d.ts.map +0 -1
- package/lib/cjs/sentry.js +0 -40
- package/lib/cjs/solrUtils.d.ts +0 -74
- package/lib/cjs/solrUtils.d.ts.map +0 -1
- package/lib/cjs/solrUtils.js +0 -322
- package/lib/cjs/styleUtils.d.ts +0 -12
- package/lib/cjs/styleUtils.d.ts.map +0 -1
- package/lib/cjs/styleUtils.js +0 -34
- package/lib/cjs/tncUtil.d.ts +0 -16
- package/lib/cjs/tncUtil.d.ts.map +0 -1
- package/lib/cjs/tncUtil.js +0 -39
- package/lib/cjs/translation-helper.d.ts +0 -10
- package/lib/cjs/translation-helper.d.ts.map +0 -1
- package/lib/cjs/translation-helper.js +0 -23
- package/lib/cjs/urlUtils.d.ts +0 -19
- package/lib/cjs/urlUtils.d.ts.map +0 -1
- package/lib/cjs/urlUtils.js +0 -76
- package/lib/cjs/userUtils.d.ts +0 -3
- package/lib/cjs/userUtils.d.ts.map +0 -1
- package/lib/cjs/userUtils.js +0 -11
- package/lib/cjs/validatorUtils.d.ts +0 -11
- package/lib/cjs/validatorUtils.d.ts.map +0 -1
- package/lib/cjs/validatorUtils.js +0 -76
- package/lib/esm/customElementUtils.d.ts +0 -20
- package/lib/esm/customElementUtils.d.ts.map +0 -1
- package/lib/esm/customElementUtils.js +0 -19
- package/lib/esm/insightRuleInfoUtils.d.ts +0 -4
- package/lib/esm/insightRuleInfoUtils.d.ts.map +0 -1
- package/lib/esm/insightRuleInfoUtils.js +0 -23
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isImageFile = exports.isValidGuid = exports.mailformat = exports.emojiPattern = exports.isEmojiPattern = exports.isValidRHEmail = exports.isRegularVersion = exports.isNumber = exports.isEmailValid = void 0;
|
|
4
|
-
const emojiPattern = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/gu;
|
|
5
|
-
exports.emojiPattern = emojiPattern;
|
|
6
|
-
const mailformat = new RegExp(
|
|
7
|
-
// eslint-disable-next-line no-control-regex
|
|
8
|
-
"([!#-'*+/-9=?A-Z^-~-]+(.[!#-'*+/-9=?A-Z^-~-]+)*|\"([]!#-[^-~ \t]|(\\[\t -~]))+\")@([!#-'*+/-9=?A-Z^-~-]+(.[!#-'*+/-9=?A-Z^-~-]+)*|[[\t -Z^-~]*])");
|
|
9
|
-
exports.mailformat = mailformat;
|
|
10
|
-
const imageRegex = /^image\/(gif|png|jpeg)$/;
|
|
11
|
-
// To check if email is valid
|
|
12
|
-
function isEmailValid(object) {
|
|
13
|
-
if (object.match(mailformat)) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.isEmailValid = isEmailValid;
|
|
21
|
-
// To check if email is RH email
|
|
22
|
-
function isValidRHEmail(object) {
|
|
23
|
-
if (object.match(mailformat) && object.search('redhat.com') > 0) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.isValidRHEmail = isValidRHEmail;
|
|
31
|
-
function isEmojiPattern(object) {
|
|
32
|
-
if (object && object.match(emojiPattern)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.isEmojiPattern = isEmojiPattern;
|
|
40
|
-
function isValidGuid(object) {
|
|
41
|
-
const guidFormat = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
42
|
-
if (object.match(guidFormat)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.isValidGuid = isValidGuid;
|
|
50
|
-
function isNumber(str) {
|
|
51
|
-
return !isNaN(parseInt(str));
|
|
52
|
-
}
|
|
53
|
-
exports.isNumber = isNumber;
|
|
54
|
-
function isRegularVersion(version) {
|
|
55
|
-
// splits the version into its parts because some versions can have words in front of them (e.g. Red Hat Build of Thorntail - Thorntail 1.x)
|
|
56
|
-
const versionPartsArray = version.split(' ');
|
|
57
|
-
// find the index that has the version and split it into its pars
|
|
58
|
-
const indexOfVersion = versionPartsArray.findIndex((p) => p.includes('.'));
|
|
59
|
-
const splitArray = indexOfVersion > -1 ? versionPartsArray[indexOfVersion].split('.') : version.split('.');
|
|
60
|
-
// if the length of the split array is not 2, or 3 it is not a regular version
|
|
61
|
-
// b/c version === major.minor.patch (patch === component in the request body)
|
|
62
|
-
if (splitArray.length !== 2 && splitArray.length !== 3 && splitArray.length !== 4)
|
|
63
|
-
return false;
|
|
64
|
-
// if either of the split array is not a number then it is not a regular version.
|
|
65
|
-
// there is no need to check if the second or third is a number because it is possible for the version to have a letter the version "number"
|
|
66
|
-
// e.g. 1.x or 1.2.x
|
|
67
|
-
if (!isNumber(splitArray[0]))
|
|
68
|
-
return false;
|
|
69
|
-
else
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
exports.isRegularVersion = isRegularVersion;
|
|
73
|
-
function isImageFile(fileType) {
|
|
74
|
-
return imageRegex.test(fileType);
|
|
75
|
-
}
|
|
76
|
-
exports.isImageFile = isImageFile;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare enum CustomElements {
|
|
2
|
-
pfeTabs = "pfe-tabs",
|
|
3
|
-
pfeCollapse = "pfe-collapse"
|
|
4
|
-
}
|
|
5
|
-
interface RequireCustomElementObject {
|
|
6
|
-
/** The custom element you want to check if it has been defined */
|
|
7
|
-
element: CustomElements;
|
|
8
|
-
/** cb that will be called if the custom element has yet to be defined */
|
|
9
|
-
requireCb: () => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* This function is to check if custom elements exist and require them if they do not.
|
|
13
|
-
* The check is needed because of how the packages are split and that patternfly elements
|
|
14
|
-
* use window.customElements.define without checking if it is already defined, which throws an
|
|
15
|
-
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that
|
|
16
|
-
* the pfelement does not get defined twice.
|
|
17
|
-
*/
|
|
18
|
-
export declare function requireCustomElement(elements: RequireCustomElementObject[]): void;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=customElementUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customElementUtils.d.ts","sourceRoot":"","sources":["../../src/customElementUtils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,OAAO,aAAa;IACpB,WAAW,iBAAiB;CAC/B;AAED,UAAU,0BAA0B;IAChC,kEAAkE;IAClE,OAAO,EAAE,cAAc,CAAC;IAExB,yEAAyE;IACzE,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,QAM1E"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export var CustomElements;
|
|
2
|
-
(function (CustomElements) {
|
|
3
|
-
CustomElements["pfeTabs"] = "pfe-tabs";
|
|
4
|
-
CustomElements["pfeCollapse"] = "pfe-collapse";
|
|
5
|
-
})(CustomElements || (CustomElements = {}));
|
|
6
|
-
/**
|
|
7
|
-
* This function is to check if custom elements exist and require them if they do not.
|
|
8
|
-
* The check is needed because of how the packages are split and that patternfly elements
|
|
9
|
-
* use window.customElements.define without checking if it is already defined, which throws an
|
|
10
|
-
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that
|
|
11
|
-
* the pfelement does not get defined twice.
|
|
12
|
-
*/
|
|
13
|
-
export function requireCustomElement(elements) {
|
|
14
|
-
elements.forEach((elementObj) => {
|
|
15
|
-
if (window.customElements.get(elementObj.element) === undefined) {
|
|
16
|
-
elementObj.requireCb();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Details } from '@cee-eng/hydrajs/@types/models/insights';
|
|
2
|
-
export declare function getRuleReasonHtml(ruleReason: string, reportDetails: Details): string;
|
|
3
|
-
export declare function parseDotTemplate(dotString: string, reportDetails: Details): string;
|
|
4
|
-
//# sourceMappingURL=insightRuleInfoUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"insightRuleInfoUtils.d.ts","sourceRoot":"","sources":["../../src/insightRuleInfoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AASlE,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,UAI3E;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,UASzE"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { markdownToHTML } from '@cee-eng/ui-toolkit';
|
|
2
|
-
import doT from 'dot/doT';
|
|
3
|
-
import assign from 'lodash/assign';
|
|
4
|
-
doT.templateSettings = assign({}, doT.templateSettings, {
|
|
5
|
-
varname: 'pydata',
|
|
6
|
-
strip: false,
|
|
7
|
-
});
|
|
8
|
-
export function getRuleReasonHtml(ruleReason, reportDetails) {
|
|
9
|
-
const resultText = parseDotTemplate(ruleReason, reportDetails);
|
|
10
|
-
const html = markdownToHTML(resultText);
|
|
11
|
-
return html;
|
|
12
|
-
}
|
|
13
|
-
export function parseDotTemplate(dotString, reportDetails) {
|
|
14
|
-
let parsedDotString = '';
|
|
15
|
-
try {
|
|
16
|
-
const tempFn = doT.template(dotString);
|
|
17
|
-
parsedDotString = tempFn(reportDetails);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
parsedDotString = '';
|
|
21
|
-
}
|
|
22
|
-
return parsedDotString;
|
|
23
|
-
}
|