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

31 lines
1.6 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveInstanceBindingNodeFromConstructorParams = resolveInstanceBindingNodeFromConstructorParams;
const common_1 = require("@inversifyjs/common");
const resolvePostConstruct_1 = require("./resolvePostConstruct");
function resolveAllPostConstructMethods(instance, binding, postConstructMethodNames) {
if (postConstructMethodNames.size === 0) {
return instance;
}
let result = instance;
for (const methodName of postConstructMethodNames) {
if ((0, common_1.isPromise)(result)) {
result = result.then((resolvedInstance) => (0, resolvePostConstruct_1.resolvePostConstruct)(resolvedInstance, binding, methodName));
}
else {
result = (0, resolvePostConstruct_1.resolvePostConstruct)(result, binding, methodName);
}
}
return result;
}
function resolveInstanceBindingNodeFromConstructorParams(setInstanceProperties) {
return (constructorValues, params, node) => {
const instance = new node.binding.implementationType(...constructorValues);
const propertiesAssignmentResult = setInstanceProperties(params, instance, node);
if ((0, common_1.isPromise)(propertiesAssignmentResult)) {
return propertiesAssignmentResult.then(() => resolveAllPostConstructMethods(instance, node.binding, node.classMetadata.lifecycle.postConstructMethodNames));
}
return resolveAllPostConstructMethods(instance, node.binding, node.classMetadata.lifecycle.postConstructMethodNames);
};
}
//# sourceMappingURL=resolveInstanceBindingNodeFromConstructorParams.js.map