@entur-partner/bff 1.2.5-alpha.1 → 1.2.5
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/package.json +2 -2
- package/dist/bff.cjs.development.js +0 -37
- package/dist/bff.cjs.development.js.map +0 -1
- package/dist/bff.cjs.production.min.js +0 -2
- package/dist/bff.cjs.production.min.js.map +0 -1
- package/dist/bff.esm.js +0 -32
- package/dist/bff.esm.js.map +0 -1
- package/dist/forwardingproxy.d.ts +0 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur-partner/bff",
|
|
3
|
-
"version": "1.2.5
|
|
3
|
+
"version": "1.2.5",
|
|
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": "2b5279bfd81f7154664ec025a85d275d6c8c6079"
|
|
42
42
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var proxy = require('express-http-proxy');
|
|
6
|
-
|
|
7
|
-
var requireOAuth = function requireOAuth(req) {
|
|
8
|
-
return /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || "");
|
|
9
|
-
};
|
|
10
|
-
var proxyConfig = function proxyConfig(methods, proxyReqPathResolver) {
|
|
11
|
-
var httpMethods = Array.isArray(methods) ? methods : [methods];
|
|
12
|
-
return {
|
|
13
|
-
filter: function filter(req) {
|
|
14
|
-
return httpMethods.includes(req.method) && requireOAuth(req);
|
|
15
|
-
},
|
|
16
|
-
proxyReqPathResolver: proxyReqPathResolver,
|
|
17
|
-
proxyReqBodyDecorator: function proxyReqBodyDecorator(bodyContent, _srcReq) {
|
|
18
|
-
return bodyContent;
|
|
19
|
-
},
|
|
20
|
-
limit: (process.env.UPLOAD_LIMIT_MB || 200) + "mb"
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
var stripTrailingSlash = function stripTrailingSlash(url) {
|
|
24
|
-
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
25
|
-
};
|
|
26
|
-
// forwards a call of a specific url / set of methods to a remote server
|
|
27
|
-
var forwardingProxy = function forwardingProxy(apiUrl) {
|
|
28
|
-
return function (method, forwardPath) {
|
|
29
|
-
return proxy(apiUrl, proxyConfig(method, function () {
|
|
30
|
-
return stripTrailingSlash(new URL(apiUrl).pathname) + forwardPath.apply(void 0, arguments);
|
|
31
|
-
}));
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
exports.forwardingProxy = forwardingProxy;
|
|
36
|
-
exports.proxyConfig = proxyConfig;
|
|
37
|
-
//# sourceMappingURL=bff.cjs.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("express-http-proxy"),e=function(r,e){var t=Array.isArray(r)?r:[r];return{filter:function(r){return t.includes(r.method)&&function(r){return/(^undefined$)|(^Bearer .+$)/gim.test(r.headers.authorization||"")}(r)},proxyReqPathResolver:e,proxyReqBodyDecorator:function(r,e){return r},limit:(process.env.UPLOAD_LIMIT_MB||200)+"mb"}};exports.forwardingProxy=function(t){return function(n,o){return r(t,e(n,function(){return((r=new URL(t).pathname).endsWith("/")?r.substring(0,r.length-1):r)+o.apply(void 0,arguments);var r}))}},exports.proxyConfig=e;
|
|
2
|
-
//# sourceMappingURL=bff.cjs.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":"wGAMaA,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,EACCF,EACArB,EACCS,EACA,WAAA,QAXwBe,EAYJ,IAAIC,IAAIJ,GAAQK,UAXnCC,SAAS,KAAOH,EAAII,UAAU,EAAGJ,EAAIK,OAAS,GAAKL,GAWJF,EAAWQ,WAAA,EAAAC,WAZpC,IAACP,CAY8C,GAEvE,CAAA"}
|
package/dist/bff.esm.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import proxy from 'express-http-proxy';
|
|
2
|
-
|
|
3
|
-
var requireOAuth = function requireOAuth(req) {
|
|
4
|
-
return /(^undefined$)|(^Bearer .+$)/gim.test(req.headers.authorization || "");
|
|
5
|
-
};
|
|
6
|
-
var proxyConfig = function proxyConfig(methods, proxyReqPathResolver) {
|
|
7
|
-
var httpMethods = Array.isArray(methods) ? methods : [methods];
|
|
8
|
-
return {
|
|
9
|
-
filter: function filter(req) {
|
|
10
|
-
return httpMethods.includes(req.method) && requireOAuth(req);
|
|
11
|
-
},
|
|
12
|
-
proxyReqPathResolver: proxyReqPathResolver,
|
|
13
|
-
proxyReqBodyDecorator: function proxyReqBodyDecorator(bodyContent, _srcReq) {
|
|
14
|
-
return bodyContent;
|
|
15
|
-
},
|
|
16
|
-
limit: (process.env.UPLOAD_LIMIT_MB || 200) + "mb"
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
var stripTrailingSlash = function stripTrailingSlash(url) {
|
|
20
|
-
return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
|
|
21
|
-
};
|
|
22
|
-
// forwards a call of a specific url / set of methods to a remote server
|
|
23
|
-
var forwardingProxy = function forwardingProxy(apiUrl) {
|
|
24
|
-
return function (method, forwardPath) {
|
|
25
|
-
return proxy(apiUrl, proxyConfig(method, function () {
|
|
26
|
-
return stripTrailingSlash(new URL(apiUrl).pathname) + forwardPath.apply(void 0, arguments);
|
|
27
|
-
}));
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { forwardingProxy, proxyConfig };
|
|
32
|
-
//# sourceMappingURL=bff.esm.js.map
|
package/dist/bff.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,4 +0,0 @@
|
|
|
1
|
-
import type { Request } from "express";
|
|
2
|
-
import proxy, { type ProxyOptions } from "express-http-proxy";
|
|
3
|
-
export declare const proxyConfig: (methods: string[], proxyReqPathResolver: Required<ProxyOptions>["proxyReqPathResolver"]) => Parameters<typeof proxy>[1];
|
|
4
|
-
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./forwardingproxy";
|