mirror of
https://github.com/versia-pub/api.git
synced 2026-03-12 20:09:14 +01:00
chore: ⬆️ Upgrade dependencies, fix new linter issues
This commit is contained in:
parent
6c15ceb1e9
commit
23936d549f
40 changed files with 154 additions and 154 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { beforeAll, beforeEach, describe, expect, test } from "bun:test";
|
||||
import { SignatureConstructor, SignatureValidator } from "./index";
|
||||
import { SignatureConstructor, SignatureValidator } from "./index.ts";
|
||||
|
||||
describe("SignatureValidator", () => {
|
||||
let validator: SignatureValidator;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import type {
|
|||
ShareExtension,
|
||||
Unfollow,
|
||||
User,
|
||||
} from "./types";
|
||||
import type { EntityValidator } from "./validator";
|
||||
} from "./types.ts";
|
||||
import type { EntityValidator } from "./validator.ts";
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,14 +6,17 @@
|
|||
*/
|
||||
|
||||
import type { ValidationError } from "zod-validation-error";
|
||||
import { SignatureConstructor, SignatureValidator } from "./cryptography";
|
||||
import { RequestParserHandler } from "./http";
|
||||
import {
|
||||
SignatureConstructor,
|
||||
SignatureValidator,
|
||||
} from "./cryptography/index.ts";
|
||||
import { RequestParserHandler } from "./http.ts";
|
||||
import {
|
||||
FederationRequester,
|
||||
type Output,
|
||||
ResponseError,
|
||||
} from "./requester/index";
|
||||
import { EntityValidator } from "./validator";
|
||||
} from "./requester/index.ts";
|
||||
import { EntityValidator } from "./validator.ts";
|
||||
|
||||
export {
|
||||
EntityValidator,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { fromZodError } from "zod-validation-error";
|
||||
import type { SignatureConstructor } from "../cryptography";
|
||||
import { WebFingerSchema } from "../schemas/webfinger";
|
||||
import type { User } from "../types";
|
||||
import { DEFAULT_UA } from "./constants";
|
||||
import type { SignatureConstructor } from "../cryptography/index.ts";
|
||||
import { WebFingerSchema } from "../schemas/webfinger.ts";
|
||||
import type { User } from "../types.ts";
|
||||
import { DEFAULT_UA } from "./constants.ts";
|
||||
|
||||
type HttpVerb = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,15 @@ import {
|
|||
NoteSchema,
|
||||
UnfollowSchema,
|
||||
UserSchema,
|
||||
} from "./schemas/base";
|
||||
import { ContentFormatSchema } from "./schemas/content_format";
|
||||
import { ExtensionPropertySchema } from "./schemas/extensions";
|
||||
import { CustomEmojiExtensionSchema } from "./schemas/extensions/custom_emojis";
|
||||
import { DislikeSchema, LikeSchema } from "./schemas/extensions/likes";
|
||||
import { VoteSchema } from "./schemas/extensions/polls";
|
||||
import { ReactionSchema } from "./schemas/extensions/reactions";
|
||||
import { ShareSchema } from "./schemas/extensions/share";
|
||||
import { VanityExtensionSchema } from "./schemas/extensions/vanity";
|
||||
} 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";
|
||||
|
||||
export {
|
||||
NoteSchema as Note,
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ import {
|
|||
ContentFormatSchema,
|
||||
ImageOnlyContentFormatSchema,
|
||||
TextOnlyContentFormatSchema,
|
||||
} from "./content_format";
|
||||
import { ExtensionPropertySchema } from "./extensions";
|
||||
import { VanityExtensionSchema } from "./extensions/vanity";
|
||||
import { extensionRegex, isISOString, semverRegex } from "./regex";
|
||||
} from "./content_format.ts";
|
||||
import { ExtensionPropertySchema } from "./extensions.ts";
|
||||
import { VanityExtensionSchema } from "./extensions/vanity.ts";
|
||||
import { extensionRegex, isISOString, semverRegex } from "./regex.ts";
|
||||
|
||||
export const EntitySchema = z
|
||||
.object({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import { CustomEmojiExtensionSchema } from "./extensions/custom_emojis";
|
||||
import { CustomEmojiExtensionSchema } from "./extensions/custom_emojis.ts";
|
||||
|
||||
export const ExtensionPropertySchema = z
|
||||
.object({
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
* @see https://versia.pub/extensions/custom-emojis
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { ImageOnlyContentFormatSchema } from "../content_format";
|
||||
import { emojiRegex } from "../regex";
|
||||
import { ImageOnlyContentFormatSchema } from "../content_format.ts";
|
||||
import { emojiRegex } from "../regex.ts";
|
||||
|
||||
/**
|
||||
* @description Used to validate the properties the extension's custom field
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import { EntitySchema } from "../base";
|
||||
import { EntitySchema } from "../base.ts";
|
||||
|
||||
/**
|
||||
* @description Like entity
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @see https://versia.pub/extensions/polls
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { EntitySchema } from "../base";
|
||||
import { EntitySchema } from "../base.ts";
|
||||
|
||||
/**
|
||||
* @description Vote extension entity
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @see https://versia.pub/extensions/reactions
|
||||
*/
|
||||
import { z } from "zod";
|
||||
import { EntitySchema } from "../base";
|
||||
import { EntitySchema } from "../base.ts";
|
||||
|
||||
/**
|
||||
* @description Reaction extension entity
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { z } from "zod";
|
||||
import { EntitySchema } from "../base";
|
||||
import { EntitySchema } from "../base.ts";
|
||||
|
||||
/**
|
||||
* @description Share entity
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import { z } from "zod";
|
|||
import {
|
||||
AudioOnlyContentFormatSchema,
|
||||
ImageOnlyContentFormatSchema,
|
||||
} from "../content_format";
|
||||
import { isISOString } from "../regex";
|
||||
} from "../content_format.ts";
|
||||
import { isISOString } from "../regex.ts";
|
||||
|
||||
/**
|
||||
* @description Vanity extension entity
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, expect, it } from "bun:test";
|
||||
import { EntityValidator } from "../index";
|
||||
import { EntityValidator } from "../index.ts";
|
||||
|
||||
describe("Package testing", () => {
|
||||
it("should not validate a bad Note", () => {
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ import type {
|
|||
NoteSchema,
|
||||
UnfollowSchema,
|
||||
UserSchema,
|
||||
} from "./schemas/base";
|
||||
import type { ContentFormatSchema } from "./schemas/content_format";
|
||||
import type { ExtensionPropertySchema } from "./schemas/extensions";
|
||||
import type { CustomEmojiExtensionSchema } from "./schemas/extensions/custom_emojis";
|
||||
import type { DislikeSchema, LikeSchema } from "./schemas/extensions/likes";
|
||||
import type { VoteSchema } from "./schemas/extensions/polls";
|
||||
import type { ReactionSchema } from "./schemas/extensions/reactions";
|
||||
import type { ShareSchema } from "./schemas/extensions/share";
|
||||
import type { VanityExtensionSchema } from "./schemas/extensions/vanity";
|
||||
} 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";
|
||||
|
||||
// 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";
|
||||
import { ContentFormatSchema } from "./schemas/content_format";
|
||||
import { ExtensionPropertySchema } from "./schemas/extensions";
|
||||
import { CustomEmojiExtensionSchema } from "./schemas/extensions/custom_emojis";
|
||||
import { LikeSchema } from "./schemas/extensions/likes";
|
||||
import { VoteSchema } from "./schemas/extensions/polls";
|
||||
import { ReactionSchema } from "./schemas/extensions/reactions";
|
||||
import { ShareSchema } from "./schemas/extensions/share";
|
||||
import { VanityExtensionSchema } from "./schemas/extensions/vanity";
|
||||
} 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 type {
|
||||
Collection,
|
||||
ContentFormat,
|
||||
|
|
@ -42,7 +42,7 @@ import type {
|
|||
Unfollow,
|
||||
User,
|
||||
VanityExtension,
|
||||
} from "./types";
|
||||
} from "./types.ts";
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: Used only as a base type
|
||||
type AnyZod = z.ZodType<any, any, any>;
|
||||
|
|
@ -244,7 +244,7 @@ export class EntityValidator {
|
|||
* @returns A promise that resolves to the validated data.
|
||||
*/
|
||||
public DislikeExtension(data: unknown): Promise<DislikeExtension> {
|
||||
return this.validate(LikeSchema, data);
|
||||
return this.validate(DislikeSchema, data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue