@gpt-core/client 0.1.0-alpha.1 → 0.2.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 (6) hide show
  1. package/README.md +306 -23
  2. package/dist/index.d.mts +16102 -6910
  3. package/dist/index.d.ts +16102 -6910
  4. package/dist/index.js +2743 -1838
  5. package/dist/index.mjs +2612 -1885
  6. package/package.json +10 -3
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
6
  var __export = (target, all) => {
8
7
  for (var name in all)
9
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,78 +16,398 @@ var __copyProps = (to, from, except, desc) => {
17
16
  return to;
18
17
  };
19
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
19
 
22
20
  // src/index.ts
23
21
  var index_exports = {};
24
22
  __export(index_exports, {
25
- GptClient: () => GptClient,
26
- eq: () => eq,
27
- eq2: () => eq2,
28
- eq3: () => eq3,
29
- eq4: () => eq4,
30
- eq5: () => eq5,
31
- eq6: () => eq6,
32
- eq7: () => eq7,
33
- eq8: () => eq8,
34
- format: () => format,
35
- greater_than: () => greater_than,
36
- greater_than2: () => greater_than2,
37
- greater_than3: () => greater_than3,
38
- greater_than4: () => greater_than4,
39
- greater_than5: () => greater_than5,
40
- greater_than6: () => greater_than6,
41
- greater_than7: () => greater_than7,
42
- greater_than8: () => greater_than8,
43
- greater_than_or_equal: () => greater_than_or_equal,
44
- greater_than_or_equal2: () => greater_than_or_equal2,
45
- greater_than_or_equal3: () => greater_than_or_equal3,
46
- greater_than_or_equal4: () => greater_than_or_equal4,
47
- greater_than_or_equal5: () => greater_than_or_equal5,
48
- greater_than_or_equal6: () => greater_than_or_equal6,
49
- greater_than_or_equal7: () => greater_than_or_equal7,
50
- greater_than_or_equal8: () => greater_than_or_equal8,
51
- less_than: () => less_than,
52
- less_than2: () => less_than2,
53
- less_than3: () => less_than3,
54
- less_than4: () => less_than4,
55
- less_than5: () => less_than5,
56
- less_than6: () => less_than6,
57
- less_than7: () => less_than7,
58
- less_than8: () => less_than8,
59
- less_than_or_equal: () => less_than_or_equal,
60
- less_than_or_equal2: () => less_than_or_equal2,
61
- less_than_or_equal3: () => less_than_or_equal3,
62
- less_than_or_equal4: () => less_than_or_equal4,
63
- less_than_or_equal5: () => less_than_or_equal5,
64
- less_than_or_equal6: () => less_than_or_equal6,
65
- less_than_or_equal7: () => less_than_or_equal7,
66
- less_than_or_equal8: () => less_than_or_equal8,
67
- not_eq: () => not_eq,
68
- not_eq2: () => not_eq2,
69
- not_eq3: () => not_eq3,
70
- not_eq4: () => not_eq4,
71
- not_eq5: () => not_eq5,
72
- not_eq6: () => not_eq6,
73
- not_eq7: () => not_eq7,
74
- not_eq8: () => not_eq8,
75
- role: () => role,
76
- status: () => status,
77
- status2: () => status2,
78
- type: () => type
23
+ AgentCreateSchema: () => AgentCreateSchema,
24
+ ApiKeyAllocateSchema: () => ApiKeyAllocateSchema,
25
+ ApiKeyCreateSchema: () => ApiKeyCreateSchema,
26
+ ApplicationCreateSchema: () => ApplicationCreateSchema,
27
+ AuthenticationError: () => AuthenticationError,
28
+ AuthorizationError: () => AuthorizationError,
29
+ BucketCreateSchema: () => BucketCreateSchema,
30
+ DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
31
+ DocumentUploadBase64Schema: () => DocumentUploadBase64Schema,
32
+ EmbedRequestSchema: () => EmbedRequestSchema,
33
+ GptCoreError: () => GptCoreError,
34
+ InvitationCreateSchema: () => InvitationCreateSchema,
35
+ LoginRequestSchema: () => LoginRequestSchema,
36
+ MessageSendSchema: () => MessageSendSchema,
37
+ NetworkError: () => NetworkError,
38
+ NotFoundError: () => NotFoundError,
39
+ PresignedDownloadSchema: () => PresignedDownloadSchema,
40
+ PresignedUploadSchema: () => PresignedUploadSchema,
41
+ RateLimitError: () => RateLimitError,
42
+ RegisterRequestSchema: () => RegisterRequestSchema,
43
+ SearchRequestSchema: () => SearchRequestSchema,
44
+ ServerError: () => ServerError,
45
+ ThreadCreateSchema: () => ThreadCreateSchema,
46
+ TimeoutError: () => TimeoutError,
47
+ ValidationError: () => ValidationError,
48
+ WorkspaceCreateSchema: () => WorkspaceCreateSchema,
49
+ calculateBackoff: () => calculateBackoff,
50
+ client: () => client,
51
+ collectStreamedMessage: () => collectStreamedMessage,
52
+ deleteAgentsById: () => deleteAgentsById,
53
+ deleteAiGraphEdgesById: () => deleteAiGraphEdgesById,
54
+ deleteAiGraphNodesById: () => deleteAiGraphNodesById,
55
+ deleteApiKeysById: () => deleteApiKeysById,
56
+ deleteApplicationsById: () => deleteApplicationsById,
57
+ deleteBucketsById: () => deleteBucketsById,
58
+ deleteDocumentsById: () => deleteDocumentsById,
59
+ deleteExtractionResultsById: () => deleteExtractionResultsById,
60
+ deleteMessagesById: () => deleteMessagesById,
61
+ deleteNotificationPreferencesById: () => deleteNotificationPreferencesById,
62
+ deleteObjectsById: () => deleteObjectsById,
63
+ deleteSearchSavedById: () => deleteSearchSavedById,
64
+ deleteTenantMembershipsByTenantIdByUserId: () => deleteTenantMembershipsByTenantIdByUserId,
65
+ deleteTenantsById: () => deleteTenantsById,
66
+ deleteThreadsById: () => deleteThreadsById,
67
+ deleteTrainingExamplesById: () => deleteTrainingExamplesById,
68
+ deleteUserProfilesById: () => deleteUserProfilesById,
69
+ deleteWebhookConfigsById: () => deleteWebhookConfigsById,
70
+ deleteWorkspaceMembershipsByWorkspaceIdByUserId: () => deleteWorkspaceMembershipsByWorkspaceIdByUserId,
71
+ deleteWorkspacesById: () => deleteWorkspacesById,
72
+ getAgents: () => getAgents,
73
+ getAgentsById: () => getAgentsById,
74
+ getAiChunksDocumentByDocumentId: () => getAiChunksDocumentByDocumentId,
75
+ getAiGraphEdges: () => getAiGraphEdges,
76
+ getAiGraphNodes: () => getAiGraphNodes,
77
+ getApiKeys: () => getApiKeys,
78
+ getApiKeysById: () => getApiKeysById,
79
+ getApplications: () => getApplications,
80
+ getApplicationsById: () => getApplicationsById,
81
+ getApplicationsBySlugBySlug: () => getApplicationsBySlugBySlug,
82
+ getAuditLogs: () => getAuditLogs,
83
+ getBuckets: () => getBuckets,
84
+ getBucketsById: () => getBucketsById,
85
+ getBucketsByIdObjects: () => getBucketsByIdObjects,
86
+ getBucketsByIdStats: () => getBucketsByIdStats,
87
+ getConfigs: () => getConfigs,
88
+ getCreditPackages: () => getCreditPackages,
89
+ getCreditPackagesById: () => getCreditPackagesById,
90
+ getCreditPackagesSlugBySlug: () => getCreditPackagesSlugBySlug,
91
+ getDocuments: () => getDocuments,
92
+ getDocumentsById: () => getDocumentsById,
93
+ getDocumentsByIdExtractionResults: () => getDocumentsByIdExtractionResults,
94
+ getDocumentsByIdRelationshipsChunks: () => getDocumentsByIdRelationshipsChunks,
95
+ getDocumentsProcessingQueue: () => getDocumentsProcessingQueue,
96
+ getDocumentsSearch: () => getDocumentsSearch,
97
+ getDocumentsStats: () => getDocumentsStats,
98
+ getExtractionResults: () => getExtractionResults,
99
+ getExtractionResultsById: () => getExtractionResultsById,
100
+ getInvitations: () => getInvitations,
101
+ getInvitationsConsumeByToken: () => getInvitationsConsumeByToken,
102
+ getLlmAnalytics: () => getLlmAnalytics,
103
+ getLlmAnalyticsById: () => getLlmAnalyticsById,
104
+ getLlmAnalyticsCosts: () => getLlmAnalyticsCosts,
105
+ getLlmAnalyticsPlatform: () => getLlmAnalyticsPlatform,
106
+ getLlmAnalyticsSummary: () => getLlmAnalyticsSummary,
107
+ getLlmAnalyticsUsage: () => getLlmAnalyticsUsage,
108
+ getLlmAnalyticsWorkspace: () => getLlmAnalyticsWorkspace,
109
+ getMessages: () => getMessages,
110
+ getMessagesById: () => getMessagesById,
111
+ getMessagesSearch: () => getMessagesSearch,
112
+ getNotificationLogs: () => getNotificationLogs,
113
+ getNotificationLogsById: () => getNotificationLogsById,
114
+ getNotificationPreferences: () => getNotificationPreferences,
115
+ getNotificationPreferencesById: () => getNotificationPreferencesById,
116
+ getObjects: () => getObjects,
117
+ getObjectsById: () => getObjectsById,
118
+ getPlans: () => getPlans,
119
+ getPlansById: () => getPlansById,
120
+ getPlansSlugBySlug: () => getPlansSlugBySlug,
121
+ getSearch: () => getSearch,
122
+ getSearchHealth: () => getSearchHealth,
123
+ getSearchIndexes: () => getSearchIndexes,
124
+ getSearchSaved: () => getSearchSaved,
125
+ getSearchSemantic: () => getSearchSemantic,
126
+ getSearchStats: () => getSearchStats,
127
+ getSearchStatus: () => getSearchStatus,
128
+ getStorageStats: () => getStorageStats,
129
+ getTenantMemberships: () => getTenantMemberships,
130
+ getTenants: () => getTenants,
131
+ getTenantsById: () => getTenantsById,
132
+ getThreads: () => getThreads,
133
+ getThreadsById: () => getThreadsById,
134
+ getThreadsSearch: () => getThreadsSearch,
135
+ getTrainingExamples: () => getTrainingExamples,
136
+ getTrainingExamplesById: () => getTrainingExamplesById,
137
+ getTransactions: () => getTransactions,
138
+ getTransactionsById: () => getTransactionsById,
139
+ getUserProfiles: () => getUserProfiles,
140
+ getUserProfilesById: () => getUserProfilesById,
141
+ getUserProfilesMe: () => getUserProfilesMe,
142
+ getUsers: () => getUsers,
143
+ getUsersById: () => getUsersById,
144
+ getUsersMe: () => getUsersMe,
145
+ getWallet: () => getWallet,
146
+ getWebhookConfigs: () => getWebhookConfigs,
147
+ getWebhookConfigsById: () => getWebhookConfigsById,
148
+ getWebhookDeliveries: () => getWebhookDeliveries,
149
+ getWebhookDeliveriesById: () => getWebhookDeliveriesById,
150
+ getWorkspaceMemberships: () => getWorkspaceMemberships,
151
+ getWorkspaces: () => getWorkspaces,
152
+ getWorkspacesById: () => getWorkspacesById,
153
+ getWorkspacesMine: () => getWorkspacesMine,
154
+ handleApiError: () => handleApiError,
155
+ isRetryableError: () => isRetryableError,
156
+ paginateAll: () => paginateAll,
157
+ paginateToArray: () => paginateToArray,
158
+ patchAgentsById: () => patchAgentsById,
159
+ patchApiKeysById: () => patchApiKeysById,
160
+ patchApiKeysByIdAllocate: () => patchApiKeysByIdAllocate,
161
+ patchApiKeysByIdRevoke: () => patchApiKeysByIdRevoke,
162
+ patchApiKeysByIdRotate: () => patchApiKeysByIdRotate,
163
+ patchApplicationsById: () => patchApplicationsById,
164
+ patchBucketsById: () => patchBucketsById,
165
+ patchConfigsByKey: () => patchConfigsByKey,
166
+ patchDocumentsById: () => patchDocumentsById,
167
+ patchExtractionResultsById: () => patchExtractionResultsById,
168
+ patchInvitationsByIdAccept: () => patchInvitationsByIdAccept,
169
+ patchInvitationsByIdResend: () => patchInvitationsByIdResend,
170
+ patchInvitationsByIdRevoke: () => patchInvitationsByIdRevoke,
171
+ patchMessagesById: () => patchMessagesById,
172
+ patchNotificationPreferencesById: () => patchNotificationPreferencesById,
173
+ patchTenantMembershipsByTenantIdByUserId: () => patchTenantMembershipsByTenantIdByUserId,
174
+ patchTenantsById: () => patchTenantsById,
175
+ patchThreadsById: () => patchThreadsById,
176
+ patchTrainingExamplesById: () => patchTrainingExamplesById,
177
+ patchUserProfilesById: () => patchUserProfilesById,
178
+ patchUsersAuthResetPassword: () => patchUsersAuthResetPassword,
179
+ patchUsersById: () => patchUsersById,
180
+ patchUsersByIdConfirmEmail: () => patchUsersByIdConfirmEmail,
181
+ patchUsersByIdResetPassword: () => patchUsersByIdResetPassword,
182
+ patchWalletAddons: () => patchWalletAddons,
183
+ patchWalletAddonsByAddonSlugCancel: () => patchWalletAddonsByAddonSlugCancel,
184
+ patchWalletPlan: () => patchWalletPlan,
185
+ patchWebhookConfigsById: () => patchWebhookConfigsById,
186
+ patchWorkspaceMembershipsByWorkspaceIdByUserId: () => patchWorkspaceMembershipsByWorkspaceIdByUserId,
187
+ patchWorkspacesById: () => patchWorkspacesById,
188
+ patchWorkspacesByIdAllocate: () => patchWorkspacesByIdAllocate,
189
+ postAgents: () => postAgents,
190
+ postAgentsByIdClone: () => postAgentsByIdClone,
191
+ postAgentsByIdTest: () => postAgentsByIdTest,
192
+ postAgentsByIdValidate: () => postAgentsByIdValidate,
193
+ postAiChunksSearch: () => postAiChunksSearch,
194
+ postAiEmbed: () => postAiEmbed,
195
+ postAiGraphEdges: () => postAiGraphEdges,
196
+ postAiGraphNodes: () => postAiGraphNodes,
197
+ postAiSearch: () => postAiSearch,
198
+ postAiSearchAdvanced: () => postAiSearchAdvanced,
199
+ postApiKeys: () => postApiKeys,
200
+ postApplications: () => postApplications,
201
+ postBuckets: () => postBuckets,
202
+ postConfigs: () => postConfigs,
203
+ postDocuments: () => postDocuments,
204
+ postDocumentsBulkDelete: () => postDocumentsBulkDelete,
205
+ postDocumentsBulkReprocess: () => postDocumentsBulkReprocess,
206
+ postDocumentsByIdAnalyze: () => postDocumentsByIdAnalyze,
207
+ postDocumentsByIdReprocess: () => postDocumentsByIdReprocess,
208
+ postDocumentsExport: () => postDocumentsExport,
209
+ postDocumentsImport: () => postDocumentsImport,
210
+ postDocumentsPresignedUpload: () => postDocumentsPresignedUpload,
211
+ postInvitationsAcceptByToken: () => postInvitationsAcceptByToken,
212
+ postInvitationsInvite: () => postInvitationsInvite,
213
+ postLlmAnalytics: () => postLlmAnalytics,
214
+ postMessages: () => postMessages,
215
+ postNotificationPreferences: () => postNotificationPreferences,
216
+ postObjectsBulkDestroy: () => postObjectsBulkDestroy,
217
+ postObjectsRegister: () => postObjectsRegister,
218
+ postPayments: () => postPayments,
219
+ postSearchReindex: () => postSearchReindex,
220
+ postSearchSaved: () => postSearchSaved,
221
+ postStorageSignDownload: () => postStorageSignDownload,
222
+ postStorageSignUpload: () => postStorageSignUpload,
223
+ postTenantMemberships: () => postTenantMemberships,
224
+ postTenants: () => postTenants,
225
+ postTenantsByIdBuyStorage: () => postTenantsByIdBuyStorage,
226
+ postTenantsByIdRemoveStorage: () => postTenantsByIdRemoveStorage,
227
+ postThreads: () => postThreads,
228
+ postThreadsActive: () => postThreadsActive,
229
+ postThreadsByIdMessages: () => postThreadsByIdMessages,
230
+ postThreadsByIdSummarize: () => postThreadsByIdSummarize,
231
+ postTokens: () => postTokens,
232
+ postTrainingExamples: () => postTrainingExamples,
233
+ postTrainingExamplesBulk: () => postTrainingExamplesBulk,
234
+ postTrainingExamplesBulkDelete: () => postTrainingExamplesBulkDelete,
235
+ postUserProfiles: () => postUserProfiles,
236
+ postUsersAuthConfirm: () => postUsersAuthConfirm,
237
+ postUsersAuthLogin: () => postUsersAuthLogin,
238
+ postUsersAuthMagicLinkLogin: () => postUsersAuthMagicLinkLogin,
239
+ postUsersAuthMagicLinkRequest: () => postUsersAuthMagicLinkRequest,
240
+ postUsersAuthRegister: () => postUsersAuthRegister,
241
+ postUsersAuthRegisterWithOidc: () => postUsersAuthRegisterWithOidc,
242
+ postUsersRegisterIsv: () => postUsersRegisterIsv,
243
+ postWebhookConfigs: () => postWebhookConfigs,
244
+ postWebhookConfigsByIdTest: () => postWebhookConfigsByIdTest,
245
+ postWebhookDeliveriesByIdRetry: () => postWebhookDeliveriesByIdRetry,
246
+ postWorkspaceMemberships: () => postWorkspaceMemberships,
247
+ postWorkspaces: () => postWorkspaces,
248
+ retryWithBackoff: () => retryWithBackoff,
249
+ sleep: () => sleep,
250
+ streamMessage: () => streamMessage,
251
+ streamSSE: () => streamSSE,
252
+ withRetry: () => withRetry
79
253
  });
80
254
  module.exports = __toCommonJS(index_exports);
81
255
 
82
- // ../../node_modules/@hey-api/client-fetch/dist/index.js
83
- var A = async (s, r) => {
84
- let e = typeof r == "function" ? await r(s) : r;
85
- if (e) return s.scheme === "bearer" ? `Bearer ${e}` : s.scheme === "basic" ? `Basic ${btoa(e)}` : e;
256
+ // src/_internal/core/bodySerializer.gen.ts
257
+ var jsonBodySerializer = {
258
+ bodySerializer: (body) => JSON.stringify(
259
+ body,
260
+ (_key, value) => typeof value === "bigint" ? value.toString() : value
261
+ )
86
262
  };
87
- var O = { bodySerializer: (s) => JSON.stringify(s, (r, e) => typeof e == "bigint" ? e.toString() : e) };
88
- var U = { $body_: "body", $headers_: "headers", $path_: "path", $query_: "query" };
89
- var D = Object.entries(U);
90
- var B = (s) => {
91
- switch (s) {
263
+
264
+ // src/_internal/core/params.gen.ts
265
+ var extraPrefixesMap = {
266
+ $body_: "body",
267
+ $headers_: "headers",
268
+ $path_: "path",
269
+ $query_: "query"
270
+ };
271
+ var extraPrefixes = Object.entries(extraPrefixesMap);
272
+
273
+ // src/_internal/core/serverSentEvents.gen.ts
274
+ var createSseClient = ({
275
+ onRequest,
276
+ onSseError,
277
+ onSseEvent,
278
+ responseTransformer,
279
+ responseValidator,
280
+ sseDefaultRetryDelay,
281
+ sseMaxRetryAttempts,
282
+ sseMaxRetryDelay,
283
+ sseSleepFn,
284
+ url,
285
+ ...options
286
+ }) => {
287
+ let lastEventId;
288
+ const sleep2 = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
289
+ const createStream = async function* () {
290
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
291
+ let attempt = 0;
292
+ const signal = options.signal ?? new AbortController().signal;
293
+ while (true) {
294
+ if (signal.aborted) break;
295
+ attempt++;
296
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
297
+ if (lastEventId !== void 0) {
298
+ headers.set("Last-Event-ID", lastEventId);
299
+ }
300
+ try {
301
+ const requestInit = {
302
+ redirect: "follow",
303
+ ...options,
304
+ body: options.serializedBody,
305
+ headers,
306
+ signal
307
+ };
308
+ let request = new Request(url, requestInit);
309
+ if (onRequest) {
310
+ request = await onRequest(url, requestInit);
311
+ }
312
+ const _fetch = options.fetch ?? globalThis.fetch;
313
+ const response = await _fetch(request);
314
+ if (!response.ok)
315
+ throw new Error(
316
+ `SSE failed: ${response.status} ${response.statusText}`
317
+ );
318
+ if (!response.body) throw new Error("No body in SSE response");
319
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
320
+ let buffer = "";
321
+ const abortHandler = () => {
322
+ try {
323
+ reader.cancel();
324
+ } catch {
325
+ }
326
+ };
327
+ signal.addEventListener("abort", abortHandler);
328
+ try {
329
+ while (true) {
330
+ const { done, value } = await reader.read();
331
+ if (done) break;
332
+ buffer += value;
333
+ const chunks = buffer.split("\n\n");
334
+ buffer = chunks.pop() ?? "";
335
+ for (const chunk of chunks) {
336
+ const lines = chunk.split("\n");
337
+ const dataLines = [];
338
+ let eventName;
339
+ for (const line of lines) {
340
+ if (line.startsWith("data:")) {
341
+ dataLines.push(line.replace(/^data:\s*/, ""));
342
+ } else if (line.startsWith("event:")) {
343
+ eventName = line.replace(/^event:\s*/, "");
344
+ } else if (line.startsWith("id:")) {
345
+ lastEventId = line.replace(/^id:\s*/, "");
346
+ } else if (line.startsWith("retry:")) {
347
+ const parsed = Number.parseInt(
348
+ line.replace(/^retry:\s*/, ""),
349
+ 10
350
+ );
351
+ if (!Number.isNaN(parsed)) {
352
+ retryDelay = parsed;
353
+ }
354
+ }
355
+ }
356
+ let data;
357
+ let parsedJson = false;
358
+ if (dataLines.length) {
359
+ const rawData = dataLines.join("\n");
360
+ try {
361
+ data = JSON.parse(rawData);
362
+ parsedJson = true;
363
+ } catch {
364
+ data = rawData;
365
+ }
366
+ }
367
+ if (parsedJson) {
368
+ if (responseValidator) {
369
+ await responseValidator(data);
370
+ }
371
+ if (responseTransformer) {
372
+ data = await responseTransformer(data);
373
+ }
374
+ }
375
+ onSseEvent?.({
376
+ data,
377
+ event: eventName,
378
+ id: lastEventId,
379
+ retry: retryDelay
380
+ });
381
+ if (dataLines.length) {
382
+ yield data;
383
+ }
384
+ }
385
+ }
386
+ } finally {
387
+ signal.removeEventListener("abort", abortHandler);
388
+ reader.releaseLock();
389
+ }
390
+ break;
391
+ } catch (error) {
392
+ onSseError?.(error);
393
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
394
+ break;
395
+ }
396
+ const backoff = Math.min(
397
+ retryDelay * 2 ** (attempt - 1),
398
+ sseMaxRetryDelay ?? 3e4
399
+ );
400
+ await sleep2(backoff);
401
+ }
402
+ }
403
+ };
404
+ const stream = createStream();
405
+ return { stream };
406
+ };
407
+
408
+ // src/_internal/core/pathSerializer.gen.ts
409
+ var separatorArrayExplode = (style) => {
410
+ switch (style) {
92
411
  case "label":
93
412
  return ".";
94
413
  case "matrix":
@@ -99,8 +418,8 @@ var B = (s) => {
99
418
  return "&";
100
419
  }
101
420
  };
102
- var N = (s) => {
103
- switch (s) {
421
+ var separatorArrayNoExplode = (style) => {
422
+ switch (style) {
104
423
  case "form":
105
424
  return ",";
106
425
  case "pipeDelimited":
@@ -111,8 +430,8 @@ var N = (s) => {
111
430
  return ",";
112
431
  }
113
432
  };
114
- var Q = (s) => {
115
- switch (s) {
433
+ var separatorObjectExplode = (style) => {
434
+ switch (style) {
116
435
  case "label":
117
436
  return ".";
118
437
  case "matrix":
@@ -123,1942 +442,2528 @@ var Q = (s) => {
123
442
  return "&";
124
443
  }
125
444
  };
126
- var S = ({ allowReserved: s, explode: r, name: e, style: a, value: i }) => {
127
- if (!r) {
128
- let t = (s ? i : i.map((l) => encodeURIComponent(l))).join(N(a));
129
- switch (a) {
445
+ var serializeArrayParam = ({
446
+ allowReserved,
447
+ explode,
448
+ name,
449
+ style,
450
+ value
451
+ }) => {
452
+ if (!explode) {
453
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
454
+ switch (style) {
130
455
  case "label":
131
- return `.${t}`;
456
+ return `.${joinedValues2}`;
132
457
  case "matrix":
133
- return `;${e}=${t}`;
458
+ return `;${name}=${joinedValues2}`;
134
459
  case "simple":
135
- return t;
460
+ return joinedValues2;
136
461
  default:
137
- return `${e}=${t}`;
462
+ return `${name}=${joinedValues2}`;
138
463
  }
139
464
  }
140
- let o = B(a), n = i.map((t) => a === "label" || a === "simple" ? s ? t : encodeURIComponent(t) : m({ allowReserved: s, name: e, value: t })).join(o);
141
- return a === "label" || a === "matrix" ? o + n : n;
142
- };
143
- var m = ({ allowReserved: s, name: r, value: e }) => {
144
- if (e == null) return "";
145
- if (typeof e == "object") throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
146
- return `${r}=${s ? e : encodeURIComponent(e)}`;
147
- };
148
- var q = ({ allowReserved: s, explode: r, name: e, style: a, value: i, valueOnly: o }) => {
149
- if (i instanceof Date) return o ? i.toISOString() : `${e}=${i.toISOString()}`;
150
- if (a !== "deepObject" && !r) {
151
- let l = [];
152
- Object.entries(i).forEach(([p, d]) => {
153
- l = [...l, p, s ? d : encodeURIComponent(d)];
154
- });
155
- let u = l.join(",");
156
- switch (a) {
465
+ const separator = separatorArrayExplode(style);
466
+ const joinedValues = value.map((v) => {
467
+ if (style === "label" || style === "simple") {
468
+ return allowReserved ? v : encodeURIComponent(v);
469
+ }
470
+ return serializePrimitiveParam({
471
+ allowReserved,
472
+ name,
473
+ value: v
474
+ });
475
+ }).join(separator);
476
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
477
+ };
478
+ var serializePrimitiveParam = ({
479
+ allowReserved,
480
+ name,
481
+ value
482
+ }) => {
483
+ if (value === void 0 || value === null) {
484
+ return "";
485
+ }
486
+ if (typeof value === "object") {
487
+ throw new Error(
488
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
489
+ );
490
+ }
491
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
492
+ };
493
+ var serializeObjectParam = ({
494
+ allowReserved,
495
+ explode,
496
+ name,
497
+ style,
498
+ value,
499
+ valueOnly
500
+ }) => {
501
+ if (value instanceof Date) {
502
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
503
+ }
504
+ if (style !== "deepObject" && !explode) {
505
+ let values = [];
506
+ Object.entries(value).forEach(([key, v]) => {
507
+ values = [
508
+ ...values,
509
+ key,
510
+ allowReserved ? v : encodeURIComponent(v)
511
+ ];
512
+ });
513
+ const joinedValues2 = values.join(",");
514
+ switch (style) {
157
515
  case "form":
158
- return `${e}=${u}`;
516
+ return `${name}=${joinedValues2}`;
159
517
  case "label":
160
- return `.${u}`;
518
+ return `.${joinedValues2}`;
161
519
  case "matrix":
162
- return `;${e}=${u}`;
520
+ return `;${name}=${joinedValues2}`;
163
521
  default:
164
- return u;
522
+ return joinedValues2;
165
523
  }
166
524
  }
167
- let n = Q(a), t = Object.entries(i).map(([l, u]) => m({ allowReserved: s, name: a === "deepObject" ? `${e}[${l}]` : l, value: u })).join(n);
168
- return a === "label" || a === "matrix" ? n + t : t;
525
+ const separator = separatorObjectExplode(style);
526
+ const joinedValues = Object.entries(value).map(
527
+ ([key, v]) => serializePrimitiveParam({
528
+ allowReserved,
529
+ name: style === "deepObject" ? `${name}[${key}]` : key,
530
+ value: v
531
+ })
532
+ ).join(separator);
533
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
169
534
  };
170
- var J = /\{[^{}]+\}/g;
171
- var M = ({ path: s, url: r }) => {
172
- let e = r, a = r.match(J);
173
- if (a) for (let i of a) {
174
- let o = false, n = i.substring(1, i.length - 1), t = "simple";
175
- n.endsWith("*") && (o = true, n = n.substring(0, n.length - 1)), n.startsWith(".") ? (n = n.substring(1), t = "label") : n.startsWith(";") && (n = n.substring(1), t = "matrix");
176
- let l = s[n];
177
- if (l == null) continue;
178
- if (Array.isArray(l)) {
179
- e = e.replace(i, S({ explode: o, name: n, style: t, value: l }));
180
- continue;
181
- }
182
- if (typeof l == "object") {
183
- e = e.replace(i, q({ explode: o, name: n, style: t, value: l, valueOnly: true }));
184
- continue;
535
+
536
+ // src/_internal/core/utils.gen.ts
537
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
538
+ var defaultPathSerializer = ({ path, url: _url }) => {
539
+ let url = _url;
540
+ const matches = _url.match(PATH_PARAM_RE);
541
+ if (matches) {
542
+ for (const match of matches) {
543
+ let explode = false;
544
+ let name = match.substring(1, match.length - 1);
545
+ let style = "simple";
546
+ if (name.endsWith("*")) {
547
+ explode = true;
548
+ name = name.substring(0, name.length - 1);
549
+ }
550
+ if (name.startsWith(".")) {
551
+ name = name.substring(1);
552
+ style = "label";
553
+ } else if (name.startsWith(";")) {
554
+ name = name.substring(1);
555
+ style = "matrix";
556
+ }
557
+ const value = path[name];
558
+ if (value === void 0 || value === null) {
559
+ continue;
560
+ }
561
+ if (Array.isArray(value)) {
562
+ url = url.replace(
563
+ match,
564
+ serializeArrayParam({ explode, name, style, value })
565
+ );
566
+ continue;
567
+ }
568
+ if (typeof value === "object") {
569
+ url = url.replace(
570
+ match,
571
+ serializeObjectParam({
572
+ explode,
573
+ name,
574
+ style,
575
+ value,
576
+ valueOnly: true
577
+ })
578
+ );
579
+ continue;
580
+ }
581
+ if (style === "matrix") {
582
+ url = url.replace(
583
+ match,
584
+ `;${serializePrimitiveParam({
585
+ name,
586
+ value
587
+ })}`
588
+ );
589
+ continue;
590
+ }
591
+ const replaceValue = encodeURIComponent(
592
+ style === "label" ? `.${value}` : value
593
+ );
594
+ url = url.replace(match, replaceValue);
185
595
  }
186
- if (t === "matrix") {
187
- e = e.replace(i, `;${m({ name: n, value: l })}`);
188
- continue;
596
+ }
597
+ return url;
598
+ };
599
+ var getUrl = ({
600
+ baseUrl,
601
+ path,
602
+ query,
603
+ querySerializer,
604
+ url: _url
605
+ }) => {
606
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
607
+ let url = (baseUrl ?? "") + pathUrl;
608
+ if (path) {
609
+ url = defaultPathSerializer({ path, url });
610
+ }
611
+ let search = query ? querySerializer(query) : "";
612
+ if (search.startsWith("?")) {
613
+ search = search.substring(1);
614
+ }
615
+ if (search) {
616
+ url += `?${search}`;
617
+ }
618
+ return url;
619
+ };
620
+ function getValidRequestBody(options) {
621
+ const hasBody = options.body !== void 0;
622
+ const isSerializedBody = hasBody && options.bodySerializer;
623
+ if (isSerializedBody) {
624
+ if ("serializedBody" in options) {
625
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
626
+ return hasSerializedBody ? options.serializedBody : null;
189
627
  }
190
- let u = encodeURIComponent(t === "label" ? `.${l}` : l);
191
- e = e.replace(i, u);
628
+ return options.body !== "" ? options.body : null;
629
+ }
630
+ if (hasBody) {
631
+ return options.body;
632
+ }
633
+ return void 0;
634
+ }
635
+
636
+ // src/_internal/core/auth.gen.ts
637
+ var getAuthToken = async (auth, callback) => {
638
+ const token = typeof callback === "function" ? await callback(auth) : callback;
639
+ if (!token) {
640
+ return;
641
+ }
642
+ if (auth.scheme === "bearer") {
643
+ return `Bearer ${token}`;
192
644
  }
193
- return e;
645
+ if (auth.scheme === "basic") {
646
+ return `Basic ${btoa(token)}`;
647
+ }
648
+ return token;
194
649
  };
195
- var k = ({ allowReserved: s, array: r, object: e } = {}) => (i) => {
196
- let o = [];
197
- if (i && typeof i == "object") for (let n in i) {
198
- let t = i[n];
199
- if (t != null) if (Array.isArray(t)) {
200
- let l = S({ allowReserved: s, explode: true, name: n, style: "form", value: t, ...r });
201
- l && o.push(l);
202
- } else if (typeof t == "object") {
203
- let l = q({ allowReserved: s, explode: true, name: n, style: "deepObject", value: t, ...e });
204
- l && o.push(l);
205
- } else {
206
- let l = m({ allowReserved: s, name: n, value: t });
207
- l && o.push(l);
650
+
651
+ // src/_internal/client/utils.gen.ts
652
+ var createQuerySerializer = ({
653
+ parameters = {},
654
+ ...args
655
+ } = {}) => {
656
+ const querySerializer = (queryParams) => {
657
+ const search = [];
658
+ if (queryParams && typeof queryParams === "object") {
659
+ for (const name in queryParams) {
660
+ const value = queryParams[name];
661
+ if (value === void 0 || value === null) {
662
+ continue;
663
+ }
664
+ const options = parameters[name] || args;
665
+ if (Array.isArray(value)) {
666
+ const serializedArray = serializeArrayParam({
667
+ allowReserved: options.allowReserved,
668
+ explode: true,
669
+ name,
670
+ style: "form",
671
+ value,
672
+ ...options.array
673
+ });
674
+ if (serializedArray) search.push(serializedArray);
675
+ } else if (typeof value === "object") {
676
+ const serializedObject = serializeObjectParam({
677
+ allowReserved: options.allowReserved,
678
+ explode: true,
679
+ name,
680
+ style: "deepObject",
681
+ value,
682
+ ...options.object
683
+ });
684
+ if (serializedObject) search.push(serializedObject);
685
+ } else {
686
+ const serializedPrimitive = serializePrimitiveParam({
687
+ allowReserved: options.allowReserved,
688
+ name,
689
+ value
690
+ });
691
+ if (serializedPrimitive) search.push(serializedPrimitive);
692
+ }
693
+ }
208
694
  }
695
+ return search.join("&");
696
+ };
697
+ return querySerializer;
698
+ };
699
+ var getParseAs = (contentType) => {
700
+ if (!contentType) {
701
+ return "stream";
209
702
  }
210
- return o.join("&");
703
+ const cleanContent = contentType.split(";")[0]?.trim();
704
+ if (!cleanContent) {
705
+ return;
706
+ }
707
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
708
+ return "json";
709
+ }
710
+ if (cleanContent === "multipart/form-data") {
711
+ return "formData";
712
+ }
713
+ if (["application/", "audio/", "image/", "video/"].some(
714
+ (type) => cleanContent.startsWith(type)
715
+ )) {
716
+ return "blob";
717
+ }
718
+ if (cleanContent.startsWith("text/")) {
719
+ return "text";
720
+ }
721
+ return;
211
722
  };
212
- var E = (s) => {
213
- if (!s) return "stream";
214
- let r = s.split(";")[0]?.trim();
215
- if (r) {
216
- if (r.startsWith("application/json") || r.endsWith("+json")) return "json";
217
- if (r === "multipart/form-data") return "formData";
218
- if (["application/", "audio/", "image/", "video/"].some((e) => r.startsWith(e))) return "blob";
219
- if (r.startsWith("text/")) return "text";
723
+ var checkForExistence = (options, name) => {
724
+ if (!name) {
725
+ return false;
220
726
  }
727
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
728
+ return true;
729
+ }
730
+ return false;
221
731
  };
222
- var $ = async ({ security: s, ...r }) => {
223
- for (let e of s) {
224
- let a = await A(e, r.auth);
225
- if (!a) continue;
226
- let i = e.name ?? "Authorization";
227
- switch (e.in) {
732
+ var setAuthParams = async ({
733
+ security,
734
+ ...options
735
+ }) => {
736
+ for (const auth of security) {
737
+ if (checkForExistence(options, auth.name)) {
738
+ continue;
739
+ }
740
+ const token = await getAuthToken(auth, options.auth);
741
+ if (!token) {
742
+ continue;
743
+ }
744
+ const name = auth.name ?? "Authorization";
745
+ switch (auth.in) {
228
746
  case "query":
229
- r.query || (r.query = {}), r.query[i] = a;
747
+ if (!options.query) {
748
+ options.query = {};
749
+ }
750
+ options.query[name] = token;
230
751
  break;
231
752
  case "cookie":
232
- r.headers.append("Cookie", `${i}=${a}`);
753
+ options.headers.append("Cookie", `${name}=${token}`);
233
754
  break;
234
755
  case "header":
235
756
  default:
236
- r.headers.set(i, a);
757
+ options.headers.set(name, token);
237
758
  break;
238
759
  }
239
- return;
240
760
  }
241
761
  };
242
- var C = (s) => L({ baseUrl: s.baseUrl, path: s.path, query: s.query, querySerializer: typeof s.querySerializer == "function" ? s.querySerializer : k(s.querySerializer), url: s.url });
243
- var L = ({ baseUrl: s, path: r, query: e, querySerializer: a, url: i }) => {
244
- let o = i.startsWith("/") ? i : `/${i}`, n = (s ?? "") + o;
245
- r && (n = M({ path: r, url: n }));
246
- let t = e ? a(e) : "";
247
- return t.startsWith("?") && (t = t.substring(1)), t && (n += `?${t}`), n;
248
- };
249
- var x = (s, r) => {
250
- let e = { ...s, ...r };
251
- return e.baseUrl?.endsWith("/") && (e.baseUrl = e.baseUrl.substring(0, e.baseUrl.length - 1)), e.headers = j(s.headers, r.headers), e;
252
- };
253
- var j = (...s) => {
254
- let r = new Headers();
255
- for (let e of s) {
256
- if (!e || typeof e != "object") continue;
257
- let a = e instanceof Headers ? e.entries() : Object.entries(e);
258
- for (let [i, o] of a) if (o === null) r.delete(i);
259
- else if (Array.isArray(o)) for (let n of o) r.append(i, n);
260
- else o !== void 0 && r.set(i, typeof o == "object" ? JSON.stringify(o) : o);
261
- }
262
- return r;
762
+ var buildUrl = (options) => getUrl({
763
+ baseUrl: options.baseUrl,
764
+ path: options.path,
765
+ query: options.query,
766
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
767
+ url: options.url
768
+ });
769
+ var mergeConfigs = (a, b) => {
770
+ const config = { ...a, ...b };
771
+ if (config.baseUrl?.endsWith("/")) {
772
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
773
+ }
774
+ config.headers = mergeHeaders(a.headers, b.headers);
775
+ return config;
776
+ };
777
+ var headersEntries = (headers) => {
778
+ const entries = [];
779
+ headers.forEach((value, key) => {
780
+ entries.push([key, value]);
781
+ });
782
+ return entries;
783
+ };
784
+ var mergeHeaders = (...headers) => {
785
+ const mergedHeaders = new Headers();
786
+ for (const header of headers) {
787
+ if (!header) {
788
+ continue;
789
+ }
790
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
791
+ for (const [key, value] of iterator) {
792
+ if (value === null) {
793
+ mergedHeaders.delete(key);
794
+ } else if (Array.isArray(value)) {
795
+ for (const v of value) {
796
+ mergedHeaders.append(key, v);
797
+ }
798
+ } else if (value !== void 0) {
799
+ mergedHeaders.set(
800
+ key,
801
+ typeof value === "object" ? JSON.stringify(value) : value
802
+ );
803
+ }
804
+ }
805
+ }
806
+ return mergedHeaders;
263
807
  };
264
- var g = class {
808
+ var Interceptors = class {
265
809
  constructor() {
266
- __publicField(this, "_fns");
267
- this._fns = [];
810
+ this.fns = [];
268
811
  }
269
812
  clear() {
270
- this._fns = [];
813
+ this.fns = [];
271
814
  }
272
- getInterceptorIndex(r) {
273
- return typeof r == "number" ? this._fns[r] ? r : -1 : this._fns.indexOf(r);
815
+ eject(id) {
816
+ const index = this.getInterceptorIndex(id);
817
+ if (this.fns[index]) {
818
+ this.fns[index] = null;
819
+ }
274
820
  }
275
- exists(r) {
276
- let e = this.getInterceptorIndex(r);
277
- return !!this._fns[e];
821
+ exists(id) {
822
+ const index = this.getInterceptorIndex(id);
823
+ return Boolean(this.fns[index]);
278
824
  }
279
- eject(r) {
280
- let e = this.getInterceptorIndex(r);
281
- this._fns[e] && (this._fns[e] = null);
825
+ getInterceptorIndex(id) {
826
+ if (typeof id === "number") {
827
+ return this.fns[id] ? id : -1;
828
+ }
829
+ return this.fns.indexOf(id);
282
830
  }
283
- update(r, e) {
284
- let a = this.getInterceptorIndex(r);
285
- return this._fns[a] ? (this._fns[a] = e, r) : false;
831
+ update(id, fn) {
832
+ const index = this.getInterceptorIndex(id);
833
+ if (this.fns[index]) {
834
+ this.fns[index] = fn;
835
+ return id;
836
+ }
837
+ return false;
286
838
  }
287
- use(r) {
288
- return this._fns = [...this._fns, r], this._fns.length - 1;
839
+ use(fn) {
840
+ this.fns.push(fn);
841
+ return this.fns.length - 1;
289
842
  }
290
843
  };
291
- var v = () => ({ error: new g(), request: new g(), response: new g() });
292
- var V = k({ allowReserved: false, array: { explode: true, style: "form" }, object: { explode: true, style: "deepObject" } });
293
- var F = { "Content-Type": "application/json" };
294
- var w = (s = {}) => ({ ...O, headers: F, parseAs: "auto", querySerializer: V, ...s });
295
- var G = (s = {}) => {
296
- let r = x(w(), s), e = () => ({ ...r }), a = (n) => (r = x(r, n), e()), i = v(), o = async (n) => {
297
- let t = { ...r, ...n, fetch: n.fetch ?? r.fetch ?? globalThis.fetch, headers: j(r.headers, n.headers) };
298
- t.security && await $({ ...t, security: t.security }), t.body && t.bodySerializer && (t.body = t.bodySerializer(t.body)), (t.body === void 0 || t.body === "") && t.headers.delete("Content-Type");
299
- let l = C(t), u = { redirect: "follow", ...t }, p = new Request(l, u);
300
- for (let f of i.request._fns) f && (p = await f(p, t));
301
- let d = t.fetch, c = await d(p);
302
- for (let f of i.response._fns) f && (c = await f(c, p, t));
303
- let b = { request: p, response: c };
304
- if (c.ok) {
305
- if (c.status === 204 || c.headers.get("Content-Length") === "0") return t.responseStyle === "data" ? {} : { data: {}, ...b };
306
- let f = (t.parseAs === "auto" ? E(c.headers.get("Content-Type")) : t.parseAs) ?? "json";
307
- if (f === "stream") return t.responseStyle === "data" ? c.body : { data: c.body, ...b };
308
- let h = await c[f]();
309
- return f === "json" && (t.responseValidator && await t.responseValidator(h), t.responseTransformer && (h = await t.responseTransformer(h))), t.responseStyle === "data" ? h : { data: h, ...b };
844
+ var createInterceptors = () => ({
845
+ error: new Interceptors(),
846
+ request: new Interceptors(),
847
+ response: new Interceptors()
848
+ });
849
+ var defaultQuerySerializer = createQuerySerializer({
850
+ allowReserved: false,
851
+ array: {
852
+ explode: true,
853
+ style: "form"
854
+ },
855
+ object: {
856
+ explode: true,
857
+ style: "deepObject"
858
+ }
859
+ });
860
+ var defaultHeaders = {
861
+ "Content-Type": "application/json"
862
+ };
863
+ var createConfig = (override = {}) => ({
864
+ ...jsonBodySerializer,
865
+ headers: defaultHeaders,
866
+ parseAs: "auto",
867
+ querySerializer: defaultQuerySerializer,
868
+ ...override
869
+ });
870
+
871
+ // src/_internal/client/client.gen.ts
872
+ var createClient = (config = {}) => {
873
+ let _config = mergeConfigs(createConfig(), config);
874
+ const getConfig = () => ({ ..._config });
875
+ const setConfig = (config2) => {
876
+ _config = mergeConfigs(_config, config2);
877
+ return getConfig();
878
+ };
879
+ const interceptors = createInterceptors();
880
+ const beforeRequest = async (options) => {
881
+ const opts = {
882
+ ..._config,
883
+ ...options,
884
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
885
+ headers: mergeHeaders(_config.headers, options.headers),
886
+ serializedBody: void 0
887
+ };
888
+ if (opts.security) {
889
+ await setAuthParams({
890
+ ...opts,
891
+ security: opts.security
892
+ });
893
+ }
894
+ if (opts.requestValidator) {
895
+ await opts.requestValidator(opts);
896
+ }
897
+ if (opts.body !== void 0 && opts.bodySerializer) {
898
+ opts.serializedBody = opts.bodySerializer(opts.body);
899
+ }
900
+ if (opts.body === void 0 || opts.serializedBody === "") {
901
+ opts.headers.delete("Content-Type");
902
+ }
903
+ const url = buildUrl(opts);
904
+ return { opts, url };
905
+ };
906
+ const request = async (options) => {
907
+ const { opts, url } = await beforeRequest(options);
908
+ const requestInit = {
909
+ redirect: "follow",
910
+ ...opts,
911
+ body: getValidRequestBody(opts)
912
+ };
913
+ let request2 = new Request(url, requestInit);
914
+ for (const fn of interceptors.request.fns) {
915
+ if (fn) {
916
+ request2 = await fn(request2, opts);
917
+ }
918
+ }
919
+ const _fetch = opts.fetch;
920
+ let response;
921
+ try {
922
+ response = await _fetch(request2);
923
+ } catch (error2) {
924
+ let finalError2 = error2;
925
+ for (const fn of interceptors.error.fns) {
926
+ if (fn) {
927
+ finalError2 = await fn(
928
+ error2,
929
+ void 0,
930
+ request2,
931
+ opts
932
+ );
933
+ }
934
+ }
935
+ finalError2 = finalError2 || {};
936
+ if (opts.throwOnError) {
937
+ throw finalError2;
938
+ }
939
+ return opts.responseStyle === "data" ? void 0 : {
940
+ error: finalError2,
941
+ request: request2,
942
+ response: void 0
943
+ };
944
+ }
945
+ for (const fn of interceptors.response.fns) {
946
+ if (fn) {
947
+ response = await fn(response, request2, opts);
948
+ }
949
+ }
950
+ const result = {
951
+ request: request2,
952
+ response
953
+ };
954
+ if (response.ok) {
955
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
956
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
957
+ let emptyData;
958
+ switch (parseAs) {
959
+ case "arrayBuffer":
960
+ case "blob":
961
+ case "text":
962
+ emptyData = await response[parseAs]();
963
+ break;
964
+ case "formData":
965
+ emptyData = new FormData();
966
+ break;
967
+ case "stream":
968
+ emptyData = response.body;
969
+ break;
970
+ case "json":
971
+ default:
972
+ emptyData = {};
973
+ break;
974
+ }
975
+ return opts.responseStyle === "data" ? emptyData : {
976
+ data: emptyData,
977
+ ...result
978
+ };
979
+ }
980
+ let data;
981
+ switch (parseAs) {
982
+ case "arrayBuffer":
983
+ case "blob":
984
+ case "formData":
985
+ case "json":
986
+ case "text":
987
+ data = await response[parseAs]();
988
+ break;
989
+ case "stream":
990
+ return opts.responseStyle === "data" ? response.body : {
991
+ data: response.body,
992
+ ...result
993
+ };
994
+ }
995
+ if (parseAs === "json") {
996
+ if (opts.responseValidator) {
997
+ await opts.responseValidator(data);
998
+ }
999
+ if (opts.responseTransformer) {
1000
+ data = await opts.responseTransformer(data);
1001
+ }
1002
+ }
1003
+ return opts.responseStyle === "data" ? data : {
1004
+ data,
1005
+ ...result
1006
+ };
310
1007
  }
311
- let R = await c.text();
1008
+ const textError = await response.text();
1009
+ let jsonError;
312
1010
  try {
313
- R = JSON.parse(R);
1011
+ jsonError = JSON.parse(textError);
314
1012
  } catch {
315
1013
  }
316
- let y = R;
317
- for (let f of i.error._fns) f && (y = await f(R, c, p, t));
318
- if (y = y || {}, t.throwOnError) throw y;
319
- return t.responseStyle === "data" ? void 0 : { error: y, ...b };
1014
+ const error = jsonError ?? textError;
1015
+ let finalError = error;
1016
+ for (const fn of interceptors.error.fns) {
1017
+ if (fn) {
1018
+ finalError = await fn(error, response, request2, opts);
1019
+ }
1020
+ }
1021
+ finalError = finalError || {};
1022
+ if (opts.throwOnError) {
1023
+ throw finalError;
1024
+ }
1025
+ return opts.responseStyle === "data" ? void 0 : {
1026
+ error: finalError,
1027
+ ...result
1028
+ };
1029
+ };
1030
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
1031
+ const makeSseFn = (method) => async (options) => {
1032
+ const { opts, url } = await beforeRequest(options);
1033
+ return createSseClient({
1034
+ ...opts,
1035
+ body: opts.body,
1036
+ headers: opts.headers,
1037
+ method,
1038
+ onRequest: async (url2, init) => {
1039
+ let request2 = new Request(url2, init);
1040
+ for (const fn of interceptors.request.fns) {
1041
+ if (fn) {
1042
+ request2 = await fn(request2, opts);
1043
+ }
1044
+ }
1045
+ return request2;
1046
+ },
1047
+ url
1048
+ });
1049
+ };
1050
+ return {
1051
+ buildUrl,
1052
+ connect: makeMethodFn("CONNECT"),
1053
+ delete: makeMethodFn("DELETE"),
1054
+ get: makeMethodFn("GET"),
1055
+ getConfig,
1056
+ head: makeMethodFn("HEAD"),
1057
+ interceptors,
1058
+ options: makeMethodFn("OPTIONS"),
1059
+ patch: makeMethodFn("PATCH"),
1060
+ post: makeMethodFn("POST"),
1061
+ put: makeMethodFn("PUT"),
1062
+ request,
1063
+ setConfig,
1064
+ sse: {
1065
+ connect: makeSseFn("CONNECT"),
1066
+ delete: makeSseFn("DELETE"),
1067
+ get: makeSseFn("GET"),
1068
+ head: makeSseFn("HEAD"),
1069
+ options: makeSseFn("OPTIONS"),
1070
+ patch: makeSseFn("PATCH"),
1071
+ post: makeSseFn("POST"),
1072
+ put: makeSseFn("PUT"),
1073
+ trace: makeSseFn("TRACE")
1074
+ },
1075
+ trace: makeMethodFn("TRACE")
320
1076
  };
321
- return { buildUrl: C, connect: (n) => o({ ...n, method: "CONNECT" }), delete: (n) => o({ ...n, method: "DELETE" }), get: (n) => o({ ...n, method: "GET" }), getConfig: e, head: (n) => o({ ...n, method: "HEAD" }), interceptors: i, options: (n) => o({ ...n, method: "OPTIONS" }), patch: (n) => o({ ...n, method: "PATCH" }), post: (n) => o({ ...n, method: "POST" }), put: (n) => o({ ...n, method: "PUT" }), request: o, setConfig: a, trace: (n) => o({ ...n, method: "TRACE" }) };
322
1077
  };
323
1078
 
324
- // src/_internal/services.gen.ts
325
- var client = G(w());
326
- var SearchService = class {
327
- /**
328
- * /ai/search/advanced operation on search resource
329
- */
330
- static postAiSearchAdvanced(options) {
331
- return (options?.client ?? client).post({
332
- ...options,
333
- url: "/ai/search/advanced"
334
- });
1079
+ // src/_internal/client.gen.ts
1080
+ var client = createClient(
1081
+ createConfig({ baseUrl: "http://localhost:22222" })
1082
+ );
1083
+
1084
+ // src/_internal/sdk.gen.ts
1085
+ var postAiSearchAdvanced = (options) => (options.client ?? client).post({
1086
+ security: [{ scheme: "bearer", type: "http" }],
1087
+ url: "/ai/search/advanced",
1088
+ ...options,
1089
+ headers: {
1090
+ "Content-Type": "application/vnd.api+json",
1091
+ ...options.headers
335
1092
  }
336
- /**
337
- * /search/indexes operation on search resource
338
- */
339
- static getSearchIndexes(options) {
340
- return (options?.client ?? client).get({
341
- ...options,
342
- url: "/search/indexes"
343
- });
1093
+ });
1094
+ var getThreads = (options) => (options.client ?? client).get({
1095
+ security: [{ scheme: "bearer", type: "http" }],
1096
+ url: "/threads",
1097
+ ...options
1098
+ });
1099
+ var postThreads = (options) => (options.client ?? client).post({
1100
+ security: [{ scheme: "bearer", type: "http" }],
1101
+ url: "/threads",
1102
+ ...options,
1103
+ headers: {
1104
+ "Content-Type": "application/vnd.api+json",
1105
+ ...options.headers
344
1106
  }
345
- /**
346
- * /search operation on search resource
347
- */
348
- static getSearch(options) {
349
- return (options?.client ?? client).get({
350
- ...options,
351
- url: "/search"
352
- });
1107
+ });
1108
+ var getLlmAnalyticsCosts = (options) => (options.client ?? client).get({
1109
+ security: [{ scheme: "bearer", type: "http" }],
1110
+ url: "/llm_analytics/costs",
1111
+ ...options
1112
+ });
1113
+ var getAiChunksDocumentByDocumentId = (options) => (options.client ?? client).get({
1114
+ security: [{ scheme: "bearer", type: "http" }],
1115
+ url: "/ai/chunks/document/{document_id}",
1116
+ ...options
1117
+ });
1118
+ var deleteExtractionResultsById = (options) => (options.client ?? client).delete({
1119
+ security: [{ scheme: "bearer", type: "http" }],
1120
+ url: "/extraction_results/{id}",
1121
+ ...options
1122
+ });
1123
+ var getExtractionResultsById = (options) => (options.client ?? client).get({
1124
+ security: [{ scheme: "bearer", type: "http" }],
1125
+ url: "/extraction_results/{id}",
1126
+ ...options
1127
+ });
1128
+ var patchExtractionResultsById = (options) => (options.client ?? client).patch({
1129
+ security: [{ scheme: "bearer", type: "http" }],
1130
+ url: "/extraction_results/{id}",
1131
+ ...options,
1132
+ headers: {
1133
+ "Content-Type": "application/vnd.api+json",
1134
+ ...options.headers
353
1135
  }
354
- /**
355
- * /search/semantic operation on search resource
356
- */
357
- static getSearchSemantic(options) {
358
- return (options?.client ?? client).get({
359
- ...options,
360
- url: "/search/semantic"
361
- });
1136
+ });
1137
+ var getWorkspaces = (options) => (options.client ?? client).get({
1138
+ security: [{ scheme: "bearer", type: "http" }],
1139
+ url: "/workspaces",
1140
+ ...options
1141
+ });
1142
+ var postWorkspaces = (options) => (options.client ?? client).post({
1143
+ security: [{ scheme: "bearer", type: "http" }],
1144
+ url: "/workspaces",
1145
+ ...options,
1146
+ headers: {
1147
+ "Content-Type": "application/vnd.api+json",
1148
+ ...options.headers
362
1149
  }
363
- /**
364
- * /ai/search operation on search resource
365
- */
366
- static postAiSearch(options) {
367
- return (options?.client ?? client).post({
368
- ...options,
369
- url: "/ai/search"
370
- });
1150
+ });
1151
+ var getDocumentsStats = (options) => (options.client ?? client).get({
1152
+ security: [{ scheme: "bearer", type: "http" }],
1153
+ url: "/documents/stats",
1154
+ ...options
1155
+ });
1156
+ var postObjectsRegister = (options) => (options.client ?? client).post({
1157
+ security: [{ scheme: "bearer", type: "http" }],
1158
+ url: "/objects/register",
1159
+ ...options,
1160
+ headers: {
1161
+ "Content-Type": "application/vnd.api+json",
1162
+ ...options.headers
371
1163
  }
372
- /**
373
- * /search/health operation on search resource
374
- */
375
- static getSearchHealth(options) {
376
- return (options?.client ?? client).get({
377
- ...options,
378
- url: "/search/health"
379
- });
1164
+ });
1165
+ var getLlmAnalyticsWorkspace = (options) => (options.client ?? client).get({
1166
+ security: [{ scheme: "bearer", type: "http" }],
1167
+ url: "/llm_analytics/workspace",
1168
+ ...options
1169
+ });
1170
+ var getSearchIndexes = (options) => (options.client ?? client).get({
1171
+ security: [{ scheme: "bearer", type: "http" }],
1172
+ url: "/search/indexes",
1173
+ ...options
1174
+ });
1175
+ var getCreditPackagesSlugBySlug = (options) => (options.client ?? client).get({
1176
+ security: [{ scheme: "bearer", type: "http" }],
1177
+ url: "/credit-packages/slug/{slug}",
1178
+ ...options
1179
+ });
1180
+ var getLlmAnalyticsPlatform = (options) => (options.client ?? client).get({
1181
+ security: [{ scheme: "bearer", type: "http" }],
1182
+ url: "/llm_analytics/platform",
1183
+ ...options
1184
+ });
1185
+ var postPayments = (options) => (options.client ?? client).post({
1186
+ security: [{ scheme: "bearer", type: "http" }],
1187
+ url: "/payments",
1188
+ ...options,
1189
+ headers: {
1190
+ "Content-Type": "application/vnd.api+json",
1191
+ ...options.headers
380
1192
  }
381
- /**
382
- * /search/status operation on search resource
383
- */
384
- static getSearchStatus(options) {
385
- return (options?.client ?? client).get({
386
- ...options,
387
- url: "/search/status"
388
- });
1193
+ });
1194
+ var patchApiKeysByIdRevoke = (options) => (options.client ?? client).patch({
1195
+ security: [{ scheme: "bearer", type: "http" }],
1196
+ url: "/api_keys/{id}/revoke",
1197
+ ...options,
1198
+ headers: {
1199
+ "Content-Type": "application/vnd.api+json",
1200
+ ...options.headers
389
1201
  }
390
- /**
391
- * /search/reindex operation on search resource
392
- */
393
- static postSearchReindex(options) {
394
- return (options?.client ?? client).post({
395
- ...options,
396
- url: "/search/reindex"
397
- });
1202
+ });
1203
+ var getInvitationsConsumeByToken = (options) => (options.client ?? client).get({
1204
+ security: [{ scheme: "bearer", type: "http" }],
1205
+ url: "/invitations/consume/{token}",
1206
+ ...options
1207
+ });
1208
+ var patchWorkspacesByIdAllocate = (options) => (options.client ?? client).patch({
1209
+ security: [{ scheme: "bearer", type: "http" }],
1210
+ url: "/workspaces/{id}/allocate",
1211
+ ...options,
1212
+ headers: {
1213
+ "Content-Type": "application/vnd.api+json",
1214
+ ...options.headers
398
1215
  }
399
- /**
400
- * /search/stats operation on search resource
401
- */
402
- static getSearchStats(options) {
403
- return (options?.client ?? client).get({
404
- ...options,
405
- url: "/search/stats"
406
- });
1216
+ });
1217
+ var postThreadsActive = (options) => (options.client ?? client).post({
1218
+ security: [{ scheme: "bearer", type: "http" }],
1219
+ url: "/threads/active",
1220
+ ...options,
1221
+ headers: {
1222
+ "Content-Type": "application/vnd.api+json",
1223
+ ...options.headers
407
1224
  }
408
- };
409
- var ThreadService = class {
410
- /**
411
- * /threads operation on thread resource
412
- */
413
- static getThreads(options) {
414
- return (options?.client ?? client).get({
415
- ...options,
416
- url: "/threads"
417
- });
1225
+ });
1226
+ var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
1227
+ security: [{ scheme: "bearer", type: "http" }],
1228
+ url: "/invitations/{id}/revoke",
1229
+ ...options,
1230
+ headers: {
1231
+ "Content-Type": "application/vnd.api+json",
1232
+ ...options.headers
418
1233
  }
419
- /**
420
- * /threads operation on thread resource
421
- */
422
- static postThreads(options) {
423
- return (options?.client ?? client).post({
424
- ...options,
425
- url: "/threads"
426
- });
1234
+ });
1235
+ var getConfigs = (options) => (options.client ?? client).get({
1236
+ security: [{ scheme: "bearer", type: "http" }],
1237
+ url: "/configs",
1238
+ ...options
1239
+ });
1240
+ var postConfigs = (options) => (options.client ?? client).post({
1241
+ security: [{ scheme: "bearer", type: "http" }],
1242
+ url: "/configs",
1243
+ ...options,
1244
+ headers: {
1245
+ "Content-Type": "application/vnd.api+json",
1246
+ ...options.headers
427
1247
  }
428
- /**
429
- * /threads/active operation on thread resource
430
- */
431
- static postThreadsActive(options) {
432
- return (options?.client ?? client).post({
433
- ...options,
434
- url: "/threads/active"
435
- });
1248
+ });
1249
+ var postTokens = (options) => (options.client ?? client).post({
1250
+ security: [{ scheme: "bearer", type: "http" }],
1251
+ url: "/tokens",
1252
+ ...options,
1253
+ headers: {
1254
+ "Content-Type": "application/vnd.api+json",
1255
+ ...options.headers
436
1256
  }
437
- /**
438
- * /threads/:id/messages operation on thread resource
439
- */
440
- static postThreadsByIdMessages(options) {
441
- return (options?.client ?? client).post({
442
- ...options,
443
- url: "/threads/{id}/messages"
444
- });
1257
+ });
1258
+ var deleteTrainingExamplesById = (options) => (options.client ?? client).delete({
1259
+ security: [{ scheme: "bearer", type: "http" }],
1260
+ url: "/training_examples/{id}",
1261
+ ...options
1262
+ });
1263
+ var getTrainingExamplesById = (options) => (options.client ?? client).get({
1264
+ security: [{ scheme: "bearer", type: "http" }],
1265
+ url: "/training_examples/{id}",
1266
+ ...options
1267
+ });
1268
+ var patchTrainingExamplesById = (options) => (options.client ?? client).patch({
1269
+ security: [{ scheme: "bearer", type: "http" }],
1270
+ url: "/training_examples/{id}",
1271
+ ...options,
1272
+ headers: {
1273
+ "Content-Type": "application/vnd.api+json",
1274
+ ...options.headers
445
1275
  }
446
- /**
447
- * /threads/:id operation on thread resource
448
- */
449
- static deleteThreadsById(options) {
450
- return (options?.client ?? client).delete({
451
- ...options,
452
- url: "/threads/{id}"
453
- });
1276
+ });
1277
+ var deleteSearchSavedById = (options) => (options.client ?? client).delete({
1278
+ security: [{ scheme: "bearer", type: "http" }],
1279
+ url: "/search/saved/{id}",
1280
+ ...options
1281
+ });
1282
+ var patchUsersAuthResetPassword = (options) => (options.client ?? client).patch({
1283
+ security: [{ scheme: "bearer", type: "http" }],
1284
+ url: "/users/auth/reset-password",
1285
+ ...options,
1286
+ headers: {
1287
+ "Content-Type": "application/vnd.api+json",
1288
+ ...options.headers
454
1289
  }
455
- /**
456
- * /threads/:id operation on thread resource
457
- */
458
- static getThreadsById(options) {
459
- return (options?.client ?? client).get({
460
- ...options,
461
- url: "/threads/{id}"
462
- });
1290
+ });
1291
+ var getBucketsByIdStats = (options) => (options.client ?? client).get({
1292
+ security: [{ scheme: "bearer", type: "http" }],
1293
+ url: "/buckets/{id}/stats",
1294
+ ...options
1295
+ });
1296
+ var getDocumentsSearch = (options) => (options.client ?? client).get({
1297
+ security: [{ scheme: "bearer", type: "http" }],
1298
+ url: "/documents/search",
1299
+ ...options
1300
+ });
1301
+ var getBucketsByIdObjects = (options) => (options.client ?? client).get({
1302
+ security: [{ scheme: "bearer", type: "http" }],
1303
+ url: "/buckets/{id}/objects",
1304
+ ...options
1305
+ });
1306
+ var patchInvitationsByIdResend = (options) => (options.client ?? client).patch({
1307
+ security: [{ scheme: "bearer", type: "http" }],
1308
+ url: "/invitations/{id}/resend",
1309
+ ...options,
1310
+ headers: {
1311
+ "Content-Type": "application/vnd.api+json",
1312
+ ...options.headers
463
1313
  }
464
- /**
465
- * /threads/:id operation on thread resource
466
- */
467
- static patchThreadsById(options) {
468
- return (options?.client ?? client).patch({
469
- ...options,
470
- url: "/threads/{id}"
471
- });
1314
+ });
1315
+ var getSearchSaved = (options) => (options.client ?? client).get({
1316
+ security: [{ scheme: "bearer", type: "http" }],
1317
+ url: "/search/saved",
1318
+ ...options
1319
+ });
1320
+ var postSearchSaved = (options) => (options.client ?? client).post({
1321
+ security: [{ scheme: "bearer", type: "http" }],
1322
+ url: "/search/saved",
1323
+ ...options,
1324
+ headers: {
1325
+ "Content-Type": "application/vnd.api+json",
1326
+ ...options.headers
472
1327
  }
473
- /**
474
- * /threads/search operation on thread resource
475
- */
476
- static getThreadsSearch(options) {
477
- return (options?.client ?? client).get({
478
- ...options,
479
- url: "/threads/search"
480
- });
1328
+ });
1329
+ var getUserProfilesMe = (options) => (options.client ?? client).get({
1330
+ security: [{ scheme: "bearer", type: "http" }],
1331
+ url: "/user_profiles/me",
1332
+ ...options
1333
+ });
1334
+ var postInvitationsInvite = (options) => (options.client ?? client).post({
1335
+ security: [{ scheme: "bearer", type: "http" }],
1336
+ url: "/invitations/invite",
1337
+ ...options,
1338
+ headers: {
1339
+ "Content-Type": "application/vnd.api+json",
1340
+ ...options.headers
481
1341
  }
482
- /**
483
- * /threads/:id/summarize operation on thread resource
484
- */
485
- static postThreadsByIdSummarize(options) {
486
- return (options?.client ?? client).post({
487
- ...options,
488
- url: "/threads/{id}/summarize"
489
- });
1342
+ });
1343
+ var deleteWebhookConfigsById = (options) => (options.client ?? client).delete({
1344
+ security: [{ scheme: "bearer", type: "http" }],
1345
+ url: "/webhook_configs/{id}",
1346
+ ...options
1347
+ });
1348
+ var getWebhookConfigsById = (options) => (options.client ?? client).get({
1349
+ security: [{ scheme: "bearer", type: "http" }],
1350
+ url: "/webhook_configs/{id}",
1351
+ ...options
1352
+ });
1353
+ var patchWebhookConfigsById = (options) => (options.client ?? client).patch({
1354
+ security: [{ scheme: "bearer", type: "http" }],
1355
+ url: "/webhook_configs/{id}",
1356
+ ...options,
1357
+ headers: {
1358
+ "Content-Type": "application/vnd.api+json",
1359
+ ...options.headers
490
1360
  }
491
- };
492
- var ExtractionResultService = class {
493
- /**
494
- * /extraction_results/:id operation on extraction_result resource
495
- */
496
- static deleteExtractionResultsById(options) {
497
- return (options?.client ?? client).delete({
498
- ...options,
499
- url: "/extraction_results/{id}"
500
- });
1361
+ });
1362
+ var postInvitationsAcceptByToken = (options) => (options.client ?? client).post({
1363
+ security: [{ scheme: "bearer", type: "http" }],
1364
+ url: "/invitations/accept_by_token",
1365
+ ...options,
1366
+ headers: {
1367
+ "Content-Type": "application/vnd.api+json",
1368
+ ...options.headers
501
1369
  }
502
- /**
503
- * /extraction_results/:id operation on extraction_result resource
504
- */
505
- static getExtractionResultsById(options) {
506
- return (options?.client ?? client).get({
507
- ...options,
508
- url: "/extraction_results/{id}"
509
- });
1370
+ });
1371
+ var postDocumentsBulkDelete = (options) => (options.client ?? client).post({
1372
+ security: [{ scheme: "bearer", type: "http" }],
1373
+ url: "/documents/bulk_delete",
1374
+ ...options,
1375
+ headers: {
1376
+ "Content-Type": "application/vnd.api+json",
1377
+ ...options.headers
510
1378
  }
511
- /**
512
- * /extraction_results/:id operation on extraction_result resource
513
- */
514
- static patchExtractionResultsById(options) {
515
- return (options?.client ?? client).patch({
516
- ...options,
517
- url: "/extraction_results/{id}"
518
- });
1379
+ });
1380
+ var postAiChunksSearch = (options) => (options.client ?? client).post({
1381
+ security: [{ scheme: "bearer", type: "http" }],
1382
+ url: "/ai/chunks/search",
1383
+ ...options,
1384
+ headers: {
1385
+ "Content-Type": "application/vnd.api+json",
1386
+ ...options.headers
519
1387
  }
520
- /**
521
- * /extraction_results operation on extraction_result resource
522
- */
523
- static getExtractionResults(options) {
524
- return (options?.client ?? client).get({
525
- ...options,
526
- url: "/extraction_results"
527
- });
1388
+ });
1389
+ var postThreadsByIdMessages = (options) => (options.client ?? client).post({
1390
+ security: [{ scheme: "bearer", type: "http" }],
1391
+ url: "/threads/{id}/messages",
1392
+ ...options,
1393
+ headers: {
1394
+ "Content-Type": "application/vnd.api+json",
1395
+ ...options.headers
528
1396
  }
529
- /**
530
- * /documents/:id/extraction_results operation on extraction_result resource
531
- */
532
- static getDocumentsByIdExtractionResults(options) {
533
- return (options?.client ?? client).get({
534
- ...options,
535
- url: "/documents/{id}/extraction_results"
536
- });
1397
+ });
1398
+ var patchInvitationsByIdAccept = (options) => (options.client ?? client).patch({
1399
+ security: [{ scheme: "bearer", type: "http" }],
1400
+ url: "/invitations/{id}/accept",
1401
+ ...options,
1402
+ headers: {
1403
+ "Content-Type": "application/vnd.api+json",
1404
+ ...options.headers
537
1405
  }
538
- };
539
- var WorkspaceService = class {
540
- /**
541
- * /workspaces operation on workspace resource
542
- */
543
- static getWorkspaces(options) {
544
- return (options?.client ?? client).get({
545
- ...options,
546
- url: "/workspaces"
547
- });
1406
+ });
1407
+ var getCreditPackagesById = (options) => (options.client ?? client).get({
1408
+ security: [{ scheme: "bearer", type: "http" }],
1409
+ url: "/credit-packages/{id}",
1410
+ ...options
1411
+ });
1412
+ var getUsersById = (options) => (options.client ?? client).get({
1413
+ security: [{ scheme: "bearer", type: "http" }],
1414
+ url: "/users/{id}",
1415
+ ...options
1416
+ });
1417
+ var patchUsersById = (options) => (options.client ?? client).patch({
1418
+ security: [{ scheme: "bearer", type: "http" }],
1419
+ url: "/users/{id}",
1420
+ ...options,
1421
+ headers: {
1422
+ "Content-Type": "application/vnd.api+json",
1423
+ ...options.headers
548
1424
  }
549
- /**
550
- * /workspaces operation on workspace resource
551
- */
552
- static postWorkspaces(options) {
553
- return (options?.client ?? client).post({
554
- ...options,
555
- url: "/workspaces"
556
- });
1425
+ });
1426
+ var postAgentsByIdValidate = (options) => (options.client ?? client).post({
1427
+ security: [{ scheme: "bearer", type: "http" }],
1428
+ url: "/agents/{id}/validate",
1429
+ ...options,
1430
+ headers: {
1431
+ "Content-Type": "application/vnd.api+json",
1432
+ ...options.headers
557
1433
  }
558
- /**
559
- * /workspaces/:id/allocate operation on workspace resource
560
- */
561
- static patchWorkspacesByIdAllocate(options) {
562
- return (options?.client ?? client).patch({
563
- ...options,
564
- url: "/workspaces/{id}/allocate"
565
- });
1434
+ });
1435
+ var postWebhookConfigsByIdTest = (options) => (options.client ?? client).post({
1436
+ security: [{ scheme: "bearer", type: "http" }],
1437
+ url: "/webhook_configs/{id}/test",
1438
+ ...options,
1439
+ headers: {
1440
+ "Content-Type": "application/vnd.api+json",
1441
+ ...options.headers
566
1442
  }
567
- /**
568
- * /workspaces/:id operation on workspace resource
569
- */
570
- static deleteWorkspacesById(options) {
571
- return (options?.client ?? client).delete({
572
- ...options,
573
- url: "/workspaces/{id}"
574
- });
1443
+ });
1444
+ var getUsersMe = (options) => (options.client ?? client).get({
1445
+ security: [{ scheme: "bearer", type: "http" }],
1446
+ url: "/users/me",
1447
+ ...options
1448
+ });
1449
+ var postUsersAuthRegisterWithOidc = (options) => (options.client ?? client).post({
1450
+ security: [{ scheme: "bearer", type: "http" }],
1451
+ url: "/users/auth/register_with_oidc",
1452
+ ...options,
1453
+ headers: {
1454
+ "Content-Type": "application/vnd.api+json",
1455
+ ...options.headers
575
1456
  }
576
- /**
577
- * /workspaces/:id operation on workspace resource
578
- */
579
- static getWorkspacesById(options) {
580
- return (options?.client ?? client).get({
581
- ...options,
582
- url: "/workspaces/{id}"
583
- });
1457
+ });
1458
+ var getTransactionsById = (options) => (options.client ?? client).get({
1459
+ security: [{ scheme: "bearer", type: "http" }],
1460
+ url: "/transactions/{id}",
1461
+ ...options
1462
+ });
1463
+ var getTenantMemberships = (options) => (options.client ?? client).get({
1464
+ security: [{ scheme: "bearer", type: "http" }],
1465
+ url: "/tenant-memberships",
1466
+ ...options
1467
+ });
1468
+ var postTenantMemberships = (options) => (options.client ?? client).post({
1469
+ security: [{ scheme: "bearer", type: "http" }],
1470
+ url: "/tenant-memberships",
1471
+ ...options,
1472
+ headers: {
1473
+ "Content-Type": "application/vnd.api+json",
1474
+ ...options.headers
584
1475
  }
585
- /**
586
- * /workspaces/:id operation on workspace resource
587
- */
588
- static patchWorkspacesById(options) {
589
- return (options?.client ?? client).patch({
590
- ...options,
591
- url: "/workspaces/{id}"
592
- });
1476
+ });
1477
+ var getDocuments = (options) => (options.client ?? client).get({
1478
+ security: [{ scheme: "bearer", type: "http" }],
1479
+ url: "/documents",
1480
+ ...options
1481
+ });
1482
+ var postDocuments = (options) => (options.client ?? client).post({
1483
+ security: [{ scheme: "bearer", type: "http" }],
1484
+ url: "/documents",
1485
+ ...options,
1486
+ headers: {
1487
+ "Content-Type": "application/vnd.api+json",
1488
+ ...options.headers
593
1489
  }
594
- /**
595
- * /workspaces/mine operation on workspace resource
596
- */
597
- static getWorkspacesMine(options) {
598
- return (options?.client ?? client).get({
599
- ...options,
600
- url: "/workspaces/mine"
601
- });
1490
+ });
1491
+ var postTrainingExamplesBulkDelete = (options) => (options.client ?? client).post({
1492
+ security: [{ scheme: "bearer", type: "http" }],
1493
+ url: "/training_examples/bulk_delete",
1494
+ ...options,
1495
+ headers: {
1496
+ "Content-Type": "application/vnd.api+json",
1497
+ ...options.headers
602
1498
  }
603
- };
604
- var ApiKeyService = class {
605
- /**
606
- * /api_keys/:id/revoke operation on api_key resource
607
- */
608
- static patchApiKeysByIdRevoke(options) {
609
- return (options?.client ?? client).patch({
610
- ...options,
611
- url: "/api_keys/{id}/revoke"
612
- });
1499
+ });
1500
+ var getLlmAnalyticsSummary = (options) => (options.client ?? client).get({
1501
+ security: [{ scheme: "bearer", type: "http" }],
1502
+ url: "/llm_analytics/summary",
1503
+ ...options
1504
+ });
1505
+ var postStorageSignDownload = (options) => (options.client ?? client).post({
1506
+ security: [{ scheme: "bearer", type: "http" }],
1507
+ url: "/storage/sign_download",
1508
+ ...options,
1509
+ headers: {
1510
+ "Content-Type": "application/vnd.api+json",
1511
+ ...options.headers
613
1512
  }
614
- /**
615
- * /api_keys operation on api_key resource
616
- */
617
- static getApiKeys(options) {
618
- return (options?.client ?? client).get({
619
- ...options,
620
- url: "/api_keys"
621
- });
1513
+ });
1514
+ var getWebhookDeliveries = (options) => (options.client ?? client).get({
1515
+ security: [{ scheme: "bearer", type: "http" }],
1516
+ url: "/webhook_deliveries",
1517
+ ...options
1518
+ });
1519
+ var deleteDocumentsById = (options) => (options.client ?? client).delete({
1520
+ security: [{ scheme: "bearer", type: "http" }],
1521
+ url: "/documents/{id}",
1522
+ ...options
1523
+ });
1524
+ var getDocumentsById = (options) => (options.client ?? client).get({
1525
+ security: [{ scheme: "bearer", type: "http" }],
1526
+ url: "/documents/{id}",
1527
+ ...options
1528
+ });
1529
+ var patchDocumentsById = (options) => (options.client ?? client).patch({
1530
+ security: [{ scheme: "bearer", type: "http" }],
1531
+ url: "/documents/{id}",
1532
+ ...options,
1533
+ headers: {
1534
+ "Content-Type": "application/vnd.api+json",
1535
+ ...options.headers
622
1536
  }
623
- /**
624
- * /api_keys operation on api_key resource
625
- */
626
- static postApiKeys(options) {
627
- return (options?.client ?? client).post({
628
- ...options,
629
- url: "/api_keys"
630
- });
1537
+ });
1538
+ var getSearch = (options) => (options.client ?? client).get({
1539
+ security: [{ scheme: "bearer", type: "http" }],
1540
+ url: "/search",
1541
+ ...options
1542
+ });
1543
+ var getInvitations = (options) => (options.client ?? client).get({
1544
+ security: [{ scheme: "bearer", type: "http" }],
1545
+ url: "/invitations",
1546
+ ...options
1547
+ });
1548
+ var postDocumentsByIdAnalyze = (options) => (options.client ?? client).post({
1549
+ security: [{ scheme: "bearer", type: "http" }],
1550
+ url: "/documents/{id}/analyze",
1551
+ ...options,
1552
+ headers: {
1553
+ "Content-Type": "application/vnd.api+json",
1554
+ ...options.headers
631
1555
  }
632
- /**
633
- * /api_keys/:id operation on api_key resource
634
- */
635
- static deleteApiKeysById(options) {
636
- return (options?.client ?? client).delete({
637
- ...options,
638
- url: "/api_keys/{id}"
639
- });
1556
+ });
1557
+ var getSearchSemantic = (options) => (options.client ?? client).get({
1558
+ security: [{ scheme: "bearer", type: "http" }],
1559
+ url: "/search/semantic",
1560
+ ...options
1561
+ });
1562
+ var getMessages = (options) => (options.client ?? client).get({
1563
+ security: [{ scheme: "bearer", type: "http" }],
1564
+ url: "/messages",
1565
+ ...options
1566
+ });
1567
+ var postMessages = (options) => (options.client ?? client).post({
1568
+ security: [{ scheme: "bearer", type: "http" }],
1569
+ url: "/messages",
1570
+ ...options,
1571
+ headers: {
1572
+ "Content-Type": "application/vnd.api+json",
1573
+ ...options.headers
640
1574
  }
641
- /**
642
- * /api_keys/:id operation on api_key resource
643
- */
644
- static getApiKeysById(options) {
645
- return (options?.client ?? client).get({
646
- ...options,
647
- url: "/api_keys/{id}"
648
- });
649
- }
650
- /**
651
- * /api_keys/:id operation on api_key resource
652
- */
653
- static patchApiKeysById(options) {
654
- return (options?.client ?? client).patch({
655
- ...options,
656
- url: "/api_keys/{id}"
657
- });
1575
+ });
1576
+ var getNotificationPreferences = (options) => (options.client ?? client).get({
1577
+ security: [{ scheme: "bearer", type: "http" }],
1578
+ url: "/notification_preferences",
1579
+ ...options
1580
+ });
1581
+ var postNotificationPreferences = (options) => (options.client ?? client).post({
1582
+ security: [{ scheme: "bearer", type: "http" }],
1583
+ url: "/notification_preferences",
1584
+ ...options,
1585
+ headers: {
1586
+ "Content-Type": "application/vnd.api+json",
1587
+ ...options.headers
658
1588
  }
659
- /**
660
- * Allocate credits to the account associated with this API Key
661
- */
662
- static patchApiKeysByIdAllocate(options) {
663
- return (options?.client ?? client).patch({
664
- ...options,
665
- url: "/api_keys/{id}/allocate"
666
- });
1589
+ });
1590
+ var getApplications = (options) => (options.client ?? client).get({
1591
+ security: [{ scheme: "bearer", type: "http" }],
1592
+ url: "/applications",
1593
+ ...options
1594
+ });
1595
+ var postApplications = (options) => (options.client ?? client).post({
1596
+ security: [{ scheme: "bearer", type: "http" }],
1597
+ url: "/applications",
1598
+ ...options,
1599
+ headers: {
1600
+ "Content-Type": "application/vnd.api+json",
1601
+ ...options.headers
667
1602
  }
668
- /**
669
- * /api_keys/:id/rotate operation on api_key resource
670
- */
671
- static patchApiKeysByIdRotate(options) {
672
- return (options?.client ?? client).patch({
673
- ...options,
674
- url: "/api_keys/{id}/rotate"
675
- });
1603
+ });
1604
+ var deleteThreadsById = (options) => (options.client ?? client).delete({
1605
+ security: [{ scheme: "bearer", type: "http" }],
1606
+ url: "/threads/{id}",
1607
+ ...options
1608
+ });
1609
+ var getThreadsById = (options) => (options.client ?? client).get({
1610
+ security: [{ scheme: "bearer", type: "http" }],
1611
+ url: "/threads/{id}",
1612
+ ...options
1613
+ });
1614
+ var patchThreadsById = (options) => (options.client ?? client).patch({
1615
+ security: [{ scheme: "bearer", type: "http" }],
1616
+ url: "/threads/{id}",
1617
+ ...options,
1618
+ headers: {
1619
+ "Content-Type": "application/vnd.api+json",
1620
+ ...options.headers
676
1621
  }
677
- };
678
- var InvitationService = class {
679
- /**
680
- * /invitations/consume/:token operation on invitation resource
681
- */
682
- static getInvitationsConsumeByToken(options) {
683
- return (options?.client ?? client).get({
684
- ...options,
685
- url: "/invitations/consume/{token}"
686
- });
1622
+ });
1623
+ var getLlmAnalytics = (options) => (options.client ?? client).get({
1624
+ security: [{ scheme: "bearer", type: "http" }],
1625
+ url: "/llm_analytics",
1626
+ ...options
1627
+ });
1628
+ var postLlmAnalytics = (options) => (options.client ?? client).post({
1629
+ security: [{ scheme: "bearer", type: "http" }],
1630
+ url: "/llm_analytics",
1631
+ ...options,
1632
+ headers: {
1633
+ "Content-Type": "application/vnd.api+json",
1634
+ ...options.headers
687
1635
  }
688
- /**
689
- * /invitations/:id/revoke operation on invitation resource
690
- */
691
- static patchInvitationsByIdRevoke(options) {
692
- return (options?.client ?? client).patch({
693
- ...options,
694
- url: "/invitations/{id}/revoke"
695
- });
1636
+ });
1637
+ var postDocumentsByIdReprocess = (options) => (options.client ?? client).post({
1638
+ security: [{ scheme: "bearer", type: "http" }],
1639
+ url: "/documents/{id}/reprocess",
1640
+ ...options,
1641
+ headers: {
1642
+ "Content-Type": "application/vnd.api+json",
1643
+ ...options.headers
696
1644
  }
697
- /**
698
- * /invitations/:id/resend operation on invitation resource
699
- */
700
- static patchInvitationsByIdResend(options) {
701
- return (options?.client ?? client).patch({
702
- ...options,
703
- url: "/invitations/{id}/resend"
704
- });
1645
+ });
1646
+ var patchUsersByIdResetPassword = (options) => (options.client ?? client).patch({
1647
+ security: [{ scheme: "bearer", type: "http" }],
1648
+ url: "/users/{id}/reset-password",
1649
+ ...options,
1650
+ headers: {
1651
+ "Content-Type": "application/vnd.api+json",
1652
+ ...options.headers
705
1653
  }
706
- /**
707
- * /invitations/invite operation on invitation resource
708
- */
709
- static postInvitationsInvite(options) {
710
- return (options?.client ?? client).post({
711
- ...options,
712
- url: "/invitations/invite"
713
- });
1654
+ });
1655
+ var postDocumentsPresignedUpload = (options) => (options.client ?? client).post({
1656
+ security: [{ scheme: "bearer", type: "http" }],
1657
+ url: "/documents/presigned_upload",
1658
+ ...options,
1659
+ headers: {
1660
+ "Content-Type": "application/vnd.api+json",
1661
+ ...options.headers
714
1662
  }
715
- /**
716
- * Accept an invitation using only the token
717
- */
718
- static postInvitationsAcceptByToken(options) {
719
- return (options?.client ?? client).post({
720
- ...options,
721
- url: "/invitations/accept_by_token"
722
- });
1663
+ });
1664
+ var getMessagesSearch = (options) => (options.client ?? client).get({
1665
+ security: [{ scheme: "bearer", type: "http" }],
1666
+ url: "/messages/search",
1667
+ ...options
1668
+ });
1669
+ var deleteWorkspacesById = (options) => (options.client ?? client).delete({
1670
+ security: [{ scheme: "bearer", type: "http" }],
1671
+ url: "/workspaces/{id}",
1672
+ ...options
1673
+ });
1674
+ var getWorkspacesById = (options) => (options.client ?? client).get({
1675
+ security: [{ scheme: "bearer", type: "http" }],
1676
+ url: "/workspaces/{id}",
1677
+ ...options
1678
+ });
1679
+ var patchWorkspacesById = (options) => (options.client ?? client).patch({
1680
+ security: [{ scheme: "bearer", type: "http" }],
1681
+ url: "/workspaces/{id}",
1682
+ ...options,
1683
+ headers: {
1684
+ "Content-Type": "application/vnd.api+json",
1685
+ ...options.headers
723
1686
  }
724
- /**
725
- * /invitations/:id/accept operation on invitation resource
726
- */
727
- static patchInvitationsByIdAccept(options) {
728
- return (options?.client ?? client).patch({
729
- ...options,
730
- url: "/invitations/{id}/accept"
731
- });
1687
+ });
1688
+ var getTenants = (options) => (options.client ?? client).get({
1689
+ security: [{ scheme: "bearer", type: "http" }],
1690
+ url: "/tenants",
1691
+ ...options
1692
+ });
1693
+ var postTenants = (options) => (options.client ?? client).post({
1694
+ security: [{ scheme: "bearer", type: "http" }],
1695
+ url: "/tenants",
1696
+ ...options,
1697
+ headers: {
1698
+ "Content-Type": "application/vnd.api+json",
1699
+ ...options.headers
732
1700
  }
733
- /**
734
- * /invitations operation on invitation resource
735
- */
736
- static getInvitations(options) {
737
- return (options?.client ?? client).get({
738
- ...options,
739
- url: "/invitations"
740
- });
1701
+ });
1702
+ var postTenantsByIdRemoveStorage = (options) => (options.client ?? client).post({
1703
+ security: [{ scheme: "bearer", type: "http" }],
1704
+ url: "/tenants/{id}/remove-storage",
1705
+ ...options,
1706
+ headers: {
1707
+ "Content-Type": "application/vnd.api+json",
1708
+ ...options.headers
741
1709
  }
742
- };
743
- var UserService = class {
744
- /**
745
- * Reset password using admin-issued reset token
746
- */
747
- static patchUsersAuthResetPassword(options) {
748
- return (options?.client ?? client).patch({
749
- ...options,
750
- url: "/users/auth/reset-password"
751
- });
1710
+ });
1711
+ var postDocumentsBulkReprocess = (options) => (options.client ?? client).post({
1712
+ security: [{ scheme: "bearer", type: "http" }],
1713
+ url: "/documents/bulk_reprocess",
1714
+ ...options,
1715
+ headers: {
1716
+ "Content-Type": "application/vnd.api+json",
1717
+ ...options.headers
752
1718
  }
753
- /**
754
- * /users/:id operation on user resource
755
- */
756
- static getUsersById(options) {
757
- return (options?.client ?? client).get({
758
- ...options,
759
- url: "/users/{id}"
760
- });
1719
+ });
1720
+ var getNotificationLogsById = (options) => (options.client ?? client).get({
1721
+ security: [{ scheme: "bearer", type: "http" }],
1722
+ url: "/notification_logs/{id}",
1723
+ ...options
1724
+ });
1725
+ var getWebhookDeliveriesById = (options) => (options.client ?? client).get({
1726
+ security: [{ scheme: "bearer", type: "http" }],
1727
+ url: "/webhook_deliveries/{id}",
1728
+ ...options
1729
+ });
1730
+ var getAuditLogs = (options) => (options.client ?? client).get({
1731
+ security: [{ scheme: "bearer", type: "http" }],
1732
+ url: "/audit-logs",
1733
+ ...options
1734
+ });
1735
+ var getAiGraphEdges = (options) => (options.client ?? client).get({
1736
+ security: [{ scheme: "bearer", type: "http" }],
1737
+ url: "/ai/graph/edges",
1738
+ ...options
1739
+ });
1740
+ var postAiGraphEdges = (options) => (options.client ?? client).post({
1741
+ security: [{ scheme: "bearer", type: "http" }],
1742
+ url: "/ai/graph/edges",
1743
+ ...options,
1744
+ headers: {
1745
+ "Content-Type": "application/vnd.api+json",
1746
+ ...options.headers
761
1747
  }
762
- /**
763
- * Admin-only user management (platform admins) - promotes/demotes admin status
764
- */
765
- static patchUsersById(options) {
766
- return (options?.client ?? client).patch({
767
- ...options,
768
- url: "/users/{id}"
769
- });
1748
+ });
1749
+ var postDocumentsExport = (options) => (options.client ?? client).post({
1750
+ security: [{ scheme: "bearer", type: "http" }],
1751
+ url: "/documents/export",
1752
+ ...options
1753
+ });
1754
+ var getTrainingExamples = (options) => (options.client ?? client).get({
1755
+ security: [{ scheme: "bearer", type: "http" }],
1756
+ url: "/training_examples",
1757
+ ...options
1758
+ });
1759
+ var postTrainingExamples = (options) => (options.client ?? client).post({
1760
+ security: [{ scheme: "bearer", type: "http" }],
1761
+ url: "/training_examples",
1762
+ ...options,
1763
+ headers: {
1764
+ "Content-Type": "application/vnd.api+json",
1765
+ ...options.headers
770
1766
  }
771
- /**
772
- * Get the currently authenticated user
773
- */
774
- static getUsersMe(options) {
775
- return (options?.client ?? client).get({
776
- ...options,
777
- url: "/users/me"
778
- });
1767
+ });
1768
+ var getBuckets = (options) => (options.client ?? client).get({
1769
+ security: [{ scheme: "bearer", type: "http" }],
1770
+ url: "/buckets",
1771
+ ...options
1772
+ });
1773
+ var postBuckets = (options) => (options.client ?? client).post({
1774
+ security: [{ scheme: "bearer", type: "http" }],
1775
+ url: "/buckets",
1776
+ ...options,
1777
+ headers: {
1778
+ "Content-Type": "application/vnd.api+json",
1779
+ ...options.headers
779
1780
  }
780
- /**
781
- * /users/auth/register_with_oidc operation on user resource
782
- */
783
- static postUsersAuthRegisterWithOidc(options) {
784
- return (options?.client ?? client).post({
785
- ...options,
786
- url: "/users/auth/register_with_oidc"
787
- });
1781
+ });
1782
+ var getPlansById = (options) => (options.client ?? client).get({
1783
+ security: [{ scheme: "bearer", type: "http" }],
1784
+ url: "/plans/{id}",
1785
+ ...options
1786
+ });
1787
+ var patchWalletAddons = (options) => (options.client ?? client).patch({
1788
+ security: [{ scheme: "bearer", type: "http" }],
1789
+ url: "/wallet/addons",
1790
+ ...options,
1791
+ headers: {
1792
+ "Content-Type": "application/vnd.api+json",
1793
+ ...options.headers
788
1794
  }
789
- /**
790
- * Admin triggers password reset email for user
791
- */
792
- static patchUsersByIdResetPassword(options) {
793
- return (options?.client ?? client).patch({
794
- ...options,
795
- url: "/users/{id}/reset-password"
796
- });
1795
+ });
1796
+ var postUsersAuthMagicLinkLogin = (options) => (options.client ?? client).post({
1797
+ security: [{ scheme: "bearer", type: "http" }],
1798
+ url: "/users/auth/magic_link/login",
1799
+ ...options,
1800
+ headers: {
1801
+ "Content-Type": "application/vnd.api+json",
1802
+ ...options.headers
797
1803
  }
798
- /**
799
- * /users/auth/magic_link/login operation on user resource
800
- */
801
- static postUsersAuthMagicLinkLogin(options) {
802
- return (options?.client ?? client).post({
803
- ...options,
804
- url: "/users/auth/magic_link/login"
805
- });
1804
+ });
1805
+ var getApiKeys = (options) => (options.client ?? client).get({
1806
+ security: [{ scheme: "bearer", type: "http" }],
1807
+ url: "/api_keys",
1808
+ ...options
1809
+ });
1810
+ var postApiKeys = (options) => (options.client ?? client).post({
1811
+ security: [{ scheme: "bearer", type: "http" }],
1812
+ url: "/api_keys",
1813
+ ...options,
1814
+ headers: {
1815
+ "Content-Type": "application/vnd.api+json",
1816
+ ...options.headers
806
1817
  }
807
- /**
808
- * Admin manually confirms user's email
809
- */
810
- static patchUsersByIdConfirmEmail(options) {
811
- return (options?.client ?? client).patch({
812
- ...options,
813
- url: "/users/{id}/confirm-email"
814
- });
1818
+ });
1819
+ var getExtractionResults = (options) => (options.client ?? client).get({
1820
+ security: [{ scheme: "bearer", type: "http" }],
1821
+ url: "/extraction_results",
1822
+ ...options
1823
+ });
1824
+ var deleteAgentsById = (options) => (options.client ?? client).delete({
1825
+ security: [{ scheme: "bearer", type: "http" }],
1826
+ url: "/agents/{id}",
1827
+ ...options
1828
+ });
1829
+ var getAgentsById = (options) => (options.client ?? client).get({
1830
+ security: [{ scheme: "bearer", type: "http" }],
1831
+ url: "/agents/{id}",
1832
+ ...options
1833
+ });
1834
+ var patchAgentsById = (options) => (options.client ?? client).patch({
1835
+ security: [{ scheme: "bearer", type: "http" }],
1836
+ url: "/agents/{id}",
1837
+ ...options,
1838
+ headers: {
1839
+ "Content-Type": "application/vnd.api+json",
1840
+ ...options.headers
815
1841
  }
816
- /**
817
- * Attempt to sign in using a username and password.
818
- */
819
- static postUsersAuthLogin(options) {
820
- return (options?.client ?? client).post({
821
- ...options,
822
- url: "/users/auth/login"
823
- });
1842
+ });
1843
+ var postDocumentsImport = (options) => (options.client ?? client).post({
1844
+ security: [{ scheme: "bearer", type: "http" }],
1845
+ url: "/documents/import",
1846
+ ...options,
1847
+ headers: {
1848
+ "Content-Type": "application/vnd.api+json",
1849
+ ...options.headers
824
1850
  }
825
- /**
826
- * /users/auth/confirm operation on user resource
827
- */
828
- static postUsersAuthConfirm(options) {
829
- return (options?.client ?? client).post({
830
- ...options,
831
- url: "/users/auth/confirm"
832
- });
1851
+ });
1852
+ var deleteApiKeysById = (options) => (options.client ?? client).delete({
1853
+ security: [{ scheme: "bearer", type: "http" }],
1854
+ url: "/api_keys/{id}",
1855
+ ...options
1856
+ });
1857
+ var getApiKeysById = (options) => (options.client ?? client).get({
1858
+ security: [{ scheme: "bearer", type: "http" }],
1859
+ url: "/api_keys/{id}",
1860
+ ...options
1861
+ });
1862
+ var patchApiKeysById = (options) => (options.client ?? client).patch({
1863
+ security: [{ scheme: "bearer", type: "http" }],
1864
+ url: "/api_keys/{id}",
1865
+ ...options,
1866
+ headers: {
1867
+ "Content-Type": "application/vnd.api+json",
1868
+ ...options.headers
833
1869
  }
834
- /**
835
- * /users/auth/magic_link/request operation on user resource
836
- */
837
- static postUsersAuthMagicLinkRequest(options) {
838
- return (options?.client ?? client).post({
839
- ...options,
840
- url: "/users/auth/magic_link/request"
841
- });
1870
+ });
1871
+ var postAiSearch = (options) => (options.client ?? client).post({
1872
+ security: [{ scheme: "bearer", type: "http" }],
1873
+ url: "/ai/search",
1874
+ ...options,
1875
+ headers: {
1876
+ "Content-Type": "application/vnd.api+json",
1877
+ ...options.headers
842
1878
  }
843
- /**
844
- * /users/auth/register operation on user resource
845
- */
846
- static postUsersAuthRegister(options) {
847
- return (options?.client ?? client).post({
848
- ...options,
849
- url: "/users/auth/register"
850
- });
1879
+ });
1880
+ var deleteAiGraphNodesById = (options) => (options.client ?? client).delete({
1881
+ security: [{ scheme: "bearer", type: "http" }],
1882
+ url: "/ai/graph/nodes/{id}",
1883
+ ...options
1884
+ });
1885
+ var patchWalletAddonsByAddonSlugCancel = (options) => (options.client ?? client).patch({
1886
+ security: [{ scheme: "bearer", type: "http" }],
1887
+ url: "/wallet/addons/{addon_slug}/cancel",
1888
+ ...options,
1889
+ headers: {
1890
+ "Content-Type": "application/vnd.api+json",
1891
+ ...options.headers
851
1892
  }
852
- /**
853
- * Platform Admin action to register a new ISV (User + Tenant + App)
854
- */
855
- static postUsersRegisterIsv(options) {
856
- return (options?.client ?? client).post({
857
- ...options,
858
- url: "/users/register_isv"
859
- });
1893
+ });
1894
+ var deleteApplicationsById = (options) => (options.client ?? client).delete({
1895
+ security: [{ scheme: "bearer", type: "http" }],
1896
+ url: "/applications/{id}",
1897
+ ...options
1898
+ });
1899
+ var getApplicationsById = (options) => (options.client ?? client).get({
1900
+ security: [{ scheme: "bearer", type: "http" }],
1901
+ url: "/applications/{id}",
1902
+ ...options
1903
+ });
1904
+ var patchApplicationsById = (options) => (options.client ?? client).patch({
1905
+ security: [{ scheme: "bearer", type: "http" }],
1906
+ url: "/applications/{id}",
1907
+ ...options,
1908
+ headers: {
1909
+ "Content-Type": "application/vnd.api+json",
1910
+ ...options.headers
860
1911
  }
861
- /**
862
- * /users operation on user resource
863
- */
864
- static getUsers(options) {
865
- return (options?.client ?? client).get({
866
- ...options,
867
- url: "/users"
868
- });
1912
+ });
1913
+ var getSearchHealth = (options) => (options.client ?? client).get({
1914
+ security: [{ scheme: "bearer", type: "http" }],
1915
+ url: "/search/health",
1916
+ ...options
1917
+ });
1918
+ var getTransactions = (options) => (options.client ?? client).get({
1919
+ security: [{ scheme: "bearer", type: "http" }],
1920
+ url: "/transactions",
1921
+ ...options
1922
+ });
1923
+ var getUserProfiles = (options) => (options.client ?? client).get({
1924
+ security: [{ scheme: "bearer", type: "http" }],
1925
+ url: "/user_profiles",
1926
+ ...options
1927
+ });
1928
+ var postUserProfiles = (options) => (options.client ?? client).post({
1929
+ security: [{ scheme: "bearer", type: "http" }],
1930
+ url: "/user_profiles",
1931
+ ...options,
1932
+ headers: {
1933
+ "Content-Type": "application/vnd.api+json",
1934
+ ...options.headers
869
1935
  }
870
- };
871
- var BucketService = class {
872
- /**
873
- * /buckets/:id/stats operation on bucket resource
874
- */
875
- static getBucketsByIdStats(options) {
876
- return (options?.client ?? client).get({
877
- ...options,
878
- url: "/buckets/{id}/stats"
879
- });
1936
+ });
1937
+ var patchUsersByIdConfirmEmail = (options) => (options.client ?? client).patch({
1938
+ security: [{ scheme: "bearer", type: "http" }],
1939
+ url: "/users/{id}/confirm-email",
1940
+ ...options,
1941
+ headers: {
1942
+ "Content-Type": "application/vnd.api+json",
1943
+ ...options.headers
880
1944
  }
881
- /**
882
- * /buckets operation on bucket resource
883
- */
884
- static getBuckets(options) {
885
- return (options?.client ?? client).get({
886
- ...options,
887
- url: "/buckets"
888
- });
1945
+ });
1946
+ var getThreadsSearch = (options) => (options.client ?? client).get({
1947
+ security: [{ scheme: "bearer", type: "http" }],
1948
+ url: "/threads/search",
1949
+ ...options
1950
+ });
1951
+ var getDocumentsByIdRelationshipsChunks = (options) => (options.client ?? client).get({
1952
+ security: [{ scheme: "bearer", type: "http" }],
1953
+ url: "/documents/{id}/relationships/chunks",
1954
+ ...options
1955
+ });
1956
+ var patchWalletPlan = (options) => (options.client ?? client).patch({
1957
+ security: [{ scheme: "bearer", type: "http" }],
1958
+ url: "/wallet/plan",
1959
+ ...options,
1960
+ headers: {
1961
+ "Content-Type": "application/vnd.api+json",
1962
+ ...options.headers
889
1963
  }
890
- /**
891
- * /buckets operation on bucket resource
892
- */
893
- static postBuckets(options) {
894
- return (options?.client ?? client).post({
895
- ...options,
896
- url: "/buckets"
897
- });
1964
+ });
1965
+ var getPlansSlugBySlug = (options) => (options.client ?? client).get({
1966
+ security: [{ scheme: "bearer", type: "http" }],
1967
+ url: "/plans/slug/{slug}",
1968
+ ...options
1969
+ });
1970
+ var getLlmAnalyticsById = (options) => (options.client ?? client).get({
1971
+ security: [{ scheme: "bearer", type: "http" }],
1972
+ url: "/llm_analytics/{id}",
1973
+ ...options
1974
+ });
1975
+ var getSearchStatus = (options) => (options.client ?? client).get({
1976
+ security: [{ scheme: "bearer", type: "http" }],
1977
+ url: "/search/status",
1978
+ ...options
1979
+ });
1980
+ var patchApiKeysByIdAllocate = (options) => (options.client ?? client).patch({
1981
+ security: [{ scheme: "bearer", type: "http" }],
1982
+ url: "/api_keys/{id}/allocate",
1983
+ ...options,
1984
+ headers: {
1985
+ "Content-Type": "application/vnd.api+json",
1986
+ ...options.headers
898
1987
  }
899
- /**
900
- * /buckets/:id operation on bucket resource
901
- */
902
- static deleteBucketsById(options) {
903
- return (options?.client ?? client).delete({
904
- ...options,
905
- url: "/buckets/{id}"
906
- });
1988
+ });
1989
+ var postUsersAuthLogin = (options) => (options.client ?? client).post({
1990
+ security: [{ scheme: "bearer", type: "http" }],
1991
+ url: "/users/auth/login",
1992
+ ...options,
1993
+ headers: {
1994
+ "Content-Type": "application/vnd.api+json",
1995
+ ...options.headers
907
1996
  }
908
- /**
909
- * /buckets/:id operation on bucket resource
910
- */
911
- static getBucketsById(options) {
912
- return (options?.client ?? client).get({
913
- ...options,
914
- url: "/buckets/{id}"
915
- });
1997
+ });
1998
+ var postAiEmbed = (options) => (options.client ?? client).post({
1999
+ security: [{ scheme: "bearer", type: "http" }],
2000
+ url: "/ai/embed",
2001
+ ...options,
2002
+ headers: {
2003
+ "Content-Type": "application/vnd.api+json",
2004
+ ...options.headers
916
2005
  }
917
- /**
918
- * /buckets/:id operation on bucket resource
919
- */
920
- static patchBucketsById(options) {
921
- return (options?.client ?? client).patch({
922
- ...options,
923
- url: "/buckets/{id}"
924
- });
2006
+ });
2007
+ var getWorkspacesMine = (options) => (options.client ?? client).get({
2008
+ security: [{ scheme: "bearer", type: "http" }],
2009
+ url: "/workspaces/mine",
2010
+ ...options
2011
+ });
2012
+ var postSearchReindex = (options) => (options.client ?? client).post({
2013
+ security: [{ scheme: "bearer", type: "http" }],
2014
+ url: "/search/reindex",
2015
+ ...options,
2016
+ headers: {
2017
+ "Content-Type": "application/vnd.api+json",
2018
+ ...options.headers
925
2019
  }
926
- };
927
- var DocumentService = class {
928
- /**
929
- * /documents/search operation on document resource
930
- */
931
- static getDocumentsSearch(options) {
932
- return (options?.client ?? client).get({
933
- ...options,
934
- url: "/documents/search"
935
- });
2020
+ });
2021
+ var postUsersAuthConfirm = (options) => (options.client ?? client).post({
2022
+ security: [{ scheme: "bearer", type: "http" }],
2023
+ url: "/users/auth/confirm",
2024
+ ...options,
2025
+ headers: {
2026
+ "Content-Type": "application/vnd.api+json",
2027
+ ...options.headers
936
2028
  }
937
- /**
938
- * /documents operation on document resource
939
- */
940
- static getDocuments(options) {
941
- return (options?.client ?? client).get({
942
- ...options,
943
- url: "/documents"
944
- });
2029
+ });
2030
+ var getStorageStats = (options) => (options.client ?? client).get({
2031
+ security: [{ scheme: "bearer", type: "http" }],
2032
+ url: "/storage/stats",
2033
+ ...options
2034
+ });
2035
+ var postTenantsByIdBuyStorage = (options) => (options.client ?? client).post({
2036
+ security: [{ scheme: "bearer", type: "http" }],
2037
+ url: "/tenants/{id}/buy-storage",
2038
+ ...options,
2039
+ headers: {
2040
+ "Content-Type": "application/vnd.api+json",
2041
+ ...options.headers
945
2042
  }
946
- /**
947
- * /documents operation on document resource
948
- */
949
- static postDocuments(options) {
950
- return (options?.client ?? client).post({
951
- ...options,
952
- url: "/documents"
953
- });
2043
+ });
2044
+ var getWorkspaceMemberships = (options) => (options.client ?? client).get({
2045
+ security: [{ scheme: "bearer", type: "http" }],
2046
+ url: "/workspace-memberships",
2047
+ ...options
2048
+ });
2049
+ var postWorkspaceMemberships = (options) => (options.client ?? client).post({
2050
+ security: [{ scheme: "bearer", type: "http" }],
2051
+ url: "/workspace-memberships",
2052
+ ...options,
2053
+ headers: {
2054
+ "Content-Type": "application/vnd.api+json",
2055
+ ...options.headers
954
2056
  }
955
- /**
956
- * /documents/:id operation on document resource
957
- */
958
- static deleteDocumentsById(options) {
959
- return (options?.client ?? client).delete({
960
- ...options,
961
- url: "/documents/{id}"
962
- });
2057
+ });
2058
+ var postUsersAuthMagicLinkRequest = (options) => (options.client ?? client).post({
2059
+ security: [{ scheme: "bearer", type: "http" }],
2060
+ url: "/users/auth/magic_link/request",
2061
+ ...options,
2062
+ headers: {
2063
+ "Content-Type": "application/vnd.api+json",
2064
+ ...options.headers
963
2065
  }
964
- /**
965
- * /documents/:id operation on document resource
966
- */
967
- static getDocumentsById(options) {
968
- return (options?.client ?? client).get({
969
- ...options,
970
- url: "/documents/{id}"
971
- });
2066
+ });
2067
+ var postUsersAuthRegister = (options) => (options.client ?? client).post({
2068
+ security: [{ scheme: "bearer", type: "http" }],
2069
+ url: "/users/auth/register",
2070
+ ...options,
2071
+ headers: {
2072
+ "Content-Type": "application/vnd.api+json",
2073
+ ...options.headers
972
2074
  }
973
- /**
974
- * /documents/:id operation on document resource
975
- */
976
- static patchDocumentsById(options) {
977
- return (options?.client ?? client).patch({
978
- ...options,
979
- url: "/documents/{id}"
980
- });
2075
+ });
2076
+ var postTrainingExamplesBulk = (options) => (options.client ?? client).post({
2077
+ security: [{ scheme: "bearer", type: "http" }],
2078
+ url: "/training_examples/bulk",
2079
+ ...options,
2080
+ headers: {
2081
+ "Content-Type": "application/vnd.api+json",
2082
+ ...options.headers
981
2083
  }
982
- /**
983
- * /documents/:id/analyze operation on document resource
984
- */
985
- static postDocumentsByIdAnalyze(options) {
986
- return (options?.client ?? client).post({
987
- ...options,
988
- url: "/documents/{id}/analyze"
989
- });
2084
+ });
2085
+ var deleteBucketsById = (options) => (options.client ?? client).delete({
2086
+ security: [{ scheme: "bearer", type: "http" }],
2087
+ url: "/buckets/{id}",
2088
+ ...options
2089
+ });
2090
+ var getBucketsById = (options) => (options.client ?? client).get({
2091
+ security: [{ scheme: "bearer", type: "http" }],
2092
+ url: "/buckets/{id}",
2093
+ ...options
2094
+ });
2095
+ var patchBucketsById = (options) => (options.client ?? client).patch({
2096
+ security: [{ scheme: "bearer", type: "http" }],
2097
+ url: "/buckets/{id}",
2098
+ ...options,
2099
+ headers: {
2100
+ "Content-Type": "application/vnd.api+json",
2101
+ ...options.headers
990
2102
  }
991
- /**
992
- * /documents/:id/reprocess operation on document resource
993
- */
994
- static postDocumentsByIdReprocess(options) {
995
- return (options?.client ?? client).post({
996
- ...options,
997
- url: "/documents/{id}/reprocess"
998
- });
2103
+ });
2104
+ var deleteAiGraphEdgesById = (options) => (options.client ?? client).delete({
2105
+ security: [{ scheme: "bearer", type: "http" }],
2106
+ url: "/ai/graph/edges/{id}",
2107
+ ...options
2108
+ });
2109
+ var deleteTenantsById = (options) => (options.client ?? client).delete({
2110
+ security: [{ scheme: "bearer", type: "http" }],
2111
+ url: "/tenants/{id}",
2112
+ ...options
2113
+ });
2114
+ var getTenantsById = (options) => (options.client ?? client).get({
2115
+ security: [{ scheme: "bearer", type: "http" }],
2116
+ url: "/tenants/{id}",
2117
+ ...options
2118
+ });
2119
+ var patchTenantsById = (options) => (options.client ?? client).patch({
2120
+ security: [{ scheme: "bearer", type: "http" }],
2121
+ url: "/tenants/{id}",
2122
+ ...options,
2123
+ headers: {
2124
+ "Content-Type": "application/vnd.api+json",
2125
+ ...options.headers
999
2126
  }
1000
- /**
1001
- * /documents/bulk_reprocess operation on document resource
1002
- */
1003
- static postDocumentsBulkReprocess(options) {
1004
- return (options?.client ?? client).post({
1005
- ...options,
1006
- url: "/documents/bulk_reprocess"
1007
- });
2127
+ });
2128
+ var getPlans = (options) => (options.client ?? client).get({
2129
+ security: [{ scheme: "bearer", type: "http" }],
2130
+ url: "/plans",
2131
+ ...options
2132
+ });
2133
+ var postAgentsByIdTest = (options) => (options.client ?? client).post({
2134
+ security: [{ scheme: "bearer", type: "http" }],
2135
+ url: "/agents/{id}/test",
2136
+ ...options,
2137
+ headers: {
2138
+ "Content-Type": "application/vnd.api+json",
2139
+ ...options.headers
1008
2140
  }
1009
- /**
1010
- * Export documents (placeholder - returns mock url)
1011
- */
1012
- static postDocumentsExport(options) {
1013
- return (options?.client ?? client).post({
1014
- ...options,
1015
- url: "/documents/export"
1016
- });
2141
+ });
2142
+ var getDocumentsProcessingQueue = (options) => (options.client ?? client).get({
2143
+ security: [{ scheme: "bearer", type: "http" }],
2144
+ url: "/documents/processing_queue",
2145
+ ...options
2146
+ });
2147
+ var deleteTenantMembershipsByTenantIdByUserId = (options) => (options.client ?? client).delete({
2148
+ security: [{ scheme: "bearer", type: "http" }],
2149
+ url: "/tenant-memberships/{tenant_id}/{user_id}",
2150
+ ...options
2151
+ });
2152
+ var patchTenantMembershipsByTenantIdByUserId = (options) => (options.client ?? client).patch({
2153
+ security: [{ scheme: "bearer", type: "http" }],
2154
+ url: "/tenant-memberships/{tenant_id}/{user_id}",
2155
+ ...options,
2156
+ headers: {
2157
+ "Content-Type": "application/vnd.api+json",
2158
+ ...options.headers
1017
2159
  }
1018
- /**
1019
- * Import documents from external URL
1020
- */
1021
- static postDocumentsImport(options) {
1022
- return (options?.client ?? client).post({
1023
- ...options,
1024
- url: "/documents/import"
1025
- });
2160
+ });
2161
+ var postStorageSignUpload = (options) => (options.client ?? client).post({
2162
+ security: [{ scheme: "bearer", type: "http" }],
2163
+ url: "/storage/sign_upload",
2164
+ ...options,
2165
+ headers: {
2166
+ "Content-Type": "application/vnd.api+json",
2167
+ ...options.headers
1026
2168
  }
1027
- /**
1028
- * Returns documents with pending or processing status
1029
- */
1030
- static getDocumentsProcessingQueue(options) {
1031
- return (options?.client ?? client).get({
1032
- ...options,
1033
- url: "/documents/processing_queue"
1034
- });
2169
+ });
2170
+ var postWebhookDeliveriesByIdRetry = (options) => (options.client ?? client).post({
2171
+ security: [{ scheme: "bearer", type: "http" }],
2172
+ url: "/webhook_deliveries/{id}/retry",
2173
+ ...options,
2174
+ headers: {
2175
+ "Content-Type": "application/vnd.api+json",
2176
+ ...options.headers
1035
2177
  }
1036
- };
1037
- var UserProfileService = class {
1038
- /**
1039
- * Get the current user's profile
1040
- */
1041
- static getUserProfilesMe(options) {
1042
- return (options?.client ?? client).get({
1043
- ...options,
1044
- url: "/user_profiles/me"
1045
- });
2178
+ });
2179
+ var postThreadsByIdSummarize = (options) => (options.client ?? client).post({
2180
+ security: [{ scheme: "bearer", type: "http" }],
2181
+ url: "/threads/{id}/summarize",
2182
+ ...options,
2183
+ headers: {
2184
+ "Content-Type": "application/vnd.api+json",
2185
+ ...options.headers
1046
2186
  }
1047
- /**
1048
- * /user_profiles operation on user_profile resource
1049
- */
1050
- static getUserProfiles(options) {
1051
- return (options?.client ?? client).get({
1052
- ...options,
1053
- url: "/user_profiles"
1054
- });
2187
+ });
2188
+ var patchConfigsByKey = (options) => (options.client ?? client).patch({
2189
+ security: [{ scheme: "bearer", type: "http" }],
2190
+ url: "/configs/{key}",
2191
+ ...options,
2192
+ headers: {
2193
+ "Content-Type": "application/vnd.api+json",
2194
+ ...options.headers
1055
2195
  }
1056
- /**
1057
- * /user_profiles operation on user_profile resource
1058
- */
1059
- static postUserProfiles(options) {
1060
- return (options?.client ?? client).post({
1061
- ...options,
1062
- url: "/user_profiles"
1063
- });
2196
+ });
2197
+ var patchApiKeysByIdRotate = (options) => (options.client ?? client).patch({
2198
+ security: [{ scheme: "bearer", type: "http" }],
2199
+ url: "/api_keys/{id}/rotate",
2200
+ ...options,
2201
+ headers: {
2202
+ "Content-Type": "application/vnd.api+json",
2203
+ ...options.headers
1064
2204
  }
1065
- /**
1066
- * /user_profiles/:id operation on user_profile resource
1067
- */
1068
- static deleteUserProfilesById(options) {
1069
- return (options?.client ?? client).delete({
1070
- ...options,
1071
- url: "/user_profiles/{id}"
1072
- });
2205
+ });
2206
+ var postAgentsByIdClone = (options) => (options.client ?? client).post({
2207
+ security: [{ scheme: "bearer", type: "http" }],
2208
+ url: "/agents/{id}/clone",
2209
+ ...options,
2210
+ headers: {
2211
+ "Content-Type": "application/vnd.api+json",
2212
+ ...options.headers
1073
2213
  }
1074
- /**
1075
- * /user_profiles/:id operation on user_profile resource
1076
- */
1077
- static getUserProfilesById(options) {
1078
- return (options?.client ?? client).get({
1079
- ...options,
1080
- url: "/user_profiles/{id}"
1081
- });
2214
+ });
2215
+ var deleteUserProfilesById = (options) => (options.client ?? client).delete({
2216
+ security: [{ scheme: "bearer", type: "http" }],
2217
+ url: "/user_profiles/{id}",
2218
+ ...options
2219
+ });
2220
+ var getUserProfilesById = (options) => (options.client ?? client).get({
2221
+ security: [{ scheme: "bearer", type: "http" }],
2222
+ url: "/user_profiles/{id}",
2223
+ ...options
2224
+ });
2225
+ var patchUserProfilesById = (options) => (options.client ?? client).patch({
2226
+ security: [{ scheme: "bearer", type: "http" }],
2227
+ url: "/user_profiles/{id}",
2228
+ ...options,
2229
+ headers: {
2230
+ "Content-Type": "application/vnd.api+json",
2231
+ ...options.headers
1082
2232
  }
1083
- /**
1084
- * /user_profiles/:id operation on user_profile resource
1085
- */
1086
- static patchUserProfilesById(options) {
1087
- return (options?.client ?? client).patch({
1088
- ...options,
1089
- url: "/user_profiles/{id}"
1090
- });
2233
+ });
2234
+ var deleteObjectsById = (options) => (options.client ?? client).delete({
2235
+ security: [{ scheme: "bearer", type: "http" }],
2236
+ url: "/objects/{id}",
2237
+ ...options
2238
+ });
2239
+ var getObjectsById = (options) => (options.client ?? client).get({
2240
+ security: [{ scheme: "bearer", type: "http" }],
2241
+ url: "/objects/{id}",
2242
+ ...options
2243
+ });
2244
+ var getWebhookConfigs = (options) => (options.client ?? client).get({
2245
+ security: [{ scheme: "bearer", type: "http" }],
2246
+ url: "/webhook_configs",
2247
+ ...options
2248
+ });
2249
+ var postWebhookConfigs = (options) => (options.client ?? client).post({
2250
+ security: [{ scheme: "bearer", type: "http" }],
2251
+ url: "/webhook_configs",
2252
+ ...options,
2253
+ headers: {
2254
+ "Content-Type": "application/vnd.api+json",
2255
+ ...options.headers
1091
2256
  }
1092
- };
1093
- var AgentService = class {
1094
- /**
1095
- * Validate sample output against agent schema
1096
- */
1097
- static postAgentsByIdValidate(options) {
1098
- return (options?.client ?? client).post({
1099
- ...options,
1100
- url: "/agents/{id}/validate"
1101
- });
2257
+ });
2258
+ var postObjectsBulkDestroy = (options) => (options.client ?? client).post({
2259
+ security: [{ scheme: "bearer", type: "http" }],
2260
+ url: "/objects/bulk-destroy",
2261
+ ...options,
2262
+ headers: {
2263
+ "Content-Type": "application/vnd.api+json",
2264
+ ...options.headers
1102
2265
  }
1103
- /**
1104
- * /agents/:id operation on agent resource
1105
- */
1106
- static deleteAgentsById(options) {
1107
- return (options?.client ?? client).delete({
1108
- ...options,
1109
- url: "/agents/{id}"
1110
- });
2266
+ });
2267
+ var getApplicationsBySlugBySlug = (options) => (options.client ?? client).get({
2268
+ security: [{ scheme: "bearer", type: "http" }],
2269
+ url: "/applications/by-slug/{slug}",
2270
+ ...options
2271
+ });
2272
+ var getNotificationLogs = (options) => (options.client ?? client).get({
2273
+ security: [{ scheme: "bearer", type: "http" }],
2274
+ url: "/notification_logs",
2275
+ ...options
2276
+ });
2277
+ var getWallet = (options) => (options.client ?? client).get({
2278
+ security: [{ scheme: "bearer", type: "http" }],
2279
+ url: "/wallet",
2280
+ ...options
2281
+ });
2282
+ var deleteMessagesById = (options) => (options.client ?? client).delete({
2283
+ security: [{ scheme: "bearer", type: "http" }],
2284
+ url: "/messages/{id}",
2285
+ ...options
2286
+ });
2287
+ var getMessagesById = (options) => (options.client ?? client).get({
2288
+ security: [{ scheme: "bearer", type: "http" }],
2289
+ url: "/messages/{id}",
2290
+ ...options
2291
+ });
2292
+ var patchMessagesById = (options) => (options.client ?? client).patch({
2293
+ security: [{ scheme: "bearer", type: "http" }],
2294
+ url: "/messages/{id}",
2295
+ ...options,
2296
+ headers: {
2297
+ "Content-Type": "application/vnd.api+json",
2298
+ ...options.headers
1111
2299
  }
1112
- /**
1113
- * /agents/:id operation on agent resource
1114
- */
1115
- static getAgentsById(options) {
1116
- return (options?.client ?? client).get({
1117
- ...options,
1118
- url: "/agents/{id}"
1119
- });
2300
+ });
2301
+ var getLlmAnalyticsUsage = (options) => (options.client ?? client).get({
2302
+ security: [{ scheme: "bearer", type: "http" }],
2303
+ url: "/llm_analytics/usage",
2304
+ ...options
2305
+ });
2306
+ var getSearchStats = (options) => (options.client ?? client).get({
2307
+ security: [{ scheme: "bearer", type: "http" }],
2308
+ url: "/search/stats",
2309
+ ...options
2310
+ });
2311
+ var deleteNotificationPreferencesById = (options) => (options.client ?? client).delete({
2312
+ security: [{ scheme: "bearer", type: "http" }],
2313
+ url: "/notification_preferences/{id}",
2314
+ ...options
2315
+ });
2316
+ var getNotificationPreferencesById = (options) => (options.client ?? client).get({
2317
+ security: [{ scheme: "bearer", type: "http" }],
2318
+ url: "/notification_preferences/{id}",
2319
+ ...options
2320
+ });
2321
+ var patchNotificationPreferencesById = (options) => (options.client ?? client).patch({
2322
+ security: [{ scheme: "bearer", type: "http" }],
2323
+ url: "/notification_preferences/{id}",
2324
+ ...options,
2325
+ headers: {
2326
+ "Content-Type": "application/vnd.api+json",
2327
+ ...options.headers
1120
2328
  }
1121
- /**
1122
- * /agents/:id operation on agent resource
1123
- */
1124
- static patchAgentsById(options) {
1125
- return (options?.client ?? client).patch({
1126
- ...options,
1127
- url: "/agents/{id}"
1128
- });
2329
+ });
2330
+ var getAiGraphNodes = (options) => (options.client ?? client).get({
2331
+ security: [{ scheme: "bearer", type: "http" }],
2332
+ url: "/ai/graph/nodes",
2333
+ ...options
2334
+ });
2335
+ var postAiGraphNodes = (options) => (options.client ?? client).post({
2336
+ security: [{ scheme: "bearer", type: "http" }],
2337
+ url: "/ai/graph/nodes",
2338
+ ...options,
2339
+ headers: {
2340
+ "Content-Type": "application/vnd.api+json",
2341
+ ...options.headers
1129
2342
  }
1130
- /**
1131
- * Run the agent against sample input
1132
- */
1133
- static postAgentsByIdTest(options) {
1134
- return (options?.client ?? client).post({
1135
- ...options,
1136
- url: "/agents/{id}/test"
1137
- });
2343
+ });
2344
+ var getAgents = (options) => (options.client ?? client).get({
2345
+ security: [{ scheme: "bearer", type: "http" }],
2346
+ url: "/agents",
2347
+ ...options
2348
+ });
2349
+ var postAgents = (options) => (options.client ?? client).post({
2350
+ security: [{ scheme: "bearer", type: "http" }],
2351
+ url: "/agents",
2352
+ ...options,
2353
+ headers: {
2354
+ "Content-Type": "application/vnd.api+json",
2355
+ ...options.headers
1138
2356
  }
1139
- /**
1140
- * Clone the agent to a new one with a new name
1141
- */
1142
- static postAgentsByIdClone(options) {
1143
- return (options?.client ?? client).post({
1144
- ...options,
1145
- url: "/agents/{id}/clone"
1146
- });
2357
+ });
2358
+ var getDocumentsByIdExtractionResults = (options) => (options.client ?? client).get({
2359
+ security: [{ scheme: "bearer", type: "http" }],
2360
+ url: "/documents/{id}/extraction_results",
2361
+ ...options
2362
+ });
2363
+ var postUsersRegisterIsv = (options) => (options.client ?? client).post({
2364
+ security: [{ scheme: "bearer", type: "http" }],
2365
+ url: "/users/register_isv",
2366
+ ...options,
2367
+ headers: {
2368
+ "Content-Type": "application/vnd.api+json",
2369
+ ...options.headers
1147
2370
  }
1148
- /**
1149
- * /agents operation on agent resource
1150
- */
1151
- static getAgents(options) {
1152
- return (options?.client ?? client).get({
1153
- ...options,
1154
- url: "/agents"
1155
- });
2371
+ });
2372
+ var deleteWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).delete({
2373
+ security: [{ scheme: "bearer", type: "http" }],
2374
+ url: "/workspace-memberships/{workspace_id}/{user_id}",
2375
+ ...options
2376
+ });
2377
+ var patchWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).patch({
2378
+ security: [{ scheme: "bearer", type: "http" }],
2379
+ url: "/workspace-memberships/{workspace_id}/{user_id}",
2380
+ ...options,
2381
+ headers: {
2382
+ "Content-Type": "application/vnd.api+json",
2383
+ ...options.headers
1156
2384
  }
1157
- /**
1158
- * /agents operation on agent resource
1159
- */
1160
- static postAgents(options) {
1161
- return (options?.client ?? client).post({
1162
- ...options,
1163
- url: "/agents"
1164
- });
2385
+ });
2386
+ var getCreditPackages = (options) => (options.client ?? client).get({
2387
+ security: [{ scheme: "bearer", type: "http" }],
2388
+ url: "/credit-packages",
2389
+ ...options
2390
+ });
2391
+ var getUsers = (options) => (options.client ?? client).get({
2392
+ security: [{ scheme: "bearer", type: "http" }],
2393
+ url: "/users",
2394
+ ...options
2395
+ });
2396
+ var getObjects = (options) => (options.client ?? client).get({
2397
+ security: [{ scheme: "bearer", type: "http" }],
2398
+ url: "/objects",
2399
+ ...options
2400
+ });
2401
+
2402
+ // src/errors/index.ts
2403
+ var GptCoreError = class extends Error {
2404
+ constructor(message, options) {
2405
+ super(message);
2406
+ this.name = this.constructor.name;
2407
+ this.statusCode = options?.statusCode;
2408
+ this.code = options?.code;
2409
+ this.requestId = options?.requestId;
2410
+ this.headers = options?.headers;
2411
+ this.body = options?.body;
2412
+ if (options?.cause) {
2413
+ this.cause = options.cause;
2414
+ }
2415
+ if (Error.captureStackTrace) {
2416
+ Error.captureStackTrace(this, this.constructor);
2417
+ }
1165
2418
  }
1166
2419
  };
1167
- var PresignedUrlService = class {
1168
- /**
1169
- * /storage/sign_download operation on presigned_url resource
1170
- */
1171
- static postStorageSignDownload(options) {
1172
- return (options?.client ?? client).post({
1173
- ...options,
1174
- url: "/storage/sign_download"
1175
- });
1176
- }
1177
- /**
1178
- * /documents/presigned_upload operation on presigned_url resource
1179
- */
1180
- static postDocumentsPresignedUpload(options) {
1181
- return (options?.client ?? client).post({
1182
- ...options,
1183
- url: "/documents/presigned_upload"
1184
- });
1185
- }
1186
- /**
1187
- * /storage/sign_upload operation on presigned_url resource
1188
- */
1189
- static postStorageSignUpload(options) {
1190
- return (options?.client ?? client).post({
1191
- ...options,
1192
- url: "/storage/sign_upload"
1193
- });
2420
+ var AuthenticationError = class extends GptCoreError {
2421
+ constructor(message = "Authentication failed", options) {
2422
+ super(message, { statusCode: 401, ...options });
1194
2423
  }
1195
2424
  };
1196
- var ApplicationService = class {
1197
- /**
1198
- * /applications operation on application resource
1199
- */
1200
- static getApplications(options) {
1201
- return (options?.client ?? client).get({
1202
- ...options,
1203
- url: "/applications"
1204
- });
1205
- }
1206
- /**
1207
- * /applications operation on application resource
1208
- */
1209
- static postApplications(options) {
1210
- return (options?.client ?? client).post({
1211
- ...options,
1212
- url: "/applications"
1213
- });
1214
- }
1215
- /**
1216
- * /applications/:id operation on application resource
1217
- */
1218
- static deleteApplicationsById(options) {
1219
- return (options?.client ?? client).delete({
1220
- ...options,
1221
- url: "/applications/{id}"
1222
- });
1223
- }
1224
- /**
1225
- * /applications/:id operation on application resource
1226
- */
1227
- static getApplicationsById(options) {
1228
- return (options?.client ?? client).get({
1229
- ...options,
1230
- url: "/applications/{id}"
1231
- });
1232
- }
1233
- /**
1234
- * /applications/:id operation on application resource
1235
- */
1236
- static patchApplicationsById(options) {
1237
- return (options?.client ?? client).patch({
1238
- ...options,
1239
- url: "/applications/{id}"
1240
- });
1241
- }
1242
- /**
1243
- * /applications/by-slug/:slug operation on application resource
1244
- */
1245
- static getApplicationsBySlugBySlug(options) {
1246
- return (options?.client ?? client).get({
1247
- ...options,
1248
- url: "/applications/by-slug/{slug}"
1249
- });
2425
+ var AuthorizationError = class extends GptCoreError {
2426
+ constructor(message = "Permission denied", options) {
2427
+ super(message, { statusCode: 403, ...options });
1250
2428
  }
1251
2429
  };
1252
- var TenantService = class {
1253
- /**
1254
- * /tenants operation on tenant resource
1255
- */
1256
- static getTenants(options) {
1257
- return (options?.client ?? client).get({
1258
- ...options,
1259
- url: "/tenants"
1260
- });
1261
- }
1262
- /**
1263
- * /tenants operation on tenant resource
1264
- */
1265
- static postTenants(options) {
1266
- return (options?.client ?? client).post({
1267
- ...options,
1268
- url: "/tenants"
1269
- });
1270
- }
1271
- /**
1272
- * /tenants/:id/remove-storage operation on tenant resource
1273
- */
1274
- static postTenantsByIdRemoveStorage(options) {
1275
- return (options?.client ?? client).post({
1276
- ...options,
1277
- url: "/tenants/{id}/remove-storage"
1278
- });
1279
- }
1280
- /**
1281
- * /tenants/:id/buy-storage operation on tenant resource
1282
- */
1283
- static postTenantsByIdBuyStorage(options) {
1284
- return (options?.client ?? client).post({
1285
- ...options,
1286
- url: "/tenants/{id}/buy-storage"
1287
- });
1288
- }
1289
- /**
1290
- * /tenants/:id operation on tenant resource
1291
- */
1292
- static deleteTenantsById(options) {
1293
- return (options?.client ?? client).delete({
1294
- ...options,
1295
- url: "/tenants/{id}"
1296
- });
1297
- }
1298
- /**
1299
- * /tenants/:id operation on tenant resource
1300
- */
1301
- static getTenantsById(options) {
1302
- return (options?.client ?? client).get({
1303
- ...options,
1304
- url: "/tenants/{id}"
1305
- });
1306
- }
1307
- /**
1308
- * /tenants/:id operation on tenant resource
1309
- */
1310
- static patchTenantsById(options) {
1311
- return (options?.client ?? client).patch({
1312
- ...options,
1313
- url: "/tenants/{id}"
1314
- });
2430
+ var NotFoundError = class extends GptCoreError {
2431
+ constructor(message = "Resource not found", options) {
2432
+ super(message, { statusCode: 404, ...options });
1315
2433
  }
1316
2434
  };
1317
- var AuditLogService = class {
1318
- /**
1319
- * /audit-logs operation on audit-log resource
1320
- */
1321
- static getAuditLogs(options) {
1322
- return (options?.client ?? client).get({
1323
- ...options,
1324
- url: "/audit-logs"
1325
- });
2435
+ var ValidationError = class extends GptCoreError {
2436
+ constructor(message = "Validation failed", errors, options) {
2437
+ super(message, { statusCode: 422, ...options });
2438
+ this.errors = errors;
1326
2439
  }
1327
2440
  };
1328
- var PlanService = class {
1329
- /**
1330
- * /plans/:id operation on plan resource
1331
- */
1332
- static deletePlansById(options) {
1333
- return (options?.client ?? client).delete({
1334
- ...options,
1335
- url: "/plans/{id}"
1336
- });
1337
- }
1338
- /**
1339
- * /plans/:id operation on plan resource
1340
- */
1341
- static getPlansById(options) {
1342
- return (options?.client ?? client).get({
1343
- ...options,
1344
- url: "/plans/{id}"
1345
- });
1346
- }
1347
- /**
1348
- * /plans/:id operation on plan resource
1349
- */
1350
- static patchPlansById(options) {
1351
- return (options?.client ?? client).patch({
1352
- ...options,
1353
- url: "/plans/{id}"
1354
- });
1355
- }
1356
- /**
1357
- * /plans/slug/:slug operation on plan resource
1358
- */
1359
- static getPlansSlugBySlug(options) {
1360
- return (options?.client ?? client).get({
1361
- ...options,
1362
- url: "/plans/slug/{slug}"
1363
- });
1364
- }
1365
- /**
1366
- * /plans operation on plan resource
1367
- */
1368
- static getPlans(options) {
1369
- return (options?.client ?? client).get({
1370
- ...options,
1371
- url: "/plans"
1372
- });
1373
- }
1374
- /**
1375
- * /plans operation on plan resource
1376
- */
1377
- static postPlans(options) {
1378
- return (options?.client ?? client).post({
1379
- ...options,
1380
- url: "/plans"
1381
- });
2441
+ var RateLimitError = class extends GptCoreError {
2442
+ constructor(message = "Rate limit exceeded", retryAfter, options) {
2443
+ super(message, { statusCode: 429, ...options });
2444
+ this.retryAfter = retryAfter;
1382
2445
  }
1383
2446
  };
1384
- var WalletService = class {
1385
- /**
1386
- * Purchase an add-on for the wallet
1387
- */
1388
- static patchWalletAddons(options) {
1389
- return (options?.client ?? client).patch({
1390
- ...options,
1391
- url: "/wallet/addons"
1392
- });
1393
- }
1394
- /**
1395
- * /wallet/addons/:addon_slug/cancel operation on wallet resource
1396
- */
1397
- static patchWalletAddonsByAddonSlugCancel(options) {
1398
- return (options?.client ?? client).patch({
1399
- ...options,
1400
- url: "/wallet/addons/{addon_slug}/cancel"
1401
- });
1402
- }
1403
- /**
1404
- * Change the main plan for the wallet
1405
- */
1406
- static patchWalletPlan(options) {
1407
- return (options?.client ?? client).patch({
1408
- ...options,
1409
- url: "/wallet/plan"
1410
- });
2447
+ var NetworkError = class extends GptCoreError {
2448
+ constructor(message = "Network request failed", options) {
2449
+ super(message, options);
1411
2450
  }
1412
- /**
1413
- * Reads the wallet for the current tenant
1414
- */
1415
- static getWallet(options) {
1416
- return (options?.client ?? client).get({
1417
- ...options,
1418
- url: "/wallet"
1419
- });
2451
+ };
2452
+ var TimeoutError = class extends GptCoreError {
2453
+ constructor(message = "Request timeout", options) {
2454
+ super(message, options);
1420
2455
  }
1421
2456
  };
1422
- var EmbeddingService = class {
1423
- /**
1424
- * /ai/embed operation on embedding resource
1425
- */
1426
- static postAiEmbed(options) {
1427
- return (options?.client ?? client).post({
1428
- ...options,
1429
- url: "/ai/embed"
1430
- });
2457
+ var ServerError = class extends GptCoreError {
2458
+ constructor(message = "Internal server error", options) {
2459
+ super(message, { statusCode: 500, ...options });
1431
2460
  }
1432
2461
  };
1433
-
1434
- // src/base-client.ts
1435
- var BaseClient = class {
1436
- constructor(config = {}) {
1437
- if (config.baseUrl) {
1438
- client.setConfig({ baseUrl: config.baseUrl });
1439
- }
1440
- client.interceptors.request.use((req) => {
1441
- req.headers.set("Accept", "application/vnd.api+json");
1442
- req.headers.set("Content-Type", "application/vnd.api+json");
1443
- if (config.apiKey) {
1444
- req.headers.set("x-application-key", config.apiKey);
1445
- }
1446
- if (config.token) {
1447
- req.headers.set("Authorization", `Bearer ${config.token}`);
2462
+ function handleApiError(error) {
2463
+ const response = error?.response || error;
2464
+ const statusCode = response?.status || error?.status || error?.statusCode;
2465
+ const headers = response?.headers || error?.headers;
2466
+ const requestId = headers?.get?.("x-request-id") || headers?.["x-request-id"];
2467
+ const body = response?.body || response?.data || error?.body || error?.data || error;
2468
+ let message = "An error occurred";
2469
+ let errors;
2470
+ if (body?.errors && Array.isArray(body.errors)) {
2471
+ const firstError = body.errors[0];
2472
+ message = firstError?.title || firstError?.detail || message;
2473
+ errors = body.errors.map((err) => ({
2474
+ field: err.source?.pointer?.split("/").pop(),
2475
+ message: err.detail || err.title || "Unknown error"
2476
+ }));
2477
+ } else if (body?.message) {
2478
+ message = body.message;
2479
+ } else if (typeof body === "string") {
2480
+ message = body;
2481
+ } else if (error?.message) {
2482
+ message = error.message;
2483
+ }
2484
+ const errorOptions = {
2485
+ statusCode,
2486
+ requestId,
2487
+ headers: headers ? headers.entries ? Object.fromEntries(headers.entries()) : Object.fromEntries(Object.entries(headers)) : void 0,
2488
+ body,
2489
+ cause: error
2490
+ };
2491
+ switch (statusCode) {
2492
+ case 401:
2493
+ throw new AuthenticationError(message, errorOptions);
2494
+ case 403:
2495
+ throw new AuthorizationError(message, errorOptions);
2496
+ case 404:
2497
+ throw new NotFoundError(message, errorOptions);
2498
+ case 400:
2499
+ case 422:
2500
+ throw new ValidationError(message, errors, errorOptions);
2501
+ case 429:
2502
+ const retryAfter = headers?.get?.("retry-after") || headers?.["retry-after"];
2503
+ throw new RateLimitError(message, retryAfter ? parseInt(retryAfter, 10) : void 0, errorOptions);
2504
+ case 500:
2505
+ case 502:
2506
+ case 503:
2507
+ case 504:
2508
+ throw new ServerError(message, errorOptions);
2509
+ default:
2510
+ if (statusCode && statusCode >= 400) {
2511
+ throw new GptCoreError(message, errorOptions);
1448
2512
  }
1449
- return req;
1450
- });
2513
+ throw new NetworkError(message, errorOptions);
1451
2514
  }
1452
- unwrap(resource) {
1453
- if (!resource) return null;
1454
- if (resource.data && !resource.id && !resource.type) {
1455
- return resource.data;
2515
+ }
2516
+
2517
+ // src/schemas/requests.ts
2518
+ var import_zod = require("zod");
2519
+ var LoginRequestSchema = import_zod.z.object({
2520
+ email: import_zod.z.string().email(),
2521
+ password: import_zod.z.string().min(8)
2522
+ });
2523
+ var RegisterRequestSchema = import_zod.z.object({
2524
+ email: import_zod.z.string().email(),
2525
+ password: import_zod.z.string().min(8),
2526
+ password_confirmation: import_zod.z.string().min(8)
2527
+ }).refine((data) => data.password === data.password_confirmation, {
2528
+ message: "Passwords don't match",
2529
+ path: ["password_confirmation"]
2530
+ });
2531
+ var ApiKeyCreateSchema = import_zod.z.object({
2532
+ name: import_zod.z.string().min(1).max(255)
2533
+ });
2534
+ var ApiKeyAllocateSchema = import_zod.z.object({
2535
+ amount: import_zod.z.number().positive(),
2536
+ description: import_zod.z.string().min(1)
2537
+ });
2538
+ var ApplicationCreateSchema = import_zod.z.object({
2539
+ name: import_zod.z.string().min(1).max(255),
2540
+ slug: import_zod.z.string().regex(/^[a-z0-9-]+$/).optional(),
2541
+ description: import_zod.z.string().optional()
2542
+ });
2543
+ var WorkspaceCreateSchema = import_zod.z.object({
2544
+ name: import_zod.z.string().min(1).max(255),
2545
+ slug: import_zod.z.string().regex(/^[a-z0-9-]+$/).optional()
2546
+ });
2547
+ var InvitationCreateSchema = import_zod.z.object({
2548
+ email: import_zod.z.string().email(),
2549
+ role: import_zod.z.string(),
2550
+ scope_type: import_zod.z.enum(["tenant", "workspace"]),
2551
+ scope_id: import_zod.z.string().uuid()
2552
+ });
2553
+ var AgentCreateSchema = import_zod.z.object({
2554
+ name: import_zod.z.string().min(1).max(255),
2555
+ prompt_template: import_zod.z.string().min(1)
2556
+ });
2557
+ var ThreadCreateSchema = import_zod.z.object({
2558
+ title: import_zod.z.string().max(255).optional()
2559
+ });
2560
+ var MessageSendSchema = import_zod.z.object({
2561
+ content: import_zod.z.string().min(1)
2562
+ });
2563
+ var SearchRequestSchema = import_zod.z.object({
2564
+ query: import_zod.z.string().min(1),
2565
+ top_k: import_zod.z.number().int().positive().max(100).default(5)
2566
+ });
2567
+ var EmbedRequestSchema = import_zod.z.object({
2568
+ text: import_zod.z.string().min(1),
2569
+ workspace_id: import_zod.z.string().uuid().optional()
2570
+ });
2571
+ var DocumentUploadBase64Schema = import_zod.z.object({
2572
+ filename: import_zod.z.string().min(1),
2573
+ content: import_zod.z.string().min(1)
2574
+ // base64 content
2575
+ });
2576
+ var BucketCreateSchema = import_zod.z.object({
2577
+ name: import_zod.z.string().min(1).max(255),
2578
+ type: import_zod.z.enum(["public", "private"])
2579
+ });
2580
+ var PresignedUploadSchema = import_zod.z.object({
2581
+ filename: import_zod.z.string().min(1),
2582
+ content_type: import_zod.z.string().min(1)
2583
+ });
2584
+ var PresignedDownloadSchema = import_zod.z.object({
2585
+ file_id: import_zod.z.string().uuid()
2586
+ });
2587
+
2588
+ // src/utils/retry.ts
2589
+ var DEFAULT_RETRY_CONFIG = {
2590
+ maxRetries: 3,
2591
+ initialDelay: 1e3,
2592
+ // 1 second
2593
+ maxDelay: 32e3,
2594
+ // 32 seconds
2595
+ retryableStatusCodes: [429, 500, 502, 503, 504]
2596
+ };
2597
+ function isRetryableError(error, retryableStatusCodes) {
2598
+ const statusCode = error?.status || error?.statusCode || error?.response?.status;
2599
+ return retryableStatusCodes.includes(statusCode);
2600
+ }
2601
+ function calculateBackoff(attempt, initialDelay, maxDelay, retryAfter) {
2602
+ if (retryAfter) {
2603
+ return Math.min(retryAfter * 1e3, maxDelay);
2604
+ }
2605
+ const exponentialDelay = initialDelay * Math.pow(2, attempt);
2606
+ const jitter = Math.random() * 0.3 * exponentialDelay;
2607
+ const delay = exponentialDelay + jitter;
2608
+ return Math.min(delay, maxDelay);
2609
+ }
2610
+ function sleep(ms) {
2611
+ return new Promise((resolve) => setTimeout(resolve, ms));
2612
+ }
2613
+ async function retryWithBackoff(fn, config = DEFAULT_RETRY_CONFIG) {
2614
+ let lastError;
2615
+ for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
2616
+ try {
2617
+ return await fn();
2618
+ } catch (error) {
2619
+ lastError = error;
2620
+ if (attempt === config.maxRetries || !isRetryableError(error, config.retryableStatusCodes)) {
2621
+ throw error;
2622
+ }
2623
+ const errorWithHeaders = error;
2624
+ const retryAfter = errorWithHeaders?.response?.headers?.get?.("retry-after") || errorWithHeaders?.response?.headers?.["retry-after"] || errorWithHeaders?.headers?.get?.("retry-after") || errorWithHeaders?.headers?.["retry-after"];
2625
+ const retryAfterSeconds = retryAfter ? parseInt(retryAfter, 10) : void 0;
2626
+ const delay = calculateBackoff(
2627
+ attempt,
2628
+ config.initialDelay,
2629
+ config.maxDelay,
2630
+ retryAfterSeconds
2631
+ );
2632
+ await sleep(delay);
1456
2633
  }
1457
- return resource;
1458
2634
  }
1459
- };
2635
+ throw lastError;
2636
+ }
2637
+ function withRetry(fn, config) {
2638
+ const retryConfig = { ...DEFAULT_RETRY_CONFIG, ...config };
2639
+ return async (...args) => {
2640
+ return retryWithBackoff(() => fn(...args), retryConfig);
2641
+ };
2642
+ }
1460
2643
 
1461
- // src/gpt-client.ts
1462
- var GptClient = class extends BaseClient {
1463
- constructor(config) {
1464
- super(config);
1465
- this.identity = {
1466
- login: async (email, password) => {
1467
- const { data, error } = await UserService.postUsersAuthLogin({
1468
- body: { data: { type: "user", attributes: { email, password } } }
1469
- });
1470
- if (error) throw error;
1471
- return {
1472
- user: this.unwrap(data?.data),
1473
- token: data?.meta?.token
1474
- };
1475
- },
1476
- register: async (email, password, password_confirmation) => {
1477
- const { data, error } = await UserService.postUsersAuthRegister({
1478
- body: {
1479
- data: {
1480
- type: "user",
1481
- attributes: { email, password, password_confirmation }
1482
- }
1483
- }
1484
- });
1485
- if (error) throw error;
1486
- return this.unwrap(data?.data);
1487
- },
1488
- me: async () => {
1489
- const { data, error } = await UserService.getUsersMe();
1490
- if (error) throw error;
1491
- return this.unwrap(data?.data);
1492
- },
1493
- profile: async () => {
1494
- const { data, error } = await UserProfileService.getUserProfilesMe();
1495
- if (error) throw error;
1496
- return this.unwrap(data?.data);
1497
- },
1498
- apiKeys: {
1499
- list: async () => {
1500
- const { data, error } = await ApiKeyService.getApiKeys();
1501
- if (error) throw error;
1502
- return this.unwrap(data?.data);
1503
- },
1504
- create: async (name) => {
1505
- const { data, error } = await ApiKeyService.postApiKeys({
1506
- body: { data: { type: "api_key", attributes: { name } } }
1507
- });
1508
- if (error) throw error;
1509
- return this.unwrap(data?.data);
1510
- },
1511
- allocate: async (id, amount, description) => {
1512
- const { error } = await ApiKeyService.patchApiKeysByIdAllocate({
1513
- path: { id },
1514
- body: { data: { type: "api_key", id, attributes: { amount, description } } }
1515
- });
1516
- if (error) throw error;
1517
- return true;
1518
- }
1519
- }
1520
- };
1521
- this.platform = {
1522
- applications: {
1523
- list: async () => {
1524
- const { data, error } = await ApplicationService.getApplications();
1525
- if (error) throw error;
1526
- return this.unwrap(data?.data);
1527
- },
1528
- create: async (attributes) => {
1529
- const { data, error } = await ApplicationService.postApplications({
1530
- body: { data: { type: "application", attributes } }
1531
- });
1532
- if (error) throw error;
1533
- return this.unwrap(data?.data);
1534
- },
1535
- getBySlug: async (slug) => {
1536
- const { data, error } = await ApplicationService.getApplicationsBySlugBySlug({
1537
- path: { slug }
1538
- });
1539
- if (error) throw error;
1540
- return this.unwrap(data?.data);
1541
- }
1542
- },
1543
- workspaces: {
1544
- list: async () => {
1545
- const { data, error } = await WorkspaceService.getWorkspaces();
1546
- if (error) throw error;
1547
- return this.unwrap(data?.data);
1548
- },
1549
- mine: async () => {
1550
- const { data, error } = await WorkspaceService.getWorkspacesMine();
1551
- if (error) throw error;
1552
- return this.unwrap(data?.data);
1553
- },
1554
- create: async (name, slug) => {
1555
- const { data, error } = await WorkspaceService.postWorkspaces({
1556
- body: { data: { type: "workspace", attributes: { name, slug } } }
1557
- });
1558
- if (error) throw error;
1559
- return this.unwrap(data?.data);
1560
- }
1561
- },
1562
- tenants: {
1563
- list: async () => {
1564
- const { data, error } = await TenantService.getTenants();
1565
- if (error) throw error;
1566
- return this.unwrap(data?.data);
1567
- }
1568
- },
1569
- invitations: {
1570
- list: async () => {
1571
- const { data, error } = await InvitationService.getInvitations();
1572
- if (error) throw error;
1573
- return this.unwrap(data?.data);
1574
- },
1575
- invite: async (email, role2, scopeType, scopeId) => {
1576
- const { error } = await InvitationService.postInvitationsInvite({
1577
- body: { email, role: role2, scope_type: scopeType, scope_id: scopeId }
1578
- });
1579
- if (error) throw error;
1580
- return true;
1581
- }
1582
- },
1583
- auditLogs: {
1584
- list: async () => {
1585
- const { data, error } = await AuditLogService.getAuditLogs();
1586
- if (error) throw error;
1587
- return this.unwrap(data?.data);
1588
- }
2644
+ // src/pagination.ts
2645
+ async function* paginateAll(fetcher, options = {}) {
2646
+ const pageSize = options.pageSize || 20;
2647
+ const limit = options.limit;
2648
+ let page = 1;
2649
+ let totalYielded = 0;
2650
+ while (true) {
2651
+ const response = await fetcher(page, pageSize);
2652
+ for (const item of response.data) {
2653
+ yield item;
2654
+ totalYielded++;
2655
+ if (limit && totalYielded >= limit) {
2656
+ return;
1589
2657
  }
1590
- };
1591
- this.ai = {
1592
- agents: {
1593
- list: async () => {
1594
- const { data, error } = await AgentService.getAgents();
1595
- if (error) throw error;
1596
- return this.unwrap(data?.data);
1597
- },
1598
- create: async (name, promptTemplate) => {
1599
- const { data, error } = await AgentService.postAgents({
1600
- body: { data: { type: "agent", attributes: { name, prompt_template: promptTemplate } } }
1601
- });
1602
- if (error) throw error;
1603
- return this.unwrap(data?.data);
1604
- }
1605
- },
1606
- threads: {
1607
- list: async () => {
1608
- const { data, error } = await ThreadService.getThreads();
1609
- if (error) throw error;
1610
- return this.unwrap(data?.data);
1611
- },
1612
- create: async (title) => {
1613
- const { data, error } = await ThreadService.postThreads({
1614
- body: { data: { type: "thread", attributes: { title } } }
1615
- });
1616
- if (error) throw error;
1617
- return this.unwrap(data?.data);
1618
- },
1619
- sendMessage: async (threadId, content) => {
1620
- const { data, error } = await ThreadService.postThreadsByIdMessages({
1621
- path: { id: threadId },
1622
- body: { data: { attributes: { content } } }
1623
- });
1624
- if (error) throw error;
1625
- return this.unwrap(data);
1626
- }
1627
- },
1628
- search: async (query, top_k = 5) => {
1629
- const { data, error } = await SearchService.postAiSearch({
1630
- body: { query, top_k }
1631
- });
1632
- if (error) throw error;
1633
- return this.unwrap(data);
1634
- },
1635
- embed: async (text, workspaceId) => {
1636
- const { data, error } = await EmbeddingService.postAiEmbed({
1637
- body: { text, workspace_id: workspaceId }
1638
- });
1639
- if (error) throw error;
1640
- return this.unwrap(data);
2658
+ }
2659
+ if (!response.links?.next || response.data.length === 0) {
2660
+ break;
2661
+ }
2662
+ page++;
2663
+ }
2664
+ }
2665
+ async function paginateToArray(fetcher, options = {}) {
2666
+ const results = [];
2667
+ for await (const item of paginateAll(fetcher, options)) {
2668
+ results.push(item);
2669
+ }
2670
+ return results;
2671
+ }
2672
+
2673
+ // src/streaming.ts
2674
+ async function* streamSSE(response, options = {}) {
2675
+ if (!response.body) {
2676
+ throw new Error("Response body is null");
2677
+ }
2678
+ const reader = response.body.getReader();
2679
+ const decoder = new TextDecoder();
2680
+ let buffer = "";
2681
+ try {
2682
+ while (true) {
2683
+ const { done, value } = await reader.read();
2684
+ if (done) {
2685
+ break;
1641
2686
  }
1642
- };
1643
- this.extraction = {
1644
- documents: {
1645
- list: async () => {
1646
- const { data, error } = await DocumentService.getDocuments();
1647
- if (error) throw error;
1648
- return this.unwrap(data?.data);
1649
- },
1650
- upload: async (_file, _filename) => {
1651
- throw new Error("Use uploadBase64 for now");
1652
- },
1653
- uploadBase64: async (filename, base64Content) => {
1654
- const { data, error } = await DocumentService.postDocuments({
1655
- body: { data: { type: "document", attributes: { filename, content: base64Content } } }
1656
- });
1657
- if (error) throw error;
1658
- return this.unwrap(data?.data);
1659
- },
1660
- get: async (id) => {
1661
- const { data, error } = await DocumentService.getDocumentsById({ path: { id } });
1662
- if (error) throw error;
1663
- return this.unwrap(data?.data);
1664
- },
1665
- delete: async (id) => {
1666
- const { error } = await DocumentService.deleteDocumentsById({ path: { id } });
1667
- if (error) throw error;
1668
- return true;
1669
- },
1670
- analyze: async (id) => {
1671
- const { error } = await DocumentService.postDocumentsByIdAnalyze({ path: { id }, body: {} });
1672
- if (error) throw error;
1673
- return true;
1674
- }
1675
- },
1676
- results: {
1677
- list: async () => {
1678
- const { data, error } = await ExtractionResultService.getExtractionResults();
1679
- if (error) throw error;
1680
- return this.unwrap(data?.data);
1681
- }
2687
+ if (options.signal?.aborted) {
2688
+ reader.cancel();
2689
+ throw new Error("Stream aborted");
1682
2690
  }
1683
- };
1684
- this.storage = {
1685
- buckets: {
1686
- list: async () => {
1687
- const { data, error } = await BucketService.getBuckets();
1688
- if (error) throw error;
1689
- return this.unwrap(data?.data);
1690
- },
1691
- create: async (name, isPublic = false) => {
1692
- const { data, error } = await BucketService.postBuckets({
1693
- body: { data: { type: "bucket", attributes: { name, type: isPublic ? "public" : "private" } } }
1694
- });
1695
- if (error) throw error;
1696
- return this.unwrap(data?.data);
1697
- }
1698
- },
1699
- presigned: {
1700
- upload: async (filename, contentType) => {
1701
- const { data, error } = await PresignedUrlService.postStorageSignUpload({
1702
- body: { filename, content_type: contentType }
1703
- });
1704
- if (error) throw error;
1705
- return this.unwrap(data);
1706
- },
1707
- download: async (fileId) => {
1708
- const { data, error } = await PresignedUrlService.postStorageSignDownload({
1709
- body: { file_id: fileId }
1710
- });
1711
- if (error) throw error;
1712
- return this.unwrap(data);
1713
- }
1714
- }
1715
- };
1716
- this.billing = {
1717
- wallet: {
1718
- get: async () => {
1719
- const { data, error } = await WalletService.getWallet();
1720
- if (error) throw error;
1721
- return this.unwrap(data?.data);
1722
- }
1723
- },
1724
- plans: {
1725
- list: async () => {
1726
- const { data, error } = await PlanService.getPlans();
1727
- if (error) throw error;
1728
- return this.unwrap(data?.data);
2691
+ buffer += decoder.decode(value, { stream: true });
2692
+ const lines = buffer.split("\n");
2693
+ buffer = lines.pop() || "";
2694
+ for (const line of lines) {
2695
+ if (line.startsWith("data: ")) {
2696
+ const data = line.slice(6);
2697
+ if (data === "[DONE]" || data.trim() === "") {
2698
+ continue;
2699
+ }
2700
+ try {
2701
+ const parsed = JSON.parse(data);
2702
+ yield parsed;
2703
+ } catch (e) {
2704
+ yield data;
2705
+ }
1729
2706
  }
1730
2707
  }
1731
- };
2708
+ }
2709
+ } catch (error) {
2710
+ if (options.onError) {
2711
+ options.onError(error);
2712
+ }
2713
+ throw error;
2714
+ } finally {
2715
+ reader.releaseLock();
2716
+ }
2717
+ }
2718
+ async function* streamMessage(response, options = {}) {
2719
+ for await (const chunk of streamSSE(response, options)) {
2720
+ yield chunk;
2721
+ if (chunk.type === "done" || chunk.type === "error") {
2722
+ break;
2723
+ }
1732
2724
  }
1733
- };
1734
-
1735
- // src/_internal/types.gen.ts
1736
- var eq = {
1737
- KEYWORD: "keyword",
1738
- SEMANTIC: "semantic"
1739
- };
1740
- var greater_than = {
1741
- KEYWORD: "keyword",
1742
- SEMANTIC: "semantic"
1743
- };
1744
- var greater_than_or_equal = {
1745
- KEYWORD: "keyword",
1746
- SEMANTIC: "semantic"
1747
- };
1748
- var less_than = {
1749
- KEYWORD: "keyword",
1750
- SEMANTIC: "semantic"
1751
- };
1752
- var less_than_or_equal = {
1753
- KEYWORD: "keyword",
1754
- SEMANTIC: "semantic"
1755
- };
1756
- var not_eq = {
1757
- KEYWORD: "keyword",
1758
- SEMANTIC: "semantic"
1759
- };
1760
- var eq2 = {
1761
- PENDING: "pending",
1762
- PROCESSING: "processing",
1763
- COMPLETED: "completed",
1764
- FAILED: "failed"
1765
- };
1766
- var greater_than2 = {
1767
- PENDING: "pending",
1768
- PROCESSING: "processing",
1769
- COMPLETED: "completed",
1770
- FAILED: "failed"
1771
- };
1772
- var greater_than_or_equal2 = {
1773
- PENDING: "pending",
1774
- PROCESSING: "processing",
1775
- COMPLETED: "completed",
1776
- FAILED: "failed"
1777
- };
1778
- var less_than2 = {
1779
- PENDING: "pending",
1780
- PROCESSING: "processing",
1781
- COMPLETED: "completed",
1782
- FAILED: "failed"
1783
- };
1784
- var less_than_or_equal2 = {
1785
- PENDING: "pending",
1786
- PROCESSING: "processing",
1787
- COMPLETED: "completed",
1788
- FAILED: "failed"
1789
- };
1790
- var not_eq2 = {
1791
- PENDING: "pending",
1792
- PROCESSING: "processing",
1793
- COMPLETED: "completed",
1794
- FAILED: "failed"
1795
- };
1796
- var status = {
1797
- PENDING: "pending",
1798
- PROCESSING: "processing",
1799
- COMPLETED: "completed",
1800
- FAILED: "failed"
1801
- };
1802
- var eq3 = {
1803
- ACTIVE: "active",
1804
- REVOKED: "revoked",
1805
- EXPIRED: "expired"
1806
- };
1807
- var greater_than3 = {
1808
- ACTIVE: "active",
1809
- REVOKED: "revoked",
1810
- EXPIRED: "expired"
1811
- };
1812
- var greater_than_or_equal3 = {
1813
- ACTIVE: "active",
1814
- REVOKED: "revoked",
1815
- EXPIRED: "expired"
1816
- };
1817
- var less_than3 = {
1818
- ACTIVE: "active",
1819
- REVOKED: "revoked",
1820
- EXPIRED: "expired"
1821
- };
1822
- var less_than_or_equal3 = {
1823
- ACTIVE: "active",
1824
- REVOKED: "revoked",
1825
- EXPIRED: "expired"
1826
- };
1827
- var not_eq3 = {
1828
- ACTIVE: "active",
1829
- REVOKED: "revoked",
1830
- EXPIRED: "expired"
1831
- };
1832
- var eq4 = {
1833
- PENDING: "pending",
1834
- SUCCESS: "success",
1835
- FAILED: "failed",
1836
- REFUNDED: "refunded",
1837
- VOIDED: "voided"
1838
- };
1839
- var greater_than4 = {
1840
- PENDING: "pending",
1841
- SUCCESS: "success",
1842
- FAILED: "failed",
1843
- REFUNDED: "refunded",
1844
- VOIDED: "voided"
1845
- };
1846
- var greater_than_or_equal4 = {
1847
- PENDING: "pending",
1848
- SUCCESS: "success",
1849
- FAILED: "failed",
1850
- REFUNDED: "refunded",
1851
- VOIDED: "voided"
1852
- };
1853
- var less_than4 = {
1854
- PENDING: "pending",
1855
- SUCCESS: "success",
1856
- FAILED: "failed",
1857
- REFUNDED: "refunded",
1858
- VOIDED: "voided"
1859
- };
1860
- var less_than_or_equal4 = {
1861
- PENDING: "pending",
1862
- SUCCESS: "success",
1863
- FAILED: "failed",
1864
- REFUNDED: "refunded",
1865
- VOIDED: "voided"
1866
- };
1867
- var not_eq4 = {
1868
- PENDING: "pending",
1869
- SUCCESS: "success",
1870
- FAILED: "failed",
1871
- REFUNDED: "refunded",
1872
- VOIDED: "voided"
1873
- };
1874
- var status2 = {
1875
- ACTIVE: "active",
1876
- REVOKED: "revoked",
1877
- EXPIRED: "expired"
1878
- };
1879
- var format = {
1880
- ENTITY: "entity",
1881
- TABULAR: "tabular",
1882
- GRAPH: "graph",
1883
- COMPOSITE: "composite"
1884
- };
1885
- var eq5 = {
1886
- OWNER: "owner",
1887
- ADMIN: "admin",
1888
- MEMBER: "member"
1889
- };
1890
- var greater_than5 = {
1891
- OWNER: "owner",
1892
- ADMIN: "admin",
1893
- MEMBER: "member"
1894
- };
1895
- var greater_than_or_equal5 = {
1896
- OWNER: "owner",
1897
- ADMIN: "admin",
1898
- MEMBER: "member"
1899
- };
1900
- var less_than5 = {
1901
- OWNER: "owner",
1902
- ADMIN: "admin",
1903
- MEMBER: "member"
1904
- };
1905
- var less_than_or_equal5 = {
1906
- OWNER: "owner",
1907
- ADMIN: "admin",
1908
- MEMBER: "member"
1909
- };
1910
- var not_eq5 = {
1911
- OWNER: "owner",
1912
- ADMIN: "admin",
1913
- MEMBER: "member"
1914
- };
1915
- var eq6 = {
1916
- PLAN: "plan",
1917
- ADDON: "addon"
1918
- };
1919
- var greater_than6 = {
1920
- PLAN: "plan",
1921
- ADDON: "addon"
1922
- };
1923
- var greater_than_or_equal6 = {
1924
- PLAN: "plan",
1925
- ADDON: "addon"
1926
- };
1927
- var less_than6 = {
1928
- PLAN: "plan",
1929
- ADDON: "addon"
1930
- };
1931
- var less_than_or_equal6 = {
1932
- PLAN: "plan",
1933
- ADDON: "addon"
1934
- };
1935
- var not_eq6 = {
1936
- PLAN: "plan",
1937
- ADDON: "addon"
1938
- };
1939
- var role = {
1940
- OWNER: "owner",
1941
- ADMIN: "admin",
1942
- MEMBER: "member"
1943
- };
1944
- var eq7 = {
1945
- PUBLIC: "public",
1946
- PRIVATE: "private"
1947
- };
1948
- var greater_than7 = {
1949
- PUBLIC: "public",
1950
- PRIVATE: "private"
1951
- };
1952
- var greater_than_or_equal7 = {
1953
- PUBLIC: "public",
1954
- PRIVATE: "private"
1955
- };
1956
- var less_than7 = {
1957
- PUBLIC: "public",
1958
- PRIVATE: "private"
1959
- };
1960
- var less_than_or_equal7 = {
1961
- PUBLIC: "public",
1962
- PRIVATE: "private"
1963
- };
1964
- var not_eq7 = {
1965
- PUBLIC: "public",
1966
- PRIVATE: "private"
1967
- };
1968
- var eq8 = {
1969
- SALE: "sale",
1970
- AUTH: "auth",
1971
- REFUND: "refund",
1972
- VOID: "void"
1973
- };
1974
- var greater_than8 = {
1975
- SALE: "sale",
1976
- AUTH: "auth",
1977
- REFUND: "refund",
1978
- VOID: "void"
1979
- };
1980
- var greater_than_or_equal8 = {
1981
- SALE: "sale",
1982
- AUTH: "auth",
1983
- REFUND: "refund",
1984
- VOID: "void"
1985
- };
1986
- var less_than8 = {
1987
- SALE: "sale",
1988
- AUTH: "auth",
1989
- REFUND: "refund",
1990
- VOID: "void"
1991
- };
1992
- var less_than_or_equal8 = {
1993
- SALE: "sale",
1994
- AUTH: "auth",
1995
- REFUND: "refund",
1996
- VOID: "void"
1997
- };
1998
- var not_eq8 = {
1999
- SALE: "sale",
2000
- AUTH: "auth",
2001
- REFUND: "refund",
2002
- VOID: "void"
2003
- };
2004
- var type = {
2005
- PUBLIC: "public",
2006
- PRIVATE: "private"
2007
- };
2725
+ }
2726
+ async function collectStreamedMessage(stream) {
2727
+ let fullMessage = "";
2728
+ for await (const chunk of stream) {
2729
+ if (chunk.type === "content" && chunk.content) {
2730
+ fullMessage += chunk.content;
2731
+ } else if (chunk.type === "error") {
2732
+ throw new Error(chunk.error || "Stream error");
2733
+ }
2734
+ }
2735
+ return fullMessage;
2736
+ }
2008
2737
  // Annotate the CommonJS export names for ESM import in node:
2009
2738
  0 && (module.exports = {
2010
- GptClient,
2011
- eq,
2012
- eq2,
2013
- eq3,
2014
- eq4,
2015
- eq5,
2016
- eq6,
2017
- eq7,
2018
- eq8,
2019
- format,
2020
- greater_than,
2021
- greater_than2,
2022
- greater_than3,
2023
- greater_than4,
2024
- greater_than5,
2025
- greater_than6,
2026
- greater_than7,
2027
- greater_than8,
2028
- greater_than_or_equal,
2029
- greater_than_or_equal2,
2030
- greater_than_or_equal3,
2031
- greater_than_or_equal4,
2032
- greater_than_or_equal5,
2033
- greater_than_or_equal6,
2034
- greater_than_or_equal7,
2035
- greater_than_or_equal8,
2036
- less_than,
2037
- less_than2,
2038
- less_than3,
2039
- less_than4,
2040
- less_than5,
2041
- less_than6,
2042
- less_than7,
2043
- less_than8,
2044
- less_than_or_equal,
2045
- less_than_or_equal2,
2046
- less_than_or_equal3,
2047
- less_than_or_equal4,
2048
- less_than_or_equal5,
2049
- less_than_or_equal6,
2050
- less_than_or_equal7,
2051
- less_than_or_equal8,
2052
- not_eq,
2053
- not_eq2,
2054
- not_eq3,
2055
- not_eq4,
2056
- not_eq5,
2057
- not_eq6,
2058
- not_eq7,
2059
- not_eq8,
2060
- role,
2061
- status,
2062
- status2,
2063
- type
2739
+ AgentCreateSchema,
2740
+ ApiKeyAllocateSchema,
2741
+ ApiKeyCreateSchema,
2742
+ ApplicationCreateSchema,
2743
+ AuthenticationError,
2744
+ AuthorizationError,
2745
+ BucketCreateSchema,
2746
+ DEFAULT_RETRY_CONFIG,
2747
+ DocumentUploadBase64Schema,
2748
+ EmbedRequestSchema,
2749
+ GptCoreError,
2750
+ InvitationCreateSchema,
2751
+ LoginRequestSchema,
2752
+ MessageSendSchema,
2753
+ NetworkError,
2754
+ NotFoundError,
2755
+ PresignedDownloadSchema,
2756
+ PresignedUploadSchema,
2757
+ RateLimitError,
2758
+ RegisterRequestSchema,
2759
+ SearchRequestSchema,
2760
+ ServerError,
2761
+ ThreadCreateSchema,
2762
+ TimeoutError,
2763
+ ValidationError,
2764
+ WorkspaceCreateSchema,
2765
+ calculateBackoff,
2766
+ client,
2767
+ collectStreamedMessage,
2768
+ deleteAgentsById,
2769
+ deleteAiGraphEdgesById,
2770
+ deleteAiGraphNodesById,
2771
+ deleteApiKeysById,
2772
+ deleteApplicationsById,
2773
+ deleteBucketsById,
2774
+ deleteDocumentsById,
2775
+ deleteExtractionResultsById,
2776
+ deleteMessagesById,
2777
+ deleteNotificationPreferencesById,
2778
+ deleteObjectsById,
2779
+ deleteSearchSavedById,
2780
+ deleteTenantMembershipsByTenantIdByUserId,
2781
+ deleteTenantsById,
2782
+ deleteThreadsById,
2783
+ deleteTrainingExamplesById,
2784
+ deleteUserProfilesById,
2785
+ deleteWebhookConfigsById,
2786
+ deleteWorkspaceMembershipsByWorkspaceIdByUserId,
2787
+ deleteWorkspacesById,
2788
+ getAgents,
2789
+ getAgentsById,
2790
+ getAiChunksDocumentByDocumentId,
2791
+ getAiGraphEdges,
2792
+ getAiGraphNodes,
2793
+ getApiKeys,
2794
+ getApiKeysById,
2795
+ getApplications,
2796
+ getApplicationsById,
2797
+ getApplicationsBySlugBySlug,
2798
+ getAuditLogs,
2799
+ getBuckets,
2800
+ getBucketsById,
2801
+ getBucketsByIdObjects,
2802
+ getBucketsByIdStats,
2803
+ getConfigs,
2804
+ getCreditPackages,
2805
+ getCreditPackagesById,
2806
+ getCreditPackagesSlugBySlug,
2807
+ getDocuments,
2808
+ getDocumentsById,
2809
+ getDocumentsByIdExtractionResults,
2810
+ getDocumentsByIdRelationshipsChunks,
2811
+ getDocumentsProcessingQueue,
2812
+ getDocumentsSearch,
2813
+ getDocumentsStats,
2814
+ getExtractionResults,
2815
+ getExtractionResultsById,
2816
+ getInvitations,
2817
+ getInvitationsConsumeByToken,
2818
+ getLlmAnalytics,
2819
+ getLlmAnalyticsById,
2820
+ getLlmAnalyticsCosts,
2821
+ getLlmAnalyticsPlatform,
2822
+ getLlmAnalyticsSummary,
2823
+ getLlmAnalyticsUsage,
2824
+ getLlmAnalyticsWorkspace,
2825
+ getMessages,
2826
+ getMessagesById,
2827
+ getMessagesSearch,
2828
+ getNotificationLogs,
2829
+ getNotificationLogsById,
2830
+ getNotificationPreferences,
2831
+ getNotificationPreferencesById,
2832
+ getObjects,
2833
+ getObjectsById,
2834
+ getPlans,
2835
+ getPlansById,
2836
+ getPlansSlugBySlug,
2837
+ getSearch,
2838
+ getSearchHealth,
2839
+ getSearchIndexes,
2840
+ getSearchSaved,
2841
+ getSearchSemantic,
2842
+ getSearchStats,
2843
+ getSearchStatus,
2844
+ getStorageStats,
2845
+ getTenantMemberships,
2846
+ getTenants,
2847
+ getTenantsById,
2848
+ getThreads,
2849
+ getThreadsById,
2850
+ getThreadsSearch,
2851
+ getTrainingExamples,
2852
+ getTrainingExamplesById,
2853
+ getTransactions,
2854
+ getTransactionsById,
2855
+ getUserProfiles,
2856
+ getUserProfilesById,
2857
+ getUserProfilesMe,
2858
+ getUsers,
2859
+ getUsersById,
2860
+ getUsersMe,
2861
+ getWallet,
2862
+ getWebhookConfigs,
2863
+ getWebhookConfigsById,
2864
+ getWebhookDeliveries,
2865
+ getWebhookDeliveriesById,
2866
+ getWorkspaceMemberships,
2867
+ getWorkspaces,
2868
+ getWorkspacesById,
2869
+ getWorkspacesMine,
2870
+ handleApiError,
2871
+ isRetryableError,
2872
+ paginateAll,
2873
+ paginateToArray,
2874
+ patchAgentsById,
2875
+ patchApiKeysById,
2876
+ patchApiKeysByIdAllocate,
2877
+ patchApiKeysByIdRevoke,
2878
+ patchApiKeysByIdRotate,
2879
+ patchApplicationsById,
2880
+ patchBucketsById,
2881
+ patchConfigsByKey,
2882
+ patchDocumentsById,
2883
+ patchExtractionResultsById,
2884
+ patchInvitationsByIdAccept,
2885
+ patchInvitationsByIdResend,
2886
+ patchInvitationsByIdRevoke,
2887
+ patchMessagesById,
2888
+ patchNotificationPreferencesById,
2889
+ patchTenantMembershipsByTenantIdByUserId,
2890
+ patchTenantsById,
2891
+ patchThreadsById,
2892
+ patchTrainingExamplesById,
2893
+ patchUserProfilesById,
2894
+ patchUsersAuthResetPassword,
2895
+ patchUsersById,
2896
+ patchUsersByIdConfirmEmail,
2897
+ patchUsersByIdResetPassword,
2898
+ patchWalletAddons,
2899
+ patchWalletAddonsByAddonSlugCancel,
2900
+ patchWalletPlan,
2901
+ patchWebhookConfigsById,
2902
+ patchWorkspaceMembershipsByWorkspaceIdByUserId,
2903
+ patchWorkspacesById,
2904
+ patchWorkspacesByIdAllocate,
2905
+ postAgents,
2906
+ postAgentsByIdClone,
2907
+ postAgentsByIdTest,
2908
+ postAgentsByIdValidate,
2909
+ postAiChunksSearch,
2910
+ postAiEmbed,
2911
+ postAiGraphEdges,
2912
+ postAiGraphNodes,
2913
+ postAiSearch,
2914
+ postAiSearchAdvanced,
2915
+ postApiKeys,
2916
+ postApplications,
2917
+ postBuckets,
2918
+ postConfigs,
2919
+ postDocuments,
2920
+ postDocumentsBulkDelete,
2921
+ postDocumentsBulkReprocess,
2922
+ postDocumentsByIdAnalyze,
2923
+ postDocumentsByIdReprocess,
2924
+ postDocumentsExport,
2925
+ postDocumentsImport,
2926
+ postDocumentsPresignedUpload,
2927
+ postInvitationsAcceptByToken,
2928
+ postInvitationsInvite,
2929
+ postLlmAnalytics,
2930
+ postMessages,
2931
+ postNotificationPreferences,
2932
+ postObjectsBulkDestroy,
2933
+ postObjectsRegister,
2934
+ postPayments,
2935
+ postSearchReindex,
2936
+ postSearchSaved,
2937
+ postStorageSignDownload,
2938
+ postStorageSignUpload,
2939
+ postTenantMemberships,
2940
+ postTenants,
2941
+ postTenantsByIdBuyStorage,
2942
+ postTenantsByIdRemoveStorage,
2943
+ postThreads,
2944
+ postThreadsActive,
2945
+ postThreadsByIdMessages,
2946
+ postThreadsByIdSummarize,
2947
+ postTokens,
2948
+ postTrainingExamples,
2949
+ postTrainingExamplesBulk,
2950
+ postTrainingExamplesBulkDelete,
2951
+ postUserProfiles,
2952
+ postUsersAuthConfirm,
2953
+ postUsersAuthLogin,
2954
+ postUsersAuthMagicLinkLogin,
2955
+ postUsersAuthMagicLinkRequest,
2956
+ postUsersAuthRegister,
2957
+ postUsersAuthRegisterWithOidc,
2958
+ postUsersRegisterIsv,
2959
+ postWebhookConfigs,
2960
+ postWebhookConfigsByIdTest,
2961
+ postWebhookDeliveriesByIdRetry,
2962
+ postWorkspaceMemberships,
2963
+ postWorkspaces,
2964
+ retryWithBackoff,
2965
+ sleep,
2966
+ streamMessage,
2967
+ streamSSE,
2968
+ withRetry
2064
2969
  });