@entur-partner/bff 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +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;
|
|
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,YAAY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,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;;;;;"}
|
package/dist/bff.esm.js.map
CHANGED
|
@@ -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;
|
|
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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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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur-partner/bff",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/bff.esm.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"reportFile": "jest-sonar-report.xml",
|
|
39
39
|
"indent": 4
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "37d8445b21bd76a2e89ba280037acf4df7ef4996"
|
|
42
42
|
}
|