strapi-plugin-magic-mail 2.10.9 → 2.10.10
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/CHANGELOG.md +7 -0
- package/dist/server/index.js +34 -2
- package/dist/server/index.mjs +34 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [2.10.10](https://github.com/Schero94/Magic-Mail/compare/v2.10.9...v2.10.10) (2026-04-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **validation:** auto-strip Strapi system metadata before .strict() check ([039b889](https://github.com/Schero94/Magic-Mail/commit/039b889d96d6a076e199bec7497304c6900b8165))
|
|
7
|
+
|
|
1
8
|
## [2.10.9](https://github.com/Schero94/Magic-Mail/compare/v2.10.8...v2.10.9) (2026-04-21)
|
|
2
9
|
|
|
3
10
|
|
package/dist/server/index.js
CHANGED
|
@@ -1256,12 +1256,44 @@ const schemas = {
|
|
|
1256
1256
|
phoneNumber: z.string().min(5).max(32).regex(/^[\d+\-() ]+$/)
|
|
1257
1257
|
})
|
|
1258
1258
|
};
|
|
1259
|
+
const STRAPI_METADATA_FIELDS = Object.freeze([
|
|
1260
|
+
"id",
|
|
1261
|
+
"documentId",
|
|
1262
|
+
"createdAt",
|
|
1263
|
+
"updatedAt",
|
|
1264
|
+
"publishedAt",
|
|
1265
|
+
"locale",
|
|
1266
|
+
"localizations",
|
|
1267
|
+
"createdBy",
|
|
1268
|
+
"updatedBy",
|
|
1269
|
+
"__component",
|
|
1270
|
+
// Populated relations/components we never want to round-trip as a write:
|
|
1271
|
+
"versions"
|
|
1272
|
+
]);
|
|
1273
|
+
function stripStrapiMetadata(body, schemaName) {
|
|
1274
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return body;
|
|
1275
|
+
const cleaned = { ...body };
|
|
1276
|
+
const removed = [];
|
|
1277
|
+
for (const key of STRAPI_METADATA_FIELDS) {
|
|
1278
|
+
if (key in cleaned) {
|
|
1279
|
+
delete cleaned[key];
|
|
1280
|
+
removed.push(key);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if (removed.length > 0 && typeof strapi !== "undefined" && strapi?.log?.debug) {
|
|
1284
|
+
strapi.log.debug(
|
|
1285
|
+
`[magic-mail] Stripped Strapi metadata from ${schemaName} payload: ${removed.join(", ")}`
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
return cleaned;
|
|
1289
|
+
}
|
|
1259
1290
|
function validate$5(schemaName, body) {
|
|
1260
1291
|
const schema = schemas[schemaName];
|
|
1261
1292
|
if (!schema) {
|
|
1262
1293
|
throw new Error(`Unknown validation schema: ${schemaName}`);
|
|
1263
1294
|
}
|
|
1264
|
-
const
|
|
1295
|
+
const sanitized = stripStrapiMetadata(body, schemaName);
|
|
1296
|
+
const result2 = schema.safeParse(sanitized);
|
|
1265
1297
|
if (!result2.success) {
|
|
1266
1298
|
const strapiErrors = require$$1__default.default.errors;
|
|
1267
1299
|
const flattened = result2.error.flatten();
|
|
@@ -15877,7 +15909,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
|
|
|
15877
15909
|
return account;
|
|
15878
15910
|
}
|
|
15879
15911
|
});
|
|
15880
|
-
const version = "2.10.
|
|
15912
|
+
const version = "2.10.9";
|
|
15881
15913
|
const require$$2 = {
|
|
15882
15914
|
version
|
|
15883
15915
|
};
|
package/dist/server/index.mjs
CHANGED
|
@@ -1243,12 +1243,44 @@ const schemas = {
|
|
|
1243
1243
|
phoneNumber: z.string().min(5).max(32).regex(/^[\d+\-() ]+$/)
|
|
1244
1244
|
})
|
|
1245
1245
|
};
|
|
1246
|
+
const STRAPI_METADATA_FIELDS = Object.freeze([
|
|
1247
|
+
"id",
|
|
1248
|
+
"documentId",
|
|
1249
|
+
"createdAt",
|
|
1250
|
+
"updatedAt",
|
|
1251
|
+
"publishedAt",
|
|
1252
|
+
"locale",
|
|
1253
|
+
"localizations",
|
|
1254
|
+
"createdBy",
|
|
1255
|
+
"updatedBy",
|
|
1256
|
+
"__component",
|
|
1257
|
+
// Populated relations/components we never want to round-trip as a write:
|
|
1258
|
+
"versions"
|
|
1259
|
+
]);
|
|
1260
|
+
function stripStrapiMetadata(body, schemaName) {
|
|
1261
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return body;
|
|
1262
|
+
const cleaned = { ...body };
|
|
1263
|
+
const removed = [];
|
|
1264
|
+
for (const key of STRAPI_METADATA_FIELDS) {
|
|
1265
|
+
if (key in cleaned) {
|
|
1266
|
+
delete cleaned[key];
|
|
1267
|
+
removed.push(key);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
if (removed.length > 0 && typeof strapi !== "undefined" && strapi?.log?.debug) {
|
|
1271
|
+
strapi.log.debug(
|
|
1272
|
+
`[magic-mail] Stripped Strapi metadata from ${schemaName} payload: ${removed.join(", ")}`
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
return cleaned;
|
|
1276
|
+
}
|
|
1246
1277
|
function validate$5(schemaName, body) {
|
|
1247
1278
|
const schema = schemas[schemaName];
|
|
1248
1279
|
if (!schema) {
|
|
1249
1280
|
throw new Error(`Unknown validation schema: ${schemaName}`);
|
|
1250
1281
|
}
|
|
1251
|
-
const
|
|
1282
|
+
const sanitized = stripStrapiMetadata(body, schemaName);
|
|
1283
|
+
const result2 = schema.safeParse(sanitized);
|
|
1252
1284
|
if (!result2.success) {
|
|
1253
1285
|
const strapiErrors = require$$1$2.errors;
|
|
1254
1286
|
const flattened = result2.error.flatten();
|
|
@@ -15864,7 +15896,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
|
|
|
15864
15896
|
return account;
|
|
15865
15897
|
}
|
|
15866
15898
|
});
|
|
15867
|
-
const version = "2.10.
|
|
15899
|
+
const version = "2.10.9";
|
|
15868
15900
|
const require$$2 = {
|
|
15869
15901
|
version
|
|
15870
15902
|
};
|
package/package.json
CHANGED