bus: remove legacy import * usage support

This commit is contained in:
undefined committed 2025-03-04 09:55:05 +08:00
1 parent bd63331137
commit aeb9d4cf50
17 files changed
+16 -24

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ import storage from '../model/storage';
import * as system from '../model/system'; import * as system from '../model/system';
import task, { Consumer } from '../model/task'; import task, { Consumer } from '../model/task';
import user from '../model/user'; import user from '../model/user';
import * as bus from '../service/bus'; import bus from '../service/bus';
import { updateJudge } from '../service/monitor'; import { updateJudge } from '../service/monitor';
import { import {
ConnectionHandler, Handler, post, subscribe, Types, ConnectionHandler, Handler, post, subscribe, Types,
+1 -1
View File
@@ -9,7 +9,7 @@ import {
BaseUserDict, ContestRule, ContestRules, ProblemDict, RecordDoc, BaseUserDict, ContestRule, ContestRules, ProblemDict, RecordDoc,
ScoreboardConfig, ScoreboardNode, ScoreboardRow, SubtaskResult, Tdoc, ScoreboardConfig, ScoreboardNode, ScoreboardRow, SubtaskResult, Tdoc,
} from '../interface'; } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import type { Handler } from '../service/server'; import type { Handler } from '../service/server';
import { Optional } from '../typeutils'; import { Optional } from '../typeutils';
+1 -1
View File
@@ -5,7 +5,7 @@ import { DiscussionNodeNotFoundError, DocumentNotFoundError } from '../error';
import { import {
DiscussionHistoryDoc, DiscussionReplyDoc, DiscussionTailReplyDoc, Document, DiscussionHistoryDoc, DiscussionReplyDoc, DiscussionTailReplyDoc, Document,
} from '../interface'; } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { NumberKeys } from '../typeutils'; import { NumberKeys } from '../typeutils';
import { buildProjection } from '../utils'; import { buildProjection } from '../utils';
+1 -1
View File
@@ -9,7 +9,7 @@ import {
DiscussionReplyDoc, ProblemDoc, ProblemStatusDoc, DiscussionReplyDoc, ProblemDoc, ProblemStatusDoc,
Tdoc, TrainingDoc, Tdoc, TrainingDoc,
} from '../interface'; } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { ArrayKeys, MaybeArray, NumberKeys, Projection } from '../typeutils'; import { ArrayKeys, MaybeArray, NumberKeys, Projection } from '../typeutils';
import { buildProjection } from '../utils'; import { buildProjection } from '../utils';
+1 -1
View File
@@ -2,7 +2,7 @@ import { Dictionary, escapeRegExp } from 'lodash';
import { LRUCache } from 'lru-cache'; import { LRUCache } from 'lru-cache';
import { Filter } from 'mongodb'; import { Filter } from 'mongodb';
import { DomainDoc } from '../interface'; import { DomainDoc } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { MaybeArray, NumberKeys } from '../typeutils'; import { MaybeArray, NumberKeys } from '../typeutils';
import { ArgMethod } from '../utils'; import { ArgMethod } from '../utils';
+1 -1
View File
@@ -1,6 +1,6 @@
import { Filter, ObjectId } from 'mongodb'; import { Filter, ObjectId } from 'mongodb';
import { MessageDoc } from '../interface'; import { MessageDoc } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { ArgMethod } from '../utils'; import { ArgMethod } from '../utils';
import { PRIV } from './builtin'; import { PRIV } from './builtin';
+1 -1
View File
@@ -1,7 +1,7 @@
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { ObjectId } from 'mongodb'; import { ObjectId } from 'mongodb';
import { OplogDoc } from '../interface'; import { OplogDoc } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import type { Handler } from '../service/server'; import type { Handler } from '../service/server';
+1 -1
View File
@@ -16,7 +16,7 @@ import type {
Document, ProblemDict, ProblemStatusDoc, User, Document, ProblemDict, ProblemStatusDoc, User,
} from '../interface'; } from '../interface';
import { parseConfig } from '../lib/testdataConfig'; import { parseConfig } from '../lib/testdataConfig';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { import {
ArrayKeys, MaybeArray, NumberKeys, Projection, ArrayKeys, MaybeArray, NumberKeys, Projection,
+1 -1
View File
@@ -1,6 +1,6 @@
import { ObjectId } from 'mongodb'; import { ObjectId } from 'mongodb';
import { SolutionNotFoundError } from '../error'; import { SolutionNotFoundError } from '../error';
import * as bus from '../service/bus'; import bus from '../service/bus';
import * as document from './document'; import * as document from './document';
class SolutionModel { class SolutionModel {
+1 -1
View File
@@ -1,5 +1,5 @@
import { SystemKeys } from '../interface'; import { SystemKeys } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { NumberKeys } from '../typeutils'; import { NumberKeys } from '../typeutils';
import { SYSTEM_SETTINGS } from './setting'; import { SYSTEM_SETTINGS } from './setting';
+1 -1
View File
@@ -6,7 +6,7 @@ import { sleep } from '@hydrooj/utils/lib/utils';
import { Context } from '../context'; import { Context } from '../context';
import { EventDoc, Task } from '../interface'; import { EventDoc, Task } from '../interface';
import { Logger } from '../logger'; import { Logger } from '../logger';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
const logger = new Logger('model/task'); const logger = new Logger('model/task');
+1 -1
View File
@@ -1,6 +1,6 @@
import { Filter } from 'mongodb'; import { Filter } from 'mongodb';
import { TokenDoc } from '../interface'; import { TokenDoc } from '../interface';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { ArgMethod } from '../utils'; import { ArgMethod } from '../utils';
+1 -1
View File
@@ -9,7 +9,7 @@ import {
} from '../interface'; } from '../interface';
import avatar from '../lib/avatar'; import avatar from '../lib/avatar';
import pwhash from '../lib/hash.hydro'; import pwhash from '../lib/hash.hydro';
import * as bus from '../service/bus'; import bus from '../service/bus';
import db from '../service/db'; import db from '../service/db';
import { Value } from '../typeutils'; import { Value } from '../typeutils';
import { ArgMethod, buildProjection } from '../utils'; import { ArgMethod, buildProjection } from '../utils';
-8
View File
@@ -114,14 +114,6 @@ export function apply(ctx: Context) {
} }
export default app; export default app;
export const on = (a, b, c?) => app.on(a, b, c);
export const once = (a, b, c?) => app.once(a, b, c);
export const parallel = app.parallel.bind(app);
export const emit = app.parallel.bind(app);
export const bail = app.bail.bind(app);
// For backward compatibility
export const serial: any = app.parallel.bind(app);
export const broadcast = app.broadcast.bind(app);
global.Hydro.service.bus = app as any; global.Hydro.service.bus = app as any;
global.bus = app; global.bus = app;
+1 -1
View File
@@ -7,7 +7,7 @@ import { Time } from '@hydrooj/utils';
import { ValidationError } from '../error'; import { ValidationError } from '../error';
import { Logger } from '../logger'; import { Logger } from '../logger';
import { load } from '../options'; import { load } from '../options';
import * as bus from './bus'; import bus from './bus';
const logger = new Logger('mongo'); const logger = new Logger('mongo');
export interface Collections { } export interface Collections { }
+1 -1
View File
@@ -4,7 +4,7 @@ import type { StatusUpdate } from '@hydrooj/utils/lib/sysinfo';
import * as sysinfo from '@hydrooj/utils/lib/sysinfo'; import * as sysinfo from '@hydrooj/utils/lib/sysinfo';
import { Context } from '../context'; import { Context } from '../context';
import { Logger } from '../logger'; import { Logger } from '../logger';
import * as bus from './bus'; import bus from './bus';
import db from './db'; import db from './db';
const coll = db.collection('status'); const coll = db.collection('status');
+1 -1
View File
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-shadow */ /* eslint-disable @typescript-eslint/no-shadow */
import { Logger } from './logger'; import { Logger } from './logger';
import * as bus from './service/bus'; import bus from './service/bus';
let terminating = false; let terminating = false;
async function terminate() { async function terminate() {