octalens-mentions 0.0.5 → 0.0.7
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/server/index.js
CHANGED
|
@@ -4,6 +4,19 @@ const bootstrap = ({ strapi }) => {
|
|
|
4
4
|
const destroy = ({ strapi }) => {
|
|
5
5
|
};
|
|
6
6
|
const register = ({ strapi }) => {
|
|
7
|
+
strapi.server.use(async (ctx, next) => {
|
|
8
|
+
if (ctx.path === "/api/octalens-mentions/ingest" && ctx.method === "POST") {
|
|
9
|
+
console.log("=== INGEST REQUEST RECEIVED ===");
|
|
10
|
+
console.log("Path:", ctx.path);
|
|
11
|
+
console.log("Method:", ctx.method);
|
|
12
|
+
console.log("Content-Type:", ctx.request.headers["content-type"]);
|
|
13
|
+
if (ctx.request.body) {
|
|
14
|
+
console.log("Parsed Body:", JSON.stringify(ctx.request.body, null, 2));
|
|
15
|
+
}
|
|
16
|
+
console.log("=================================");
|
|
17
|
+
}
|
|
18
|
+
await next();
|
|
19
|
+
});
|
|
7
20
|
};
|
|
8
21
|
const config = {
|
|
9
22
|
default: {},
|
|
@@ -114,6 +127,10 @@ function getMentionTitle(title, body) {
|
|
|
114
127
|
}
|
|
115
128
|
const controller = ({ strapi }) => ({
|
|
116
129
|
async ingest(ctx) {
|
|
130
|
+
console.log("Raw request body:", JSON.stringify(ctx.request.body, null, 2));
|
|
131
|
+
console.log("###############################");
|
|
132
|
+
console.log("Raw mention data:", ctx.request.body);
|
|
133
|
+
console.log("###############################");
|
|
117
134
|
const requestBody = ctx.request.body;
|
|
118
135
|
if (!requestBody?.data) return ctx.badRequest("Missing data in request body");
|
|
119
136
|
ctx.body = { data: requestBody?.data };
|
|
@@ -159,7 +176,26 @@ const controllers = {
|
|
|
159
176
|
mention: mention$1,
|
|
160
177
|
ingest: controller
|
|
161
178
|
};
|
|
162
|
-
const
|
|
179
|
+
const logRawBody = (config2, { strapi }) => {
|
|
180
|
+
return async (ctx, next) => {
|
|
181
|
+
if (ctx.path === "/api/octalens-mentions/ingest" && ctx.method === "POST") {
|
|
182
|
+
const chunks = [];
|
|
183
|
+
ctx.req.on("data", (chunk) => {
|
|
184
|
+
chunks.push(chunk);
|
|
185
|
+
});
|
|
186
|
+
ctx.req.on("end", () => {
|
|
187
|
+
const rawBody = Buffer.concat(chunks).toString("utf8");
|
|
188
|
+
console.log("=== RAW REQUEST BODY ===");
|
|
189
|
+
console.log(rawBody);
|
|
190
|
+
console.log("=== END RAW REQUEST BODY ===");
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
await next();
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
const middlewares = {
|
|
197
|
+
logRawBody
|
|
198
|
+
};
|
|
163
199
|
const policies = {};
|
|
164
200
|
const adminApiRoutes = [
|
|
165
201
|
{
|
package/dist/server/index.mjs
CHANGED
|
@@ -3,6 +3,19 @@ const bootstrap = ({ strapi }) => {
|
|
|
3
3
|
const destroy = ({ strapi }) => {
|
|
4
4
|
};
|
|
5
5
|
const register = ({ strapi }) => {
|
|
6
|
+
strapi.server.use(async (ctx, next) => {
|
|
7
|
+
if (ctx.path === "/api/octalens-mentions/ingest" && ctx.method === "POST") {
|
|
8
|
+
console.log("=== INGEST REQUEST RECEIVED ===");
|
|
9
|
+
console.log("Path:", ctx.path);
|
|
10
|
+
console.log("Method:", ctx.method);
|
|
11
|
+
console.log("Content-Type:", ctx.request.headers["content-type"]);
|
|
12
|
+
if (ctx.request.body) {
|
|
13
|
+
console.log("Parsed Body:", JSON.stringify(ctx.request.body, null, 2));
|
|
14
|
+
}
|
|
15
|
+
console.log("=================================");
|
|
16
|
+
}
|
|
17
|
+
await next();
|
|
18
|
+
});
|
|
6
19
|
};
|
|
7
20
|
const config = {
|
|
8
21
|
default: {},
|
|
@@ -113,6 +126,10 @@ function getMentionTitle(title, body) {
|
|
|
113
126
|
}
|
|
114
127
|
const controller = ({ strapi }) => ({
|
|
115
128
|
async ingest(ctx) {
|
|
129
|
+
console.log("Raw request body:", JSON.stringify(ctx.request.body, null, 2));
|
|
130
|
+
console.log("###############################");
|
|
131
|
+
console.log("Raw mention data:", ctx.request.body);
|
|
132
|
+
console.log("###############################");
|
|
116
133
|
const requestBody = ctx.request.body;
|
|
117
134
|
if (!requestBody?.data) return ctx.badRequest("Missing data in request body");
|
|
118
135
|
ctx.body = { data: requestBody?.data };
|
|
@@ -158,7 +175,26 @@ const controllers = {
|
|
|
158
175
|
mention: mention$1,
|
|
159
176
|
ingest: controller
|
|
160
177
|
};
|
|
161
|
-
const
|
|
178
|
+
const logRawBody = (config2, { strapi }) => {
|
|
179
|
+
return async (ctx, next) => {
|
|
180
|
+
if (ctx.path === "/api/octalens-mentions/ingest" && ctx.method === "POST") {
|
|
181
|
+
const chunks = [];
|
|
182
|
+
ctx.req.on("data", (chunk) => {
|
|
183
|
+
chunks.push(chunk);
|
|
184
|
+
});
|
|
185
|
+
ctx.req.on("end", () => {
|
|
186
|
+
const rawBody = Buffer.concat(chunks).toString("utf8");
|
|
187
|
+
console.log("=== RAW REQUEST BODY ===");
|
|
188
|
+
console.log(rawBody);
|
|
189
|
+
console.log("=== END RAW REQUEST BODY ===");
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
await next();
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
const middlewares = {
|
|
196
|
+
logRawBody
|
|
197
|
+
};
|
|
162
198
|
const policies = {};
|
|
163
199
|
const adminApiRoutes = [
|
|
164
200
|
{
|
|
@@ -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;
|
package/package.json
CHANGED