@kevisual/cnb 0.0.15 → 0.0.17

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
@@ -22509,9 +22509,12 @@ class InitEnv2 {
22509
22509
  InitEnv2.init();
22510
22510
 
22511
22511
  // src/cnb-core.ts
22512
+ var API_BASER_URL = "https://api.cnb.cool";
22513
+ var API_HACK_URL = "https://cnb.cool";
22514
+
22512
22515
  class CNBCore {
22513
- baseURL = "https://api.cnb.cool";
22514
- hackURL = "https://cnb.cool";
22516
+ baseURL = API_BASER_URL;
22517
+ hackURL = API_HACK_URL;
22515
22518
  token;
22516
22519
  cookie;
22517
22520
  constructor(options) {
@@ -22526,8 +22529,8 @@ class CNBCore {
22526
22529
  }
22527
22530
  }
22528
22531
  if (options?.cors?.baseUrl) {
22529
- this.baseURL = options.cors.baseUrl + "/" + this.baseURL;
22530
- this.hackURL = options.cors.baseUrl + "/" + this.hackURL;
22532
+ this.baseURL = options.cors.baseUrl + "/" + API_BASER_URL.replace("https://", "");
22533
+ this.hackURL = options.cors.baseUrl + "/" + API_HACK_URL.replace("https://", "");
22531
22534
  }
22532
22535
  }
22533
22536
  async request({ url: url2, method = "GET", data, params, headers, body, useCookie, useOrigin }) {
@@ -22675,7 +22678,7 @@ class Workspace extends CNBCore {
22675
22678
  // src/knowledge/index.ts
22676
22679
  class KnowledgeBase extends CNBCore {
22677
22680
  constructor(options) {
22678
- super({ token: options.token, cookie: options.cookie });
22681
+ super(options);
22679
22682
  }
22680
22683
  queryKnowledgeBase(repo, data) {
22681
22684
  const url2 = `/${repo}/-/knowledge/base/query`;
@@ -22701,7 +22704,7 @@ class KnowledgeBase extends CNBCore {
22701
22704
  // src/repo/index.ts
22702
22705
  class Repo extends CNBCore {
22703
22706
  constructor(options) {
22704
- super({ token: options.token, cookie: options.cookie });
22707
+ super(options);
22705
22708
  }
22706
22709
  createRepo(data) {
22707
22710
  const name = data.name;
@@ -22788,7 +22791,7 @@ class Repo extends CNBCore {
22788
22791
  // src/user/index.ts
22789
22792
  class User extends CNBCore {
22790
22793
  constructor(options) {
22791
- super({ token: options.token, cookie: options.cookie });
22794
+ super(options);
22792
22795
  }
22793
22796
  getCurrentUser() {
22794
22797
  const url2 = `${this.hackURL}/user`;
@@ -22837,7 +22840,7 @@ class User extends CNBCore {
22837
22840
  // src/build/index.ts
22838
22841
  class Build extends CNBCore {
22839
22842
  constructor(options) {
22840
- super({ token: options.token, cookie: options.cookie });
22843
+ super(options);
22841
22844
  }
22842
22845
  startBuild(repo, data) {
22843
22846
  const url2 = `/${repo}/-/build/start`;
@@ -22852,7 +22855,7 @@ class Build extends CNBCore {
22852
22855
  // src/issue/index.ts
22853
22856
  class Issue extends CNBCore {
22854
22857
  constructor(options) {
22855
- super({ token: options.token, cookie: options.cookie });
22858
+ super(options);
22856
22859
  }
22857
22860
  createIssue(repo, data) {
22858
22861
  const url2 = `/${repo}/-/issues`;
@@ -22905,7 +22908,7 @@ class Issue extends CNBCore {
22905
22908
  // src/mission/index.ts
22906
22909
  class Mission extends CNBCore {
22907
22910
  constructor(options) {
22908
- super({ token: options.token, cookie: options.cookie });
22911
+ super(options);
22909
22912
  }
22910
22913
  getMissions(group, params) {
22911
22914
  const url2 = `/${group}/-/missions`;
@@ -22970,7 +22973,7 @@ class Mission extends CNBCore {
22970
22973
  class AiBase extends CNBCore {
22971
22974
  group;
22972
22975
  constructor(options) {
22973
- super({ token: options.token, cookie: options.cookie });
22976
+ super(options);
22974
22977
  }
22975
22978
  autoPr(repo, data) {
22976
22979
  const url2 = `/${repo}/-/build/ai/auto-pr`;
package/dist/routes.js CHANGED
@@ -22509,9 +22509,12 @@ class InitEnv2 {
22509
22509
  InitEnv2.init();
22510
22510
 
22511
22511
  // src/cnb-core.ts
22512
+ var API_BASER_URL = "https://api.cnb.cool";
22513
+ var API_HACK_URL = "https://cnb.cool";
22514
+
22512
22515
  class CNBCore {
22513
- baseURL = "https://api.cnb.cool";
22514
- hackURL = "https://cnb.cool";
22516
+ baseURL = API_BASER_URL;
22517
+ hackURL = API_HACK_URL;
22515
22518
  token;
22516
22519
  cookie;
22517
22520
  constructor(options) {
@@ -22526,8 +22529,8 @@ class CNBCore {
22526
22529
  }
22527
22530
  }
22528
22531
  if (options?.cors?.baseUrl) {
22529
- this.baseURL = options.cors.baseUrl + "/" + this.baseURL;
22530
- this.hackURL = options.cors.baseUrl + "/" + this.hackURL;
22532
+ this.baseURL = options.cors.baseUrl + "/" + API_BASER_URL.replace("https://", "");
22533
+ this.hackURL = options.cors.baseUrl + "/" + API_HACK_URL.replace("https://", "");
22531
22534
  }
22532
22535
  }
22533
22536
  async request({ url: url2, method = "GET", data, params, headers, body, useCookie, useOrigin }) {
@@ -22675,7 +22678,7 @@ class Workspace extends CNBCore {
22675
22678
  // src/knowledge/index.ts
22676
22679
  class KnowledgeBase extends CNBCore {
22677
22680
  constructor(options) {
22678
- super({ token: options.token, cookie: options.cookie });
22681
+ super(options);
22679
22682
  }
22680
22683
  queryKnowledgeBase(repo, data) {
22681
22684
  const url2 = `/${repo}/-/knowledge/base/query`;
@@ -22701,7 +22704,7 @@ class KnowledgeBase extends CNBCore {
22701
22704
  // src/repo/index.ts
22702
22705
  class Repo extends CNBCore {
22703
22706
  constructor(options) {
22704
- super({ token: options.token, cookie: options.cookie });
22707
+ super(options);
22705
22708
  }
22706
22709
  createRepo(data) {
22707
22710
  const name = data.name;
@@ -22788,7 +22791,7 @@ class Repo extends CNBCore {
22788
22791
  // src/user/index.ts
22789
22792
  class User extends CNBCore {
22790
22793
  constructor(options) {
22791
- super({ token: options.token, cookie: options.cookie });
22794
+ super(options);
22792
22795
  }
22793
22796
  getCurrentUser() {
22794
22797
  const url2 = `${this.hackURL}/user`;
@@ -22837,7 +22840,7 @@ class User extends CNBCore {
22837
22840
  // src/build/index.ts
22838
22841
  class Build extends CNBCore {
22839
22842
  constructor(options) {
22840
- super({ token: options.token, cookie: options.cookie });
22843
+ super(options);
22841
22844
  }
22842
22845
  startBuild(repo, data) {
22843
22846
  const url2 = `/${repo}/-/build/start`;
@@ -22852,7 +22855,7 @@ class Build extends CNBCore {
22852
22855
  // src/issue/index.ts
22853
22856
  class Issue extends CNBCore {
22854
22857
  constructor(options) {
22855
- super({ token: options.token, cookie: options.cookie });
22858
+ super(options);
22856
22859
  }
22857
22860
  createIssue(repo, data) {
22858
22861
  const url2 = `/${repo}/-/issues`;
@@ -22905,7 +22908,7 @@ class Issue extends CNBCore {
22905
22908
  // src/mission/index.ts
22906
22909
  class Mission extends CNBCore {
22907
22910
  constructor(options) {
22908
- super({ token: options.token, cookie: options.cookie });
22911
+ super(options);
22909
22912
  }
22910
22913
  getMissions(group, params) {
22911
22914
  const url2 = `/${group}/-/missions`;
@@ -22970,7 +22973,7 @@ class Mission extends CNBCore {
22970
22973
  class AiBase extends CNBCore {
22971
22974
  group;
22972
22975
  constructor(options) {
22973
- super({ token: options.token, cookie: options.cookie });
22976
+ super(options);
22974
22977
  }
22975
22978
  autoPr(repo, data) {
22976
22979
  const url2 = `/${repo}/-/build/ai/auto-pr`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cnb",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
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/cnb-core.ts CHANGED
@@ -20,9 +20,11 @@ export type RequestOptions = {
20
20
  useCookie?: boolean;
21
21
  useOrigin?: boolean;
22
22
  };
23
+ const API_BASER_URL = 'https://api.cnb.cool'
24
+ const API_HACK_URL = 'https://cnb.cool'
23
25
  export class CNBCore {
24
- baseURL = 'https://api.cnb.cool';
25
- hackURL = 'https://cnb.cool'
26
+ baseURL = API_BASER_URL;
27
+ hackURL = API_HACK_URL;
26
28
  public token: string;
27
29
  public cookie?: string;
28
30
  constructor(options: CNBCoreOptions) {
@@ -37,8 +39,8 @@ export class CNBCore {
37
39
  }
38
40
  }
39
41
  if (options?.cors?.baseUrl) {
40
- this.baseURL = options.cors.baseUrl + '/' + this.baseURL;
41
- this.hackURL = options.cors.baseUrl + '/' + this.hackURL;
42
+ this.baseURL = options.cors.baseUrl + '/' + API_BASER_URL.replace('https://', '');
43
+ this.hackURL = options.cors.baseUrl + '/' + API_HACK_URL.replace('https://', '');
42
44
  }
43
45
  }
44
46
 
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
  /**
@@ -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
  /**