@perstack/api-client 0.0.48 → 0.0.50
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/{bundle.d.mts → index.d.mts} +591 -1040
- package/dist/index.d.mts.map +1 -0
- package/dist/{bundle.mjs → index.mjs} +769 -1159
- package/dist/index.mjs.map +1 -0
- package/package.json +6 -8
- package/dist/bundle.d.mts.map +0 -1
- package/dist/bundle.mjs.map +0 -1
|
@@ -2,6 +2,414 @@ import { r as __toESM, t as __commonJSMin } from "./chunk-Bdv87wj9.mjs";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { activityOrGroupSchema, checkpointSchema as perstackCheckpointSchema, instructionMessageSchema, messageSchema, stepSchema, toolCallSchema, toolMessageSchema, toolResultSchema, usageSchema, userMessageSchema } from "@perstack/core";
|
|
4
4
|
|
|
5
|
+
//#region src/lib/api-key.ts
|
|
6
|
+
function matchWildcard(value, pattern) {
|
|
7
|
+
if (pattern === "*") return true;
|
|
8
|
+
if (pattern.endsWith("*")) return value.startsWith(pattern.slice(0, -1));
|
|
9
|
+
if (pattern.startsWith("*")) return value.endsWith(pattern.slice(1));
|
|
10
|
+
return value === pattern;
|
|
11
|
+
}
|
|
12
|
+
function matchOperations(operations, requiredOperation) {
|
|
13
|
+
return operations.some((pattern) => matchWildcard(requiredOperation, pattern));
|
|
14
|
+
}
|
|
15
|
+
function matchExperts(experts, expertId) {
|
|
16
|
+
if (experts === void 0 || experts === "*") return true;
|
|
17
|
+
return experts.some((pattern) => matchWildcard(expertId, pattern));
|
|
18
|
+
}
|
|
19
|
+
function isApiKeyPermissions(parsed) {
|
|
20
|
+
return typeof parsed === "object" && parsed !== null && "operations" in parsed && Array.isArray(parsed.operations);
|
|
21
|
+
}
|
|
22
|
+
function parseApiKeyPermissions(permissionsJson) {
|
|
23
|
+
if (!permissionsJson) return null;
|
|
24
|
+
try {
|
|
25
|
+
const parsed = JSON.parse(permissionsJson);
|
|
26
|
+
if (!isApiKeyPermissions(parsed)) return null;
|
|
27
|
+
return parsed;
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function stringifyApiKeyPermissions(permissions) {
|
|
33
|
+
return JSON.stringify(permissions);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/lib/auth.ts
|
|
38
|
+
function buildAuthHeaders(auth) {
|
|
39
|
+
if (auth.type === "apiKey") return { Authorization: `Bearer ${auth.apiKey}` };
|
|
40
|
+
return { Cookie: auth.cookie };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/lib/errors.ts
|
|
45
|
+
function createValidationError(error) {
|
|
46
|
+
return {
|
|
47
|
+
errorType: "validation",
|
|
48
|
+
code: 400,
|
|
49
|
+
message: `Validation failed: ${error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`,
|
|
50
|
+
reason: error.issues
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function createAbortError() {
|
|
54
|
+
return {
|
|
55
|
+
errorType: "abort",
|
|
56
|
+
code: 0,
|
|
57
|
+
message: "Request aborted",
|
|
58
|
+
aborted: true
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createTimeoutError() {
|
|
62
|
+
return {
|
|
63
|
+
errorType: "timeout",
|
|
64
|
+
code: 0,
|
|
65
|
+
message: "Request timed out"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createNetworkError(error) {
|
|
69
|
+
return {
|
|
70
|
+
errorType: "network",
|
|
71
|
+
code: 0,
|
|
72
|
+
message: error instanceof Error ? error.message : "Network error",
|
|
73
|
+
reason: error,
|
|
74
|
+
cause: error instanceof Error ? error : void 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function handleHttpError(response$23) {
|
|
78
|
+
let errorBody;
|
|
79
|
+
try {
|
|
80
|
+
errorBody = await response$23.json();
|
|
81
|
+
} catch {
|
|
82
|
+
errorBody = void 0;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
ok: false,
|
|
86
|
+
error: createHttpError(response$23.status, response$23.statusText, errorBody)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function createHttpError(status, statusText, body) {
|
|
90
|
+
if (typeof body === "object" && body !== null) {
|
|
91
|
+
const hasReason = "reason" in body;
|
|
92
|
+
if ("error" in body && typeof body.error === "string") return {
|
|
93
|
+
errorType: "http",
|
|
94
|
+
code: status,
|
|
95
|
+
message: body.error,
|
|
96
|
+
reason: hasReason ? body.reason : void 0
|
|
97
|
+
};
|
|
98
|
+
if (hasReason) return {
|
|
99
|
+
errorType: "http",
|
|
100
|
+
code: status,
|
|
101
|
+
message: statusText,
|
|
102
|
+
reason: body.reason
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
errorType: "http",
|
|
107
|
+
code: status,
|
|
108
|
+
message: statusText
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function isHttpError(error) {
|
|
112
|
+
return error.errorType === "http";
|
|
113
|
+
}
|
|
114
|
+
function isNetworkError(error) {
|
|
115
|
+
return error.errorType === "network";
|
|
116
|
+
}
|
|
117
|
+
function isTimeoutError(error) {
|
|
118
|
+
return error.errorType === "timeout";
|
|
119
|
+
}
|
|
120
|
+
function isValidationError(error) {
|
|
121
|
+
return error.errorType === "validation";
|
|
122
|
+
}
|
|
123
|
+
function isAbortError(error) {
|
|
124
|
+
return error.errorType === "abort";
|
|
125
|
+
}
|
|
126
|
+
function isClientError(error) {
|
|
127
|
+
return error.errorType !== "http";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/lib/fetcher.ts
|
|
132
|
+
const DEFAULT_BASE_URL = "https://api.perstack.ai";
|
|
133
|
+
const DEFAULT_TIMEOUT = 3e4;
|
|
134
|
+
function createFetcher(config) {
|
|
135
|
+
const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
136
|
+
const timeout = config.timeout ?? DEFAULT_TIMEOUT;
|
|
137
|
+
const useCredentials = "credentials" in config && config.credentials === "include";
|
|
138
|
+
const apiKey = "apiKey" in config ? config.apiKey : void 0;
|
|
139
|
+
function buildUrl(path) {
|
|
140
|
+
return `${baseUrl}${path}`;
|
|
141
|
+
}
|
|
142
|
+
function buildHeaders(options) {
|
|
143
|
+
const headers = {};
|
|
144
|
+
if (options?.hasBody) headers["Content-Type"] = "application/json";
|
|
145
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
146
|
+
return headers;
|
|
147
|
+
}
|
|
148
|
+
function getCredentials() {
|
|
149
|
+
return useCredentials ? "include" : void 0;
|
|
150
|
+
}
|
|
151
|
+
function createTimeoutSignal(externalSignal) {
|
|
152
|
+
const controller = new AbortController();
|
|
153
|
+
let timedOut = false;
|
|
154
|
+
const timeoutId = setTimeout(() => {
|
|
155
|
+
timedOut = true;
|
|
156
|
+
controller.abort();
|
|
157
|
+
}, timeout);
|
|
158
|
+
let abortHandler;
|
|
159
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
160
|
+
else {
|
|
161
|
+
abortHandler = () => controller.abort();
|
|
162
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
signal: controller.signal,
|
|
166
|
+
cleanup: () => {
|
|
167
|
+
clearTimeout(timeoutId);
|
|
168
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
169
|
+
},
|
|
170
|
+
isTimeout: () => timedOut
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function wrapStreamWithIdleTimeout(stream, idleTimeoutMs, externalSignal) {
|
|
174
|
+
const reader = stream.getReader();
|
|
175
|
+
const controller = new AbortController();
|
|
176
|
+
let timeoutId;
|
|
177
|
+
let abortHandler;
|
|
178
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
179
|
+
else {
|
|
180
|
+
abortHandler = () => controller.abort();
|
|
181
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
182
|
+
}
|
|
183
|
+
function resetTimeout() {
|
|
184
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
185
|
+
timeoutId = setTimeout(() => controller.abort(), idleTimeoutMs);
|
|
186
|
+
}
|
|
187
|
+
function cleanup() {
|
|
188
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
189
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
190
|
+
}
|
|
191
|
+
return new ReadableStream({
|
|
192
|
+
start() {
|
|
193
|
+
resetTimeout();
|
|
194
|
+
},
|
|
195
|
+
async pull(streamController) {
|
|
196
|
+
try {
|
|
197
|
+
const result = await Promise.race([reader.read(), new Promise((_, reject) => {
|
|
198
|
+
if (controller.signal.aborted) reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
199
|
+
controller.signal.addEventListener("abort", () => {
|
|
200
|
+
reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
201
|
+
});
|
|
202
|
+
})]);
|
|
203
|
+
if (result.done) {
|
|
204
|
+
cleanup();
|
|
205
|
+
streamController.close();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
resetTimeout();
|
|
209
|
+
streamController.enqueue(result.value);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
cleanup();
|
|
212
|
+
reader.cancel().catch(() => {});
|
|
213
|
+
if (error instanceof DOMException && error.name === "AbortError") streamController.error(new DOMException("Stream idle timeout", "AbortError"));
|
|
214
|
+
else streamController.error(error);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
cancel(reason) {
|
|
218
|
+
cleanup();
|
|
219
|
+
reader.cancel(reason).catch(() => {});
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
async function request$23(method, path, body, options) {
|
|
224
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
225
|
+
try {
|
|
226
|
+
const response$23 = await fetch(buildUrl(path), {
|
|
227
|
+
method,
|
|
228
|
+
headers: buildHeaders(body ? { hasBody: true } : void 0),
|
|
229
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
230
|
+
signal,
|
|
231
|
+
credentials: getCredentials()
|
|
232
|
+
});
|
|
233
|
+
if (!response$23.ok) return handleHttpError(response$23);
|
|
234
|
+
return {
|
|
235
|
+
ok: true,
|
|
236
|
+
data: await response$23.json()
|
|
237
|
+
};
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
240
|
+
if (isTimeout()) return {
|
|
241
|
+
ok: false,
|
|
242
|
+
error: createTimeoutError()
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
ok: false,
|
|
246
|
+
error: createAbortError()
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
ok: false,
|
|
251
|
+
error: createNetworkError(error)
|
|
252
|
+
};
|
|
253
|
+
} finally {
|
|
254
|
+
cleanup();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async function requestBlob(path, options) {
|
|
258
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
259
|
+
try {
|
|
260
|
+
const response$23 = await fetch(buildUrl(path), {
|
|
261
|
+
method: "GET",
|
|
262
|
+
headers: buildHeaders(),
|
|
263
|
+
signal,
|
|
264
|
+
credentials: getCredentials()
|
|
265
|
+
});
|
|
266
|
+
if (!response$23.ok) return handleHttpError(response$23);
|
|
267
|
+
return {
|
|
268
|
+
ok: true,
|
|
269
|
+
data: await response$23.blob()
|
|
270
|
+
};
|
|
271
|
+
} catch (error) {
|
|
272
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
273
|
+
if (isTimeout()) return {
|
|
274
|
+
ok: false,
|
|
275
|
+
error: createTimeoutError()
|
|
276
|
+
};
|
|
277
|
+
return {
|
|
278
|
+
ok: false,
|
|
279
|
+
error: createAbortError()
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
ok: false,
|
|
284
|
+
error: createNetworkError(error)
|
|
285
|
+
};
|
|
286
|
+
} finally {
|
|
287
|
+
cleanup();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async function requestStream(path, options) {
|
|
291
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
292
|
+
try {
|
|
293
|
+
const response$23 = await fetch(buildUrl(path), {
|
|
294
|
+
method: "GET",
|
|
295
|
+
headers: buildHeaders(),
|
|
296
|
+
signal,
|
|
297
|
+
credentials: getCredentials()
|
|
298
|
+
});
|
|
299
|
+
if (!response$23.ok) {
|
|
300
|
+
cleanup();
|
|
301
|
+
return handleHttpError(response$23);
|
|
302
|
+
}
|
|
303
|
+
if (!response$23.body) {
|
|
304
|
+
cleanup();
|
|
305
|
+
return {
|
|
306
|
+
ok: false,
|
|
307
|
+
error: createNetworkError(/* @__PURE__ */ new Error("Response body is null"))
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
cleanup();
|
|
311
|
+
const idleTimeout = options?.streamIdleTimeout ?? timeout;
|
|
312
|
+
return {
|
|
313
|
+
ok: true,
|
|
314
|
+
data: wrapStreamWithIdleTimeout(response$23.body, idleTimeout, options?.signal)
|
|
315
|
+
};
|
|
316
|
+
} catch (error) {
|
|
317
|
+
cleanup();
|
|
318
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
319
|
+
if (isTimeout()) return {
|
|
320
|
+
ok: false,
|
|
321
|
+
error: createTimeoutError()
|
|
322
|
+
};
|
|
323
|
+
return {
|
|
324
|
+
ok: false,
|
|
325
|
+
error: createAbortError()
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
ok: false,
|
|
330
|
+
error: createNetworkError(error)
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async function requestNoContent(method, path, options) {
|
|
335
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
336
|
+
try {
|
|
337
|
+
const response$23 = await fetch(buildUrl(path), {
|
|
338
|
+
method,
|
|
339
|
+
headers: buildHeaders(),
|
|
340
|
+
signal,
|
|
341
|
+
credentials: getCredentials()
|
|
342
|
+
});
|
|
343
|
+
if (!response$23.ok) return handleHttpError(response$23);
|
|
344
|
+
return {
|
|
345
|
+
ok: true,
|
|
346
|
+
data: void 0
|
|
347
|
+
};
|
|
348
|
+
} catch (error) {
|
|
349
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
350
|
+
if (isTimeout()) return {
|
|
351
|
+
ok: false,
|
|
352
|
+
error: createTimeoutError()
|
|
353
|
+
};
|
|
354
|
+
return {
|
|
355
|
+
ok: false,
|
|
356
|
+
error: createAbortError()
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
ok: false,
|
|
361
|
+
error: createNetworkError(error)
|
|
362
|
+
};
|
|
363
|
+
} finally {
|
|
364
|
+
cleanup();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
get: (path, options) => request$23("GET", path, void 0, options),
|
|
369
|
+
post: (path, body, options) => request$23("POST", path, body, options),
|
|
370
|
+
put: (path, body, options) => request$23("PUT", path, body, options),
|
|
371
|
+
delete: (path, options) => request$23("DELETE", path, void 0, options),
|
|
372
|
+
deleteNoContent: (path, options) => requestNoContent("DELETE", path, options),
|
|
373
|
+
getBlob: (path, options) => requestBlob(path, options),
|
|
374
|
+
getStream: (path, options) => requestStream(path, options)
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/lib/query-string.ts
|
|
380
|
+
function buildQueryString(params) {
|
|
381
|
+
if (!params) return "";
|
|
382
|
+
const searchParams = new URLSearchParams();
|
|
383
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0) searchParams.set(key, String(value));
|
|
384
|
+
const queryString = searchParams.toString();
|
|
385
|
+
return queryString ? `?${queryString}` : "";
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/lib/sse.ts
|
|
390
|
+
async function* parseSSE(reader) {
|
|
391
|
+
const decoder = new TextDecoder();
|
|
392
|
+
let buffer = "";
|
|
393
|
+
while (true) {
|
|
394
|
+
const { value, done } = await reader.read();
|
|
395
|
+
if (done) break;
|
|
396
|
+
buffer += decoder.decode(value, { stream: true });
|
|
397
|
+
const events = buffer.split("\n\n");
|
|
398
|
+
buffer = events.pop() || "";
|
|
399
|
+
for (const event of events) {
|
|
400
|
+
if (event.trim() === "") continue;
|
|
401
|
+
const lines = event.split("\n");
|
|
402
|
+
const eventType = lines.find((line) => line.startsWith("event:"))?.slice(6).trim();
|
|
403
|
+
const data = lines.find((line) => line.startsWith("data:"))?.slice(5).trim();
|
|
404
|
+
if (eventType !== "message" || !data) continue;
|
|
405
|
+
try {
|
|
406
|
+
yield JSON.parse(data);
|
|
407
|
+
} catch {}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
//#endregion
|
|
5
413
|
//#region ../constants/index.ts
|
|
6
414
|
const organizationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
7
415
|
const maxOrganizationNameLength = 128;
|
|
@@ -44,13 +452,13 @@ const maxProviderHeadersCount = 50;
|
|
|
44
452
|
|
|
45
453
|
//#endregion
|
|
46
454
|
//#region ../models/src/domain/common.ts
|
|
47
|
-
const cuidSchema = z.cuid2();
|
|
455
|
+
const cuidSchema = z.string().cuid2();
|
|
456
|
+
const cuidRequestSchema = z.string().min(24).cuid2();
|
|
48
457
|
const runtimeVersionSchema = z.enum(["v1.0"]);
|
|
49
458
|
const providerSchema = z.enum([
|
|
50
459
|
"anthropic",
|
|
51
460
|
"google",
|
|
52
461
|
"openai",
|
|
53
|
-
"ollama",
|
|
54
462
|
"deepseek",
|
|
55
463
|
"azure-openai",
|
|
56
464
|
"amazon-bedrock",
|
|
@@ -154,7 +562,7 @@ const createApiKeyResponseSchema = z.object({
|
|
|
154
562
|
|
|
155
563
|
//#endregion
|
|
156
564
|
//#region ../models/src/api/api-keys/create.ts
|
|
157
|
-
const request$
|
|
565
|
+
const request$22 = { body: z.object({
|
|
158
566
|
name: z.string().min(1).max(255).optional(),
|
|
159
567
|
operations: z.array(z.string()).optional(),
|
|
160
568
|
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
@@ -162,7 +570,7 @@ const request$49 = { body: z.object({
|
|
|
162
570
|
applicationIds: z.array(cuidSchema).optional(),
|
|
163
571
|
expiresIn: z.number().min(60).optional()
|
|
164
572
|
}) };
|
|
165
|
-
const response$
|
|
573
|
+
const response$22 = z.object({ data: z.object({
|
|
166
574
|
apiKey: apiKeySchema.extend({
|
|
167
575
|
permissions: apiKeyPermissionsSchema.optional(),
|
|
168
576
|
wildcardApplicationAccess: z.boolean(),
|
|
@@ -173,8 +581,8 @@ const response$51 = z.object({ data: z.object({
|
|
|
173
581
|
|
|
174
582
|
//#endregion
|
|
175
583
|
//#region ../models/src/api/api-keys/get.ts
|
|
176
|
-
const request$
|
|
177
|
-
const response$
|
|
584
|
+
const request$21 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
585
|
+
const response$21 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
178
586
|
permissions: apiKeyPermissionsSchema.optional(),
|
|
179
587
|
wildcardApplicationAccess: z.boolean(),
|
|
180
588
|
applicationIds: z.array(cuidSchema)
|
|
@@ -266,25 +674,24 @@ const errorUnauthorizedFlexible = z.object({
|
|
|
266
674
|
}).describe("Unauthorized");
|
|
267
675
|
|
|
268
676
|
//#endregion
|
|
269
|
-
//#region ../models/src/api/api-keys/
|
|
270
|
-
const request$
|
|
271
|
-
|
|
272
|
-
skip: z.coerce.number().min(0).default(0)
|
|
273
|
-
}) };
|
|
274
|
-
const apiKeyWithApplicationsSchema = apiKeySchema.extend({
|
|
677
|
+
//#region ../models/src/api/api-keys/revoke.ts
|
|
678
|
+
const request$20 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
679
|
+
const response$20 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
275
680
|
permissions: apiKeyPermissionsSchema.optional(),
|
|
276
681
|
wildcardApplicationAccess: z.boolean(),
|
|
277
682
|
applicationIds: z.array(cuidSchema)
|
|
278
|
-
});
|
|
279
|
-
const response$49 = z.object({
|
|
280
|
-
data: z.object({ apiKeys: z.array(apiKeyWithApplicationsSchema) }),
|
|
281
|
-
meta: paginationMeta
|
|
282
|
-
});
|
|
683
|
+
}) }) });
|
|
283
684
|
|
|
284
685
|
//#endregion
|
|
285
|
-
//#region ../models/src/api/api-keys/
|
|
286
|
-
const request$
|
|
287
|
-
|
|
686
|
+
//#region ../models/src/api/api-keys/update.ts
|
|
687
|
+
const request$19 = {
|
|
688
|
+
params: z.object({ apiKeyId: cuidSchema }),
|
|
689
|
+
body: z.object({
|
|
690
|
+
applicationIds: z.array(cuidSchema).optional(),
|
|
691
|
+
wildcardApplicationAccess: z.boolean().optional()
|
|
692
|
+
})
|
|
693
|
+
};
|
|
694
|
+
const response$19 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
288
695
|
permissions: apiKeyPermissionsSchema.optional(),
|
|
289
696
|
wildcardApplicationAccess: z.boolean(),
|
|
290
697
|
applicationIds: z.array(cuidSchema)
|
|
@@ -313,25 +720,15 @@ const applicationSchema = z.object({
|
|
|
313
720
|
|
|
314
721
|
//#endregion
|
|
315
722
|
//#region ../models/src/api/applications/create.ts
|
|
316
|
-
const request$
|
|
723
|
+
const request$18 = { body: z.object({
|
|
317
724
|
name: applicationNameSchema,
|
|
318
725
|
applicationGroupId: cuidSchema.optional()
|
|
319
726
|
}) };
|
|
320
|
-
const response$
|
|
321
|
-
|
|
322
|
-
//#endregion
|
|
323
|
-
//#region ../models/src/api/applications/delete.ts
|
|
324
|
-
const request$44 = { params: z.object({ applicationId: cuidSchema }) };
|
|
325
|
-
const response$46 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
326
|
-
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region ../models/src/api/applications/get.ts
|
|
329
|
-
const request$43 = { params: z.object({ applicationId: cuidSchema }) };
|
|
330
|
-
const response$45 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
727
|
+
const response$18 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
331
728
|
|
|
332
729
|
//#endregion
|
|
333
730
|
//#region ../models/src/api/applications/getAll.ts
|
|
334
|
-
const request$
|
|
731
|
+
const request$17 = { query: z.object({
|
|
335
732
|
name: z.union([z.string(), z.array(z.string())]).optional().transform((v) => Array.isArray(v) ? v.join(",") : v),
|
|
336
733
|
sort: z.enum([
|
|
337
734
|
"name",
|
|
@@ -342,21 +739,21 @@ const request$42 = { query: z.object({
|
|
|
342
739
|
take: z.coerce.number().min(1).max(100).default(20),
|
|
343
740
|
skip: z.coerce.number().min(0).default(0)
|
|
344
741
|
}) };
|
|
345
|
-
const response$
|
|
742
|
+
const response$17 = z.object({
|
|
346
743
|
data: z.object({ applications: z.array(applicationSchema) }),
|
|
347
744
|
meta: paginationMeta
|
|
348
745
|
});
|
|
349
746
|
|
|
350
747
|
//#endregion
|
|
351
748
|
//#region ../models/src/api/applications/update.ts
|
|
352
|
-
const request$
|
|
749
|
+
const request$16 = {
|
|
353
750
|
params: z.object({ applicationId: cuidSchema }),
|
|
354
751
|
body: z.object({
|
|
355
752
|
name: applicationNameSchema.optional(),
|
|
356
753
|
status: applicationStatusSchema.exclude(["deleted"]).optional()
|
|
357
754
|
}).refine((data) => data.name !== void 0 || data.status !== void 0, { message: "At least one field must be provided" })
|
|
358
755
|
};
|
|
359
|
-
const response$
|
|
756
|
+
const response$16 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
360
757
|
|
|
361
758
|
//#endregion
|
|
362
759
|
//#region ../models/src/domain/secret.ts
|
|
@@ -378,44 +775,28 @@ const secretSchema = z.object({
|
|
|
378
775
|
|
|
379
776
|
//#endregion
|
|
380
777
|
//#region ../models/src/api/env/secrets/create.ts
|
|
381
|
-
const request$
|
|
778
|
+
const request$15 = { body: z.object({
|
|
382
779
|
applicationId: cuidSchema,
|
|
383
780
|
name: secretNameSchema,
|
|
384
781
|
value: secretValueSchema
|
|
385
782
|
}) };
|
|
386
|
-
const response$
|
|
387
|
-
|
|
388
|
-
//#endregion
|
|
389
|
-
//#region ../models/src/api/env/secrets/delete.ts
|
|
390
|
-
const request$39 = {
|
|
391
|
-
params: z.object({ name: z.string().min(1) }),
|
|
392
|
-
query: z.object({ applicationId: cuidSchema })
|
|
393
|
-
};
|
|
394
|
-
const response$41 = z.null();
|
|
395
|
-
|
|
396
|
-
//#endregion
|
|
397
|
-
//#region ../models/src/api/env/secrets/get.ts
|
|
398
|
-
const request$38 = {
|
|
399
|
-
params: z.object({ name: z.string().min(1) }),
|
|
400
|
-
query: z.object({ applicationId: cuidSchema })
|
|
401
|
-
};
|
|
402
|
-
const response$40 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
783
|
+
const response$15 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
403
784
|
|
|
404
785
|
//#endregion
|
|
405
786
|
//#region ../models/src/api/env/secrets/getAll.ts
|
|
406
|
-
const request$
|
|
407
|
-
const response$
|
|
787
|
+
const request$14 = { query: z.object({ applicationId: cuidSchema.optional() }) };
|
|
788
|
+
const response$14 = z.object({ data: z.object({ secrets: z.array(secretMetadataSchema) }) });
|
|
408
789
|
|
|
409
790
|
//#endregion
|
|
410
791
|
//#region ../models/src/api/env/secrets/update.ts
|
|
411
|
-
const request$
|
|
792
|
+
const request$13 = {
|
|
412
793
|
params: z.object({ name: z.string().min(1) }),
|
|
413
794
|
body: z.object({
|
|
414
795
|
applicationId: cuidSchema,
|
|
415
796
|
value: secretValueSchema
|
|
416
797
|
})
|
|
417
798
|
};
|
|
418
|
-
const response$
|
|
799
|
+
const response$13 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
419
800
|
|
|
420
801
|
//#endregion
|
|
421
802
|
//#region ../models/src/domain/variable.ts
|
|
@@ -439,44 +820,28 @@ const variableResponseSchema = z.object({
|
|
|
439
820
|
|
|
440
821
|
//#endregion
|
|
441
822
|
//#region ../models/src/api/env/variables/create.ts
|
|
442
|
-
const request$
|
|
823
|
+
const request$12 = { body: z.object({
|
|
443
824
|
applicationId: cuidSchema,
|
|
444
825
|
name: variableNameSchema,
|
|
445
826
|
value: variableValueSchema
|
|
446
827
|
}) };
|
|
447
|
-
const response$
|
|
448
|
-
|
|
449
|
-
//#endregion
|
|
450
|
-
//#region ../models/src/api/env/variables/delete.ts
|
|
451
|
-
const request$34 = {
|
|
452
|
-
params: z.object({ name: z.string().min(1) }),
|
|
453
|
-
query: z.object({ applicationId: cuidSchema })
|
|
454
|
-
};
|
|
455
|
-
const response$36 = z.null();
|
|
456
|
-
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region ../models/src/api/env/variables/get.ts
|
|
459
|
-
const request$33 = {
|
|
460
|
-
params: z.object({ name: z.string().min(1) }),
|
|
461
|
-
query: z.object({ applicationId: cuidSchema })
|
|
462
|
-
};
|
|
463
|
-
const response$35 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
828
|
+
const response$12 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
464
829
|
|
|
465
830
|
//#endregion
|
|
466
831
|
//#region ../models/src/api/env/variables/getAll.ts
|
|
467
|
-
const request$
|
|
468
|
-
const response$
|
|
832
|
+
const request$11 = { query: z.object({ applicationId: cuidSchema }) };
|
|
833
|
+
const response$11 = z.object({ data: z.object({ variables: z.array(variableResponseSchema) }) });
|
|
469
834
|
|
|
470
835
|
//#endregion
|
|
471
836
|
//#region ../models/src/api/env/variables/update.ts
|
|
472
|
-
const request$
|
|
837
|
+
const request$10 = {
|
|
473
838
|
params: z.object({ name: z.string().min(1) }),
|
|
474
839
|
body: z.object({
|
|
475
840
|
applicationId: cuidSchema,
|
|
476
841
|
value: variableValueSchema
|
|
477
842
|
})
|
|
478
843
|
};
|
|
479
|
-
const response$
|
|
844
|
+
const response$10 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
480
845
|
|
|
481
846
|
//#endregion
|
|
482
847
|
//#region ../models/src/domain/expertScope.ts
|
|
@@ -484,6 +849,7 @@ const expertScopeSchema = z.object({
|
|
|
484
849
|
id: cuidSchema,
|
|
485
850
|
name: scopeNameSchema,
|
|
486
851
|
organizationId: cuidSchema,
|
|
852
|
+
expertDraftScopeId: cuidSchema,
|
|
487
853
|
published: z.boolean(),
|
|
488
854
|
publishedAt: datetimeSchema.optional(),
|
|
489
855
|
category: expertCategoryFieldSchema,
|
|
@@ -602,171 +968,9 @@ const expertWithMetadataSchema = expertSchema.extend({
|
|
|
602
968
|
version: expertVersionSchema
|
|
603
969
|
});
|
|
604
970
|
|
|
605
|
-
//#endregion
|
|
606
|
-
//#region ../models/src/api/experts/definition.ts
|
|
607
|
-
const expertDefinitionSchema = z.object({
|
|
608
|
-
name: expertNameFieldSchema,
|
|
609
|
-
version: expertVersionFieldSchema,
|
|
610
|
-
organizationId: cuidSchema,
|
|
611
|
-
createdAt: datetimeSchema,
|
|
612
|
-
updatedAt: datetimeSchema,
|
|
613
|
-
createdBy: cuidSchema,
|
|
614
|
-
updatedBy: cuidSchema,
|
|
615
|
-
experts: z.record(expertKeyFieldSchema, expertSchema.omit({ key: true }))
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
//#endregion
|
|
619
|
-
//#region ../models/src/api/experts/delete.ts
|
|
620
|
-
const request$30 = { params: z.object({ scopeName: scopeNameRefSchema }) };
|
|
621
|
-
const response$32 = z.object({ data: expertMetadataSchema.extend({
|
|
622
|
-
yanked: z.literal(true),
|
|
623
|
-
latestTagUpdated: z.boolean()
|
|
624
|
-
}) });
|
|
625
|
-
|
|
626
|
-
//#endregion
|
|
627
|
-
//#region ../models/src/domain/expertDraftScope.ts
|
|
628
|
-
const expertDraftScopeSchema = z.object({
|
|
629
|
-
id: cuidSchema,
|
|
630
|
-
name: scopeNameSchema,
|
|
631
|
-
organizationId: cuidSchema,
|
|
632
|
-
applicationId: cuidSchema,
|
|
633
|
-
totalRuns: z.number().int().min(0),
|
|
634
|
-
totalJobs: z.number().int().min(0),
|
|
635
|
-
createdAt: datetimeSchema,
|
|
636
|
-
updatedAt: datetimeSchema,
|
|
637
|
-
createdBy: cuidSchema,
|
|
638
|
-
updatedBy: cuidSchema
|
|
639
|
-
});
|
|
640
|
-
const expertDraftRefSchema = z.object({
|
|
641
|
-
id: cuidSchema,
|
|
642
|
-
expertDraftScopeId: cuidSchema,
|
|
643
|
-
totalRuns: z.number().int().min(0),
|
|
644
|
-
totalJobs: z.number().int().min(0),
|
|
645
|
-
createdAt: datetimeSchema,
|
|
646
|
-
updatedAt: datetimeSchema,
|
|
647
|
-
createdBy: cuidSchema,
|
|
648
|
-
updatedBy: cuidSchema
|
|
649
|
-
});
|
|
650
|
-
const expertDraftScopeWithRefsSchema = expertDraftScopeSchema.extend({ draftRefs: z.array(expertDraftRefSchema) });
|
|
651
|
-
|
|
652
|
-
//#endregion
|
|
653
|
-
//#region ../models/src/api/experts/drafts/definition.ts
|
|
654
|
-
const expertDefinitionContentSchema = z.object({
|
|
655
|
-
name: expertNameFieldSchema,
|
|
656
|
-
version: z.literal("0.0.0-draft"),
|
|
657
|
-
applicationId: cuidSchema,
|
|
658
|
-
createdAt: datetimeSchema,
|
|
659
|
-
updatedAt: datetimeSchema,
|
|
660
|
-
createdBy: cuidSchema,
|
|
661
|
-
updatedBy: cuidSchema,
|
|
662
|
-
experts: z.record(expertKeyFieldSchema, expertSchema.omit({ key: true }))
|
|
663
|
-
});
|
|
664
|
-
|
|
665
|
-
//#endregion
|
|
666
|
-
//#region ../models/src/api/experts/drafts/create.ts
|
|
667
|
-
const request$29 = {
|
|
668
|
-
params: z.object({ scopeName: scopeNameSchema }),
|
|
669
|
-
body: z.object({
|
|
670
|
-
applicationId: cuidSchema,
|
|
671
|
-
experts: z.array(expertSchema)
|
|
672
|
-
})
|
|
673
|
-
};
|
|
674
|
-
const response$31 = z.object({ data: z.object({
|
|
675
|
-
scope: expertDraftScopeSchema,
|
|
676
|
-
draftRef: expertDraftRefSchema,
|
|
677
|
-
definition: expertDefinitionContentSchema
|
|
678
|
-
}) });
|
|
679
|
-
|
|
680
|
-
//#endregion
|
|
681
|
-
//#region ../models/src/api/experts/drafts/delete.ts
|
|
682
|
-
const request$28 = { params: z.object({
|
|
683
|
-
scopeName: scopeNameSchema,
|
|
684
|
-
draftRef: expertDraftRefSchema.shape.id
|
|
685
|
-
}) };
|
|
686
|
-
const response$30 = z.object({ data: z.object({
|
|
687
|
-
deleted: z.boolean(),
|
|
688
|
-
draftRef: z.string()
|
|
689
|
-
}) });
|
|
690
|
-
|
|
691
|
-
//#endregion
|
|
692
|
-
//#region ../models/src/api/experts/drafts/get.ts
|
|
693
|
-
const request$27 = { params: z.object({
|
|
694
|
-
scopeName: scopeNameSchema,
|
|
695
|
-
draftRef: expertDraftRefSchema.shape.id
|
|
696
|
-
}) };
|
|
697
|
-
const response$29 = z.object({ data: z.object({
|
|
698
|
-
scope: expertDraftScopeSchema,
|
|
699
|
-
draftRef: expertDraftRefSchema,
|
|
700
|
-
definition: expertDefinitionContentSchema
|
|
701
|
-
}) });
|
|
702
|
-
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region ../models/src/api/experts/drafts/getAll.ts
|
|
705
|
-
const request$26 = {
|
|
706
|
-
params: z.object({ scopeName: expertDraftScopeSchema.shape.name }),
|
|
707
|
-
query: z.object({
|
|
708
|
-
take: z.coerce.number().int().min(1).max(100).default(20),
|
|
709
|
-
skip: z.coerce.number().int().min(0).default(0)
|
|
710
|
-
})
|
|
711
|
-
};
|
|
712
|
-
const response$28 = z.object({
|
|
713
|
-
data: z.object({ draftRefs: z.array(expertDraftRefSchema) }),
|
|
714
|
-
meta: paginationMeta
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
//#endregion
|
|
718
|
-
//#region ../models/src/api/experts/drafts/update.ts
|
|
719
|
-
const request$25 = {
|
|
720
|
-
params: z.object({
|
|
721
|
-
scopeName: scopeNameSchema,
|
|
722
|
-
draftRef: expertDraftRefSchema.shape.id
|
|
723
|
-
}),
|
|
724
|
-
body: z.object({ experts: z.array(expertSchema) })
|
|
725
|
-
};
|
|
726
|
-
const response$27 = z.object({ data: z.object({
|
|
727
|
-
scope: expertDraftScopeSchema,
|
|
728
|
-
draftRef: expertDraftRefSchema,
|
|
729
|
-
definition: expertDefinitionContentSchema
|
|
730
|
-
}) });
|
|
731
|
-
|
|
732
|
-
//#endregion
|
|
733
|
-
//#region ../models/src/api/experts/drafts/version.ts
|
|
734
|
-
const request$24 = {
|
|
735
|
-
params: z.object({
|
|
736
|
-
scopeName: scopeNameSchema,
|
|
737
|
-
draftRef: z.string().min(1)
|
|
738
|
-
}),
|
|
739
|
-
body: z.object({
|
|
740
|
-
version: z.string().min(1, "Version is required.").max(maxExpertVersionTagLength, "Version is too long.").regex(expertVersionRegex, "Invalid version format. (e.g. 1.0.0)"),
|
|
741
|
-
tag: z.string().max(maxExpertVersionTagLength, "Tag is too long.").regex(tagNameRegex, "Invalid tag format. (e.g. latest)").optional()
|
|
742
|
-
})
|
|
743
|
-
};
|
|
744
|
-
const response$26 = z.object({ data: z.object({
|
|
745
|
-
scope: expertScopeSchema,
|
|
746
|
-
version: expertVersionSchema,
|
|
747
|
-
definitionUrl: z.string()
|
|
748
|
-
}) });
|
|
749
|
-
|
|
750
|
-
//#endregion
|
|
751
|
-
//#region ../models/src/api/experts/featured.ts
|
|
752
|
-
const response$25 = z.object({ data: z.object({ featuredExperts: z.array(z.object({
|
|
753
|
-
scope: expertScopeSchema,
|
|
754
|
-
currentVersion: expertVersionSchema,
|
|
755
|
-
displayOrder: z.number().int().min(0).max(2),
|
|
756
|
-
featuredAt: z.string().datetime()
|
|
757
|
-
})) }) });
|
|
758
|
-
|
|
759
|
-
//#endregion
|
|
760
|
-
//#region ../models/src/api/experts/get.ts
|
|
761
|
-
const request$23 = { params: z.object({ scopeName: scopeNameRefSchema }) };
|
|
762
|
-
const response$24 = z.object({ data: z.object({
|
|
763
|
-
definition: expertDefinitionSchema,
|
|
764
|
-
yanked: z.boolean().optional()
|
|
765
|
-
}) });
|
|
766
|
-
|
|
767
971
|
//#endregion
|
|
768
972
|
//#region ../models/src/api/experts/getAll.ts
|
|
769
|
-
const request$
|
|
973
|
+
const request$9 = { query: z.object({
|
|
770
974
|
filter: z.string().describe("Filter by scope name (partial match)").optional(),
|
|
771
975
|
category: z.enum([
|
|
772
976
|
"general",
|
|
@@ -775,38 +979,15 @@ const request$22 = { query: z.object({
|
|
|
775
979
|
"writing",
|
|
776
980
|
"data",
|
|
777
981
|
"automation"
|
|
778
|
-
]).describe("Filter by category").optional(),
|
|
779
|
-
includeDrafts: z.coerce.boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
|
|
780
|
-
take: z.coerce.number().min(1).max(100).default(20),
|
|
781
|
-
skip: z.coerce.number().min(0).default(0)
|
|
782
|
-
}) };
|
|
783
|
-
const response$
|
|
784
|
-
data: z.object({ experts: z.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema })) }),
|
|
785
|
-
meta: paginationMeta
|
|
786
|
-
});
|
|
787
|
-
|
|
788
|
-
//#endregion
|
|
789
|
-
//#region ../models/src/api/experts/meta.ts
|
|
790
|
-
const request$21 = {
|
|
791
|
-
params: z.object({ scopeName: scopeNameRefSchema }),
|
|
792
|
-
query: z.object({ public: z.enum(["true", "false"]).transform((val) => val === "true").optional().default(false).describe("Public access check (no auth)") })
|
|
793
|
-
};
|
|
794
|
-
const response$22 = z.object({ data: expertMetadataSchema.extend({ definitionUrl: z.string() }) });
|
|
795
|
-
|
|
796
|
-
//#endregion
|
|
797
|
-
//#region ../models/src/api/experts/publish.ts
|
|
798
|
-
const request$20 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
799
|
-
const response$21 = z.object({ data: z.object({ scope: expertScopeSchema }) });
|
|
800
|
-
|
|
801
|
-
//#endregion
|
|
802
|
-
//#region ../models/src/api/experts/unpublish.ts
|
|
803
|
-
const request$19 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
804
|
-
const response$20 = z.object({ data: z.object({ scope: expertScopeSchema }) });
|
|
805
|
-
|
|
806
|
-
//#endregion
|
|
807
|
-
//#region ../models/src/api/experts/versions.ts
|
|
808
|
-
const request$18 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
809
|
-
const response$19 = z.object({ data: z.object({ versions: z.array(expertVersionSchema) }) });
|
|
982
|
+
]).describe("Filter by category").optional(),
|
|
983
|
+
includeDrafts: z.coerce.boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
|
|
984
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
985
|
+
skip: z.coerce.number().min(0).default(0)
|
|
986
|
+
}) };
|
|
987
|
+
const response$9 = z.object({
|
|
988
|
+
data: z.object({ experts: z.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema.nullable() })) }),
|
|
989
|
+
meta: paginationMeta
|
|
990
|
+
});
|
|
810
991
|
|
|
811
992
|
//#endregion
|
|
812
993
|
//#region ../models/src/domain/checkpoint.ts
|
|
@@ -885,26 +1066,18 @@ const requestCheckpointSchema = perstackCheckpointSchema.omit({
|
|
|
885
1066
|
id: true,
|
|
886
1067
|
runId: true
|
|
887
1068
|
}).extend({ runId: z.string().optional() });
|
|
888
|
-
const request$
|
|
1069
|
+
const request$8 = {
|
|
889
1070
|
params: z.object({ jobId: cuidSchema }),
|
|
890
1071
|
body: z.object({
|
|
891
1072
|
checkpoint: requestCheckpointSchema,
|
|
892
1073
|
step: stepSchema
|
|
893
1074
|
})
|
|
894
1075
|
};
|
|
895
|
-
const response$
|
|
896
|
-
|
|
897
|
-
//#endregion
|
|
898
|
-
//#region ../models/src/api/jobs/checkpoints/get.ts
|
|
899
|
-
const request$16 = { params: z.object({
|
|
900
|
-
jobId: cuidSchema,
|
|
901
|
-
checkpointId: cuidSchema
|
|
902
|
-
}) };
|
|
903
|
-
const response$17 = z.object({ data: z.object({ checkpoint: apiCheckpointSchema }) });
|
|
1076
|
+
const response$8 = z.object({ data: z.object({ checkpoint: apiCheckpointSchema }) });
|
|
904
1077
|
|
|
905
1078
|
//#endregion
|
|
906
1079
|
//#region ../models/src/api/jobs/checkpoints/getAll.ts
|
|
907
|
-
const request$
|
|
1080
|
+
const request$7 = {
|
|
908
1081
|
params: z.object({ jobId: cuidSchema }),
|
|
909
1082
|
query: z.object({
|
|
910
1083
|
filter: z.string().min(1).max(256).optional(),
|
|
@@ -914,16 +1087,11 @@ const request$15 = {
|
|
|
914
1087
|
skip: z.coerce.number().min(0).default(0)
|
|
915
1088
|
})
|
|
916
1089
|
};
|
|
917
|
-
const response$
|
|
1090
|
+
const response$7 = z.object({
|
|
918
1091
|
data: z.object({ checkpoints: z.array(apiCheckpointSchema) }),
|
|
919
1092
|
meta: paginationMeta
|
|
920
1093
|
});
|
|
921
1094
|
|
|
922
|
-
//#endregion
|
|
923
|
-
//#region ../models/src/api/jobs/checkpoints/stream.ts
|
|
924
|
-
const request$14 = { params: z.object({ jobId: cuidSchema }) };
|
|
925
|
-
const response$15 = z.object({ data: apiCheckpointSchema });
|
|
926
|
-
|
|
927
1095
|
//#endregion
|
|
928
1096
|
//#region ../support-models/src/index.ts
|
|
929
1097
|
const anthropicSupportModels = [
|
|
@@ -1124,7 +1292,7 @@ const jobSchema = z.object({
|
|
|
1124
1292
|
|
|
1125
1293
|
//#endregion
|
|
1126
1294
|
//#region ../models/src/api/jobs/continue.ts
|
|
1127
|
-
const request$
|
|
1295
|
+
const request$6 = {
|
|
1128
1296
|
params: z.object({ jobId: cuidSchema }),
|
|
1129
1297
|
body: z.object({
|
|
1130
1298
|
query: jobSchema.shape.query.optional(),
|
|
@@ -1137,11 +1305,11 @@ const request$13 = {
|
|
|
1137
1305
|
maxRetries: z.coerce.number().optional()
|
|
1138
1306
|
})
|
|
1139
1307
|
};
|
|
1140
|
-
const response$
|
|
1308
|
+
const response$6 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1141
1309
|
|
|
1142
1310
|
//#endregion
|
|
1143
1311
|
//#region ../models/src/api/jobs/create.ts
|
|
1144
|
-
const request$
|
|
1312
|
+
const request$5 = { body: z.object({
|
|
1145
1313
|
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
1146
1314
|
expertKey: expertKeyFieldSchema,
|
|
1147
1315
|
query: jobSchema.shape.query.optional(),
|
|
@@ -1152,33 +1320,28 @@ const request$12 = { body: z.object({
|
|
|
1152
1320
|
maxSteps: z.coerce.number().optional(),
|
|
1153
1321
|
maxRetries: z.coerce.number().optional()
|
|
1154
1322
|
}) };
|
|
1155
|
-
const response$
|
|
1156
|
-
|
|
1157
|
-
//#endregion
|
|
1158
|
-
//#region ../models/src/api/jobs/get.ts
|
|
1159
|
-
const request$11 = { params: z.object({ jobId: cuidSchema }) };
|
|
1160
|
-
const response$12 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1323
|
+
const response$5 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1161
1324
|
|
|
1162
1325
|
//#endregion
|
|
1163
1326
|
//#region ../models/src/api/jobs/getAll.ts
|
|
1164
|
-
const request$
|
|
1327
|
+
const request$4 = { query: z.object({
|
|
1165
1328
|
sort: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
1166
1329
|
order: z.enum(["asc", "desc"]).optional(),
|
|
1167
1330
|
take: z.coerce.number().min(1).max(100).default(20),
|
|
1168
1331
|
skip: z.coerce.number().min(0).default(0)
|
|
1169
1332
|
}) };
|
|
1170
|
-
const response$
|
|
1333
|
+
const response$4 = z.object({
|
|
1171
1334
|
data: z.object({ jobs: z.array(jobSchema) }),
|
|
1172
1335
|
meta: paginationMeta
|
|
1173
1336
|
});
|
|
1174
1337
|
|
|
1175
1338
|
//#endregion
|
|
1176
1339
|
//#region ../models/src/api/jobs/update.ts
|
|
1177
|
-
const request$
|
|
1340
|
+
const request$3 = {
|
|
1178
1341
|
params: z.object({ jobId: cuidSchema }),
|
|
1179
1342
|
body: z.object({ status: jobStatusSchema })
|
|
1180
1343
|
};
|
|
1181
|
-
const response$
|
|
1344
|
+
const response$3 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1182
1345
|
|
|
1183
1346
|
//#endregion
|
|
1184
1347
|
//#region ../models/src/domain/providerSetting.ts
|
|
@@ -1255,7 +1418,7 @@ const providerApiKeyMetadataSchema = z.object({
|
|
|
1255
1418
|
|
|
1256
1419
|
//#endregion
|
|
1257
1420
|
//#region ../models/src/api/provider-settings/api-keys/create.ts
|
|
1258
|
-
const request$
|
|
1421
|
+
const request$2 = {
|
|
1259
1422
|
params: z.object({
|
|
1260
1423
|
applicationId: cuidSchema,
|
|
1261
1424
|
provider: providerSchema
|
|
@@ -1264,947 +1427,433 @@ const request$8 = {
|
|
|
1264
1427
|
name: z.string().min(1).max(255),
|
|
1265
1428
|
value: z.string().min(1)
|
|
1266
1429
|
})
|
|
1267
|
-
};
|
|
1268
|
-
const response$
|
|
1269
|
-
|
|
1270
|
-
//#endregion
|
|
1271
|
-
//#region ../models/src/api/provider-settings/api-keys/delete.ts
|
|
1272
|
-
const request$7 = { params: z.object({
|
|
1273
|
-
applicationId: cuidSchema,
|
|
1274
|
-
provider: providerSchema,
|
|
1275
|
-
apiKeyId: cuidSchema
|
|
1276
|
-
}) };
|
|
1277
|
-
const response$8 = z.null();
|
|
1278
|
-
|
|
1279
|
-
//#endregion
|
|
1280
|
-
//#region ../models/src/api/provider-settings/api-keys/getAll.ts
|
|
1281
|
-
const request$6 = { params: z.object({
|
|
1282
|
-
applicationId: cuidSchema,
|
|
1283
|
-
provider: providerSchema
|
|
1284
|
-
}) };
|
|
1285
|
-
const response$7 = z.object({ data: z.object({ apiKeys: z.array(providerApiKeyMetadataSchema) }) });
|
|
1286
|
-
|
|
1287
|
-
//#endregion
|
|
1288
|
-
//#region ../models/src/api/provider-settings/create.ts
|
|
1289
|
-
const request$5 = {
|
|
1290
|
-
params: z.object({ applicationId: cuidSchema }),
|
|
1291
|
-
body: z.object({
|
|
1292
|
-
provider: providerSchema,
|
|
1293
|
-
settings: providerSettingsSchema.optional()
|
|
1294
|
-
})
|
|
1295
|
-
};
|
|
1296
|
-
const response$6 = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1297
|
-
|
|
1298
|
-
//#endregion
|
|
1299
|
-
//#region ../models/src/api/provider-settings/delete.ts
|
|
1300
|
-
const request$4 = { params: z.object({
|
|
1301
|
-
applicationId: cuidSchema,
|
|
1302
|
-
provider: providerSchema
|
|
1303
|
-
}) };
|
|
1304
|
-
const response$5 = z.null();
|
|
1305
|
-
|
|
1306
|
-
//#endregion
|
|
1307
|
-
//#region ../models/src/api/provider-settings/get.ts
|
|
1308
|
-
const request$3 = { params: z.object({
|
|
1309
|
-
applicationId: cuidSchema,
|
|
1310
|
-
provider: providerSchema
|
|
1311
|
-
}) };
|
|
1312
|
-
const response$4 = z.object({ data: z.object({
|
|
1313
|
-
providerSetting: providerSettingResponseSchema,
|
|
1314
|
-
apiKeys: z.array(providerApiKeyMetadataSchema)
|
|
1315
|
-
}) });
|
|
1316
|
-
|
|
1317
|
-
//#endregion
|
|
1318
|
-
//#region ../models/src/api/provider-settings/getAll.ts
|
|
1319
|
-
const request$2 = { params: z.object({ applicationId: cuidSchema }) };
|
|
1320
|
-
const response$3 = z.object({ data: z.object({ providerSettings: z.array(providerSettingResponseSchema) }) });
|
|
1321
|
-
|
|
1322
|
-
//#endregion
|
|
1323
|
-
//#region ../models/src/api/provider-settings/update.ts
|
|
1324
|
-
const request$1 = {
|
|
1325
|
-
params: z.object({
|
|
1326
|
-
applicationId: cuidSchema,
|
|
1327
|
-
provider: providerSchema
|
|
1328
|
-
}),
|
|
1329
|
-
body: z.object({ settings: providerSettingsSchema.optional() })
|
|
1330
|
-
};
|
|
1331
|
-
const response$2 = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1332
|
-
|
|
1333
|
-
//#endregion
|
|
1334
|
-
//#region ../models/src/api/session/get.ts
|
|
1335
|
-
const response$1 = z.object({ data: z.object({
|
|
1336
|
-
user: userSchema,
|
|
1337
|
-
organization: organizationSchema,
|
|
1338
|
-
application: applicationSchema.nullable()
|
|
1339
|
-
}) });
|
|
1340
|
-
|
|
1341
|
-
//#endregion
|
|
1342
|
-
//#region ../models/src/api/session/setApplication.ts
|
|
1343
|
-
const request = { body: z.object({ applicationId: z.string().min(1, "Application ID is required") }) };
|
|
1344
|
-
const response = z.object({ data: z.object({ success: z.literal(true) }) });
|
|
1345
|
-
|
|
1346
|
-
//#endregion
|
|
1347
|
-
//#region ../models/src/domain/providerApiKey.ts
|
|
1348
|
-
const providerApiKeyNameSchema = z.string().min(1).max(255);
|
|
1349
|
-
const providerApiKeyValueSchema = z.string().min(1);
|
|
1350
|
-
const providerApiKeySchema = z.object({
|
|
1351
|
-
type: z.literal("providerApiKey"),
|
|
1352
|
-
id: cuidSchema,
|
|
1353
|
-
providerSettingId: cuidSchema,
|
|
1354
|
-
name: providerApiKeyNameSchema,
|
|
1355
|
-
lastUsedAt: datetimeSchema.optional(),
|
|
1356
|
-
expiresAt: datetimeSchema.optional(),
|
|
1357
|
-
providerSetting: providerSettingSchema,
|
|
1358
|
-
createdAt: datetimeSchema,
|
|
1359
|
-
updatedAt: datetimeSchema
|
|
1360
|
-
});
|
|
1361
|
-
|
|
1362
|
-
//#endregion
|
|
1363
|
-
//#region ../models/src/domain/run.ts
|
|
1364
|
-
const runStatusSchema = z.enum([
|
|
1365
|
-
"queued",
|
|
1366
|
-
"processing",
|
|
1367
|
-
"completed",
|
|
1368
|
-
"stoppedByInteractiveTool",
|
|
1369
|
-
"stoppedByDelegate",
|
|
1370
|
-
"stoppedByExceededMaxSteps",
|
|
1371
|
-
"stoppedByError"
|
|
1372
|
-
]);
|
|
1373
|
-
const runSchema = z.object({
|
|
1374
|
-
type: z.literal("run"),
|
|
1375
|
-
id: cuidSchema,
|
|
1376
|
-
jobId: cuidSchema,
|
|
1377
|
-
parentRunId: cuidSchema.optional(),
|
|
1378
|
-
organizationId: cuidSchema,
|
|
1379
|
-
createdAt: datetimeSchema,
|
|
1380
|
-
updatedAt: datetimeSchema,
|
|
1381
|
-
status: runStatusSchema,
|
|
1382
|
-
runtimeVersion: runtimeVersionSchema,
|
|
1383
|
-
expertKey: expertKeyFieldSchema,
|
|
1384
|
-
interactiveToolCallResult: z.boolean().optional(),
|
|
1385
|
-
expert: expertWithMetadataSchema,
|
|
1386
|
-
stepNumber: z.number().int().min(0),
|
|
1387
|
-
usage: usageSchema,
|
|
1388
|
-
machineId: z.string().optional()
|
|
1389
|
-
});
|
|
1390
|
-
|
|
1391
|
-
//#endregion
|
|
1392
|
-
//#region src/lib/errors.ts
|
|
1393
|
-
function createValidationError(error) {
|
|
1394
|
-
return {
|
|
1395
|
-
errorType: "validation",
|
|
1396
|
-
code: 400,
|
|
1397
|
-
message: `Validation failed: ${error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`,
|
|
1398
|
-
reason: error.issues
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
function createAbortError() {
|
|
1402
|
-
return {
|
|
1403
|
-
errorType: "abort",
|
|
1404
|
-
code: 0,
|
|
1405
|
-
message: "Request aborted",
|
|
1406
|
-
aborted: true
|
|
1407
|
-
};
|
|
1408
|
-
}
|
|
1409
|
-
function createTimeoutError() {
|
|
1410
|
-
return {
|
|
1411
|
-
errorType: "timeout",
|
|
1412
|
-
code: 0,
|
|
1413
|
-
message: "Request timed out"
|
|
1414
|
-
};
|
|
1415
|
-
}
|
|
1416
|
-
function createNetworkError(error) {
|
|
1417
|
-
return {
|
|
1418
|
-
errorType: "network",
|
|
1419
|
-
code: 0,
|
|
1420
|
-
message: error instanceof Error ? error.message : "Network error",
|
|
1421
|
-
reason: error,
|
|
1422
|
-
cause: error instanceof Error ? error : void 0
|
|
1423
|
-
};
|
|
1424
|
-
}
|
|
1425
|
-
async function handleHttpError(response$52) {
|
|
1426
|
-
let errorBody;
|
|
1427
|
-
try {
|
|
1428
|
-
errorBody = await response$52.json();
|
|
1429
|
-
} catch {
|
|
1430
|
-
errorBody = void 0;
|
|
1431
|
-
}
|
|
1432
|
-
return {
|
|
1433
|
-
ok: false,
|
|
1434
|
-
error: createHttpError(response$52.status, response$52.statusText, errorBody)
|
|
1435
|
-
};
|
|
1436
|
-
}
|
|
1437
|
-
function createHttpError(status, statusText, body) {
|
|
1438
|
-
if (typeof body === "object" && body !== null) {
|
|
1439
|
-
const hasReason = "reason" in body;
|
|
1440
|
-
if ("error" in body && typeof body.error === "string") return {
|
|
1441
|
-
errorType: "http",
|
|
1442
|
-
code: status,
|
|
1443
|
-
message: body.error,
|
|
1444
|
-
reason: hasReason ? body.reason : void 0
|
|
1445
|
-
};
|
|
1446
|
-
if (hasReason) return {
|
|
1447
|
-
errorType: "http",
|
|
1448
|
-
code: status,
|
|
1449
|
-
message: statusText,
|
|
1450
|
-
reason: body.reason
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
|
-
return {
|
|
1454
|
-
errorType: "http",
|
|
1455
|
-
code: status,
|
|
1456
|
-
message: statusText
|
|
1457
|
-
};
|
|
1458
|
-
}
|
|
1459
|
-
function isHttpError(error) {
|
|
1460
|
-
return error.errorType === "http";
|
|
1461
|
-
}
|
|
1462
|
-
function isNetworkError(error) {
|
|
1463
|
-
return error.errorType === "network";
|
|
1464
|
-
}
|
|
1465
|
-
function isTimeoutError(error) {
|
|
1466
|
-
return error.errorType === "timeout";
|
|
1467
|
-
}
|
|
1468
|
-
function isValidationError(error) {
|
|
1469
|
-
return error.errorType === "validation";
|
|
1470
|
-
}
|
|
1471
|
-
function isAbortError(error) {
|
|
1472
|
-
return error.errorType === "abort";
|
|
1473
|
-
}
|
|
1474
|
-
function isClientError(error) {
|
|
1475
|
-
return error.errorType !== "http";
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
//#endregion
|
|
1479
|
-
//#region src/endpoints/api-keys.ts
|
|
1480
|
-
const BASE_PATH$6 = "/api/v1/api_keys";
|
|
1481
|
-
function createApiKeysApi(fetcher) {
|
|
1482
|
-
return {
|
|
1483
|
-
async create(input, options) {
|
|
1484
|
-
const result = request$49.body.safeParse(input);
|
|
1485
|
-
if (!result.success) return {
|
|
1486
|
-
ok: false,
|
|
1487
|
-
error: createValidationError(result.error)
|
|
1488
|
-
};
|
|
1489
|
-
return fetcher.post(BASE_PATH$6, input, options);
|
|
1490
|
-
},
|
|
1491
|
-
async list(input, options) {
|
|
1492
|
-
const queryParams = new URLSearchParams();
|
|
1493
|
-
if (input?.take !== void 0) queryParams.set("take", String(input.take));
|
|
1494
|
-
if (input?.skip !== void 0) queryParams.set("skip", String(input.skip));
|
|
1495
|
-
const queryString = queryParams.toString();
|
|
1496
|
-
const url = queryString ? `${BASE_PATH$6}?${queryString}` : BASE_PATH$6;
|
|
1497
|
-
return fetcher.get(url, options);
|
|
1498
|
-
},
|
|
1499
|
-
async get(id, options) {
|
|
1500
|
-
const result = request$48.params.safeParse({ apiKeyId: id });
|
|
1501
|
-
if (!result.success) return {
|
|
1502
|
-
ok: false,
|
|
1503
|
-
error: createValidationError(result.error)
|
|
1504
|
-
};
|
|
1505
|
-
return fetcher.get(`${BASE_PATH$6}/${id}`, options);
|
|
1506
|
-
},
|
|
1507
|
-
async revoke(id, options) {
|
|
1508
|
-
const result = request$46.params.safeParse({ apiKeyId: id });
|
|
1509
|
-
if (!result.success) return {
|
|
1510
|
-
ok: false,
|
|
1511
|
-
error: createValidationError(result.error)
|
|
1512
|
-
};
|
|
1513
|
-
return fetcher.post(`${BASE_PATH$6}/${id}/revoke`, {}, options);
|
|
1514
|
-
}
|
|
1515
|
-
};
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
//#endregion
|
|
1519
|
-
//#region src/lib/query-string.ts
|
|
1520
|
-
function buildQueryString(params) {
|
|
1521
|
-
if (!params) return "";
|
|
1522
|
-
const searchParams = new URLSearchParams();
|
|
1523
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0) searchParams.set(key, String(value));
|
|
1524
|
-
const queryString = searchParams.toString();
|
|
1525
|
-
return queryString ? `?${queryString}` : "";
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
//#endregion
|
|
1529
|
-
//#region src/endpoints/applications.ts
|
|
1530
|
-
const BASE_PATH$5 = "/api/v1/applications";
|
|
1531
|
-
function createApplicationsApi(fetcher) {
|
|
1532
|
-
return {
|
|
1533
|
-
async list(params, options) {
|
|
1534
|
-
if (params) {
|
|
1535
|
-
const result = request$42.query.safeParse(params);
|
|
1536
|
-
if (!result.success) return {
|
|
1537
|
-
ok: false,
|
|
1538
|
-
error: createValidationError(result.error)
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
const queryString = buildQueryString(params);
|
|
1542
|
-
return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
|
|
1543
|
-
},
|
|
1544
|
-
async get(id, options) {
|
|
1545
|
-
return fetcher.get(`${BASE_PATH$5}/${id}`, options);
|
|
1546
|
-
},
|
|
1547
|
-
async create(input, options) {
|
|
1548
|
-
const result = request$45.body.safeParse(input);
|
|
1549
|
-
if (!result.success) return {
|
|
1550
|
-
ok: false,
|
|
1551
|
-
error: createValidationError(result.error)
|
|
1552
|
-
};
|
|
1553
|
-
return fetcher.post(BASE_PATH$5, input, options);
|
|
1554
|
-
},
|
|
1555
|
-
async update(id, input, options) {
|
|
1556
|
-
const result = request$41.body.safeParse(input);
|
|
1557
|
-
if (!result.success) return {
|
|
1558
|
-
ok: false,
|
|
1559
|
-
error: createValidationError(result.error)
|
|
1560
|
-
};
|
|
1561
|
-
return fetcher.post(`${BASE_PATH$5}/${id}`, input, options);
|
|
1562
|
-
},
|
|
1563
|
-
async delete(id, options) {
|
|
1564
|
-
return fetcher.delete(`${BASE_PATH$5}/${id}`, options);
|
|
1565
|
-
}
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1430
|
+
};
|
|
1431
|
+
const response$2 = z.object({ data: z.object({ apiKey: providerApiKeyMetadataSchema }) });
|
|
1568
1432
|
|
|
1569
1433
|
//#endregion
|
|
1570
|
-
//#region src/
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1434
|
+
//#region ../models/src/api/provider-settings/create.ts
|
|
1435
|
+
const request$1 = {
|
|
1436
|
+
params: z.object({ applicationId: cuidSchema }),
|
|
1437
|
+
body: z.object({
|
|
1438
|
+
provider: providerSchema,
|
|
1439
|
+
settings: providerSettingsSchema.optional()
|
|
1440
|
+
})
|
|
1441
|
+
};
|
|
1442
|
+
const response$1 = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1443
|
+
|
|
1444
|
+
//#endregion
|
|
1445
|
+
//#region ../models/src/api/provider-settings/update.ts
|
|
1446
|
+
const request = {
|
|
1447
|
+
params: z.object({
|
|
1448
|
+
applicationId: cuidSchema,
|
|
1449
|
+
provider: providerSchema
|
|
1450
|
+
}),
|
|
1451
|
+
body: z.object({ settings: providerSettingsSchema.optional() })
|
|
1452
|
+
};
|
|
1453
|
+
const response = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1454
|
+
|
|
1455
|
+
//#endregion
|
|
1456
|
+
//#region src/endpoints/api-keys.ts
|
|
1457
|
+
const BASE_PATH$6 = "/api/v1/api_keys";
|
|
1458
|
+
function createApiKeysApi(fetcher) {
|
|
1573
1459
|
return {
|
|
1574
|
-
async list(params, options) {
|
|
1575
|
-
if (params) {
|
|
1576
|
-
const result = request$37.query.safeParse(params);
|
|
1577
|
-
if (!result.success) return {
|
|
1578
|
-
ok: false,
|
|
1579
|
-
error: createValidationError(result.error)
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
const queryString = buildQueryString(params);
|
|
1583
|
-
return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
|
|
1584
|
-
},
|
|
1585
|
-
async get(name, options) {
|
|
1586
|
-
const encodedName = encodeURIComponent(name);
|
|
1587
|
-
return fetcher.get(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1588
|
-
},
|
|
1589
1460
|
async create(input, options) {
|
|
1590
|
-
const result = request$
|
|
1461
|
+
const result = request$22.body.safeParse(input);
|
|
1591
1462
|
if (!result.success) return {
|
|
1592
1463
|
ok: false,
|
|
1593
1464
|
error: createValidationError(result.error)
|
|
1594
1465
|
};
|
|
1595
|
-
return fetcher.post(BASE_PATH$
|
|
1466
|
+
return fetcher.post(BASE_PATH$6, input, options);
|
|
1596
1467
|
},
|
|
1597
|
-
async
|
|
1598
|
-
const
|
|
1468
|
+
async list(input, options) {
|
|
1469
|
+
const queryParams = new URLSearchParams();
|
|
1470
|
+
if (input?.take !== void 0) queryParams.set("take", String(input.take));
|
|
1471
|
+
if (input?.skip !== void 0) queryParams.set("skip", String(input.skip));
|
|
1472
|
+
const queryString = queryParams.toString();
|
|
1473
|
+
const url = queryString ? `${BASE_PATH$6}?${queryString}` : BASE_PATH$6;
|
|
1474
|
+
return fetcher.get(url, options);
|
|
1475
|
+
},
|
|
1476
|
+
async get(id, options) {
|
|
1477
|
+
const result = request$21.params.safeParse({ apiKeyId: id });
|
|
1599
1478
|
if (!result.success) return {
|
|
1600
1479
|
ok: false,
|
|
1601
1480
|
error: createValidationError(result.error)
|
|
1602
1481
|
};
|
|
1603
|
-
|
|
1604
|
-
return fetcher.put(`${BASE_PATH$4}/${encodedName}`, input, options);
|
|
1482
|
+
return fetcher.get(`${BASE_PATH$6}/${id}`, options);
|
|
1605
1483
|
},
|
|
1606
|
-
async
|
|
1607
|
-
const
|
|
1608
|
-
return fetcher.deleteNoContent(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1609
|
-
}
|
|
1610
|
-
};
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
//#endregion
|
|
1614
|
-
//#region src/endpoints/env-variables.ts
|
|
1615
|
-
const BASE_PATH$3 = "/api/v1/env/variables";
|
|
1616
|
-
function createVariablesApi(fetcher) {
|
|
1617
|
-
return {
|
|
1618
|
-
async list(params, options) {
|
|
1619
|
-
const result = request$32.query.safeParse(params);
|
|
1484
|
+
async revoke(id, options) {
|
|
1485
|
+
const result = request$20.params.safeParse({ apiKeyId: id });
|
|
1620
1486
|
if (!result.success) return {
|
|
1621
1487
|
ok: false,
|
|
1622
1488
|
error: createValidationError(result.error)
|
|
1623
1489
|
};
|
|
1624
|
-
|
|
1625
|
-
return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
|
|
1626
|
-
},
|
|
1627
|
-
async get(name, options) {
|
|
1628
|
-
const encodedName = encodeURIComponent(name);
|
|
1629
|
-
return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1490
|
+
return fetcher.post(`${BASE_PATH$6}/${id}/revoke`, {}, options);
|
|
1630
1491
|
},
|
|
1631
|
-
async
|
|
1632
|
-
const
|
|
1633
|
-
if (!
|
|
1492
|
+
async update(id, input, options) {
|
|
1493
|
+
const paramsResult = request$19.params.safeParse({ apiKeyId: id });
|
|
1494
|
+
if (!paramsResult.success) return {
|
|
1634
1495
|
ok: false,
|
|
1635
|
-
error: createValidationError(
|
|
1496
|
+
error: createValidationError(paramsResult.error)
|
|
1636
1497
|
};
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
async update(name, input, options) {
|
|
1640
|
-
const result = request$31.body.safeParse(input);
|
|
1641
|
-
if (!result.success) return {
|
|
1498
|
+
const bodyResult = request$19.body.safeParse(input);
|
|
1499
|
+
if (!bodyResult.success) return {
|
|
1642
1500
|
ok: false,
|
|
1643
|
-
error: createValidationError(
|
|
1501
|
+
error: createValidationError(bodyResult.error)
|
|
1644
1502
|
};
|
|
1645
|
-
|
|
1646
|
-
return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
|
|
1647
|
-
},
|
|
1648
|
-
async delete(name, options) {
|
|
1649
|
-
const encodedName = encodeURIComponent(name);
|
|
1650
|
-
return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1503
|
+
return fetcher.post(`${BASE_PATH$6}/${id}`, input, options);
|
|
1651
1504
|
}
|
|
1652
1505
|
};
|
|
1653
1506
|
}
|
|
1654
1507
|
|
|
1655
1508
|
//#endregion
|
|
1656
|
-
//#region src/endpoints/
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
secrets: createSecretsApi(fetcher),
|
|
1660
|
-
variables: createVariablesApi(fetcher)
|
|
1661
|
-
};
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
//#endregion
|
|
1665
|
-
//#region src/endpoints/experts-drafts.ts
|
|
1666
|
-
function createDraftsApi(fetcher, basePath) {
|
|
1509
|
+
//#region src/endpoints/applications.ts
|
|
1510
|
+
const BASE_PATH$5 = "/api/v1/applications";
|
|
1511
|
+
function createApplicationsApi(fetcher) {
|
|
1667
1512
|
return {
|
|
1668
|
-
async list(
|
|
1513
|
+
async list(params, options) {
|
|
1669
1514
|
if (params) {
|
|
1670
|
-
const result = request$
|
|
1515
|
+
const result = request$17.query.safeParse(params);
|
|
1671
1516
|
if (!result.success) return {
|
|
1672
1517
|
ok: false,
|
|
1673
1518
|
error: createValidationError(result.error)
|
|
1674
1519
|
};
|
|
1675
1520
|
}
|
|
1676
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1677
1521
|
const queryString = buildQueryString(params);
|
|
1678
|
-
return fetcher.get(`${
|
|
1679
|
-
},
|
|
1680
|
-
async get(scopeName, draftRef, options) {
|
|
1681
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1682
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1683
|
-
return fetcher.get(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, options);
|
|
1684
|
-
},
|
|
1685
|
-
async create(scopeName, input, options) {
|
|
1686
|
-
const result = request$29.body.safeParse(input);
|
|
1687
|
-
if (!result.success) return {
|
|
1688
|
-
ok: false,
|
|
1689
|
-
error: createValidationError(result.error)
|
|
1690
|
-
};
|
|
1691
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1692
|
-
return fetcher.post(`${basePath}/${encodedScopeName}/drafts`, input, options);
|
|
1693
|
-
},
|
|
1694
|
-
async update(scopeName, draftRef, input, options) {
|
|
1695
|
-
const result = request$25.body.safeParse(input);
|
|
1696
|
-
if (!result.success) return {
|
|
1697
|
-
ok: false,
|
|
1698
|
-
error: createValidationError(result.error)
|
|
1699
|
-
};
|
|
1700
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1701
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1702
|
-
return fetcher.post(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, input, options);
|
|
1522
|
+
return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
|
|
1703
1523
|
},
|
|
1704
|
-
async
|
|
1705
|
-
|
|
1706
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1707
|
-
return fetcher.delete(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, options);
|
|
1524
|
+
async get(id, options) {
|
|
1525
|
+
return fetcher.get(`${BASE_PATH$5}/${id}`, options);
|
|
1708
1526
|
},
|
|
1709
|
-
async
|
|
1710
|
-
const result = request$
|
|
1527
|
+
async create(input, options) {
|
|
1528
|
+
const result = request$18.body.safeParse(input);
|
|
1711
1529
|
if (!result.success) return {
|
|
1712
1530
|
ok: false,
|
|
1713
1531
|
error: createValidationError(result.error)
|
|
1714
1532
|
};
|
|
1715
|
-
|
|
1716
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1717
|
-
return fetcher.post(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}/version`, input, options);
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
//#endregion
|
|
1723
|
-
//#region src/endpoints/experts-versions.ts
|
|
1724
|
-
function createVersionsApi(fetcher, basePath) {
|
|
1725
|
-
return { async list(scopeName, options) {
|
|
1726
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1727
|
-
return fetcher.get(`${basePath}/${encodedScopeName}/versions`, options);
|
|
1728
|
-
} };
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
//#endregion
|
|
1732
|
-
//#region src/endpoints/experts.ts
|
|
1733
|
-
const BASE_PATH$2 = "/api/v1/experts";
|
|
1734
|
-
function createExpertsApi(fetcher) {
|
|
1735
|
-
return {
|
|
1736
|
-
async list(params, options) {
|
|
1737
|
-
if (params) {
|
|
1738
|
-
const result = request$22.query.safeParse(params);
|
|
1739
|
-
if (!result.success) return {
|
|
1740
|
-
ok: false,
|
|
1741
|
-
error: createValidationError(result.error)
|
|
1742
|
-
};
|
|
1743
|
-
}
|
|
1744
|
-
const queryString = buildQueryString(params);
|
|
1745
|
-
return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
|
|
1746
|
-
},
|
|
1747
|
-
async get(key, options) {
|
|
1748
|
-
const encodedKey = encodeURIComponent(key);
|
|
1749
|
-
return fetcher.get(`${BASE_PATH$2}/${encodedKey}`, options);
|
|
1750
|
-
},
|
|
1751
|
-
async getFeatured(options) {
|
|
1752
|
-
return fetcher.get(`${BASE_PATH$2}/featured`, options);
|
|
1753
|
-
},
|
|
1754
|
-
async getMeta(key, options) {
|
|
1755
|
-
const encodedKey = encodeURIComponent(key);
|
|
1756
|
-
return fetcher.get(`${BASE_PATH$2}/${encodedKey}/meta`, options);
|
|
1757
|
-
},
|
|
1758
|
-
async publish(scopeName, options) {
|
|
1759
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1760
|
-
return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/publish`, {}, options);
|
|
1761
|
-
},
|
|
1762
|
-
async unpublish(scopeName, options) {
|
|
1763
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1764
|
-
return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/unpublish`, {}, options);
|
|
1765
|
-
},
|
|
1766
|
-
async yank(key, options) {
|
|
1767
|
-
const encodedKey = encodeURIComponent(key);
|
|
1768
|
-
return fetcher.delete(`${BASE_PATH$2}/${encodedKey}`, options);
|
|
1769
|
-
},
|
|
1770
|
-
drafts: createDraftsApi(fetcher, BASE_PATH$2),
|
|
1771
|
-
versions: createVersionsApi(fetcher, BASE_PATH$2)
|
|
1772
|
-
};
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
//#endregion
|
|
1776
|
-
//#region src/lib/sse.ts
|
|
1777
|
-
async function* parseSSE(reader) {
|
|
1778
|
-
const decoder = new TextDecoder();
|
|
1779
|
-
let buffer = "";
|
|
1780
|
-
while (true) {
|
|
1781
|
-
const { value, done } = await reader.read();
|
|
1782
|
-
if (done) break;
|
|
1783
|
-
buffer += decoder.decode(value, { stream: true });
|
|
1784
|
-
const events = buffer.split("\n\n");
|
|
1785
|
-
buffer = events.pop() || "";
|
|
1786
|
-
for (const event of events) {
|
|
1787
|
-
if (event.trim() === "") continue;
|
|
1788
|
-
const lines = event.split("\n");
|
|
1789
|
-
const eventType = lines.find((line) => line.startsWith("event:"))?.slice(6).trim();
|
|
1790
|
-
const data = lines.find((line) => line.startsWith("data:"))?.slice(5).trim();
|
|
1791
|
-
if (eventType !== "message" || !data) continue;
|
|
1792
|
-
try {
|
|
1793
|
-
yield JSON.parse(data);
|
|
1794
|
-
} catch {}
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
//#endregion
|
|
1800
|
-
//#region src/endpoints/jobs-checkpoints.ts
|
|
1801
|
-
function createCheckpointsApi(fetcher, basePath) {
|
|
1802
|
-
return {
|
|
1803
|
-
async list(jobId, params, options) {
|
|
1804
|
-
if (params) {
|
|
1805
|
-
const result = request$15.query.safeParse(params);
|
|
1806
|
-
if (!result.success) return {
|
|
1807
|
-
ok: false,
|
|
1808
|
-
error: createValidationError(result.error)
|
|
1809
|
-
};
|
|
1810
|
-
}
|
|
1811
|
-
const queryString = buildQueryString(params);
|
|
1812
|
-
return fetcher.get(`${basePath}/${jobId}/checkpoints${queryString}`, options);
|
|
1813
|
-
},
|
|
1814
|
-
async get(jobId, checkpointId, options) {
|
|
1815
|
-
return fetcher.get(`${basePath}/${jobId}/checkpoints/${checkpointId}`, options);
|
|
1533
|
+
return fetcher.post(BASE_PATH$5, input, options);
|
|
1816
1534
|
},
|
|
1817
|
-
async
|
|
1818
|
-
const result = request$
|
|
1535
|
+
async update(id, input, options) {
|
|
1536
|
+
const result = request$16.body.safeParse(input);
|
|
1819
1537
|
if (!result.success) return {
|
|
1820
1538
|
ok: false,
|
|
1821
1539
|
error: createValidationError(result.error)
|
|
1822
1540
|
};
|
|
1823
|
-
return fetcher.post(`${
|
|
1541
|
+
return fetcher.post(`${BASE_PATH$5}/${id}`, input, options);
|
|
1824
1542
|
},
|
|
1825
|
-
async
|
|
1826
|
-
|
|
1827
|
-
if (!result.ok) {
|
|
1828
|
-
yield {
|
|
1829
|
-
ok: false,
|
|
1830
|
-
error: result.error
|
|
1831
|
-
};
|
|
1832
|
-
return;
|
|
1833
|
-
}
|
|
1834
|
-
const reader = result.data.getReader();
|
|
1835
|
-
try {
|
|
1836
|
-
for await (const checkpoint of parseSSE(reader)) yield {
|
|
1837
|
-
ok: true,
|
|
1838
|
-
data: checkpoint
|
|
1839
|
-
};
|
|
1840
|
-
} catch (error) {
|
|
1841
|
-
if (error instanceof DOMException && error.name === "AbortError") yield {
|
|
1842
|
-
ok: false,
|
|
1843
|
-
error: createAbortError()
|
|
1844
|
-
};
|
|
1845
|
-
else yield {
|
|
1846
|
-
ok: false,
|
|
1847
|
-
error: createNetworkError(error)
|
|
1848
|
-
};
|
|
1849
|
-
}
|
|
1543
|
+
async delete(id, options) {
|
|
1544
|
+
return fetcher.delete(`${BASE_PATH$5}/${id}`, options);
|
|
1850
1545
|
}
|
|
1851
1546
|
};
|
|
1852
1547
|
}
|
|
1853
1548
|
|
|
1854
1549
|
//#endregion
|
|
1855
|
-
//#region src/endpoints/
|
|
1856
|
-
const BASE_PATH$
|
|
1857
|
-
function
|
|
1550
|
+
//#region src/endpoints/env-secrets.ts
|
|
1551
|
+
const BASE_PATH$4 = "/api/v1/env/secrets";
|
|
1552
|
+
function createSecretsApi(fetcher) {
|
|
1858
1553
|
return {
|
|
1859
1554
|
async list(params, options) {
|
|
1860
1555
|
if (params) {
|
|
1861
|
-
const result = request$
|
|
1556
|
+
const result = request$14.query.safeParse(params);
|
|
1862
1557
|
if (!result.success) return {
|
|
1863
1558
|
ok: false,
|
|
1864
1559
|
error: createValidationError(result.error)
|
|
1865
1560
|
};
|
|
1866
1561
|
}
|
|
1867
1562
|
const queryString = buildQueryString(params);
|
|
1868
|
-
return fetcher.get(`${BASE_PATH$
|
|
1869
|
-
},
|
|
1870
|
-
async get(id, options) {
|
|
1871
|
-
return fetcher.get(`${BASE_PATH$1}/${id}`, options);
|
|
1563
|
+
return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
|
|
1872
1564
|
},
|
|
1873
|
-
async
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1876
|
-
ok: false,
|
|
1877
|
-
error: createValidationError(result.error)
|
|
1878
|
-
};
|
|
1879
|
-
return fetcher.post(BASE_PATH$1, input, options);
|
|
1565
|
+
async get(name, options) {
|
|
1566
|
+
const encodedName = encodeURIComponent(name);
|
|
1567
|
+
return fetcher.get(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1880
1568
|
},
|
|
1881
|
-
async
|
|
1882
|
-
const result = request$
|
|
1569
|
+
async create(input, options) {
|
|
1570
|
+
const result = request$15.body.safeParse(input);
|
|
1883
1571
|
if (!result.success) return {
|
|
1884
1572
|
ok: false,
|
|
1885
1573
|
error: createValidationError(result.error)
|
|
1886
1574
|
};
|
|
1887
|
-
return fetcher.post(
|
|
1575
|
+
return fetcher.post(BASE_PATH$4, input, options);
|
|
1888
1576
|
},
|
|
1889
|
-
async
|
|
1577
|
+
async update(name, input, options) {
|
|
1890
1578
|
const result = request$13.body.safeParse(input);
|
|
1891
1579
|
if (!result.success) return {
|
|
1892
1580
|
ok: false,
|
|
1893
1581
|
error: createValidationError(result.error)
|
|
1894
1582
|
};
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
async cancel(id, options) {
|
|
1898
|
-
return fetcher.post(`${BASE_PATH$1}/${id}/cancel`, {}, options);
|
|
1583
|
+
const encodedName = encodeURIComponent(name);
|
|
1584
|
+
return fetcher.put(`${BASE_PATH$4}/${encodedName}`, input, options);
|
|
1899
1585
|
},
|
|
1900
|
-
|
|
1586
|
+
async delete(name, options) {
|
|
1587
|
+
const encodedName = encodeURIComponent(name);
|
|
1588
|
+
return fetcher.deleteNoContent(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1589
|
+
}
|
|
1901
1590
|
};
|
|
1902
1591
|
}
|
|
1903
1592
|
|
|
1904
1593
|
//#endregion
|
|
1905
|
-
//#region src/endpoints/
|
|
1906
|
-
const BASE_PATH = "/api/v1/
|
|
1907
|
-
function
|
|
1594
|
+
//#region src/endpoints/env-variables.ts
|
|
1595
|
+
const BASE_PATH$3 = "/api/v1/env/variables";
|
|
1596
|
+
function createVariablesApi(fetcher) {
|
|
1908
1597
|
return {
|
|
1909
|
-
async list(
|
|
1910
|
-
|
|
1911
|
-
},
|
|
1912
|
-
async get(applicationId, provider, options) {
|
|
1913
|
-
const encodedProvider = encodeURIComponent(provider);
|
|
1914
|
-
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
1915
|
-
},
|
|
1916
|
-
async create(applicationId, input, options) {
|
|
1917
|
-
const result = request$5.body.safeParse(input);
|
|
1598
|
+
async list(params, options) {
|
|
1599
|
+
const result = request$11.query.safeParse(params);
|
|
1918
1600
|
if (!result.success) return {
|
|
1919
1601
|
ok: false,
|
|
1920
1602
|
error: createValidationError(result.error)
|
|
1921
1603
|
};
|
|
1922
|
-
|
|
1604
|
+
const queryString = buildQueryString(params);
|
|
1605
|
+
return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
|
|
1923
1606
|
},
|
|
1924
|
-
async
|
|
1925
|
-
const
|
|
1607
|
+
async get(name, options) {
|
|
1608
|
+
const encodedName = encodeURIComponent(name);
|
|
1609
|
+
return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1610
|
+
},
|
|
1611
|
+
async create(input, options) {
|
|
1612
|
+
const result = request$12.body.safeParse(input);
|
|
1926
1613
|
if (!result.success) return {
|
|
1927
1614
|
ok: false,
|
|
1928
1615
|
error: createValidationError(result.error)
|
|
1929
1616
|
};
|
|
1930
|
-
|
|
1931
|
-
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, input, options);
|
|
1932
|
-
},
|
|
1933
|
-
async delete(applicationId, provider, options) {
|
|
1934
|
-
const encodedProvider = encodeURIComponent(provider);
|
|
1935
|
-
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
1936
|
-
},
|
|
1937
|
-
async listApiKeys(applicationId, provider, options) {
|
|
1938
|
-
const encodedProvider = encodeURIComponent(provider);
|
|
1939
|
-
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, options);
|
|
1617
|
+
return fetcher.post(BASE_PATH$3, input, options);
|
|
1940
1618
|
},
|
|
1941
|
-
async
|
|
1942
|
-
const result = request$
|
|
1619
|
+
async update(name, input, options) {
|
|
1620
|
+
const result = request$10.body.safeParse(input);
|
|
1943
1621
|
if (!result.success) return {
|
|
1944
1622
|
ok: false,
|
|
1945
1623
|
error: createValidationError(result.error)
|
|
1946
1624
|
};
|
|
1947
|
-
const
|
|
1948
|
-
return fetcher.
|
|
1625
|
+
const encodedName = encodeURIComponent(name);
|
|
1626
|
+
return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
|
|
1949
1627
|
},
|
|
1950
|
-
async
|
|
1951
|
-
const
|
|
1952
|
-
|
|
1953
|
-
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys/${encodedApiKeyId}`, options);
|
|
1628
|
+
async delete(name, options) {
|
|
1629
|
+
const encodedName = encodeURIComponent(name);
|
|
1630
|
+
return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1954
1631
|
}
|
|
1955
1632
|
};
|
|
1956
1633
|
}
|
|
1957
1634
|
|
|
1958
1635
|
//#endregion
|
|
1959
|
-
//#region src/
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
const
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
}, timeout);
|
|
1986
|
-
let abortHandler;
|
|
1987
|
-
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
1988
|
-
else {
|
|
1989
|
-
abortHandler = () => controller.abort();
|
|
1990
|
-
externalSignal.addEventListener("abort", abortHandler);
|
|
1991
|
-
}
|
|
1992
|
-
return {
|
|
1993
|
-
signal: controller.signal,
|
|
1994
|
-
cleanup: () => {
|
|
1995
|
-
clearTimeout(timeoutId);
|
|
1996
|
-
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
1997
|
-
},
|
|
1998
|
-
isTimeout: () => timedOut
|
|
1999
|
-
};
|
|
2000
|
-
}
|
|
2001
|
-
function wrapStreamWithIdleTimeout(stream, idleTimeoutMs, externalSignal) {
|
|
2002
|
-
const reader = stream.getReader();
|
|
2003
|
-
const controller = new AbortController();
|
|
2004
|
-
let timeoutId;
|
|
2005
|
-
let abortHandler;
|
|
2006
|
-
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
2007
|
-
else {
|
|
2008
|
-
abortHandler = () => controller.abort();
|
|
2009
|
-
externalSignal.addEventListener("abort", abortHandler);
|
|
2010
|
-
}
|
|
2011
|
-
function resetTimeout() {
|
|
2012
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
2013
|
-
timeoutId = setTimeout(() => controller.abort(), idleTimeoutMs);
|
|
2014
|
-
}
|
|
2015
|
-
function cleanup() {
|
|
2016
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
2017
|
-
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
2018
|
-
}
|
|
2019
|
-
return new ReadableStream({
|
|
2020
|
-
start() {
|
|
2021
|
-
resetTimeout();
|
|
2022
|
-
},
|
|
2023
|
-
async pull(streamController) {
|
|
2024
|
-
try {
|
|
2025
|
-
const result = await Promise.race([reader.read(), new Promise((_, reject) => {
|
|
2026
|
-
if (controller.signal.aborted) reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
2027
|
-
controller.signal.addEventListener("abort", () => {
|
|
2028
|
-
reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
2029
|
-
});
|
|
2030
|
-
})]);
|
|
2031
|
-
if (result.done) {
|
|
2032
|
-
cleanup();
|
|
2033
|
-
streamController.close();
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
resetTimeout();
|
|
2037
|
-
streamController.enqueue(result.value);
|
|
2038
|
-
} catch (error) {
|
|
2039
|
-
cleanup();
|
|
2040
|
-
reader.cancel().catch(() => {});
|
|
2041
|
-
if (error instanceof DOMException && error.name === "AbortError") streamController.error(new DOMException("Stream idle timeout", "AbortError"));
|
|
2042
|
-
else streamController.error(error);
|
|
2043
|
-
}
|
|
2044
|
-
},
|
|
2045
|
-
cancel(reason) {
|
|
2046
|
-
cleanup();
|
|
2047
|
-
reader.cancel(reason).catch(() => {});
|
|
2048
|
-
}
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
async function request$50(method, path, body, options) {
|
|
2052
|
-
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
2053
|
-
try {
|
|
2054
|
-
const response$52 = await fetch(buildUrl(path), {
|
|
2055
|
-
method,
|
|
2056
|
-
headers: buildHeaders(body ? { hasBody: true } : void 0),
|
|
2057
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
2058
|
-
signal,
|
|
2059
|
-
credentials: getCredentials()
|
|
2060
|
-
});
|
|
2061
|
-
if (!response$52.ok) return handleHttpError(response$52);
|
|
2062
|
-
return {
|
|
2063
|
-
ok: true,
|
|
2064
|
-
data: await response$52.json()
|
|
2065
|
-
};
|
|
2066
|
-
} catch (error) {
|
|
2067
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
2068
|
-
if (isTimeout()) return {
|
|
1636
|
+
//#region src/endpoints/env.ts
|
|
1637
|
+
function createEnvApi(fetcher) {
|
|
1638
|
+
return {
|
|
1639
|
+
secrets: createSecretsApi(fetcher),
|
|
1640
|
+
variables: createVariablesApi(fetcher)
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
//#endregion
|
|
1645
|
+
//#region src/endpoints/experts-versions.ts
|
|
1646
|
+
function createVersionsApi(fetcher, basePath) {
|
|
1647
|
+
return { async list(scopeName, options) {
|
|
1648
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1649
|
+
return fetcher.get(`${basePath}/${encodedScopeName}/versions`, options);
|
|
1650
|
+
} };
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
//#endregion
|
|
1654
|
+
//#region src/endpoints/experts.ts
|
|
1655
|
+
const BASE_PATH$2 = "/api/v1/experts";
|
|
1656
|
+
function createExpertsApi(fetcher) {
|
|
1657
|
+
return {
|
|
1658
|
+
async list(params, options) {
|
|
1659
|
+
if (params) {
|
|
1660
|
+
const result = request$9.query.safeParse(params);
|
|
1661
|
+
if (!result.success) return {
|
|
2069
1662
|
ok: false,
|
|
2070
|
-
error:
|
|
1663
|
+
error: createValidationError(result.error)
|
|
2071
1664
|
};
|
|
2072
|
-
|
|
1665
|
+
}
|
|
1666
|
+
const queryString = buildQueryString(params);
|
|
1667
|
+
return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
|
|
1668
|
+
},
|
|
1669
|
+
async get(key, options) {
|
|
1670
|
+
const encodedKey = encodeURIComponent(key);
|
|
1671
|
+
return fetcher.get(`${BASE_PATH$2}/${encodedKey}`, options);
|
|
1672
|
+
},
|
|
1673
|
+
async getFeatured(options) {
|
|
1674
|
+
return fetcher.get(`${BASE_PATH$2}/featured`, options);
|
|
1675
|
+
},
|
|
1676
|
+
async getMeta(key, options) {
|
|
1677
|
+
const encodedKey = encodeURIComponent(key);
|
|
1678
|
+
return fetcher.get(`${BASE_PATH$2}/${encodedKey}/meta`, options);
|
|
1679
|
+
},
|
|
1680
|
+
async publish(scopeName, options) {
|
|
1681
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1682
|
+
return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/publish`, {}, options);
|
|
1683
|
+
},
|
|
1684
|
+
async unpublish(scopeName, options) {
|
|
1685
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1686
|
+
return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/unpublish`, {}, options);
|
|
1687
|
+
},
|
|
1688
|
+
async yank(key, options) {
|
|
1689
|
+
const encodedKey = encodeURIComponent(key);
|
|
1690
|
+
return fetcher.delete(`${BASE_PATH$2}/${encodedKey}`, options);
|
|
1691
|
+
},
|
|
1692
|
+
versions: createVersionsApi(fetcher, BASE_PATH$2)
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
//#endregion
|
|
1697
|
+
//#region src/endpoints/jobs-checkpoints.ts
|
|
1698
|
+
function createCheckpointsApi(fetcher, basePath) {
|
|
1699
|
+
return {
|
|
1700
|
+
async list(jobId, params, options) {
|
|
1701
|
+
if (params) {
|
|
1702
|
+
const result = request$7.query.safeParse(params);
|
|
1703
|
+
if (!result.success) return {
|
|
2073
1704
|
ok: false,
|
|
2074
|
-
error:
|
|
1705
|
+
error: createValidationError(result.error)
|
|
2075
1706
|
};
|
|
2076
1707
|
}
|
|
2077
|
-
|
|
1708
|
+
const queryString = buildQueryString(params);
|
|
1709
|
+
return fetcher.get(`${basePath}/${jobId}/checkpoints${queryString}`, options);
|
|
1710
|
+
},
|
|
1711
|
+
async get(jobId, checkpointId, options) {
|
|
1712
|
+
return fetcher.get(`${basePath}/${jobId}/checkpoints/${checkpointId}`, options);
|
|
1713
|
+
},
|
|
1714
|
+
async create(jobId, input, options) {
|
|
1715
|
+
const result = request$8.body.safeParse(input);
|
|
1716
|
+
if (!result.success) return {
|
|
2078
1717
|
ok: false,
|
|
2079
|
-
error:
|
|
2080
|
-
};
|
|
2081
|
-
} finally {
|
|
2082
|
-
cleanup();
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
async function requestBlob(path, options) {
|
|
2086
|
-
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
2087
|
-
try {
|
|
2088
|
-
const response$52 = await fetch(buildUrl(path), {
|
|
2089
|
-
method: "GET",
|
|
2090
|
-
headers: buildHeaders(),
|
|
2091
|
-
signal,
|
|
2092
|
-
credentials: getCredentials()
|
|
2093
|
-
});
|
|
2094
|
-
if (!response$52.ok) return handleHttpError(response$52);
|
|
2095
|
-
return {
|
|
2096
|
-
ok: true,
|
|
2097
|
-
data: await response$52.blob()
|
|
1718
|
+
error: createValidationError(result.error)
|
|
2098
1719
|
};
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
1720
|
+
return fetcher.post(`${basePath}/${jobId}/checkpoints`, input, options);
|
|
1721
|
+
},
|
|
1722
|
+
async *stream(jobId, options) {
|
|
1723
|
+
const result = await fetcher.getStream(`${basePath}/${jobId}/checkpoints/stream`, options);
|
|
1724
|
+
if (!result.ok) {
|
|
1725
|
+
yield {
|
|
2102
1726
|
ok: false,
|
|
2103
|
-
error:
|
|
1727
|
+
error: result.error
|
|
2104
1728
|
};
|
|
2105
|
-
return
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
const reader = result.data.getReader();
|
|
1732
|
+
try {
|
|
1733
|
+
for await (const checkpoint of parseSSE(reader)) yield {
|
|
1734
|
+
ok: true,
|
|
1735
|
+
data: checkpoint
|
|
1736
|
+
};
|
|
1737
|
+
} catch (error) {
|
|
1738
|
+
if (error instanceof DOMException && error.name === "AbortError") yield {
|
|
2106
1739
|
ok: false,
|
|
2107
1740
|
error: createAbortError()
|
|
2108
1741
|
};
|
|
2109
|
-
|
|
2110
|
-
return {
|
|
2111
|
-
ok: false,
|
|
2112
|
-
error: createNetworkError(error)
|
|
2113
|
-
};
|
|
2114
|
-
} finally {
|
|
2115
|
-
cleanup();
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
async function requestStream(path, options) {
|
|
2119
|
-
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
2120
|
-
try {
|
|
2121
|
-
const response$52 = await fetch(buildUrl(path), {
|
|
2122
|
-
method: "GET",
|
|
2123
|
-
headers: buildHeaders(),
|
|
2124
|
-
signal,
|
|
2125
|
-
credentials: getCredentials()
|
|
2126
|
-
});
|
|
2127
|
-
if (!response$52.ok) {
|
|
2128
|
-
cleanup();
|
|
2129
|
-
return handleHttpError(response$52);
|
|
2130
|
-
}
|
|
2131
|
-
if (!response$52.body) {
|
|
2132
|
-
cleanup();
|
|
2133
|
-
return {
|
|
1742
|
+
else yield {
|
|
2134
1743
|
ok: false,
|
|
2135
|
-
error: createNetworkError(
|
|
1744
|
+
error: createNetworkError(error)
|
|
2136
1745
|
};
|
|
2137
1746
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
return {
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
//#endregion
|
|
1752
|
+
//#region src/endpoints/jobs.ts
|
|
1753
|
+
const BASE_PATH$1 = "/api/v1/jobs";
|
|
1754
|
+
function createJobsApi(fetcher) {
|
|
1755
|
+
return {
|
|
1756
|
+
async list(params, options) {
|
|
1757
|
+
if (params) {
|
|
1758
|
+
const result = request$4.query.safeParse(params);
|
|
1759
|
+
if (!result.success) return {
|
|
2152
1760
|
ok: false,
|
|
2153
|
-
error:
|
|
1761
|
+
error: createValidationError(result.error)
|
|
2154
1762
|
};
|
|
2155
1763
|
}
|
|
2156
|
-
|
|
1764
|
+
const queryString = buildQueryString(params);
|
|
1765
|
+
return fetcher.get(`${BASE_PATH$1}${queryString}`, options);
|
|
1766
|
+
},
|
|
1767
|
+
async get(id, options) {
|
|
1768
|
+
return fetcher.get(`${BASE_PATH$1}/${id}`, options);
|
|
1769
|
+
},
|
|
1770
|
+
async start(input, options) {
|
|
1771
|
+
const result = request$5.body.safeParse(input);
|
|
1772
|
+
if (!result.success) return {
|
|
2157
1773
|
ok: false,
|
|
2158
|
-
error:
|
|
1774
|
+
error: createValidationError(result.error)
|
|
2159
1775
|
};
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
headers: buildHeaders(),
|
|
2168
|
-
signal,
|
|
2169
|
-
credentials: getCredentials()
|
|
2170
|
-
});
|
|
2171
|
-
if (!response$52.ok) return handleHttpError(response$52);
|
|
2172
|
-
return {
|
|
2173
|
-
ok: true,
|
|
2174
|
-
data: void 0
|
|
1776
|
+
return fetcher.post(BASE_PATH$1, input, options);
|
|
1777
|
+
},
|
|
1778
|
+
async update(id, input, options) {
|
|
1779
|
+
const result = request$3.body.safeParse(input);
|
|
1780
|
+
if (!result.success) return {
|
|
1781
|
+
ok: false,
|
|
1782
|
+
error: createValidationError(result.error)
|
|
2175
1783
|
};
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
};
|
|
2182
|
-
return {
|
|
2183
|
-
ok: false,
|
|
2184
|
-
error: createAbortError()
|
|
2185
|
-
};
|
|
2186
|
-
}
|
|
2187
|
-
return {
|
|
1784
|
+
return fetcher.post(`${BASE_PATH$1}/${id}`, input, options);
|
|
1785
|
+
},
|
|
1786
|
+
async continue(id, input, options) {
|
|
1787
|
+
const result = request$6.body.safeParse(input);
|
|
1788
|
+
if (!result.success) return {
|
|
2188
1789
|
ok: false,
|
|
2189
|
-
error:
|
|
1790
|
+
error: createValidationError(result.error)
|
|
2190
1791
|
};
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
1792
|
+
return fetcher.post(`${BASE_PATH$1}/${id}/continue`, input, options);
|
|
1793
|
+
},
|
|
1794
|
+
async cancel(id, options) {
|
|
1795
|
+
return fetcher.post(`${BASE_PATH$1}/${id}/cancel`, {}, options);
|
|
1796
|
+
},
|
|
1797
|
+
checkpoints: createCheckpointsApi(fetcher, BASE_PATH$1)
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
//#endregion
|
|
1802
|
+
//#region src/endpoints/provider-settings.ts
|
|
1803
|
+
const BASE_PATH = "/api/v1/applications";
|
|
1804
|
+
function createProviderSettingsApi(fetcher) {
|
|
2195
1805
|
return {
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
1806
|
+
async list(applicationId, options) {
|
|
1807
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings`, options);
|
|
1808
|
+
},
|
|
1809
|
+
async get(applicationId, provider, options) {
|
|
1810
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1811
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
1812
|
+
},
|
|
1813
|
+
async create(applicationId, input, options) {
|
|
1814
|
+
const result = request$1.body.safeParse(input);
|
|
1815
|
+
if (!result.success) return {
|
|
1816
|
+
ok: false,
|
|
1817
|
+
error: createValidationError(result.error)
|
|
1818
|
+
};
|
|
1819
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings`, input, options);
|
|
1820
|
+
},
|
|
1821
|
+
async update(applicationId, provider, input, options) {
|
|
1822
|
+
const result = request.body.safeParse(input);
|
|
1823
|
+
if (!result.success) return {
|
|
1824
|
+
ok: false,
|
|
1825
|
+
error: createValidationError(result.error)
|
|
1826
|
+
};
|
|
1827
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1828
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, input, options);
|
|
1829
|
+
},
|
|
1830
|
+
async delete(applicationId, provider, options) {
|
|
1831
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1832
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
1833
|
+
},
|
|
1834
|
+
async listApiKeys(applicationId, provider, options) {
|
|
1835
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1836
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, options);
|
|
1837
|
+
},
|
|
1838
|
+
async createApiKey(applicationId, provider, input, options) {
|
|
1839
|
+
const result = request$2.body.safeParse(input);
|
|
1840
|
+
if (!result.success) return {
|
|
1841
|
+
ok: false,
|
|
1842
|
+
error: createValidationError(result.error)
|
|
1843
|
+
};
|
|
1844
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1845
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, input, options);
|
|
1846
|
+
},
|
|
1847
|
+
async deleteApiKey(applicationId, provider, apiKeyId, options) {
|
|
1848
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1849
|
+
const encodedApiKeyId = encodeURIComponent(apiKeyId);
|
|
1850
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys/${encodedApiKeyId}`, options);
|
|
1851
|
+
}
|
|
2203
1852
|
};
|
|
2204
1853
|
}
|
|
2205
1854
|
|
|
2206
1855
|
//#endregion
|
|
2207
|
-
//#region src/client
|
|
1856
|
+
//#region src/public/client.ts
|
|
2208
1857
|
function createApiClient(config) {
|
|
2209
1858
|
const fetcher = createFetcher(config);
|
|
2210
1859
|
return {
|
|
@@ -2217,45 +1866,6 @@ function createApiClient(config) {
|
|
|
2217
1866
|
};
|
|
2218
1867
|
}
|
|
2219
1868
|
|
|
2220
|
-
//#endregion
|
|
2221
|
-
//#region src/lib/api-key.ts
|
|
2222
|
-
function matchWildcard(value, pattern) {
|
|
2223
|
-
if (pattern === "*") return true;
|
|
2224
|
-
if (pattern.endsWith("*")) return value.startsWith(pattern.slice(0, -1));
|
|
2225
|
-
if (pattern.startsWith("*")) return value.endsWith(pattern.slice(1));
|
|
2226
|
-
return value === pattern;
|
|
2227
|
-
}
|
|
2228
|
-
function matchOperations(operations, requiredOperation) {
|
|
2229
|
-
return operations.some((pattern) => matchWildcard(requiredOperation, pattern));
|
|
2230
|
-
}
|
|
2231
|
-
function matchExperts(experts, expertId) {
|
|
2232
|
-
if (experts === void 0 || experts === "*") return true;
|
|
2233
|
-
return experts.some((pattern) => matchWildcard(expertId, pattern));
|
|
2234
|
-
}
|
|
2235
|
-
function isApiKeyPermissions(parsed) {
|
|
2236
|
-
return typeof parsed === "object" && parsed !== null && "operations" in parsed && Array.isArray(parsed.operations);
|
|
2237
|
-
}
|
|
2238
|
-
function parseApiKeyPermissions(permissionsJson) {
|
|
2239
|
-
if (!permissionsJson) return null;
|
|
2240
|
-
try {
|
|
2241
|
-
const parsed = JSON.parse(permissionsJson);
|
|
2242
|
-
if (!isApiKeyPermissions(parsed)) return null;
|
|
2243
|
-
return parsed;
|
|
2244
|
-
} catch {
|
|
2245
|
-
return null;
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
function stringifyApiKeyPermissions(permissions) {
|
|
2249
|
-
return JSON.stringify(permissions);
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
//#endregion
|
|
2253
|
-
//#region src/lib/auth.ts
|
|
2254
|
-
function buildAuthHeaders(auth) {
|
|
2255
|
-
if (auth.type === "apiKey") return { Authorization: `Bearer ${auth.apiKey}` };
|
|
2256
|
-
return { Cookie: auth.cookie };
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
1869
|
//#endregion
|
|
2260
1870
|
export { buildAuthHeaders, buildQueryString, createAbortError, createApiClient, createFetcher, createHttpError, createNetworkError, createTimeoutError, createValidationError, handleHttpError, isAbortError, isClientError, isHttpError, isNetworkError, isTimeoutError, isValidationError, matchExperts, matchOperations, matchWildcard, parseApiKeyPermissions, parseSSE, stringifyApiKeyPermissions };
|
|
2261
|
-
//# sourceMappingURL=
|
|
1871
|
+
//# sourceMappingURL=index.mjs.map
|