@rh-support/utils 2.1.26 → 2.1.27
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/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
package/lib/cjs/eventUtils.js
DELETED
|
@@ -1,32 +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.dtmTrackEvent = exports.pendoTrackEvent = exports.haltEvent = void 0;
|
|
7
|
-
const hydrajs_1 = require("@cee-eng/hydrajs");
|
|
8
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
9
|
-
function haltEvent(event) {
|
|
10
|
-
if (event) {
|
|
11
|
-
event.stopPropagation();
|
|
12
|
-
event.preventDefault();
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.haltEvent = haltEvent;
|
|
16
|
-
// https://support.pendo.io/hc/en-us/articles/360032294291-Track-Events-Configuration
|
|
17
|
-
// if event name is not exist in the pendo then it will create
|
|
18
|
-
// new event otherwise it will update existing event.
|
|
19
|
-
function pendoTrackEvent(name, properties = {}) {
|
|
20
|
-
const pendo = window.pendo;
|
|
21
|
-
// log the event for prod and local envirnoment
|
|
22
|
-
if (!(0, isEmpty_1.default)(pendo) && (hydrajs_1.Env.getEnvName() === hydrajs_1.Env.EnvNames.PROD || hydrajs_1.Env.isLocalEnv())) {
|
|
23
|
-
pendo.track(name, properties);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.pendoTrackEvent = pendoTrackEvent;
|
|
27
|
-
function dtmTrackEvent(elemRef, eventName, event) {
|
|
28
|
-
if (elemRef.current && (hydrajs_1.Env.getEnvName() === hydrajs_1.Env.EnvNames.PROD || hydrajs_1.Env.isLocalEnv())) {
|
|
29
|
-
elemRef.current.dispatchEvent(new CustomEvent(eventName, event));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.dtmTrackEvent = dtmTrackEvent;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
declare enum APP_HOST_NAMES {
|
|
2
|
-
supportHubHostName = "supportHubHostName"
|
|
3
|
-
}
|
|
4
|
-
declare const getSFDCEnv: () => string;
|
|
5
|
-
declare const getSFDCSecureSupportCaseLink: (caseNumber: string) => string;
|
|
6
|
-
export { APP_HOST_NAMES, getSFDCEnv, getSFDCSecureSupportCaseLink };
|
|
7
|
-
//# sourceMappingURL=hostNameUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hostNameUtils.d.ts","sourceRoot":"","sources":["../../src/hostNameUtils.ts"],"names":[],"mappings":"AAEA,aAAK,cAAc;IACf,kBAAkB,uBAAuB;CAC5C;AAED,QAAA,MAAM,UAAU,cAqBf,CAAC;AAEF,QAAA,MAAM,4BAA4B,eAAgB,MAAM,WAGvD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC"}
|
package/lib/cjs/hostNameUtils.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSFDCSecureSupportCaseLink = exports.getSFDCEnv = exports.APP_HOST_NAMES = void 0;
|
|
4
|
-
const hydrajs_1 = require("@cee-eng/hydrajs");
|
|
5
|
-
var APP_HOST_NAMES;
|
|
6
|
-
(function (APP_HOST_NAMES) {
|
|
7
|
-
APP_HOST_NAMES["supportHubHostName"] = "supportHubHostName";
|
|
8
|
-
})(APP_HOST_NAMES || (exports.APP_HOST_NAMES = APP_HOST_NAMES = {}));
|
|
9
|
-
const getSFDCEnv = () => {
|
|
10
|
-
const env = hydrajs_1.Env.getEnvName();
|
|
11
|
-
// Prod HostName
|
|
12
|
-
let hostName = 'gss.my.salesforce.com';
|
|
13
|
-
switch (env) {
|
|
14
|
-
case hydrajs_1.Env.EnvNames.QA:
|
|
15
|
-
hostName = 'gss--qa.cs53.my.salesforce.com';
|
|
16
|
-
break;
|
|
17
|
-
case hydrajs_1.Env.EnvNames.STAGE:
|
|
18
|
-
hostName = 'gss--stage2.cs70.my.salesforce.com';
|
|
19
|
-
break;
|
|
20
|
-
case hydrajs_1.Env.EnvNames.PROD_BETA:
|
|
21
|
-
case hydrajs_1.Env.EnvNames.PROD:
|
|
22
|
-
hostName = 'gss.my.salesforce.com';
|
|
23
|
-
break;
|
|
24
|
-
default:
|
|
25
|
-
hostName = 'gss.my.salesforce.com';
|
|
26
|
-
}
|
|
27
|
-
return hostName;
|
|
28
|
-
};
|
|
29
|
-
exports.getSFDCEnv = getSFDCEnv;
|
|
30
|
-
const getSFDCSecureSupportCaseLink = (caseNumber) => {
|
|
31
|
-
const hostName = getSFDCEnv();
|
|
32
|
-
return `https://${hostName}/apex/Support#/cases/${caseNumber}`;
|
|
33
|
-
};
|
|
34
|
-
exports.getSFDCSecureSupportCaseLink = getSFDCSecureSupportCaseLink;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IMaintenance } from '@cee-eng/hydrajs/@types/models/maintenance';
|
|
2
|
-
export declare enum PCM_CONFIG_FIELD_TYPE {
|
|
3
|
-
JSON = "JSON",
|
|
4
|
-
JSON_ARRAY = "JSON-ARRAY",
|
|
5
|
-
JSON_HASHMAP = "JSON-HASHMAP",
|
|
6
|
-
FEATURE_FLAG = "FEATURE-FLAG",// to handle values like 0 and 1
|
|
7
|
-
STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED",
|
|
8
|
-
STRING = "STRING",
|
|
9
|
-
NUMBER = "NUMBER"
|
|
10
|
-
}
|
|
11
|
-
declare function getConfigField(config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE): any;
|
|
12
|
-
declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE) => any;
|
|
13
|
-
export { getConfigField, getFieldInParts };
|
|
14
|
-
//# sourceMappingURL=hydraConfigUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydraConfigUtils.d.ts","sourceRoot":"","sources":["../../src/hydraConfigUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAO1E,oBAAY,qBAAqB;IAC7B,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB,CAAE,gCAAgC;IAC/D,sBAAsB,2BAA2B;IACjD,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,qBAA4B,OAgCzG;AAED,QAAA,MAAM,eAAe,WAAY,YAAY,EAAE,aAAa,MAAM,cAAa,qBAAqB,QAuCnG,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,83 +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.getFieldInParts = exports.getConfigField = exports.PCM_CONFIG_FIELD_TYPE = void 0;
|
|
7
|
-
const concat_1 = __importDefault(require("lodash/concat"));
|
|
8
|
-
const map_1 = __importDefault(require("lodash/map"));
|
|
9
|
-
const merge_1 = __importDefault(require("lodash/merge"));
|
|
10
|
-
const reduce_1 = __importDefault(require("lodash/reduce"));
|
|
11
|
-
const startsWith_1 = __importDefault(require("lodash/startsWith"));
|
|
12
|
-
var PCM_CONFIG_FIELD_TYPE;
|
|
13
|
-
(function (PCM_CONFIG_FIELD_TYPE) {
|
|
14
|
-
PCM_CONFIG_FIELD_TYPE["JSON"] = "JSON";
|
|
15
|
-
PCM_CONFIG_FIELD_TYPE["JSON_ARRAY"] = "JSON-ARRAY";
|
|
16
|
-
PCM_CONFIG_FIELD_TYPE["JSON_HASHMAP"] = "JSON-HASHMAP";
|
|
17
|
-
PCM_CONFIG_FIELD_TYPE["FEATURE_FLAG"] = "FEATURE-FLAG";
|
|
18
|
-
PCM_CONFIG_FIELD_TYPE["STRING_COMMA_SEPERATED"] = "STRING-COMMA-SEPERATED";
|
|
19
|
-
PCM_CONFIG_FIELD_TYPE["STRING"] = "STRING";
|
|
20
|
-
PCM_CONFIG_FIELD_TYPE["NUMBER"] = "NUMBER";
|
|
21
|
-
})(PCM_CONFIG_FIELD_TYPE || (exports.PCM_CONFIG_FIELD_TYPE = PCM_CONFIG_FIELD_TYPE = {}));
|
|
22
|
-
function getConfigField(config, fieldName, fieldType = null) {
|
|
23
|
-
let values = (0, reduce_1.default)(config, (result, v) => {
|
|
24
|
-
return v.fieldName.startsWith(fieldName) ? [...result, v.fieldValue] : result;
|
|
25
|
-
}, []);
|
|
26
|
-
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.STRING) {
|
|
27
|
-
return values[0];
|
|
28
|
-
}
|
|
29
|
-
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.NUMBER) {
|
|
30
|
-
return parseInt(values[0], 10);
|
|
31
|
-
}
|
|
32
|
-
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG) {
|
|
33
|
-
return values.length === 0 ? false : Boolean(parseInt(values[0]));
|
|
34
|
-
}
|
|
35
|
-
if (values.length === 0)
|
|
36
|
-
return null;
|
|
37
|
-
if (!fieldType)
|
|
38
|
-
return values;
|
|
39
|
-
try {
|
|
40
|
-
const parsed = values.map((value) => JSON.parse(value));
|
|
41
|
-
if (fieldType === PCM_CONFIG_FIELD_TYPE.JSON)
|
|
42
|
-
return parsed;
|
|
43
|
-
if (fieldType === PCM_CONFIG_FIELD_TYPE.JSON_ARRAY)
|
|
44
|
-
return (0, reduce_1.default)(parsed, concat_1.default);
|
|
45
|
-
if (fieldType === PCM_CONFIG_FIELD_TYPE.JSON_HASHMAP)
|
|
46
|
-
return (0, reduce_1.default)(parsed, merge_1.default);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.log(error);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.getConfigField = getConfigField;
|
|
53
|
-
const getFieldInParts = (config, fieldName, fieldType = null) => {
|
|
54
|
-
const values = (0, reduce_1.default)(config, (result, v) => {
|
|
55
|
-
return (0, startsWith_1.default)(v.fieldName, fieldName) ? [...result, v.fieldValue] : result;
|
|
56
|
-
}, []);
|
|
57
|
-
if (values.length === 0) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
if (!fieldType) {
|
|
61
|
-
return values;
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
if (fieldType === 'STRING-COMMA-SEPERATED') {
|
|
65
|
-
return (0, reduce_1.default)(values, (acc, value) => {
|
|
66
|
-
return acc.concat(value.split(','));
|
|
67
|
-
}, []);
|
|
68
|
-
}
|
|
69
|
-
const parsed = (0, map_1.default)(values, JSON.parse);
|
|
70
|
-
if (fieldType === 'JSON') {
|
|
71
|
-
return parsed;
|
|
72
|
-
}
|
|
73
|
-
// if (fieldType === 'JSON-ARRAY') { return reduce(parsed, concat); }
|
|
74
|
-
if (fieldType === 'JSON-HASHMAP') {
|
|
75
|
-
return (0, reduce_1.default)(parsed, merge_1.default);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
// tslint:disable-next-line:no-console
|
|
80
|
-
console.error(error);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
exports.getFieldInParts = getFieldInParts;
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export * from './apiUtils';
|
|
2
|
-
export * from './appUtils';
|
|
3
|
-
export * from './browserDetectionUtils';
|
|
4
|
-
export * from './caseUtils';
|
|
5
|
-
export * from './cacheUtils';
|
|
6
|
-
export * from './csvUtils';
|
|
7
|
-
export * from './dateUtils';
|
|
8
|
-
export * from './dropdownUtils';
|
|
9
|
-
export * from './eventUtils';
|
|
10
|
-
export * from './hostNameUtils';
|
|
11
|
-
export * from './hydraConfigUtils';
|
|
12
|
-
export * from './insightRuleInfoUtils';
|
|
13
|
-
export * from './lruCacheUtils';
|
|
14
|
-
export * from './productsUtils';
|
|
15
|
-
export * from './promiseUtils';
|
|
16
|
-
export * from './recommendationUtils';
|
|
17
|
-
export * from './solrUtils';
|
|
18
|
-
export * from './searchApiUtils';
|
|
19
|
-
export * from './scrollUtils';
|
|
20
|
-
export * from './urlUtils';
|
|
21
|
-
export * from './validatorUtils';
|
|
22
|
-
export * from './userUtils';
|
|
23
|
-
export * from './styleUtils';
|
|
24
|
-
export * from './translation-helper';
|
|
25
|
-
export * from './outlier';
|
|
26
|
-
export * from './sentry';
|
|
27
|
-
export * from './constants/preferredLanguages';
|
|
28
|
-
export * from './tncUtil';
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,WAAW,CAAC"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./apiUtils"), exports);
|
|
18
|
-
__exportStar(require("./appUtils"), exports);
|
|
19
|
-
__exportStar(require("./browserDetectionUtils"), exports);
|
|
20
|
-
__exportStar(require("./caseUtils"), exports);
|
|
21
|
-
__exportStar(require("./cacheUtils"), exports);
|
|
22
|
-
__exportStar(require("./csvUtils"), exports);
|
|
23
|
-
__exportStar(require("./dateUtils"), exports);
|
|
24
|
-
__exportStar(require("./dropdownUtils"), exports);
|
|
25
|
-
__exportStar(require("./eventUtils"), exports);
|
|
26
|
-
__exportStar(require("./hostNameUtils"), exports);
|
|
27
|
-
__exportStar(require("./hydraConfigUtils"), exports);
|
|
28
|
-
__exportStar(require("./insightRuleInfoUtils"), exports);
|
|
29
|
-
__exportStar(require("./lruCacheUtils"), exports);
|
|
30
|
-
__exportStar(require("./productsUtils"), exports);
|
|
31
|
-
__exportStar(require("./promiseUtils"), exports);
|
|
32
|
-
__exportStar(require("./recommendationUtils"), exports);
|
|
33
|
-
__exportStar(require("./solrUtils"), exports);
|
|
34
|
-
__exportStar(require("./searchApiUtils"), exports);
|
|
35
|
-
__exportStar(require("./scrollUtils"), exports);
|
|
36
|
-
__exportStar(require("./urlUtils"), exports);
|
|
37
|
-
__exportStar(require("./validatorUtils"), exports);
|
|
38
|
-
__exportStar(require("./userUtils"), exports);
|
|
39
|
-
__exportStar(require("./styleUtils"), exports);
|
|
40
|
-
__exportStar(require("./translation-helper"), exports);
|
|
41
|
-
__exportStar(require("./outlier"), exports);
|
|
42
|
-
__exportStar(require("./sentry"), exports);
|
|
43
|
-
__exportStar(require("./constants/preferredLanguages"), exports);
|
|
44
|
-
__exportStar(require("./tncUtil"), exports);
|
|
@@ -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,31 +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.parseDotTemplate = exports.getRuleReasonHtml = void 0;
|
|
7
|
-
const ui_toolkit_1 = require("@cee-eng/ui-toolkit");
|
|
8
|
-
const doT_1 = __importDefault(require("dot/doT"));
|
|
9
|
-
const assign_1 = __importDefault(require("lodash/assign"));
|
|
10
|
-
doT_1.default.templateSettings = (0, assign_1.default)({}, doT_1.default.templateSettings, {
|
|
11
|
-
varname: 'pydata',
|
|
12
|
-
strip: false,
|
|
13
|
-
});
|
|
14
|
-
function getRuleReasonHtml(ruleReason, reportDetails) {
|
|
15
|
-
const resultText = parseDotTemplate(ruleReason, reportDetails);
|
|
16
|
-
const html = (0, ui_toolkit_1.markdownToHTML)(resultText);
|
|
17
|
-
return html;
|
|
18
|
-
}
|
|
19
|
-
exports.getRuleReasonHtml = getRuleReasonHtml;
|
|
20
|
-
function parseDotTemplate(dotString, reportDetails) {
|
|
21
|
-
let parsedDotString = '';
|
|
22
|
-
try {
|
|
23
|
-
const tempFn = doT_1.default.template(dotString);
|
|
24
|
-
parsedDotString = tempFn(reportDetails);
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
parsedDotString = '';
|
|
28
|
-
}
|
|
29
|
-
return parsedDotString;
|
|
30
|
-
}
|
|
31
|
-
exports.parseDotTemplate = parseDotTemplate;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class LRUCache<K, V> {
|
|
2
|
-
max: number;
|
|
3
|
-
cache: Map<K, V>;
|
|
4
|
-
constructor(max?: number);
|
|
5
|
-
get(key: K): V;
|
|
6
|
-
set(key: K, val: V): void;
|
|
7
|
-
has(key: K): boolean;
|
|
8
|
-
size(): number;
|
|
9
|
-
first(): any;
|
|
10
|
-
peek(key: K): V;
|
|
11
|
-
clear(): void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=lruCacheUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lruCacheUtils.d.ts","sourceRoot":"","sources":["../../src/lruCacheUtils.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ,CAAC,CAAC,EAAE,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACL,GAAG,SAAK;IAKpB,GAAG,CAAC,GAAG,EAAE,CAAC;IAUV,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IAQlB,GAAG,CAAC,GAAG,EAAE,CAAC;IAIV,IAAI;IAIJ,KAAK;IAIL,IAAI,CAAC,GAAG,EAAE,CAAC;IAMX,KAAK;CAGR"}
|
package/lib/cjs/lruCacheUtils.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LRUCache = void 0;
|
|
4
|
-
class LRUCache {
|
|
5
|
-
constructor(max = 10) {
|
|
6
|
-
this.max = max;
|
|
7
|
-
this.cache = new Map();
|
|
8
|
-
}
|
|
9
|
-
get(key) {
|
|
10
|
-
let item = this.cache.get(key);
|
|
11
|
-
if (item) {
|
|
12
|
-
// refresh key
|
|
13
|
-
this.cache.delete(key);
|
|
14
|
-
this.cache.set(key, item);
|
|
15
|
-
}
|
|
16
|
-
return item;
|
|
17
|
-
}
|
|
18
|
-
set(key, val) {
|
|
19
|
-
// refresh key
|
|
20
|
-
if (this.cache.has(key))
|
|
21
|
-
this.cache.delete(key);
|
|
22
|
-
// evict oldest
|
|
23
|
-
else if (this.cache.size === this.max)
|
|
24
|
-
this.cache.delete(this.first());
|
|
25
|
-
this.cache.set(key, val);
|
|
26
|
-
}
|
|
27
|
-
has(key) {
|
|
28
|
-
return this.cache.has(key);
|
|
29
|
-
}
|
|
30
|
-
size() {
|
|
31
|
-
return this.cache.size;
|
|
32
|
-
}
|
|
33
|
-
first() {
|
|
34
|
-
return this.cache.keys().next().value;
|
|
35
|
-
}
|
|
36
|
-
peek(key) {
|
|
37
|
-
if (this.cache.has(key)) {
|
|
38
|
-
return this.cache.get(key);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
clear() {
|
|
42
|
-
this.cache.clear();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.LRUCache = LRUCache;
|
package/lib/cjs/outlier.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Outlier Function
|
|
3
|
-
* Refer: https://www.cuemath.com/outlier-formula/
|
|
4
|
-
*
|
|
5
|
-
* An outlier function which takers array of number and find high outlier and low outlier
|
|
6
|
-
* 1. Taker array of number and sort then in ascending order.
|
|
7
|
-
* 2. Calculate first(q1) and third(q3) quartile.
|
|
8
|
-
* 3. Calculate inter-quartile(iqr) range (q3-q1).
|
|
9
|
-
* 4. Find the upper boundary value by formula q3 + iqr*1.5.
|
|
10
|
-
* 5. Find the lower boundary value by formula q1 - iqr*1.5
|
|
11
|
-
*
|
|
12
|
-
* @param {number[]} numbers
|
|
13
|
-
* @returns {number[]} upper and lower boundary value
|
|
14
|
-
*/
|
|
15
|
-
export declare const outlier: (array: Array<number>) => Array<number>;
|
|
16
|
-
//# sourceMappingURL=outlier.d.ts.map
|
package/lib/cjs/outlier.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outlier.d.ts","sourceRoot":"","sources":["../../src/outlier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,UAAW,MAAM,MAAM,CAAC,KAAG,MAAM,MAAM,CAkC1D,CAAC"}
|
package/lib/cjs/outlier.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Outlier Function
|
|
4
|
-
* Refer: https://www.cuemath.com/outlier-formula/
|
|
5
|
-
*
|
|
6
|
-
* An outlier function which takers array of number and find high outlier and low outlier
|
|
7
|
-
* 1. Taker array of number and sort then in ascending order.
|
|
8
|
-
* 2. Calculate first(q1) and third(q3) quartile.
|
|
9
|
-
* 3. Calculate inter-quartile(iqr) range (q3-q1).
|
|
10
|
-
* 4. Find the upper boundary value by formula q3 + iqr*1.5.
|
|
11
|
-
* 5. Find the lower boundary value by formula q1 - iqr*1.5
|
|
12
|
-
*
|
|
13
|
-
* @param {number[]} numbers
|
|
14
|
-
* @returns {number[]} upper and lower boundary value
|
|
15
|
-
*/
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.outlier = void 0;
|
|
18
|
-
const outlier = (array) => {
|
|
19
|
-
// Take array length
|
|
20
|
-
const arrayLength = array.length;
|
|
21
|
-
// Check if length is smaller than four then return array result as it is
|
|
22
|
-
if (arrayLength < 4) {
|
|
23
|
-
return array;
|
|
24
|
-
}
|
|
25
|
-
let q1, q3, iqr, upperBoundary, lowerBoundary;
|
|
26
|
-
// Make a copy of array plus sort it in ascending order
|
|
27
|
-
const sortedArray = array.slice().sort((a, b) => a - b);
|
|
28
|
-
// Find the quartiles range
|
|
29
|
-
// If median is odd adjust the index by minus one
|
|
30
|
-
if (((arrayLength - 1) / 4) % 1 === 0 || (arrayLength / 4) % 1 === 0) {
|
|
31
|
-
q1 = (1 / 2) * (sortedArray[Math.floor(arrayLength / 4) - 1] + sortedArray[Math.floor(arrayLength / 4)]);
|
|
32
|
-
q3 =
|
|
33
|
-
(1 / 2) *
|
|
34
|
-
(sortedArray[Math.ceil(arrayLength * (3 / 4)) - 1] + sortedArray[Math.ceil(arrayLength * (3 / 4))]);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
q1 = sortedArray[Math.floor(arrayLength / 4)];
|
|
38
|
-
q3 = sortedArray[Math.floor(arrayLength * (3 / 4))];
|
|
39
|
-
}
|
|
40
|
-
// Calculate inter-quartile range
|
|
41
|
-
iqr = q3 - q1;
|
|
42
|
-
// upper boundary
|
|
43
|
-
upperBoundary = q3 + iqr * 1.5;
|
|
44
|
-
// lower boundary
|
|
45
|
-
lowerBoundary = q1 - iqr * 1.5;
|
|
46
|
-
return [upperBoundary, lowerBoundary];
|
|
47
|
-
};
|
|
48
|
-
exports.outlier = outlier;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IProductV2, ISEProduct } from '@cee-eng/hydrajs/@types/models/product';
|
|
2
|
-
export interface ITroubleshootProductResponse {
|
|
3
|
-
topProducts: Partial<ISEProduct>[];
|
|
4
|
-
otherProducts: Partial<ISEProduct>[];
|
|
5
|
-
productsResult: Partial<ISEProduct>[];
|
|
6
|
-
}
|
|
7
|
-
export declare const handleProductSearchResponse: (productsResultAll: ISEProduct[], productsResultEntitled?: IProductV2[], topCount?: number) => 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;
|
|
15
|
-
/**
|
|
16
|
-
* Tries to get top products with priority given to recentlyFiledAgainst
|
|
17
|
-
* before checking general top products from un-authed SE API
|
|
18
|
-
* @param products Partial<ISEProduct>
|
|
19
|
-
*/
|
|
20
|
-
export declare function getTopProducts(products: Partial<ISEProduct>[], topCount?: number): Partial<ISEProduct>[];
|
|
21
|
-
export declare function isOnlyVersion(versions: string[]): boolean;
|
|
22
|
-
export declare function getVersionIfOnlyVersion(versions: string[]): string;
|
|
23
|
-
export declare function getUniqueSortedVersions(versions: string[]): string[];
|
|
24
|
-
export declare const versionSorter: (_a: string, _b: string) => 0 | 1 | -1;
|
|
25
|
-
export declare const versionSort: (arr: string[]) => string[];
|
|
26
|
-
interface IGetVersionReturnValue {
|
|
27
|
-
major: string;
|
|
28
|
-
minor?: string;
|
|
29
|
-
}
|
|
30
|
-
export declare function getVersion(version: string): IGetVersionReturnValue;
|
|
31
|
-
export declare function isSpecialSupportOfferingEnabled(allProducts: Partial<ISEProduct>[], selectedProduct: string): boolean;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=productsUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,aAC1B,MAAM,KACjB,4BA4BF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,4BACd,UAAU,EAAE,KACrC,4BAeF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,QAAQ,SAAI,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE,CAOnG;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;AAED,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,eAAe,EAAE,MAAM,WAK1G"}
|
package/lib/cjs/productsUtils.js
DELETED
|
@@ -1,138 +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.isSpecialSupportOfferingEnabled = exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleEntitledProductResponse = exports.handleProductSearchResponse = void 0;
|
|
7
|
-
const difference_1 = __importDefault(require("lodash/difference"));
|
|
8
|
-
const forEach_1 = __importDefault(require("lodash/forEach"));
|
|
9
|
-
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
10
|
-
const map_1 = __importDefault(require("lodash/map"));
|
|
11
|
-
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
12
|
-
const remove_1 = __importDefault(require("lodash/remove"));
|
|
13
|
-
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
14
|
-
const validatorUtils_1 = require("./validatorUtils");
|
|
15
|
-
const handleProductSearchResponse = (productsResultAll, productsResultEntitled = [], topCount = 5) => {
|
|
16
|
-
const productsResultEntitledMap = {};
|
|
17
|
-
(0, forEach_1.default)(productsResultEntitled, (p) => {
|
|
18
|
-
// If (p.supportedForCustomer)
|
|
19
|
-
// Needs confirmation froom CCM team before adding
|
|
20
|
-
productsResultEntitledMap[`${p.name}`] = p;
|
|
21
|
-
});
|
|
22
|
-
const productsResult = (0, map_1.default)(productsResultAll, (product) => {
|
|
23
|
-
var _c, _d;
|
|
24
|
-
const entitledProduct = productsResultEntitledMap[product.product];
|
|
25
|
-
const uniqueVersions = getUniqueSortedVersions(product.versions);
|
|
26
|
-
return Object.assign(Object.assign(Object.assign({}, product), entitledProduct), { versions: uniqueVersions, isEntitledProduct: !(0, isEmpty_1.default)(entitledProduct), featuredVersion: ((_c = product.versions) === null || _c === void 0 ? void 0 : _c.includes(product.featuredVersion))
|
|
27
|
-
? product.featuredVersion
|
|
28
|
-
: (_d = product === null || product === void 0 ? void 0 : product.versions[0]) !== null && _d !== void 0 ? _d : '' });
|
|
29
|
-
});
|
|
30
|
-
// We get products based on the highest number of support cases
|
|
31
|
-
const topProducts = getTopProducts(productsResult, topCount);
|
|
32
|
-
const productsResultSorted = (0, orderBy_1.default)(productsResult, ['product'], ['asc']);
|
|
33
|
-
return {
|
|
34
|
-
productsResult: productsResultSorted,
|
|
35
|
-
topProducts,
|
|
36
|
-
otherProducts: (0, difference_1.default)(productsResultSorted, topProducts),
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
exports.handleProductSearchResponse = handleProductSearchResponse;
|
|
40
|
-
/**
|
|
41
|
-
* This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
|
|
42
|
-
* and need to create partial response like method `handleProductSearchResponse`
|
|
43
|
-
* @param productsResultEntitled IProductV2[]
|
|
44
|
-
* @returns ITroubleshootProductResponse
|
|
45
|
-
*/
|
|
46
|
-
const handleEntitledProductResponse = (productsResultEntitled = []) => {
|
|
47
|
-
const productsResult = productsResultEntitled.map((product) => {
|
|
48
|
-
return Object.assign(Object.assign({}, product), { product: product.name, isEntitledProduct: true });
|
|
49
|
-
});
|
|
50
|
-
const topProducts = getTopProducts(productsResult);
|
|
51
|
-
const productsResultSorted = (0, orderBy_1.default)(productsResult, ['product'], ['asc']);
|
|
52
|
-
return {
|
|
53
|
-
productsResult: productsResultSorted,
|
|
54
|
-
topProducts,
|
|
55
|
-
otherProducts: (0, difference_1.default)(productsResultSorted, topProducts),
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
exports.handleEntitledProductResponse = handleEntitledProductResponse;
|
|
59
|
-
/**
|
|
60
|
-
* Tries to get top products with priority given to recentlyFiledAgainst
|
|
61
|
-
* before checking general top products from un-authed SE API
|
|
62
|
-
* @param products Partial<ISEProduct>
|
|
63
|
-
*/
|
|
64
|
-
function getTopProducts(products, topCount = 5) {
|
|
65
|
-
const toReturn = (0, remove_1.default)([...products], (o) => o.recentlyFiledAgainst);
|
|
66
|
-
if (toReturn.length < topCount) {
|
|
67
|
-
const generalTopProducts = (0, remove_1.default)([...products], (o) => !o.recentlyFiledAgainst && o.isTopProduct);
|
|
68
|
-
toReturn.push(...generalTopProducts);
|
|
69
|
-
}
|
|
70
|
-
return toReturn.slice(0, topCount);
|
|
71
|
-
}
|
|
72
|
-
exports.getTopProducts = getTopProducts;
|
|
73
|
-
function isOnlyVersion(versions) {
|
|
74
|
-
return (versions === null || versions === void 0 ? void 0 : versions.length) && versions.length === 1;
|
|
75
|
-
}
|
|
76
|
-
exports.isOnlyVersion = isOnlyVersion;
|
|
77
|
-
function getVersionIfOnlyVersion(versions) {
|
|
78
|
-
return isOnlyVersion(versions) ? versions[0] : undefined;
|
|
79
|
-
}
|
|
80
|
-
exports.getVersionIfOnlyVersion = getVersionIfOnlyVersion;
|
|
81
|
-
function getUniqueSortedVersions(versions) {
|
|
82
|
-
return (0, exports.versionSort)((0, uniq_1.default)(versions));
|
|
83
|
-
}
|
|
84
|
-
exports.getUniqueSortedVersions = getUniqueSortedVersions;
|
|
85
|
-
const versionSorter = (_a, _b) => {
|
|
86
|
-
//Added because of wrong order of versions
|
|
87
|
-
let a = _a.match(/(\d+|\w+)/gm);
|
|
88
|
-
let b = _b.match(/(\d+|\w+)/gm);
|
|
89
|
-
for (var i = 0; i < (a.length > b.length ? a.length : b.length); i++) {
|
|
90
|
-
const x = parseInt(a[i]) || a[i];
|
|
91
|
-
const y = parseInt(b[i]) || b[i];
|
|
92
|
-
if (x === undefined || x < y) {
|
|
93
|
-
return 1;
|
|
94
|
-
}
|
|
95
|
-
else if (y === undefined || y < x) {
|
|
96
|
-
return -1;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (_a.length > _b.length) {
|
|
100
|
-
return 1;
|
|
101
|
-
}
|
|
102
|
-
else if (_b.length > _a.length) {
|
|
103
|
-
return -1;
|
|
104
|
-
}
|
|
105
|
-
return 0;
|
|
106
|
-
};
|
|
107
|
-
exports.versionSorter = versionSorter;
|
|
108
|
-
const versionSort = (arr) => {
|
|
109
|
-
return arr.sort(exports.versionSorter);
|
|
110
|
-
};
|
|
111
|
-
exports.versionSort = versionSort;
|
|
112
|
-
function getVersion(version) {
|
|
113
|
-
// 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)
|
|
114
|
-
const versionPartsArray = version.split(' ');
|
|
115
|
-
// find the index that has the version and split it into its parts
|
|
116
|
-
const indexOfVersion = versionPartsArray.findIndex((p) => p.includes('.'));
|
|
117
|
-
const splitArray = indexOfVersion > -1 ? versionPartsArray[indexOfVersion].split('.') : version.split('.');
|
|
118
|
-
// if the length of the split array is not 2, or 3 it is not a regular version
|
|
119
|
-
// b/c version === major.minor.patch (patch === component in the request body)
|
|
120
|
-
if (splitArray.length !== 2 && splitArray.length !== 3 && splitArray.length !== 4)
|
|
121
|
-
return { major: version };
|
|
122
|
-
// if either of the split array is not a number then it is not a regular version.
|
|
123
|
-
// 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"
|
|
124
|
-
// e.g. 1.x or 1.2.x
|
|
125
|
-
if (!(0, validatorUtils_1.isNumber)(splitArray[0]))
|
|
126
|
-
return { major: version };
|
|
127
|
-
else if (!(0, validatorUtils_1.isNumber)(splitArray[1]))
|
|
128
|
-
return { major: version.split('.')[0] };
|
|
129
|
-
else
|
|
130
|
-
return { major: version.split('.')[0], minor: version.split('.')[1] };
|
|
131
|
-
}
|
|
132
|
-
exports.getVersion = getVersion;
|
|
133
|
-
function isSpecialSupportOfferingEnabled(allProducts, selectedProduct) {
|
|
134
|
-
var _c;
|
|
135
|
-
const productHasSpecialSupportOffering = (_c = allProducts.find((product) => product.name === selectedProduct)) === null || _c === void 0 ? void 0 : _c.hasSpecialSupportOffering;
|
|
136
|
-
return productHasSpecialSupportOffering;
|
|
137
|
-
}
|
|
138
|
-
exports.isSpecialSupportOfferingEnabled = isSpecialSupportOfferingEnabled;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface IPromiseReflection<T> {
|
|
2
|
-
v?: T;
|
|
3
|
-
status: 'fulfilled' | 'rejected';
|
|
4
|
-
e?: Error;
|
|
5
|
-
}
|
|
6
|
-
declare const promiseReflection: <T>(p: Promise<T>) => Promise<IPromiseReflection<T>>;
|
|
7
|
-
export { promiseReflection, IPromiseReflection };
|
|
8
|
-
//# sourceMappingURL=promiseUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promiseUtils.d.ts","sourceRoot":"","sources":["../../src/promiseUtils.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB,CAAC,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAGD,QAAA,MAAM,iBAAiB,sDAOtB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC"}
|
package/lib/cjs/promiseUtils.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.promiseReflection = void 0;
|
|
13
|
-
// Promise.allSetteled is not supported in IE11. Here we use a helper function to mock the functionality
|
|
14
|
-
const promiseReflection = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
try {
|
|
16
|
-
const v = yield p;
|
|
17
|
-
return { v, status: 'fulfilled' };
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
return { e, status: 'rejected' };
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
exports.promiseReflection = promiseReflection;
|