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