mirror of
https://github.com/versia-pub/api.git
synced 2025-12-06 00:18:19 +01:00
refactor(federation): 🚚 Rename schemas to validators
Fixes issues with Bun bundling
This commit is contained in:
parent
ebf16a82cb
commit
f80cffd01a
2
build.ts
2
build.ts
|
|
@ -2,7 +2,7 @@ import dts from "bun-plugin-dts";
|
|||
import ora from "ora";
|
||||
|
||||
const entrypoints = {
|
||||
federation: ["index.ts", "schemas.ts", "types.ts"],
|
||||
federation: ["index.ts", "validators.ts", "types.ts"],
|
||||
client: ["index.ts", "types.ts"],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* @file index.ts
|
||||
* @fileoverview Main entrypoint and export for the module
|
||||
* @module federation
|
||||
* @see module:federation/schemas/base
|
||||
* @see module:federation/validators/base
|
||||
*/
|
||||
|
||||
import type { ValidationError } from "zod-validation-error";
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
"exports": {
|
||||
".": "./index.ts",
|
||||
"./types": "./types.ts",
|
||||
"./schemas": "./schemas.ts"
|
||||
"./validators": "./validators.ts"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
"default": "./dist/types.js",
|
||||
"types": "./dist/types.d.ts"
|
||||
},
|
||||
"./schemas": {
|
||||
"import": "./dist/schemas.js",
|
||||
"default": "./dist/schemas.js",
|
||||
"types": "./dist/schemas.d.ts"
|
||||
"./validators": {
|
||||
"import": "./dist/validators.js",
|
||||
"default": "./dist/validators.js",
|
||||
"types": "./dist/validators.d.ts"
|
||||
}
|
||||
},
|
||||
"funding": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { fromZodError } from "zod-validation-error";
|
||||
import type { SignatureConstructor } from "../cryptography/index.ts";
|
||||
import { WebFingerSchema } from "../schemas/webfinger.ts";
|
||||
import { WebFingerSchema } from "../validators/webfinger.ts";
|
||||
import type { User } from "../types.ts";
|
||||
import { DEFAULT_UA } from "./constants.ts";
|
||||
|
||||
|
|
|
|||
|
|
@ -16,15 +16,18 @@ import type {
|
|||
NoteSchema,
|
||||
UnfollowSchema,
|
||||
UserSchema,
|
||||
} from "./schemas/base.ts";
|
||||
import type { ContentFormatSchema } from "./schemas/content_format.ts";
|
||||
import type { ExtensionPropertySchema } from "./schemas/extensions.ts";
|
||||
import type { CustomEmojiExtensionSchema } from "./schemas/extensions/custom_emojis.ts";
|
||||
import type { DislikeSchema, LikeSchema } from "./schemas/extensions/likes.ts";
|
||||
import type { VoteSchema } from "./schemas/extensions/polls.ts";
|
||||
import type { ReactionSchema } from "./schemas/extensions/reactions.ts";
|
||||
import type { ShareSchema } from "./schemas/extensions/share.ts";
|
||||
import type { VanityExtensionSchema } from "./schemas/extensions/vanity.ts";
|
||||
} from "./validators/base.ts";
|
||||
import type { ContentFormatSchema } from "./validators/content_format.ts";
|
||||
import type { ExtensionPropertySchema } from "./validators/extensions.ts";
|
||||
import type { CustomEmojiExtensionSchema } from "./validators/extensions/custom_emojis.ts";
|
||||
import type {
|
||||
DislikeSchema,
|
||||
LikeSchema,
|
||||
} from "./validators/extensions/likes.ts";
|
||||
import type { VoteSchema } from "./validators/extensions/polls.ts";
|
||||
import type { ReactionSchema } from "./validators/extensions/reactions.ts";
|
||||
import type { ShareSchema } from "./validators/extensions/share.ts";
|
||||
import type { VanityExtensionSchema } from "./validators/extensions/vanity.ts";
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: Used only as a base type
|
||||
type AnyZod = z.ZodType<any, any, any>;
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ import {
|
|||
NoteSchema,
|
||||
UnfollowSchema,
|
||||
UserSchema,
|
||||
} from "./schemas/base.ts";
|
||||
import { ContentFormatSchema } from "./schemas/content_format.ts";
|
||||
import { ExtensionPropertySchema } from "./schemas/extensions.ts";
|
||||
import { CustomEmojiExtensionSchema } from "./schemas/extensions/custom_emojis.ts";
|
||||
import { DislikeSchema, LikeSchema } from "./schemas/extensions/likes.ts";
|
||||
import { VoteSchema } from "./schemas/extensions/polls.ts";
|
||||
import { ReactionSchema } from "./schemas/extensions/reactions.ts";
|
||||
import { ShareSchema } from "./schemas/extensions/share.ts";
|
||||
import { VanityExtensionSchema } from "./schemas/extensions/vanity.ts";
|
||||
} from "./validators/base.ts";
|
||||
import { ContentFormatSchema } from "./validators/content_format.ts";
|
||||
import { ExtensionPropertySchema } from "./validators/extensions.ts";
|
||||
import { CustomEmojiExtensionSchema } from "./validators/extensions/custom_emojis.ts";
|
||||
import { DislikeSchema, LikeSchema } from "./validators/extensions/likes.ts";
|
||||
import { VoteSchema } from "./validators/extensions/polls.ts";
|
||||
import { ReactionSchema } from "./validators/extensions/reactions.ts";
|
||||
import { ShareSchema } from "./validators/extensions/share.ts";
|
||||
import { VanityExtensionSchema } from "./validators/extensions/vanity.ts";
|
||||
import type {
|
||||
Collection,
|
||||
ContentFormat,
|
||||
|
|
@ -52,7 +52,7 @@ type InferType<T extends AnyZod> = z.infer<T>;
|
|||
/**
|
||||
* Validates entities against their respective schemas.
|
||||
* @module federation/validator
|
||||
* @see module:federation/schemas/base
|
||||
* @see module:federation/validators/base
|
||||
* @example
|
||||
* import { EntityValidator, type ValidationError } from "@versia/federation";
|
||||
* const validator = new EntityValidator();
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ import {
|
|||
NoteSchema,
|
||||
UnfollowSchema,
|
||||
UserSchema,
|
||||
} from "./schemas/base.ts";
|
||||
import { ContentFormatSchema } from "./schemas/content_format.ts";
|
||||
import { ExtensionPropertySchema } from "./schemas/extensions.ts";
|
||||
import { CustomEmojiExtensionSchema } from "./schemas/extensions/custom_emojis.ts";
|
||||
import { DislikeSchema, LikeSchema } from "./schemas/extensions/likes.ts";
|
||||
import { VoteSchema } from "./schemas/extensions/polls.ts";
|
||||
import { ReactionSchema } from "./schemas/extensions/reactions.ts";
|
||||
import { ShareSchema } from "./schemas/extensions/share.ts";
|
||||
import { VanityExtensionSchema } from "./schemas/extensions/vanity.ts";
|
||||
import { WebFingerSchema } from "./schemas/webfinger.ts";
|
||||
} from "./validators/base.ts";
|
||||
import { ContentFormatSchema } from "./validators/content_format.ts";
|
||||
import { ExtensionPropertySchema } from "./validators/extensions.ts";
|
||||
import { CustomEmojiExtensionSchema } from "./validators/extensions/custom_emojis.ts";
|
||||
import { DislikeSchema, LikeSchema } from "./validators/extensions/likes.ts";
|
||||
import { VoteSchema } from "./validators/extensions/polls.ts";
|
||||
import { ReactionSchema } from "./validators/extensions/reactions.ts";
|
||||
import { ShareSchema } from "./validators/extensions/share.ts";
|
||||
import { VanityExtensionSchema } from "./validators/extensions/vanity.ts";
|
||||
import { WebFingerSchema } from "./validators/webfinger.ts";
|
||||
|
||||
export {
|
||||
NoteSchema as Note,
|
||||
Loading…
Reference in a new issue