refactor(federation): 🚚 Remove custom path alias

This commit is contained in:
Jesse Wierzbinski 2024-07-23 00:11:05 +02:00
parent 1529708dd8
commit 2313bcbbcc
No known key found for this signature in database
13 changed files with 30 additions and 37 deletions

View file

@ -10,8 +10,8 @@ import type {
ServerMetadata,
Undo,
User,
} from "@/federation/schemas";
import type { EntityValidator } from "@/federation/validator/index";
} from "../schemas";
import type { EntityValidator } from "../validator/index";
type MaybePromise<T> = T | Promise<T>;

View file

@ -5,18 +5,15 @@
* @see module:federation/schemas/base
*/
import {
SignatureConstructor,
SignatureValidator,
} from "@/federation/cryptography";
import { RequestParserHandler } from "@/federation/http";
import type { ValidationError } from "zod-validation-error";
import { SignatureConstructor, SignatureValidator } from "./cryptography";
import { RequestParserHandler } from "./http";
import {
FederationRequester,
type Output,
ResponseError,
} from "@/federation/requester/index";
import { EntityValidator } from "@/federation/validator/index";
import type { ValidationError } from "zod-validation-error";
} from "./requester/index";
import { EntityValidator } from "./validator/index";
export {
EntityValidator,

View file

@ -1,3 +1,3 @@
import pkg from "@/federation/package.json" with { type: "json" };
import pkg from "../package.json" with { type: "json" };
export const DEFAULT_UA = `LysandFederation/${pkg.version} (+${pkg.homepage})`;

View file

@ -1,8 +1,8 @@
import type { SignatureConstructor } from "@/federation/cryptography";
import { DEFAULT_UA } from "@/federation/requester/constants";
import type { User } from "@/federation/schemas";
import { WebFingerSchema } from "@/federation/schemas/webfinger";
import { fromZodError } from "zod-validation-error";
import type { SignatureConstructor } from "../cryptography";
import type { User } from "../schemas";
import { WebFingerSchema } from "../schemas/webfinger";
import { DEFAULT_UA } from "./constants";
type HttpVerb = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";

View file

@ -1,3 +1,4 @@
import type { z } from "zod";
import type {
ActionSchema,
ActorPublicKeyDataSchema,
@ -20,8 +21,7 @@ import type {
UserSchema,
VanityExtensionSchema,
VisibilitySchema,
} from "@/federation/schemas/base";
import type { z } from "zod";
} from "./schemas/base";
// biome-ignore lint/suspicious/noExplicitAny: Used only as a base type
type AnyZod = z.ZodType<any, any, any>;

View file

@ -1,9 +1,9 @@
import { ContentFormatSchema } from "@/federation/schemas/content_format";
import { ExtensionPropertySchema } from "@/federation/schemas/extensions";
import { CustomEmojiExtensionSchema } from "@/federation/schemas/extensions/custom_emojis";
import { VanityExtensionSchema } from "@/federation/schemas/extensions/vanity";
import { extensionTypeRegex } from "@/federation/schemas/regex";
import { z } from "zod";
import { ContentFormatSchema } from "./content_format";
import { ExtensionPropertySchema } from "./extensions";
import { CustomEmojiExtensionSchema } from "./extensions/custom_emojis";
import { VanityExtensionSchema } from "./extensions/vanity";
import { extensionTypeRegex } from "./regex";
const EntitySchema = z.object({
id: z.string().uuid(),

View file

@ -1,5 +1,5 @@
import { CustomEmojiExtensionSchema } from "@/federation/schemas/extensions/custom_emojis";
import { z } from "zod";
import { CustomEmojiExtensionSchema } from "./extensions/custom_emojis";
export const ExtensionPropertySchema = z.object({
"org.lysand:custom_emojis":

View file

@ -1,5 +1,3 @@
import { ContentFormatSchema } from "@/federation/schemas/content_format";
import { emojiRegex } from "@/federation/schemas/regex";
/**
* Custom emojis extension.
* @module federation/schemas/extensions/custom_emojis
@ -7,6 +5,8 @@ import { emojiRegex } from "@/federation/schemas/regex";
* @see https://lysand.org/extensions/custom-emojis
*/
import { z } from "zod";
import { ContentFormatSchema } from "../content_format";
import { emojiRegex } from "../regex";
/**
* @description Used to validate the properties the extension's custom field

View file

@ -1,5 +1,3 @@
import { ExtensionSchema } from "@/federation/schemas/base";
import { ContentFormatSchema } from "@/federation/schemas/content_format";
/**
* Polls extension
* @module federation/schemas/extensions/polls
@ -7,6 +5,8 @@ import { ContentFormatSchema } from "@/federation/schemas/content_format";
* @see https://lysand.org/extensions/polls
*/
import { z } from "zod";
import { ExtensionSchema } from "../base";
import { ContentFormatSchema } from "../content_format";
/**
* @description Poll extension entity

View file

@ -1,4 +1,3 @@
import { ExtensionSchema } from "@/federation/schemas/base";
/**
* Reactions extension
* @module federation/schemas/extensions/reactions
@ -6,6 +5,7 @@ import { ExtensionSchema } from "@/federation/schemas/base";
* @see https://lysand.org/extensions/reactions
*/
import { z } from "zod";
import { ExtensionSchema } from "../base";
/**
* @description Reaction extension entity

View file

@ -5,8 +5,8 @@
* @see https://lysand.org/extensions/vanity
*/
import { ContentFormatSchema } from "@/federation/schemas/content_format";
import { z } from "zod";
import { ContentFormatSchema } from "../content_format";
/**
* @description Vanity extension entity

View file

@ -1,3 +1,5 @@
import type { z } from "zod";
import { fromError } from "zod-validation-error";
import {
ActionSchema,
ActorPublicKeyDataSchema,
@ -20,9 +22,7 @@ import {
UserSchema,
VanityExtensionSchema,
VisibilitySchema,
} from "@/federation/schemas/base";
import type { z } from "zod";
import { fromError } from "zod-validation-error";
} from "../schemas/base";
// biome-ignore lint/suspicious/noExplicitAny: Used only as a base type
type AnyZod = z.ZodType<any, any, any>;

View file

@ -22,11 +22,7 @@
"experimentalDecorators": true,
"verbatimModuleSyntax": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"paths": {
"@/federation/*": ["./federation/*"],
"@/client/*": ["./client/*"]
}
"noUnusedParameters": true
},
"include": ["*.ts", "*.d.ts", "**/*.ts", "**/*.d.ts"]
}