@mp-front/common 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/adapters/index.d.ts +2 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/redis-adapter.d.ts +15 -0
- package/dist/adapters/redis-adapter.d.ts.map +1 -0
- package/dist/auth/authorization-service.d.ts +11 -0
- package/dist/auth/authorization-service.d.ts.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/authorization-service-DE-hoYji.js +48 -0
- package/dist/authorization-service-DkLS18Us.cjs +1 -0
- package/dist/cache/index.d.ts +3 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/session-handler/constants/index.d.ts +6 -0
- package/dist/cache/session-handler/constants/index.d.ts.map +1 -0
- package/dist/cache/session-handler/index.d.ts +2 -0
- package/dist/cache/session-handler/index.d.ts.map +1 -0
- package/dist/cache/session-handler/session-cache.d.ts +52 -0
- package/dist/cache/session-handler/session-cache.d.ts.map +1 -0
- package/dist/cache/session-handler/types/index.d.ts +37 -0
- package/dist/cache/session-handler/types/index.d.ts.map +1 -0
- package/dist/cache/terminal-handler/constants/environments.d.ts +3 -0
- package/dist/cache/terminal-handler/constants/environments.d.ts.map +1 -0
- package/dist/cache/terminal-handler/constants/identifier.d.ts +3 -0
- package/dist/cache/terminal-handler/constants/identifier.d.ts.map +1 -0
- package/dist/cache/terminal-handler/constants/index.d.ts +3 -0
- package/dist/cache/terminal-handler/constants/index.d.ts.map +1 -0
- package/dist/cache/terminal-handler/index.d.ts +2 -0
- package/dist/cache/terminal-handler/index.d.ts.map +1 -0
- package/dist/cache/terminal-handler/terminal.d.ts +11 -0
- package/dist/cache/terminal-handler/terminal.d.ts.map +1 -0
- package/dist/cache/terminal-handler/types/index.d.ts +2 -0
- package/dist/cache/terminal-handler/types/index.d.ts.map +1 -0
- package/dist/cache/terminal-handler/types/terminal.d.ts +7 -0
- package/dist/cache/terminal-handler/types/terminal.d.ts.map +1 -0
- package/dist/cache-providers/index.d.ts +2 -0
- package/dist/cache-providers/index.d.ts.map +1 -0
- package/dist/cache-providers/redis/index.d.ts +2 -0
- package/dist/cache-providers/redis/index.d.ts.map +1 -0
- package/dist/cache-providers/redis/ioredis-instance.d.ts +3 -0
- package/dist/cache-providers/redis/ioredis-instance.d.ts.map +1 -0
- package/dist/cache-providers/redis/redis-cache.d.ts +23 -0
- package/dist/cache-providers/redis/redis-cache.d.ts.map +1 -0
- package/dist/cache-providers/redis/types/index.d.ts +37 -0
- package/dist/cache-providers/redis/types/index.d.ts.map +1 -0
- package/dist/client-Btua9wfS.js +230 -0
- package/dist/client-Bv9OflsW.cjs +1 -0
- package/dist/default-errors-DiEIEEE2.cjs +1 -0
- package/dist/default-errors-DsKmUZbG.js +59 -0
- package/dist/encoder-BEp9qfLf.cjs +1 -0
- package/dist/encoder-CXAlLf5T.js +39 -0
- package/dist/encrypter-CgZLhLnj.cjs +1 -0
- package/dist/encrypter-ZTjrp3uD.js +54 -0
- package/dist/engine/auth-engine.d.ts +29 -0
- package/dist/engine/auth-engine.d.ts.map +1 -0
- package/dist/engine/entra-id.d.ts +12 -0
- package/dist/engine/entra-id.d.ts.map +1 -0
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/types/index.d.ts +51 -0
- package/dist/engine/types/index.d.ts.map +1 -0
- package/dist/errors/default-errors.d.ts +31 -0
- package/dist/errors/default-errors.d.ts.map +1 -0
- package/dist/errors/error-handler.d.ts +8 -0
- package/dist/errors/error-handler.d.ts.map +1 -0
- package/dist/errors/i18n.d.ts +30 -0
- package/dist/errors/i18n.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/runtime-error-code.d.ts +16 -0
- package/dist/errors/runtime-error-code.d.ts.map +1 -0
- package/dist/errors/runtime-error.d.ts +6 -0
- package/dist/errors/runtime-error.d.ts.map +1 -0
- package/dist/fetch-BZP9DZLg.cjs +3 -0
- package/dist/fetch-CUIb9XhZ.js +761 -0
- package/dist/helpers/encoder.d.ts +8 -0
- package/dist/helpers/encoder.d.ts.map +1 -0
- package/dist/helpers/encrypter.d.ts +10 -0
- package/dist/helpers/encrypter.d.ts.map +1 -0
- package/dist/helpers/escape-unicode.d.ts +2 -0
- package/dist/helpers/escape-unicode.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/logger.d.ts +16 -0
- package/dist/helpers/logger.d.ts.map +1 -0
- package/dist/http/backend.d.ts +18 -0
- package/dist/http/backend.d.ts.map +1 -0
- package/dist/http/client.d.ts +20 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/http/headers.d.ts +9 -0
- package/dist/http/headers.d.ts.map +1 -0
- package/dist/http/index.d.ts +4 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/types/http-options.d.ts +13 -0
- package/dist/http/types/http-options.d.ts.map +1 -0
- package/dist/http/types/index.d.ts +5 -0
- package/dist/http/types/index.d.ts.map +1 -0
- package/dist/http/types/method.d.ts +2 -0
- package/dist/http/types/method.d.ts.map +1 -0
- package/dist/http/types/request-config.d.ts +10 -0
- package/dist/http/types/request-config.d.ts.map +1 -0
- package/dist/http/types/response.d.ts +39 -0
- package/dist/http/types/response.d.ts.map +1 -0
- package/dist/i18n-CEBemBIX.js +31 -0
- package/dist/i18n-vIm9wuAG.cjs +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/ioredis-instance-BaXfqmqC.js +11 -0
- package/dist/ioredis-instance-PenLE7vi.cjs +1 -0
- package/dist/loading-handler-BrN0O37N.cjs +1 -0
- package/dist/loading-handler-ivYFmS_V.js +17 -0
- package/dist/lodash-DNCgFYS7.cjs +27 -0
- package/dist/lodash-QjAkD17S.js +3677 -0
- package/dist/logger-BMbeDoGU.cjs +1 -0
- package/dist/logger-DtlFWyFO.js +60 -0
- package/dist/middleware/api-middleware.d.ts +22 -0
- package/dist/middleware/api-middleware.d.ts.map +1 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/types/index.d.ts +2 -0
- package/dist/middleware/types/index.d.ts.map +1 -0
- package/dist/mp-front-common-adapters.cjs +1 -0
- package/dist/mp-front-common-adapters.js +169 -0
- package/dist/mp-front-common-all.cjs +1 -0
- package/dist/mp-front-common-all.js +126 -0
- package/dist/mp-front-common-auth.cjs +1 -0
- package/dist/mp-front-common-auth.js +4 -0
- package/dist/mp-front-common-cache.cjs +1 -0
- package/dist/mp-front-common-cache.js +132 -0
- package/dist/mp-front-common-cacheProviders.cjs +1 -0
- package/dist/mp-front-common-cacheProviders.js +4 -0
- package/dist/mp-front-common-engine.cjs +1 -0
- package/dist/mp-front-common-engine.js +185 -0
- package/dist/mp-front-common-errors.cjs +1 -0
- package/dist/mp-front-common-errors.js +9 -0
- package/dist/mp-front-common-helpers.cjs +1 -0
- package/dist/mp-front-common-helpers.js +9 -0
- package/dist/mp-front-common-http.cjs +1 -0
- package/dist/mp-front-common-http.js +6 -0
- package/dist/mp-front-common-rxjs.cjs +1 -0
- package/dist/mp-front-common-rxjs.js +4 -0
- package/dist/redis-cache-BoKAFYQi.js +83 -0
- package/dist/redis-cache-DjKTqllz.cjs +1 -0
- package/dist/rx-subject-manager-ZC9CWBWH.cjs +1 -0
- package/dist/rx-subject-manager-_4urHn8A.js +24 -0
- package/dist/rxjs/index.d.ts +2 -0
- package/dist/rxjs/index.d.ts.map +1 -0
- package/dist/rxjs/loading-handler.d.ts +7 -0
- package/dist/rxjs/loading-handler.d.ts.map +1 -0
- package/dist/rxjs/rx-subject-manager.d.ts +9 -0
- package/dist/rxjs/rx-subject-manager.d.ts.map +1 -0
- package/dist/stringify-93tp0umt.js +9 -0
- package/dist/stringify-BN6t_WDt.cjs +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/v5-BTqP79vV.cjs +1 -0
- package/dist/v5-Cu1sjPlx.js +91 -0
- package/package.json +107 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var w=Object.defineProperty;var N=(c,e,t)=>e in c?w(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;var o=(c,e,t)=>N(c,typeof e!="symbol"?e+"":e,t);const i=require("rxjs"),S=require("./logger-BMbeDoGU.cjs");require("./lodash-DNCgFYS7.cjs");require("node-jose");require("crypto");const l=require("./default-errors-DiEIEEE2.cjs"),R=require("./fetch-BZP9DZLg.cjs"),D=require("./authorization-service-DkLS18Us.cjs"),x=require("./encoder-BEp9qfLf.cjs"),p=require("./loading-handler-BrN0O37N.cjs"),B=require("./v5-BTqP79vV.cjs");class O{constructor(e={}){o(this,"logger",new S.Logger);o(this,"headers");this.headers={Accept:"application/json","Content-Type":"application/vnd.api+json",...e}}addTokenBackend(e){return this.logger.logDebug("addTokenBackend HttpHeaders",JSON.stringify(e)),new D.AuthorizationService().get().pipe(i.switchMap(t=>i.of({...e,Authorization:`Bearer ${t}`})))}get(e){this.logger.logDebug("get HttpHeaders");const t=i.of({...this.headers});return e?t.pipe(i.switchMap(s=>this.addTokenBackend(s))):t}}const L=process.env.ID_FRONT??"NOT_AVAILABLE";class ${constructor(){o(this,"httpHeaders",new O);o(this,"logger",new S.Logger)}errorCatcher(e,t){var s,r,n;if(e!=null&&e.errors)throw new l.RuntimeError(((n=(r=(s=e.errors).at)==null?void 0:r.call(s,0))==null?void 0:n.code)??l.RuntimeErrorCode.DEFAULT,t??"");return!(e!=null&&e.errors)}get(e,t={}){const s=this.buildRequest("GET",e,null,t);return this.request(s)}post(e,t,s={}){const r=this.buildRequest("POST",e,t,s);return this.request(r)}put(e,t,s={}){const r=this.buildRequest("PUT",e,t,s);return this.request(r)}delete(e,t={}){const s=this.buildRequest("DELETE",e,null,t);return this.request(s)}formatParams(e,t){return JSON.stringify(t==="JSON:API"?{data:{type:L,attributes:e}}:e)}buildRequest(e,t,s,r){const n=r.format??"JSON:API",a={requestID:r==null?void 0:r.requestID,withCredentials:(r==null?void 0:r.withCredentials)??!0,url:t,headers:r.headers,method:e,selector:u=>u.json()};if(e==="GET"){const u=new URL(t);if(r.params)for(const m of Object.keys(r.params))u.searchParams.append(m,`${r.params[m]}`);return{...a,url:u.toString()}}return{...a,body:this.formatParams(s,n)}}request({url:e,requestID:t,withCredentials:s=!1,...r}){return this.httpHeaders.get(s).pipe(i.switchMap(n=>R.fromFetch(e,{...r,headers:{...r.headers,...n}}).pipe(i.catchError(a=>{throw this.logger.logError(JSON.stringify(a)),this.logger.logError(`HttpBackend \x1B[37m <URL>: \x1B[33m ${e} \x1B[37m <RequestID>: \x1B[33m ${t} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(n)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(this.formatParams(r.body,r.format))} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)} \x1B[33m`),new l.RuntimeError(l.RuntimeErrorCode.DEFAULT,t)}),i.switchMap(a=>(this.logger.logDebug(`HttpBackend \x1B[37m <URL>: \x1B[33m ${e} \x1B[37m <RequestID>: \x1B[33m ${t} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(n)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(this.formatParams(r.body,r.format))} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)} \x1B[33m`),i.of(a))))),i.filter(n=>this.errorCatcher(n,t)))}}class J{constructor(){o(this,"httpHeaders",new O);o(this,"logger",new S.Logger);o(this,"encoder",new x.Encoder);o(this,"isLoadingEnabled",!0)}setIsLoadingEnabled(e){this.isLoadingEnabled=e}get(e,t={}){const s=this.buildRequest("GET",e,null,t);return this.request(s)}post(e,t,s={}){const r=this.buildRequest("POST",e,t,s);return this.request(r)}put(e,t,s={}){const r=this.buildRequest("PUT",e,t,s);return this.request(r)}patch(e,t,s={}){const r=this.buildRequest("PATCH",e,t,s);return this.request(r)}delete(e,t={}){const s=this.buildRequest("DELETE",e,null,t);return this.request(s)}buildRequest(e,t,s,r){const n={url:t,headers:r.headers,method:e,selector:h=>h.json()},a=new Date().toISOString(),u=B.v5(a,B.v5.URL);if(e==="GET"){const h=new URL(t,location.origin),f=r.params??{},b=Object.entries(f).reduce((d,H)=>{const[g,T]=H;if(d[g]=`${T}`,Object.hasOwn(f,g)){const E=f[g];E!=null&&(d[g]=E)}return d},{}),y=this.encoder.encode(b,u),q=JSON.parse(y);for(const d of Object.keys(q))h.searchParams.append(d,`${q[d]}`);return{...n,url:h.toString()}}return new Headers(r.headers).get("Content-Type")==="multipart/form-data"?(s.append("requestID",u),{...n,body:s}):{...n,body:this.encoder.encode(s??{},u)}}request({url:e,...t}){return p.LoadingHandler.getInstance().setSubject(this.isLoadingEnabled),this.httpHeaders.get(!1).pipe(i.switchMap(s=>{const r={...s,...t.headers};return"Content-Type"in r&&r["Content-Type"]==="multipart/form-data"&&delete r["Content-Type"],R.fromFetch(e,{...t,headers:r}).pipe(i.switchMap(n=>i.of(this.encoder.decode(n))),i.switchMap(n=>{if("code"in n)throw n;return p.LoadingHandler.getInstance().setSubject(!1),this.logger.logDebug(`HttpClient <URL>: ${e} <HEADERS>: ${JSON.stringify(t.headers)} <BODY> ${JSON.stringify(t.body)} <RESPONSE>: ${JSON.stringify(n)}`),i.of(n)}),i.catchError(n=>(this.logger.logError(`HttpClient <URL>: ${e} <HEADERS>: ${JSON.stringify(t.headers)} <BODY> ${JSON.stringify(t.body)} <ERROR>: ${JSON.stringify(n)}`),p.LoadingHandler.getInstance().setSubject(!1),l.ErrorHandler.getInstance().setSubject(n),i.EMPTY)))}))}}exports.HttpBackend=$;exports.HttpClient=J;exports.HttpHeaders=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var N=Object.defineProperty;var n=(R,e,s)=>e in R?N(R,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):R[e]=s;var O=(R,e,s)=>n(R,typeof e!="symbol"?e+"":e,s);const T=require("./rx-subject-manager-ZC9CWBWH.cjs"),t=class t extends T.RxSubjectManager{constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}};O(t,"instance");let r=t;class l extends Error{constructor(s,a=""){super(`Runtime error with code: ${s}`);O(this,"code");O(this,"requestID");this.code=s,this.requestID=a}}var E=(R=>(R.DEFAULT="default",R.GENERAL_ERROR="ERR-GENERAL-01",R.INTERNAL_ERROR="internalError",R.UNAUTHORIZED="UNAUTHORIZED",R.UNKNOWN_ERROR="UNKNOWN_ERROR",R.NETWORK_ERROR="NETWORK_ERROR",R.TIMEOUT_ERROR="TIMEOUT_ERROR",R.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",R.AUTHORIZATION_ERROR="AUTHORIZATION_ERROR",R.VALIDATION_ERROR="VALIDATION_ERROR",R.NOT_FOUND_ERROR="NOT_FOUND_ERROR",R.CONFLICT_ERROR="CONFLICT_ERROR",R.SERVER_ERROR="SERVER_ERROR",R))(E||{});const c={[E.UNAUTHORIZED]:{level:"warning",type:"modal",message:"errors.UnAuthorized.message",title:"errors.UnAuthorized.title",code:310},[E.GENERAL_ERROR]:{level:"warning",type:"modal",message:"errors.ERR-GENERAL-01.message",title:"errors.ERR-GENERAL-01.title",code:400},[E.INTERNAL_ERROR]:{level:"warning",type:"modal",message:"errors.internalError.message",title:"errors.internalError.title",code:420},[E.DEFAULT]:{code:420,type:"modal",message:"errors.default.message",title:"errors.default.title",level:"warning"}};exports.ErrorHandler=r;exports.RuntimeError=l;exports.RuntimeErrorCode=E;exports.commonErrors=c;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var r = (R, e, s) => e in R ? T(R, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : R[e] = s;
|
|
3
|
+
var O = (R, e, s) => r(R, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { R as l } from "./rx-subject-manager-_4urHn8A.js";
|
|
5
|
+
const t = class t extends l {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
static getInstance() {
|
|
10
|
+
return t.instance || (t.instance = new t()), t.instance;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
O(t, "instance");
|
|
14
|
+
let a = t;
|
|
15
|
+
class I extends Error {
|
|
16
|
+
constructor(s, N = "") {
|
|
17
|
+
super(`Runtime error with code: ${s}`);
|
|
18
|
+
O(this, "code");
|
|
19
|
+
O(this, "requestID");
|
|
20
|
+
this.code = s, this.requestID = N;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
var E = /* @__PURE__ */ ((R) => (R.DEFAULT = "default", R.GENERAL_ERROR = "ERR-GENERAL-01", R.INTERNAL_ERROR = "internalError", R.UNAUTHORIZED = "UNAUTHORIZED", R.UNKNOWN_ERROR = "UNKNOWN_ERROR", R.NETWORK_ERROR = "NETWORK_ERROR", R.TIMEOUT_ERROR = "TIMEOUT_ERROR", R.AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR", R.AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR", R.VALIDATION_ERROR = "VALIDATION_ERROR", R.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", R.CONFLICT_ERROR = "CONFLICT_ERROR", R.SERVER_ERROR = "SERVER_ERROR", R))(E || {});
|
|
24
|
+
const c = {
|
|
25
|
+
[E.UNAUTHORIZED]: {
|
|
26
|
+
level: "warning",
|
|
27
|
+
type: "modal",
|
|
28
|
+
message: "errors.UnAuthorized.message",
|
|
29
|
+
title: "errors.UnAuthorized.title",
|
|
30
|
+
code: 310
|
|
31
|
+
},
|
|
32
|
+
[E.GENERAL_ERROR]: {
|
|
33
|
+
level: "warning",
|
|
34
|
+
type: "modal",
|
|
35
|
+
message: "errors.ERR-GENERAL-01.message",
|
|
36
|
+
title: "errors.ERR-GENERAL-01.title",
|
|
37
|
+
code: 400
|
|
38
|
+
},
|
|
39
|
+
[E.INTERNAL_ERROR]: {
|
|
40
|
+
level: "warning",
|
|
41
|
+
type: "modal",
|
|
42
|
+
message: "errors.internalError.message",
|
|
43
|
+
title: "errors.internalError.title",
|
|
44
|
+
code: 420
|
|
45
|
+
},
|
|
46
|
+
[E.DEFAULT]: {
|
|
47
|
+
code: 420,
|
|
48
|
+
type: "modal",
|
|
49
|
+
message: "errors.default.message",
|
|
50
|
+
title: "errors.default.title",
|
|
51
|
+
level: "warning"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
a as E,
|
|
56
|
+
I as R,
|
|
57
|
+
E as a,
|
|
58
|
+
c
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=(o,r,e)=>r in o?i(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e;var n=(o,r,e)=>c(o,typeof r!="symbol"?r+"":r,e);const g=require("./lodash-DNCgFYS7.cjs"),f=require("./logger-BMbeDoGU.cjs");require("node-jose");require("crypto");class l{constructor(){n(this,"logger",new f.Logger)}encode(r,e){try{this.logger.logDebug("encode Encoder",JSON.stringify(r));const s=JSON.stringify(r),t=Buffer.from(s).toString("base64");return JSON.stringify({info:t,requestID:e})}catch{return this.logger.logDebug("error convert to base64"),JSON.stringify({info:r,requestID:e})}}decode(r){try{g.lodashExports.isString(r)&&(r=JSON.parse(r));const{info:e}=r;this.logger.logDebug("decode Encoder",JSON.stringify(e));const s=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;if(g.lodashExports.isString(e)&&s.test(e)){const t=Buffer.from(e,"base64").toString();return JSON.parse(t)}}catch{this.logger.logError("error convert to base64")}return r}}exports.Encoder=l;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var c = (e, r, o) => r in e ? i(e, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[r] = o;
|
|
3
|
+
var s = (e, r, o) => c(e, typeof r != "symbol" ? r + "" : r, o);
|
|
4
|
+
import { l as g } from "./lodash-QjAkD17S.js";
|
|
5
|
+
import { L as f } from "./logger-DtlFWyFO.js";
|
|
6
|
+
import "node-jose";
|
|
7
|
+
import "crypto";
|
|
8
|
+
class b {
|
|
9
|
+
constructor() {
|
|
10
|
+
s(this, "logger", new f());
|
|
11
|
+
}
|
|
12
|
+
encode(r, o) {
|
|
13
|
+
try {
|
|
14
|
+
this.logger.logDebug("encode Encoder", JSON.stringify(r));
|
|
15
|
+
const t = JSON.stringify(r), n = Buffer.from(t).toString("base64");
|
|
16
|
+
return JSON.stringify({ info: n, requestID: o });
|
|
17
|
+
} catch {
|
|
18
|
+
return this.logger.logDebug("error convert to base64"), JSON.stringify({ info: r, requestID: o });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
decode(r) {
|
|
22
|
+
try {
|
|
23
|
+
g.isString(r) && (r = JSON.parse(r));
|
|
24
|
+
const { info: o } = r;
|
|
25
|
+
this.logger.logDebug("decode Encoder", JSON.stringify(o));
|
|
26
|
+
const t = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
27
|
+
if (g.isString(o) && t.test(o)) {
|
|
28
|
+
const n = Buffer.from(o, "base64").toString();
|
|
29
|
+
return JSON.parse(n);
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
this.logger.logError("error convert to base64");
|
|
33
|
+
}
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
b as E
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var o=(t,e,r)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var i=(t,e,r)=>o(t,typeof e!="symbol"?e+"":e,r);const n=require("node-jose"),g=require("crypto"),E=require("./logger-BMbeDoGU.cjs");require("./lodash-DNCgFYS7.cjs");const a=t=>t.replace(/[\u00A0-\uffff]/gu,e=>"\\u"+("000"+e.charCodeAt(0).toString(16)).slice(-4));class y{constructor(){i(this,"logger",new E.Logger);i(this,"signatureKey")}async generateKey(){const e=process.env.SECRET_SIGNATURE;if(!e)throw new Error("Define a SECRET_SIGNATURE from `.env`");this.signatureKey=await n.JWK.asKey({kty:"oct",k:n.util.base64url.encode(e)})}async encrypt(e){if(await this.generateKey(),!this.signatureKey)throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");const r=JSON.stringify(e),s=a(r);return await n.JWE.createEncrypt({format:"compact"},this.signatureKey).update(s).final()}async decrypt(e){if(await this.generateKey(),!this.signatureKey)throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");const{payload:r}=await n.JWE.createDecrypt(this.signatureKey).decrypt(e);return JSON.parse(r.toString())}async isEncrypted(e){this.logger.logInfo("EncryptionHandler",e);try{return await this.decrypt(e??""),this.logger.logDebug("EncryptionHandler","IS ENCRYPTED 🥵"),!0}catch(r){return this.logger.logWarn("EncryptionHandler",JSON.stringify(r)),this.logger.logDebug("EncryptionHandler","IS NOT ENCRYPTED 🙂"),!1}}generateSHA(e){const r=JSON.stringify(e);return g.createHash("sha256").update(r).digest("hex")}}exports.Encrypter=y;exports.escapeUnicode=a;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var s = (t, e, r) => e in t ? o(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var a = (t, e, r) => s(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import n from "node-jose";
|
|
5
|
+
import { createHash as c } from "crypto";
|
|
6
|
+
import { L as E } from "./logger-DtlFWyFO.js";
|
|
7
|
+
import "./lodash-QjAkD17S.js";
|
|
8
|
+
const g = (t) => t.replace(/[\u00A0-\uffff]/gu, (e) => "\\u" + ("000" + e.charCodeAt(0).toString(16)).slice(-4));
|
|
9
|
+
class d {
|
|
10
|
+
constructor() {
|
|
11
|
+
a(this, "logger", new E());
|
|
12
|
+
a(this, "signatureKey");
|
|
13
|
+
}
|
|
14
|
+
async generateKey() {
|
|
15
|
+
const e = process.env.SECRET_SIGNATURE;
|
|
16
|
+
if (!e)
|
|
17
|
+
throw new Error("Define a SECRET_SIGNATURE from `.env`");
|
|
18
|
+
this.signatureKey = await n.JWK.asKey({
|
|
19
|
+
kty: "oct",
|
|
20
|
+
k: n.util.base64url.encode(e)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async encrypt(e) {
|
|
24
|
+
if (await this.generateKey(), !this.signatureKey) throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");
|
|
25
|
+
const r = JSON.stringify(e), i = g(r);
|
|
26
|
+
return await n.JWE.createEncrypt(
|
|
27
|
+
{ format: "compact" },
|
|
28
|
+
this.signatureKey
|
|
29
|
+
).update(i).final();
|
|
30
|
+
}
|
|
31
|
+
async decrypt(e) {
|
|
32
|
+
if (await this.generateKey(), !this.signatureKey) throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");
|
|
33
|
+
const { payload: r } = await n.JWE.createDecrypt(
|
|
34
|
+
this.signatureKey
|
|
35
|
+
).decrypt(e);
|
|
36
|
+
return JSON.parse(r.toString());
|
|
37
|
+
}
|
|
38
|
+
async isEncrypted(e) {
|
|
39
|
+
this.logger.logInfo("EncryptionHandler", e);
|
|
40
|
+
try {
|
|
41
|
+
return await this.decrypt(e ?? ""), this.logger.logDebug("EncryptionHandler", "IS ENCRYPTED 🥵"), !0;
|
|
42
|
+
} catch (r) {
|
|
43
|
+
return this.logger.logWarn("EncryptionHandler", JSON.stringify(r)), this.logger.logDebug("EncryptionHandler", "IS NOT ENCRYPTED 🙂"), !1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
generateSHA(e) {
|
|
47
|
+
const r = JSON.stringify(e);
|
|
48
|
+
return c("sha256").update(r).digest("hex");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
d as E,
|
|
53
|
+
g as e
|
|
54
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { default as EntraID } from './entra-id';
|
|
3
|
+
export declare class AuthEngine extends EntraID {
|
|
4
|
+
private getAppRoles;
|
|
5
|
+
private getAppRoleAssignments;
|
|
6
|
+
private userRolesByApp;
|
|
7
|
+
private getRolesFromApi;
|
|
8
|
+
getRoles(email: string, idObjApp: string): Observable<{
|
|
9
|
+
roles: string[];
|
|
10
|
+
}>;
|
|
11
|
+
private getGroupsFromApi;
|
|
12
|
+
private getUserGroups;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param email correo del usuario
|
|
16
|
+
* @param idGroup id del grupo de EntraID
|
|
17
|
+
* @returns `true` si el usuario pertenece al grupo
|
|
18
|
+
*/
|
|
19
|
+
inGroup(email: string, idGroup: string): Observable<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param email correo del usuario
|
|
23
|
+
* @param idRole id del rol del aplicativo de EntraID
|
|
24
|
+
* @param idObjApp id del objeto de la aplicacion `Identificador de objeto` en EntraID
|
|
25
|
+
* @returns `true` si el usuario tiene asignado el rol
|
|
26
|
+
*/
|
|
27
|
+
inRole(email: string, idRole: string, idObjApp: string): Observable<boolean>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=auth-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-engine.d.ts","sourceRoot":"","sources":["../../src/engine/auth-engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGtC,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAavC,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,WAAW;IA2BnB,OAAO,CAAC,qBAAqB;IA+B7B,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,eAAe;IAMhB,QAAQ,CACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,UAAU,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAIlC,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,aAAa;IAIrB;;;;;OAKG;IACI,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAkB7C;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAiB9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Logger } from '../helpers';
|
|
2
|
+
declare class EntraID {
|
|
3
|
+
readonly logger: Logger;
|
|
4
|
+
protected getHeaders(): import('rxjs').Observable<{
|
|
5
|
+
headers: {
|
|
6
|
+
Authorization: string;
|
|
7
|
+
responseType: string;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export default EntraID;
|
|
12
|
+
//# sourceMappingURL=entra-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entra-id.d.ts","sourceRoot":"","sources":["../../src/engine/entra-id.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAalC,cAAM,OAAO;IACX,QAAQ,CAAC,MAAM,SAAe;IAE9B,SAAS,CAAC,UAAU;;;;;;CAkDrB;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface IRolesByUser {
|
|
2
|
+
id: string;
|
|
3
|
+
deletedDateTime: string | null;
|
|
4
|
+
appRoleId: string;
|
|
5
|
+
createdDateTime: string;
|
|
6
|
+
principalDisplayName: string;
|
|
7
|
+
principalId: string;
|
|
8
|
+
principalType: string;
|
|
9
|
+
resourceDisplayName: string;
|
|
10
|
+
resourceId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IAppRoleAssignments {
|
|
13
|
+
"@odata.context": string;
|
|
14
|
+
"@microsoft.graph.tips": string;
|
|
15
|
+
value: IRolesByUser[];
|
|
16
|
+
}
|
|
17
|
+
export interface IRolesByApp {
|
|
18
|
+
allowedMemberTypes: string[];
|
|
19
|
+
description: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
id: string;
|
|
22
|
+
isEnabled: boolean;
|
|
23
|
+
origin: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IAppRoles {
|
|
27
|
+
"@odata.context": string;
|
|
28
|
+
value: IRolesByApp[];
|
|
29
|
+
}
|
|
30
|
+
interface IGroup {
|
|
31
|
+
"@odata.type": string;
|
|
32
|
+
id: string;
|
|
33
|
+
description: string;
|
|
34
|
+
displayName: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IGroups {
|
|
37
|
+
"@odata.context": string;
|
|
38
|
+
value: IGroup[];
|
|
39
|
+
}
|
|
40
|
+
export interface IResponseRolesCache<T> {
|
|
41
|
+
sha: string;
|
|
42
|
+
data: {
|
|
43
|
+
roles: Array<T>;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface IResponseGroupsCache {
|
|
47
|
+
sha: string;
|
|
48
|
+
data: IGroups;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/types/index.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,MAAM,CAAA;IACxB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,KAAK,EAAE,YAAY,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAED,UAAU,MAAM;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB;AACD,MAAM,WAAW,OAAO;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE;QACJ,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;KAChB,CAAA;CACF;AACD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;CACd"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const commonErrors: {
|
|
2
|
+
UNAUTHORIZED: {
|
|
3
|
+
level: string;
|
|
4
|
+
type: string;
|
|
5
|
+
message: string;
|
|
6
|
+
title: string;
|
|
7
|
+
code: number;
|
|
8
|
+
};
|
|
9
|
+
"ERR-GENERAL-01": {
|
|
10
|
+
level: string;
|
|
11
|
+
type: string;
|
|
12
|
+
message: string;
|
|
13
|
+
title: string;
|
|
14
|
+
code: number;
|
|
15
|
+
};
|
|
16
|
+
internalError: {
|
|
17
|
+
level: string;
|
|
18
|
+
type: string;
|
|
19
|
+
message: string;
|
|
20
|
+
title: string;
|
|
21
|
+
code: number;
|
|
22
|
+
};
|
|
23
|
+
default: {
|
|
24
|
+
code: number;
|
|
25
|
+
type: string;
|
|
26
|
+
message: string;
|
|
27
|
+
title: string;
|
|
28
|
+
level: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=default-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-errors.d.ts","sourceRoot":"","sources":["../../src/errors/default-errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BxB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RxSubjectManager } from '../rxjs/rx-subject-manager';
|
|
2
|
+
import { RuntimeError } from './runtime-error';
|
|
3
|
+
export declare class ErrorHandler extends RxSubjectManager<RuntimeError> {
|
|
4
|
+
private static instance;
|
|
5
|
+
private constructor();
|
|
6
|
+
static getInstance(): ErrorHandler;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/errors/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D,qBAAa,YAAa,SAAQ,gBAAgB,CAAC,YAAY,CAAC;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IAErC,OAAO;IAIP,MAAM,CAAC,WAAW;CAMnB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare const translation: {
|
|
2
|
+
errors: {
|
|
3
|
+
default: {
|
|
4
|
+
title: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
"ERR-GENERAL-01": {
|
|
8
|
+
title: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
UnAuthorized: {
|
|
12
|
+
title: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
ErrorGeneral: {
|
|
16
|
+
title: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
internalError: {
|
|
20
|
+
title: string;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
UserConfigError: {
|
|
24
|
+
title: string;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default translation;
|
|
30
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/errors/i18n.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BhB,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum RuntimeErrorCode {
|
|
2
|
+
DEFAULT = "default",
|
|
3
|
+
GENERAL_ERROR = "ERR-GENERAL-01",
|
|
4
|
+
INTERNAL_ERROR = "internalError",
|
|
5
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
6
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
7
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
8
|
+
TIMEOUT_ERROR = "TIMEOUT_ERROR",
|
|
9
|
+
AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
|
|
10
|
+
AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR",
|
|
11
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
12
|
+
NOT_FOUND_ERROR = "NOT_FOUND_ERROR",
|
|
13
|
+
CONFLICT_ERROR = "CONFLICT_ERROR",
|
|
14
|
+
SERVER_ERROR = "SERVER_ERROR"
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=runtime-error-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-error-code.d.ts","sourceRoot":"","sources":["../../src/errors/runtime-error-code.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,aAAa,mBAAmB;IAChC,cAAc,kBAAkB;IAChC,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,oBAAoB,yBAAyB;IAC7C,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-error.d.ts","sourceRoot":"","sources":["../../src/errors/runtime-error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;gBACL,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,MAAW;CAKjD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";var x=function(r,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])},x(r,t)};function P(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");x(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var g=function(){return g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},g.apply(this,arguments)};function B(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function C(r,t,e,n){function i(o){return o instanceof e?o:new e(function(u){u(o)})}return new(e||(e=Promise))(function(o,u){function s(l){try{c(n.next(l))}catch(p){u(p)}}function a(l){try{c(n.throw(l))}catch(p){u(p)}}function c(l){l.done?o(l.value):i(l.value).then(s,a)}c((n=n.apply(r,t||[])).next())})}function U(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(c){return function(l){return a([c,l])}}function a(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(e=0)),e;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,i=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){e.label=c[1];break}if(c[0]===6&&e.label<o[1]){e.label=o[1],o=c;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(c);break}o[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(r,e)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function w(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,o=[],u;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){u={error:s}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(u)throw u.error}}return o}function _(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return r.concat(o||Array.prototype.slice.call(t))}function m(r){return this instanceof m?(this.v=r,this):new m(r)}function D(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",u),i[Symbol.asyncIterator]=function(){return this},i;function u(f){return function(d){return Promise.resolve(d).then(f,p)}}function s(f,d){n[f]&&(i[f]=function(y){return new Promise(function(V,q){o.push([f,y,V,q])>1||a(f,y)})},d&&(i[f]=d(i[f])))}function a(f,d){try{c(n[f](d))}catch(y){v(o[0][3],y)}}function c(f){f.value instanceof m?Promise.resolve(f.value.v).then(l,p):v(o[0][2],f)}function l(f){a("next",f)}function p(f){a("throw",f)}function v(f,d){f(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function H(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof w=="function"?w(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(o){e[o]=r[o]&&function(u){return new Promise(function(s,a){u=r[o](u),i(s,a,u.done,u.value)})}}function i(o,u,s,a){Promise.resolve(a).then(function(c){o({value:c,done:s})},u)}}function h(r){return typeof r=="function"}function J(r){var t=function(n){Error.call(n),n.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var O=J(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription:
|
|
2
|
+
`+e.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function k(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var A=(function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,n,i,o;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var s=w(u),a=s.next();!a.done;a=s.next()){var c=a.value;c.remove(this)}}catch(y){t={error:y}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}else u.remove(this);var l=this.initialTeardown;if(h(l))try{l()}catch(y){o=y instanceof O?y.errors:[y]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var v=w(p),f=v.next();!f.done;f=v.next()){var d=f.value;try{L(d)}catch(y){o=o??[],y instanceof O?o=_(_([],E(o)),E(y.errors)):o.push(y)}}}catch(y){n={error:y}}finally{try{f&&!f.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(o)throw new O(o)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)L(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&k(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&k(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=(function(){var t=new r;return t.closed=!0,t})(),r})();A.EMPTY;function Y(r){return r instanceof A||r&&"closed"in r&&h(r.remove)&&h(r.add)&&h(r.unsubscribe)}function L(r){h(r)?r():r.unsubscribe()}var K={Promise:void 0},Q={setTimeout:function(r,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];return setTimeout.apply(void 0,_([r,t],E(e)))},clearTimeout:function(r){return clearTimeout(r)},delegate:void 0};function G(r){Q.setTimeout(function(){throw r})}function R(){}function X(r){r()}var T=(function(r){P(t,r);function t(e){var n=r.call(this)||this;return n.isStopped=!1,e?(n.destination=e,Y(e)&&e.add(n)):n.destination=z,n}return t.create=function(e,n,i){return new I(e,n,i)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(A),Z=(function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(n){S(n)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(n){S(n)}else S(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){S(e)}},r})(),I=(function(r){P(t,r);function t(e,n,i){var o=r.call(this)||this,u;return h(e)||!e?u={next:e??void 0,error:n??void 0,complete:i??void 0}:u=e,o.destination=new Z(u),o}return t})(T);function S(r){G(r)}function $(r){throw r}var z={closed:!0,next:R,error:$,complete:R};function W(r,t,e,n,i){return new N(r,t,e,n,i)}var N=(function(r){P(t,r);function t(e,n,i,o,u,s){var a=r.call(this,e)||this;return a.onFinalize=u,a.shouldUnsubscribe=s,a._next=n?function(c){try{n(c)}catch(l){e.error(l)}}:r.prototype._next,a._error=o?function(c){try{o(c)}catch(l){e.error(l)}finally{this.unsubscribe()}}:r.prototype._error,a._complete=i?function(){try{i()}catch(c){e.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,a}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t})(T),j=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function rr(r){return r}function er(r){return r.length===0?rr:r.length===1?r[0]:function(e){return r.reduce(function(n,i){return i(n)},e)}}var b=(function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,n){var i=this,o=nr(t)?t:new I(t,e,n);return X(function(){var u=i,s=u.operator,a=u.source;o.add(s?s.call(o,a):a?i._subscribe(o):i._trySubscribe(o))}),o},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var n=this;return e=F(e),new e(function(i,o){var u=new I({next:function(s){try{t(s)}catch(a){o(a),u.unsubscribe()}},error:o,complete:i});n.subscribe(u)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[j]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return er(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=F(t),new t(function(n,i){var o;e.subscribe(function(u){return o=u},function(u){return i(u)},function(){return n(o)})})},r.create=function(t){return new r(t)},r})();function F(r){var t;return(t=r??K.Promise)!==null&&t!==void 0?t:Promise}function tr(r){return r&&h(r.next)&&h(r.error)&&h(r.complete)}function nr(r){return r&&r instanceof T||tr(r)&&Y(r)}var or=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function ir(r){return h(r==null?void 0:r.then)}function ur(r){return h(r[j])}function cr(r){return Symbol.asyncIterator&&h(r==null?void 0:r[Symbol.asyncIterator])}function ar(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function sr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var fr=sr();function lr(r){return h(r==null?void 0:r[fr])}function yr(r){return D(this,arguments,function(){var e,n,i,o;return U(this,function(u){switch(u.label){case 0:e=r.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,m(e.read())];case 3:return n=u.sent(),i=n.value,o=n.done,o?[4,m(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,m(i)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function hr(r){return h(r==null?void 0:r.getReader)}function pr(r){if(r instanceof b)return r;if(r!=null){if(ur(r))return vr(r);if(or(r))return dr(r);if(ir(r))return br(r);if(cr(r))return M(r);if(lr(r))return mr(r);if(hr(r))return wr(r)}throw ar(r)}function vr(r){return new b(function(t){var e=r[j]();if(h(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function dr(r){return new b(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()})}function br(r){return new b(function(t){r.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,G)})}function mr(r){return new b(function(t){var e,n;try{for(var i=w(r),o=i.next();!o.done;o=i.next()){var u=o.value;if(t.next(u),t.closed)return}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}t.complete()})}function M(r){return new b(function(t){Sr(r,t).catch(function(e){return t.error(e)})})}function wr(r){return M(yr(r))}function Sr(r,t){var e,n,i,o;return C(this,void 0,void 0,function(){var u,s;return U(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),e=H(r),a.label=1;case 1:return[4,e.next()];case 2:if(n=a.sent(),!!n.done)return[3,4];if(u=n.value,t.next(u),t.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=a.sent(),i={error:s},[3,11];case 6:return a.trys.push([6,,9,10]),n&&!n.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function gr(r,t){t===void 0&&(t={});var e=t.selector,n=B(t,["selector"]);return new b(function(i){var o=new AbortController,u=o.signal,s=!0,a=n.signal;if(a)if(a.aborted)o.abort();else{var c=function(){u.aborted||o.abort()};a.addEventListener("abort",c),i.add(function(){return a.removeEventListener("abort",c)})}var l=g(g({},n),{signal:u}),p=function(v){s=!1,i.error(v)};return fetch(r,l).then(function(v){e?pr(e(v)).subscribe(W(i,void 0,function(){s=!1,i.complete()},p)):(s=!1,i.next(v),i.complete())}).catch(p),function(){s&&o.abort()}})}exports.fromFetch=gr;
|