From ed6a9c5bbc9308e266fdd26df9d34b710bdc6092 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Thu, 5 Feb 2026 19:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E8=87=B30.0.15=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96CNB=E5=92=8C?= =?UTF-8?q?Workspace=E7=B1=BB=E7=9A=84=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9A=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.ts | 22 ++++++++++++---------- src/workspace/index.ts | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index a0e3baa..0f972b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/cnb", - "version": "0.0.14", + "version": "0.0.15", "description": "", "main": "index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index 334ecbf..2f43dda 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,21 +21,23 @@ export class CNB extends CNBCore { mission!: Mission; ai!: AiBase; constructor(options: CNBOptions) { - super({ token: options.token, cookie: options.cookie, cnb: options.cnb }); + super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb }); this.init(options); } init(cnbOptions?: CNBOptions) { const token = this.token; const cookie = this.cookie; - const options = { token, cookie }; - this.workspace = new Workspace(options.token); - this.knowledgeBase = new KnowledgeBase({ token: options.token, cookie: options.cookie }); - this.repo = new Repo({ token: options.token, cookie: options.cookie }); - this.user = new User({ token: options.token, cookie: options.cookie }); - this.build = new Build({ token: options.token, cookie: options.cookie }); - this.issue = new Issue({ token: options.token, cookie: options.cookie }); - this.mission = new Mission({ token: options.token, cookie: options.cookie }); - this.ai = new AiBase({ token: options.token, cookie: options.cookie }); + const cors = cnbOptions?.cors || {} + const cnb = cnbOptions?.cnb + const options = { token, cookie, cors, cnb }; + this.workspace = new Workspace(options); + this.knowledgeBase = new KnowledgeBase(options); + this.repo = new Repo(options); + this.user = new User(options); + this.build = new Build(options); + this.issue = new Issue(options); + this.mission = new Mission(options); + this.ai = new AiBase(options); } setToken(token: string) { this.token = token; diff --git a/src/workspace/index.ts b/src/workspace/index.ts index 4a547ba..cb013f0 100644 --- a/src/workspace/index.ts +++ b/src/workspace/index.ts @@ -6,7 +6,7 @@ */ import { Result } from "@kevisual/query/query"; -import { CNBCore } from "../cnb-core.ts"; +import { CNBCore, CNBCoreOptions } from "../cnb-core.ts"; /** * 工作空间列表查询参数 @@ -33,8 +33,8 @@ export interface ListParams { * https://api.cnb.cool/#/operations/GetWorkspaceDetail */ export class Workspace extends CNBCore { - constructor(token: string) { - super({ token }); + constructor(options: CNBCoreOptions) { + super(options); } /** * 删除我的云原生开发环境