chore: 移除autowire特性

This commit is contained in:
xiaojunnuo
2025-04-28 21:55:23 +08:00
parent 048696ee93
commit 0b6941d5ce
25 changed files with 55 additions and 106 deletions

View File

@@ -4,9 +4,6 @@ import { IAccess, Registrable } from "@certd/pipeline";
export type DnsProviderDefine = Registrable & {
accessType: string;
icon?: string;
autowire?: {
[key: string]: any;
};
};
export type CreateRecordOptions = {

View File

@@ -39,8 +39,6 @@ export async function createDnsProvider(opts: { dnsProviderType: string; context
}
// @ts-ignore
const dnsProvider: IDnsProvider = new DnsProviderClass();
Decorator.inject(dnsProviderDefine.autowire, dnsProvider, context);
dnsProvider.setCtx(context);
await dnsProvider.onInstance();
return dnsProvider;

View File

@@ -1,6 +1,6 @@
import { dnsProviderRegistry } from "./registry.js";
import { DnsProviderDefine } from "./api.js";
import { Decorator, AUTOWIRE_KEY } from "@certd/pipeline";
import { Decorator } from "@certd/pipeline";
import * as _ from "lodash-es";
// 提供一个唯一 key
@@ -9,15 +9,6 @@ export const DNS_PROVIDER_CLASS_KEY = "pipeline:dns-provider";
export function IsDnsProvider(define: DnsProviderDefine): ClassDecorator {
return (target: any) => {
target = Decorator.target(target);
const autowires: any = {};
const properties = Decorator.getClassProperties(target);
for (const property in properties) {
const autowire = Reflect.getMetadata(AUTOWIRE_KEY, target, property);
if (autowire) {
autowires[property] = autowire;
}
}
_.merge(define, { autowire: autowires });
Reflect.defineMetadata(DNS_PROVIDER_CLASS_KEY, define, target);