@kevisual/cnb 0.0.14 → 0.0.16

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 = {};
@@ -22675,7 +22675,7 @@ class Workspace extends CNBCore {
22675
22675
  // src/knowledge/index.ts
22676
22676
  class KnowledgeBase extends CNBCore {
22677
22677
  constructor(options) {
22678
- super({ token: options.token, cookie: options.cookie });
22678
+ super(options);
22679
22679
  }
22680
22680
  queryKnowledgeBase(repo, data) {
22681
22681
  const url2 = `/${repo}/-/knowledge/base/query`;
@@ -22701,7 +22701,7 @@ class KnowledgeBase extends CNBCore {
22701
22701
  // src/repo/index.ts
22702
22702
  class Repo extends CNBCore {
22703
22703
  constructor(options) {
22704
- super({ token: options.token, cookie: options.cookie });
22704
+ super(options);
22705
22705
  }
22706
22706
  createRepo(data) {
22707
22707
  const name = data.name;
@@ -22788,7 +22788,7 @@ class Repo extends CNBCore {
22788
22788
  // src/user/index.ts
22789
22789
  class User extends CNBCore {
22790
22790
  constructor(options) {
22791
- super({ token: options.token, cookie: options.cookie });
22791
+ super(options);
22792
22792
  }
22793
22793
  getCurrentUser() {
22794
22794
  const url2 = `${this.hackURL}/user`;
@@ -22837,7 +22837,7 @@ class User extends CNBCore {
22837
22837
  // src/build/index.ts
22838
22838
  class Build extends CNBCore {
22839
22839
  constructor(options) {
22840
- super({ token: options.token, cookie: options.cookie });
22840
+ super(options);
22841
22841
  }
22842
22842
  startBuild(repo, data) {
22843
22843
  const url2 = `/${repo}/-/build/start`;
@@ -22852,7 +22852,7 @@ class Build extends CNBCore {
22852
22852
  // src/issue/index.ts
22853
22853
  class Issue extends CNBCore {
22854
22854
  constructor(options) {
22855
- super({ token: options.token, cookie: options.cookie });
22855
+ super(options);
22856
22856
  }
22857
22857
  createIssue(repo, data) {
22858
22858
  const url2 = `/${repo}/-/issues`;
@@ -22905,7 +22905,7 @@ class Issue extends CNBCore {
22905
22905
  // src/mission/index.ts
22906
22906
  class Mission extends CNBCore {
22907
22907
  constructor(options) {
22908
- super({ token: options.token, cookie: options.cookie });
22908
+ super(options);
22909
22909
  }
22910
22910
  getMissions(group, params) {
22911
22911
  const url2 = `/${group}/-/missions`;
@@ -22970,7 +22970,7 @@ class Mission extends CNBCore {
22970
22970
  class AiBase extends CNBCore {
22971
22971
  group;
22972
22972
  constructor(options) {
22973
- super({ token: options.token, cookie: options.cookie });
22973
+ super(options);
22974
22974
  }
22975
22975
  autoPr(repo, data) {
22976
22976
  const url2 = `/${repo}/-/build/ai/auto-pr`;
@@ -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 = {};
@@ -22675,7 +22675,7 @@ class Workspace extends CNBCore {
22675
22675
  // src/knowledge/index.ts
22676
22676
  class KnowledgeBase extends CNBCore {
22677
22677
  constructor(options) {
22678
- super({ token: options.token, cookie: options.cookie });
22678
+ super(options);
22679
22679
  }
22680
22680
  queryKnowledgeBase(repo, data) {
22681
22681
  const url2 = `/${repo}/-/knowledge/base/query`;
@@ -22701,7 +22701,7 @@ class KnowledgeBase extends CNBCore {
22701
22701
  // src/repo/index.ts
22702
22702
  class Repo extends CNBCore {
22703
22703
  constructor(options) {
22704
- super({ token: options.token, cookie: options.cookie });
22704
+ super(options);
22705
22705
  }
22706
22706
  createRepo(data) {
22707
22707
  const name = data.name;
@@ -22788,7 +22788,7 @@ class Repo extends CNBCore {
22788
22788
  // src/user/index.ts
22789
22789
  class User extends CNBCore {
22790
22790
  constructor(options) {
22791
- super({ token: options.token, cookie: options.cookie });
22791
+ super(options);
22792
22792
  }
22793
22793
  getCurrentUser() {
22794
22794
  const url2 = `${this.hackURL}/user`;
@@ -22837,7 +22837,7 @@ class User extends CNBCore {
22837
22837
  // src/build/index.ts
22838
22838
  class Build extends CNBCore {
22839
22839
  constructor(options) {
22840
- super({ token: options.token, cookie: options.cookie });
22840
+ super(options);
22841
22841
  }
22842
22842
  startBuild(repo, data) {
22843
22843
  const url2 = `/${repo}/-/build/start`;
@@ -22852,7 +22852,7 @@ class Build extends CNBCore {
22852
22852
  // src/issue/index.ts
22853
22853
  class Issue extends CNBCore {
22854
22854
  constructor(options) {
22855
- super({ token: options.token, cookie: options.cookie });
22855
+ super(options);
22856
22856
  }
22857
22857
  createIssue(repo, data) {
22858
22858
  const url2 = `/${repo}/-/issues`;
@@ -22905,7 +22905,7 @@ class Issue extends CNBCore {
22905
22905
  // src/mission/index.ts
22906
22906
  class Mission extends CNBCore {
22907
22907
  constructor(options) {
22908
- super({ token: options.token, cookie: options.cookie });
22908
+ super(options);
22909
22909
  }
22910
22910
  getMissions(group, params) {
22911
22911
  const url2 = `/${group}/-/missions`;
@@ -22970,7 +22970,7 @@ class Mission extends CNBCore {
22970
22970
  class AiBase extends CNBCore {
22971
22971
  group;
22972
22972
  constructor(options) {
22973
- super({ token: options.token, cookie: options.cookie });
22973
+ super(options);
22974
22974
  }
22975
22975
  autoPr(repo, data) {
22976
22976
  const url2 = `/${repo}/-/build/ai/auto-pr`;
@@ -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.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/ai/index.ts CHANGED
@@ -3,7 +3,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
3
3
  class AiBase extends CNBCore {
4
4
  group: string;
5
5
  constructor(options: CNBCoreOptions) {
6
- super({ token: options.token, cookie: options.cookie });
6
+ super(options);
7
7
  }
8
8
  autoPr(repo: string, data: { body: string, branch?: string, title: string }): Promise<Result<any>> {
9
9
  const url = `/${repo}/-/build/ai/auto-pr`;
@@ -3,7 +3,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
3
3
 
4
4
  export class Build extends CNBCore {
5
5
  constructor(options: CNBCoreOptions ) {
6
- super({ token: options.token, cookie: options.cookie });
6
+ super(options);
7
7
  }
8
8
  startBuild(repo: string, data: StartBuildData): Promise<any> {
9
9
  const url = `/${repo}/-/build/start`;
package/src/git/index.ts CHANGED
@@ -166,7 +166,7 @@ export type HeadRef = {
166
166
  */
167
167
  export class Git extends CNBCore {
168
168
  constructor(options: CNBCoreOptions) {
169
- super({ token: options.token, cookie: options.cookie });
169
+ super(options);
170
170
  }
171
171
 
172
172
  /**
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;
@@ -38,7 +38,7 @@ export type IssueItem = {
38
38
  };
39
39
  export class Issue extends CNBCore {
40
40
  constructor(options: CNBCoreOptions) {
41
- super({ token: options.token, cookie: options.cookie });
41
+ super(options);
42
42
  }
43
43
 
44
44
  createIssue(repo: string, data: Partial<IssueItem>): Promise<any> {
@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions, Result } from "../cnb-core.ts";
2
2
 
3
3
  export class KnowledgeBase extends CNBCore {
4
4
  constructor(options: CNBCoreOptions) {
5
- super({ token: options.token, cookie: options.cookie });
5
+ super(options);
6
6
  }
7
7
 
8
8
  queryKnowledgeBase(repo: string, data: {
@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
2
2
 
3
3
  export class Mission extends CNBCore {
4
4
  constructor(options: CNBCoreOptions) {
5
- super({ token: options.token, cookie: options.cookie });
5
+ super(options);
6
6
  }
7
7
 
8
8
  /**
package/src/repo/index.ts CHANGED
@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
2
2
 
3
3
  export class Repo extends CNBCore {
4
4
  constructor(options: CNBCoreOptions) {
5
- super({ token: options.token, cookie: options.cookie });
5
+ super(options);
6
6
  }
7
7
  /**
8
8
  * 创建代码仓库
package/src/user/index.ts CHANGED
@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions } from "../cnb-core.ts";
2
2
  import { Result } from "@kevisual/query";
3
3
  export class User extends CNBCore {
4
4
  constructor(options: CNBCoreOptions<{}>) {
5
- super({ token: options.token, cookie: options.cookie });
5
+ super(options);
6
6
  }
7
7
 
8
8
  /**
@@ -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
  * 删除我的云原生开发环境