@fedify/express 2.3.12-dev.2365 → 2.3.12
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/dist/index.cjs +7 -3
- package/dist/index.js +7 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6,9 +6,10 @@ function integrateFederation(federation, contextDataFactory) {
|
|
|
6
6
|
const body = req.method === "GET" || req.method === "HEAD" ? void 0 : createRequestBody(req);
|
|
7
7
|
const request = fromERequest(req, body?.stream);
|
|
8
8
|
const contextData = contextDataFactory(req);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const contextDataPromise = contextData instanceof Promise ? contextData : Promise.resolve(contextData);
|
|
10
|
+
let notFound = false;
|
|
11
|
+
let notAcceptable = false;
|
|
12
|
+
contextDataPromise.then(async (contextData) => {
|
|
12
13
|
const response = await federation.fetch(request, {
|
|
13
14
|
contextData,
|
|
14
15
|
onNotFound: () => {
|
|
@@ -39,6 +40,9 @@ function integrateFederation(federation, contextDataFactory) {
|
|
|
39
40
|
res.json = () => res;
|
|
40
41
|
res.removeHeader = () => res;
|
|
41
42
|
res.setHeader = () => res;
|
|
43
|
+
}).catch((error) => {
|
|
44
|
+
if (notFound || notAcceptable) throw error;
|
|
45
|
+
next(error === "route" || error === "router" ? new Error(error) : error || /* @__PURE__ */ new Error("The federation middleware promise was rejected."));
|
|
42
46
|
});
|
|
43
47
|
};
|
|
44
48
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,10 @@ function integrateFederation(federation, contextDataFactory) {
|
|
|
5
5
|
const body = req.method === "GET" || req.method === "HEAD" ? void 0 : createRequestBody(req);
|
|
6
6
|
const request = fromERequest(req, body?.stream);
|
|
7
7
|
const contextData = contextDataFactory(req);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const contextDataPromise = contextData instanceof Promise ? contextData : Promise.resolve(contextData);
|
|
9
|
+
let notFound = false;
|
|
10
|
+
let notAcceptable = false;
|
|
11
|
+
contextDataPromise.then(async (contextData) => {
|
|
11
12
|
const response = await federation.fetch(request, {
|
|
12
13
|
contextData,
|
|
13
14
|
onNotFound: () => {
|
|
@@ -38,6 +39,9 @@ function integrateFederation(federation, contextDataFactory) {
|
|
|
38
39
|
res.json = () => res;
|
|
39
40
|
res.removeHeader = () => res;
|
|
40
41
|
res.setHeader = () => res;
|
|
42
|
+
}).catch((error) => {
|
|
43
|
+
if (notFound || notAcceptable) throw error;
|
|
44
|
+
next(error === "route" || error === "router" ? new Error(error) : error || /* @__PURE__ */ new Error("The federation middleware promise was rejected."));
|
|
41
45
|
});
|
|
42
46
|
};
|
|
43
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/express",
|
|
3
|
-
"version": "2.3.12
|
|
3
|
+
"version": "2.3.12",
|
|
4
4
|
"description": "Integrate Fedify with Express",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"express": ">=4.0.0",
|
|
52
|
-
"@fedify/fedify": "^2.3.12
|
|
52
|
+
"@fedify/fedify": "^2.3.12"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/express": "^4.0.0",
|