Update dependencies, fix (auto)import problems
This commit is contained in:
parent
267a83d484
commit
1d893c4a78
40 changed files with 5166 additions and 3047 deletions
|
@ -1,12 +1,12 @@
|
|||
/* global defineEventHandler, getQuery, createError, readBody, setResponseStatus */
|
||||
import { QueryObject } from "ufo";
|
||||
import { H3Event } from "h3";
|
||||
import { ResultSetHeader } from "mysql2/promise";
|
||||
import { defineEventHandler, getQuery, readBody, setResponseStatus, H3Event } from "h3";
|
||||
import { type ResultSetHeader } from "mysql2/promise";
|
||||
|
||||
import { data, database } from "./database";
|
||||
import { type data, database } from "./database";
|
||||
import { isString } from "./isString";
|
||||
import Snowflake from "~/utils/snowflake";
|
||||
import { client } from "~/utils/types/database";
|
||||
import { type client } from "~/utils/types/database";
|
||||
|
||||
import { createError } from "#imports";
|
||||
|
||||
type queryType = {
|
||||
type: "before" | "after" | "around",
|
||||
|
@ -33,7 +33,7 @@ export default class BaaPagination<T extends {[k: string]: any}, keyType extends
|
|||
* @param query the query to parse
|
||||
* @throws if query malformed (multiple before/after/around)
|
||||
*/
|
||||
static getLocationParameterType(query: QueryObject): queryType {
|
||||
static getLocationParameterType(query: any): queryType {
|
||||
const before = query.before;
|
||||
const after = query.after;
|
||||
const around = query.around;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import mysql, { Connection } from "mysql2/promise";
|
||||
import mysql, { type Connection } from "mysql2/promise";
|
||||
|
||||
const connectionOptions: mysql.ConnectionOptions = {
|
||||
host: process.env.DB_HOST,
|
||||
|
@ -12,8 +12,8 @@ const connectionOptions: mysql.ConnectionOptions = {
|
|||
|
||||
export const database =
|
||||
await mysql.createConnection(connectionOptions) as Connection & {
|
||||
new: (localConnectionOptions: mysql.ConnectionOptions | undefined) => Promise<Connection>
|
||||
new: (localConnectionOptions?: mysql.ConnectionOptions | undefined) => Promise<Connection>
|
||||
};
|
||||
database.new = (localConnectionOptions: mysql.ConnectionOptions | undefined) => { return mysql.createConnection({ ...localConnectionOptions, ...connectionOptions }); };
|
||||
database.new = (localConnectionOptions?: mysql.ConnectionOptions | undefined) => { return mysql.createConnection({ ...localConnectionOptions, ...connectionOptions }); };
|
||||
|
||||
export type data<T> = [T[], mysql.FieldPacket[]];
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/* global getCookie, createError */
|
||||
import { H3Event } from "h3";
|
||||
import { getCookie, H3Event } from "h3";
|
||||
|
||||
import { database, data } from "./database";
|
||||
import { user } from "~/utils/types/database";
|
||||
import { database, type data } from "./database";
|
||||
import { type user } from "~/utils/types/database";
|
||||
|
||||
import { createError } from "#imports";
|
||||
|
||||
export default async function getRequestingUser(e: H3Event) {
|
||||
const cookie = getCookie(e, "token");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global createError */
|
||||
import { createError } from "#imports";
|
||||
|
||||
export function createValidationError(errors: Map<string, string>) {
|
||||
let message = "Invalid parameters: ";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue