@entur-partner/bff 1.2.2 → 1.2.5-alpha.0

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/LICENSE.md ADDED
@@ -0,0 +1 @@
1
+ This package is unlicensed, and is only usable internally at Entur AS
@@ -9,7 +9,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
  var proxy__default = /*#__PURE__*/_interopDefaultLegacy(proxy);
10
10
 
11
11
  var requireOAuth = function requireOAuth(req) {
12
- return /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || '');
12
+ return /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || "");
13
13
  };
14
14
  var proxyConfig = function proxyConfig(methods, proxyReqPathResolver) {
15
15
  var httpMethods = Array.isArray(methods) ? methods : [methods];
@@ -25,7 +25,7 @@ var proxyConfig = function proxyConfig(methods, proxyReqPathResolver) {
25
25
  };
26
26
  };
27
27
  var stripTrailingSlash = function stripTrailingSlash(url) {
28
- return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
28
+ return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
29
29
  };
30
30
  // forwards a call of a specific url / set of methods to a remote server
31
31
  var forwardingProxy = function forwardingProxy(apiUrl) {
@@ -1 +1 @@
1
- {"version":3,"file":"bff.cjs.development.js","sources":["../src/forwardingproxy.ts"],"sourcesContent":["import proxy, { ProxyOptions } from 'express-http-proxy';\nimport { Request } from 'express';\n\nconst requireOAuth = (req: Request) =>\n /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || '');\n\nexport const proxyConfig = (\n methods: string[],\n proxyReqPathResolver: Required<ProxyOptions>['proxyReqPathResolver']\n): Parameters<typeof proxy>[1] => {\n const httpMethods = Array.isArray(methods) ? methods : [methods];\n\n return {\n filter: (req: Request) =>\n httpMethods.includes(req.method) && requireOAuth(req),\n proxyReqPathResolver,\n proxyReqBodyDecorator: (bodyContent, _srcReq) => bodyContent,\n limit: `${process.env.UPLOAD_LIMIT_MB || 200}mb`,\n };\n};\n\nconst stripTrailingSlash = (url: string) =>\n url.endsWith('/') ? url.substring(0, url.length - 1) : url;\n\n// forwards a call of a specific url / set of methods to a remote server\nexport const forwardingProxy =\n (apiUrl: string) =>\n (method: string[], forwardPath: (...reqs: Request[]) => string) =>\n proxy(\n apiUrl,\n proxyConfig(\n method,\n (...params) =>\n stripTrailingSlash(new URL(apiUrl).pathname) + forwardPath(...params)\n )\n );\n"],"names":["requireOAuth","req","test","headers","authorization","proxyConfig","methods","proxyReqPathResolver","httpMethods","Array","isArray","filter","includes","method","proxyReqBodyDecorator","bodyContent","_srcReq","limit","process","env","UPLOAD_LIMIT_MB","stripTrailingSlash","url","endsWith","substring","length","forwardingProxy","apiUrl","forwardPath","proxy","URL","pathname","apply","arguments"],"mappings":";;;;;;;;;;AAGA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,GAAY,EAAA;EAAA,OAChC,gCAAgC,CAACC,IAAI,CAACD,GAAG,CAACE,OAAO,CAACC,aAAa,IAAI,EAAE,CAAC,CAAA;AAAA,CAAA,CAAA;AAEjE,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CACtBC,OAAiB,EACjBC,oBAAoE,EACrC;AAC/B,EAAA,IAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC,CAAA;EAEhE,OAAO;IACLK,MAAM,EAAE,SAAAA,MAAAA,CAACV,GAAY,EAAA;AAAA,MAAA,OACnBO,WAAW,CAACI,QAAQ,CAACX,GAAG,CAACY,MAAM,CAAC,IAAIb,YAAY,CAACC,GAAG,CAAC,CAAA;AAAA,KAAA;AACvDM,IAAAA,oBAAoB,EAApBA,oBAAoB;AACpBO,IAAAA,qBAAqB,EAAE,SAAAA,qBAACC,CAAAA,WAAW,EAAEC,OAAO,EAAA;AAAA,MAAA,OAAKD,WAAW,CAAA;AAAA,KAAA;AAC5DE,IAAAA,KAAK,GAAKC,OAAO,CAACC,GAAG,CAACC,eAAe,IAAI,GAAG,IAAA,IAAA;GAC7C,CAAA;AACH,EAAC;AAED,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,GAAW,EAAA;EAAA,OACrCA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,SAAS,CAAC,CAAC,EAAEF,GAAG,CAACG,MAAM,GAAG,CAAC,CAAC,GAAGH,GAAG,CAAA;AAAA,CAAA,CAAA;AAE5D;IACaI,eAAe,GAC1B,SADWA,eAAeA,CACzBC,MAAc,EAAA;EAAA,OACf,UAACd,MAAgB,EAAEe,WAA2C,EAAA;AAAA,IAAA,OAC5DC,yBAAK,CACHF,MAAM,EACNtB,WAAW,CACTQ,MAAM,EACN,YAAA;AAAA,MAAA,OACEQ,kBAAkB,CAAC,IAAIS,GAAG,CAACH,MAAM,CAAC,CAACI,QAAQ,CAAC,GAAGH,WAAW,CAAAI,KAAA,CAAA,KAAA,CAAA,EAAAC,SAAU,CAAC,CAAA;AAAA,KAAA,CACxE,CACF,CAAA;AAAA,GAAA,CAAA;AAAA;;;;;"}
1
+ {"version":3,"file":"bff.cjs.development.js","sources":["../src/forwardingproxy.ts"],"sourcesContent":["import type { Request } from \"express\";\nimport proxy, { type ProxyOptions } from \"express-http-proxy\";\n\nconst requireOAuth = (req: Request) =>\n\t/(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || \"\");\n\nexport const proxyConfig = (\n\tmethods: string[],\n\tproxyReqPathResolver: Required<ProxyOptions>[\"proxyReqPathResolver\"],\n): Parameters<typeof proxy>[1] => {\n\tconst httpMethods = Array.isArray(methods) ? methods : [methods];\n\n\treturn {\n\t\tfilter: (req: Request) =>\n\t\t\thttpMethods.includes(req.method) && requireOAuth(req),\n\t\tproxyReqPathResolver,\n\t\tproxyReqBodyDecorator: (bodyContent, _srcReq) => bodyContent,\n\t\tlimit: `${process.env.UPLOAD_LIMIT_MB || 200}mb`,\n\t};\n};\n\nconst stripTrailingSlash = (url: string) =>\n\turl.endsWith(\"/\") ? url.substring(0, url.length - 1) : url;\n\n// forwards a call of a specific url / set of methods to a remote server\nexport const forwardingProxy =\n\t(apiUrl: string) =>\n\t(method: string[], forwardPath: (...reqs: Request[]) => string) =>\n\t\tproxy(\n\t\t\tapiUrl,\n\t\t\tproxyConfig(\n\t\t\t\tmethod,\n\t\t\t\t(...params) =>\n\t\t\t\t\tstripTrailingSlash(new URL(apiUrl).pathname) + forwardPath(...params),\n\t\t\t),\n\t\t);\n"],"names":["requireOAuth","req","test","headers","authorization","proxyConfig","methods","proxyReqPathResolver","httpMethods","Array","isArray","filter","includes","method","proxyReqBodyDecorator","bodyContent","_srcReq","limit","process","env","UPLOAD_LIMIT_MB","stripTrailingSlash","url","endsWith","substring","length","forwardingProxy","apiUrl","forwardPath","proxy","URL","pathname","apply","arguments"],"mappings":";;;;;;;;;;AAGA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,GAAY,EAAA;EAAA,OACjC,gCAAgC,CAACC,IAAI,CAACD,GAAG,CAACE,OAAO,CAACC,aAAa,IAAI,EAAE,CAAC,CAAA;AAAA,CAAA,CAAA;AAEhE,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CACvBC,OAAiB,EACjBC,oBAAoE,EACpC;AAChC,EAAA,IAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC,CAAA;EAEhE,OAAO;AACNK,IAAAA,MAAM,EAAE,SAARA,MAAMA,CAAGV,GAAY,EAAA;AAAA,MAAA,OACpBO,WAAW,CAACI,QAAQ,CAACX,GAAG,CAACY,MAAM,CAAC,IAAIb,YAAY,CAACC,GAAG,CAAC,CAAA;AAAA,KAAA;AACtDM,IAAAA,oBAAoB,EAApBA,oBAAoB;AACpBO,IAAAA,qBAAqB,EAAE,SAAvBA,qBAAqBA,CAAGC,WAAW,EAAEC,OAAO,EAAA;AAAA,MAAA,OAAKD,WAAW,CAAA;AAAA,KAAA;AAC5DE,IAAAA,KAAK,GAAKC,OAAO,CAACC,GAAG,CAACC,eAAe,IAAI,GAAG,IAAA,IAAA;GAC5C,CAAA;AACF,EAAC;AAED,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,GAAW,EAAA;EAAA,OACtCA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,SAAS,CAAC,CAAC,EAAEF,GAAG,CAACG,MAAM,GAAG,CAAC,CAAC,GAAGH,GAAG,CAAA;AAAA,CAAA,CAAA;AAE3D;IACaI,eAAe,GAC3B,SADYA,eAAeA,CAC1BC,MAAc,EAAA;EAAA,OACf,UAACd,MAAgB,EAAEe,WAA2C,EAAA;AAAA,IAAA,OAC7DC,yBAAK,CACJF,MAAM,EACNtB,WAAW,CACVQ,MAAM,EACN,YAAA;AAAA,MAAA,OACCQ,kBAAkB,CAAC,IAAIS,GAAG,CAACH,MAAM,CAAC,CAACI,QAAQ,CAAC,GAAGH,WAAW,CAAAI,KAAA,CAAA,KAAA,CAAA,EAAAC,SAAU,CAAC,CAAA;AAAA,KAAA,CACtE,CACD,CAAA;AAAA,GAAA,CAAA;AAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"bff.cjs.production.min.js","sources":["../src/forwardingproxy.ts"],"sourcesContent":["import proxy, { ProxyOptions } from 'express-http-proxy';\nimport { Request } from 'express';\n\nconst requireOAuth = (req: Request) =>\n /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || '');\n\nexport const proxyConfig = (\n methods: string[],\n proxyReqPathResolver: Required<ProxyOptions>['proxyReqPathResolver']\n): Parameters<typeof proxy>[1] => {\n const httpMethods = Array.isArray(methods) ? methods : [methods];\n\n return {\n filter: (req: Request) =>\n httpMethods.includes(req.method) && requireOAuth(req),\n proxyReqPathResolver,\n proxyReqBodyDecorator: (bodyContent, _srcReq) => bodyContent,\n limit: `${process.env.UPLOAD_LIMIT_MB || 200}mb`,\n };\n};\n\nconst stripTrailingSlash = (url: string) =>\n url.endsWith('/') ? url.substring(0, url.length - 1) : url;\n\n// forwards a call of a specific url / set of methods to a remote server\nexport const forwardingProxy =\n (apiUrl: string) =>\n (method: string[], forwardPath: (...reqs: Request[]) => string) =>\n proxy(\n apiUrl,\n proxyConfig(\n method,\n (...params) =>\n stripTrailingSlash(new URL(apiUrl).pathname) + forwardPath(...params)\n )\n );\n"],"names":["proxyConfig","methods","proxyReqPathResolver","httpMethods","Array","isArray","filter","req","includes","method","test","headers","authorization","requireOAuth","proxyReqBodyDecorator","bodyContent","_srcReq","limit","process","env","UPLOAD_LIMIT_MB","apiUrl","forwardPath","proxy","url","URL","pathname","endsWith","substring","length","apply","arguments"],"mappings":"mLAMaA,EAAc,SACzBC,EACAC,GAEA,IAAMC,EAAcC,MAAMC,QAAQJ,GAAWA,EAAU,CAACA,GAExD,MAAO,CACLK,OAAQ,SAACC,GAAY,OACnBJ,EAAYK,SAASD,EAAIE,SAXV,SAACF,GAAY,MAChC,iCAAiCG,KAAKH,EAAII,QAAQC,eAAiB,GAAG,CAU9BC,CAAaN,EAAI,EACvDL,qBAAAA,EACAY,sBAAuB,SAACC,EAAaC,GAAO,OAAKD,CAAW,EAC5DE,OAAUC,QAAQC,IAAIC,iBAAmB,KAAG,KAEhD,0BAOE,SAACC,GAAc,OACf,SAACZ,EAAkBa,GAA2C,OAC5DC,UACEF,EACArB,EACES,GACA,WAAA,QAXoBe,EAYC,IAAIC,IAAIJ,GAAQK,UAXvCC,SAAS,KAAOH,EAAII,UAAU,EAAGJ,EAAIK,OAAS,GAAKL,GAWAF,EAAWQ,WAAA,EAAAC,WAZzC,IAACP,CAYmD,IAE1E,CAAA"}
1
+ {"version":3,"file":"bff.cjs.production.min.js","sources":["../src/forwardingproxy.ts"],"sourcesContent":["import type { Request } from \"express\";\nimport proxy, { type ProxyOptions } from \"express-http-proxy\";\n\nconst requireOAuth = (req: Request) =>\n\t/(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || \"\");\n\nexport const proxyConfig = (\n\tmethods: string[],\n\tproxyReqPathResolver: Required<ProxyOptions>[\"proxyReqPathResolver\"],\n): Parameters<typeof proxy>[1] => {\n\tconst httpMethods = Array.isArray(methods) ? methods : [methods];\n\n\treturn {\n\t\tfilter: (req: Request) =>\n\t\t\thttpMethods.includes(req.method) && requireOAuth(req),\n\t\tproxyReqPathResolver,\n\t\tproxyReqBodyDecorator: (bodyContent, _srcReq) => bodyContent,\n\t\tlimit: `${process.env.UPLOAD_LIMIT_MB || 200}mb`,\n\t};\n};\n\nconst stripTrailingSlash = (url: string) =>\n\turl.endsWith(\"/\") ? url.substring(0, url.length - 1) : url;\n\n// forwards a call of a specific url / set of methods to a remote server\nexport const forwardingProxy =\n\t(apiUrl: string) =>\n\t(method: string[], forwardPath: (...reqs: Request[]) => string) =>\n\t\tproxy(\n\t\t\tapiUrl,\n\t\t\tproxyConfig(\n\t\t\t\tmethod,\n\t\t\t\t(...params) =>\n\t\t\t\t\tstripTrailingSlash(new URL(apiUrl).pathname) + forwardPath(...params),\n\t\t\t),\n\t\t);\n"],"names":["proxyConfig","methods","proxyReqPathResolver","httpMethods","Array","isArray","filter","req","includes","method","test","headers","authorization","requireOAuth","proxyReqBodyDecorator","bodyContent","_srcReq","limit","process","env","UPLOAD_LIMIT_MB","apiUrl","forwardPath","proxy","url","URL","pathname","endsWith","substring","length","apply","arguments"],"mappings":"mLAMaA,EAAc,SAC1BC,EACAC,GAEA,IAAMC,EAAcC,MAAMC,QAAQJ,GAAWA,EAAU,CAACA,GAExD,MAAO,CACNK,OAAQ,SAACC,GAAY,OACpBJ,EAAYK,SAASD,EAAIE,SAXP,SAACF,GAAY,MACjC,iCAAiCG,KAAKH,EAAII,QAAQC,eAAiB,GAAG,CAUhCC,CAAaN,EAAI,EACtDL,qBAAAA,EACAY,sBAAuB,SAACC,EAAaC,GAAO,OAAKD,CAAW,EAC5DE,OAAUC,QAAQC,IAAIC,iBAAmB,KAAG,KAE9C,0BAOC,SAACC,GAAc,OACf,SAACZ,EAAkBa,GAA2C,OAC7DC,UACCF,EACArB,EACCS,GACA,WAAA,QAXwBe,EAYJ,IAAIC,IAAIJ,GAAQK,UAXnCC,SAAS,KAAOH,EAAII,UAAU,EAAGJ,EAAIK,OAAS,GAAKL,GAWJF,EAAWQ,WAAA,EAAAC,WAZpC,IAACP,CAY8C,IAEvE,CAAA"}
package/dist/bff.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import proxy from 'express-http-proxy';
2
2
 
3
3
  var requireOAuth = function requireOAuth(req) {
4
- return /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || '');
4
+ return /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || "");
5
5
  };
6
6
  var proxyConfig = function proxyConfig(methods, proxyReqPathResolver) {
7
7
  var httpMethods = Array.isArray(methods) ? methods : [methods];
@@ -17,7 +17,7 @@ var proxyConfig = function proxyConfig(methods, proxyReqPathResolver) {
17
17
  };
18
18
  };
19
19
  var stripTrailingSlash = function stripTrailingSlash(url) {
20
- return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
20
+ return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
21
21
  };
22
22
  // forwards a call of a specific url / set of methods to a remote server
23
23
  var forwardingProxy = function forwardingProxy(apiUrl) {
@@ -1 +1 @@
1
- {"version":3,"file":"bff.esm.js","sources":["../src/forwardingproxy.ts"],"sourcesContent":["import proxy, { ProxyOptions } from 'express-http-proxy';\nimport { Request } from 'express';\n\nconst requireOAuth = (req: Request) =>\n /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || '');\n\nexport const proxyConfig = (\n methods: string[],\n proxyReqPathResolver: Required<ProxyOptions>['proxyReqPathResolver']\n): Parameters<typeof proxy>[1] => {\n const httpMethods = Array.isArray(methods) ? methods : [methods];\n\n return {\n filter: (req: Request) =>\n httpMethods.includes(req.method) && requireOAuth(req),\n proxyReqPathResolver,\n proxyReqBodyDecorator: (bodyContent, _srcReq) => bodyContent,\n limit: `${process.env.UPLOAD_LIMIT_MB || 200}mb`,\n };\n};\n\nconst stripTrailingSlash = (url: string) =>\n url.endsWith('/') ? url.substring(0, url.length - 1) : url;\n\n// forwards a call of a specific url / set of methods to a remote server\nexport const forwardingProxy =\n (apiUrl: string) =>\n (method: string[], forwardPath: (...reqs: Request[]) => string) =>\n proxy(\n apiUrl,\n proxyConfig(\n method,\n (...params) =>\n stripTrailingSlash(new URL(apiUrl).pathname) + forwardPath(...params)\n )\n );\n"],"names":["requireOAuth","req","test","headers","authorization","proxyConfig","methods","proxyReqPathResolver","httpMethods","Array","isArray","filter","includes","method","proxyReqBodyDecorator","bodyContent","_srcReq","limit","process","env","UPLOAD_LIMIT_MB","stripTrailingSlash","url","endsWith","substring","length","forwardingProxy","apiUrl","forwardPath","proxy","URL","pathname","apply","arguments"],"mappings":";;AAGA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,GAAY,EAAA;EAAA,OAChC,gCAAgC,CAACC,IAAI,CAACD,GAAG,CAACE,OAAO,CAACC,aAAa,IAAI,EAAE,CAAC,CAAA;AAAA,CAAA,CAAA;AAEjE,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CACtBC,OAAiB,EACjBC,oBAAoE,EACrC;AAC/B,EAAA,IAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC,CAAA;EAEhE,OAAO;IACLK,MAAM,EAAE,SAAAA,MAAAA,CAACV,GAAY,EAAA;AAAA,MAAA,OACnBO,WAAW,CAACI,QAAQ,CAACX,GAAG,CAACY,MAAM,CAAC,IAAIb,YAAY,CAACC,GAAG,CAAC,CAAA;AAAA,KAAA;AACvDM,IAAAA,oBAAoB,EAApBA,oBAAoB;AACpBO,IAAAA,qBAAqB,EAAE,SAAAA,qBAACC,CAAAA,WAAW,EAAEC,OAAO,EAAA;AAAA,MAAA,OAAKD,WAAW,CAAA;AAAA,KAAA;AAC5DE,IAAAA,KAAK,GAAKC,OAAO,CAACC,GAAG,CAACC,eAAe,IAAI,GAAG,IAAA,IAAA;GAC7C,CAAA;AACH,EAAC;AAED,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,GAAW,EAAA;EAAA,OACrCA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,SAAS,CAAC,CAAC,EAAEF,GAAG,CAACG,MAAM,GAAG,CAAC,CAAC,GAAGH,GAAG,CAAA;AAAA,CAAA,CAAA;AAE5D;IACaI,eAAe,GAC1B,SADWA,eAAeA,CACzBC,MAAc,EAAA;EAAA,OACf,UAACd,MAAgB,EAAEe,WAA2C,EAAA;AAAA,IAAA,OAC5DC,KAAK,CACHF,MAAM,EACNtB,WAAW,CACTQ,MAAM,EACN,YAAA;AAAA,MAAA,OACEQ,kBAAkB,CAAC,IAAIS,GAAG,CAACH,MAAM,CAAC,CAACI,QAAQ,CAAC,GAAGH,WAAW,CAAAI,KAAA,CAAA,KAAA,CAAA,EAAAC,SAAU,CAAC,CAAA;AAAA,KAAA,CACxE,CACF,CAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"bff.esm.js","sources":["../src/forwardingproxy.ts"],"sourcesContent":["import type { Request } from \"express\";\nimport proxy, { type ProxyOptions } from \"express-http-proxy\";\n\nconst requireOAuth = (req: Request) =>\n\t/(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || \"\");\n\nexport const proxyConfig = (\n\tmethods: string[],\n\tproxyReqPathResolver: Required<ProxyOptions>[\"proxyReqPathResolver\"],\n): Parameters<typeof proxy>[1] => {\n\tconst httpMethods = Array.isArray(methods) ? methods : [methods];\n\n\treturn {\n\t\tfilter: (req: Request) =>\n\t\t\thttpMethods.includes(req.method) && requireOAuth(req),\n\t\tproxyReqPathResolver,\n\t\tproxyReqBodyDecorator: (bodyContent, _srcReq) => bodyContent,\n\t\tlimit: `${process.env.UPLOAD_LIMIT_MB || 200}mb`,\n\t};\n};\n\nconst stripTrailingSlash = (url: string) =>\n\turl.endsWith(\"/\") ? url.substring(0, url.length - 1) : url;\n\n// forwards a call of a specific url / set of methods to a remote server\nexport const forwardingProxy =\n\t(apiUrl: string) =>\n\t(method: string[], forwardPath: (...reqs: Request[]) => string) =>\n\t\tproxy(\n\t\t\tapiUrl,\n\t\t\tproxyConfig(\n\t\t\t\tmethod,\n\t\t\t\t(...params) =>\n\t\t\t\t\tstripTrailingSlash(new URL(apiUrl).pathname) + forwardPath(...params),\n\t\t\t),\n\t\t);\n"],"names":["requireOAuth","req","test","headers","authorization","proxyConfig","methods","proxyReqPathResolver","httpMethods","Array","isArray","filter","includes","method","proxyReqBodyDecorator","bodyContent","_srcReq","limit","process","env","UPLOAD_LIMIT_MB","stripTrailingSlash","url","endsWith","substring","length","forwardingProxy","apiUrl","forwardPath","proxy","URL","pathname","apply","arguments"],"mappings":";;AAGA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAIC,GAAY,EAAA;EAAA,OACjC,gCAAgC,CAACC,IAAI,CAACD,GAAG,CAACE,OAAO,CAACC,aAAa,IAAI,EAAE,CAAC,CAAA;AAAA,CAAA,CAAA;AAEhE,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CACvBC,OAAiB,EACjBC,oBAAoE,EACpC;AAChC,EAAA,IAAMC,WAAW,GAAGC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC,CAAA;EAEhE,OAAO;AACNK,IAAAA,MAAM,EAAE,SAARA,MAAMA,CAAGV,GAAY,EAAA;AAAA,MAAA,OACpBO,WAAW,CAACI,QAAQ,CAACX,GAAG,CAACY,MAAM,CAAC,IAAIb,YAAY,CAACC,GAAG,CAAC,CAAA;AAAA,KAAA;AACtDM,IAAAA,oBAAoB,EAApBA,oBAAoB;AACpBO,IAAAA,qBAAqB,EAAE,SAAvBA,qBAAqBA,CAAGC,WAAW,EAAEC,OAAO,EAAA;AAAA,MAAA,OAAKD,WAAW,CAAA;AAAA,KAAA;AAC5DE,IAAAA,KAAK,GAAKC,OAAO,CAACC,GAAG,CAACC,eAAe,IAAI,GAAG,IAAA,IAAA;GAC5C,CAAA;AACF,EAAC;AAED,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,GAAW,EAAA;EAAA,OACtCA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,GAAGD,GAAG,CAACE,SAAS,CAAC,CAAC,EAAEF,GAAG,CAACG,MAAM,GAAG,CAAC,CAAC,GAAGH,GAAG,CAAA;AAAA,CAAA,CAAA;AAE3D;IACaI,eAAe,GAC3B,SADYA,eAAeA,CAC1BC,MAAc,EAAA;EAAA,OACf,UAACd,MAAgB,EAAEe,WAA2C,EAAA;AAAA,IAAA,OAC7DC,KAAK,CACJF,MAAM,EACNtB,WAAW,CACVQ,MAAM,EACN,YAAA;AAAA,MAAA,OACCQ,kBAAkB,CAAC,IAAIS,GAAG,CAACH,MAAM,CAAC,CAACI,QAAQ,CAAC,GAAGH,WAAW,CAAAI,KAAA,CAAA,KAAA,CAAA,EAAAC,SAAU,CAAC,CAAA;AAAA,KAAA,CACtE,CACD,CAAA;AAAA,GAAA,CAAA;AAAA;;;;"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="qs" />
2
- import proxy, { ProxyOptions } from 'express-http-proxy';
3
- import { Request } from 'express';
4
- export declare const proxyConfig: (methods: string[], proxyReqPathResolver: Required<ProxyOptions>['proxyReqPathResolver']) => Parameters<typeof proxy>[1];
2
+ import type { Request } from "express";
3
+ import proxy, { type ProxyOptions } from "express-http-proxy";
4
+ export declare const proxyConfig: (methods: string[], proxyReqPathResolver: Required<ProxyOptions>["proxyReqPathResolver"]) => Parameters<typeof proxy>[1];
5
5
  export declare const forwardingProxy: (apiUrl: string) => (method: string[], forwardPath: (...reqs: Request[]) => string) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './forwardingproxy';
1
+ export * from "./forwardingproxy";
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
1
  {
2
- "name": "@entur-partner/bff",
3
- "version": "1.2.2",
4
- "license": "EUPL-1.2",
5
- "main": "dist/index.js",
6
- "module": "dist/bff.esm.js",
7
- "typings": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/entur/entur-partner-packages.git",
14
- "directory": "packages/bff"
15
- },
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "scripts": {
20
- "watch": "dts watch --noClean --verbose",
21
- "build": "dts build",
22
- "test": "dts test --env=jsdom --passWithNoTests",
23
- "lint": "dts lint"
24
- },
25
- "dependencies": {
26
- "express-http-proxy": "^1.6.3"
27
- },
28
- "devDependencies": {
29
- "@types/express-http-proxy": "1.6.6"
30
- },
31
- "jest": {
32
- "collectCoverageFrom": [
33
- "<rootDir>/src/**/*.{js,jsx,ts,tsx}"
34
- ]
35
- },
36
- "jestSonar": {
37
- "reportPath": "reports/jest/",
38
- "reportFile": "jest-sonar-report.xml",
39
- "indent": 4
40
- },
41
- "gitHead": "d80524acda1e959d9f3d4002c664f9f8ce5ff74d"
2
+ "name": "@entur-partner/bff",
3
+ "version": "1.2.5-alpha.0",
4
+ "license": "EUPL-1.2",
5
+ "main": "dist/index.js",
6
+ "module": "dist/bff.esm.js",
7
+ "typings": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/entur/entur-partner-packages.git",
14
+ "directory": "packages/bff"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "watch": "dts watch --noClean --verbose",
21
+ "build": "dts build",
22
+ "test": "dts test --env=jsdom --passWithNoTests",
23
+ "lint": "dts lint"
24
+ },
25
+ "dependencies": {
26
+ "express-http-proxy": "^1.6.3"
27
+ },
28
+ "devDependencies": {
29
+ "@types/express-http-proxy": "1.6.6"
30
+ },
31
+ "jest": {
32
+ "collectCoverageFrom": [
33
+ "<rootDir>/src/**/*.{js,jsx,ts,tsx}"
34
+ ]
35
+ },
36
+ "jestSonar": {
37
+ "reportPath": "reports/jest/",
38
+ "reportFile": "jest-sonar-report.xml",
39
+ "indent": 4
40
+ },
41
+ "gitHead": "60e3f8765e47d7496720435932909572544087da"
42
42
  }