fix: 修复上传到cos报runtimeDepsService未初始化的问题

This commit is contained in:
xiaojunnuo
2026-07-15 01:09:57 +08:00
parent b91c9e4ea6
commit 167b303fae
53 changed files with 517 additions and 1533 deletions
@@ -10,12 +10,15 @@ export class VolcengineCdnClient {
this.opts = opts;
}
async importRuntime(packageName: string) {
return this.opts.access.importRuntime(packageName);
}
async getCdnClient() {
if (this.service) {
return this.service;
}
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { cdn } = await importRuntime("@volcengine/openapi");
const { cdn } = await this.importRuntime("@volcengine/openapi");
const service = new cdn.CdnService();
// 设置ak、sk
service.setAccessKeyId(this.opts.access.accessKeyId);
@@ -19,10 +19,12 @@ export class VolcengineDnsClient {
constructor(opts: VolcengineOpts) {
this.opts = opts;
}
async importRuntime(packageName: string) {
return this.opts.access.importRuntime(packageName);
}
async doRequest(req: VolcengineReq) {
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { Signer } = await importRuntime("@volcengine/openapi");
const { Signer } = await this.importRuntime("@volcengine/openapi");
// http request data
const openApiRequestData: any = {
@@ -243,7 +243,7 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin {
return {
value: item.Domain,
label: item.Domain,
domain : item.Domain,
domain: item.Domain,
};
});
return this.ctx.utils.options.buildGroupOptions(list, this.certDomains);
@@ -1,12 +1,10 @@
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 {
@@ -17,6 +15,10 @@ export class VolcengineClient {
this.opts = opts;
}
async importRuntime(packageName: string) {
return this.opts.access.importRuntime(packageName);
}
async getCertCenterService() {
const CommonService = await this.getServiceCls();
@@ -142,8 +144,7 @@ export class VolcengineClient {
}
async getTOSService(opts: { region?: string }) {
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { TosClient } = await importRuntime("@volcengine/tos-sdk");
const { TosClient } = await this.importRuntime("@volcengine/tos-sdk");
const client = new TosClient({
accessKeyId: this.opts.access.accessKeyId,
@@ -172,8 +173,7 @@ export class VolcengineClient {
if (this.CommonService) {
return this.CommonService;
}
const importRuntime = this.opts.importRuntime || this.opts.access.importRuntime.bind(this.opts.access);
const { Service } = await importRuntime("@volcengine/openapi");
const { Service } = await this.importRuntime("@volcengine/openapi");
class CommonService extends Service {
Generic: any;
@@ -22,7 +22,6 @@ export class VolcengineDnsProvider extends AbstractDnsProvider {
access: this.access,
logger: this.logger,
http: this.http,
importRuntime: this.importRuntime.bind(this),
});
}