@sonicjs-cms/core 2.0.0-beta.1 → 2.0.0-beta.3
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/{chunk-QUMBDPNJ.cjs → chunk-4MZPFGLT.cjs} +31 -31
- package/dist/{chunk-QUMBDPNJ.cjs.map → chunk-4MZPFGLT.cjs.map} +1 -1
- package/dist/{chunk-RGCQSFKC.cjs → chunk-NK6FN5R5.cjs} +10 -2
- package/dist/chunk-NK6FN5R5.cjs.map +1 -0
- package/dist/{chunk-JIINOD2W.js → chunk-OL2OE3VJ.js} +9 -3
- package/dist/chunk-OL2OE3VJ.js.map +1 -0
- package/dist/{chunk-JETM2U2D.js → chunk-Q3KCKPHE.js} +3 -3
- package/dist/{chunk-JETM2U2D.js.map → chunk-Q3KCKPHE.js.map} +1 -1
- package/dist/index.cjs +48 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/routes.cjs +19 -19
- package/dist/routes.js +2 -2
- package/dist/utils.cjs +18 -10
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JIINOD2W.js.map +0 -1
- package/dist/chunk-RGCQSFKC.cjs.map +0 -1
|
@@ -4,7 +4,7 @@ var chunkAGOE25LF_cjs = require('./chunk-AGOE25LF.cjs');
|
|
|
4
4
|
var chunkBUKT6HP5_cjs = require('./chunk-BUKT6HP5.cjs');
|
|
5
5
|
var chunkRNR4HA23_cjs = require('./chunk-RNR4HA23.cjs');
|
|
6
6
|
var chunkET5I4GBD_cjs = require('./chunk-ET5I4GBD.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkNK6FN5R5_cjs = require('./chunk-NK6FN5R5.cjs');
|
|
8
8
|
var hono = require('hono');
|
|
9
9
|
var cors = require('hono/cors');
|
|
10
10
|
var zod = require('zod');
|
|
@@ -333,12 +333,12 @@ apiRoutes.get("/content", async (c) => {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
const filter =
|
|
336
|
+
const filter = chunkNK6FN5R5_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
337
337
|
if (!filter.limit) {
|
|
338
338
|
filter.limit = 50;
|
|
339
339
|
}
|
|
340
340
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
341
|
-
const builder = new
|
|
341
|
+
const builder = new chunkNK6FN5R5_cjs.QueryFilterBuilder();
|
|
342
342
|
const queryResult = builder.build("content", filter);
|
|
343
343
|
if (queryResult.errors.length > 0) {
|
|
344
344
|
return c.json({
|
|
@@ -425,7 +425,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
425
425
|
if (!collectionResult) {
|
|
426
426
|
return c.json({ error: "Collection not found" }, 404);
|
|
427
427
|
}
|
|
428
|
-
const filter =
|
|
428
|
+
const filter = chunkNK6FN5R5_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
429
429
|
if (!filter.where) {
|
|
430
430
|
filter.where = { and: [] };
|
|
431
431
|
}
|
|
@@ -441,7 +441,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
441
441
|
filter.limit = 50;
|
|
442
442
|
}
|
|
443
443
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
444
|
-
const builder = new
|
|
444
|
+
const builder = new chunkNK6FN5R5_cjs.QueryFilterBuilder();
|
|
445
445
|
const queryResult = builder.build("content", filter);
|
|
446
446
|
if (queryResult.errors.length > 0) {
|
|
447
447
|
return c.json({
|
|
@@ -6877,7 +6877,7 @@ function renderUserEditPage(data) {
|
|
|
6877
6877
|
<input
|
|
6878
6878
|
type="text"
|
|
6879
6879
|
name="first_name"
|
|
6880
|
-
value="${
|
|
6880
|
+
value="${chunkNK6FN5R5_cjs.escapeHtml(data.userToEdit.firstName || "")}"
|
|
6881
6881
|
required
|
|
6882
6882
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
6883
6883
|
/>
|
|
@@ -6888,7 +6888,7 @@ function renderUserEditPage(data) {
|
|
|
6888
6888
|
<input
|
|
6889
6889
|
type="text"
|
|
6890
6890
|
name="last_name"
|
|
6891
|
-
value="${
|
|
6891
|
+
value="${chunkNK6FN5R5_cjs.escapeHtml(data.userToEdit.lastName || "")}"
|
|
6892
6892
|
required
|
|
6893
6893
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
6894
6894
|
/>
|
|
@@ -6899,7 +6899,7 @@ function renderUserEditPage(data) {
|
|
|
6899
6899
|
<input
|
|
6900
6900
|
type="text"
|
|
6901
6901
|
name="username"
|
|
6902
|
-
value="${
|
|
6902
|
+
value="${chunkNK6FN5R5_cjs.escapeHtml(data.userToEdit.username || "")}"
|
|
6903
6903
|
required
|
|
6904
6904
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
6905
6905
|
/>
|
|
@@ -6910,7 +6910,7 @@ function renderUserEditPage(data) {
|
|
|
6910
6910
|
<input
|
|
6911
6911
|
type="email"
|
|
6912
6912
|
name="email"
|
|
6913
|
-
value="${
|
|
6913
|
+
value="${chunkNK6FN5R5_cjs.escapeHtml(data.userToEdit.email || "")}"
|
|
6914
6914
|
required
|
|
6915
6915
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
6916
6916
|
/>
|
|
@@ -6921,7 +6921,7 @@ function renderUserEditPage(data) {
|
|
|
6921
6921
|
<input
|
|
6922
6922
|
type="tel"
|
|
6923
6923
|
name="phone"
|
|
6924
|
-
value="${
|
|
6924
|
+
value="${chunkNK6FN5R5_cjs.escapeHtml(data.userToEdit.phone || "")}"
|
|
6925
6925
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
6926
6926
|
/>
|
|
6927
6927
|
</div>
|
|
@@ -6935,7 +6935,7 @@ function renderUserEditPage(data) {
|
|
|
6935
6935
|
class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-8 text-base text-zinc-950 dark:text-white outline outline-1 -outline-offset-1 outline-zinc-500/30 dark:outline-zinc-400/30 *:bg-white dark:*:bg-zinc-800 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zinc-500 dark:focus-visible:outline-zinc-400 sm:text-sm/6"
|
|
6936
6936
|
>
|
|
6937
6937
|
${data.roles.map((role) => `
|
|
6938
|
-
<option value="${
|
|
6938
|
+
<option value="${chunkNK6FN5R5_cjs.escapeHtml(role.value)}" ${data.userToEdit.role === role.value ? "selected" : ""}>${chunkNK6FN5R5_cjs.escapeHtml(role.label)}</option>
|
|
6939
6939
|
`).join("")}
|
|
6940
6940
|
</select>
|
|
6941
6941
|
<svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-zinc-600 dark:text-zinc-400 sm:size-4">
|
|
@@ -6951,7 +6951,7 @@ function renderUserEditPage(data) {
|
|
|
6951
6951
|
name="bio"
|
|
6952
6952
|
rows="3"
|
|
6953
6953
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
6954
|
-
>${
|
|
6954
|
+
>${chunkNK6FN5R5_cjs.escapeHtml(data.userToEdit.bio || "")}</textarea>
|
|
6955
6955
|
</div>
|
|
6956
6956
|
</div>
|
|
6957
6957
|
|
|
@@ -7947,12 +7947,12 @@ userRoutes.put("/profile", async (c) => {
|
|
|
7947
7947
|
const db = c.env.DB;
|
|
7948
7948
|
try {
|
|
7949
7949
|
const formData = await c.req.formData();
|
|
7950
|
-
const firstName =
|
|
7951
|
-
const lastName =
|
|
7952
|
-
const username =
|
|
7950
|
+
const firstName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
7951
|
+
const lastName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
7952
|
+
const username = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
7953
7953
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
7954
|
-
const phone =
|
|
7955
|
-
const bio =
|
|
7954
|
+
const phone = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
7955
|
+
const bio = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
7956
7956
|
const timezone = formData.get("timezone")?.toString() || "UTC";
|
|
7957
7957
|
const language = formData.get("language")?.toString() || "en";
|
|
7958
7958
|
const emailNotifications = formData.get("email_notifications") === "1";
|
|
@@ -8319,12 +8319,12 @@ userRoutes.post("/users/new", chunkBUKT6HP5_cjs.requirePermission("users.create"
|
|
|
8319
8319
|
const user = c.get("user");
|
|
8320
8320
|
try {
|
|
8321
8321
|
const formData = await c.req.formData();
|
|
8322
|
-
const firstName =
|
|
8323
|
-
const lastName =
|
|
8324
|
-
const username =
|
|
8322
|
+
const firstName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8323
|
+
const lastName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8324
|
+
const username = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
8325
8325
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8326
|
-
const phone =
|
|
8327
|
-
const bio =
|
|
8326
|
+
const phone = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
8327
|
+
const bio = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
8328
8328
|
const role = formData.get("role")?.toString() || "viewer";
|
|
8329
8329
|
const password = formData.get("password")?.toString() || "";
|
|
8330
8330
|
const confirmPassword = formData.get("confirm_password")?.toString() || "";
|
|
@@ -8525,12 +8525,12 @@ userRoutes.put("/users/:id", chunkBUKT6HP5_cjs.requirePermission("users.update")
|
|
|
8525
8525
|
const userId = c.req.param("id");
|
|
8526
8526
|
try {
|
|
8527
8527
|
const formData = await c.req.formData();
|
|
8528
|
-
const firstName =
|
|
8529
|
-
const lastName =
|
|
8530
|
-
const username =
|
|
8528
|
+
const firstName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8529
|
+
const lastName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8530
|
+
const username = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
8531
8531
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8532
|
-
const phone =
|
|
8533
|
-
const bio =
|
|
8532
|
+
const phone = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
8533
|
+
const bio = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
8534
8534
|
const role = formData.get("role")?.toString() || "viewer";
|
|
8535
8535
|
const isActive = formData.get("is_active") === "1";
|
|
8536
8536
|
const emailVerified = formData.get("email_verified") === "1";
|
|
@@ -8673,8 +8673,8 @@ userRoutes.post("/invite-user", chunkBUKT6HP5_cjs.requirePermission("users.creat
|
|
|
8673
8673
|
const formData = await c.req.formData();
|
|
8674
8674
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8675
8675
|
const role = formData.get("role")?.toString()?.trim() || "viewer";
|
|
8676
|
-
const firstName =
|
|
8677
|
-
const lastName =
|
|
8676
|
+
const firstName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8677
|
+
const lastName = chunkNK6FN5R5_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8678
8678
|
if (!email || !firstName || !lastName) {
|
|
8679
8679
|
return c.json({ error: "Email, first name, and last name are required" }, 400);
|
|
8680
8680
|
}
|
|
@@ -15797,5 +15797,5 @@ exports.api_media_default = api_media_default;
|
|
|
15797
15797
|
exports.api_system_default = api_system_default;
|
|
15798
15798
|
exports.auth_default = auth_default;
|
|
15799
15799
|
exports.userRoutes = userRoutes;
|
|
15800
|
-
//# sourceMappingURL=chunk-
|
|
15801
|
-
//# sourceMappingURL=chunk-
|
|
15800
|
+
//# sourceMappingURL=chunk-4MZPFGLT.cjs.map
|
|
15801
|
+
//# sourceMappingURL=chunk-4MZPFGLT.cjs.map
|