mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
refactor: 🚚 Explicitely add extensions to all imports
This commit is contained in:
parent
b5b7014c00
commit
b53307c824
|
|
@ -5,7 +5,7 @@ import { db } from "~/drizzle/db";
|
|||
import { Applications } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, deleteUsers, passwords } = await getTestUsers(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { db } from "~/drizzle/db";
|
|||
import { Applications } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, deleteUsers, passwords } = await getTestUsers(1);
|
||||
const token = randomString(32, "hex");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./block";
|
||||
import { meta } from "./block.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./follow";
|
||||
import { meta } from "./follow.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./followers";
|
||||
import { meta } from "./followers.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./following";
|
||||
import { meta } from "./following.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./mute";
|
||||
import { meta } from "./mute.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./statuses";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils.ts";
|
||||
import { meta } from "./statuses.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(40, users[1])).toReversed();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Relationship as ApiRelationship } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./unmute";
|
||||
import { meta } from "./unmute.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { eq } from "drizzle-orm";
|
|||
import { db } from "~/drizzle/db";
|
||||
import { Users } from "~/drizzle/schema";
|
||||
import { fakeRequest, getSolvedChallenge } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const username = randomString(10, "hex");
|
||||
const username2 = randomString(10, "hex");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { eq } from "drizzle-orm";
|
|||
import { db } from "~/drizzle/db";
|
||||
import { Users } from "~/drizzle/schema";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { contentToHtml } from "~/classes/functions/status";
|
|||
import { MediaManager } from "~/classes/media/media-manager";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { EmojiToUser, RolePermissions, Users } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Attachment } from "~/packages/database-interface/attachment";
|
||||
import { Emoji } from "~/packages/database-interface/emoji";
|
||||
import { User } from "~/packages/database-interface/user";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { fakeRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
// /api/v1/challenges
|
||||
describe(meta.route, () => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { inArray } from "drizzle-orm";
|
|||
import { db } from "~/drizzle/db";
|
||||
import { Emojis } from "~/drizzle/schema";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { inArray } from "drizzle-orm";
|
|||
import { db } from "~/drizzle/db";
|
||||
import { Emojis } from "~/drizzle/schema";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
let id = "";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sharp from "sharp";
|
|||
import { db } from "~/drizzle/db";
|
||||
import { Emojis } from "~/drizzle/schema";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(3);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { fakeRequest } from "~/tests/utils";
|
||||
import { meta } from "./extended_description";
|
||||
import { meta } from "./extended_description.ts";
|
||||
|
||||
// /api/v1/instance/extended_description
|
||||
describe(meta.route, () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { fakeRequest } from "~/tests/utils";
|
||||
import { meta } from "./privacy_policy";
|
||||
import { meta } from "./privacy_policy.ts";
|
||||
|
||||
// /api/v1/instance/privacy_policy
|
||||
describe(meta.route, () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { fakeRequest } from "~/tests/utils";
|
||||
import { meta } from "./rules";
|
||||
import { meta } from "./rules.ts";
|
||||
|
||||
// /api/v1/instance/rules
|
||||
describe(meta.route, () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { fakeRequest } from "~/tests/utils";
|
||||
import { meta } from "./tos";
|
||||
import { meta } from "./tos.ts";
|
||||
|
||||
// /api/v1/instance/tos
|
||||
describe(meta.route, () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(1);
|
||||
const timeline = await getTestStatuses(10, users[0]);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { createRoute } from "@hono/zod-openapi";
|
|||
import { z } from "zod";
|
||||
import { MediaManager } from "~/classes/media/media-manager";
|
||||
import { RolePermissions } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Attachment } from "~/packages/database-interface/attachment";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sharp from "sharp";
|
|||
import { z } from "zod";
|
||||
import { MediaManager } from "~/classes/media/media-manager";
|
||||
import { RolePermissions } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Attachment } from "~/packages/database-interface/attachment";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(3);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./dismiss";
|
||||
import { meta } from "./dismiss.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
let notifications: ApiNotification[] = [];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
let notifications: ApiNotification[] = [];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
let notifications: ApiNotification[] = [];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
const statuses = await getTestStatuses(40, users[0]);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Notification as ApiNotification } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const getFormData = (object: Record<string, string | number | boolean>) =>
|
||||
Object.keys(object).reduce((formData, key) => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|||
import { ADMIN_ROLES, DEFAULT_ROLES, RolePermissions } from "~/drizzle/schema";
|
||||
import { Role } from "~/packages/database-interface/role";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(1);
|
||||
let role: Role;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { ADMIN_ROLES } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Role } from "~/packages/database-interface/role";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, deleteUsers, tokens } = await getTestUsers(1);
|
||||
let role: Role;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./favourite";
|
||||
import { meta } from "./favourite.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(2, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./favourited_by";
|
||||
import { meta } from "./favourited_by.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { createRoute } from "@hono/zod-openapi";
|
|||
import ISO6391 from "iso-639-1";
|
||||
import { z } from "zod";
|
||||
import { RolePermissions } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Attachment } from "~/packages/database-interface/attachment";
|
||||
import { Note } from "~/packages/database-interface/note";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Account as ApiAccount } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./reblogged_by";
|
||||
import { meta } from "./reblogged_by.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./unfavourite";
|
||||
import { meta } from "./unfavourite.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(2, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import type { Status as ApiStatus } from "@versia/client/types";
|
|||
import { eq } from "drizzle-orm";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Emojis } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { createRoute } from "@hono/zod-openapi";
|
|||
import ISO6391 from "iso-639-1";
|
||||
import { z } from "zod";
|
||||
import { RolePermissions } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Attachment } from "~/packages/database-interface/attachment";
|
||||
import { Note } from "~/packages/database-interface/note";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./home";
|
||||
import { meta } from "./home.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import type { Status as ApiStatus } from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { fakeRequest, getTestStatuses, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./public";
|
||||
import { meta } from "./public.ts";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(5);
|
||||
const timeline = (await getTestStatuses(40, users[0])).toReversed();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
const { tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { fakeRequest } from "~/tests/utils";
|
||||
import { meta } from "./index";
|
||||
import { meta } from "./index.ts";
|
||||
|
||||
// /api/v2/instance
|
||||
describe(meta.route, () => {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sharp from "sharp";
|
|||
import { z } from "zod";
|
||||
import { MediaManager } from "~/classes/media/media-manager";
|
||||
import { RolePermissions } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Attachment } from "~/packages/database-interface/attachment";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
||||
|
|
|
|||
18
app.ts
18
app.ts
|
|
@ -13,15 +13,15 @@ import { getLogger } from "@logtape/logtape";
|
|||
import chalk from "chalk";
|
||||
import type { ValidationError } from "zod-validation-error";
|
||||
import pkg from "~/package.json" with { type: "application/json" };
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { PluginLoader } from "./classes/plugin/loader";
|
||||
import { agentBans } from "./middlewares/agent-bans";
|
||||
import { bait } from "./middlewares/bait";
|
||||
import { boundaryCheck } from "./middlewares/boundary-check";
|
||||
import { ipBans } from "./middlewares/ip-bans";
|
||||
import { logger } from "./middlewares/logger";
|
||||
import { routes } from "./routes";
|
||||
import type { ApiRouteExports, HonoEnv } from "./types/api";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { PluginLoader } from "./classes/plugin/loader.ts";
|
||||
import { agentBans } from "./middlewares/agent-bans.ts";
|
||||
import { bait } from "./middlewares/bait.ts";
|
||||
import { boundaryCheck } from "./middlewares/boundary-check.ts";
|
||||
import { ipBans } from "./middlewares/ip-bans.ts";
|
||||
import { logger } from "./middlewares/logger.ts";
|
||||
import { routes } from "./routes.ts";
|
||||
import type { ApiRouteExports, HonoEnv } from "./types/api.ts";
|
||||
|
||||
export const appFactory = async () => {
|
||||
await configureLoggers();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
"all": true,
|
||||
"correctness": {
|
||||
"noNodejsModules": "off",
|
||||
"useImportExtensions": "off",
|
||||
"noUndeclaredDependencies": "off"
|
||||
},
|
||||
"performance": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { LikeExtension } from "@versia/federation/types";
|
|||
import { type InferSelectModel, and, eq } from "drizzle-orm";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Likes, Notifications } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import type { Note } from "~/packages/database-interface/note";
|
||||
import type { User } from "~/packages/database-interface/user";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import { db } from "~/drizzle/db";
|
|||
import type { Notifications } from "~/drizzle/schema";
|
||||
import { Note } from "~/packages/database-interface/note";
|
||||
import { User } from "~/packages/database-interface/user";
|
||||
import type { StatusWithRelations } from "./status";
|
||||
import type { StatusWithRelations } from "./status.ts";
|
||||
import {
|
||||
type UserWithRelations,
|
||||
transformOutputToUserWithRelations,
|
||||
userExtrasTemplate,
|
||||
userRelations,
|
||||
} from "./user";
|
||||
} from "./user.ts";
|
||||
|
||||
export type Notification = InferSelectModel<typeof Notifications>;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,17 +31,17 @@ import {
|
|||
type Notes,
|
||||
Users,
|
||||
} from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import type { EmojiWithInstance } from "~/packages/database-interface/emoji";
|
||||
import { User } from "~/packages/database-interface/user";
|
||||
import type { Application } from "./application";
|
||||
import type { Application } from "./application.ts";
|
||||
import {
|
||||
type UserWithInstance,
|
||||
type UserWithRelations,
|
||||
transformOutputToUserWithRelations,
|
||||
userExtrasTemplate,
|
||||
userRelations,
|
||||
} from "./user";
|
||||
} from "./user.ts";
|
||||
|
||||
export type Status = InferSelectModel<typeof Notes>;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import {
|
|||
} from "~/drizzle/schema";
|
||||
import type { EmojiWithInstance } from "~/packages/database-interface/emoji";
|
||||
import { User } from "~/packages/database-interface/user";
|
||||
import type { Application } from "./application";
|
||||
import type { Token } from "./token";
|
||||
import type { Application } from "./application.ts";
|
||||
import type { Token } from "./token.ts";
|
||||
|
||||
export type UserType = InferSelectModel<typeof Users>;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import {
|
|||
import { rm } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import type { getMediaHash } from "../media-hasher";
|
||||
import { DiskMediaDriver } from "./disk";
|
||||
import type { getMediaHash } from "../media-hasher.ts";
|
||||
import { DiskMediaDriver } from "./disk.ts";
|
||||
|
||||
describe("DiskMediaDriver", () => {
|
||||
let diskDriver: DiskMediaDriver;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
import { rm } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import { getMediaHash } from "../media-hasher";
|
||||
import type { UploadedFileMetadata } from "../media-manager";
|
||||
import type { MediaDriver } from "./media-driver";
|
||||
import { getMediaHash } from "../media-hasher.ts";
|
||||
import type { UploadedFileMetadata } from "../media-manager.ts";
|
||||
import type { MediaDriver } from "./media-driver.ts";
|
||||
|
||||
/**
|
||||
* Implements the MediaDriver interface for disk storage.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* @module MediaManager/Drivers
|
||||
*/
|
||||
|
||||
import type { UploadedFileMetadata } from "../media-manager";
|
||||
import type { UploadedFileMetadata } from "../media-manager.ts";
|
||||
|
||||
/**
|
||||
* Represents a media storage driver.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
import { type Mock, beforeEach, describe, expect, it, mock } from "bun:test";
|
||||
import type { S3Client } from "@bradenmacdonald/s3-lite-client";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import type { getMediaHash } from "../media-hasher";
|
||||
import { S3MediaDriver } from "./s3";
|
||||
import type { getMediaHash } from "../media-hasher.ts";
|
||||
import { S3MediaDriver } from "./s3.ts";
|
||||
|
||||
describe("S3MediaDriver", () => {
|
||||
let s3Driver: S3MediaDriver;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import { S3Client } from "@bradenmacdonald/s3-lite-client";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import { getMediaHash } from "../media-hasher";
|
||||
import type { UploadedFileMetadata } from "../media-manager";
|
||||
import type { MediaDriver } from "./media-driver";
|
||||
import { getMediaHash } from "../media-hasher.ts";
|
||||
import type { UploadedFileMetadata } from "../media-manager.ts";
|
||||
import type { MediaDriver } from "./media-driver.ts";
|
||||
|
||||
/**
|
||||
* Implements the MediaDriver interface for S3 storage.
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
import { beforeEach, describe, expect, it, mock } from "bun:test";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import { MediaBackendType } from "~/packages/config-manager/config.type";
|
||||
import { DiskMediaDriver } from "./drivers/disk";
|
||||
import { S3MediaDriver } from "./drivers/s3";
|
||||
import { MediaManager } from "./media-manager";
|
||||
import type { ImageConversionPreprocessor } from "./preprocessors/image-conversion";
|
||||
import { DiskMediaDriver } from "./drivers/disk.ts";
|
||||
import { S3MediaDriver } from "./drivers/s3.ts";
|
||||
import { MediaManager } from "./media-manager.ts";
|
||||
import type { ImageConversionPreprocessor } from "./preprocessors/image-conversion.ts";
|
||||
|
||||
describe("MediaManager", () => {
|
||||
let mediaManager: MediaManager;
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
*/
|
||||
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import { DiskMediaDriver } from "./drivers/disk";
|
||||
import type { MediaDriver } from "./drivers/media-driver";
|
||||
import { S3MediaDriver } from "./drivers/s3";
|
||||
import { BlurhashPreprocessor } from "./preprocessors/blurhash";
|
||||
import { ImageConversionPreprocessor } from "./preprocessors/image-conversion";
|
||||
import type { MediaPreprocessor } from "./preprocessors/media-preprocessor";
|
||||
import { DiskMediaDriver } from "./drivers/disk.ts";
|
||||
import type { MediaDriver } from "./drivers/media-driver.ts";
|
||||
import { S3MediaDriver } from "./drivers/s3.ts";
|
||||
import { BlurhashPreprocessor } from "./preprocessors/blurhash.ts";
|
||||
import { ImageConversionPreprocessor } from "./preprocessors/image-conversion.ts";
|
||||
import type { MediaPreprocessor } from "./preprocessors/media-preprocessor.ts";
|
||||
|
||||
/**
|
||||
* Manages media operations with support for different storage drivers and preprocessing plugins.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { beforeEach, describe, expect, it, mock } from "bun:test";
|
||||
import sharp from "sharp";
|
||||
import { BlurhashPreprocessor } from "./blurhash";
|
||||
import { BlurhashPreprocessor } from "./blurhash.ts";
|
||||
|
||||
describe("BlurhashPreprocessor", () => {
|
||||
let preprocessor: BlurhashPreprocessor;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { encode } from "blurhash";
|
||||
import sharp from "sharp";
|
||||
import type { MediaPreprocessor } from "./media-preprocessor";
|
||||
import type { MediaPreprocessor } from "./media-preprocessor.ts";
|
||||
|
||||
export class BlurhashPreprocessor implements MediaPreprocessor {
|
||||
public async process(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { beforeEach, describe, expect, it } from "bun:test";
|
||||
import sharp from "sharp";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import { ImageConversionPreprocessor } from "./image-conversion";
|
||||
import { ImageConversionPreprocessor } from "./image-conversion.ts";
|
||||
|
||||
describe("ImageConversionPreprocessor", () => {
|
||||
let preprocessor: ImageConversionPreprocessor;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import sharp from "sharp";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import type { MediaPreprocessor } from "./media-preprocessor";
|
||||
import type { MediaPreprocessor } from "./media-preprocessor.ts";
|
||||
|
||||
/**
|
||||
* Supported input media formats.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
import { ZodError, type ZodTypeAny, z } from "zod";
|
||||
import { Plugin } from "~/packages/plugin-kit";
|
||||
import { type Manifest, manifestSchema } from "~/packages/plugin-kit/schema";
|
||||
import { PluginLoader } from "./loader";
|
||||
import { PluginLoader } from "./loader.ts";
|
||||
|
||||
const mockReaddir = jest.fn();
|
||||
const mockGetLogger = jest.fn(() => ({
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { db } from "~/drizzle/db";
|
|||
import { Emojis, Instances, Users } from "~/drizzle/schema";
|
||||
import { Instance } from "~/packages/database-interface/instance";
|
||||
import { User } from "~/packages/database-interface/user";
|
||||
import { BaseCommand } from "./base";
|
||||
import { BaseCommand } from "./base.ts";
|
||||
|
||||
export type FlagsType<T extends typeof Command> = Interfaces.InferredFlags<
|
||||
(typeof BaseCommand)["baseFlags"] & T["flags"]
|
||||
|
|
|
|||
28
cli/index.ts
28
cli/index.ts
|
|
@ -1,19 +1,19 @@
|
|||
import { configureLoggers } from "@/loggers";
|
||||
import { execute } from "@oclif/core";
|
||||
import EmojiAdd from "./commands/emoji/add";
|
||||
import EmojiDelete from "./commands/emoji/delete";
|
||||
import EmojiImport from "./commands/emoji/import";
|
||||
import EmojiList from "./commands/emoji/list";
|
||||
import FederationInstanceFetch from "./commands/federation/instance/fetch";
|
||||
import FederationUserFetch from "./commands/federation/user/fetch";
|
||||
import FederationUserFinger from "./commands/federation/user/finger";
|
||||
import IndexRebuild from "./commands/index/rebuild";
|
||||
import Start from "./commands/start";
|
||||
import UserCreate from "./commands/user/create";
|
||||
import UserDelete from "./commands/user/delete";
|
||||
import UserList from "./commands/user/list";
|
||||
import UserRefetch from "./commands/user/refetch";
|
||||
import UserReset from "./commands/user/reset";
|
||||
import EmojiAdd from "./commands/emoji/add.ts";
|
||||
import EmojiDelete from "./commands/emoji/delete.ts";
|
||||
import EmojiImport from "./commands/emoji/import.ts";
|
||||
import EmojiList from "./commands/emoji/list.ts";
|
||||
import FederationInstanceFetch from "./commands/federation/instance/fetch.ts";
|
||||
import FederationUserFetch from "./commands/federation/user/fetch.ts";
|
||||
import FederationUserFinger from "./commands/federation/user/finger.ts";
|
||||
import IndexRebuild from "./commands/index/rebuild.ts";
|
||||
import Start from "./commands/start.ts";
|
||||
import UserCreate from "./commands/user/create.ts";
|
||||
import UserDelete from "./commands/user/delete.ts";
|
||||
import UserList from "./commands/user/list.ts";
|
||||
import UserRefetch from "./commands/user/refetch.ts";
|
||||
import UserReset from "./commands/user/reset.ts";
|
||||
|
||||
await configureLoggers();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Config } from "drizzle-kit";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
|
||||
export default {
|
||||
dialect: "postgresql",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { withReplicas } from "drizzle-orm/pg-core";
|
|||
import { migrate } from "drizzle-orm/postgres-js/migrator";
|
||||
import { Pool } from "pg";
|
||||
import { config } from "~/packages/config-manager";
|
||||
import * as schema from "./schema";
|
||||
import * as schema from "./schema.ts";
|
||||
|
||||
const primaryDb = new Pool({
|
||||
host: config.database.host,
|
||||
|
|
|
|||
4
index.ts
4
index.ts
|
|
@ -2,7 +2,7 @@ import cluster from "node:cluster";
|
|||
import { sentry } from "@/sentry";
|
||||
import { createServer } from "@/server";
|
||||
import { appFactory } from "~/app";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
|
||||
process.on("SIGINT", () => {
|
||||
process.exit();
|
||||
|
|
@ -12,7 +12,7 @@ if (cluster.isPrimary) {
|
|||
for (let i = 0; i < Number(process.env.NUM_CPUS ?? 1); i++) {
|
||||
cluster.fork();
|
||||
}
|
||||
await import("./setup");
|
||||
await import("./setup.ts");
|
||||
sentry?.captureMessage("Server started", "info");
|
||||
} else {
|
||||
createServer(config, await appFactory());
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import { z } from "zod";
|
|||
import { db } from "~/drizzle/db";
|
||||
import { Attachments } from "~/drizzle/schema";
|
||||
import { MediaBackendType } from "~/packages/config-manager/config.type";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { BaseInterface } from "./base";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
|
||||
export type AttachmentType = InferSelectModel<typeof Attachments>;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import {
|
|||
import { z } from "zod";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Emojis, Instances } from "~/drizzle/schema";
|
||||
import { BaseInterface } from "./base";
|
||||
import { Instance } from "./instance";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
import { Instance } from "./instance.ts";
|
||||
|
||||
export type EmojiWithInstance = InferSelectModel<typeof Emojis> & {
|
||||
instance: InferSelectModel<typeof Instances> | null;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ import {
|
|||
} from "drizzle-orm";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Instances } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { BaseInterface } from "./base";
|
||||
import { User } from "./user";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
import { User } from "./user.ts";
|
||||
|
||||
export type AttachmentType = InferSelectModel<typeof Instances>;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ import {
|
|||
Users,
|
||||
} from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager";
|
||||
import { Attachment } from "./attachment";
|
||||
import { BaseInterface } from "./base";
|
||||
import { Emoji } from "./emoji";
|
||||
import { User } from "./user";
|
||||
import { Attachment } from "./attachment.ts";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
import { Emoji } from "./emoji.ts";
|
||||
import { User } from "./user.ts";
|
||||
|
||||
/**
|
||||
* Gives helpers to fetch notes from database in a nice format
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import {
|
|||
import { z } from "zod";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Relationships } from "~/drizzle/schema";
|
||||
import { BaseInterface } from "./base";
|
||||
import type { User } from "./user";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
import type { User } from "./user.ts";
|
||||
|
||||
export type RelationshipType = InferSelectModel<typeof Relationships>;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import {
|
|||
import { z } from "zod";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { RoleToUsers, Roles } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { BaseInterface } from "./base";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
|
||||
export type RoleType = InferSelectModel<typeof Roles>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { type SQL, gt } from "drizzle-orm";
|
||||
import { Notes, Users } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager";
|
||||
import { Note } from "./note";
|
||||
import { User } from "./user";
|
||||
import { Note } from "./note.ts";
|
||||
import { User } from "./user.ts";
|
||||
|
||||
enum TimelineType {
|
||||
Note = "Note",
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ import {
|
|||
} from "~/drizzle/schema";
|
||||
import { type Config, config } from "~/packages/config-manager";
|
||||
import type { KnownEntity } from "~/types/api.ts";
|
||||
import { BaseInterface } from "./base";
|
||||
import { Emoji } from "./emoji";
|
||||
import { Instance } from "./instance";
|
||||
import type { Note } from "./note";
|
||||
import { Relationship } from "./relationship";
|
||||
import { Role } from "./role";
|
||||
import { BaseInterface } from "./base.ts";
|
||||
import { Emoji } from "./emoji.ts";
|
||||
import { Instance } from "./instance.ts";
|
||||
import type { Note } from "./note.ts";
|
||||
import { Relationship } from "./relationship.ts";
|
||||
import { Role } from "./role.ts";
|
||||
|
||||
/**
|
||||
* Gives helpers to fetch users from database in a nice format
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { z } from "zod";
|
||||
import { Hooks } from "./hooks";
|
||||
import { Plugin } from "./plugin";
|
||||
import { Hooks } from "./hooks.ts";
|
||||
import { Plugin } from "./plugin.ts";
|
||||
|
||||
const myPlugin = new Plugin(
|
||||
z.object({
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Hooks } from "./hooks";
|
||||
import { Plugin } from "./plugin";
|
||||
import type { Manifest } from "./schema";
|
||||
import { Hooks } from "./hooks.ts";
|
||||
import { Plugin } from "./plugin.ts";
|
||||
import type { Manifest } from "./schema.ts";
|
||||
|
||||
export type { Manifest };
|
||||
export { Plugin, Hooks };
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { zodToJsonSchema } from "zod-to-json-schema";
|
||||
import { manifestSchema } from "./schema";
|
||||
import { manifestSchema } from "./schema.ts";
|
||||
|
||||
const jsonSchema = zodToJsonSchema(manifestSchema);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { OpenAPIHono } from "@hono/zod-openapi";
|
|||
import type { z } from "zod";
|
||||
import { type ZodError, fromZodError } from "zod-validation-error";
|
||||
import type { HonoEnv } from "~/types/api";
|
||||
import type { ServerHooks } from "./hooks";
|
||||
import type { ServerHooks } from "./hooks.ts";
|
||||
|
||||
export type HonoPluginEnv<ConfigType extends z.ZodTypeAny> = HonoEnv & {
|
||||
Variables: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Hooks, Plugin } from "@versia/kit";
|
||||
import { z } from "zod";
|
||||
import authorizeRoute from "./routes/authorize";
|
||||
import tokenRevokeRoute from "./routes/oauth/revoke";
|
||||
import tokenRoute from "./routes/oauth/token";
|
||||
import ssoRoute from "./routes/sso";
|
||||
import ssoIdRoute from "./routes/sso/:id/index";
|
||||
import authorizeRoute from "./routes/authorize.ts";
|
||||
import tokenRevokeRoute from "./routes/oauth/revoke.ts";
|
||||
import tokenRoute from "./routes/oauth/token.ts";
|
||||
import ssoIdRoute from "./routes/sso/:id/index.ts";
|
||||
import ssoRoute from "./routes/sso/index.ts";
|
||||
|
||||
const plugin = new Plugin(
|
||||
z.object({
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { JOSEError } from "jose/errors";
|
|||
import { z } from "zod";
|
||||
import { TokenType } from "~/classes/functions/token";
|
||||
import { User } from "~/packages/database-interface/user";
|
||||
import type { PluginType } from "../index";
|
||||
import type { PluginType } from "../index.ts";
|
||||
|
||||
const schemas = {
|
||||
query: z.object({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { createRoute, z } from "@hono/zod-openapi";
|
|||
import { db } from "@versia/kit/db";
|
||||
import { eq } from "@versia/kit/drizzle";
|
||||
import { Tokens } from "@versia/kit/tables";
|
||||
import type { PluginType } from "../..";
|
||||
import type { PluginType } from "../../index.ts";
|
||||
|
||||
export const schemas = {
|
||||
json: z.object({
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { createRoute, z } from "@hono/zod-openapi";
|
|||
import { db } from "@versia/kit/db";
|
||||
import { eq } from "@versia/kit/drizzle";
|
||||
import { Tokens } from "@versia/kit/tables";
|
||||
import type { PluginType } from "../..";
|
||||
import type { PluginType } from "../../index.ts";
|
||||
|
||||
export const schemas = {
|
||||
json: z.object({
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import {
|
|||
} from "oauth4webapi";
|
||||
import { z } from "zod";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
import type { PluginType } from "../..";
|
||||
import { oauthDiscoveryRequest, oauthRedirectUri } from "../../utils";
|
||||
import type { PluginType } from "../../index.ts";
|
||||
import { oauthDiscoveryRequest, oauthRedirectUri } from "../../utils.ts";
|
||||
|
||||
export default (plugin: PluginType) => {
|
||||
plugin.registerRoute("/api/v1/sso", (app) => {
|
||||
|
|
|
|||
4
setup.ts
4
setup.ts
|
|
@ -2,9 +2,9 @@ import { checkConfig } from "@/init";
|
|||
import { configureLoggers } from "@/loggers";
|
||||
import { getLogger } from "@logtape/logtape";
|
||||
import { setupDatabase } from "~/drizzle/db";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { Note } from "~/packages/database-interface/note";
|
||||
import { searchManager } from "./classes/search/search-manager";
|
||||
import { searchManager } from "./classes/search/search-manager.ts";
|
||||
|
||||
const timeAtStart = performance.now();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { afterAll, describe, expect, test } from "bun:test";
|
||||
import { fakeRequest, getTestUsers } from "./utils";
|
||||
import { fakeRequest, getTestUsers } from "./utils.ts";
|
||||
|
||||
const { tokens, deleteUsers } = await getTestUsers(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import type {
|
|||
Account as ApiAccount,
|
||||
Relationship as ApiRelationship,
|
||||
} from "@versia/client/types";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
||||
|
||||
const { users, tokens, deleteUsers } = await getTestUsers(2);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import type {
|
|||
Application as ApiApplication,
|
||||
Token as ApiToken,
|
||||
} from "@versia/client/types";
|
||||
import { fakeRequest, getTestUsers } from "./utils";
|
||||
import { fakeRequest, getTestUsers } from "./utils.ts";
|
||||
|
||||
let clientId: string;
|
||||
let clientSecret: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { setupDatabase } from "~/drizzle/db";
|
||||
import { deleteOldTestUsers } from "./utils";
|
||||
import { deleteOldTestUsers } from "./utils.ts";
|
||||
|
||||
await setupDatabase();
|
||||
await deleteOldTestUsers();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import type { Application } from "~/classes/functions/application";
|
|||
import { type AuthData, getFromHeader } from "~/classes/functions/user";
|
||||
import { db } from "~/drizzle/db";
|
||||
import { Challenges } from "~/drizzle/schema";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
import type { User } from "~/packages/database-interface/user";
|
||||
import type { ApiRouteMetadata, HonoEnv, HttpVerb } from "~/types/api";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
|
||||
export const oauthRedirectUri = (issuer: string) =>
|
||||
new URL(`/oauth/sso/${issuer}/callback`, config.http.base_url).toString();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { getLogger } from "@logtape/logtape";
|
||||
import { markdownParse } from "~/classes/functions/status";
|
||||
import { sentry } from "./sentry";
|
||||
import { sentry } from "./sentry.ts";
|
||||
|
||||
export const renderMarkdownInPath = async (
|
||||
path: string,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as Sentry from "@sentry/bun";
|
||||
import pkg from "~/package.json";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
|
||||
const sentryInstance =
|
||||
config.logging.sentry.enabled &&
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { OpenAPIHono } from "@hono/zod-openapi";
|
||||
import type { Config } from "~/packages/config-manager/config.type";
|
||||
import type { HonoEnv } from "~/types/api";
|
||||
import { debugResponse } from "./api";
|
||||
import { debugResponse } from "./api.ts";
|
||||
|
||||
export const createServer = (config: Config, app: OpenAPIHono<HonoEnv>) =>
|
||||
Bun.serve({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import type {
|
|||
import type { Status, findManyNotes } from "~/classes/functions/status";
|
||||
import type { UserType, findManyUsers } from "~/classes/functions/user";
|
||||
import type { db } from "~/drizzle/db";
|
||||
import { config } from "~/packages/config-manager/index";
|
||||
import { config } from "~/packages/config-manager/index.ts";
|
||||
|
||||
export async function fetchTimeline<T extends UserType | Status | Notification>(
|
||||
model:
|
||||
|
|
|
|||
Loading…
Reference in a new issue