@knowledge-stack/ksapi 1.149.0 → 1.150.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 +13 -4
- package/dist/apis/DocumentsApi.js +11 -2
- package/dist/apis/SystemJobsApi.d.ts +39 -1
- package/dist/apis/SystemJobsApi.js +48 -0
- package/dist/esm/apis/DocumentsApi.d.ts +13 -4
- package/dist/esm/apis/DocumentsApi.js +11 -2
- package/dist/esm/apis/SystemJobsApi.d.ts +39 -1
- package/dist/esm/apis/SystemJobsApi.js +49 -1
- package/dist/esm/models/DocumentVersionMetadata.d.ts +6 -0
- package/dist/esm/models/DocumentVersionMetadata.js +2 -0
- package/dist/esm/models/IngestZipResponse.d.ts +10 -23
- package/dist/esm/models/IngestZipResponse.js +5 -17
- package/dist/esm/models/ZipIngestionStatusResponse.d.ts +64 -0
- package/dist/esm/models/ZipIngestionStatusResponse.js +53 -0
- package/dist/esm/models/ZipMemberStatusResponse.d.ts +77 -0
- package/dist/esm/models/ZipMemberStatusResponse.js +54 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/models/DocumentVersionMetadata.d.ts +6 -0
- package/dist/models/DocumentVersionMetadata.js +2 -0
- package/dist/models/IngestZipResponse.d.ts +10 -23
- package/dist/models/IngestZipResponse.js +5 -17
- package/dist/models/ZipIngestionStatusResponse.d.ts +64 -0
- package/dist/models/ZipIngestionStatusResponse.js +61 -0
- package/dist/models/ZipMemberStatusResponse.d.ts +77 -0
- package/dist/models/ZipMemberStatusResponse.js +62 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/docs/DocumentVersionMetadata.md +2 -0
- package/docs/DocumentsApi.md +12 -3
- package/docs/IngestZipResponse.md +4 -10
- package/docs/SystemJobsApi.md +76 -0
- package/docs/ZipIngestionStatusResponse.md +39 -0
- package/docs/ZipMemberStatusResponse.md +45 -0
- package/package.json +1 -1
- package/src/apis/DocumentsApi.ts +25 -4
- package/src/apis/SystemJobsApi.ts +86 -0
- package/src/models/DocumentVersionMetadata.ts +8 -0
- package/src/models/IngestZipResponse.ts +15 -37
- package/src/models/ZipIngestionStatusResponse.ts +113 -0
- package/src/models/ZipMemberStatusResponse.ts +123 -0
- package/src/models/index.ts +2 -0
|
@@ -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
|
+
* One member's outcome within a ZIP fan-out (from the workflow query).
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ZipMemberStatusResponse
|
|
16
|
+
*/
|
|
17
|
+
export interface ZipMemberStatusResponse {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof ZipMemberStatusResponse
|
|
22
|
+
*/
|
|
23
|
+
zipPath: string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof ZipMemberStatusResponse
|
|
28
|
+
*/
|
|
29
|
+
documentId?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof ZipMemberStatusResponse
|
|
34
|
+
*/
|
|
35
|
+
documentVersionId?: string | null;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof ZipMemberStatusResponse
|
|
40
|
+
*/
|
|
41
|
+
workflowId?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @memberof ZipMemberStatusResponse
|
|
46
|
+
*/
|
|
47
|
+
error?: string | null;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @type {boolean}
|
|
51
|
+
* @memberof ZipMemberStatusResponse
|
|
52
|
+
*/
|
|
53
|
+
skipped?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const ZipMemberStatusResponsePropertyValidationAttributesMap: {
|
|
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 ZipMemberStatusResponse interface.
|
|
72
|
+
*/
|
|
73
|
+
export declare function instanceOfZipMemberStatusResponse(value: object): value is ZipMemberStatusResponse;
|
|
74
|
+
export declare function ZipMemberStatusResponseFromJSON(json: any): ZipMemberStatusResponse;
|
|
75
|
+
export declare function ZipMemberStatusResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ZipMemberStatusResponse;
|
|
76
|
+
export declare function ZipMemberStatusResponseToJSON(json: any): ZipMemberStatusResponse;
|
|
77
|
+
export declare function ZipMemberStatusResponseToJSONTyped(value?: ZipMemberStatusResponse | 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.ZipMemberStatusResponsePropertyValidationAttributesMap = void 0;
|
|
17
|
+
exports.instanceOfZipMemberStatusResponse = instanceOfZipMemberStatusResponse;
|
|
18
|
+
exports.ZipMemberStatusResponseFromJSON = ZipMemberStatusResponseFromJSON;
|
|
19
|
+
exports.ZipMemberStatusResponseFromJSONTyped = ZipMemberStatusResponseFromJSONTyped;
|
|
20
|
+
exports.ZipMemberStatusResponseToJSON = ZipMemberStatusResponseToJSON;
|
|
21
|
+
exports.ZipMemberStatusResponseToJSONTyped = ZipMemberStatusResponseToJSONTyped;
|
|
22
|
+
exports.ZipMemberStatusResponsePropertyValidationAttributesMap = {};
|
|
23
|
+
/**
|
|
24
|
+
* Check if a given object implements the ZipMemberStatusResponse interface.
|
|
25
|
+
*/
|
|
26
|
+
function instanceOfZipMemberStatusResponse(value) {
|
|
27
|
+
if (!('zipPath' in value) || value['zipPath'] === undefined)
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function ZipMemberStatusResponseFromJSON(json) {
|
|
32
|
+
return ZipMemberStatusResponseFromJSONTyped(json, false);
|
|
33
|
+
}
|
|
34
|
+
function ZipMemberStatusResponseFromJSONTyped(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
|
+
'error': json['error'] == null ? undefined : json['error'],
|
|
44
|
+
'skipped': json['skipped'] == null ? undefined : json['skipped'],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function ZipMemberStatusResponseToJSON(json) {
|
|
48
|
+
return ZipMemberStatusResponseToJSONTyped(json, false);
|
|
49
|
+
}
|
|
50
|
+
function ZipMemberStatusResponseToJSONTyped(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
|
+
'error': value['error'],
|
|
60
|
+
'skipped': value['skipped'],
|
|
61
|
+
};
|
|
62
|
+
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -361,3 +361,5 @@ export * from './XlsxCellAnchorInputOrDocxParagraphAnchorInput';
|
|
|
361
361
|
export * from './XlsxCellAnchorOutput';
|
|
362
362
|
export * from './XlsxCellAnchorOutputOrDocxParagraphAnchorOutput';
|
|
363
363
|
export * from './ZipFileResult';
|
|
364
|
+
export * from './ZipIngestionStatusResponse';
|
|
365
|
+
export * from './ZipMemberStatusResponse';
|
package/dist/models/index.js
CHANGED
|
@@ -379,3 +379,5 @@ __exportStar(require("./XlsxCellAnchorInputOrDocxParagraphAnchorInput"), exports
|
|
|
379
379
|
__exportStar(require("./XlsxCellAnchorOutput"), exports);
|
|
380
380
|
__exportStar(require("./XlsxCellAnchorOutputOrDocxParagraphAnchorOutput"), exports);
|
|
381
381
|
__exportStar(require("./ZipFileResult"), exports);
|
|
382
|
+
__exportStar(require("./ZipIngestionStatusResponse"), exports);
|
|
383
|
+
__exportStar(require("./ZipMemberStatusResponse"), exports);
|
|
@@ -27,6 +27,7 @@ Name | Type
|
|
|
27
27
|
`quotaPageCount` | number
|
|
28
28
|
`quotaIdempotencyKey` | string
|
|
29
29
|
`fileMd5` | string
|
|
30
|
+
`idempotencyKey` | string
|
|
30
31
|
|
|
31
32
|
## Example
|
|
32
33
|
|
|
@@ -55,6 +56,7 @@ const example = {
|
|
|
55
56
|
"quotaPageCount": null,
|
|
56
57
|
"quotaIdempotencyKey": null,
|
|
57
58
|
"fileMd5": null,
|
|
59
|
+
"idempotencyKey": null,
|
|
58
60
|
} satisfies DocumentVersionMetadata
|
|
59
61
|
|
|
60
62
|
console.log(example)
|
package/docs/DocumentsApi.md
CHANGED
|
@@ -322,7 +322,7 @@ example().catch(console.error);
|
|
|
322
322
|
|
|
323
323
|
## ingestDocument
|
|
324
324
|
|
|
325
|
-
> IngestDocumentResponse ingestDocument(file, pathPartId, name, ingestionMode, chunkType, secondaryTaxonomy, pageDpi, workflowRunId, workflowDefinitionId)
|
|
325
|
+
> IngestDocumentResponse ingestDocument(file, pathPartId, name, ingestionMode, chunkType, secondaryTaxonomy, pageDpi, workflowRunId, tagIds, idempotencyKey, workflowDefinitionId)
|
|
326
326
|
|
|
327
327
|
Ingest Document Handler
|
|
328
328
|
|
|
@@ -364,6 +364,10 @@ async function example() {
|
|
|
364
364
|
pageDpi: 56,
|
|
365
365
|
// string | Workflow run context for assumed agent uploads. (optional)
|
|
366
366
|
workflowRunId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
367
|
+
// Array<string> | Tag IDs applied to the created document. (optional)
|
|
368
|
+
tagIds: ...,
|
|
369
|
+
// string | Opt-in key: a repeat with the same key at the same (parent, name) replays the existing document instead of a 409. (optional)
|
|
370
|
+
idempotencyKey: idempotencyKey_example,
|
|
367
371
|
// string | Workflow definition context for assumed agent uploads. (optional)
|
|
368
372
|
workflowDefinitionId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
369
373
|
} satisfies IngestDocumentRequest;
|
|
@@ -393,6 +397,8 @@ example().catch(console.error);
|
|
|
393
397
|
| **secondaryTaxonomy** | `ImageTaxonomy` | | [Optional] [Defaults to `undefined`] [Enum: picture, flowchart] |
|
|
394
398
|
| **pageDpi** | `number` | DPI for PDF page screenshots (default 72, min 36, max 216). | [Optional] [Defaults to `72`] |
|
|
395
399
|
| **workflowRunId** | `string` | Workflow run context for assumed agent uploads. | [Optional] [Defaults to `undefined`] |
|
|
400
|
+
| **tagIds** | `Array<string>` | Tag IDs applied to the created document. | [Optional] |
|
|
401
|
+
| **idempotencyKey** | `string` | Opt-in key: a repeat with the same key at the same (parent, name) replays the existing document instead of a 409. | [Optional] [Defaults to `undefined`] |
|
|
396
402
|
| **workflowDefinitionId** | `string` | Workflow definition context for assumed agent uploads. | [Optional] [Defaults to `undefined`] |
|
|
397
403
|
|
|
398
404
|
### Return type
|
|
@@ -517,11 +523,11 @@ example().catch(console.error);
|
|
|
517
523
|
|
|
518
524
|
## ingestZip
|
|
519
525
|
|
|
520
|
-
> IngestZipResponse ingestZip(file, pathPartId, ingestionMode)
|
|
526
|
+
> IngestZipResponse ingestZip(file, pathPartId, ingestionMode, tagIds)
|
|
521
527
|
|
|
522
528
|
Ingest Zip Handler
|
|
523
529
|
|
|
524
|
-
Upload a ZIP archive
|
|
530
|
+
Upload a ZIP archive; ingest each member asynchronously via a fan-out. The whole archive nests under a single FOLDER named after the ZIP file (``report.zip`` -> ``report/``), with the ZIP\'s directory structure mirrored beneath it as FOLDER PathParts — all created synchronously. Returns 202 with the fan-out ``workflow_id`` (poll ``GET /v1/system-jobs/zip-ingestions/{workflow_id}`` for per-member outcomes) plus the artifacts ``skipped`` during classification. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes; a re-upload whose ZIP-named folder already exists returns 409. Per-member failures (unsupported type, oversized) surface in the polled workflow results, not in this response. Each member reuses the single-file ingest path, so run-enrollment and completion events fire per member there.
|
|
525
531
|
|
|
526
532
|
### Example
|
|
527
533
|
|
|
@@ -549,6 +555,8 @@ async function example() {
|
|
|
549
555
|
pathPartId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
550
556
|
// IngestionMode (optional)
|
|
551
557
|
ingestionMode: ...,
|
|
558
|
+
// Array<string> | Tag IDs applied to every ingested member document. (optional)
|
|
559
|
+
tagIds: ...,
|
|
552
560
|
} satisfies IngestZipRequest;
|
|
553
561
|
|
|
554
562
|
try {
|
|
@@ -571,6 +579,7 @@ example().catch(console.error);
|
|
|
571
579
|
| **file** | `Blob` | | [Defaults to `undefined`] |
|
|
572
580
|
| **pathPartId** | `string` | Parent path part ID (must be a FOLDER type) | [Defaults to `undefined`] |
|
|
573
581
|
| **ingestionMode** | `IngestionMode` | | [Optional] [Defaults to `undefined`] [Enum: high_accuracy, standard, single_chunk] |
|
|
582
|
+
| **tagIds** | `Array<string>` | Tag IDs applied to every ingested member document. | [Optional] |
|
|
574
583
|
|
|
575
584
|
### Return type
|
|
576
585
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# IngestZipResponse
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Response from dispatching a ZIP archive to async ingestion. ``workflow_id`` is the fan-out workflow to poll at ``GET /v1/system-jobs/zip-ingestions/{workflow_id}`` for per-member outcomes; it is None when the archive held no ingestible members. ``skipped`` are the artifact/error entries resolved synchronously during classification.
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
8
8
|
Name | Type
|
|
9
9
|
------------ | -------------
|
|
10
|
-
`
|
|
11
|
-
`
|
|
12
|
-
`succeeded` | number
|
|
13
|
-
`skipped` | number
|
|
14
|
-
`failed` | number
|
|
10
|
+
`workflowId` | string
|
|
11
|
+
`skipped` | [Array<ZipFileResult>](ZipFileResult.md)
|
|
15
12
|
|
|
16
13
|
## Example
|
|
17
14
|
|
|
@@ -20,11 +17,8 @@ import type { IngestZipResponse } from '@knowledge-stack/ksapi'
|
|
|
20
17
|
|
|
21
18
|
// TODO: Update the object below with actual values
|
|
22
19
|
const example = {
|
|
23
|
-
"
|
|
24
|
-
"totalFound": null,
|
|
25
|
-
"succeeded": null,
|
|
20
|
+
"workflowId": null,
|
|
26
21
|
"skipped": null,
|
|
27
|
-
"failed": null,
|
|
28
22
|
} satisfies IngestZipResponse
|
|
29
23
|
|
|
30
24
|
console.log(example)
|
package/docs/SystemJobsApi.md
CHANGED
|
@@ -8,6 +8,7 @@ All URIs are relative to *http://localhost:8000*
|
|
|
8
8
|
| [**dvWorkflowRerun**](SystemJobsApi.md#dvworkflowrerun) | **POST** /v1/system-jobs/document_versions/{workflow_id} | Dv Workflow Rerun Handler |
|
|
9
9
|
| [**getDvWorkflow**](SystemJobsApi.md#getdvworkflow) | **GET** /v1/system-jobs/document_versions/{workflow_id} | Get Dv Workflow Handler |
|
|
10
10
|
| [**getTemporalWorkflowStatus**](SystemJobsApi.md#gettemporalworkflowstatus) | **GET** /v1/system-jobs/{workflow_id} | Get Temporal Workflow Status Handler |
|
|
11
|
+
| [**getZipIngestionStatus**](SystemJobsApi.md#getzipingestionstatus) | **GET** /v1/system-jobs/zip-ingestions/{workflow_id} | Get Zip Ingestion Status Handler |
|
|
11
12
|
| [**listDvWorkflows**](SystemJobsApi.md#listdvworkflows) | **GET** /v1/system-jobs/document_versions | List Dv Workflows Handler |
|
|
12
13
|
|
|
13
14
|
|
|
@@ -312,6 +313,81 @@ example().catch(console.error);
|
|
|
312
313
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
313
314
|
|
|
314
315
|
|
|
316
|
+
## getZipIngestionStatus
|
|
317
|
+
|
|
318
|
+
> ZipIngestionStatusResponse getZipIngestionStatus(workflowId)
|
|
319
|
+
|
|
320
|
+
Get Zip Ingestion Status Handler
|
|
321
|
+
|
|
322
|
+
Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute. The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this returns 404.
|
|
323
|
+
|
|
324
|
+
### Example
|
|
325
|
+
|
|
326
|
+
```ts
|
|
327
|
+
import {
|
|
328
|
+
Configuration,
|
|
329
|
+
SystemJobsApi,
|
|
330
|
+
} from '@knowledge-stack/ksapi';
|
|
331
|
+
import type { GetZipIngestionStatusRequest } from '@knowledge-stack/ksapi';
|
|
332
|
+
|
|
333
|
+
async function example() {
|
|
334
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
335
|
+
const config = new Configuration({
|
|
336
|
+
// To configure API key authorization: cookieAuth
|
|
337
|
+
apiKey: "YOUR API KEY",
|
|
338
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
339
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
340
|
+
});
|
|
341
|
+
const api = new SystemJobsApi(config);
|
|
342
|
+
|
|
343
|
+
const body = {
|
|
344
|
+
// string
|
|
345
|
+
workflowId: workflowId_example,
|
|
346
|
+
} satisfies GetZipIngestionStatusRequest;
|
|
347
|
+
|
|
348
|
+
try {
|
|
349
|
+
const data = await api.getZipIngestionStatus(body);
|
|
350
|
+
console.log(data);
|
|
351
|
+
} catch (error) {
|
|
352
|
+
console.error(error);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Run the test
|
|
357
|
+
example().catch(console.error);
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Parameters
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
| Name | Type | Description | Notes |
|
|
364
|
+
|------------- | ------------- | ------------- | -------------|
|
|
365
|
+
| **workflowId** | `string` | | [Defaults to `undefined`] |
|
|
366
|
+
|
|
367
|
+
### Return type
|
|
368
|
+
|
|
369
|
+
[**ZipIngestionStatusResponse**](ZipIngestionStatusResponse.md)
|
|
370
|
+
|
|
371
|
+
### Authorization
|
|
372
|
+
|
|
373
|
+
[cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
|
|
374
|
+
|
|
375
|
+
### HTTP request headers
|
|
376
|
+
|
|
377
|
+
- **Content-Type**: Not defined
|
|
378
|
+
- **Accept**: `application/json`
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
### HTTP response details
|
|
382
|
+
| Status code | Description | Response headers |
|
|
383
|
+
|-------------|-------------|------------------|
|
|
384
|
+
| **200** | Successful Response | - |
|
|
385
|
+
| **422** | Validation Error | - |
|
|
386
|
+
| **0** | Error response. | - |
|
|
387
|
+
|
|
388
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
389
|
+
|
|
390
|
+
|
|
315
391
|
## listDvWorkflows
|
|
316
392
|
|
|
317
393
|
> PaginatedResponseWorkflowSummaryResponse listDvWorkflows(limit, offset)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# ZipIngestionStatusResponse
|
|
3
|
+
|
|
4
|
+
Status of a ZIP fan-out: live Temporal state + per-member outcomes. ``files`` reflects progress so far — members that have been dispatched (``workflow_id`` set), failed to dispatch (``error`` set), or were skipped as artifacts. Poll until ``temporal_status`` is terminal (e.g. ``COMPLETED``).
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`workflowId` | string
|
|
11
|
+
`temporalStatus` | string
|
|
12
|
+
`files` | [Array<ZipMemberStatusResponse>](ZipMemberStatusResponse.md)
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { ZipIngestionStatusResponse } from '@knowledge-stack/ksapi'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"workflowId": null,
|
|
22
|
+
"temporalStatus": null,
|
|
23
|
+
"files": null,
|
|
24
|
+
} satisfies ZipIngestionStatusResponse
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as ZipIngestionStatusResponse
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# ZipMemberStatusResponse
|
|
3
|
+
|
|
4
|
+
One member\'s outcome within a ZIP fan-out (from the workflow query).
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`zipPath` | string
|
|
11
|
+
`documentId` | string
|
|
12
|
+
`documentVersionId` | string
|
|
13
|
+
`workflowId` | string
|
|
14
|
+
`error` | string
|
|
15
|
+
`skipped` | boolean
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { ZipMemberStatusResponse } 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
|
+
"error": null,
|
|
29
|
+
"skipped": null,
|
|
30
|
+
} satisfies ZipMemberStatusResponse
|
|
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 ZipMemberStatusResponse
|
|
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
|
@@ -94,6 +94,8 @@ export interface IngestDocumentRequest {
|
|
|
94
94
|
secondaryTaxonomy?: ImageTaxonomy;
|
|
95
95
|
pageDpi?: number;
|
|
96
96
|
workflowRunId?: string | null;
|
|
97
|
+
tagIds?: Array<string>;
|
|
98
|
+
idempotencyKey?: string | null;
|
|
97
99
|
workflowDefinitionId?: string | null;
|
|
98
100
|
}
|
|
99
101
|
|
|
@@ -112,6 +114,7 @@ export interface IngestZipRequest {
|
|
|
112
114
|
file: Blob;
|
|
113
115
|
pathPartId: string;
|
|
114
116
|
ingestionMode?: IngestionMode;
|
|
117
|
+
tagIds?: Array<string>;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
export interface ListDocumentsRequest {
|
|
@@ -250,6 +253,8 @@ export interface DocumentsApiInterface {
|
|
|
250
253
|
* @param {ImageTaxonomy} [secondaryTaxonomy]
|
|
251
254
|
* @param {number} [pageDpi] DPI for PDF page screenshots (default 72, min 36, max 216).
|
|
252
255
|
* @param {string} [workflowRunId] Workflow run context for assumed agent uploads.
|
|
256
|
+
* @param {Array<string>} [tagIds] Tag IDs applied to the created document.
|
|
257
|
+
* @param {string} [idempotencyKey] Opt-in key: a repeat with the same key at the same (parent, name) replays the existing document instead of a 409.
|
|
253
258
|
* @param {string} [workflowDefinitionId] Workflow definition context for assumed agent uploads.
|
|
254
259
|
* @throws {RequiredError}
|
|
255
260
|
* @memberof DocumentsApiInterface
|
|
@@ -267,6 +272,8 @@ export interface DocumentsApiInterface {
|
|
|
267
272
|
* @param {ImageTaxonomy} [secondaryTaxonomy]
|
|
268
273
|
* @param {number} [pageDpi] DPI for PDF page screenshots (default 72, min 36, max 216).
|
|
269
274
|
* @param {string} [workflowRunId] Workflow run context for assumed agent uploads.
|
|
275
|
+
* @param {Array<string>} [tagIds] Tag IDs applied to the created document.
|
|
276
|
+
* @param {string} [idempotencyKey] Opt-in key: a repeat with the same key at the same (parent, name) replays the existing document instead of a 409.
|
|
270
277
|
* @param {string} [workflowDefinitionId] Workflow definition context for assumed agent uploads.
|
|
271
278
|
* @param {*} [options] Override http request option.
|
|
272
279
|
* @throws {RequiredError}
|
|
@@ -323,17 +330,19 @@ export interface DocumentsApiInterface {
|
|
|
323
330
|
* @param {Blob} file
|
|
324
331
|
* @param {string} pathPartId Parent path part ID (must be a FOLDER type)
|
|
325
332
|
* @param {IngestionMode} [ingestionMode]
|
|
333
|
+
* @param {Array<string>} [tagIds] Tag IDs applied to every ingested member document.
|
|
326
334
|
* @throws {RequiredError}
|
|
327
335
|
* @memberof DocumentsApiInterface
|
|
328
336
|
*/
|
|
329
337
|
ingestZipRequestOpts(requestParameters: IngestZipRequest): Promise<runtime.RequestOpts>;
|
|
330
338
|
|
|
331
339
|
/**
|
|
332
|
-
* Upload a ZIP archive
|
|
340
|
+
* Upload a ZIP archive; ingest each member asynchronously via a fan-out. The whole archive nests under a single FOLDER named after the ZIP file (``report.zip`` -> ``report/``), with the ZIP\'s directory structure mirrored beneath it as FOLDER PathParts — all created synchronously. Returns 202 with the fan-out ``workflow_id`` (poll ``GET /v1/system-jobs/zip-ingestions/{workflow_id}`` for per-member outcomes) plus the artifacts ``skipped`` during classification. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes; a re-upload whose ZIP-named folder already exists returns 409. Per-member failures (unsupported type, oversized) surface in the polled workflow results, not in this response. Each member reuses the single-file ingest path, so run-enrollment and completion events fire per member there.
|
|
333
341
|
* @summary Ingest Zip Handler
|
|
334
342
|
* @param {Blob} file
|
|
335
343
|
* @param {string} pathPartId Parent path part ID (must be a FOLDER type)
|
|
336
344
|
* @param {IngestionMode} [ingestionMode]
|
|
345
|
+
* @param {Array<string>} [tagIds] Tag IDs applied to every ingested member document.
|
|
337
346
|
* @param {*} [options] Override http request option.
|
|
338
347
|
* @throws {RequiredError}
|
|
339
348
|
* @memberof DocumentsApiInterface
|
|
@@ -341,7 +350,7 @@ export interface DocumentsApiInterface {
|
|
|
341
350
|
ingestZipRaw(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestZipResponse>>;
|
|
342
351
|
|
|
343
352
|
/**
|
|
344
|
-
* Upload a ZIP archive
|
|
353
|
+
* Upload a ZIP archive; ingest each member asynchronously via a fan-out. The whole archive nests under a single FOLDER named after the ZIP file (``report.zip`` -> ``report/``), with the ZIP\'s directory structure mirrored beneath it as FOLDER PathParts — all created synchronously. Returns 202 with the fan-out ``workflow_id`` (poll ``GET /v1/system-jobs/zip-ingestions/{workflow_id}`` for per-member outcomes) plus the artifacts ``skipped`` during classification. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes; a re-upload whose ZIP-named folder already exists returns 409. Per-member failures (unsupported type, oversized) surface in the polled workflow results, not in this response. Each member reuses the single-file ingest path, so run-enrollment and completion events fire per member there.
|
|
345
354
|
* Ingest Zip Handler
|
|
346
355
|
*/
|
|
347
356
|
ingestZip(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestZipResponse>;
|
|
@@ -730,6 +739,14 @@ export class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterfa
|
|
|
730
739
|
formParams.append('workflow_run_id', requestParameters['workflowRunId'] as any);
|
|
731
740
|
}
|
|
732
741
|
|
|
742
|
+
if (requestParameters['tagIds'] != null) {
|
|
743
|
+
formParams.append('tag_ids', requestParameters['tagIds']!.join(runtime.COLLECTION_FORMATS["csv"]));
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (requestParameters['idempotencyKey'] != null) {
|
|
747
|
+
formParams.append('idempotency_key', requestParameters['idempotencyKey'] as any);
|
|
748
|
+
}
|
|
749
|
+
|
|
733
750
|
if (requestParameters['workflowDefinitionId'] != null) {
|
|
734
751
|
formParams.append('workflow_definition_id', requestParameters['workflowDefinitionId'] as any);
|
|
735
752
|
}
|
|
@@ -931,6 +948,10 @@ export class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterfa
|
|
|
931
948
|
formParams.append('ingestion_mode', requestParameters['ingestionMode'] as any);
|
|
932
949
|
}
|
|
933
950
|
|
|
951
|
+
if (requestParameters['tagIds'] != null) {
|
|
952
|
+
formParams.append('tag_ids', requestParameters['tagIds']!.join(runtime.COLLECTION_FORMATS["csv"]));
|
|
953
|
+
}
|
|
954
|
+
|
|
934
955
|
|
|
935
956
|
let urlPath = `/v1/documents/ingest-zip`;
|
|
936
957
|
|
|
@@ -944,7 +965,7 @@ export class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterfa
|
|
|
944
965
|
}
|
|
945
966
|
|
|
946
967
|
/**
|
|
947
|
-
* Upload a ZIP archive
|
|
968
|
+
* Upload a ZIP archive; ingest each member asynchronously via a fan-out. The whole archive nests under a single FOLDER named after the ZIP file (``report.zip`` -> ``report/``), with the ZIP\'s directory structure mirrored beneath it as FOLDER PathParts — all created synchronously. Returns 202 with the fan-out ``workflow_id`` (poll ``GET /v1/system-jobs/zip-ingestions/{workflow_id}`` for per-member outcomes) plus the artifacts ``skipped`` during classification. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes; a re-upload whose ZIP-named folder already exists returns 409. Per-member failures (unsupported type, oversized) surface in the polled workflow results, not in this response. Each member reuses the single-file ingest path, so run-enrollment and completion events fire per member there.
|
|
948
969
|
* Ingest Zip Handler
|
|
949
970
|
*/
|
|
950
971
|
async ingestZipRaw(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestZipResponse>> {
|
|
@@ -955,7 +976,7 @@ export class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterfa
|
|
|
955
976
|
}
|
|
956
977
|
|
|
957
978
|
/**
|
|
958
|
-
* Upload a ZIP archive
|
|
979
|
+
* Upload a ZIP archive; ingest each member asynchronously via a fan-out. The whole archive nests under a single FOLDER named after the ZIP file (``report.zip`` -> ``report/``), with the ZIP\'s directory structure mirrored beneath it as FOLDER PathParts — all created synchronously. Returns 202 with the fan-out ``workflow_id`` (poll ``GET /v1/system-jobs/zip-ingestions/{workflow_id}`` for per-member outcomes) plus the artifacts ``skipped`` during classification. Whole-archive failures (not a ZIP, zip-bomb, >500 files) return 400 before any DB writes; a re-upload whose ZIP-named folder already exists returns 409. Per-member failures (unsupported type, oversized) surface in the polled workflow results, not in this response. Each member reuses the single-file ingest path, so run-enrollment and completion events fire per member there.
|
|
959
980
|
* Ingest Zip Handler
|
|
960
981
|
*/
|
|
961
982
|
async ingestZip(requestParameters: IngestZipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestZipResponse> {
|