@knowledge-stack/ksapi 3.13.0 → 3.14.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.
Files changed (49) hide show
  1. package/.openapi-generator/FILES +4 -0
  2. package/README.md +6 -2
  3. package/dist/apis/DocumentVersionsApi.d.ts +4 -4
  4. package/dist/apis/DocumentVersionsApi.js +2 -2
  5. package/dist/apis/SystemJobsApi.d.ts +126 -17
  6. package/dist/apis/SystemJobsApi.js +137 -8
  7. package/dist/esm/apis/DocumentVersionsApi.d.ts +4 -4
  8. package/dist/esm/apis/DocumentVersionsApi.js +2 -2
  9. package/dist/esm/apis/SystemJobsApi.d.ts +126 -17
  10. package/dist/esm/apis/SystemJobsApi.js +138 -9
  11. package/dist/esm/models/BulkFailureReason.d.ts +3 -0
  12. package/dist/esm/models/BulkFailureReason.js +4 -1
  13. package/dist/esm/models/BulkRerunRequest.d.ts +47 -0
  14. package/dist/esm/models/BulkRerunRequest.js +42 -0
  15. package/dist/esm/models/PaginatedResponseUserInfo.d.ts +66 -0
  16. package/dist/esm/models/PaginatedResponseUserInfo.js +70 -0
  17. package/dist/esm/models/WorkflowDetailResponse.d.ts +26 -1
  18. package/dist/esm/models/WorkflowDetailResponse.js +17 -0
  19. package/dist/esm/models/WorkflowSummaryResponse.d.ts +26 -1
  20. package/dist/esm/models/WorkflowSummaryResponse.js +17 -0
  21. package/dist/esm/models/index.d.ts +2 -0
  22. package/dist/esm/models/index.js +2 -0
  23. package/dist/models/BulkFailureReason.d.ts +3 -0
  24. package/dist/models/BulkFailureReason.js +4 -1
  25. package/dist/models/BulkRerunRequest.d.ts +47 -0
  26. package/dist/models/BulkRerunRequest.js +50 -0
  27. package/dist/models/PaginatedResponseUserInfo.d.ts +66 -0
  28. package/dist/models/PaginatedResponseUserInfo.js +78 -0
  29. package/dist/models/WorkflowDetailResponse.d.ts +26 -1
  30. package/dist/models/WorkflowDetailResponse.js +17 -0
  31. package/dist/models/WorkflowSummaryResponse.d.ts +26 -1
  32. package/dist/models/WorkflowSummaryResponse.js +17 -0
  33. package/dist/models/index.d.ts +2 -0
  34. package/dist/models/index.js +2 -0
  35. package/docs/BulkRerunRequest.md +35 -0
  36. package/docs/DocumentVersionsApi.md +1 -1
  37. package/docs/PaginatedResponseUserInfo.md +40 -0
  38. package/docs/SystemJobsApi.md +190 -5
  39. package/docs/WorkflowDetailResponse.md +8 -0
  40. package/docs/WorkflowSummaryResponse.md +8 -0
  41. package/package.json +1 -1
  42. package/src/apis/DocumentVersionsApi.ts +4 -4
  43. package/src/apis/SystemJobsApi.ts +272 -16
  44. package/src/models/BulkFailureReason.ts +4 -1
  45. package/src/models/BulkRerunRequest.ts +82 -0
  46. package/src/models/PaginatedResponseUserInfo.ts +130 -0
  47. package/src/models/WorkflowDetailResponse.ts +44 -1
  48. package/src/models/WorkflowSummaryResponse.ts +44 -1
  49. package/src/models/index.ts +2 -0
@@ -15,9 +15,14 @@
15
15
 
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
+ BulkOperationResponse,
19
+ BulkRerunRequest,
18
20
  ErrorResponse,
19
21
  HTTPValidationError,
22
+ PaginatedResponseUserInfo,
20
23
  PaginatedResponseWorkflowSummaryResponse,
24
+ PipelineStatus,
25
+ SortDirection,
21
26
  TemporalWorkflowStatusResponse,
22
27
  WorkflowActionResponse,
23
28
  WorkflowCancelResponse,
@@ -25,12 +30,22 @@ import type {
25
30
  ZipIngestionStatusResponse,
26
31
  } from '../models/index';
27
32
  import {
33
+ BulkOperationResponseFromJSON,
34
+ BulkOperationResponseToJSON,
35
+ BulkRerunRequestFromJSON,
36
+ BulkRerunRequestToJSON,
28
37
  ErrorResponseFromJSON,
29
38
  ErrorResponseToJSON,
30
39
  HTTPValidationErrorFromJSON,
31
40
  HTTPValidationErrorToJSON,
41
+ PaginatedResponseUserInfoFromJSON,
42
+ PaginatedResponseUserInfoToJSON,
32
43
  PaginatedResponseWorkflowSummaryResponseFromJSON,
33
44
  PaginatedResponseWorkflowSummaryResponseToJSON,
45
+ PipelineStatusFromJSON,
46
+ PipelineStatusToJSON,
47
+ SortDirectionFromJSON,
48
+ SortDirectionToJSON,
34
49
  TemporalWorkflowStatusResponseFromJSON,
35
50
  TemporalWorkflowStatusResponseToJSON,
36
51
  WorkflowActionResponseFromJSON,
@@ -43,6 +58,10 @@ import {
43
58
  ZipIngestionStatusResponseToJSON,
44
59
  } from '../models/index';
45
60
 
61
+ export interface BulkRerunDvWorkflowsRequest {
62
+ bulkRerunRequest: BulkRerunRequest;
63
+ }
64
+
46
65
  export interface CancelTemporalWorkflowRequest {
47
66
  workflowId: string;
48
67
  }
@@ -63,9 +82,24 @@ export interface GetZipIngestionStatusRequest {
63
82
  workflowId: string;
64
83
  }
65
84
 
85
+ export interface ListDvWorkflowUploadersRequest {
86
+ usernameLike?: string | null;
87
+ limit?: number;
88
+ offset?: number;
89
+ }
90
+
66
91
  export interface ListDvWorkflowsRequest {
67
92
  limit?: number;
68
93
  offset?: number;
94
+ sortDir?: SortDirection;
95
+ status?: Array<PipelineStatus> | null;
96
+ nameLike?: string | null;
97
+ latestVersionOnly?: boolean;
98
+ uploaderUserId?: string | null;
99
+ createdAfter?: Date | null;
100
+ createdBefore?: Date | null;
101
+ updatedAfter?: Date | null;
102
+ updatedBefore?: Date | null;
69
103
  }
70
104
 
71
105
  /**
@@ -75,6 +109,30 @@ export interface ListDvWorkflowsRequest {
75
109
  * @interface SystemJobsApiInterface
76
110
  */
77
111
  export interface SystemJobsApiInterface {
112
+ /**
113
+ * Creates request options for bulkRerunDvWorkflows without sending the request
114
+ * @param {BulkRerunRequest} bulkRerunRequest
115
+ * @throws {RequiredError}
116
+ * @memberof SystemJobsApiInterface
117
+ */
118
+ bulkRerunDvWorkflowsRequestOpts(requestParameters: BulkRerunDvWorkflowsRequest): Promise<runtime.RequestOpts>;
119
+
120
+ /**
121
+ * Re-run ingestion for the selected document versions, reporting per item. ``not_found``: missing, trashed, never ingested or without its stored source; ``forbidden``: no ``can_write``; ``in_progress_workflow``: still pending/processing; ``already_ingested``: completed; ``unsupported_document_type``: a type that is no longer ingested; ``superseded``: a newer version of the document exists. More than 200 ids is a 400 before any re-run.
122
+ * @summary Bulk Rerun Dv Workflows Handler
123
+ * @param {BulkRerunRequest} bulkRerunRequest
124
+ * @param {*} [options] Override http request option.
125
+ * @throws {RequiredError}
126
+ * @memberof SystemJobsApiInterface
127
+ */
128
+ bulkRerunDvWorkflowsRaw(requestParameters: BulkRerunDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>>;
129
+
130
+ /**
131
+ * Re-run ingestion for the selected document versions, reporting per item. ``not_found``: missing, trashed, never ingested or without its stored source; ``forbidden``: no ``can_write``; ``in_progress_workflow``: still pending/processing; ``already_ingested``: completed; ``unsupported_document_type``: a type that is no longer ingested; ``superseded``: a newer version of the document exists. More than 200 ids is a 400 before any re-run.
132
+ * Bulk Rerun Dv Workflows Handler
133
+ */
134
+ bulkRerunDvWorkflows(requestParameters: BulkRerunDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse>;
135
+
78
136
  /**
79
137
  * Creates request options for cancelTemporalWorkflow without sending the request
80
138
  * @param {string} workflowId
@@ -84,7 +142,7 @@ export interface SystemJobsApiInterface {
84
142
  cancelTemporalWorkflowRequestOpts(requestParameters: CancelTemporalWorkflowRequest): Promise<runtime.RequestOpts>;
85
143
 
86
144
  /**
87
- * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side.
145
+ * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side. A run no worker ever picked up is terminated instead, since a cancel request is itself a workflow task nobody would process. When Temporal no longer has the run, or it was terminated here, a document version still showing it running is settled as cancelled (needs ``can_write``) so it can be re-run.
88
146
  * @summary Cancel Temporal Workflow Handler
89
147
  * @param {string} workflowId
90
148
  * @param {*} [options] Override http request option.
@@ -94,7 +152,7 @@ export interface SystemJobsApiInterface {
94
152
  cancelTemporalWorkflowRaw(requestParameters: CancelTemporalWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowCancelResponse>>;
95
153
 
96
154
  /**
97
- * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side.
155
+ * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side. A run no worker ever picked up is terminated instead, since a cancel request is itself a workflow task nobody would process. When Temporal no longer has the run, or it was terminated here, a document version still showing it running is settled as cancelled (needs ``can_write``) so it can be re-run.
98
156
  * Cancel Temporal Workflow Handler
99
157
  */
100
158
  cancelTemporalWorkflow(requestParameters: CancelTemporalWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowCancelResponse>;
@@ -108,7 +166,7 @@ export interface SystemJobsApiInterface {
108
166
  dvWorkflowRerunRequestOpts(requestParameters: DvWorkflowRerunRequest): Promise<runtime.RequestOpts>;
109
167
 
110
168
  /**
111
- * Rerun a workflow. USER role requires ``can_write`` on the document path. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
169
+ * Rerun a workflow. USER role requires ``can_write`` on the document path. A version that a newer live version supersedes is refused with 409. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
112
170
  * @summary Dv Workflow Rerun Handler
113
171
  * @param {string} workflowId
114
172
  * @param {*} [options] Override http request option.
@@ -118,7 +176,7 @@ export interface SystemJobsApiInterface {
118
176
  dvWorkflowRerunRaw(requestParameters: DvWorkflowRerunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowActionResponse>>;
119
177
 
120
178
  /**
121
- * Rerun a workflow. USER role requires ``can_write`` on the document path. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
179
+ * Rerun a workflow. USER role requires ``can_write`` on the document path. A version that a newer live version supersedes is refused with 409. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
122
180
  * Dv Workflow Rerun Handler
123
181
  */
124
182
  dvWorkflowRerun(requestParameters: DvWorkflowRerunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowActionResponse>;
@@ -180,7 +238,7 @@ export interface SystemJobsApiInterface {
180
238
  getZipIngestionStatusRequestOpts(requestParameters: GetZipIngestionStatusRequest): Promise<runtime.RequestOpts>;
181
239
 
182
240
  /**
183
- * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s.
241
+ * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s. Any other workflow type has no ``results`` query and is a 404, not a 500.
184
242
  * @summary Get Zip Ingestion Status Handler
185
243
  * @param {string} workflowId
186
244
  * @param {*} [options] Override http request option.
@@ -190,25 +248,71 @@ export interface SystemJobsApiInterface {
190
248
  getZipIngestionStatusRaw(requestParameters: GetZipIngestionStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ZipIngestionStatusResponse>>;
191
249
 
192
250
  /**
193
- * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s.
251
+ * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s. Any other workflow type has no ``results`` query and is a 404, not a 500.
194
252
  * Get Zip Ingestion Status Handler
195
253
  */
196
254
  getZipIngestionStatus(requestParameters: GetZipIngestionStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ZipIngestionStatusResponse>;
197
255
 
256
+ /**
257
+ * Creates request options for listDvWorkflowUploaders without sending the request
258
+ * @param {string} [usernameLike] Case-insensitive substring of the first or last name
259
+ * @param {number} [limit] Number of items per page
260
+ * @param {number} [offset] Number of items to skip
261
+ * @throws {RequiredError}
262
+ * @memberof SystemJobsApiInterface
263
+ */
264
+ listDvWorkflowUploadersRequestOpts(requestParameters: ListDvWorkflowUploadersRequest): Promise<runtime.RequestOpts>;
265
+
266
+ /**
267
+ * People who uploaded a version the caller can list, for the uploader filter. Scoped like ``list_dv_workflows``: USER only counts versions under readable paths.
268
+ * @summary List Dv Workflow Uploaders Handler
269
+ * @param {string} [usernameLike] Case-insensitive substring of the first or last name
270
+ * @param {number} [limit] Number of items per page
271
+ * @param {number} [offset] Number of items to skip
272
+ * @param {*} [options] Override http request option.
273
+ * @throws {RequiredError}
274
+ * @memberof SystemJobsApiInterface
275
+ */
276
+ listDvWorkflowUploadersRaw(requestParameters: ListDvWorkflowUploadersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseUserInfo>>;
277
+
278
+ /**
279
+ * People who uploaded a version the caller can list, for the uploader filter. Scoped like ``list_dv_workflows``: USER only counts versions under readable paths.
280
+ * List Dv Workflow Uploaders Handler
281
+ */
282
+ listDvWorkflowUploaders(requestParameters: ListDvWorkflowUploadersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseUserInfo>;
283
+
198
284
  /**
199
285
  * Creates request options for listDvWorkflows without sending the request
200
286
  * @param {number} [limit] Number of items per page
201
287
  * @param {number} [offset] Number of items to skip
288
+ * @param {SortDirection} [sortDir] Sort direction (ASC or DESC); overrides the field\&#39;s natural default. Every sort field supports both directions.
289
+ * @param {Array<PipelineStatus>} [status] Only versions in one of these pipeline statuses
290
+ * @param {string} [nameLike] Case-insensitive substring filter on document name
291
+ * @param {boolean} [latestVersionOnly] Skip versions superseded by a newer version
292
+ * @param {string} [uploaderUserId] Filter to versions uploaded by this user
293
+ * @param {Date} [createdAfter] Only items created at or after this timestamp (inclusive)
294
+ * @param {Date} [createdBefore] Only items created strictly before this timestamp
295
+ * @param {Date} [updatedAfter] Only items updated at or after this timestamp (inclusive)
296
+ * @param {Date} [updatedBefore] Only items updated strictly before this timestamp
202
297
  * @throws {RequiredError}
203
298
  * @memberof SystemJobsApiInterface
204
299
  */
205
300
  listDvWorkflowsRequestOpts(requestParameters: ListDvWorkflowsRequest): Promise<runtime.RequestOpts>;
206
301
 
207
302
  /**
208
- * List all workflows for the current tenant (paginated, DB-backed). ADMIN/OWNER see all workflows; USER sees only those under permitted paths.
303
+ * List ingestions of live documents in the current tenant, newest upload first. ADMIN/OWNER see every version; USER only versions under readable paths. ``sort_dir=ASC`` lists the oldest upload first.
209
304
  * @summary List Dv Workflows Handler
210
305
  * @param {number} [limit] Number of items per page
211
306
  * @param {number} [offset] Number of items to skip
307
+ * @param {SortDirection} [sortDir] Sort direction (ASC or DESC); overrides the field\&#39;s natural default. Every sort field supports both directions.
308
+ * @param {Array<PipelineStatus>} [status] Only versions in one of these pipeline statuses
309
+ * @param {string} [nameLike] Case-insensitive substring filter on document name
310
+ * @param {boolean} [latestVersionOnly] Skip versions superseded by a newer version
311
+ * @param {string} [uploaderUserId] Filter to versions uploaded by this user
312
+ * @param {Date} [createdAfter] Only items created at or after this timestamp (inclusive)
313
+ * @param {Date} [createdBefore] Only items created strictly before this timestamp
314
+ * @param {Date} [updatedAfter] Only items updated at or after this timestamp (inclusive)
315
+ * @param {Date} [updatedBefore] Only items updated strictly before this timestamp
212
316
  * @param {*} [options] Override http request option.
213
317
  * @throws {RequiredError}
214
318
  * @memberof SystemJobsApiInterface
@@ -216,7 +320,7 @@ export interface SystemJobsApiInterface {
216
320
  listDvWorkflowsRaw(requestParameters: ListDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseWorkflowSummaryResponse>>;
217
321
 
218
322
  /**
219
- * List all workflows for the current tenant (paginated, DB-backed). ADMIN/OWNER see all workflows; USER sees only those under permitted paths.
323
+ * List ingestions of live documents in the current tenant, newest upload first. ADMIN/OWNER see every version; USER only versions under readable paths. ``sort_dir=ASC`` lists the oldest upload first.
220
324
  * List Dv Workflows Handler
221
325
  */
222
326
  listDvWorkflows(requestParameters: ListDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseWorkflowSummaryResponse>;
@@ -228,6 +332,63 @@ export interface SystemJobsApiInterface {
228
332
  */
229
333
  export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInterface {
230
334
 
335
+ /**
336
+ * Creates request options for bulkRerunDvWorkflows without sending the request
337
+ */
338
+ async bulkRerunDvWorkflowsRequestOpts(requestParameters: BulkRerunDvWorkflowsRequest): Promise<runtime.RequestOpts> {
339
+ if (requestParameters['bulkRerunRequest'] == null) {
340
+ throw new runtime.RequiredError(
341
+ 'bulkRerunRequest',
342
+ 'Required parameter "bulkRerunRequest" was null or undefined when calling bulkRerunDvWorkflows().'
343
+ );
344
+ }
345
+
346
+ const queryParameters: any = {};
347
+
348
+ const headerParameters: runtime.HTTPHeaders = {};
349
+
350
+ headerParameters['Content-Type'] = 'application/json';
351
+
352
+ if (this.configuration && this.configuration.accessToken) {
353
+ const token = this.configuration.accessToken;
354
+ const tokenString = await token("bearerAuth", []);
355
+
356
+ if (tokenString) {
357
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
358
+ }
359
+ }
360
+
361
+ let urlPath = `/v1/system-jobs/document_versions/bulk-rerun`;
362
+
363
+ return {
364
+ path: urlPath,
365
+ method: 'POST',
366
+ headers: headerParameters,
367
+ query: queryParameters,
368
+ body: BulkRerunRequestToJSON(requestParameters['bulkRerunRequest']),
369
+ };
370
+ }
371
+
372
+ /**
373
+ * Re-run ingestion for the selected document versions, reporting per item. ``not_found``: missing, trashed, never ingested or without its stored source; ``forbidden``: no ``can_write``; ``in_progress_workflow``: still pending/processing; ``already_ingested``: completed; ``unsupported_document_type``: a type that is no longer ingested; ``superseded``: a newer version of the document exists. More than 200 ids is a 400 before any re-run.
374
+ * Bulk Rerun Dv Workflows Handler
375
+ */
376
+ async bulkRerunDvWorkflowsRaw(requestParameters: BulkRerunDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>> {
377
+ const requestOptions = await this.bulkRerunDvWorkflowsRequestOpts(requestParameters);
378
+ const response = await this.request(requestOptions, initOverrides);
379
+
380
+ return new runtime.JSONApiResponse(response, (jsonValue) => BulkOperationResponseFromJSON(jsonValue));
381
+ }
382
+
383
+ /**
384
+ * Re-run ingestion for the selected document versions, reporting per item. ``not_found``: missing, trashed, never ingested or without its stored source; ``forbidden``: no ``can_write``; ``in_progress_workflow``: still pending/processing; ``already_ingested``: completed; ``unsupported_document_type``: a type that is no longer ingested; ``superseded``: a newer version of the document exists. More than 200 ids is a 400 before any re-run.
385
+ * Bulk Rerun Dv Workflows Handler
386
+ */
387
+ async bulkRerunDvWorkflows(requestParameters: BulkRerunDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse> {
388
+ const response = await this.bulkRerunDvWorkflowsRaw(requestParameters, initOverrides);
389
+ return await response.value();
390
+ }
391
+
231
392
  /**
232
393
  * Creates request options for cancelTemporalWorkflow without sending the request
233
394
  */
@@ -264,7 +425,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
264
425
  }
265
426
 
266
427
  /**
267
- * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side.
428
+ * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side. A run no worker ever picked up is terminated instead, since a cancel request is itself a workflow task nobody would process. When Temporal no longer has the run, or it was terminated here, a document version still showing it running is settled as cancelled (needs ``can_write``) so it can be re-run.
268
429
  * Cancel Temporal Workflow Handler
269
430
  */
270
431
  async cancelTemporalWorkflowRaw(requestParameters: CancelTemporalWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowCancelResponse>> {
@@ -275,7 +436,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
275
436
  }
276
437
 
277
438
  /**
278
- * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side.
439
+ * Cancel any Temporal workflow owned by the caller\'s tenant. No status guard — this is a thin Temporal wrapper. Cancelling an already-terminal workflow is a no-op on the Temporal side. A run no worker ever picked up is terminated instead, since a cancel request is itself a workflow task nobody would process. When Temporal no longer has the run, or it was terminated here, a document version still showing it running is settled as cancelled (needs ``can_write``) so it can be re-run.
279
440
  * Cancel Temporal Workflow Handler
280
441
  */
281
442
  async cancelTemporalWorkflow(requestParameters: CancelTemporalWorkflowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowCancelResponse> {
@@ -319,7 +480,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
319
480
  }
320
481
 
321
482
  /**
322
- * Rerun a workflow. USER role requires ``can_write`` on the document path. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
483
+ * Rerun a workflow. USER role requires ``can_write`` on the document path. A version that a newer live version supersedes is refused with 409. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
323
484
  * Dv Workflow Rerun Handler
324
485
  */
325
486
  async dvWorkflowRerunRaw(requestParameters: DvWorkflowRerunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowActionResponse>> {
@@ -330,7 +491,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
330
491
  }
331
492
 
332
493
  /**
333
- * Rerun a workflow. USER role requires ``can_write`` on the document path. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
494
+ * Rerun a workflow. USER role requires ``can_write`` on the document path. A version that a newer live version supersedes is refused with 409. ``s3_client`` is injected because ``DocumentIngestionService.__init__`` requires it, even though the re-ingestion path reuses the existing S3 source.
334
495
  * Dv Workflow Rerun Handler
335
496
  */
336
497
  async dvWorkflowRerun(requestParameters: DvWorkflowRerunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowActionResponse> {
@@ -484,7 +645,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
484
645
  }
485
646
 
486
647
  /**
487
- * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s.
648
+ * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s. Any other workflow type has no ``results`` query and is a 404, not a 500.
488
649
  * Get Zip Ingestion Status Handler
489
650
  */
490
651
  async getZipIngestionStatusRaw(requestParameters: GetZipIngestionStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ZipIngestionStatusResponse>> {
@@ -495,7 +656,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
495
656
  }
496
657
 
497
658
  /**
498
- * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s.
659
+ * Get a ZIP fan-out\'s live status + per-member outcomes. Tenant-scoped via the TenantId search attribute (no per-path can_read check — intentionally consistent with the sibling generic Temporal endpoints below; the opaque workflow_id is only handed to the uploader, who had can_write on the target). The per-member results come from the workflow\'s ``results`` query (served from retained history), so once Temporal retention expires this 404s. Any other workflow type has no ``results`` query and is a 404, not a 500.
499
660
  * Get Zip Ingestion Status Handler
500
661
  */
501
662
  async getZipIngestionStatus(requestParameters: GetZipIngestionStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ZipIngestionStatusResponse> {
@@ -503,6 +664,65 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
503
664
  return await response.value();
504
665
  }
505
666
 
667
+ /**
668
+ * Creates request options for listDvWorkflowUploaders without sending the request
669
+ */
670
+ async listDvWorkflowUploadersRequestOpts(requestParameters: ListDvWorkflowUploadersRequest): Promise<runtime.RequestOpts> {
671
+ const queryParameters: any = {};
672
+
673
+ if (requestParameters['usernameLike'] != null) {
674
+ queryParameters['username_like'] = requestParameters['usernameLike'];
675
+ }
676
+
677
+ if (requestParameters['limit'] != null) {
678
+ queryParameters['limit'] = requestParameters['limit'];
679
+ }
680
+
681
+ if (requestParameters['offset'] != null) {
682
+ queryParameters['offset'] = requestParameters['offset'];
683
+ }
684
+
685
+ const headerParameters: runtime.HTTPHeaders = {};
686
+
687
+ if (this.configuration && this.configuration.accessToken) {
688
+ const token = this.configuration.accessToken;
689
+ const tokenString = await token("bearerAuth", []);
690
+
691
+ if (tokenString) {
692
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
693
+ }
694
+ }
695
+
696
+ let urlPath = `/v1/system-jobs/document_versions/uploaders`;
697
+
698
+ return {
699
+ path: urlPath,
700
+ method: 'GET',
701
+ headers: headerParameters,
702
+ query: queryParameters,
703
+ };
704
+ }
705
+
706
+ /**
707
+ * People who uploaded a version the caller can list, for the uploader filter. Scoped like ``list_dv_workflows``: USER only counts versions under readable paths.
708
+ * List Dv Workflow Uploaders Handler
709
+ */
710
+ async listDvWorkflowUploadersRaw(requestParameters: ListDvWorkflowUploadersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseUserInfo>> {
711
+ const requestOptions = await this.listDvWorkflowUploadersRequestOpts(requestParameters);
712
+ const response = await this.request(requestOptions, initOverrides);
713
+
714
+ return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResponseUserInfoFromJSON(jsonValue));
715
+ }
716
+
717
+ /**
718
+ * People who uploaded a version the caller can list, for the uploader filter. Scoped like ``list_dv_workflows``: USER only counts versions under readable paths.
719
+ * List Dv Workflow Uploaders Handler
720
+ */
721
+ async listDvWorkflowUploaders(requestParameters: ListDvWorkflowUploadersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseUserInfo> {
722
+ const response = await this.listDvWorkflowUploadersRaw(requestParameters, initOverrides);
723
+ return await response.value();
724
+ }
725
+
506
726
  /**
507
727
  * Creates request options for listDvWorkflows without sending the request
508
728
  */
@@ -517,6 +737,42 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
517
737
  queryParameters['offset'] = requestParameters['offset'];
518
738
  }
519
739
 
740
+ if (requestParameters['sortDir'] != null) {
741
+ queryParameters['sort_dir'] = requestParameters['sortDir'];
742
+ }
743
+
744
+ if (requestParameters['status'] != null) {
745
+ queryParameters['status'] = requestParameters['status'];
746
+ }
747
+
748
+ if (requestParameters['nameLike'] != null) {
749
+ queryParameters['name_like'] = requestParameters['nameLike'];
750
+ }
751
+
752
+ if (requestParameters['latestVersionOnly'] != null) {
753
+ queryParameters['latest_version_only'] = requestParameters['latestVersionOnly'];
754
+ }
755
+
756
+ if (requestParameters['uploaderUserId'] != null) {
757
+ queryParameters['uploader_user_id'] = requestParameters['uploaderUserId'];
758
+ }
759
+
760
+ if (requestParameters['createdAfter'] != null) {
761
+ queryParameters['created_after'] = (requestParameters['createdAfter'] as any).toISOString();
762
+ }
763
+
764
+ if (requestParameters['createdBefore'] != null) {
765
+ queryParameters['created_before'] = (requestParameters['createdBefore'] as any).toISOString();
766
+ }
767
+
768
+ if (requestParameters['updatedAfter'] != null) {
769
+ queryParameters['updated_after'] = (requestParameters['updatedAfter'] as any).toISOString();
770
+ }
771
+
772
+ if (requestParameters['updatedBefore'] != null) {
773
+ queryParameters['updated_before'] = (requestParameters['updatedBefore'] as any).toISOString();
774
+ }
775
+
520
776
  const headerParameters: runtime.HTTPHeaders = {};
521
777
 
522
778
  if (this.configuration && this.configuration.accessToken) {
@@ -539,7 +795,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
539
795
  }
540
796
 
541
797
  /**
542
- * List all workflows for the current tenant (paginated, DB-backed). ADMIN/OWNER see all workflows; USER sees only those under permitted paths.
798
+ * List ingestions of live documents in the current tenant, newest upload first. ADMIN/OWNER see every version; USER only versions under readable paths. ``sort_dir=ASC`` lists the oldest upload first.
543
799
  * List Dv Workflows Handler
544
800
  */
545
801
  async listDvWorkflowsRaw(requestParameters: ListDvWorkflowsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseWorkflowSummaryResponse>> {
@@ -550,7 +806,7 @@ export class SystemJobsApi extends runtime.BaseAPI implements SystemJobsApiInter
550
806
  }
551
807
 
552
808
  /**
553
- * List all workflows for the current tenant (paginated, DB-backed). ADMIN/OWNER see all workflows; USER sees only those under permitted paths.
809
+ * List ingestions of live documents in the current tenant, newest upload first. ADMIN/OWNER see every version; USER only versions under readable paths. ``sort_dir=ASC`` lists the oldest upload first.
554
810
  * List Dv Workflows Handler
555
811
  */
556
812
  async listDvWorkflows(requestParameters: ListDvWorkflowsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseWorkflowSummaryResponse> {
@@ -31,7 +31,10 @@ export const BulkFailureReason = {
31
31
  CheckedOut: 'checked_out',
32
32
  NameConflict: 'name_conflict',
33
33
  InProgressWorkflow: 'in_progress_workflow',
34
- PermissionLimit: 'permission_limit'
34
+ PermissionLimit: 'permission_limit',
35
+ AlreadyIngested: 'already_ingested',
36
+ UnsupportedDocumentType: 'unsupported_document_type',
37
+ Superseded: 'superseded'
35
38
  } as const;
36
39
  export type BulkFailureReason = typeof BulkFailureReason[keyof typeof BulkFailureReason];
37
40
 
@@ -0,0 +1,82 @@
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
+ /**
17
+ * Re-run ingestion for the selected document versions.
18
+ * @export
19
+ * @interface BulkRerunRequest
20
+ */
21
+ export interface BulkRerunRequest {
22
+ /**
23
+ *
24
+ * @type {Array<string>}
25
+ * @memberof BulkRerunRequest
26
+ */
27
+ documentVersionIds?: Array<string>;
28
+ }
29
+ export const BulkRerunRequestPropertyValidationAttributesMap: {
30
+ [property: string]: {
31
+ maxLength?: number,
32
+ minLength?: number,
33
+ pattern?: string,
34
+ maximum?: number,
35
+ exclusiveMaximum?: boolean,
36
+ minimum?: number,
37
+ exclusiveMinimum?: boolean,
38
+ multipleOf?: number,
39
+ maxItems?: number,
40
+ minItems?: number,
41
+ uniqueItems?: boolean
42
+ }
43
+ } = {
44
+ }
45
+
46
+
47
+ /**
48
+ * Check if a given object implements the BulkRerunRequest interface.
49
+ */
50
+ export function instanceOfBulkRerunRequest(value: object): value is BulkRerunRequest {
51
+ return true;
52
+ }
53
+
54
+ export function BulkRerunRequestFromJSON(json: any): BulkRerunRequest {
55
+ return BulkRerunRequestFromJSONTyped(json, false);
56
+ }
57
+
58
+ export function BulkRerunRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): BulkRerunRequest {
59
+ if (json == null) {
60
+ return json;
61
+ }
62
+ return {
63
+
64
+ 'documentVersionIds': json['document_version_ids'] == null ? undefined : json['document_version_ids'],
65
+ };
66
+ }
67
+
68
+ export function BulkRerunRequestToJSON(json: any): BulkRerunRequest {
69
+ return BulkRerunRequestToJSONTyped(json, false);
70
+ }
71
+
72
+ export function BulkRerunRequestToJSONTyped(value?: BulkRerunRequest | null, ignoreDiscriminator: boolean = false): any {
73
+ if (value == null) {
74
+ return value;
75
+ }
76
+
77
+ return {
78
+
79
+ 'document_version_ids': value['documentVersionIds'],
80
+ };
81
+ }
82
+