修复 @param 在类扩展时作用域污染的问题,完善interface
parent
cd6938dd6c
commit
dd7914e1fb
@ -0,0 +1,8 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"gruntfuggly.todo-tree",
|
||||
"ronnidc.nunjucks",
|
||||
"sysoev.language-stylus"
|
||||
]
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface Global {
|
||||
Hydro: {
|
||||
model: any
|
||||
handler: any
|
||||
script: any
|
||||
service: any
|
||||
lib: any
|
||||
stat: any
|
||||
wiki: any
|
||||
template: any
|
||||
ui: any
|
||||
error: any
|
||||
locales: any
|
||||
}
|
||||
nodeModules: any
|
||||
onDestory: Function[]
|
||||
isFirstWorker: boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'cluster' {
|
||||
let isFirstWorker: boolean;
|
||||
}
|
||||
|
||||
export { };
|
@ -0,0 +1,149 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import { ObjectID, GridFSBucket } from 'mongodb';
|
||||
import fs from 'fs';
|
||||
|
||||
export interface Setting {
|
||||
family: string,
|
||||
key: string,
|
||||
range: Array<[string, string]> | { [key: string]: string },
|
||||
value: any,
|
||||
type: string,
|
||||
name: string,
|
||||
desc: string,
|
||||
flag: number,
|
||||
}
|
||||
|
||||
export interface Pdoc {
|
||||
_id: ObjectID
|
||||
domainId: string
|
||||
docId: number
|
||||
pid: string
|
||||
owner: number
|
||||
title: string
|
||||
content: string
|
||||
nSubmit: number
|
||||
nAccept: number
|
||||
tag: string[]
|
||||
category: string[],
|
||||
data: ObjectID | null
|
||||
hidden: boolean
|
||||
config: string
|
||||
}
|
||||
|
||||
export interface TestCase {
|
||||
time: number,
|
||||
memory: number,
|
||||
status: number,
|
||||
message: string,
|
||||
}
|
||||
|
||||
export interface Rdoc {
|
||||
_id: ObjectID,
|
||||
domainId: string,
|
||||
pid: number
|
||||
uid: number,
|
||||
lang: string,
|
||||
code: string,
|
||||
score: number,
|
||||
memory: number,
|
||||
time: number,
|
||||
judgeTexts: string[],
|
||||
compilerTexts: string[],
|
||||
testCases: TestCase[],
|
||||
rejudged: boolean,
|
||||
judger: string,
|
||||
judgeAt: Date,
|
||||
status: number,
|
||||
type: string,
|
||||
hidden: boolean,
|
||||
input?: string,
|
||||
stdout?: string,
|
||||
stderr?: string,
|
||||
tid?: ObjectID,
|
||||
ttype?: number,
|
||||
}
|
||||
|
||||
export type ProblemImporter = (url: string, handler: any) =>
|
||||
Promise<[Pdoc, fs.ReadStream?]> | [Pdoc, fs.ReadStream?];
|
||||
|
||||
export interface Script {
|
||||
run: (args: any, report: Function) => any,
|
||||
description: string,
|
||||
validate: any,
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface Global {
|
||||
Hydro: {
|
||||
model: {
|
||||
blacklist: typeof import('./model/blacklist'),
|
||||
builtin: typeof import('./model/builtin'),
|
||||
contest: typeof import('./model/contest'),
|
||||
discussion: typeof import('./model/discussion'),
|
||||
document: typeof import('./model/document'),
|
||||
domain: typeof import('./model/domain'),
|
||||
file: typeof import('./model/file'),
|
||||
message: typeof import('./model/message'),
|
||||
opcount: typeof import('./model/opcount'),
|
||||
problem: typeof import('./model/problem'),
|
||||
record: typeof import('./model/record'),
|
||||
setting: typeof import('./model/setting'),
|
||||
solution: typeof import('./model/solution'),
|
||||
system: typeof import('./model/system'),
|
||||
task: typeof import('./model/task'),
|
||||
token: typeof import('./model/token'),
|
||||
training: typeof import('./model/training'),
|
||||
user: typeof import('./model/user'),
|
||||
[key: string]: any,
|
||||
},
|
||||
handler: { [key: string]: Function },
|
||||
script: { [key: string]: Script },
|
||||
service: {
|
||||
bus: typeof import('./service/bus'),
|
||||
db: typeof import('./service/db'),
|
||||
gridfs: GridFSBucket,
|
||||
monitor: typeof import('./service/monitor'),
|
||||
server: typeof import('./service/server'),
|
||||
},
|
||||
lib: {
|
||||
download: typeof import('./lib/download').default,
|
||||
'hash.hydro': typeof import('./lib/hash.hydro').default,
|
||||
hpm: typeof import('./lib/hpm'),
|
||||
i18n: typeof import('./lib/i18n').default,
|
||||
'import.syzoj': typeof import('./lib/import.syzoj').syzoj,
|
||||
jwt: typeof import('./lib/jwt'),
|
||||
logger: typeof import('./lib/logger').default,
|
||||
mail: typeof import('./lib/mail'),
|
||||
markdown: typeof import('./lib/markdown'),
|
||||
md5: typeof import('./lib/md5').default,
|
||||
misc: typeof import('./lib/misc'),
|
||||
nav: typeof import('./lib/nav').default,
|
||||
paginate: typeof import('./lib/paginate').default,
|
||||
rank: typeof import('./lib/rank').default,
|
||||
rating: typeof import('./lib/rating').default,
|
||||
readConfig: typeof import('./lib/readConfig').default,
|
||||
sha1: typeof import('./lib/sha1').default,
|
||||
sysinfo: typeof import('./lib/sysinfo'),
|
||||
template: typeof import('./lib/template'),
|
||||
'testdata.convert.ini': typeof import('./lib/testdata.convert.ini').default,
|
||||
useragent: typeof import('./lib/useragent'),
|
||||
validator: typeof import('./lib/validator'),
|
||||
[key: string]: any
|
||||
},
|
||||
stat: any,
|
||||
wiki: { [category: string]: { [page: string]: any } },
|
||||
template: { [key: string]: string },
|
||||
ui: any,
|
||||
error: typeof import('./error'),
|
||||
locales: { [id: string]: { [key: string]: string } },
|
||||
},
|
||||
nodeModules: any,
|
||||
onDestory: Function[],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'cluster' {
|
||||
let isFirstWorker: boolean;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
import { GridFSBucket } from 'mongodb';
|
||||
import { db } from './db';
|
||||
|
||||
const exp = new GridFSBucket(db);
|
||||
export const fs = new GridFSBucket(db);
|
||||
|
||||
global.Hydro.service.gridfs = exp;
|
||||
global.Hydro.service.gridfs = fs;
|
||||
|
||||
export default exp;
|
||||
export default fs;
|
||||
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"id": "problem-import-syzoj",
|
||||
"version": "1.0.1",
|
||||
"description": "Import problem from syzoj."
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
Import problem from syzoj.: 从运行 syzoj 系统的 OJ 导入题目。
|
||||
problem.import.problem_description: '## 题目描述'
|
||||
problem.import.input_format: '## 输入格式'
|
||||
problem.import.output_format: '## 输出格式'
|
||||
problem.import.hint: '## 提示'
|
||||
problem.import.limit_and_hint: '## 限制'
|
||||
problem.import.additional_file: '## 附加文件'
|
||||
import: 导入
|
Loading…
Reference in New Issue