mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
feat(federation): ✨ Port to Versia 0.6
This commit is contained in:
parent
de69f27877
commit
fca30b4dad
62 changed files with 1614 additions and 2008 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import { isISOString } from "../regex.ts";
|
||||
import { url } from "./common.ts";
|
||||
import { CustomEmojiExtensionSchema } from "./extensions/emojis.ts";
|
||||
|
||||
export const ExtensionPropertySchema = z
|
||||
|
|
@ -10,14 +9,26 @@ export const ExtensionPropertySchema = z
|
|||
})
|
||||
.catchall(z.any());
|
||||
|
||||
export const ReferenceSchema = z.string();
|
||||
|
||||
export const EntitySchema = z.strictObject({
|
||||
// biome-ignore lint/style/useNamingConvention: required for JSON schema
|
||||
$schema: z.url().nullish(),
|
||||
id: z.string().max(512),
|
||||
id: z
|
||||
.string()
|
||||
.max(512)
|
||||
.regex(
|
||||
// a-z, A-Z, 0-9, - and _
|
||||
/^[A-Za-z0-9\-_]+$/,
|
||||
"can only contain alphanumeric characters, hyphens and underscores",
|
||||
),
|
||||
created_at: z
|
||||
.string()
|
||||
.refine((v) => isISOString(v), "must be a valid ISO8601 datetime"),
|
||||
uri: url,
|
||||
.refine((v) => isISOString(v), "must be a valid RFC 3339 datetime"),
|
||||
type: z.string(),
|
||||
extensions: ExtensionPropertySchema.nullish(),
|
||||
});
|
||||
|
||||
export const TransientEntitySchema = EntitySchema.extend({
|
||||
id: z.null().optional(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue