@kevisual/cnb 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/opencode.js CHANGED
@@ -22629,8 +22629,8 @@ class CNBCore {
22629
22629
 
22630
22630
  // src/workspace/index.ts
22631
22631
  class Workspace extends CNBCore {
22632
- constructor(token) {
22633
- super({ token });
22632
+ constructor(options) {
22633
+ super(options);
22634
22634
  }
22635
22635
  async deleteWorkspace(params) {
22636
22636
  const data = {};
@@ -22994,21 +22994,23 @@ class CNB extends CNBCore {
22994
22994
  mission;
22995
22995
  ai;
22996
22996
  constructor(options) {
22997
- super({ token: options.token, cookie: options.cookie, cnb: options.cnb });
22997
+ super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
22998
22998
  this.init(options);
22999
22999
  }
23000
23000
  init(cnbOptions) {
23001
23001
  const token = this.token;
23002
23002
  const cookie = this.cookie;
23003
- const options = { token, cookie };
23004
- this.workspace = new Workspace(options.token);
23005
- this.knowledgeBase = new KnowledgeBase({ token: options.token, cookie: options.cookie });
23006
- this.repo = new Repo({ token: options.token, cookie: options.cookie });
23007
- this.user = new User({ token: options.token, cookie: options.cookie });
23008
- this.build = new Build({ token: options.token, cookie: options.cookie });
23009
- this.issue = new Issue({ token: options.token, cookie: options.cookie });
23010
- this.mission = new Mission({ token: options.token, cookie: options.cookie });
23011
- this.ai = new AiBase({ token: options.token, cookie: options.cookie });
23003
+ const cors = cnbOptions?.cors || {};
23004
+ const cnb = cnbOptions?.cnb;
23005
+ const options = { token, cookie, cors, cnb };
23006
+ this.workspace = new Workspace(options);
23007
+ this.knowledgeBase = new KnowledgeBase(options);
23008
+ this.repo = new Repo(options);
23009
+ this.user = new User(options);
23010
+ this.build = new Build(options);
23011
+ this.issue = new Issue(options);
23012
+ this.mission = new Mission(options);
23013
+ this.ai = new AiBase(options);
23012
23014
  }
23013
23015
  setToken(token) {
23014
23016
  this.token = token;
package/dist/routes.d.ts CHANGED
@@ -84,7 +84,7 @@ interface ListParams {
84
84
  * https://api.cnb.cool/#/operations/GetWorkspaceDetail
85
85
  */
86
86
  declare class Workspace extends CNBCore {
87
- constructor(token: string);
87
+ constructor(options: CNBCoreOptions);
88
88
  /**
89
89
  * 删除我的云原生开发环境
90
90
  * @param params 删除参数,pipelineId 和 sn 二选一,优先使用 pipelineId
package/dist/routes.js CHANGED
@@ -22629,8 +22629,8 @@ class CNBCore {
22629
22629
 
22630
22630
  // src/workspace/index.ts
22631
22631
  class Workspace extends CNBCore {
22632
- constructor(token) {
22633
- super({ token });
22632
+ constructor(options) {
22633
+ super(options);
22634
22634
  }
22635
22635
  async deleteWorkspace(params) {
22636
22636
  const data = {};
@@ -22994,21 +22994,23 @@ class CNB extends CNBCore {
22994
22994
  mission;
22995
22995
  ai;
22996
22996
  constructor(options) {
22997
- super({ token: options.token, cookie: options.cookie, cnb: options.cnb });
22997
+ super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
22998
22998
  this.init(options);
22999
22999
  }
23000
23000
  init(cnbOptions) {
23001
23001
  const token = this.token;
23002
23002
  const cookie = this.cookie;
23003
- const options = { token, cookie };
23004
- this.workspace = new Workspace(options.token);
23005
- this.knowledgeBase = new KnowledgeBase({ token: options.token, cookie: options.cookie });
23006
- this.repo = new Repo({ token: options.token, cookie: options.cookie });
23007
- this.user = new User({ token: options.token, cookie: options.cookie });
23008
- this.build = new Build({ token: options.token, cookie: options.cookie });
23009
- this.issue = new Issue({ token: options.token, cookie: options.cookie });
23010
- this.mission = new Mission({ token: options.token, cookie: options.cookie });
23011
- this.ai = new AiBase({ token: options.token, cookie: options.cookie });
23003
+ const cors = cnbOptions?.cors || {};
23004
+ const cnb = cnbOptions?.cnb;
23005
+ const options = { token, cookie, cors, cnb };
23006
+ this.workspace = new Workspace(options);
23007
+ this.knowledgeBase = new KnowledgeBase(options);
23008
+ this.repo = new Repo(options);
23009
+ this.user = new User(options);
23010
+ this.build = new Build(options);
23011
+ this.issue = new Issue(options);
23012
+ this.mission = new Mission(options);
23013
+ this.ai = new AiBase(options);
23012
23014
  }
23013
23015
  setToken(token) {
23014
23016
  this.token = token;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cnb",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -21,21 +21,23 @@ export class CNB extends CNBCore {
21
21
  mission!: Mission;
22
22
  ai!: AiBase;
23
23
  constructor(options: CNBOptions) {
24
- super({ token: options.token, cookie: options.cookie, cnb: options.cnb });
24
+ super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
25
25
  this.init(options);
26
26
  }
27
27
  init(cnbOptions?: CNBOptions) {
28
28
  const token = this.token;
29
29
  const cookie = this.cookie;
30
- const options = { token, cookie };
31
- this.workspace = new Workspace(options.token);
32
- this.knowledgeBase = new KnowledgeBase({ token: options.token, cookie: options.cookie });
33
- this.repo = new Repo({ token: options.token, cookie: options.cookie });
34
- this.user = new User({ token: options.token, cookie: options.cookie });
35
- this.build = new Build({ token: options.token, cookie: options.cookie });
36
- this.issue = new Issue({ token: options.token, cookie: options.cookie });
37
- this.mission = new Mission({ token: options.token, cookie: options.cookie });
38
- this.ai = new AiBase({ token: options.token, cookie: options.cookie });
30
+ const cors = cnbOptions?.cors || {}
31
+ const cnb = cnbOptions?.cnb
32
+ const options = { token, cookie, cors, cnb };
33
+ this.workspace = new Workspace(options);
34
+ this.knowledgeBase = new KnowledgeBase(options);
35
+ this.repo = new Repo(options);
36
+ this.user = new User(options);
37
+ this.build = new Build(options);
38
+ this.issue = new Issue(options);
39
+ this.mission = new Mission(options);
40
+ this.ai = new AiBase(options);
39
41
  }
40
42
  setToken(token: string) {
41
43
  this.token = token;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { Result } from "@kevisual/query/query";
9
- import { CNBCore } from "../cnb-core.ts";
9
+ import { CNBCore, CNBCoreOptions } from "../cnb-core.ts";
10
10
 
11
11
  /**
12
12
  * 工作空间列表查询参数
@@ -33,8 +33,8 @@ export interface ListParams {
33
33
  * https://api.cnb.cool/#/operations/GetWorkspaceDetail
34
34
  */
35
35
  export class Workspace extends CNBCore {
36
- constructor(token: string) {
37
- super({ token });
36
+ constructor(options: CNBCoreOptions) {
37
+ super(options);
38
38
  }
39
39
  /**
40
40
  * 删除我的云原生开发环境