@yimingliao/cms 0.0.165 → 0.0.168
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/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +1 -1
- package/dist/src/server/infrastructure/cookie/cookie.service.js +2 -2
- package/dist/src/server/infrastructure/zod/schemas/schemas.js +0 -8
- package/dist/src/server/interfaces/actions/resources/admin/commands/create/admin-create-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/admin/commands/update/admin-update-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/file/commands/create/file-create-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/file/commands/create-many/file-create-many-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/file/commands/update/file-update-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/post/commands/create/post-create-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/post/commands/update/post-update-validator.js +1 -1
- package/dist/src/server/interfaces/actions/resources/seo-metadata/commands/upsert/seo-metadata-upsert-validator.js +1 -1
- package/dist/src/server/interfaces/apis/file-upload/validator.js +1 -1
- package/dist/types/src/server/infrastructure/cookie/cookie.service.d.ts +6 -1
- package/dist/types/src/server/infrastructure/cookie/cookie.service.d.ts.map +1 -1
- package/dist/types/src/server/infrastructure/zod/schemas/schemas.d.ts +1 -3
- package/dist/types/src/server/infrastructure/zod/schemas/schemas.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,14 +6,14 @@ const DEFAULT_OPTIONS = {
|
|
|
6
6
|
sameSite: "strict",
|
|
7
7
|
path: "/"
|
|
8
8
|
};
|
|
9
|
-
function createCookieService(nextCookies, cryptoService) {
|
|
9
|
+
function createCookieService(nextCookies, cryptoService, options = DEFAULT_OPTIONS) {
|
|
10
10
|
async function set({
|
|
11
11
|
name,
|
|
12
12
|
value,
|
|
13
13
|
expireSeconds
|
|
14
14
|
}) {
|
|
15
15
|
const cookieStore = await nextCookies();
|
|
16
|
-
cookieStore.set(name, value, { ...
|
|
16
|
+
cookieStore.set(name, value, { ...options, maxAge: expireSeconds });
|
|
17
17
|
}
|
|
18
18
|
async function setSignedCookie({
|
|
19
19
|
name,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
function createSchemas({
|
|
2
2
|
z,
|
|
3
|
-
localeArray,
|
|
4
3
|
exist
|
|
5
4
|
}) {
|
|
6
5
|
const trimmedString = () => z.string().trim();
|
|
7
6
|
const MAX_NUMBER = 2147483647;
|
|
8
7
|
const MAX_STRING = 1e5;
|
|
9
|
-
const localeSet = new Set(localeArray);
|
|
10
8
|
function text() {
|
|
11
9
|
return trimmedString().max(MAX_STRING);
|
|
12
10
|
}
|
|
@@ -55,11 +53,6 @@ function createSchemas({
|
|
|
55
53
|
function pathSegment() {
|
|
56
54
|
return trimmedString().min(1).regex(/^(?!\.\.?$)[^\u0000-\u001F/\\]+$/u).max(255);
|
|
57
55
|
}
|
|
58
|
-
function locale() {
|
|
59
|
-
return trimmedString().refine((val) => localeSet.has(val), {
|
|
60
|
-
error: "Invalid locale"
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
56
|
function singleItem(options) {
|
|
64
57
|
return z.object({
|
|
65
58
|
id: id().refine((v) => exist(v, options), {
|
|
@@ -92,7 +85,6 @@ function createSchemas({
|
|
|
92
85
|
sha256Hash,
|
|
93
86
|
slug,
|
|
94
87
|
pathSegment,
|
|
95
|
-
locale,
|
|
96
88
|
// item
|
|
97
89
|
singleItem,
|
|
98
90
|
multiItems
|
package/dist/src/server/interfaces/actions/resources/file/commands/create/file-create-validator.js
CHANGED
|
@@ -26,7 +26,7 @@ const fileCreateValidator = (schemas) => schemas.z.object({
|
|
|
26
26
|
translations: schemas.array(
|
|
27
27
|
schemas.z.object({
|
|
28
28
|
// core
|
|
29
|
-
locale: schemas.
|
|
29
|
+
locale: schemas.text(),
|
|
30
30
|
// text
|
|
31
31
|
name: schemas.text().nullable(),
|
|
32
32
|
alt: schemas.text().nullable()
|
|
@@ -20,7 +20,7 @@ const fileCreateManyValidator = (schemas) => schemas.z.object({
|
|
|
20
20
|
translations: schemas.array(
|
|
21
21
|
schemas.z.object({
|
|
22
22
|
// core
|
|
23
|
-
locale: schemas.
|
|
23
|
+
locale: schemas.text(),
|
|
24
24
|
// text
|
|
25
25
|
name: schemas.text().nullable(),
|
|
26
26
|
alt: schemas.text().nullable()
|
package/dist/src/server/interfaces/actions/resources/file/commands/update/file-update-validator.js
CHANGED
|
@@ -24,7 +24,7 @@ const fileUpdateValidator = (schemas) => schemas.z.object({
|
|
|
24
24
|
translations: schemas.array(
|
|
25
25
|
schemas.z.object({
|
|
26
26
|
// core
|
|
27
|
-
locale: schemas.
|
|
27
|
+
locale: schemas.text(),
|
|
28
28
|
// text
|
|
29
29
|
name: schemas.text().nullable(),
|
|
30
30
|
alt: schemas.text().nullable()
|
package/dist/src/server/interfaces/actions/resources/post/commands/create/post-create-validator.js
CHANGED
|
@@ -87,7 +87,7 @@ const postCreateValidator = ({
|
|
|
87
87
|
// ----------------------------------------------------------------------------
|
|
88
88
|
translations: schemas.array(
|
|
89
89
|
schemas.z.object({
|
|
90
|
-
locale: schemas.
|
|
90
|
+
locale: schemas.text(),
|
|
91
91
|
// text
|
|
92
92
|
title: schemas.text().nullable(),
|
|
93
93
|
subtitle: schemas.text().nullable(),
|
package/dist/src/server/interfaces/actions/resources/post/commands/update/post-update-validator.js
CHANGED
|
@@ -89,7 +89,7 @@ const postUpdateValidator = ({
|
|
|
89
89
|
// ----------------------------------------------------------------------------
|
|
90
90
|
translations: schemas.array(
|
|
91
91
|
schemas.z.object({
|
|
92
|
-
locale: schemas.
|
|
92
|
+
locale: schemas.text(),
|
|
93
93
|
// text
|
|
94
94
|
title: schemas.text().nullable(),
|
|
95
95
|
subtitle: schemas.text().nullable(),
|
|
@@ -13,7 +13,7 @@ const seoMetadataUpsertValidator = (schemas) => schemas.z.object({
|
|
|
13
13
|
translations: schemas.array(
|
|
14
14
|
schemas.z.object({
|
|
15
15
|
// core
|
|
16
|
-
locale: schemas.
|
|
16
|
+
locale: schemas.text(),
|
|
17
17
|
// ---------------------------------------------------
|
|
18
18
|
// Basic
|
|
19
19
|
// ---------------------------------------------------
|
|
@@ -4,7 +4,7 @@ const fileUploadValidator = (schemas) => schemas.z.object({
|
|
|
4
4
|
//====== Translations ======
|
|
5
5
|
translations: schemas.array(
|
|
6
6
|
schemas.z.object({
|
|
7
|
-
locale: schemas.
|
|
7
|
+
locale: schemas.text(),
|
|
8
8
|
name: schemas.text().nullable(),
|
|
9
9
|
alt: schemas.text().nullable()
|
|
10
10
|
})
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { createCryptoService } from "../crypto";
|
|
2
2
|
import type { cookies } from "next/headers";
|
|
3
|
-
export declare function createCookieService(nextCookies: () => Promise<Awaited<ReturnType<typeof cookies>>>, cryptoService: ReturnType<typeof createCryptoService
|
|
3
|
+
export declare function createCookieService(nextCookies: () => Promise<Awaited<ReturnType<typeof cookies>>>, cryptoService: ReturnType<typeof createCryptoService>, options?: {
|
|
4
|
+
httpOnly: boolean;
|
|
5
|
+
secure: boolean;
|
|
6
|
+
sameSite: "strict";
|
|
7
|
+
path: string;
|
|
8
|
+
}): {
|
|
4
9
|
set: ({ name, value, expireSeconds, }: {
|
|
5
10
|
name: string;
|
|
6
11
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.service.d.ts","sourceRoot":"","sources":["../../../../../../src/server/infrastructure/cookie/cookie.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAU5C,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,EAC/D,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cookie.service.d.ts","sourceRoot":"","sources":["../../../../../../src/server/infrastructure/cookie/cookie.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAU5C,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,EAC/D,aAAa,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,EACrD,OAAO;;;;;CAAkB;2CAStB;QACD,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;KACvB;uDASE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;KACvB;oBAa4B;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;gCAMlC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;qCASjB;QAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;uBA2ChC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;EAgBvD"}
|
|
@@ -2,9 +2,8 @@ import type { createZod } from "../create-zod";
|
|
|
2
2
|
import type { createExist, ExistOptions } from "../rules/exist";
|
|
3
3
|
import type zod from "zod";
|
|
4
4
|
import type { ZodType } from "zod";
|
|
5
|
-
export declare function createSchemas({ z,
|
|
5
|
+
export declare function createSchemas({ z, exist, }: {
|
|
6
6
|
z: ReturnType<typeof createZod>;
|
|
7
|
-
localeArray: string[];
|
|
8
7
|
exist: ReturnType<typeof createExist>;
|
|
9
8
|
}): {
|
|
10
9
|
z: typeof zod;
|
|
@@ -20,7 +19,6 @@ export declare function createSchemas({ z, localeArray, exist, }: {
|
|
|
20
19
|
sha256Hash: () => zod.ZodString;
|
|
21
20
|
slug: () => zod.ZodString;
|
|
22
21
|
pathSegment: () => zod.ZodString;
|
|
23
|
-
locale: () => zod.ZodString;
|
|
24
22
|
singleItem: (options: ExistOptions) => zod.ZodNullable<zod.ZodObject<{
|
|
25
23
|
id: zod.ZodString;
|
|
26
24
|
}, zod.core.$strip>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/zod/schemas/schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,wBAAgB,aAAa,CAAC,EAC5B,CAAC,EACD,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/zod/schemas/schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,wBAAgB,aAAa,CAAC,EAC5B,CAAC,EACD,KAAK,GACN,EAAE;IACD,CAAC,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;IAChC,KAAK,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;CACvC;;;;;;;;YA0CgB,CAAC,SAAS,OAAO,UAAU,CAAC;;;;;;0BAkDd,YAAY;;;0BAUZ,YAAY;;;;;;;EA8B1C"}
|