@bygghammar/cms-platform 0.57.0 → 0.57.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.
- package/package.json +1 -1
- package/src/server/schemas.ts +11 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bygghammar/cms-platform",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.1",
|
|
4
4
|
"description": "Shared CMS platform: blocks, block types, i18n core, UI primitives and design-token contract used by every Bygghammar/Voyara site.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
package/src/server/schemas.ts
CHANGED
|
@@ -85,11 +85,11 @@ export const pageSchemas = {
|
|
|
85
85
|
* Administration inputs. Roles and provider kinds come from the platform's
|
|
86
86
|
* own enums, which the caller passes so a site cannot drift from them.
|
|
87
87
|
*/
|
|
88
|
-
export function adminSchemas(input: {
|
|
89
|
-
roles: readonly [
|
|
90
|
-
providerKinds: readonly [
|
|
88
|
+
export function adminSchemas<R extends string, K extends string>(input: {
|
|
89
|
+
roles: readonly [R, ...R[]];
|
|
90
|
+
providerKinds: readonly [K, ...K[]];
|
|
91
91
|
}) {
|
|
92
|
-
const role = z.enum(input.roles);
|
|
92
|
+
const role = z.enum(input.roles as unknown as [R, ...R[]]);
|
|
93
93
|
return {
|
|
94
94
|
role,
|
|
95
95
|
createUser: z.object({
|
|
@@ -114,7 +114,7 @@ export function adminSchemas(input: {
|
|
|
114
114
|
emailProvider: z.object({
|
|
115
115
|
id: uuid.optional(),
|
|
116
116
|
name: z.string().min(1).max(120),
|
|
117
|
-
kind: z.enum(input.providerKinds),
|
|
117
|
+
kind: z.enum(input.providerKinds as unknown as [K, ...K[]]),
|
|
118
118
|
is_active: z.boolean().default(true),
|
|
119
119
|
sort_order: z.number().int().min(0).max(9999).default(100),
|
|
120
120
|
from_name: z.string().max(200).nullable().optional(),
|
|
@@ -209,9 +209,9 @@ const localizedImage = z
|
|
|
209
209
|
* everything else — the localized string/image shape, the allowed Open Graph
|
|
210
210
|
* and Twitter values, the slug map — is a platform contract.
|
|
211
211
|
*/
|
|
212
|
-
export function pageSeoSchemas(input: {
|
|
213
|
-
pageKeys: readonly [
|
|
214
|
-
locales: readonly [
|
|
212
|
+
export function pageSeoSchemas<P extends string, L extends string>(input: {
|
|
213
|
+
pageKeys: readonly [P, ...P[]];
|
|
214
|
+
locales: readonly [L, ...L[]];
|
|
215
215
|
}) {
|
|
216
216
|
const seo = z
|
|
217
217
|
.object({
|
|
@@ -224,7 +224,7 @@ export function pageSeoSchemas(input: {
|
|
|
224
224
|
twitterCard: z.enum(["summary", "summary_large_image"]).optional(),
|
|
225
225
|
keywords: localizedString.optional(),
|
|
226
226
|
robots: z.string().max(120).optional(),
|
|
227
|
-
jsonLd: z.record(z.enum(input.locales), z.record(z.string(), z.unknown())).optional(),
|
|
227
|
+
jsonLd: z.record(z.enum(input.locales as unknown as [L, ...L[]]), z.record(z.string(), z.unknown())).optional(),
|
|
228
228
|
})
|
|
229
229
|
.strict();
|
|
230
230
|
|
|
@@ -233,8 +233,8 @@ export function pageSeoSchemas(input: {
|
|
|
233
233
|
return {
|
|
234
234
|
seo,
|
|
235
235
|
slugs,
|
|
236
|
-
save: z.object({ pageKey: z.enum(input.pageKeys), slugs, seo }),
|
|
237
|
-
delete: z.object({ pageKey: z.enum(input.pageKeys) }),
|
|
236
|
+
save: z.object({ pageKey: z.enum(input.pageKeys as unknown as [P, ...P[]]), slugs, seo }),
|
|
237
|
+
delete: z.object({ pageKey: z.enum(input.pageKeys as unknown as [P, ...P[]]) }),
|
|
238
238
|
} as const;
|
|
239
239
|
}
|
|
240
240
|
|