@djangocfg/api 2.1.332 → 2.1.333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-server.cjs +1043 -1041
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +1043 -1041
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +1053 -1051
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +1053 -1051
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +12 -837
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.mjs +12 -837
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +1081 -1079
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -20
- package/dist/index.d.ts +0 -20
- package/dist/index.mjs +1081 -1079
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/client.gen.ts +3 -2
- package/src/_api/generated/helpers/auth.ts +64 -47
package/dist/index.cjs
CHANGED
|
@@ -53,830 +53,6 @@ __export(index_exports, {
|
|
|
53
53
|
});
|
|
54
54
|
module.exports = __toCommonJS(index_exports);
|
|
55
55
|
|
|
56
|
-
// src/_api/generated/core/bodySerializer.gen.ts
|
|
57
|
-
var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
|
|
58
|
-
if (typeof value === "string" || value instanceof Blob) {
|
|
59
|
-
data.append(key, value);
|
|
60
|
-
} else if (value instanceof Date) {
|
|
61
|
-
data.append(key, value.toISOString());
|
|
62
|
-
} else {
|
|
63
|
-
data.append(key, JSON.stringify(value));
|
|
64
|
-
}
|
|
65
|
-
}, "serializeFormDataPair");
|
|
66
|
-
var formDataBodySerializer = {
|
|
67
|
-
bodySerializer: /* @__PURE__ */ __name((body) => {
|
|
68
|
-
const data = new FormData();
|
|
69
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
70
|
-
if (value === void 0 || value === null) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (Array.isArray(value)) {
|
|
74
|
-
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
75
|
-
} else {
|
|
76
|
-
serializeFormDataPair(data, key, value);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
return data;
|
|
80
|
-
}, "bodySerializer")
|
|
81
|
-
};
|
|
82
|
-
var jsonBodySerializer = {
|
|
83
|
-
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// src/_api/generated/core/params.gen.ts
|
|
87
|
-
var extraPrefixesMap = {
|
|
88
|
-
$body_: "body",
|
|
89
|
-
$headers_: "headers",
|
|
90
|
-
$path_: "path",
|
|
91
|
-
$query_: "query"
|
|
92
|
-
};
|
|
93
|
-
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
94
|
-
|
|
95
|
-
// src/_api/generated/core/serverSentEvents.gen.ts
|
|
96
|
-
function createSseClient({
|
|
97
|
-
onRequest,
|
|
98
|
-
onSseError,
|
|
99
|
-
onSseEvent,
|
|
100
|
-
responseTransformer,
|
|
101
|
-
responseValidator,
|
|
102
|
-
sseDefaultRetryDelay,
|
|
103
|
-
sseMaxRetryAttempts,
|
|
104
|
-
sseMaxRetryDelay,
|
|
105
|
-
sseSleepFn,
|
|
106
|
-
url,
|
|
107
|
-
...options
|
|
108
|
-
}) {
|
|
109
|
-
let lastEventId;
|
|
110
|
-
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
111
|
-
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
112
|
-
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
113
|
-
let attempt = 0;
|
|
114
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
115
|
-
while (true) {
|
|
116
|
-
if (signal.aborted) break;
|
|
117
|
-
attempt++;
|
|
118
|
-
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
119
|
-
if (lastEventId !== void 0) {
|
|
120
|
-
headers.set("Last-Event-ID", lastEventId);
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const requestInit = {
|
|
124
|
-
redirect: "follow",
|
|
125
|
-
...options,
|
|
126
|
-
body: options.serializedBody,
|
|
127
|
-
headers,
|
|
128
|
-
signal
|
|
129
|
-
};
|
|
130
|
-
let request = new Request(url, requestInit);
|
|
131
|
-
if (onRequest) {
|
|
132
|
-
request = await onRequest(url, requestInit);
|
|
133
|
-
}
|
|
134
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
135
|
-
const response = await _fetch(request);
|
|
136
|
-
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
137
|
-
if (!response.body) throw new Error("No body in SSE response");
|
|
138
|
-
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
139
|
-
let buffer = "";
|
|
140
|
-
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
141
|
-
try {
|
|
142
|
-
reader.cancel();
|
|
143
|
-
} catch {
|
|
144
|
-
}
|
|
145
|
-
}, "abortHandler");
|
|
146
|
-
signal.addEventListener("abort", abortHandler);
|
|
147
|
-
try {
|
|
148
|
-
while (true) {
|
|
149
|
-
const { done, value } = await reader.read();
|
|
150
|
-
if (done) break;
|
|
151
|
-
buffer += value;
|
|
152
|
-
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
153
|
-
const chunks = buffer.split("\n\n");
|
|
154
|
-
buffer = chunks.pop() ?? "";
|
|
155
|
-
for (const chunk of chunks) {
|
|
156
|
-
const lines = chunk.split("\n");
|
|
157
|
-
const dataLines = [];
|
|
158
|
-
let eventName;
|
|
159
|
-
for (const line of lines) {
|
|
160
|
-
if (line.startsWith("data:")) {
|
|
161
|
-
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
162
|
-
} else if (line.startsWith("event:")) {
|
|
163
|
-
eventName = line.replace(/^event:\s*/, "");
|
|
164
|
-
} else if (line.startsWith("id:")) {
|
|
165
|
-
lastEventId = line.replace(/^id:\s*/, "");
|
|
166
|
-
} else if (line.startsWith("retry:")) {
|
|
167
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
168
|
-
if (!Number.isNaN(parsed)) {
|
|
169
|
-
retryDelay = parsed;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
let data;
|
|
174
|
-
let parsedJson = false;
|
|
175
|
-
if (dataLines.length) {
|
|
176
|
-
const rawData = dataLines.join("\n");
|
|
177
|
-
try {
|
|
178
|
-
data = JSON.parse(rawData);
|
|
179
|
-
parsedJson = true;
|
|
180
|
-
} catch {
|
|
181
|
-
data = rawData;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (parsedJson) {
|
|
185
|
-
if (responseValidator) {
|
|
186
|
-
await responseValidator(data);
|
|
187
|
-
}
|
|
188
|
-
if (responseTransformer) {
|
|
189
|
-
data = await responseTransformer(data);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
onSseEvent?.({
|
|
193
|
-
data,
|
|
194
|
-
event: eventName,
|
|
195
|
-
id: lastEventId,
|
|
196
|
-
retry: retryDelay
|
|
197
|
-
});
|
|
198
|
-
if (dataLines.length) {
|
|
199
|
-
yield data;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
} finally {
|
|
204
|
-
signal.removeEventListener("abort", abortHandler);
|
|
205
|
-
reader.releaseLock();
|
|
206
|
-
}
|
|
207
|
-
break;
|
|
208
|
-
} catch (error) {
|
|
209
|
-
onSseError?.(error);
|
|
210
|
-
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
214
|
-
await sleep(backoff);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}, "createStream");
|
|
218
|
-
const stream = createStream();
|
|
219
|
-
return { stream };
|
|
220
|
-
}
|
|
221
|
-
__name(createSseClient, "createSseClient");
|
|
222
|
-
|
|
223
|
-
// src/_api/generated/core/pathSerializer.gen.ts
|
|
224
|
-
var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
225
|
-
switch (style) {
|
|
226
|
-
case "label":
|
|
227
|
-
return ".";
|
|
228
|
-
case "matrix":
|
|
229
|
-
return ";";
|
|
230
|
-
case "simple":
|
|
231
|
-
return ",";
|
|
232
|
-
default:
|
|
233
|
-
return "&";
|
|
234
|
-
}
|
|
235
|
-
}, "separatorArrayExplode");
|
|
236
|
-
var separatorArrayNoExplode = /* @__PURE__ */ __name((style) => {
|
|
237
|
-
switch (style) {
|
|
238
|
-
case "form":
|
|
239
|
-
return ",";
|
|
240
|
-
case "pipeDelimited":
|
|
241
|
-
return "|";
|
|
242
|
-
case "spaceDelimited":
|
|
243
|
-
return "%20";
|
|
244
|
-
default:
|
|
245
|
-
return ",";
|
|
246
|
-
}
|
|
247
|
-
}, "separatorArrayNoExplode");
|
|
248
|
-
var separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
249
|
-
switch (style) {
|
|
250
|
-
case "label":
|
|
251
|
-
return ".";
|
|
252
|
-
case "matrix":
|
|
253
|
-
return ";";
|
|
254
|
-
case "simple":
|
|
255
|
-
return ",";
|
|
256
|
-
default:
|
|
257
|
-
return "&";
|
|
258
|
-
}
|
|
259
|
-
}, "separatorObjectExplode");
|
|
260
|
-
var serializeArrayParam = /* @__PURE__ */ __name(({
|
|
261
|
-
allowReserved,
|
|
262
|
-
explode,
|
|
263
|
-
name,
|
|
264
|
-
style,
|
|
265
|
-
value
|
|
266
|
-
}) => {
|
|
267
|
-
if (!explode) {
|
|
268
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
269
|
-
switch (style) {
|
|
270
|
-
case "label":
|
|
271
|
-
return `.${joinedValues2}`;
|
|
272
|
-
case "matrix":
|
|
273
|
-
return `;${name}=${joinedValues2}`;
|
|
274
|
-
case "simple":
|
|
275
|
-
return joinedValues2;
|
|
276
|
-
default:
|
|
277
|
-
return `${name}=${joinedValues2}`;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
const separator = separatorArrayExplode(style);
|
|
281
|
-
const joinedValues = value.map((v) => {
|
|
282
|
-
if (style === "label" || style === "simple") {
|
|
283
|
-
return allowReserved ? v : encodeURIComponent(v);
|
|
284
|
-
}
|
|
285
|
-
return serializePrimitiveParam({
|
|
286
|
-
allowReserved,
|
|
287
|
-
name,
|
|
288
|
-
value: v
|
|
289
|
-
});
|
|
290
|
-
}).join(separator);
|
|
291
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
292
|
-
}, "serializeArrayParam");
|
|
293
|
-
var serializePrimitiveParam = /* @__PURE__ */ __name(({
|
|
294
|
-
allowReserved,
|
|
295
|
-
name,
|
|
296
|
-
value
|
|
297
|
-
}) => {
|
|
298
|
-
if (value === void 0 || value === null) {
|
|
299
|
-
return "";
|
|
300
|
-
}
|
|
301
|
-
if (typeof value === "object") {
|
|
302
|
-
throw new Error(
|
|
303
|
-
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
307
|
-
}, "serializePrimitiveParam");
|
|
308
|
-
var serializeObjectParam = /* @__PURE__ */ __name(({
|
|
309
|
-
allowReserved,
|
|
310
|
-
explode,
|
|
311
|
-
name,
|
|
312
|
-
style,
|
|
313
|
-
value,
|
|
314
|
-
valueOnly
|
|
315
|
-
}) => {
|
|
316
|
-
if (value instanceof Date) {
|
|
317
|
-
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
318
|
-
}
|
|
319
|
-
if (style !== "deepObject" && !explode) {
|
|
320
|
-
let values = [];
|
|
321
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
322
|
-
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
323
|
-
});
|
|
324
|
-
const joinedValues2 = values.join(",");
|
|
325
|
-
switch (style) {
|
|
326
|
-
case "form":
|
|
327
|
-
return `${name}=${joinedValues2}`;
|
|
328
|
-
case "label":
|
|
329
|
-
return `.${joinedValues2}`;
|
|
330
|
-
case "matrix":
|
|
331
|
-
return `;${name}=${joinedValues2}`;
|
|
332
|
-
default:
|
|
333
|
-
return joinedValues2;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
const separator = separatorObjectExplode(style);
|
|
337
|
-
const joinedValues = Object.entries(value).map(
|
|
338
|
-
([key, v]) => serializePrimitiveParam({
|
|
339
|
-
allowReserved,
|
|
340
|
-
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
341
|
-
value: v
|
|
342
|
-
})
|
|
343
|
-
).join(separator);
|
|
344
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
345
|
-
}, "serializeObjectParam");
|
|
346
|
-
|
|
347
|
-
// src/_api/generated/core/utils.gen.ts
|
|
348
|
-
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
349
|
-
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
350
|
-
let url = _url;
|
|
351
|
-
const matches = _url.match(PATH_PARAM_RE);
|
|
352
|
-
if (matches) {
|
|
353
|
-
for (const match of matches) {
|
|
354
|
-
let explode = false;
|
|
355
|
-
let name = match.substring(1, match.length - 1);
|
|
356
|
-
let style = "simple";
|
|
357
|
-
if (name.endsWith("*")) {
|
|
358
|
-
explode = true;
|
|
359
|
-
name = name.substring(0, name.length - 1);
|
|
360
|
-
}
|
|
361
|
-
if (name.startsWith(".")) {
|
|
362
|
-
name = name.substring(1);
|
|
363
|
-
style = "label";
|
|
364
|
-
} else if (name.startsWith(";")) {
|
|
365
|
-
name = name.substring(1);
|
|
366
|
-
style = "matrix";
|
|
367
|
-
}
|
|
368
|
-
const value = path[name];
|
|
369
|
-
if (value === void 0 || value === null) {
|
|
370
|
-
continue;
|
|
371
|
-
}
|
|
372
|
-
if (Array.isArray(value)) {
|
|
373
|
-
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
374
|
-
continue;
|
|
375
|
-
}
|
|
376
|
-
if (typeof value === "object") {
|
|
377
|
-
url = url.replace(
|
|
378
|
-
match,
|
|
379
|
-
serializeObjectParam({
|
|
380
|
-
explode,
|
|
381
|
-
name,
|
|
382
|
-
style,
|
|
383
|
-
value,
|
|
384
|
-
valueOnly: true
|
|
385
|
-
})
|
|
386
|
-
);
|
|
387
|
-
continue;
|
|
388
|
-
}
|
|
389
|
-
if (style === "matrix") {
|
|
390
|
-
url = url.replace(
|
|
391
|
-
match,
|
|
392
|
-
`;${serializePrimitiveParam({
|
|
393
|
-
name,
|
|
394
|
-
value
|
|
395
|
-
})}`
|
|
396
|
-
);
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
const replaceValue = encodeURIComponent(
|
|
400
|
-
style === "label" ? `.${value}` : value
|
|
401
|
-
);
|
|
402
|
-
url = url.replace(match, replaceValue);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return url;
|
|
406
|
-
}, "defaultPathSerializer");
|
|
407
|
-
var getUrl = /* @__PURE__ */ __name(({
|
|
408
|
-
baseUrl,
|
|
409
|
-
path,
|
|
410
|
-
query,
|
|
411
|
-
querySerializer,
|
|
412
|
-
url: _url
|
|
413
|
-
}) => {
|
|
414
|
-
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
415
|
-
let url = (baseUrl ?? "") + pathUrl;
|
|
416
|
-
if (path) {
|
|
417
|
-
url = defaultPathSerializer({ path, url });
|
|
418
|
-
}
|
|
419
|
-
let search = query ? querySerializer(query) : "";
|
|
420
|
-
if (search.startsWith("?")) {
|
|
421
|
-
search = search.substring(1);
|
|
422
|
-
}
|
|
423
|
-
if (search) {
|
|
424
|
-
url += `?${search}`;
|
|
425
|
-
}
|
|
426
|
-
return url;
|
|
427
|
-
}, "getUrl");
|
|
428
|
-
function getValidRequestBody(options) {
|
|
429
|
-
const hasBody = options.body !== void 0;
|
|
430
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
431
|
-
if (isSerializedBody) {
|
|
432
|
-
if ("serializedBody" in options) {
|
|
433
|
-
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
434
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
435
|
-
}
|
|
436
|
-
return options.body !== "" ? options.body : null;
|
|
437
|
-
}
|
|
438
|
-
if (hasBody) {
|
|
439
|
-
return options.body;
|
|
440
|
-
}
|
|
441
|
-
return void 0;
|
|
442
|
-
}
|
|
443
|
-
__name(getValidRequestBody, "getValidRequestBody");
|
|
444
|
-
|
|
445
|
-
// src/_api/generated/core/auth.gen.ts
|
|
446
|
-
var getAuthToken = /* @__PURE__ */ __name(async (auth2, callback) => {
|
|
447
|
-
const token = typeof callback === "function" ? await callback(auth2) : callback;
|
|
448
|
-
if (!token) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
if (auth2.scheme === "bearer") {
|
|
452
|
-
return `Bearer ${token}`;
|
|
453
|
-
}
|
|
454
|
-
if (auth2.scheme === "basic") {
|
|
455
|
-
return `Basic ${btoa(token)}`;
|
|
456
|
-
}
|
|
457
|
-
return token;
|
|
458
|
-
}, "getAuthToken");
|
|
459
|
-
|
|
460
|
-
// src/_api/generated/client/utils.gen.ts
|
|
461
|
-
var createQuerySerializer = /* @__PURE__ */ __name(({
|
|
462
|
-
parameters = {},
|
|
463
|
-
...args
|
|
464
|
-
} = {}) => {
|
|
465
|
-
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
466
|
-
const search = [];
|
|
467
|
-
if (queryParams && typeof queryParams === "object") {
|
|
468
|
-
for (const name in queryParams) {
|
|
469
|
-
const value = queryParams[name];
|
|
470
|
-
if (value === void 0 || value === null) {
|
|
471
|
-
continue;
|
|
472
|
-
}
|
|
473
|
-
const options = parameters[name] || args;
|
|
474
|
-
if (Array.isArray(value)) {
|
|
475
|
-
const serializedArray = serializeArrayParam({
|
|
476
|
-
allowReserved: options.allowReserved,
|
|
477
|
-
explode: true,
|
|
478
|
-
name,
|
|
479
|
-
style: "form",
|
|
480
|
-
value,
|
|
481
|
-
...options.array
|
|
482
|
-
});
|
|
483
|
-
if (serializedArray) search.push(serializedArray);
|
|
484
|
-
} else if (typeof value === "object") {
|
|
485
|
-
const serializedObject = serializeObjectParam({
|
|
486
|
-
allowReserved: options.allowReserved,
|
|
487
|
-
explode: true,
|
|
488
|
-
name,
|
|
489
|
-
style: "deepObject",
|
|
490
|
-
value,
|
|
491
|
-
...options.object
|
|
492
|
-
});
|
|
493
|
-
if (serializedObject) search.push(serializedObject);
|
|
494
|
-
} else {
|
|
495
|
-
const serializedPrimitive = serializePrimitiveParam({
|
|
496
|
-
allowReserved: options.allowReserved,
|
|
497
|
-
name,
|
|
498
|
-
value
|
|
499
|
-
});
|
|
500
|
-
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
return search.join("&");
|
|
505
|
-
}, "querySerializer");
|
|
506
|
-
return querySerializer;
|
|
507
|
-
}, "createQuerySerializer");
|
|
508
|
-
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
509
|
-
if (!contentType) {
|
|
510
|
-
return "stream";
|
|
511
|
-
}
|
|
512
|
-
const cleanContent = contentType.split(";")[0]?.trim();
|
|
513
|
-
if (!cleanContent) {
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
517
|
-
return "json";
|
|
518
|
-
}
|
|
519
|
-
if (cleanContent === "multipart/form-data") {
|
|
520
|
-
return "formData";
|
|
521
|
-
}
|
|
522
|
-
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
523
|
-
return "blob";
|
|
524
|
-
}
|
|
525
|
-
if (cleanContent.startsWith("text/")) {
|
|
526
|
-
return "text";
|
|
527
|
-
}
|
|
528
|
-
return;
|
|
529
|
-
}, "getParseAs");
|
|
530
|
-
var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
531
|
-
if (!name) {
|
|
532
|
-
return false;
|
|
533
|
-
}
|
|
534
|
-
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
535
|
-
return true;
|
|
536
|
-
}
|
|
537
|
-
return false;
|
|
538
|
-
}, "checkForExistence");
|
|
539
|
-
var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
540
|
-
security,
|
|
541
|
-
...options
|
|
542
|
-
}) => {
|
|
543
|
-
for (const auth2 of security) {
|
|
544
|
-
if (checkForExistence(options, auth2.name)) {
|
|
545
|
-
continue;
|
|
546
|
-
}
|
|
547
|
-
const token = await getAuthToken(auth2, options.auth);
|
|
548
|
-
if (!token) {
|
|
549
|
-
continue;
|
|
550
|
-
}
|
|
551
|
-
const name = auth2.name ?? "Authorization";
|
|
552
|
-
switch (auth2.in) {
|
|
553
|
-
case "query":
|
|
554
|
-
if (!options.query) {
|
|
555
|
-
options.query = {};
|
|
556
|
-
}
|
|
557
|
-
options.query[name] = token;
|
|
558
|
-
break;
|
|
559
|
-
case "cookie":
|
|
560
|
-
options.headers.append("Cookie", `${name}=${token}`);
|
|
561
|
-
break;
|
|
562
|
-
case "header":
|
|
563
|
-
default:
|
|
564
|
-
options.headers.set(name, token);
|
|
565
|
-
break;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}, "setAuthParams");
|
|
569
|
-
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
570
|
-
baseUrl: options.baseUrl,
|
|
571
|
-
path: options.path,
|
|
572
|
-
query: options.query,
|
|
573
|
-
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
574
|
-
url: options.url
|
|
575
|
-
}), "buildUrl");
|
|
576
|
-
var mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
577
|
-
const config = { ...a, ...b };
|
|
578
|
-
if (config.baseUrl?.endsWith("/")) {
|
|
579
|
-
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
580
|
-
}
|
|
581
|
-
config.headers = mergeHeaders(a.headers, b.headers);
|
|
582
|
-
return config;
|
|
583
|
-
}, "mergeConfigs");
|
|
584
|
-
var headersEntries = /* @__PURE__ */ __name((headers) => {
|
|
585
|
-
const entries = [];
|
|
586
|
-
headers.forEach((value, key) => {
|
|
587
|
-
entries.push([key, value]);
|
|
588
|
-
});
|
|
589
|
-
return entries;
|
|
590
|
-
}, "headersEntries");
|
|
591
|
-
var mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
592
|
-
const mergedHeaders = new Headers();
|
|
593
|
-
for (const header of headers) {
|
|
594
|
-
if (!header) {
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
598
|
-
for (const [key, value] of iterator) {
|
|
599
|
-
if (value === null) {
|
|
600
|
-
mergedHeaders.delete(key);
|
|
601
|
-
} else if (Array.isArray(value)) {
|
|
602
|
-
for (const v of value) {
|
|
603
|
-
mergedHeaders.append(key, v);
|
|
604
|
-
}
|
|
605
|
-
} else if (value !== void 0) {
|
|
606
|
-
mergedHeaders.set(
|
|
607
|
-
key,
|
|
608
|
-
typeof value === "object" ? JSON.stringify(value) : value
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return mergedHeaders;
|
|
614
|
-
}, "mergeHeaders");
|
|
615
|
-
var Interceptors = class {
|
|
616
|
-
static {
|
|
617
|
-
__name(this, "Interceptors");
|
|
618
|
-
}
|
|
619
|
-
fns = [];
|
|
620
|
-
clear() {
|
|
621
|
-
this.fns = [];
|
|
622
|
-
}
|
|
623
|
-
eject(id) {
|
|
624
|
-
const index = this.getInterceptorIndex(id);
|
|
625
|
-
if (this.fns[index]) {
|
|
626
|
-
this.fns[index] = null;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
exists(id) {
|
|
630
|
-
const index = this.getInterceptorIndex(id);
|
|
631
|
-
return Boolean(this.fns[index]);
|
|
632
|
-
}
|
|
633
|
-
getInterceptorIndex(id) {
|
|
634
|
-
if (typeof id === "number") {
|
|
635
|
-
return this.fns[id] ? id : -1;
|
|
636
|
-
}
|
|
637
|
-
return this.fns.indexOf(id);
|
|
638
|
-
}
|
|
639
|
-
update(id, fn) {
|
|
640
|
-
const index = this.getInterceptorIndex(id);
|
|
641
|
-
if (this.fns[index]) {
|
|
642
|
-
this.fns[index] = fn;
|
|
643
|
-
return id;
|
|
644
|
-
}
|
|
645
|
-
return false;
|
|
646
|
-
}
|
|
647
|
-
use(fn) {
|
|
648
|
-
this.fns.push(fn);
|
|
649
|
-
return this.fns.length - 1;
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
var createInterceptors = /* @__PURE__ */ __name(() => ({
|
|
653
|
-
error: new Interceptors(),
|
|
654
|
-
request: new Interceptors(),
|
|
655
|
-
response: new Interceptors()
|
|
656
|
-
}), "createInterceptors");
|
|
657
|
-
var defaultQuerySerializer = createQuerySerializer({
|
|
658
|
-
allowReserved: false,
|
|
659
|
-
array: {
|
|
660
|
-
explode: true,
|
|
661
|
-
style: "form"
|
|
662
|
-
},
|
|
663
|
-
object: {
|
|
664
|
-
explode: true,
|
|
665
|
-
style: "deepObject"
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
var defaultHeaders = {
|
|
669
|
-
"Content-Type": "application/json"
|
|
670
|
-
};
|
|
671
|
-
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
672
|
-
...jsonBodySerializer,
|
|
673
|
-
headers: defaultHeaders,
|
|
674
|
-
parseAs: "auto",
|
|
675
|
-
querySerializer: defaultQuerySerializer,
|
|
676
|
-
...override
|
|
677
|
-
}), "createConfig");
|
|
678
|
-
|
|
679
|
-
// src/_api/generated/client/client.gen.ts
|
|
680
|
-
var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
681
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
682
|
-
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
683
|
-
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
684
|
-
_config = mergeConfigs(_config, config2);
|
|
685
|
-
return getConfig();
|
|
686
|
-
}, "setConfig");
|
|
687
|
-
const interceptors = createInterceptors();
|
|
688
|
-
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
689
|
-
const opts = {
|
|
690
|
-
..._config,
|
|
691
|
-
...options,
|
|
692
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
693
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
694
|
-
serializedBody: void 0
|
|
695
|
-
};
|
|
696
|
-
if (opts.security) {
|
|
697
|
-
await setAuthParams({
|
|
698
|
-
...opts,
|
|
699
|
-
security: opts.security
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
if (opts.requestValidator) {
|
|
703
|
-
await opts.requestValidator(opts);
|
|
704
|
-
}
|
|
705
|
-
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
706
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
707
|
-
}
|
|
708
|
-
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
709
|
-
opts.headers.delete("Content-Type");
|
|
710
|
-
}
|
|
711
|
-
const resolvedOpts = opts;
|
|
712
|
-
const url = buildUrl(resolvedOpts);
|
|
713
|
-
return { opts: resolvedOpts, url };
|
|
714
|
-
}, "beforeRequest");
|
|
715
|
-
const request = /* @__PURE__ */ __name(async (options) => {
|
|
716
|
-
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
717
|
-
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
718
|
-
let request2;
|
|
719
|
-
let response;
|
|
720
|
-
try {
|
|
721
|
-
const { opts, url } = await beforeRequest(options);
|
|
722
|
-
const requestInit = {
|
|
723
|
-
redirect: "follow",
|
|
724
|
-
...opts,
|
|
725
|
-
body: getValidRequestBody(opts)
|
|
726
|
-
};
|
|
727
|
-
request2 = new Request(url, requestInit);
|
|
728
|
-
for (const fn of interceptors.request.fns) {
|
|
729
|
-
if (fn) {
|
|
730
|
-
request2 = await fn(request2, opts);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
const _fetch = opts.fetch;
|
|
734
|
-
response = await _fetch(request2);
|
|
735
|
-
for (const fn of interceptors.response.fns) {
|
|
736
|
-
if (fn) {
|
|
737
|
-
response = await fn(response, request2, opts);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
const result = {
|
|
741
|
-
request: request2,
|
|
742
|
-
response
|
|
743
|
-
};
|
|
744
|
-
if (response.ok) {
|
|
745
|
-
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
746
|
-
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
747
|
-
let emptyData;
|
|
748
|
-
switch (parseAs) {
|
|
749
|
-
case "arrayBuffer":
|
|
750
|
-
case "blob":
|
|
751
|
-
case "text":
|
|
752
|
-
emptyData = await response[parseAs]();
|
|
753
|
-
break;
|
|
754
|
-
case "formData":
|
|
755
|
-
emptyData = new FormData();
|
|
756
|
-
break;
|
|
757
|
-
case "stream":
|
|
758
|
-
emptyData = response.body;
|
|
759
|
-
break;
|
|
760
|
-
case "json":
|
|
761
|
-
default:
|
|
762
|
-
emptyData = {};
|
|
763
|
-
break;
|
|
764
|
-
}
|
|
765
|
-
return opts.responseStyle === "data" ? emptyData : {
|
|
766
|
-
data: emptyData,
|
|
767
|
-
...result
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
let data;
|
|
771
|
-
switch (parseAs) {
|
|
772
|
-
case "arrayBuffer":
|
|
773
|
-
case "blob":
|
|
774
|
-
case "formData":
|
|
775
|
-
case "text":
|
|
776
|
-
data = await response[parseAs]();
|
|
777
|
-
break;
|
|
778
|
-
case "json": {
|
|
779
|
-
const text = await response.text();
|
|
780
|
-
data = text ? JSON.parse(text) : {};
|
|
781
|
-
break;
|
|
782
|
-
}
|
|
783
|
-
case "stream":
|
|
784
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
785
|
-
data: response.body,
|
|
786
|
-
...result
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
if (parseAs === "json") {
|
|
790
|
-
if (opts.responseValidator) {
|
|
791
|
-
await opts.responseValidator(data);
|
|
792
|
-
}
|
|
793
|
-
if (opts.responseTransformer) {
|
|
794
|
-
data = await opts.responseTransformer(data);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return opts.responseStyle === "data" ? data : {
|
|
798
|
-
data,
|
|
799
|
-
...result
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
const textError = await response.text();
|
|
803
|
-
let jsonError;
|
|
804
|
-
try {
|
|
805
|
-
jsonError = JSON.parse(textError);
|
|
806
|
-
} catch {
|
|
807
|
-
}
|
|
808
|
-
throw jsonError ?? textError;
|
|
809
|
-
} catch (error) {
|
|
810
|
-
let finalError = error;
|
|
811
|
-
for (const fn of interceptors.error.fns) {
|
|
812
|
-
if (fn) {
|
|
813
|
-
finalError = await fn(finalError, response, request2, options);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
finalError = finalError || {};
|
|
817
|
-
if (throwOnError) {
|
|
818
|
-
throw finalError;
|
|
819
|
-
}
|
|
820
|
-
return responseStyle === "data" ? void 0 : {
|
|
821
|
-
error: finalError,
|
|
822
|
-
request: request2,
|
|
823
|
-
response
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
}, "request");
|
|
827
|
-
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
828
|
-
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
829
|
-
const { opts, url } = await beforeRequest(options);
|
|
830
|
-
return createSseClient({
|
|
831
|
-
...opts,
|
|
832
|
-
body: opts.body,
|
|
833
|
-
method,
|
|
834
|
-
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
835
|
-
let request2 = new Request(url2, init);
|
|
836
|
-
for (const fn of interceptors.request.fns) {
|
|
837
|
-
if (fn) {
|
|
838
|
-
request2 = await fn(request2, opts);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
return request2;
|
|
842
|
-
}, "onRequest"),
|
|
843
|
-
serializedBody: getValidRequestBody(opts),
|
|
844
|
-
url
|
|
845
|
-
});
|
|
846
|
-
}, "makeSseFn");
|
|
847
|
-
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl({ ..._config, ...options }), "_buildUrl");
|
|
848
|
-
return {
|
|
849
|
-
buildUrl: _buildUrl,
|
|
850
|
-
connect: makeMethodFn("CONNECT"),
|
|
851
|
-
delete: makeMethodFn("DELETE"),
|
|
852
|
-
get: makeMethodFn("GET"),
|
|
853
|
-
getConfig,
|
|
854
|
-
head: makeMethodFn("HEAD"),
|
|
855
|
-
interceptors,
|
|
856
|
-
options: makeMethodFn("OPTIONS"),
|
|
857
|
-
patch: makeMethodFn("PATCH"),
|
|
858
|
-
post: makeMethodFn("POST"),
|
|
859
|
-
put: makeMethodFn("PUT"),
|
|
860
|
-
request,
|
|
861
|
-
setConfig,
|
|
862
|
-
sse: {
|
|
863
|
-
connect: makeSseFn("CONNECT"),
|
|
864
|
-
delete: makeSseFn("DELETE"),
|
|
865
|
-
get: makeSseFn("GET"),
|
|
866
|
-
head: makeSseFn("HEAD"),
|
|
867
|
-
options: makeSseFn("OPTIONS"),
|
|
868
|
-
patch: makeSseFn("PATCH"),
|
|
869
|
-
post: makeSseFn("POST"),
|
|
870
|
-
put: makeSseFn("PUT"),
|
|
871
|
-
trace: makeSseFn("TRACE")
|
|
872
|
-
},
|
|
873
|
-
trace: makeMethodFn("TRACE")
|
|
874
|
-
};
|
|
875
|
-
}, "createClient");
|
|
876
|
-
|
|
877
|
-
// src/_api/generated/client.gen.ts
|
|
878
|
-
var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
879
|
-
|
|
880
56
|
// src/_api/generated/helpers/auth.ts
|
|
881
57
|
var ACCESS_KEY = "cfg.access_token";
|
|
882
58
|
var REFRESH_KEY = "cfg.refresh_token";
|
|
@@ -969,15 +145,20 @@ var _apiKeyOverride = null;
|
|
|
969
145
|
var _baseUrlOverride = null;
|
|
970
146
|
var _withCredentials = true;
|
|
971
147
|
var _onUnauthorized = null;
|
|
148
|
+
var _client = null;
|
|
149
|
+
function pushClientConfig() {
|
|
150
|
+
if (!_client) return;
|
|
151
|
+
_client.setConfig({
|
|
152
|
+
baseUrl: auth.getBaseUrl(),
|
|
153
|
+
credentials: _withCredentials ? "include" : "same-origin"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
__name(pushClientConfig, "pushClientConfig");
|
|
972
157
|
var auth = {
|
|
973
158
|
// ── Storage mode ──────────────────────────────────────────────────
|
|
974
159
|
getStorageMode() {
|
|
975
160
|
return _storageMode;
|
|
976
161
|
},
|
|
977
|
-
/**
|
|
978
|
-
* Switch the storage backend. Existing values in the *previous*
|
|
979
|
-
* backend are NOT migrated — set fresh values after switching.
|
|
980
|
-
*/
|
|
981
162
|
setStorageMode(mode) {
|
|
982
163
|
_storageMode = mode;
|
|
983
164
|
_storage = mode === "cookie" ? cookieBackend : localStorageBackend;
|
|
@@ -1003,15 +184,12 @@ var auth = {
|
|
|
1003
184
|
return _storage.get(ACCESS_KEY) !== null;
|
|
1004
185
|
},
|
|
1005
186
|
// ── API key ───────────────────────────────────────────────────────
|
|
1006
|
-
/** In-memory API key. Falls back to storage, then NEXT_PUBLIC_API_KEY. */
|
|
1007
187
|
getApiKey() {
|
|
1008
188
|
return _apiKeyOverride ?? _storage.get(API_KEY_KEY) ?? defaultApiKey();
|
|
1009
189
|
},
|
|
1010
|
-
/** In-memory only (cleared on reload). */
|
|
1011
190
|
setApiKey(key) {
|
|
1012
191
|
_apiKeyOverride = key;
|
|
1013
192
|
},
|
|
1014
|
-
/** Persist to active storage backend (localStorage or cookie). */
|
|
1015
193
|
setApiKeyPersist(key) {
|
|
1016
194
|
_apiKeyOverride = key;
|
|
1017
195
|
_storage.set(API_KEY_KEY, key);
|
|
@@ -1021,7 +199,6 @@ var auth = {
|
|
|
1021
199
|
_storage.set(API_KEY_KEY, null);
|
|
1022
200
|
},
|
|
1023
201
|
// ── Locale ────────────────────────────────────────────────────────
|
|
1024
|
-
/** Override locale → falls back to NEXT_LOCALE cookie / navigator.language. */
|
|
1025
202
|
getLocale() {
|
|
1026
203
|
return _localeOverride ?? detectLocale();
|
|
1027
204
|
},
|
|
@@ -1035,48 +212,48 @@ var auth = {
|
|
|
1035
212
|
},
|
|
1036
213
|
setBaseUrl(url) {
|
|
1037
214
|
_baseUrlOverride = url ? url.replace(/\/$/, "") : null;
|
|
1038
|
-
|
|
215
|
+
pushClientConfig();
|
|
1039
216
|
},
|
|
1040
|
-
// ── Credentials toggle
|
|
217
|
+
// ── Credentials toggle ────────────────────────────────────────────
|
|
1041
218
|
getWithCredentials() {
|
|
1042
219
|
return _withCredentials;
|
|
1043
220
|
},
|
|
1044
221
|
setWithCredentials(value) {
|
|
1045
222
|
_withCredentials = value;
|
|
1046
|
-
|
|
223
|
+
pushClientConfig();
|
|
1047
224
|
},
|
|
1048
225
|
// ── 401 handler ───────────────────────────────────────────────────
|
|
1049
|
-
/**
|
|
1050
|
-
* Register a callback fired on every 401 response. Use this to wire
|
|
1051
|
-
* a token-refresh flow or a forced logout. Setting `null` removes
|
|
1052
|
-
* the handler.
|
|
1053
|
-
*/
|
|
1054
226
|
onUnauthorized(cb) {
|
|
1055
227
|
_onUnauthorized = cb;
|
|
1056
228
|
}
|
|
1057
229
|
};
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
230
|
+
function installAuthOnClient(client2) {
|
|
231
|
+
if (_client) return;
|
|
232
|
+
_client = client2;
|
|
233
|
+
client2.setConfig({
|
|
234
|
+
baseUrl: auth.getBaseUrl(),
|
|
235
|
+
credentials: _withCredentials ? "include" : "same-origin"
|
|
236
|
+
});
|
|
237
|
+
client2.interceptors.request.use((request) => {
|
|
238
|
+
const token = auth.getToken();
|
|
239
|
+
if (token) request.headers.set("Authorization", `Bearer ${token}`);
|
|
240
|
+
const locale = auth.getLocale();
|
|
241
|
+
if (locale) request.headers.set("Accept-Language", locale);
|
|
242
|
+
const apiKey = auth.getApiKey();
|
|
243
|
+
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
244
|
+
return request;
|
|
245
|
+
});
|
|
246
|
+
client2.interceptors.response.use((response) => {
|
|
247
|
+
if (response.status === 401 && _onUnauthorized) {
|
|
248
|
+
try {
|
|
249
|
+
_onUnauthorized(response);
|
|
250
|
+
} catch {
|
|
251
|
+
}
|
|
1076
252
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
}
|
|
253
|
+
return response;
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
__name(installAuthOnClient, "installAuthOnClient");
|
|
1080
257
|
|
|
1081
258
|
// src/_api/generated/helpers/logger.ts
|
|
1082
259
|
var import_consola = require("consola");
|
|
@@ -1265,277 +442,1102 @@ var MemoryStorageAdapter = class {
|
|
|
1265
442
|
static {
|
|
1266
443
|
__name(this, "MemoryStorageAdapter");
|
|
1267
444
|
}
|
|
1268
|
-
store = /* @__PURE__ */ new Map();
|
|
1269
|
-
getItem(key) {
|
|
1270
|
-
return this.store.get(key) ?? null;
|
|
445
|
+
store = /* @__PURE__ */ new Map();
|
|
446
|
+
getItem(key) {
|
|
447
|
+
return this.store.get(key) ?? null;
|
|
448
|
+
}
|
|
449
|
+
setItem(key, value) {
|
|
450
|
+
this.store.set(key, value);
|
|
451
|
+
}
|
|
452
|
+
removeItem(key) {
|
|
453
|
+
this.store.delete(key);
|
|
454
|
+
}
|
|
455
|
+
clear() {
|
|
456
|
+
this.store.clear();
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
var CookieStorageAdapter = class {
|
|
460
|
+
constructor(opts = {}) {
|
|
461
|
+
this.opts = opts;
|
|
462
|
+
}
|
|
463
|
+
static {
|
|
464
|
+
__name(this, "CookieStorageAdapter");
|
|
465
|
+
}
|
|
466
|
+
getItem(key) {
|
|
467
|
+
if (typeof document === "undefined") return null;
|
|
468
|
+
const prefix = `${encodeURIComponent(key)}=`;
|
|
469
|
+
for (const part of document.cookie.split("; ")) {
|
|
470
|
+
if (part.startsWith(prefix)) {
|
|
471
|
+
return decodeURIComponent(part.slice(prefix.length));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
setItem(key, value) {
|
|
477
|
+
if (typeof document === "undefined") return;
|
|
478
|
+
const parts = [
|
|
479
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`,
|
|
480
|
+
`Path=${this.opts.path ?? "/"}`
|
|
481
|
+
];
|
|
482
|
+
if (this.opts.domain) parts.push(`Domain=${this.opts.domain}`);
|
|
483
|
+
if (this.opts.secure) parts.push("Secure");
|
|
484
|
+
if (this.opts.sameSite) parts.push(`SameSite=${this.opts.sameSite}`);
|
|
485
|
+
if (this.opts.maxAgeSeconds != null) {
|
|
486
|
+
parts.push(`Max-Age=${this.opts.maxAgeSeconds}`);
|
|
487
|
+
}
|
|
488
|
+
document.cookie = parts.join("; ");
|
|
489
|
+
}
|
|
490
|
+
removeItem(key) {
|
|
491
|
+
if (typeof document === "undefined") return;
|
|
492
|
+
document.cookie = `${encodeURIComponent(key)}=; Max-Age=0; Path=${this.opts.path ?? "/"}`;
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// src/_api/generated/helpers/errors.ts
|
|
497
|
+
var APIError = class extends Error {
|
|
498
|
+
constructor(statusCode, statusText, response, url, message) {
|
|
499
|
+
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
500
|
+
this.statusCode = statusCode;
|
|
501
|
+
this.statusText = statusText;
|
|
502
|
+
this.response = response;
|
|
503
|
+
this.url = url;
|
|
504
|
+
this.name = "APIError";
|
|
505
|
+
}
|
|
506
|
+
static {
|
|
507
|
+
__name(this, "APIError");
|
|
508
|
+
}
|
|
509
|
+
get details() {
|
|
510
|
+
if (typeof this.response === "object" && this.response !== null) {
|
|
511
|
+
return this.response;
|
|
512
|
+
}
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
get fieldErrors() {
|
|
516
|
+
const details = this.details;
|
|
517
|
+
if (!details) return null;
|
|
518
|
+
const fieldErrors = {};
|
|
519
|
+
for (const [key, value] of Object.entries(details)) {
|
|
520
|
+
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
521
|
+
}
|
|
522
|
+
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
523
|
+
}
|
|
524
|
+
get errorMessage() {
|
|
525
|
+
const details = this.details;
|
|
526
|
+
if (!details) return this.message;
|
|
527
|
+
if (details.detail) {
|
|
528
|
+
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
529
|
+
}
|
|
530
|
+
if (details.error) return String(details.error);
|
|
531
|
+
if (details.message) return String(details.message);
|
|
532
|
+
const fieldErrors = this.fieldErrors;
|
|
533
|
+
if (fieldErrors) {
|
|
534
|
+
const firstField = Object.keys(fieldErrors)[0];
|
|
535
|
+
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
536
|
+
}
|
|
537
|
+
return this.message;
|
|
538
|
+
}
|
|
539
|
+
get isValidationError() {
|
|
540
|
+
return this.statusCode === 400;
|
|
541
|
+
}
|
|
542
|
+
get isAuthError() {
|
|
543
|
+
return this.statusCode === 401;
|
|
544
|
+
}
|
|
545
|
+
get isPermissionError() {
|
|
546
|
+
return this.statusCode === 403;
|
|
547
|
+
}
|
|
548
|
+
get isNotFoundError() {
|
|
549
|
+
return this.statusCode === 404;
|
|
550
|
+
}
|
|
551
|
+
get isServerError() {
|
|
552
|
+
return this.statusCode >= 500 && this.statusCode < 600;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
var NetworkError = class extends Error {
|
|
556
|
+
constructor(message, url, originalError) {
|
|
557
|
+
super(message);
|
|
558
|
+
this.url = url;
|
|
559
|
+
this.originalError = originalError;
|
|
560
|
+
this.name = "NetworkError";
|
|
561
|
+
}
|
|
562
|
+
static {
|
|
563
|
+
__name(this, "NetworkError");
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
// src/_api/generated/helpers/validation-events.ts
|
|
568
|
+
function dispatchValidationError(detail) {
|
|
569
|
+
if (typeof window === "undefined") return;
|
|
570
|
+
try {
|
|
571
|
+
const event = new CustomEvent("zod-validation-error", {
|
|
572
|
+
detail,
|
|
573
|
+
bubbles: true,
|
|
574
|
+
cancelable: false
|
|
575
|
+
});
|
|
576
|
+
window.dispatchEvent(event);
|
|
577
|
+
} catch (error) {
|
|
578
|
+
console.warn("Failed to dispatch validation error event:", error);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
__name(dispatchValidationError, "dispatchValidationError");
|
|
582
|
+
function onValidationError(callback) {
|
|
583
|
+
if (typeof window === "undefined") return () => {
|
|
584
|
+
};
|
|
585
|
+
const handler = /* @__PURE__ */ __name((event) => {
|
|
586
|
+
if (event instanceof CustomEvent) callback(event.detail);
|
|
587
|
+
}, "handler");
|
|
588
|
+
window.addEventListener("zod-validation-error", handler);
|
|
589
|
+
return () => window.removeEventListener("zod-validation-error", handler);
|
|
590
|
+
}
|
|
591
|
+
__name(onValidationError, "onValidationError");
|
|
592
|
+
function formatZodError(error) {
|
|
593
|
+
const issues = error.issues.map((issue, index) => {
|
|
594
|
+
const path = issue.path.join(".") || "root";
|
|
595
|
+
const parts = [`${index + 1}. ${path}: ${issue.message}`];
|
|
596
|
+
if ("expected" in issue && issue.expected) parts.push(` Expected: ${issue.expected}`);
|
|
597
|
+
if ("received" in issue && issue.received) parts.push(` Received: ${issue.received}`);
|
|
598
|
+
return parts.join("\n");
|
|
599
|
+
});
|
|
600
|
+
return issues.join("\n");
|
|
601
|
+
}
|
|
602
|
+
__name(formatZodError, "formatZodError");
|
|
603
|
+
|
|
604
|
+
// src/_api/generated/_cfg_centrifugo/api.ts
|
|
605
|
+
var API2 = class {
|
|
606
|
+
static {
|
|
607
|
+
__name(this, "API");
|
|
608
|
+
}
|
|
609
|
+
logger;
|
|
610
|
+
constructor(_baseUrl, opts = {}) {
|
|
611
|
+
this.logger = new APILogger(opts.logger);
|
|
612
|
+
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
613
|
+
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
614
|
+
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
615
|
+
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
616
|
+
}
|
|
617
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
618
|
+
getBaseUrl() {
|
|
619
|
+
return auth.getBaseUrl();
|
|
620
|
+
}
|
|
621
|
+
setBaseUrl(url) {
|
|
622
|
+
auth.setBaseUrl(url);
|
|
623
|
+
}
|
|
624
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
625
|
+
getToken() {
|
|
626
|
+
return auth.getToken();
|
|
627
|
+
}
|
|
628
|
+
setToken(token) {
|
|
629
|
+
auth.setToken(token);
|
|
630
|
+
}
|
|
631
|
+
getRefreshToken() {
|
|
632
|
+
return auth.getRefreshToken();
|
|
633
|
+
}
|
|
634
|
+
setRefreshToken(token) {
|
|
635
|
+
auth.setRefreshToken(token);
|
|
636
|
+
}
|
|
637
|
+
clearToken() {
|
|
638
|
+
auth.clearTokens();
|
|
639
|
+
}
|
|
640
|
+
isAuthenticated() {
|
|
641
|
+
return auth.isAuthenticated();
|
|
642
|
+
}
|
|
643
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
644
|
+
getLocale() {
|
|
645
|
+
return auth.getLocale();
|
|
646
|
+
}
|
|
647
|
+
setLocale(locale) {
|
|
648
|
+
auth.setLocale(locale);
|
|
649
|
+
}
|
|
650
|
+
getApiKey() {
|
|
651
|
+
return auth.getApiKey();
|
|
652
|
+
}
|
|
653
|
+
setApiKey(key) {
|
|
654
|
+
auth.setApiKey(key);
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
// src/_api/generated/_cfg_totp/api.ts
|
|
659
|
+
var API3 = class {
|
|
660
|
+
static {
|
|
661
|
+
__name(this, "API");
|
|
662
|
+
}
|
|
663
|
+
logger;
|
|
664
|
+
constructor(_baseUrl, opts = {}) {
|
|
665
|
+
this.logger = new APILogger(opts.logger);
|
|
666
|
+
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
667
|
+
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
668
|
+
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
669
|
+
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
670
|
+
}
|
|
671
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
672
|
+
getBaseUrl() {
|
|
673
|
+
return auth.getBaseUrl();
|
|
674
|
+
}
|
|
675
|
+
setBaseUrl(url) {
|
|
676
|
+
auth.setBaseUrl(url);
|
|
677
|
+
}
|
|
678
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
679
|
+
getToken() {
|
|
680
|
+
return auth.getToken();
|
|
681
|
+
}
|
|
682
|
+
setToken(token) {
|
|
683
|
+
auth.setToken(token);
|
|
1271
684
|
}
|
|
1272
|
-
|
|
1273
|
-
|
|
685
|
+
getRefreshToken() {
|
|
686
|
+
return auth.getRefreshToken();
|
|
1274
687
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
688
|
+
setRefreshToken(token) {
|
|
689
|
+
auth.setRefreshToken(token);
|
|
1277
690
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
691
|
+
clearToken() {
|
|
692
|
+
auth.clearTokens();
|
|
1280
693
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
constructor(opts = {}) {
|
|
1284
|
-
this.opts = opts;
|
|
694
|
+
isAuthenticated() {
|
|
695
|
+
return auth.isAuthenticated();
|
|
1285
696
|
}
|
|
1286
|
-
|
|
1287
|
-
|
|
697
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
698
|
+
getLocale() {
|
|
699
|
+
return auth.getLocale();
|
|
1288
700
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
const prefix = `${encodeURIComponent(key)}=`;
|
|
1292
|
-
for (const part of document.cookie.split("; ")) {
|
|
1293
|
-
if (part.startsWith(prefix)) {
|
|
1294
|
-
return decodeURIComponent(part.slice(prefix.length));
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
return null;
|
|
701
|
+
setLocale(locale) {
|
|
702
|
+
auth.setLocale(locale);
|
|
1298
703
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
const parts = [
|
|
1302
|
-
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`,
|
|
1303
|
-
`Path=${this.opts.path ?? "/"}`
|
|
1304
|
-
];
|
|
1305
|
-
if (this.opts.domain) parts.push(`Domain=${this.opts.domain}`);
|
|
1306
|
-
if (this.opts.secure) parts.push("Secure");
|
|
1307
|
-
if (this.opts.sameSite) parts.push(`SameSite=${this.opts.sameSite}`);
|
|
1308
|
-
if (this.opts.maxAgeSeconds != null) {
|
|
1309
|
-
parts.push(`Max-Age=${this.opts.maxAgeSeconds}`);
|
|
1310
|
-
}
|
|
1311
|
-
document.cookie = parts.join("; ");
|
|
704
|
+
getApiKey() {
|
|
705
|
+
return auth.getApiKey();
|
|
1312
706
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
document.cookie = `${encodeURIComponent(key)}=; Max-Age=0; Path=${this.opts.path ?? "/"}`;
|
|
707
|
+
setApiKey(key) {
|
|
708
|
+
auth.setApiKey(key);
|
|
1316
709
|
}
|
|
1317
710
|
};
|
|
1318
711
|
|
|
1319
|
-
// src/_api/generated/
|
|
1320
|
-
var
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
get details() {
|
|
1333
|
-
if (typeof this.response === "object" && this.response !== null) {
|
|
1334
|
-
return this.response;
|
|
1335
|
-
}
|
|
1336
|
-
return null;
|
|
1337
|
-
}
|
|
1338
|
-
get fieldErrors() {
|
|
1339
|
-
const details = this.details;
|
|
1340
|
-
if (!details) return null;
|
|
1341
|
-
const fieldErrors = {};
|
|
1342
|
-
for (const [key, value] of Object.entries(details)) {
|
|
1343
|
-
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
1344
|
-
}
|
|
1345
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
712
|
+
// src/_api/generated/index.ts
|
|
713
|
+
var CfgAccountsApi = new API();
|
|
714
|
+
var CfgCentrifugoApi = new API2();
|
|
715
|
+
var CfgTotpApi = new API3();
|
|
716
|
+
|
|
717
|
+
// src/_api/generated/core/bodySerializer.gen.ts
|
|
718
|
+
var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
|
|
719
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
720
|
+
data.append(key, value);
|
|
721
|
+
} else if (value instanceof Date) {
|
|
722
|
+
data.append(key, value.toISOString());
|
|
723
|
+
} else {
|
|
724
|
+
data.append(key, JSON.stringify(value));
|
|
1346
725
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
726
|
+
}, "serializeFormDataPair");
|
|
727
|
+
var formDataBodySerializer = {
|
|
728
|
+
bodySerializer: /* @__PURE__ */ __name((body) => {
|
|
729
|
+
const data = new FormData();
|
|
730
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
731
|
+
if (value === void 0 || value === null) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
if (Array.isArray(value)) {
|
|
735
|
+
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
736
|
+
} else {
|
|
737
|
+
serializeFormDataPair(data, key, value);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
return data;
|
|
741
|
+
}, "bodySerializer")
|
|
742
|
+
};
|
|
743
|
+
var jsonBodySerializer = {
|
|
744
|
+
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
// src/_api/generated/core/params.gen.ts
|
|
748
|
+
var extraPrefixesMap = {
|
|
749
|
+
$body_: "body",
|
|
750
|
+
$headers_: "headers",
|
|
751
|
+
$path_: "path",
|
|
752
|
+
$query_: "query"
|
|
753
|
+
};
|
|
754
|
+
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
755
|
+
|
|
756
|
+
// src/_api/generated/core/serverSentEvents.gen.ts
|
|
757
|
+
function createSseClient({
|
|
758
|
+
onRequest,
|
|
759
|
+
onSseError,
|
|
760
|
+
onSseEvent,
|
|
761
|
+
responseTransformer,
|
|
762
|
+
responseValidator,
|
|
763
|
+
sseDefaultRetryDelay,
|
|
764
|
+
sseMaxRetryAttempts,
|
|
765
|
+
sseMaxRetryDelay,
|
|
766
|
+
sseSleepFn,
|
|
767
|
+
url,
|
|
768
|
+
...options
|
|
769
|
+
}) {
|
|
770
|
+
let lastEventId;
|
|
771
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
772
|
+
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
773
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
774
|
+
let attempt = 0;
|
|
775
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
776
|
+
while (true) {
|
|
777
|
+
if (signal.aborted) break;
|
|
778
|
+
attempt++;
|
|
779
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
780
|
+
if (lastEventId !== void 0) {
|
|
781
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
782
|
+
}
|
|
783
|
+
try {
|
|
784
|
+
const requestInit = {
|
|
785
|
+
redirect: "follow",
|
|
786
|
+
...options,
|
|
787
|
+
body: options.serializedBody,
|
|
788
|
+
headers,
|
|
789
|
+
signal
|
|
790
|
+
};
|
|
791
|
+
let request = new Request(url, requestInit);
|
|
792
|
+
if (onRequest) {
|
|
793
|
+
request = await onRequest(url, requestInit);
|
|
794
|
+
}
|
|
795
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
796
|
+
const response = await _fetch(request);
|
|
797
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
798
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
799
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
800
|
+
let buffer = "";
|
|
801
|
+
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
802
|
+
try {
|
|
803
|
+
reader.cancel();
|
|
804
|
+
} catch {
|
|
805
|
+
}
|
|
806
|
+
}, "abortHandler");
|
|
807
|
+
signal.addEventListener("abort", abortHandler);
|
|
808
|
+
try {
|
|
809
|
+
while (true) {
|
|
810
|
+
const { done, value } = await reader.read();
|
|
811
|
+
if (done) break;
|
|
812
|
+
buffer += value;
|
|
813
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
814
|
+
const chunks = buffer.split("\n\n");
|
|
815
|
+
buffer = chunks.pop() ?? "";
|
|
816
|
+
for (const chunk of chunks) {
|
|
817
|
+
const lines = chunk.split("\n");
|
|
818
|
+
const dataLines = [];
|
|
819
|
+
let eventName;
|
|
820
|
+
for (const line of lines) {
|
|
821
|
+
if (line.startsWith("data:")) {
|
|
822
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
823
|
+
} else if (line.startsWith("event:")) {
|
|
824
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
825
|
+
} else if (line.startsWith("id:")) {
|
|
826
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
827
|
+
} else if (line.startsWith("retry:")) {
|
|
828
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
829
|
+
if (!Number.isNaN(parsed)) {
|
|
830
|
+
retryDelay = parsed;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
let data;
|
|
835
|
+
let parsedJson = false;
|
|
836
|
+
if (dataLines.length) {
|
|
837
|
+
const rawData = dataLines.join("\n");
|
|
838
|
+
try {
|
|
839
|
+
data = JSON.parse(rawData);
|
|
840
|
+
parsedJson = true;
|
|
841
|
+
} catch {
|
|
842
|
+
data = rawData;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
if (parsedJson) {
|
|
846
|
+
if (responseValidator) {
|
|
847
|
+
await responseValidator(data);
|
|
848
|
+
}
|
|
849
|
+
if (responseTransformer) {
|
|
850
|
+
data = await responseTransformer(data);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
onSseEvent?.({
|
|
854
|
+
data,
|
|
855
|
+
event: eventName,
|
|
856
|
+
id: lastEventId,
|
|
857
|
+
retry: retryDelay
|
|
858
|
+
});
|
|
859
|
+
if (dataLines.length) {
|
|
860
|
+
yield data;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
} finally {
|
|
865
|
+
signal.removeEventListener("abort", abortHandler);
|
|
866
|
+
reader.releaseLock();
|
|
867
|
+
}
|
|
868
|
+
break;
|
|
869
|
+
} catch (error) {
|
|
870
|
+
onSseError?.(error);
|
|
871
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
872
|
+
break;
|
|
873
|
+
}
|
|
874
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
875
|
+
await sleep(backoff);
|
|
876
|
+
}
|
|
1359
877
|
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
878
|
+
}, "createStream");
|
|
879
|
+
const stream = createStream();
|
|
880
|
+
return { stream };
|
|
881
|
+
}
|
|
882
|
+
__name(createSseClient, "createSseClient");
|
|
883
|
+
|
|
884
|
+
// src/_api/generated/core/pathSerializer.gen.ts
|
|
885
|
+
var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
886
|
+
switch (style) {
|
|
887
|
+
case "label":
|
|
888
|
+
return ".";
|
|
889
|
+
case "matrix":
|
|
890
|
+
return ";";
|
|
891
|
+
case "simple":
|
|
892
|
+
return ",";
|
|
893
|
+
default:
|
|
894
|
+
return "&";
|
|
1364
895
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
896
|
+
}, "separatorArrayExplode");
|
|
897
|
+
var separatorArrayNoExplode = /* @__PURE__ */ __name((style) => {
|
|
898
|
+
switch (style) {
|
|
899
|
+
case "form":
|
|
900
|
+
return ",";
|
|
901
|
+
case "pipeDelimited":
|
|
902
|
+
return "|";
|
|
903
|
+
case "spaceDelimited":
|
|
904
|
+
return "%20";
|
|
905
|
+
default:
|
|
906
|
+
return ",";
|
|
1367
907
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
908
|
+
}, "separatorArrayNoExplode");
|
|
909
|
+
var separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
910
|
+
switch (style) {
|
|
911
|
+
case "label":
|
|
912
|
+
return ".";
|
|
913
|
+
case "matrix":
|
|
914
|
+
return ";";
|
|
915
|
+
case "simple":
|
|
916
|
+
return ",";
|
|
917
|
+
default:
|
|
918
|
+
return "&";
|
|
1370
919
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
920
|
+
}, "separatorObjectExplode");
|
|
921
|
+
var serializeArrayParam = /* @__PURE__ */ __name(({
|
|
922
|
+
allowReserved,
|
|
923
|
+
explode,
|
|
924
|
+
name,
|
|
925
|
+
style,
|
|
926
|
+
value
|
|
927
|
+
}) => {
|
|
928
|
+
if (!explode) {
|
|
929
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
930
|
+
switch (style) {
|
|
931
|
+
case "label":
|
|
932
|
+
return `.${joinedValues2}`;
|
|
933
|
+
case "matrix":
|
|
934
|
+
return `;${name}=${joinedValues2}`;
|
|
935
|
+
case "simple":
|
|
936
|
+
return joinedValues2;
|
|
937
|
+
default:
|
|
938
|
+
return `${name}=${joinedValues2}`;
|
|
939
|
+
}
|
|
1373
940
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
941
|
+
const separator = separatorArrayExplode(style);
|
|
942
|
+
const joinedValues = value.map((v) => {
|
|
943
|
+
if (style === "label" || style === "simple") {
|
|
944
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
945
|
+
}
|
|
946
|
+
return serializePrimitiveParam({
|
|
947
|
+
allowReserved,
|
|
948
|
+
name,
|
|
949
|
+
value: v
|
|
950
|
+
});
|
|
951
|
+
}).join(separator);
|
|
952
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
953
|
+
}, "serializeArrayParam");
|
|
954
|
+
var serializePrimitiveParam = /* @__PURE__ */ __name(({
|
|
955
|
+
allowReserved,
|
|
956
|
+
name,
|
|
957
|
+
value
|
|
958
|
+
}) => {
|
|
959
|
+
if (value === void 0 || value === null) {
|
|
960
|
+
return "";
|
|
1376
961
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
this.url = url;
|
|
1382
|
-
this.originalError = originalError;
|
|
1383
|
-
this.name = "NetworkError";
|
|
962
|
+
if (typeof value === "object") {
|
|
963
|
+
throw new Error(
|
|
964
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
965
|
+
);
|
|
1384
966
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
967
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
968
|
+
}, "serializePrimitiveParam");
|
|
969
|
+
var serializeObjectParam = /* @__PURE__ */ __name(({
|
|
970
|
+
allowReserved,
|
|
971
|
+
explode,
|
|
972
|
+
name,
|
|
973
|
+
style,
|
|
974
|
+
value,
|
|
975
|
+
valueOnly
|
|
976
|
+
}) => {
|
|
977
|
+
if (value instanceof Date) {
|
|
978
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
1387
979
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
if (typeof window === "undefined") return;
|
|
1393
|
-
try {
|
|
1394
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
1395
|
-
detail,
|
|
1396
|
-
bubbles: true,
|
|
1397
|
-
cancelable: false
|
|
980
|
+
if (style !== "deepObject" && !explode) {
|
|
981
|
+
let values = [];
|
|
982
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
983
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
1398
984
|
});
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
985
|
+
const joinedValues2 = values.join(",");
|
|
986
|
+
switch (style) {
|
|
987
|
+
case "form":
|
|
988
|
+
return `${name}=${joinedValues2}`;
|
|
989
|
+
case "label":
|
|
990
|
+
return `.${joinedValues2}`;
|
|
991
|
+
case "matrix":
|
|
992
|
+
return `;${name}=${joinedValues2}`;
|
|
993
|
+
default:
|
|
994
|
+
return joinedValues2;
|
|
995
|
+
}
|
|
1402
996
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1414
|
-
__name(onValidationError, "onValidationError");
|
|
1415
|
-
function formatZodError(error) {
|
|
1416
|
-
const issues = error.issues.map((issue, index) => {
|
|
1417
|
-
const path = issue.path.join(".") || "root";
|
|
1418
|
-
const parts = [`${index + 1}. ${path}: ${issue.message}`];
|
|
1419
|
-
if ("expected" in issue && issue.expected) parts.push(` Expected: ${issue.expected}`);
|
|
1420
|
-
if ("received" in issue && issue.received) parts.push(` Received: ${issue.received}`);
|
|
1421
|
-
return parts.join("\n");
|
|
1422
|
-
});
|
|
1423
|
-
return issues.join("\n");
|
|
1424
|
-
}
|
|
1425
|
-
__name(formatZodError, "formatZodError");
|
|
997
|
+
const separator = separatorObjectExplode(style);
|
|
998
|
+
const joinedValues = Object.entries(value).map(
|
|
999
|
+
([key, v]) => serializePrimitiveParam({
|
|
1000
|
+
allowReserved,
|
|
1001
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
1002
|
+
value: v
|
|
1003
|
+
})
|
|
1004
|
+
).join(separator);
|
|
1005
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
1006
|
+
}, "serializeObjectParam");
|
|
1426
1007
|
|
|
1427
|
-
// src/_api/generated/
|
|
1428
|
-
var
|
|
1429
|
-
|
|
1430
|
-
|
|
1008
|
+
// src/_api/generated/core/utils.gen.ts
|
|
1009
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
1010
|
+
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
1011
|
+
let url = _url;
|
|
1012
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
1013
|
+
if (matches) {
|
|
1014
|
+
for (const match of matches) {
|
|
1015
|
+
let explode = false;
|
|
1016
|
+
let name = match.substring(1, match.length - 1);
|
|
1017
|
+
let style = "simple";
|
|
1018
|
+
if (name.endsWith("*")) {
|
|
1019
|
+
explode = true;
|
|
1020
|
+
name = name.substring(0, name.length - 1);
|
|
1021
|
+
}
|
|
1022
|
+
if (name.startsWith(".")) {
|
|
1023
|
+
name = name.substring(1);
|
|
1024
|
+
style = "label";
|
|
1025
|
+
} else if (name.startsWith(";")) {
|
|
1026
|
+
name = name.substring(1);
|
|
1027
|
+
style = "matrix";
|
|
1028
|
+
}
|
|
1029
|
+
const value = path[name];
|
|
1030
|
+
if (value === void 0 || value === null) {
|
|
1031
|
+
continue;
|
|
1032
|
+
}
|
|
1033
|
+
if (Array.isArray(value)) {
|
|
1034
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
1035
|
+
continue;
|
|
1036
|
+
}
|
|
1037
|
+
if (typeof value === "object") {
|
|
1038
|
+
url = url.replace(
|
|
1039
|
+
match,
|
|
1040
|
+
serializeObjectParam({
|
|
1041
|
+
explode,
|
|
1042
|
+
name,
|
|
1043
|
+
style,
|
|
1044
|
+
value,
|
|
1045
|
+
valueOnly: true
|
|
1046
|
+
})
|
|
1047
|
+
);
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
if (style === "matrix") {
|
|
1051
|
+
url = url.replace(
|
|
1052
|
+
match,
|
|
1053
|
+
`;${serializePrimitiveParam({
|
|
1054
|
+
name,
|
|
1055
|
+
value
|
|
1056
|
+
})}`
|
|
1057
|
+
);
|
|
1058
|
+
continue;
|
|
1059
|
+
}
|
|
1060
|
+
const replaceValue = encodeURIComponent(
|
|
1061
|
+
style === "label" ? `.${value}` : value
|
|
1062
|
+
);
|
|
1063
|
+
url = url.replace(match, replaceValue);
|
|
1064
|
+
}
|
|
1431
1065
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1066
|
+
return url;
|
|
1067
|
+
}, "defaultPathSerializer");
|
|
1068
|
+
var getUrl = /* @__PURE__ */ __name(({
|
|
1069
|
+
baseUrl,
|
|
1070
|
+
path,
|
|
1071
|
+
query,
|
|
1072
|
+
querySerializer,
|
|
1073
|
+
url: _url
|
|
1074
|
+
}) => {
|
|
1075
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
1076
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
1077
|
+
if (path) {
|
|
1078
|
+
url = defaultPathSerializer({ path, url });
|
|
1439
1079
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1080
|
+
let search = query ? querySerializer(query) : "";
|
|
1081
|
+
if (search.startsWith("?")) {
|
|
1082
|
+
search = search.substring(1);
|
|
1443
1083
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1084
|
+
if (search) {
|
|
1085
|
+
url += `?${search}`;
|
|
1446
1086
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1087
|
+
return url;
|
|
1088
|
+
}, "getUrl");
|
|
1089
|
+
function getValidRequestBody(options) {
|
|
1090
|
+
const hasBody = options.body !== void 0;
|
|
1091
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
1092
|
+
if (isSerializedBody) {
|
|
1093
|
+
if ("serializedBody" in options) {
|
|
1094
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
1095
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
1096
|
+
}
|
|
1097
|
+
return options.body !== "" ? options.body : null;
|
|
1450
1098
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1099
|
+
if (hasBody) {
|
|
1100
|
+
return options.body;
|
|
1453
1101
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1102
|
+
return void 0;
|
|
1103
|
+
}
|
|
1104
|
+
__name(getValidRequestBody, "getValidRequestBody");
|
|
1105
|
+
|
|
1106
|
+
// src/_api/generated/core/auth.gen.ts
|
|
1107
|
+
var getAuthToken = /* @__PURE__ */ __name(async (auth2, callback) => {
|
|
1108
|
+
const token = typeof callback === "function" ? await callback(auth2) : callback;
|
|
1109
|
+
if (!token) {
|
|
1110
|
+
return;
|
|
1456
1111
|
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1112
|
+
if (auth2.scheme === "bearer") {
|
|
1113
|
+
return `Bearer ${token}`;
|
|
1459
1114
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1115
|
+
if (auth2.scheme === "basic") {
|
|
1116
|
+
return `Basic ${btoa(token)}`;
|
|
1462
1117
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1118
|
+
return token;
|
|
1119
|
+
}, "getAuthToken");
|
|
1120
|
+
|
|
1121
|
+
// src/_api/generated/client/utils.gen.ts
|
|
1122
|
+
var createQuerySerializer = /* @__PURE__ */ __name(({
|
|
1123
|
+
parameters = {},
|
|
1124
|
+
...args
|
|
1125
|
+
} = {}) => {
|
|
1126
|
+
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
1127
|
+
const search = [];
|
|
1128
|
+
if (queryParams && typeof queryParams === "object") {
|
|
1129
|
+
for (const name in queryParams) {
|
|
1130
|
+
const value = queryParams[name];
|
|
1131
|
+
if (value === void 0 || value === null) {
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
const options = parameters[name] || args;
|
|
1135
|
+
if (Array.isArray(value)) {
|
|
1136
|
+
const serializedArray = serializeArrayParam({
|
|
1137
|
+
allowReserved: options.allowReserved,
|
|
1138
|
+
explode: true,
|
|
1139
|
+
name,
|
|
1140
|
+
style: "form",
|
|
1141
|
+
value,
|
|
1142
|
+
...options.array
|
|
1143
|
+
});
|
|
1144
|
+
if (serializedArray) search.push(serializedArray);
|
|
1145
|
+
} else if (typeof value === "object") {
|
|
1146
|
+
const serializedObject = serializeObjectParam({
|
|
1147
|
+
allowReserved: options.allowReserved,
|
|
1148
|
+
explode: true,
|
|
1149
|
+
name,
|
|
1150
|
+
style: "deepObject",
|
|
1151
|
+
value,
|
|
1152
|
+
...options.object
|
|
1153
|
+
});
|
|
1154
|
+
if (serializedObject) search.push(serializedObject);
|
|
1155
|
+
} else {
|
|
1156
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
1157
|
+
allowReserved: options.allowReserved,
|
|
1158
|
+
name,
|
|
1159
|
+
value
|
|
1160
|
+
});
|
|
1161
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
return search.join("&");
|
|
1166
|
+
}, "querySerializer");
|
|
1167
|
+
return querySerializer;
|
|
1168
|
+
}, "createQuerySerializer");
|
|
1169
|
+
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
1170
|
+
if (!contentType) {
|
|
1171
|
+
return "stream";
|
|
1465
1172
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
return
|
|
1173
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
1174
|
+
if (!cleanContent) {
|
|
1175
|
+
return;
|
|
1469
1176
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1177
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
1178
|
+
return "json";
|
|
1472
1179
|
}
|
|
1473
|
-
|
|
1474
|
-
return
|
|
1180
|
+
if (cleanContent === "multipart/form-data") {
|
|
1181
|
+
return "formData";
|
|
1475
1182
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1183
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
1184
|
+
return "blob";
|
|
1478
1185
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
// src/_api/generated/_cfg_totp/api.ts
|
|
1482
|
-
var API3 = class {
|
|
1483
|
-
static {
|
|
1484
|
-
__name(this, "API");
|
|
1186
|
+
if (cleanContent.startsWith("text/")) {
|
|
1187
|
+
return "text";
|
|
1485
1188
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
1492
|
-
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
1189
|
+
return;
|
|
1190
|
+
}, "getParseAs");
|
|
1191
|
+
var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
1192
|
+
if (!name) {
|
|
1193
|
+
return false;
|
|
1493
1194
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
return auth.getBaseUrl();
|
|
1195
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
1196
|
+
return true;
|
|
1497
1197
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1198
|
+
return false;
|
|
1199
|
+
}, "checkForExistence");
|
|
1200
|
+
var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
1201
|
+
security,
|
|
1202
|
+
...options
|
|
1203
|
+
}) => {
|
|
1204
|
+
for (const auth2 of security) {
|
|
1205
|
+
if (checkForExistence(options, auth2.name)) {
|
|
1206
|
+
continue;
|
|
1207
|
+
}
|
|
1208
|
+
const token = await getAuthToken(auth2, options.auth);
|
|
1209
|
+
if (!token) {
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1212
|
+
const name = auth2.name ?? "Authorization";
|
|
1213
|
+
switch (auth2.in) {
|
|
1214
|
+
case "query":
|
|
1215
|
+
if (!options.query) {
|
|
1216
|
+
options.query = {};
|
|
1217
|
+
}
|
|
1218
|
+
options.query[name] = token;
|
|
1219
|
+
break;
|
|
1220
|
+
case "cookie":
|
|
1221
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
1222
|
+
break;
|
|
1223
|
+
case "header":
|
|
1224
|
+
default:
|
|
1225
|
+
options.headers.set(name, token);
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1500
1228
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1229
|
+
}, "setAuthParams");
|
|
1230
|
+
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
1231
|
+
baseUrl: options.baseUrl,
|
|
1232
|
+
path: options.path,
|
|
1233
|
+
query: options.query,
|
|
1234
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
1235
|
+
url: options.url
|
|
1236
|
+
}), "buildUrl");
|
|
1237
|
+
var mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
1238
|
+
const config = { ...a, ...b };
|
|
1239
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
1240
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
1504
1241
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1242
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
1243
|
+
return config;
|
|
1244
|
+
}, "mergeConfigs");
|
|
1245
|
+
var headersEntries = /* @__PURE__ */ __name((headers) => {
|
|
1246
|
+
const entries = [];
|
|
1247
|
+
headers.forEach((value, key) => {
|
|
1248
|
+
entries.push([key, value]);
|
|
1249
|
+
});
|
|
1250
|
+
return entries;
|
|
1251
|
+
}, "headersEntries");
|
|
1252
|
+
var mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
1253
|
+
const mergedHeaders = new Headers();
|
|
1254
|
+
for (const header of headers) {
|
|
1255
|
+
if (!header) {
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1258
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
1259
|
+
for (const [key, value] of iterator) {
|
|
1260
|
+
if (value === null) {
|
|
1261
|
+
mergedHeaders.delete(key);
|
|
1262
|
+
} else if (Array.isArray(value)) {
|
|
1263
|
+
for (const v of value) {
|
|
1264
|
+
mergedHeaders.append(key, v);
|
|
1265
|
+
}
|
|
1266
|
+
} else if (value !== void 0) {
|
|
1267
|
+
mergedHeaders.set(
|
|
1268
|
+
key,
|
|
1269
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1507
1273
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1274
|
+
return mergedHeaders;
|
|
1275
|
+
}, "mergeHeaders");
|
|
1276
|
+
var Interceptors = class {
|
|
1277
|
+
static {
|
|
1278
|
+
__name(this, "Interceptors");
|
|
1510
1279
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1280
|
+
fns = [];
|
|
1281
|
+
clear() {
|
|
1282
|
+
this.fns = [];
|
|
1513
1283
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1284
|
+
eject(id) {
|
|
1285
|
+
const index = this.getInterceptorIndex(id);
|
|
1286
|
+
if (this.fns[index]) {
|
|
1287
|
+
this.fns[index] = null;
|
|
1288
|
+
}
|
|
1516
1289
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1290
|
+
exists(id) {
|
|
1291
|
+
const index = this.getInterceptorIndex(id);
|
|
1292
|
+
return Boolean(this.fns[index]);
|
|
1519
1293
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1294
|
+
getInterceptorIndex(id) {
|
|
1295
|
+
if (typeof id === "number") {
|
|
1296
|
+
return this.fns[id] ? id : -1;
|
|
1297
|
+
}
|
|
1298
|
+
return this.fns.indexOf(id);
|
|
1523
1299
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1300
|
+
update(id, fn) {
|
|
1301
|
+
const index = this.getInterceptorIndex(id);
|
|
1302
|
+
if (this.fns[index]) {
|
|
1303
|
+
this.fns[index] = fn;
|
|
1304
|
+
return id;
|
|
1305
|
+
}
|
|
1306
|
+
return false;
|
|
1526
1307
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1308
|
+
use(fn) {
|
|
1309
|
+
this.fns.push(fn);
|
|
1310
|
+
return this.fns.length - 1;
|
|
1529
1311
|
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1312
|
+
};
|
|
1313
|
+
var createInterceptors = /* @__PURE__ */ __name(() => ({
|
|
1314
|
+
error: new Interceptors(),
|
|
1315
|
+
request: new Interceptors(),
|
|
1316
|
+
response: new Interceptors()
|
|
1317
|
+
}), "createInterceptors");
|
|
1318
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
1319
|
+
allowReserved: false,
|
|
1320
|
+
array: {
|
|
1321
|
+
explode: true,
|
|
1322
|
+
style: "form"
|
|
1323
|
+
},
|
|
1324
|
+
object: {
|
|
1325
|
+
explode: true,
|
|
1326
|
+
style: "deepObject"
|
|
1532
1327
|
}
|
|
1328
|
+
});
|
|
1329
|
+
var defaultHeaders = {
|
|
1330
|
+
"Content-Type": "application/json"
|
|
1533
1331
|
};
|
|
1332
|
+
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
1333
|
+
...jsonBodySerializer,
|
|
1334
|
+
headers: defaultHeaders,
|
|
1335
|
+
parseAs: "auto",
|
|
1336
|
+
querySerializer: defaultQuerySerializer,
|
|
1337
|
+
...override
|
|
1338
|
+
}), "createConfig");
|
|
1534
1339
|
|
|
1535
|
-
// src/_api/generated/
|
|
1536
|
-
var
|
|
1537
|
-
|
|
1538
|
-
|
|
1340
|
+
// src/_api/generated/client/client.gen.ts
|
|
1341
|
+
var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
1342
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
1343
|
+
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
1344
|
+
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
1345
|
+
_config = mergeConfigs(_config, config2);
|
|
1346
|
+
return getConfig();
|
|
1347
|
+
}, "setConfig");
|
|
1348
|
+
const interceptors = createInterceptors();
|
|
1349
|
+
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
1350
|
+
const opts = {
|
|
1351
|
+
..._config,
|
|
1352
|
+
...options,
|
|
1353
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
1354
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
1355
|
+
serializedBody: void 0
|
|
1356
|
+
};
|
|
1357
|
+
if (opts.security) {
|
|
1358
|
+
await setAuthParams({
|
|
1359
|
+
...opts,
|
|
1360
|
+
security: opts.security
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
if (opts.requestValidator) {
|
|
1364
|
+
await opts.requestValidator(opts);
|
|
1365
|
+
}
|
|
1366
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
1367
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
1368
|
+
}
|
|
1369
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
1370
|
+
opts.headers.delete("Content-Type");
|
|
1371
|
+
}
|
|
1372
|
+
const resolvedOpts = opts;
|
|
1373
|
+
const url = buildUrl(resolvedOpts);
|
|
1374
|
+
return { opts: resolvedOpts, url };
|
|
1375
|
+
}, "beforeRequest");
|
|
1376
|
+
const request = /* @__PURE__ */ __name(async (options) => {
|
|
1377
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
1378
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
1379
|
+
let request2;
|
|
1380
|
+
let response;
|
|
1381
|
+
try {
|
|
1382
|
+
const { opts, url } = await beforeRequest(options);
|
|
1383
|
+
const requestInit = {
|
|
1384
|
+
redirect: "follow",
|
|
1385
|
+
...opts,
|
|
1386
|
+
body: getValidRequestBody(opts)
|
|
1387
|
+
};
|
|
1388
|
+
request2 = new Request(url, requestInit);
|
|
1389
|
+
for (const fn of interceptors.request.fns) {
|
|
1390
|
+
if (fn) {
|
|
1391
|
+
request2 = await fn(request2, opts);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
const _fetch = opts.fetch;
|
|
1395
|
+
response = await _fetch(request2);
|
|
1396
|
+
for (const fn of interceptors.response.fns) {
|
|
1397
|
+
if (fn) {
|
|
1398
|
+
response = await fn(response, request2, opts);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
const result = {
|
|
1402
|
+
request: request2,
|
|
1403
|
+
response
|
|
1404
|
+
};
|
|
1405
|
+
if (response.ok) {
|
|
1406
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
1407
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
1408
|
+
let emptyData;
|
|
1409
|
+
switch (parseAs) {
|
|
1410
|
+
case "arrayBuffer":
|
|
1411
|
+
case "blob":
|
|
1412
|
+
case "text":
|
|
1413
|
+
emptyData = await response[parseAs]();
|
|
1414
|
+
break;
|
|
1415
|
+
case "formData":
|
|
1416
|
+
emptyData = new FormData();
|
|
1417
|
+
break;
|
|
1418
|
+
case "stream":
|
|
1419
|
+
emptyData = response.body;
|
|
1420
|
+
break;
|
|
1421
|
+
case "json":
|
|
1422
|
+
default:
|
|
1423
|
+
emptyData = {};
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
1426
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
1427
|
+
data: emptyData,
|
|
1428
|
+
...result
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
let data;
|
|
1432
|
+
switch (parseAs) {
|
|
1433
|
+
case "arrayBuffer":
|
|
1434
|
+
case "blob":
|
|
1435
|
+
case "formData":
|
|
1436
|
+
case "text":
|
|
1437
|
+
data = await response[parseAs]();
|
|
1438
|
+
break;
|
|
1439
|
+
case "json": {
|
|
1440
|
+
const text = await response.text();
|
|
1441
|
+
data = text ? JSON.parse(text) : {};
|
|
1442
|
+
break;
|
|
1443
|
+
}
|
|
1444
|
+
case "stream":
|
|
1445
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
1446
|
+
data: response.body,
|
|
1447
|
+
...result
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
if (parseAs === "json") {
|
|
1451
|
+
if (opts.responseValidator) {
|
|
1452
|
+
await opts.responseValidator(data);
|
|
1453
|
+
}
|
|
1454
|
+
if (opts.responseTransformer) {
|
|
1455
|
+
data = await opts.responseTransformer(data);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return opts.responseStyle === "data" ? data : {
|
|
1459
|
+
data,
|
|
1460
|
+
...result
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
const textError = await response.text();
|
|
1464
|
+
let jsonError;
|
|
1465
|
+
try {
|
|
1466
|
+
jsonError = JSON.parse(textError);
|
|
1467
|
+
} catch {
|
|
1468
|
+
}
|
|
1469
|
+
throw jsonError ?? textError;
|
|
1470
|
+
} catch (error) {
|
|
1471
|
+
let finalError = error;
|
|
1472
|
+
for (const fn of interceptors.error.fns) {
|
|
1473
|
+
if (fn) {
|
|
1474
|
+
finalError = await fn(finalError, response, request2, options);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
finalError = finalError || {};
|
|
1478
|
+
if (throwOnError) {
|
|
1479
|
+
throw finalError;
|
|
1480
|
+
}
|
|
1481
|
+
return responseStyle === "data" ? void 0 : {
|
|
1482
|
+
error: finalError,
|
|
1483
|
+
request: request2,
|
|
1484
|
+
response
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
}, "request");
|
|
1488
|
+
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
1489
|
+
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
1490
|
+
const { opts, url } = await beforeRequest(options);
|
|
1491
|
+
return createSseClient({
|
|
1492
|
+
...opts,
|
|
1493
|
+
body: opts.body,
|
|
1494
|
+
method,
|
|
1495
|
+
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
1496
|
+
let request2 = new Request(url2, init);
|
|
1497
|
+
for (const fn of interceptors.request.fns) {
|
|
1498
|
+
if (fn) {
|
|
1499
|
+
request2 = await fn(request2, opts);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
return request2;
|
|
1503
|
+
}, "onRequest"),
|
|
1504
|
+
serializedBody: getValidRequestBody(opts),
|
|
1505
|
+
url
|
|
1506
|
+
});
|
|
1507
|
+
}, "makeSseFn");
|
|
1508
|
+
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl({ ..._config, ...options }), "_buildUrl");
|
|
1509
|
+
return {
|
|
1510
|
+
buildUrl: _buildUrl,
|
|
1511
|
+
connect: makeMethodFn("CONNECT"),
|
|
1512
|
+
delete: makeMethodFn("DELETE"),
|
|
1513
|
+
get: makeMethodFn("GET"),
|
|
1514
|
+
getConfig,
|
|
1515
|
+
head: makeMethodFn("HEAD"),
|
|
1516
|
+
interceptors,
|
|
1517
|
+
options: makeMethodFn("OPTIONS"),
|
|
1518
|
+
patch: makeMethodFn("PATCH"),
|
|
1519
|
+
post: makeMethodFn("POST"),
|
|
1520
|
+
put: makeMethodFn("PUT"),
|
|
1521
|
+
request,
|
|
1522
|
+
setConfig,
|
|
1523
|
+
sse: {
|
|
1524
|
+
connect: makeSseFn("CONNECT"),
|
|
1525
|
+
delete: makeSseFn("DELETE"),
|
|
1526
|
+
get: makeSseFn("GET"),
|
|
1527
|
+
head: makeSseFn("HEAD"),
|
|
1528
|
+
options: makeSseFn("OPTIONS"),
|
|
1529
|
+
patch: makeSseFn("PATCH"),
|
|
1530
|
+
post: makeSseFn("POST"),
|
|
1531
|
+
put: makeSseFn("PUT"),
|
|
1532
|
+
trace: makeSseFn("TRACE")
|
|
1533
|
+
},
|
|
1534
|
+
trace: makeMethodFn("TRACE")
|
|
1535
|
+
};
|
|
1536
|
+
}, "createClient");
|
|
1537
|
+
|
|
1538
|
+
// src/_api/generated/client.gen.ts
|
|
1539
|
+
var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
1540
|
+
installAuthOnClient(client);
|
|
1539
1541
|
|
|
1540
1542
|
// src/_api/generated/sdk.gen.ts
|
|
1541
1543
|
var Cfg = class {
|