@easy-cms/core 0.65.0 → 0.66.1
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.
|
@@ -4709,6 +4709,7 @@ function validateConfig(config) {
|
|
|
4709
4709
|
validateCors(config.cors, add);
|
|
4710
4710
|
validateLocalization(config, add);
|
|
4711
4711
|
validateWebhooks(config, add);
|
|
4712
|
+
warnNestedUnique(config, (issue) => issues.push(issue));
|
|
4712
4713
|
const collections = asArray(config.collections, "collections", add);
|
|
4713
4714
|
const globals = asArray(config.globals, "globals", add);
|
|
4714
4715
|
const collectionSlugs = /* @__PURE__ */ new Set([...BUILTIN_COLLECTIONS]);
|
|
@@ -4791,6 +4792,31 @@ function validateCronSecret(value, push) {
|
|
|
4791
4792
|
severity: "warning"
|
|
4792
4793
|
});
|
|
4793
4794
|
}
|
|
4795
|
+
function warnNestedUnique(config, push) {
|
|
4796
|
+
const walk = (fields, path, nested) => {
|
|
4797
|
+
for (const field of Array.isArray(fields) ? fields : []) {
|
|
4798
|
+
if (typeof field !== "object" || field === null) continue;
|
|
4799
|
+
const at = `${path}.${String(field.name)}`;
|
|
4800
|
+
if (nested && field.unique === true)
|
|
4801
|
+
push({
|
|
4802
|
+
path: `${at}.unique`,
|
|
4803
|
+
message: "only works on top-level fields; inside a group, array or block it is ignored",
|
|
4804
|
+
hint: "move the field to the top level, or check uniqueness in a beforeValidate hook",
|
|
4805
|
+
severity: "warning"
|
|
4806
|
+
});
|
|
4807
|
+
if (field.type === "group" || field.type === "array") walk(field.fields, `${at}.fields`, true);
|
|
4808
|
+
if (field.type === "blocks")
|
|
4809
|
+
for (const block of Array.isArray(field.blocks) ? field.blocks : [])
|
|
4810
|
+
walk(block?.fields, `${at}.blocks.${String(block?.slug)}`, true);
|
|
4811
|
+
}
|
|
4812
|
+
};
|
|
4813
|
+
for (const [kind, list] of [
|
|
4814
|
+
["collections", config.collections],
|
|
4815
|
+
["globals", config.globals]
|
|
4816
|
+
])
|
|
4817
|
+
for (const container of Array.isArray(list) ? list : [])
|
|
4818
|
+
walk(container?.fields, `${kind}.${String(container?.slug)}.fields`, false);
|
|
4819
|
+
}
|
|
4794
4820
|
function publicURLs(storage) {
|
|
4795
4821
|
const url = storage.url;
|
|
4796
4822
|
try {
|
|
@@ -9182,7 +9208,7 @@ async function readAdminModule(cms, index) {
|
|
|
9182
9208
|
}
|
|
9183
9209
|
|
|
9184
9210
|
// src/version.ts
|
|
9185
|
-
var VERSION = true ? "0.
|
|
9211
|
+
var VERSION = true ? "0.66.1" : "0.0.0-dev";
|
|
9186
9212
|
|
|
9187
9213
|
// src/rest/admin-deliveries.ts
|
|
9188
9214
|
var PER_PAGE = 50;
|
|
@@ -10530,6 +10556,7 @@ async function route(cms, ctx, method, path, options) {
|
|
|
10530
10556
|
}
|
|
10531
10557
|
if (second === "audit" && third === "verify" && segments.length === 3) {
|
|
10532
10558
|
if (method !== "POST") throw methodNotAllowed(ctx, "POST");
|
|
10559
|
+
if (!isSystemAdmin(ctx.user)) throw new ForbiddenError();
|
|
10533
10560
|
return { body: await cms.audit.verify() };
|
|
10534
10561
|
}
|
|
10535
10562
|
if (second !== "audit" || third !== void 0) throw new HttpError("Not found", 404);
|
package/dist/index.js
CHANGED
package/dist/internal.js
CHANGED