@knowledge-stack/ksapi 1.24.0 → 1.25.1

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.
Files changed (70) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/README.md +10 -2
  3. package/dist/apis/ChunksApi.d.ts +87 -5
  4. package/dist/apis/ChunksApi.js +85 -2
  5. package/dist/apis/PathPartsApi.d.ts +86 -1
  6. package/dist/apis/PathPartsApi.js +85 -0
  7. package/dist/esm/apis/ChunksApi.d.ts +87 -5
  8. package/dist/esm/apis/ChunksApi.js +86 -3
  9. package/dist/esm/apis/PathPartsApi.d.ts +86 -1
  10. package/dist/esm/apis/PathPartsApi.js +86 -1
  11. package/dist/esm/models/ChunkBulkResponse.d.ts +139 -0
  12. package/dist/esm/models/ChunkBulkResponse.js +100 -0
  13. package/dist/esm/models/ChunkContentItem.d.ts +1 -1
  14. package/dist/esm/models/ChunkContentItem.js +3 -1
  15. package/dist/esm/models/ChunkSearchRequest.d.ts +17 -5
  16. package/dist/esm/models/ChunkSearchRequest.js +12 -4
  17. package/dist/esm/models/DocumentResponse.d.ts +1 -1
  18. package/dist/esm/models/DocumentResponse.js +3 -1
  19. package/dist/esm/models/FolderResponse.d.ts +1 -1
  20. package/dist/esm/models/FolderResponse.js +3 -1
  21. package/dist/esm/models/SectionContentItem.d.ts +1 -1
  22. package/dist/esm/models/SectionContentItem.js +3 -1
  23. package/dist/esm/models/SubtreeChunkGroup.d.ts +62 -0
  24. package/dist/esm/models/SubtreeChunkGroup.js +52 -0
  25. package/dist/esm/models/SubtreeChunksResponse.d.ts +48 -0
  26. package/dist/esm/models/SubtreeChunksResponse.js +45 -0
  27. package/dist/esm/models/VersionChunkIdsResponse.d.ts +47 -0
  28. package/dist/esm/models/VersionChunkIdsResponse.js +44 -0
  29. package/dist/esm/models/index.d.ts +4 -0
  30. package/dist/esm/models/index.js +4 -0
  31. package/dist/models/ChunkBulkResponse.d.ts +139 -0
  32. package/dist/models/ChunkBulkResponse.js +108 -0
  33. package/dist/models/ChunkContentItem.d.ts +1 -1
  34. package/dist/models/ChunkContentItem.js +3 -1
  35. package/dist/models/ChunkSearchRequest.d.ts +17 -5
  36. package/dist/models/ChunkSearchRequest.js +12 -4
  37. package/dist/models/DocumentResponse.d.ts +1 -1
  38. package/dist/models/DocumentResponse.js +3 -1
  39. package/dist/models/FolderResponse.d.ts +1 -1
  40. package/dist/models/FolderResponse.js +3 -1
  41. package/dist/models/SectionContentItem.d.ts +1 -1
  42. package/dist/models/SectionContentItem.js +3 -1
  43. package/dist/models/SubtreeChunkGroup.d.ts +62 -0
  44. package/dist/models/SubtreeChunkGroup.js +60 -0
  45. package/dist/models/SubtreeChunksResponse.d.ts +48 -0
  46. package/dist/models/SubtreeChunksResponse.js +53 -0
  47. package/dist/models/VersionChunkIdsResponse.d.ts +47 -0
  48. package/dist/models/VersionChunkIdsResponse.js +52 -0
  49. package/dist/models/index.d.ts +4 -0
  50. package/dist/models/index.js +4 -0
  51. package/docs/ChunkBulkResponse.md +65 -0
  52. package/docs/ChunkSearchRequest.md +8 -4
  53. package/docs/ChunksApi.md +145 -1
  54. package/docs/PathPartsApi.md +147 -0
  55. package/docs/SubtreeChunkGroup.md +39 -0
  56. package/docs/SubtreeChunksResponse.md +35 -0
  57. package/docs/VersionChunkIdsResponse.md +35 -0
  58. package/package.json +1 -1
  59. package/src/apis/ChunksApi.ts +165 -4
  60. package/src/apis/PathPartsApi.ts +166 -0
  61. package/src/models/ChunkBulkResponse.ts +232 -0
  62. package/src/models/ChunkContentItem.ts +3 -2
  63. package/src/models/ChunkSearchRequest.ts +29 -9
  64. package/src/models/DocumentResponse.ts +3 -2
  65. package/src/models/FolderResponse.ts +3 -2
  66. package/src/models/SectionContentItem.ts +3 -2
  67. package/src/models/SubtreeChunkGroup.ts +104 -0
  68. package/src/models/SubtreeChunksResponse.ts +91 -0
  69. package/src/models/VersionChunkIdsResponse.ts +83 -0
  70. package/src/models/index.ts +4 -0
@@ -15,6 +15,7 @@
15
15
 
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
+ ChunkBulkResponse,
18
19
  ChunkResponse,
19
20
  ChunkSearchRequest,
20
21
  CreateChunkRequest,
@@ -22,8 +23,11 @@ import type {
22
23
  ScoredChunkResponse,
23
24
  UpdateChunkContentRequest,
24
25
  UpdateChunkMetadataRequest,
26
+ VersionChunkIdsResponse,
25
27
  } from '../models/index';
26
28
  import {
29
+ ChunkBulkResponseFromJSON,
30
+ ChunkBulkResponseToJSON,
27
31
  ChunkResponseFromJSON,
28
32
  ChunkResponseToJSON,
29
33
  ChunkSearchRequestFromJSON,
@@ -38,6 +42,8 @@ import {
38
42
  UpdateChunkContentRequestToJSON,
39
43
  UpdateChunkMetadataRequestFromJSON,
40
44
  UpdateChunkMetadataRequestToJSON,
45
+ VersionChunkIdsResponseFromJSON,
46
+ VersionChunkIdsResponseToJSON,
41
47
  } from '../models/index';
42
48
 
43
49
  export interface CreateChunkOperationRequest {
@@ -55,6 +61,16 @@ export interface GetChunkRequest {
55
61
  ksUat?: string | null;
56
62
  }
57
63
 
64
+ export interface GetChunksBulkRequest {
65
+ chunkIds?: Array<string> | null;
66
+ ksUat?: string | null;
67
+ }
68
+
69
+ export interface GetVersionChunkIdsRequest {
70
+ documentVersionId: string;
71
+ ksUat?: string | null;
72
+ }
73
+
58
74
  export interface SearchChunksRequest {
59
75
  chunkSearchRequest: ChunkSearchRequest;
60
76
  ksUat?: string | null;
@@ -157,6 +173,58 @@ export interface ChunksApiInterface {
157
173
  */
158
174
  getChunk(requestParameters: GetChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
159
175
 
176
+ /**
177
+ * Creates request options for getChunksBulk without sending the request
178
+ * @param {Array<string>} [chunkIds] Chunk IDs to resolve (max 200)
179
+ * @param {string} [ksUat]
180
+ * @throws {RequiredError}
181
+ * @memberof ChunksApiInterface
182
+ */
183
+ getChunksBulkRequestOpts(requestParameters: GetChunksBulkRequest): Promise<runtime.RequestOpts>;
184
+
185
+ /**
186
+ * Batch-fetch chunks with their full ancestor path part IDs. Returns standard chunk data plus path_part_id_segments (the ordered ancestor chain from root to chunk) for each requested chunk. Non-existent IDs are silently skipped. Limited to 200 IDs per call.
187
+ * @summary Get Chunks Bulk Handler
188
+ * @param {Array<string>} [chunkIds] Chunk IDs to resolve (max 200)
189
+ * @param {string} [ksUat]
190
+ * @param {*} [options] Override http request option.
191
+ * @throws {RequiredError}
192
+ * @memberof ChunksApiInterface
193
+ */
194
+ getChunksBulkRaw(requestParameters: GetChunksBulkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ChunkBulkResponse>>>;
195
+
196
+ /**
197
+ * Batch-fetch chunks with their full ancestor path part IDs. Returns standard chunk data plus path_part_id_segments (the ordered ancestor chain from root to chunk) for each requested chunk. Non-existent IDs are silently skipped. Limited to 200 IDs per call.
198
+ * Get Chunks Bulk Handler
199
+ */
200
+ getChunksBulk(requestParameters: GetChunksBulkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ChunkBulkResponse>>;
201
+
202
+ /**
203
+ * Creates request options for getVersionChunkIds without sending the request
204
+ * @param {string} documentVersionId Document version ID
205
+ * @param {string} [ksUat]
206
+ * @throws {RequiredError}
207
+ * @memberof ChunksApiInterface
208
+ */
209
+ getVersionChunkIdsRequestOpts(requestParameters: GetVersionChunkIdsRequest): Promise<runtime.RequestOpts>;
210
+
211
+ /**
212
+ * Get all chunk IDs belonging to a document version. Used by the embedding pipeline to discover chunks for a version.
213
+ * @summary Get Version Chunk Ids Handler
214
+ * @param {string} documentVersionId Document version ID
215
+ * @param {string} [ksUat]
216
+ * @param {*} [options] Override http request option.
217
+ * @throws {RequiredError}
218
+ * @memberof ChunksApiInterface
219
+ */
220
+ getVersionChunkIdsRaw(requestParameters: GetVersionChunkIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VersionChunkIdsResponse>>;
221
+
222
+ /**
223
+ * Get all chunk IDs belonging to a document version. Used by the embedding pipeline to discover chunks for a version.
224
+ * Get Version Chunk Ids Handler
225
+ */
226
+ getVersionChunkIds(requestParameters: GetVersionChunkIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VersionChunkIdsResponse>;
227
+
160
228
  /**
161
229
  * Creates request options for searchChunks without sending the request
162
230
  * @param {ChunkSearchRequest} chunkSearchRequest
@@ -167,7 +235,7 @@ export interface ChunksApiInterface {
167
235
  searchChunksRequestOpts(requestParameters: SearchChunksRequest): Promise<runtime.RequestOpts>;
168
236
 
169
237
  /**
170
- * Semantic search over chunks using vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses a two-session design to avoid holding a DB connection during the external embedding API call.
238
+ * Semantic search over chunks using Qdrant vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses Qdrant for vector search and hydrates results from Postgres.
171
239
  * @summary Search Chunks Handler
172
240
  * @param {ChunkSearchRequest} chunkSearchRequest
173
241
  * @param {string} [ksUat]
@@ -178,7 +246,7 @@ export interface ChunksApiInterface {
178
246
  searchChunksRaw(requestParameters: SearchChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ScoredChunkResponse>>>;
179
247
 
180
248
  /**
181
- * Semantic search over chunks using vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses a two-session design to avoid holding a DB connection during the external embedding API call.
249
+ * Semantic search over chunks using Qdrant vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses Qdrant for vector search and hydrates results from Postgres.
182
250
  * Search Chunks Handler
183
251
  */
184
252
  searchChunks(requestParameters: SearchChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ScoredChunkResponse>>;
@@ -388,6 +456,99 @@ export class ChunksApi extends runtime.BaseAPI implements ChunksApiInterface {
388
456
  return await response.value();
389
457
  }
390
458
 
459
+ /**
460
+ * Creates request options for getChunksBulk without sending the request
461
+ */
462
+ async getChunksBulkRequestOpts(requestParameters: GetChunksBulkRequest): Promise<runtime.RequestOpts> {
463
+ const queryParameters: any = {};
464
+
465
+ if (requestParameters['chunkIds'] != null) {
466
+ queryParameters['chunk_ids'] = requestParameters['chunkIds'];
467
+ }
468
+
469
+ const headerParameters: runtime.HTTPHeaders = {};
470
+
471
+
472
+ let urlPath = `/v1/chunks/bulk`;
473
+
474
+ return {
475
+ path: urlPath,
476
+ method: 'GET',
477
+ headers: headerParameters,
478
+ query: queryParameters,
479
+ };
480
+ }
481
+
482
+ /**
483
+ * Batch-fetch chunks with their full ancestor path part IDs. Returns standard chunk data plus path_part_id_segments (the ordered ancestor chain from root to chunk) for each requested chunk. Non-existent IDs are silently skipped. Limited to 200 IDs per call.
484
+ * Get Chunks Bulk Handler
485
+ */
486
+ async getChunksBulkRaw(requestParameters: GetChunksBulkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ChunkBulkResponse>>> {
487
+ const requestOptions = await this.getChunksBulkRequestOpts(requestParameters);
488
+ const response = await this.request(requestOptions, initOverrides);
489
+
490
+ return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ChunkBulkResponseFromJSON));
491
+ }
492
+
493
+ /**
494
+ * Batch-fetch chunks with their full ancestor path part IDs. Returns standard chunk data plus path_part_id_segments (the ordered ancestor chain from root to chunk) for each requested chunk. Non-existent IDs are silently skipped. Limited to 200 IDs per call.
495
+ * Get Chunks Bulk Handler
496
+ */
497
+ async getChunksBulk(requestParameters: GetChunksBulkRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ChunkBulkResponse>> {
498
+ const response = await this.getChunksBulkRaw(requestParameters, initOverrides);
499
+ return await response.value();
500
+ }
501
+
502
+ /**
503
+ * Creates request options for getVersionChunkIds without sending the request
504
+ */
505
+ async getVersionChunkIdsRequestOpts(requestParameters: GetVersionChunkIdsRequest): Promise<runtime.RequestOpts> {
506
+ if (requestParameters['documentVersionId'] == null) {
507
+ throw new runtime.RequiredError(
508
+ 'documentVersionId',
509
+ 'Required parameter "documentVersionId" was null or undefined when calling getVersionChunkIds().'
510
+ );
511
+ }
512
+
513
+ const queryParameters: any = {};
514
+
515
+ if (requestParameters['documentVersionId'] != null) {
516
+ queryParameters['document_version_id'] = requestParameters['documentVersionId'];
517
+ }
518
+
519
+ const headerParameters: runtime.HTTPHeaders = {};
520
+
521
+
522
+ let urlPath = `/v1/chunks/version-chunk-ids`;
523
+
524
+ return {
525
+ path: urlPath,
526
+ method: 'GET',
527
+ headers: headerParameters,
528
+ query: queryParameters,
529
+ };
530
+ }
531
+
532
+ /**
533
+ * Get all chunk IDs belonging to a document version. Used by the embedding pipeline to discover chunks for a version.
534
+ * Get Version Chunk Ids Handler
535
+ */
536
+ async getVersionChunkIdsRaw(requestParameters: GetVersionChunkIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VersionChunkIdsResponse>> {
537
+ const requestOptions = await this.getVersionChunkIdsRequestOpts(requestParameters);
538
+ const response = await this.request(requestOptions, initOverrides);
539
+
540
+ return new runtime.JSONApiResponse(response, (jsonValue) => VersionChunkIdsResponseFromJSON(jsonValue));
541
+ }
542
+
543
+ /**
544
+ * Get all chunk IDs belonging to a document version. Used by the embedding pipeline to discover chunks for a version.
545
+ * Get Version Chunk Ids Handler
546
+ */
547
+ async getVersionChunkIds(requestParameters: GetVersionChunkIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VersionChunkIdsResponse> {
548
+ const response = await this.getVersionChunkIdsRaw(requestParameters, initOverrides);
549
+ return await response.value();
550
+ }
551
+
391
552
  /**
392
553
  * Creates request options for searchChunks without sending the request
393
554
  */
@@ -418,7 +579,7 @@ export class ChunksApi extends runtime.BaseAPI implements ChunksApiInterface {
418
579
  }
419
580
 
420
581
  /**
421
- * Semantic search over chunks using vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses a two-session design to avoid holding a DB connection during the external embedding API call.
582
+ * Semantic search over chunks using Qdrant vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses Qdrant for vector search and hydrates results from Postgres.
422
583
  * Search Chunks Handler
423
584
  */
424
585
  async searchChunksRaw(requestParameters: SearchChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ScoredChunkResponse>>> {
@@ -429,7 +590,7 @@ export class ChunksApi extends runtime.BaseAPI implements ChunksApiInterface {
429
590
  }
430
591
 
431
592
  /**
432
- * Semantic search over chunks using vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses a two-session design to avoid holding a DB connection during the external embedding API call.
593
+ * Semantic search over chunks using Qdrant vector similarity. Combines vector similarity with path-based authorization and optional metadata filters. Uses Qdrant for vector search and hydrates results from Postgres.
433
594
  * Search Chunks Handler
434
595
  */
435
596
  async searchChunks(requestParameters: SearchChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ScoredChunkResponse>> {
@@ -21,6 +21,7 @@ import type {
21
21
  PathOrder,
22
22
  PathPartResponse,
23
23
  PathPartTagsResponse,
24
+ SubtreeChunksResponse,
24
25
  } from '../models/index';
25
26
  import {
26
27
  BulkTagRequestFromJSON,
@@ -35,6 +36,8 @@ import {
35
36
  PathPartResponseToJSON,
36
37
  PathPartTagsResponseFromJSON,
37
38
  PathPartTagsResponseToJSON,
39
+ SubtreeChunksResponseFromJSON,
40
+ SubtreeChunksResponseToJSON,
38
41
  } from '../models/index';
39
42
 
40
43
  export interface BulkAddPathPartTagsRequest {
@@ -54,6 +57,17 @@ export interface GetPathPartRequest {
54
57
  ksUat?: string | null;
55
58
  }
56
59
 
60
+ export interface GetPathPartSubtreeChunksRequest {
61
+ pathPartId: string;
62
+ ksUat?: string | null;
63
+ }
64
+
65
+ export interface GetPathPartTagsRequest {
66
+ pathPartId: string;
67
+ includeInherited?: boolean;
68
+ ksUat?: string | null;
69
+ }
70
+
57
71
  export interface ListPathPartsRequest {
58
72
  parentPathId?: string | null;
59
73
  maxDepth?: number;
@@ -152,6 +166,60 @@ export interface PathPartsApiInterface {
152
166
  */
153
167
  getPathPart(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartResponse>;
154
168
 
169
+ /**
170
+ * Creates request options for getPathPartSubtreeChunks without sending the request
171
+ * @param {string} pathPartId
172
+ * @param {string} [ksUat]
173
+ * @throws {RequiredError}
174
+ * @memberof PathPartsApiInterface
175
+ */
176
+ getPathPartSubtreeChunksRequestOpts(requestParameters: GetPathPartSubtreeChunksRequest): Promise<runtime.RequestOpts>;
177
+
178
+ /**
179
+ * Resolve all descendant chunks for a subtree root. Returns chunks grouped by identical (path_part_ids, tag_ids) tuples.
180
+ * @summary Get Path Part Subtree Chunks Handler
181
+ * @param {string} pathPartId
182
+ * @param {string} [ksUat]
183
+ * @param {*} [options] Override http request option.
184
+ * @throws {RequiredError}
185
+ * @memberof PathPartsApiInterface
186
+ */
187
+ getPathPartSubtreeChunksRaw(requestParameters: GetPathPartSubtreeChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubtreeChunksResponse>>;
188
+
189
+ /**
190
+ * Resolve all descendant chunks for a subtree root. Returns chunks grouped by identical (path_part_ids, tag_ids) tuples.
191
+ * Get Path Part Subtree Chunks Handler
192
+ */
193
+ getPathPartSubtreeChunks(requestParameters: GetPathPartSubtreeChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubtreeChunksResponse>;
194
+
195
+ /**
196
+ * Creates request options for getPathPartTags without sending the request
197
+ * @param {string} pathPartId
198
+ * @param {boolean} [includeInherited] Include tags inherited from ancestor path parts
199
+ * @param {string} [ksUat]
200
+ * @throws {RequiredError}
201
+ * @memberof PathPartsApiInterface
202
+ */
203
+ getPathPartTagsRequestOpts(requestParameters: GetPathPartTagsRequest): Promise<runtime.RequestOpts>;
204
+
205
+ /**
206
+ * Get tags for a path part. When include_inherited=False (default), returns only directly-attached tags. When include_inherited=True, walks the ancestor chain and returns the deduplicated union of tags from all ancestors (including the path part itself).
207
+ * @summary Get Path Part Tags Handler
208
+ * @param {string} pathPartId
209
+ * @param {boolean} [includeInherited] Include tags inherited from ancestor path parts
210
+ * @param {string} [ksUat]
211
+ * @param {*} [options] Override http request option.
212
+ * @throws {RequiredError}
213
+ * @memberof PathPartsApiInterface
214
+ */
215
+ getPathPartTagsRaw(requestParameters: GetPathPartTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PathPartTagsResponse>>;
216
+
217
+ /**
218
+ * Get tags for a path part. When include_inherited=False (default), returns only directly-attached tags. When include_inherited=True, walks the ancestor chain and returns the deduplicated union of tags from all ancestors (including the path part itself).
219
+ * Get Path Part Tags Handler
220
+ */
221
+ getPathPartTags(requestParameters: GetPathPartTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartTagsResponse>;
222
+
155
223
  /**
156
224
  * Creates request options for listPathParts without sending the request
157
225
  * @param {string} [parentPathId] Parent PathPart ID (defaults to root)
@@ -354,6 +422,104 @@ export class PathPartsApi extends runtime.BaseAPI implements PathPartsApiInterfa
354
422
  return await response.value();
355
423
  }
356
424
 
425
+ /**
426
+ * Creates request options for getPathPartSubtreeChunks without sending the request
427
+ */
428
+ async getPathPartSubtreeChunksRequestOpts(requestParameters: GetPathPartSubtreeChunksRequest): Promise<runtime.RequestOpts> {
429
+ if (requestParameters['pathPartId'] == null) {
430
+ throw new runtime.RequiredError(
431
+ 'pathPartId',
432
+ 'Required parameter "pathPartId" was null or undefined when calling getPathPartSubtreeChunks().'
433
+ );
434
+ }
435
+
436
+ const queryParameters: any = {};
437
+
438
+ const headerParameters: runtime.HTTPHeaders = {};
439
+
440
+
441
+ let urlPath = `/v1/path-parts/{path_part_id}/subtree_chunks`;
442
+ urlPath = urlPath.replace(`{${"path_part_id"}}`, encodeURIComponent(String(requestParameters['pathPartId'])));
443
+
444
+ return {
445
+ path: urlPath,
446
+ method: 'GET',
447
+ headers: headerParameters,
448
+ query: queryParameters,
449
+ };
450
+ }
451
+
452
+ /**
453
+ * Resolve all descendant chunks for a subtree root. Returns chunks grouped by identical (path_part_ids, tag_ids) tuples.
454
+ * Get Path Part Subtree Chunks Handler
455
+ */
456
+ async getPathPartSubtreeChunksRaw(requestParameters: GetPathPartSubtreeChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubtreeChunksResponse>> {
457
+ const requestOptions = await this.getPathPartSubtreeChunksRequestOpts(requestParameters);
458
+ const response = await this.request(requestOptions, initOverrides);
459
+
460
+ return new runtime.JSONApiResponse(response, (jsonValue) => SubtreeChunksResponseFromJSON(jsonValue));
461
+ }
462
+
463
+ /**
464
+ * Resolve all descendant chunks for a subtree root. Returns chunks grouped by identical (path_part_ids, tag_ids) tuples.
465
+ * Get Path Part Subtree Chunks Handler
466
+ */
467
+ async getPathPartSubtreeChunks(requestParameters: GetPathPartSubtreeChunksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubtreeChunksResponse> {
468
+ const response = await this.getPathPartSubtreeChunksRaw(requestParameters, initOverrides);
469
+ return await response.value();
470
+ }
471
+
472
+ /**
473
+ * Creates request options for getPathPartTags without sending the request
474
+ */
475
+ async getPathPartTagsRequestOpts(requestParameters: GetPathPartTagsRequest): Promise<runtime.RequestOpts> {
476
+ if (requestParameters['pathPartId'] == null) {
477
+ throw new runtime.RequiredError(
478
+ 'pathPartId',
479
+ 'Required parameter "pathPartId" was null or undefined when calling getPathPartTags().'
480
+ );
481
+ }
482
+
483
+ const queryParameters: any = {};
484
+
485
+ if (requestParameters['includeInherited'] != null) {
486
+ queryParameters['include_inherited'] = requestParameters['includeInherited'];
487
+ }
488
+
489
+ const headerParameters: runtime.HTTPHeaders = {};
490
+
491
+
492
+ let urlPath = `/v1/path-parts/{path_part_id}/tags`;
493
+ urlPath = urlPath.replace(`{${"path_part_id"}}`, encodeURIComponent(String(requestParameters['pathPartId'])));
494
+
495
+ return {
496
+ path: urlPath,
497
+ method: 'GET',
498
+ headers: headerParameters,
499
+ query: queryParameters,
500
+ };
501
+ }
502
+
503
+ /**
504
+ * Get tags for a path part. When include_inherited=False (default), returns only directly-attached tags. When include_inherited=True, walks the ancestor chain and returns the deduplicated union of tags from all ancestors (including the path part itself).
505
+ * Get Path Part Tags Handler
506
+ */
507
+ async getPathPartTagsRaw(requestParameters: GetPathPartTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PathPartTagsResponse>> {
508
+ const requestOptions = await this.getPathPartTagsRequestOpts(requestParameters);
509
+ const response = await this.request(requestOptions, initOverrides);
510
+
511
+ return new runtime.JSONApiResponse(response, (jsonValue) => PathPartTagsResponseFromJSON(jsonValue));
512
+ }
513
+
514
+ /**
515
+ * Get tags for a path part. When include_inherited=False (default), returns only directly-attached tags. When include_inherited=True, walks the ancestor chain and returns the deduplicated union of tags from all ancestors (including the path part itself).
516
+ * Get Path Part Tags Handler
517
+ */
518
+ async getPathPartTags(requestParameters: GetPathPartTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartTagsResponse> {
519
+ const response = await this.getPathPartTagsRaw(requestParameters, initOverrides);
520
+ return await response.value();
521
+ }
522
+
357
523
  /**
358
524
  * Creates request options for listPathParts without sending the request
359
525
  */
@@ -0,0 +1,232 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { ChunkMetadataOutput } from './ChunkMetadataOutput';
17
+ import {
18
+ ChunkMetadataOutputFromJSON,
19
+ ChunkMetadataOutputFromJSONTyped,
20
+ ChunkMetadataOutputToJSON,
21
+ ChunkMetadataOutputToJSONTyped,
22
+ } from './ChunkMetadataOutput';
23
+ import type { ChunkType } from './ChunkType';
24
+ import {
25
+ ChunkTypeFromJSON,
26
+ ChunkTypeFromJSONTyped,
27
+ ChunkTypeToJSON,
28
+ ChunkTypeToJSONTyped,
29
+ } from './ChunkType';
30
+
31
+ /**
32
+ * Chunk response with ancestor path part IDs for Qdrant payload construction.
33
+ * @export
34
+ * @interface ChunkBulkResponse
35
+ */
36
+ export interface ChunkBulkResponse {
37
+ /**
38
+ * Chunk ID
39
+ * @type {string}
40
+ * @memberof ChunkBulkResponse
41
+ */
42
+ id: string;
43
+ /**
44
+ * PathPart ID
45
+ * @type {string}
46
+ * @memberof ChunkBulkResponse
47
+ */
48
+ pathPartId: string;
49
+ /**
50
+ * ChunkContent ID
51
+ * @type {string}
52
+ * @memberof ChunkBulkResponse
53
+ */
54
+ contentId: string;
55
+ /**
56
+ * Chunk text content
57
+ * @type {string}
58
+ * @memberof ChunkBulkResponse
59
+ */
60
+ content: string;
61
+ /**
62
+ *
63
+ * @type {ChunkType}
64
+ * @memberof ChunkBulkResponse
65
+ */
66
+ chunkType: ChunkType;
67
+ /**
68
+ *
69
+ * @type {ChunkMetadataOutput}
70
+ * @memberof ChunkBulkResponse
71
+ */
72
+ chunkMetadata: ChunkMetadataOutput;
73
+ /**
74
+ * Parent PathPart ID
75
+ * @type {string}
76
+ * @memberof ChunkBulkResponse
77
+ */
78
+ parentPathId: string;
79
+ /**
80
+ * Previous sibling PathPart ID
81
+ * @type {string}
82
+ * @memberof ChunkBulkResponse
83
+ */
84
+ prevSiblingPathId?: string | null;
85
+ /**
86
+ * Next sibling PathPart ID
87
+ * @type {string}
88
+ * @memberof ChunkBulkResponse
89
+ */
90
+ nextSiblingPathId?: string | null;
91
+ /**
92
+ * Full materialized path from root
93
+ * @type {string}
94
+ * @memberof ChunkBulkResponse
95
+ */
96
+ materializedPath: string;
97
+ /**
98
+ * Whether this chunk is system-managed
99
+ * @type {boolean}
100
+ * @memberof ChunkBulkResponse
101
+ */
102
+ systemManaged: boolean;
103
+ /**
104
+ * Tenant ID
105
+ * @type {string}
106
+ * @memberof ChunkBulkResponse
107
+ */
108
+ tenantId: string;
109
+ /**
110
+ * Creation timestamp
111
+ * @type {Date}
112
+ * @memberof ChunkBulkResponse
113
+ */
114
+ createdAt: Date;
115
+ /**
116
+ * Last update timestamp
117
+ * @type {Date}
118
+ * @memberof ChunkBulkResponse
119
+ */
120
+ updatedAt: Date;
121
+ /**
122
+ * Presigned URL to download the chunk's visual asset (6-hour validity)
123
+ * @type {string}
124
+ * @memberof ChunkBulkResponse
125
+ */
126
+ assetS3Url?: string | null;
127
+ /**
128
+ * Ordered ancestor PathPart IDs from root to chunk
129
+ * @type {Array<string>}
130
+ * @memberof ChunkBulkResponse
131
+ */
132
+ pathPartIdSegments: Array<string>;
133
+ }
134
+
135
+
136
+
137
+ /**
138
+ * Check if a given object implements the ChunkBulkResponse interface.
139
+ */
140
+ export function instanceOfChunkBulkResponse(value: object): value is ChunkBulkResponse {
141
+ if (!('id' in value) || value['id'] === undefined) return false;
142
+ if (!('pathPartId' in value) || value['pathPartId'] === undefined) return false;
143
+ if (!('contentId' in value) || value['contentId'] === undefined) return false;
144
+ if (!('content' in value) || value['content'] === undefined) return false;
145
+ if (!('chunkType' in value) || value['chunkType'] === undefined) return false;
146
+ if (!('chunkMetadata' in value) || value['chunkMetadata'] === undefined) return false;
147
+ if (!('parentPathId' in value) || value['parentPathId'] === undefined) return false;
148
+ if (!('materializedPath' in value) || value['materializedPath'] === undefined) return false;
149
+ if (!('systemManaged' in value) || value['systemManaged'] === undefined) return false;
150
+ if (!('tenantId' in value) || value['tenantId'] === undefined) return false;
151
+ if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
152
+ if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false;
153
+ if (!('pathPartIdSegments' in value) || value['pathPartIdSegments'] === undefined) return false;
154
+ return true;
155
+ }
156
+
157
+ export function ChunkBulkResponseFromJSON(json: any): ChunkBulkResponse {
158
+ return ChunkBulkResponseFromJSONTyped(json, false);
159
+ }
160
+
161
+ export function ChunkBulkResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChunkBulkResponse {
162
+ if (json == null) {
163
+ return json;
164
+ }
165
+ return {
166
+
167
+ 'id': json['id'],
168
+ 'pathPartId': json['path_part_id'],
169
+ 'contentId': json['content_id'],
170
+ 'content': json['content'],
171
+ 'chunkType': ChunkTypeFromJSON(json['chunk_type']),
172
+ 'chunkMetadata': ChunkMetadataOutputFromJSON(json['chunk_metadata']),
173
+ 'parentPathId': json['parent_path_id'],
174
+ 'prevSiblingPathId': json['prev_sibling_path_id'] == null ? undefined : json['prev_sibling_path_id'],
175
+ 'nextSiblingPathId': json['next_sibling_path_id'] == null ? undefined : json['next_sibling_path_id'],
176
+ 'materializedPath': json['materialized_path'],
177
+ 'systemManaged': json['system_managed'],
178
+ 'tenantId': json['tenant_id'],
179
+ 'createdAt': (new Date(json['created_at'])),
180
+ 'updatedAt': (new Date(json['updated_at'])),
181
+ 'assetS3Url': json['asset_s3_url'] == null ? undefined : json['asset_s3_url'],
182
+ 'pathPartIdSegments': json['path_part_id_segments'],
183
+ };
184
+ }
185
+
186
+ export function ChunkBulkResponseToJSON(json: any): ChunkBulkResponse {
187
+ return ChunkBulkResponseToJSONTyped(json, false);
188
+ }
189
+
190
+ export function ChunkBulkResponseToJSONTyped(value?: ChunkBulkResponse | null, ignoreDiscriminator: boolean = false): any {
191
+ if (value == null) {
192
+ return value;
193
+ }
194
+
195
+ return {
196
+
197
+ 'id': value['id'],
198
+ 'path_part_id': value['pathPartId'],
199
+ 'content_id': value['contentId'],
200
+ 'content': value['content'],
201
+ 'chunk_type': ChunkTypeToJSON(value['chunkType']),
202
+ 'chunk_metadata': ChunkMetadataOutputToJSON(value['chunkMetadata']),
203
+ 'parent_path_id': value['parentPathId'],
204
+ 'prev_sibling_path_id': value['prevSiblingPathId'],
205
+ 'next_sibling_path_id': value['nextSiblingPathId'],
206
+ 'materialized_path': value['materializedPath'],
207
+ 'system_managed': value['systemManaged'],
208
+ 'tenant_id': value['tenantId'],
209
+ 'created_at': value['createdAt'].toISOString(),
210
+ 'updated_at': value['updatedAt'].toISOString(),
211
+ 'asset_s3_url': value['assetS3Url'],
212
+ 'path_part_id_segments': value['pathPartIdSegments'],
213
+ };
214
+ }
215
+
216
+ export const ChunkBulkResponsePropertyValidationAttributesMap: {
217
+ [property: string]: {
218
+ maxLength?: number,
219
+ minLength?: number,
220
+ pattern?: string,
221
+ maximum?: number,
222
+ exclusiveMaximum?: boolean,
223
+ minimum?: number,
224
+ exclusiveMinimum?: boolean,
225
+ multipleOf?: number,
226
+ maxItems?: number,
227
+ minItems?: number,
228
+ uniqueItems?: boolean
229
+ }
230
+ } = {
231
+ }
232
+