mp-front-cli 2.1.1 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/AuthEngine-D65_iNdB.cjs +1 -0
  2. package/dist/{fetch-service-parent-be-CqCxXrf0.js → AuthEngine-Gl4gv5KD.js} +443 -232
  3. package/dist/core/errors/common-errors.d.ts +3 -0
  4. package/dist/core/errors/common-errors.d.ts.map +1 -0
  5. package/dist/core/errors/error-catalog.d.ts +5 -0
  6. package/dist/core/errors/error-catalog.d.ts.map +1 -1
  7. package/dist/core/errors/exception.d.ts +12 -0
  8. package/dist/core/errors/exception.d.ts.map +1 -0
  9. package/dist/core/errors/index.d.ts +1 -0
  10. package/dist/core/errors/index.d.ts.map +1 -1
  11. package/dist/core/middleware/index.d.ts.map +1 -1
  12. package/dist/core/utils/AuthEngine/AuthEngine.d.ts +29 -0
  13. package/dist/core/utils/AuthEngine/AuthEngine.d.ts.map +1 -0
  14. package/dist/core/utils/AuthEngine/EntraID.d.ts +11 -0
  15. package/dist/core/utils/AuthEngine/EntraID.d.ts.map +1 -0
  16. package/dist/core/utils/AuthEngine/index.d.ts +2 -0
  17. package/dist/core/utils/AuthEngine/index.d.ts.map +1 -0
  18. package/dist/core/utils/AuthEngine/interfaces/index.d.ts +51 -0
  19. package/dist/core/utils/AuthEngine/interfaces/index.d.ts.map +1 -0
  20. package/dist/core/utils/Terminal/constants/index.d.ts +1 -1
  21. package/dist/core/utils/api-request/fetch-service-be.d.ts +0 -5
  22. package/dist/core/utils/api-request/fetch-service-be.d.ts.map +1 -1
  23. package/dist/core/utils/api-request/fetch-service-fe.d.ts.map +1 -1
  24. package/dist/core/utils/custom-adapter.d.ts.map +1 -1
  25. package/dist/core/utils/index.d.ts +1 -0
  26. package/dist/core/utils/index.d.ts.map +1 -1
  27. package/dist/{mp-front-cli-encoder.es.js → custom-encoder-Cfd7FFMe.js} +3 -2
  28. package/dist/custom-encoder-d7rw7W8X.cjs +27 -0
  29. package/dist/custom-redis-BaTLH6jE.cjs +1 -0
  30. package/dist/index-D-Gvi_du.cjs +1 -0
  31. package/dist/loading-handler-CVkAHN_A.cjs +1 -0
  32. package/dist/mp-front-cli-adapter.cjs +1 -0
  33. package/dist/mp-front-cli-all.cjs +1 -0
  34. package/dist/mp-front-cli-all.js +16 -0
  35. package/dist/mp-front-cli-cache.cjs +1 -0
  36. package/dist/{mp-front-cli-cache.es.js → mp-front-cli-cache.js} +1 -1
  37. package/dist/mp-front-cli-core.cjs +1 -0
  38. package/dist/mp-front-cli-core.js +16 -0
  39. package/dist/mp-front-cli-encoder.cjs +1 -0
  40. package/dist/mp-front-cli-encoder.js +5 -0
  41. package/dist/mp-front-cli-encrypter.cjs +1 -0
  42. package/dist/{mp-front-cli-encrypter.es.js → mp-front-cli-encrypter.js} +1 -1
  43. package/dist/mp-front-cli-header.cjs +1 -0
  44. package/dist/{mp-front-cli-header.es.js → mp-front-cli-header.js} +2 -2
  45. package/dist/mp-front-cli-locale.cjs +1 -0
  46. package/dist/mp-front-cli-logger.cjs +1 -0
  47. package/dist/mp-front-cli-services.cjs +1 -0
  48. package/dist/mp-front-cli-services.js +4 -0
  49. package/dist/mp-front-cli-utils-rxjs.cjs +1 -0
  50. package/dist/service-token-Bv3BAiQd.cjs +3 -0
  51. package/dist/{service-token-DceocCHP.js → service-token-DUKgd-pZ.js} +1 -1
  52. package/dist/stringify-BN6t_WDt.cjs +1 -0
  53. package/package.json +29 -16
  54. package/dist/mp-front-cli-all.es.js +0 -14
  55. package/dist/mp-front-cli-core.es.js +0 -14
  56. package/dist/mp-front-cli-services.es.js +0 -4
  57. /package/dist/{mp-front-cli-adapter.es.js → mp-front-cli-adapter.js} +0 -0
  58. /package/dist/{mp-front-cli-locale.es.js → mp-front-cli-locale.js} +0 -0
  59. /package/dist/{mp-front-cli-logger.es.js → mp-front-cli-logger.js} +0 -0
  60. /package/dist/{mp-front-cli-utils-rxjs.es.js → mp-front-cli-utils-rxjs.js} +0 -0
@@ -1,24 +1,24 @@
1
- var F = Object.defineProperty;
2
- var w = (t, E, e) => E in t ? F(t, E, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[E] = e;
3
- var N = (t, E, e) => w(t, typeof E != "symbol" ? E + "" : E, e);
4
- import { of as O, switchMap as C, forkJoin as d, catchError as I, EMPTY as c, filter as u } from "rxjs";
5
- import { CustomEncrypter as v } from "./mp-front-cli-encrypter.es.js";
6
- import { CustomHeader as y } from "./mp-front-cli-header.es.js";
7
- import h from "querystring";
8
- import { f as g } from "./service-token-DceocCHP.js";
9
- import { L as S, M as P } from "./loading-handler-Br21zGTA.js";
10
- import { CustomEncoder as M } from "./mp-front-cli-encoder.es.js";
11
- import { u as Q } from "./stringify-93tp0umt.js";
12
- import { CustomLogger as G } from "./mp-front-cli-logger.es.js";
13
- import B from "i18next";
14
- import { t as V } from "./index-Dy5KNkhq.js";
15
- const f = (t) => (B.init({
1
+ var Y = Object.defineProperty;
2
+ var X = (A, t, e) => t in A ? Y(A, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[t] = e;
3
+ var O = (A, t, e) => X(A, typeof t != "symbol" ? t + "" : t, e);
4
+ import { of as n, switchMap as N, forkJoin as p, catchError as U, EMPTY as h, filter as G } from "rxjs";
5
+ import { CustomEncrypter as b } from "./mp-front-cli-encrypter.js";
6
+ import y from "i18next";
7
+ import { CustomHeader as V } from "./mp-front-cli-header.js";
8
+ import J from "querystring";
9
+ import { f as L } from "./service-token-DUKgd-pZ.js";
10
+ import { L as S, M as x } from "./loading-handler-Br21zGTA.js";
11
+ import { C as K, l as c } from "./custom-encoder-Cfd7FFMe.js";
12
+ import { CustomLogger as u } from "./mp-front-cli-logger.js";
13
+ import { u as Z } from "./stringify-93tp0umt.js";
14
+ import { t as k } from "./index-Dy5KNkhq.js";
15
+ const D = (A) => (y.init({
16
16
  resources: {
17
17
  es: {
18
18
  translation: {
19
19
  errors: {
20
- ...V.errors,
21
- ...(t == null ? void 0 : t.es) ?? {}
20
+ ...k.errors,
21
+ ...(A == null ? void 0 : A.es) ?? {}
22
22
  }
23
23
  }
24
24
  }
@@ -33,7 +33,7 @@ const f = (t) => (B.init({
33
33
  // react already safes from xss
34
34
  },
35
35
  debug: !1
36
- }), B), J = {
36
+ }), y), j = {
37
37
  "SKIPFINGERPRINT-WITHOUT-PERMISSIONS-01": {
38
38
  code: 400,
39
39
  type: "modal",
@@ -90,7 +90,7 @@ const f = (t) => (B.init({
90
90
  title: "errors.helpdesk.UNEXCEPTED-ERROR.title",
91
91
  level: "error"
92
92
  }
93
- }, $ = {
93
+ }, W = {
94
94
  "PF-CANCEL-APPLICATION-GENERIC-ERROR-001": {
95
95
  code: 400,
96
96
  type: "modal",
@@ -98,10 +98,10 @@ const f = (t) => (B.init({
98
98
  title: "errors.PF-CANCEL-APPLICATION-GENERIC-ERROR-001.title",
99
99
  level: "error"
100
100
  }
101
- }, Y = {
102
- ...$,
103
- ...J
104
- }, X = {
101
+ }, z = {
102
+ ...W,
103
+ ...j
104
+ }, H = {
105
105
  UNAUTHORIZED: {
106
106
  level: "warning",
107
107
  type: "modal",
@@ -944,16 +944,16 @@ const f = (t) => (B.init({
944
944
  type: "modal",
945
945
  level: "warning"
946
946
  },
947
- ...Y
947
+ ...z
948
948
  };
949
- class n extends G {
949
+ class d extends u {
950
950
  constructor() {
951
951
  super(...arguments);
952
- N(this, "errorCatalog", { ...X });
953
- N(this, "i18Next");
952
+ O(this, "errorCatalog", { ...H });
953
+ O(this, "i18Next");
954
954
  }
955
955
  get(e = "default", r = "NOT_FOUND") {
956
- var A, a;
956
+ var o, l;
957
957
  const { errorCatalog: s } = this;
958
958
  if (e instanceof Error)
959
959
  return this.logError(e.message), {
@@ -962,18 +962,18 @@ class n extends G {
962
962
  message: this.translate(s.internalError.message),
963
963
  uuid: r
964
964
  };
965
- const o = typeof e == "string" ? e : e.code ?? e.errorType;
966
- this.logDebug("statusCode", o);
967
- const l = typeof e == "string" ? {} : { ...e };
965
+ const E = typeof e == "string" ? e : e.code ?? e.errorType;
966
+ this.logDebug("statusCode", E);
967
+ const a = typeof e == "string" ? {} : { ...e };
968
968
  return {
969
- ...s[o] ?? s.default,
969
+ ...s[E] ?? s.default,
970
970
  title: this.translate(
971
- ((A = s[o]) == null ? void 0 : A.title) ?? s.default.title,
972
- l
971
+ ((o = s[E]) == null ? void 0 : o.title) ?? s.default.title,
972
+ a
973
973
  ),
974
974
  message: this.translate(
975
- ((a = s[o]) == null ? void 0 : a.message) ?? s.default.message,
976
- l
975
+ ((l = s[E]) == null ? void 0 : l.message) ?? s.default.message,
976
+ a
977
977
  ),
978
978
  payload: typeof e != "string" ? { errorCode: e.code } : {},
979
979
  uuid: r
@@ -983,250 +983,296 @@ class n extends G {
983
983
  this.errorCatalog = { ...this.errorCatalog, ...e };
984
984
  }
985
985
  setI18nResources(e) {
986
- this.i18Next = f(e);
986
+ this.i18Next = D(e);
987
987
  }
988
988
  translate(e, r = {}) {
989
- return this.i18Next || (this.i18Next = f()), this.i18Next.t(e, { payload: r });
989
+ return this.i18Next || (this.i18Next = D()), this.i18Next.t(e, { payload: r });
990
990
  }
991
991
  }
992
- class Oe extends v {
992
+ const m = class m {
993
+ constructor() {
994
+ O(this, "customLogger", new u());
995
+ O(this, "exceptions", { ...H });
996
+ }
997
+ static getInstance() {
998
+ return m.instance || (m.instance = new m()), m.instance;
999
+ }
1000
+ init(t, e) {
1001
+ this.exceptions = { ...this.exceptions, ...t }, m.i18n = D(e);
1002
+ }
1003
+ get(t, e = "NOT_FOUND") {
1004
+ var E, a;
1005
+ if (m.i18n || (m.i18n = D()), t instanceof Error) {
1006
+ this.customLogger.logError(t.message);
1007
+ const o = this.exceptions.internalError;
1008
+ return {
1009
+ ...o,
1010
+ title: this.translate(o.title),
1011
+ message: this.translate(o.message),
1012
+ uuid: e
1013
+ };
1014
+ }
1015
+ const r = typeof t == "string" ? t : t.code ?? t.errorType;
1016
+ this.customLogger.logDebug("statusCode", r);
1017
+ const s = typeof t == "string" ? {} : { ...t };
1018
+ return {
1019
+ ...this.exceptions[r] ?? this.exceptions.default,
1020
+ title: this.translate(
1021
+ ((E = this.exceptions[r]) == null ? void 0 : E.title) ?? this.exceptions.default.title,
1022
+ s
1023
+ ),
1024
+ message: this.translate(
1025
+ ((a = this.exceptions[r]) == null ? void 0 : a.message) ?? this.exceptions.default.message,
1026
+ s
1027
+ ),
1028
+ payload: typeof t != "string" ? { errorCode: t.code } : {},
1029
+ uuid: e
1030
+ };
1031
+ }
1032
+ translate(t, e = {}) {
1033
+ return m.i18n.t(t, { payload: e });
1034
+ }
1035
+ };
1036
+ O(m, "instance"), O(m, "i18n");
1037
+ let I = m;
1038
+ class De extends b {
993
1039
  constructor() {
994
1040
  super(...arguments);
995
- N(this, "uuid", "");
996
- N(this, "session", null);
1041
+ O(this, "uuid", "");
1042
+ O(this, "session", null);
997
1043
  }
998
1044
  setSession(e) {
999
1045
  this.session = e;
1000
1046
  }
1001
1047
  getSession() {
1002
- if (!this.session) throw new n().get("SESSION_NOT_FOUND");
1048
+ if (!this.session) throw I.getInstance().get("SESSION_NOT_FOUND");
1003
1049
  return this.session;
1004
1050
  }
1005
1051
  returnData(e, r, s) {
1006
- const o = this.encode(r, s);
1007
- e.status(200).json(o);
1052
+ const E = this.encode(r, s);
1053
+ e.status(200).json(E);
1008
1054
  }
1009
1055
  returnError(e, r) {
1010
- return r != null && r.uuid ? e.status(520).json(r) : e.status(520).json(new n().get(r, this.uuid));
1056
+ return r != null && r.uuid ? e.status(520).json(r) : e.status(520).json(I.getInstance().get(r, this.uuid));
1011
1057
  }
1012
1058
  get(e) {
1013
1059
  return this.logDebug("get ApiMiddleware"), (r, s) => {
1014
- var o;
1015
- this.logDebug("return ApiMiddleware"), this.uuid = (o = r == null ? void 0 : r.body) == null ? void 0 : o.uuid, O(r).pipe(
1016
- C(
1017
- (l) => d({
1018
- params: O(this.decode(l.body)),
1019
- headers: O(l.headers)
1060
+ var E;
1061
+ this.logDebug("return ApiMiddleware"), this.uuid = (E = r == null ? void 0 : r.body) == null ? void 0 : E.uuid, n(r).pipe(
1062
+ N(
1063
+ (a) => p({
1064
+ params: n(this.decode(a.body)),
1065
+ headers: n(a.headers)
1020
1066
  })
1021
1067
  ),
1022
- C(
1023
- ({ params: l, headers: A }) => d({
1024
- response: e(l, this.uuid, A),
1025
- headers: O(A),
1026
- params: O(l)
1068
+ N(
1069
+ ({ params: a, headers: o }) => p({
1070
+ response: e(a, this.uuid, o),
1071
+ headers: n(o),
1072
+ params: n(a)
1027
1073
  })
1028
1074
  ),
1029
- C(({ params: l, response: A, headers: a }) => (this.logDebug(
1030
- `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${r.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(a)} \x1B[37m <UUID> \x1B[33m ${r.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(l)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(A)}`
1031
- ), O(A))),
1032
- I((l) => {
1033
- var A;
1075
+ N(({ params: a, response: o, headers: l }) => (this.logDebug(
1076
+ `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${r.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(l)} \x1B[37m <UUID> \x1B[33m ${r.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(a)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)}`
1077
+ ), n(o))),
1078
+ U((a) => {
1079
+ var o;
1034
1080
  return this.logError(
1035
- `ApiMiddleware <URL>: ${r == null ? void 0 : r.url} <HEADERS>: ${JSON.stringify(r == null ? void 0 : r.headers)} <UUID> ${(A = r == null ? void 0 : r.body) == null ? void 0 : A.uuid} <PARAMS> ${JSON.stringify(r == null ? void 0 : r.body)} <ERROR>: ${JSON.stringify(l)}`
1036
- ), this.returnError(s, l), c;
1081
+ `ApiMiddleware <URL>: ${r == null ? void 0 : r.url} <HEADERS>: ${JSON.stringify(r == null ? void 0 : r.headers)} <UUID> ${(o = r == null ? void 0 : r.body) == null ? void 0 : o.uuid} <PARAMS> ${JSON.stringify(r == null ? void 0 : r.body)} <ERROR>: ${JSON.stringify(a)}`
1082
+ ), this.returnError(s, a), h;
1037
1083
  })
1038
1084
  ).subscribe({
1039
- next: (l) => {
1040
- this.logDebug("ApiMiddleware subscribe next", JSON.stringify(l)), this.returnData(s, l, this.uuid);
1085
+ next: (a) => {
1086
+ this.logDebug("ApiMiddleware subscribe next", JSON.stringify(a)), this.returnData(s, a, this.uuid);
1041
1087
  }
1042
1088
  });
1043
1089
  };
1044
1090
  }
1045
1091
  }
1046
- const H = process.env.ID_FRONT ?? "NOT_AVAILABLE";
1047
- class Ce extends y {
1092
+ const q = process.env.ID_FRONT ?? "NOT_AVAILABLE";
1093
+ class de extends V {
1048
1094
  constructor(e, r, s = {}) {
1049
1095
  super(s);
1050
- N(this, "apiUrl");
1051
- N(this, "method");
1096
+ O(this, "apiUrl");
1097
+ O(this, "method");
1052
1098
  this.apiUrl = e, this.method = r ?? "POST";
1053
1099
  }
1054
1100
  errorHandler(e, r) {
1055
1101
  if (e != null && e.errors)
1056
- throw new n().get(e.errors[0], r);
1102
+ throw I.getInstance().get(e.errors[0], r);
1057
1103
  return !(e != null && e.errors);
1058
1104
  }
1059
1105
  formatParams(e) {
1060
1106
  return JSON.stringify({
1061
1107
  data: {
1062
- type: H,
1108
+ type: q,
1063
1109
  attributes: e
1064
1110
  }
1065
1111
  });
1066
1112
  }
1067
1113
  fetchData(e = {}, r) {
1068
1114
  return this.getHeaders().pipe(
1069
- C(
1070
- (s) => g(
1115
+ N(
1116
+ (s) => L(
1071
1117
  this.apiUrl,
1072
1118
  {
1073
1119
  method: "POST",
1074
1120
  headers: s,
1075
1121
  body: this.formatParams(e),
1076
- selector: (o) => o.json()
1122
+ selector: (E) => E.json()
1077
1123
  }
1078
1124
  ).pipe(
1079
- I((o) => {
1080
- throw this.logError(JSON.stringify(o)), this.logError(
1125
+ U((E) => {
1126
+ throw this.logError(JSON.stringify(E)), this.logError(
1081
1127
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1082
1128
  s
1083
1129
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1084
1130
  this.formatParams(e)
1085
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
1086
- ), new n().get("default", r);
1131
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(E)} \x1B[33m`
1132
+ ), I.getInstance().get("default", r);
1087
1133
  }),
1088
- C((o) => (this.logDebug(
1134
+ N((E) => (this.logDebug(
1089
1135
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1090
1136
  s
1091
1137
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1092
1138
  this.formatParams(e)
1093
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
1094
- ), O(o)))
1139
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(E)} \x1B[33m`
1140
+ ), n(E)))
1095
1141
  )
1096
1142
  ),
1097
- u((s) => this.errorHandler(s, r))
1143
+ G((s) => this.errorHandler(s, r))
1098
1144
  );
1099
1145
  }
1100
1146
  fetchCustomData(e = {}, r, s) {
1101
- const o = {
1147
+ const E = {
1102
1148
  "Content-Type": "application/json"
1103
- }, l = h.stringify(
1149
+ }, a = J.stringify(
1104
1150
  e
1105
- ), A = `${this.apiUrl}?${l}`, a = this.method === "GET" ? A : this.apiUrl;
1106
- return this.getHeaders(o, s).pipe(
1107
- C(
1108
- (R) => g(a, {
1151
+ ), o = `${this.apiUrl}?${a}`, l = this.method === "GET" ? o : this.apiUrl;
1152
+ return this.getHeaders(E, s).pipe(
1153
+ N(
1154
+ (R) => L(l, {
1109
1155
  method: this.method,
1110
1156
  headers: R,
1111
1157
  body: this.method === "GET" ? null : JSON.stringify(e),
1112
- selector: (i) => i.json()
1158
+ selector: (T) => T.json()
1113
1159
  }).pipe(
1114
- I((i) => {
1115
- throw this.logError(JSON.stringify(i)), this.logError(
1116
- `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${a} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1160
+ U((T) => {
1161
+ throw this.logError(JSON.stringify(T)), this.logError(
1162
+ `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${l} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1117
1163
  R
1118
1164
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1119
1165
  this.formatParams(e)
1120
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(i)} \x1B[33m`
1121
- ), new n().get("default", r);
1166
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(T)} \x1B[33m`
1167
+ ), I.getInstance().get("default", r);
1122
1168
  }),
1123
- C((i) => (this.logDebug(
1124
- `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${a} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1169
+ N((T) => (this.logDebug(
1170
+ `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${l} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1125
1171
  R
1126
1172
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1127
1173
  e
1128
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(i)} \x1B[33m`
1129
- ), O(i)))
1174
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(T)} \x1B[33m`
1175
+ ), n(T)))
1130
1176
  )
1131
1177
  )
1132
1178
  );
1133
1179
  }
1134
1180
  }
1135
- const b = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
1136
- function K(t) {
1137
- return typeof t == "string" && b.test(t);
1181
+ const ee = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
1182
+ function re(A) {
1183
+ return typeof A == "string" && ee.test(A);
1138
1184
  }
1139
- function W(t) {
1140
- if (!K(t))
1185
+ function te(A) {
1186
+ if (!re(A))
1141
1187
  throw TypeError("Invalid UUID");
1142
- let E;
1188
+ let t;
1143
1189
  const e = new Uint8Array(16);
1144
- return e[0] = (E = parseInt(t.slice(0, 8), 16)) >>> 24, e[1] = E >>> 16 & 255, e[2] = E >>> 8 & 255, e[3] = E & 255, e[4] = (E = parseInt(t.slice(9, 13), 16)) >>> 8, e[5] = E & 255, e[6] = (E = parseInt(t.slice(14, 18), 16)) >>> 8, e[7] = E & 255, e[8] = (E = parseInt(t.slice(19, 23), 16)) >>> 8, e[9] = E & 255, e[10] = (E = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, e[11] = E / 4294967296 & 255, e[12] = E >>> 24 & 255, e[13] = E >>> 16 & 255, e[14] = E >>> 8 & 255, e[15] = E & 255, e;
1190
+ return e[0] = (t = parseInt(A.slice(0, 8), 16)) >>> 24, e[1] = t >>> 16 & 255, e[2] = t >>> 8 & 255, e[3] = t & 255, e[4] = (t = parseInt(A.slice(9, 13), 16)) >>> 8, e[5] = t & 255, e[6] = (t = parseInt(A.slice(14, 18), 16)) >>> 8, e[7] = t & 255, e[8] = (t = parseInt(A.slice(19, 23), 16)) >>> 8, e[9] = t & 255, e[10] = (t = parseInt(A.slice(24, 36), 16)) / 1099511627776 & 255, e[11] = t / 4294967296 & 255, e[12] = t >>> 24 & 255, e[13] = t >>> 16 & 255, e[14] = t >>> 8 & 255, e[15] = t & 255, e;
1145
1191
  }
1146
- function k(t) {
1147
- t = unescape(encodeURIComponent(t));
1148
- const E = [];
1149
- for (let e = 0; e < t.length; ++e)
1150
- E.push(t.charCodeAt(e));
1151
- return E;
1192
+ function se(A) {
1193
+ A = unescape(encodeURIComponent(A));
1194
+ const t = [];
1195
+ for (let e = 0; e < A.length; ++e)
1196
+ t.push(A.charCodeAt(e));
1197
+ return t;
1152
1198
  }
1153
- const j = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", _ = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
1154
- function Z(t, E, e) {
1155
- function r(s, o, l, A) {
1156
- var a;
1157
- if (typeof s == "string" && (s = k(s)), typeof o == "string" && (o = W(o)), ((a = o) === null || a === void 0 ? void 0 : a.length) !== 16)
1199
+ const Ee = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", le = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
1200
+ function Ae(A, t, e) {
1201
+ function r(s, E, a, o) {
1202
+ var l;
1203
+ if (typeof s == "string" && (s = se(s)), typeof E == "string" && (E = te(E)), ((l = E) === null || l === void 0 ? void 0 : l.length) !== 16)
1158
1204
  throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
1159
1205
  let R = new Uint8Array(16 + s.length);
1160
- if (R.set(o), R.set(s, o.length), R = e(R), R[6] = R[6] & 15 | E, R[8] = R[8] & 63 | 128, l) {
1161
- A = A || 0;
1162
- for (let i = 0; i < 16; ++i)
1163
- l[A + i] = R[i];
1164
- return l;
1206
+ if (R.set(E), R.set(s, E.length), R = e(R), R[6] = R[6] & 15 | t, R[8] = R[8] & 63 | 128, a) {
1207
+ o = o || 0;
1208
+ for (let T = 0; T < 16; ++T)
1209
+ a[o + T] = R[T];
1210
+ return a;
1165
1211
  }
1166
- return Q(R);
1212
+ return Z(R);
1167
1213
  }
1168
1214
  try {
1169
- r.name = t;
1215
+ r.name = A;
1170
1216
  } catch {
1171
1217
  }
1172
- return r.DNS = j, r.URL = _, r;
1218
+ return r.DNS = Ee, r.URL = le, r;
1173
1219
  }
1174
- function z(t, E, e, r) {
1175
- switch (t) {
1220
+ function ae(A, t, e, r) {
1221
+ switch (A) {
1176
1222
  case 0:
1177
- return E & e ^ ~E & r;
1223
+ return t & e ^ ~t & r;
1178
1224
  case 1:
1179
- return E ^ e ^ r;
1225
+ return t ^ e ^ r;
1180
1226
  case 2:
1181
- return E & e ^ E & r ^ e & r;
1227
+ return t & e ^ t & r ^ e & r;
1182
1228
  case 3:
1183
- return E ^ e ^ r;
1229
+ return t ^ e ^ r;
1184
1230
  }
1185
1231
  }
1186
- function U(t, E) {
1187
- return t << E | t >>> 32 - E;
1232
+ function P(A, t) {
1233
+ return A << t | A >>> 32 - t;
1188
1234
  }
1189
- function q(t) {
1190
- const E = [1518500249, 1859775393, 2400959708, 3395469782], e = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
1191
- if (typeof t == "string") {
1192
- const l = unescape(encodeURIComponent(t));
1193
- t = [];
1194
- for (let A = 0; A < l.length; ++A)
1195
- t.push(l.charCodeAt(A));
1196
- } else Array.isArray(t) || (t = Array.prototype.slice.call(t));
1197
- t.push(128);
1198
- const r = t.length / 4 + 2, s = Math.ceil(r / 16), o = new Array(s);
1199
- for (let l = 0; l < s; ++l) {
1200
- const A = new Uint32Array(16);
1201
- for (let a = 0; a < 16; ++a)
1202
- A[a] = t[l * 64 + a * 4] << 24 | t[l * 64 + a * 4 + 1] << 16 | t[l * 64 + a * 4 + 2] << 8 | t[l * 64 + a * 4 + 3];
1203
- o[l] = A;
1235
+ function oe(A) {
1236
+ const t = [1518500249, 1859775393, 2400959708, 3395469782], e = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
1237
+ if (typeof A == "string") {
1238
+ const a = unescape(encodeURIComponent(A));
1239
+ A = [];
1240
+ for (let o = 0; o < a.length; ++o)
1241
+ A.push(a.charCodeAt(o));
1242
+ } else Array.isArray(A) || (A = Array.prototype.slice.call(A));
1243
+ A.push(128);
1244
+ const r = A.length / 4 + 2, s = Math.ceil(r / 16), E = new Array(s);
1245
+ for (let a = 0; a < s; ++a) {
1246
+ const o = new Uint32Array(16);
1247
+ for (let l = 0; l < 16; ++l)
1248
+ o[l] = A[a * 64 + l * 4] << 24 | A[a * 64 + l * 4 + 1] << 16 | A[a * 64 + l * 4 + 2] << 8 | A[a * 64 + l * 4 + 3];
1249
+ E[a] = o;
1204
1250
  }
1205
- o[s - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), o[s - 1][14] = Math.floor(o[s - 1][14]), o[s - 1][15] = (t.length - 1) * 8 & 4294967295;
1206
- for (let l = 0; l < s; ++l) {
1207
- const A = new Uint32Array(80);
1208
- for (let T = 0; T < 16; ++T)
1209
- A[T] = o[l][T];
1210
- for (let T = 16; T < 80; ++T)
1211
- A[T] = U(A[T - 3] ^ A[T - 8] ^ A[T - 14] ^ A[T - 16], 1);
1212
- let a = e[0], R = e[1], i = e[2], m = e[3], L = e[4];
1213
- for (let T = 0; T < 80; ++T) {
1214
- const D = Math.floor(T / 20), x = U(a, 5) + z(D, R, i, m) + L + E[D] + A[T] >>> 0;
1215
- L = m, m = i, i = U(R, 30) >>> 0, R = a, a = x;
1251
+ E[s - 1][14] = (A.length - 1) * 8 / Math.pow(2, 32), E[s - 1][14] = Math.floor(E[s - 1][14]), E[s - 1][15] = (A.length - 1) * 8 & 4294967295;
1252
+ for (let a = 0; a < s; ++a) {
1253
+ const o = new Uint32Array(80);
1254
+ for (let C = 0; C < 16; ++C)
1255
+ o[C] = E[a][C];
1256
+ for (let C = 16; C < 80; ++C)
1257
+ o[C] = P(o[C - 3] ^ o[C - 8] ^ o[C - 14] ^ o[C - 16], 1);
1258
+ let l = e[0], R = e[1], T = e[2], g = e[3], i = e[4];
1259
+ for (let C = 0; C < 80; ++C) {
1260
+ const f = Math.floor(C / 20), $ = P(l, 5) + ae(f, R, T, g) + i + t[f] + o[C] >>> 0;
1261
+ i = g, g = T, T = P(R, 30) >>> 0, R = l, l = $;
1216
1262
  }
1217
- e[0] = e[0] + a >>> 0, e[1] = e[1] + R >>> 0, e[2] = e[2] + i >>> 0, e[3] = e[3] + m >>> 0, e[4] = e[4] + L >>> 0;
1263
+ e[0] = e[0] + l >>> 0, e[1] = e[1] + R >>> 0, e[2] = e[2] + T >>> 0, e[3] = e[3] + g >>> 0, e[4] = e[4] + i >>> 0;
1218
1264
  }
1219
1265
  return [e[0] >> 24 & 255, e[0] >> 16 & 255, e[0] >> 8 & 255, e[0] & 255, e[1] >> 24 & 255, e[1] >> 16 & 255, e[1] >> 8 & 255, e[1] & 255, e[2] >> 24 & 255, e[2] >> 16 & 255, e[2] >> 8 & 255, e[2] & 255, e[3] >> 24 & 255, e[3] >> 16 & 255, e[3] >> 8 & 255, e[3] & 255, e[4] >> 24 & 255, e[4] >> 16 & 255, e[4] >> 8 & 255, e[4] & 255];
1220
1266
  }
1221
- const p = Z("v5", 80, q);
1222
- class Le extends M {
1267
+ const v = Ae("v5", 80, oe);
1268
+ class Pe extends K {
1223
1269
  constructor(e, r = "POST", s = {}) {
1224
1270
  super();
1225
- N(this, "apiUrl");
1226
- N(this, "method");
1227
- N(this, "headers");
1228
- N(this, "isLoadingEnabled", !0);
1229
- N(this, "errorResponse");
1271
+ O(this, "apiUrl");
1272
+ O(this, "method");
1273
+ O(this, "headers");
1274
+ O(this, "isLoadingEnabled", !0);
1275
+ O(this, "errorResponse");
1230
1276
  this.apiUrl = e, this.method = r, this.headers = {
1231
1277
  "Content-Type": "application/json",
1232
1278
  ...s
@@ -1239,37 +1285,37 @@ class Le extends M {
1239
1285
  this.errorResponse = e;
1240
1286
  }
1241
1287
  fetchData(e = {}) {
1242
- const r = (/* @__PURE__ */ new Date()).toISOString(), s = p(r, p.URL), o = this.encode({ ...e }, s);
1288
+ const r = (/* @__PURE__ */ new Date()).toISOString(), s = v(r, v.URL), E = this.encode({ ...e }, s);
1243
1289
  S.getInstance().setSubject(this.isLoadingEnabled);
1244
- const A = new URLSearchParams(window.location.search).get("flow") ?? "N/A";
1245
- return g(this.apiUrl, {
1290
+ const o = new URLSearchParams(window.location.search).get("flow") ?? "N/A";
1291
+ return L(this.apiUrl, {
1246
1292
  method: this.method,
1247
- headers: { ...this.headers, flow: A },
1248
- body: o,
1249
- selector: (a) => a.json()
1293
+ headers: { ...this.headers, flow: o },
1294
+ body: E,
1295
+ selector: (l) => l.json()
1250
1296
  }).pipe(
1251
- C((a) => O(this.decode(a))),
1252
- C((a) => a.code && (a.type === "modal" || a.type === "message") ? (this.logError(
1253
- `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${o} <RESPONSE>: ${JSON.stringify(a)}`
1254
- ), S.getInstance().setSubject(!1), P.getInstance().setSubject(a), this.errorResponse ? O(this.errorResponse) : c) : O(a)),
1255
- C((a) => (S.getInstance().setSubject(!1), this.logDebug(
1256
- `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${o} <RESPONSE>: ${JSON.stringify(a)}`
1257
- ), O(a))),
1258
- I((a) => (this.logError(
1259
- `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${o} <RESPONSE>: ${JSON.stringify(a)}`
1260
- ), S.getInstance().setSubject(!1), P.getInstance().setSubject(
1261
- new n().get(a, s)
1262
- ), this.errorResponse ? O(this.errorResponse) : c))
1297
+ N((l) => n(this.decode(l))),
1298
+ N((l) => l.code && (l.type === "modal" || l.type === "message") ? (this.logError(
1299
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${E} <RESPONSE>: ${JSON.stringify(l)}`
1300
+ ), S.getInstance().setSubject(!1), x.getInstance().setSubject(l), this.errorResponse ? n(this.errorResponse) : h) : n(l)),
1301
+ N((l) => (S.getInstance().setSubject(!1), this.logDebug(
1302
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${E} <RESPONSE>: ${JSON.stringify(l)}`
1303
+ ), n(l))),
1304
+ U((l) => (this.logError(
1305
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${E} <RESPONSE>: ${JSON.stringify(l)}`
1306
+ ), S.getInstance().setSubject(!1), x.getInstance().setSubject(
1307
+ I.getInstance().get(l, s)
1308
+ ), this.errorResponse ? n(this.errorResponse) : h))
1263
1309
  );
1264
1310
  }
1265
1311
  }
1266
- const ee = process.env.ID_FRONT ?? "NOT_AVAILABLE";
1267
- class ne extends y {
1312
+ const ie = process.env.ID_FRONT ?? "NOT_AVAILABLE";
1313
+ class Be extends V {
1268
1314
  constructor(e, r, s = {}) {
1269
1315
  super(s);
1270
- N(this, "apiUrl");
1271
- N(this, "method");
1272
- N(this, "errorCatalog", new n());
1316
+ O(this, "apiUrl");
1317
+ O(this, "method");
1318
+ O(this, "errorCatalog", new d());
1273
1319
  this.apiUrl = e, this.method = r ?? "POST";
1274
1320
  }
1275
1321
  errorHandler(e, r) {
@@ -1280,86 +1326,251 @@ class ne extends y {
1280
1326
  formatParams(e) {
1281
1327
  return JSON.stringify({
1282
1328
  data: {
1283
- type: ee,
1329
+ type: ie,
1284
1330
  attributes: e
1285
1331
  }
1286
1332
  });
1287
1333
  }
1288
1334
  fetchData(e = {}, r) {
1289
- const { resources: s, errors: o } = this.onInit();
1290
- return this.errorCatalog.setErrors(o), this.errorCatalog.setI18nResources(s), this.getHeaders().pipe(
1291
- C(
1292
- (l) => g(
1335
+ const { resources: s, errors: E } = this.onInit();
1336
+ return this.errorCatalog.setErrors(E), this.errorCatalog.setI18nResources(s), this.getHeaders().pipe(
1337
+ N(
1338
+ (a) => L(
1293
1339
  this.apiUrl,
1294
1340
  {
1295
1341
  method: "POST",
1296
- headers: l,
1342
+ headers: a,
1297
1343
  body: this.formatParams(e),
1298
- selector: (A) => A.json()
1344
+ selector: (o) => o.json()
1299
1345
  }
1300
1346
  ).pipe(
1301
- I((A) => {
1302
- throw this.logError(JSON.stringify(A)), this.logError(
1347
+ U((o) => {
1348
+ throw this.logError(JSON.stringify(o)), this.logError(
1303
1349
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1304
- l
1350
+ a
1305
1351
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1306
1352
  this.formatParams(e)
1307
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(A)} \x1B[33m`
1308
- ), new n().get("default", r);
1353
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
1354
+ ), new d().get("default", r);
1309
1355
  }),
1310
- C((A) => (this.logDebug(
1356
+ N((o) => (this.logDebug(
1311
1357
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1312
- l
1358
+ a
1313
1359
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1314
1360
  this.formatParams(e)
1315
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(A)} \x1B[33m`
1316
- ), O(A)))
1361
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
1362
+ ), n(o)))
1317
1363
  )
1318
1364
  ),
1319
- u((l) => this.errorHandler(l, r))
1365
+ G((a) => this.errorHandler(a, r))
1320
1366
  );
1321
1367
  }
1322
1368
  fetchCustomData(e = {}, r, s) {
1323
- const { resources: o, errors: l } = this.onInit();
1324
- this.errorCatalog.setErrors(l), this.errorCatalog.setI18nResources(o);
1325
- const A = {
1369
+ const { resources: E, errors: a } = this.onInit();
1370
+ this.errorCatalog.setErrors(a), this.errorCatalog.setI18nResources(E);
1371
+ const o = {
1326
1372
  "Content-Type": "application/json"
1327
- }, a = h.stringify(
1373
+ }, l = J.stringify(
1328
1374
  e
1329
- ), R = `${this.apiUrl}?${a}`, i = this.method === "GET" ? R : this.apiUrl;
1330
- return this.getHeaders(A, s).pipe(
1331
- C(
1332
- (m) => g(i, {
1375
+ ), R = `${this.apiUrl}?${l}`, T = this.method === "GET" ? R : this.apiUrl;
1376
+ return this.getHeaders(o, s).pipe(
1377
+ N(
1378
+ (g) => L(T, {
1333
1379
  method: this.method,
1334
- headers: m,
1380
+ headers: g,
1335
1381
  body: this.method === "GET" ? null : JSON.stringify(e),
1336
- selector: (L) => L.json()
1382
+ selector: (i) => i.json()
1337
1383
  }).pipe(
1338
- I((L) => {
1339
- throw this.logError(JSON.stringify(L)), this.logError(
1340
- `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${i} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1341
- m
1384
+ U((i) => {
1385
+ throw this.logError(JSON.stringify(i)), this.logError(
1386
+ `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${T} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1387
+ g
1342
1388
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1343
1389
  this.formatParams(e)
1344
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(L)} \x1B[33m`
1345
- ), new n().get("default", r);
1390
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(i)} \x1B[33m`
1391
+ ), new d().get("default", r);
1346
1392
  }),
1347
- C((L) => (this.logDebug(
1348
- `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${i} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1349
- m
1393
+ N((i) => (this.logDebug(
1394
+ `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${T} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1395
+ g
1350
1396
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1351
1397
  e
1352
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(L)} \x1B[33m`
1353
- ), O(L)))
1398
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(i)} \x1B[33m`
1399
+ ), n(i)))
1354
1400
  )
1355
1401
  )
1356
1402
  );
1357
1403
  }
1358
1404
  }
1405
+ const B = {
1406
+ client_id: process.env.AZURE_AD_CLIENT_ID,
1407
+ client_secret: process.env.AZURE_AD_CLIENT_SECRET,
1408
+ resource: process.env.AZURE_AD_CLIENT_RESOURCE,
1409
+ grant_type: process.env.AZURE_AD_CLIENT_GRANT_TYPE
1410
+ }, w = process.env.AZURE_AD_GRAPH_URL_TOKEN, F = process.env.AZURE_AD_TENANT_ID;
1411
+ class Re extends u {
1412
+ getHeaders() {
1413
+ const t = Object.keys(B).some((r) => c.isEmpty(B[r]));
1414
+ if (c.isEmpty(w) || c.isEmpty(F))
1415
+ throw this.logError(
1416
+ "AZURE_AD_GRAPH_URL_TOKEN or AZURE_AD_TENANT_ID are empty or missing"
1417
+ ), new Error(
1418
+ "AZURE_AD_GRAPH_URL_TOKEN or AZURE_AD_TENANT_ID are empty or missing"
1419
+ );
1420
+ if (t)
1421
+ throw this.logError(
1422
+ "Some variables are empty or missing, check AZURE_AD_CLIENT_ID, AZURE_AD_CLIENT_SECRET, AZURE_AD_CLIENT_RESOURCE, AZURE_AD_CLIENT_GRANT_TYPE"
1423
+ ), new Error("some variables are empty or missing");
1424
+ const e = w.replace(
1425
+ "AZURE_AD_TENANT_ID",
1426
+ F
1427
+ );
1428
+ return L(e, {
1429
+ method: "POST",
1430
+ headers: {
1431
+ Accept: "application/json",
1432
+ "Content-Type": "application/x-www-form-urlencoded"
1433
+ },
1434
+ body: new URLSearchParams(B),
1435
+ selector: (r) => r.json()
1436
+ }).pipe(
1437
+ N((r) => (this.logDebug(
1438
+ "response from API new_url_365_graph_token",
1439
+ JSON.stringify(r)
1440
+ ), n({
1441
+ headers: {
1442
+ Authorization: `Bearer ${r == null ? void 0 : r.access_token}`,
1443
+ responseType: "json"
1444
+ }
1445
+ })))
1446
+ );
1447
+ }
1448
+ }
1449
+ const _ = process.env.AZURE_AD_GRAPH_GET_APP_ROLES, M = process.env.AZURE_AD_GRAPH_GET_USER_BY_EMAIL, Q = process.env.AZURE_AD_GRAPH_GROUPS;
1450
+ class pe extends Re {
1451
+ getAppRoles(t) {
1452
+ if (c.isEmpty(_))
1453
+ throw this.logError("AZURE_AD_GRAPH_GET_APP_ROLES URL is empty or missing"), new Error("AZURE_AD_GRAPH_GET_APP_ROLES URL is empty or missing");
1454
+ const e = _.replace(
1455
+ "{id-obj}",
1456
+ `${t}`
1457
+ );
1458
+ return this.getHeaders().pipe(
1459
+ N(
1460
+ (r) => L(e, {
1461
+ method: "GET",
1462
+ headers: r == null ? void 0 : r.headers,
1463
+ selector: (s) => s.json()
1464
+ }).pipe(N((s) => n({ roles: s == null ? void 0 : s.value })))
1465
+ )
1466
+ );
1467
+ }
1468
+ getAppRoleAssignments(t) {
1469
+ if (c.isEmpty(M))
1470
+ throw this.logError("AZURE_AD_GRAPH_GET_USER_BY_EMAIL URL is empty or missing"), new Error(
1471
+ "AZURE_AD_GRAPH_GET_USER_BY_EMAIL URL is empty or missing"
1472
+ );
1473
+ const r = `${M.replace(
1474
+ "{user-mail}",
1475
+ `${t}/appRoleAssignments`
1476
+ )}?$select=appRoleId,resourceDisplayName`;
1477
+ return this.getHeaders().pipe(
1478
+ N(
1479
+ (s) => L(r, {
1480
+ method: "GET",
1481
+ headers: s == null ? void 0 : s.headers,
1482
+ selector: (E) => E.json()
1483
+ })
1484
+ )
1485
+ );
1486
+ }
1487
+ userRolesByApp(t, e) {
1488
+ return p({
1489
+ appRoles: this.getAppRoles(e),
1490
+ appRoleAssignments: this.getAppRoleAssignments(t)
1491
+ }).pipe(
1492
+ N(({ appRoles: r, appRoleAssignments: s }) => {
1493
+ var o;
1494
+ const E = (o = s == null ? void 0 : s.value) == null ? void 0 : o.map(
1495
+ (l) => {
1496
+ var R, T, g;
1497
+ return (g = (T = (R = r == null ? void 0 : r.roles) == null ? void 0 : R.filter((i) => (i == null ? void 0 : i.id) === (l == null ? void 0 : l.appRoleId))) == null ? void 0 : T.filter((i) => i == null ? void 0 : i.isEnabled)) == null ? void 0 : g.map((i) => ({
1498
+ appRoleId: l == null ? void 0 : l.appRoleId,
1499
+ displayName: i == null ? void 0 : i.displayName,
1500
+ value: i == null ? void 0 : i.value
1501
+ }));
1502
+ }
1503
+ ).flat(), a = E == null ? void 0 : E.map((l) => l == null ? void 0 : l.appRoleId);
1504
+ return n({ roles: a });
1505
+ })
1506
+ );
1507
+ }
1508
+ getRolesFromApi(t, e) {
1509
+ return this.userRolesByApp(t, e).pipe(
1510
+ N((r) => n(r))
1511
+ );
1512
+ }
1513
+ getRoles(t, e) {
1514
+ return this.getRolesFromApi(t, e);
1515
+ }
1516
+ getGroupsFromApi(t) {
1517
+ if (this.logDebug("getGroupsFromApi by email: ", JSON.stringify(t)), c.isEmpty(Q))
1518
+ throw this.logError("AZURE_AD_GRAPH_GROUPS URL is empty or missing"), new Error("AZURE_AD_GRAPH_GROUPS URL is empty or missing");
1519
+ const e = `${Q.replace("idUser", t)}?$select=id,description,displayName`;
1520
+ return this.logDebug("URL base: ", e), this.getHeaders().pipe(
1521
+ N(
1522
+ (r) => L(e, {
1523
+ method: "GET",
1524
+ headers: r == null ? void 0 : r.headers,
1525
+ selector: (s) => s.json()
1526
+ }).pipe(
1527
+ N((s) => (this.logDebug("response from API: ", JSON.stringify(s)), n(s)))
1528
+ )
1529
+ )
1530
+ );
1531
+ }
1532
+ getUserGroups(t) {
1533
+ return this.getGroupsFromApi(t);
1534
+ }
1535
+ /**
1536
+ *
1537
+ * @param email correo del usuario
1538
+ * @param idGroup id del grupo de EntraID
1539
+ * @returns `true` si el usuario pertenece al grupo
1540
+ */
1541
+ inGroup(t, e) {
1542
+ return this.logDebug("Check inGroup params: ", JSON.stringify({ email: t, idGroup: e })), c.isEmpty(t) || c.isEmpty(e) ? (this.logError("inGroup method error"), this.logError("email or idGroup are empty or missing"), n(!1)) : this.getUserGroups(t).pipe(
1543
+ N((r) => {
1544
+ var s;
1545
+ return n((s = r == null ? void 0 : r.value) == null ? void 0 : s.some((E) => (E == null ? void 0 : E.id) === e));
1546
+ })
1547
+ );
1548
+ }
1549
+ /**
1550
+ *
1551
+ * @param email correo del usuario
1552
+ * @param idRole id del rol del aplicativo de EntraID
1553
+ * @param idObjApp id del objeto de la aplicacion `Identificador de objeto` en EntraID
1554
+ * @returns `true` si el usuario tiene asignado el rol
1555
+ */
1556
+ inRole(t, e, r) {
1557
+ return this.logDebug(
1558
+ "Check inRole params: ",
1559
+ JSON.stringify({ email: t, idRole: e, idObjApp: r })
1560
+ ), c.isEmpty(t) || c.isEmpty(e) || c.isEmpty(r) ? (this.logError("inRole method error"), this.logError("email or idRole or idObjApp are empty or missing"), n(!1)) : this.getRoles(t, r).pipe(
1561
+ N((s) => {
1562
+ var E;
1563
+ return n((E = s == null ? void 0 : s.roles) == null ? void 0 : E.includes(e));
1564
+ })
1565
+ );
1566
+ }
1567
+ }
1359
1568
  export {
1360
- Oe as A,
1361
- n as E,
1362
- Ce as F,
1363
- Le as a,
1364
- ne as b
1569
+ De as A,
1570
+ d as E,
1571
+ de as F,
1572
+ I as a,
1573
+ Pe as b,
1574
+ Be as c,
1575
+ pe as d
1365
1576
  };