From 23936d549f64d2ea90c2be83f28fce63fcfc087a Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 16 Sep 2024 12:48:52 +0200 Subject: [PATCH] chore: :arrow_up: Upgrade dependencies, fix new linter issues --- biome.json | 29 +++---- bun.lockb | Bin 101316 -> 101316 bytes client/index.ts | 6 +- client/types.ts | 76 +++++++++--------- client/types/account.ts | 10 +-- client/types/announcement.ts | 4 +- client/types/async_attachment.ts | 2 +- client/types/context.ts | 2 +- client/types/conversation.ts | 4 +- client/types/follow_request.ts | 4 +- client/types/instance.ts | 2 +- client/types/notification.ts | 6 +- client/types/preferences.ts | 2 +- client/types/reaction.ts | 2 +- client/types/report.ts | 2 +- client/types/results.ts | 6 +- client/types/scheduled_status.ts | 4 +- client/types/source.ts | 2 +- client/types/status.ts | 16 ++-- client/types/status_params.ts | 2 +- client/types/tag.ts | 2 +- client/versia/base.ts | 2 +- client/versia/client.ts | 6 +- federation/cryptography/index.test.ts | 2 +- federation/http.ts | 4 +- federation/index.ts | 11 ++- federation/requester/index.ts | 8 +- federation/schemas.ts | 18 ++--- federation/schemas/base.ts | 8 +- federation/schemas/extensions.ts | 2 +- .../schemas/extensions/custom_emojis.ts | 4 +- federation/schemas/extensions/likes.ts | 2 +- federation/schemas/extensions/polls.ts | 2 +- federation/schemas/extensions/reactions.ts | 2 +- federation/schemas/extensions/share.ts | 2 +- federation/schemas/extensions/vanity.ts | 4 +- federation/tests/index.test.ts | 2 +- federation/types.ts | 18 ++--- federation/validator.ts | 22 ++--- package.json | 6 +- 40 files changed, 154 insertions(+), 154 deletions(-) diff --git a/biome.json b/biome.json index f14320b..49582b0 100644 --- a/biome.json +++ b/biome.json @@ -1,19 +1,22 @@ { - "$schema": "https://biomejs.dev/schemas/1.8.1/schema.json", + "$schema": "https://biomejs.dev/schemas/1.9.1/schema.json", "organizeImports": { - "enabled": true, - "ignore": ["node_modules", "dist"] + "enabled": true }, "linter": { "enabled": true, "rules": { "all": true, "correctness": { - "noNodejsModules": "off" + "noNodejsModules": "off", + "noUndeclaredDependencies": "off" }, "complexity": { "noExcessiveCognitiveComplexity": "off" }, + "suspicious": { + "noConsole": "off" + }, "style": { "noDefaultExport": "off", "noParameterProperties": "off", @@ -67,25 +70,19 @@ } }, "nursery": { - "noDuplicateElseIf": "warn", - "noDuplicateJsonKeys": "warn", - "noEvolvingTypes": "warn", - "noYodaExpression": "warn", - "useConsistentBuiltinInstantiation": "warn", - "useErrorMessage": "warn", - "useImportExtensions": "off", - "useThrowNewError": "warn" + "noDuplicateElseIf": "warn" } - }, - "ignore": ["node_modules", "dist"] + } }, "formatter": { "enabled": true, "indentStyle": "space", - "indentWidth": 4, - "ignore": ["node_modules", "dist"] + "indentWidth": 4 }, "javascript": { "globals": ["Bun"] + }, + "files": { + "ignore": ["node_modules", "dist"] } } diff --git a/bun.lockb b/bun.lockb index f7cb08838fedc401c556b3c14678b157def5ab23..58af25a65fbab1523dbcd81868bc936ee3ecd979 100755 GIT binary patch delta 1857 zcmZXUdpuNW7{|}c>=-d2nZb-1twDvET*kGSu4c>-x}b7Nlu`_m+t#>OTW$@G65_K- zjBF-`3b}2&Vx!VVp;|UtL~Yt^O?yTr%K7Ix=l6Tx@B2LO`FwsYFuDasr&G1HdYI^^ zljJ8s*(|y@9jIws$XdnG4r7{QlZY z(2JutPC0c60~W<9^9MDT^OaRFe072|kmq+P>+{nI>iiPjRs2VUc0^gGV!&56l;`&l z6{KG(80>ANoo&eR0D_>;Yn-(dQ+Quz~$$V z6hC((>?HZSFuZIm?_??2Oq`0a_OUN4DnAo4AUG3h88a}Jl3DAgwzPyX06ML`cfIq_ zjOos~#?xud~! z?^G#2zxdtll0S$wt(GdAWQvkHoZ2rE7=PW`YN!ch$+(UGabMaacL5-=k{GE5$hAlx zlpy@piP-+5e=hm>-pi~baD(~EBG*lH{I27?*cu8qBsOe74-JI$s&GV`r9xVs6$;myw{Jv0i9_{tsU1iU%=J`7PNdxqSI__xJH_I25*TpwLpoq`qQrenqC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k diff --git a/client/index.ts b/client/index.ts index a376c5a..21b40ef 100644 --- a/client/index.ts +++ b/client/index.ts @@ -1,5 +1,5 @@ -import type { Token } from "./types/token"; -import { type Output, ResponseError } from "./versia/base"; -import { Client } from "./versia/client"; +import type { Token } from "./types/token.ts"; +import { type Output, ResponseError } from "./versia/base.ts"; +import { Client } from "./versia/client.ts"; export { Client, ResponseError, type Output, type Token }; diff --git a/client/types.ts b/client/types.ts index f251856..7b1fab6 100644 --- a/client/types.ts +++ b/client/types.ts @@ -1,50 +1,50 @@ -import type { Account } from "./types/account"; -import type { Activity } from "./types/activity"; +import type { Account } from "./types/account.ts"; +import type { Activity } from "./types/activity.ts"; import type { Announcement, AnnouncementAccount, AnnouncementReaction, AnnouncementStatus, -} from "./types/announcement"; -import type { Application, ApplicationData } from "./types/application"; -import type { AsyncAttachment } from "./types/async_attachment"; -import type { Attachment, Focus, Meta, Sub } from "./types/attachment"; -import type { Card } from "./types/card"; -import type { Context } from "./types/context"; -import type { Conversation } from "./types/conversation"; -import type { Emoji } from "./types/emoji"; -import type { FeaturedTag } from "./types/featured_tag"; -import type { Field } from "./types/field"; -import type { Filter, FilterContext } from "./types/filter"; -import type { FollowRequest } from "./types/follow_request"; -import type { History } from "./types/history"; -import type { IdentityProof } from "./types/identity_proof"; +} from "./types/announcement.ts"; +import type { Application, ApplicationData } from "./types/application.ts"; +import type { AsyncAttachment } from "./types/async_attachment.ts"; +import type { Attachment, Focus, Meta, Sub } from "./types/attachment.ts"; +import type { Card } from "./types/card.ts"; +import type { Context } from "./types/context.ts"; +import type { Conversation } from "./types/conversation.ts"; +import type { Emoji } from "./types/emoji.ts"; +import type { FeaturedTag } from "./types/featured_tag.ts"; +import type { Field } from "./types/field.ts"; +import type { Filter, FilterContext } from "./types/filter.ts"; +import type { FollowRequest } from "./types/follow_request.ts"; +import type { History } from "./types/history.ts"; +import type { IdentityProof } from "./types/identity_proof.ts"; import type { ExtendedDescription, Instance, InstanceRule, -} from "./types/instance"; -import type { List, RepliesPolicy } from "./types/list"; -import type { Marker } from "./types/marker"; -import type { Mention } from "./types/mention"; -import type { Notification, NotificationType } from "./types/notification"; -import type { Poll, PollOption } from "./types/poll"; -import type { Preferences } from "./types/preferences"; -import type { Alerts, PushSubscription } from "./types/push_subscription"; -import type { Reaction } from "./types/reaction"; -import type { Relationship } from "./types/relationship"; -import type { Category, Report } from "./types/report"; -import type { Results } from "./types/results"; -import type { ScheduledStatus } from "./types/scheduled_status"; -import type { Source } from "./types/source"; -import type { Stats } from "./types/stats"; -import type { Status, StatusTag, StatusVisibility } from "./types/status"; -import type { StatusParams } from "./types/status_params"; -import type { StatusSource } from "./types/status_source"; -import type { Tag } from "./types/tag"; -import type { Token } from "./types/token"; -import type { URLs } from "./types/urls"; -import { RolePermission, type VersiaRole } from "./types/versia"; +} from "./types/instance.ts"; +import type { List, RepliesPolicy } from "./types/list.ts"; +import type { Marker } from "./types/marker.ts"; +import type { Mention } from "./types/mention.ts"; +import type { Notification, NotificationType } from "./types/notification.ts"; +import type { Poll, PollOption } from "./types/poll.ts"; +import type { Preferences } from "./types/preferences.ts"; +import type { Alerts, PushSubscription } from "./types/push_subscription.ts"; +import type { Reaction } from "./types/reaction.ts"; +import type { Relationship } from "./types/relationship.ts"; +import type { Category, Report } from "./types/report.ts"; +import type { Results } from "./types/results.ts"; +import type { ScheduledStatus } from "./types/scheduled_status.ts"; +import type { Source } from "./types/source.ts"; +import type { Stats } from "./types/stats.ts"; +import type { Status, StatusTag, StatusVisibility } from "./types/status.ts"; +import type { StatusParams } from "./types/status_params.ts"; +import type { StatusSource } from "./types/status_source.ts"; +import type { Tag } from "./types/tag.ts"; +import type { Token } from "./types/token.ts"; +import type { URLs } from "./types/urls.ts"; +import { RolePermission, type VersiaRole } from "./types/versia.ts"; export type { Account, diff --git a/client/types/account.ts b/client/types/account.ts index 52511bd..886586c 100644 --- a/client/types/account.ts +++ b/client/types/account.ts @@ -1,8 +1,8 @@ -import type { Emoji } from "./emoji"; -import type { Field } from "./field"; -import type { Role } from "./role"; -import type { Source } from "./source"; -import type { VersiaRole } from "./versia"; +import type { Emoji } from "./emoji.ts"; +import type { Field } from "./field.ts"; +import type { Role } from "./role.ts"; +import type { Source } from "./source.ts"; +import type { VersiaRole } from "./versia.ts"; export type Account = { id: string; diff --git a/client/types/announcement.ts b/client/types/announcement.ts index 0a3cb10..4f9ae30 100644 --- a/client/types/announcement.ts +++ b/client/types/announcement.ts @@ -1,5 +1,5 @@ -import type { Emoji } from "./emoji"; -import type { StatusTag } from "./status"; +import type { Emoji } from "./emoji.ts"; +import type { StatusTag } from "./status.ts"; export type Announcement = { id: string; diff --git a/client/types/async_attachment.ts b/client/types/async_attachment.ts index 7b2b5b0..ff15389 100644 --- a/client/types/async_attachment.ts +++ b/client/types/async_attachment.ts @@ -1,4 +1,4 @@ -import type { Meta } from "./attachment"; +import type { Meta } from "./attachment.ts"; export type AsyncAttachment = { id: string; diff --git a/client/types/context.ts b/client/types/context.ts index c053f51..8df1b1d 100644 --- a/client/types/context.ts +++ b/client/types/context.ts @@ -1,4 +1,4 @@ -import type { Status } from "./status"; +import type { Status } from "./status.ts"; export type Context = { ancestors: Status[]; diff --git a/client/types/conversation.ts b/client/types/conversation.ts index 5edf609..8360768 100644 --- a/client/types/conversation.ts +++ b/client/types/conversation.ts @@ -1,5 +1,5 @@ -import type { Account } from "./account"; -import type { Status } from "./status"; +import type { Account } from "./account.ts"; +import type { Status } from "./status.ts"; export type Conversation = { id: string; diff --git a/client/types/follow_request.ts b/client/types/follow_request.ts index 676b583..ca20610 100644 --- a/client/types/follow_request.ts +++ b/client/types/follow_request.ts @@ -1,5 +1,5 @@ -import type { Emoji } from "./emoji"; -import type { Field } from "./field"; +import type { Emoji } from "./emoji.ts"; +import type { Field } from "./field.ts"; export type FollowRequest = { id: number; diff --git a/client/types/instance.ts b/client/types/instance.ts index 00f568c..5baf2f5 100644 --- a/client/types/instance.ts +++ b/client/types/instance.ts @@ -1,4 +1,4 @@ -import type { Account } from "./account"; +import type { Account } from "./account.ts"; export type Instance = { domain: string; diff --git a/client/types/notification.ts b/client/types/notification.ts index d240f49..6c39463 100644 --- a/client/types/notification.ts +++ b/client/types/notification.ts @@ -1,6 +1,6 @@ -import type { Account } from "./account"; -import type { Reaction } from "./reaction"; -import type { Status } from "./status"; +import type { Account } from "./account.ts"; +import type { Reaction } from "./reaction.ts"; +import type { Status } from "./status.ts"; export type Notification = { account: Account | null; diff --git a/client/types/preferences.ts b/client/types/preferences.ts index c0efe96..215c46f 100644 --- a/client/types/preferences.ts +++ b/client/types/preferences.ts @@ -1,4 +1,4 @@ -import type { StatusVisibility } from "./status"; +import type { StatusVisibility } from "./status.ts"; export type Preferences = { "posting:default:visibility": StatusVisibility; diff --git a/client/types/reaction.ts b/client/types/reaction.ts index 7483269..39f9af9 100644 --- a/client/types/reaction.ts +++ b/client/types/reaction.ts @@ -1,4 +1,4 @@ -import type { Account } from "./account"; +import type { Account } from "./account.ts"; export type Reaction = { count: number; diff --git a/client/types/report.ts b/client/types/report.ts index ee98aa3..519e961 100644 --- a/client/types/report.ts +++ b/client/types/report.ts @@ -1,4 +1,4 @@ -import type { Account } from "./account"; +import type { Account } from "./account.ts"; export type Report = { id: string; diff --git a/client/types/results.ts b/client/types/results.ts index 229f98e..53d1692 100644 --- a/client/types/results.ts +++ b/client/types/results.ts @@ -1,6 +1,6 @@ -import type { Account } from "./account"; -import type { Status } from "./status"; -import type { Tag } from "./tag"; +import type { Account } from "./account.ts"; +import type { Status } from "./status.ts"; +import type { Tag } from "./tag.ts"; export type Results = { accounts: Account[]; diff --git a/client/types/scheduled_status.ts b/client/types/scheduled_status.ts index 69389ef..44c5b6c 100644 --- a/client/types/scheduled_status.ts +++ b/client/types/scheduled_status.ts @@ -1,5 +1,5 @@ -import type { Attachment } from "./attachment"; -import type { StatusParams } from "./status_params"; +import type { Attachment } from "./attachment.ts"; +import type { StatusParams } from "./status_params.ts"; export type ScheduledStatus = { id: string; diff --git a/client/types/source.ts b/client/types/source.ts index cab190e..966f7d7 100644 --- a/client/types/source.ts +++ b/client/types/source.ts @@ -1,4 +1,4 @@ -import type { Field } from "./field"; +import type { Field } from "./field.ts"; export type Source = { privacy: string | null; diff --git a/client/types/status.ts b/client/types/status.ts index 8e0b912..d1733aa 100644 --- a/client/types/status.ts +++ b/client/types/status.ts @@ -1,11 +1,11 @@ -import type { Account } from "./account"; -import type { Application } from "./application"; -import type { Attachment } from "./attachment"; -import type { Card } from "./card"; -import type { Emoji } from "./emoji"; -import type { Mention } from "./mention"; -import type { Poll } from "./poll"; -import type { Reaction } from "./reaction"; +import type { Account } from "./account.ts"; +import type { Application } from "./application.ts"; +import type { Attachment } from "./attachment.ts"; +import type { Card } from "./card.ts"; +import type { Emoji } from "./emoji.ts"; +import type { Mention } from "./mention.ts"; +import type { Poll } from "./poll.ts"; +import type { Reaction } from "./reaction.ts"; export type Status = { id: string; diff --git a/client/types/status_params.ts b/client/types/status_params.ts index 56c1874..ad512a0 100644 --- a/client/types/status_params.ts +++ b/client/types/status_params.ts @@ -1,4 +1,4 @@ -import type { StatusVisibility } from "./status"; +import type { StatusVisibility } from "./status.ts"; export type StatusParams = { text: string; diff --git a/client/types/tag.ts b/client/types/tag.ts index 6923742..fc2fdda 100644 --- a/client/types/tag.ts +++ b/client/types/tag.ts @@ -1,4 +1,4 @@ -import type { History } from "./history"; +import type { History } from "./history.ts"; export type Tag = { name: string; diff --git a/client/versia/base.ts b/client/versia/base.ts index 583f41b..2e196dd 100644 --- a/client/versia/base.ts +++ b/client/versia/base.ts @@ -1,4 +1,4 @@ -import { DEFAULT_UA } from "./constants"; +import { DEFAULT_UA } from "./constants.ts"; type HttpVerb = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; type ConvertibleObject = { diff --git a/client/versia/client.ts b/client/versia/client.ts index 2ae3c80..f08eca6 100644 --- a/client/versia/client.ts +++ b/client/versia/client.ts @@ -28,9 +28,9 @@ import type { Tag, Token, VersiaRole, -} from "../types"; -import { BaseClient, type Output } from "./base"; -import { DEFAULT_SCOPE, NO_REDIRECT } from "./constants"; +} from "../types.ts"; +import { BaseClient, type Output } from "./base.ts"; +import { DEFAULT_SCOPE, NO_REDIRECT } from "./constants.ts"; type StatusContentType = | "text/plain" diff --git a/federation/cryptography/index.test.ts b/federation/cryptography/index.test.ts index 9d40c05..e35c0b4 100644 --- a/federation/cryptography/index.test.ts +++ b/federation/cryptography/index.test.ts @@ -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; diff --git a/federation/http.ts b/federation/http.ts index 115807c..0d40dee 100644 --- a/federation/http.ts +++ b/federation/http.ts @@ -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 | Promise; diff --git a/federation/index.ts b/federation/index.ts index a2c9c24..0fde9dd 100644 --- a/federation/index.ts +++ b/federation/index.ts @@ -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, diff --git a/federation/requester/index.ts b/federation/requester/index.ts index 790d94b..a347ec8 100644 --- a/federation/requester/index.ts +++ b/federation/requester/index.ts @@ -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"; diff --git a/federation/schemas.ts b/federation/schemas.ts index e2c5342..47ee369 100644 --- a/federation/schemas.ts +++ b/federation/schemas.ts @@ -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, diff --git a/federation/schemas/base.ts b/federation/schemas/base.ts index 7d78f89..a2e6f86 100644 --- a/federation/schemas/base.ts +++ b/federation/schemas/base.ts @@ -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({ diff --git a/federation/schemas/extensions.ts b/federation/schemas/extensions.ts index 2077fed..e0d62b3 100644 --- a/federation/schemas/extensions.ts +++ b/federation/schemas/extensions.ts @@ -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({ diff --git a/federation/schemas/extensions/custom_emojis.ts b/federation/schemas/extensions/custom_emojis.ts index 573c44b..d813e8d 100644 --- a/federation/schemas/extensions/custom_emojis.ts +++ b/federation/schemas/extensions/custom_emojis.ts @@ -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 diff --git a/federation/schemas/extensions/likes.ts b/federation/schemas/extensions/likes.ts index 53ee827..a0fcc26 100644 --- a/federation/schemas/extensions/likes.ts +++ b/federation/schemas/extensions/likes.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { EntitySchema } from "../base"; +import { EntitySchema } from "../base.ts"; /** * @description Like entity diff --git a/federation/schemas/extensions/polls.ts b/federation/schemas/extensions/polls.ts index db4accf..bbc514c 100644 --- a/federation/schemas/extensions/polls.ts +++ b/federation/schemas/extensions/polls.ts @@ -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 diff --git a/federation/schemas/extensions/reactions.ts b/federation/schemas/extensions/reactions.ts index fb15e80..ee97030 100644 --- a/federation/schemas/extensions/reactions.ts +++ b/federation/schemas/extensions/reactions.ts @@ -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 diff --git a/federation/schemas/extensions/share.ts b/federation/schemas/extensions/share.ts index 3209b38..415b470 100644 --- a/federation/schemas/extensions/share.ts +++ b/federation/schemas/extensions/share.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { EntitySchema } from "../base"; +import { EntitySchema } from "../base.ts"; /** * @description Share entity diff --git a/federation/schemas/extensions/vanity.ts b/federation/schemas/extensions/vanity.ts index f6ba3dd..c04cff9 100644 --- a/federation/schemas/extensions/vanity.ts +++ b/federation/schemas/extensions/vanity.ts @@ -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 diff --git a/federation/tests/index.test.ts b/federation/tests/index.test.ts index 30a5021..595a47e 100644 --- a/federation/tests/index.test.ts +++ b/federation/tests/index.test.ts @@ -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", () => { diff --git a/federation/types.ts b/federation/types.ts index 723ecac..daecd86 100644 --- a/federation/types.ts +++ b/federation/types.ts @@ -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; diff --git a/federation/validator.ts b/federation/validator.ts index 77fab61..da5fc37 100644 --- a/federation/validator.ts +++ b/federation/validator.ts @@ -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; @@ -244,7 +244,7 @@ export class EntityValidator { * @returns A promise that resolves to the validated data. */ public DislikeExtension(data: unknown): Promise { - return this.validate(LikeSchema, data); + return this.validate(DislikeSchema, data); } /** diff --git a/package.json b/package.json index b5dcc6a..fed07aa 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,9 @@ "check": "bunx tsc -p ." }, "devDependencies": { - "@biomejs/biome": "^1.8.3", - "@types/bun": "^1.1.8", - "@types/node": "^22.5.0", + "@biomejs/biome": "^1.9.1", + "@types/bun": "^1.1.9", + "@types/node": "^22.5.5", "bun-plugin-dts": "^0.2.3" }, "trustedDependencies": ["@biomejs/biome"],