@fedify/nestjs 1.9.0-dev.1408 → 1.9.0-dev.1425

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 CHANGED
@@ -71,6 +71,8 @@ import {
71
71
  NestModule,
72
72
  RequestMethod,
73
73
  } from '@nestjs/common';
74
+ import { ConfigModule } from '@nestjs/config';
75
+ import * as express from 'express';
74
76
  import { AppController } from './app.controller';
75
77
  import { AppService } from './app.service';
76
78
  import { DatabaseModule } from './database/database.module';
@@ -117,8 +119,12 @@ export class AppModule implements NestModule {
117
119
  },
118
120
  );
119
121
 
120
- // Apply middleware to all routes except auth endpoints
121
- consumer.apply(fedifyMiddleware)
122
+ // Fedify middleware requires the raw request body for HTTP signature verification
123
+ // so we apply `express.raw()` before `fedifyMiddleware` to preserve the body.
124
+ consumer.apply(
125
+ express.raw({ type: '*/*' }),
126
+ fedifyMiddleware,
127
+ ).forRoutes({ path: '*', method: RequestMethod.ALL
122
128
  }
123
129
  }
124
130
 
package/dist/index.js CHANGED
@@ -27,7 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  const __nestjs_common = __toESM(require("@nestjs/common"));
28
28
  const __fedify_fedify = __toESM(require("@fedify/fedify"));
29
29
  const node_buffer = __toESM(require("node:buffer"));
30
- const node_stream = __toESM(require("node:stream"));
31
30
 
32
31
  //#region src/fedify.constants.ts
33
32
  const FEDIFY_FEDERATION = "FEDIFY_FEDERATION";
@@ -115,7 +114,7 @@ function fromERequest(req) {
115
114
  method: req.method,
116
115
  headers,
117
116
  duplex: "half",
118
- body: req.method === "GET" || req.method === "HEAD" ? void 0 : node_stream.Readable.toWeb(req)
117
+ body: req.method === "GET" || req.method === "HEAD" ? void 0 : req.body && typeof req.body === "object" && !node_buffer.Buffer.isBuffer(req.body) ? JSON.stringify(req.body) : req.body
119
118
  });
120
119
  }
121
120
  function setEResponse(res, response) {
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Injectable, Module } from "@nestjs/common";
2
2
  import { MemoryKvStore, createFederation } from "@fedify/fedify";
3
3
  import { Buffer as Buffer$1 } from "node:buffer";
4
- import { Readable } from "node:stream";
5
4
 
6
5
  //#region rolldown:runtime
7
6
  var __create = Object.create;
@@ -115,7 +114,7 @@ function fromERequest(req) {
115
114
  method: req.method,
116
115
  headers,
117
116
  duplex: "half",
118
- body: req.method === "GET" || req.method === "HEAD" ? void 0 : Readable.toWeb(req)
117
+ body: req.method === "GET" || req.method === "HEAD" ? void 0 : req.body && typeof req.body === "object" && !Buffer$1.isBuffer(req.body) ? JSON.stringify(req.body) : req.body
119
118
  });
120
119
  }
121
120
  function setEResponse(res, response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/nestjs",
3
- "version": "1.9.0-dev.1408+7c78ce1a",
3
+ "version": "1.9.0-dev.1425+2ae57cf6",
4
4
  "description": "Integrate Fedify with Nest.js",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -49,7 +49,7 @@
49
49
  "peerDependencies": {
50
50
  "@nestjs/common": "^11.0.1",
51
51
  "express": "^4.0.0",
52
- "@fedify/fedify": "1.9.0-dev.1408+7c78ce1a"
52
+ "@fedify/fedify": "1.9.0-dev.1425+2ae57cf6"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/express": "^4.0.0",