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