@babav/knowledge-core-client 0.28.0 → 0.29.0

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/index.d.ts CHANGED
@@ -181,6 +181,7 @@ export interface Corpus {
181
181
  id: UUID;
182
182
  name: string;
183
183
  description: string | null;
184
+ custom_metadata: Record<string, unknown>;
184
185
  }
185
186
  export interface Folder {
186
187
  id: UUID;
@@ -549,16 +550,25 @@ export declare class KnowledgeCoreClient extends HttpBase {
549
550
  create: (b: {
550
551
  name: string;
551
552
  description?: string;
553
+ custom_metadata?: Record<string, unknown>;
552
554
  }) => Promise<Corpus>;
553
555
  list: (q?: {
554
556
  limit?: number;
555
557
  cursor?: string;
556
558
  }) => Promise<Page<Corpus>>;
557
559
  listAll: () => Promise<Corpus[]>;
560
+ /** Filter corpora by custom_metadata using the same metadata filter as documents. */
561
+ search: (b: {
562
+ filter?: MetadataFilter;
563
+ limit?: number;
564
+ cursor?: string;
565
+ }) => Promise<Page<Corpus>>;
558
566
  get: (id: UUID) => Promise<Corpus>;
567
+ /** `custom_metadata` merges (provided keys upsert, a null value deletes a key). */
559
568
  update: (id: UUID, b: {
560
569
  name?: string;
561
570
  description?: string;
571
+ custom_metadata?: Record<string, unknown>;
562
572
  }) => Promise<Corpus>;
563
573
  delete: (id: UUID, confirmName: string) => Promise<void>;
564
574
  listFolders: (id: UUID) => Promise<Folder[]>;
package/dist/index.js CHANGED
@@ -219,7 +219,10 @@ export class KnowledgeCoreClient extends HttpBase {
219
219
  create: (b) => this.request("POST", "/v1/corpora", { json: b }),
220
220
  list: (q) => this.request("GET", "/v1/corpora", { query: q }),
221
221
  listAll: () => this.pageAll("/v1/corpora"),
222
+ /** Filter corpora by custom_metadata using the same metadata filter as documents. */
223
+ search: (b) => this.request("POST", "/v1/corpora/search", { json: b }),
222
224
  get: (id) => this.request("GET", `/v1/corpora/${id}`),
225
+ /** `custom_metadata` merges (provided keys upsert, a null value deletes a key). */
223
226
  update: (id, b) => this.request("PATCH", `/v1/corpora/${id}`, { json: b }),
224
227
  delete: (id, confirmName) => this.request("DELETE", `/v1/corpora/${id}`, { query: { confirm: confirmName } }),
225
228
  listFolders: (id) => this.pageAll(`/v1/corpora/${id}/folders`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "TypeScript client for the Babav Knowledge Core API (Deno + Node 18+, zero deps). Includes the babav.visual grammar TYPES at the ./visual subpath (types only; all visual rendering is server-side).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -211,6 +211,7 @@ export interface Corpus {
211
211
  id: UUID;
212
212
  name: string;
213
213
  description: string | null;
214
+ custom_metadata: Record<string, unknown>;
214
215
  }
215
216
  export interface Folder {
216
217
  id: UUID;
@@ -679,12 +680,16 @@ export class KnowledgeCoreClient extends HttpBase {
679
680
 
680
681
  // --- corpora ---
681
682
  corpora = {
682
- create: (b: { name: string; description?: string }) =>
683
+ create: (b: { name: string; description?: string; custom_metadata?: Record<string, unknown> }) =>
683
684
  this.request<Corpus>("POST", "/v1/corpora", { json: b }),
684
685
  list: (q?: { limit?: number; cursor?: string }) => this.request<Page<Corpus>>("GET", "/v1/corpora", { query: q }),
685
686
  listAll: () => this.pageAll<Corpus>("/v1/corpora"),
687
+ /** Filter corpora by custom_metadata using the same metadata filter as documents. */
688
+ search: (b: { filter?: MetadataFilter; limit?: number; cursor?: string }) =>
689
+ this.request<Page<Corpus>>("POST", "/v1/corpora/search", { json: b }),
686
690
  get: (id: UUID) => this.request<Corpus>("GET", `/v1/corpora/${id}`),
687
- update: (id: UUID, b: { name?: string; description?: string }) =>
691
+ /** `custom_metadata` merges (provided keys upsert, a null value deletes a key). */
692
+ update: (id: UUID, b: { name?: string; description?: string; custom_metadata?: Record<string, unknown> }) =>
688
693
  this.request<Corpus>("PATCH", `/v1/corpora/${id}`, { json: b }),
689
694
  delete: (id: UUID, confirmName: string) => this.request<void>("DELETE", `/v1/corpora/${id}`, { query: { confirm: confirmName } }),
690
695
  listFolders: (id: UUID) => this.pageAll<Folder>(`/v1/corpora/${id}/folders`),