@knowledge-stack/ksapi 1.15.0 → 1.16.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 (68) hide show
  1. package/.openapi-generator/FILES +7 -0
  2. package/README.md +2 -2
  3. package/dist/apis/AuthApi.d.ts +30 -1
  4. package/dist/apis/AuthApi.js +39 -0
  5. package/dist/apis/DocumentVersionsApi.d.ts +32 -1
  6. package/dist/apis/DocumentVersionsApi.js +37 -0
  7. package/dist/apis/DocumentsApi.d.ts +34 -1
  8. package/dist/apis/DocumentsApi.js +59 -0
  9. package/dist/apis/TenantsApi.d.ts +4 -4
  10. package/dist/apis/TenantsApi.js +2 -2
  11. package/dist/esm/apis/AuthApi.d.ts +30 -1
  12. package/dist/esm/apis/AuthApi.js +40 -1
  13. package/dist/esm/apis/DocumentVersionsApi.d.ts +32 -1
  14. package/dist/esm/apis/DocumentVersionsApi.js +38 -1
  15. package/dist/esm/apis/DocumentsApi.d.ts +34 -1
  16. package/dist/esm/apis/DocumentsApi.js +60 -1
  17. package/dist/esm/apis/TenantsApi.d.ts +4 -4
  18. package/dist/esm/apis/TenantsApi.js +2 -2
  19. package/dist/esm/models/AssumeUserRequest.d.ts +53 -0
  20. package/dist/esm/models/AssumeUserRequest.js +48 -0
  21. package/dist/esm/models/AssumeUserResponse.d.ts +47 -0
  22. package/dist/esm/models/AssumeUserResponse.js +44 -0
  23. package/dist/esm/models/DocumentVersionMetadata.d.ts +89 -0
  24. package/dist/esm/models/DocumentVersionMetadata.js +55 -0
  25. package/dist/esm/models/DocumentVersionMetadataUpdate.d.ts +87 -0
  26. package/dist/esm/models/DocumentVersionMetadataUpdate.js +55 -0
  27. package/dist/esm/models/DocumentVersionResponse.d.ts +13 -0
  28. package/dist/esm/models/DocumentVersionResponse.js +5 -0
  29. package/dist/esm/models/IngestDocumentResponse.d.ts +59 -0
  30. package/dist/esm/models/IngestDocumentResponse.js +52 -0
  31. package/dist/esm/models/PipelineState.d.ts +78 -0
  32. package/dist/esm/models/PipelineState.js +57 -0
  33. package/dist/esm/models/PipelineStatus.d.ts +27 -0
  34. package/dist/esm/models/PipelineStatus.js +45 -0
  35. package/dist/esm/models/index.d.ts +7 -0
  36. package/dist/esm/models/index.js +7 -0
  37. package/dist/models/AssumeUserRequest.d.ts +53 -0
  38. package/dist/models/AssumeUserRequest.js +56 -0
  39. package/dist/models/AssumeUserResponse.d.ts +47 -0
  40. package/dist/models/AssumeUserResponse.js +52 -0
  41. package/dist/models/DocumentVersionMetadata.d.ts +89 -0
  42. package/dist/models/DocumentVersionMetadata.js +63 -0
  43. package/dist/models/DocumentVersionMetadataUpdate.d.ts +87 -0
  44. package/dist/models/DocumentVersionMetadataUpdate.js +63 -0
  45. package/dist/models/DocumentVersionResponse.d.ts +13 -0
  46. package/dist/models/DocumentVersionResponse.js +5 -0
  47. package/dist/models/IngestDocumentResponse.d.ts +59 -0
  48. package/dist/models/IngestDocumentResponse.js +60 -0
  49. package/dist/models/PipelineState.d.ts +78 -0
  50. package/dist/models/PipelineState.js +65 -0
  51. package/dist/models/PipelineStatus.d.ts +27 -0
  52. package/dist/models/PipelineStatus.js +53 -0
  53. package/dist/models/index.d.ts +7 -0
  54. package/dist/models/index.js +7 -0
  55. package/package.json +1 -1
  56. package/src/apis/AuthApi.ts +80 -0
  57. package/src/apis/DocumentVersionsApi.ts +76 -0
  58. package/src/apis/DocumentsApi.ts +103 -0
  59. package/src/apis/TenantsApi.ts +4 -4
  60. package/src/models/AssumeUserRequest.ts +92 -0
  61. package/src/models/AssumeUserResponse.ts +83 -0
  62. package/src/models/DocumentVersionMetadata.ts +143 -0
  63. package/src/models/DocumentVersionMetadataUpdate.ts +141 -0
  64. package/src/models/DocumentVersionResponse.ts +24 -0
  65. package/src/models/IngestDocumentResponse.ts +101 -0
  66. package/src/models/PipelineState.ts +134 -0
  67. package/src/models/PipelineStatus.ts +55 -0
  68. package/src/models/index.ts +7 -0
@@ -21,6 +21,8 @@ src/apis/UserPermissionsApi.ts
21
21
  src/apis/UsersApi.ts
22
22
  src/apis/index.ts
23
23
  src/index.ts
24
+ src/models/AssumeUserRequest.ts
25
+ src/models/AssumeUserResponse.ts
24
26
  src/models/ChunkLineageResponse.ts
25
27
  src/models/ChunkMetadataInput.ts
26
28
  src/models/ChunkMetadataOutput.ts
@@ -42,6 +44,8 @@ src/models/DocumentContentPathPart.ts
42
44
  src/models/DocumentOrigin.ts
43
45
  src/models/DocumentResponse.ts
44
46
  src/models/DocumentType.ts
47
+ src/models/DocumentVersionMetadata.ts
48
+ src/models/DocumentVersionMetadataUpdate.ts
45
49
  src/models/DocumentVersionResponse.ts
46
50
  src/models/EmailSentResponse.ts
47
51
  src/models/EmailVerificationRequest.ts
@@ -51,6 +55,7 @@ src/models/FolderResponse.ts
51
55
  src/models/HTTPValidationError.ts
52
56
  src/models/HealthCheckResponse.ts
53
57
  src/models/IdpType.ts
58
+ src/models/IngestDocumentResponse.ts
54
59
  src/models/InviteResponse.ts
55
60
  src/models/InviteStatus.ts
56
61
  src/models/InviteUserRequest.ts
@@ -79,6 +84,8 @@ src/models/PathOrder.ts
79
84
  src/models/PathPartResponse.ts
80
85
  src/models/PermissionCapability.ts
81
86
  src/models/PermissionResponse.ts
87
+ src/models/PipelineState.ts
88
+ src/models/PipelineStatus.ts
82
89
  src/models/Polygon.ts
83
90
  src/models/PolygonReference.ts
84
91
  src/models/RootResponse.ts
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## @knowledge-stack/ksapi@1.15.0
1
+ ## @knowledge-stack/ksapi@1.16.0
2
2
 
3
3
  This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
4
4
 
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install @knowledge-stack/ksapi@1.15.0 --save
39
+ npm install @knowledge-stack/ksapi@1.16.0 --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
@@ -10,7 +10,11 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { CreatePasswordUserRequest, EmailSentResponse, EmailVerificationRequest, IdpType, PasswordResetRequest, PasswordResetWithTokenRequest, SignInRequest, UserResponse } from '../models/index';
13
+ import type { AssumeUserRequest, AssumeUserResponse, CreatePasswordUserRequest, EmailSentResponse, EmailVerificationRequest, IdpType, PasswordResetRequest, PasswordResetWithTokenRequest, SignInRequest, UserResponse } from '../models/index';
14
+ export interface AssumeUserOperationRequest {
15
+ xAdminApiKey: string;
16
+ assumeUserRequest: AssumeUserRequest;
17
+ }
14
18
  export interface CreatePasswordUserOperationRequest {
15
19
  createPasswordUserRequest: CreatePasswordUserRequest;
16
20
  }
@@ -53,6 +57,21 @@ export interface SendPwResetEmailRequest {
53
57
  * @interface AuthApiInterface
54
58
  */
55
59
  export interface AuthApiInterface {
60
+ /**
61
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
62
+ * @summary Assume User Identity Handler
63
+ * @param {string} xAdminApiKey
64
+ * @param {AssumeUserRequest} assumeUserRequest
65
+ * @param {*} [options] Override http request option.
66
+ * @throws {RequiredError}
67
+ * @memberof AuthApiInterface
68
+ */
69
+ assumeUserRaw(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AssumeUserResponse>>;
70
+ /**
71
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
72
+ * Assume User Identity Handler
73
+ */
74
+ assumeUser(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AssumeUserResponse>;
56
75
  /**
57
76
  *
58
77
  * @summary Create Password User Handler
@@ -202,6 +221,16 @@ export interface AuthApiInterface {
202
221
  *
203
222
  */
204
223
  export declare class AuthApi extends runtime.BaseAPI implements AuthApiInterface {
224
+ /**
225
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
226
+ * Assume User Identity Handler
227
+ */
228
+ assumeUserRaw(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AssumeUserResponse>>;
229
+ /**
230
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
231
+ * Assume User Identity Handler
232
+ */
233
+ assumeUser(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AssumeUserResponse>;
205
234
  /**
206
235
  * Create Password User Handler
207
236
  */
@@ -29,6 +29,45 @@ const index_1 = require("../models/index");
29
29
  *
30
30
  */
31
31
  class AuthApi extends runtime.BaseAPI {
32
+ /**
33
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
34
+ * Assume User Identity Handler
35
+ */
36
+ assumeUserRaw(requestParameters, initOverrides) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (requestParameters['xAdminApiKey'] == null) {
39
+ throw new runtime.RequiredError('xAdminApiKey', 'Required parameter "xAdminApiKey" was null or undefined when calling assumeUser().');
40
+ }
41
+ if (requestParameters['assumeUserRequest'] == null) {
42
+ throw new runtime.RequiredError('assumeUserRequest', 'Required parameter "assumeUserRequest" was null or undefined when calling assumeUser().');
43
+ }
44
+ const queryParameters = {};
45
+ const headerParameters = {};
46
+ headerParameters['Content-Type'] = 'application/json';
47
+ if (requestParameters['xAdminApiKey'] != null) {
48
+ headerParameters['x-admin-api-key'] = String(requestParameters['xAdminApiKey']);
49
+ }
50
+ let urlPath = `/v1/auth/assume_user`;
51
+ const response = yield this.request({
52
+ path: urlPath,
53
+ method: 'POST',
54
+ headers: headerParameters,
55
+ query: queryParameters,
56
+ body: (0, index_1.AssumeUserRequestToJSON)(requestParameters['assumeUserRequest']),
57
+ }, initOverrides);
58
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AssumeUserResponseFromJSON)(jsonValue));
59
+ });
60
+ }
61
+ /**
62
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
63
+ * Assume User Identity Handler
64
+ */
65
+ assumeUser(requestParameters, initOverrides) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const response = yield this.assumeUserRaw(requestParameters, initOverrides);
68
+ return yield response.value();
69
+ });
70
+ }
32
71
  /**
33
72
  * Create Password User Handler
34
73
  */
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { DocumentVersionResponse, PaginatedResponseDocumentContentPathPart, PaginatedResponseDocumentVersionResponse } from '../models/index';
13
+ import type { DocumentVersionMetadataUpdate, DocumentVersionResponse, PaginatedResponseDocumentContentPathPart, PaginatedResponseDocumentVersionResponse } from '../models/index';
14
14
  export interface CreateDocumentVersionRequest {
15
15
  documentId: string;
16
16
  ksUat?: string;
@@ -36,6 +36,11 @@ export interface ListDocumentVersionsRequest {
36
36
  offset?: number;
37
37
  ksUat?: string;
38
38
  }
39
+ export interface UpdateDocumentVersionMetadataRequest {
40
+ versionId: string;
41
+ documentVersionMetadataUpdate: DocumentVersionMetadataUpdate;
42
+ ksUat?: string;
43
+ }
39
44
  /**
40
45
  * DocumentVersionsApi - interface
41
46
  *
@@ -123,6 +128,22 @@ export interface DocumentVersionsApiInterface {
123
128
  * List Document Versions Handler
124
129
  */
125
130
  listDocumentVersions(requestParameters: ListDocumentVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentVersionResponse>;
131
+ /**
132
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
133
+ * @summary Update Document Version Metadata Handler
134
+ * @param {string} versionId DocumentVersion ID
135
+ * @param {DocumentVersionMetadataUpdate} documentVersionMetadataUpdate
136
+ * @param {string} [ksUat]
137
+ * @param {*} [options] Override http request option.
138
+ * @throws {RequiredError}
139
+ * @memberof DocumentVersionsApiInterface
140
+ */
141
+ updateDocumentVersionMetadataRaw(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentVersionResponse>>;
142
+ /**
143
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
144
+ * Update Document Version Metadata Handler
145
+ */
146
+ updateDocumentVersionMetadata(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentVersionResponse>;
126
147
  }
127
148
  /**
128
149
  *
@@ -178,4 +199,14 @@ export declare class DocumentVersionsApi extends runtime.BaseAPI implements Docu
178
199
  * List Document Versions Handler
179
200
  */
180
201
  listDocumentVersions(requestParameters: ListDocumentVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentVersionResponse>;
202
+ /**
203
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
204
+ * Update Document Version Metadata Handler
205
+ */
206
+ updateDocumentVersionMetadataRaw(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentVersionResponse>>;
207
+ /**
208
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
209
+ * Update Document Version Metadata Handler
210
+ */
211
+ updateDocumentVersionMetadata(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentVersionResponse>;
181
212
  }
@@ -205,5 +205,42 @@ class DocumentVersionsApi extends runtime.BaseAPI {
205
205
  return yield response.value();
206
206
  });
207
207
  }
208
+ /**
209
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
210
+ * Update Document Version Metadata Handler
211
+ */
212
+ updateDocumentVersionMetadataRaw(requestParameters, initOverrides) {
213
+ return __awaiter(this, void 0, void 0, function* () {
214
+ if (requestParameters['versionId'] == null) {
215
+ throw new runtime.RequiredError('versionId', 'Required parameter "versionId" was null or undefined when calling updateDocumentVersionMetadata().');
216
+ }
217
+ if (requestParameters['documentVersionMetadataUpdate'] == null) {
218
+ throw new runtime.RequiredError('documentVersionMetadataUpdate', 'Required parameter "documentVersionMetadataUpdate" was null or undefined when calling updateDocumentVersionMetadata().');
219
+ }
220
+ const queryParameters = {};
221
+ const headerParameters = {};
222
+ headerParameters['Content-Type'] = 'application/json';
223
+ let urlPath = `/v1/document_versions/{version_id}/metadata`;
224
+ urlPath = urlPath.replace(`{${"version_id"}}`, encodeURIComponent(String(requestParameters['versionId'])));
225
+ const response = yield this.request({
226
+ path: urlPath,
227
+ method: 'PATCH',
228
+ headers: headerParameters,
229
+ query: queryParameters,
230
+ body: (0, index_1.DocumentVersionMetadataUpdateToJSON)(requestParameters['documentVersionMetadataUpdate']),
231
+ }, initOverrides);
232
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.DocumentVersionResponseFromJSON)(jsonValue));
233
+ });
234
+ }
235
+ /**
236
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
237
+ * Update Document Version Metadata Handler
238
+ */
239
+ updateDocumentVersionMetadata(requestParameters, initOverrides) {
240
+ return __awaiter(this, void 0, void 0, function* () {
241
+ const response = yield this.updateDocumentVersionMetadataRaw(requestParameters, initOverrides);
242
+ return yield response.value();
243
+ });
244
+ }
208
245
  }
209
246
  exports.DocumentVersionsApi = DocumentVersionsApi;
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { CreateDocumentRequest, DocumentResponse, PaginatedResponseDocumentResponse, PathOrder, UpdateDocumentRequest } from '../models/index';
13
+ import type { CreateDocumentRequest, DocumentResponse, IngestDocumentResponse, PaginatedResponseDocumentResponse, PathOrder, UpdateDocumentRequest } from '../models/index';
14
14
  export interface CreateDocumentOperationRequest {
15
15
  createDocumentRequest: CreateDocumentRequest;
16
16
  ksUat?: string;
@@ -23,6 +23,12 @@ export interface GetDocumentRequest {
23
23
  documentId: string;
24
24
  ksUat?: string;
25
25
  }
26
+ export interface IngestDocumentRequest {
27
+ file: Blob;
28
+ folderId: string;
29
+ ksUat?: string;
30
+ name?: string;
31
+ }
26
32
  export interface ListDocumentsRequest {
27
33
  parentId?: string;
28
34
  sortOrder?: PathOrder;
@@ -87,6 +93,23 @@ export interface DocumentsApiInterface {
87
93
  * Get Document Handler
88
94
  */
89
95
  getDocument(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
96
+ /**
97
+ * Upload a file, create document + version, and trigger ingestion workflow. Returns 201 with the Temporal workflow ID. Design decision — S3 upload happens *before* the DB write: We pre-generate document and version UUIDs, upload the source file to S3, and only then persist the DB records. If the DB write fails, an orphaned S3 object is left behind (acceptable storage cost cleaned up by the S3 deletion cronjob). The reverse — a committed DB record pointing to a missing S3 object — would crash downstream pipeline activities that expect the file to exist.
98
+ * @summary Ingest Document Handler
99
+ * @param {Blob} file
100
+ * @param {string} folderId Parent folder ID
101
+ * @param {string} [ksUat]
102
+ * @param {string} [name] Document name (defaults to filename)
103
+ * @param {*} [options] Override http request option.
104
+ * @throws {RequiredError}
105
+ * @memberof DocumentsApiInterface
106
+ */
107
+ ingestDocumentRaw(requestParameters: IngestDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestDocumentResponse>>;
108
+ /**
109
+ * Upload a file, create document + version, and trigger ingestion workflow. Returns 201 with the Temporal workflow ID. Design decision — S3 upload happens *before* the DB write: We pre-generate document and version UUIDs, upload the source file to S3, and only then persist the DB records. If the DB write fails, an orphaned S3 object is left behind (acceptable storage cost cleaned up by the S3 deletion cronjob). The reverse — a committed DB record pointing to a missing S3 object — would crash downstream pipeline activities that expect the file to exist.
110
+ * Ingest Document Handler
111
+ */
112
+ ingestDocument(requestParameters: IngestDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestDocumentResponse>;
90
113
  /**
91
114
  * List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
92
115
  * @summary List Documents Handler
@@ -156,6 +179,16 @@ export declare class DocumentsApi extends runtime.BaseAPI implements DocumentsAp
156
179
  * Get Document Handler
157
180
  */
158
181
  getDocument(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
182
+ /**
183
+ * Upload a file, create document + version, and trigger ingestion workflow. Returns 201 with the Temporal workflow ID. Design decision — S3 upload happens *before* the DB write: We pre-generate document and version UUIDs, upload the source file to S3, and only then persist the DB records. If the DB write fails, an orphaned S3 object is left behind (acceptable storage cost cleaned up by the S3 deletion cronjob). The reverse — a committed DB record pointing to a missing S3 object — would crash downstream pipeline activities that expect the file to exist.
184
+ * Ingest Document Handler
185
+ */
186
+ ingestDocumentRaw(requestParameters: IngestDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestDocumentResponse>>;
187
+ /**
188
+ * Upload a file, create document + version, and trigger ingestion workflow. Returns 201 with the Temporal workflow ID. Design decision — S3 upload happens *before* the DB write: We pre-generate document and version UUIDs, upload the source file to S3, and only then persist the DB records. If the DB write fails, an orphaned S3 object is left behind (acceptable storage cost cleaned up by the S3 deletion cronjob). The reverse — a committed DB record pointing to a missing S3 object — would crash downstream pipeline activities that expect the file to exist.
189
+ * Ingest Document Handler
190
+ */
191
+ ingestDocument(requestParameters: IngestDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestDocumentResponse>;
159
192
  /**
160
193
  * List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
161
194
  * List Documents Handler
@@ -125,6 +125,65 @@ class DocumentsApi extends runtime.BaseAPI {
125
125
  return yield response.value();
126
126
  });
127
127
  }
128
+ /**
129
+ * Upload a file, create document + version, and trigger ingestion workflow. Returns 201 with the Temporal workflow ID. Design decision — S3 upload happens *before* the DB write: We pre-generate document and version UUIDs, upload the source file to S3, and only then persist the DB records. If the DB write fails, an orphaned S3 object is left behind (acceptable storage cost cleaned up by the S3 deletion cronjob). The reverse — a committed DB record pointing to a missing S3 object — would crash downstream pipeline activities that expect the file to exist.
130
+ * Ingest Document Handler
131
+ */
132
+ ingestDocumentRaw(requestParameters, initOverrides) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ if (requestParameters['file'] == null) {
135
+ throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling ingestDocument().');
136
+ }
137
+ if (requestParameters['folderId'] == null) {
138
+ throw new runtime.RequiredError('folderId', 'Required parameter "folderId" was null or undefined when calling ingestDocument().');
139
+ }
140
+ const queryParameters = {};
141
+ const headerParameters = {};
142
+ const consumes = [
143
+ { contentType: 'multipart/form-data' },
144
+ ];
145
+ // @ts-ignore: canConsumeForm may be unused
146
+ const canConsumeForm = runtime.canConsumeForm(consumes);
147
+ let formParams;
148
+ let useForm = false;
149
+ // use FormData to transmit files using content-type "multipart/form-data"
150
+ useForm = canConsumeForm;
151
+ if (useForm) {
152
+ formParams = new FormData();
153
+ }
154
+ else {
155
+ formParams = new URLSearchParams();
156
+ }
157
+ if (requestParameters['file'] != null) {
158
+ formParams.append('file', requestParameters['file']);
159
+ }
160
+ if (requestParameters['folderId'] != null) {
161
+ formParams.append('folder_id', requestParameters['folderId']);
162
+ }
163
+ if (requestParameters['name'] != null) {
164
+ formParams.append('name', requestParameters['name']);
165
+ }
166
+ let urlPath = `/v1/documents/ingest`;
167
+ const response = yield this.request({
168
+ path: urlPath,
169
+ method: 'POST',
170
+ headers: headerParameters,
171
+ query: queryParameters,
172
+ body: formParams,
173
+ }, initOverrides);
174
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.IngestDocumentResponseFromJSON)(jsonValue));
175
+ });
176
+ }
177
+ /**
178
+ * Upload a file, create document + version, and trigger ingestion workflow. Returns 201 with the Temporal workflow ID. Design decision — S3 upload happens *before* the DB write: We pre-generate document and version UUIDs, upload the source file to S3, and only then persist the DB records. If the DB write fails, an orphaned S3 object is left behind (acceptable storage cost cleaned up by the S3 deletion cronjob). The reverse — a committed DB record pointing to a missing S3 object — would crash downstream pipeline activities that expect the file to exist.
179
+ * Ingest Document Handler
180
+ */
181
+ ingestDocument(requestParameters, initOverrides) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ const response = yield this.ingestDocumentRaw(requestParameters, initOverrides);
184
+ return yield response.value();
185
+ });
186
+ }
128
187
  /**
129
188
  * List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
130
189
  * List Documents Handler
@@ -62,7 +62,7 @@ export interface TenantsApiInterface {
62
62
  */
63
63
  createTenant(requestParameters: CreateTenantOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TenantResponse>;
64
64
  /**
65
- * Delete a tenant. Requires OWNER role in the tenant.
65
+ * Delete a tenant. Requires OWNER role in the tenant. Deletes the tenant\'s S3 bucket after the DB transaction commits.
66
66
  * @summary Delete Tenant
67
67
  * @param {string} tenantId
68
68
  * @param {string} [ksUat]
@@ -72,7 +72,7 @@ export interface TenantsApiInterface {
72
72
  */
73
73
  deleteTenantRaw(requestParameters: DeleteTenantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
74
74
  /**
75
- * Delete a tenant. Requires OWNER role in the tenant.
75
+ * Delete a tenant. Requires OWNER role in the tenant. Deletes the tenant\'s S3 bucket after the DB transaction commits.
76
76
  * Delete Tenant
77
77
  */
78
78
  deleteTenant(requestParameters: DeleteTenantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
@@ -156,12 +156,12 @@ export declare class TenantsApi extends runtime.BaseAPI implements TenantsApiInt
156
156
  */
157
157
  createTenant(requestParameters: CreateTenantOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TenantResponse>;
158
158
  /**
159
- * Delete a tenant. Requires OWNER role in the tenant.
159
+ * Delete a tenant. Requires OWNER role in the tenant. Deletes the tenant\'s S3 bucket after the DB transaction commits.
160
160
  * Delete Tenant
161
161
  */
162
162
  deleteTenantRaw(requestParameters: DeleteTenantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
163
163
  /**
164
- * Delete a tenant. Requires OWNER role in the tenant.
164
+ * Delete a tenant. Requires OWNER role in the tenant. Deletes the tenant\'s S3 bucket after the DB transaction commits.
165
165
  * Delete Tenant
166
166
  */
167
167
  deleteTenant(requestParameters: DeleteTenantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
@@ -63,7 +63,7 @@ class TenantsApi extends runtime.BaseAPI {
63
63
  });
64
64
  }
65
65
  /**
66
- * Delete a tenant. Requires OWNER role in the tenant.
66
+ * Delete a tenant. Requires OWNER role in the tenant. Deletes the tenant\'s S3 bucket after the DB transaction commits.
67
67
  * Delete Tenant
68
68
  */
69
69
  deleteTenantRaw(requestParameters, initOverrides) {
@@ -85,7 +85,7 @@ class TenantsApi extends runtime.BaseAPI {
85
85
  });
86
86
  }
87
87
  /**
88
- * Delete a tenant. Requires OWNER role in the tenant.
88
+ * Delete a tenant. Requires OWNER role in the tenant. Deletes the tenant\'s S3 bucket after the DB transaction commits.
89
89
  * Delete Tenant
90
90
  */
91
91
  deleteTenant(requestParameters, initOverrides) {
@@ -10,7 +10,11 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { CreatePasswordUserRequest, EmailSentResponse, EmailVerificationRequest, IdpType, PasswordResetRequest, PasswordResetWithTokenRequest, SignInRequest, UserResponse } from '../models/index';
13
+ import type { AssumeUserRequest, AssumeUserResponse, CreatePasswordUserRequest, EmailSentResponse, EmailVerificationRequest, IdpType, PasswordResetRequest, PasswordResetWithTokenRequest, SignInRequest, UserResponse } from '../models/index';
14
+ export interface AssumeUserOperationRequest {
15
+ xAdminApiKey: string;
16
+ assumeUserRequest: AssumeUserRequest;
17
+ }
14
18
  export interface CreatePasswordUserOperationRequest {
15
19
  createPasswordUserRequest: CreatePasswordUserRequest;
16
20
  }
@@ -53,6 +57,21 @@ export interface SendPwResetEmailRequest {
53
57
  * @interface AuthApiInterface
54
58
  */
55
59
  export interface AuthApiInterface {
60
+ /**
61
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
62
+ * @summary Assume User Identity Handler
63
+ * @param {string} xAdminApiKey
64
+ * @param {AssumeUserRequest} assumeUserRequest
65
+ * @param {*} [options] Override http request option.
66
+ * @throws {RequiredError}
67
+ * @memberof AuthApiInterface
68
+ */
69
+ assumeUserRaw(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AssumeUserResponse>>;
70
+ /**
71
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
72
+ * Assume User Identity Handler
73
+ */
74
+ assumeUser(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AssumeUserResponse>;
56
75
  /**
57
76
  *
58
77
  * @summary Create Password User Handler
@@ -202,6 +221,16 @@ export interface AuthApiInterface {
202
221
  *
203
222
  */
204
223
  export declare class AuthApi extends runtime.BaseAPI implements AuthApiInterface {
224
+ /**
225
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
226
+ * Assume User Identity Handler
227
+ */
228
+ assumeUserRaw(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AssumeUserResponse>>;
229
+ /**
230
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
231
+ * Assume User Identity Handler
232
+ */
233
+ assumeUser(requestParameters: AssumeUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AssumeUserResponse>;
205
234
  /**
206
235
  * Create Password User Handler
207
236
  */
@@ -21,11 +21,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  });
22
22
  };
23
23
  import * as runtime from '../runtime';
24
- import { CreatePasswordUserRequestToJSON, EmailSentResponseFromJSON, EmailVerificationRequestToJSON, PasswordResetRequestToJSON, PasswordResetWithTokenRequestToJSON, SignInRequestToJSON, UserResponseFromJSON, } from '../models/index';
24
+ import { AssumeUserRequestToJSON, AssumeUserResponseFromJSON, CreatePasswordUserRequestToJSON, EmailSentResponseFromJSON, EmailVerificationRequestToJSON, PasswordResetRequestToJSON, PasswordResetWithTokenRequestToJSON, SignInRequestToJSON, UserResponseFromJSON, } from '../models/index';
25
25
  /**
26
26
  *
27
27
  */
28
28
  export class AuthApi extends runtime.BaseAPI {
29
+ /**
30
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
31
+ * Assume User Identity Handler
32
+ */
33
+ assumeUserRaw(requestParameters, initOverrides) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ if (requestParameters['xAdminApiKey'] == null) {
36
+ throw new runtime.RequiredError('xAdminApiKey', 'Required parameter "xAdminApiKey" was null or undefined when calling assumeUser().');
37
+ }
38
+ if (requestParameters['assumeUserRequest'] == null) {
39
+ throw new runtime.RequiredError('assumeUserRequest', 'Required parameter "assumeUserRequest" was null or undefined when calling assumeUser().');
40
+ }
41
+ const queryParameters = {};
42
+ const headerParameters = {};
43
+ headerParameters['Content-Type'] = 'application/json';
44
+ if (requestParameters['xAdminApiKey'] != null) {
45
+ headerParameters['x-admin-api-key'] = String(requestParameters['xAdminApiKey']);
46
+ }
47
+ let urlPath = `/v1/auth/assume_user`;
48
+ const response = yield this.request({
49
+ path: urlPath,
50
+ method: 'POST',
51
+ headers: headerParameters,
52
+ query: queryParameters,
53
+ body: AssumeUserRequestToJSON(requestParameters['assumeUserRequest']),
54
+ }, initOverrides);
55
+ return new runtime.JSONApiResponse(response, (jsonValue) => AssumeUserResponseFromJSON(jsonValue));
56
+ });
57
+ }
58
+ /**
59
+ * Generate a UAT for a given user/tenant pair. Authenticated via static ADMIN_API_KEY. Intended for worker service to obtain identity credentials for user-aware API operations. Validates that the user is a member of the requested tenant before minting the token.
60
+ * Assume User Identity Handler
61
+ */
62
+ assumeUser(requestParameters, initOverrides) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const response = yield this.assumeUserRaw(requestParameters, initOverrides);
65
+ return yield response.value();
66
+ });
67
+ }
29
68
  /**
30
69
  * Create Password User Handler
31
70
  */
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { DocumentVersionResponse, PaginatedResponseDocumentContentPathPart, PaginatedResponseDocumentVersionResponse } from '../models/index';
13
+ import type { DocumentVersionMetadataUpdate, DocumentVersionResponse, PaginatedResponseDocumentContentPathPart, PaginatedResponseDocumentVersionResponse } from '../models/index';
14
14
  export interface CreateDocumentVersionRequest {
15
15
  documentId: string;
16
16
  ksUat?: string;
@@ -36,6 +36,11 @@ export interface ListDocumentVersionsRequest {
36
36
  offset?: number;
37
37
  ksUat?: string;
38
38
  }
39
+ export interface UpdateDocumentVersionMetadataRequest {
40
+ versionId: string;
41
+ documentVersionMetadataUpdate: DocumentVersionMetadataUpdate;
42
+ ksUat?: string;
43
+ }
39
44
  /**
40
45
  * DocumentVersionsApi - interface
41
46
  *
@@ -123,6 +128,22 @@ export interface DocumentVersionsApiInterface {
123
128
  * List Document Versions Handler
124
129
  */
125
130
  listDocumentVersions(requestParameters: ListDocumentVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentVersionResponse>;
131
+ /**
132
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
133
+ * @summary Update Document Version Metadata Handler
134
+ * @param {string} versionId DocumentVersion ID
135
+ * @param {DocumentVersionMetadataUpdate} documentVersionMetadataUpdate
136
+ * @param {string} [ksUat]
137
+ * @param {*} [options] Override http request option.
138
+ * @throws {RequiredError}
139
+ * @memberof DocumentVersionsApiInterface
140
+ */
141
+ updateDocumentVersionMetadataRaw(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentVersionResponse>>;
142
+ /**
143
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
144
+ * Update Document Version Metadata Handler
145
+ */
146
+ updateDocumentVersionMetadata(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentVersionResponse>;
126
147
  }
127
148
  /**
128
149
  *
@@ -178,4 +199,14 @@ export declare class DocumentVersionsApi extends runtime.BaseAPI implements Docu
178
199
  * List Document Versions Handler
179
200
  */
180
201
  listDocumentVersions(requestParameters: ListDocumentVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentVersionResponse>;
202
+ /**
203
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
204
+ * Update Document Version Metadata Handler
205
+ */
206
+ updateDocumentVersionMetadataRaw(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentVersionResponse>>;
207
+ /**
208
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
209
+ * Update Document Version Metadata Handler
210
+ */
211
+ updateDocumentVersionMetadata(requestParameters: UpdateDocumentVersionMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentVersionResponse>;
181
212
  }
@@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  });
22
22
  };
23
23
  import * as runtime from '../runtime';
24
- import { DocumentVersionResponseFromJSON, PaginatedResponseDocumentContentPathPartFromJSON, PaginatedResponseDocumentVersionResponseFromJSON, } from '../models/index';
24
+ import { DocumentVersionMetadataUpdateToJSON, DocumentVersionResponseFromJSON, PaginatedResponseDocumentContentPathPartFromJSON, PaginatedResponseDocumentVersionResponseFromJSON, } from '../models/index';
25
25
  /**
26
26
  *
27
27
  */
@@ -202,4 +202,41 @@ export class DocumentVersionsApi extends runtime.BaseAPI {
202
202
  return yield response.value();
203
203
  });
204
204
  }
205
+ /**
206
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
207
+ * Update Document Version Metadata Handler
208
+ */
209
+ updateDocumentVersionMetadataRaw(requestParameters, initOverrides) {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ if (requestParameters['versionId'] == null) {
212
+ throw new runtime.RequiredError('versionId', 'Required parameter "versionId" was null or undefined when calling updateDocumentVersionMetadata().');
213
+ }
214
+ if (requestParameters['documentVersionMetadataUpdate'] == null) {
215
+ throw new runtime.RequiredError('documentVersionMetadataUpdate', 'Required parameter "documentVersionMetadataUpdate" was null or undefined when calling updateDocumentVersionMetadata().');
216
+ }
217
+ const queryParameters = {};
218
+ const headerParameters = {};
219
+ headerParameters['Content-Type'] = 'application/json';
220
+ let urlPath = `/v1/document_versions/{version_id}/metadata`;
221
+ urlPath = urlPath.replace(`{${"version_id"}}`, encodeURIComponent(String(requestParameters['versionId'])));
222
+ const response = yield this.request({
223
+ path: urlPath,
224
+ method: 'PATCH',
225
+ headers: headerParameters,
226
+ query: queryParameters,
227
+ body: DocumentVersionMetadataUpdateToJSON(requestParameters['documentVersionMetadataUpdate']),
228
+ }, initOverrides);
229
+ return new runtime.JSONApiResponse(response, (jsonValue) => DocumentVersionResponseFromJSON(jsonValue));
230
+ });
231
+ }
232
+ /**
233
+ * Merge metadata fields into an existing document version\'s metadata. Only non-null fields in the request body are merged; existing metadata fields not present in the request are preserved.
234
+ * Update Document Version Metadata Handler
235
+ */
236
+ updateDocumentVersionMetadata(requestParameters, initOverrides) {
237
+ return __awaiter(this, void 0, void 0, function* () {
238
+ const response = yield this.updateDocumentVersionMetadataRaw(requestParameters, initOverrides);
239
+ return yield response.value();
240
+ });
241
+ }
205
242
  }