@knowledge-stack/ksapi 1.146.0 → 1.147.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.
- 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/IngestZipResponse.d.ts +72 -0
- package/dist/esm/models/IngestZipResponse.js +61 -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/IngestZipResponse.d.ts +72 -0
- package/dist/models/IngestZipResponse.js +69 -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/DocumentsApi.md +82 -0
- package/docs/IngestZipResponse.md +43 -0
- package/docs/ZipFileResult.md +45 -0
- package/package.json +1 -1
- package/src/apis/DocumentsApi.ts +127 -0
- package/src/models/IngestZipResponse.ts +127 -0
- package/src/models/ZipFileResult.ts +123 -0
- package/src/models/index.ts +2 -0
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
export const ZipFileResultPropertyValidationAttributesMap = {};
|
|
15
|
+
/**
|
|
16
|
+
* Check if a given object implements the ZipFileResult interface.
|
|
17
|
+
*/
|
|
18
|
+
export function instanceOfZipFileResult(value) {
|
|
19
|
+
if (!('zipPath' in value) || value['zipPath'] === undefined)
|
|
20
|
+
return false;
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
export function ZipFileResultFromJSON(json) {
|
|
24
|
+
return ZipFileResultFromJSONTyped(json, false);
|
|
25
|
+
}
|
|
26
|
+
export function ZipFileResultFromJSONTyped(json, ignoreDiscriminator) {
|
|
27
|
+
if (json == null) {
|
|
28
|
+
return json;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
'zipPath': json['zip_path'],
|
|
32
|
+
'documentId': json['document_id'] == null ? undefined : json['document_id'],
|
|
33
|
+
'documentVersionId': json['document_version_id'] == null ? undefined : json['document_version_id'],
|
|
34
|
+
'workflowId': json['workflow_id'] == null ? undefined : json['workflow_id'],
|
|
35
|
+
'skipped': json['skipped'] == null ? undefined : json['skipped'],
|
|
36
|
+
'error': json['error'] == null ? undefined : json['error'],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function ZipFileResultToJSON(json) {
|
|
40
|
+
return ZipFileResultToJSONTyped(json, false);
|
|
41
|
+
}
|
|
42
|
+
export function ZipFileResultToJSONTyped(value, ignoreDiscriminator = false) {
|
|
43
|
+
if (value == null) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
'zip_path': value['zipPath'],
|
|
48
|
+
'document_id': value['documentId'],
|
|
49
|
+
'document_version_id': value['documentVersionId'],
|
|
50
|
+
'workflow_id': value['workflowId'],
|
|
51
|
+
'skipped': value['skipped'],
|
|
52
|
+
'error': value['error'],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -139,6 +139,7 @@ export * from './IdpType';
|
|
|
139
139
|
export * from './ImageTaxonomy';
|
|
140
140
|
export * from './InformationStatistics';
|
|
141
141
|
export * from './IngestDocumentResponse';
|
|
142
|
+
export * from './IngestZipResponse';
|
|
142
143
|
export * from './IngestionMode';
|
|
143
144
|
export * from './Input';
|
|
144
145
|
export * from './InputOrigin';
|
|
@@ -357,3 +358,4 @@ export * from './XlsxCellAnchorInput';
|
|
|
357
358
|
export * from './XlsxCellAnchorInputOrDocxParagraphAnchorInput';
|
|
358
359
|
export * from './XlsxCellAnchorOutput';
|
|
359
360
|
export * from './XlsxCellAnchorOutputOrDocxParagraphAnchorOutput';
|
|
361
|
+
export * from './ZipFileResult';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -141,6 +141,7 @@ export * from './IdpType';
|
|
|
141
141
|
export * from './ImageTaxonomy';
|
|
142
142
|
export * from './InformationStatistics';
|
|
143
143
|
export * from './IngestDocumentResponse';
|
|
144
|
+
export * from './IngestZipResponse';
|
|
144
145
|
export * from './IngestionMode';
|
|
145
146
|
export * from './Input';
|
|
146
147
|
export * from './InputOrigin';
|
|
@@ -359,3 +360,4 @@ export * from './XlsxCellAnchorInput';
|
|
|
359
360
|
export * from './XlsxCellAnchorInputOrDocxParagraphAnchorInput';
|
|
360
361
|
export * from './XlsxCellAnchorOutput';
|
|
361
362
|
export * from './XlsxCellAnchorOutputOrDocxParagraphAnchorOutput';
|
|
363
|
+
export * from './ZipFileResult';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Stack API
|
|
3
|
+
* 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.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { ZipFileResult } from './ZipFileResult';
|
|
13
|
+
/**
|
|
14
|
+
* Aggregate response from a ZIP ingestion batch.
|
|
15
|
+
* @export
|
|
16
|
+
* @interface IngestZipResponse
|
|
17
|
+
*/
|
|
18
|
+
export interface IngestZipResponse {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<ZipFileResult>}
|
|
22
|
+
* @memberof IngestZipResponse
|
|
23
|
+
*/
|
|
24
|
+
files: Array<ZipFileResult>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof IngestZipResponse
|
|
29
|
+
*/
|
|
30
|
+
totalFound: number;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {number}
|
|
34
|
+
* @memberof IngestZipResponse
|
|
35
|
+
*/
|
|
36
|
+
succeeded: number;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {number}
|
|
40
|
+
* @memberof IngestZipResponse
|
|
41
|
+
*/
|
|
42
|
+
skipped: number;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @memberof IngestZipResponse
|
|
47
|
+
*/
|
|
48
|
+
failed: number;
|
|
49
|
+
}
|
|
50
|
+
export declare const IngestZipResponsePropertyValidationAttributesMap: {
|
|
51
|
+
[property: string]: {
|
|
52
|
+
maxLength?: number;
|
|
53
|
+
minLength?: number;
|
|
54
|
+
pattern?: string;
|
|
55
|
+
maximum?: number;
|
|
56
|
+
exclusiveMaximum?: boolean;
|
|
57
|
+
minimum?: number;
|
|
58
|
+
exclusiveMinimum?: boolean;
|
|
59
|
+
multipleOf?: number;
|
|
60
|
+
maxItems?: number;
|
|
61
|
+
minItems?: number;
|
|
62
|
+
uniqueItems?: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Check if a given object implements the IngestZipResponse interface.
|
|
67
|
+
*/
|
|
68
|
+
export declare function instanceOfIngestZipResponse(value: object): value is IngestZipResponse;
|
|
69
|
+
export declare function IngestZipResponseFromJSON(json: any): IngestZipResponse;
|
|
70
|
+
export declare function IngestZipResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): IngestZipResponse;
|
|
71
|
+
export declare function IngestZipResponseToJSON(json: any): IngestZipResponse;
|
|
72
|
+
export declare function IngestZipResponseToJSONTyped(value?: IngestZipResponse | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Knowledge Stack API
|
|
6
|
+
* 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.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.1.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.IngestZipResponsePropertyValidationAttributesMap = void 0;
|
|
17
|
+
exports.instanceOfIngestZipResponse = instanceOfIngestZipResponse;
|
|
18
|
+
exports.IngestZipResponseFromJSON = IngestZipResponseFromJSON;
|
|
19
|
+
exports.IngestZipResponseFromJSONTyped = IngestZipResponseFromJSONTyped;
|
|
20
|
+
exports.IngestZipResponseToJSON = IngestZipResponseToJSON;
|
|
21
|
+
exports.IngestZipResponseToJSONTyped = IngestZipResponseToJSONTyped;
|
|
22
|
+
const ZipFileResult_1 = require("./ZipFileResult");
|
|
23
|
+
exports.IngestZipResponsePropertyValidationAttributesMap = {};
|
|
24
|
+
/**
|
|
25
|
+
* Check if a given object implements the IngestZipResponse interface.
|
|
26
|
+
*/
|
|
27
|
+
function instanceOfIngestZipResponse(value) {
|
|
28
|
+
if (!('files' in value) || value['files'] === undefined)
|
|
29
|
+
return false;
|
|
30
|
+
if (!('totalFound' in value) || value['totalFound'] === undefined)
|
|
31
|
+
return false;
|
|
32
|
+
if (!('succeeded' in value) || value['succeeded'] === undefined)
|
|
33
|
+
return false;
|
|
34
|
+
if (!('skipped' in value) || value['skipped'] === undefined)
|
|
35
|
+
return false;
|
|
36
|
+
if (!('failed' in value) || value['failed'] === undefined)
|
|
37
|
+
return false;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
function IngestZipResponseFromJSON(json) {
|
|
41
|
+
return IngestZipResponseFromJSONTyped(json, false);
|
|
42
|
+
}
|
|
43
|
+
function IngestZipResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
44
|
+
if (json == null) {
|
|
45
|
+
return json;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
'files': (json['files'].map(ZipFileResult_1.ZipFileResultFromJSON)),
|
|
49
|
+
'totalFound': json['total_found'],
|
|
50
|
+
'succeeded': json['succeeded'],
|
|
51
|
+
'skipped': json['skipped'],
|
|
52
|
+
'failed': json['failed'],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function IngestZipResponseToJSON(json) {
|
|
56
|
+
return IngestZipResponseToJSONTyped(json, false);
|
|
57
|
+
}
|
|
58
|
+
function IngestZipResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
59
|
+
if (value == null) {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
'files': (value['files'].map(ZipFileResult_1.ZipFileResultToJSON)),
|
|
64
|
+
'total_found': value['totalFound'],
|
|
65
|
+
'succeeded': value['succeeded'],
|
|
66
|
+
'skipped': value['skipped'],
|
|
67
|
+
'failed': value['failed'],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Stack API
|
|
3
|
+
* 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.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Per-file outcome from a ZIP ingestion batch.
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ZipFileResult
|
|
16
|
+
*/
|
|
17
|
+
export interface ZipFileResult {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof ZipFileResult
|
|
22
|
+
*/
|
|
23
|
+
zipPath: string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof ZipFileResult
|
|
28
|
+
*/
|
|
29
|
+
documentId?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof ZipFileResult
|
|
34
|
+
*/
|
|
35
|
+
documentVersionId?: string | null;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof ZipFileResult
|
|
40
|
+
*/
|
|
41
|
+
workflowId?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
* @memberof ZipFileResult
|
|
46
|
+
*/
|
|
47
|
+
skipped?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @type {string}
|
|
51
|
+
* @memberof ZipFileResult
|
|
52
|
+
*/
|
|
53
|
+
error?: string | null;
|
|
54
|
+
}
|
|
55
|
+
export declare const ZipFileResultPropertyValidationAttributesMap: {
|
|
56
|
+
[property: string]: {
|
|
57
|
+
maxLength?: number;
|
|
58
|
+
minLength?: number;
|
|
59
|
+
pattern?: string;
|
|
60
|
+
maximum?: number;
|
|
61
|
+
exclusiveMaximum?: boolean;
|
|
62
|
+
minimum?: number;
|
|
63
|
+
exclusiveMinimum?: boolean;
|
|
64
|
+
multipleOf?: number;
|
|
65
|
+
maxItems?: number;
|
|
66
|
+
minItems?: number;
|
|
67
|
+
uniqueItems?: boolean;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Check if a given object implements the ZipFileResult interface.
|
|
72
|
+
*/
|
|
73
|
+
export declare function instanceOfZipFileResult(value: object): value is ZipFileResult;
|
|
74
|
+
export declare function ZipFileResultFromJSON(json: any): ZipFileResult;
|
|
75
|
+
export declare function ZipFileResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): ZipFileResult;
|
|
76
|
+
export declare function ZipFileResultToJSON(json: any): ZipFileResult;
|
|
77
|
+
export declare function ZipFileResultToJSONTyped(value?: ZipFileResult | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Knowledge Stack API
|
|
6
|
+
* 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.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.1.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ZipFileResultPropertyValidationAttributesMap = void 0;
|
|
17
|
+
exports.instanceOfZipFileResult = instanceOfZipFileResult;
|
|
18
|
+
exports.ZipFileResultFromJSON = ZipFileResultFromJSON;
|
|
19
|
+
exports.ZipFileResultFromJSONTyped = ZipFileResultFromJSONTyped;
|
|
20
|
+
exports.ZipFileResultToJSON = ZipFileResultToJSON;
|
|
21
|
+
exports.ZipFileResultToJSONTyped = ZipFileResultToJSONTyped;
|
|
22
|
+
exports.ZipFileResultPropertyValidationAttributesMap = {};
|
|
23
|
+
/**
|
|
24
|
+
* Check if a given object implements the ZipFileResult interface.
|
|
25
|
+
*/
|
|
26
|
+
function instanceOfZipFileResult(value) {
|
|
27
|
+
if (!('zipPath' in value) || value['zipPath'] === undefined)
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function ZipFileResultFromJSON(json) {
|
|
32
|
+
return ZipFileResultFromJSONTyped(json, false);
|
|
33
|
+
}
|
|
34
|
+
function ZipFileResultFromJSONTyped(json, ignoreDiscriminator) {
|
|
35
|
+
if (json == null) {
|
|
36
|
+
return json;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
'zipPath': json['zip_path'],
|
|
40
|
+
'documentId': json['document_id'] == null ? undefined : json['document_id'],
|
|
41
|
+
'documentVersionId': json['document_version_id'] == null ? undefined : json['document_version_id'],
|
|
42
|
+
'workflowId': json['workflow_id'] == null ? undefined : json['workflow_id'],
|
|
43
|
+
'skipped': json['skipped'] == null ? undefined : json['skipped'],
|
|
44
|
+
'error': json['error'] == null ? undefined : json['error'],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function ZipFileResultToJSON(json) {
|
|
48
|
+
return ZipFileResultToJSONTyped(json, false);
|
|
49
|
+
}
|
|
50
|
+
function ZipFileResultToJSONTyped(value, ignoreDiscriminator = false) {
|
|
51
|
+
if (value == null) {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
'zip_path': value['zipPath'],
|
|
56
|
+
'document_id': value['documentId'],
|
|
57
|
+
'document_version_id': value['documentVersionId'],
|
|
58
|
+
'workflow_id': value['workflowId'],
|
|
59
|
+
'skipped': value['skipped'],
|
|
60
|
+
'error': value['error'],
|
|
61
|
+
};
|
|
62
|
+
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ export * from './IdpType';
|
|
|
139
139
|
export * from './ImageTaxonomy';
|
|
140
140
|
export * from './InformationStatistics';
|
|
141
141
|
export * from './IngestDocumentResponse';
|
|
142
|
+
export * from './IngestZipResponse';
|
|
142
143
|
export * from './IngestionMode';
|
|
143
144
|
export * from './Input';
|
|
144
145
|
export * from './InputOrigin';
|
|
@@ -357,3 +358,4 @@ export * from './XlsxCellAnchorInput';
|
|
|
357
358
|
export * from './XlsxCellAnchorInputOrDocxParagraphAnchorInput';
|
|
358
359
|
export * from './XlsxCellAnchorOutput';
|
|
359
360
|
export * from './XlsxCellAnchorOutputOrDocxParagraphAnchorOutput';
|
|
361
|
+
export * from './ZipFileResult';
|
package/dist/models/index.js
CHANGED
|
@@ -157,6 +157,7 @@ __exportStar(require("./IdpType"), exports);
|
|
|
157
157
|
__exportStar(require("./ImageTaxonomy"), exports);
|
|
158
158
|
__exportStar(require("./InformationStatistics"), exports);
|
|
159
159
|
__exportStar(require("./IngestDocumentResponse"), exports);
|
|
160
|
+
__exportStar(require("./IngestZipResponse"), exports);
|
|
160
161
|
__exportStar(require("./IngestionMode"), exports);
|
|
161
162
|
__exportStar(require("./Input"), exports);
|
|
162
163
|
__exportStar(require("./InputOrigin"), exports);
|
|
@@ -375,3 +376,4 @@ __exportStar(require("./XlsxCellAnchorInput"), exports);
|
|
|
375
376
|
__exportStar(require("./XlsxCellAnchorInputOrDocxParagraphAnchorInput"), exports);
|
|
376
377
|
__exportStar(require("./XlsxCellAnchorOutput"), exports);
|
|
377
378
|
__exportStar(require("./XlsxCellAnchorOutputOrDocxParagraphAnchorOutput"), exports);
|
|
379
|
+
__exportStar(require("./ZipFileResult"), exports);
|
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
|
+
|
|
@@ -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
|
+
|