@babav/knowledge-core-client 0.37.0 → 0.38.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 +33 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
- package/src/index.ts +21 -0
package/dist/index.d.ts
CHANGED
|
@@ -325,6 +325,36 @@ export interface SectionsResponse {
|
|
|
325
325
|
document_id: UUID;
|
|
326
326
|
sections: SectionAnalytics[];
|
|
327
327
|
}
|
|
328
|
+
/** One chunk's retrieval heat + where it sits in the document's view-PDF. `regions` are
|
|
329
|
+
* view-PDF points (origin bottom-left), possibly spanning pages; `method`/`regions` null (or
|
|
330
|
+
* method "unaligned") => no box to draw (heat still shown). retrieved=0 => never-retrieved. */
|
|
331
|
+
export interface ChunkHeat {
|
|
332
|
+
chunk_id: string;
|
|
333
|
+
seq: number;
|
|
334
|
+
parent_id: UUID | null;
|
|
335
|
+
retrieved: number;
|
|
336
|
+
reranked: number;
|
|
337
|
+
citation_count: number;
|
|
338
|
+
best_rerank_rank: number | null;
|
|
339
|
+
best_rerank_score: number | null;
|
|
340
|
+
method: string | null;
|
|
341
|
+
regions: {
|
|
342
|
+
page: number;
|
|
343
|
+
bbox: [number, number, number, number];
|
|
344
|
+
}[] | null;
|
|
345
|
+
}
|
|
346
|
+
/** Everything to overlay retrieval heat on the original document: a signed view-PDF URL
|
|
347
|
+
* (render with pdf.js), its per-page geometry, and every chunk's heat + boxes. */
|
|
348
|
+
export interface ChunkHeatmapResponse {
|
|
349
|
+
document_id: UUID;
|
|
350
|
+
view_pdf_url: string | null;
|
|
351
|
+
page_dims: {
|
|
352
|
+
w: number;
|
|
353
|
+
h: number;
|
|
354
|
+
rotation: number;
|
|
355
|
+
}[] | null;
|
|
356
|
+
chunks: ChunkHeat[];
|
|
357
|
+
}
|
|
328
358
|
export interface MonthlyCorpus {
|
|
329
359
|
corpus_id: UUID;
|
|
330
360
|
yyyy_mm: string;
|
|
@@ -933,6 +963,9 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
933
963
|
document: (documentId: UUID) => Promise<DocumentAnalytics>;
|
|
934
964
|
/** Parent-section grain for a document (never exposes chunk ids). */
|
|
935
965
|
documentSections: (documentId: UUID) => Promise<SectionsResponse>;
|
|
966
|
+
/** Per-chunk retrieval heat + position in the document's view-PDF, plus a signed
|
|
967
|
+
* view-PDF URL — everything to overlay heat on the ORIGINAL document with pdf.js. */
|
|
968
|
+
documentChunks: (documentId: UUID) => Promise<ChunkHeatmapResponse>;
|
|
936
969
|
/** Whole-corpus scatter payload: every document with x=retrieved_reach, y=conversion,
|
|
937
970
|
* bubble=chunk_count, and a server-computed quadrant. No pagination (`truncated` if capped). */
|
|
938
971
|
corpusScatter: (corpusId: UUID) => Promise<ScatterResponse>;
|
package/dist/index.js
CHANGED
|
@@ -468,6 +468,9 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
468
468
|
document: (documentId) => this.request("GET", `/v1/analytics/documents/${documentId}`),
|
|
469
469
|
/** Parent-section grain for a document (never exposes chunk ids). */
|
|
470
470
|
documentSections: (documentId) => this.request("GET", `/v1/analytics/documents/${documentId}/sections`),
|
|
471
|
+
/** Per-chunk retrieval heat + position in the document's view-PDF, plus a signed
|
|
472
|
+
* view-PDF URL — everything to overlay heat on the ORIGINAL document with pdf.js. */
|
|
473
|
+
documentChunks: (documentId) => this.request("GET", `/v1/analytics/documents/${documentId}/chunks`),
|
|
471
474
|
/** Whole-corpus scatter payload: every document with x=retrieved_reach, y=conversion,
|
|
472
475
|
* bubble=chunk_count, and a server-computed quadrant. No pagination (`truncated` if capped). */
|
|
473
476
|
corpusScatter: (corpusId) => this.request("GET", `/v1/analytics/corpora/${corpusId}/scatter`),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.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
|
@@ -336,6 +336,24 @@ export interface SectionAnalytics {
|
|
|
336
336
|
citation_count: number; best_rerank_score: number | null; band: AnalyticsBand;
|
|
337
337
|
}
|
|
338
338
|
export interface SectionsResponse { document_id: UUID; sections: SectionAnalytics[] }
|
|
339
|
+
/** One chunk's retrieval heat + where it sits in the document's view-PDF. `regions` are
|
|
340
|
+
* view-PDF points (origin bottom-left), possibly spanning pages; `method`/`regions` null (or
|
|
341
|
+
* method "unaligned") => no box to draw (heat still shown). retrieved=0 => never-retrieved. */
|
|
342
|
+
export interface ChunkHeat {
|
|
343
|
+
chunk_id: string; seq: number; parent_id: UUID | null;
|
|
344
|
+
retrieved: number; reranked: number; citation_count: number;
|
|
345
|
+
best_rerank_rank: number | null; best_rerank_score: number | null;
|
|
346
|
+
method: string | null;
|
|
347
|
+
regions: { page: number; bbox: [number, number, number, number] }[] | null;
|
|
348
|
+
}
|
|
349
|
+
/** Everything to overlay retrieval heat on the original document: a signed view-PDF URL
|
|
350
|
+
* (render with pdf.js), its per-page geometry, and every chunk's heat + boxes. */
|
|
351
|
+
export interface ChunkHeatmapResponse {
|
|
352
|
+
document_id: UUID;
|
|
353
|
+
view_pdf_url: string | null;
|
|
354
|
+
page_dims: { w: number; h: number; rotation: number }[] | null;
|
|
355
|
+
chunks: ChunkHeat[];
|
|
356
|
+
}
|
|
339
357
|
export interface MonthlyCorpus {
|
|
340
358
|
corpus_id: UUID; yyyy_mm: string; queries: number; documents_retrieved: number;
|
|
341
359
|
chunks_retrieved: number; citations: number; revenue_share: number;
|
|
@@ -1070,6 +1088,9 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1070
1088
|
document: (documentId: UUID) => this.request<DocumentAnalytics>("GET", `/v1/analytics/documents/${documentId}`),
|
|
1071
1089
|
/** Parent-section grain for a document (never exposes chunk ids). */
|
|
1072
1090
|
documentSections: (documentId: UUID) => this.request<SectionsResponse>("GET", `/v1/analytics/documents/${documentId}/sections`),
|
|
1091
|
+
/** Per-chunk retrieval heat + position in the document's view-PDF, plus a signed
|
|
1092
|
+
* view-PDF URL — everything to overlay heat on the ORIGINAL document with pdf.js. */
|
|
1093
|
+
documentChunks: (documentId: UUID) => this.request<ChunkHeatmapResponse>("GET", `/v1/analytics/documents/${documentId}/chunks`),
|
|
1073
1094
|
/** Whole-corpus scatter payload: every document with x=retrieved_reach, y=conversion,
|
|
1074
1095
|
* bubble=chunk_count, and a server-computed quadrant. No pagination (`truncated` if capped). */
|
|
1075
1096
|
corpusScatter: (corpusId: UUID) => this.request<ScatterResponse>("GET", `/v1/analytics/corpora/${corpusId}/scatter`),
|