@rh-support/utils 0.2.10 → 0.2.14

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.
@@ -1,7 +1,9 @@
1
1
  import { IApiCreateState, IApiDeleteState, IApiResponseDetails, IApiUpdateState } from '@rh-support/types/shared';
2
+ import { ITroubleshootProductResponse } from './productsUtils';
2
3
  export declare function getApiResourceObject<T>(data?: T, isFetching?: boolean, isError?: boolean, errorMessage?: string, error?: Error): IApiResponseDetails<T>;
3
4
  export declare function getApiCreationStatus(isCreating?: boolean, isError?: boolean, errorMessage?: string): IApiCreateState;
4
5
  export declare function getApiUpdationStatus(isUpdating?: boolean, isError?: boolean, errorMessage?: string): IApiUpdateState;
5
6
  export declare function getApiDeletionStatus(isDeleting?: boolean, isError?: boolean, errorMessage?: string): IApiDeleteState;
6
7
  export declare function haventLoadedMetadata<T>(apiResponse: IApiResponseDetails<T>, isEmptyCallback?: (data: T) => boolean): boolean;
8
+ export declare function haventLoadedProductsMetadata(apiResponse: IApiResponseDetails<ITroubleshootProductResponse>): boolean;
7
9
  //# sourceMappingURL=apiUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGlH,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,IAAI,GAAE,CAAa,EACnB,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,EACzB,KAAK,GAAE,KAAY,GACpB,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAED,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AACD,wBAAgB,oBAAoB,CAChC,UAAU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,EAAE,CAAC,KAAK,OAAO,GACvC,OAAO,CAGT;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,mBAAmB,CAAC,4BAA4B,CAAC,GAAG,OAAO,CAEpH"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.haventLoadedMetadata = exports.getApiDeletionStatus = exports.getApiUpdationStatus = exports.getApiCreationStatus = exports.getApiResourceObject = void 0;
6
+ exports.haventLoadedProductsMetadata = exports.haventLoadedMetadata = exports.getApiDeletionStatus = exports.getApiUpdationStatus = exports.getApiCreationStatus = exports.getApiResourceObject = void 0;
7
7
  var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
8
8
  function getApiResourceObject(data, isFetching, isError, errorMessage, error) {
9
9
  if (data === void 0) { data = undefined; }
@@ -40,3 +40,7 @@ function haventLoadedMetadata(apiResponse, isEmptyCallback) {
40
40
  return isDataEmpty(apiResponse.data) && !apiResponse.isFetching && !apiResponse.isError;
41
41
  }
42
42
  exports.haventLoadedMetadata = haventLoadedMetadata;
43
+ function haventLoadedProductsMetadata(apiResponse) {
44
+ return isEmpty_1.default(apiResponse.data.productsResult) && !apiResponse.isFetching && !apiResponse.isError;
45
+ }
46
+ exports.haventLoadedProductsMetadata = haventLoadedProductsMetadata;
@@ -12,5 +12,5 @@ export declare function isOpenShiftOnlineProduct(product: string): boolean;
12
12
  export declare function isValidCaseNumber(caseNumber: string): boolean;
13
13
  export declare function areAllValidCaseNumbers(items: string[]): boolean;
14
14
  export declare function linkifyLinks(text?: string): string;
15
- export declare function severitySort(sevA: any, sevB: any): 1 | -1 | 0;
15
+ export declare function severitySort(sevA: any, sevB: any): 0 | 1 | -1;
16
16
  //# sourceMappingURL=caseUtils.d.ts.map
@@ -2,6 +2,7 @@ declare enum APP_HOST_NAMES {
2
2
  supportHubHostName = "supportHubHostName"
3
3
  }
4
4
  declare const getAppHostName: (appName: APP_HOST_NAMES) => string;
5
- declare const getSHCaseLink: (caseNumber: string) => string;
6
- export { getAppHostName, APP_HOST_NAMES, getSHCaseLink };
5
+ declare const getSFDCEnv: () => string;
6
+ declare const getSFDCSecureSupportCaseLink: (caseNumber: string) => string;
7
+ export { getAppHostName, APP_HOST_NAMES, getSFDCEnv, getSFDCSecureSupportCaseLink };
7
8
  //# sourceMappingURL=hostNameUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hostNameUtils.d.ts","sourceRoot":"","sources":["../../src/hostNameUtils.ts"],"names":[],"mappings":"AAAA,aAAK,cAAc;IACf,kBAAkB,uBAAuB;CAC5C;AAMD,QAAA,MAAM,cAAc,YAAa,cAAc,WAE9C,CAAC;AAEF,QAAA,MAAM,aAAa,eAAgB,MAAM,WAExC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"hostNameUtils.d.ts","sourceRoot":"","sources":["../../src/hostNameUtils.ts"],"names":[],"mappings":"AAEA,aAAK,cAAc;IACf,kBAAkB,uBAAuB;CAC5C;AAMD,QAAA,MAAM,cAAc,YAAa,cAAc,WAE9C,CAAC;AAEF,QAAA,MAAM,UAAU,cAoBf,CAAC;AAEF,QAAA,MAAM,4BAA4B,eAAgB,MAAM,WAGvD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC"}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getSHCaseLink = exports.APP_HOST_NAMES = exports.getAppHostName = void 0;
4
+ exports.getSFDCSecureSupportCaseLink = exports.getSFDCEnv = exports.APP_HOST_NAMES = exports.getAppHostName = void 0;
5
+ var hydrajs_1 = require("@cee-eng/hydrajs");
5
6
  var APP_HOST_NAMES;
6
7
  (function (APP_HOST_NAMES) {
7
8
  APP_HOST_NAMES["supportHubHostName"] = "supportHubHostName";
@@ -14,7 +15,29 @@ var getAppHostName = function (appName) {
14
15
  return APP_URLS[appName];
15
16
  };
16
17
  exports.getAppHostName = getAppHostName;
17
- var getSHCaseLink = function (caseNumber) {
18
- return getAppHostName(APP_HOST_NAMES.supportHubHostName) + "/#/case/" + caseNumber;
18
+ var getSFDCEnv = function () {
19
+ var env = hydrajs_1.Env.getEnvName();
20
+ // Prod HostName
21
+ var hostName = 'gss.my.salesforce.com';
22
+ switch (env) {
23
+ case hydrajs_1.Env.EnvNames.QA:
24
+ hostName = 'gss--qa.cs53.my.salesforce.com';
25
+ break;
26
+ case hydrajs_1.Env.EnvNames.STAGE:
27
+ hostName = 'gss--stage2.cs70.my.salesforce.com';
28
+ break;
29
+ case hydrajs_1.Env.EnvNames.PROD_BETA:
30
+ case hydrajs_1.Env.EnvNames.PROD:
31
+ hostName = 'gss.my.salesforce.com';
32
+ break;
33
+ default:
34
+ hostName = 'gss.my.salesforce.com';
35
+ }
36
+ return hostName;
19
37
  };
20
- exports.getSHCaseLink = getSHCaseLink;
38
+ exports.getSFDCEnv = getSFDCEnv;
39
+ var getSFDCSecureSupportCaseLink = function (caseNumber) {
40
+ var hostName = getSFDCEnv();
41
+ return "https://" + hostName + "/apex/Support#/cases/" + caseNumber;
42
+ };
43
+ exports.getSFDCSecureSupportCaseLink = getSFDCSecureSupportCaseLink;
@@ -3,9 +3,10 @@ export declare enum PCM_CONFIG_FIELD_TYPE {
3
3
  JSON = "JSON",
4
4
  JSON_ARRAY = "JSON-ARRAY",
5
5
  JSON_HASHMAP = "JSON-HASHMAP",
6
- FEATURE_FLAG = "FEATURE-FLAG"
6
+ FEATURE_FLAG = "FEATURE-FLAG",
7
+ STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED"
7
8
  }
8
9
  declare function getConfigField(config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE): any;
9
- declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType: string) => any;
10
+ declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE) => any;
10
11
  export { getConfigField, getFieldInParts };
11
12
  //# sourceMappingURL=hydraConfigUtils.d.ts.map
@@ -1 +1 @@
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;CAChC;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,qBAA4B,OAwBzG;AAED,QAAA,MAAM,eAAe,WAAY,YAAY,EAAE,aAAa,MAAM,aAAa,MAAM,QA2BpF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
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;IAC7B,sBAAsB,2BAA2B;CACpD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,qBAA4B,OAwBzG;AAED,QAAA,MAAM,eAAe,WAAY,YAAY,EAAE,aAAa,MAAM,cAAa,qBAAqB,QAuCnG,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -36,6 +36,7 @@ var PCM_CONFIG_FIELD_TYPE;
36
36
  PCM_CONFIG_FIELD_TYPE["JSON_ARRAY"] = "JSON-ARRAY";
37
37
  PCM_CONFIG_FIELD_TYPE["JSON_HASHMAP"] = "JSON-HASHMAP";
38
38
  PCM_CONFIG_FIELD_TYPE["FEATURE_FLAG"] = "FEATURE-FLAG";
39
+ PCM_CONFIG_FIELD_TYPE["STRING_COMMA_SEPERATED"] = "STRING-COMMA-SEPERATED";
39
40
  })(PCM_CONFIG_FIELD_TYPE = exports.PCM_CONFIG_FIELD_TYPE || (exports.PCM_CONFIG_FIELD_TYPE = {}));
40
41
  function getConfigField(config, fieldName, fieldType) {
41
42
  if (fieldType === void 0) { fieldType = null; }
@@ -64,6 +65,7 @@ function getConfigField(config, fieldName, fieldType) {
64
65
  }
65
66
  exports.getConfigField = getConfigField;
66
67
  var getFieldInParts = function (config, fieldName, fieldType) {
68
+ if (fieldType === void 0) { fieldType = null; }
67
69
  var values = reduce_1.default(config, function (result, v) {
68
70
  return startsWith_1.default(v.fieldName, fieldName) ? __spreadArray(__spreadArray([], __read(result)), [v.fieldValue]) : result;
69
71
  }, []);
@@ -74,6 +76,11 @@ var getFieldInParts = function (config, fieldName, fieldType) {
74
76
  return values;
75
77
  }
76
78
  try {
79
+ if (fieldType === 'STRING-COMMA-SEPERATED') {
80
+ return reduce_1.default(values, function (acc, value) {
81
+ return acc.concat(value.split(','));
82
+ }, []);
83
+ }
77
84
  var parsed = map_1.default(values, JSON.parse);
78
85
  if (fieldType === 'JSON') {
79
86
  return parsed;
@@ -14,7 +14,7 @@ export declare function getTopProducts(products: Partial<ISEProduct>[]): Partial
14
14
  export declare function isOnlyVersion(versions: string[]): boolean;
15
15
  export declare function getVersionIfOnlyVersion(versions: string[]): string;
16
16
  export declare function getUniqueSortedVersions(versions: string[]): string[];
17
- export declare const versionSorter: (_a: string, _b: string) => 1 | -1 | 0;
17
+ export declare const versionSorter: (_a: string, _b: string) => 0 | 1 | -1;
18
18
  export declare const versionSort: (arr: string[]) => string[];
19
19
  interface IGetVersionReturnValue {
20
20
  major: string;
@@ -1,3 +1,8 @@
1
- declare const promiseReflection: (p: any) => any;
2
- export { promiseReflection };
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 };
3
8
  //# sourceMappingURL=promiseUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promiseUtils.d.ts","sourceRoot":"","sources":["../../src/promiseUtils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,iBAIlB,CAAC;AAEN,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
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"}
@@ -1,7 +1,58 @@
1
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
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
39
  exports.promiseReflection = void 0;
4
- var promiseReflection = function (p) {
5
- return p.then(function (v) { return ({ v: v, status: 'fulfilled' }); }, function (e) { return ({ e: e, status: 'rejected' }); });
6
- };
40
+ // Promise.allSetteled is not supported in IE11. Here we use a helper function to mock the functionality
41
+ var promiseReflection = function (p) { return __awaiter(void 0, void 0, void 0, function () {
42
+ var v, e_1;
43
+ return __generator(this, function (_a) {
44
+ switch (_a.label) {
45
+ case 0:
46
+ _a.trys.push([0, 2, , 3]);
47
+ return [4 /*yield*/, p];
48
+ case 1:
49
+ v = _a.sent();
50
+ return [2 /*return*/, { v: v, status: 'fulfilled' }];
51
+ case 2:
52
+ e_1 = _a.sent();
53
+ return [2 /*return*/, { e: e_1, status: 'rejected' }];
54
+ case 3: return [2 /*return*/];
55
+ }
56
+ });
57
+ }); };
7
58
  exports.promiseReflection = promiseReflection;
@@ -1,7 +1,9 @@
1
1
  import { IApiCreateState, IApiDeleteState, IApiResponseDetails, IApiUpdateState } from '@rh-support/types/shared';
2
+ import { ITroubleshootProductResponse } from './productsUtils';
2
3
  export declare function getApiResourceObject<T>(data?: T, isFetching?: boolean, isError?: boolean, errorMessage?: string, error?: Error): IApiResponseDetails<T>;
3
4
  export declare function getApiCreationStatus(isCreating?: boolean, isError?: boolean, errorMessage?: string): IApiCreateState;
4
5
  export declare function getApiUpdationStatus(isUpdating?: boolean, isError?: boolean, errorMessage?: string): IApiUpdateState;
5
6
  export declare function getApiDeletionStatus(isDeleting?: boolean, isError?: boolean, errorMessage?: string): IApiDeleteState;
6
7
  export declare function haventLoadedMetadata<T>(apiResponse: IApiResponseDetails<T>, isEmptyCallback?: (data: T) => boolean): boolean;
8
+ export declare function haventLoadedProductsMetadata(apiResponse: IApiResponseDetails<ITroubleshootProductResponse>): boolean;
7
9
  //# sourceMappingURL=apiUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGlH,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,IAAI,GAAE,CAAa,EACnB,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,EACzB,KAAK,GAAE,KAAY,GACpB,mBAAmB,C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,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACnC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GACvC,OAAO,CAGT;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,mBAAmB,CAAC,4BAA4B,CAAC,GAAG,OAAO,CAEpH"}
@@ -15,3 +15,6 @@ export function haventLoadedMetadata(apiResponse, isEmptyCallback) {
15
15
  const isDataEmpty = isEmptyCallback ? isEmptyCallback : isEmpty;
16
16
  return isDataEmpty(apiResponse.data) && !apiResponse.isFetching && !apiResponse.isError;
17
17
  }
18
+ export function haventLoadedProductsMetadata(apiResponse) {
19
+ return isEmpty(apiResponse.data.productsResult) && !apiResponse.isFetching && !apiResponse.isError;
20
+ }
@@ -12,5 +12,5 @@ export declare function isOpenShiftOnlineProduct(product: string): boolean;
12
12
  export declare function isValidCaseNumber(caseNumber: string): boolean;
13
13
  export declare function areAllValidCaseNumbers(items: string[]): boolean;
14
14
  export declare function linkifyLinks(text?: string): string;
15
- export declare function severitySort(sevA: any, sevB: any): 1 | -1 | 0;
15
+ export declare function severitySort(sevA: any, sevB: any): 0 | 1 | -1;
16
16
  //# sourceMappingURL=caseUtils.d.ts.map
@@ -2,6 +2,7 @@ declare enum APP_HOST_NAMES {
2
2
  supportHubHostName = "supportHubHostName"
3
3
  }
4
4
  declare const getAppHostName: (appName: APP_HOST_NAMES) => string;
5
- declare const getSHCaseLink: (caseNumber: string) => string;
6
- export { getAppHostName, APP_HOST_NAMES, getSHCaseLink };
5
+ declare const getSFDCEnv: () => string;
6
+ declare const getSFDCSecureSupportCaseLink: (caseNumber: string) => string;
7
+ export { getAppHostName, APP_HOST_NAMES, getSFDCEnv, getSFDCSecureSupportCaseLink };
7
8
  //# sourceMappingURL=hostNameUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hostNameUtils.d.ts","sourceRoot":"","sources":["../../src/hostNameUtils.ts"],"names":[],"mappings":"AAAA,aAAK,cAAc;IACf,kBAAkB,uBAAuB;CAC5C;AAMD,QAAA,MAAM,cAAc,YAAa,cAAc,WAE9C,CAAC;AAEF,QAAA,MAAM,aAAa,eAAgB,MAAM,WAExC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"hostNameUtils.d.ts","sourceRoot":"","sources":["../../src/hostNameUtils.ts"],"names":[],"mappings":"AAEA,aAAK,cAAc;IACf,kBAAkB,uBAAuB;CAC5C;AAMD,QAAA,MAAM,cAAc,YAAa,cAAc,WAE9C,CAAC;AAEF,QAAA,MAAM,UAAU,cAoBf,CAAC;AAEF,QAAA,MAAM,4BAA4B,eAAgB,MAAM,WAGvD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Env } from '@cee-eng/hydrajs';
1
2
  var APP_HOST_NAMES;
2
3
  (function (APP_HOST_NAMES) {
3
4
  APP_HOST_NAMES["supportHubHostName"] = "supportHubHostName";
@@ -8,7 +9,28 @@ const APP_URLS = {
8
9
  const getAppHostName = (appName) => {
9
10
  return APP_URLS[appName];
10
11
  };
11
- const getSHCaseLink = (caseNumber) => {
12
- return `${getAppHostName(APP_HOST_NAMES.supportHubHostName)}/#/case/${caseNumber}`;
12
+ const getSFDCEnv = () => {
13
+ const env = Env.getEnvName();
14
+ // Prod HostName
15
+ let hostName = 'gss.my.salesforce.com';
16
+ switch (env) {
17
+ case Env.EnvNames.QA:
18
+ hostName = 'gss--qa.cs53.my.salesforce.com';
19
+ break;
20
+ case Env.EnvNames.STAGE:
21
+ hostName = 'gss--stage2.cs70.my.salesforce.com';
22
+ break;
23
+ case Env.EnvNames.PROD_BETA:
24
+ case Env.EnvNames.PROD:
25
+ hostName = 'gss.my.salesforce.com';
26
+ break;
27
+ default:
28
+ hostName = 'gss.my.salesforce.com';
29
+ }
30
+ return hostName;
13
31
  };
14
- export { getAppHostName, APP_HOST_NAMES, getSHCaseLink };
32
+ const getSFDCSecureSupportCaseLink = (caseNumber) => {
33
+ const hostName = getSFDCEnv();
34
+ return `https://${hostName}/apex/Support#/cases/${caseNumber}`;
35
+ };
36
+ export { getAppHostName, APP_HOST_NAMES, getSFDCEnv, getSFDCSecureSupportCaseLink };
@@ -3,9 +3,10 @@ export declare enum PCM_CONFIG_FIELD_TYPE {
3
3
  JSON = "JSON",
4
4
  JSON_ARRAY = "JSON-ARRAY",
5
5
  JSON_HASHMAP = "JSON-HASHMAP",
6
- FEATURE_FLAG = "FEATURE-FLAG"
6
+ FEATURE_FLAG = "FEATURE-FLAG",
7
+ STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED"
7
8
  }
8
9
  declare function getConfigField(config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE): any;
9
- declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType: string) => any;
10
+ declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE) => any;
10
11
  export { getConfigField, getFieldInParts };
11
12
  //# sourceMappingURL=hydraConfigUtils.d.ts.map
@@ -1 +1 @@
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;CAChC;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,qBAA4B,OAwBzG;AAED,QAAA,MAAM,eAAe,WAAY,YAAY,EAAE,aAAa,MAAM,aAAa,MAAM,QA2BpF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
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;IAC7B,sBAAsB,2BAA2B;CACpD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,qBAA4B,OAwBzG;AAED,QAAA,MAAM,eAAe,WAAY,YAAY,EAAE,aAAa,MAAM,cAAa,qBAAqB,QAuCnG,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -9,6 +9,7 @@ export var PCM_CONFIG_FIELD_TYPE;
9
9
  PCM_CONFIG_FIELD_TYPE["JSON_ARRAY"] = "JSON-ARRAY";
10
10
  PCM_CONFIG_FIELD_TYPE["JSON_HASHMAP"] = "JSON-HASHMAP";
11
11
  PCM_CONFIG_FIELD_TYPE["FEATURE_FLAG"] = "FEATURE-FLAG";
12
+ PCM_CONFIG_FIELD_TYPE["STRING_COMMA_SEPERATED"] = "STRING-COMMA-SEPERATED";
12
13
  })(PCM_CONFIG_FIELD_TYPE || (PCM_CONFIG_FIELD_TYPE = {}));
13
14
  function getConfigField(config, fieldName, fieldType = null) {
14
15
  let values = reduce(config, (result, v) => {
@@ -34,7 +35,7 @@ function getConfigField(config, fieldName, fieldType = null) {
34
35
  console.log(error);
35
36
  }
36
37
  }
37
- const getFieldInParts = (config, fieldName, fieldType) => {
38
+ const getFieldInParts = (config, fieldName, fieldType = null) => {
38
39
  const values = reduce(config, (result, v) => {
39
40
  return startsWith(v.fieldName, fieldName) ? [...result, v.fieldValue] : result;
40
41
  }, []);
@@ -45,6 +46,11 @@ const getFieldInParts = (config, fieldName, fieldType) => {
45
46
  return values;
46
47
  }
47
48
  try {
49
+ if (fieldType === 'STRING-COMMA-SEPERATED') {
50
+ return reduce(values, (acc, value) => {
51
+ return acc.concat(value.split(','));
52
+ }, []);
53
+ }
48
54
  const parsed = map(values, JSON.parse);
49
55
  if (fieldType === 'JSON') {
50
56
  return parsed;
@@ -14,7 +14,7 @@ export declare function getTopProducts(products: Partial<ISEProduct>[]): Partial
14
14
  export declare function isOnlyVersion(versions: string[]): boolean;
15
15
  export declare function getVersionIfOnlyVersion(versions: string[]): string;
16
16
  export declare function getUniqueSortedVersions(versions: string[]): string[];
17
- export declare const versionSorter: (_a: string, _b: string) => 1 | -1 | 0;
17
+ export declare const versionSorter: (_a: string, _b: string) => 0 | 1 | -1;
18
18
  export declare const versionSort: (arr: string[]) => string[];
19
19
  interface IGetVersionReturnValue {
20
20
  major: string;
@@ -1,3 +1,8 @@
1
- declare const promiseReflection: (p: any) => any;
2
- export { promiseReflection };
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 };
3
8
  //# sourceMappingURL=promiseUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promiseUtils.d.ts","sourceRoot":"","sources":["../../src/promiseUtils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,iBAIlB,CAAC;AAEN,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
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"}
@@ -1,2 +1,20 @@
1
- const promiseReflection = (p) => p.then((v) => ({ v, status: 'fulfilled' }), (e) => ({ e, status: 'rejected' }));
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ // Promise.allSetteled is not supported in IE11. Here we use a helper function to mock the functionality
11
+ const promiseReflection = (p) => __awaiter(void 0, void 0, void 0, function* () {
12
+ try {
13
+ const v = yield p;
14
+ return { v, status: 'fulfilled' };
15
+ }
16
+ catch (e) {
17
+ return { e, status: 'rejected' };
18
+ }
19
+ });
2
20
  export { promiseReflection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/utils",
3
- "version": "0.2.10",
3
+ "version": "0.2.14",
4
4
  "description": "> TODO: description",
5
5
  "author": "Vikas Rathee <vrathee@redhat.com>",
6
6
  "license": "ISC",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@cee-eng/hydrajs": "4.7.3",
49
- "@cee-eng/ui-toolkit": "1.1.3",
50
- "@rh-support/api": "0.3.2",
49
+ "@cee-eng/ui-toolkit": "1.1.4",
50
+ "@rh-support/api": "0.3.9",
51
51
  "@rh-support/types": "0.2.0",
52
52
  "dompurify": "^2.2.6",
53
53
  "i18next": "^19.0.1",
@@ -62,8 +62,8 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@cee-eng/hydrajs": "4.7.3",
65
- "@cee-eng/ui-toolkit": "1.1.3",
66
- "@rh-support/api": "0.3.8",
65
+ "@cee-eng/ui-toolkit": "1.1.4",
66
+ "@rh-support/api": "0.3.9",
67
67
  "@rh-support/types": "0.2.0",
68
68
  "dompurify": "^2.2.6",
69
69
  "dot": "^1.1.3",
@@ -87,5 +87,5 @@
87
87
  "@types/react-dom": "^17.0.9",
88
88
  "moment-timezone": "^0.5.32"
89
89
  },
90
- "gitHead": "9a2829fecfe0e5755eacfb6f27b67271edb56e33"
90
+ "gitHead": "f16c3e016d3cfc56fa94f1cb1a8f8ab2d3fe0a35"
91
91
  }