@gpt-core/admin 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 +339 -17
  2. package/dist/index.d.mts +19861 -1179
  3. package/dist/index.d.ts +19861 -1179
  4. package/dist/index.js +1408 -609
  5. package/dist/index.mjs +1386 -557
  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);
17
+
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 sleep = 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 sleep(backoff);
146
+ }
147
+ }
148
+ };
149
+ const stream = createStream();
150
+ return { stream };
151
+ };
4
152
 
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;
9
- };
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) {
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,210 +187,649 @@ 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)];
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
77
219
  });
78
- let u = l.join(",");
79
- switch (a) {
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;
92
- };
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;
108
- }
109
- if (t === "matrix") {
110
- e = e.replace(i, `;${m({ name: n, value: l })}`);
111
- continue;
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;
279
+ };
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);
112
340
  }
113
- let u = encodeURIComponent(t === "label" ? `.${l}` : l);
114
- e = e.replace(i, u);
115
- }
116
- return e;
117
- };
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);
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;
131
372
  }
373
+ return options.body !== "" ? options.body : null;
374
+ }
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}`;
132
389
  }
133
- return o.join("&");
390
+ if (auth.scheme === "basic") {
391
+ return `Basic ${btoa(token)}`;
392
+ }
393
+ return token;
394
+ };
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
+ }
439
+ }
440
+ return search.join("&");
441
+ };
442
+ return querySerializer;
134
443
  };
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";
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";
143
457
  }
458
+ if (["application/", "audio/", "image/", "video/"].some(
459
+ (type) => cleanContent.startsWith(type)
460
+ )) {
461
+ return "blob";
462
+ }
463
+ if (cleanContent.startsWith("text/")) {
464
+ return "text";
465
+ }
466
+ return;
144
467
  };
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) {
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;
474
+ }
475
+ return false;
476
+ };
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);
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);
184
518
  }
185
- return r;
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 = [];
194
- }
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);
205
- }
206
- update(r, e) {
207
- let a = this.getInterceptorIndex(r);
208
- return this._fns[a] ? (this._fns[a] = e, r) : false;
209
- }
210
- use(r) {
211
- return this._fns = [...this._fns, r], this._fns.length - 1;
212
- }
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 };
558
+ this.fns = [];
559
+ }
560
+ eject(id) {
561
+ const index = this.getInterceptorIndex(id);
562
+ if (this.fns[index]) {
563
+ this.fns[index] = null;
564
+ }
565
+ }
566
+ exists(id) {
567
+ const index = this.getInterceptorIndex(id);
568
+ return Boolean(this.fns[index]);
569
+ }
570
+ getInterceptorIndex(id) {
571
+ if (typeof id === "number") {
572
+ return this.fns[id] ? id : -1;
573
+ }
574
+ return this.fns.indexOf(id);
575
+ }
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());
824
+ // src/_internal/client.gen.ts
825
+ var client = createClient(
826
+ createConfig({ baseUrl: "http://localhost:22222" })
827
+ );
249
828
 
250
829
  // src/base-client.ts
251
830
  var BaseClient = class {
252
831
  constructor(config = {}) {
832
+ this.config = config;
253
833
  if (config.baseUrl) {
254
834
  client.setConfig({ baseUrl: config.baseUrl });
255
835
  }
@@ -259,6 +839,12 @@ var BaseClient = class {
259
839
  if (config.apiKey) {
260
840
  req.headers.set("x-application-key", config.apiKey);
261
841
  }
842
+ if (config.applicationId) {
843
+ req.headers.set("x-application-id", config.applicationId);
844
+ }
845
+ if (config.token) {
846
+ req.headers.set("Authorization", `Bearer ${config.token}`);
847
+ }
262
848
  return req;
263
849
  });
264
850
  }
@@ -269,404 +855,647 @@ var BaseClient = class {
269
855
  }
270
856
  return resource;
271
857
  }
858
+ getHeaders() {
859
+ return {
860
+ "x-application-key": this.config.apiKey || ""
861
+ };
862
+ }
272
863
  };
273
864
 
865
+ // src/_internal/sdk.gen.ts
866
+ var patchAdminAccountsByIdCredit = (options) => (options.client ?? client).patch({
867
+ security: [{ scheme: "bearer", type: "http" }],
868
+ url: "/admin/accounts/{id}/credit",
869
+ ...options,
870
+ headers: {
871
+ "Content-Type": "application/vnd.api+json",
872
+ ...options.headers
873
+ }
874
+ });
875
+ var patchAdminApiKeysByIdRotate = (options) => (options.client ?? client).patch({
876
+ security: [{ scheme: "bearer", type: "http" }],
877
+ url: "/admin/api_keys/{id}/rotate",
878
+ ...options,
879
+ headers: {
880
+ "Content-Type": "application/vnd.api+json",
881
+ ...options.headers
882
+ }
883
+ });
884
+ var getAdminWebhookConfigs = (options) => (options.client ?? client).get({
885
+ security: [{ scheme: "bearer", type: "http" }],
886
+ url: "/admin/webhook_configs",
887
+ ...options
888
+ });
889
+ var postAdminWebhookConfigs = (options) => (options.client ?? client).post({
890
+ security: [{ scheme: "bearer", type: "http" }],
891
+ url: "/admin/webhook_configs",
892
+ ...options,
893
+ headers: {
894
+ "Content-Type": "application/vnd.api+json",
895
+ ...options.headers
896
+ }
897
+ });
898
+ var deleteAdminWebhookConfigsById = (options) => (options.client ?? client).delete({
899
+ security: [{ scheme: "bearer", type: "http" }],
900
+ url: "/admin/webhook_configs/{id}",
901
+ ...options
902
+ });
903
+ var getAdminWebhookConfigsById = (options) => (options.client ?? client).get({
904
+ security: [{ scheme: "bearer", type: "http" }],
905
+ url: "/admin/webhook_configs/{id}",
906
+ ...options
907
+ });
908
+ var patchAdminWebhookConfigsById = (options) => (options.client ?? client).patch({
909
+ security: [{ scheme: "bearer", type: "http" }],
910
+ url: "/admin/webhook_configs/{id}",
911
+ ...options,
912
+ headers: {
913
+ "Content-Type": "application/vnd.api+json",
914
+ ...options.headers
915
+ }
916
+ });
917
+ var getAdminDocumentsById = (options) => (options.client ?? client).get({
918
+ security: [{ scheme: "bearer", type: "http" }],
919
+ url: "/admin/documents/{id}",
920
+ ...options
921
+ });
922
+ var postAdminWebhookConfigsByIdTest = (options) => (options.client ?? client).post({
923
+ security: [{ scheme: "bearer", type: "http" }],
924
+ url: "/admin/webhook_configs/{id}/test",
925
+ ...options,
926
+ headers: {
927
+ "Content-Type": "application/vnd.api+json",
928
+ ...options.headers
929
+ }
930
+ });
931
+ var patchAdminAccountsByIdDebit = (options) => (options.client ?? client).patch({
932
+ security: [{ scheme: "bearer", type: "http" }],
933
+ url: "/admin/accounts/{id}/debit",
934
+ ...options,
935
+ headers: {
936
+ "Content-Type": "application/vnd.api+json",
937
+ ...options.headers
938
+ }
939
+ });
940
+ var getAdminAccounts = (options) => (options.client ?? client).get({
941
+ security: [{ scheme: "bearer", type: "http" }],
942
+ url: "/admin/accounts",
943
+ ...options
944
+ });
945
+ var getAdminStorageStats = (options) => (options.client ?? client).get({
946
+ security: [{ scheme: "bearer", type: "http" }],
947
+ url: "/admin/storage/stats",
948
+ ...options
949
+ });
950
+ var getAdminAccountsById = (options) => (options.client ?? client).get({
951
+ security: [{ scheme: "bearer", type: "http" }],
952
+ url: "/admin/accounts/{id}",
953
+ ...options
954
+ });
955
+ var postAdminDocumentsBulkDelete = (options) => (options.client ?? client).post({
956
+ security: [{ scheme: "bearer", type: "http" }],
957
+ url: "/admin/documents/bulk_delete",
958
+ ...options,
959
+ headers: {
960
+ "Content-Type": "application/vnd.api+json",
961
+ ...options.headers
962
+ }
963
+ });
964
+ var getAdminDocuments = (options) => (options.client ?? client).get({
965
+ security: [{ scheme: "bearer", type: "http" }],
966
+ url: "/admin/documents",
967
+ ...options
968
+ });
969
+ var patchAdminApiKeysByIdAllocate = (options) => (options.client ?? client).patch({
970
+ security: [{ scheme: "bearer", type: "http" }],
971
+ url: "/admin/api_keys/{id}/allocate",
972
+ ...options,
973
+ headers: {
974
+ "Content-Type": "application/vnd.api+json",
975
+ ...options.headers
976
+ }
977
+ });
978
+ var getAdminBucketsByIdStats = (options) => (options.client ?? client).get({
979
+ security: [{ scheme: "bearer", type: "http" }],
980
+ url: "/admin/buckets/{id}/stats",
981
+ ...options
982
+ });
983
+ var patchAdminApiKeysByIdRevoke = (options) => (options.client ?? client).patch({
984
+ security: [{ scheme: "bearer", type: "http" }],
985
+ url: "/admin/api_keys/{id}/revoke",
986
+ ...options,
987
+ headers: {
988
+ "Content-Type": "application/vnd.api+json",
989
+ ...options.headers
990
+ }
991
+ });
992
+ var getAdminWebhookDeliveriesById = (options) => (options.client ?? client).get({
993
+ security: [{ scheme: "bearer", type: "http" }],
994
+ url: "/admin/webhook_deliveries/{id}",
995
+ ...options
996
+ });
997
+ var getAdminBucketsByIdObjects = (options) => (options.client ?? client).get({
998
+ security: [{ scheme: "bearer", type: "http" }],
999
+ url: "/admin/buckets/{id}/objects",
1000
+ ...options
1001
+ });
1002
+ var getAdminApiKeys = (options) => (options.client ?? client).get({
1003
+ security: [{ scheme: "bearer", type: "http" }],
1004
+ url: "/admin/api_keys",
1005
+ ...options
1006
+ });
1007
+ var getAdminApiKeysById = (options) => (options.client ?? client).get({
1008
+ security: [{ scheme: "bearer", type: "http" }],
1009
+ url: "/admin/api_keys/{id}",
1010
+ ...options
1011
+ });
1012
+ var postAdminDocumentsBulkReprocess = (options) => (options.client ?? client).post({
1013
+ security: [{ scheme: "bearer", type: "http" }],
1014
+ url: "/admin/documents/bulk_reprocess",
1015
+ ...options,
1016
+ headers: {
1017
+ "Content-Type": "application/vnd.api+json",
1018
+ ...options.headers
1019
+ }
1020
+ });
1021
+ var getAdminBuckets = (options) => (options.client ?? client).get({
1022
+ security: [{ scheme: "bearer", type: "http" }],
1023
+ url: "/admin/buckets",
1024
+ ...options
1025
+ });
1026
+ var getAdminBucketsById = (options) => (options.client ?? client).get({
1027
+ security: [{ scheme: "bearer", type: "http" }],
1028
+ url: "/admin/buckets/{id}",
1029
+ ...options
1030
+ });
1031
+ var postAdminWebhookDeliveriesByIdRetry = (options) => (options.client ?? client).post({
1032
+ security: [{ scheme: "bearer", type: "http" }],
1033
+ url: "/admin/webhook_deliveries/{id}/retry",
1034
+ ...options,
1035
+ headers: {
1036
+ "Content-Type": "application/vnd.api+json",
1037
+ ...options.headers
1038
+ }
1039
+ });
1040
+ var getAdminWebhookDeliveries = (options) => (options.client ?? client).get({
1041
+ security: [{ scheme: "bearer", type: "http" }],
1042
+ url: "/admin/webhook_deliveries",
1043
+ ...options
1044
+ });
1045
+
1046
+ // src/schemas/requests.ts
1047
+ import { z } from "zod";
1048
+ var StorageStatsRequestSchema = z.object({
1049
+ workspace_id: z.string().optional()
1050
+ });
1051
+ var WebhookConfigCreateSchema = z.object({
1052
+ url: z.string().url(),
1053
+ events: z.array(z.string()).min(1),
1054
+ secret: z.string().optional(),
1055
+ enabled: z.boolean().default(true)
1056
+ });
1057
+ var WebhookBulkEnableSchema = z.object({
1058
+ config_ids: z.array(z.string()).min(1).max(100)
1059
+ });
1060
+ var WebhookBulkDisableSchema = z.object({
1061
+ config_ids: z.array(z.string()).min(1).max(100)
1062
+ });
1063
+ var WebhookDeliveryBulkRetrySchema = z.object({
1064
+ delivery_ids: z.array(z.string()).min(1).max(100)
1065
+ });
1066
+ var AgentAdminCreateSchema = z.object({
1067
+ name: z.string().min(1).max(255),
1068
+ prompt_template: z.string().min(1),
1069
+ system_wide: z.boolean().default(false)
1070
+ });
1071
+ var AccountCreditSchema = z.object({
1072
+ amount: z.number().positive(),
1073
+ description: z.string().optional()
1074
+ });
1075
+ var AccountDebitSchema = z.object({
1076
+ amount: z.number().positive(),
1077
+ description: z.string().optional()
1078
+ });
1079
+ var ApiKeyAllocateSchema = z.object({
1080
+ rate_limit: z.number().int().positive().optional(),
1081
+ expires_at: z.string().datetime().optional()
1082
+ });
1083
+ var DocumentBulkDeleteSchema = z.object({
1084
+ document_ids: z.array(z.string()).min(1).max(100)
1085
+ });
1086
+ var DocumentBulkReprocessSchema = z.object({
1087
+ document_ids: z.array(z.string()).min(1).max(100)
1088
+ });
1089
+
274
1090
  // src/gpt-admin.ts
275
1091
  var GptAdmin = class extends BaseClient {
276
1092
  constructor(config) {
277
1093
  super(config);
1094
+ /**
1095
+ * Storage administration
1096
+ */
278
1097
  this.storage = {
279
- // stats: async () => {
280
- // const { data, error } = await StorageStatsService.getStorageStats();
281
- // if (error) throw error;
282
- // return this.unwrap<any>(data?.data);
283
- // }
1098
+ /**
1099
+ * Get storage statistics
1100
+ */
1101
+ stats: async (workspaceId) => {
1102
+ const validated = StorageStatsRequestSchema.parse({ workspace_id: workspaceId });
1103
+ const { data } = await getAdminStorageStats({
1104
+ headers: this.getHeaders(),
1105
+ query: validated.workspace_id ? { filter: { workspace_id: validated.workspace_id } } : void 0
1106
+ });
1107
+ return this.unwrap(data?.data);
1108
+ },
1109
+ /**
1110
+ * Bucket management
1111
+ */
1112
+ buckets: {
1113
+ list: async () => {
1114
+ const { data } = await getAdminBuckets({ headers: this.getHeaders() });
1115
+ return this.unwrap(data?.data);
1116
+ },
1117
+ get: async (id) => {
1118
+ const { data } = await getAdminBucketsById({
1119
+ headers: this.getHeaders(),
1120
+ path: { id }
1121
+ });
1122
+ return this.unwrap(data?.data);
1123
+ },
1124
+ stats: async (id) => {
1125
+ const { data } = await getAdminBucketsByIdStats({
1126
+ headers: this.getHeaders(),
1127
+ path: { id }
1128
+ });
1129
+ return this.unwrap(data?.data);
1130
+ },
1131
+ objects: async (id) => {
1132
+ const { data } = await getAdminBucketsByIdObjects({
1133
+ headers: this.getHeaders(),
1134
+ path: { id }
1135
+ });
1136
+ return this.unwrap(data?.data);
1137
+ }
1138
+ }
1139
+ };
1140
+ /**
1141
+ * Account management
1142
+ */
1143
+ this.accounts = {
1144
+ list: async () => {
1145
+ const { data } = await getAdminAccounts({ headers: this.getHeaders() });
1146
+ return this.unwrap(data?.data);
1147
+ },
1148
+ get: async (id) => {
1149
+ const { data } = await getAdminAccountsById({
1150
+ headers: this.getHeaders(),
1151
+ path: { id }
1152
+ });
1153
+ return this.unwrap(data?.data);
1154
+ },
1155
+ credit: async (id, amount, description) => {
1156
+ const validated = AccountCreditSchema.parse({ amount, description });
1157
+ const { data } = await patchAdminAccountsByIdCredit({
1158
+ headers: this.getHeaders(),
1159
+ path: { id },
1160
+ body: {
1161
+ data: {
1162
+ id,
1163
+ type: "account",
1164
+ attributes: validated
1165
+ }
1166
+ }
1167
+ });
1168
+ return this.unwrap(data?.data);
1169
+ },
1170
+ debit: async (id, amount, description) => {
1171
+ const validated = AccountDebitSchema.parse({ amount, description });
1172
+ const { data } = await patchAdminAccountsByIdDebit({
1173
+ headers: this.getHeaders(),
1174
+ path: { id },
1175
+ body: {
1176
+ data: {
1177
+ id,
1178
+ type: "account",
1179
+ attributes: validated
1180
+ }
1181
+ }
1182
+ });
1183
+ return this.unwrap(data?.data);
1184
+ }
284
1185
  };
1186
+ /**
1187
+ * Webhook management
1188
+ */
285
1189
  this.webhooks = {
286
- // stats: async () => {
287
- // const { data, error } = await WebhookConfigService.getWebhookConfigsStats();
288
- // if (error) throw error;
289
- // return this.unwrap<any>(data?.data);
290
- // },
1190
+ configs: {
1191
+ list: async () => {
1192
+ const { data } = await getAdminWebhookConfigs({ headers: this.getHeaders() });
1193
+ return this.unwrap(data?.data);
1194
+ },
1195
+ create: async (name, url, events, applicationId, secret, enabled = true) => {
1196
+ const { data } = await postAdminWebhookConfigs({
1197
+ headers: this.getHeaders(),
1198
+ body: {
1199
+ data: {
1200
+ type: "webhook_config",
1201
+ attributes: {
1202
+ name,
1203
+ url,
1204
+ events,
1205
+ application_id: applicationId,
1206
+ secret,
1207
+ enabled
1208
+ }
1209
+ }
1210
+ }
1211
+ });
1212
+ return this.unwrap(data?.data);
1213
+ },
1214
+ get: async (id) => {
1215
+ const { data } = await getAdminWebhookConfigsById({
1216
+ headers: this.getHeaders(),
1217
+ path: { id }
1218
+ });
1219
+ return this.unwrap(data?.data);
1220
+ },
1221
+ update: async (id, updates) => {
1222
+ const { data } = await patchAdminWebhookConfigsById({
1223
+ headers: this.getHeaders(),
1224
+ path: { id },
1225
+ body: {
1226
+ data: {
1227
+ id,
1228
+ type: "webhook_config",
1229
+ attributes: updates
1230
+ }
1231
+ }
1232
+ });
1233
+ return this.unwrap(data?.data);
1234
+ },
1235
+ delete: async (id) => {
1236
+ await deleteAdminWebhookConfigsById({
1237
+ headers: this.getHeaders(),
1238
+ path: { id }
1239
+ });
1240
+ return true;
1241
+ },
1242
+ test: async (id) => {
1243
+ const { data } = await postAdminWebhookConfigsByIdTest({
1244
+ headers: this.getHeaders(),
1245
+ path: { id }
1246
+ });
1247
+ return this.unwrap(data?.data);
1248
+ }
1249
+ },
291
1250
  deliveries: {
292
- // stats: async () => {
293
- // const { data, error } = await WebhookDeliveryService.getWebhookDeliveriesStats();
294
- // if (error) throw error;
295
- // return this.unwrap<any>(data?.data);
296
- // },
297
- // bulkRetry: async (deliveryIds: string[]) => {
298
- // const { error } = await WebhookDeliveryService.postWebhookDeliveriesBulkRetry({
299
- // body: { data: { type: 'webhook_delivery', attributes: { delivery_ids: deliveryIds }}} as any
300
- // });
301
- // if (error) throw error;
302
- // return true;
303
- // }
1251
+ list: async () => {
1252
+ const { data } = await getAdminWebhookDeliveries({ headers: this.getHeaders() });
1253
+ return this.unwrap(data?.data);
1254
+ },
1255
+ get: async (id) => {
1256
+ const { data } = await getAdminWebhookDeliveriesById({
1257
+ headers: this.getHeaders(),
1258
+ path: { id }
1259
+ });
1260
+ return this.unwrap(data?.data);
1261
+ },
1262
+ retry: async (id) => {
1263
+ const { data } = await postAdminWebhookDeliveriesByIdRetry({
1264
+ headers: this.getHeaders(),
1265
+ path: { id }
1266
+ });
1267
+ return this.unwrap(data?.data);
1268
+ }
304
1269
  }
305
- // bulkEnable: async (ids: string[]) => {
306
- // const { error } = await WebhookConfigService.postWebhookConfigsBulkEnable({
307
- // body: { data: { type: 'webhook_config', attributes: { config_ids: ids }}} as any
308
- // });
309
- // if (error) throw error;
310
- // return true;
311
- // },
312
- // bulkDisable: async (ids: string[]) => {
313
- // const { error } = await WebhookConfigService.postWebhookConfigsBulkDisable({
314
- // body: { data: { type: 'webhook_config', attributes: { config_ids: ids }}} as any
315
- // });
316
- // if (error) throw error;
317
- // return true;
318
- // }
319
1270
  };
320
- this.agents = {
321
- // stats: async (id: string) => {
322
- // const { data, error } = await AgentService.getAgentsByIdStats({ path: { id }});
323
- // if (error) throw error;
324
- // return this.unwrap<any>(data?.data);
325
- // },
326
- // export: async (id: string) => {
327
- // const { data, error } = await AgentService.postAgentsByIdExport({
328
- // path: { id }
329
- // });
330
- // if (error) throw error;
331
- // return data; // Likely raw export structure
332
- // },
333
- // import: async (json: any) => {
334
- // const { data, error } = await AgentService.postAgentsImport({
335
- // body: json
336
- // });
337
- // if (error) throw error;
338
- // return this.unwrap<Types.agent>(data?.data);
339
- // }
1271
+ /**
1272
+ * Document administration
1273
+ */
1274
+ this.documents = {
1275
+ list: async () => {
1276
+ const { data } = await getAdminDocuments({ headers: this.getHeaders() });
1277
+ return this.unwrap(data?.data);
1278
+ },
1279
+ get: async (id) => {
1280
+ const { data } = await getAdminDocumentsById({
1281
+ headers: this.getHeaders(),
1282
+ path: { id }
1283
+ });
1284
+ return this.unwrap(data?.data);
1285
+ },
1286
+ bulkDelete: async (documentIds) => {
1287
+ const validated = DocumentBulkDeleteSchema.parse({ document_ids: documentIds });
1288
+ const { data } = await postAdminDocumentsBulkDelete({
1289
+ headers: this.getHeaders(),
1290
+ body: {
1291
+ data: {
1292
+ type: "operation_success",
1293
+ attributes: {
1294
+ ids: validated.document_ids
1295
+ }
1296
+ }
1297
+ }
1298
+ });
1299
+ return this.unwrap(data?.data);
1300
+ },
1301
+ bulkReprocess: async (documentIds) => {
1302
+ const validated = DocumentBulkReprocessSchema.parse({ document_ids: documentIds });
1303
+ const { data } = await postAdminDocumentsBulkReprocess({
1304
+ headers: this.getHeaders(),
1305
+ body: {
1306
+ data: {
1307
+ ids: validated.document_ids
1308
+ }
1309
+ }
1310
+ });
1311
+ return this.unwrap(data?.data);
1312
+ }
1313
+ };
1314
+ /**
1315
+ * API Key management
1316
+ */
1317
+ this.apiKeys = {
1318
+ list: async () => {
1319
+ const { data } = await getAdminApiKeys({ headers: this.getHeaders() });
1320
+ return this.unwrap(data?.data);
1321
+ },
1322
+ get: async (id) => {
1323
+ const { data } = await getAdminApiKeysById({
1324
+ headers: this.getHeaders(),
1325
+ path: { id }
1326
+ });
1327
+ return this.unwrap(data?.data);
1328
+ },
1329
+ allocate: async (id, amount, description) => {
1330
+ const { data } = await patchAdminApiKeysByIdAllocate({
1331
+ headers: this.getHeaders(),
1332
+ path: { id },
1333
+ body: {
1334
+ data: {
1335
+ id,
1336
+ type: "api_key",
1337
+ attributes: {
1338
+ amount,
1339
+ description
1340
+ }
1341
+ }
1342
+ }
1343
+ });
1344
+ return this.unwrap(data?.data);
1345
+ },
1346
+ revoke: async (id) => {
1347
+ const { data } = await patchAdminApiKeysByIdRevoke({
1348
+ headers: this.getHeaders(),
1349
+ path: { id }
1350
+ });
1351
+ return this.unwrap(data?.data);
1352
+ },
1353
+ rotate: async (id) => {
1354
+ const { data } = await patchAdminApiKeysByIdRotate({
1355
+ headers: this.getHeaders(),
1356
+ path: { id }
1357
+ });
1358
+ return this.unwrap(data?.data);
1359
+ }
340
1360
  };
341
1361
  }
342
1362
  };
343
1363
 
344
- // src/_internal/types.gen.ts
345
- var eq = {
346
- KEYWORD: "keyword",
347
- SEMANTIC: "semantic"
348
- };
349
- var greater_than = {
350
- KEYWORD: "keyword",
351
- SEMANTIC: "semantic"
352
- };
353
- var greater_than_or_equal = {
354
- KEYWORD: "keyword",
355
- SEMANTIC: "semantic"
356
- };
357
- var less_than = {
358
- KEYWORD: "keyword",
359
- SEMANTIC: "semantic"
360
- };
361
- var less_than_or_equal = {
362
- KEYWORD: "keyword",
363
- SEMANTIC: "semantic"
364
- };
365
- var not_eq = {
366
- KEYWORD: "keyword",
367
- SEMANTIC: "semantic"
368
- };
369
- var eq2 = {
370
- PENDING: "pending",
371
- PROCESSING: "processing",
372
- COMPLETED: "completed",
373
- FAILED: "failed"
374
- };
375
- var greater_than2 = {
376
- PENDING: "pending",
377
- PROCESSING: "processing",
378
- COMPLETED: "completed",
379
- FAILED: "failed"
380
- };
381
- var greater_than_or_equal2 = {
382
- PENDING: "pending",
383
- PROCESSING: "processing",
384
- COMPLETED: "completed",
385
- FAILED: "failed"
386
- };
387
- var less_than2 = {
388
- PENDING: "pending",
389
- PROCESSING: "processing",
390
- COMPLETED: "completed",
391
- FAILED: "failed"
392
- };
393
- var less_than_or_equal2 = {
394
- PENDING: "pending",
395
- PROCESSING: "processing",
396
- COMPLETED: "completed",
397
- FAILED: "failed"
398
- };
399
- var not_eq2 = {
400
- PENDING: "pending",
401
- PROCESSING: "processing",
402
- COMPLETED: "completed",
403
- FAILED: "failed"
404
- };
405
- var status = {
406
- PENDING: "pending",
407
- PROCESSING: "processing",
408
- COMPLETED: "completed",
409
- FAILED: "failed"
410
- };
411
- var eq3 = {
412
- ACTIVE: "active",
413
- REVOKED: "revoked",
414
- EXPIRED: "expired"
415
- };
416
- var greater_than3 = {
417
- ACTIVE: "active",
418
- REVOKED: "revoked",
419
- EXPIRED: "expired"
420
- };
421
- var greater_than_or_equal3 = {
422
- ACTIVE: "active",
423
- REVOKED: "revoked",
424
- EXPIRED: "expired"
425
- };
426
- var less_than3 = {
427
- ACTIVE: "active",
428
- REVOKED: "revoked",
429
- EXPIRED: "expired"
430
- };
431
- var less_than_or_equal3 = {
432
- ACTIVE: "active",
433
- REVOKED: "revoked",
434
- EXPIRED: "expired"
435
- };
436
- var not_eq3 = {
437
- ACTIVE: "active",
438
- REVOKED: "revoked",
439
- EXPIRED: "expired"
440
- };
441
- var eq4 = {
442
- PENDING: "pending",
443
- SUCCESS: "success",
444
- FAILED: "failed",
445
- REFUNDED: "refunded",
446
- VOIDED: "voided"
447
- };
448
- var greater_than4 = {
449
- PENDING: "pending",
450
- SUCCESS: "success",
451
- FAILED: "failed",
452
- REFUNDED: "refunded",
453
- VOIDED: "voided"
454
- };
455
- var greater_than_or_equal4 = {
456
- PENDING: "pending",
457
- SUCCESS: "success",
458
- FAILED: "failed",
459
- REFUNDED: "refunded",
460
- VOIDED: "voided"
461
- };
462
- var less_than4 = {
463
- PENDING: "pending",
464
- SUCCESS: "success",
465
- FAILED: "failed",
466
- REFUNDED: "refunded",
467
- VOIDED: "voided"
468
- };
469
- var less_than_or_equal4 = {
470
- PENDING: "pending",
471
- SUCCESS: "success",
472
- FAILED: "failed",
473
- REFUNDED: "refunded",
474
- VOIDED: "voided"
475
- };
476
- var not_eq4 = {
477
- PENDING: "pending",
478
- SUCCESS: "success",
479
- FAILED: "failed",
480
- REFUNDED: "refunded",
481
- VOIDED: "voided"
482
- };
483
- var status2 = {
484
- ACTIVE: "active",
485
- REVOKED: "revoked",
486
- EXPIRED: "expired"
487
- };
488
- var format = {
489
- ENTITY: "entity",
490
- TABULAR: "tabular",
491
- GRAPH: "graph",
492
- COMPOSITE: "composite"
493
- };
494
- var eq5 = {
495
- OWNER: "owner",
496
- ADMIN: "admin",
497
- MEMBER: "member"
498
- };
499
- var greater_than5 = {
500
- OWNER: "owner",
501
- ADMIN: "admin",
502
- MEMBER: "member"
503
- };
504
- var greater_than_or_equal5 = {
505
- OWNER: "owner",
506
- ADMIN: "admin",
507
- MEMBER: "member"
508
- };
509
- var less_than5 = {
510
- OWNER: "owner",
511
- ADMIN: "admin",
512
- MEMBER: "member"
513
- };
514
- var less_than_or_equal5 = {
515
- OWNER: "owner",
516
- ADMIN: "admin",
517
- MEMBER: "member"
518
- };
519
- var not_eq5 = {
520
- OWNER: "owner",
521
- ADMIN: "admin",
522
- MEMBER: "member"
523
- };
524
- var eq6 = {
525
- PLAN: "plan",
526
- ADDON: "addon"
527
- };
528
- var greater_than6 = {
529
- PLAN: "plan",
530
- ADDON: "addon"
531
- };
532
- var greater_than_or_equal6 = {
533
- PLAN: "plan",
534
- ADDON: "addon"
535
- };
536
- var less_than6 = {
537
- PLAN: "plan",
538
- ADDON: "addon"
539
- };
540
- var less_than_or_equal6 = {
541
- PLAN: "plan",
542
- ADDON: "addon"
543
- };
544
- var not_eq6 = {
545
- PLAN: "plan",
546
- ADDON: "addon"
547
- };
548
- var role = {
549
- OWNER: "owner",
550
- ADMIN: "admin",
551
- MEMBER: "member"
552
- };
553
- var eq7 = {
554
- PUBLIC: "public",
555
- PRIVATE: "private"
556
- };
557
- var greater_than7 = {
558
- PUBLIC: "public",
559
- PRIVATE: "private"
560
- };
561
- var greater_than_or_equal7 = {
562
- PUBLIC: "public",
563
- PRIVATE: "private"
564
- };
565
- var less_than7 = {
566
- PUBLIC: "public",
567
- PRIVATE: "private"
568
- };
569
- var less_than_or_equal7 = {
570
- PUBLIC: "public",
571
- PRIVATE: "private"
572
- };
573
- var not_eq7 = {
574
- PUBLIC: "public",
575
- PRIVATE: "private"
576
- };
577
- var eq8 = {
578
- SALE: "sale",
579
- AUTH: "auth",
580
- REFUND: "refund",
581
- VOID: "void"
582
- };
583
- var greater_than8 = {
584
- SALE: "sale",
585
- AUTH: "auth",
586
- REFUND: "refund",
587
- VOID: "void"
588
- };
589
- var greater_than_or_equal8 = {
590
- SALE: "sale",
591
- AUTH: "auth",
592
- REFUND: "refund",
593
- VOID: "void"
594
- };
595
- var less_than8 = {
596
- SALE: "sale",
597
- AUTH: "auth",
598
- REFUND: "refund",
599
- VOID: "void"
600
- };
601
- var less_than_or_equal8 = {
602
- SALE: "sale",
603
- AUTH: "auth",
604
- REFUND: "refund",
605
- VOID: "void"
606
- };
607
- var not_eq8 = {
608
- SALE: "sale",
609
- AUTH: "auth",
610
- REFUND: "refund",
611
- VOID: "void"
612
- };
613
- var type = {
614
- PUBLIC: "public",
615
- PRIVATE: "private"
1364
+ // src/errors/index.ts
1365
+ var GptCoreError = class extends Error {
1366
+ constructor(message, options) {
1367
+ super(message);
1368
+ this.name = this.constructor.name;
1369
+ this.statusCode = options?.statusCode;
1370
+ this.code = options?.code;
1371
+ this.requestId = options?.requestId;
1372
+ this.headers = options?.headers;
1373
+ this.body = options?.body;
1374
+ if (options?.cause) {
1375
+ this.cause = options.cause;
1376
+ }
1377
+ if (Error.captureStackTrace) {
1378
+ Error.captureStackTrace(this, this.constructor);
1379
+ }
1380
+ }
1381
+ };
1382
+ var AuthenticationError = class extends GptCoreError {
1383
+ constructor(message = "Authentication failed", options) {
1384
+ super(message, { statusCode: 401, ...options });
1385
+ }
616
1386
  };
1387
+ var AuthorizationError = class extends GptCoreError {
1388
+ constructor(message = "Permission denied", options) {
1389
+ super(message, { statusCode: 403, ...options });
1390
+ }
1391
+ };
1392
+ var NotFoundError = class extends GptCoreError {
1393
+ constructor(message = "Resource not found", options) {
1394
+ super(message, { statusCode: 404, ...options });
1395
+ }
1396
+ };
1397
+ var ValidationError = class extends GptCoreError {
1398
+ constructor(message = "Validation failed", errors, options) {
1399
+ super(message, { statusCode: 422, ...options });
1400
+ this.errors = errors;
1401
+ }
1402
+ };
1403
+ var RateLimitError = class extends GptCoreError {
1404
+ constructor(message = "Rate limit exceeded", retryAfter, options) {
1405
+ super(message, { statusCode: 429, ...options });
1406
+ this.retryAfter = retryAfter;
1407
+ }
1408
+ };
1409
+ var NetworkError = class extends GptCoreError {
1410
+ constructor(message = "Network request failed", options) {
1411
+ super(message, options);
1412
+ }
1413
+ };
1414
+ var TimeoutError = class extends GptCoreError {
1415
+ constructor(message = "Request timeout", options) {
1416
+ super(message, options);
1417
+ }
1418
+ };
1419
+ var ServerError = class extends GptCoreError {
1420
+ constructor(message = "Internal server error", options) {
1421
+ super(message, { statusCode: 500, ...options });
1422
+ }
1423
+ };
1424
+ function handleApiError(error) {
1425
+ const response = error?.response || error;
1426
+ const statusCode = response?.status || error?.status || error?.statusCode;
1427
+ const headers = response?.headers || error?.headers;
1428
+ const requestId = headers?.get?.("x-request-id") || headers?.["x-request-id"];
1429
+ const body = response?.body || response?.data || error?.body || error?.data || error;
1430
+ let message = "An error occurred";
1431
+ let errors;
1432
+ if (body?.errors && Array.isArray(body.errors)) {
1433
+ const firstError = body.errors[0];
1434
+ message = firstError?.title || firstError?.detail || message;
1435
+ errors = body.errors.map((err) => ({
1436
+ field: err.source?.pointer?.split("/").pop(),
1437
+ message: err.detail || err.title || "Unknown error"
1438
+ }));
1439
+ } else if (body?.message) {
1440
+ message = body.message;
1441
+ } else if (typeof body === "string") {
1442
+ message = body;
1443
+ } else if (error?.message) {
1444
+ message = error.message;
1445
+ }
1446
+ const errorOptions = {
1447
+ statusCode,
1448
+ requestId,
1449
+ headers: headers ? headers.entries ? Object.fromEntries(headers.entries()) : Object.fromEntries(Object.entries(headers)) : void 0,
1450
+ body,
1451
+ cause: error
1452
+ };
1453
+ switch (statusCode) {
1454
+ case 401:
1455
+ throw new AuthenticationError(message, errorOptions);
1456
+ case 403:
1457
+ throw new AuthorizationError(message, errorOptions);
1458
+ case 404:
1459
+ throw new NotFoundError(message, errorOptions);
1460
+ case 400:
1461
+ case 422:
1462
+ throw new ValidationError(message, errors, errorOptions);
1463
+ case 429:
1464
+ const retryAfter = headers?.get?.("retry-after") || headers?.["retry-after"];
1465
+ throw new RateLimitError(message, retryAfter ? parseInt(retryAfter, 10) : void 0, errorOptions);
1466
+ case 500:
1467
+ case 502:
1468
+ case 503:
1469
+ case 504:
1470
+ throw new ServerError(message, errorOptions);
1471
+ default:
1472
+ if (statusCode && statusCode >= 400) {
1473
+ throw new GptCoreError(message, errorOptions);
1474
+ }
1475
+ throw new NetworkError(message, errorOptions);
1476
+ }
1477
+ }
617
1478
  export {
1479
+ AccountCreditSchema,
1480
+ AccountDebitSchema,
1481
+ AgentAdminCreateSchema,
1482
+ ApiKeyAllocateSchema,
1483
+ AuthenticationError,
1484
+ AuthorizationError,
1485
+ DocumentBulkDeleteSchema,
1486
+ DocumentBulkReprocessSchema,
618
1487
  GptAdmin,
619
- eq,
620
- eq2,
621
- eq3,
622
- eq4,
623
- eq5,
624
- eq6,
625
- eq7,
626
- eq8,
627
- format,
628
- greater_than,
629
- greater_than2,
630
- greater_than3,
631
- greater_than4,
632
- greater_than5,
633
- greater_than6,
634
- greater_than7,
635
- greater_than8,
636
- greater_than_or_equal,
637
- greater_than_or_equal2,
638
- greater_than_or_equal3,
639
- greater_than_or_equal4,
640
- greater_than_or_equal5,
641
- greater_than_or_equal6,
642
- greater_than_or_equal7,
643
- greater_than_or_equal8,
644
- less_than,
645
- less_than2,
646
- less_than3,
647
- less_than4,
648
- less_than5,
649
- less_than6,
650
- less_than7,
651
- less_than8,
652
- less_than_or_equal,
653
- less_than_or_equal2,
654
- less_than_or_equal3,
655
- less_than_or_equal4,
656
- less_than_or_equal5,
657
- less_than_or_equal6,
658
- less_than_or_equal7,
659
- less_than_or_equal8,
660
- not_eq,
661
- not_eq2,
662
- not_eq3,
663
- not_eq4,
664
- not_eq5,
665
- not_eq6,
666
- not_eq7,
667
- not_eq8,
668
- role,
669
- status,
670
- status2,
671
- type
1488
+ GptCoreError,
1489
+ NetworkError,
1490
+ NotFoundError,
1491
+ RateLimitError,
1492
+ ServerError,
1493
+ StorageStatsRequestSchema,
1494
+ TimeoutError,
1495
+ ValidationError,
1496
+ WebhookBulkDisableSchema,
1497
+ WebhookBulkEnableSchema,
1498
+ WebhookConfigCreateSchema,
1499
+ WebhookDeliveryBulkRetrySchema,
1500
+ handleApiError
672
1501
  };