Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion standalone/standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
"@eggjs/tegg-dynamic-inject-runtime": "^3.72.0",
"@eggjs/tegg-lifecycle": "^3.72.0",
"@eggjs/tegg-loader": "^3.72.0",
"@eggjs/tegg-controller-plugin": "^3.72.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better maintainability and to follow common conventions, dependencies in package.json should be sorted alphabetically. The newly added @eggjs/tegg-controller-plugin is out of order. It should be placed before @eggjs/tegg-dal-plugin.

"@eggjs/tegg-metadata": "^3.72.0",
"@eggjs/tegg-runtime": "^3.72.0"
"@eggjs/tegg-runtime": "^3.72.0",
"@eggjs/tegg-types": "^3.72.0"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 12 additions & 0 deletions standalone/standalone/src/Runner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ModuleConfigUtil, ModuleReference, ReadModuleReferenceOptions, RuntimeConfig } from '@eggjs/tegg-common-util';
import {
EggPrototype,
EggPrototypeCreatorFactory,
EggPrototypeLifecycleUtil, GlobalGraph,
LoadUnit,
LoadUnitFactory,
Expand All @@ -11,6 +12,7 @@ import {
ContextHandler,
EggContainerFactory,
EggContext,
EggObjectFactory,
EggObjectLifecycleUtil,
LoadUnitInstance,
LoadUnitInstanceFactory,
Expand Down Expand Up @@ -44,6 +46,9 @@ import { MysqlDataSourceManager } from '@eggjs/tegg-dal-plugin';
import { SqlMapManager } from '@eggjs/tegg-dal-plugin/lib/SqlMapManager';
import { TableModelManager } from '@eggjs/tegg-dal-plugin/lib/TableModelManager';
import { TransactionPrototypeHook } from '@eggjs/tegg-dal-plugin/lib/TransactionPrototypeHook';
import { AGENT_CONTROLLER_PROTO_IMPL_TYPE } from '@eggjs/tegg-types';
import { AgentControllerProto } from '@eggjs/tegg-controller-plugin/lib/AgentControllerProto';
import { AgentControllerObject } from '@eggjs/tegg-controller-plugin/lib/AgentControllerObject';

export interface ModuleDependency extends ReadModuleReferenceOptions {
baseDir: string;
Expand Down Expand Up @@ -179,6 +184,13 @@ export class Runner {
EggPrototypeLifecycleUtil.registerLifecycle(this.dalTableEggPrototypeHook);
EggPrototypeLifecycleUtil.registerLifecycle(this.transactionPrototypeHook);
LoadUnitLifecycleUtil.registerLifecycle(this.dalModuleLoadUnitHook);

// AgentController support
EggPrototypeCreatorFactory.registerPrototypeCreator(
AGENT_CONTROLLER_PROTO_IMPL_TYPE, AgentControllerProto.createProto);
AgentControllerObject.setLogger(logger as any);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The type assertion as any hides a potential type mismatch and should be avoided. The logger variable is of type Logger (from @eggjs/tegg) or console, but AgentControllerObject.setLogger expects an EggLogger (from egg). This could lead to runtime errors if agent-runtime (which receives this logger) calls methods specific to EggLogger that are not present on the provided logger object. Please resolve this type incompatibility properly instead of suppressing the type error.

EggObjectFactory.registerEggObjectCreateMethod(
AgentControllerProto, AgentControllerObject.createObject);
}

async load() {
Expand Down
Loading