@rh-support/utils 2.1.26 → 2.1.29
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/lib/esm/recommendationUtils.js +1 -1
- package/package.json +6 -10
- package/lib/cjs/apiUtils.d.ts +0 -17
- package/lib/cjs/apiUtils.d.ts.map +0 -1
- package/lib/cjs/apiUtils.js +0 -65
- 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 -102
- 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 -34
- 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 -29
- package/lib/cjs/index.d.ts.map +0 -1
- package/lib/cjs/index.js +0 -44
- 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 -321
- 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 -21
- package/lib/cjs/urlUtils.d.ts.map +0 -1
- package/lib/cjs/urlUtils.js +0 -85
- 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
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Highlighting, ISolrRecommendation } from '@cee-eng/hydrajs/@types/models/solr/solr';
|
|
2
|
-
export declare function getRecommendationTitle(doc: ISolrRecommendation): string;
|
|
3
|
-
export declare function getRecommendationAbstract(doc: ISolrRecommendation): string;
|
|
4
|
-
export declare function computeRecommendationTitle(doc: ISolrRecommendation): {
|
|
5
|
-
__html: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const computeRecommendationAbstract: (doc: any, truncateLen?: number) => {
|
|
8
|
-
__html: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function replaceHighlightingData(docs: ISolrRecommendation[], highlighting: Highlighting): ISolrRecommendation[];
|
|
11
|
-
export declare function truncate(str: string, len: number): string;
|
|
12
|
-
export declare function decodeMarkTag(str: string): string;
|
|
13
|
-
export declare function cleanupMarkDown(str: string): string;
|
|
14
|
-
//# sourceMappingURL=recommendationUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAgBvB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cleanupMarkDown = exports.decodeMarkTag = exports.truncate = exports.replaceHighlightingData = exports.computeRecommendationAbstract = exports.computeRecommendationTitle = exports.getRecommendationAbstract = exports.getRecommendationTitle = void 0;
|
|
7
|
-
const dompurify_1 = __importDefault(require("dompurify"));
|
|
8
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
9
|
-
function getRecommendationTitle(doc) {
|
|
10
|
-
return !(0, isEmpty_1.default)(doc.publishedTitle) ? doc.publishedTitle : doc.allTitle;
|
|
11
|
-
}
|
|
12
|
-
exports.getRecommendationTitle = getRecommendationTitle;
|
|
13
|
-
function getRecommendationAbstract(doc) {
|
|
14
|
-
return !(0, isEmpty_1.default)(doc.publishedAbstract) ? doc.publishedAbstract : doc.abstract;
|
|
15
|
-
}
|
|
16
|
-
exports.getRecommendationAbstract = getRecommendationAbstract;
|
|
17
|
-
function computeRecommendationTitle(doc) {
|
|
18
|
-
const title = getRecommendationTitle(doc);
|
|
19
|
-
return { __html: dompurify_1.default.sanitize(decodeMarkTag(title)) };
|
|
20
|
-
}
|
|
21
|
-
exports.computeRecommendationTitle = computeRecommendationTitle;
|
|
22
|
-
const computeRecommendationAbstract = (doc, truncateLen = 128) => {
|
|
23
|
-
const abstract = getRecommendationAbstract(doc);
|
|
24
|
-
const processedAbstract = truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen);
|
|
25
|
-
return { __html: dompurify_1.default.sanitize(processedAbstract) };
|
|
26
|
-
};
|
|
27
|
-
exports.computeRecommendationAbstract = computeRecommendationAbstract;
|
|
28
|
-
function replaceHighlightingData(docs, highlighting) {
|
|
29
|
-
return docs.map((doc) => {
|
|
30
|
-
// highlight id is either uri or view_uri
|
|
31
|
-
// when we are uploading a file before adding "Problem description" no highlighting doc is present hence passing an empty object
|
|
32
|
-
const highlightObj = highlighting
|
|
33
|
-
? highlighting[doc.resource_uri] || highlighting[doc.uri] || highlighting[doc.view_uri] || {}
|
|
34
|
-
: {};
|
|
35
|
-
return Object.assign(Object.assign({}, doc), { abstract: (highlightObj.abstract && highlightObj.abstract[0]) || doc.abstract || '', publishedAbstract: (highlightObj.publishedAbstract && highlightObj.publishedAbstract[0]) || doc.publishedAbstract || '', issue: highlightObj.issue || doc.issue || [] });
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.replaceHighlightingData = replaceHighlightingData;
|
|
39
|
-
function truncate(str, len) {
|
|
40
|
-
if (str.length > len) {
|
|
41
|
-
return str.substring(0, len).replace(/<[^>]*$/, '') + '…';
|
|
42
|
-
}
|
|
43
|
-
return str;
|
|
44
|
-
}
|
|
45
|
-
exports.truncate = truncate;
|
|
46
|
-
function decodeMarkTag(str) {
|
|
47
|
-
return str.replace(/%3Cmark%3E/gm, '<mark>').replace(/%3C%2Fmark%3E/gm, '</mark>');
|
|
48
|
-
}
|
|
49
|
-
exports.decodeMarkTag = decodeMarkTag;
|
|
50
|
-
function cleanupMarkDown(str) {
|
|
51
|
-
return str
|
|
52
|
-
.replace('### Overview', '')
|
|
53
|
-
.replace(/~~~ /gm, '')
|
|
54
|
-
.replace(/~~/gm, '')
|
|
55
|
-
.replace(/###/gm, '')
|
|
56
|
-
.replace(/##/gm, '')
|
|
57
|
-
.replace(/#/gm, '')
|
|
58
|
-
.replace(/\\\*\\\*\\\*/gm, '***')
|
|
59
|
-
.replace(/\\\*\\\*/gm, '**');
|
|
60
|
-
}
|
|
61
|
-
exports.cleanupMarkDown = cleanupMarkDown;
|
package/lib/cjs/scrollUtils.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
interface IScrollIntoViewOptions extends ScrollIntoViewOptions {
|
|
3
|
-
navBarRef?: MutableRefObject<HTMLElement>;
|
|
4
|
-
offset?: number;
|
|
5
|
-
timeout?: number;
|
|
6
|
-
onlyIfNotInViewport?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function scrollIntoView(sectionRef: React.MutableRefObject<HTMLElement>, options?: IScrollIntoViewOptions): void;
|
|
9
|
-
export declare function isElementInViewport(el: MutableRefObject<HTMLElement>, topStaticNavRef?: MutableRefObject<HTMLElement>): boolean;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=scrollUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scrollUtils.d.ts","sourceRoot":"","sources":["../../src/scrollUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEhD,UAAU,sBAAuB,SAAQ,qBAAqB;IAC1D,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,EAAE,sBAAsB,QA4C/G;AAED,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACjC,eAAe,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,WAalD"}
|
package/lib/cjs/scrollUtils.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isElementInViewport = exports.scrollIntoView = void 0;
|
|
7
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
8
|
-
function scrollIntoView(sectionRef, options) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
if ((0, isEmpty_1.default)(sectionRef === null || sectionRef === void 0 ? void 0 : sectionRef.current))
|
|
11
|
-
return;
|
|
12
|
-
if (!!(options === null || options === void 0 ? void 0 : options.onlyIfNotInViewport) && isElementInViewport(sectionRef, options === null || options === void 0 ? void 0 : options.navBarRef))
|
|
13
|
-
return;
|
|
14
|
-
// If we have a nav that has been scrolled down then just scrolling it to top will bring content in view
|
|
15
|
-
if (((_b = (_a = options === null || options === void 0 ? void 0 : options.navBarRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().top) > 0) {
|
|
16
|
-
try {
|
|
17
|
-
options.navBarRef.current.scrollIntoView({ behavior: 'smooth' });
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
options.navBarRef.current.scrollIntoView();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
// lets you delay scroll, else will just run in the next cycle of the javascript event loop
|
|
24
|
-
setTimeout(() => {
|
|
25
|
-
var _a, _b, _c;
|
|
26
|
-
// if an offset or navBar is specified then element.scrollIntoView wont work and you need to use window.scrollTo
|
|
27
|
-
const hasNavbar = !!((_a = options === null || options === void 0 ? void 0 : options.navBarRef) === null || _a === void 0 ? void 0 : _a.current);
|
|
28
|
-
const hasOffset = !!(options === null || options === void 0 ? void 0 : options.offset);
|
|
29
|
-
if (hasNavbar || hasOffset) {
|
|
30
|
-
const sectionRect = sectionRef.current.getBoundingClientRect();
|
|
31
|
-
let elementTopPosition = sectionRect.top;
|
|
32
|
-
let top = elementTopPosition - ((_b = options === null || options === void 0 ? void 0 : options.offset) !== null && _b !== void 0 ? _b : 0);
|
|
33
|
-
if (hasNavbar) {
|
|
34
|
-
const navRect = options.navBarRef.current.getBoundingClientRect();
|
|
35
|
-
// elementTopPosition = already_scrolled - (nav height - section top)
|
|
36
|
-
elementTopPosition = window.pageYOffset - (navRect.height - sectionRect.top);
|
|
37
|
-
top = elementTopPosition - ((_c = options === null || options === void 0 ? void 0 : options.offset) !== null && _c !== void 0 ? _c : 0);
|
|
38
|
-
}
|
|
39
|
-
// window.scrollTo can throw an error when passing in options, so this try/catch catches the error
|
|
40
|
-
// and only uses the window.scrollTo without the options.
|
|
41
|
-
try {
|
|
42
|
-
window.scrollTo({
|
|
43
|
-
top,
|
|
44
|
-
behavior: 'smooth',
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
window.scrollTo(0, top);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
try {
|
|
53
|
-
sectionRef.current.scrollIntoView(Object.assign(Object.assign({}, (options || {})), { behavior: 'smooth' }));
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
sectionRef.current.scrollIntoView(Object.assign(Object.assign({}, (options || {})), { behavior: 'auto' }));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, (_c = options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : 0);
|
|
60
|
-
}
|
|
61
|
-
exports.scrollIntoView = scrollIntoView;
|
|
62
|
-
function isElementInViewport(el, topStaticNavRef) {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
if ((0, isEmpty_1.default)(el === null || el === void 0 ? void 0 : el.current)) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
const topNavHeight = (_b = (_a = topStaticNavRef === null || topStaticNavRef === void 0 ? void 0 : topStaticNavRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;
|
|
68
|
-
var rect = el.current.getBoundingClientRect();
|
|
69
|
-
return (rect.top - topNavHeight >= 0 &&
|
|
70
|
-
rect.left >= 0 &&
|
|
71
|
-
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) /* or $(window).height() */ &&
|
|
72
|
-
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */);
|
|
73
|
-
}
|
|
74
|
-
exports.isElementInViewport = isElementInViewport;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ISearchSolrQuery } from '@cee-eng/hydrajs/@types/api/search';
|
|
2
|
-
import { ISolrRecommendation } from '@cee-eng/hydrajs/@types/models/solr/solr';
|
|
3
|
-
export declare const documentKindToInclude = "documentKind:(\"Solution\" OR \"Article\" OR \"Errata\" OR \"Vulnerability\" OR \"Cve\" OR \"LabInfo\")";
|
|
4
|
-
export declare const issuesDefaultParamsObj: ISearchSolrQuery;
|
|
5
|
-
export type IRecommendationAdditionalFilters = {
|
|
6
|
-
[key in keyof ISolrRecommendation]?: string[] | {
|
|
7
|
-
values: string[];
|
|
8
|
-
exclude: true;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare function addFiltersToFieldQueries(fqArray: string[], additionalFilters: any): void;
|
|
12
|
-
export declare function getSolrParams(rows: number, highlighted_fragment_size: number, additionalFilters?: IRecommendationAdditionalFilters, QueryFields?: boolean): {
|
|
13
|
-
rows: number;
|
|
14
|
-
'hl.fragsize': number;
|
|
15
|
-
seQueryFields: boolean;
|
|
16
|
-
expressionParams?: {
|
|
17
|
-
case_number: string;
|
|
18
|
-
case_product: string;
|
|
19
|
-
case_version: string;
|
|
20
|
-
};
|
|
21
|
-
fq?: string | string[];
|
|
22
|
-
sort?: string;
|
|
23
|
-
fl?: string;
|
|
24
|
-
showRetired?: boolean;
|
|
25
|
-
mltDocSearch?: boolean;
|
|
26
|
-
newSearch?: boolean;
|
|
27
|
-
hl?: boolean;
|
|
28
|
-
'hl.fl'?: string;
|
|
29
|
-
'hl.simple.pre'?: string;
|
|
30
|
-
'hl.simple.post'?: string;
|
|
31
|
-
'hl.snippets'?: number;
|
|
32
|
-
wt?: string;
|
|
33
|
-
'facet.pivot'?: string;
|
|
34
|
-
'facet.pivot.mincount'?: string;
|
|
35
|
-
facet?: boolean;
|
|
36
|
-
'face.sort'?: string;
|
|
37
|
-
'facet.field'?: string[];
|
|
38
|
-
'facet.mincount'?: string;
|
|
39
|
-
rerank?: boolean;
|
|
40
|
-
q?: string;
|
|
41
|
-
start?: number;
|
|
42
|
-
clientName?: string;
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=searchApiUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchApiUtils.d.ts","sourceRoot":"","sources":["../../src/searchApiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,4GAC+D,CAAC;AAElG,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,MAAM,MAAM,gCAAgC,GAAG;KAC1C,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CACtF,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,KAAA,QAc5E;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,CAAC,EAAE,gCAAgC,EACpD,WAAW,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSolrParams = exports.addFiltersToFieldQueries = exports.issuesDefaultParamsObj = exports.documentKindToInclude = void 0;
|
|
7
|
-
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
8
|
-
exports.documentKindToInclude = 'documentKind:("Solution" OR "Article" OR "Errata" OR "Vulnerability" OR "Cve" OR "LabInfo")';
|
|
9
|
-
exports.issuesDefaultParamsObj = {
|
|
10
|
-
q: '*:*',
|
|
11
|
-
fq: [exports.documentKindToInclude, '-internalTags:helper_solution'],
|
|
12
|
-
start: 0,
|
|
13
|
-
rows: 10,
|
|
14
|
-
fl: 'id, allTitle, publishedTitle, view_uri, resource_uri, uri, issue, lastModifiedDate, kcsState, kcsRateUp, kcsRateDown, documentKind, publishedAbstract, abstract, authorSSOName, tag',
|
|
15
|
-
seQueryFields: false,
|
|
16
|
-
hl: true,
|
|
17
|
-
'hl.fl': 'abstract, publishedAbstract, issue',
|
|
18
|
-
'hl.simple.pre': '%3Cmark%3E',
|
|
19
|
-
'hl.simple.post': '%3C%2Fmark%3E',
|
|
20
|
-
'hl.snippets': 1,
|
|
21
|
-
'hl.fragsize': 0,
|
|
22
|
-
};
|
|
23
|
-
function addFiltersToFieldQueries(fqArray, additionalFilters) {
|
|
24
|
-
Object.keys(additionalFilters).forEach((_key) => {
|
|
25
|
-
var _a;
|
|
26
|
-
const val = additionalFilters[_key];
|
|
27
|
-
if (Array.isArray(val) && val.length > 0) {
|
|
28
|
-
const query = `${_key}:(${val.join(' OR ')})`;
|
|
29
|
-
query && fqArray.push(query);
|
|
30
|
-
}
|
|
31
|
-
else if (typeof val === 'object') {
|
|
32
|
-
const excludeFlag = val === null || val === void 0 ? void 0 : val.exclude;
|
|
33
|
-
const values = (_a = val === null || val === void 0 ? void 0 : val.values) !== null && _a !== void 0 ? _a : [];
|
|
34
|
-
if (values.length < 1)
|
|
35
|
-
return;
|
|
36
|
-
const query = `${_key}:(${values.join(' OR ')})`;
|
|
37
|
-
query && fqArray.push(`${excludeFlag ? '-' : ''}${query}`);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
exports.addFiltersToFieldQueries = addFiltersToFieldQueries;
|
|
42
|
-
function getSolrParams(rows, highlighted_fragment_size, additionalFilters, QueryFields) {
|
|
43
|
-
const cloneIssueParams = (0, cloneDeep_1.default)(exports.issuesDefaultParamsObj);
|
|
44
|
-
const issueParamsObj = Object.assign(Object.assign({}, cloneIssueParams), { rows, 'hl.fragsize': highlighted_fragment_size, seQueryFields: QueryFields || false });
|
|
45
|
-
additionalFilters && addFiltersToFieldQueries(issueParamsObj.fq, additionalFilters);
|
|
46
|
-
return issueParamsObj;
|
|
47
|
-
}
|
|
48
|
-
exports.getSolrParams = getSolrParams;
|
package/lib/cjs/sentry.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface Window {
|
|
3
|
-
sessionjs: any;
|
|
4
|
-
Raven: any;
|
|
5
|
-
app: string;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Send current user context to Raven (JS error logging library).
|
|
10
|
-
*/
|
|
11
|
-
export declare function sendToSentry(error: Error, additionalTags?: {}, message?: string, extra?: {
|
|
12
|
-
error: Error | any;
|
|
13
|
-
}): void;
|
|
14
|
-
//# sourceMappingURL=sentry.d.ts.map
|
package/lib/cjs/sentry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../src/sentry.ts"],"names":[],"mappings":"AAOA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,EAAE,GAAG,CAAC;QACf,KAAK,EAAE,GAAG,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;KACf;CACJ;AAED;;GAEG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,KAAK,EAAE,OAAO,GAAE,MAAW,EAAE,KAAK,CAAC,EAAE;IAAE,KAAK,EAAE,KAAK,GAAG,GAAG,CAAA;CAAE,QAwCnH"}
|
package/lib/cjs/sentry.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendToSentry = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Send current user context to Raven (JS error logging library).
|
|
6
|
-
*/
|
|
7
|
-
function sendToSentry(error, additionalTags = {}, message = '', extra) {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const state = window.sessionjs._state;
|
|
10
|
-
function expiresIn() {
|
|
11
|
-
try {
|
|
12
|
-
return state.keycloak.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + state.keycloak.timeSkew;
|
|
13
|
-
}
|
|
14
|
-
catch (e) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const token = window.sessionjs.getToken();
|
|
19
|
-
const userInfo = {
|
|
20
|
-
user_id: token.user_id,
|
|
21
|
-
account_id: token.account_id,
|
|
22
|
-
account_number: token.account_number,
|
|
23
|
-
internal: token.internal,
|
|
24
|
-
lang: token.lang,
|
|
25
|
-
};
|
|
26
|
-
if (typeof (window === null || window === void 0 ? void 0 : window.Raven) !== 'undefined' && typeof ((_a = window === null || window === void 0 ? void 0 : window.Raven) === null || _a === void 0 ? void 0 : _a.captureException) === 'function') {
|
|
27
|
-
// setting user context
|
|
28
|
-
window === null || window === void 0 ? void 0 : window.Raven.setUserContext({
|
|
29
|
-
id: userInfo.user_id,
|
|
30
|
-
user_info: userInfo,
|
|
31
|
-
});
|
|
32
|
-
// setting additional tags for debug purpose
|
|
33
|
-
let tagsContext = Object.assign(Object.assign({ is_authenticated: window.sessionjs.isAuthenticated(), is_token_expired: state.keycloak.authenticated ? state.keycloak.isTokenExpired(0) : null, token_expires_in: expiresIn() }, additionalTags), { app_name: (_b = window.app) !== null && _b !== void 0 ? _b : 'Portal Case Management' });
|
|
34
|
-
window === null || window === void 0 ? void 0 : window.Raven.setTagsContext(tagsContext);
|
|
35
|
-
window === null || window === void 0 ? void 0 : window.Raven.captureException(error, { extra });
|
|
36
|
-
if (message)
|
|
37
|
-
window === null || window === void 0 ? void 0 : window.Raven.captureMessage(message, { level: 'error' });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.sendToSentry = sendToSentry;
|
package/lib/cjs/solrUtils.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { IFacetResponse } from '@rh-support/types/shared';
|
|
2
|
-
export interface ISolrQP {
|
|
3
|
-
start?: number;
|
|
4
|
-
rows?: number;
|
|
5
|
-
sort?: string | boolean;
|
|
6
|
-
q?: string;
|
|
7
|
-
'facet.mincount'?: number;
|
|
8
|
-
'facet.pivot.mincount'?: number;
|
|
9
|
-
'facet.limit'?: number;
|
|
10
|
-
'facet.sort'?: string;
|
|
11
|
-
'facet.query'?: string[];
|
|
12
|
-
fl?: string;
|
|
13
|
-
defType?: string;
|
|
14
|
-
facet?: boolean;
|
|
15
|
-
'facet.field'?: string[];
|
|
16
|
-
'facet.pivot'?: string;
|
|
17
|
-
fq?: string[];
|
|
18
|
-
'f.case_product.facet.limit'?: number;
|
|
19
|
-
'f.case_version.facet.pivot.limit'?: number;
|
|
20
|
-
'f.case_version.facet.pivot.mincount'?: number;
|
|
21
|
-
}
|
|
22
|
-
export declare function solr(init?: ISolrQP): {
|
|
23
|
-
fq: (k: string, v: string | string[], tag?: string, options?: {
|
|
24
|
-
processValue: {
|
|
25
|
-
join: string;
|
|
26
|
-
};
|
|
27
|
-
}) => any;
|
|
28
|
-
preBuiltfq: (k: string, v: string | string[], tag?: string) => any;
|
|
29
|
-
facetField: (facet: string, excludeTags?: string[]) => any;
|
|
30
|
-
pivotField: (pivot: string, excludeTags?: string[]) => any;
|
|
31
|
-
value: () => ISolrQP;
|
|
32
|
-
beginOr: () => any;
|
|
33
|
-
endOr: () => any;
|
|
34
|
-
};
|
|
35
|
-
export type ISolrResponseToFacetFields<T> = {
|
|
36
|
-
[key in keyof T]?: IFacetResponse[];
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @param solrResponse
|
|
41
|
-
* Accepts solrResponse and then return the facet values in an object map
|
|
42
|
-
* with key being the facet key and value being of type IFacetResponse
|
|
43
|
-
*/
|
|
44
|
-
export declare function solrResponseToFacetFields<T, U extends object>(solrResponse: T): ISolrResponseToFacetFields<U>;
|
|
45
|
-
export type ISolrResponseToPivotFields<T, U> = {
|
|
46
|
-
[key in keyof T]?: U[];
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param solrResponse
|
|
51
|
-
* Accepts solrResponse and then return the pivot values in an object map
|
|
52
|
-
* with key being the pivot key(ex: 'case_product,case_version') and
|
|
53
|
-
* value being of type IFacetResponse and also next pivot as the key and its value again of type IFacetResponse.
|
|
54
|
-
*/
|
|
55
|
-
export declare function solrResponseToPivotFields<T, U extends object, V>(solrResponse: T): ISolrResponseToPivotFields<U, V>;
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @param fieldValueMap
|
|
59
|
-
* Accepts the output type of solrResponseToPivotFields and then return the
|
|
60
|
-
* string query by ORing the values of same type(for ex. all the version will be ORed) and ANDing the
|
|
61
|
-
* children values with parent values. Uses solr-query-builder library internally
|
|
62
|
-
*/
|
|
63
|
-
export declare function buildSolrQuery(fieldValueMap: any, wrapWithParentheses?: boolean): any;
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* @param query
|
|
67
|
-
* Takes a solr string query with AND OR operations
|
|
68
|
-
* and return the object with key as the field name
|
|
69
|
-
* and value will be the array of field values
|
|
70
|
-
* Pivots having logical OR operations will be returned as
|
|
71
|
-
* the nested object
|
|
72
|
-
*/
|
|
73
|
-
export declare function parseSolrQuery(query: string): {};
|
|
74
|
-
//# sourceMappingURL=solrUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solrUtils.d.ts","sourceRoot":"","sources":["../../src/solrUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAM1D,MAAM,WAAW,OAAO;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,qCAAqC,CAAC,EAAE,MAAM,CAAC;CAClD;AAsBD,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO;YAOnB,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM;;;;;oBAmBlC,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM;wBAWtC,MAAM,gBAAgB,MAAM,EAAE;wBAS9B,MAAM,gBAAgB,MAAM,EAAE;iBAOvC,OAAO;;;EAoBzB;AAED,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI;KACvC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE;CACtC,CAAC;AAEF;;;;;GAKG;AAEH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAmB7G;AAED,MAAM,MAAM,0BAA0B,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1C,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;CACzB,CAAC;AAEF;;;;;;GAMG;AAEH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,CAYnH;AAmBD;;;;;;GAMG;AAEH,wBAAgB,cAAc,CAAC,aAAa,KAAA,EAAE,mBAAmB,UAAQ,OA4BxE;AA+BD;;;;;;;;GAQG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,MAU3C"}
|