this is a mess and still definitely incomplete

This commit is contained in:
split / May 2024-02-29 21:08:47 -08:00
parent 0f9bcba740
commit c6e9e25973
22 changed files with 339 additions and 262 deletions

View file

@ -3,11 +3,12 @@
"version": "1.4.0-dev",
"description": "Discord-based file sharing",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node ./out/server/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "vite",
"build": "tsc && vite build",
"build": "tsc --build src/server && vite build",
"preview": "vite preview"
},
"keywords": [],

View file

@ -1,14 +1,17 @@
import fs from "fs"
import { stat } from "fs/promises"
import Files from "./lib/files"
import Files from "./lib/files.js"
import { program } from "commander"
import { basename } from "path"
import { Writable } from "node:stream"
const pkg = require(`${process.cwd()}/package.json`)
let config = require(`${process.cwd()}/config.json`)
import pkg from "../../package.json" assert { type: "json" }
import config from "../../config.json" assert { type: "json" }
import { fileURLToPath } from "url"
import { dirname } from "path"
// init data
const __dirname = dirname(fileURLToPath(import.meta.url))
if (!fs.existsSync(__dirname + "/../../.data/"))
fs.mkdirSync(__dirname + "/../../.data/")
@ -65,12 +68,12 @@ program.command("upload")
if (!(fs.existsSync(file) && (await stat(file)).isFile()))
throw `${file} is not a file`
let writable = files.writeFileStream({
filename: basename(file),
mime: "application/octet-stream",
size: (await stat(file)).size,
uploadId: options.fileid
})
let writable = files.createWriteStream()
writable
.setName(file)
?.setType("application/octet-stream")
?.setUploadId(options.fileId)
if (!(writable instanceof Writable))
throw JSON.stringify(writable, null, 3)

View file

@ -3,10 +3,10 @@ import { serveStatic } from "@hono/node-server/serve-static"
import { Hono } from "hono"
import fs from "fs"
import { readFile } from "fs/promises"
import Files from "./lib/files"
import { getAccount } from "./lib/middleware"
import APIRouter from "./routes/api"
import preview from "./routes/preview"
import Files from "./lib/files.js"
import { getAccount } from "./lib/middleware.js"
import APIRouter from "./routes/api.js"
import preview from "./routes/preview.js"
const pkg = require(`${process.cwd()}/package.json`)
const app = new Hono()
@ -117,4 +117,4 @@ serve(
}
)
export = app
export default app

View file

@ -1,3 +1,4 @@
// working around typescript cause i can't think of anything better :upside_down:
import { type RequestInfo, type RequestInit, type Response, Headers } from "node-fetch"
// I jerk off to skibidi toilet. His smile is so fucking hot, oh my god, oh.

View file

@ -1,8 +1,8 @@
import { REST } from "./DiscordRequests"
import { REST } from "./DiscordRequests.js"
import type { APIMessage } from "discord-api-types/v10"
import FormData from "form-data"
import { Readable } from "node:stream"
import { Configuration } from "../files"
import { Configuration } from "../files.js"
const EXPIRE_AFTER = 20 * 60 * 1000
const DISCORD_EPOCH = 1420070400000

View file

@ -1,7 +1,7 @@
import crypto from "crypto"
import * as auth from "./auth";
import * as auth from "./auth.js";
import { readFile, writeFile } from "fs/promises"
import { FileVisibility } from "./files";
import { FileVisibility } from "./files.js";
// this is probably horrible
// but i don't even care anymore

View file

@ -1,19 +1,18 @@
import { readFile, writeFile } from "node:fs/promises"
import { Readable, Writable } from "node:stream"
import crypto from "node:crypto"
import { files } from "./accounts"
import { Client as API } from "./DiscordAPI"
import { files } from "./accounts.js"
import { Client as API } from "./DiscordAPI/index.js"
import type {APIAttachment} from "discord-api-types/v10"
import "dotenv"
import * as Accounts from "./accounts"
import * as Accounts from "./accounts.js"
export let id_check_regex = /[A-Za-z0-9_\-\.\!\=\:\&\$\,\+\;\@\~\*\(\)\']+/
export let alphanum = Array.from(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
)
require("dotenv").config()
// bad solution but whatever
export type FileVisibility = "public" | "anonymous" | "private"
@ -96,73 +95,159 @@ async function startPushingWebStream(stream: Readable, webStream: ReadableStream
}
}
namespace StreamHelpers {
export class WebError extends Error {
export interface UploadStream {
uploaded: number // number of bytes uploaded
stream : Readable
}
export class StreamBuffer {
readonly targetSize: number
filled: number = 0
current?: Readable
messages: string[] = []
writable?: Writable
private newmessage_debounce : boolean = true
api: API
files: Files
constructor( files: Files, targetSize: number ) {
this.files = files
this.api = files.api
this.targetSize = targetSize
}
private async startMessage(): Promise<Readable | undefined> {
if (!this.newmessage_debounce) return
this.newmessage_debounce = false
let sbuf = this
let stream = new Readable({
read() {
console.log("Read called. Emitting drain")
sbuf.writable!.emit("drain")
}
})
stream.pause()
console.log(`Starting a message`)
this.api.send(stream).then(message => {
this.messages.push(message.id)
console.log(`Sent: ${message.id}`)
this.newmessage_debounce = true
})
readonly statusCode: number = 500
return stream
}
async getNextStream() {
console.log("Getting stream...")
if (this.current) return this.current
else {
// startmessage.... idk
this.current = await this.startMessage();
console.log("current:" + (this.current ? "yes" : "no"))
return this.current
}
}
constructor(status: number, message: string) {
super(message)
this.statusCode = status
}
}
export class UploadStream extends Writable {
uploadId?: string
name?: string
mime?: string
owner?: string
files: Files
error?: Error
constructor(files: Files, owner?: string) {
super()
this.owner = owner
this.files = files
}
// implementing some stuff
_write(data: Buffer, encoding: string, callback: () => void) {
console.log("Write to stream attempted")
this.getNextStream().then(ns => {
if (ns) {ns.push(data); callback()} else this.end();
console.log(`pushed... ${ns ? "ns exists" : "ns doesn't exist"}... ${data.byteLength} byte chunk`);
return
})
}
_destroy(error: Error | null) {
this.error = error || undefined
if (error instanceof WebError) return // destroyed by self
if (error) this.abort() // destroyed externally...
}
/**
* @description Cancel & unlock the file. When destroy() is called with a non-WebError, this is automatically called
*/
async abort() {
if (!this.destroyed) this.destroy()
await this.files.api.deleteMessages(this.messages)
}
/**
* @description Commit the file to the database
* @returns The file's ID
*/
async commit() {
if (this.errored) throw this.error
if (!this.closed) {
let err = Error("attempted to commit file without closing the stream")
this.destroy(err); throw err
}
// Perform checks
if (!this.mime) throw new WebError(400, "no mime provided")
if (!this.name) throw new WebError(400, "no filename provided")
if (!this.uploadId) this.setUploadId(generateFileId())
// commit to db here...
}
// exposed methods
setName(name: string) {
if (this.name)
return this.destroy( new WebError(400, "duplicate attempt to set filename") )
if (name.length > 512)
return this.destroy( new WebError(400, "filename can be a maximum of 512 characters") )
this.name = name;
}
setType(type: string) {
if (this.mime)
return this.destroy( new WebError(400, "duplicate attempt to set mime type") )
if (type.length > 256)
return this.destroy( new WebError(400, "mime type can be a maximum of 256 characters") )
this.mime = type;
}
setUploadId(id: string) {
if (this.uploadId)
return this.destroy( new WebError(400, "duplicate attempt to set upload ID") )
if (id.match(id_check_regex)?.[0] != id
|| id.length > this.files.config.maxUploadIdLength)
return this.destroy( new WebError(400, "invalid file ID") )
// There's more stuff to check here!
// Make sure to check if the upload ID is locked
// and if the user owns this file...
this.uploadId = id
return this
}
// merged StreamBuffer helper
filled: number = 0
current?: Readable
messages: string[] = []
private newmessage_debounce : boolean = true
private async startMessage(): Promise<Readable | undefined> {
if (!this.newmessage_debounce) return
this.newmessage_debounce = false
let stream = new Readable({
read() {
console.log("Read called. Emitting drain")
this.emit("drain")
}
})
stream.pause()
console.log(`Starting a message`)
this.files.api.send(stream).then(message => {
this.messages.push(message.id)
console.log(`Sent: ${message.id}`)
this.newmessage_debounce = true
})
return stream
}
private async getNextStream() {
console.log("Getting stream...")
if (this.current) return this.current
else {
// startmessage.... idk
this.current = await this.startMessage();
console.log("current:" + (this.current ? "yes" : "no"))
return this.current
}
}
}
export default class Files {
config: Configuration
api: API
@ -209,33 +294,8 @@ export default class Files {
)
}
writeFileStream(metadata: FileUploadSettings & { size: number }) {
let uploadId = (metadata.uploadId || generateFileId()).toString()
let validation = this.validateUpload(
{...metadata, uploadId}
)
if (validation) return validation
let buf = new StreamHelpers.StreamBuffer(this, metadata.size)
let fs_obj = this
let wt = new Writable({
write(data: Buffer, encoding, callback) {
console.log("Write to stream attempted")
buf.getNextStream().then(ns => {
if (ns) {ns.push(data); callback()} else this.end();
console.log(`pushed... ${ns ? "ns exists" : "ns doesn't exist"}... ${data.byteLength} byte chunk`);
return
})
},
})
buf.writable = wt;
return wt
createWriteStream(owner?: string) {
return new UploadStream(this, owner)
}
// fs

View file

@ -1,7 +1,7 @@
import * as Accounts from "./accounts"
import * as Accounts from "./accounts.js"
import { Handler as RequestHandler } from "hono"
import ServeError from "../lib/errors"
import * as auth from "./auth"
import ServeError from "../lib/errors.js"
import * as auth from "./auth.js"
/**
* @description Middleware which adds an account, if any, to ctx.get("account")

View file

@ -1,5 +1,5 @@
import type { Handler } from "hono"
import ServeError from "./errors"
import ServeError from "./errors.js"
interface RatelimitSettings {
requests: number

View file

@ -1,6 +1,6 @@
import { Hono } from "hono"
import { readFile, readdir } from "fs/promises"
import Files from "../lib/files"
import Files from "../lib/files.js"
const APIDirectory = __dirname + "/api"

View file

@ -1,15 +1,15 @@
import { Hono } from "hono"
import * as Accounts from "../../../lib/accounts"
import * as auth from "../../../lib/auth"
import * as Accounts from "../../../lib/accounts.js"
import * as auth from "../../../lib/auth.js"
import { writeFile } from "fs/promises"
import { sendMail } from "../../../lib/mail"
import { sendMail } from "../../../lib/mail.js"
import {
getAccount,
requiresAccount,
requiresAdmin,
requiresPermissions,
} from "../../../lib/middleware"
import Files from "../../../lib/files"
} from "../../../lib/middleware.js"
import Files from "../../../lib/files.js"
export let adminRoutes = new Hono<{
Variables: {

View file

@ -1,22 +1,22 @@
import { Hono, Handler } from "hono"
import { getCookie, setCookie } from "hono/cookie"
import * as Accounts from "../../../lib/accounts"
import * as auth from "../../../lib/auth"
import { sendMail } from "../../../lib/mail"
import * as Accounts from "../../../lib/accounts.js"
import * as auth from "../../../lib/auth.js"
import { sendMail } from "../../../lib/mail.js"
import {
getAccount,
noAPIAccess,
requiresAccount,
requiresPermissions,
} from "../../../lib/middleware"
import { accountRatelimit } from "../../../lib/ratelimit"
} from "../../../lib/middleware.js"
import { accountRatelimit } from "../../../lib/ratelimit.js"
import ServeError from "../../../lib/errors"
import ServeError from "../../../lib/errors.js"
import Files, {
FileVisibility,
generateFileId,
id_check_regex,
} from "../../../lib/files"
} from "../../../lib/files.js"
import { writeFile } from "fs/promises"

View file

@ -1,12 +1,12 @@
import { Hono } from "hono"
import * as Accounts from "../../../lib/accounts"
import * as Accounts from "../../../lib/accounts.js"
import { writeFile } from "fs/promises"
import Files from "../../../lib/files"
import Files from "../../../lib/files.js"
import {
getAccount,
requiresAccount,
requiresPermissions,
} from "../../../lib/middleware"
} from "../../../lib/middleware.js"
export let fileApiRoutes = new Hono<{
Variables: {

View file

@ -1,15 +1,15 @@
import bodyParser from "body-parser"
import { Hono } from "hono"
import * as Accounts from "../../../lib/accounts"
import * as auth from "../../../lib/auth"
import * as Accounts from "../../../lib/accounts.js"
import * as auth from "../../../lib/auth.js"
import axios, { AxiosResponse } from "axios"
import { type Range } from "range-parser"
import multer, { memoryStorage } from "multer"
import { Readable } from "stream"
import ServeError from "../../../lib/errors"
import Files from "../../../lib/files"
import { getAccount, requiresPermissions } from "../../../lib/middleware"
import ServeError from "../../../lib/errors.js"
import Files from "../../../lib/files.js"
import { getAccount, requiresPermissions } from "../../../lib/middleware.js"
let parser = bodyParser.json({
type: ["text/plain", "application/json"],
@ -27,7 +27,7 @@ let config = require(`${process.cwd()}/config.json`)
primaryApi.use(getAccount)
module.exports = function (files: Files) {
module.exports = function (files: Files) {/*
primaryApi.get(
["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],
async (ctx) => {
@ -114,7 +114,7 @@ module.exports = function (files: Files) {
return ServeError(ctx, 404, "file not found")
}
}
)
)*/
// primaryApi.head(
// ["/file/:fileId", "/cpt/:fileId/*", "/:fileId"],

View file

@ -6,18 +6,18 @@ import { getCookie, setCookie } from "hono/cookie"
// Libs
import Files, { id_check_regex } from "../../../lib/files"
import * as Accounts from "../../../lib/accounts"
import * as Authentication from "../../../lib/auth"
import Files, { id_check_regex } from "../../../lib/files.js"
import * as Accounts from "../../../lib/accounts.js"
import * as Authentication from "../../../lib/auth.js"
import {
assertAPI,
getAccount,
noAPIAccess,
requiresAccount,
requiresPermissions,
} from "../../../lib/middleware"
import ServeError from "../../../lib/errors"
import { sendMail } from "../../../lib/mail"
} from "../../../lib/middleware.js"
import ServeError from "../../../lib/errors.js"
import { sendMail } from "../../../lib/mail.js"
const Configuration = require(`${process.cwd()}/config.json`)

View file

@ -5,17 +5,17 @@ import { Hono } from "hono"
// Libs
import Files, { id_check_regex } from "../../../lib/files"
import * as Accounts from "../../../lib/accounts"
import * as Authentication from "../../../lib/auth"
import Files, { id_check_regex } from "../../../lib/files.js"
import * as Accounts from "../../../lib/accounts.js"
import * as Authentication from "../../../lib/auth.js"
import {
getAccount,
noAPIAccess,
requiresAccount,
requiresAdmin,
} from "../../../lib/middleware"
import ServeError from "../../../lib/errors"
import { sendMail } from "../../../lib/mail"
} from "../../../lib/middleware.js"
import ServeError from "../../../lib/errors.js"
import { sendMail } from "../../../lib/mail.js"
const Configuration = require(`${process.cwd()}/config.json`)

View file

@ -1,12 +1,12 @@
import { Hono } from "hono"
import Files, { id_check_regex } from "../../../lib/files"
import * as Accounts from "../../../lib/accounts"
import Files, { id_check_regex } from "../../../lib/files.js"
import * as Accounts from "../../../lib/accounts.js"
import {
getAccount,
requiresAccount,
requiresPermissions,
} from "../../../lib/middleware"
import ServeError from "../../../lib/errors"
} from "../../../lib/middleware.js"
import ServeError from "../../../lib/errors.js"
const Configuration = require(`${process.cwd()}/config.json`)

View file

@ -1,5 +1,5 @@
import { Hono } from "hono";
import Files from "../../../lib/files";
import Files from "../../../lib/files.js";
const router = new Hono()

View file

@ -1,5 +1,5 @@
import { Hono } from "hono"
import Files from "../../../lib/files"
import Files from "../../../lib/files.js"
const router = new Hono()

View file

@ -1,11 +1,11 @@
import fs from "fs/promises"
import bytes from "bytes"
import ServeError from "../lib/errors"
import * as Accounts from "../lib/accounts"
import ServeError from "../lib/errors.js"
import * as Accounts from "../lib/accounts.js"
import type { Handler } from "hono"
import type Files from "../lib/files"
import type Files from "../lib/files.js"
const pkg = require(`${process.cwd()}/package.json`)
export = (files: Files): Handler =>
export default (files: Files): Handler =>
async (ctx) => {
let acc = ctx.get("account") as Accounts.Account
const fileId = ctx.req.param("fileId")

104
src/server/tsconfig.json Normal file
View file

@ -0,0 +1,104 @@
{
"include":["**/*"],
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "nodenext", /* Specify what module code is generated. */
//"rootDir": "./src/", /* Specify the root folder within your source files. */
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
"resolveJsonModule": true, /* Enable importing .json files. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "../../out/server", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View file

@ -1,104 +1,12 @@
{
"include":["src/server/**/*"],
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./src/", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./out/server", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
"rootDir": ".",
"outDir": ".",
"resolveJsonModule": true,
"composite": true,
"skipLibCheck": true
},
"files": [
"package.json", "config.json"
]
}