This commit is contained in:
2026-01-05 10:50:37 +08:00
parent 2707286d7d
commit 2724f09a5b
6 changed files with 121 additions and 150 deletions

View File

@@ -3,23 +3,29 @@ import { Workspace } from "./workspace.ts";
import { KnowledgeBase } from "./knowledge/index.ts";
import { Repo } from "./repo/index.ts";
import { User } from "./user/index.ts";
import { Build } from "./build/index.ts";
type CNBOptions = CNBCoreOptions<{}>;
type CNBOptions = CNBCoreOptions<{
group?: string;
}>;
export class CNB extends CNBCore {
workspace!: Workspace;
knowledgeBase!: KnowledgeBase;
repo!: Repo;
user!: User;
build!: Build;
constructor(options: CNBOptions) {
super({ token: options.token, cookie: options.cookie });
this.init(options);
}
init(options: CNBOptions) {
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 });
const group = options.group || '';
this.knowledgeBase = new KnowledgeBase({ group: group, token: options.token, cookie: options.cookie });
this.repo = new Repo({ group: group, token: options.token, cookie: options.cookie });
this.user = new User({ token: options.token, cookie: options.cookie });
this.build = new Build({ group: group, token: options.token, cookie: options.cookie });
}
}
@@ -27,3 +33,5 @@ export * from './workspace.ts'
export * from './cnb-core.ts'
export * from './knowledge/index.ts'
export * from './repo/index.ts'
export * from './user/index.ts'
export * from './build/index.ts'