@perstack/api-client 0.0.47 → 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/README.md +38 -51
- package/dist/index.d.mts +1352 -1171
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +845 -985
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,421 @@ 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;
|
|
416
|
+
const applicationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
8
417
|
const maxApplicationNameLength = 255;
|
|
418
|
+
const maxVariableValueLength = 65536;
|
|
419
|
+
const maxSecretValueLength = 65536;
|
|
9
420
|
const expertKeyRegex = /^((?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*)(?:@((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?)|@([a-z0-9][a-z0-9_.-]*))?$/;
|
|
10
421
|
const expertNameRegex = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
|
|
11
422
|
const scopeNameRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
@@ -41,19 +452,19 @@ const maxProviderHeadersCount = 50;
|
|
|
41
452
|
|
|
42
453
|
//#endregion
|
|
43
454
|
//#region ../models/src/domain/common.ts
|
|
44
|
-
const cuidSchema = z.cuid2();
|
|
455
|
+
const cuidSchema = z.string().cuid2();
|
|
456
|
+
const cuidRequestSchema = z.string().min(24).cuid2();
|
|
45
457
|
const runtimeVersionSchema = z.enum(["v1.0"]);
|
|
46
458
|
const providerSchema = z.enum([
|
|
47
459
|
"anthropic",
|
|
48
460
|
"google",
|
|
49
461
|
"openai",
|
|
50
|
-
"ollama",
|
|
51
462
|
"deepseek",
|
|
52
463
|
"azure-openai",
|
|
53
464
|
"amazon-bedrock",
|
|
54
465
|
"google-vertex"
|
|
55
466
|
]);
|
|
56
|
-
const datetimeSchema = z.string().datetime();
|
|
467
|
+
const datetimeSchema = z.string().datetime({ offset: true });
|
|
57
468
|
const expertKeyFieldSchema = z.string().min(1).max(maxExpertKeyLength).regex(expertKeyRegex);
|
|
58
469
|
const expertNameFieldSchema = z.string().min(1).max(maxExpertNameLength).regex(expertNameRegex);
|
|
59
470
|
const expertVersionFieldSchema = z.string().min(1).max(maxExpertVersionTagLength).regex(expertVersionRegex);
|
|
@@ -98,41 +509,84 @@ const organizationSchema = z.object({
|
|
|
98
509
|
});
|
|
99
510
|
|
|
100
511
|
//#endregion
|
|
101
|
-
//#region ../models/src/domain/
|
|
102
|
-
const
|
|
103
|
-
const applicationStatusSchema = z.enum([
|
|
512
|
+
//#region ../models/src/domain/user.ts
|
|
513
|
+
const userStatusSchema = z.enum([
|
|
104
514
|
"active",
|
|
105
515
|
"inactive",
|
|
106
516
|
"deleted"
|
|
107
517
|
]);
|
|
108
|
-
const
|
|
109
|
-
type: z.literal("
|
|
518
|
+
const userSchema = z.object({
|
|
519
|
+
type: z.literal("user"),
|
|
110
520
|
id: cuidSchema,
|
|
111
|
-
|
|
112
|
-
|
|
521
|
+
email: z.string().email(),
|
|
522
|
+
emailVerified: z.boolean(),
|
|
523
|
+
name: z.string().min(1).max(255).optional(),
|
|
524
|
+
image: z.string().url().optional(),
|
|
525
|
+
status: userStatusSchema,
|
|
526
|
+
organizations: z.array(organizationSchema),
|
|
113
527
|
createdAt: datetimeSchema,
|
|
114
|
-
updatedAt: datetimeSchema
|
|
115
|
-
name: applicationNameSchema,
|
|
116
|
-
status: applicationStatusSchema
|
|
528
|
+
updatedAt: datetimeSchema
|
|
117
529
|
});
|
|
118
530
|
|
|
119
531
|
//#endregion
|
|
120
|
-
//#region ../models/src/
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
})
|
|
125
|
-
const
|
|
532
|
+
//#region ../models/src/domain/apiKey.ts
|
|
533
|
+
const apiKeyPermissionsSchema = z.object({
|
|
534
|
+
operations: z.array(z.string()),
|
|
535
|
+
experts: z.union([z.array(z.string()), z.literal("*")]).optional()
|
|
536
|
+
});
|
|
537
|
+
const apiKeySchema = z.object({
|
|
538
|
+
type: z.literal("apiKey"),
|
|
539
|
+
id: cuidSchema,
|
|
540
|
+
name: z.string().min(1).max(255).optional(),
|
|
541
|
+
start: z.string().optional(),
|
|
542
|
+
prefix: z.string().optional(),
|
|
543
|
+
user: userSchema.optional(),
|
|
544
|
+
enabled: z.boolean(),
|
|
545
|
+
expiresAt: datetimeSchema.optional(),
|
|
546
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
547
|
+
lastRequest: datetimeSchema.optional(),
|
|
548
|
+
createdAt: datetimeSchema,
|
|
549
|
+
updatedAt: datetimeSchema
|
|
550
|
+
});
|
|
551
|
+
const createApiKeyInputSchema = z.object({
|
|
552
|
+
name: z.string().min(1).max(255).optional(),
|
|
553
|
+
organizationId: cuidSchema,
|
|
554
|
+
operations: z.array(z.string()).optional(),
|
|
555
|
+
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
556
|
+
expiresIn: z.number().min(60).optional()
|
|
557
|
+
});
|
|
558
|
+
const createApiKeyResponseSchema = z.object({
|
|
559
|
+
apiKey: apiKeySchema,
|
|
560
|
+
key: z.string()
|
|
561
|
+
});
|
|
126
562
|
|
|
127
563
|
//#endregion
|
|
128
|
-
//#region ../models/src/api/
|
|
129
|
-
const request$
|
|
130
|
-
|
|
564
|
+
//#region ../models/src/api/api-keys/create.ts
|
|
565
|
+
const request$22 = { body: z.object({
|
|
566
|
+
name: z.string().min(1).max(255).optional(),
|
|
567
|
+
operations: z.array(z.string()).optional(),
|
|
568
|
+
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
569
|
+
wildcardApplicationAccess: z.boolean().optional(),
|
|
570
|
+
applicationIds: z.array(cuidSchema).optional(),
|
|
571
|
+
expiresIn: z.number().min(60).optional()
|
|
572
|
+
}) };
|
|
573
|
+
const response$22 = z.object({ data: z.object({
|
|
574
|
+
apiKey: apiKeySchema.extend({
|
|
575
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
576
|
+
wildcardApplicationAccess: z.boolean(),
|
|
577
|
+
applicationIds: z.array(cuidSchema)
|
|
578
|
+
}),
|
|
579
|
+
key: z.string()
|
|
580
|
+
}) });
|
|
131
581
|
|
|
132
582
|
//#endregion
|
|
133
|
-
//#region ../models/src/api/
|
|
134
|
-
const request$
|
|
135
|
-
const response$
|
|
583
|
+
//#region ../models/src/api/api-keys/get.ts
|
|
584
|
+
const request$21 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
585
|
+
const response$21 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
586
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
587
|
+
wildcardApplicationAccess: z.boolean(),
|
|
588
|
+
applicationIds: z.array(cuidSchema)
|
|
589
|
+
}) }) });
|
|
136
590
|
|
|
137
591
|
//#endregion
|
|
138
592
|
//#region ../../node_modules/ts-dedent/dist/index.js
|
|
@@ -213,15 +667,68 @@ const paginationMeta = z.object({
|
|
|
213
667
|
take: z.number().int().min(1),
|
|
214
668
|
skip: z.number().int().min(0)
|
|
215
669
|
});
|
|
216
|
-
const errorUnauthorizedFlexible = z.object({
|
|
217
|
-
code: z.literal(401),
|
|
218
|
-
error: z.literal("Unauthorized"),
|
|
219
|
-
reason: z.string()
|
|
220
|
-
}).describe("Unauthorized");
|
|
670
|
+
const errorUnauthorizedFlexible = z.object({
|
|
671
|
+
code: z.literal(401),
|
|
672
|
+
error: z.literal("Unauthorized"),
|
|
673
|
+
reason: z.string()
|
|
674
|
+
}).describe("Unauthorized");
|
|
675
|
+
|
|
676
|
+
//#endregion
|
|
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({
|
|
680
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
681
|
+
wildcardApplicationAccess: z.boolean(),
|
|
682
|
+
applicationIds: z.array(cuidSchema)
|
|
683
|
+
}) }) });
|
|
684
|
+
|
|
685
|
+
//#endregion
|
|
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({
|
|
695
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
696
|
+
wildcardApplicationAccess: z.boolean(),
|
|
697
|
+
applicationIds: z.array(cuidSchema)
|
|
698
|
+
}) }) });
|
|
699
|
+
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region ../models/src/domain/application.ts
|
|
702
|
+
const applicationNameSchema = z.string().min(1).max(maxApplicationNameLength).regex(applicationNameRegex);
|
|
703
|
+
const applicationStatusSchema = z.enum([
|
|
704
|
+
"active",
|
|
705
|
+
"inactive",
|
|
706
|
+
"deleted"
|
|
707
|
+
]);
|
|
708
|
+
const applicationSchema = z.object({
|
|
709
|
+
type: z.literal("application"),
|
|
710
|
+
id: cuidSchema,
|
|
711
|
+
organizationId: cuidSchema,
|
|
712
|
+
organization: organizationSchema,
|
|
713
|
+
createdAt: datetimeSchema,
|
|
714
|
+
updatedAt: datetimeSchema,
|
|
715
|
+
name: applicationNameSchema,
|
|
716
|
+
status: applicationStatusSchema,
|
|
717
|
+
expertCount: z.number().describe("Number of expert draft scopes associated with this application").optional(),
|
|
718
|
+
providers: z.array(providerSchema).describe("List of configured providers for this application").optional()
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region ../models/src/api/applications/create.ts
|
|
723
|
+
const request$18 = { body: z.object({
|
|
724
|
+
name: applicationNameSchema,
|
|
725
|
+
applicationGroupId: cuidSchema.optional()
|
|
726
|
+
}) };
|
|
727
|
+
const response$18 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
221
728
|
|
|
222
729
|
//#endregion
|
|
223
730
|
//#region ../models/src/api/applications/getAll.ts
|
|
224
|
-
const request$
|
|
731
|
+
const request$17 = { query: z.object({
|
|
225
732
|
name: z.union([z.string(), z.array(z.string())]).optional().transform((v) => Array.isArray(v) ? v.join(",") : v),
|
|
226
733
|
sort: z.enum([
|
|
227
734
|
"name",
|
|
@@ -229,29 +736,29 @@ const request$35 = { query: z.object({
|
|
|
229
736
|
"updatedAt"
|
|
230
737
|
]).optional(),
|
|
231
738
|
order: z.enum(["asc", "desc"]).optional(),
|
|
232
|
-
take: z.coerce.number().min(1).max(100).default(
|
|
739
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
233
740
|
skip: z.coerce.number().min(0).default(0)
|
|
234
741
|
}) };
|
|
235
|
-
const response$
|
|
742
|
+
const response$17 = z.object({
|
|
236
743
|
data: z.object({ applications: z.array(applicationSchema) }),
|
|
237
744
|
meta: paginationMeta
|
|
238
745
|
});
|
|
239
746
|
|
|
240
747
|
//#endregion
|
|
241
748
|
//#region ../models/src/api/applications/update.ts
|
|
242
|
-
const request$
|
|
749
|
+
const request$16 = {
|
|
243
750
|
params: z.object({ applicationId: cuidSchema }),
|
|
244
751
|
body: z.object({
|
|
245
752
|
name: applicationNameSchema.optional(),
|
|
246
753
|
status: applicationStatusSchema.exclude(["deleted"]).optional()
|
|
247
754
|
}).refine((data) => data.name !== void 0 || data.status !== void 0, { message: "At least one field must be provided" })
|
|
248
755
|
};
|
|
249
|
-
const response$
|
|
756
|
+
const response$16 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
250
757
|
|
|
251
758
|
//#endregion
|
|
252
759
|
//#region ../models/src/domain/secret.ts
|
|
253
760
|
const secretNameSchema = z.string().min(1, "Secret name is required").max(255, "Secret name must be 255 characters or less").regex(/^[A-Z][A-Z0-9_]*$/, "Secret name must start with uppercase letter and contain only uppercase letters, numbers, and underscores");
|
|
254
|
-
const secretValueSchema = z.string().min(1, "Secret value is required");
|
|
761
|
+
const secretValueSchema = z.string().min(1, "Secret value is required").max(maxSecretValueLength);
|
|
255
762
|
const secretMetadataSchema = z.object({
|
|
256
763
|
name: z.string(),
|
|
257
764
|
createdAt: datetimeSchema,
|
|
@@ -268,49 +775,33 @@ const secretSchema = z.object({
|
|
|
268
775
|
|
|
269
776
|
//#endregion
|
|
270
777
|
//#region ../models/src/api/env/secrets/create.ts
|
|
271
|
-
const request$
|
|
778
|
+
const request$15 = { body: z.object({
|
|
272
779
|
applicationId: cuidSchema,
|
|
273
780
|
name: secretNameSchema,
|
|
274
781
|
value: secretValueSchema
|
|
275
782
|
}) };
|
|
276
|
-
const response$
|
|
277
|
-
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region ../models/src/api/env/secrets/delete.ts
|
|
280
|
-
const request$32 = {
|
|
281
|
-
params: z.object({ name: z.string().min(1) }),
|
|
282
|
-
query: z.object({ applicationId: cuidSchema })
|
|
283
|
-
};
|
|
284
|
-
const response$34 = z.null();
|
|
285
|
-
|
|
286
|
-
//#endregion
|
|
287
|
-
//#region ../models/src/api/env/secrets/get.ts
|
|
288
|
-
const request$31 = {
|
|
289
|
-
params: z.object({ name: z.string().min(1) }),
|
|
290
|
-
query: z.object({ applicationId: cuidSchema })
|
|
291
|
-
};
|
|
292
|
-
const response$33 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
783
|
+
const response$15 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
293
784
|
|
|
294
785
|
//#endregion
|
|
295
786
|
//#region ../models/src/api/env/secrets/getAll.ts
|
|
296
|
-
const request$
|
|
297
|
-
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) }) });
|
|
298
789
|
|
|
299
790
|
//#endregion
|
|
300
791
|
//#region ../models/src/api/env/secrets/update.ts
|
|
301
|
-
const request$
|
|
792
|
+
const request$13 = {
|
|
302
793
|
params: z.object({ name: z.string().min(1) }),
|
|
303
794
|
body: z.object({
|
|
304
795
|
applicationId: cuidSchema,
|
|
305
796
|
value: secretValueSchema
|
|
306
797
|
})
|
|
307
798
|
};
|
|
308
|
-
const response$
|
|
799
|
+
const response$13 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
309
800
|
|
|
310
801
|
//#endregion
|
|
311
802
|
//#region ../models/src/domain/variable.ts
|
|
312
|
-
const variableNameSchema = z.string().min(1).max(255).regex(/^[A-
|
|
313
|
-
const variableValueSchema = z.string();
|
|
803
|
+
const variableNameSchema = z.string().min(1).max(255).regex(/^[A-Z][A-Z0-9_]*$/, "Variable name must start with uppercase letter and contain only uppercase letters, digits, and underscores");
|
|
804
|
+
const variableValueSchema = z.string().max(maxVariableValueLength);
|
|
314
805
|
const variableSchema = z.object({
|
|
315
806
|
type: z.literal("variable"),
|
|
316
807
|
id: cuidSchema,
|
|
@@ -329,44 +820,28 @@ const variableResponseSchema = z.object({
|
|
|
329
820
|
|
|
330
821
|
//#endregion
|
|
331
822
|
//#region ../models/src/api/env/variables/create.ts
|
|
332
|
-
const request$
|
|
823
|
+
const request$12 = { body: z.object({
|
|
333
824
|
applicationId: cuidSchema,
|
|
334
825
|
name: variableNameSchema,
|
|
335
826
|
value: variableValueSchema
|
|
336
827
|
}) };
|
|
337
|
-
const response$
|
|
338
|
-
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region ../models/src/api/env/variables/delete.ts
|
|
341
|
-
const request$27 = {
|
|
342
|
-
params: z.object({ name: z.string().min(1) }),
|
|
343
|
-
query: z.object({ applicationId: cuidSchema })
|
|
344
|
-
};
|
|
345
|
-
const response$29 = z.null();
|
|
346
|
-
|
|
347
|
-
//#endregion
|
|
348
|
-
//#region ../models/src/api/env/variables/get.ts
|
|
349
|
-
const request$26 = {
|
|
350
|
-
params: z.object({ name: z.string().min(1) }),
|
|
351
|
-
query: z.object({ applicationId: cuidSchema })
|
|
352
|
-
};
|
|
353
|
-
const response$28 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
828
|
+
const response$12 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
354
829
|
|
|
355
830
|
//#endregion
|
|
356
831
|
//#region ../models/src/api/env/variables/getAll.ts
|
|
357
|
-
const request$
|
|
358
|
-
const response$
|
|
832
|
+
const request$11 = { query: z.object({ applicationId: cuidSchema }) };
|
|
833
|
+
const response$11 = z.object({ data: z.object({ variables: z.array(variableResponseSchema) }) });
|
|
359
834
|
|
|
360
835
|
//#endregion
|
|
361
836
|
//#region ../models/src/api/env/variables/update.ts
|
|
362
|
-
const request$
|
|
837
|
+
const request$10 = {
|
|
363
838
|
params: z.object({ name: z.string().min(1) }),
|
|
364
839
|
body: z.object({
|
|
365
840
|
applicationId: cuidSchema,
|
|
366
841
|
value: variableValueSchema
|
|
367
842
|
})
|
|
368
843
|
};
|
|
369
|
-
const response$
|
|
844
|
+
const response$10 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
370
845
|
|
|
371
846
|
//#endregion
|
|
372
847
|
//#region ../models/src/domain/expertScope.ts
|
|
@@ -374,6 +849,7 @@ const expertScopeSchema = z.object({
|
|
|
374
849
|
id: cuidSchema,
|
|
375
850
|
name: scopeNameSchema,
|
|
376
851
|
organizationId: cuidSchema,
|
|
852
|
+
expertDraftScopeId: cuidSchema,
|
|
377
853
|
published: z.boolean(),
|
|
378
854
|
publishedAt: datetimeSchema.optional(),
|
|
379
855
|
category: expertCategoryFieldSchema,
|
|
@@ -492,171 +968,9 @@ const expertWithMetadataSchema = expertSchema.extend({
|
|
|
492
968
|
version: expertVersionSchema
|
|
493
969
|
});
|
|
494
970
|
|
|
495
|
-
//#endregion
|
|
496
|
-
//#region ../models/src/api/experts/definition.ts
|
|
497
|
-
const expertDefinitionSchema = z.object({
|
|
498
|
-
name: expertNameFieldSchema,
|
|
499
|
-
version: expertVersionFieldSchema,
|
|
500
|
-
organizationId: cuidSchema,
|
|
501
|
-
createdAt: datetimeSchema,
|
|
502
|
-
updatedAt: datetimeSchema,
|
|
503
|
-
createdBy: cuidSchema,
|
|
504
|
-
updatedBy: cuidSchema,
|
|
505
|
-
experts: z.record(expertKeyFieldSchema, expertSchema.omit({ key: true }))
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
//#endregion
|
|
509
|
-
//#region ../models/src/api/experts/delete.ts
|
|
510
|
-
const request$23 = { params: z.object({ scopeName: scopeNameRefSchema }) };
|
|
511
|
-
const response$25 = z.object({ data: expertMetadataSchema.extend({
|
|
512
|
-
yanked: z.literal(true),
|
|
513
|
-
latestTagUpdated: z.boolean()
|
|
514
|
-
}) });
|
|
515
|
-
|
|
516
|
-
//#endregion
|
|
517
|
-
//#region ../models/src/domain/expertDraftScope.ts
|
|
518
|
-
const expertDraftScopeSchema = z.object({
|
|
519
|
-
id: cuidSchema,
|
|
520
|
-
name: scopeNameSchema,
|
|
521
|
-
organizationId: cuidSchema,
|
|
522
|
-
applicationId: cuidSchema,
|
|
523
|
-
totalRuns: z.number().int().min(0),
|
|
524
|
-
totalJobs: z.number().int().min(0),
|
|
525
|
-
createdAt: datetimeSchema,
|
|
526
|
-
updatedAt: datetimeSchema,
|
|
527
|
-
createdBy: cuidSchema,
|
|
528
|
-
updatedBy: cuidSchema
|
|
529
|
-
});
|
|
530
|
-
const expertDraftRefSchema = z.object({
|
|
531
|
-
id: cuidSchema,
|
|
532
|
-
expertDraftScopeId: cuidSchema,
|
|
533
|
-
totalRuns: z.number().int().min(0),
|
|
534
|
-
totalJobs: z.number().int().min(0),
|
|
535
|
-
createdAt: datetimeSchema,
|
|
536
|
-
updatedAt: datetimeSchema,
|
|
537
|
-
createdBy: cuidSchema,
|
|
538
|
-
updatedBy: cuidSchema
|
|
539
|
-
});
|
|
540
|
-
const expertDraftScopeWithRefsSchema = expertDraftScopeSchema.extend({ draftRefs: z.array(expertDraftRefSchema) });
|
|
541
|
-
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region ../models/src/api/experts/drafts/definition.ts
|
|
544
|
-
const expertDefinitionContentSchema = z.object({
|
|
545
|
-
name: expertNameFieldSchema,
|
|
546
|
-
version: z.literal("0.0.0-draft"),
|
|
547
|
-
applicationId: cuidSchema,
|
|
548
|
-
createdAt: datetimeSchema,
|
|
549
|
-
updatedAt: datetimeSchema,
|
|
550
|
-
createdBy: cuidSchema,
|
|
551
|
-
updatedBy: cuidSchema,
|
|
552
|
-
experts: z.record(expertKeyFieldSchema, expertSchema.omit({ key: true }))
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
//#endregion
|
|
556
|
-
//#region ../models/src/api/experts/drafts/create.ts
|
|
557
|
-
const request$22 = {
|
|
558
|
-
params: z.object({ scopeName: scopeNameSchema }),
|
|
559
|
-
body: z.object({
|
|
560
|
-
applicationId: cuidSchema,
|
|
561
|
-
experts: z.array(expertSchema)
|
|
562
|
-
})
|
|
563
|
-
};
|
|
564
|
-
const response$24 = z.object({ data: z.object({
|
|
565
|
-
scope: expertDraftScopeSchema,
|
|
566
|
-
draftRef: expertDraftRefSchema,
|
|
567
|
-
definition: expertDefinitionContentSchema
|
|
568
|
-
}) });
|
|
569
|
-
|
|
570
|
-
//#endregion
|
|
571
|
-
//#region ../models/src/api/experts/drafts/delete.ts
|
|
572
|
-
const request$21 = { params: z.object({
|
|
573
|
-
scopeName: scopeNameSchema,
|
|
574
|
-
draftRef: expertDraftRefSchema.shape.id
|
|
575
|
-
}) };
|
|
576
|
-
const response$23 = z.object({ data: z.object({
|
|
577
|
-
deleted: z.boolean(),
|
|
578
|
-
draftRef: z.string()
|
|
579
|
-
}) });
|
|
580
|
-
|
|
581
|
-
//#endregion
|
|
582
|
-
//#region ../models/src/api/experts/drafts/get.ts
|
|
583
|
-
const request$20 = { params: z.object({
|
|
584
|
-
scopeName: scopeNameSchema,
|
|
585
|
-
draftRef: expertDraftRefSchema.shape.id
|
|
586
|
-
}) };
|
|
587
|
-
const response$22 = z.object({ data: z.object({
|
|
588
|
-
scope: expertDraftScopeSchema,
|
|
589
|
-
draftRef: expertDraftRefSchema,
|
|
590
|
-
definition: expertDefinitionContentSchema
|
|
591
|
-
}) });
|
|
592
|
-
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region ../models/src/api/experts/drafts/getAll.ts
|
|
595
|
-
const request$19 = {
|
|
596
|
-
params: z.object({ scopeName: expertDraftScopeSchema.shape.name }),
|
|
597
|
-
query: z.object({
|
|
598
|
-
limit: z.coerce.number().int().min(1).max(100).optional().default(20),
|
|
599
|
-
offset: z.coerce.number().int().min(0).optional().default(0)
|
|
600
|
-
})
|
|
601
|
-
};
|
|
602
|
-
const response$21 = z.object({ data: z.object({
|
|
603
|
-
draftRefs: z.array(expertDraftRefSchema),
|
|
604
|
-
total: z.number().int().min(0)
|
|
605
|
-
}) });
|
|
606
|
-
|
|
607
|
-
//#endregion
|
|
608
|
-
//#region ../models/src/api/experts/drafts/update.ts
|
|
609
|
-
const request$18 = {
|
|
610
|
-
params: z.object({
|
|
611
|
-
scopeName: scopeNameSchema,
|
|
612
|
-
draftRef: expertDraftRefSchema.shape.id
|
|
613
|
-
}),
|
|
614
|
-
body: z.object({ experts: z.array(expertSchema) })
|
|
615
|
-
};
|
|
616
|
-
const response$20 = z.object({ data: z.object({
|
|
617
|
-
scope: expertDraftScopeSchema,
|
|
618
|
-
draftRef: expertDraftRefSchema,
|
|
619
|
-
definition: expertDefinitionContentSchema
|
|
620
|
-
}) });
|
|
621
|
-
|
|
622
|
-
//#endregion
|
|
623
|
-
//#region ../models/src/api/experts/drafts/version.ts
|
|
624
|
-
const request$17 = {
|
|
625
|
-
params: z.object({
|
|
626
|
-
scopeName: scopeNameSchema,
|
|
627
|
-
draftRef: z.string().min(1)
|
|
628
|
-
}),
|
|
629
|
-
body: z.object({
|
|
630
|
-
version: z.string().min(1, "Version is required.").max(maxExpertVersionTagLength, "Version is too long.").regex(expertVersionRegex, "Invalid version format. (e.g. 1.0.0)"),
|
|
631
|
-
tag: z.string().max(maxExpertVersionTagLength, "Tag is too long.").regex(tagNameRegex, "Invalid tag format. (e.g. latest)").optional()
|
|
632
|
-
})
|
|
633
|
-
};
|
|
634
|
-
const response$19 = z.object({ data: z.object({
|
|
635
|
-
scope: expertScopeSchema,
|
|
636
|
-
version: expertVersionSchema,
|
|
637
|
-
definitionUrl: z.string()
|
|
638
|
-
}) });
|
|
639
|
-
|
|
640
|
-
//#endregion
|
|
641
|
-
//#region ../models/src/api/experts/featured.ts
|
|
642
|
-
const response$18 = z.object({ data: z.object({ featuredExperts: z.array(z.object({
|
|
643
|
-
scope: expertScopeSchema,
|
|
644
|
-
currentVersion: expertVersionSchema,
|
|
645
|
-
displayOrder: z.number().int().min(0).max(2),
|
|
646
|
-
featuredAt: z.string().datetime()
|
|
647
|
-
})) }) });
|
|
648
|
-
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region ../models/src/api/experts/get.ts
|
|
651
|
-
const request$16 = { params: z.object({ scopeName: scopeNameRefSchema }) };
|
|
652
|
-
const response$17 = z.object({ data: z.object({
|
|
653
|
-
definition: expertDefinitionSchema,
|
|
654
|
-
yanked: z.boolean().optional()
|
|
655
|
-
}) });
|
|
656
|
-
|
|
657
971
|
//#endregion
|
|
658
972
|
//#region ../models/src/api/experts/getAll.ts
|
|
659
|
-
const request$
|
|
973
|
+
const request$9 = { query: z.object({
|
|
660
974
|
filter: z.string().describe("Filter by scope name (partial match)").optional(),
|
|
661
975
|
category: z.enum([
|
|
662
976
|
"general",
|
|
@@ -667,36 +981,13 @@ const request$15 = { query: z.object({
|
|
|
667
981
|
"automation"
|
|
668
982
|
]).describe("Filter by category").optional(),
|
|
669
983
|
includeDrafts: z.coerce.boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
|
|
670
|
-
|
|
671
|
-
|
|
984
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
985
|
+
skip: z.coerce.number().min(0).default(0)
|
|
672
986
|
}) };
|
|
673
|
-
const response$
|
|
674
|
-
experts: z.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema })),
|
|
675
|
-
|
|
676
|
-
})
|
|
677
|
-
|
|
678
|
-
//#endregion
|
|
679
|
-
//#region ../models/src/api/experts/meta.ts
|
|
680
|
-
const request$14 = {
|
|
681
|
-
params: z.object({ scopeName: scopeNameRefSchema }),
|
|
682
|
-
query: z.object({ public: z.enum(["true", "false"]).transform((val) => val === "true").optional().default(false).describe("Public access check (no auth)") })
|
|
683
|
-
};
|
|
684
|
-
const response$15 = z.object({ data: expertMetadataSchema.extend({ definitionUrl: z.string() }) });
|
|
685
|
-
|
|
686
|
-
//#endregion
|
|
687
|
-
//#region ../models/src/api/experts/publish.ts
|
|
688
|
-
const request$13 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
689
|
-
const response$14 = z.object({ data: z.object({ scope: expertScopeSchema }) });
|
|
690
|
-
|
|
691
|
-
//#endregion
|
|
692
|
-
//#region ../models/src/api/experts/unpublish.ts
|
|
693
|
-
const request$12 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
694
|
-
const response$13 = z.object({ data: z.object({ scope: expertScopeSchema }) });
|
|
695
|
-
|
|
696
|
-
//#endregion
|
|
697
|
-
//#region ../models/src/api/experts/versions.ts
|
|
698
|
-
const request$11 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
699
|
-
const response$12 = z.object({ data: z.object({ versions: z.array(expertVersionSchema) }) });
|
|
987
|
+
const response$9 = z.object({
|
|
988
|
+
data: z.object({ experts: z.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema.nullable() })) }),
|
|
989
|
+
meta: paginationMeta
|
|
990
|
+
});
|
|
700
991
|
|
|
701
992
|
//#endregion
|
|
702
993
|
//#region ../models/src/domain/checkpoint.ts
|
|
@@ -775,45 +1066,32 @@ const requestCheckpointSchema = perstackCheckpointSchema.omit({
|
|
|
775
1066
|
id: true,
|
|
776
1067
|
runId: true
|
|
777
1068
|
}).extend({ runId: z.string().optional() });
|
|
778
|
-
const request$
|
|
1069
|
+
const request$8 = {
|
|
779
1070
|
params: z.object({ jobId: cuidSchema }),
|
|
780
1071
|
body: z.object({
|
|
781
1072
|
checkpoint: requestCheckpointSchema,
|
|
782
1073
|
step: stepSchema
|
|
783
1074
|
})
|
|
784
1075
|
};
|
|
785
|
-
const response$
|
|
786
|
-
|
|
787
|
-
//#endregion
|
|
788
|
-
//#region ../models/src/api/jobs/checkpoints/get.ts
|
|
789
|
-
const request$9 = { params: z.object({
|
|
790
|
-
jobId: cuidSchema,
|
|
791
|
-
checkpointId: cuidSchema
|
|
792
|
-
}) };
|
|
793
|
-
const response$10 = z.object({ data: z.object({ checkpoint: apiCheckpointSchema }) });
|
|
1076
|
+
const response$8 = z.object({ data: z.object({ checkpoint: apiCheckpointSchema }) });
|
|
794
1077
|
|
|
795
1078
|
//#endregion
|
|
796
1079
|
//#region ../models/src/api/jobs/checkpoints/getAll.ts
|
|
797
|
-
const request$
|
|
1080
|
+
const request$7 = {
|
|
798
1081
|
params: z.object({ jobId: cuidSchema }),
|
|
799
1082
|
query: z.object({
|
|
800
1083
|
filter: z.string().min(1).max(256).optional(),
|
|
801
1084
|
sort: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
802
1085
|
order: z.enum(["asc", "desc"]).optional(),
|
|
803
|
-
take: z.coerce.number().min(1).max(100).default(
|
|
1086
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
804
1087
|
skip: z.coerce.number().min(0).default(0)
|
|
805
1088
|
})
|
|
806
1089
|
};
|
|
807
|
-
const response$
|
|
1090
|
+
const response$7 = z.object({
|
|
808
1091
|
data: z.object({ checkpoints: z.array(apiCheckpointSchema) }),
|
|
809
1092
|
meta: paginationMeta
|
|
810
1093
|
});
|
|
811
1094
|
|
|
812
|
-
//#endregion
|
|
813
|
-
//#region ../models/src/api/jobs/checkpoints/stream.ts
|
|
814
|
-
const request$7 = { params: z.object({ jobId: cuidSchema }) };
|
|
815
|
-
const response$8 = z.object({ data: apiCheckpointSchema });
|
|
816
|
-
|
|
817
1095
|
//#endregion
|
|
818
1096
|
//#region ../support-models/src/index.ts
|
|
819
1097
|
const anthropicSupportModels = [
|
|
@@ -1027,151 +1305,44 @@ const request$6 = {
|
|
|
1027
1305
|
maxRetries: z.coerce.number().optional()
|
|
1028
1306
|
})
|
|
1029
1307
|
};
|
|
1030
|
-
const response$7 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1031
|
-
|
|
1032
|
-
//#endregion
|
|
1033
|
-
//#region ../models/src/api/jobs/create.ts
|
|
1034
|
-
const request$5 = { body: z.object({
|
|
1035
|
-
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
1036
|
-
expertKey: expertKeyFieldSchema,
|
|
1037
|
-
query: jobSchema.shape.query.optional(),
|
|
1038
|
-
files: z.union([z.instanceof(File), z.array(z.instanceof(File))]).optional(),
|
|
1039
|
-
provider: providerSchema,
|
|
1040
|
-
model: jobSchema.shape.model.optional(),
|
|
1041
|
-
reasoningBudget: reasoningBudgetSchema.optional(),
|
|
1042
|
-
maxSteps: z.coerce.number().optional(),
|
|
1043
|
-
maxRetries: z.coerce.number().optional()
|
|
1044
|
-
}) };
|
|
1045
1308
|
const response$6 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1046
1309
|
|
|
1047
|
-
//#endregion
|
|
1048
|
-
//#region ../models/src/api/jobs/
|
|
1049
|
-
const request$
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
}) };
|
|
1060
|
-
const response$
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
//#endregion
|
|
1074
|
-
//#region ../models/src/api/jobs/workspace/get.ts
|
|
1075
|
-
const workspaceCommitSchema = z.object({
|
|
1076
|
-
sha: z.string(),
|
|
1077
|
-
message: z.string(),
|
|
1078
|
-
author: z.string(),
|
|
1079
|
-
timestamp: z.string()
|
|
1080
|
-
});
|
|
1081
|
-
const workspaceStatsSchema = z.object({
|
|
1082
|
-
commits: z.number().int().min(0),
|
|
1083
|
-
filesChanged: z.number().int().min(0),
|
|
1084
|
-
additions: z.number().int().min(0),
|
|
1085
|
-
deletions: z.number().int().min(0)
|
|
1086
|
-
});
|
|
1087
|
-
const workspaceSchema = z.object({
|
|
1088
|
-
jobId: z.string(),
|
|
1089
|
-
branch: z.string(),
|
|
1090
|
-
baseBranch: z.string(),
|
|
1091
|
-
lastCommit: workspaceCommitSchema.optional(),
|
|
1092
|
-
stats: workspaceStatsSchema.optional()
|
|
1093
|
-
});
|
|
1094
|
-
const request$1 = { params: z.object({ jobId: cuidSchema }) };
|
|
1095
|
-
const response$2 = z.object({ data: z.object({ workspace: workspaceSchema }) });
|
|
1096
|
-
|
|
1097
|
-
//#endregion
|
|
1098
|
-
//#region ../models/src/api/jobs/workspace/tree.ts
|
|
1099
|
-
const workspaceItemSchema = z.object({
|
|
1100
|
-
type: z.enum(["directory", "file"]),
|
|
1101
|
-
path: z.string(),
|
|
1102
|
-
name: z.string(),
|
|
1103
|
-
size: z.number().optional(),
|
|
1104
|
-
sha: z.string().optional()
|
|
1105
|
-
});
|
|
1106
|
-
const request = {
|
|
1107
|
-
params: z.object({ jobId: cuidSchema }),
|
|
1108
|
-
query: z.object({
|
|
1109
|
-
path: z.string().optional(),
|
|
1110
|
-
recursive: z.coerce.boolean().optional()
|
|
1111
|
-
})
|
|
1112
|
-
};
|
|
1113
|
-
const response$1 = z.object({ data: z.object({ items: z.array(workspaceItemSchema) }) });
|
|
1114
|
-
|
|
1115
|
-
//#endregion
|
|
1116
|
-
//#region ../models/src/domain/user.ts
|
|
1117
|
-
const userStatusSchema = z.enum([
|
|
1118
|
-
"active",
|
|
1119
|
-
"inactive",
|
|
1120
|
-
"deleted"
|
|
1121
|
-
]);
|
|
1122
|
-
const userSchema = z.object({
|
|
1123
|
-
type: z.literal("user"),
|
|
1124
|
-
id: cuidSchema,
|
|
1125
|
-
email: z.string().email(),
|
|
1126
|
-
emailVerified: z.boolean(),
|
|
1127
|
-
name: z.string().min(1).max(255).optional(),
|
|
1128
|
-
image: z.string().url().optional(),
|
|
1129
|
-
status: userStatusSchema,
|
|
1130
|
-
organizations: z.array(organizationSchema),
|
|
1131
|
-
createdAt: datetimeSchema,
|
|
1132
|
-
updatedAt: datetimeSchema
|
|
1133
|
-
});
|
|
1134
|
-
|
|
1135
|
-
//#endregion
|
|
1136
|
-
//#region ../models/src/api/session/get.ts
|
|
1137
|
-
const response = z.object({ data: z.object({
|
|
1138
|
-
user: userSchema,
|
|
1139
|
-
organization: organizationSchema,
|
|
1140
|
-
application: applicationSchema.nullable()
|
|
1141
|
-
}) });
|
|
1142
|
-
|
|
1143
|
-
//#endregion
|
|
1144
|
-
//#region ../models/src/domain/apiKey.ts
|
|
1145
|
-
const apiKeyPermissionsSchema = z.object({
|
|
1146
|
-
operations: z.array(z.string()),
|
|
1147
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional()
|
|
1148
|
-
});
|
|
1149
|
-
const apiKeySchema = z.object({
|
|
1150
|
-
type: z.literal("apiKey"),
|
|
1151
|
-
id: cuidSchema,
|
|
1152
|
-
name: z.string().min(1).max(255).optional(),
|
|
1153
|
-
start: z.string().optional(),
|
|
1154
|
-
prefix: z.string().optional(),
|
|
1155
|
-
user: userSchema.optional(),
|
|
1156
|
-
enabled: z.boolean(),
|
|
1157
|
-
expiresAt: datetimeSchema.optional(),
|
|
1158
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
1159
|
-
lastRequest: datetimeSchema.optional(),
|
|
1160
|
-
createdAt: datetimeSchema,
|
|
1161
|
-
updatedAt: datetimeSchema
|
|
1162
|
-
});
|
|
1163
|
-
const createApiKeyInputSchema = z.object({
|
|
1164
|
-
name: z.string().min(1).max(255).optional(),
|
|
1165
|
-
organizationId: cuidSchema,
|
|
1166
|
-
operations: z.array(z.string()).optional(),
|
|
1167
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
1168
|
-
expiresIn: z.number().min(60).optional()
|
|
1169
|
-
});
|
|
1170
|
-
const createApiKeyResponseSchema = z.object({
|
|
1171
|
-
apiKey: apiKeySchema,
|
|
1172
|
-
key: z.string()
|
|
1310
|
+
//#endregion
|
|
1311
|
+
//#region ../models/src/api/jobs/create.ts
|
|
1312
|
+
const request$5 = { body: z.object({
|
|
1313
|
+
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
1314
|
+
expertKey: expertKeyFieldSchema,
|
|
1315
|
+
query: jobSchema.shape.query.optional(),
|
|
1316
|
+
files: z.union([z.instanceof(File), z.array(z.instanceof(File))]).optional(),
|
|
1317
|
+
provider: providerSchema,
|
|
1318
|
+
model: jobSchema.shape.model.optional(),
|
|
1319
|
+
reasoningBudget: reasoningBudgetSchema.optional(),
|
|
1320
|
+
maxSteps: z.coerce.number().optional(),
|
|
1321
|
+
maxRetries: z.coerce.number().optional()
|
|
1322
|
+
}) };
|
|
1323
|
+
const response$5 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1324
|
+
|
|
1325
|
+
//#endregion
|
|
1326
|
+
//#region ../models/src/api/jobs/getAll.ts
|
|
1327
|
+
const request$4 = { query: z.object({
|
|
1328
|
+
sort: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
1329
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
1330
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
1331
|
+
skip: z.coerce.number().min(0).default(0)
|
|
1332
|
+
}) };
|
|
1333
|
+
const response$4 = z.object({
|
|
1334
|
+
data: z.object({ jobs: z.array(jobSchema) }),
|
|
1335
|
+
meta: paginationMeta
|
|
1173
1336
|
});
|
|
1174
1337
|
|
|
1338
|
+
//#endregion
|
|
1339
|
+
//#region ../models/src/api/jobs/update.ts
|
|
1340
|
+
const request$3 = {
|
|
1341
|
+
params: z.object({ jobId: cuidSchema }),
|
|
1342
|
+
body: z.object({ status: jobStatusSchema })
|
|
1343
|
+
};
|
|
1344
|
+
const response$3 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1345
|
+
|
|
1175
1346
|
//#endregion
|
|
1176
1347
|
//#region ../models/src/domain/providerSetting.ts
|
|
1177
1348
|
const baseUrlSchema = z.string().url().max(maxProviderBaseUrlLength).optional();
|
|
@@ -1228,215 +1399,235 @@ const providerSettingSchema = z.object({
|
|
|
1228
1399
|
createdAt: datetimeSchema,
|
|
1229
1400
|
updatedAt: datetimeSchema
|
|
1230
1401
|
});
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
//#region ../models/src/domain/providerApiKey.ts
|
|
1234
|
-
const providerApiKeyNameSchema = z.string().min(1).max(255);
|
|
1235
|
-
const providerApiKeyValueSchema = z.string().min(1);
|
|
1236
|
-
const providerApiKeySchema = z.object({
|
|
1237
|
-
type: z.literal("providerApiKey"),
|
|
1402
|
+
const providerSettingResponseSchema = z.object({
|
|
1403
|
+
type: z.literal("providerSetting"),
|
|
1238
1404
|
id: cuidSchema,
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
lastUsedAt: datetimeSchema.optional(),
|
|
1242
|
-
expiresAt: datetimeSchema.optional(),
|
|
1243
|
-
providerSetting: providerSettingSchema,
|
|
1405
|
+
provider: providerSchema,
|
|
1406
|
+
settings: providerSettingsSchema.optional(),
|
|
1244
1407
|
createdAt: datetimeSchema,
|
|
1245
1408
|
updatedAt: datetimeSchema
|
|
1246
1409
|
});
|
|
1247
|
-
|
|
1248
|
-
//#endregion
|
|
1249
|
-
//#region ../models/src/domain/run.ts
|
|
1250
|
-
const runStatusSchema = z.enum([
|
|
1251
|
-
"queued",
|
|
1252
|
-
"processing",
|
|
1253
|
-
"completed",
|
|
1254
|
-
"stoppedByInteractiveTool",
|
|
1255
|
-
"stoppedByDelegate",
|
|
1256
|
-
"stoppedByExceededMaxSteps",
|
|
1257
|
-
"stoppedByError"
|
|
1258
|
-
]);
|
|
1259
|
-
const runSchema = z.object({
|
|
1260
|
-
type: z.literal("run"),
|
|
1410
|
+
const providerApiKeyMetadataSchema = z.object({
|
|
1261
1411
|
id: cuidSchema,
|
|
1262
|
-
|
|
1263
|
-
parentRunId: cuidSchema.optional(),
|
|
1264
|
-
organizationId: cuidSchema,
|
|
1412
|
+
name: z.string(),
|
|
1265
1413
|
createdAt: datetimeSchema,
|
|
1266
1414
|
updatedAt: datetimeSchema,
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
expertKey: expertKeyFieldSchema,
|
|
1270
|
-
interactiveToolCallResult: z.boolean().optional(),
|
|
1271
|
-
expert: expertWithMetadataSchema,
|
|
1272
|
-
stepNumber: z.number().int().min(0),
|
|
1273
|
-
usage: usageSchema,
|
|
1274
|
-
machineId: z.string().optional()
|
|
1415
|
+
lastUsedAt: datetimeSchema.nullable(),
|
|
1416
|
+
expiresAt: datetimeSchema.nullable()
|
|
1275
1417
|
});
|
|
1276
1418
|
|
|
1277
1419
|
//#endregion
|
|
1278
|
-
//#region src/
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1420
|
+
//#region ../models/src/api/provider-settings/api-keys/create.ts
|
|
1421
|
+
const request$2 = {
|
|
1422
|
+
params: z.object({
|
|
1423
|
+
applicationId: cuidSchema,
|
|
1424
|
+
provider: providerSchema
|
|
1425
|
+
}),
|
|
1426
|
+
body: z.object({
|
|
1427
|
+
name: z.string().min(1).max(255),
|
|
1428
|
+
value: z.string().min(1)
|
|
1429
|
+
})
|
|
1430
|
+
};
|
|
1431
|
+
const response$2 = z.object({ data: z.object({ apiKey: providerApiKeyMetadataSchema }) });
|
|
1432
|
+
|
|
1433
|
+
//#endregion
|
|
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) {
|
|
1314
1459
|
return {
|
|
1315
|
-
|
|
1316
|
-
|
|
1460
|
+
async create(input, options) {
|
|
1461
|
+
const result = request$22.body.safeParse(input);
|
|
1462
|
+
if (!result.success) return {
|
|
1463
|
+
ok: false,
|
|
1464
|
+
error: createValidationError(result.error)
|
|
1465
|
+
};
|
|
1466
|
+
return fetcher.post(BASE_PATH$6, input, options);
|
|
1467
|
+
},
|
|
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 });
|
|
1478
|
+
if (!result.success) return {
|
|
1479
|
+
ok: false,
|
|
1480
|
+
error: createValidationError(result.error)
|
|
1481
|
+
};
|
|
1482
|
+
return fetcher.get(`${BASE_PATH$6}/${id}`, options);
|
|
1483
|
+
},
|
|
1484
|
+
async revoke(id, options) {
|
|
1485
|
+
const result = request$20.params.safeParse({ apiKeyId: id });
|
|
1486
|
+
if (!result.success) return {
|
|
1487
|
+
ok: false,
|
|
1488
|
+
error: createValidationError(result.error)
|
|
1489
|
+
};
|
|
1490
|
+
return fetcher.post(`${BASE_PATH$6}/${id}/revoke`, {}, options);
|
|
1491
|
+
},
|
|
1492
|
+
async update(id, input, options) {
|
|
1493
|
+
const paramsResult = request$19.params.safeParse({ apiKeyId: id });
|
|
1494
|
+
if (!paramsResult.success) return {
|
|
1495
|
+
ok: false,
|
|
1496
|
+
error: createValidationError(paramsResult.error)
|
|
1497
|
+
};
|
|
1498
|
+
const bodyResult = request$19.body.safeParse(input);
|
|
1499
|
+
if (!bodyResult.success) return {
|
|
1500
|
+
ok: false,
|
|
1501
|
+
error: createValidationError(bodyResult.error)
|
|
1502
|
+
};
|
|
1503
|
+
return fetcher.post(`${BASE_PATH$6}/${id}`, input, options);
|
|
1504
|
+
}
|
|
1317
1505
|
};
|
|
1318
1506
|
}
|
|
1319
1507
|
|
|
1320
1508
|
//#endregion
|
|
1321
1509
|
//#region src/endpoints/applications.ts
|
|
1322
|
-
const BASE_PATH$
|
|
1323
|
-
function buildQueryString$4(params) {
|
|
1324
|
-
if (!params) return "";
|
|
1325
|
-
const searchParams = new URLSearchParams();
|
|
1326
|
-
if (params.name !== void 0) searchParams.set("name", params.name);
|
|
1327
|
-
if (params.sort !== void 0) searchParams.set("sort", params.sort);
|
|
1328
|
-
if (params.order !== void 0) searchParams.set("order", params.order);
|
|
1329
|
-
if (params.take !== void 0) searchParams.set("take", params.take.toString());
|
|
1330
|
-
if (params.skip !== void 0) searchParams.set("skip", params.skip.toString());
|
|
1331
|
-
const queryString = searchParams.toString();
|
|
1332
|
-
return queryString ? `?${queryString}` : "";
|
|
1333
|
-
}
|
|
1510
|
+
const BASE_PATH$5 = "/api/v1/applications";
|
|
1334
1511
|
function createApplicationsApi(fetcher) {
|
|
1335
1512
|
return {
|
|
1336
1513
|
async list(params, options) {
|
|
1337
1514
|
if (params) {
|
|
1338
|
-
const result = request$
|
|
1515
|
+
const result = request$17.query.safeParse(params);
|
|
1339
1516
|
if (!result.success) return {
|
|
1340
1517
|
ok: false,
|
|
1341
1518
|
error: createValidationError(result.error)
|
|
1342
1519
|
};
|
|
1343
1520
|
}
|
|
1344
|
-
const queryString = buildQueryString
|
|
1345
|
-
return fetcher.get(`${BASE_PATH$
|
|
1521
|
+
const queryString = buildQueryString(params);
|
|
1522
|
+
return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
|
|
1346
1523
|
},
|
|
1347
1524
|
async get(id, options) {
|
|
1348
|
-
return fetcher.get(`${BASE_PATH$
|
|
1525
|
+
return fetcher.get(`${BASE_PATH$5}/${id}`, options);
|
|
1349
1526
|
},
|
|
1350
1527
|
async create(input, options) {
|
|
1351
|
-
const result = request$
|
|
1528
|
+
const result = request$18.body.safeParse(input);
|
|
1352
1529
|
if (!result.success) return {
|
|
1353
1530
|
ok: false,
|
|
1354
1531
|
error: createValidationError(result.error)
|
|
1355
1532
|
};
|
|
1356
|
-
return fetcher.post(BASE_PATH$
|
|
1533
|
+
return fetcher.post(BASE_PATH$5, input, options);
|
|
1357
1534
|
},
|
|
1358
1535
|
async update(id, input, options) {
|
|
1359
|
-
const result = request$
|
|
1536
|
+
const result = request$16.body.safeParse(input);
|
|
1360
1537
|
if (!result.success) return {
|
|
1361
1538
|
ok: false,
|
|
1362
1539
|
error: createValidationError(result.error)
|
|
1363
1540
|
};
|
|
1364
|
-
return fetcher.post(`${BASE_PATH$
|
|
1541
|
+
return fetcher.post(`${BASE_PATH$5}/${id}`, input, options);
|
|
1365
1542
|
},
|
|
1366
1543
|
async delete(id, options) {
|
|
1367
|
-
return fetcher.delete(`${BASE_PATH$
|
|
1544
|
+
return fetcher.delete(`${BASE_PATH$5}/${id}`, options);
|
|
1368
1545
|
}
|
|
1369
1546
|
};
|
|
1370
1547
|
}
|
|
1371
1548
|
|
|
1372
1549
|
//#endregion
|
|
1373
1550
|
//#region src/endpoints/env-secrets.ts
|
|
1374
|
-
const BASE_PATH$
|
|
1551
|
+
const BASE_PATH$4 = "/api/v1/env/secrets";
|
|
1375
1552
|
function createSecretsApi(fetcher) {
|
|
1376
1553
|
return {
|
|
1377
|
-
async list(options) {
|
|
1378
|
-
|
|
1554
|
+
async list(params, options) {
|
|
1555
|
+
if (params) {
|
|
1556
|
+
const result = request$14.query.safeParse(params);
|
|
1557
|
+
if (!result.success) return {
|
|
1558
|
+
ok: false,
|
|
1559
|
+
error: createValidationError(result.error)
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
const queryString = buildQueryString(params);
|
|
1563
|
+
return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
|
|
1379
1564
|
},
|
|
1380
1565
|
async get(name, options) {
|
|
1381
1566
|
const encodedName = encodeURIComponent(name);
|
|
1382
|
-
return fetcher.get(`${BASE_PATH$
|
|
1567
|
+
return fetcher.get(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1383
1568
|
},
|
|
1384
1569
|
async create(input, options) {
|
|
1385
|
-
const result = request$
|
|
1570
|
+
const result = request$15.body.safeParse(input);
|
|
1386
1571
|
if (!result.success) return {
|
|
1387
1572
|
ok: false,
|
|
1388
1573
|
error: createValidationError(result.error)
|
|
1389
1574
|
};
|
|
1390
|
-
return fetcher.post(BASE_PATH$
|
|
1575
|
+
return fetcher.post(BASE_PATH$4, input, options);
|
|
1391
1576
|
},
|
|
1392
1577
|
async update(name, input, options) {
|
|
1393
|
-
const result = request$
|
|
1578
|
+
const result = request$13.body.safeParse(input);
|
|
1394
1579
|
if (!result.success) return {
|
|
1395
1580
|
ok: false,
|
|
1396
1581
|
error: createValidationError(result.error)
|
|
1397
1582
|
};
|
|
1398
1583
|
const encodedName = encodeURIComponent(name);
|
|
1399
|
-
return fetcher.put(`${BASE_PATH$
|
|
1584
|
+
return fetcher.put(`${BASE_PATH$4}/${encodedName}`, input, options);
|
|
1400
1585
|
},
|
|
1401
1586
|
async delete(name, options) {
|
|
1402
1587
|
const encodedName = encodeURIComponent(name);
|
|
1403
|
-
return fetcher.deleteNoContent(`${BASE_PATH$
|
|
1588
|
+
return fetcher.deleteNoContent(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1404
1589
|
}
|
|
1405
1590
|
};
|
|
1406
1591
|
}
|
|
1407
1592
|
|
|
1408
1593
|
//#endregion
|
|
1409
1594
|
//#region src/endpoints/env-variables.ts
|
|
1410
|
-
const BASE_PATH$
|
|
1595
|
+
const BASE_PATH$3 = "/api/v1/env/variables";
|
|
1411
1596
|
function createVariablesApi(fetcher) {
|
|
1412
1597
|
return {
|
|
1413
|
-
async list(options) {
|
|
1414
|
-
|
|
1598
|
+
async list(params, options) {
|
|
1599
|
+
const result = request$11.query.safeParse(params);
|
|
1600
|
+
if (!result.success) return {
|
|
1601
|
+
ok: false,
|
|
1602
|
+
error: createValidationError(result.error)
|
|
1603
|
+
};
|
|
1604
|
+
const queryString = buildQueryString(params);
|
|
1605
|
+
return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
|
|
1415
1606
|
},
|
|
1416
1607
|
async get(name, options) {
|
|
1417
1608
|
const encodedName = encodeURIComponent(name);
|
|
1418
|
-
return fetcher.get(`${BASE_PATH$
|
|
1609
|
+
return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1419
1610
|
},
|
|
1420
1611
|
async create(input, options) {
|
|
1421
|
-
const result = request$
|
|
1612
|
+
const result = request$12.body.safeParse(input);
|
|
1422
1613
|
if (!result.success) return {
|
|
1423
1614
|
ok: false,
|
|
1424
1615
|
error: createValidationError(result.error)
|
|
1425
1616
|
};
|
|
1426
|
-
return fetcher.post(BASE_PATH$
|
|
1617
|
+
return fetcher.post(BASE_PATH$3, input, options);
|
|
1427
1618
|
},
|
|
1428
1619
|
async update(name, input, options) {
|
|
1429
|
-
const result = request$
|
|
1620
|
+
const result = request$10.body.safeParse(input);
|
|
1430
1621
|
if (!result.success) return {
|
|
1431
1622
|
ok: false,
|
|
1432
1623
|
error: createValidationError(result.error)
|
|
1433
1624
|
};
|
|
1434
1625
|
const encodedName = encodeURIComponent(name);
|
|
1435
|
-
return fetcher.put(`${BASE_PATH$
|
|
1626
|
+
return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
|
|
1436
1627
|
},
|
|
1437
1628
|
async delete(name, options) {
|
|
1438
1629
|
const encodedName = encodeURIComponent(name);
|
|
1439
|
-
return fetcher.deleteNoContent(`${BASE_PATH$
|
|
1630
|
+
return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1440
1631
|
}
|
|
1441
1632
|
};
|
|
1442
1633
|
}
|
|
@@ -1450,72 +1641,6 @@ function createEnvApi(fetcher) {
|
|
|
1450
1641
|
};
|
|
1451
1642
|
}
|
|
1452
1643
|
|
|
1453
|
-
//#endregion
|
|
1454
|
-
//#region src/endpoints/experts-drafts.ts
|
|
1455
|
-
function buildQueryString$3(params) {
|
|
1456
|
-
if (!params) return "";
|
|
1457
|
-
const searchParams = new URLSearchParams();
|
|
1458
|
-
if (params.limit !== void 0) searchParams.set("limit", params.limit.toString());
|
|
1459
|
-
if (params.offset !== void 0) searchParams.set("offset", params.offset.toString());
|
|
1460
|
-
const queryString = searchParams.toString();
|
|
1461
|
-
return queryString ? `?${queryString}` : "";
|
|
1462
|
-
}
|
|
1463
|
-
function createDraftsApi(fetcher, basePath) {
|
|
1464
|
-
return {
|
|
1465
|
-
async list(scopeName, params, options) {
|
|
1466
|
-
if (params) {
|
|
1467
|
-
const result = request$19.query.safeParse(params);
|
|
1468
|
-
if (!result.success) return {
|
|
1469
|
-
ok: false,
|
|
1470
|
-
error: createValidationError(result.error)
|
|
1471
|
-
};
|
|
1472
|
-
}
|
|
1473
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1474
|
-
const queryString = buildQueryString$3(params);
|
|
1475
|
-
return fetcher.get(`${basePath}/${encodedScopeName}/drafts${queryString}`, options);
|
|
1476
|
-
},
|
|
1477
|
-
async get(scopeName, draftRef, options) {
|
|
1478
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1479
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1480
|
-
return fetcher.get(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, options);
|
|
1481
|
-
},
|
|
1482
|
-
async create(scopeName, input, options) {
|
|
1483
|
-
const result = request$22.body.safeParse(input);
|
|
1484
|
-
if (!result.success) return {
|
|
1485
|
-
ok: false,
|
|
1486
|
-
error: createValidationError(result.error)
|
|
1487
|
-
};
|
|
1488
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1489
|
-
return fetcher.post(`${basePath}/${encodedScopeName}/drafts`, input, options);
|
|
1490
|
-
},
|
|
1491
|
-
async update(scopeName, draftRef, input, options) {
|
|
1492
|
-
const result = request$18.body.safeParse(input);
|
|
1493
|
-
if (!result.success) return {
|
|
1494
|
-
ok: false,
|
|
1495
|
-
error: createValidationError(result.error)
|
|
1496
|
-
};
|
|
1497
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1498
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1499
|
-
return fetcher.post(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, input, options);
|
|
1500
|
-
},
|
|
1501
|
-
async delete(scopeName, draftRef, options) {
|
|
1502
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1503
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1504
|
-
return fetcher.delete(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, options);
|
|
1505
|
-
},
|
|
1506
|
-
async assignVersion(scopeName, draftRef, input, options) {
|
|
1507
|
-
const result = request$17.body.safeParse(input);
|
|
1508
|
-
if (!result.success) return {
|
|
1509
|
-
ok: false,
|
|
1510
|
-
error: createValidationError(result.error)
|
|
1511
|
-
};
|
|
1512
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1513
|
-
const encodedDraftRef = encodeURIComponent(draftRef);
|
|
1514
|
-
return fetcher.post(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}/version`, input, options);
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
1644
|
//#endregion
|
|
1520
1645
|
//#region src/endpoints/experts-versions.ts
|
|
1521
1646
|
function createVersionsApi(fetcher, basePath) {
|
|
@@ -1527,113 +1652,67 @@ function createVersionsApi(fetcher, basePath) {
|
|
|
1527
1652
|
|
|
1528
1653
|
//#endregion
|
|
1529
1654
|
//#region src/endpoints/experts.ts
|
|
1530
|
-
const BASE_PATH$
|
|
1531
|
-
function buildQueryString$2(params) {
|
|
1532
|
-
if (!params) return "";
|
|
1533
|
-
const searchParams = new URLSearchParams();
|
|
1534
|
-
if (params.filter !== void 0) searchParams.set("filter", params.filter);
|
|
1535
|
-
if (params.category !== void 0) searchParams.set("category", params.category);
|
|
1536
|
-
if (params.includeDrafts !== void 0) searchParams.set("includeDrafts", params.includeDrafts.toString());
|
|
1537
|
-
if (params.limit !== void 0) searchParams.set("limit", params.limit.toString());
|
|
1538
|
-
if (params.offset !== void 0) searchParams.set("offset", params.offset.toString());
|
|
1539
|
-
const queryString = searchParams.toString();
|
|
1540
|
-
return queryString ? `?${queryString}` : "";
|
|
1541
|
-
}
|
|
1655
|
+
const BASE_PATH$2 = "/api/v1/experts";
|
|
1542
1656
|
function createExpertsApi(fetcher) {
|
|
1543
1657
|
return {
|
|
1544
1658
|
async list(params, options) {
|
|
1545
1659
|
if (params) {
|
|
1546
|
-
const result = request$
|
|
1660
|
+
const result = request$9.query.safeParse(params);
|
|
1547
1661
|
if (!result.success) return {
|
|
1548
1662
|
ok: false,
|
|
1549
1663
|
error: createValidationError(result.error)
|
|
1550
1664
|
};
|
|
1551
1665
|
}
|
|
1552
|
-
const queryString = buildQueryString
|
|
1553
|
-
return fetcher.get(`${BASE_PATH$
|
|
1666
|
+
const queryString = buildQueryString(params);
|
|
1667
|
+
return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
|
|
1554
1668
|
},
|
|
1555
1669
|
async get(key, options) {
|
|
1556
1670
|
const encodedKey = encodeURIComponent(key);
|
|
1557
|
-
return fetcher.get(`${BASE_PATH$
|
|
1558
|
-
},
|
|
1559
|
-
async getFeatured(options) {
|
|
1560
|
-
return fetcher.get(`${BASE_PATH$
|
|
1561
|
-
},
|
|
1562
|
-
async getMeta(key, options) {
|
|
1563
|
-
const encodedKey = encodeURIComponent(key);
|
|
1564
|
-
return fetcher.get(`${BASE_PATH$
|
|
1565
|
-
},
|
|
1566
|
-
async publish(scopeName, options) {
|
|
1567
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1568
|
-
return fetcher.post(`${BASE_PATH$
|
|
1569
|
-
},
|
|
1570
|
-
async unpublish(scopeName, options) {
|
|
1571
|
-
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1572
|
-
return fetcher.post(`${BASE_PATH$
|
|
1573
|
-
},
|
|
1574
|
-
async yank(key, options) {
|
|
1575
|
-
const encodedKey = encodeURIComponent(key);
|
|
1576
|
-
return fetcher.delete(`${BASE_PATH$
|
|
1577
|
-
},
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
//#endregion
|
|
1584
|
-
//#region src/lib/sse.ts
|
|
1585
|
-
async function* parseSSE(reader) {
|
|
1586
|
-
const decoder = new TextDecoder();
|
|
1587
|
-
let buffer = "";
|
|
1588
|
-
while (true) {
|
|
1589
|
-
const { value, done } = await reader.read();
|
|
1590
|
-
if (done) break;
|
|
1591
|
-
buffer += decoder.decode(value, { stream: true });
|
|
1592
|
-
const events = buffer.split("\n\n");
|
|
1593
|
-
buffer = events.pop() || "";
|
|
1594
|
-
for (const event of events) {
|
|
1595
|
-
if (event.trim() === "") continue;
|
|
1596
|
-
const lines = event.split("\n");
|
|
1597
|
-
const eventType = lines.find((line) => line.startsWith("event:"))?.slice(6).trim();
|
|
1598
|
-
const data = lines.find((line) => line.startsWith("data:"))?.slice(5).trim();
|
|
1599
|
-
if (eventType !== "message" || !data) continue;
|
|
1600
|
-
try {
|
|
1601
|
-
yield JSON.parse(data);
|
|
1602
|
-
} catch {}
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
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
|
+
};
|
|
1605
1694
|
}
|
|
1606
1695
|
|
|
1607
1696
|
//#endregion
|
|
1608
1697
|
//#region src/endpoints/jobs-checkpoints.ts
|
|
1609
|
-
function buildQueryString$1(params) {
|
|
1610
|
-
if (!params) return "";
|
|
1611
|
-
const searchParams = new URLSearchParams();
|
|
1612
|
-
if (params.take !== void 0) searchParams.set("take", params.take.toString());
|
|
1613
|
-
if (params.skip !== void 0) searchParams.set("skip", params.skip.toString());
|
|
1614
|
-
if (params.sort !== void 0) searchParams.set("sort", params.sort);
|
|
1615
|
-
if (params.order !== void 0) searchParams.set("order", params.order);
|
|
1616
|
-
const queryString = searchParams.toString();
|
|
1617
|
-
return queryString ? `?${queryString}` : "";
|
|
1618
|
-
}
|
|
1619
1698
|
function createCheckpointsApi(fetcher, basePath) {
|
|
1620
1699
|
return {
|
|
1621
1700
|
async list(jobId, params, options) {
|
|
1622
1701
|
if (params) {
|
|
1623
|
-
const result = request$
|
|
1702
|
+
const result = request$7.query.safeParse(params);
|
|
1624
1703
|
if (!result.success) return {
|
|
1625
1704
|
ok: false,
|
|
1626
1705
|
error: createValidationError(result.error)
|
|
1627
1706
|
};
|
|
1628
1707
|
}
|
|
1629
|
-
const queryString = buildQueryString
|
|
1708
|
+
const queryString = buildQueryString(params);
|
|
1630
1709
|
return fetcher.get(`${basePath}/${jobId}/checkpoints${queryString}`, options);
|
|
1631
1710
|
},
|
|
1632
1711
|
async get(jobId, checkpointId, options) {
|
|
1633
1712
|
return fetcher.get(`${basePath}/${jobId}/checkpoints/${checkpointId}`, options);
|
|
1634
1713
|
},
|
|
1635
1714
|
async create(jobId, input, options) {
|
|
1636
|
-
const result = request$
|
|
1715
|
+
const result = request$8.body.safeParse(input);
|
|
1637
1716
|
if (!result.success) return {
|
|
1638
1717
|
ok: false,
|
|
1639
1718
|
error: createValidationError(result.error)
|
|
@@ -1642,74 +1721,51 @@ function createCheckpointsApi(fetcher, basePath) {
|
|
|
1642
1721
|
},
|
|
1643
1722
|
async *stream(jobId, options) {
|
|
1644
1723
|
const result = await fetcher.getStream(`${basePath}/${jobId}/checkpoints/stream`, options);
|
|
1645
|
-
if (!result.ok)
|
|
1724
|
+
if (!result.ok) {
|
|
1725
|
+
yield {
|
|
1726
|
+
ok: false,
|
|
1727
|
+
error: result.error
|
|
1728
|
+
};
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1646
1731
|
const reader = result.data.getReader();
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
function buildTreeQueryString(params) {
|
|
1655
|
-
if (!params) return "";
|
|
1656
|
-
const searchParams = new URLSearchParams();
|
|
1657
|
-
if (params.path !== void 0) searchParams.set("path", params.path);
|
|
1658
|
-
if (params.recursive !== void 0) searchParams.set("recursive", params.recursive.toString());
|
|
1659
|
-
const queryString = searchParams.toString();
|
|
1660
|
-
return queryString ? `?${queryString}` : "";
|
|
1661
|
-
}
|
|
1662
|
-
function createWorkspaceApi(fetcher, basePath) {
|
|
1663
|
-
return {
|
|
1664
|
-
async get(jobId, options) {
|
|
1665
|
-
return fetcher.get(`${basePath}/${jobId}/workspace`, options);
|
|
1666
|
-
},
|
|
1667
|
-
async tree(jobId, params, options) {
|
|
1668
|
-
if (params) {
|
|
1669
|
-
const result = request.query.safeParse(params);
|
|
1670
|
-
if (!result.success) return {
|
|
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 {
|
|
1671
1739
|
ok: false,
|
|
1672
|
-
error:
|
|
1740
|
+
error: createAbortError()
|
|
1741
|
+
};
|
|
1742
|
+
else yield {
|
|
1743
|
+
ok: false,
|
|
1744
|
+
error: createNetworkError(error)
|
|
1673
1745
|
};
|
|
1674
1746
|
}
|
|
1675
|
-
const queryString = buildTreeQueryString(params);
|
|
1676
|
-
return fetcher.get(`${basePath}/${jobId}/workspace/tree${queryString}`, options);
|
|
1677
|
-
},
|
|
1678
|
-
async blob(jobId, path, options) {
|
|
1679
|
-
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
1680
|
-
return fetcher.getBlob(`${basePath}/${jobId}/workspace/blob/${normalizedPath}`, options);
|
|
1681
1747
|
}
|
|
1682
1748
|
};
|
|
1683
1749
|
}
|
|
1684
1750
|
|
|
1685
1751
|
//#endregion
|
|
1686
1752
|
//#region src/endpoints/jobs.ts
|
|
1687
|
-
const BASE_PATH = "/api/v1/jobs";
|
|
1688
|
-
function buildQueryString(params) {
|
|
1689
|
-
if (!params) return "";
|
|
1690
|
-
const searchParams = new URLSearchParams();
|
|
1691
|
-
if (params.take !== void 0) searchParams.set("take", params.take.toString());
|
|
1692
|
-
if (params.skip !== void 0) searchParams.set("skip", params.skip.toString());
|
|
1693
|
-
if (params.sort !== void 0) searchParams.set("sort", params.sort);
|
|
1694
|
-
if (params.order !== void 0) searchParams.set("order", params.order);
|
|
1695
|
-
const queryString = searchParams.toString();
|
|
1696
|
-
return queryString ? `?${queryString}` : "";
|
|
1697
|
-
}
|
|
1753
|
+
const BASE_PATH$1 = "/api/v1/jobs";
|
|
1698
1754
|
function createJobsApi(fetcher) {
|
|
1699
1755
|
return {
|
|
1700
1756
|
async list(params, options) {
|
|
1701
1757
|
if (params) {
|
|
1702
|
-
const result = request$
|
|
1758
|
+
const result = request$4.query.safeParse(params);
|
|
1703
1759
|
if (!result.success) return {
|
|
1704
1760
|
ok: false,
|
|
1705
1761
|
error: createValidationError(result.error)
|
|
1706
1762
|
};
|
|
1707
1763
|
}
|
|
1708
1764
|
const queryString = buildQueryString(params);
|
|
1709
|
-
return fetcher.get(`${BASE_PATH}${queryString}`, options);
|
|
1765
|
+
return fetcher.get(`${BASE_PATH$1}${queryString}`, options);
|
|
1710
1766
|
},
|
|
1711
1767
|
async get(id, options) {
|
|
1712
|
-
return fetcher.get(`${BASE_PATH}/${id}`, options);
|
|
1768
|
+
return fetcher.get(`${BASE_PATH$1}/${id}`, options);
|
|
1713
1769
|
},
|
|
1714
1770
|
async start(input, options) {
|
|
1715
1771
|
const result = request$5.body.safeParse(input);
|
|
@@ -1717,15 +1773,15 @@ function createJobsApi(fetcher) {
|
|
|
1717
1773
|
ok: false,
|
|
1718
1774
|
error: createValidationError(result.error)
|
|
1719
1775
|
};
|
|
1720
|
-
return fetcher.post(BASE_PATH, input, options);
|
|
1776
|
+
return fetcher.post(BASE_PATH$1, input, options);
|
|
1721
1777
|
},
|
|
1722
1778
|
async update(id, input, options) {
|
|
1723
|
-
const result = request$
|
|
1779
|
+
const result = request$3.body.safeParse(input);
|
|
1724
1780
|
if (!result.success) return {
|
|
1725
1781
|
ok: false,
|
|
1726
1782
|
error: createValidationError(result.error)
|
|
1727
1783
|
};
|
|
1728
|
-
return fetcher.post(`${BASE_PATH}/${id}`, input, options);
|
|
1784
|
+
return fetcher.post(`${BASE_PATH$1}/${id}`, input, options);
|
|
1729
1785
|
},
|
|
1730
1786
|
async continue(id, input, options) {
|
|
1731
1787
|
const result = request$6.body.safeParse(input);
|
|
@@ -1733,279 +1789,83 @@ function createJobsApi(fetcher) {
|
|
|
1733
1789
|
ok: false,
|
|
1734
1790
|
error: createValidationError(result.error)
|
|
1735
1791
|
};
|
|
1736
|
-
return fetcher.post(`${BASE_PATH}/${id}/continue`, input, options);
|
|
1792
|
+
return fetcher.post(`${BASE_PATH$1}/${id}/continue`, input, options);
|
|
1737
1793
|
},
|
|
1738
1794
|
async cancel(id, options) {
|
|
1739
|
-
return fetcher.post(`${BASE_PATH}/${id}/cancel`, {}, options);
|
|
1795
|
+
return fetcher.post(`${BASE_PATH$1}/${id}/cancel`, {}, options);
|
|
1740
1796
|
},
|
|
1741
|
-
checkpoints: createCheckpointsApi(fetcher, BASE_PATH)
|
|
1742
|
-
workspace: createWorkspaceApi(fetcher, BASE_PATH)
|
|
1797
|
+
checkpoints: createCheckpointsApi(fetcher, BASE_PATH$1)
|
|
1743
1798
|
};
|
|
1744
1799
|
}
|
|
1745
1800
|
|
|
1746
1801
|
//#endregion
|
|
1747
|
-
//#region src/
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
return headers;
|
|
1762
|
-
}
|
|
1763
|
-
function getCredentials() {
|
|
1764
|
-
return useCredentials ? "include" : void 0;
|
|
1765
|
-
}
|
|
1766
|
-
function createTimeoutSignal(externalSignal) {
|
|
1767
|
-
const controller = new AbortController();
|
|
1768
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1769
|
-
let abortHandler;
|
|
1770
|
-
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
1771
|
-
else {
|
|
1772
|
-
abortHandler = () => controller.abort();
|
|
1773
|
-
externalSignal.addEventListener("abort", abortHandler);
|
|
1774
|
-
}
|
|
1775
|
-
return {
|
|
1776
|
-
signal: controller.signal,
|
|
1777
|
-
cleanup: () => {
|
|
1778
|
-
clearTimeout(timeoutId);
|
|
1779
|
-
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
1780
|
-
}
|
|
1781
|
-
};
|
|
1782
|
-
}
|
|
1783
|
-
async function request$39(method, path, body, options) {
|
|
1784
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
1785
|
-
try {
|
|
1786
|
-
const response$41 = await fetch(buildUrl(path), {
|
|
1787
|
-
method,
|
|
1788
|
-
headers: buildHeaders(),
|
|
1789
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
1790
|
-
signal,
|
|
1791
|
-
credentials: getCredentials()
|
|
1792
|
-
});
|
|
1793
|
-
if (!response$41.ok) {
|
|
1794
|
-
let errorBody;
|
|
1795
|
-
try {
|
|
1796
|
-
errorBody = await response$41.json();
|
|
1797
|
-
} catch {
|
|
1798
|
-
errorBody = void 0;
|
|
1799
|
-
}
|
|
1800
|
-
return {
|
|
1801
|
-
ok: false,
|
|
1802
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
1805
|
-
return {
|
|
1806
|
-
ok: true,
|
|
1807
|
-
data: await response$41.json()
|
|
1808
|
-
};
|
|
1809
|
-
} catch (error) {
|
|
1810
|
-
if (error instanceof Error && error.name === "AbortError") return {
|
|
1811
|
-
ok: false,
|
|
1812
|
-
error: createAbortError()
|
|
1813
|
-
};
|
|
1814
|
-
return {
|
|
1815
|
-
ok: false,
|
|
1816
|
-
error: createNetworkError(error)
|
|
1817
|
-
};
|
|
1818
|
-
} finally {
|
|
1819
|
-
cleanup();
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
async function requestBlob(path, options) {
|
|
1823
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
1824
|
-
try {
|
|
1825
|
-
const response$41 = await fetch(buildUrl(path), {
|
|
1826
|
-
method: "GET",
|
|
1827
|
-
headers: buildHeaders(),
|
|
1828
|
-
signal,
|
|
1829
|
-
credentials: getCredentials()
|
|
1830
|
-
});
|
|
1831
|
-
if (!response$41.ok) {
|
|
1832
|
-
let errorBody;
|
|
1833
|
-
try {
|
|
1834
|
-
errorBody = await response$41.json();
|
|
1835
|
-
} catch {
|
|
1836
|
-
errorBody = void 0;
|
|
1837
|
-
}
|
|
1838
|
-
return {
|
|
1839
|
-
ok: false,
|
|
1840
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
|
-
return {
|
|
1844
|
-
ok: true,
|
|
1845
|
-
data: await response$41.blob()
|
|
1846
|
-
};
|
|
1847
|
-
} catch (error) {
|
|
1848
|
-
if (error instanceof Error && error.name === "AbortError") return {
|
|
1849
|
-
ok: false,
|
|
1850
|
-
error: createAbortError()
|
|
1851
|
-
};
|
|
1852
|
-
return {
|
|
1853
|
-
ok: false,
|
|
1854
|
-
error: createNetworkError(error)
|
|
1855
|
-
};
|
|
1856
|
-
} finally {
|
|
1857
|
-
cleanup();
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
async function requestStream(path, options) {
|
|
1861
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
1862
|
-
try {
|
|
1863
|
-
const response$41 = await fetch(buildUrl(path), {
|
|
1864
|
-
method: "GET",
|
|
1865
|
-
headers: buildHeaders(),
|
|
1866
|
-
signal,
|
|
1867
|
-
credentials: getCredentials()
|
|
1868
|
-
});
|
|
1869
|
-
if (!response$41.ok) {
|
|
1870
|
-
let errorBody;
|
|
1871
|
-
try {
|
|
1872
|
-
errorBody = await response$41.json();
|
|
1873
|
-
} catch {
|
|
1874
|
-
errorBody = void 0;
|
|
1875
|
-
}
|
|
1876
|
-
cleanup();
|
|
1877
|
-
return {
|
|
1878
|
-
ok: false,
|
|
1879
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1880
|
-
};
|
|
1881
|
-
}
|
|
1882
|
-
if (!response$41.body) {
|
|
1883
|
-
cleanup();
|
|
1884
|
-
return {
|
|
1885
|
-
ok: false,
|
|
1886
|
-
error: createNetworkError(/* @__PURE__ */ new Error("Response body is null"))
|
|
1887
|
-
};
|
|
1888
|
-
}
|
|
1889
|
-
cleanup();
|
|
1890
|
-
return {
|
|
1891
|
-
ok: true,
|
|
1892
|
-
data: response$41.body
|
|
1893
|
-
};
|
|
1894
|
-
} catch (error) {
|
|
1895
|
-
cleanup();
|
|
1896
|
-
if (error instanceof Error && error.name === "AbortError") return {
|
|
1897
|
-
ok: false,
|
|
1898
|
-
error: createAbortError()
|
|
1899
|
-
};
|
|
1900
|
-
return {
|
|
1802
|
+
//#region src/endpoints/provider-settings.ts
|
|
1803
|
+
const BASE_PATH = "/api/v1/applications";
|
|
1804
|
+
function createProviderSettingsApi(fetcher) {
|
|
1805
|
+
return {
|
|
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 {
|
|
1901
1816
|
ok: false,
|
|
1902
|
-
error:
|
|
1903
|
-
};
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
async function requestNoContent(method, path, options) {
|
|
1907
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
1908
|
-
try {
|
|
1909
|
-
const response$41 = await fetch(buildUrl(path), {
|
|
1910
|
-
method,
|
|
1911
|
-
headers: buildHeaders(),
|
|
1912
|
-
signal,
|
|
1913
|
-
credentials: getCredentials()
|
|
1914
|
-
});
|
|
1915
|
-
if (!response$41.ok) {
|
|
1916
|
-
let errorBody;
|
|
1917
|
-
try {
|
|
1918
|
-
errorBody = await response$41.json();
|
|
1919
|
-
} catch {
|
|
1920
|
-
errorBody = void 0;
|
|
1921
|
-
}
|
|
1922
|
-
return {
|
|
1923
|
-
ok: false,
|
|
1924
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1925
|
-
};
|
|
1926
|
-
}
|
|
1927
|
-
return {
|
|
1928
|
-
ok: true,
|
|
1929
|
-
data: void 0
|
|
1817
|
+
error: createValidationError(result.error)
|
|
1930
1818
|
};
|
|
1931
|
-
|
|
1932
|
-
|
|
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 {
|
|
1933
1824
|
ok: false,
|
|
1934
|
-
error:
|
|
1825
|
+
error: createValidationError(result.error)
|
|
1935
1826
|
};
|
|
1936
|
-
|
|
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 {
|
|
1937
1841
|
ok: false,
|
|
1938
|
-
error:
|
|
1842
|
+
error: createValidationError(result.error)
|
|
1939
1843
|
};
|
|
1940
|
-
|
|
1941
|
-
|
|
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);
|
|
1942
1851
|
}
|
|
1943
|
-
}
|
|
1944
|
-
return {
|
|
1945
|
-
get: (path, options) => request$39("GET", path, void 0, options),
|
|
1946
|
-
post: (path, body, options) => request$39("POST", path, body, options),
|
|
1947
|
-
put: (path, body, options) => request$39("PUT", path, body, options),
|
|
1948
|
-
delete: (path, options) => request$39("DELETE", path, void 0, options),
|
|
1949
|
-
deleteNoContent: (path, options) => requestNoContent("DELETE", path, options),
|
|
1950
|
-
getBlob: (path, options) => requestBlob(path, options),
|
|
1951
|
-
getStream: (path, options) => requestStream(path, options)
|
|
1952
1852
|
};
|
|
1953
1853
|
}
|
|
1954
1854
|
|
|
1955
1855
|
//#endregion
|
|
1956
|
-
//#region src/client.ts
|
|
1856
|
+
//#region src/public/client.ts
|
|
1957
1857
|
function createApiClient(config) {
|
|
1958
1858
|
const fetcher = createFetcher(config);
|
|
1959
1859
|
return {
|
|
1860
|
+
apiKeys: createApiKeysApi(fetcher),
|
|
1960
1861
|
applications: createApplicationsApi(fetcher),
|
|
1961
1862
|
env: createEnvApi(fetcher),
|
|
1962
1863
|
jobs: createJobsApi(fetcher),
|
|
1963
|
-
experts: createExpertsApi(fetcher)
|
|
1864
|
+
experts: createExpertsApi(fetcher),
|
|
1865
|
+
providerSettings: createProviderSettingsApi(fetcher)
|
|
1964
1866
|
};
|
|
1965
1867
|
}
|
|
1966
1868
|
|
|
1967
1869
|
//#endregion
|
|
1968
|
-
|
|
1969
|
-
function matchWildcard(value, pattern) {
|
|
1970
|
-
if (pattern === "*") return true;
|
|
1971
|
-
if (pattern.endsWith("*")) return value.startsWith(pattern.slice(0, -1));
|
|
1972
|
-
if (pattern.startsWith("*")) return value.endsWith(pattern.slice(1));
|
|
1973
|
-
return value === pattern;
|
|
1974
|
-
}
|
|
1975
|
-
function matchOperations(operations, requiredOperation) {
|
|
1976
|
-
return operations.some((pattern) => matchWildcard(requiredOperation, pattern));
|
|
1977
|
-
}
|
|
1978
|
-
function matchExperts(experts, expertId) {
|
|
1979
|
-
if (experts === void 0 || experts === "*") return true;
|
|
1980
|
-
return experts.some((pattern) => matchWildcard(expertId, pattern));
|
|
1981
|
-
}
|
|
1982
|
-
function isApiKeyPermissions(parsed) {
|
|
1983
|
-
return typeof parsed === "object" && parsed !== null && "operations" in parsed && Array.isArray(parsed.operations);
|
|
1984
|
-
}
|
|
1985
|
-
function parseApiKeyPermissions(permissionsJson) {
|
|
1986
|
-
if (!permissionsJson) return null;
|
|
1987
|
-
try {
|
|
1988
|
-
const parsed = JSON.parse(permissionsJson);
|
|
1989
|
-
if (!isApiKeyPermissions(parsed)) return null;
|
|
1990
|
-
return parsed;
|
|
1991
|
-
} catch {
|
|
1992
|
-
return null;
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
function stringifyApiKeyPermissions(permissions) {
|
|
1996
|
-
return JSON.stringify(permissions);
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
//#endregion
|
|
2000
|
-
//#region src/lib/auth.ts
|
|
2001
|
-
/**
|
|
2002
|
-
* Build authentication headers from AuthOptions.
|
|
2003
|
-
*/
|
|
2004
|
-
function buildAuthHeaders(auth) {
|
|
2005
|
-
if (auth.type === "apiKey") return { Authorization: `Bearer ${auth.apiKey}` };
|
|
2006
|
-
return { Cookie: auth.cookie };
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
//#endregion
|
|
2010
|
-
export { buildAuthHeaders, createAbortError, createApiClient, createFetcher, createHttpError, createNetworkError, createValidationError, matchExperts, matchOperations, matchWildcard, parseApiKeyPermissions, parseSSE, stringifyApiKeyPermissions };
|
|
1870
|
+
export { buildAuthHeaders, buildQueryString, createAbortError, createApiClient, createFetcher, createHttpError, createNetworkError, createTimeoutError, createValidationError, handleHttpError, isAbortError, isClientError, isHttpError, isNetworkError, isTimeoutError, isValidationError, matchExperts, matchOperations, matchWildcard, parseApiKeyPermissions, parseSSE, stringifyApiKeyPermissions };
|
|
2011
1871
|
//# sourceMappingURL=index.mjs.map
|