@gpt-platform/admin 0.1.1 → 0.1.2
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.
- package/dist/index.d.mts +80648 -87212
- package/dist/index.d.ts +80648 -87212
- package/dist/index.js +531 -544
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +503 -511
- package/dist/index.mjs.map +1 -0
- package/llms.txt +17 -0
- package/package.json +2 -3
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/_internal/core/bodySerializer.gen.ts
|
|
2
2
|
var jsonBodySerializer = {
|
|
3
|
-
bodySerializer: (body) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
bodySerializer: (body) => JSON.stringify(
|
|
4
|
+
body,
|
|
5
|
+
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
6
|
+
)
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/_internal/core/serverSentEvents.gen.ts
|
|
@@ -21,8 +21,7 @@ var createSseClient = ({
|
|
|
21
21
|
...options
|
|
22
22
|
}) => {
|
|
23
23
|
let lastEventId;
|
|
24
|
-
const sleep =
|
|
25
|
-
sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
24
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
26
25
|
const createStream = async function* () {
|
|
27
26
|
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
28
27
|
let attempt = 0;
|
|
@@ -30,10 +29,7 @@ var createSseClient = ({
|
|
|
30
29
|
while (true) {
|
|
31
30
|
if (signal.aborted) break;
|
|
32
31
|
attempt++;
|
|
33
|
-
const headers =
|
|
34
|
-
options.headers instanceof Headers
|
|
35
|
-
? options.headers
|
|
36
|
-
: new Headers(options.headers);
|
|
32
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
37
33
|
if (lastEventId !== void 0) {
|
|
38
34
|
headers.set("Last-Event-ID", lastEventId);
|
|
39
35
|
}
|
|
@@ -43,7 +39,7 @@ var createSseClient = ({
|
|
|
43
39
|
...options,
|
|
44
40
|
body: options.serializedBody,
|
|
45
41
|
headers,
|
|
46
|
-
signal
|
|
42
|
+
signal
|
|
47
43
|
};
|
|
48
44
|
let request = new Request(url, requestInit);
|
|
49
45
|
if (onRequest) {
|
|
@@ -53,17 +49,16 @@ var createSseClient = ({
|
|
|
53
49
|
const response = await _fetch(request);
|
|
54
50
|
if (!response.ok)
|
|
55
51
|
throw new Error(
|
|
56
|
-
`SSE failed: ${response.status} ${response.statusText}
|
|
52
|
+
`SSE failed: ${response.status} ${response.statusText}`
|
|
57
53
|
);
|
|
58
54
|
if (!response.body) throw new Error("No body in SSE response");
|
|
59
|
-
const reader = response.body
|
|
60
|
-
.pipeThrough(new TextDecoderStream())
|
|
61
|
-
.getReader();
|
|
55
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
62
56
|
let buffer = "";
|
|
63
57
|
const abortHandler = () => {
|
|
64
58
|
try {
|
|
65
59
|
reader.cancel();
|
|
66
|
-
} catch {
|
|
60
|
+
} catch {
|
|
61
|
+
}
|
|
67
62
|
};
|
|
68
63
|
signal.addEventListener("abort", abortHandler);
|
|
69
64
|
try {
|
|
@@ -88,7 +83,7 @@ var createSseClient = ({
|
|
|
88
83
|
} else if (line.startsWith("retry:")) {
|
|
89
84
|
const parsed = Number.parseInt(
|
|
90
85
|
line.replace(/^retry:\s*/, ""),
|
|
91
|
-
10
|
|
86
|
+
10
|
|
92
87
|
);
|
|
93
88
|
if (!Number.isNaN(parsed)) {
|
|
94
89
|
retryDelay = parsed;
|
|
@@ -118,7 +113,7 @@ var createSseClient = ({
|
|
|
118
113
|
data,
|
|
119
114
|
event: eventName,
|
|
120
115
|
id: lastEventId,
|
|
121
|
-
retry: retryDelay
|
|
116
|
+
retry: retryDelay
|
|
122
117
|
});
|
|
123
118
|
if (dataLines.length) {
|
|
124
119
|
yield data;
|
|
@@ -137,7 +132,7 @@ var createSseClient = ({
|
|
|
137
132
|
}
|
|
138
133
|
const backoff = Math.min(
|
|
139
134
|
retryDelay * 2 ** (attempt - 1),
|
|
140
|
-
sseMaxRetryDelay ?? 3e4
|
|
135
|
+
sseMaxRetryDelay ?? 3e4
|
|
141
136
|
);
|
|
142
137
|
await sleep(backoff);
|
|
143
138
|
}
|
|
@@ -184,11 +179,15 @@ var separatorObjectExplode = (style) => {
|
|
|
184
179
|
return "&";
|
|
185
180
|
}
|
|
186
181
|
};
|
|
187
|
-
var serializeArrayParam = ({
|
|
182
|
+
var serializeArrayParam = ({
|
|
183
|
+
allowReserved,
|
|
184
|
+
explode,
|
|
185
|
+
name,
|
|
186
|
+
style,
|
|
187
|
+
value
|
|
188
|
+
}) => {
|
|
188
189
|
if (!explode) {
|
|
189
|
-
const joinedValues2 = (
|
|
190
|
-
allowReserved ? value : value.map((v) => encodeURIComponent(v))
|
|
191
|
-
).join(separatorArrayNoExplode(style));
|
|
190
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
192
191
|
switch (style) {
|
|
193
192
|
case "label":
|
|
194
193
|
return `.${joinedValues2}`;
|
|
@@ -201,29 +200,29 @@ var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
|
201
200
|
}
|
|
202
201
|
}
|
|
203
202
|
const separator = separatorArrayExplode(style);
|
|
204
|
-
const joinedValues = value
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
.join(separator);
|
|
216
|
-
return style === "label" || style === "matrix"
|
|
217
|
-
? separator + joinedValues
|
|
218
|
-
: joinedValues;
|
|
203
|
+
const joinedValues = value.map((v) => {
|
|
204
|
+
if (style === "label" || style === "simple") {
|
|
205
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
206
|
+
}
|
|
207
|
+
return serializePrimitiveParam({
|
|
208
|
+
allowReserved,
|
|
209
|
+
name,
|
|
210
|
+
value: v
|
|
211
|
+
});
|
|
212
|
+
}).join(separator);
|
|
213
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
219
214
|
};
|
|
220
|
-
var serializePrimitiveParam = ({
|
|
215
|
+
var serializePrimitiveParam = ({
|
|
216
|
+
allowReserved,
|
|
217
|
+
name,
|
|
218
|
+
value
|
|
219
|
+
}) => {
|
|
221
220
|
if (value === void 0 || value === null) {
|
|
222
221
|
return "";
|
|
223
222
|
}
|
|
224
223
|
if (typeof value === "object") {
|
|
225
224
|
throw new Error(
|
|
226
|
-
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
225
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
227
226
|
);
|
|
228
227
|
}
|
|
229
228
|
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
@@ -234,7 +233,7 @@ var serializeObjectParam = ({
|
|
|
234
233
|
name,
|
|
235
234
|
style,
|
|
236
235
|
value,
|
|
237
|
-
valueOnly
|
|
236
|
+
valueOnly
|
|
238
237
|
}) => {
|
|
239
238
|
if (value instanceof Date) {
|
|
240
239
|
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
@@ -242,7 +241,11 @@ var serializeObjectParam = ({
|
|
|
242
241
|
if (style !== "deepObject" && !explode) {
|
|
243
242
|
let values = [];
|
|
244
243
|
Object.entries(value).forEach(([key, v]) => {
|
|
245
|
-
values = [
|
|
244
|
+
values = [
|
|
245
|
+
...values,
|
|
246
|
+
key,
|
|
247
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
248
|
+
];
|
|
246
249
|
});
|
|
247
250
|
const joinedValues2 = values.join(",");
|
|
248
251
|
switch (style) {
|
|
@@ -257,18 +260,14 @@ var serializeObjectParam = ({
|
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
const separator = separatorObjectExplode(style);
|
|
260
|
-
const joinedValues = Object.entries(value)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
.join(separator);
|
|
269
|
-
return style === "label" || style === "matrix"
|
|
270
|
-
? separator + joinedValues
|
|
271
|
-
: joinedValues;
|
|
263
|
+
const joinedValues = Object.entries(value).map(
|
|
264
|
+
([key, v]) => serializePrimitiveParam({
|
|
265
|
+
allowReserved,
|
|
266
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
267
|
+
value: v
|
|
268
|
+
})
|
|
269
|
+
).join(separator);
|
|
270
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
272
271
|
};
|
|
273
272
|
|
|
274
273
|
// src/_internal/core/utils.gen.ts
|
|
@@ -299,7 +298,7 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
299
298
|
if (Array.isArray(value)) {
|
|
300
299
|
url = url.replace(
|
|
301
300
|
match,
|
|
302
|
-
serializeArrayParam({ explode, name, style, value })
|
|
301
|
+
serializeArrayParam({ explode, name, style, value })
|
|
303
302
|
);
|
|
304
303
|
continue;
|
|
305
304
|
}
|
|
@@ -311,8 +310,8 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
311
310
|
name,
|
|
312
311
|
style,
|
|
313
312
|
value,
|
|
314
|
-
valueOnly: true
|
|
315
|
-
})
|
|
313
|
+
valueOnly: true
|
|
314
|
+
})
|
|
316
315
|
);
|
|
317
316
|
continue;
|
|
318
317
|
}
|
|
@@ -321,20 +320,26 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
321
320
|
match,
|
|
322
321
|
`;${serializePrimitiveParam({
|
|
323
322
|
name,
|
|
324
|
-
value
|
|
325
|
-
})}
|
|
323
|
+
value
|
|
324
|
+
})}`
|
|
326
325
|
);
|
|
327
326
|
continue;
|
|
328
327
|
}
|
|
329
328
|
const replaceValue = encodeURIComponent(
|
|
330
|
-
style === "label" ? `.${value}` : value
|
|
329
|
+
style === "label" ? `.${value}` : value
|
|
331
330
|
);
|
|
332
331
|
url = url.replace(match, replaceValue);
|
|
333
332
|
}
|
|
334
333
|
}
|
|
335
334
|
return url;
|
|
336
335
|
};
|
|
337
|
-
var getUrl = ({
|
|
336
|
+
var getUrl = ({
|
|
337
|
+
baseUrl,
|
|
338
|
+
path,
|
|
339
|
+
query,
|
|
340
|
+
querySerializer,
|
|
341
|
+
url: _url
|
|
342
|
+
}) => {
|
|
338
343
|
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
339
344
|
let url = (baseUrl ?? "") + pathUrl;
|
|
340
345
|
if (path) {
|
|
@@ -354,8 +359,7 @@ function getValidRequestBody(options) {
|
|
|
354
359
|
const isSerializedBody = hasBody && options.bodySerializer;
|
|
355
360
|
if (isSerializedBody) {
|
|
356
361
|
if ("serializedBody" in options) {
|
|
357
|
-
const hasSerializedBody =
|
|
358
|
-
options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
362
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
359
363
|
return hasSerializedBody ? options.serializedBody : null;
|
|
360
364
|
}
|
|
361
365
|
return options.body !== "" ? options.body : null;
|
|
@@ -368,8 +372,7 @@ function getValidRequestBody(options) {
|
|
|
368
372
|
|
|
369
373
|
// src/_internal/core/auth.gen.ts
|
|
370
374
|
var getAuthToken = async (auth, callback) => {
|
|
371
|
-
const token =
|
|
372
|
-
typeof callback === "function" ? await callback(auth) : callback;
|
|
375
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
373
376
|
if (!token) {
|
|
374
377
|
return;
|
|
375
378
|
}
|
|
@@ -383,7 +386,10 @@ var getAuthToken = async (auth, callback) => {
|
|
|
383
386
|
};
|
|
384
387
|
|
|
385
388
|
// src/_internal/client/utils.gen.ts
|
|
386
|
-
var createQuerySerializer = ({
|
|
389
|
+
var createQuerySerializer = ({
|
|
390
|
+
parameters = {},
|
|
391
|
+
...args
|
|
392
|
+
} = {}) => {
|
|
387
393
|
const querySerializer = (queryParams) => {
|
|
388
394
|
const search = [];
|
|
389
395
|
if (queryParams && typeof queryParams === "object") {
|
|
@@ -400,7 +406,7 @@ var createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
|
400
406
|
name,
|
|
401
407
|
style: "form",
|
|
402
408
|
value,
|
|
403
|
-
...options.array
|
|
409
|
+
...options.array
|
|
404
410
|
});
|
|
405
411
|
if (serializedArray) search.push(serializedArray);
|
|
406
412
|
} else if (typeof value === "object") {
|
|
@@ -410,14 +416,14 @@ var createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
|
410
416
|
name,
|
|
411
417
|
style: "deepObject",
|
|
412
418
|
value,
|
|
413
|
-
...options.object
|
|
419
|
+
...options.object
|
|
414
420
|
});
|
|
415
421
|
if (serializedObject) search.push(serializedObject);
|
|
416
422
|
} else {
|
|
417
423
|
const serializedPrimitive = serializePrimitiveParam({
|
|
418
424
|
allowReserved: options.allowReserved,
|
|
419
425
|
name,
|
|
420
|
-
value
|
|
426
|
+
value
|
|
421
427
|
});
|
|
422
428
|
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
423
429
|
}
|
|
@@ -435,20 +441,15 @@ var getParseAs = (contentType) => {
|
|
|
435
441
|
if (!cleanContent) {
|
|
436
442
|
return;
|
|
437
443
|
}
|
|
438
|
-
if (
|
|
439
|
-
cleanContent.startsWith("application/json") ||
|
|
440
|
-
cleanContent.endsWith("+json")
|
|
441
|
-
) {
|
|
444
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
442
445
|
return "json";
|
|
443
446
|
}
|
|
444
447
|
if (cleanContent === "multipart/form-data") {
|
|
445
448
|
return "formData";
|
|
446
449
|
}
|
|
447
|
-
if (
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
)
|
|
451
|
-
) {
|
|
450
|
+
if (["application/", "audio/", "image/", "video/"].some(
|
|
451
|
+
(type) => cleanContent.startsWith(type)
|
|
452
|
+
)) {
|
|
452
453
|
return "blob";
|
|
453
454
|
}
|
|
454
455
|
if (cleanContent.startsWith("text/")) {
|
|
@@ -460,16 +461,15 @@ var checkForExistence = (options, name) => {
|
|
|
460
461
|
if (!name) {
|
|
461
462
|
return false;
|
|
462
463
|
}
|
|
463
|
-
if (
|
|
464
|
-
options.headers.has(name) ||
|
|
465
|
-
options.query?.[name] ||
|
|
466
|
-
options.headers.get("Cookie")?.includes(`${name}=`)
|
|
467
|
-
) {
|
|
464
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
468
465
|
return true;
|
|
469
466
|
}
|
|
470
467
|
return false;
|
|
471
468
|
};
|
|
472
|
-
var setAuthParams = async ({
|
|
469
|
+
var setAuthParams = async ({
|
|
470
|
+
security,
|
|
471
|
+
...options
|
|
472
|
+
}) => {
|
|
473
473
|
for (const auth of security) {
|
|
474
474
|
if (checkForExistence(options, auth.name)) {
|
|
475
475
|
continue;
|
|
@@ -496,17 +496,13 @@ var setAuthParams = async ({ security, ...options }) => {
|
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
};
|
|
499
|
-
var buildUrl = (options) =>
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
? options.querySerializer
|
|
507
|
-
: createQuerySerializer(options.querySerializer),
|
|
508
|
-
url: options.url,
|
|
509
|
-
});
|
|
499
|
+
var buildUrl = (options) => getUrl({
|
|
500
|
+
baseUrl: options.baseUrl,
|
|
501
|
+
path: options.path,
|
|
502
|
+
query: options.query,
|
|
503
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
504
|
+
url: options.url
|
|
505
|
+
});
|
|
510
506
|
var mergeConfigs = (a, b) => {
|
|
511
507
|
const config = { ...a, ...b };
|
|
512
508
|
if (config.baseUrl?.endsWith("/")) {
|
|
@@ -528,10 +524,7 @@ var mergeHeaders = (...headers) => {
|
|
|
528
524
|
if (!header) {
|
|
529
525
|
continue;
|
|
530
526
|
}
|
|
531
|
-
const iterator =
|
|
532
|
-
header instanceof Headers
|
|
533
|
-
? headersEntries(header)
|
|
534
|
-
: Object.entries(header);
|
|
527
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
535
528
|
for (const [key, value] of iterator) {
|
|
536
529
|
if (value === null) {
|
|
537
530
|
mergedHeaders.delete(key);
|
|
@@ -542,7 +535,7 @@ var mergeHeaders = (...headers) => {
|
|
|
542
535
|
} else if (value !== void 0) {
|
|
543
536
|
mergedHeaders.set(
|
|
544
537
|
key,
|
|
545
|
-
typeof value === "object" ? JSON.stringify(value) : value
|
|
538
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
546
539
|
);
|
|
547
540
|
}
|
|
548
541
|
}
|
|
@@ -588,28 +581,28 @@ var Interceptors = class {
|
|
|
588
581
|
var createInterceptors = () => ({
|
|
589
582
|
error: new Interceptors(),
|
|
590
583
|
request: new Interceptors(),
|
|
591
|
-
response: new Interceptors()
|
|
584
|
+
response: new Interceptors()
|
|
592
585
|
});
|
|
593
586
|
var defaultQuerySerializer = createQuerySerializer({
|
|
594
587
|
allowReserved: false,
|
|
595
588
|
array: {
|
|
596
589
|
explode: true,
|
|
597
|
-
style: "form"
|
|
590
|
+
style: "form"
|
|
598
591
|
},
|
|
599
592
|
object: {
|
|
600
593
|
explode: true,
|
|
601
|
-
style: "deepObject"
|
|
602
|
-
}
|
|
594
|
+
style: "deepObject"
|
|
595
|
+
}
|
|
603
596
|
});
|
|
604
597
|
var defaultHeaders = {
|
|
605
|
-
"Content-Type": "application/json"
|
|
598
|
+
"Content-Type": "application/json"
|
|
606
599
|
};
|
|
607
600
|
var createConfig = (override = {}) => ({
|
|
608
601
|
...jsonBodySerializer,
|
|
609
602
|
headers: defaultHeaders,
|
|
610
603
|
parseAs: "auto",
|
|
611
604
|
querySerializer: defaultQuerySerializer,
|
|
612
|
-
...override
|
|
605
|
+
...override
|
|
613
606
|
});
|
|
614
607
|
|
|
615
608
|
// src/_internal/client/client.gen.ts
|
|
@@ -627,12 +620,12 @@ var createClient = (config = {}) => {
|
|
|
627
620
|
...options,
|
|
628
621
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
629
622
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
630
|
-
serializedBody: void 0
|
|
623
|
+
serializedBody: void 0
|
|
631
624
|
};
|
|
632
625
|
if (opts.security) {
|
|
633
626
|
await setAuthParams({
|
|
634
627
|
...opts,
|
|
635
|
-
security: opts.security
|
|
628
|
+
security: opts.security
|
|
636
629
|
});
|
|
637
630
|
}
|
|
638
631
|
if (opts.requestValidator) {
|
|
@@ -652,7 +645,7 @@ var createClient = (config = {}) => {
|
|
|
652
645
|
const requestInit = {
|
|
653
646
|
redirect: "follow",
|
|
654
647
|
...opts,
|
|
655
|
-
body: getValidRequestBody(opts)
|
|
648
|
+
body: getValidRequestBody(opts)
|
|
656
649
|
};
|
|
657
650
|
let request2 = new Request(url, requestInit);
|
|
658
651
|
for (const fn of interceptors.request.fns) {
|
|
@@ -668,20 +661,23 @@ var createClient = (config = {}) => {
|
|
|
668
661
|
let finalError2 = error2;
|
|
669
662
|
for (const fn of interceptors.error.fns) {
|
|
670
663
|
if (fn) {
|
|
671
|
-
finalError2 = await fn(
|
|
664
|
+
finalError2 = await fn(
|
|
665
|
+
error2,
|
|
666
|
+
void 0,
|
|
667
|
+
request2,
|
|
668
|
+
opts
|
|
669
|
+
);
|
|
672
670
|
}
|
|
673
671
|
}
|
|
674
672
|
finalError2 = finalError2 || {};
|
|
675
673
|
if (opts.throwOnError) {
|
|
676
674
|
throw finalError2;
|
|
677
675
|
}
|
|
678
|
-
return opts.responseStyle === "data"
|
|
679
|
-
|
|
680
|
-
:
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
response: void 0,
|
|
684
|
-
};
|
|
676
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
677
|
+
error: finalError2,
|
|
678
|
+
request: request2,
|
|
679
|
+
response: void 0
|
|
680
|
+
};
|
|
685
681
|
}
|
|
686
682
|
for (const fn of interceptors.response.fns) {
|
|
687
683
|
if (fn) {
|
|
@@ -690,17 +686,11 @@ var createClient = (config = {}) => {
|
|
|
690
686
|
}
|
|
691
687
|
const result = {
|
|
692
688
|
request: request2,
|
|
693
|
-
response
|
|
689
|
+
response
|
|
694
690
|
};
|
|
695
691
|
if (response.ok) {
|
|
696
|
-
const parseAs =
|
|
697
|
-
|
|
698
|
-
? getParseAs(response.headers.get("Content-Type"))
|
|
699
|
-
: opts.parseAs) ?? "json";
|
|
700
|
-
if (
|
|
701
|
-
response.status === 204 ||
|
|
702
|
-
response.headers.get("Content-Length") === "0"
|
|
703
|
-
) {
|
|
692
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
693
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
704
694
|
let emptyData;
|
|
705
695
|
switch (parseAs) {
|
|
706
696
|
case "arrayBuffer":
|
|
@@ -719,12 +709,10 @@ var createClient = (config = {}) => {
|
|
|
719
709
|
emptyData = {};
|
|
720
710
|
break;
|
|
721
711
|
}
|
|
722
|
-
return opts.responseStyle === "data"
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
...result,
|
|
727
|
-
};
|
|
712
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
713
|
+
data: emptyData,
|
|
714
|
+
...result
|
|
715
|
+
};
|
|
728
716
|
}
|
|
729
717
|
let data;
|
|
730
718
|
switch (parseAs) {
|
|
@@ -736,12 +724,10 @@ var createClient = (config = {}) => {
|
|
|
736
724
|
data = await response[parseAs]();
|
|
737
725
|
break;
|
|
738
726
|
case "stream":
|
|
739
|
-
return opts.responseStyle === "data"
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
...result,
|
|
744
|
-
};
|
|
727
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
728
|
+
data: response.body,
|
|
729
|
+
...result
|
|
730
|
+
};
|
|
745
731
|
}
|
|
746
732
|
if (parseAs === "json") {
|
|
747
733
|
if (opts.responseValidator) {
|
|
@@ -751,18 +737,17 @@ var createClient = (config = {}) => {
|
|
|
751
737
|
data = await opts.responseTransformer(data);
|
|
752
738
|
}
|
|
753
739
|
}
|
|
754
|
-
return opts.responseStyle === "data"
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
...result,
|
|
759
|
-
};
|
|
740
|
+
return opts.responseStyle === "data" ? data : {
|
|
741
|
+
data,
|
|
742
|
+
...result
|
|
743
|
+
};
|
|
760
744
|
}
|
|
761
745
|
const textError = await response.text();
|
|
762
746
|
let jsonError;
|
|
763
747
|
try {
|
|
764
748
|
jsonError = JSON.parse(textError);
|
|
765
|
-
} catch {
|
|
749
|
+
} catch {
|
|
750
|
+
}
|
|
766
751
|
const error = jsonError ?? textError;
|
|
767
752
|
let finalError = error;
|
|
768
753
|
for (const fn of interceptors.error.fns) {
|
|
@@ -774,12 +759,10 @@ var createClient = (config = {}) => {
|
|
|
774
759
|
if (opts.throwOnError) {
|
|
775
760
|
throw finalError;
|
|
776
761
|
}
|
|
777
|
-
return opts.responseStyle === "data"
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
...result,
|
|
782
|
-
};
|
|
762
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
763
|
+
error: finalError,
|
|
764
|
+
...result
|
|
765
|
+
};
|
|
783
766
|
};
|
|
784
767
|
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
785
768
|
const makeSseFn = (method) => async (options) => {
|
|
@@ -798,7 +781,7 @@ var createClient = (config = {}) => {
|
|
|
798
781
|
}
|
|
799
782
|
return request2;
|
|
800
783
|
},
|
|
801
|
-
url
|
|
784
|
+
url
|
|
802
785
|
});
|
|
803
786
|
};
|
|
804
787
|
return {
|
|
@@ -824,14 +807,16 @@ var createClient = (config = {}) => {
|
|
|
824
807
|
patch: makeSseFn("PATCH"),
|
|
825
808
|
post: makeSseFn("POST"),
|
|
826
809
|
put: makeSseFn("PUT"),
|
|
827
|
-
trace: makeSseFn("TRACE")
|
|
810
|
+
trace: makeSseFn("TRACE")
|
|
828
811
|
},
|
|
829
|
-
trace: makeMethodFn("TRACE")
|
|
812
|
+
trace: makeMethodFn("TRACE")
|
|
830
813
|
};
|
|
831
814
|
};
|
|
832
815
|
|
|
833
816
|
// src/_internal/client.gen.ts
|
|
834
|
-
var client = createClient(
|
|
817
|
+
var client = createClient(
|
|
818
|
+
createConfig({ baseUrl: "http://localhost:33333" })
|
|
819
|
+
);
|
|
835
820
|
|
|
836
821
|
// src/base-client.ts
|
|
837
822
|
var DEFAULT_API_VERSION = "2025-12-03";
|
|
@@ -854,7 +839,7 @@ var BaseClient = class {
|
|
|
854
839
|
this.apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
|
|
855
840
|
if (config.baseUrl && !isSecureUrl(config.baseUrl)) {
|
|
856
841
|
console.warn(
|
|
857
|
-
"[GPT Core SDK] Warning: Using non-HTTPS URL. Credentials may be transmitted insecurely. Use HTTPS in production environments."
|
|
842
|
+
"[GPT Core SDK] Warning: Using non-HTTPS URL. Credentials may be transmitted insecurely. Use HTTPS in production environments."
|
|
858
843
|
);
|
|
859
844
|
}
|
|
860
845
|
if (config.baseUrl) {
|
|
@@ -864,12 +849,12 @@ var BaseClient = class {
|
|
|
864
849
|
const requestUrl = req.url || config.baseUrl || "";
|
|
865
850
|
if ((config.apiKey || config.token) && !isSecureUrl(requestUrl)) {
|
|
866
851
|
console.warn(
|
|
867
|
-
"[GPT Core SDK] Warning: Sending credentials over non-HTTPS connection."
|
|
852
|
+
"[GPT Core SDK] Warning: Sending credentials over non-HTTPS connection."
|
|
868
853
|
);
|
|
869
854
|
}
|
|
870
855
|
req.headers.set(
|
|
871
856
|
"Accept",
|
|
872
|
-
`application/vnd.api+json; version=${this.apiVersion}
|
|
857
|
+
`application/vnd.api+json; version=${this.apiVersion}`
|
|
873
858
|
);
|
|
874
859
|
req.headers.set("Content-Type", "application/vnd.api+json");
|
|
875
860
|
if (config.apiKey) {
|
|
@@ -897,7 +882,7 @@ var BaseClient = class {
|
|
|
897
882
|
}
|
|
898
883
|
getHeaders() {
|
|
899
884
|
return {
|
|
900
|
-
"x-application-key": this.config.apiKey || ""
|
|
885
|
+
"x-application-key": this.config.apiKey || ""
|
|
901
886
|
};
|
|
902
887
|
}
|
|
903
888
|
};
|
|
@@ -966,8 +951,7 @@ function handleApiError(error) {
|
|
|
966
951
|
const statusCode = response?.status || err?.status || err?.statusCode;
|
|
967
952
|
const headers = response?.headers || err?.headers;
|
|
968
953
|
const requestId = headers?.get?.("x-request-id") || headers?.["x-request-id"];
|
|
969
|
-
const body =
|
|
970
|
-
response?.body || response?.data || err?.body || err?.data || err;
|
|
954
|
+
const body = response?.body || response?.data || err?.body || err?.data || err;
|
|
971
955
|
let message = "An error occurred";
|
|
972
956
|
let errors;
|
|
973
957
|
const bodyObj = body;
|
|
@@ -976,7 +960,7 @@ function handleApiError(error) {
|
|
|
976
960
|
message = firstError?.title || firstError?.detail || message;
|
|
977
961
|
errors = bodyObj.errors.map((e) => ({
|
|
978
962
|
field: e.source?.pointer?.split("/").pop(),
|
|
979
|
-
message: e.detail || e.title || "Unknown error"
|
|
963
|
+
message: e.detail || e.title || "Unknown error"
|
|
980
964
|
}));
|
|
981
965
|
} else if (bodyObj?.message) {
|
|
982
966
|
message = bodyObj.message;
|
|
@@ -991,18 +975,15 @@ function handleApiError(error) {
|
|
|
991
975
|
"x-application-key",
|
|
992
976
|
"cookie",
|
|
993
977
|
"x-forwarded-for",
|
|
994
|
-
"x-real-ip"
|
|
978
|
+
"x-real-ip"
|
|
995
979
|
];
|
|
996
980
|
const filterSensitiveHeaders = (hdrs) => {
|
|
997
981
|
if (!hdrs) return void 0;
|
|
998
|
-
const entries =
|
|
999
|
-
hdrs instanceof Headers
|
|
1000
|
-
? Array.from(hdrs.entries())
|
|
1001
|
-
: Object.entries(hdrs);
|
|
982
|
+
const entries = hdrs instanceof Headers ? Array.from(hdrs.entries()) : Object.entries(hdrs);
|
|
1002
983
|
const filtered = entries.filter(([key]) => {
|
|
1003
984
|
const lowerKey = key.toLowerCase();
|
|
1004
|
-
return !sensitiveHeaderPatterns.some(
|
|
1005
|
-
lowerKey.includes(pattern)
|
|
985
|
+
return !sensitiveHeaderPatterns.some(
|
|
986
|
+
(pattern) => lowerKey.includes(pattern)
|
|
1006
987
|
);
|
|
1007
988
|
});
|
|
1008
989
|
return filtered.length > 0 ? Object.fromEntries(filtered) : void 0;
|
|
@@ -1012,7 +993,7 @@ function handleApiError(error) {
|
|
|
1012
993
|
requestId,
|
|
1013
994
|
headers: filterSensitiveHeaders(headers),
|
|
1014
995
|
body,
|
|
1015
|
-
cause: error instanceof Error ? error : void 0
|
|
996
|
+
cause: error instanceof Error ? error : void 0
|
|
1016
997
|
};
|
|
1017
998
|
switch (statusCode) {
|
|
1018
999
|
case 401:
|
|
@@ -1025,12 +1006,11 @@ function handleApiError(error) {
|
|
|
1025
1006
|
case 422:
|
|
1026
1007
|
throw new ValidationError(message, errors, errorOptions);
|
|
1027
1008
|
case 429: {
|
|
1028
|
-
const retryAfter =
|
|
1029
|
-
headers?.get?.("retry-after") || headers?.["retry-after"];
|
|
1009
|
+
const retryAfter = headers?.get?.("retry-after") || headers?.["retry-after"];
|
|
1030
1010
|
throw new RateLimitError(
|
|
1031
1011
|
message,
|
|
1032
1012
|
retryAfter ? parseInt(retryAfter, 10) : void 0,
|
|
1033
|
-
errorOptions
|
|
1013
|
+
errorOptions
|
|
1034
1014
|
);
|
|
1035
1015
|
}
|
|
1036
1016
|
case 500:
|
|
@@ -1069,13 +1049,13 @@ async function* streamSSE(response, options = {}) {
|
|
|
1069
1049
|
if (elapsed > timeout) {
|
|
1070
1050
|
reader.cancel();
|
|
1071
1051
|
throw new TimeoutError(
|
|
1072
|
-
`Stream timeout exceeded after ${elapsed}ms (limit: ${timeout}ms)
|
|
1052
|
+
`Stream timeout exceeded after ${elapsed}ms (limit: ${timeout}ms)`
|
|
1073
1053
|
);
|
|
1074
1054
|
}
|
|
1075
1055
|
if (chunkCount >= maxChunks) {
|
|
1076
1056
|
reader.cancel();
|
|
1077
1057
|
throw new GptCoreError(`Maximum chunk limit exceeded (${maxChunks})`, {
|
|
1078
|
-
code: "stream_limit_exceeded"
|
|
1058
|
+
code: "stream_limit_exceeded"
|
|
1079
1059
|
});
|
|
1080
1060
|
}
|
|
1081
1061
|
const { done, value } = await reader.read();
|
|
@@ -1089,7 +1069,7 @@ async function* streamSSE(response, options = {}) {
|
|
|
1089
1069
|
reader.cancel();
|
|
1090
1070
|
throw new GptCoreError(
|
|
1091
1071
|
`Stream buffer size exceeded (${bufferSize} bytes, limit: ${maxBufferSize})`,
|
|
1092
|
-
{ code: "stream_limit_exceeded" }
|
|
1072
|
+
{ code: "stream_limit_exceeded" }
|
|
1093
1073
|
);
|
|
1094
1074
|
}
|
|
1095
1075
|
buffer += decoder.decode(value, { stream: true });
|
|
@@ -1105,7 +1085,7 @@ async function* streamSSE(response, options = {}) {
|
|
|
1105
1085
|
} catch {
|
|
1106
1086
|
yield {
|
|
1107
1087
|
type: "error",
|
|
1108
|
-
error: `Malformed SSE data: ${data.substring(0, 200)}
|
|
1088
|
+
error: `Malformed SSE data: ${data.substring(0, 200)}`
|
|
1109
1089
|
};
|
|
1110
1090
|
}
|
|
1111
1091
|
}
|
|
@@ -1154,13 +1134,13 @@ var RequestBuilder = class {
|
|
|
1154
1134
|
async execute(fn, params, options) {
|
|
1155
1135
|
const headers = buildHeaders(this.getHeaders, options);
|
|
1156
1136
|
try {
|
|
1157
|
-
const { data } = await this.requestWithRetry(
|
|
1158
|
-
fn({
|
|
1137
|
+
const { data } = await this.requestWithRetry(
|
|
1138
|
+
() => fn({
|
|
1159
1139
|
client: this.clientInstance,
|
|
1160
1140
|
headers,
|
|
1161
1141
|
...params,
|
|
1162
|
-
...
|
|
1163
|
-
})
|
|
1142
|
+
...options?.signal && { signal: options.signal }
|
|
1143
|
+
})
|
|
1164
1144
|
);
|
|
1165
1145
|
return this.unwrap(data?.data);
|
|
1166
1146
|
} catch (error) {
|
|
@@ -1173,13 +1153,13 @@ var RequestBuilder = class {
|
|
|
1173
1153
|
async executeDelete(fn, params, options) {
|
|
1174
1154
|
const headers = buildHeaders(this.getHeaders, options);
|
|
1175
1155
|
try {
|
|
1176
|
-
await this.requestWithRetry(
|
|
1177
|
-
fn({
|
|
1156
|
+
await this.requestWithRetry(
|
|
1157
|
+
() => fn({
|
|
1178
1158
|
client: this.clientInstance,
|
|
1179
1159
|
headers,
|
|
1180
1160
|
...params,
|
|
1181
|
-
...
|
|
1182
|
-
})
|
|
1161
|
+
...options?.signal && { signal: options.signal }
|
|
1162
|
+
})
|
|
1183
1163
|
);
|
|
1184
1164
|
return true;
|
|
1185
1165
|
} catch (error) {
|
|
@@ -1193,12 +1173,12 @@ var RequestBuilder = class {
|
|
|
1193
1173
|
async rawGet(url, options) {
|
|
1194
1174
|
const headers = buildHeaders(this.getHeaders, options);
|
|
1195
1175
|
try {
|
|
1196
|
-
const { data } = await this.requestWithRetry(
|
|
1197
|
-
this.clientInstance.get({
|
|
1176
|
+
const { data } = await this.requestWithRetry(
|
|
1177
|
+
() => this.clientInstance.get({
|
|
1198
1178
|
url,
|
|
1199
1179
|
headers,
|
|
1200
|
-
...
|
|
1201
|
-
})
|
|
1180
|
+
...options?.signal && { signal: options.signal }
|
|
1181
|
+
})
|
|
1202
1182
|
);
|
|
1203
1183
|
return this.unwrap(data?.data);
|
|
1204
1184
|
} catch (error) {
|
|
@@ -1212,13 +1192,13 @@ var RequestBuilder = class {
|
|
|
1212
1192
|
async rawPost(url, body, options) {
|
|
1213
1193
|
const headers = buildHeaders(this.getHeaders, options);
|
|
1214
1194
|
try {
|
|
1215
|
-
const { data } = await this.requestWithRetry(
|
|
1216
|
-
this.clientInstance.post({
|
|
1195
|
+
const { data } = await this.requestWithRetry(
|
|
1196
|
+
() => this.clientInstance.post({
|
|
1217
1197
|
url,
|
|
1218
1198
|
headers,
|
|
1219
|
-
...
|
|
1220
|
-
...
|
|
1221
|
-
})
|
|
1199
|
+
...body !== void 0 && { body: JSON.stringify(body) },
|
|
1200
|
+
...options?.signal && { signal: options.signal }
|
|
1201
|
+
})
|
|
1222
1202
|
);
|
|
1223
1203
|
return this.unwrap(data?.data);
|
|
1224
1204
|
} catch (error) {
|
|
@@ -1237,13 +1217,13 @@ var RequestBuilder = class {
|
|
|
1237
1217
|
createPaginatedFetcher(fn, queryBuilder, options) {
|
|
1238
1218
|
return async (page, pageSize) => {
|
|
1239
1219
|
const headers = buildHeaders(this.getHeaders, options);
|
|
1240
|
-
const { data } = await this.requestWithRetry(
|
|
1241
|
-
fn({
|
|
1220
|
+
const { data } = await this.requestWithRetry(
|
|
1221
|
+
() => fn({
|
|
1242
1222
|
client: this.clientInstance,
|
|
1243
1223
|
headers,
|
|
1244
|
-
...
|
|
1245
|
-
...queryBuilder(page, pageSize)
|
|
1246
|
-
})
|
|
1224
|
+
...options?.signal && { signal: options.signal },
|
|
1225
|
+
...queryBuilder(page, pageSize)
|
|
1226
|
+
})
|
|
1247
1227
|
);
|
|
1248
1228
|
const envelope = data;
|
|
1249
1229
|
const items = this.unwrap(envelope.data) || [];
|
|
@@ -1266,38 +1246,38 @@ var RequestBuilder = class {
|
|
|
1266
1246
|
headers,
|
|
1267
1247
|
body: JSON.stringify({ data: { type: "message", attributes: body } }),
|
|
1268
1248
|
parseAs: "stream",
|
|
1269
|
-
...
|
|
1249
|
+
...options?.signal && { signal: options.signal }
|
|
1270
1250
|
});
|
|
1271
1251
|
const envelope = result;
|
|
1272
1252
|
const streamBody = envelope.data ?? result;
|
|
1273
1253
|
const response = envelope.response;
|
|
1274
1254
|
if (response && !response.ok) {
|
|
1275
1255
|
throw new ServerError(`Stream request failed: ${response.status}`, {
|
|
1276
|
-
statusCode: response.status
|
|
1256
|
+
statusCode: response.status
|
|
1277
1257
|
});
|
|
1278
1258
|
}
|
|
1279
1259
|
if (streamBody instanceof ReadableStream) {
|
|
1280
1260
|
const syntheticResponse = new Response(streamBody, {
|
|
1281
|
-
headers: { "Content-Type": "text/event-stream" }
|
|
1261
|
+
headers: { "Content-Type": "text/event-stream" }
|
|
1282
1262
|
});
|
|
1283
1263
|
return streamMessage(syntheticResponse, {
|
|
1284
1264
|
signal: options?.signal,
|
|
1285
|
-
...streamOptions
|
|
1265
|
+
...streamOptions
|
|
1286
1266
|
});
|
|
1287
1267
|
}
|
|
1288
1268
|
if (streamBody instanceof Response) {
|
|
1289
1269
|
if (!streamBody.ok) {
|
|
1290
1270
|
throw new ServerError(`Stream request failed: ${streamBody.status}`, {
|
|
1291
|
-
statusCode: streamBody.status
|
|
1271
|
+
statusCode: streamBody.status
|
|
1292
1272
|
});
|
|
1293
1273
|
}
|
|
1294
1274
|
return streamMessage(streamBody, {
|
|
1295
1275
|
signal: options?.signal,
|
|
1296
|
-
...streamOptions
|
|
1276
|
+
...streamOptions
|
|
1297
1277
|
});
|
|
1298
1278
|
}
|
|
1299
1279
|
throw new GptCoreError("Unexpected stream response format", {
|
|
1300
|
-
code: "stream_error"
|
|
1280
|
+
code: "stream_error"
|
|
1301
1281
|
});
|
|
1302
1282
|
}
|
|
1303
1283
|
/**
|
|
@@ -1311,288 +1291,261 @@ var RequestBuilder = class {
|
|
|
1311
1291
|
url,
|
|
1312
1292
|
headers,
|
|
1313
1293
|
parseAs: "stream",
|
|
1314
|
-
...
|
|
1294
|
+
...options?.signal && { signal: options.signal }
|
|
1315
1295
|
});
|
|
1316
1296
|
const envelope = result;
|
|
1317
1297
|
const streamBody = envelope.data ?? result;
|
|
1318
1298
|
const response = envelope.response;
|
|
1319
1299
|
if (response && !response.ok) {
|
|
1320
1300
|
throw new ServerError(`Stream request failed: ${response.status}`, {
|
|
1321
|
-
statusCode: response.status
|
|
1301
|
+
statusCode: response.status
|
|
1322
1302
|
});
|
|
1323
1303
|
}
|
|
1324
1304
|
if (streamBody instanceof ReadableStream) {
|
|
1325
1305
|
const syntheticResponse = new Response(streamBody, {
|
|
1326
|
-
headers: { "Content-Type": "text/event-stream" }
|
|
1306
|
+
headers: { "Content-Type": "text/event-stream" }
|
|
1327
1307
|
});
|
|
1328
1308
|
return streamMessage(syntheticResponse, {
|
|
1329
1309
|
signal: options?.signal,
|
|
1330
|
-
...streamOptions
|
|
1310
|
+
...streamOptions
|
|
1331
1311
|
});
|
|
1332
1312
|
}
|
|
1333
1313
|
if (streamBody instanceof Response) {
|
|
1334
1314
|
if (!streamBody.ok) {
|
|
1335
1315
|
throw new ServerError(`Stream request failed: ${streamBody.status}`, {
|
|
1336
|
-
statusCode: streamBody.status
|
|
1316
|
+
statusCode: streamBody.status
|
|
1337
1317
|
});
|
|
1338
1318
|
}
|
|
1339
1319
|
return streamMessage(streamBody, {
|
|
1340
1320
|
signal: options?.signal,
|
|
1341
|
-
...streamOptions
|
|
1321
|
+
...streamOptions
|
|
1342
1322
|
});
|
|
1343
1323
|
}
|
|
1344
1324
|
throw new GptCoreError("Unexpected stream response format", {
|
|
1345
|
-
code: "stream_error"
|
|
1325
|
+
code: "stream_error"
|
|
1346
1326
|
});
|
|
1347
1327
|
}
|
|
1348
1328
|
};
|
|
1349
1329
|
|
|
1350
1330
|
// src/_internal/sdk.gen.ts
|
|
1351
|
-
var patchAdminAccountsByIdCredit = (options) =>
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
var
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
headers
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
var
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
});
|
|
1527
|
-
var getAdminBucketsById = (options) =>
|
|
1528
|
-
(options.client ?? client).get({
|
|
1529
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1530
|
-
url: "/admin/buckets/{id}",
|
|
1531
|
-
...options,
|
|
1532
|
-
});
|
|
1533
|
-
var postAdminWebhookConfigsByIdTest = (options) =>
|
|
1534
|
-
(options.client ?? client).post({
|
|
1535
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1536
|
-
url: "/admin/webhook-configs/{id}/test",
|
|
1537
|
-
...options,
|
|
1538
|
-
headers: {
|
|
1539
|
-
"Content-Type": "application/vnd.api+json",
|
|
1540
|
-
...options.headers,
|
|
1541
|
-
},
|
|
1542
|
-
});
|
|
1543
|
-
var postAdminWebhookDeliveriesByIdRetry = (options) =>
|
|
1544
|
-
(options.client ?? client).post({
|
|
1545
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1546
|
-
url: "/admin/webhook-deliveries/{id}/retry",
|
|
1547
|
-
...options,
|
|
1548
|
-
headers: {
|
|
1549
|
-
"Content-Type": "application/vnd.api+json",
|
|
1550
|
-
...options.headers,
|
|
1551
|
-
},
|
|
1552
|
-
});
|
|
1331
|
+
var patchAdminAccountsByIdCredit = (options) => (options.client ?? client).patch({
|
|
1332
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1333
|
+
url: "/admin/accounts/{id}/credit",
|
|
1334
|
+
...options,
|
|
1335
|
+
headers: {
|
|
1336
|
+
"Content-Type": "application/vnd.api+json",
|
|
1337
|
+
...options.headers
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
var getAdminWebhookDeliveriesById = (options) => (options.client ?? client).get({
|
|
1341
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1342
|
+
url: "/admin/webhook-deliveries/{id}",
|
|
1343
|
+
...options
|
|
1344
|
+
});
|
|
1345
|
+
var getAdminApiKeysById = (options) => (options.client ?? client).get({
|
|
1346
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1347
|
+
url: "/admin/api-keys/{id}",
|
|
1348
|
+
...options
|
|
1349
|
+
});
|
|
1350
|
+
var deleteAdminWebhookConfigsById = (options) => (options.client ?? client).delete({
|
|
1351
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1352
|
+
url: "/admin/webhook-configs/{id}",
|
|
1353
|
+
...options
|
|
1354
|
+
});
|
|
1355
|
+
var getAdminWebhookConfigsById = (options) => (options.client ?? client).get({
|
|
1356
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1357
|
+
url: "/admin/webhook-configs/{id}",
|
|
1358
|
+
...options
|
|
1359
|
+
});
|
|
1360
|
+
var patchAdminWebhookConfigsById = (options) => (options.client ?? client).patch({
|
|
1361
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1362
|
+
url: "/admin/webhook-configs/{id}",
|
|
1363
|
+
...options,
|
|
1364
|
+
headers: {
|
|
1365
|
+
"Content-Type": "application/vnd.api+json",
|
|
1366
|
+
...options.headers
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
var patchAdminAccountsByIdDebit = (options) => (options.client ?? client).patch({
|
|
1370
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1371
|
+
url: "/admin/accounts/{id}/debit",
|
|
1372
|
+
...options,
|
|
1373
|
+
headers: {
|
|
1374
|
+
"Content-Type": "application/vnd.api+json",
|
|
1375
|
+
...options.headers
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
var getAdminApiKeys = (options) => (options.client ?? client).get({
|
|
1379
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1380
|
+
url: "/admin/api-keys",
|
|
1381
|
+
...options
|
|
1382
|
+
});
|
|
1383
|
+
var getAdminExtractionDocumentsById = (options) => (options.client ?? client).get({
|
|
1384
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1385
|
+
url: "/admin/extraction/documents/{id}",
|
|
1386
|
+
...options
|
|
1387
|
+
});
|
|
1388
|
+
var getAdminAccounts = (options) => (options.client ?? client).get({
|
|
1389
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1390
|
+
url: "/admin/accounts",
|
|
1391
|
+
...options
|
|
1392
|
+
});
|
|
1393
|
+
var getAdminStorageStats = (options) => (options.client ?? client).get({
|
|
1394
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1395
|
+
url: "/admin/storage/stats",
|
|
1396
|
+
...options
|
|
1397
|
+
});
|
|
1398
|
+
var getAdminAccountsById = (options) => (options.client ?? client).get({
|
|
1399
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1400
|
+
url: "/admin/accounts/{id}",
|
|
1401
|
+
...options
|
|
1402
|
+
});
|
|
1403
|
+
var getAdminBucketsByIdStats = (options) => (options.client ?? client).get({
|
|
1404
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1405
|
+
url: "/admin/buckets/{id}/stats",
|
|
1406
|
+
...options
|
|
1407
|
+
});
|
|
1408
|
+
var getAdminDocumentsStats = (options) => (options.client ?? client).get({
|
|
1409
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1410
|
+
url: "/admin/documents/stats",
|
|
1411
|
+
...options
|
|
1412
|
+
});
|
|
1413
|
+
var getAdminWebhookDeliveries = (options) => (options.client ?? client).get({
|
|
1414
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1415
|
+
url: "/admin/webhook-deliveries",
|
|
1416
|
+
...options
|
|
1417
|
+
});
|
|
1418
|
+
var getAdminExtractionDocuments = (options) => (options.client ?? client).get({
|
|
1419
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1420
|
+
url: "/admin/extraction/documents",
|
|
1421
|
+
...options
|
|
1422
|
+
});
|
|
1423
|
+
var getAdminBucketsByIdObjects = (options) => (options.client ?? client).get({
|
|
1424
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1425
|
+
url: "/admin/buckets/{id}/objects",
|
|
1426
|
+
...options
|
|
1427
|
+
});
|
|
1428
|
+
var postAdminDocumentsBulkDelete = (options) => (options.client ?? client).post({
|
|
1429
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1430
|
+
url: "/admin/documents/bulk-delete",
|
|
1431
|
+
...options,
|
|
1432
|
+
headers: {
|
|
1433
|
+
"Content-Type": "application/vnd.api+json",
|
|
1434
|
+
...options.headers
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
var getAdminWebhookConfigs = (options) => (options.client ?? client).get({
|
|
1438
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1439
|
+
url: "/admin/webhook-configs",
|
|
1440
|
+
...options
|
|
1441
|
+
});
|
|
1442
|
+
var postAdminWebhookConfigs = (options) => (options.client ?? client).post({
|
|
1443
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1444
|
+
url: "/admin/webhook-configs",
|
|
1445
|
+
...options,
|
|
1446
|
+
headers: {
|
|
1447
|
+
"Content-Type": "application/vnd.api+json",
|
|
1448
|
+
...options.headers
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
var patchAdminApiKeysByIdAllocate = (options) => (options.client ?? client).patch({
|
|
1452
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1453
|
+
url: "/admin/api-keys/{id}/allocate",
|
|
1454
|
+
...options,
|
|
1455
|
+
headers: {
|
|
1456
|
+
"Content-Type": "application/vnd.api+json",
|
|
1457
|
+
...options.headers
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
var patchAdminApiKeysByIdRevoke = (options) => (options.client ?? client).patch({
|
|
1461
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1462
|
+
url: "/admin/api-keys/{id}/revoke",
|
|
1463
|
+
...options,
|
|
1464
|
+
headers: {
|
|
1465
|
+
"Content-Type": "application/vnd.api+json",
|
|
1466
|
+
...options.headers
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
var getAdminBuckets = (options) => (options.client ?? client).get({
|
|
1470
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1471
|
+
url: "/admin/buckets",
|
|
1472
|
+
...options
|
|
1473
|
+
});
|
|
1474
|
+
var patchAdminApiKeysByIdRotate = (options) => (options.client ?? client).patch({
|
|
1475
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1476
|
+
url: "/admin/api-keys/{id}/rotate",
|
|
1477
|
+
...options,
|
|
1478
|
+
headers: {
|
|
1479
|
+
"Content-Type": "application/vnd.api+json",
|
|
1480
|
+
...options.headers
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
var getAdminBucketsById = (options) => (options.client ?? client).get({
|
|
1484
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1485
|
+
url: "/admin/buckets/{id}",
|
|
1486
|
+
...options
|
|
1487
|
+
});
|
|
1488
|
+
var postAdminWebhookConfigsByIdTest = (options) => (options.client ?? client).post({
|
|
1489
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1490
|
+
url: "/admin/webhook-configs/{id}/test",
|
|
1491
|
+
...options,
|
|
1492
|
+
headers: {
|
|
1493
|
+
"Content-Type": "application/vnd.api+json",
|
|
1494
|
+
...options.headers
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
var postAdminWebhookDeliveriesByIdRetry = (options) => (options.client ?? client).post({
|
|
1498
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1499
|
+
url: "/admin/webhook-deliveries/{id}/retry",
|
|
1500
|
+
...options,
|
|
1501
|
+
headers: {
|
|
1502
|
+
"Content-Type": "application/vnd.api+json",
|
|
1503
|
+
...options.headers
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1553
1506
|
|
|
1554
1507
|
// src/schemas/requests.ts
|
|
1555
1508
|
import { z } from "zod";
|
|
1556
1509
|
var StorageStatsRequestSchema = z.object({
|
|
1557
|
-
workspace_id: z.string().optional()
|
|
1510
|
+
workspace_id: z.string().optional()
|
|
1558
1511
|
});
|
|
1559
1512
|
var WebhookConfigCreateSchema = z.object({
|
|
1560
1513
|
url: z.string().url(),
|
|
1561
1514
|
events: z.array(z.string()).min(1),
|
|
1562
1515
|
secret: z.string().optional(),
|
|
1563
|
-
enabled: z.boolean().default(true)
|
|
1516
|
+
enabled: z.boolean().default(true)
|
|
1564
1517
|
});
|
|
1565
1518
|
var WebhookBulkEnableSchema = z.object({
|
|
1566
|
-
config_ids: z.array(z.string()).min(1).max(100)
|
|
1519
|
+
config_ids: z.array(z.string()).min(1).max(100)
|
|
1567
1520
|
});
|
|
1568
1521
|
var WebhookBulkDisableSchema = z.object({
|
|
1569
|
-
config_ids: z.array(z.string()).min(1).max(100)
|
|
1522
|
+
config_ids: z.array(z.string()).min(1).max(100)
|
|
1570
1523
|
});
|
|
1571
1524
|
var WebhookDeliveryBulkRetrySchema = z.object({
|
|
1572
|
-
delivery_ids: z.array(z.string()).min(1).max(100)
|
|
1525
|
+
delivery_ids: z.array(z.string()).min(1).max(100)
|
|
1573
1526
|
});
|
|
1574
1527
|
var AgentAdminCreateSchema = z.object({
|
|
1575
1528
|
name: z.string().min(1).max(255),
|
|
1576
1529
|
prompt_template: z.string().min(1),
|
|
1577
|
-
system_wide: z.boolean().default(false)
|
|
1530
|
+
system_wide: z.boolean().default(false)
|
|
1578
1531
|
});
|
|
1579
1532
|
var AccountCreditSchema = z.object({
|
|
1580
1533
|
amount: z.number().positive(),
|
|
1581
|
-
description: z.string().optional()
|
|
1534
|
+
description: z.string().optional()
|
|
1582
1535
|
});
|
|
1583
1536
|
var AccountDebitSchema = z.object({
|
|
1584
1537
|
amount: z.number().positive(),
|
|
1585
|
-
description: z.string().optional()
|
|
1538
|
+
description: z.string().optional()
|
|
1586
1539
|
});
|
|
1587
1540
|
var ApiKeyAllocateSchema = z.object({
|
|
1588
1541
|
rate_limit: z.number().int().positive().optional(),
|
|
1589
|
-
expires_at: z.string().datetime().optional()
|
|
1542
|
+
expires_at: z.string().datetime().optional()
|
|
1590
1543
|
});
|
|
1591
1544
|
var DocumentBulkDeleteSchema = z.object({
|
|
1592
|
-
document_ids: z.array(z.string()).min(1).max(100)
|
|
1545
|
+
document_ids: z.array(z.string()).min(1).max(100)
|
|
1593
1546
|
});
|
|
1594
1547
|
var DocumentBulkReprocessSchema = z.object({
|
|
1595
|
-
document_ids: z.array(z.string()).min(1).max(100)
|
|
1548
|
+
document_ids: z.array(z.string()).min(1).max(100)
|
|
1596
1549
|
});
|
|
1597
1550
|
|
|
1598
1551
|
// src/namespaces/accounts.ts
|
|
@@ -1604,7 +1557,11 @@ function createAccountsNamespace(rb) {
|
|
|
1604
1557
|
},
|
|
1605
1558
|
/** Get a billing account by ID */
|
|
1606
1559
|
get: async (id, options) => {
|
|
1607
|
-
return rb.execute(
|
|
1560
|
+
return rb.execute(
|
|
1561
|
+
getAdminAccountsById,
|
|
1562
|
+
{ path: { id } },
|
|
1563
|
+
options
|
|
1564
|
+
);
|
|
1608
1565
|
},
|
|
1609
1566
|
/** Credit an account */
|
|
1610
1567
|
credit: async (id, amount, description, options) => {
|
|
@@ -1617,11 +1574,11 @@ function createAccountsNamespace(rb) {
|
|
|
1617
1574
|
data: {
|
|
1618
1575
|
id,
|
|
1619
1576
|
type: "account",
|
|
1620
|
-
attributes: validated
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1577
|
+
attributes: validated
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1623
1580
|
},
|
|
1624
|
-
options
|
|
1581
|
+
options
|
|
1625
1582
|
);
|
|
1626
1583
|
},
|
|
1627
1584
|
/** Debit an account */
|
|
@@ -1635,13 +1592,13 @@ function createAccountsNamespace(rb) {
|
|
|
1635
1592
|
data: {
|
|
1636
1593
|
id,
|
|
1637
1594
|
type: "account",
|
|
1638
|
-
attributes: validated
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1595
|
+
attributes: validated
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1641
1598
|
},
|
|
1642
|
-
options
|
|
1599
|
+
options
|
|
1643
1600
|
);
|
|
1644
|
-
}
|
|
1601
|
+
}
|
|
1645
1602
|
};
|
|
1646
1603
|
}
|
|
1647
1604
|
|
|
@@ -1668,22 +1625,30 @@ function createApiKeysNamespace(rb) {
|
|
|
1668
1625
|
type: "api_key",
|
|
1669
1626
|
attributes: {
|
|
1670
1627
|
amount,
|
|
1671
|
-
description
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1628
|
+
description
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1675
1632
|
},
|
|
1676
|
-
options
|
|
1633
|
+
options
|
|
1677
1634
|
);
|
|
1678
1635
|
},
|
|
1679
1636
|
/** Revoke an API key */
|
|
1680
1637
|
revoke: async (id, options) => {
|
|
1681
|
-
return rb.execute(
|
|
1638
|
+
return rb.execute(
|
|
1639
|
+
patchAdminApiKeysByIdRevoke,
|
|
1640
|
+
{ path: { id } },
|
|
1641
|
+
options
|
|
1642
|
+
);
|
|
1682
1643
|
},
|
|
1683
1644
|
/** Rotate an API key */
|
|
1684
1645
|
rotate: async (id, options) => {
|
|
1685
|
-
return rb.execute(
|
|
1686
|
-
|
|
1646
|
+
return rb.execute(
|
|
1647
|
+
patchAdminApiKeysByIdRotate,
|
|
1648
|
+
{ path: { id } },
|
|
1649
|
+
options
|
|
1650
|
+
);
|
|
1651
|
+
}
|
|
1687
1652
|
};
|
|
1688
1653
|
}
|
|
1689
1654
|
|
|
@@ -1692,14 +1657,18 @@ function createDocumentsNamespace(rb) {
|
|
|
1692
1657
|
return {
|
|
1693
1658
|
/** List extraction documents */
|
|
1694
1659
|
list: async (options) => {
|
|
1695
|
-
return rb.execute(
|
|
1660
|
+
return rb.execute(
|
|
1661
|
+
getAdminExtractionDocuments,
|
|
1662
|
+
{},
|
|
1663
|
+
options
|
|
1664
|
+
);
|
|
1696
1665
|
},
|
|
1697
1666
|
/** Get a document by ID */
|
|
1698
1667
|
get: async (id, options) => {
|
|
1699
1668
|
return rb.execute(
|
|
1700
1669
|
getAdminExtractionDocumentsById,
|
|
1701
1670
|
{ path: { id } },
|
|
1702
|
-
options
|
|
1671
|
+
options
|
|
1703
1672
|
);
|
|
1704
1673
|
},
|
|
1705
1674
|
/** Get document statistics */
|
|
@@ -1709,7 +1678,7 @@ function createDocumentsNamespace(rb) {
|
|
|
1709
1678
|
/** Bulk delete documents */
|
|
1710
1679
|
bulkDelete: async (documentIds, options) => {
|
|
1711
1680
|
const validated = DocumentBulkDeleteSchema.parse({
|
|
1712
|
-
document_ids: documentIds
|
|
1681
|
+
document_ids: documentIds
|
|
1713
1682
|
});
|
|
1714
1683
|
return rb.execute(
|
|
1715
1684
|
postAdminDocumentsBulkDelete,
|
|
@@ -1718,14 +1687,14 @@ function createDocumentsNamespace(rb) {
|
|
|
1718
1687
|
data: {
|
|
1719
1688
|
type: "operation_success",
|
|
1720
1689
|
attributes: {
|
|
1721
|
-
ids: validated.document_ids
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1690
|
+
ids: validated.document_ids
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1725
1694
|
},
|
|
1726
|
-
options
|
|
1695
|
+
options
|
|
1727
1696
|
);
|
|
1728
|
-
}
|
|
1697
|
+
}
|
|
1729
1698
|
};
|
|
1730
1699
|
}
|
|
1731
1700
|
|
|
@@ -1734,44 +1703,44 @@ function addExecutionStreaming(executions, getHeaders) {
|
|
|
1734
1703
|
executions.stream = async (executionId, options) => {
|
|
1735
1704
|
const headers = {
|
|
1736
1705
|
...getHeaders(),
|
|
1737
|
-
Accept: "text/event-stream"
|
|
1706
|
+
Accept: "text/event-stream"
|
|
1738
1707
|
};
|
|
1739
1708
|
const result = await client.get({
|
|
1740
1709
|
url: `/isv/agent-executions/${executionId}/stream`,
|
|
1741
1710
|
headers,
|
|
1742
1711
|
parseAs: "stream",
|
|
1743
|
-
...
|
|
1712
|
+
...options?.signal && { signal: options.signal }
|
|
1744
1713
|
});
|
|
1745
1714
|
const envelope = result;
|
|
1746
1715
|
const streamBody = envelope.data ?? result;
|
|
1747
1716
|
const response = envelope.response;
|
|
1748
1717
|
if (response && !response.ok) {
|
|
1749
1718
|
throw new ServerError(`Stream request failed: ${response.status}`, {
|
|
1750
|
-
statusCode: response.status
|
|
1719
|
+
statusCode: response.status
|
|
1751
1720
|
});
|
|
1752
1721
|
}
|
|
1753
1722
|
if (streamBody instanceof ReadableStream) {
|
|
1754
1723
|
const syntheticResponse = new Response(streamBody, {
|
|
1755
|
-
headers: { "Content-Type": "text/event-stream" }
|
|
1724
|
+
headers: { "Content-Type": "text/event-stream" }
|
|
1756
1725
|
});
|
|
1757
1726
|
return streamMessage(syntheticResponse, {
|
|
1758
1727
|
signal: options?.signal,
|
|
1759
|
-
...options
|
|
1728
|
+
...options
|
|
1760
1729
|
});
|
|
1761
1730
|
}
|
|
1762
1731
|
if (streamBody instanceof Response) {
|
|
1763
1732
|
if (!streamBody.ok) {
|
|
1764
1733
|
throw new ServerError(`Stream request failed: ${streamBody.status}`, {
|
|
1765
|
-
statusCode: streamBody.status
|
|
1734
|
+
statusCode: streamBody.status
|
|
1766
1735
|
});
|
|
1767
1736
|
}
|
|
1768
1737
|
return streamMessage(streamBody, {
|
|
1769
1738
|
signal: options?.signal,
|
|
1770
|
-
...options
|
|
1739
|
+
...options
|
|
1771
1740
|
});
|
|
1772
1741
|
}
|
|
1773
1742
|
throw new GptCoreError("Unexpected stream response format", {
|
|
1774
|
-
code: "stream_error"
|
|
1743
|
+
code: "stream_error"
|
|
1775
1744
|
});
|
|
1776
1745
|
};
|
|
1777
1746
|
}
|
|
@@ -1781,23 +1750,33 @@ function createExecutionsNamespace(rb) {
|
|
|
1781
1750
|
const executions = {
|
|
1782
1751
|
/** Start a new agent execution */
|
|
1783
1752
|
start: async (agentId, params, options) => {
|
|
1784
|
-
return rb.rawPost(
|
|
1753
|
+
return rb.rawPost(
|
|
1754
|
+
`/isv/agents/${agentId}/execute`,
|
|
1755
|
+
params,
|
|
1756
|
+
options
|
|
1757
|
+
);
|
|
1785
1758
|
},
|
|
1786
1759
|
/** Get execution status and details */
|
|
1787
1760
|
get: async (executionId, options) => {
|
|
1788
|
-
return rb.rawGet(
|
|
1761
|
+
return rb.rawGet(
|
|
1762
|
+
`/isv/agent-executions/${executionId}`,
|
|
1763
|
+
options
|
|
1764
|
+
);
|
|
1789
1765
|
},
|
|
1790
1766
|
/** List executions for a workspace */
|
|
1791
1767
|
list: async (filters, options) => {
|
|
1792
1768
|
const query = filters?.status ? `?status=${filters.status}` : "";
|
|
1793
|
-
return rb.rawGet(
|
|
1769
|
+
return rb.rawGet(
|
|
1770
|
+
`/isv/agent-executions${query}`,
|
|
1771
|
+
options
|
|
1772
|
+
);
|
|
1794
1773
|
},
|
|
1795
1774
|
/** Cancel a running execution */
|
|
1796
1775
|
cancel: async (executionId, options) => {
|
|
1797
1776
|
return rb.rawPost(
|
|
1798
1777
|
`/isv/agent-executions/${executionId}/cancel`,
|
|
1799
1778
|
void 0,
|
|
1800
|
-
options
|
|
1779
|
+
options
|
|
1801
1780
|
);
|
|
1802
1781
|
},
|
|
1803
1782
|
/** Approve a pending tool call */
|
|
@@ -1805,7 +1784,7 @@ function createExecutionsNamespace(rb) {
|
|
|
1805
1784
|
return rb.rawPost(
|
|
1806
1785
|
`/isv/agent-executions/${executionId}/approve`,
|
|
1807
1786
|
void 0,
|
|
1808
|
-
options
|
|
1787
|
+
options
|
|
1809
1788
|
);
|
|
1810
1789
|
},
|
|
1811
1790
|
/** Deny a pending tool call */
|
|
@@ -1813,26 +1792,36 @@ function createExecutionsNamespace(rb) {
|
|
|
1813
1792
|
return rb.rawPost(
|
|
1814
1793
|
`/isv/agent-executions/${executionId}/deny`,
|
|
1815
1794
|
reason ? { reason } : void 0,
|
|
1816
|
-
options
|
|
1795
|
+
options
|
|
1817
1796
|
);
|
|
1818
1797
|
},
|
|
1819
1798
|
/** Estimate cost for executing an agent */
|
|
1820
1799
|
estimate: async (agentId, params, options) => {
|
|
1821
|
-
return rb.rawPost(
|
|
1800
|
+
return rb.rawPost(
|
|
1801
|
+
`/isv/agents/${agentId}/estimate`,
|
|
1802
|
+
params,
|
|
1803
|
+
options
|
|
1804
|
+
);
|
|
1822
1805
|
},
|
|
1823
1806
|
/** Get child executions of a parent execution */
|
|
1824
1807
|
getChildren: async (executionId, options) => {
|
|
1825
1808
|
return rb.rawGet(
|
|
1826
1809
|
`/isv/agent-executions/${executionId}/children`,
|
|
1827
|
-
options
|
|
1810
|
+
options
|
|
1828
1811
|
);
|
|
1829
1812
|
},
|
|
1830
1813
|
/** Get the execution tree rooted at a given execution */
|
|
1831
1814
|
getTree: async (executionId, options) => {
|
|
1832
|
-
return rb.rawGet(
|
|
1833
|
-
|
|
1815
|
+
return rb.rawGet(
|
|
1816
|
+
`/isv/agent-executions/${executionId}/tree`,
|
|
1817
|
+
options
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1834
1820
|
};
|
|
1835
|
-
addExecutionStreaming(
|
|
1821
|
+
addExecutionStreaming(
|
|
1822
|
+
executions,
|
|
1823
|
+
() => rb.getRequestHeaders()
|
|
1824
|
+
);
|
|
1836
1825
|
return executions;
|
|
1837
1826
|
}
|
|
1838
1827
|
|
|
@@ -1842,14 +1831,12 @@ function createStorageNamespace(rb) {
|
|
|
1842
1831
|
/** Get storage statistics */
|
|
1843
1832
|
stats: async (workspaceId, options) => {
|
|
1844
1833
|
const validated = StorageStatsRequestSchema.parse({
|
|
1845
|
-
workspace_id: workspaceId
|
|
1834
|
+
workspace_id: workspaceId
|
|
1846
1835
|
});
|
|
1847
1836
|
return rb.execute(
|
|
1848
1837
|
getAdminStorageStats,
|
|
1849
|
-
validated.workspace_id
|
|
1850
|
-
|
|
1851
|
-
: {},
|
|
1852
|
-
options,
|
|
1838
|
+
validated.workspace_id ? { query: { filter: { workspace_id: validated.workspace_id } } } : {},
|
|
1839
|
+
options
|
|
1853
1840
|
);
|
|
1854
1841
|
},
|
|
1855
1842
|
/** Bucket management */
|
|
@@ -1860,21 +1847,29 @@ function createStorageNamespace(rb) {
|
|
|
1860
1847
|
},
|
|
1861
1848
|
/** Get a bucket by ID */
|
|
1862
1849
|
get: async (id, options) => {
|
|
1863
|
-
return rb.execute(
|
|
1850
|
+
return rb.execute(
|
|
1851
|
+
getAdminBucketsById,
|
|
1852
|
+
{ path: { id } },
|
|
1853
|
+
options
|
|
1854
|
+
);
|
|
1864
1855
|
},
|
|
1865
1856
|
/** Get bucket statistics */
|
|
1866
1857
|
stats: async (id, options) => {
|
|
1867
|
-
return rb.execute(
|
|
1858
|
+
return rb.execute(
|
|
1859
|
+
getAdminBucketsByIdStats,
|
|
1860
|
+
{ path: { id } },
|
|
1861
|
+
options
|
|
1862
|
+
);
|
|
1868
1863
|
},
|
|
1869
1864
|
/** List objects in a bucket */
|
|
1870
1865
|
objects: async (id, options) => {
|
|
1871
1866
|
return rb.execute(
|
|
1872
1867
|
getAdminBucketsByIdObjects,
|
|
1873
1868
|
{ path: { id } },
|
|
1874
|
-
options
|
|
1869
|
+
options
|
|
1875
1870
|
);
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1878
1873
|
};
|
|
1879
1874
|
}
|
|
1880
1875
|
|
|
@@ -1887,15 +1882,7 @@ function createWebhooksNamespace(rb) {
|
|
|
1887
1882
|
return rb.execute(getAdminWebhookConfigs, {}, options);
|
|
1888
1883
|
},
|
|
1889
1884
|
/** Create a webhook config */
|
|
1890
|
-
create: async (
|
|
1891
|
-
name,
|
|
1892
|
-
url,
|
|
1893
|
-
events,
|
|
1894
|
-
applicationId,
|
|
1895
|
-
secret,
|
|
1896
|
-
enabled = true,
|
|
1897
|
-
options,
|
|
1898
|
-
) => {
|
|
1885
|
+
create: async (name, url, events, applicationId, secret, enabled = true, options) => {
|
|
1899
1886
|
return rb.execute(
|
|
1900
1887
|
postAdminWebhookConfigs,
|
|
1901
1888
|
{
|
|
@@ -1908,12 +1895,12 @@ function createWebhooksNamespace(rb) {
|
|
|
1908
1895
|
events,
|
|
1909
1896
|
application_id: applicationId,
|
|
1910
1897
|
secret,
|
|
1911
|
-
enabled
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1898
|
+
enabled
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1915
1902
|
},
|
|
1916
|
-
options
|
|
1903
|
+
options
|
|
1917
1904
|
);
|
|
1918
1905
|
},
|
|
1919
1906
|
/** Get a webhook config by ID */
|
|
@@ -1921,7 +1908,7 @@ function createWebhooksNamespace(rb) {
|
|
|
1921
1908
|
return rb.execute(
|
|
1922
1909
|
getAdminWebhookConfigsById,
|
|
1923
1910
|
{ path: { id } },
|
|
1924
|
-
options
|
|
1911
|
+
options
|
|
1925
1912
|
);
|
|
1926
1913
|
},
|
|
1927
1914
|
/** Update a webhook config */
|
|
@@ -1934,11 +1921,11 @@ function createWebhooksNamespace(rb) {
|
|
|
1934
1921
|
data: {
|
|
1935
1922
|
id,
|
|
1936
1923
|
type: "webhook_config",
|
|
1937
|
-
attributes: updates
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1924
|
+
attributes: updates
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1940
1927
|
},
|
|
1941
|
-
options
|
|
1928
|
+
options
|
|
1942
1929
|
);
|
|
1943
1930
|
},
|
|
1944
1931
|
/** Delete a webhook config */
|
|
@@ -1946,7 +1933,7 @@ function createWebhooksNamespace(rb) {
|
|
|
1946
1933
|
return rb.executeDelete(
|
|
1947
1934
|
deleteAdminWebhookConfigsById,
|
|
1948
1935
|
{ path: { id } },
|
|
1949
|
-
options
|
|
1936
|
+
options
|
|
1950
1937
|
);
|
|
1951
1938
|
},
|
|
1952
1939
|
/** Test a webhook config */
|
|
@@ -1954,21 +1941,25 @@ function createWebhooksNamespace(rb) {
|
|
|
1954
1941
|
return rb.execute(
|
|
1955
1942
|
postAdminWebhookConfigsByIdTest,
|
|
1956
1943
|
{ path: { id } },
|
|
1957
|
-
options
|
|
1944
|
+
options
|
|
1958
1945
|
);
|
|
1959
|
-
}
|
|
1946
|
+
}
|
|
1960
1947
|
},
|
|
1961
1948
|
deliveries: {
|
|
1962
1949
|
/** List webhook deliveries */
|
|
1963
1950
|
list: async (options) => {
|
|
1964
|
-
return rb.execute(
|
|
1951
|
+
return rb.execute(
|
|
1952
|
+
getAdminWebhookDeliveries,
|
|
1953
|
+
{},
|
|
1954
|
+
options
|
|
1955
|
+
);
|
|
1965
1956
|
},
|
|
1966
1957
|
/** Get a webhook delivery by ID */
|
|
1967
1958
|
get: async (id, options) => {
|
|
1968
1959
|
return rb.execute(
|
|
1969
1960
|
getAdminWebhookDeliveriesById,
|
|
1970
1961
|
{ path: { id } },
|
|
1971
|
-
options
|
|
1962
|
+
options
|
|
1972
1963
|
);
|
|
1973
1964
|
},
|
|
1974
1965
|
/** Retry a webhook delivery */
|
|
@@ -1976,10 +1967,10 @@ function createWebhooksNamespace(rb) {
|
|
|
1976
1967
|
return rb.execute(
|
|
1977
1968
|
postAdminWebhookDeliveriesByIdRetry,
|
|
1978
1969
|
{ path: { id } },
|
|
1979
|
-
options
|
|
1970
|
+
options
|
|
1980
1971
|
);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1983
1974
|
};
|
|
1984
1975
|
}
|
|
1985
1976
|
|
|
@@ -1991,7 +1982,7 @@ var GptAdmin = class extends BaseClient {
|
|
|
1991
1982
|
this.clientInstance,
|
|
1992
1983
|
() => this.getHeaders(),
|
|
1993
1984
|
(d) => this.unwrap(d),
|
|
1994
|
-
(fn) => this.requestWithRetry(fn)
|
|
1985
|
+
(fn) => this.requestWithRetry(fn)
|
|
1995
1986
|
);
|
|
1996
1987
|
this.accounts = createAccountsNamespace(rb);
|
|
1997
1988
|
this.apiKeys = createApiKeysNamespace(rb);
|
|
@@ -2028,5 +2019,6 @@ export {
|
|
|
2028
2019
|
WebhookConfigCreateSchema,
|
|
2029
2020
|
WebhookDeliveryBulkRetrySchema,
|
|
2030
2021
|
index_default as default,
|
|
2031
|
-
handleApiError
|
|
2022
|
+
handleApiError
|
|
2032
2023
|
};
|
|
2024
|
+
//# sourceMappingURL=index.mjs.map
|