mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
Update Prisma to 6.11 (#133)
* chore: update prisma to 6.11 more prisma future proofing due to experimental features * chore: update dependencies twemoji - new unicode update argon2 - bux fixes vue3-carousel - improve mobile experiance vue-tsc - more stable * fix: incorrect prisma version in docker Also remove default value for BUILD_DROP_VERSION, that is now handled in nuxt config * fix: no logging in prod * chore: optimize docker builds even more * fix: revert adoption of prisma driverAdapters see: https://github.com/prisma/prisma/issues/27486 * chore: optimize dockerignore some more * Fix `pino-pretty` not being included in build (#135) * Remove `pino` from frontend * Fix for downloads and removing of library source (#136) * fix: downloads and removing library source * fix: linting * Fix max file size of 4GB (update droplet) (#137) * Fix manual metadata import (#138) * chore(deps): bump vue-i18n from 10.0.7 to 10.0.8 (#140) Bumps [vue-i18n](https://github.com/intlify/vue-i18n/tree/HEAD/packages/vue-i18n) from 10.0.7 to 10.0.8. - [Release notes](https://github.com/intlify/vue-i18n/releases) - [Changelog](https://github.com/intlify/vue-i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/intlify/vue-i18n/commits/v10.0.8/packages/vue-i18n) --- updated-dependencies: - dependency-name: vue-i18n dependency-version: 10.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump @intlify/core from 10.0.7 to 10.0.8 (#139) --- updated-dependencies: - dependency-name: "@intlify/core" dependency-version: 10.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Small fixes (#141) * fix: save task as Json rather than string * fix: pull objects before creating game in database * fix: strips relative dirs from version information * fix: #132 * fix: lint * fix: news object ids and small tweaks * fix: notification styling errors * fix: lint * fix: build issues by regenerating lockfile --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: DecDuck <declanahofmeyr@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { APITokenMode } from "~/prisma/client";
|
||||
import { APITokenMode } from "~/prisma/client/enums";
|
||||
import prisma from "../db/database";
|
||||
import sessionHandler from "../session";
|
||||
import type { MinimumRequestObject } from "~/server/h3";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { AuthMec } from "~/prisma/client";
|
||||
import { AuthMec } from "~/prisma/client/enums";
|
||||
import { OIDCManager } from "./oidc";
|
||||
import { logger } from "~/server/internal/logging";
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { randomUUID } from "crypto";
|
||||
import prisma from "../../db/database";
|
||||
import type { User } from "~/prisma/client";
|
||||
import { AuthMec } from "~/prisma/client";
|
||||
import type { UserModel } from "~/prisma/client/models";
|
||||
import { AuthMec } from "~/prisma/client/enums";
|
||||
import objectHandler from "../../objects";
|
||||
import type { Readable } from "stream";
|
||||
import * as jdenticon from "jdenticon";
|
||||
@ -165,7 +165,7 @@ export class OIDCManager {
|
||||
async authorize(
|
||||
code: string,
|
||||
state: string,
|
||||
): Promise<{ user: User; options: OIDCAuthSessionOptions } | string> {
|
||||
): Promise<{ user: UserModel; options: OIDCAuthSessionOptions } | string> {
|
||||
const session = this.signinStateTable[state];
|
||||
if (!session) return "Invalid state parameter";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { EnumDictionary } from "../utils/types";
|
||||
import prisma from "../db/database";
|
||||
import { ClientCapabilities } from "~/prisma/client";
|
||||
import { ClientCapabilities } from "~/prisma/client/enums";
|
||||
|
||||
// These values are technically mapped to the database,
|
||||
// but Typescript/Prisma doesn't let me link them
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { Client, User } from "~/prisma/client";
|
||||
import type { ClientModel, UserModel } from "~/prisma/client/models";
|
||||
import type { EventHandlerRequest, H3Event } from "h3";
|
||||
import droplet from "@drop-oss/droplet";
|
||||
import prisma from "../db/database";
|
||||
@ -11,8 +11,8 @@ export type EventHandlerFunction<T> = (
|
||||
|
||||
type ClientUtils = {
|
||||
clientId: string;
|
||||
fetchClient: () => Promise<Client>;
|
||||
fetchUser: () => Promise<User>;
|
||||
fetchClient: () => Promise<ClientModel>;
|
||||
fetchUser: () => Promise<UserModel>;
|
||||
};
|
||||
|
||||
const NONCE_LENIENCE = 30_000;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import prisma from "../db/database";
|
||||
import type { Platform } from "~/prisma/client";
|
||||
import type { Platform } from "~/prisma/client/enums";
|
||||
import { useCertificateAuthority } from "~/server/plugins/ca";
|
||||
import type {
|
||||
CapabilityConfiguration,
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import type { ApplicationSettings } from "~/prisma/client";
|
||||
import type { ApplicationSettingsModel } from "~/prisma/client/models";
|
||||
import prisma from "../db/database";
|
||||
|
||||
class ApplicationConfiguration {
|
||||
// Reference to the currently selected application configuration
|
||||
private currentApplicationSettings: ApplicationSettings | undefined =
|
||||
private currentApplicationSettings: ApplicationSettingsModel | undefined =
|
||||
undefined;
|
||||
|
||||
private async save() {
|
||||
await this.init();
|
||||
|
||||
const deepAppConfigCopy: Omit<ApplicationSettings, "timestamp"> & {
|
||||
const deepAppConfigCopy: Omit<ApplicationSettingsModel, "timestamp"> & {
|
||||
timestamp?: Date;
|
||||
} = JSON.parse(JSON.stringify(this.currentApplicationSettings));
|
||||
|
||||
@ -56,9 +56,9 @@ class ApplicationConfiguration {
|
||||
this.currentApplicationSettings = latestState;
|
||||
}
|
||||
|
||||
async set<T extends keyof ApplicationSettings>(
|
||||
async set<T extends keyof ApplicationSettingsModel>(
|
||||
key: T,
|
||||
value: ApplicationSettings[T],
|
||||
value: ApplicationSettingsModel[T],
|
||||
) {
|
||||
await this.init();
|
||||
if (!this.currentApplicationSettings)
|
||||
@ -71,9 +71,9 @@ class ApplicationConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
async get<T extends keyof ApplicationSettings>(
|
||||
async get<T extends keyof ApplicationSettingsModel>(
|
||||
key: T,
|
||||
): Promise<ApplicationSettings[T]> {
|
||||
): Promise<ApplicationSettingsModel[T]> {
|
||||
await this.init();
|
||||
if (!this.currentApplicationSettings)
|
||||
throw new Error("Somehow, failed to initialise application settings");
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
import { PrismaClient } from "~/prisma/client";
|
||||
import { PrismaClient } from "~/prisma/client/client";
|
||||
// import { PrismaPg } from "@prisma/adapter-pg";
|
||||
|
||||
const prismaClientSingleton = () => {
|
||||
return new PrismaClient({});
|
||||
// const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
|
||||
// const prisma = new PrismaClient({ adapter });
|
||||
const prisma = new PrismaClient();
|
||||
return prisma;
|
||||
};
|
||||
|
||||
declare const globalThis: {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { GameVersion } from "~/prisma/client";
|
||||
import type { GameVersionModel } from "~/prisma/client/models";
|
||||
import prisma from "../db/database";
|
||||
|
||||
export type DropChunk = {
|
||||
@ -54,7 +54,7 @@ class ManifestGenerator {
|
||||
|
||||
// Local function because eventual caching
|
||||
async generateManifest(gameId: string, versionName: string) {
|
||||
const versions: GameVersion[] = [];
|
||||
const versions: GameVersionModel[] = [];
|
||||
|
||||
const baseVersion = await prisma.gameVersion.findUnique({
|
||||
where: {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { LibraryBackend } from "~/prisma/client";
|
||||
import type { LibraryBackend } from "~/prisma/client/enums";
|
||||
|
||||
export abstract class LibraryProvider<CFG> {
|
||||
constructor(_config: CFG, _id: string) {
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
VersionNotFoundError,
|
||||
type LibraryProvider,
|
||||
} from "../provider";
|
||||
import { LibraryBackend } from "~/prisma/client";
|
||||
import { LibraryBackend } from "~/prisma/client/enums";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import droplet from "@drop-oss/droplet";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ArkErrors, type } from "arktype";
|
||||
import type { LibraryProvider } from "../provider";
|
||||
import { VersionNotFoundError } from "../provider";
|
||||
import { LibraryBackend } from "~/prisma/client";
|
||||
import { LibraryBackend } from "~/prisma/client/enums";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import droplet from "@drop-oss/droplet";
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
import pino from "pino";
|
||||
import "pino-pretty";
|
||||
import pinoPretty from "pino-pretty";
|
||||
|
||||
// call pino pretty so that it isn't excluded from the build
|
||||
pinoPretty();
|
||||
|
||||
export const logger = pino({
|
||||
transport: {
|
||||
@ -9,5 +12,3 @@ export const logger = pino({
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
logger.child({});
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { MetadataSource, type Company } from "~/prisma/client";
|
||||
import type { CompanyModel } from "~/prisma/client/models";
|
||||
import { MetadataSource } from "~/prisma/client/enums";
|
||||
import type { MetadataProvider } from ".";
|
||||
import { MissingMetadataProviderConfig } from ".";
|
||||
import type {
|
||||
@ -178,7 +179,7 @@ export class GiantBombProvider implements MetadataProvider {
|
||||
? this.turndown.turndown(gameData.description)
|
||||
: gameData.deck;
|
||||
|
||||
const publishers: Company[] = [];
|
||||
const publishers: CompanyModel[] = [];
|
||||
if (gameData.publishers) {
|
||||
for (const pub of gameData.publishers) {
|
||||
context?.logger.info(`Importing publisher "${pub.name}"`);
|
||||
@ -195,7 +196,7 @@ export class GiantBombProvider implements MetadataProvider {
|
||||
|
||||
context?.progress(35);
|
||||
|
||||
const developers: Company[] = [];
|
||||
const developers: CompanyModel[] = [];
|
||||
if (gameData.developers) {
|
||||
for (const dev of gameData.developers) {
|
||||
context?.logger.info(`Importing developer "${dev.name}"`);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Company } from "~/prisma/client";
|
||||
import { MetadataSource } from "~/prisma/client";
|
||||
import type { CompanyModel } from "~/prisma/client/models";
|
||||
import { MetadataSource } from "~/prisma/client/enums";
|
||||
import type { MetadataProvider } from ".";
|
||||
import { MissingMetadataProviderConfig } from ".";
|
||||
import type {
|
||||
@ -386,8 +386,8 @@ export class IGDBProvider implements MetadataProvider {
|
||||
|
||||
context?.progress(20);
|
||||
|
||||
const publishers: Company[] = [];
|
||||
const developers: Company[] = [];
|
||||
const publishers: CompanyModel[] = [];
|
||||
const developers: CompanyModel[] = [];
|
||||
for (const involvedCompany of currentGame.involved_companies ?? []) {
|
||||
// get details about the involved company
|
||||
const involved_company_response = await this.request<IGDBInvolvedCompany>(
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { type Prisma, MetadataSource } from "~/prisma/client";
|
||||
import type { Prisma } from "~/prisma/client/client";
|
||||
import { MetadataSource } from "~/prisma/client/enums";
|
||||
import prisma from "../db/database";
|
||||
import type {
|
||||
_FetchGameMetadataParams,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { MetadataSource } from "~/prisma/client";
|
||||
import { MetadataSource } from "~/prisma/client/enums";
|
||||
import type { MetadataProvider } from ".";
|
||||
import type {
|
||||
_FetchGameMetadataParams,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Company } from "~/prisma/client";
|
||||
import { MetadataSource } from "~/prisma/client";
|
||||
import type { CompanyModel } from "~/prisma/client/models";
|
||||
import { MetadataSource } from "~/prisma/client/enums";
|
||||
import type { MetadataProvider } from ".";
|
||||
import type {
|
||||
GameMetadataSearchResult,
|
||||
@ -396,7 +396,7 @@ export class PCGamingWikiProvider implements MetadataProvider {
|
||||
|
||||
const game = res.data.cargoquery[0].title;
|
||||
|
||||
const publishers: Company[] = [];
|
||||
const publishers: CompanyModel[] = [];
|
||||
if (game.Publishers !== null) {
|
||||
context?.logger.info("Found publishers, importing...");
|
||||
const pubListClean = this.parseWikiStringArray(game.Publishers);
|
||||
@ -416,7 +416,7 @@ export class PCGamingWikiProvider implements MetadataProvider {
|
||||
|
||||
context?.progress(40);
|
||||
|
||||
const developers: Company[] = [];
|
||||
const developers: CompanyModel[] = [];
|
||||
if (game.Developers !== null) {
|
||||
context?.logger.info("Found developers, importing...");
|
||||
const devListClean = this.parseWikiStringArray(game.Developers);
|
||||
|
||||
@ -6,7 +6,7 @@ Design goals:
|
||||
2. Real-time; use websocket listeners to keep clients up-to-date
|
||||
*/
|
||||
|
||||
import type { Notification } from "~/prisma/client";
|
||||
import type { NotificationModel } from "~/prisma/client/models";
|
||||
import prisma from "../db/database";
|
||||
import type { GlobalACL } from "../acls";
|
||||
|
||||
@ -14,7 +14,7 @@ import type { GlobalACL } from "../acls";
|
||||
|
||||
// TODO: document notification action format
|
||||
export type NotificationCreateArgs = Pick<
|
||||
Notification,
|
||||
NotificationModel,
|
||||
"title" | "description" | "actions" | "nonce"
|
||||
> & { acls: Array<GlobalACL> };
|
||||
|
||||
@ -24,7 +24,7 @@ class NotificationSystem {
|
||||
string,
|
||||
Map<
|
||||
string,
|
||||
{ callback: (notification: Notification) => void; acls: GlobalACL[] }
|
||||
{ callback: (notification: NotificationModel) => void; acls: GlobalACL[] }
|
||||
>
|
||||
>();
|
||||
|
||||
@ -32,7 +32,7 @@ class NotificationSystem {
|
||||
userId: string,
|
||||
acls: Array<GlobalACL>,
|
||||
id: string,
|
||||
callback: (notification: Notification) => void,
|
||||
callback: (notification: NotificationModel) => void,
|
||||
) {
|
||||
if (!this.listeners.has(userId)) this.listeners.set(userId, new Map());
|
||||
// eslint-disable-next-line @typescript-eslint/no-extra-non-null-assertion
|
||||
@ -60,7 +60,10 @@ class NotificationSystem {
|
||||
}
|
||||
}
|
||||
|
||||
private async pushNotification(userId: string, notification: Notification) {
|
||||
private async pushNotification(
|
||||
userId: string,
|
||||
notification: NotificationModel,
|
||||
) {
|
||||
for (const [_, listener] of this.listeners.get(userId) ?? []) {
|
||||
const hasSome =
|
||||
notification.acls.findIndex(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Platform } from "~/prisma/client";
|
||||
import { Platform } from "~/prisma/client/enums";
|
||||
|
||||
export function parsePlatform(platform: string) {
|
||||
switch (platform.toLowerCase()) {
|
||||
|
||||
Reference in New Issue
Block a user