chore: ⬆️ Upgrade dependencies

This commit is contained in:
Jesse Wierzbinski 2025-12-10 21:26:02 +01:00
parent a951a08073
commit b35e54c9b4
No known key found for this signature in database
11 changed files with 370 additions and 285 deletions

View file

@ -1,3 +1,4 @@
import { Clerc } from "@clerc/core";
import { completionsPlugin } from "@clerc/plugin-completions";
import { friendlyErrorPlugin } from "@clerc/plugin-friendly-error";
import { helpPlugin } from "@clerc/plugin-help";
@ -5,7 +6,6 @@ import { notFoundPlugin } from "@clerc/plugin-not-found";
import { versionPlugin } from "@clerc/plugin-version";
import { setupDatabase } from "@versia-server/kit/db";
import { searchManager } from "@versia-server/kit/search";
import { Clerc } from "clerc";
import pkg from "../package.json" with { type: "json" };
import { rebuildIndexCommand } from "./index/rebuild.ts";
import { refetchInstanceCommand } from "./instance/refetch.ts";

View file

@ -1,25 +1,21 @@
import { defineCommand } from "@clerc/core";
import { config } from "@versia-server/config";
import { SonicIndexType, searchManager } from "@versia-server/kit/search";
// @ts-expect-error - Root import is required or the Clec type definitions won't work
// biome-ignore lint/correctness/noUnusedImports: Root import is required or the Clec type definitions won't work
import { defineCommand, type Root } from "clerc";
import ora from "ora";
export const rebuildIndexCommand = defineCommand(
{
name: "index rebuild",
description: "Rebuild the search index.",
parameters: ["<type>"],
flags: {
"batch-size": {
description: "Number of records to process at once",
type: Number,
alias: "b",
default: 100,
},
export const rebuildIndexCommand = defineCommand({
name: "index rebuild",
description: "Rebuild the search index.",
parameters: ["<type>"],
flags: {
"batch-size": {
description: "Number of records to process at once",
type: Number,
alias: "b",
default: 100,
},
},
async (context) => {
handler: async (context) => {
const { "batch-size": batchSize } = context.flags;
const { type } = context.parameters;
@ -59,4 +55,4 @@ export const rebuildIndexCommand = defineCommand(
spinner.succeed("Search indexes rebuilt");
},
);
});

View file

@ -1,24 +1,20 @@
import { defineCommand } from "@clerc/core";
import { Instance } from "@versia-server/kit/db";
import { FetchJobType, fetchQueue } from "@versia-server/kit/queues/fetch";
import { Instances } from "@versia-server/kit/tables";
import chalk from "chalk";
// @ts-expect-error - Root import is required or the Clec type definitions won't work
// biome-ignore lint/correctness/noUnusedImports: Root import is required or the Clec type definitions won't work
import { defineCommand, type Root } from "clerc";
import { eq } from "drizzle-orm";
export const refetchInstanceCommand = defineCommand(
{
name: "instance refetch",
description: "Refetches metadata from remote instances.",
parameters: ["<url_or_host>"],
},
async (context) => {
const { urlOrHost } = context.parameters;
export const refetchInstanceCommand = defineCommand({
name: "instance refetch",
description: "Refetches metadata from remote instances.",
parameters: ["<url_or_host>"],
handler: async (context) => {
const { url_or_host } = context.parameters;
const host = URL.canParse(urlOrHost)
? new URL(urlOrHost).host
: urlOrHost;
const host = URL.canParse(url_or_host)
? new URL(url_or_host).host
: url_or_host;
const instance = await Instance.fromSql(eq(Instances.baseUrl, host));
@ -34,4 +30,4 @@ export const refetchInstanceCommand = defineCommand(
`Refresh job enqueued for ${chalk.gray(instance.data.baseUrl)}.`,
);
},
);
});

View file

@ -1,38 +1,34 @@
import { defineCommand } from "@clerc/core";
import { config } from "@versia-server/config";
import { User } from "@versia-server/kit/db";
import { searchManager } from "@versia-server/kit/search";
import { Users } from "@versia-server/kit/tables";
import chalk from "chalk";
// @ts-expect-error - Root import is required or the Clec type definitions won't work
// biome-ignore lint/correctness/noUnusedImports: Root import is required or the Clec type definitions won't work
import { defineCommand, type Root } from "clerc";
import { and, eq, isNull } from "drizzle-orm";
import { renderUnicodeCompact } from "uqr";
export const createUserCommand = defineCommand(
{
name: "user create",
description: "Create a new user.",
parameters: ["<username>"],
flags: {
password: {
description: "Password for the new user",
type: String,
alias: "p",
},
email: {
description: "Email for the new user",
type: String,
alias: "e",
},
admin: {
description: "Make the new user an admin",
type: Boolean,
alias: "a",
},
export const createUserCommand = defineCommand({
name: "user create",
description: "Create a new user.",
parameters: ["<username>"],
flags: {
password: {
description: "Password for the new user",
type: String,
alias: "p",
},
email: {
description: "Email for the new user",
type: String,
alias: "e",
},
admin: {
description: "Make the new user an admin",
type: Boolean,
alias: "a",
},
},
async (context) => {
handler: async (context) => {
const { admin, email, password } = context.flags;
const { username } = context.parameters;
@ -87,4 +83,4 @@ export const createUserCommand = defineCommand(
console.info(`\n ${qrcode.replaceAll("\n", "\n ")}`);
}
},
);
});

View file

@ -1,34 +1,31 @@
import { defineCommand } from "@clerc/core";
import confirm from "@inquirer/confirm";
import chalk from "chalk";
// @ts-expect-error - Root import is required or the Clec type definitions won't work
// biome-ignore lint/correctness/noUnusedImports: Root import is required or the Clec type definitions won't work
import { defineCommand, type Root } from "clerc";
import { retrieveUser } from "../utils.ts";
export const deleteUserCommand = defineCommand(
{
name: "user delete",
alias: "user rm",
description:
"Delete a user from the database. Can use username or handle.",
parameters: ["<username_or_handle>"],
flags: {
confirm: {
description: "Ask for confirmation before deleting the user",
type: Boolean,
alias: "c",
default: true,
},
export const deleteUserCommand = defineCommand({
name: "user delete",
alias: "user rm",
description: "Delete a user from the database. Can use username or handle.",
parameters: ["<username_or_handle>"],
flags: {
confirm: {
description: "Ask for confirmation before deleting the user",
type: Boolean,
alias: "c",
default: true,
},
},
async (context) => {
handler: async (context) => {
const { confirm: confirmFlag } = context.flags;
const { usernameOrHandle } = context.parameters;
const { username_or_handle } = context.parameters;
const user = await retrieveUser(usernameOrHandle);
const user = await retrieveUser(username_or_handle);
if (!user) {
throw new Error(`User ${chalk.gray(usernameOrHandle)} not found.`);
throw new Error(
`User ${chalk.gray(username_or_handle)} not found.`,
);
}
console.info(`About to delete user ${chalk.gray(user.data.username)}!`);
@ -57,4 +54,4 @@ export const deleteUserCommand = defineCommand(
`User ${chalk.gray(user.data.username)} has been deleted.`,
);
},
);
});

View file

@ -1,18 +1,14 @@
import { defineCommand } from "@clerc/core";
import { User } from "@versia-server/kit/db";
import chalk from "chalk";
// @ts-expect-error - Root import is required or the Clec type definitions won't work
// biome-ignore lint/correctness/noUnusedImports: Root import is required or the Clec type definitions won't work
import { defineCommand, type Root } from "clerc";
import ora from "ora";
import { retrieveUser } from "../utils.ts";
export const refetchUserCommand = defineCommand(
{
name: "user refetch",
description: "Refetches user data from their remote instance.",
parameters: ["<handle>"],
},
async (context) => {
export const refetchUserCommand = defineCommand({
name: "user refetch",
description: "Refetches user data from their remote instance.",
parameters: ["<handle>"],
handler: async (context) => {
const { handle } = context.parameters;
const user = await retrieveUser(handle);
@ -40,4 +36,4 @@ export const refetchUserCommand = defineCommand(
spinner.succeed(`User ${chalk.gray(user.data.username)} refetched.`);
},
);
});

View file

@ -1,19 +1,15 @@
import { defineCommand } from "@clerc/core";
import { Client, Token } from "@versia-server/kit/db";
import { randomUUIDv7 } from "bun";
import chalk from "chalk";
// @ts-expect-error - Root import is required or the Clec type definitions won't work
// biome-ignore lint/correctness/noUnusedImports: Root import is required or the Clec type definitions won't work
import { defineCommand, type Root } from "clerc";
import { randomString } from "@/math.ts";
import { retrieveUser } from "../utils.ts";
export const generateTokenCommand = defineCommand(
{
name: "user token",
description: "Generates a new access token for a user.",
parameters: ["<username>"],
},
async (context) => {
export const generateTokenCommand = defineCommand({
name: "user token",
description: "Generates a new access token for a user.",
parameters: ["<username>"],
handler: async (context) => {
const { username } = context.parameters;
const user = await retrieveUser(username);
@ -47,4 +43,4 @@ export const generateTokenCommand = defineCommand(
);
console.info(`Access Token: ${chalk.blue(token.data.accessToken)}`);
},
);
});