octalens-mentions 0.0.5 → 0.0.6

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.
@@ -114,6 +114,10 @@ function getMentionTitle(title, body) {
114
114
  }
115
115
  const controller = ({ strapi }) => ({
116
116
  async ingest(ctx) {
117
+ console.log("Raw request body:", JSON.stringify(ctx.request.body, null, 2));
118
+ console.log("###############################");
119
+ console.log("Raw mention data:", ctx.request.body);
120
+ console.log("###############################");
117
121
  const requestBody = ctx.request.body;
118
122
  if (!requestBody?.data) return ctx.badRequest("Missing data in request body");
119
123
  ctx.body = { data: requestBody?.data };
@@ -159,7 +163,26 @@ const controllers = {
159
163
  mention: mention$1,
160
164
  ingest: controller
161
165
  };
162
- const middlewares = {};
166
+ const logRawBody = (config2, { strapi }) => {
167
+ return async (ctx, next) => {
168
+ if (ctx.path === "/api/octalens-mentions/ingest" && ctx.method === "POST") {
169
+ const chunks = [];
170
+ ctx.req.on("data", (chunk) => {
171
+ chunks.push(chunk);
172
+ });
173
+ ctx.req.on("end", () => {
174
+ const rawBody = Buffer.concat(chunks).toString("utf8");
175
+ console.log("=== RAW REQUEST BODY ===");
176
+ console.log(rawBody);
177
+ console.log("=== END RAW REQUEST BODY ===");
178
+ });
179
+ }
180
+ await next();
181
+ };
182
+ };
183
+ const middlewares = {
184
+ logRawBody
185
+ };
163
186
  const policies = {};
164
187
  const adminApiRoutes = [
165
188
  {
@@ -113,6 +113,10 @@ function getMentionTitle(title, body) {
113
113
  }
114
114
  const controller = ({ strapi }) => ({
115
115
  async ingest(ctx) {
116
+ console.log("Raw request body:", JSON.stringify(ctx.request.body, null, 2));
117
+ console.log("###############################");
118
+ console.log("Raw mention data:", ctx.request.body);
119
+ console.log("###############################");
116
120
  const requestBody = ctx.request.body;
117
121
  if (!requestBody?.data) return ctx.badRequest("Missing data in request body");
118
122
  ctx.body = { data: requestBody?.data };
@@ -158,7 +162,26 @@ const controllers = {
158
162
  mention: mention$1,
159
163
  ingest: controller
160
164
  };
161
- const middlewares = {};
165
+ const logRawBody = (config2, { strapi }) => {
166
+ return async (ctx, next) => {
167
+ if (ctx.path === "/api/octalens-mentions/ingest" && ctx.method === "POST") {
168
+ const chunks = [];
169
+ ctx.req.on("data", (chunk) => {
170
+ chunks.push(chunk);
171
+ });
172
+ ctx.req.on("end", () => {
173
+ const rawBody = Buffer.concat(chunks).toString("utf8");
174
+ console.log("=== RAW REQUEST BODY ===");
175
+ console.log(rawBody);
176
+ console.log("=== END RAW REQUEST BODY ===");
177
+ });
178
+ }
179
+ await next();
180
+ };
181
+ };
182
+ const middlewares = {
183
+ logRawBody
184
+ };
162
185
  const policies = {};
163
186
  const adminApiRoutes = [
164
187
  {
@@ -137,6 +137,10 @@ declare const _default: {
137
137
  };
138
138
  };
139
139
  policies: {};
140
- middlewares: {};
140
+ middlewares: {
141
+ logRawBody: (config: any, { strapi }: {
142
+ strapi: import("@strapi/types/dist/core").Strapi;
143
+ }) => (ctx: any, next: any) => Promise<void>;
144
+ };
141
145
  };
142
146
  export default _default;
@@ -1,2 +1,6 @@
1
- declare const _default: {};
1
+ declare const _default: {
2
+ logRawBody: (config: any, { strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => (ctx: any, next: any) => Promise<void>;
5
+ };
2
6
  export default _default;
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const _default: (config: any, { strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => (ctx: any, next: any) => Promise<void>;
5
+ export default _default;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.5",
2
+ "version": "0.0.6",
3
3
  "keywords": [],
4
4
  "type": "commonjs",
5
5
  "exports": {