Files
NapCatQQ/.pnpm-store/v3/files/73/954174c76137056cc5ab7866897296cee539e9bc90891abc6fad1cfbd70cdac6198cee2ba29253bc6527be98f1366dbf82d94c5e4daf062fed2c6f1c2598e7
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

34 lines
2.1 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwAtInvalidClassMetadata = throwAtInvalidClassMetadata;
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
const MaybeClassElementMetadataKind_1 = require("../models/MaybeClassElementMetadataKind");
function throwAtInvalidClassMetadata(type, classMetadata) {
const errors = [];
for (let i = 0; i < classMetadata.constructorArguments.length; ++i) {
const constructorArgument = classMetadata.constructorArguments[i];
if (constructorArgument === undefined ||
constructorArgument.kind === MaybeClassElementMetadataKind_1.MaybeClassElementMetadataKind.unknown) {
errors.push(` - Missing or incomplete metadata for type "${type.name}" at constructor argument with index ${i.toString()}.
Every constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`);
}
}
for (const [propertyKey, property] of classMetadata.properties) {
if (property.kind === MaybeClassElementMetadataKind_1.MaybeClassElementMetadataKind.unknown) {
errors.push(` - Missing or incomplete metadata for type "${type.name}" at property "${propertyKey.toString()}".
This property must be decorated either with @inject or @multiInject decorator.`);
}
}
if (errors.length === 0) {
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.unknown, `Unexpected class metadata for type "${type.name}" with uncompletion traces.
This might be caused by one of the following reasons:
1. A third party library is targeting inversify reflection metadata.
2. A bug is causing the issue. Consider submiting an issue to fix it.`);
}
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.missingInjectionDecorator, `Invalid class metadata at type ${type.name}:
${errors.join('\n\n')}`);
}
//# sourceMappingURL=throwAtInvalidClassMetadata.js.map