@knowledge-stack/ksapi 1.145.1 → 1.147.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/.openapi-generator/FILES +4 -0
- package/README.md +5 -2
- package/dist/apis/DocumentsApi.d.ts +45 -1
- package/dist/apis/DocumentsApi.js +75 -0
- package/dist/esm/apis/DocumentsApi.d.ts +45 -1
- package/dist/esm/apis/DocumentsApi.js +76 -1
- package/dist/esm/models/ChunkContentItem.d.ts +6 -0
- package/dist/esm/models/ChunkContentItem.js +2 -0
- package/dist/esm/models/IngestZipResponse.d.ts +72 -0
- package/dist/esm/models/IngestZipResponse.js +61 -0
- package/dist/esm/models/SectionContentItem.d.ts +12 -0
- package/dist/esm/models/SectionContentItem.js +4 -0
- package/dist/esm/models/ZipFileResult.d.ts +77 -0
- package/dist/esm/models/ZipFileResult.js +54 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/models/ChunkContentItem.d.ts +6 -0
- package/dist/models/ChunkContentItem.js +2 -0
- package/dist/models/IngestZipResponse.d.ts +72 -0
- package/dist/models/IngestZipResponse.js +69 -0
- package/dist/models/SectionContentItem.d.ts +12 -0
- package/dist/models/SectionContentItem.js +4 -0
- package/dist/models/ZipFileResult.d.ts +77 -0
- package/dist/models/ZipFileResult.js +62 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/docs/ChunkContentItem.md +2 -0
- package/docs/DocumentsApi.md +82 -0
- package/docs/IngestZipResponse.md +43 -0
- package/docs/SectionContentItem.md +4 -0
- package/docs/SectionContentItemOrChunkContentItem.md +4 -0
- package/docs/ZipFileResult.md +45 -0
- package/package.json +1 -1
- package/src/apis/DocumentsApi.ts +127 -0
- package/src/models/ChunkContentItem.ts +8 -0
- package/src/models/IngestZipResponse.ts +127 -0
- package/src/models/SectionContentItem.ts +16 -0
- package/src/models/ZipFileResult.ts +123 -0
- package/src/models/index.ts +2 -0
package/docs/DocumentsApi.md
CHANGED
|
@@ -10,6 +10,7 @@ All URIs are relative to *http://localhost:8000*
|
|
|
10
10
|
| [**getDocument**](DocumentsApi.md#getdocument) | **GET** /v1/documents/{document_id} | Get Document Handler |
|
|
11
11
|
| [**ingestDocument**](DocumentsApi.md#ingestdocument) | **POST** /v1/documents/ingest | Ingest Document Handler |
|
|
12
12
|
| [**ingestDocumentVersion**](DocumentsApi.md#ingestdocumentversion) | **POST** /v1/documents/{document_id}/ingest | Ingest Document Version Handler |
|
|
13
|
+
| [**ingestZip**](DocumentsApi.md#ingestzip) | **POST** /v1/documents/ingest-zip | Ingest Zip Handler |
|
|
13
14
|
| [**listDocuments**](DocumentsApi.md#listdocuments) | **GET** /v1/documents | List Documents Handler |
|
|
14
15
|
| [**updateDocument**](DocumentsApi.md#updatedocumentoperation) | **PATCH** /v1/documents/{document_id} | Update Document Handler |
|
|
15
16
|
|
|
@@ -514,6 +515,87 @@ example().catch(console.error);
|
|
|
514
515
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
515
516
|
|
|
516
517
|
|
|
518
|
+
## ingestZip
|
|
519
|
+
|
|
520
|
+
> IngestZipResponse ingestZip(file, pathPartId, ingestionMode)
|
|
521
|
+
|
|
522
|
+
Ingest Zip Handler
|
|
523
|
+
|
|
524
|
+
Upload a ZIP archive and ingest each member file individually. Directory structure inside the ZIP is preserved as FOLDER PathParts under the target folder. Returns 202 with per-file outcomes — each file that ingests successfully has its own Temporal workflow ID to poll for status. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes. Per-file failures (unsupported type, oversized) are included in the response with ``error`` set; other files continue processing.
|
|
525
|
+
|
|
526
|
+
### Example
|
|
527
|
+
|
|
528
|
+
```ts
|
|
529
|
+
import {
|
|
530
|
+
Configuration,
|
|
531
|
+
DocumentsApi,
|
|
532
|
+
} from '@knowledge-stack/ksapi';
|
|
533
|
+
import type { IngestZipRequest } from '@knowledge-stack/ksapi';
|
|
534
|
+
|
|
535
|
+
async function example() {
|
|
536
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
537
|
+
const config = new Configuration({
|
|
538
|
+
// To configure API key authorization: cookieAuth
|
|
539
|
+
apiKey: "YOUR API KEY",
|
|
540
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
541
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
542
|
+
});
|
|
543
|
+
const api = new DocumentsApi(config);
|
|
544
|
+
|
|
545
|
+
const body = {
|
|
546
|
+
// Blob
|
|
547
|
+
file: BINARY_DATA_HERE,
|
|
548
|
+
// string | Parent path part ID (must be a FOLDER type)
|
|
549
|
+
pathPartId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
550
|
+
// IngestionMode (optional)
|
|
551
|
+
ingestionMode: ...,
|
|
552
|
+
} satisfies IngestZipRequest;
|
|
553
|
+
|
|
554
|
+
try {
|
|
555
|
+
const data = await api.ingestZip(body);
|
|
556
|
+
console.log(data);
|
|
557
|
+
} catch (error) {
|
|
558
|
+
console.error(error);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Run the test
|
|
563
|
+
example().catch(console.error);
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Parameters
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
| Name | Type | Description | Notes |
|
|
570
|
+
|------------- | ------------- | ------------- | -------------|
|
|
571
|
+
| **file** | `Blob` | | [Defaults to `undefined`] |
|
|
572
|
+
| **pathPartId** | `string` | Parent path part ID (must be a FOLDER type) | [Defaults to `undefined`] |
|
|
573
|
+
| **ingestionMode** | `IngestionMode` | | [Optional] [Defaults to `undefined`] [Enum: high_accuracy, standard, single_chunk] |
|
|
574
|
+
|
|
575
|
+
### Return type
|
|
576
|
+
|
|
577
|
+
[**IngestZipResponse**](IngestZipResponse.md)
|
|
578
|
+
|
|
579
|
+
### Authorization
|
|
580
|
+
|
|
581
|
+
[cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
|
|
582
|
+
|
|
583
|
+
### HTTP request headers
|
|
584
|
+
|
|
585
|
+
- **Content-Type**: `multipart/form-data`
|
|
586
|
+
- **Accept**: `application/json`
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
### HTTP response details
|
|
590
|
+
| Status code | Description | Response headers |
|
|
591
|
+
|-------------|-------------|------------------|
|
|
592
|
+
| **202** | Successful Response | - |
|
|
593
|
+
| **422** | Validation Error | - |
|
|
594
|
+
| **0** | Error response. | - |
|
|
595
|
+
|
|
596
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
597
|
+
|
|
598
|
+
|
|
517
599
|
## listDocuments
|
|
518
600
|
|
|
519
601
|
> PaginatedResponseDocumentResponse listDocuments(parentPathPartId, sortOrder, sortDir, ownerId, documentType, withTags, limit, offset, createdAfter, createdBefore, updatedAfter, updatedBefore)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
# IngestZipResponse
|
|
3
|
+
|
|
4
|
+
Aggregate response from a ZIP ingestion batch.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`files` | [Array<ZipFileResult>](ZipFileResult.md)
|
|
11
|
+
`totalFound` | number
|
|
12
|
+
`succeeded` | number
|
|
13
|
+
`skipped` | number
|
|
14
|
+
`failed` | number
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import type { IngestZipResponse } from '@knowledge-stack/ksapi'
|
|
20
|
+
|
|
21
|
+
// TODO: Update the object below with actual values
|
|
22
|
+
const example = {
|
|
23
|
+
"files": null,
|
|
24
|
+
"totalFound": null,
|
|
25
|
+
"succeeded": null,
|
|
26
|
+
"skipped": null,
|
|
27
|
+
"failed": null,
|
|
28
|
+
} satisfies IngestZipResponse
|
|
29
|
+
|
|
30
|
+
console.log(example)
|
|
31
|
+
|
|
32
|
+
// Convert the instance to a JSON string
|
|
33
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
34
|
+
console.log(exampleJSON)
|
|
35
|
+
|
|
36
|
+
// Parse the JSON string back to an object
|
|
37
|
+
const exampleParsed = JSON.parse(exampleJSON) as IngestZipResponse
|
|
38
|
+
console.log(exampleParsed)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
42
|
+
|
|
43
|
+
|
|
@@ -13,6 +13,8 @@ Name | Type
|
|
|
13
13
|
`parentPathId` | string
|
|
14
14
|
`metadataObjId` | string
|
|
15
15
|
`depth` | number
|
|
16
|
+
`chunkStartIndex` | number
|
|
17
|
+
`chunkEndIndex` | number
|
|
16
18
|
`pageNumber` | number
|
|
17
19
|
`materializedPath` | string
|
|
18
20
|
`systemManaged` | boolean
|
|
@@ -33,6 +35,8 @@ const example = {
|
|
|
33
35
|
"parentPathId": null,
|
|
34
36
|
"metadataObjId": null,
|
|
35
37
|
"depth": null,
|
|
38
|
+
"chunkStartIndex": null,
|
|
39
|
+
"chunkEndIndex": null,
|
|
36
40
|
"pageNumber": null,
|
|
37
41
|
"materializedPath": null,
|
|
38
42
|
"systemManaged": null,
|
|
@@ -12,6 +12,8 @@ Name | Type
|
|
|
12
12
|
`parentPathId` | string
|
|
13
13
|
`metadataObjId` | string
|
|
14
14
|
`depth` | number
|
|
15
|
+
`chunkStartIndex` | number
|
|
16
|
+
`chunkEndIndex` | number
|
|
15
17
|
`pageNumber` | number
|
|
16
18
|
`materializedPath` | string
|
|
17
19
|
`systemManaged` | boolean
|
|
@@ -35,6 +37,8 @@ const example = {
|
|
|
35
37
|
"parentPathId": null,
|
|
36
38
|
"metadataObjId": null,
|
|
37
39
|
"depth": null,
|
|
40
|
+
"chunkStartIndex": null,
|
|
41
|
+
"chunkEndIndex": null,
|
|
38
42
|
"pageNumber": null,
|
|
39
43
|
"materializedPath": null,
|
|
40
44
|
"systemManaged": null,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# ZipFileResult
|
|
3
|
+
|
|
4
|
+
Per-file outcome from a ZIP ingestion batch.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`zipPath` | string
|
|
11
|
+
`documentId` | string
|
|
12
|
+
`documentVersionId` | string
|
|
13
|
+
`workflowId` | string
|
|
14
|
+
`skipped` | boolean
|
|
15
|
+
`error` | string
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { ZipFileResult } from '@knowledge-stack/ksapi'
|
|
21
|
+
|
|
22
|
+
// TODO: Update the object below with actual values
|
|
23
|
+
const example = {
|
|
24
|
+
"zipPath": null,
|
|
25
|
+
"documentId": null,
|
|
26
|
+
"documentVersionId": null,
|
|
27
|
+
"workflowId": null,
|
|
28
|
+
"skipped": null,
|
|
29
|
+
"error": null,
|
|
30
|
+
} satisfies ZipFileResult
|
|
31
|
+
|
|
32
|
+
console.log(example)
|
|
33
|
+
|
|
34
|
+
// Convert the instance to a JSON string
|
|
35
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
36
|
+
console.log(exampleJSON)
|
|
37
|
+
|
|
38
|
+
// Parse the JSON string back to an object
|
|
39
|
+
const exampleParsed = JSON.parse(exampleJSON) as ZipFileResult
|
|
40
|
+
console.log(exampleParsed)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
44
|
+
|
|
45
|
+
|
package/package.json
CHANGED
package/src/apis/DocumentsApi.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
HTTPValidationError,
|
|
26
26
|
ImageTaxonomy,
|
|
27
27
|
IngestDocumentResponse,
|
|
28
|
+
IngestZipResponse,
|
|
28
29
|
IngestionMode,
|
|
29
30
|
PaginatedResponseDocumentResponse,
|
|
30
31
|
PathOrder,
|
|
@@ -52,6 +53,8 @@ import {
|
|
|
52
53
|
ImageTaxonomyToJSON,
|
|
53
54
|
IngestDocumentResponseFromJSON,
|
|
54
55
|
IngestDocumentResponseToJSON,
|
|
56
|
+
IngestZipResponseFromJSON,
|
|
57
|
+
IngestZipResponseToJSON,
|
|
55
58
|
IngestionModeFromJSON,
|
|
56
59
|
IngestionModeToJSON,
|
|
57
60
|
PaginatedResponseDocumentResponseFromJSON,
|
|
@@ -105,6 +108,12 @@ export interface IngestDocumentVersionRequest {
|
|
|
105
108
|
workflowDefinitionId?: string | null;
|
|
106
109
|
}
|
|
107
110
|
|
|
111
|
+
export interface IngestZipRequest {
|
|
112
|
+
file: Blob;
|
|
113
|
+
pathPartId: string;
|
|
114
|
+
ingestionMode?: IngestionMode;
|
|
115
|
+
}
|
|
116
|
+
|
|
108
117
|
export interface ListDocumentsRequest {
|
|
109
118
|
parentPathPartId?: string | null;
|
|
110
119
|
sortOrder?: PathOrder;
|
|
@@ -309,6 +318,34 @@ export interface DocumentsApiInterface {
|
|
|
309
318
|
*/
|
|
310
319
|
ingestDocumentVersion(requestParameters: IngestDocumentVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestDocumentResponse>;
|
|
311
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Creates request options for ingestZip without sending the request
|
|
323
|
+
* @param {Blob} file
|
|
324
|
+
* @param {string} pathPartId Parent path part ID (must be a FOLDER type)
|
|
325
|
+
* @param {IngestionMode} [ingestionMode]
|
|
326
|
+
* @throws {RequiredError}
|
|
327
|
+
* @memberof DocumentsApiInterface
|
|
328
|
+
*/
|
|
329
|
+
ingestZipRequestOpts(requestParameters: IngestZipRequest): Promise<runtime.RequestOpts>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Upload a ZIP archive and ingest each member file individually. Directory structure inside the ZIP is preserved as FOLDER PathParts under the target folder. Returns 202 with per-file outcomes — each file that ingests successfully has its own Temporal workflow ID to poll for status. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes. Per-file failures (unsupported type, oversized) are included in the response with ``error`` set; other files continue processing.
|
|
333
|
+
* @summary Ingest Zip Handler
|
|
334
|
+
* @param {Blob} file
|
|
335
|
+
* @param {string} pathPartId Parent path part ID (must be a FOLDER type)
|
|
336
|
+
* @param {IngestionMode} [ingestionMode]
|
|
337
|
+
* @param {*} [options] Override http request option.
|
|
338
|
+
* @throws {RequiredError}
|
|
339
|
+
* @memberof DocumentsApiInterface
|
|
340
|
+
*/
|
|
341
|
+
ingestZipRaw(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestZipResponse>>;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Upload a ZIP archive and ingest each member file individually. Directory structure inside the ZIP is preserved as FOLDER PathParts under the target folder. Returns 202 with per-file outcomes — each file that ingests successfully has its own Temporal workflow ID to poll for status. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes. Per-file failures (unsupported type, oversized) are included in the response with ``error`` set; other files continue processing.
|
|
345
|
+
* Ingest Zip Handler
|
|
346
|
+
*/
|
|
347
|
+
ingestZip(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestZipResponse>;
|
|
348
|
+
|
|
312
349
|
/**
|
|
313
350
|
* Creates request options for listDocuments without sending the request
|
|
314
351
|
* @param {string} [parentPathPartId] Parent PathPart ID (defaults to root)
|
|
@@ -836,6 +873,96 @@ export class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterfa
|
|
|
836
873
|
return await response.value();
|
|
837
874
|
}
|
|
838
875
|
|
|
876
|
+
/**
|
|
877
|
+
* Creates request options for ingestZip without sending the request
|
|
878
|
+
*/
|
|
879
|
+
async ingestZipRequestOpts(requestParameters: IngestZipRequest): Promise<runtime.RequestOpts> {
|
|
880
|
+
if (requestParameters['file'] == null) {
|
|
881
|
+
throw new runtime.RequiredError(
|
|
882
|
+
'file',
|
|
883
|
+
'Required parameter "file" was null or undefined when calling ingestZip().'
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
if (requestParameters['pathPartId'] == null) {
|
|
888
|
+
throw new runtime.RequiredError(
|
|
889
|
+
'pathPartId',
|
|
890
|
+
'Required parameter "pathPartId" was null or undefined when calling ingestZip().'
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
const queryParameters: any = {};
|
|
895
|
+
|
|
896
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
897
|
+
|
|
898
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
899
|
+
const token = this.configuration.accessToken;
|
|
900
|
+
const tokenString = await token("bearerAuth", []);
|
|
901
|
+
|
|
902
|
+
if (tokenString) {
|
|
903
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
const consumes: runtime.Consume[] = [
|
|
907
|
+
{ contentType: 'multipart/form-data' },
|
|
908
|
+
];
|
|
909
|
+
// @ts-ignore: canConsumeForm may be unused
|
|
910
|
+
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
911
|
+
|
|
912
|
+
let formParams: { append(param: string, value: any): any };
|
|
913
|
+
let useForm = false;
|
|
914
|
+
// use FormData to transmit files using content-type "multipart/form-data"
|
|
915
|
+
useForm = canConsumeForm;
|
|
916
|
+
if (useForm) {
|
|
917
|
+
formParams = new FormData();
|
|
918
|
+
} else {
|
|
919
|
+
formParams = new URLSearchParams();
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
if (requestParameters['file'] != null) {
|
|
923
|
+
formParams.append('file', requestParameters['file'] as any);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
if (requestParameters['pathPartId'] != null) {
|
|
927
|
+
formParams.append('path_part_id', requestParameters['pathPartId'] as any);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
if (requestParameters['ingestionMode'] != null) {
|
|
931
|
+
formParams.append('ingestion_mode', requestParameters['ingestionMode'] as any);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
let urlPath = `/v1/documents/ingest-zip`;
|
|
936
|
+
|
|
937
|
+
return {
|
|
938
|
+
path: urlPath,
|
|
939
|
+
method: 'POST',
|
|
940
|
+
headers: headerParameters,
|
|
941
|
+
query: queryParameters,
|
|
942
|
+
body: formParams,
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Upload a ZIP archive and ingest each member file individually. Directory structure inside the ZIP is preserved as FOLDER PathParts under the target folder. Returns 202 with per-file outcomes — each file that ingests successfully has its own Temporal workflow ID to poll for status. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes. Per-file failures (unsupported type, oversized) are included in the response with ``error`` set; other files continue processing.
|
|
948
|
+
* Ingest Zip Handler
|
|
949
|
+
*/
|
|
950
|
+
async ingestZipRaw(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestZipResponse>> {
|
|
951
|
+
const requestOptions = await this.ingestZipRequestOpts(requestParameters);
|
|
952
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
953
|
+
|
|
954
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => IngestZipResponseFromJSON(jsonValue));
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Upload a ZIP archive and ingest each member file individually. Directory structure inside the ZIP is preserved as FOLDER PathParts under the target folder. Returns 202 with per-file outcomes — each file that ingests successfully has its own Temporal workflow ID to poll for status. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes. Per-file failures (unsupported type, oversized) are included in the response with ``error`` set; other files continue processing.
|
|
959
|
+
* Ingest Zip Handler
|
|
960
|
+
*/
|
|
961
|
+
async ingestZip(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestZipResponse> {
|
|
962
|
+
const response = await this.ingestZipRaw(requestParameters, initOverrides);
|
|
963
|
+
return await response.value();
|
|
964
|
+
}
|
|
965
|
+
|
|
839
966
|
/**
|
|
840
967
|
* Creates request options for listDocuments without sending the request
|
|
841
968
|
*/
|
|
@@ -77,6 +77,12 @@ export interface ChunkContentItem {
|
|
|
77
77
|
* @memberof ChunkContentItem
|
|
78
78
|
*/
|
|
79
79
|
depth: number;
|
|
80
|
+
/**
|
|
81
|
+
* 0-based ordinal of this chunk, counting CHUNK rows in DFS order from the traversal root. Usable directly as a read start/end coordinate. Null on endpoints that do not compute traversal ordinals.
|
|
82
|
+
* @type {number}
|
|
83
|
+
* @memberof ChunkContentItem
|
|
84
|
+
*/
|
|
85
|
+
chunkStartIndex?: number | null;
|
|
80
86
|
/**
|
|
81
87
|
* Chunk content
|
|
82
88
|
* @type {string}
|
|
@@ -188,6 +194,7 @@ export function ChunkContentItemFromJSONTyped(json: any, ignoreDiscriminator: bo
|
|
|
188
194
|
'parentPathId': json['parent_path_id'],
|
|
189
195
|
'metadataObjId': json['metadata_obj_id'],
|
|
190
196
|
'depth': json['depth'],
|
|
197
|
+
'chunkStartIndex': json['chunk_start_index'] == null ? undefined : json['chunk_start_index'],
|
|
191
198
|
'content': json['content'] == null ? undefined : json['content'],
|
|
192
199
|
'chunkType': json['chunk_type'] == null ? undefined : ChunkTypeFromJSON(json['chunk_type']),
|
|
193
200
|
'chunkMetadata': json['chunk_metadata'] == null ? undefined : ChunkMetadataFromJSON(json['chunk_metadata']),
|
|
@@ -216,6 +223,7 @@ export function ChunkContentItemToJSONTyped(value?: ChunkContentItem | null, ign
|
|
|
216
223
|
'parent_path_id': value['parentPathId'],
|
|
217
224
|
'metadata_obj_id': value['metadataObjId'],
|
|
218
225
|
'depth': value['depth'],
|
|
226
|
+
'chunk_start_index': value['chunkStartIndex'],
|
|
219
227
|
'content': value['content'],
|
|
220
228
|
'chunk_type': ChunkTypeToJSON(value['chunkType']),
|
|
221
229
|
'chunk_metadata': ChunkMetadataToJSON(value['chunkMetadata']),
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Knowledge Stack API
|
|
5
|
+
* Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
|
|
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 { ZipFileResult } from './ZipFileResult';
|
|
17
|
+
import {
|
|
18
|
+
ZipFileResultFromJSON,
|
|
19
|
+
ZipFileResultFromJSONTyped,
|
|
20
|
+
ZipFileResultToJSON,
|
|
21
|
+
ZipFileResultToJSONTyped,
|
|
22
|
+
} from './ZipFileResult';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Aggregate response from a ZIP ingestion batch.
|
|
26
|
+
* @export
|
|
27
|
+
* @interface IngestZipResponse
|
|
28
|
+
*/
|
|
29
|
+
export interface IngestZipResponse {
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {Array<ZipFileResult>}
|
|
33
|
+
* @memberof IngestZipResponse
|
|
34
|
+
*/
|
|
35
|
+
files: Array<ZipFileResult>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @memberof IngestZipResponse
|
|
40
|
+
*/
|
|
41
|
+
totalFound: number;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @memberof IngestZipResponse
|
|
46
|
+
*/
|
|
47
|
+
succeeded: number;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @type {number}
|
|
51
|
+
* @memberof IngestZipResponse
|
|
52
|
+
*/
|
|
53
|
+
skipped: number;
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @type {number}
|
|
57
|
+
* @memberof IngestZipResponse
|
|
58
|
+
*/
|
|
59
|
+
failed: number;
|
|
60
|
+
}
|
|
61
|
+
export const IngestZipResponsePropertyValidationAttributesMap: {
|
|
62
|
+
[property: string]: {
|
|
63
|
+
maxLength?: number,
|
|
64
|
+
minLength?: number,
|
|
65
|
+
pattern?: string,
|
|
66
|
+
maximum?: number,
|
|
67
|
+
exclusiveMaximum?: boolean,
|
|
68
|
+
minimum?: number,
|
|
69
|
+
exclusiveMinimum?: boolean,
|
|
70
|
+
multipleOf?: number,
|
|
71
|
+
maxItems?: number,
|
|
72
|
+
minItems?: number,
|
|
73
|
+
uniqueItems?: boolean
|
|
74
|
+
}
|
|
75
|
+
} = {
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check if a given object implements the IngestZipResponse interface.
|
|
81
|
+
*/
|
|
82
|
+
export function instanceOfIngestZipResponse(value: object): value is IngestZipResponse {
|
|
83
|
+
if (!('files' in value) || value['files'] === undefined) return false;
|
|
84
|
+
if (!('totalFound' in value) || value['totalFound'] === undefined) return false;
|
|
85
|
+
if (!('succeeded' in value) || value['succeeded'] === undefined) return false;
|
|
86
|
+
if (!('skipped' in value) || value['skipped'] === undefined) return false;
|
|
87
|
+
if (!('failed' in value) || value['failed'] === undefined) return false;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function IngestZipResponseFromJSON(json: any): IngestZipResponse {
|
|
92
|
+
return IngestZipResponseFromJSONTyped(json, false);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function IngestZipResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): IngestZipResponse {
|
|
96
|
+
if (json == null) {
|
|
97
|
+
return json;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
|
|
101
|
+
'files': ((json['files'] as Array<any>).map(ZipFileResultFromJSON)),
|
|
102
|
+
'totalFound': json['total_found'],
|
|
103
|
+
'succeeded': json['succeeded'],
|
|
104
|
+
'skipped': json['skipped'],
|
|
105
|
+
'failed': json['failed'],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function IngestZipResponseToJSON(json: any): IngestZipResponse {
|
|
110
|
+
return IngestZipResponseToJSONTyped(json, false);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function IngestZipResponseToJSONTyped(value?: IngestZipResponse | null, ignoreDiscriminator: boolean = false): any {
|
|
114
|
+
if (value == null) {
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
|
|
120
|
+
'files': ((value['files'] as Array<any>).map(ZipFileResultToJSON)),
|
|
121
|
+
'total_found': value['totalFound'],
|
|
122
|
+
'succeeded': value['succeeded'],
|
|
123
|
+
'skipped': value['skipped'],
|
|
124
|
+
'failed': value['failed'],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
@@ -63,6 +63,18 @@ export interface SectionContentItem {
|
|
|
63
63
|
* @memberof SectionContentItem
|
|
64
64
|
*/
|
|
65
65
|
depth: number;
|
|
66
|
+
/**
|
|
67
|
+
* 0-based ordinal of the first chunk in this section's subtree, counting CHUNK rows in DFS order from the traversal root. Null when the section has no chunk anywhere below it, and on endpoints that do not compute traversal ordinals.
|
|
68
|
+
* @type {number}
|
|
69
|
+
* @memberof SectionContentItem
|
|
70
|
+
*/
|
|
71
|
+
chunkStartIndex?: number | null;
|
|
72
|
+
/**
|
|
73
|
+
* 0-based ordinal of the last chunk in this section's subtree, inclusive. Chunks outside the section — a later sibling, or a chunk attached to an ancestor — are excluded, so the span covers only this section's own content. Null under the same conditions as chunk_start_index.
|
|
74
|
+
* @type {number}
|
|
75
|
+
* @memberof SectionContentItem
|
|
76
|
+
*/
|
|
77
|
+
chunkEndIndex?: number | null;
|
|
66
78
|
/**
|
|
67
79
|
* Section page number
|
|
68
80
|
* @type {number}
|
|
@@ -162,6 +174,8 @@ export function SectionContentItemFromJSONTyped(json: any, ignoreDiscriminator:
|
|
|
162
174
|
'parentPathId': json['parent_path_id'],
|
|
163
175
|
'metadataObjId': json['metadata_obj_id'],
|
|
164
176
|
'depth': json['depth'],
|
|
177
|
+
'chunkStartIndex': json['chunk_start_index'] == null ? undefined : json['chunk_start_index'],
|
|
178
|
+
'chunkEndIndex': json['chunk_end_index'] == null ? undefined : json['chunk_end_index'],
|
|
165
179
|
'pageNumber': json['page_number'] == null ? undefined : json['page_number'],
|
|
166
180
|
'materializedPath': json['materialized_path'],
|
|
167
181
|
'systemManaged': json['system_managed'],
|
|
@@ -188,6 +202,8 @@ export function SectionContentItemToJSONTyped(value?: SectionContentItem | null,
|
|
|
188
202
|
'parent_path_id': value['parentPathId'],
|
|
189
203
|
'metadata_obj_id': value['metadataObjId'],
|
|
190
204
|
'depth': value['depth'],
|
|
205
|
+
'chunk_start_index': value['chunkStartIndex'],
|
|
206
|
+
'chunk_end_index': value['chunkEndIndex'],
|
|
191
207
|
'page_number': value['pageNumber'],
|
|
192
208
|
'materialized_path': value['materializedPath'],
|
|
193
209
|
'system_managed': value['systemManaged'],
|