Initial Project Boilerplate
This commit is contained in:
24
.env.example
Normal file
24
.env.example
Normal file
@@ -0,0 +1,24 @@
|
||||
# Since the ".env" file is gitignored, you can use the ".env.example" file to
|
||||
# build a new ".env" file when you clone the repo. Keep this file up-to-date
|
||||
# when you add new variables to `.env`.
|
||||
|
||||
# This file will be committed to version control, so make sure not to have any
|
||||
# secrets in it. If you are cloning this repo, create a copy of this file named
|
||||
# ".env" and populate it with your secrets.
|
||||
|
||||
# When adding additional environment variables, the schema in "/src/env.js"
|
||||
# should be updated accordingly.
|
||||
|
||||
# Next Auth
|
||||
# You can generate a new secret on the command line with:
|
||||
# npx auth secret
|
||||
# https://next-auth.js.org/configuration/options#secret
|
||||
AUTH_SECRET=""
|
||||
|
||||
# Next Auth Discord Provider
|
||||
AUTH_DISCORD_ID=""
|
||||
AUTH_DISCORD_SECRET=""
|
||||
|
||||
# Prisma
|
||||
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
|
||||
DATABASE_URL="file:./db.sqlite"
|
||||
46
.gitignore
vendored
Normal file
46
.gitignore
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# database
|
||||
/prisma/db.sqlite
|
||||
/prisma/db.sqlite-journal
|
||||
db.sqlite
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
next-env.d.ts
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
|
||||
.env
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
# idea files
|
||||
.idea
|
||||
29
README.md
Normal file
29
README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Create T3 App
|
||||
|
||||
This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app`.
|
||||
|
||||
## What's next? How do I make an app with this?
|
||||
|
||||
We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary.
|
||||
|
||||
If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help.
|
||||
|
||||
- [Next.js](https://nextjs.org)
|
||||
- [NextAuth.js](https://next-auth.js.org)
|
||||
- [Prisma](https://prisma.io)
|
||||
- [Drizzle](https://orm.drizzle.team)
|
||||
- [Tailwind CSS](https://tailwindcss.com)
|
||||
- [tRPC](https://trpc.io)
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources:
|
||||
|
||||
- [Documentation](https://create.t3.gg/)
|
||||
- [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials
|
||||
|
||||
You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome!
|
||||
|
||||
## How do I deploy this?
|
||||
|
||||
Follow our deployment guides for [Vercel](https://create.t3.gg/en/deployment/vercel), [Netlify](https://create.t3.gg/en/deployment/netlify) and [Docker](https://create.t3.gg/en/deployment/docker) for more information.
|
||||
48
eslint.config.js
Normal file
48
eslint.config.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: import.meta.dirname,
|
||||
});
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: [".next"],
|
||||
},
|
||||
...compat.extends("next/core-web-vitals"),
|
||||
{
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
extends: [
|
||||
...tseslint.configs.recommended,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
],
|
||||
rules: {
|
||||
"@typescript-eslint/array-type": "off",
|
||||
"@typescript-eslint/consistent-type-definitions": "off",
|
||||
"@typescript-eslint/consistent-type-imports": [
|
||||
"warn",
|
||||
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{ argsIgnorePattern: "^_" },
|
||||
],
|
||||
"@typescript-eslint/require-await": "off",
|
||||
"@typescript-eslint/no-misused-promises": [
|
||||
"error",
|
||||
{ checksVoidReturn: { attributes: false } },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
linterOptions: {
|
||||
reportUnusedDisableDirectives: true,
|
||||
},
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
1
generated/prisma/client.d.ts
vendored
Normal file
1
generated/prisma/client.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./index";
|
||||
4
generated/prisma/client.js
Normal file
4
generated/prisma/client.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
module.exports = { ...require(".") };
|
||||
1
generated/prisma/default.d.ts
vendored
Normal file
1
generated/prisma/default.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./index";
|
||||
4
generated/prisma/default.js
Normal file
4
generated/prisma/default.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
module.exports = { ...require("#main-entry-point") };
|
||||
1
generated/prisma/edge.d.ts
vendored
Normal file
1
generated/prisma/edge.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./default";
|
||||
237
generated/prisma/edge.js
Normal file
237
generated/prisma/edge.js
Normal file
File diff suppressed because one or more lines are too long
212
generated/prisma/index-browser.js
Normal file
212
generated/prisma/index-browser.js
Normal file
@@ -0,0 +1,212 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
const {
|
||||
Decimal,
|
||||
objectEnumValues,
|
||||
makeStrictEnum,
|
||||
Public,
|
||||
getRuntime,
|
||||
skip,
|
||||
} = require("./runtime/index-browser.js");
|
||||
|
||||
const Prisma = {};
|
||||
|
||||
exports.Prisma = Prisma;
|
||||
exports.$Enums = {};
|
||||
|
||||
/**
|
||||
* Prisma Client JS version: 6.19.3
|
||||
* Query Engine version: c2990dca591cba766e3b7ef5d9e8a84796e47ab7
|
||||
*/
|
||||
Prisma.prismaVersion = {
|
||||
client: "6.19.3",
|
||||
engine: "c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
|
||||
};
|
||||
|
||||
Prisma.PrismaClientKnownRequestError = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`PrismaClientKnownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.PrismaClientUnknownRequestError = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`PrismaClientUnknownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.PrismaClientRustPanicError = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`PrismaClientRustPanicError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.PrismaClientInitializationError = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`PrismaClientInitializationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.PrismaClientValidationError = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`PrismaClientValidationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.Decimal = Decimal;
|
||||
|
||||
/**
|
||||
* Re-export of sql-template-tag
|
||||
*/
|
||||
Prisma.sql = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`sqltag is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.empty = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`empty is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.join = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`join is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.raw = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`raw is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.validator = Public.validator;
|
||||
|
||||
/**
|
||||
* Extensions
|
||||
*/
|
||||
Prisma.getExtensionContext = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`Extensions.getExtensionContext is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
Prisma.defineExtension = () => {
|
||||
const runtimeName = getRuntime().prettyName;
|
||||
throw new Error(`Extensions.defineExtension is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
|
||||
In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`);
|
||||
};
|
||||
|
||||
/**
|
||||
* Shorthand utilities for JSON filtering
|
||||
*/
|
||||
Prisma.DbNull = objectEnumValues.instances.DbNull;
|
||||
Prisma.JsonNull = objectEnumValues.instances.JsonNull;
|
||||
Prisma.AnyNull = objectEnumValues.instances.AnyNull;
|
||||
|
||||
Prisma.NullTypes = {
|
||||
DbNull: objectEnumValues.classes.DbNull,
|
||||
JsonNull: objectEnumValues.classes.JsonNull,
|
||||
AnyNull: objectEnumValues.classes.AnyNull,
|
||||
};
|
||||
|
||||
/**
|
||||
* Enums
|
||||
*/
|
||||
|
||||
exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
|
||||
Serializable: "Serializable",
|
||||
});
|
||||
|
||||
exports.Prisma.PostScalarFieldEnum = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
createdAt: "createdAt",
|
||||
updatedAt: "updatedAt",
|
||||
createdById: "createdById",
|
||||
};
|
||||
|
||||
exports.Prisma.AccountScalarFieldEnum = {
|
||||
id: "id",
|
||||
userId: "userId",
|
||||
type: "type",
|
||||
provider: "provider",
|
||||
providerAccountId: "providerAccountId",
|
||||
refresh_token: "refresh_token",
|
||||
access_token: "access_token",
|
||||
expires_at: "expires_at",
|
||||
token_type: "token_type",
|
||||
scope: "scope",
|
||||
id_token: "id_token",
|
||||
session_state: "session_state",
|
||||
refresh_token_expires_in: "refresh_token_expires_in",
|
||||
};
|
||||
|
||||
exports.Prisma.SessionScalarFieldEnum = {
|
||||
id: "id",
|
||||
sessionToken: "sessionToken",
|
||||
userId: "userId",
|
||||
expires: "expires",
|
||||
};
|
||||
|
||||
exports.Prisma.UserScalarFieldEnum = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
email: "email",
|
||||
emailVerified: "emailVerified",
|
||||
image: "image",
|
||||
};
|
||||
|
||||
exports.Prisma.VerificationTokenScalarFieldEnum = {
|
||||
identifier: "identifier",
|
||||
token: "token",
|
||||
expires: "expires",
|
||||
};
|
||||
|
||||
exports.Prisma.SortOrder = {
|
||||
asc: "asc",
|
||||
desc: "desc",
|
||||
};
|
||||
|
||||
exports.Prisma.NullsOrder = {
|
||||
first: "first",
|
||||
last: "last",
|
||||
};
|
||||
|
||||
exports.Prisma.ModelName = {
|
||||
Post: "Post",
|
||||
Account: "Account",
|
||||
Session: "Session",
|
||||
User: "User",
|
||||
VerificationToken: "VerificationToken",
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a stub Prisma Client that will error at runtime if called.
|
||||
*/
|
||||
class PrismaClient {
|
||||
constructor() {
|
||||
return new Proxy(this, {
|
||||
get(target, prop) {
|
||||
let message;
|
||||
const runtime = getRuntime();
|
||||
if (runtime.isEdge) {
|
||||
message = `PrismaClient is not configured to run in ${runtime.prettyName}. In order to run Prisma Client on edge runtime, either:
|
||||
- Use Prisma Accelerate: https://pris.ly/d/accelerate
|
||||
- Use Driver Adapters: https://pris.ly/d/driver-adapters
|
||||
`;
|
||||
} else {
|
||||
message =
|
||||
"PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in `" +
|
||||
runtime.prettyName +
|
||||
"`).";
|
||||
}
|
||||
|
||||
message += `
|
||||
If this is unexpected, please open an issue: https://pris.ly/prisma-prisma-bug-report`;
|
||||
|
||||
throw new Error(message);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.PrismaClient = PrismaClient;
|
||||
|
||||
Object.assign(exports, Prisma);
|
||||
10380
generated/prisma/index.d.ts
vendored
Normal file
10380
generated/prisma/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
251
generated/prisma/index.js
Normal file
251
generated/prisma/index.js
Normal file
File diff suppressed because one or more lines are too long
BIN
generated/prisma/libquery_engine-darwin-arm64.dylib.node
Executable file
BIN
generated/prisma/libquery_engine-darwin-arm64.dylib.node
Executable file
Binary file not shown.
183
generated/prisma/package.json
Normal file
183
generated/prisma/package.json
Normal file
@@ -0,0 +1,183 @@
|
||||
{
|
||||
"name": "prisma-client-8875f4962595a327c55c17944afbef0714e6a628415d4eb7b71cc7f620c53850",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"browser": "default.js",
|
||||
"exports": {
|
||||
"./client": {
|
||||
"require": {
|
||||
"node": "./index.js",
|
||||
"edge-light": "./wasm.js",
|
||||
"workerd": "./wasm.js",
|
||||
"worker": "./wasm.js",
|
||||
"browser": "./index-browser.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"import": {
|
||||
"node": "./index.js",
|
||||
"edge-light": "./wasm.js",
|
||||
"workerd": "./wasm.js",
|
||||
"worker": "./wasm.js",
|
||||
"browser": "./index-browser.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"require": {
|
||||
"node": "./index.js",
|
||||
"edge-light": "./wasm.js",
|
||||
"workerd": "./wasm.js",
|
||||
"worker": "./wasm.js",
|
||||
"browser": "./index-browser.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"import": {
|
||||
"node": "./index.js",
|
||||
"edge-light": "./wasm.js",
|
||||
"workerd": "./wasm.js",
|
||||
"worker": "./wasm.js",
|
||||
"browser": "./index-browser.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./edge": {
|
||||
"types": "./edge.d.ts",
|
||||
"require": "./edge.js",
|
||||
"import": "./edge.js",
|
||||
"default": "./edge.js"
|
||||
},
|
||||
"./react-native": {
|
||||
"types": "./react-native.d.ts",
|
||||
"require": "./react-native.js",
|
||||
"import": "./react-native.js",
|
||||
"default": "./react-native.js"
|
||||
},
|
||||
"./extension": {
|
||||
"types": "./extension.d.ts",
|
||||
"require": "./extension.js",
|
||||
"import": "./extension.js",
|
||||
"default": "./extension.js"
|
||||
},
|
||||
"./index-browser": {
|
||||
"types": "./index.d.ts",
|
||||
"require": "./index-browser.js",
|
||||
"import": "./index-browser.js",
|
||||
"default": "./index-browser.js"
|
||||
},
|
||||
"./index": {
|
||||
"types": "./index.d.ts",
|
||||
"require": "./index.js",
|
||||
"import": "./index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./wasm": {
|
||||
"types": "./wasm.d.ts",
|
||||
"require": "./wasm.js",
|
||||
"import": "./wasm.mjs",
|
||||
"default": "./wasm.mjs"
|
||||
},
|
||||
"./runtime/client": {
|
||||
"types": "./runtime/client.d.ts",
|
||||
"node": {
|
||||
"require": "./runtime/client.js",
|
||||
"default": "./runtime/client.js"
|
||||
},
|
||||
"require": "./runtime/client.js",
|
||||
"import": "./runtime/client.mjs",
|
||||
"default": "./runtime/client.mjs"
|
||||
},
|
||||
"./runtime/library": {
|
||||
"types": "./runtime/library.d.ts",
|
||||
"require": "./runtime/library.js",
|
||||
"import": "./runtime/library.mjs",
|
||||
"default": "./runtime/library.mjs"
|
||||
},
|
||||
"./runtime/binary": {
|
||||
"types": "./runtime/binary.d.ts",
|
||||
"require": "./runtime/binary.js",
|
||||
"import": "./runtime/binary.mjs",
|
||||
"default": "./runtime/binary.mjs"
|
||||
},
|
||||
"./runtime/wasm-engine-edge": {
|
||||
"types": "./runtime/wasm-engine-edge.d.ts",
|
||||
"require": "./runtime/wasm-engine-edge.js",
|
||||
"import": "./runtime/wasm-engine-edge.mjs",
|
||||
"default": "./runtime/wasm-engine-edge.mjs"
|
||||
},
|
||||
"./runtime/wasm-compiler-edge": {
|
||||
"types": "./runtime/wasm-compiler-edge.d.ts",
|
||||
"require": "./runtime/wasm-compiler-edge.js",
|
||||
"import": "./runtime/wasm-compiler-edge.mjs",
|
||||
"default": "./runtime/wasm-compiler-edge.mjs"
|
||||
},
|
||||
"./runtime/edge": {
|
||||
"types": "./runtime/edge.d.ts",
|
||||
"require": "./runtime/edge.js",
|
||||
"import": "./runtime/edge-esm.js",
|
||||
"default": "./runtime/edge-esm.js"
|
||||
},
|
||||
"./runtime/react-native": {
|
||||
"types": "./runtime/react-native.d.ts",
|
||||
"require": "./runtime/react-native.js",
|
||||
"import": "./runtime/react-native.js",
|
||||
"default": "./runtime/react-native.js"
|
||||
},
|
||||
"./runtime/index-browser": {
|
||||
"types": "./runtime/index-browser.d.ts",
|
||||
"require": "./runtime/index-browser.js",
|
||||
"import": "./runtime/index-browser.mjs",
|
||||
"default": "./runtime/index-browser.mjs"
|
||||
},
|
||||
"./generator-build": {
|
||||
"require": "./generator-build/index.js",
|
||||
"import": "./generator-build/index.js",
|
||||
"default": "./generator-build/index.js"
|
||||
},
|
||||
"./sql": {
|
||||
"require": {
|
||||
"types": "./sql.d.ts",
|
||||
"node": "./sql.js",
|
||||
"default": "./sql.js"
|
||||
},
|
||||
"import": {
|
||||
"types": "./sql.d.ts",
|
||||
"node": "./sql.mjs",
|
||||
"default": "./sql.mjs"
|
||||
},
|
||||
"default": "./sql.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"version": "6.19.3",
|
||||
"sideEffects": false,
|
||||
"imports": {
|
||||
"#wasm-engine-loader": {
|
||||
"edge-light": "./wasm-edge-light-loader.mjs",
|
||||
"workerd": "./wasm-worker-loader.mjs",
|
||||
"worker": "./wasm-worker-loader.mjs",
|
||||
"default": "./wasm-worker-loader.mjs"
|
||||
},
|
||||
"#main-entry-point": {
|
||||
"require": {
|
||||
"node": "./index.js",
|
||||
"edge-light": "./wasm.js",
|
||||
"workerd": "./wasm.js",
|
||||
"worker": "./wasm.js",
|
||||
"browser": "./index-browser.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"import": {
|
||||
"node": "./index.js",
|
||||
"edge-light": "./wasm.js",
|
||||
"workerd": "./wasm.js",
|
||||
"worker": "./wasm.js",
|
||||
"browser": "./index-browser.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"default": "./index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
812
generated/prisma/query_engine_bg.js
Normal file
812
generated/prisma/query_engine_bg.js
Normal file
@@ -0,0 +1,812 @@
|
||||
"use strict";
|
||||
var F = Object.defineProperty;
|
||||
var B = Object.getOwnPropertyDescriptor;
|
||||
var R = Object.getOwnPropertyNames;
|
||||
var U = Object.prototype.hasOwnProperty;
|
||||
var L = (e, t) => {
|
||||
for (var n in t) F(e, n, { get: t[n], enumerable: !0 });
|
||||
},
|
||||
N = (e, t, n, _) => {
|
||||
if ((t && typeof t == "object") || typeof t == "function")
|
||||
for (let o of R(t))
|
||||
!U.call(e, o) &&
|
||||
o !== n &&
|
||||
F(e, o, {
|
||||
get: () => t[o],
|
||||
enumerable: !(_ = B(t, o)) || _.enumerable,
|
||||
});
|
||||
return e;
|
||||
};
|
||||
var C = (e) => N(F({}, "__esModule", { value: !0 }), e);
|
||||
var qt = {};
|
||||
L(qt, {
|
||||
QueryEngine: () => E,
|
||||
__wbg_Error_e83987f665cf5504: () => J,
|
||||
__wbg_Number_bb48ca12f395cd08: () => X,
|
||||
__wbg_String_8f0eb39a4a4c2f66: () => Y,
|
||||
__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd: () => K,
|
||||
__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68: () => Z,
|
||||
__wbg___wbindgen_debug_string_df47ffb5e35e6763: () => ee,
|
||||
__wbg___wbindgen_in_bb933bd9e1b3bc0f: () => te,
|
||||
__wbg___wbindgen_is_bigint_cb320707dcd35f0b: () => ne,
|
||||
__wbg___wbindgen_is_function_ee8a6c5833c90377: () => re,
|
||||
__wbg___wbindgen_is_object_c818261d21f283a4: () => _e,
|
||||
__wbg___wbindgen_is_string_fbb76cb2940daafd: () => oe,
|
||||
__wbg___wbindgen_is_undefined_2d472862bd29a478: () => ce,
|
||||
__wbg___wbindgen_jsval_eq_6b13ab83478b1c50: () => ie,
|
||||
__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147: () => se,
|
||||
__wbg___wbindgen_number_get_a20bf9b85341449d: () => ue,
|
||||
__wbg___wbindgen_string_get_e4f06c90489ad01b: () => be,
|
||||
__wbg___wbindgen_throw_b855445ff6a94295: () => fe,
|
||||
__wbg__wbg_cb_unref_2454a539ea5790d9: () => ae,
|
||||
__wbg_call_525440f72fbfc0ea: () => ge,
|
||||
__wbg_call_e762c39fa8ea36bf: () => le,
|
||||
__wbg_crypto_805be4ce92f1e370: () => de,
|
||||
__wbg_done_2042aa2670fb1db1: () => we,
|
||||
__wbg_entries_e171b586f8f6bdbf: () => pe,
|
||||
__wbg_getRandomValues_f6a868620c8bab49: () => xe,
|
||||
__wbg_getTime_14776bfb48a1bff9: () => ye,
|
||||
__wbg_get_7bed016f185add81: () => me,
|
||||
__wbg_get_ece95cf6585650d9: () => he,
|
||||
__wbg_get_efcb449f58ec27c2: () => Te,
|
||||
__wbg_get_with_ref_key_1dc361bd10053bfe: () => Ae,
|
||||
__wbg_has_787fafc980c3ccdb: () => Se,
|
||||
__wbg_instanceof_ArrayBuffer_70beb1189ca63b38: () => Fe,
|
||||
__wbg_instanceof_Map_8579b5e2ab5437c7: () => Ie,
|
||||
__wbg_instanceof_Promise_001fdd42afa1b7ef: () => qe,
|
||||
__wbg_instanceof_Uint8Array_20c8e73002f7af98: () => ke,
|
||||
__wbg_isArray_96e0af9891d0945d: () => Ee,
|
||||
__wbg_isSafeInteger_d216eda7911dde36: () => Oe,
|
||||
__wbg_iterator_e5822695327a3c39: () => Me,
|
||||
__wbg_keys_b4d27b02ad14f4be: () => ve,
|
||||
__wbg_length_69bca3cb64fc8748: () => De,
|
||||
__wbg_length_cdd215e10d9dd507: () => je,
|
||||
__wbg_msCrypto_2ac4d17c4748234a: () => Be,
|
||||
__wbg_new_0_f9740686d739025c: () => Re,
|
||||
__wbg_new_1acc0b6eea89d040: () => Ue,
|
||||
__wbg_new_3c3d849046688a66: () => Le,
|
||||
__wbg_new_5a79be3ab53b8aa5: () => Ne,
|
||||
__wbg_new_68651c719dcda04e: () => Ce,
|
||||
__wbg_new_e17d9f43105b08be: () => $e,
|
||||
__wbg_new_from_slice_92f4d78ca282a2d2: () => Ve,
|
||||
__wbg_new_no_args_ee98eee5275000a4: () => We,
|
||||
__wbg_new_with_length_01aa0dc35aa13543: () => ze,
|
||||
__wbg_next_020810e0ae8ebcb0: () => Pe,
|
||||
__wbg_next_2c826fe5dfec6b6a: () => Ge,
|
||||
__wbg_node_ecc8306b9857f33d: () => Qe,
|
||||
__wbg_now_793306c526e2e3b6: () => He,
|
||||
__wbg_now_7fd00a794a07d388: () => Je,
|
||||
__wbg_now_b3f7572f6ef3d3a9: () => Xe,
|
||||
__wbg_process_5cff2739921be718: () => Ye,
|
||||
__wbg_prototypesetcall_2a6620b6922694b2: () => Ke,
|
||||
__wbg_push_df81a39d04db858c: () => Ze,
|
||||
__wbg_queueMicrotask_5a8a9131f3f0b37b: () => et,
|
||||
__wbg_queueMicrotask_6d79674585219521: () => tt,
|
||||
__wbg_randomFillSync_d3c85af7e31cf1f8: () => nt,
|
||||
__wbg_require_0c566c6f2eef6c79: () => rt,
|
||||
__wbg_resolve_caf97c30b83f7053: () => _t,
|
||||
__wbg_setTimeout_5d6a1d4fc51ea450: () => ot,
|
||||
__wbg_set_3f1d0b984ed272ed: () => ct,
|
||||
__wbg_set_907fb406c34a251d: () => it,
|
||||
__wbg_set_c213c871859d6500: () => st,
|
||||
__wbg_set_c2abbebe8b9ebee1: () => ut,
|
||||
__wbg_set_wasm: () => $,
|
||||
__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e: () => bt,
|
||||
__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac: () => ft,
|
||||
__wbg_static_accessor_SELF_6fdf4b64710cc91b: () => at,
|
||||
__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2: () => gt,
|
||||
__wbg_subarray_480600f3d6a9f26c: () => lt,
|
||||
__wbg_then_4f46f6544e6b4a28: () => dt,
|
||||
__wbg_then_70d05cf780a18d77: () => wt,
|
||||
__wbg_valueOf_9eee4828c11458ca: () => pt,
|
||||
__wbg_value_692627309814bb8c: () => xt,
|
||||
__wbg_versions_a8e5a362e1f16442: () => yt,
|
||||
__wbindgen_cast_126e48f66237b479: () => mt,
|
||||
__wbindgen_cast_2241b6af4c4b2941: () => ht,
|
||||
__wbindgen_cast_4625c577ab2ec9ee: () => Tt,
|
||||
__wbindgen_cast_9ae0607507abb057: () => At,
|
||||
__wbindgen_cast_cb9088102bce6b30: () => St,
|
||||
__wbindgen_cast_d6cd19b81560fd6e: () => Ft,
|
||||
__wbindgen_init_externref_table: () => It,
|
||||
debug_panic: () => P,
|
||||
getBuildTimeInfo: () => G,
|
||||
});
|
||||
module.exports = C(qt);
|
||||
var h = () => {};
|
||||
h.prototype = h;
|
||||
let r;
|
||||
function $(e) {
|
||||
r = e;
|
||||
}
|
||||
let T = null;
|
||||
function p() {
|
||||
return (
|
||||
(T === null || T.byteLength === 0) && (T = new Uint8Array(r.memory.buffer)),
|
||||
T
|
||||
);
|
||||
}
|
||||
let A = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
|
||||
A.decode();
|
||||
const V = 2146435072;
|
||||
let I = 0;
|
||||
function W(e, t) {
|
||||
return (
|
||||
(I += t),
|
||||
I >= V &&
|
||||
((A = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 })),
|
||||
A.decode(),
|
||||
(I = t)),
|
||||
A.decode(p().subarray(e, e + t))
|
||||
);
|
||||
}
|
||||
function S(e, t) {
|
||||
return ((e = e >>> 0), W(e, t));
|
||||
}
|
||||
let u = 0;
|
||||
const x = new TextEncoder();
|
||||
"encodeInto" in x ||
|
||||
(x.encodeInto = function (e, t) {
|
||||
const n = x.encode(e);
|
||||
return (t.set(n), { read: e.length, written: n.length });
|
||||
});
|
||||
function b(e, t, n) {
|
||||
if (n === void 0) {
|
||||
const s = x.encode(e),
|
||||
f = t(s.length, 1) >>> 0;
|
||||
return (
|
||||
p()
|
||||
.subarray(f, f + s.length)
|
||||
.set(s),
|
||||
(u = s.length),
|
||||
f
|
||||
);
|
||||
}
|
||||
let _ = e.length,
|
||||
o = t(_, 1) >>> 0;
|
||||
const i = p();
|
||||
let c = 0;
|
||||
for (; c < _; c++) {
|
||||
const s = e.charCodeAt(c);
|
||||
if (s > 127) break;
|
||||
i[o + c] = s;
|
||||
}
|
||||
if (c !== _) {
|
||||
(c !== 0 && (e = e.slice(c)),
|
||||
(o = n(o, _, (_ = c + e.length * 3), 1) >>> 0));
|
||||
const s = p().subarray(o + c, o + _),
|
||||
f = x.encodeInto(e, s);
|
||||
((c += f.written), (o = n(o, _, c, 1) >>> 0));
|
||||
}
|
||||
return ((u = c), o);
|
||||
}
|
||||
let w = null;
|
||||
function l() {
|
||||
return (
|
||||
(w === null ||
|
||||
w.buffer.detached === !0 ||
|
||||
(w.buffer.detached === void 0 && w.buffer !== r.memory.buffer)) &&
|
||||
(w = new DataView(r.memory.buffer)),
|
||||
w
|
||||
);
|
||||
}
|
||||
function a(e) {
|
||||
return e == null;
|
||||
}
|
||||
function q(e) {
|
||||
const t = typeof e;
|
||||
if (t == "number" || t == "boolean" || e == null) return `${e}`;
|
||||
if (t == "string") return `"${e}"`;
|
||||
if (t == "symbol") {
|
||||
const o = e.description;
|
||||
return o == null ? "Symbol" : `Symbol(${o})`;
|
||||
}
|
||||
if (t == "function") {
|
||||
const o = e.name;
|
||||
return typeof o == "string" && o.length > 0 ? `Function(${o})` : "Function";
|
||||
}
|
||||
if (Array.isArray(e)) {
|
||||
const o = e.length;
|
||||
let i = "[";
|
||||
o > 0 && (i += q(e[0]));
|
||||
for (let c = 1; c < o; c++) i += ", " + q(e[c]);
|
||||
return ((i += "]"), i);
|
||||
}
|
||||
const n = /\[object ([^\]]+)\]/.exec(toString.call(e));
|
||||
let _;
|
||||
if (n && n.length > 1) _ = n[1];
|
||||
else return toString.call(e);
|
||||
if (_ == "Object")
|
||||
try {
|
||||
return "Object(" + JSON.stringify(e) + ")";
|
||||
} catch {
|
||||
return "Object";
|
||||
}
|
||||
return e instanceof Error
|
||||
? `${e.name}: ${e.message}
|
||||
${e.stack}`
|
||||
: _;
|
||||
}
|
||||
function y(e) {
|
||||
const t = r.__externref_table_alloc();
|
||||
return (r.__wbindgen_externrefs.set(t, e), t);
|
||||
}
|
||||
function g(e, t) {
|
||||
try {
|
||||
return e.apply(this, t);
|
||||
} catch (n) {
|
||||
const _ = y(n);
|
||||
r.__wbindgen_exn_store(_);
|
||||
}
|
||||
}
|
||||
function k(e, t) {
|
||||
return ((e = e >>> 0), p().subarray(e / 1, e / 1 + t));
|
||||
}
|
||||
const O =
|
||||
typeof FinalizationRegistry > "u"
|
||||
? { register: () => {}, unregister: () => {} }
|
||||
: new FinalizationRegistry((e) => e.dtor(e.a, e.b));
|
||||
function z(e, t, n, _) {
|
||||
const o = { a: e, b: t, cnt: 1, dtor: n },
|
||||
i = (...c) => {
|
||||
o.cnt++;
|
||||
const s = o.a;
|
||||
o.a = 0;
|
||||
try {
|
||||
return _(s, o.b, ...c);
|
||||
} finally {
|
||||
((o.a = s), i._wbg_cb_unref());
|
||||
}
|
||||
};
|
||||
return (
|
||||
(i._wbg_cb_unref = () => {
|
||||
--o.cnt === 0 && (o.dtor(o.a, o.b), (o.a = 0), O.unregister(o));
|
||||
}),
|
||||
O.register(i, o, o),
|
||||
i
|
||||
);
|
||||
}
|
||||
function M(e) {
|
||||
const t = r.__wbindgen_externrefs.get(e);
|
||||
return (r.__externref_table_dealloc(e), t);
|
||||
}
|
||||
function P(e) {
|
||||
var t = a(e) ? 0 : b(e, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
n = u;
|
||||
const _ = r.debug_panic(t, n);
|
||||
if (_[1]) throw M(_[0]);
|
||||
}
|
||||
function G() {
|
||||
return r.getBuildTimeInfo();
|
||||
}
|
||||
function Q(e, t, n) {
|
||||
r.wasm_bindgen__convert__closures_____invoke__ha235f3ea55a06a09(e, t, n);
|
||||
}
|
||||
function H(e, t, n, _) {
|
||||
r.wasm_bindgen__convert__closures_____invoke__h1a2f20be69ab8911(e, t, n, _);
|
||||
}
|
||||
const v =
|
||||
typeof FinalizationRegistry > "u"
|
||||
? { register: () => {}, unregister: () => {} }
|
||||
: new FinalizationRegistry((e) => r.__wbg_queryengine_free(e >>> 0, 1));
|
||||
class E {
|
||||
__destroy_into_raw() {
|
||||
const t = this.__wbg_ptr;
|
||||
return ((this.__wbg_ptr = 0), v.unregister(this), t);
|
||||
}
|
||||
free() {
|
||||
const t = this.__destroy_into_raw();
|
||||
r.__wbg_queryengine_free(t, 0);
|
||||
}
|
||||
disconnect(t, n) {
|
||||
const _ = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
o = u,
|
||||
i = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
c = u;
|
||||
return r.queryengine_disconnect(this.__wbg_ptr, _, o, i, c);
|
||||
}
|
||||
startTransaction(t, n, _) {
|
||||
const o = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
i = u,
|
||||
c = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
s = u,
|
||||
f = b(_, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
d = u;
|
||||
return r.queryengine_startTransaction(this.__wbg_ptr, o, i, c, s, f, d);
|
||||
}
|
||||
commitTransaction(t, n, _) {
|
||||
const o = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
i = u,
|
||||
c = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
s = u,
|
||||
f = b(_, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
d = u;
|
||||
return r.queryengine_commitTransaction(this.__wbg_ptr, o, i, c, s, f, d);
|
||||
}
|
||||
rollbackTransaction(t, n, _) {
|
||||
const o = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
i = u,
|
||||
c = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
s = u,
|
||||
f = b(_, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
d = u;
|
||||
return r.queryengine_rollbackTransaction(this.__wbg_ptr, o, i, c, s, f, d);
|
||||
}
|
||||
constructor(t, n, _) {
|
||||
const o = r.queryengine_new(t, n, _);
|
||||
if (o[2]) throw M(o[1]);
|
||||
return (
|
||||
(this.__wbg_ptr = o[0] >>> 0),
|
||||
v.register(this, this.__wbg_ptr, this),
|
||||
this
|
||||
);
|
||||
}
|
||||
query(t, n, _, o) {
|
||||
const i = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
c = u,
|
||||
s = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
f = u;
|
||||
var d = a(_) ? 0 : b(_, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
m = u;
|
||||
const D = b(o, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
j = u;
|
||||
return r.queryengine_query(this.__wbg_ptr, i, c, s, f, d, m, D, j);
|
||||
}
|
||||
trace(t) {
|
||||
const n = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
_ = u;
|
||||
return r.queryengine_trace(this.__wbg_ptr, n, _);
|
||||
}
|
||||
connect(t, n) {
|
||||
const _ = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
o = u,
|
||||
i = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
c = u;
|
||||
return r.queryengine_connect(this.__wbg_ptr, _, o, i, c);
|
||||
}
|
||||
metrics(t) {
|
||||
const n = b(t, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
_ = u;
|
||||
return r.queryengine_metrics(this.__wbg_ptr, n, _);
|
||||
}
|
||||
}
|
||||
Symbol.dispose && (E.prototype[Symbol.dispose] = E.prototype.free);
|
||||
function J(e, t) {
|
||||
return Error(S(e, t));
|
||||
}
|
||||
function X(e) {
|
||||
return Number(e);
|
||||
}
|
||||
function Y(e, t) {
|
||||
const n = String(t),
|
||||
_ = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
o = u;
|
||||
(l().setInt32(e + 4 * 1, o, !0), l().setInt32(e + 4 * 0, _, !0));
|
||||
}
|
||||
function K(e, t) {
|
||||
const n = t,
|
||||
_ = typeof n == "bigint" ? n : void 0;
|
||||
(l().setBigInt64(e + 8 * 1, a(_) ? BigInt(0) : _, !0),
|
||||
l().setInt32(e + 4 * 0, !a(_), !0));
|
||||
}
|
||||
function Z(e) {
|
||||
const t = e,
|
||||
n = typeof t == "boolean" ? t : void 0;
|
||||
return a(n) ? 16777215 : n ? 1 : 0;
|
||||
}
|
||||
function ee(e, t) {
|
||||
const n = q(t),
|
||||
_ = b(n, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
o = u;
|
||||
(l().setInt32(e + 4 * 1, o, !0), l().setInt32(e + 4 * 0, _, !0));
|
||||
}
|
||||
function te(e, t) {
|
||||
return e in t;
|
||||
}
|
||||
function ne(e) {
|
||||
return typeof e == "bigint";
|
||||
}
|
||||
function re(e) {
|
||||
return typeof e == "function";
|
||||
}
|
||||
function _e(e) {
|
||||
const t = e;
|
||||
return typeof t == "object" && t !== null;
|
||||
}
|
||||
function oe(e) {
|
||||
return typeof e == "string";
|
||||
}
|
||||
function ce(e) {
|
||||
return e === void 0;
|
||||
}
|
||||
function ie(e, t) {
|
||||
return e === t;
|
||||
}
|
||||
function se(e, t) {
|
||||
return e == t;
|
||||
}
|
||||
function ue(e, t) {
|
||||
const n = t,
|
||||
_ = typeof n == "number" ? n : void 0;
|
||||
(l().setFloat64(e + 8 * 1, a(_) ? 0 : _, !0),
|
||||
l().setInt32(e + 4 * 0, !a(_), !0));
|
||||
}
|
||||
function be(e, t) {
|
||||
const n = t,
|
||||
_ = typeof n == "string" ? n : void 0;
|
||||
var o = a(_) ? 0 : b(_, r.__wbindgen_malloc, r.__wbindgen_realloc),
|
||||
i = u;
|
||||
(l().setInt32(e + 4 * 1, i, !0), l().setInt32(e + 4 * 0, o, !0));
|
||||
}
|
||||
function fe(e, t) {
|
||||
throw new Error(S(e, t));
|
||||
}
|
||||
function ae(e) {
|
||||
e._wbg_cb_unref();
|
||||
}
|
||||
function ge() {
|
||||
return g(function (e, t, n) {
|
||||
return e.call(t, n);
|
||||
}, arguments);
|
||||
}
|
||||
function le() {
|
||||
return g(function (e, t) {
|
||||
return e.call(t);
|
||||
}, arguments);
|
||||
}
|
||||
function de(e) {
|
||||
return e.crypto;
|
||||
}
|
||||
function we(e) {
|
||||
return e.done;
|
||||
}
|
||||
function pe(e) {
|
||||
return Object.entries(e);
|
||||
}
|
||||
function xe() {
|
||||
return g(function (e, t) {
|
||||
e.getRandomValues(t);
|
||||
}, arguments);
|
||||
}
|
||||
function ye(e) {
|
||||
return e.getTime();
|
||||
}
|
||||
function me(e, t) {
|
||||
return e[t >>> 0];
|
||||
}
|
||||
function he() {
|
||||
return g(function (e, t) {
|
||||
return e[t];
|
||||
}, arguments);
|
||||
}
|
||||
function Te() {
|
||||
return g(function (e, t) {
|
||||
return Reflect.get(e, t);
|
||||
}, arguments);
|
||||
}
|
||||
function Ae(e, t) {
|
||||
return e[t];
|
||||
}
|
||||
function Se() {
|
||||
return g(function (e, t) {
|
||||
return Reflect.has(e, t);
|
||||
}, arguments);
|
||||
}
|
||||
function Fe(e) {
|
||||
let t;
|
||||
try {
|
||||
t = e instanceof ArrayBuffer;
|
||||
} catch {
|
||||
t = !1;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function Ie(e) {
|
||||
let t;
|
||||
try {
|
||||
t = e instanceof Map;
|
||||
} catch {
|
||||
t = !1;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function qe(e) {
|
||||
let t;
|
||||
try {
|
||||
t = e instanceof Promise;
|
||||
} catch {
|
||||
t = !1;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function ke(e) {
|
||||
let t;
|
||||
try {
|
||||
t = e instanceof Uint8Array;
|
||||
} catch {
|
||||
t = !1;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function Ee(e) {
|
||||
return Array.isArray(e);
|
||||
}
|
||||
function Oe(e) {
|
||||
return Number.isSafeInteger(e);
|
||||
}
|
||||
function Me() {
|
||||
return Symbol.iterator;
|
||||
}
|
||||
function ve(e) {
|
||||
return Object.keys(e);
|
||||
}
|
||||
function De(e) {
|
||||
return e.length;
|
||||
}
|
||||
function je(e) {
|
||||
return e.length;
|
||||
}
|
||||
function Be(e) {
|
||||
return e.msCrypto;
|
||||
}
|
||||
function Re() {
|
||||
return new Date();
|
||||
}
|
||||
function Ue() {
|
||||
return new Object();
|
||||
}
|
||||
function Le(e, t) {
|
||||
try {
|
||||
var n = { a: e, b: t },
|
||||
_ = (i, c) => {
|
||||
const s = n.a;
|
||||
n.a = 0;
|
||||
try {
|
||||
return H(s, n.b, i, c);
|
||||
} finally {
|
||||
n.a = s;
|
||||
}
|
||||
};
|
||||
return new Promise(_);
|
||||
} finally {
|
||||
n.a = n.b = 0;
|
||||
}
|
||||
}
|
||||
function Ne(e) {
|
||||
return new Uint8Array(e);
|
||||
}
|
||||
function Ce() {
|
||||
return new Map();
|
||||
}
|
||||
function $e() {
|
||||
return new Array();
|
||||
}
|
||||
function Ve(e, t) {
|
||||
return new Uint8Array(k(e, t));
|
||||
}
|
||||
function We(e, t) {
|
||||
return new h(S(e, t));
|
||||
}
|
||||
function ze(e) {
|
||||
return new Uint8Array(e >>> 0);
|
||||
}
|
||||
function Pe() {
|
||||
return g(function (e) {
|
||||
return e.next();
|
||||
}, arguments);
|
||||
}
|
||||
function Ge(e) {
|
||||
return e.next;
|
||||
}
|
||||
function Qe(e) {
|
||||
return e.node;
|
||||
}
|
||||
function He() {
|
||||
return Date.now();
|
||||
}
|
||||
function Je(e) {
|
||||
return e.now();
|
||||
}
|
||||
function Xe() {
|
||||
return g(function () {
|
||||
return Date.now();
|
||||
}, arguments);
|
||||
}
|
||||
function Ye(e) {
|
||||
return e.process;
|
||||
}
|
||||
function Ke(e, t, n) {
|
||||
Uint8Array.prototype.set.call(k(e, t), n);
|
||||
}
|
||||
function Ze(e, t) {
|
||||
return e.push(t);
|
||||
}
|
||||
function et(e) {
|
||||
return e.queueMicrotask;
|
||||
}
|
||||
function tt(e) {
|
||||
queueMicrotask(e);
|
||||
}
|
||||
function nt() {
|
||||
return g(function (e, t) {
|
||||
e.randomFillSync(t);
|
||||
}, arguments);
|
||||
}
|
||||
function rt() {
|
||||
return g(function () {
|
||||
return module.require;
|
||||
}, arguments);
|
||||
}
|
||||
function _t(e) {
|
||||
return Promise.resolve(e);
|
||||
}
|
||||
function ot(e, t) {
|
||||
return setTimeout(e, t >>> 0);
|
||||
}
|
||||
function ct(e, t, n) {
|
||||
e[t] = n;
|
||||
}
|
||||
function it(e, t, n) {
|
||||
return e.set(t, n);
|
||||
}
|
||||
function st(e, t, n) {
|
||||
e[t >>> 0] = n;
|
||||
}
|
||||
function ut() {
|
||||
return g(function (e, t, n) {
|
||||
return Reflect.set(e, t, n);
|
||||
}, arguments);
|
||||
}
|
||||
function bt() {
|
||||
const e = typeof global > "u" ? null : global;
|
||||
return a(e) ? 0 : y(e);
|
||||
}
|
||||
function ft() {
|
||||
const e = typeof globalThis > "u" ? null : globalThis;
|
||||
return a(e) ? 0 : y(e);
|
||||
}
|
||||
function at() {
|
||||
const e = typeof self > "u" ? null : self;
|
||||
return a(e) ? 0 : y(e);
|
||||
}
|
||||
function gt() {
|
||||
const e = typeof window > "u" ? null : window;
|
||||
return a(e) ? 0 : y(e);
|
||||
}
|
||||
function lt(e, t, n) {
|
||||
return e.subarray(t >>> 0, n >>> 0);
|
||||
}
|
||||
function dt(e, t) {
|
||||
return e.then(t);
|
||||
}
|
||||
function wt(e, t, n) {
|
||||
return e.then(t, n);
|
||||
}
|
||||
function pt(e) {
|
||||
return e.valueOf();
|
||||
}
|
||||
function xt(e) {
|
||||
return e.value;
|
||||
}
|
||||
function yt(e) {
|
||||
return e.versions;
|
||||
}
|
||||
function mt(e, t) {
|
||||
return z(e, t, r.wasm_bindgen__closure__destroy__hf9ae564cf31e91c2, Q);
|
||||
}
|
||||
function ht(e, t) {
|
||||
return S(e, t);
|
||||
}
|
||||
function Tt(e) {
|
||||
return BigInt.asUintN(64, e);
|
||||
}
|
||||
function At(e) {
|
||||
return e;
|
||||
}
|
||||
function St(e, t) {
|
||||
return k(e, t);
|
||||
}
|
||||
function Ft(e) {
|
||||
return e;
|
||||
}
|
||||
function It() {
|
||||
const e = r.__wbindgen_externrefs,
|
||||
t = e.grow(4);
|
||||
(e.set(0, void 0),
|
||||
e.set(t + 0, void 0),
|
||||
e.set(t + 1, null),
|
||||
e.set(t + 2, !0),
|
||||
e.set(t + 3, !1));
|
||||
}
|
||||
0 &&
|
||||
(module.exports = {
|
||||
QueryEngine,
|
||||
__wbg_Error_e83987f665cf5504,
|
||||
__wbg_Number_bb48ca12f395cd08,
|
||||
__wbg_String_8f0eb39a4a4c2f66,
|
||||
__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd,
|
||||
__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68,
|
||||
__wbg___wbindgen_debug_string_df47ffb5e35e6763,
|
||||
__wbg___wbindgen_in_bb933bd9e1b3bc0f,
|
||||
__wbg___wbindgen_is_bigint_cb320707dcd35f0b,
|
||||
__wbg___wbindgen_is_function_ee8a6c5833c90377,
|
||||
__wbg___wbindgen_is_object_c818261d21f283a4,
|
||||
__wbg___wbindgen_is_string_fbb76cb2940daafd,
|
||||
__wbg___wbindgen_is_undefined_2d472862bd29a478,
|
||||
__wbg___wbindgen_jsval_eq_6b13ab83478b1c50,
|
||||
__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147,
|
||||
__wbg___wbindgen_number_get_a20bf9b85341449d,
|
||||
__wbg___wbindgen_string_get_e4f06c90489ad01b,
|
||||
__wbg___wbindgen_throw_b855445ff6a94295,
|
||||
__wbg__wbg_cb_unref_2454a539ea5790d9,
|
||||
__wbg_call_525440f72fbfc0ea,
|
||||
__wbg_call_e762c39fa8ea36bf,
|
||||
__wbg_crypto_805be4ce92f1e370,
|
||||
__wbg_done_2042aa2670fb1db1,
|
||||
__wbg_entries_e171b586f8f6bdbf,
|
||||
__wbg_getRandomValues_f6a868620c8bab49,
|
||||
__wbg_getTime_14776bfb48a1bff9,
|
||||
__wbg_get_7bed016f185add81,
|
||||
__wbg_get_ece95cf6585650d9,
|
||||
__wbg_get_efcb449f58ec27c2,
|
||||
__wbg_get_with_ref_key_1dc361bd10053bfe,
|
||||
__wbg_has_787fafc980c3ccdb,
|
||||
__wbg_instanceof_ArrayBuffer_70beb1189ca63b38,
|
||||
__wbg_instanceof_Map_8579b5e2ab5437c7,
|
||||
__wbg_instanceof_Promise_001fdd42afa1b7ef,
|
||||
__wbg_instanceof_Uint8Array_20c8e73002f7af98,
|
||||
__wbg_isArray_96e0af9891d0945d,
|
||||
__wbg_isSafeInteger_d216eda7911dde36,
|
||||
__wbg_iterator_e5822695327a3c39,
|
||||
__wbg_keys_b4d27b02ad14f4be,
|
||||
__wbg_length_69bca3cb64fc8748,
|
||||
__wbg_length_cdd215e10d9dd507,
|
||||
__wbg_msCrypto_2ac4d17c4748234a,
|
||||
__wbg_new_0_f9740686d739025c,
|
||||
__wbg_new_1acc0b6eea89d040,
|
||||
__wbg_new_3c3d849046688a66,
|
||||
__wbg_new_5a79be3ab53b8aa5,
|
||||
__wbg_new_68651c719dcda04e,
|
||||
__wbg_new_e17d9f43105b08be,
|
||||
__wbg_new_from_slice_92f4d78ca282a2d2,
|
||||
__wbg_new_no_args_ee98eee5275000a4,
|
||||
__wbg_new_with_length_01aa0dc35aa13543,
|
||||
__wbg_next_020810e0ae8ebcb0,
|
||||
__wbg_next_2c826fe5dfec6b6a,
|
||||
__wbg_node_ecc8306b9857f33d,
|
||||
__wbg_now_793306c526e2e3b6,
|
||||
__wbg_now_7fd00a794a07d388,
|
||||
__wbg_now_b3f7572f6ef3d3a9,
|
||||
__wbg_process_5cff2739921be718,
|
||||
__wbg_prototypesetcall_2a6620b6922694b2,
|
||||
__wbg_push_df81a39d04db858c,
|
||||
__wbg_queueMicrotask_5a8a9131f3f0b37b,
|
||||
__wbg_queueMicrotask_6d79674585219521,
|
||||
__wbg_randomFillSync_d3c85af7e31cf1f8,
|
||||
__wbg_require_0c566c6f2eef6c79,
|
||||
__wbg_resolve_caf97c30b83f7053,
|
||||
__wbg_setTimeout_5d6a1d4fc51ea450,
|
||||
__wbg_set_3f1d0b984ed272ed,
|
||||
__wbg_set_907fb406c34a251d,
|
||||
__wbg_set_c213c871859d6500,
|
||||
__wbg_set_c2abbebe8b9ebee1,
|
||||
__wbg_set_wasm,
|
||||
__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e,
|
||||
__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac,
|
||||
__wbg_static_accessor_SELF_6fdf4b64710cc91b,
|
||||
__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2,
|
||||
__wbg_subarray_480600f3d6a9f26c,
|
||||
__wbg_then_4f46f6544e6b4a28,
|
||||
__wbg_then_70d05cf780a18d77,
|
||||
__wbg_valueOf_9eee4828c11458ca,
|
||||
__wbg_value_692627309814bb8c,
|
||||
__wbg_versions_a8e5a362e1f16442,
|
||||
__wbindgen_cast_126e48f66237b479,
|
||||
__wbindgen_cast_2241b6af4c4b2941,
|
||||
__wbindgen_cast_4625c577ab2ec9ee,
|
||||
__wbindgen_cast_9ae0607507abb057,
|
||||
__wbindgen_cast_cb9088102bce6b30,
|
||||
__wbindgen_cast_d6cd19b81560fd6e,
|
||||
__wbindgen_init_externref_table,
|
||||
debug_panic,
|
||||
getBuildTimeInfo,
|
||||
});
|
||||
BIN
generated/prisma/query_engine_bg.wasm
Normal file
BIN
generated/prisma/query_engine_bg.wasm
Normal file
Binary file not shown.
10087
generated/prisma/runtime/edge-esm.js
Normal file
10087
generated/prisma/runtime/edge-esm.js
Normal file
File diff suppressed because it is too large
Load Diff
10123
generated/prisma/runtime/edge.js
Normal file
10123
generated/prisma/runtime/edge.js
Normal file
File diff suppressed because it is too large
Load Diff
430
generated/prisma/runtime/index-browser.d.ts
vendored
Normal file
430
generated/prisma/runtime/index-browser.d.ts
vendored
Normal file
@@ -0,0 +1,430 @@
|
||||
declare class AnyNull extends NullTypesEnumValue {
|
||||
#private;
|
||||
}
|
||||
|
||||
declare type Args<T, F extends Operation> = T extends {
|
||||
[K: symbol]: {
|
||||
types: {
|
||||
operations: {
|
||||
[K in F]: {
|
||||
args: any;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
? T[symbol]["types"]["operations"][F]["args"]
|
||||
: any;
|
||||
|
||||
declare class DbNull extends NullTypesEnumValue {
|
||||
#private;
|
||||
}
|
||||
|
||||
export declare function Decimal(n: Decimal.Value): Decimal;
|
||||
|
||||
export declare namespace Decimal {
|
||||
export type Constructor = typeof Decimal;
|
||||
export type Instance = Decimal;
|
||||
export type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
||||
export type Modulo = Rounding | 9;
|
||||
export type Value = string | number | Decimal;
|
||||
|
||||
// http://mikemcl.github.io/decimal.js/#constructor-properties
|
||||
export interface Config {
|
||||
precision?: number;
|
||||
rounding?: Rounding;
|
||||
toExpNeg?: number;
|
||||
toExpPos?: number;
|
||||
minE?: number;
|
||||
maxE?: number;
|
||||
crypto?: boolean;
|
||||
modulo?: Modulo;
|
||||
defaults?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export declare class Decimal {
|
||||
readonly d: number[];
|
||||
readonly e: number;
|
||||
readonly s: number;
|
||||
|
||||
constructor(n: Decimal.Value);
|
||||
|
||||
absoluteValue(): Decimal;
|
||||
abs(): Decimal;
|
||||
|
||||
ceil(): Decimal;
|
||||
|
||||
clampedTo(min: Decimal.Value, max: Decimal.Value): Decimal;
|
||||
clamp(min: Decimal.Value, max: Decimal.Value): Decimal;
|
||||
|
||||
comparedTo(n: Decimal.Value): number;
|
||||
cmp(n: Decimal.Value): number;
|
||||
|
||||
cosine(): Decimal;
|
||||
cos(): Decimal;
|
||||
|
||||
cubeRoot(): Decimal;
|
||||
cbrt(): Decimal;
|
||||
|
||||
decimalPlaces(): number;
|
||||
dp(): number;
|
||||
|
||||
dividedBy(n: Decimal.Value): Decimal;
|
||||
div(n: Decimal.Value): Decimal;
|
||||
|
||||
dividedToIntegerBy(n: Decimal.Value): Decimal;
|
||||
divToInt(n: Decimal.Value): Decimal;
|
||||
|
||||
equals(n: Decimal.Value): boolean;
|
||||
eq(n: Decimal.Value): boolean;
|
||||
|
||||
floor(): Decimal;
|
||||
|
||||
greaterThan(n: Decimal.Value): boolean;
|
||||
gt(n: Decimal.Value): boolean;
|
||||
|
||||
greaterThanOrEqualTo(n: Decimal.Value): boolean;
|
||||
gte(n: Decimal.Value): boolean;
|
||||
|
||||
hyperbolicCosine(): Decimal;
|
||||
cosh(): Decimal;
|
||||
|
||||
hyperbolicSine(): Decimal;
|
||||
sinh(): Decimal;
|
||||
|
||||
hyperbolicTangent(): Decimal;
|
||||
tanh(): Decimal;
|
||||
|
||||
inverseCosine(): Decimal;
|
||||
acos(): Decimal;
|
||||
|
||||
inverseHyperbolicCosine(): Decimal;
|
||||
acosh(): Decimal;
|
||||
|
||||
inverseHyperbolicSine(): Decimal;
|
||||
asinh(): Decimal;
|
||||
|
||||
inverseHyperbolicTangent(): Decimal;
|
||||
atanh(): Decimal;
|
||||
|
||||
inverseSine(): Decimal;
|
||||
asin(): Decimal;
|
||||
|
||||
inverseTangent(): Decimal;
|
||||
atan(): Decimal;
|
||||
|
||||
isFinite(): boolean;
|
||||
|
||||
isInteger(): boolean;
|
||||
isInt(): boolean;
|
||||
|
||||
isNaN(): boolean;
|
||||
|
||||
isNegative(): boolean;
|
||||
isNeg(): boolean;
|
||||
|
||||
isPositive(): boolean;
|
||||
isPos(): boolean;
|
||||
|
||||
isZero(): boolean;
|
||||
|
||||
lessThan(n: Decimal.Value): boolean;
|
||||
lt(n: Decimal.Value): boolean;
|
||||
|
||||
lessThanOrEqualTo(n: Decimal.Value): boolean;
|
||||
lte(n: Decimal.Value): boolean;
|
||||
|
||||
logarithm(n?: Decimal.Value): Decimal;
|
||||
log(n?: Decimal.Value): Decimal;
|
||||
|
||||
minus(n: Decimal.Value): Decimal;
|
||||
sub(n: Decimal.Value): Decimal;
|
||||
|
||||
modulo(n: Decimal.Value): Decimal;
|
||||
mod(n: Decimal.Value): Decimal;
|
||||
|
||||
naturalExponential(): Decimal;
|
||||
exp(): Decimal;
|
||||
|
||||
naturalLogarithm(): Decimal;
|
||||
ln(): Decimal;
|
||||
|
||||
negated(): Decimal;
|
||||
neg(): Decimal;
|
||||
|
||||
plus(n: Decimal.Value): Decimal;
|
||||
add(n: Decimal.Value): Decimal;
|
||||
|
||||
precision(includeZeros?: boolean): number;
|
||||
sd(includeZeros?: boolean): number;
|
||||
|
||||
round(): Decimal;
|
||||
|
||||
sine(): Decimal;
|
||||
sin(): Decimal;
|
||||
|
||||
squareRoot(): Decimal;
|
||||
sqrt(): Decimal;
|
||||
|
||||
tangent(): Decimal;
|
||||
tan(): Decimal;
|
||||
|
||||
times(n: Decimal.Value): Decimal;
|
||||
mul(n: Decimal.Value): Decimal;
|
||||
|
||||
toBinary(significantDigits?: number): string;
|
||||
toBinary(significantDigits: number, rounding: Decimal.Rounding): string;
|
||||
|
||||
toDecimalPlaces(decimalPlaces?: number): Decimal;
|
||||
toDecimalPlaces(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
|
||||
toDP(decimalPlaces?: number): Decimal;
|
||||
toDP(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
|
||||
|
||||
toExponential(decimalPlaces?: number): string;
|
||||
toExponential(decimalPlaces: number, rounding: Decimal.Rounding): string;
|
||||
|
||||
toFixed(decimalPlaces?: number): string;
|
||||
toFixed(decimalPlaces: number, rounding: Decimal.Rounding): string;
|
||||
|
||||
toFraction(max_denominator?: Decimal.Value): Decimal[];
|
||||
|
||||
toHexadecimal(significantDigits?: number): string;
|
||||
toHexadecimal(significantDigits: number, rounding: Decimal.Rounding): string;
|
||||
toHex(significantDigits?: number): string;
|
||||
toHex(significantDigits: number, rounding?: Decimal.Rounding): string;
|
||||
|
||||
toJSON(): string;
|
||||
|
||||
toNearest(n: Decimal.Value, rounding?: Decimal.Rounding): Decimal;
|
||||
|
||||
toNumber(): number;
|
||||
|
||||
toOctal(significantDigits?: number): string;
|
||||
toOctal(significantDigits: number, rounding: Decimal.Rounding): string;
|
||||
|
||||
toPower(n: Decimal.Value): Decimal;
|
||||
pow(n: Decimal.Value): Decimal;
|
||||
|
||||
toPrecision(significantDigits?: number): string;
|
||||
toPrecision(significantDigits: number, rounding: Decimal.Rounding): string;
|
||||
|
||||
toSignificantDigits(significantDigits?: number): Decimal;
|
||||
toSignificantDigits(
|
||||
significantDigits: number,
|
||||
rounding: Decimal.Rounding,
|
||||
): Decimal;
|
||||
toSD(significantDigits?: number): Decimal;
|
||||
toSD(significantDigits: number, rounding: Decimal.Rounding): Decimal;
|
||||
|
||||
toString(): string;
|
||||
|
||||
truncated(): Decimal;
|
||||
trunc(): Decimal;
|
||||
|
||||
valueOf(): string;
|
||||
|
||||
static abs(n: Decimal.Value): Decimal;
|
||||
static acos(n: Decimal.Value): Decimal;
|
||||
static acosh(n: Decimal.Value): Decimal;
|
||||
static add(x: Decimal.Value, y: Decimal.Value): Decimal;
|
||||
static asin(n: Decimal.Value): Decimal;
|
||||
static asinh(n: Decimal.Value): Decimal;
|
||||
static atan(n: Decimal.Value): Decimal;
|
||||
static atanh(n: Decimal.Value): Decimal;
|
||||
static atan2(y: Decimal.Value, x: Decimal.Value): Decimal;
|
||||
static cbrt(n: Decimal.Value): Decimal;
|
||||
static ceil(n: Decimal.Value): Decimal;
|
||||
static clamp(
|
||||
n: Decimal.Value,
|
||||
min: Decimal.Value,
|
||||
max: Decimal.Value,
|
||||
): Decimal;
|
||||
static clone(object?: Decimal.Config): Decimal.Constructor;
|
||||
static config(object: Decimal.Config): Decimal.Constructor;
|
||||
static cos(n: Decimal.Value): Decimal;
|
||||
static cosh(n: Decimal.Value): Decimal;
|
||||
static div(x: Decimal.Value, y: Decimal.Value): Decimal;
|
||||
static exp(n: Decimal.Value): Decimal;
|
||||
static floor(n: Decimal.Value): Decimal;
|
||||
static hypot(...n: Decimal.Value[]): Decimal;
|
||||
static isDecimal(object: any): object is Decimal;
|
||||
static ln(n: Decimal.Value): Decimal;
|
||||
static log(n: Decimal.Value, base?: Decimal.Value): Decimal;
|
||||
static log2(n: Decimal.Value): Decimal;
|
||||
static log10(n: Decimal.Value): Decimal;
|
||||
static max(...n: Decimal.Value[]): Decimal;
|
||||
static min(...n: Decimal.Value[]): Decimal;
|
||||
static mod(x: Decimal.Value, y: Decimal.Value): Decimal;
|
||||
static mul(x: Decimal.Value, y: Decimal.Value): Decimal;
|
||||
static noConflict(): Decimal.Constructor; // Browser only
|
||||
static pow(base: Decimal.Value, exponent: Decimal.Value): Decimal;
|
||||
static random(significantDigits?: number): Decimal;
|
||||
static round(n: Decimal.Value): Decimal;
|
||||
static set(object: Decimal.Config): Decimal.Constructor;
|
||||
static sign(n: Decimal.Value): number;
|
||||
static sin(n: Decimal.Value): Decimal;
|
||||
static sinh(n: Decimal.Value): Decimal;
|
||||
static sqrt(n: Decimal.Value): Decimal;
|
||||
static sub(x: Decimal.Value, y: Decimal.Value): Decimal;
|
||||
static sum(...n: Decimal.Value[]): Decimal;
|
||||
static tan(n: Decimal.Value): Decimal;
|
||||
static tanh(n: Decimal.Value): Decimal;
|
||||
static trunc(n: Decimal.Value): Decimal;
|
||||
|
||||
static readonly default?: Decimal.Constructor;
|
||||
static readonly Decimal?: Decimal.Constructor;
|
||||
|
||||
static readonly precision: number;
|
||||
static readonly rounding: Decimal.Rounding;
|
||||
static readonly toExpNeg: number;
|
||||
static readonly toExpPos: number;
|
||||
static readonly minE: number;
|
||||
static readonly maxE: number;
|
||||
static readonly crypto: boolean;
|
||||
static readonly modulo: Decimal.Modulo;
|
||||
|
||||
static readonly ROUND_UP: 0;
|
||||
static readonly ROUND_DOWN: 1;
|
||||
static readonly ROUND_CEIL: 2;
|
||||
static readonly ROUND_FLOOR: 3;
|
||||
static readonly ROUND_HALF_UP: 4;
|
||||
static readonly ROUND_HALF_DOWN: 5;
|
||||
static readonly ROUND_HALF_EVEN: 6;
|
||||
static readonly ROUND_HALF_CEIL: 7;
|
||||
static readonly ROUND_HALF_FLOOR: 8;
|
||||
static readonly EUCLID: 9;
|
||||
}
|
||||
|
||||
declare type Exact<A, W> =
|
||||
| (A extends unknown
|
||||
? W extends A
|
||||
? {
|
||||
[K in keyof A]: Exact<A[K], W[K]>;
|
||||
}
|
||||
: W
|
||||
: never)
|
||||
| (A extends Narrowable ? A : never);
|
||||
|
||||
export declare function getRuntime(): GetRuntimeOutput;
|
||||
|
||||
declare type GetRuntimeOutput = {
|
||||
id: RuntimeName;
|
||||
prettyName: string;
|
||||
isEdge: boolean;
|
||||
};
|
||||
|
||||
declare class JsonNull extends NullTypesEnumValue {
|
||||
#private;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates more strict variant of an enum which, unlike regular enum,
|
||||
* throws on non-existing property access. This can be useful in following situations:
|
||||
* - we have an API, that accepts both `undefined` and `SomeEnumType` as an input
|
||||
* - enum values are generated dynamically from DMMF.
|
||||
*
|
||||
* In that case, if using normal enums and no compile-time typechecking, using non-existing property
|
||||
* will result in `undefined` value being used, which will be accepted. Using strict enum
|
||||
* in this case will help to have a runtime exception, telling you that you are probably doing something wrong.
|
||||
*
|
||||
* Note: if you need to check for existence of a value in the enum you can still use either
|
||||
* `in` operator or `hasOwnProperty` function.
|
||||
*
|
||||
* @param definition
|
||||
* @returns
|
||||
*/
|
||||
export declare function makeStrictEnum<
|
||||
T extends Record<PropertyKey, string | number>,
|
||||
>(definition: T): T;
|
||||
|
||||
declare type Narrowable = string | number | bigint | boolean | [];
|
||||
|
||||
declare class NullTypesEnumValue extends ObjectEnumValue {
|
||||
_getNamespace(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for unique values of object-valued enums.
|
||||
*/
|
||||
declare abstract class ObjectEnumValue {
|
||||
constructor(arg?: symbol);
|
||||
abstract _getNamespace(): string;
|
||||
_getName(): string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export declare const objectEnumValues: {
|
||||
classes: {
|
||||
DbNull: typeof DbNull;
|
||||
JsonNull: typeof JsonNull;
|
||||
AnyNull: typeof AnyNull;
|
||||
};
|
||||
instances: {
|
||||
DbNull: DbNull;
|
||||
JsonNull: JsonNull;
|
||||
AnyNull: AnyNull;
|
||||
};
|
||||
};
|
||||
|
||||
declare type Operation =
|
||||
| "findFirst"
|
||||
| "findFirstOrThrow"
|
||||
| "findUnique"
|
||||
| "findUniqueOrThrow"
|
||||
| "findMany"
|
||||
| "create"
|
||||
| "createMany"
|
||||
| "createManyAndReturn"
|
||||
| "update"
|
||||
| "updateMany"
|
||||
| "updateManyAndReturn"
|
||||
| "upsert"
|
||||
| "delete"
|
||||
| "deleteMany"
|
||||
| "aggregate"
|
||||
| "count"
|
||||
| "groupBy"
|
||||
| "$queryRaw"
|
||||
| "$executeRaw"
|
||||
| "$queryRawUnsafe"
|
||||
| "$executeRawUnsafe"
|
||||
| "findRaw"
|
||||
| "aggregateRaw"
|
||||
| "$runCommandRaw";
|
||||
|
||||
declare namespace Public {
|
||||
export { validator };
|
||||
}
|
||||
export { Public };
|
||||
|
||||
declare type RuntimeName =
|
||||
| "workerd"
|
||||
| "deno"
|
||||
| "netlify"
|
||||
| "node"
|
||||
| "bun"
|
||||
| "edge-light"
|
||||
| "";
|
||||
|
||||
declare function validator<V>(): <S>(select: Exact<S, V>) => S;
|
||||
|
||||
declare function validator<
|
||||
C,
|
||||
M extends Exclude<keyof C, `$${string}`>,
|
||||
O extends keyof C[M] & Operation,
|
||||
>(client: C, model: M, operation: O): <S>(select: Exact<S, Args<C[M], O>>) => S;
|
||||
|
||||
declare function validator<
|
||||
C,
|
||||
M extends Exclude<keyof C, `$${string}`>,
|
||||
O extends keyof C[M] & Operation,
|
||||
P extends keyof Args<C[M], O>,
|
||||
>(
|
||||
client: C,
|
||||
model: M,
|
||||
operation: O,
|
||||
prop: P,
|
||||
): <S>(select: Exact<S, Args<C[M], O>[P]>) => S;
|
||||
|
||||
export {};
|
||||
2289
generated/prisma/runtime/index-browser.js
Normal file
2289
generated/prisma/runtime/index-browser.js
Normal file
File diff suppressed because it is too large
Load Diff
5052
generated/prisma/runtime/library.d.ts
vendored
Normal file
5052
generated/prisma/runtime/library.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10641
generated/prisma/runtime/library.js
Normal file
10641
generated/prisma/runtime/library.js
Normal file
File diff suppressed because it is too large
Load Diff
10679
generated/prisma/runtime/react-native.js
vendored
Normal file
10679
generated/prisma/runtime/react-native.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12156
generated/prisma/runtime/wasm-compiler-edge.js
Normal file
12156
generated/prisma/runtime/wasm-compiler-edge.js
Normal file
File diff suppressed because it is too large
Load Diff
8768
generated/prisma/runtime/wasm-engine-edge.js
Normal file
8768
generated/prisma/runtime/wasm-engine-edge.js
Normal file
File diff suppressed because it is too large
Load Diff
75
generated/prisma/schema.prisma
Normal file
75
generated/prisma/schema.prisma
Normal file
@@ -0,0 +1,75 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
// NOTE: When using mysql or sqlserver, uncomment the @db.Text annotations in model Account below
|
||||
// Further reading:
|
||||
// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema
|
||||
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Post {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
createdBy User @relation(fields: [createdById], references: [id])
|
||||
createdById String
|
||||
|
||||
@@index([name])
|
||||
}
|
||||
|
||||
// Necessary for Next auth
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String? // @db.Text
|
||||
access_token String? // @db.Text
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? // @db.Text
|
||||
session_state String?
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
refresh_token_expires_in Int?
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
posts Post[]
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String @unique
|
||||
expires DateTime
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
5
generated/prisma/wasm-edge-light-loader.mjs
Normal file
5
generated/prisma/wasm-edge-light-loader.mjs
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
export default import('./query_engine_bg.wasm?module')
|
||||
5
generated/prisma/wasm-worker-loader.mjs
Normal file
5
generated/prisma/wasm-worker-loader.mjs
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
export default import('./query_engine_bg.wasm')
|
||||
1
generated/prisma/wasm.d.ts
vendored
Normal file
1
generated/prisma/wasm.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./default";
|
||||
244
generated/prisma/wasm.js
Normal file
244
generated/prisma/wasm.js
Normal file
@@ -0,0 +1,244 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
const {
|
||||
PrismaClientKnownRequestError,
|
||||
PrismaClientUnknownRequestError,
|
||||
PrismaClientRustPanicError,
|
||||
PrismaClientInitializationError,
|
||||
PrismaClientValidationError,
|
||||
getPrismaClient,
|
||||
sqltag,
|
||||
empty,
|
||||
join,
|
||||
raw,
|
||||
skip,
|
||||
Decimal,
|
||||
Debug,
|
||||
objectEnumValues,
|
||||
makeStrictEnum,
|
||||
Extensions,
|
||||
warnOnce,
|
||||
defineDmmfProperty,
|
||||
Public,
|
||||
getRuntime,
|
||||
createParam,
|
||||
} = require("./runtime/wasm-engine-edge.js");
|
||||
|
||||
const Prisma = {};
|
||||
|
||||
exports.Prisma = Prisma;
|
||||
exports.$Enums = {};
|
||||
|
||||
/**
|
||||
* Prisma Client JS version: 6.19.3
|
||||
* Query Engine version: c2990dca591cba766e3b7ef5d9e8a84796e47ab7
|
||||
*/
|
||||
Prisma.prismaVersion = {
|
||||
client: "6.19.3",
|
||||
engine: "c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
|
||||
};
|
||||
|
||||
Prisma.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
|
||||
Prisma.PrismaClientUnknownRequestError = PrismaClientUnknownRequestError;
|
||||
Prisma.PrismaClientRustPanicError = PrismaClientRustPanicError;
|
||||
Prisma.PrismaClientInitializationError = PrismaClientInitializationError;
|
||||
Prisma.PrismaClientValidationError = PrismaClientValidationError;
|
||||
Prisma.Decimal = Decimal;
|
||||
|
||||
/**
|
||||
* Re-export of sql-template-tag
|
||||
*/
|
||||
Prisma.sql = sqltag;
|
||||
Prisma.empty = empty;
|
||||
Prisma.join = join;
|
||||
Prisma.raw = raw;
|
||||
Prisma.validator = Public.validator;
|
||||
|
||||
/**
|
||||
* Extensions
|
||||
*/
|
||||
Prisma.getExtensionContext = Extensions.getExtensionContext;
|
||||
Prisma.defineExtension = Extensions.defineExtension;
|
||||
|
||||
/**
|
||||
* Shorthand utilities for JSON filtering
|
||||
*/
|
||||
Prisma.DbNull = objectEnumValues.instances.DbNull;
|
||||
Prisma.JsonNull = objectEnumValues.instances.JsonNull;
|
||||
Prisma.AnyNull = objectEnumValues.instances.AnyNull;
|
||||
|
||||
Prisma.NullTypes = {
|
||||
DbNull: objectEnumValues.classes.DbNull,
|
||||
JsonNull: objectEnumValues.classes.JsonNull,
|
||||
AnyNull: objectEnumValues.classes.AnyNull,
|
||||
};
|
||||
|
||||
/**
|
||||
* Enums
|
||||
*/
|
||||
exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
|
||||
Serializable: "Serializable",
|
||||
});
|
||||
|
||||
exports.Prisma.PostScalarFieldEnum = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
createdAt: "createdAt",
|
||||
updatedAt: "updatedAt",
|
||||
createdById: "createdById",
|
||||
};
|
||||
|
||||
exports.Prisma.AccountScalarFieldEnum = {
|
||||
id: "id",
|
||||
userId: "userId",
|
||||
type: "type",
|
||||
provider: "provider",
|
||||
providerAccountId: "providerAccountId",
|
||||
refresh_token: "refresh_token",
|
||||
access_token: "access_token",
|
||||
expires_at: "expires_at",
|
||||
token_type: "token_type",
|
||||
scope: "scope",
|
||||
id_token: "id_token",
|
||||
session_state: "session_state",
|
||||
refresh_token_expires_in: "refresh_token_expires_in",
|
||||
};
|
||||
|
||||
exports.Prisma.SessionScalarFieldEnum = {
|
||||
id: "id",
|
||||
sessionToken: "sessionToken",
|
||||
userId: "userId",
|
||||
expires: "expires",
|
||||
};
|
||||
|
||||
exports.Prisma.UserScalarFieldEnum = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
email: "email",
|
||||
emailVerified: "emailVerified",
|
||||
image: "image",
|
||||
};
|
||||
|
||||
exports.Prisma.VerificationTokenScalarFieldEnum = {
|
||||
identifier: "identifier",
|
||||
token: "token",
|
||||
expires: "expires",
|
||||
};
|
||||
|
||||
exports.Prisma.SortOrder = {
|
||||
asc: "asc",
|
||||
desc: "desc",
|
||||
};
|
||||
|
||||
exports.Prisma.NullsOrder = {
|
||||
first: "first",
|
||||
last: "last",
|
||||
};
|
||||
|
||||
exports.Prisma.ModelName = {
|
||||
Post: "Post",
|
||||
Account: "Account",
|
||||
Session: "Session",
|
||||
User: "User",
|
||||
VerificationToken: "VerificationToken",
|
||||
};
|
||||
/**
|
||||
* Create the Client
|
||||
*/
|
||||
const config = {
|
||||
generator: {
|
||||
name: "client",
|
||||
provider: {
|
||||
fromEnvVar: null,
|
||||
value: "prisma-client-js",
|
||||
},
|
||||
output: {
|
||||
value:
|
||||
"/Users/junipertaylor/Documents/GitHub/FolderGameChallenge/t3app/generated/prisma",
|
||||
fromEnvVar: null,
|
||||
},
|
||||
config: {
|
||||
engineType: "library",
|
||||
},
|
||||
binaryTargets: [
|
||||
{
|
||||
fromEnvVar: null,
|
||||
value: "darwin-arm64",
|
||||
native: true,
|
||||
},
|
||||
],
|
||||
previewFeatures: [],
|
||||
sourceFilePath:
|
||||
"/Users/junipertaylor/Documents/GitHub/FolderGameChallenge/t3app/prisma/schema.prisma",
|
||||
isCustomOutput: true,
|
||||
},
|
||||
relativeEnvPaths: {
|
||||
rootEnvPath: null,
|
||||
schemaEnvPath: "../../.env",
|
||||
},
|
||||
relativePath: "../../prisma",
|
||||
clientVersion: "6.19.3",
|
||||
engineVersion: "c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
|
||||
datasourceNames: ["db"],
|
||||
activeProvider: "sqlite",
|
||||
postinstall: false,
|
||||
inlineDatasources: {
|
||||
db: {
|
||||
url: {
|
||||
fromEnvVar: "DATABASE_URL",
|
||||
value: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
inlineSchema:
|
||||
'// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n provider = "prisma-client-js"\n output = "../generated/prisma"\n}\n\ndatasource db {\n provider = "sqlite"\n // NOTE: When using mysql or sqlserver, uncomment the @db.Text annotations in model Account below\n // Further reading:\n // https://next-auth.js.org/adapters/prisma#create-the-prisma-schema\n // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string\n url = env("DATABASE_URL")\n}\n\nmodel Post {\n id Int @id @default(autoincrement())\n name String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n createdBy User @relation(fields: [createdById], references: [id])\n createdById String\n\n @@index([name])\n}\n\n// Necessary for Next auth\nmodel Account {\n id String @id @default(cuid())\n userId String\n type String\n provider String\n providerAccountId String\n refresh_token String? // @db.Text\n access_token String? // @db.Text\n expires_at Int?\n token_type String?\n scope String?\n id_token String? // @db.Text\n session_state String?\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n refresh_token_expires_in Int?\n\n @@unique([provider, providerAccountId])\n}\n\nmodel Session {\n id String @id @default(cuid())\n sessionToken String @unique\n userId String\n expires DateTime\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n}\n\nmodel User {\n id String @id @default(cuid())\n name String?\n email String? @unique\n emailVerified DateTime?\n image String?\n accounts Account[]\n sessions Session[]\n posts Post[]\n}\n\nmodel VerificationToken {\n identifier String\n token String @unique\n expires DateTime\n\n @@unique([identifier, token])\n}\n',
|
||||
inlineSchemaHash:
|
||||
"2379fe619003a4532e1317ec33324f5549ff669a85866549ae71a5b6c8c7fc10",
|
||||
copyEngine: true,
|
||||
};
|
||||
config.dirname = "/";
|
||||
|
||||
config.runtimeDataModel = JSON.parse(
|
||||
'{"models":{"Post":{"fields":[{"name":"id","kind":"scalar","type":"Int"},{"name":"name","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"createdBy","kind":"object","type":"User","relationName":"PostToUser"},{"name":"createdById","kind":"scalar","type":"String"}],"dbName":null},"Account":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"userId","kind":"scalar","type":"String"},{"name":"type","kind":"scalar","type":"String"},{"name":"provider","kind":"scalar","type":"String"},{"name":"providerAccountId","kind":"scalar","type":"String"},{"name":"refresh_token","kind":"scalar","type":"String"},{"name":"access_token","kind":"scalar","type":"String"},{"name":"expires_at","kind":"scalar","type":"Int"},{"name":"token_type","kind":"scalar","type":"String"},{"name":"scope","kind":"scalar","type":"String"},{"name":"id_token","kind":"scalar","type":"String"},{"name":"session_state","kind":"scalar","type":"String"},{"name":"user","kind":"object","type":"User","relationName":"AccountToUser"},{"name":"refresh_token_expires_in","kind":"scalar","type":"Int"}],"dbName":null},"Session":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"sessionToken","kind":"scalar","type":"String"},{"name":"userId","kind":"scalar","type":"String"},{"name":"expires","kind":"scalar","type":"DateTime"},{"name":"user","kind":"object","type":"User","relationName":"SessionToUser"}],"dbName":null},"User":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"email","kind":"scalar","type":"String"},{"name":"emailVerified","kind":"scalar","type":"DateTime"},{"name":"image","kind":"scalar","type":"String"},{"name":"accounts","kind":"object","type":"Account","relationName":"AccountToUser"},{"name":"sessions","kind":"object","type":"Session","relationName":"SessionToUser"},{"name":"posts","kind":"object","type":"Post","relationName":"PostToUser"}],"dbName":null},"VerificationToken":{"fields":[{"name":"identifier","kind":"scalar","type":"String"},{"name":"token","kind":"scalar","type":"String"},{"name":"expires","kind":"scalar","type":"DateTime"}],"dbName":null}},"enums":{},"types":{}}',
|
||||
);
|
||||
defineDmmfProperty(exports.Prisma, config.runtimeDataModel);
|
||||
config.engineWasm = {
|
||||
getRuntime: async () => require("./query_engine_bg.js"),
|
||||
getQueryEngineWasmModule: async () => {
|
||||
const loader = (await import("#wasm-engine-loader")).default;
|
||||
const engine = (await loader).default;
|
||||
return engine;
|
||||
},
|
||||
};
|
||||
config.compilerWasm = undefined;
|
||||
|
||||
config.injectableEdgeEnv = () => ({
|
||||
parsed: {
|
||||
DATABASE_URL:
|
||||
(typeof globalThis !== "undefined" && globalThis["DATABASE_URL"]) ||
|
||||
(typeof process !== "undefined" &&
|
||||
process.env &&
|
||||
process.env.DATABASE_URL) ||
|
||||
undefined,
|
||||
},
|
||||
});
|
||||
|
||||
if (
|
||||
(typeof globalThis !== "undefined" && globalThis["DEBUG"]) ||
|
||||
(typeof process !== "undefined" && process.env && process.env.DEBUG) ||
|
||||
undefined
|
||||
) {
|
||||
Debug.enable(
|
||||
(typeof globalThis !== "undefined" && globalThis["DEBUG"]) ||
|
||||
(typeof process !== "undefined" && process.env && process.env.DEBUG) ||
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
|
||||
const PrismaClient = getPrismaClient(config);
|
||||
exports.PrismaClient = PrismaClient;
|
||||
Object.assign(exports, Prisma);
|
||||
10
next.config.js
Normal file
10
next.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
|
||||
* for Docker builds.
|
||||
*/
|
||||
import "./src/env.js";
|
||||
|
||||
/** @type {import("next").NextConfig} */
|
||||
const config = {};
|
||||
|
||||
export default config;
|
||||
16139
package-lock.json
generated
Normal file
16139
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
133
package.json
Normal file
133
package.json
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"name": "folder-game-challenge",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "next build",
|
||||
"check": "next lint && tsc --noEmit",
|
||||
"db:generate": "prisma migrate dev",
|
||||
"db:migrate": "prisma migrate deploy",
|
||||
"db:push": "prisma db push",
|
||||
"db:studio": "prisma studio",
|
||||
"dev": "next dev --turbo",
|
||||
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mdx}\" --cache",
|
||||
"format:write": "prettier --write \"**/*.{ts,tsx,js,jsx,mdx}\" --cache",
|
||||
"postinstall": "prisma generate",
|
||||
"lint": "next lint",
|
||||
"lint:fix": "next lint --fix",
|
||||
"preview": "next build && next start",
|
||||
"start": "next start",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@auth/prisma-adapter": "^2.7.2",
|
||||
"@aws-sdk/client-s3": "^3.477.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.477.0",
|
||||
"@cloudflare/stream-react": "^1.9.1",
|
||||
"@colyseus/ws-transport": "^0.15.3",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@livekit/components-react": "^2.9.20",
|
||||
"@livekit/components-styles": "^1.2.0",
|
||||
"@mantine/carousel": "^7.10.0",
|
||||
"@mantine/core": "^7.10.0",
|
||||
"@mantine/dates": "^7.10.0",
|
||||
"@mantine/form": "^7.10.0",
|
||||
"@mantine/hooks": "^7.10.0",
|
||||
"@mantine/next": "^6.0.21",
|
||||
"@mantine/notifications": "^7.10.0",
|
||||
"@mantine/tiptap": "^7.10.0",
|
||||
"@next/third-parties": "^15.5.14",
|
||||
"@prisma/client": "^6.6.0",
|
||||
"@sendgrid/mail": "^7.7.0",
|
||||
"@t3-oss/env-nextjs": "^0.12.0",
|
||||
"@tabler/icons-react": "^2.44.0",
|
||||
"@tanstack/react-query": "^5.69.0",
|
||||
"@tiptap/core": "^2.27.2",
|
||||
"@tiptap/extension-blockquote": "^2.27.2",
|
||||
"@tiptap/extension-bold": "^2.27.2",
|
||||
"@tiptap/extension-highlight": "^2.27.2",
|
||||
"@tiptap/extension-link": "^2.27.2",
|
||||
"@tiptap/extension-subscript": "^2.27.2",
|
||||
"@tiptap/extension-superscript": "^2.27.2",
|
||||
"@tiptap/extension-text-align": "^2.27.2",
|
||||
"@tiptap/extension-underline": "^2.27.2",
|
||||
"@tiptap/pm": "^2.27.2",
|
||||
"@tiptap/react": "^2.27.2",
|
||||
"@tiptap/starter-kit": "^2.27.2",
|
||||
"@trpc/client": "^11.0.0",
|
||||
"@trpc/react-query": "^11.0.0",
|
||||
"@trpc/server": "^11.0.0",
|
||||
"archiver": "^7.0.1",
|
||||
"argon2": "^0.31.1",
|
||||
"axios": "^1.14.0",
|
||||
"colyseus.js": "^0.15.28",
|
||||
"date-fns": "^4.1.0",
|
||||
"dayjs": "^1.11.20",
|
||||
"embla-carousel-react": "^8.1.3",
|
||||
"formidable": "^3.5.4",
|
||||
"gifuct-js": "^2.1.2",
|
||||
"hls.js": "^1.6.15",
|
||||
"jszip": "^3.10.1",
|
||||
"konva": "^10.2.3",
|
||||
"livekit-client": "^2.18.1",
|
||||
"livekit-server-sdk": "^2.15.0",
|
||||
"motion": "^12.38.0",
|
||||
"nanoid": "^5.0.3",
|
||||
"next": "^15.2.3",
|
||||
"next-auth": "5.0.0-beta.25",
|
||||
"phaser": "^3.90.0",
|
||||
"prism-react-renderer": "^2.4.1",
|
||||
"react": "^19.0.0",
|
||||
"react-calendly": "^4.3.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-konva": "^18.2.14",
|
||||
"react-qr-code": "^2.0.18",
|
||||
"react-quill": "^2.0.0",
|
||||
"server-only": "^0.0.1",
|
||||
"socket.io": "^4.8.3",
|
||||
"socket.io-client": "^4.7.5",
|
||||
"superjson": "^2.2.1",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@playwright/test": "^1.59.1",
|
||||
"@tailwindcss/postcss": "^4.0.15",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/archiver": "^6.0.4",
|
||||
"@types/formidable": "^3.5.0",
|
||||
"@types/jszip": "^3.4.0",
|
||||
"@types/node": "^20.14.10",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"@vitejs/plugin-react": "^5.2.0",
|
||||
"@vitest/coverage-v8": "^4.1.2",
|
||||
"@vitest/ui": "^4.1.2",
|
||||
"dotenv": "^17.4.1",
|
||||
"eslint": "^9.23.0",
|
||||
"eslint-config-next": "^15.2.3",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
|
||||
"happy-dom": "^20.8.9",
|
||||
"jsdom": "^28.1.0",
|
||||
"playwright": "^1.59.1",
|
||||
"postcss": "^8.5.3",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"prisma": "^6.6.0",
|
||||
"tailwindcss": "^4.0.15",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.8.2",
|
||||
"typescript-eslint": "^8.27.0",
|
||||
"vitest": "^4.1.2"
|
||||
},
|
||||
"ct3aMetadata": {
|
||||
"initVersion": "7.40.0"
|
||||
},
|
||||
"packageManager": "npm@10.9.0"
|
||||
}
|
||||
5
postcss.config.js
Normal file
5
postcss.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export default {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
};
|
||||
4
prettier.config.js
Normal file
4
prettier.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
||||
export default {
|
||||
plugins: ["prettier-plugin-tailwindcss"],
|
||||
};
|
||||
75
prisma/schema.prisma
Normal file
75
prisma/schema.prisma
Normal file
@@ -0,0 +1,75 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
// NOTE: When using mysql or sqlserver, uncomment the @db.Text annotations in model Account below
|
||||
// Further reading:
|
||||
// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema
|
||||
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Post {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
createdBy User @relation(fields: [createdById], references: [id])
|
||||
createdById String
|
||||
|
||||
@@index([name])
|
||||
}
|
||||
|
||||
// Necessary for Next auth
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String? // @db.Text
|
||||
access_token String? // @db.Text
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? // @db.Text
|
||||
session_state String?
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
refresh_token_expires_in Int?
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
posts Post[]
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String @unique
|
||||
expires DateTime
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
50
src/app/_components/post.tsx
Normal file
50
src/app/_components/post.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { api } from "~/trpc/react";
|
||||
|
||||
export function LatestPost() {
|
||||
const [latestPost] = api.post.getLatest.useSuspenseQuery();
|
||||
|
||||
const utils = api.useUtils();
|
||||
const [name, setName] = useState("");
|
||||
const createPost = api.post.create.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.post.invalidate();
|
||||
setName("");
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="w-full max-w-xs">
|
||||
{latestPost ? (
|
||||
<p className="truncate">Your most recent post: {latestPost.name}</p>
|
||||
) : (
|
||||
<p>You have no posts yet.</p>
|
||||
)}
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
createPost.mutate({ name });
|
||||
}}
|
||||
className="flex flex-col gap-2"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Title"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
className="w-full rounded-full bg-white/10 px-4 py-2 text-white"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
className="rounded-full bg-white/10 px-10 py-3 font-semibold transition hover:bg-white/20"
|
||||
disabled={createPost.isPending}
|
||||
>
|
||||
{createPost.isPending ? "Submitting..." : "Submit"}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
3
src/app/api/auth/[...nextauth]/route.ts
Normal file
3
src/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { handlers } from "~/server/auth";
|
||||
|
||||
export const { GET, POST } = handlers;
|
||||
34
src/app/api/trpc/[trpc]/route.ts
Normal file
34
src/app/api/trpc/[trpc]/route.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
import { type NextRequest } from "next/server";
|
||||
|
||||
import { env } from "~/env";
|
||||
import { appRouter } from "~/server/api/root";
|
||||
import { createTRPCContext } from "~/server/api/trpc";
|
||||
|
||||
/**
|
||||
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
|
||||
* handling a HTTP request (e.g. when you make requests from Client Components).
|
||||
*/
|
||||
const createContext = async (req: NextRequest) => {
|
||||
return createTRPCContext({
|
||||
headers: req.headers,
|
||||
});
|
||||
};
|
||||
|
||||
const handler = (req: NextRequest) =>
|
||||
fetchRequestHandler({
|
||||
endpoint: "/api/trpc",
|
||||
req,
|
||||
router: appRouter,
|
||||
createContext: () => createContext(req),
|
||||
onError:
|
||||
env.NODE_ENV === "development"
|
||||
? ({ path, error }) => {
|
||||
console.error(
|
||||
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`,
|
||||
);
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
37
src/app/layout.tsx
Normal file
37
src/app/layout.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import "~/styles/globals.css";
|
||||
|
||||
import { type Metadata } from "next";
|
||||
import { Bakbak_One, Teko } from "next/font/google";
|
||||
|
||||
import { TRPCReactProvider } from "~/trpc/react";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Folder Game Challenge",
|
||||
description:
|
||||
"An interactive game challenge focused on file management and navigating software.",
|
||||
icons: [{ rel: "icon", url: "/favicon.ico" }],
|
||||
};
|
||||
|
||||
const teko = Teko({
|
||||
weight: "700",
|
||||
subsets: ["latin"],
|
||||
variable: "--font-teko",
|
||||
});
|
||||
|
||||
const bakbakOne = Bakbak_One({
|
||||
weight: "400",
|
||||
subsets: ["latin"],
|
||||
variable: "--font-bakbak-one",
|
||||
});
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<html lang="en" className={`${teko.variable} ${bakbakOne.variable}`}>
|
||||
<body className="bg-zinc-950 text-zinc-100 antialiased">
|
||||
<TRPCReactProvider>{children}</TRPCReactProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
21
src/app/page.tsx
Normal file
21
src/app/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col items-center justify-center px-6 py-16">
|
||||
<div className="max-w-2xl space-y-8 text-center">
|
||||
<h1 className="font-heading text-5xl tracking-tight text-white sm:text-6xl">
|
||||
Folder Game Challenge
|
||||
</h1>
|
||||
<div className="space-y-6 text-lg leading-relaxed text-zinc-300 sm:text-xl">
|
||||
<p>
|
||||
You have 2 hours to create an interactive game that uses some
|
||||
education around file management, using / navigating software etc.
|
||||
</p>
|
||||
<p>
|
||||
The goal is the user will progress through levels completing
|
||||
challenges based in real knowledge learning.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
52
src/env.js
Normal file
52
src/env.js
Normal file
@@ -0,0 +1,52 @@
|
||||
import { createEnv } from "@t3-oss/env-nextjs";
|
||||
import { z } from "zod";
|
||||
|
||||
export const env = createEnv({
|
||||
/**
|
||||
* Specify your server-side environment variables schema here. This way you can ensure the app
|
||||
* isn't built with invalid env vars.
|
||||
*/
|
||||
server: {
|
||||
AUTH_SECRET:
|
||||
process.env.NODE_ENV === "production"
|
||||
? z.string()
|
||||
: z.string().optional(),
|
||||
AUTH_DISCORD_ID: z.string().optional(),
|
||||
AUTH_DISCORD_SECRET: z.string().optional(),
|
||||
DATABASE_URL: z.string().url(),
|
||||
NODE_ENV: z
|
||||
.enum(["development", "test", "production"])
|
||||
.default("development"),
|
||||
},
|
||||
|
||||
/**
|
||||
* Specify your client-side environment variables schema here. This way you can ensure the app
|
||||
* isn't built with invalid env vars. To expose them to the client, prefix them with
|
||||
* `NEXT_PUBLIC_`.
|
||||
*/
|
||||
client: {
|
||||
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
||||
},
|
||||
|
||||
/**
|
||||
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
|
||||
* middlewares) or client-side so we need to destruct manually.
|
||||
*/
|
||||
runtimeEnv: {
|
||||
AUTH_SECRET: process.env.AUTH_SECRET,
|
||||
AUTH_DISCORD_ID: process.env.AUTH_DISCORD_ID,
|
||||
AUTH_DISCORD_SECRET: process.env.AUTH_DISCORD_SECRET,
|
||||
DATABASE_URL: process.env.DATABASE_URL,
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
},
|
||||
/**
|
||||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
||||
* useful for Docker builds.
|
||||
*/
|
||||
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
|
||||
/**
|
||||
* Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
|
||||
* `SOME_VAR=''` will throw an error.
|
||||
*/
|
||||
emptyStringAsUndefined: true,
|
||||
});
|
||||
23
src/server/api/root.ts
Normal file
23
src/server/api/root.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { postRouter } from "~/server/api/routers/post";
|
||||
import { createCallerFactory, createTRPCRouter } from "~/server/api/trpc";
|
||||
|
||||
/**
|
||||
* This is the primary router for your server.
|
||||
*
|
||||
* All routers added in /api/routers should be manually added here.
|
||||
*/
|
||||
export const appRouter = createTRPCRouter({
|
||||
post: postRouter,
|
||||
});
|
||||
|
||||
// export type definition of API
|
||||
export type AppRouter = typeof appRouter;
|
||||
|
||||
/**
|
||||
* Create a server-side caller for the tRPC API.
|
||||
* @example
|
||||
* const trpc = createCaller(createContext);
|
||||
* const res = await trpc.post.all();
|
||||
* ^? Post[]
|
||||
*/
|
||||
export const createCaller = createCallerFactory(appRouter);
|
||||
41
src/server/api/routers/post.ts
Normal file
41
src/server/api/routers/post.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import {
|
||||
createTRPCRouter,
|
||||
protectedProcedure,
|
||||
publicProcedure,
|
||||
} from "~/server/api/trpc";
|
||||
|
||||
export const postRouter = createTRPCRouter({
|
||||
hello: publicProcedure
|
||||
.input(z.object({ text: z.string() }))
|
||||
.query(({ input }) => {
|
||||
return {
|
||||
greeting: `Hello ${input.text}`,
|
||||
};
|
||||
}),
|
||||
|
||||
create: protectedProcedure
|
||||
.input(z.object({ name: z.string().min(1) }))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
return ctx.db.post.create({
|
||||
data: {
|
||||
name: input.name,
|
||||
createdBy: { connect: { id: ctx.session.user.id } },
|
||||
},
|
||||
});
|
||||
}),
|
||||
|
||||
getLatest: protectedProcedure.query(async ({ ctx }) => {
|
||||
const post = await ctx.db.post.findFirst({
|
||||
orderBy: { createdAt: "desc" },
|
||||
where: { createdBy: { id: ctx.session.user.id } },
|
||||
});
|
||||
|
||||
return post ?? null;
|
||||
}),
|
||||
|
||||
getSecretMessage: protectedProcedure.query(() => {
|
||||
return "you can now see this secret message!";
|
||||
}),
|
||||
});
|
||||
133
src/server/api/trpc.ts
Normal file
133
src/server/api/trpc.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* YOU PROBABLY DON'T NEED TO EDIT THIS FILE, UNLESS:
|
||||
* 1. You want to modify request context (see Part 1).
|
||||
* 2. You want to create a new middleware or type of procedure (see Part 3).
|
||||
*
|
||||
* TL;DR - This is where all the tRPC server stuff is created and plugged in. The pieces you will
|
||||
* need to use are documented accordingly near the end.
|
||||
*/
|
||||
|
||||
import { initTRPC, TRPCError } from "@trpc/server";
|
||||
import superjson from "superjson";
|
||||
import { ZodError } from "zod";
|
||||
|
||||
import { auth } from "~/server/auth";
|
||||
import { db } from "~/server/db";
|
||||
|
||||
/**
|
||||
* 1. CONTEXT
|
||||
*
|
||||
* This section defines the "contexts" that are available in the backend API.
|
||||
*
|
||||
* These allow you to access things when processing a request, like the database, the session, etc.
|
||||
*
|
||||
* This helper generates the "internals" for a tRPC context. The API handler and RSC clients each
|
||||
* wrap this and provides the required context.
|
||||
*
|
||||
* @see https://trpc.io/docs/server/context
|
||||
*/
|
||||
export const createTRPCContext = async (opts: { headers: Headers }) => {
|
||||
const session = await auth();
|
||||
|
||||
return {
|
||||
db,
|
||||
session,
|
||||
...opts,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 2. INITIALIZATION
|
||||
*
|
||||
* This is where the tRPC API is initialized, connecting the context and transformer. We also parse
|
||||
* ZodErrors so that you get typesafety on the frontend if your procedure fails due to validation
|
||||
* errors on the backend.
|
||||
*/
|
||||
const t = initTRPC.context<typeof createTRPCContext>().create({
|
||||
transformer: superjson,
|
||||
errorFormatter({ shape, error }) {
|
||||
return {
|
||||
...shape,
|
||||
data: {
|
||||
...shape.data,
|
||||
zodError:
|
||||
error.cause instanceof ZodError ? error.cause.flatten() : null,
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a server-side caller.
|
||||
*
|
||||
* @see https://trpc.io/docs/server/server-side-calls
|
||||
*/
|
||||
export const createCallerFactory = t.createCallerFactory;
|
||||
|
||||
/**
|
||||
* 3. ROUTER & PROCEDURE (THE IMPORTANT BIT)
|
||||
*
|
||||
* These are the pieces you use to build your tRPC API. You should import these a lot in the
|
||||
* "/src/server/api/routers" directory.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is how you create new routers and sub-routers in your tRPC API.
|
||||
*
|
||||
* @see https://trpc.io/docs/router
|
||||
*/
|
||||
export const createTRPCRouter = t.router;
|
||||
|
||||
/**
|
||||
* Middleware for timing procedure execution and adding an artificial delay in development.
|
||||
*
|
||||
* You can remove this if you don't like it, but it can help catch unwanted waterfalls by simulating
|
||||
* network latency that would occur in production but not in local development.
|
||||
*/
|
||||
const timingMiddleware = t.middleware(async ({ next, path }) => {
|
||||
const start = Date.now();
|
||||
|
||||
if (t._config.isDev) {
|
||||
// artificial delay in dev
|
||||
const waitMs = Math.floor(Math.random() * 400) + 100;
|
||||
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
||||
}
|
||||
|
||||
const result = await next();
|
||||
|
||||
const end = Date.now();
|
||||
console.log(`[TRPC] ${path} took ${end - start}ms to execute`);
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
/**
|
||||
* Public (unauthenticated) procedure
|
||||
*
|
||||
* This is the base piece you use to build new queries and mutations on your tRPC API. It does not
|
||||
* guarantee that a user querying is authorized, but you can still access user session data if they
|
||||
* are logged in.
|
||||
*/
|
||||
export const publicProcedure = t.procedure.use(timingMiddleware);
|
||||
|
||||
/**
|
||||
* Protected (authenticated) procedure
|
||||
*
|
||||
* If you want a query or mutation to ONLY be accessible to logged in users, use this. It verifies
|
||||
* the session is valid and guarantees `ctx.session.user` is not null.
|
||||
*
|
||||
* @see https://trpc.io/docs/procedures
|
||||
*/
|
||||
export const protectedProcedure = t.procedure
|
||||
.use(timingMiddleware)
|
||||
.use(({ ctx, next }) => {
|
||||
if (!ctx.session?.user) {
|
||||
throw new TRPCError({ code: "UNAUTHORIZED" });
|
||||
}
|
||||
return next({
|
||||
ctx: {
|
||||
// infers the `session` as non-nullable
|
||||
session: { ...ctx.session, user: ctx.session.user },
|
||||
},
|
||||
});
|
||||
});
|
||||
60
src/server/auth/config.ts
Normal file
60
src/server/auth/config.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { PrismaAdapter } from "@auth/prisma-adapter";
|
||||
import { type DefaultSession, type NextAuthConfig } from "next-auth";
|
||||
import DiscordProvider from "next-auth/providers/discord";
|
||||
|
||||
import { env } from "~/env";
|
||||
import { db } from "~/server/db";
|
||||
|
||||
/**
|
||||
* Module augmentation for `next-auth` types. Allows us to add custom properties to the `session`
|
||||
* object and keep type safety.
|
||||
*
|
||||
* @see https://next-auth.js.org/getting-started/typescript#module-augmentation
|
||||
*/
|
||||
declare module "next-auth" {
|
||||
interface Session extends DefaultSession {
|
||||
user: {
|
||||
id: string;
|
||||
// ...other properties
|
||||
// role: UserRole;
|
||||
} & DefaultSession["user"];
|
||||
}
|
||||
|
||||
// interface User {
|
||||
// // ...other properties
|
||||
// // role: UserRole;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc.
|
||||
*
|
||||
* @see https://next-auth.js.org/configuration/options
|
||||
*/
|
||||
export const authConfig = {
|
||||
providers: [
|
||||
...(env.AUTH_DISCORD_ID && env.AUTH_DISCORD_SECRET
|
||||
? [
|
||||
DiscordProvider({
|
||||
clientId: env.AUTH_DISCORD_ID,
|
||||
clientSecret: env.AUTH_DISCORD_SECRET,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
/**
|
||||
* ...add more providers here.
|
||||
*
|
||||
* @see https://next-auth.js.org/getting-started/providers
|
||||
*/
|
||||
],
|
||||
adapter: PrismaAdapter(db),
|
||||
callbacks: {
|
||||
session: ({ session, user }) => ({
|
||||
...session,
|
||||
user: {
|
||||
...session.user,
|
||||
id: user.id,
|
||||
},
|
||||
}),
|
||||
},
|
||||
} satisfies NextAuthConfig;
|
||||
10
src/server/auth/index.ts
Normal file
10
src/server/auth/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import NextAuth from "next-auth";
|
||||
import { cache } from "react";
|
||||
|
||||
import { authConfig } from "./config";
|
||||
|
||||
const { auth: uncachedAuth, handlers, signIn, signOut } = NextAuth(authConfig);
|
||||
|
||||
const auth = cache(uncachedAuth);
|
||||
|
||||
export { auth, handlers, signIn, signOut };
|
||||
16
src/server/db.ts
Normal file
16
src/server/db.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { env } from "~/env";
|
||||
import { PrismaClient } from "../../generated/prisma";
|
||||
|
||||
const createPrismaClient = () =>
|
||||
new PrismaClient({
|
||||
log:
|
||||
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
|
||||
});
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: ReturnType<typeof createPrismaClient> | undefined;
|
||||
};
|
||||
|
||||
export const db = globalForPrisma.prisma ?? createPrismaClient();
|
||||
|
||||
if (env.NODE_ENV !== "production") globalForPrisma.prisma = db;
|
||||
7
src/styles/globals.css
Normal file
7
src/styles/globals.css
Normal file
@@ -0,0 +1,7 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
--font-sans: var(--font-bakbak-one), ui-sans-serif, system-ui, sans-serif,
|
||||
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--font-heading: var(--font-teko), ui-sans-serif, sans-serif;
|
||||
}
|
||||
25
src/trpc/query-client.ts
Normal file
25
src/trpc/query-client.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
defaultShouldDehydrateQuery,
|
||||
QueryClient,
|
||||
} from "@tanstack/react-query";
|
||||
import SuperJSON from "superjson";
|
||||
|
||||
export const createQueryClient = () =>
|
||||
new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
// With SSR, we usually want to set some default staleTime
|
||||
// above 0 to avoid refetching immediately on the client
|
||||
staleTime: 30 * 1000,
|
||||
},
|
||||
dehydrate: {
|
||||
serializeData: SuperJSON.serialize,
|
||||
shouldDehydrateQuery: (query) =>
|
||||
defaultShouldDehydrateQuery(query) ||
|
||||
query.state.status === "pending",
|
||||
},
|
||||
hydrate: {
|
||||
deserializeData: SuperJSON.deserialize,
|
||||
},
|
||||
},
|
||||
});
|
||||
78
src/trpc/react.tsx
Normal file
78
src/trpc/react.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
"use client";
|
||||
|
||||
import { QueryClientProvider, type QueryClient } from "@tanstack/react-query";
|
||||
import { httpBatchStreamLink, loggerLink } from "@trpc/client";
|
||||
import { createTRPCReact } from "@trpc/react-query";
|
||||
import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";
|
||||
import { useState } from "react";
|
||||
import SuperJSON from "superjson";
|
||||
|
||||
import { type AppRouter } from "~/server/api/root";
|
||||
import { createQueryClient } from "./query-client";
|
||||
|
||||
let clientQueryClientSingleton: QueryClient | undefined = undefined;
|
||||
const getQueryClient = () => {
|
||||
if (typeof window === "undefined") {
|
||||
// Server: always make a new query client
|
||||
return createQueryClient();
|
||||
}
|
||||
// Browser: use singleton pattern to keep the same query client
|
||||
clientQueryClientSingleton ??= createQueryClient();
|
||||
|
||||
return clientQueryClientSingleton;
|
||||
};
|
||||
|
||||
export const api = createTRPCReact<AppRouter>();
|
||||
|
||||
/**
|
||||
* Inference helper for inputs.
|
||||
*
|
||||
* @example type HelloInput = RouterInputs['example']['hello']
|
||||
*/
|
||||
export type RouterInputs = inferRouterInputs<AppRouter>;
|
||||
|
||||
/**
|
||||
* Inference helper for outputs.
|
||||
*
|
||||
* @example type HelloOutput = RouterOutputs['example']['hello']
|
||||
*/
|
||||
export type RouterOutputs = inferRouterOutputs<AppRouter>;
|
||||
|
||||
export function TRPCReactProvider(props: { children: React.ReactNode }) {
|
||||
const queryClient = getQueryClient();
|
||||
|
||||
const [trpcClient] = useState(() =>
|
||||
api.createClient({
|
||||
links: [
|
||||
loggerLink({
|
||||
enabled: (op) =>
|
||||
process.env.NODE_ENV === "development" ||
|
||||
(op.direction === "down" && op.result instanceof Error),
|
||||
}),
|
||||
httpBatchStreamLink({
|
||||
transformer: SuperJSON,
|
||||
url: getBaseUrl() + "/api/trpc",
|
||||
headers: () => {
|
||||
const headers = new Headers();
|
||||
headers.set("x-trpc-source", "nextjs-react");
|
||||
return headers;
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<api.Provider client={trpcClient} queryClient={queryClient}>
|
||||
{props.children}
|
||||
</api.Provider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function getBaseUrl() {
|
||||
if (typeof window !== "undefined") return window.location.origin;
|
||||
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`;
|
||||
return `http://localhost:${process.env.PORT ?? 3000}`;
|
||||
}
|
||||
30
src/trpc/server.ts
Normal file
30
src/trpc/server.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import "server-only";
|
||||
|
||||
import { createHydrationHelpers } from "@trpc/react-query/rsc";
|
||||
import { headers } from "next/headers";
|
||||
import { cache } from "react";
|
||||
|
||||
import { createCaller, type AppRouter } from "~/server/api/root";
|
||||
import { createTRPCContext } from "~/server/api/trpc";
|
||||
import { createQueryClient } from "./query-client";
|
||||
|
||||
/**
|
||||
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
|
||||
* handling a tRPC call from a React Server Component.
|
||||
*/
|
||||
const createContext = cache(async () => {
|
||||
const heads = new Headers(await headers());
|
||||
heads.set("x-trpc-source", "rsc");
|
||||
|
||||
return createTRPCContext({
|
||||
headers: heads,
|
||||
});
|
||||
});
|
||||
|
||||
const getQueryClient = cache(createQueryClient);
|
||||
const caller = createCaller(createContext);
|
||||
|
||||
export const { trpc: api, HydrateClient } = createHydrationHelpers<AppRouter>(
|
||||
caller,
|
||||
getQueryClient,
|
||||
);
|
||||
42
tsconfig.json
Normal file
42
tsconfig.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Base Options: */
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "es2022",
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleDetection": "force",
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
|
||||
/* Strictness */
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"checkJs": true,
|
||||
|
||||
/* Bundled projects */
|
||||
"lib": ["dom", "dom.iterable", "ES2022"],
|
||||
"noEmit": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"jsx": "preserve",
|
||||
"plugins": [{ "name": "next" }],
|
||||
"incremental": true,
|
||||
|
||||
/* Path Aliases */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.cjs",
|
||||
"**/*.js",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": ["node_modules", "generated"]
|
||||
}
|
||||
Reference in New Issue
Block a user