@kevisual/cnb 0.0.18 → 0.0.20
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 +14 -3
- package/dist/routes.d.ts +8 -0
- package/dist/routes.js +14 -3
- package/package.json +7 -6
- package/src/cnb-core.ts +8 -2
- package/src/repo/index.ts +11 -1
package/dist/opencode.js
CHANGED
|
@@ -21444,7 +21444,7 @@ class InitEnv {
|
|
|
21444
21444
|
}
|
|
21445
21445
|
InitEnv.init();
|
|
21446
21446
|
|
|
21447
|
-
// node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.2.
|
|
21447
|
+
// node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.2.4/node_modules/@kevisual/use-config/dist/app.js
|
|
21448
21448
|
import { createRequire as createRequire2 } from "node:module";
|
|
21449
21449
|
import fs from "node:fs";
|
|
21450
21450
|
import path from "node:path";
|
|
@@ -22517,6 +22517,7 @@ class CNBCore {
|
|
|
22517
22517
|
hackURL = API_HACK_URL;
|
|
22518
22518
|
token;
|
|
22519
22519
|
cookie;
|
|
22520
|
+
isCors;
|
|
22520
22521
|
constructor(options) {
|
|
22521
22522
|
this.token = options.token;
|
|
22522
22523
|
this.cookie = options.cookie;
|
|
@@ -22532,6 +22533,7 @@ class CNBCore {
|
|
|
22532
22533
|
this.baseURL = options.cors.baseUrl + "/" + API_BASER_URL.replace("https://", "");
|
|
22533
22534
|
this.hackURL = options.cors.baseUrl + "/" + API_HACK_URL.replace("https://", "");
|
|
22534
22535
|
}
|
|
22536
|
+
this.isCors = !!options?.cors?.baseUrl;
|
|
22535
22537
|
}
|
|
22536
22538
|
async request({ url: url2, method = "GET", data, params, headers, body, useCookie, useOrigin }) {
|
|
22537
22539
|
const defaultHeaders = {
|
|
@@ -22558,9 +22560,14 @@ class CNBCore {
|
|
|
22558
22560
|
delete _headers.Authorization;
|
|
22559
22561
|
}
|
|
22560
22562
|
if (useCookie) {
|
|
22561
|
-
|
|
22563
|
+
if (this.isCors) {
|
|
22564
|
+
_headers["app-cookie"] = this.cookie || "";
|
|
22565
|
+
} else {
|
|
22566
|
+
_headers["Cookie"] = this.cookie || "";
|
|
22567
|
+
}
|
|
22562
22568
|
delete _headers.Authorization;
|
|
22563
22569
|
}
|
|
22570
|
+
console.log("Request URL:", url2, data, _headers);
|
|
22564
22571
|
const response = await fetch(url2 || "", {
|
|
22565
22572
|
method,
|
|
22566
22573
|
headers: _headers,
|
|
@@ -22790,6 +22797,10 @@ class Repo extends CNBCore {
|
|
|
22790
22797
|
}
|
|
22791
22798
|
return this.get({ url: url2, params: _params });
|
|
22792
22799
|
}
|
|
22800
|
+
updateRepoInfo(repo, params) {
|
|
22801
|
+
const url2 = `/${repo}`;
|
|
22802
|
+
return this.patch({ url: url2, data: params });
|
|
22803
|
+
}
|
|
22793
22804
|
}
|
|
22794
22805
|
|
|
22795
22806
|
// src/user/index.ts
|
|
@@ -36584,7 +36595,7 @@ config3(en_default());
|
|
|
36584
36595
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
36585
36596
|
var zod_default = exports_external;
|
|
36586
36597
|
|
|
36587
|
-
// node_modules/.pnpm/@opencode-ai+plugin@1.1.
|
|
36598
|
+
// node_modules/.pnpm/@opencode-ai+plugin@1.1.53/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
36588
36599
|
function tool2(input) {
|
|
36589
36600
|
return input;
|
|
36590
36601
|
}
|
package/dist/routes.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ declare class CNBCore {
|
|
|
28
28
|
hackURL: string;
|
|
29
29
|
token: string;
|
|
30
30
|
cookie?: string;
|
|
31
|
+
isCors: boolean;
|
|
31
32
|
constructor(options: CNBCoreOptions);
|
|
32
33
|
request({ url, method, data, params, headers, body, useCookie, useOrigin }: RequestOptions): Promise<any>;
|
|
33
34
|
makeUrl(url?: string): string;
|
|
@@ -296,7 +297,14 @@ declare class Repo extends CNBCore {
|
|
|
296
297
|
search?: string;
|
|
297
298
|
status?: 'active' | 'archived';
|
|
298
299
|
}): Promise<Result<RepoItem[]>>;
|
|
300
|
+
updateRepoInfo(repo: string, params: UpdateRepoInfo): Promise<any>;
|
|
299
301
|
}
|
|
302
|
+
type UpdateRepoInfo = {
|
|
303
|
+
description?: string;
|
|
304
|
+
license?: 'MIT' | 'Apache-2.0' | 'GPL-3.0' | 'Unlicense';
|
|
305
|
+
site?: string;
|
|
306
|
+
topics?: string[];
|
|
307
|
+
};
|
|
300
308
|
type CreateRepoData = {
|
|
301
309
|
description: string;
|
|
302
310
|
license?: 'MIT' | 'Apache-2.0' | 'GPL-3.0' | 'Unlicense';
|
package/dist/routes.js
CHANGED
|
@@ -21444,7 +21444,7 @@ class InitEnv {
|
|
|
21444
21444
|
}
|
|
21445
21445
|
InitEnv.init();
|
|
21446
21446
|
|
|
21447
|
-
// node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.2.
|
|
21447
|
+
// node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.2.4/node_modules/@kevisual/use-config/dist/app.js
|
|
21448
21448
|
import { createRequire as createRequire2 } from "node:module";
|
|
21449
21449
|
import fs from "node:fs";
|
|
21450
21450
|
import path from "node:path";
|
|
@@ -22517,6 +22517,7 @@ class CNBCore {
|
|
|
22517
22517
|
hackURL = API_HACK_URL;
|
|
22518
22518
|
token;
|
|
22519
22519
|
cookie;
|
|
22520
|
+
isCors;
|
|
22520
22521
|
constructor(options) {
|
|
22521
22522
|
this.token = options.token;
|
|
22522
22523
|
this.cookie = options.cookie;
|
|
@@ -22532,6 +22533,7 @@ class CNBCore {
|
|
|
22532
22533
|
this.baseURL = options.cors.baseUrl + "/" + API_BASER_URL.replace("https://", "");
|
|
22533
22534
|
this.hackURL = options.cors.baseUrl + "/" + API_HACK_URL.replace("https://", "");
|
|
22534
22535
|
}
|
|
22536
|
+
this.isCors = !!options?.cors?.baseUrl;
|
|
22535
22537
|
}
|
|
22536
22538
|
async request({ url: url2, method = "GET", data, params, headers, body, useCookie, useOrigin }) {
|
|
22537
22539
|
const defaultHeaders = {
|
|
@@ -22558,9 +22560,14 @@ class CNBCore {
|
|
|
22558
22560
|
delete _headers.Authorization;
|
|
22559
22561
|
}
|
|
22560
22562
|
if (useCookie) {
|
|
22561
|
-
|
|
22563
|
+
if (this.isCors) {
|
|
22564
|
+
_headers["app-cookie"] = this.cookie || "";
|
|
22565
|
+
} else {
|
|
22566
|
+
_headers["Cookie"] = this.cookie || "";
|
|
22567
|
+
}
|
|
22562
22568
|
delete _headers.Authorization;
|
|
22563
22569
|
}
|
|
22570
|
+
console.log("Request URL:", url2, data, _headers);
|
|
22564
22571
|
const response = await fetch(url2 || "", {
|
|
22565
22572
|
method,
|
|
22566
22573
|
headers: _headers,
|
|
@@ -22790,6 +22797,10 @@ class Repo extends CNBCore {
|
|
|
22790
22797
|
}
|
|
22791
22798
|
return this.get({ url: url2, params: _params });
|
|
22792
22799
|
}
|
|
22800
|
+
updateRepoInfo(repo, params) {
|
|
22801
|
+
const url2 = `/${repo}`;
|
|
22802
|
+
return this.patch({ url: url2, data: params });
|
|
22803
|
+
}
|
|
22793
22804
|
}
|
|
22794
22805
|
|
|
22795
22806
|
// src/user/index.ts
|
|
@@ -36584,7 +36595,7 @@ config3(en_default());
|
|
|
36584
36595
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
36585
36596
|
var zod_default = exports_external;
|
|
36586
36597
|
|
|
36587
|
-
// node_modules/.pnpm/@opencode-ai+plugin@1.1.
|
|
36598
|
+
// node_modules/.pnpm/@opencode-ai+plugin@1.1.53/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
36588
36599
|
function tool2(input) {
|
|
36589
36600
|
return input;
|
|
36590
36601
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cnb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,19 +16,20 @@
|
|
|
16
16
|
],
|
|
17
17
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"packageManager": "pnpm@10.
|
|
19
|
+
"packageManager": "pnpm@10.29.1",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@kevisual/ai": "^0.0.24",
|
|
23
23
|
"@kevisual/code-builder": "^0.0.6",
|
|
24
|
+
"@kevisual/dts": "^0.0.3",
|
|
24
25
|
"@kevisual/context": "^0.0.4",
|
|
25
26
|
"@kevisual/types": "^0.0.12",
|
|
26
|
-
"@opencode-ai/plugin": "^1.1.
|
|
27
|
+
"@opencode-ai/plugin": "^1.1.53",
|
|
27
28
|
"@types/bun": "^1.3.8",
|
|
28
|
-
"@types/node": "^25.2.
|
|
29
|
+
"@types/node": "^25.2.2",
|
|
29
30
|
"@types/ws": "^8.18.1",
|
|
30
31
|
"dayjs": "^1.11.19",
|
|
31
|
-
"dotenv": "^17.2.
|
|
32
|
+
"dotenv": "^17.2.4"
|
|
32
33
|
},
|
|
33
34
|
"publishConfig": {
|
|
34
35
|
"access": "public"
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"zod": "^4.3.6"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@kevisual/query": "^0.0.
|
|
41
|
+
"@kevisual/query": "^0.0.40",
|
|
41
42
|
"@kevisual/router": "^0.0.70",
|
|
42
43
|
"@kevisual/use-config": "^1.0.30",
|
|
43
44
|
"es-toolkit": "^1.44.0",
|
package/src/cnb-core.ts
CHANGED
|
@@ -27,6 +27,7 @@ export class CNBCore {
|
|
|
27
27
|
hackURL = API_HACK_URL;
|
|
28
28
|
public token: string;
|
|
29
29
|
public cookie?: string;
|
|
30
|
+
isCors: boolean;
|
|
30
31
|
constructor(options: CNBCoreOptions) {
|
|
31
32
|
this.token = options.token;
|
|
32
33
|
this.cookie = options.cookie;
|
|
@@ -42,6 +43,7 @@ export class CNBCore {
|
|
|
42
43
|
this.baseURL = options.cors.baseUrl + '/' + API_BASER_URL.replace('https://', '');
|
|
43
44
|
this.hackURL = options.cors.baseUrl + '/' + API_HACK_URL.replace('https://', '');
|
|
44
45
|
}
|
|
46
|
+
this.isCors = !!options?.cors?.baseUrl;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
async request({ url, method = 'GET', data, params, headers, body, useCookie, useOrigin }: RequestOptions): Promise<any> {
|
|
@@ -70,10 +72,14 @@ export class CNBCore {
|
|
|
70
72
|
delete _headers.Authorization;
|
|
71
73
|
}
|
|
72
74
|
if (useCookie) {
|
|
73
|
-
|
|
75
|
+
if (this.isCors) {
|
|
76
|
+
_headers['app-cookie'] = this.cookie || "";
|
|
77
|
+
} else {
|
|
78
|
+
_headers['Cookie'] = this.cookie || "";
|
|
79
|
+
}
|
|
74
80
|
delete _headers.Authorization;
|
|
75
81
|
}
|
|
76
|
-
|
|
82
|
+
console.log('Request URL:', url, data, _headers);
|
|
77
83
|
const response = await fetch(url || '', {
|
|
78
84
|
method,
|
|
79
85
|
headers: _headers,
|
package/src/repo/index.ts
CHANGED
|
@@ -95,11 +95,21 @@ export class Repo extends CNBCore {
|
|
|
95
95
|
page: params.page || 1,
|
|
96
96
|
page_size: params.page_size || 999,
|
|
97
97
|
}
|
|
98
|
-
if(!_params.search) {
|
|
98
|
+
if (!_params.search) {
|
|
99
99
|
delete _params.search;
|
|
100
100
|
}
|
|
101
101
|
return this.get({ url, params: _params });
|
|
102
102
|
}
|
|
103
|
+
updateRepoInfo(repo: string, params: UpdateRepoInfo): Promise<any> {
|
|
104
|
+
const url = `/${repo}`;
|
|
105
|
+
return this.patch({ url, data: params });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
type UpdateRepoInfo = {
|
|
109
|
+
description?: string;
|
|
110
|
+
license?: 'MIT' | 'Apache-2.0' | 'GPL-3.0' | 'Unlicense';
|
|
111
|
+
site?: string;
|
|
112
|
+
topics?: string[];
|
|
103
113
|
}
|
|
104
114
|
|
|
105
115
|
type CreateRepoData = {
|