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