@kevisual/cnb 0.0.56 → 0.0.57

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/routes.d.ts CHANGED
@@ -247,6 +247,76 @@ declare class KnowledgeBase extends CNBCore {
247
247
  }>>>;
248
248
  getBase(repo: string): Promise<Result<any>>;
249
249
  deleteBase(repo: string): Promise<Result<any>>;
250
+ /**
251
+ * 未暴露
252
+ * @param repo
253
+ * @param data
254
+ * @returns
255
+ */
256
+ createKnowledgeBase(repo: string, data: {
257
+ embedding_model_name: string;
258
+ include: string;
259
+ exclude: string;
260
+ issue_sync_enabled?: boolean;
261
+ processing?: {
262
+ chunk_size: number;
263
+ chunk_overlap: number;
264
+ text_separator: string;
265
+ };
266
+ issue?: {
267
+ labels: string;
268
+ state: string;
269
+ };
270
+ }): Promise<Result<any>>;
271
+ /**
272
+ * 未暴露
273
+ * @param repo
274
+ * @param data
275
+ * @returns
276
+ */
277
+ updateKnowledgeBase(repo: string, data: {
278
+ last_commit_sha?: string;
279
+ issue_last_sync_time?: string;
280
+ }): Promise<Result<any>>;
281
+ /**
282
+ * 未暴露
283
+ * @param repo
284
+ * @param text
285
+ * @returns
286
+ */
287
+ getEmbedding(repo: string, text: string): Promise<Result<{
288
+ embedding: number[];
289
+ }>>;
290
+ /**
291
+ * 未暴露
292
+ * @param repo
293
+ * @param chunksData
294
+ * @returns
295
+ */
296
+ addDocument(repo: string, chunksData: {
297
+ path: string;
298
+ chunks: Array<{
299
+ content: string;
300
+ hash: string;
301
+ offset: number;
302
+ size: number;
303
+ }>;
304
+ }): Promise<Result<any>>;
305
+ /**
306
+ * 未暴露
307
+ * @param repo
308
+ * @param paths
309
+ * @returns
310
+ */
311
+ deleteDocument(repo: string, paths: string[]): Promise<Result<any>>;
312
+ /**
313
+ * 未暴露
314
+ * @param repo
315
+ * @param page
316
+ * @param page_size
317
+ * @returns
318
+ */
319
+ listDocument(repo: string, page?: number, page_size?: number): Promise<Result<any[]>>;
250
320
  }
251
321
  type MetadataFilteringConditions = {
252
322
  conditions: Array<{
@@ -257,7 +327,7 @@ type MetadataFilteringConditions = {
257
327
  */
258
328
  value?: string;
259
329
  }>;
260
- logical_operator?: 'adn' | 'or';
330
+ logical_operator?: 'and' | 'or';
261
331
  };
262
332
  type QueryRag = {
263
333
  chunk: string;
@@ -563,8 +633,11 @@ type IssueItem = {
563
633
  number: string;
564
634
  priority: string;
565
635
  started_at: string;
566
- state: string;
567
- state_reason: string;
636
+ state: 'open' | 'closed';
637
+ /**
638
+ * state_reason must be one of completed, not_planned, reopened
639
+ */
640
+ state_reason: 'completed' | 'not_planned' | 'reopened';
568
641
  title: string;
569
642
  updated_at: string;
570
643
  };
@@ -1060,6 +1133,161 @@ type ListIssueLabelsParams = {
1060
1133
  page_size?: number;
1061
1134
  };
1062
1135
 
1136
+ /**
1137
+ * 制品类型
1138
+ */
1139
+ type PackageType = "all" | "docker" | "helm" | "docker-model" | "maven" | "npm" | "ohpm" | "pypi" | "nuget" | "composer" | "conan" | "cargo";
1140
+ /**
1141
+ * 制品库可见性类型
1142
+ */
1143
+ type VisibilityType = "private" | "public";
1144
+ /**
1145
+ * 制品库排序类型
1146
+ */
1147
+ type PackageOrderingType = "pull_count" | "last_push_at" | "name_ascend" | "name_descend";
1148
+ /**
1149
+ * 最后推送者信息
1150
+ */
1151
+ type LastPusher = {
1152
+ is_frozen: boolean;
1153
+ is_lock: boolean;
1154
+ name: string;
1155
+ username: string;
1156
+ };
1157
+ /**
1158
+ * 制品基本信息
1159
+ */
1160
+ type Package = {
1161
+ count: number;
1162
+ description: string;
1163
+ labels: string[];
1164
+ last_artifact_name: string;
1165
+ last_pusher: LastPusher;
1166
+ name: string;
1167
+ package: string;
1168
+ package_type: PackageType;
1169
+ pull_count: number;
1170
+ recent_pull_count: number;
1171
+ };
1172
+ /**
1173
+ * 制品库信息
1174
+ */
1175
+ type Registry = {
1176
+ created_at: string;
1177
+ description: string;
1178
+ name: string;
1179
+ owner: string;
1180
+ type: PackageType;
1181
+ visibility: VisibilityType;
1182
+ };
1183
+ /**
1184
+ * 制品库列表查询参数
1185
+ */
1186
+ type ListGroupRegistriesParams = {
1187
+ /** 页码 */
1188
+ page?: number;
1189
+ /** 每页数量 */
1190
+ page_size?: number;
1191
+ /** 制品仓库类型 */
1192
+ registry_type?: "npm" | "maven" | "ohpm";
1193
+ /** 制品仓库可见性类型 */
1194
+ filter_type?: VisibilityType;
1195
+ /** 排序字段 */
1196
+ order_by?: "created_at" | "name";
1197
+ };
1198
+ /**
1199
+ * 制品列表查询参数
1200
+ */
1201
+ type ListPackagesParams = {
1202
+ /** 顺序类型 */
1203
+ ordering?: PackageOrderingType;
1204
+ /** 关键字,搜索制品名称 */
1205
+ name?: string;
1206
+ };
1207
+ /**
1208
+ * 制品库管理
1209
+ */
1210
+ declare class RegistryPackage extends CNBCore {
1211
+ constructor(options: CNBCoreOptions);
1212
+ /**
1213
+ * 查询组织下面用户有权限查看到的制品仓库
1214
+ * @param slug 组织 slug
1215
+ * @param params 查询参数
1216
+ */
1217
+ listGroupRegistries(slug: string, params?: ListGroupRegistriesParams): Promise<Result<Registry[]>>;
1218
+ /**
1219
+ * 设置制品库可见性
1220
+ * @param registry 制品库路径
1221
+ * @param data 可见性设置
1222
+ */
1223
+ setVisibility(registry: string, data: {
1224
+ visibility: VisibilityType;
1225
+ }): Promise<Result<void>>;
1226
+ /**
1227
+ * 删除制品库
1228
+ * @param registry 制品库路径
1229
+ */
1230
+ remove(registry: string): Promise<Result<void>>;
1231
+ }
1232
+
1233
+ /**
1234
+ * 制品管理
1235
+ */
1236
+ declare class PackageManagement extends CNBCore {
1237
+ constructor(options: CNBCoreOptions);
1238
+ /**
1239
+ * 查询制品列表
1240
+ * @param slug 资源路径
1241
+ * @param type 制品类型
1242
+ * @param params 查询参数
1243
+ */
1244
+ list(slug: string, type: PackageType, params?: ListPackagesParams & {
1245
+ page?: number;
1246
+ page_size?: number;
1247
+ }): Promise<Result<Package[]>>;
1248
+ /**
1249
+ * 获取制品详情
1250
+ * @param slug 资源路径
1251
+ * @param type 制品类型
1252
+ * @param name 制品名称
1253
+ */
1254
+ getOne(slug: string, type: PackageType, name: string): Promise<Result<any>>;
1255
+ /**
1256
+ * 删除制品
1257
+ * @param slug 资源路径
1258
+ * @param type 制品类型
1259
+ * @param name 制品名称
1260
+ */
1261
+ remove(slug: string, type: PackageType, name: string): Promise<Result<void>>;
1262
+ /**
1263
+ * 获取制品标签详情
1264
+ * @param slug 资源路径
1265
+ * @param type 制品类型
1266
+ * @param name 制品名称
1267
+ * @param tag 标签名称
1268
+ */
1269
+ getTag(slug: string, type: PackageType, name: string, tag: string): Promise<Result<any>>;
1270
+ /**
1271
+ * 删除制品标签
1272
+ * @param slug 资源路径
1273
+ * @param type 制品类型
1274
+ * @param name 制品名称
1275
+ * @param tag 标签名称
1276
+ */
1277
+ removeTag(slug: string, type: PackageType, name: string, tag: string): Promise<Result<void>>;
1278
+ /**
1279
+ * 获取制品标签列表
1280
+ * @param slug 资源路径
1281
+ * @param type 制品类型
1282
+ * @param name 制品名称
1283
+ * @param params 查询参数
1284
+ */
1285
+ listTags(slug: string, type: PackageType, name: string, params?: {
1286
+ page?: number;
1287
+ page_size?: number;
1288
+ }): Promise<Result<any>>;
1289
+ }
1290
+
1063
1291
  type CNBOptions = CNBCoreOptions<{}>;
1064
1292
  declare class CNB extends CNBCore {
1065
1293
  workspace: Workspace;
@@ -1074,6 +1302,10 @@ declare class CNB extends CNBCore {
1074
1302
  repoLabel: RepoLabel;
1075
1303
  issueLabel: IssueLabel;
1076
1304
  };
1305
+ packages: {
1306
+ registry: RegistryPackage;
1307
+ package: PackageManagement;
1308
+ };
1077
1309
  constructor(options: CNBOptions);
1078
1310
  init(cnbOptions?: CNBOptions): void;
1079
1311
  setToken(token: string): void;