@babav/knowledge-core-client 0.22.3 → 0.22.4

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
@@ -454,7 +454,7 @@ export declare class KnowledgeCoreClient extends HttpBase {
454
454
  folders: {
455
455
  create: (corpusId: UUID, name: string) => Promise<Folder>;
456
456
  rename: (folderId: UUID, name: string) => Promise<Folder>;
457
- delete: (folderId: UUID) => Promise<void>;
457
+ delete: (folderId: UUID, confirmName?: string) => Promise<void>;
458
458
  listDocuments: (folderId: UUID, q?: {
459
459
  limit?: number;
460
460
  cursor?: string;
package/dist/index.js CHANGED
@@ -246,7 +246,10 @@ export class KnowledgeCoreClient extends HttpBase {
246
246
  folders = {
247
247
  create: (corpusId, name) => this.request("POST", `/v1/corpora/${corpusId}/folders`, { json: { name } }),
248
248
  rename: (folderId, name) => this.request("PATCH", `/v1/folders/${folderId}`, { json: { name } }),
249
- delete: (folderId) => this.request("DELETE", `/v1/folders/${folderId}`),
249
+ // Plain delete requires the folder to be EMPTY (else 409). Pass `confirmName` (the folder's
250
+ // name) to CASCADE — delete the folder AND every document in it (async, 202). The default
251
+ // folder cannot be deleted either way.
252
+ delete: (folderId, confirmName) => this.request("DELETE", `/v1/folders/${folderId}`, confirmName ? { query: { confirm: confirmName } } : undefined),
250
253
  listDocuments: (folderId, q) => this.request("GET", `/v1/folders/${folderId}/documents`, { query: q }),
251
254
  /** Count documents in the folder: { total, indexed, in_flight, failed }. */
252
255
  countDocuments: (folderId) => this.request("GET", `/v1/folders/${folderId}/documents/count`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.22.3",
3
+ "version": "0.22.4",
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
@@ -594,7 +594,11 @@ export class KnowledgeCoreClient extends HttpBase {
594
594
  folders = {
595
595
  create: (corpusId: UUID, name: string) => this.request<Folder>("POST", `/v1/corpora/${corpusId}/folders`, { json: { name } }),
596
596
  rename: (folderId: UUID, name: string) => this.request<Folder>("PATCH", `/v1/folders/${folderId}`, { json: { name } }),
597
- delete: (folderId: UUID) => this.request<void>("DELETE", `/v1/folders/${folderId}`),
597
+ // Plain delete requires the folder to be EMPTY (else 409). Pass `confirmName` (the folder's
598
+ // name) to CASCADE — delete the folder AND every document in it (async, 202). The default
599
+ // folder cannot be deleted either way.
600
+ delete: (folderId: UUID, confirmName?: string) =>
601
+ this.request<void>("DELETE", `/v1/folders/${folderId}`, confirmName ? { query: { confirm: confirmName } } : undefined),
598
602
  listDocuments: (folderId: UUID, q?: { limit?: number; cursor?: string }) =>
599
603
  this.request<Page<Document>>("GET", `/v1/folders/${folderId}/documents`, { query: q }),
600
604
  /** Count documents in the folder: { total, indexed, in_flight, failed }. */