fix(pipeline): 重构运行时依赖加载逻辑,修复火山引擎DNS解析报runtimeDepsService未初始化的bug

This commit is contained in:
xiaojunnuo
2026-07-11 23:40:13 +08:00
parent edda1b57f3
commit ec69b8f11b
18 changed files with 105 additions and 48 deletions
@@ -14,7 +14,8 @@ export class VolcengineCdnClient {
if (this.service) {
return this.service;
}
const { cdn } = await this.opts.access.importRuntime("@volcengine/openapi");
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { cdn } = await importRuntime("@volcengine/openapi");
const service = new cdn.CdnService();
// 设置ak、sk
service.setAccessKeyId(this.opts.access.accessKeyId);
@@ -21,7 +21,8 @@ export class VolcengineDnsClient {
}
async doRequest(req: VolcengineReq) {
const { Signer } = await this.opts.access.importRuntime("@volcengine/openapi");
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { Signer } = await importRuntime("@volcengine/openapi");
// http request data
const openApiRequestData: any = {
@@ -1,10 +1,12 @@
import { VolcengineAccess } from "./access.js";
import { HttpClient, ILogger } from "@certd/basic";
import { ImportRuntime } from "@certd/pipeline";
export type VolcengineOpts = {
access: VolcengineAccess;
logger: ILogger;
http: HttpClient;
importRuntime?: ImportRuntime;
};
export class VolcengineClient {
@@ -140,7 +142,8 @@ export class VolcengineClient {
}
async getTOSService(opts: { region?: string }) {
const { TosClient } = await this.opts.access.importRuntime("@volcengine/tos-sdk");
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { TosClient } = await importRuntime("@volcengine/tos-sdk");
const client = new TosClient({
accessKeyId: this.opts.access.accessKeyId,
@@ -169,7 +172,8 @@ export class VolcengineClient {
if (this.CommonService) {
return this.CommonService;
}
const { Service } = await this.opts.access.importRuntime("@volcengine/openapi");
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { Service } = await importRuntime("@volcengine/openapi");
class CommonService extends Service {
Generic: any;
@@ -22,6 +22,7 @@ export class VolcengineDnsProvider extends AbstractDnsProvider {
access: this.access,
logger: this.logger,
http: this.http,
importRuntime: this.importRuntime.bind(this),
});
}