@djangocfg/api 2.1.455 → 2.1.456
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.cjs +2654 -2920
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +18 -82
- package/dist/auth.d.ts +18 -82
- package/dist/auth.mjs +385 -2861
- package/dist/auth.mjs.map +1 -1
- package/dist/chunk-2G67QRNU.mjs +2096 -0
- package/dist/chunk-2G67QRNU.mjs.map +1 -0
- package/dist/chunk-32SRQGAC.mjs +2109 -0
- package/dist/chunk-32SRQGAC.mjs.map +1 -0
- package/dist/chunk-4BPRCONN.mjs +2098 -0
- package/dist/chunk-4BPRCONN.mjs.map +1 -0
- package/dist/chunk-5UZ2Z323.mjs +2021 -0
- package/dist/chunk-5UZ2Z323.mjs.map +1 -0
- package/dist/chunk-7KFTJXNM.mjs +2097 -0
- package/dist/chunk-7KFTJXNM.mjs.map +1 -0
- package/dist/chunk-BK4K5CVT.mjs +2019 -0
- package/dist/chunk-BK4K5CVT.mjs.map +1 -0
- package/dist/chunk-JLPJZ6WB.mjs +2020 -0
- package/dist/chunk-JLPJZ6WB.mjs.map +1 -0
- package/dist/chunk-TVU6PYJH.mjs +2032 -0
- package/dist/chunk-TVU6PYJH.mjs.map +1 -0
- package/dist/clients.cjs +2210 -1847
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +23 -0
- package/dist/clients.d.ts +23 -0
- package/dist/clients.mjs +14 -1845
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +1776 -962
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +4 -1375
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +2245 -1877
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -4
- package/dist/index.d.ts +81 -4
- package/dist/index.mjs +20 -1860
- package/dist/index.mjs.map +1 -1
- package/dist/sdk.gen-2SQOPTWJ.mjs +26 -0
- package/dist/sdk.gen-2SQOPTWJ.mjs.map +1 -0
- package/dist/sdk.gen-HSGK4C5S.mjs +26 -0
- package/dist/sdk.gen-HSGK4C5S.mjs.map +1 -0
- package/dist/sdk.gen-NUK2VGHO.mjs +25 -0
- package/dist/sdk.gen-NUK2VGHO.mjs.map +1 -0
- package/dist/sdk.gen-O4KAQUZB.mjs +26 -0
- package/dist/sdk.gen-O4KAQUZB.mjs.map +1 -0
- package/dist/sdk.gen-PPAVSBNT.mjs +26 -0
- package/dist/sdk.gen-PPAVSBNT.mjs.map +1 -0
- package/dist/sdk.gen-XLHLOCJ2.mjs +25 -0
- package/dist/sdk.gen-XLHLOCJ2.mjs.map +1 -0
- package/dist/sdk.gen-ZOE6NQAL.mjs +26 -0
- package/dist/sdk.gen-ZOE6NQAL.mjs.map +1 -0
- package/dist/sdk.gen-ZT7LGJVO.mjs +26 -0
- package/dist/sdk.gen-ZT7LGJVO.mjs.map +1 -0
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +1 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenBlacklistCreate.ts +28 -0
- package/src/_api/generated/_cfg_accounts/openapi.json +99 -0
- package/src/_api/generated/_cfg_accounts/schemas/TokenBlacklistRequest.ts +11 -0
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +1 -0
- package/src/_api/generated/_cfg_centrifugo/openapi.json +9 -0
- package/src/_api/generated/_cfg_totp/openapi.json +33 -0
- package/src/_api/generated/helpers/auth.ts +276 -31
- package/src/_api/generated/openapi.json +129 -0
- package/src/_api/generated/sdk.gen.ts +94 -16
- package/src/_api/generated/types.gen.ts +18 -0
- package/src/auth/__tests__/guard.test.ts +0 -31
- package/src/auth/constants.ts +6 -0
- package/src/auth/context/AccountsContext.tsx +14 -24
- package/src/auth/context/AuthContext.tsx +226 -609
- package/src/auth/hooks/index.ts +3 -4
- package/src/auth/hooks/useGithubAuth.ts +3 -3
- package/src/auth/hooks/useSession.ts +22 -0
- package/src/auth/hooks/useTwoFactor.ts +4 -4
- package/src/auth/middlewares/index.ts +5 -6
- package/src/auth/utils/guard.ts +0 -22
- package/src/auth/utils/index.ts +0 -2
- package/src/_api/generated/_cfg_accounts/events.ts +0 -198
- package/src/_api/generated/_cfg_centrifugo/events.ts +0 -198
- package/src/_api/generated/_cfg_totp/events.ts +0 -198
- package/src/auth/__tests__/jwt.test.ts +0 -119
- package/src/auth/__tests__/sessionBootstrap.test.ts +0 -111
- package/src/auth/__tests__/useTokenRefresh.dom.test.tsx +0 -167
- package/src/auth/hooks/useAuthGuard.ts +0 -35
- package/src/auth/hooks/useTokenRefresh.ts +0 -131
- package/src/auth/refreshHandler.ts +0 -79
- package/src/auth/utils/jwt.ts +0 -66
package/dist/hooks.cjs
CHANGED
|
@@ -6,6 +6,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
9
12
|
var __export = (target, all) => {
|
|
10
13
|
for (var name in all)
|
|
11
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -28,32 +31,60 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
31
|
));
|
|
29
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
33
|
|
|
31
|
-
// src/hooks/index.ts
|
|
32
|
-
var hooks_exports = {};
|
|
33
|
-
__export(hooks_exports, {
|
|
34
|
-
useApiKey: () => useApiKey
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(hooks_exports);
|
|
37
|
-
|
|
38
|
-
// src/hooks/useApiKey.ts
|
|
39
|
-
var import_react = require("react");
|
|
40
|
-
|
|
41
|
-
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts
|
|
42
|
-
var import_mutation = __toESM(require("swr/mutation"), 1);
|
|
43
|
-
|
|
44
34
|
// src/_api/generated/core/bodySerializer.gen.ts
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
var serializeFormDataPair, formDataBodySerializer, jsonBodySerializer;
|
|
36
|
+
var init_bodySerializer_gen = __esm({
|
|
37
|
+
"src/_api/generated/core/bodySerializer.gen.ts"() {
|
|
38
|
+
serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
|
|
39
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
40
|
+
data.append(key, value);
|
|
41
|
+
} else if (value instanceof Date) {
|
|
42
|
+
data.append(key, value.toISOString());
|
|
43
|
+
} else {
|
|
44
|
+
data.append(key, JSON.stringify(value));
|
|
45
|
+
}
|
|
46
|
+
}, "serializeFormDataPair");
|
|
47
|
+
formDataBodySerializer = {
|
|
48
|
+
bodySerializer: /* @__PURE__ */ __name((body) => {
|
|
49
|
+
const data = new FormData();
|
|
50
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
51
|
+
if (value === void 0 || value === null) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (Array.isArray(value)) {
|
|
55
|
+
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
56
|
+
} else {
|
|
57
|
+
serializeFormDataPair(data, key, value);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return data;
|
|
61
|
+
}, "bodySerializer")
|
|
62
|
+
};
|
|
63
|
+
jsonBodySerializer = {
|
|
64
|
+
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
48
68
|
|
|
49
69
|
// src/_api/generated/core/params.gen.ts
|
|
50
|
-
var extraPrefixesMap
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
70
|
+
var extraPrefixesMap, extraPrefixes;
|
|
71
|
+
var init_params_gen = __esm({
|
|
72
|
+
"src/_api/generated/core/params.gen.ts"() {
|
|
73
|
+
extraPrefixesMap = {
|
|
74
|
+
$body_: "body",
|
|
75
|
+
$headers_: "headers",
|
|
76
|
+
$path_: "path",
|
|
77
|
+
$query_: "query"
|
|
78
|
+
};
|
|
79
|
+
extraPrefixes = Object.entries(extraPrefixesMap);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// src/_api/generated/core/queryKeySerializer.gen.ts
|
|
84
|
+
var init_queryKeySerializer_gen = __esm({
|
|
85
|
+
"src/_api/generated/core/queryKeySerializer.gen.ts"() {
|
|
86
|
+
}
|
|
87
|
+
});
|
|
57
88
|
|
|
58
89
|
// src/_api/generated/core/serverSentEvents.gen.ts
|
|
59
90
|
function createSseClient({
|
|
@@ -181,213 +212,142 @@ function createSseClient({
|
|
|
181
212
|
const stream = createStream();
|
|
182
213
|
return { stream };
|
|
183
214
|
}
|
|
184
|
-
|
|
215
|
+
var init_serverSentEvents_gen = __esm({
|
|
216
|
+
"src/_api/generated/core/serverSentEvents.gen.ts"() {
|
|
217
|
+
__name(createSseClient, "createSseClient");
|
|
218
|
+
}
|
|
219
|
+
});
|
|
185
220
|
|
|
186
221
|
// src/_api/generated/core/pathSerializer.gen.ts
|
|
187
|
-
var separatorArrayExplode
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
style,
|
|
228
|
-
value
|
|
229
|
-
}) => {
|
|
230
|
-
if (!explode) {
|
|
231
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
232
|
-
switch (style) {
|
|
233
|
-
case "label":
|
|
234
|
-
return `.${joinedValues2}`;
|
|
235
|
-
case "matrix":
|
|
236
|
-
return `;${name}=${joinedValues2}`;
|
|
237
|
-
case "simple":
|
|
238
|
-
return joinedValues2;
|
|
239
|
-
default:
|
|
240
|
-
return `${name}=${joinedValues2}`;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
const separator = separatorArrayExplode(style);
|
|
244
|
-
const joinedValues = value.map((v) => {
|
|
245
|
-
if (style === "label" || style === "simple") {
|
|
246
|
-
return allowReserved ? v : encodeURIComponent(v);
|
|
247
|
-
}
|
|
248
|
-
return serializePrimitiveParam({
|
|
222
|
+
var separatorArrayExplode, separatorArrayNoExplode, separatorObjectExplode, serializeArrayParam, serializePrimitiveParam, serializeObjectParam;
|
|
223
|
+
var init_pathSerializer_gen = __esm({
|
|
224
|
+
"src/_api/generated/core/pathSerializer.gen.ts"() {
|
|
225
|
+
separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
226
|
+
switch (style) {
|
|
227
|
+
case "label":
|
|
228
|
+
return ".";
|
|
229
|
+
case "matrix":
|
|
230
|
+
return ";";
|
|
231
|
+
case "simple":
|
|
232
|
+
return ",";
|
|
233
|
+
default:
|
|
234
|
+
return "&";
|
|
235
|
+
}
|
|
236
|
+
}, "separatorArrayExplode");
|
|
237
|
+
separatorArrayNoExplode = /* @__PURE__ */ __name((style) => {
|
|
238
|
+
switch (style) {
|
|
239
|
+
case "form":
|
|
240
|
+
return ",";
|
|
241
|
+
case "pipeDelimited":
|
|
242
|
+
return "|";
|
|
243
|
+
case "spaceDelimited":
|
|
244
|
+
return "%20";
|
|
245
|
+
default:
|
|
246
|
+
return ",";
|
|
247
|
+
}
|
|
248
|
+
}, "separatorArrayNoExplode");
|
|
249
|
+
separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
250
|
+
switch (style) {
|
|
251
|
+
case "label":
|
|
252
|
+
return ".";
|
|
253
|
+
case "matrix":
|
|
254
|
+
return ";";
|
|
255
|
+
case "simple":
|
|
256
|
+
return ",";
|
|
257
|
+
default:
|
|
258
|
+
return "&";
|
|
259
|
+
}
|
|
260
|
+
}, "separatorObjectExplode");
|
|
261
|
+
serializeArrayParam = /* @__PURE__ */ __name(({
|
|
249
262
|
allowReserved,
|
|
263
|
+
explode,
|
|
250
264
|
name,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
if (style !== "deepObject" && !explode) {
|
|
283
|
-
let values = [];
|
|
284
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
285
|
-
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
286
|
-
});
|
|
287
|
-
const joinedValues2 = values.join(",");
|
|
288
|
-
switch (style) {
|
|
289
|
-
case "form":
|
|
290
|
-
return `${name}=${joinedValues2}`;
|
|
291
|
-
case "label":
|
|
292
|
-
return `.${joinedValues2}`;
|
|
293
|
-
case "matrix":
|
|
294
|
-
return `;${name}=${joinedValues2}`;
|
|
295
|
-
default:
|
|
296
|
-
return joinedValues2;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
const separator = separatorObjectExplode(style);
|
|
300
|
-
const joinedValues = Object.entries(value).map(
|
|
301
|
-
([key, v]) => serializePrimitiveParam({
|
|
265
|
+
style,
|
|
266
|
+
value
|
|
267
|
+
}) => {
|
|
268
|
+
if (!explode) {
|
|
269
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
270
|
+
switch (style) {
|
|
271
|
+
case "label":
|
|
272
|
+
return `.${joinedValues2}`;
|
|
273
|
+
case "matrix":
|
|
274
|
+
return `;${name}=${joinedValues2}`;
|
|
275
|
+
case "simple":
|
|
276
|
+
return joinedValues2;
|
|
277
|
+
default:
|
|
278
|
+
return `${name}=${joinedValues2}`;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const separator = separatorArrayExplode(style);
|
|
282
|
+
const joinedValues = value.map((v) => {
|
|
283
|
+
if (style === "label" || style === "simple") {
|
|
284
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
285
|
+
}
|
|
286
|
+
return serializePrimitiveParam({
|
|
287
|
+
allowReserved,
|
|
288
|
+
name,
|
|
289
|
+
value: v
|
|
290
|
+
});
|
|
291
|
+
}).join(separator);
|
|
292
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
293
|
+
}, "serializeArrayParam");
|
|
294
|
+
serializePrimitiveParam = /* @__PURE__ */ __name(({
|
|
302
295
|
allowReserved,
|
|
303
|
-
name
|
|
304
|
-
value
|
|
305
|
-
})
|
|
306
|
-
).join(separator);
|
|
307
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
308
|
-
}, "serializeObjectParam");
|
|
309
|
-
|
|
310
|
-
// src/_api/generated/core/utils.gen.ts
|
|
311
|
-
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
312
|
-
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
313
|
-
let url = _url;
|
|
314
|
-
const matches = _url.match(PATH_PARAM_RE);
|
|
315
|
-
if (matches) {
|
|
316
|
-
for (const match of matches) {
|
|
317
|
-
let explode = false;
|
|
318
|
-
let name = match.substring(1, match.length - 1);
|
|
319
|
-
let style = "simple";
|
|
320
|
-
if (name.endsWith("*")) {
|
|
321
|
-
explode = true;
|
|
322
|
-
name = name.substring(0, name.length - 1);
|
|
323
|
-
}
|
|
324
|
-
if (name.startsWith(".")) {
|
|
325
|
-
name = name.substring(1);
|
|
326
|
-
style = "label";
|
|
327
|
-
} else if (name.startsWith(";")) {
|
|
328
|
-
name = name.substring(1);
|
|
329
|
-
style = "matrix";
|
|
330
|
-
}
|
|
331
|
-
const value = path[name];
|
|
296
|
+
name,
|
|
297
|
+
value
|
|
298
|
+
}) => {
|
|
332
299
|
if (value === void 0 || value === null) {
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
if (Array.isArray(value)) {
|
|
336
|
-
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
337
|
-
continue;
|
|
300
|
+
return "";
|
|
338
301
|
}
|
|
339
302
|
if (typeof value === "object") {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
serializeObjectParam({
|
|
343
|
-
explode,
|
|
344
|
-
name,
|
|
345
|
-
style,
|
|
346
|
-
value,
|
|
347
|
-
valueOnly: true
|
|
348
|
-
})
|
|
303
|
+
throw new Error(
|
|
304
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
349
305
|
);
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
352
|
-
if (style === "matrix") {
|
|
353
|
-
url = url.replace(
|
|
354
|
-
match,
|
|
355
|
-
`;${serializePrimitiveParam({
|
|
356
|
-
name,
|
|
357
|
-
value
|
|
358
|
-
})}`
|
|
359
|
-
);
|
|
360
|
-
continue;
|
|
361
306
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
307
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
308
|
+
}, "serializePrimitiveParam");
|
|
309
|
+
serializeObjectParam = /* @__PURE__ */ __name(({
|
|
310
|
+
allowReserved,
|
|
311
|
+
explode,
|
|
312
|
+
name,
|
|
313
|
+
style,
|
|
314
|
+
value,
|
|
315
|
+
valueOnly
|
|
316
|
+
}) => {
|
|
317
|
+
if (value instanceof Date) {
|
|
318
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
319
|
+
}
|
|
320
|
+
if (style !== "deepObject" && !explode) {
|
|
321
|
+
let values = [];
|
|
322
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
323
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
324
|
+
});
|
|
325
|
+
const joinedValues2 = values.join(",");
|
|
326
|
+
switch (style) {
|
|
327
|
+
case "form":
|
|
328
|
+
return `${name}=${joinedValues2}`;
|
|
329
|
+
case "label":
|
|
330
|
+
return `.${joinedValues2}`;
|
|
331
|
+
case "matrix":
|
|
332
|
+
return `;${name}=${joinedValues2}`;
|
|
333
|
+
default:
|
|
334
|
+
return joinedValues2;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
const separator = separatorObjectExplode(style);
|
|
338
|
+
const joinedValues = Object.entries(value).map(
|
|
339
|
+
([key, v]) => serializePrimitiveParam({
|
|
340
|
+
allowReserved,
|
|
341
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
342
|
+
value: v
|
|
343
|
+
})
|
|
344
|
+
).join(separator);
|
|
345
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
346
|
+
}, "serializeObjectParam");
|
|
388
347
|
}
|
|
389
|
-
|
|
390
|
-
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// src/_api/generated/core/utils.gen.ts
|
|
391
351
|
function getValidRequestBody(options) {
|
|
392
352
|
const hasBody = options.body !== void 0;
|
|
393
353
|
const isSerializedBody = hasBody && options.bodySerializer;
|
|
@@ -403,102 +363,115 @@ function getValidRequestBody(options) {
|
|
|
403
363
|
}
|
|
404
364
|
return void 0;
|
|
405
365
|
}
|
|
406
|
-
|
|
366
|
+
var PATH_PARAM_RE, defaultPathSerializer, getUrl;
|
|
367
|
+
var init_utils_gen = __esm({
|
|
368
|
+
"src/_api/generated/core/utils.gen.ts"() {
|
|
369
|
+
init_pathSerializer_gen();
|
|
370
|
+
PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
371
|
+
defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
372
|
+
let url = _url;
|
|
373
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
374
|
+
if (matches) {
|
|
375
|
+
for (const match of matches) {
|
|
376
|
+
let explode = false;
|
|
377
|
+
let name = match.substring(1, match.length - 1);
|
|
378
|
+
let style = "simple";
|
|
379
|
+
if (name.endsWith("*")) {
|
|
380
|
+
explode = true;
|
|
381
|
+
name = name.substring(0, name.length - 1);
|
|
382
|
+
}
|
|
383
|
+
if (name.startsWith(".")) {
|
|
384
|
+
name = name.substring(1);
|
|
385
|
+
style = "label";
|
|
386
|
+
} else if (name.startsWith(";")) {
|
|
387
|
+
name = name.substring(1);
|
|
388
|
+
style = "matrix";
|
|
389
|
+
}
|
|
390
|
+
const value = path[name];
|
|
391
|
+
if (value === void 0 || value === null) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (Array.isArray(value)) {
|
|
395
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
if (typeof value === "object") {
|
|
399
|
+
url = url.replace(
|
|
400
|
+
match,
|
|
401
|
+
serializeObjectParam({
|
|
402
|
+
explode,
|
|
403
|
+
name,
|
|
404
|
+
style,
|
|
405
|
+
value,
|
|
406
|
+
valueOnly: true
|
|
407
|
+
})
|
|
408
|
+
);
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
if (style === "matrix") {
|
|
412
|
+
url = url.replace(
|
|
413
|
+
match,
|
|
414
|
+
`;${serializePrimitiveParam({
|
|
415
|
+
name,
|
|
416
|
+
value
|
|
417
|
+
})}`
|
|
418
|
+
);
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
const replaceValue = encodeURIComponent(
|
|
422
|
+
style === "label" ? `.${value}` : value
|
|
423
|
+
);
|
|
424
|
+
url = url.replace(match, replaceValue);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return url;
|
|
428
|
+
}, "defaultPathSerializer");
|
|
429
|
+
getUrl = /* @__PURE__ */ __name(({
|
|
430
|
+
baseUrl,
|
|
431
|
+
path,
|
|
432
|
+
query,
|
|
433
|
+
querySerializer,
|
|
434
|
+
url: _url
|
|
435
|
+
}) => {
|
|
436
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
437
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
438
|
+
if (path) {
|
|
439
|
+
url = defaultPathSerializer({ path, url });
|
|
440
|
+
}
|
|
441
|
+
let search = query ? querySerializer(query) : "";
|
|
442
|
+
if (search.startsWith("?")) {
|
|
443
|
+
search = search.substring(1);
|
|
444
|
+
}
|
|
445
|
+
if (search) {
|
|
446
|
+
url += `?${search}`;
|
|
447
|
+
}
|
|
448
|
+
return url;
|
|
449
|
+
}, "getUrl");
|
|
450
|
+
__name(getValidRequestBody, "getValidRequestBody");
|
|
451
|
+
}
|
|
452
|
+
});
|
|
407
453
|
|
|
408
454
|
// src/_api/generated/core/auth.gen.ts
|
|
409
|
-
var getAuthToken
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
455
|
+
var getAuthToken;
|
|
456
|
+
var init_auth_gen = __esm({
|
|
457
|
+
"src/_api/generated/core/auth.gen.ts"() {
|
|
458
|
+
getAuthToken = /* @__PURE__ */ __name(async (auth2, callback) => {
|
|
459
|
+
const token = typeof callback === "function" ? await callback(auth2) : callback;
|
|
460
|
+
if (!token) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (auth2.scheme === "bearer") {
|
|
464
|
+
return `Bearer ${token}`;
|
|
465
|
+
}
|
|
466
|
+
if (auth2.scheme === "basic") {
|
|
467
|
+
return `Basic ${btoa(token)}`;
|
|
468
|
+
}
|
|
469
|
+
return token;
|
|
470
|
+
}, "getAuthToken");
|
|
419
471
|
}
|
|
420
|
-
|
|
421
|
-
}, "getAuthToken");
|
|
472
|
+
});
|
|
422
473
|
|
|
423
474
|
// src/_api/generated/client/utils.gen.ts
|
|
424
|
-
var createQuerySerializer = /* @__PURE__ */ __name(({
|
|
425
|
-
parameters = {},
|
|
426
|
-
...args
|
|
427
|
-
} = {}) => {
|
|
428
|
-
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
429
|
-
const search = [];
|
|
430
|
-
if (queryParams && typeof queryParams === "object") {
|
|
431
|
-
for (const name in queryParams) {
|
|
432
|
-
const value = queryParams[name];
|
|
433
|
-
if (value === void 0 || value === null) {
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
const options = parameters[name] || args;
|
|
437
|
-
if (Array.isArray(value)) {
|
|
438
|
-
const serializedArray = serializeArrayParam({
|
|
439
|
-
allowReserved: options.allowReserved,
|
|
440
|
-
explode: true,
|
|
441
|
-
name,
|
|
442
|
-
style: "form",
|
|
443
|
-
value,
|
|
444
|
-
...options.array
|
|
445
|
-
});
|
|
446
|
-
if (serializedArray) search.push(serializedArray);
|
|
447
|
-
} else if (typeof value === "object") {
|
|
448
|
-
const serializedObject = serializeObjectParam({
|
|
449
|
-
allowReserved: options.allowReserved,
|
|
450
|
-
explode: true,
|
|
451
|
-
name,
|
|
452
|
-
style: "deepObject",
|
|
453
|
-
value,
|
|
454
|
-
...options.object
|
|
455
|
-
});
|
|
456
|
-
if (serializedObject) search.push(serializedObject);
|
|
457
|
-
} else {
|
|
458
|
-
const serializedPrimitive = serializePrimitiveParam({
|
|
459
|
-
allowReserved: options.allowReserved,
|
|
460
|
-
name,
|
|
461
|
-
value
|
|
462
|
-
});
|
|
463
|
-
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
return search.join("&");
|
|
468
|
-
}, "querySerializer");
|
|
469
|
-
return querySerializer;
|
|
470
|
-
}, "createQuerySerializer");
|
|
471
|
-
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
472
|
-
if (!contentType) {
|
|
473
|
-
return "stream";
|
|
474
|
-
}
|
|
475
|
-
const cleanContent = contentType.split(";")[0]?.trim();
|
|
476
|
-
if (!cleanContent) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
480
|
-
return "json";
|
|
481
|
-
}
|
|
482
|
-
if (cleanContent === "multipart/form-data") {
|
|
483
|
-
return "formData";
|
|
484
|
-
}
|
|
485
|
-
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
486
|
-
return "blob";
|
|
487
|
-
}
|
|
488
|
-
if (cleanContent.startsWith("text/")) {
|
|
489
|
-
return "text";
|
|
490
|
-
}
|
|
491
|
-
return;
|
|
492
|
-
}, "getParseAs");
|
|
493
|
-
var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
494
|
-
if (!name) {
|
|
495
|
-
return false;
|
|
496
|
-
}
|
|
497
|
-
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
498
|
-
return true;
|
|
499
|
-
}
|
|
500
|
-
return false;
|
|
501
|
-
}, "checkForExistence");
|
|
502
475
|
async function setAuthParams(options) {
|
|
503
476
|
for (const auth2 of options.security ?? []) {
|
|
504
477
|
if (checkForExistence(options, auth2.name)) {
|
|
@@ -526,424 +499,484 @@ async function setAuthParams(options) {
|
|
|
526
499
|
}
|
|
527
500
|
}
|
|
528
501
|
}
|
|
529
|
-
|
|
530
|
-
var
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
502
|
+
var createQuerySerializer, getParseAs, checkForExistence, buildUrl, mergeConfigs, headersEntries, mergeHeaders, Interceptors, createInterceptors, defaultQuerySerializer, defaultHeaders, createConfig;
|
|
503
|
+
var init_utils_gen2 = __esm({
|
|
504
|
+
"src/_api/generated/client/utils.gen.ts"() {
|
|
505
|
+
init_auth_gen();
|
|
506
|
+
init_bodySerializer_gen();
|
|
507
|
+
init_pathSerializer_gen();
|
|
508
|
+
init_utils_gen();
|
|
509
|
+
createQuerySerializer = /* @__PURE__ */ __name(({
|
|
510
|
+
parameters = {},
|
|
511
|
+
...args
|
|
512
|
+
} = {}) => {
|
|
513
|
+
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
514
|
+
const search = [];
|
|
515
|
+
if (queryParams && typeof queryParams === "object") {
|
|
516
|
+
for (const name in queryParams) {
|
|
517
|
+
const value = queryParams[name];
|
|
518
|
+
if (value === void 0 || value === null) {
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
const options = parameters[name] || args;
|
|
522
|
+
if (Array.isArray(value)) {
|
|
523
|
+
const serializedArray = serializeArrayParam({
|
|
524
|
+
allowReserved: options.allowReserved,
|
|
525
|
+
explode: true,
|
|
526
|
+
name,
|
|
527
|
+
style: "form",
|
|
528
|
+
value,
|
|
529
|
+
...options.array
|
|
530
|
+
});
|
|
531
|
+
if (serializedArray) search.push(serializedArray);
|
|
532
|
+
} else if (typeof value === "object") {
|
|
533
|
+
const serializedObject = serializeObjectParam({
|
|
534
|
+
allowReserved: options.allowReserved,
|
|
535
|
+
explode: true,
|
|
536
|
+
name,
|
|
537
|
+
style: "deepObject",
|
|
538
|
+
value,
|
|
539
|
+
...options.object
|
|
540
|
+
});
|
|
541
|
+
if (serializedObject) search.push(serializedObject);
|
|
542
|
+
} else {
|
|
543
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
544
|
+
allowReserved: options.allowReserved,
|
|
545
|
+
name,
|
|
546
|
+
value
|
|
547
|
+
});
|
|
548
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
565
551
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
552
|
+
return search.join("&");
|
|
553
|
+
}, "querySerializer");
|
|
554
|
+
return querySerializer;
|
|
555
|
+
}, "createQuerySerializer");
|
|
556
|
+
getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
557
|
+
if (!contentType) {
|
|
558
|
+
return "stream";
|
|
571
559
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
560
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
561
|
+
if (!cleanContent) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
565
|
+
return "json";
|
|
566
|
+
}
|
|
567
|
+
if (cleanContent === "multipart/form-data") {
|
|
568
|
+
return "formData";
|
|
569
|
+
}
|
|
570
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
571
|
+
return "blob";
|
|
572
|
+
}
|
|
573
|
+
if (cleanContent.startsWith("text/")) {
|
|
574
|
+
return "text";
|
|
575
|
+
}
|
|
576
|
+
return;
|
|
577
|
+
}, "getParseAs");
|
|
578
|
+
checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
579
|
+
if (!name) {
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
return false;
|
|
586
|
+
}, "checkForExistence");
|
|
587
|
+
__name(setAuthParams, "setAuthParams");
|
|
588
|
+
buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
589
|
+
baseUrl: options.baseUrl,
|
|
590
|
+
path: options.path,
|
|
591
|
+
query: options.query,
|
|
592
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
593
|
+
url: options.url
|
|
594
|
+
}), "buildUrl");
|
|
595
|
+
mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
596
|
+
const config = { ...a, ...b };
|
|
597
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
598
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
599
|
+
}
|
|
600
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
601
|
+
return config;
|
|
602
|
+
}, "mergeConfigs");
|
|
603
|
+
headersEntries = /* @__PURE__ */ __name((headers) => {
|
|
604
|
+
const entries = [];
|
|
605
|
+
headers.forEach((value, key) => {
|
|
606
|
+
entries.push([key, value]);
|
|
607
|
+
});
|
|
608
|
+
return entries;
|
|
609
|
+
}, "headersEntries");
|
|
610
|
+
mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
611
|
+
const mergedHeaders = new Headers();
|
|
612
|
+
for (const header of headers) {
|
|
613
|
+
if (!header) {
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
617
|
+
for (const [key, value] of iterator) {
|
|
618
|
+
if (value === null) {
|
|
619
|
+
mergedHeaders.delete(key);
|
|
620
|
+
} else if (Array.isArray(value)) {
|
|
621
|
+
for (const v of value) {
|
|
622
|
+
mergedHeaders.append(key, v);
|
|
623
|
+
}
|
|
624
|
+
} else if (value !== void 0) {
|
|
625
|
+
mergedHeaders.set(
|
|
626
|
+
key,
|
|
627
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return mergedHeaders;
|
|
633
|
+
}, "mergeHeaders");
|
|
634
|
+
Interceptors = class {
|
|
635
|
+
static {
|
|
636
|
+
__name(this, "Interceptors");
|
|
637
|
+
}
|
|
638
|
+
fns = [];
|
|
639
|
+
clear() {
|
|
640
|
+
this.fns = [];
|
|
641
|
+
}
|
|
642
|
+
eject(id) {
|
|
643
|
+
const index = this.getInterceptorIndex(id);
|
|
644
|
+
if (this.fns[index]) {
|
|
645
|
+
this.fns[index] = null;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
exists(id) {
|
|
649
|
+
const index = this.getInterceptorIndex(id);
|
|
650
|
+
return Boolean(this.fns[index]);
|
|
651
|
+
}
|
|
652
|
+
getInterceptorIndex(id) {
|
|
653
|
+
if (typeof id === "number") {
|
|
654
|
+
return this.fns[id] ? id : -1;
|
|
655
|
+
}
|
|
656
|
+
return this.fns.indexOf(id);
|
|
657
|
+
}
|
|
658
|
+
update(id, fn) {
|
|
659
|
+
const index = this.getInterceptorIndex(id);
|
|
660
|
+
if (this.fns[index]) {
|
|
661
|
+
this.fns[index] = fn;
|
|
662
|
+
return id;
|
|
663
|
+
}
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
use(fn) {
|
|
667
|
+
this.fns.push(fn);
|
|
668
|
+
return this.fns.length - 1;
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
createInterceptors = /* @__PURE__ */ __name(() => ({
|
|
672
|
+
error: new Interceptors(),
|
|
673
|
+
request: new Interceptors(),
|
|
674
|
+
response: new Interceptors()
|
|
675
|
+
}), "createInterceptors");
|
|
676
|
+
defaultQuerySerializer = createQuerySerializer({
|
|
677
|
+
allowReserved: false,
|
|
678
|
+
array: {
|
|
679
|
+
explode: true,
|
|
680
|
+
style: "form"
|
|
681
|
+
},
|
|
682
|
+
object: {
|
|
683
|
+
explode: true,
|
|
684
|
+
style: "deepObject"
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
defaultHeaders = {
|
|
688
|
+
"Content-Type": "application/json"
|
|
689
|
+
};
|
|
690
|
+
createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
691
|
+
...jsonBodySerializer,
|
|
692
|
+
headers: defaultHeaders,
|
|
693
|
+
parseAs: "auto",
|
|
694
|
+
querySerializer: defaultQuerySerializer,
|
|
695
|
+
...override
|
|
696
|
+
}), "createConfig");
|
|
627
697
|
}
|
|
628
698
|
});
|
|
629
|
-
var defaultHeaders = {
|
|
630
|
-
"Content-Type": "application/json"
|
|
631
|
-
};
|
|
632
|
-
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
633
|
-
...jsonBodySerializer,
|
|
634
|
-
headers: defaultHeaders,
|
|
635
|
-
parseAs: "auto",
|
|
636
|
-
querySerializer: defaultQuerySerializer,
|
|
637
|
-
...override
|
|
638
|
-
}), "createConfig");
|
|
639
699
|
|
|
640
700
|
// src/_api/generated/client/client.gen.ts
|
|
641
|
-
var createClient
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
667
|
-
opts.headers.delete("Content-Type");
|
|
668
|
-
}
|
|
669
|
-
const resolvedOpts = opts;
|
|
670
|
-
const url = buildUrl(resolvedOpts);
|
|
671
|
-
return { opts: resolvedOpts, url };
|
|
672
|
-
}, "beforeRequest");
|
|
673
|
-
const request = /* @__PURE__ */ __name(async (options) => {
|
|
674
|
-
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
675
|
-
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
676
|
-
let request2;
|
|
677
|
-
let response;
|
|
678
|
-
try {
|
|
679
|
-
const { opts, url } = await beforeRequest(options);
|
|
680
|
-
const requestInit = {
|
|
681
|
-
redirect: "follow",
|
|
682
|
-
...opts,
|
|
683
|
-
body: getValidRequestBody(opts)
|
|
684
|
-
};
|
|
685
|
-
request2 = new Request(url, requestInit);
|
|
686
|
-
for (const fn of interceptors.request.fns) {
|
|
687
|
-
if (fn) {
|
|
688
|
-
request2 = await fn(request2, opts);
|
|
701
|
+
var createClient;
|
|
702
|
+
var init_client_gen = __esm({
|
|
703
|
+
"src/_api/generated/client/client.gen.ts"() {
|
|
704
|
+
init_serverSentEvents_gen();
|
|
705
|
+
init_utils_gen();
|
|
706
|
+
init_utils_gen2();
|
|
707
|
+
createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
708
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
709
|
+
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
710
|
+
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
711
|
+
_config = mergeConfigs(_config, config2);
|
|
712
|
+
return getConfig();
|
|
713
|
+
}, "setConfig");
|
|
714
|
+
const interceptors = createInterceptors();
|
|
715
|
+
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
716
|
+
const opts = {
|
|
717
|
+
..._config,
|
|
718
|
+
...options,
|
|
719
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
720
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
721
|
+
serializedBody: void 0
|
|
722
|
+
};
|
|
723
|
+
if (opts.security) {
|
|
724
|
+
await setAuthParams(opts);
|
|
689
725
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
response = await _fetch(request2);
|
|
693
|
-
for (const fn of interceptors.response.fns) {
|
|
694
|
-
if (fn) {
|
|
695
|
-
response = await fn(response, request2, opts);
|
|
726
|
+
if (opts.requestValidator) {
|
|
727
|
+
await opts.requestValidator(opts);
|
|
696
728
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
request: request2,
|
|
700
|
-
response
|
|
701
|
-
};
|
|
702
|
-
if (response.ok) {
|
|
703
|
-
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
704
|
-
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
705
|
-
let emptyData;
|
|
706
|
-
switch (parseAs) {
|
|
707
|
-
case "arrayBuffer":
|
|
708
|
-
case "blob":
|
|
709
|
-
case "text":
|
|
710
|
-
emptyData = await response[parseAs]();
|
|
711
|
-
break;
|
|
712
|
-
case "formData":
|
|
713
|
-
emptyData = new FormData();
|
|
714
|
-
break;
|
|
715
|
-
case "stream":
|
|
716
|
-
emptyData = response.body;
|
|
717
|
-
break;
|
|
718
|
-
case "json":
|
|
719
|
-
default:
|
|
720
|
-
emptyData = {};
|
|
721
|
-
break;
|
|
722
|
-
}
|
|
723
|
-
return opts.responseStyle === "data" ? emptyData : {
|
|
724
|
-
data: emptyData,
|
|
725
|
-
...result
|
|
726
|
-
};
|
|
729
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
730
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
727
731
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
732
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
733
|
+
opts.headers.delete("Content-Type");
|
|
734
|
+
}
|
|
735
|
+
const resolvedOpts = opts;
|
|
736
|
+
const url = buildUrl(resolvedOpts);
|
|
737
|
+
return { opts: resolvedOpts, url };
|
|
738
|
+
}, "beforeRequest");
|
|
739
|
+
const request = /* @__PURE__ */ __name(async (options) => {
|
|
740
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
741
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
742
|
+
let request2;
|
|
743
|
+
let response;
|
|
744
|
+
try {
|
|
745
|
+
const { opts, url } = await beforeRequest(options);
|
|
746
|
+
const requestInit = {
|
|
747
|
+
redirect: "follow",
|
|
748
|
+
...opts,
|
|
749
|
+
body: getValidRequestBody(opts)
|
|
750
|
+
};
|
|
751
|
+
request2 = new Request(url, requestInit);
|
|
752
|
+
for (const fn of interceptors.request.fns) {
|
|
753
|
+
if (fn) {
|
|
754
|
+
request2 = await fn(request2, opts);
|
|
755
|
+
}
|
|
740
756
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
757
|
+
const _fetch = opts.fetch;
|
|
758
|
+
response = await _fetch(request2);
|
|
759
|
+
for (const fn of interceptors.response.fns) {
|
|
760
|
+
if (fn) {
|
|
761
|
+
response = await fn(response, request2, opts);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
const result = {
|
|
765
|
+
request: request2,
|
|
766
|
+
response
|
|
767
|
+
};
|
|
768
|
+
if (response.ok) {
|
|
769
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
770
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
771
|
+
let emptyData;
|
|
772
|
+
switch (parseAs) {
|
|
773
|
+
case "arrayBuffer":
|
|
774
|
+
case "blob":
|
|
775
|
+
case "text":
|
|
776
|
+
emptyData = await response[parseAs]();
|
|
777
|
+
break;
|
|
778
|
+
case "formData":
|
|
779
|
+
emptyData = new FormData();
|
|
780
|
+
break;
|
|
781
|
+
case "stream":
|
|
782
|
+
emptyData = response.body;
|
|
783
|
+
break;
|
|
784
|
+
case "json":
|
|
785
|
+
default:
|
|
786
|
+
emptyData = {};
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
790
|
+
data: emptyData,
|
|
791
|
+
...result
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
let data;
|
|
795
|
+
switch (parseAs) {
|
|
796
|
+
case "arrayBuffer":
|
|
797
|
+
case "blob":
|
|
798
|
+
case "formData":
|
|
799
|
+
case "text":
|
|
800
|
+
data = await response[parseAs]();
|
|
801
|
+
break;
|
|
802
|
+
case "json": {
|
|
803
|
+
const text = await response.text();
|
|
804
|
+
data = text ? JSON.parse(text) : {};
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
case "stream":
|
|
808
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
809
|
+
data: response.body,
|
|
810
|
+
...result
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
if (parseAs === "json") {
|
|
814
|
+
if (opts.responseValidator) {
|
|
815
|
+
await opts.responseValidator(data);
|
|
816
|
+
}
|
|
817
|
+
if (opts.responseTransformer) {
|
|
818
|
+
data = await opts.responseTransformer(data);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return opts.responseStyle === "data" ? data : {
|
|
822
|
+
data,
|
|
744
823
|
...result
|
|
745
824
|
};
|
|
746
|
-
}
|
|
747
|
-
if (parseAs === "json") {
|
|
748
|
-
if (opts.responseValidator) {
|
|
749
|
-
await opts.responseValidator(data);
|
|
750
825
|
}
|
|
751
|
-
|
|
752
|
-
|
|
826
|
+
const textError = await response.text();
|
|
827
|
+
let jsonError;
|
|
828
|
+
try {
|
|
829
|
+
jsonError = JSON.parse(textError);
|
|
830
|
+
} catch {
|
|
831
|
+
}
|
|
832
|
+
throw jsonError ?? textError;
|
|
833
|
+
} catch (error) {
|
|
834
|
+
let finalError = error;
|
|
835
|
+
for (const fn of interceptors.error.fns) {
|
|
836
|
+
if (fn) {
|
|
837
|
+
finalError = await fn(finalError, response, request2, options);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
finalError = finalError || {};
|
|
841
|
+
if (throwOnError) {
|
|
842
|
+
throw finalError;
|
|
753
843
|
}
|
|
844
|
+
return responseStyle === "data" ? void 0 : {
|
|
845
|
+
error: finalError,
|
|
846
|
+
request: request2,
|
|
847
|
+
response
|
|
848
|
+
};
|
|
754
849
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
};
|
|
850
|
+
}, "request");
|
|
851
|
+
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
852
|
+
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
853
|
+
const { opts, url } = await beforeRequest(options);
|
|
854
|
+
return createSseClient({
|
|
855
|
+
...opts,
|
|
856
|
+
body: opts.body,
|
|
857
|
+
method,
|
|
858
|
+
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
859
|
+
let request2 = new Request(url2, init);
|
|
860
|
+
for (const fn of interceptors.request.fns) {
|
|
861
|
+
if (fn) {
|
|
862
|
+
request2 = await fn(request2, opts);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return request2;
|
|
866
|
+
}, "onRequest"),
|
|
867
|
+
serializedBody: getValidRequestBody(opts),
|
|
868
|
+
url
|
|
869
|
+
});
|
|
870
|
+
}, "makeSseFn");
|
|
871
|
+
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl({ ..._config, ...options }), "_buildUrl");
|
|
872
|
+
return {
|
|
873
|
+
buildUrl: _buildUrl,
|
|
874
|
+
connect: makeMethodFn("CONNECT"),
|
|
875
|
+
delete: makeMethodFn("DELETE"),
|
|
876
|
+
get: makeMethodFn("GET"),
|
|
877
|
+
getConfig,
|
|
878
|
+
head: makeMethodFn("HEAD"),
|
|
879
|
+
interceptors,
|
|
880
|
+
options: makeMethodFn("OPTIONS"),
|
|
881
|
+
patch: makeMethodFn("PATCH"),
|
|
882
|
+
post: makeMethodFn("POST"),
|
|
883
|
+
put: makeMethodFn("PUT"),
|
|
884
|
+
request,
|
|
885
|
+
setConfig,
|
|
886
|
+
sse: {
|
|
887
|
+
connect: makeSseFn("CONNECT"),
|
|
888
|
+
delete: makeSseFn("DELETE"),
|
|
889
|
+
get: makeSseFn("GET"),
|
|
890
|
+
head: makeSseFn("HEAD"),
|
|
891
|
+
options: makeSseFn("OPTIONS"),
|
|
892
|
+
patch: makeSseFn("PATCH"),
|
|
893
|
+
post: makeSseFn("POST"),
|
|
894
|
+
put: makeSseFn("PUT"),
|
|
895
|
+
trace: makeSseFn("TRACE")
|
|
896
|
+
},
|
|
897
|
+
trace: makeMethodFn("TRACE")
|
|
898
|
+
};
|
|
899
|
+
}, "createClient");
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
// src/_api/generated/client/index.ts
|
|
904
|
+
var init_client = __esm({
|
|
905
|
+
"src/_api/generated/client/index.ts"() {
|
|
906
|
+
init_bodySerializer_gen();
|
|
907
|
+
init_params_gen();
|
|
908
|
+
init_queryKeySerializer_gen();
|
|
909
|
+
init_client_gen();
|
|
910
|
+
init_utils_gen2();
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
// src/_api/generated/helpers/errors.ts
|
|
915
|
+
var APIError;
|
|
916
|
+
var init_errors = __esm({
|
|
917
|
+
"src/_api/generated/helpers/errors.ts"() {
|
|
918
|
+
APIError = class extends Error {
|
|
919
|
+
constructor(statusCode, statusText, response, url, message) {
|
|
920
|
+
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
921
|
+
this.statusCode = statusCode;
|
|
922
|
+
this.statusText = statusText;
|
|
923
|
+
this.response = response;
|
|
924
|
+
this.url = url;
|
|
925
|
+
this.name = "APIError";
|
|
759
926
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
try {
|
|
763
|
-
jsonError = JSON.parse(textError);
|
|
764
|
-
} catch {
|
|
927
|
+
static {
|
|
928
|
+
__name(this, "APIError");
|
|
765
929
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
for (const fn of interceptors.error.fns) {
|
|
770
|
-
if (fn) {
|
|
771
|
-
finalError = await fn(finalError, response, request2, options);
|
|
930
|
+
get details() {
|
|
931
|
+
if (typeof this.response === "object" && this.response !== null) {
|
|
932
|
+
return this.response;
|
|
772
933
|
}
|
|
934
|
+
return null;
|
|
773
935
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
936
|
+
get fieldErrors() {
|
|
937
|
+
const details = this.details;
|
|
938
|
+
if (!details) return null;
|
|
939
|
+
const fieldErrors = {};
|
|
940
|
+
for (const [key, value] of Object.entries(details)) {
|
|
941
|
+
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
942
|
+
}
|
|
943
|
+
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
777
944
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
}, "request");
|
|
785
|
-
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
786
|
-
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
787
|
-
const { opts, url } = await beforeRequest(options);
|
|
788
|
-
return createSseClient({
|
|
789
|
-
...opts,
|
|
790
|
-
body: opts.body,
|
|
791
|
-
method,
|
|
792
|
-
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
793
|
-
let request2 = new Request(url2, init);
|
|
794
|
-
for (const fn of interceptors.request.fns) {
|
|
795
|
-
if (fn) {
|
|
796
|
-
request2 = await fn(request2, opts);
|
|
797
|
-
}
|
|
945
|
+
get errorMessage() {
|
|
946
|
+
const details = this.details;
|
|
947
|
+
if (!details) return this.message;
|
|
948
|
+
if (details.detail) {
|
|
949
|
+
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
798
950
|
}
|
|
799
|
-
return
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
head: makeSseFn("HEAD"),
|
|
825
|
-
options: makeSseFn("OPTIONS"),
|
|
826
|
-
patch: makeSseFn("PATCH"),
|
|
827
|
-
post: makeSseFn("POST"),
|
|
828
|
-
put: makeSseFn("PUT"),
|
|
829
|
-
trace: makeSseFn("TRACE")
|
|
830
|
-
},
|
|
831
|
-
trace: makeMethodFn("TRACE")
|
|
832
|
-
};
|
|
833
|
-
}, "createClient");
|
|
834
|
-
|
|
835
|
-
// src/_api/generated/helpers/errors.ts
|
|
836
|
-
var APIError = class extends Error {
|
|
837
|
-
constructor(statusCode, statusText, response, url, message) {
|
|
838
|
-
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
839
|
-
this.statusCode = statusCode;
|
|
840
|
-
this.statusText = statusText;
|
|
841
|
-
this.response = response;
|
|
842
|
-
this.url = url;
|
|
843
|
-
this.name = "APIError";
|
|
844
|
-
}
|
|
845
|
-
static {
|
|
846
|
-
__name(this, "APIError");
|
|
847
|
-
}
|
|
848
|
-
get details() {
|
|
849
|
-
if (typeof this.response === "object" && this.response !== null) {
|
|
850
|
-
return this.response;
|
|
851
|
-
}
|
|
852
|
-
return null;
|
|
853
|
-
}
|
|
854
|
-
get fieldErrors() {
|
|
855
|
-
const details = this.details;
|
|
856
|
-
if (!details) return null;
|
|
857
|
-
const fieldErrors = {};
|
|
858
|
-
for (const [key, value] of Object.entries(details)) {
|
|
859
|
-
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
860
|
-
}
|
|
861
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
862
|
-
}
|
|
863
|
-
get errorMessage() {
|
|
864
|
-
const details = this.details;
|
|
865
|
-
if (!details) return this.message;
|
|
866
|
-
if (details.detail) {
|
|
867
|
-
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
868
|
-
}
|
|
869
|
-
if (details.error) return String(details.error);
|
|
870
|
-
if (details.message) return String(details.message);
|
|
871
|
-
const fieldErrors = this.fieldErrors;
|
|
872
|
-
if (fieldErrors) {
|
|
873
|
-
const firstField = Object.keys(fieldErrors)[0];
|
|
874
|
-
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
875
|
-
}
|
|
876
|
-
return this.message;
|
|
877
|
-
}
|
|
878
|
-
get isValidationError() {
|
|
879
|
-
return this.statusCode === 400;
|
|
880
|
-
}
|
|
881
|
-
get isAuthError() {
|
|
882
|
-
return this.statusCode === 401;
|
|
883
|
-
}
|
|
884
|
-
get isPermissionError() {
|
|
885
|
-
return this.statusCode === 403;
|
|
886
|
-
}
|
|
887
|
-
get isNotFoundError() {
|
|
888
|
-
return this.statusCode === 404;
|
|
889
|
-
}
|
|
890
|
-
get isServerError() {
|
|
891
|
-
return this.statusCode >= 500 && this.statusCode < 600;
|
|
951
|
+
if (details.error) return String(details.error);
|
|
952
|
+
if (details.message) return String(details.message);
|
|
953
|
+
const fieldErrors = this.fieldErrors;
|
|
954
|
+
if (fieldErrors) {
|
|
955
|
+
const firstField = Object.keys(fieldErrors)[0];
|
|
956
|
+
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
957
|
+
}
|
|
958
|
+
return this.message;
|
|
959
|
+
}
|
|
960
|
+
get isValidationError() {
|
|
961
|
+
return this.statusCode === 400;
|
|
962
|
+
}
|
|
963
|
+
get isAuthError() {
|
|
964
|
+
return this.statusCode === 401;
|
|
965
|
+
}
|
|
966
|
+
get isPermissionError() {
|
|
967
|
+
return this.statusCode === 403;
|
|
968
|
+
}
|
|
969
|
+
get isNotFoundError() {
|
|
970
|
+
return this.statusCode === 404;
|
|
971
|
+
}
|
|
972
|
+
get isServerError() {
|
|
973
|
+
return this.statusCode >= 500 && this.statusCode < 600;
|
|
974
|
+
}
|
|
975
|
+
};
|
|
892
976
|
}
|
|
893
|
-
};
|
|
977
|
+
});
|
|
894
978
|
|
|
895
979
|
// src/_api/generated/helpers/auth.ts
|
|
896
|
-
var ACCESS_KEY = "cfg.access_token";
|
|
897
|
-
var REFRESH_KEY = "cfg.refresh_token";
|
|
898
|
-
var API_KEY_KEY = "cfg.api_key";
|
|
899
|
-
var isBrowser = typeof window !== "undefined";
|
|
900
|
-
var localStorageBackend = {
|
|
901
|
-
get(key) {
|
|
902
|
-
if (!isBrowser) return null;
|
|
903
|
-
try {
|
|
904
|
-
return window.localStorage.getItem(key);
|
|
905
|
-
} catch {
|
|
906
|
-
return null;
|
|
907
|
-
}
|
|
908
|
-
},
|
|
909
|
-
set(key, value) {
|
|
910
|
-
if (!isBrowser) return;
|
|
911
|
-
try {
|
|
912
|
-
if (value === null) window.localStorage.removeItem(key);
|
|
913
|
-
else window.localStorage.setItem(key, value);
|
|
914
|
-
} catch {
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
var COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
|
|
919
|
-
var cookieBackend = {
|
|
920
|
-
get(key) {
|
|
921
|
-
if (!isBrowser) return null;
|
|
922
|
-
try {
|
|
923
|
-
const re = new RegExp(`(?:^|;\\s*)${encodeURIComponent(key)}=([^;]*)`);
|
|
924
|
-
const m = document.cookie.match(re);
|
|
925
|
-
return m ? decodeURIComponent(m[1]) : null;
|
|
926
|
-
} catch {
|
|
927
|
-
return null;
|
|
928
|
-
}
|
|
929
|
-
},
|
|
930
|
-
set(key, value) {
|
|
931
|
-
if (!isBrowser) return;
|
|
932
|
-
try {
|
|
933
|
-
const k = encodeURIComponent(key);
|
|
934
|
-
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
935
|
-
if (value === null) {
|
|
936
|
-
document.cookie = `${k}=; Path=/; Max-Age=0; SameSite=Lax${secure}`;
|
|
937
|
-
} else {
|
|
938
|
-
const v = encodeURIComponent(value);
|
|
939
|
-
document.cookie = `${k}=${v}; Path=/; Max-Age=${COOKIE_MAX_AGE}; SameSite=Lax${secure}`;
|
|
940
|
-
}
|
|
941
|
-
} catch {
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
var _storage = localStorageBackend;
|
|
946
|
-
var _storageMode = "localStorage";
|
|
947
980
|
function detectLocale() {
|
|
948
981
|
try {
|
|
949
982
|
if (typeof document !== "undefined") {
|
|
@@ -957,7 +990,6 @@ function detectLocale() {
|
|
|
957
990
|
}
|
|
958
991
|
return null;
|
|
959
992
|
}
|
|
960
|
-
__name(detectLocale, "detectLocale");
|
|
961
993
|
function defaultBaseUrl() {
|
|
962
994
|
if (typeof window !== "undefined") {
|
|
963
995
|
try {
|
|
@@ -980,7 +1012,6 @@ function defaultBaseUrl() {
|
|
|
980
1012
|
}
|
|
981
1013
|
return "";
|
|
982
1014
|
}
|
|
983
|
-
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
984
1015
|
function defaultApiKey() {
|
|
985
1016
|
try {
|
|
986
1017
|
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
@@ -990,16 +1021,77 @@ function defaultApiKey() {
|
|
|
990
1021
|
}
|
|
991
1022
|
return null;
|
|
992
1023
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1024
|
+
function jwtExpMs(token) {
|
|
1025
|
+
try {
|
|
1026
|
+
const payload = token.split(".")[1];
|
|
1027
|
+
if (!payload) return null;
|
|
1028
|
+
const json = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
|
|
1029
|
+
return typeof json.exp === "number" ? json.exp * 1e3 : null;
|
|
1030
|
+
} catch {
|
|
1031
|
+
return null;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
function computeSnapshot() {
|
|
1035
|
+
const access = _storage.get(ACCESS_KEY);
|
|
1036
|
+
const refresh = _storage.get(REFRESH_KEY);
|
|
1037
|
+
const now = Date.now();
|
|
1038
|
+
const accessExp = access ? jwtExpMs(access) : null;
|
|
1039
|
+
const accessAlive = access !== null && (accessExp === null || accessExp > now);
|
|
1040
|
+
const refreshExp = refresh ? jwtExpMs(refresh) : null;
|
|
1041
|
+
const refreshAlive = refresh !== null && (refreshExp === null || refreshExp > now);
|
|
1042
|
+
return {
|
|
1043
|
+
status: accessAlive || refreshAlive ? "authenticated" : "anonymous",
|
|
1044
|
+
accessExpiresAt: accessExp
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
function scheduleExpiryFlip() {
|
|
1048
|
+
if (!isBrowser) return;
|
|
1049
|
+
if (_expiryTimer !== null) {
|
|
1050
|
+
clearTimeout(_expiryTimer);
|
|
1051
|
+
_expiryTimer = null;
|
|
1052
|
+
}
|
|
1053
|
+
if (_sessionListeners.size === 0) return;
|
|
1054
|
+
const now = Date.now();
|
|
1055
|
+
const exps = [];
|
|
1056
|
+
const access = _storage.get(ACCESS_KEY);
|
|
1057
|
+
const refresh = _storage.get(REFRESH_KEY);
|
|
1058
|
+
const accessExp = access ? jwtExpMs(access) : null;
|
|
1059
|
+
const refreshExp = refresh ? jwtExpMs(refresh) : null;
|
|
1060
|
+
if (accessExp !== null && accessExp > now) exps.push(accessExp);
|
|
1061
|
+
if (refreshExp !== null && refreshExp > now) exps.push(refreshExp);
|
|
1062
|
+
if (!exps.length) return;
|
|
1063
|
+
const delay = Math.min(Math.min(...exps) - now + 250, 2147483647);
|
|
1064
|
+
_expiryTimer = setTimeout(notifySessionChanged, delay);
|
|
1065
|
+
}
|
|
1066
|
+
function notifySessionChanged() {
|
|
1067
|
+
const next = computeSnapshot();
|
|
1068
|
+
const changed = next.status !== _snapshot.status || next.accessExpiresAt !== _snapshot.accessExpiresAt;
|
|
1069
|
+
if (changed) _snapshot = next;
|
|
1070
|
+
scheduleExpiryFlip();
|
|
1071
|
+
if (!changed) return;
|
|
1072
|
+
for (const listener of Array.from(_sessionListeners)) {
|
|
1073
|
+
try {
|
|
1074
|
+
listener();
|
|
1075
|
+
} catch {
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
if (isBrowser) {
|
|
1079
|
+
try {
|
|
1080
|
+
window.dispatchEvent(new Event(SESSION_SYNC_EVENT));
|
|
1081
|
+
} catch {
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
function ensureStorageSync() {
|
|
1086
|
+
if (!isBrowser || _storageListenerInstalled) return;
|
|
1087
|
+
_storageListenerInstalled = true;
|
|
1088
|
+
window.addEventListener("storage", (e) => {
|
|
1089
|
+
if (e.key === null || e.key === ACCESS_KEY || e.key === REFRESH_KEY) {
|
|
1090
|
+
notifySessionChanged();
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
window.addEventListener(SESSION_SYNC_EVENT, () => notifySessionChanged());
|
|
1094
|
+
}
|
|
1003
1095
|
function pushClientConfig() {
|
|
1004
1096
|
if (!_client) return;
|
|
1005
1097
|
_client.setConfig({
|
|
@@ -1007,125 +1099,25 @@ function pushClientConfig() {
|
|
|
1007
1099
|
credentials: _withCredentials ? "include" : "same-origin"
|
|
1008
1100
|
});
|
|
1009
1101
|
}
|
|
1010
|
-
__name(pushClientConfig, "pushClientConfig");
|
|
1011
|
-
var auth = {
|
|
1012
|
-
// ── Storage mode ──────────────────────────────────────────────────
|
|
1013
|
-
getStorageMode() {
|
|
1014
|
-
return _storageMode;
|
|
1015
|
-
},
|
|
1016
|
-
setStorageMode(mode) {
|
|
1017
|
-
_storageMode = mode;
|
|
1018
|
-
_storage = mode === "cookie" ? cookieBackend : localStorageBackend;
|
|
1019
|
-
},
|
|
1020
|
-
// ── Bearer token ──────────────────────────────────────────────────
|
|
1021
|
-
getToken() {
|
|
1022
|
-
return _storage.get(ACCESS_KEY);
|
|
1023
|
-
},
|
|
1024
|
-
setToken(token) {
|
|
1025
|
-
_storage.set(ACCESS_KEY, token);
|
|
1026
|
-
},
|
|
1027
|
-
getRefreshToken() {
|
|
1028
|
-
return _storage.get(REFRESH_KEY);
|
|
1029
|
-
},
|
|
1030
|
-
setRefreshToken(token) {
|
|
1031
|
-
_storage.set(REFRESH_KEY, token);
|
|
1032
|
-
},
|
|
1033
|
-
clearTokens() {
|
|
1034
|
-
_storage.set(ACCESS_KEY, null);
|
|
1035
|
-
_storage.set(REFRESH_KEY, null);
|
|
1036
|
-
},
|
|
1037
|
-
isAuthenticated() {
|
|
1038
|
-
return _storage.get(ACCESS_KEY) !== null;
|
|
1039
|
-
},
|
|
1040
|
-
// ── API key ───────────────────────────────────────────────────────
|
|
1041
|
-
getApiKey() {
|
|
1042
|
-
return _apiKeyOverride ?? _storage.get(API_KEY_KEY) ?? defaultApiKey();
|
|
1043
|
-
},
|
|
1044
|
-
setApiKey(key) {
|
|
1045
|
-
_apiKeyOverride = key;
|
|
1046
|
-
},
|
|
1047
|
-
setApiKeyPersist(key) {
|
|
1048
|
-
_apiKeyOverride = key;
|
|
1049
|
-
_storage.set(API_KEY_KEY, key);
|
|
1050
|
-
},
|
|
1051
|
-
clearApiKey() {
|
|
1052
|
-
_apiKeyOverride = null;
|
|
1053
|
-
_storage.set(API_KEY_KEY, null);
|
|
1054
|
-
},
|
|
1055
|
-
// ── Locale ────────────────────────────────────────────────────────
|
|
1056
|
-
getLocale() {
|
|
1057
|
-
return _localeOverride ?? detectLocale();
|
|
1058
|
-
},
|
|
1059
|
-
setLocale(locale) {
|
|
1060
|
-
_localeOverride = locale;
|
|
1061
|
-
},
|
|
1062
|
-
// ── Base URL ──────────────────────────────────────────────────────
|
|
1063
|
-
getBaseUrl() {
|
|
1064
|
-
const url = _baseUrlOverride ?? defaultBaseUrl();
|
|
1065
|
-
return url.replace(/\/$/, "");
|
|
1066
|
-
},
|
|
1067
|
-
setBaseUrl(url) {
|
|
1068
|
-
_baseUrlOverride = url ? url.replace(/\/$/, "") : null;
|
|
1069
|
-
pushClientConfig();
|
|
1070
|
-
},
|
|
1071
|
-
// ── Credentials toggle ────────────────────────────────────────────
|
|
1072
|
-
getWithCredentials() {
|
|
1073
|
-
return _withCredentials;
|
|
1074
|
-
},
|
|
1075
|
-
setWithCredentials(value) {
|
|
1076
|
-
_withCredentials = value;
|
|
1077
|
-
pushClientConfig();
|
|
1078
|
-
},
|
|
1079
|
-
// ── 401 handler ───────────────────────────────────────────────────
|
|
1080
|
-
/**
|
|
1081
|
-
* Fired when the server returns 401 AND no refresh path recovers it
|
|
1082
|
-
* (no refresh token, no refresh handler, refresh failed, or retry
|
|
1083
|
-
* still 401). The app should clear local state and redirect to login.
|
|
1084
|
-
*
|
|
1085
|
-
* NOT fired for 401 that gets transparently recovered by the refresh
|
|
1086
|
-
* handler — those are invisible to callers.
|
|
1087
|
-
*/
|
|
1088
|
-
onUnauthorized(cb) {
|
|
1089
|
-
_onUnauthorized = cb;
|
|
1090
|
-
},
|
|
1091
|
-
/**
|
|
1092
|
-
* Register the refresh strategy. The handler receives the current
|
|
1093
|
-
* refresh token and must call your refresh endpoint, returning
|
|
1094
|
-
* `{ access, refresh? }` on success or `null` on failure.
|
|
1095
|
-
*
|
|
1096
|
-
* @example
|
|
1097
|
-
* auth.setRefreshHandler(async (refresh) => {
|
|
1098
|
-
* const { data } = await Auth.tokenRefreshCreate({ body: { refresh } });
|
|
1099
|
-
* return data ? { access: data.access, refresh: data.refresh } : null;
|
|
1100
|
-
* });
|
|
1101
|
-
*/
|
|
1102
|
-
setRefreshHandler(fn) {
|
|
1103
|
-
_refreshHandler = fn;
|
|
1104
|
-
},
|
|
1105
|
-
/**
|
|
1106
|
-
* Proactively run the registered refresh handler right now, reusing the
|
|
1107
|
-
* SAME single-flight promise as the 401-recovery interceptor. Callers
|
|
1108
|
-
* (e.g. an expiry timer / focus / reconnect) get token rotation,
|
|
1109
|
-
* de-duplication and rotated-token persistence for free — they must NOT
|
|
1110
|
-
* re-implement any of it. Returns the fresh access token, or null if
|
|
1111
|
-
* there is no handler / no refresh token / the refresh failed.
|
|
1112
|
-
*/
|
|
1113
|
-
refreshNow() {
|
|
1114
|
-
return tryRefresh();
|
|
1115
|
-
}
|
|
1116
|
-
};
|
|
1117
1102
|
async function tryRefresh() {
|
|
1118
1103
|
if (_refreshInflight) return _refreshInflight;
|
|
1119
1104
|
if (!_refreshHandler) return null;
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1105
|
+
const runRefresh = /* @__PURE__ */ __name(async () => {
|
|
1106
|
+
const refresh = auth.getRefreshToken();
|
|
1107
|
+
if (!refresh) return null;
|
|
1108
|
+
const result = await _refreshHandler(refresh);
|
|
1109
|
+
if (!result?.access) return null;
|
|
1110
|
+
auth.setToken(result.access);
|
|
1111
|
+
if (result.refresh) auth.setRefreshToken(result.refresh);
|
|
1112
|
+
return result.access;
|
|
1113
|
+
}, "runRefresh");
|
|
1122
1114
|
_refreshInflight = (async () => {
|
|
1123
1115
|
try {
|
|
1124
|
-
const
|
|
1125
|
-
if (
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
return
|
|
1116
|
+
const locks = typeof navigator !== "undefined" ? navigator.locks : void 0;
|
|
1117
|
+
if (locks?.request) {
|
|
1118
|
+
return await locks.request(`${REFRESH_KEY}:refresh`, runRefresh);
|
|
1119
|
+
}
|
|
1120
|
+
return await runRefresh();
|
|
1129
1121
|
} catch {
|
|
1130
1122
|
return null;
|
|
1131
1123
|
} finally {
|
|
@@ -1134,7 +1126,21 @@ async function tryRefresh() {
|
|
|
1134
1126
|
})();
|
|
1135
1127
|
return _refreshInflight;
|
|
1136
1128
|
}
|
|
1137
|
-
|
|
1129
|
+
function expireSession(response) {
|
|
1130
|
+
auth.clearTokens();
|
|
1131
|
+
for (const cb of Array.from(_sessionExpiredHandlers)) {
|
|
1132
|
+
try {
|
|
1133
|
+
cb(response);
|
|
1134
|
+
} catch {
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
if (_onUnauthorized) {
|
|
1138
|
+
try {
|
|
1139
|
+
_onUnauthorized(response);
|
|
1140
|
+
} catch {
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1138
1144
|
function dpopEnabled() {
|
|
1139
1145
|
try {
|
|
1140
1146
|
return typeof process !== "undefined" && process.env?.NEXT_PUBLIC_DPOP_ENABLED === "true";
|
|
@@ -1142,10 +1148,6 @@ function dpopEnabled() {
|
|
|
1142
1148
|
return false;
|
|
1143
1149
|
}
|
|
1144
1150
|
}
|
|
1145
|
-
__name(dpopEnabled, "dpopEnabled");
|
|
1146
|
-
var _DPOP_DB = "cfg-auth";
|
|
1147
|
-
var _DPOP_STORE = "keys";
|
|
1148
|
-
var _DPOP_KEY_ID = "dpop-ec-p256";
|
|
1149
1151
|
function _idbOpen() {
|
|
1150
1152
|
return new Promise((resolve, reject) => {
|
|
1151
1153
|
const req = indexedDB.open(_DPOP_DB, 1);
|
|
@@ -1154,7 +1156,6 @@ function _idbOpen() {
|
|
|
1154
1156
|
req.onerror = () => reject(req.error);
|
|
1155
1157
|
});
|
|
1156
1158
|
}
|
|
1157
|
-
__name(_idbOpen, "_idbOpen");
|
|
1158
1159
|
function _idbGet(key) {
|
|
1159
1160
|
return _idbOpen().then((db) => new Promise((resolve, reject) => {
|
|
1160
1161
|
const tx = db.transaction(_DPOP_STORE, "readonly");
|
|
@@ -1163,7 +1164,6 @@ function _idbGet(key) {
|
|
|
1163
1164
|
req.onerror = () => reject(req.error);
|
|
1164
1165
|
}));
|
|
1165
1166
|
}
|
|
1166
|
-
__name(_idbGet, "_idbGet");
|
|
1167
1167
|
function _idbPut(key, value) {
|
|
1168
1168
|
return _idbOpen().then((db) => new Promise((resolve, reject) => {
|
|
1169
1169
|
const tx = db.transaction(_DPOP_STORE, "readwrite");
|
|
@@ -1172,8 +1172,6 @@ function _idbPut(key, value) {
|
|
|
1172
1172
|
tx.onerror = () => reject(tx.error);
|
|
1173
1173
|
}));
|
|
1174
1174
|
}
|
|
1175
|
-
__name(_idbPut, "_idbPut");
|
|
1176
|
-
var _dpopKeyPromise = null;
|
|
1177
1175
|
function _getDpopKeyPair() {
|
|
1178
1176
|
if (_dpopKeyPromise) return _dpopKeyPromise;
|
|
1179
1177
|
_dpopKeyPromise = (async () => {
|
|
@@ -1191,23 +1189,19 @@ function _getDpopKeyPair() {
|
|
|
1191
1189
|
})();
|
|
1192
1190
|
return _dpopKeyPromise;
|
|
1193
1191
|
}
|
|
1194
|
-
__name(_getDpopKeyPair, "_getDpopKeyPair");
|
|
1195
1192
|
function _b64urlFromBytes(bytes) {
|
|
1196
1193
|
const arr = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
1197
1194
|
let s = "";
|
|
1198
1195
|
for (let i = 0; i < arr.length; i++) s += String.fromCharCode(arr[i]);
|
|
1199
1196
|
return btoa(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1200
1197
|
}
|
|
1201
|
-
__name(_b64urlFromBytes, "_b64urlFromBytes");
|
|
1202
1198
|
function _b64urlFromString(str) {
|
|
1203
1199
|
return _b64urlFromBytes(new TextEncoder().encode(str));
|
|
1204
1200
|
}
|
|
1205
|
-
__name(_b64urlFromString, "_b64urlFromString");
|
|
1206
1201
|
async function _publicJwk(pub) {
|
|
1207
1202
|
const jwk = await crypto.subtle.exportKey("jwk", pub);
|
|
1208
1203
|
return { kty: "EC", crv: "P-256", x: jwk.x, y: jwk.y };
|
|
1209
1204
|
}
|
|
1210
|
-
__name(_publicJwk, "_publicJwk");
|
|
1211
1205
|
async function _makeDpopProof(method, url) {
|
|
1212
1206
|
try {
|
|
1213
1207
|
const pair = await _getDpopKeyPair();
|
|
@@ -1227,7 +1221,6 @@ async function _makeDpopProof(method, url) {
|
|
|
1227
1221
|
return null;
|
|
1228
1222
|
}
|
|
1229
1223
|
}
|
|
1230
|
-
__name(_makeDpopProof, "_makeDpopProof");
|
|
1231
1224
|
function installAuthOnClient(client2) {
|
|
1232
1225
|
if (_client) return;
|
|
1233
1226
|
_client = client2;
|
|
@@ -1264,22 +1257,12 @@ function installAuthOnClient(client2) {
|
|
|
1264
1257
|
client2.interceptors.response.use(async (response, request) => {
|
|
1265
1258
|
if (response.status !== 401) return response;
|
|
1266
1259
|
if (request.headers.get(RETRY_MARKER)) {
|
|
1267
|
-
|
|
1268
|
-
try {
|
|
1269
|
-
_onUnauthorized(response);
|
|
1270
|
-
} catch {
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1260
|
+
expireSession(response);
|
|
1273
1261
|
return response;
|
|
1274
1262
|
}
|
|
1275
1263
|
const newToken = await tryRefresh();
|
|
1276
1264
|
if (!newToken) {
|
|
1277
|
-
|
|
1278
|
-
try {
|
|
1279
|
-
_onUnauthorized(response);
|
|
1280
|
-
} catch {
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1265
|
+
expireSession(response);
|
|
1283
1266
|
return response;
|
|
1284
1267
|
}
|
|
1285
1268
|
const retry = request.clone();
|
|
@@ -1291,128 +1274,956 @@ function installAuthOnClient(client2) {
|
|
|
1291
1274
|
}
|
|
1292
1275
|
try {
|
|
1293
1276
|
const retried = await fetch(retry);
|
|
1294
|
-
if (retried.status === 401
|
|
1277
|
+
if (retried.status === 401) expireSession(retried);
|
|
1278
|
+
return retried;
|
|
1279
|
+
} catch {
|
|
1280
|
+
return response;
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
var ACCESS_KEY, REFRESH_KEY, API_KEY_KEY, isBrowser, localStorageBackend, COOKIE_MAX_AGE, cookieBackend, _storage, _storageMode, _localeOverride, _apiKeyOverride, _baseUrlOverride, _withCredentials, _onUnauthorized, _refreshHandler, _refreshInflight, RETRY_MARKER, SERVER_SNAPSHOT, SESSION_SYNC_EVENT, _snapshot, _sessionListeners, _expiryTimer, _storageListenerInstalled, _sessionExpiredHandlers, _client, auth, _DPOP_DB, _DPOP_STORE, _DPOP_KEY_ID, _dpopKeyPromise;
|
|
1285
|
+
var init_auth = __esm({
|
|
1286
|
+
"src/_api/generated/helpers/auth.ts"() {
|
|
1287
|
+
init_errors();
|
|
1288
|
+
ACCESS_KEY = "cfg.access_token";
|
|
1289
|
+
REFRESH_KEY = "cfg.refresh_token";
|
|
1290
|
+
API_KEY_KEY = "cfg.api_key";
|
|
1291
|
+
isBrowser = typeof window !== "undefined";
|
|
1292
|
+
localStorageBackend = {
|
|
1293
|
+
get(key) {
|
|
1294
|
+
if (!isBrowser) return null;
|
|
1295
|
+
try {
|
|
1296
|
+
return window.localStorage.getItem(key);
|
|
1297
|
+
} catch {
|
|
1298
|
+
return null;
|
|
1299
|
+
}
|
|
1300
|
+
},
|
|
1301
|
+
set(key, value) {
|
|
1302
|
+
if (!isBrowser) return;
|
|
1295
1303
|
try {
|
|
1296
|
-
|
|
1304
|
+
if (value === null) window.localStorage.removeItem(key);
|
|
1305
|
+
else window.localStorage.setItem(key, value);
|
|
1297
1306
|
} catch {
|
|
1298
1307
|
}
|
|
1299
1308
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1309
|
+
};
|
|
1310
|
+
COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
|
|
1311
|
+
cookieBackend = {
|
|
1312
|
+
get(key) {
|
|
1313
|
+
if (!isBrowser) return null;
|
|
1303
1314
|
try {
|
|
1304
|
-
|
|
1315
|
+
const re = new RegExp(`(?:^|;\\s*)${encodeURIComponent(key)}=([^;]*)`);
|
|
1316
|
+
const m = document.cookie.match(re);
|
|
1317
|
+
return m ? decodeURIComponent(m[1]) : null;
|
|
1318
|
+
} catch {
|
|
1319
|
+
return null;
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
set(key, value) {
|
|
1323
|
+
if (!isBrowser) return;
|
|
1324
|
+
try {
|
|
1325
|
+
const k = encodeURIComponent(key);
|
|
1326
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
1327
|
+
if (value === null) {
|
|
1328
|
+
document.cookie = `${k}=; Path=/; Max-Age=0; SameSite=Lax${secure}`;
|
|
1329
|
+
} else {
|
|
1330
|
+
const v = encodeURIComponent(value);
|
|
1331
|
+
document.cookie = `${k}=${v}; Path=/; Max-Age=${COOKIE_MAX_AGE}; SameSite=Lax${secure}`;
|
|
1332
|
+
}
|
|
1305
1333
|
} catch {
|
|
1306
1334
|
}
|
|
1307
1335
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
__name(
|
|
1336
|
+
};
|
|
1337
|
+
_storage = localStorageBackend;
|
|
1338
|
+
_storageMode = "localStorage";
|
|
1339
|
+
__name(detectLocale, "detectLocale");
|
|
1340
|
+
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
1341
|
+
__name(defaultApiKey, "defaultApiKey");
|
|
1342
|
+
_localeOverride = null;
|
|
1343
|
+
_apiKeyOverride = null;
|
|
1344
|
+
_baseUrlOverride = null;
|
|
1345
|
+
_withCredentials = true;
|
|
1346
|
+
_onUnauthorized = null;
|
|
1347
|
+
_refreshHandler = null;
|
|
1348
|
+
_refreshInflight = null;
|
|
1349
|
+
RETRY_MARKER = "X-Auth-Retry";
|
|
1350
|
+
__name(jwtExpMs, "jwtExpMs");
|
|
1351
|
+
__name(computeSnapshot, "computeSnapshot");
|
|
1352
|
+
SERVER_SNAPSHOT = { status: "anonymous", accessExpiresAt: null };
|
|
1353
|
+
SESSION_SYNC_EVENT = `cfg-auth:changed:${ACCESS_KEY}`;
|
|
1354
|
+
_snapshot = computeSnapshot();
|
|
1355
|
+
_sessionListeners = /* @__PURE__ */ new Set();
|
|
1356
|
+
_expiryTimer = null;
|
|
1357
|
+
_storageListenerInstalled = false;
|
|
1358
|
+
__name(scheduleExpiryFlip, "scheduleExpiryFlip");
|
|
1359
|
+
__name(notifySessionChanged, "notifySessionChanged");
|
|
1360
|
+
__name(ensureStorageSync, "ensureStorageSync");
|
|
1361
|
+
_sessionExpiredHandlers = /* @__PURE__ */ new Set();
|
|
1362
|
+
_client = null;
|
|
1363
|
+
__name(pushClientConfig, "pushClientConfig");
|
|
1364
|
+
auth = {
|
|
1365
|
+
// ── Storage mode ──────────────────────────────────────────────────
|
|
1366
|
+
getStorageMode() {
|
|
1367
|
+
return _storageMode;
|
|
1368
|
+
},
|
|
1369
|
+
setStorageMode(mode) {
|
|
1370
|
+
_storageMode = mode;
|
|
1371
|
+
_storage = mode === "cookie" ? cookieBackend : localStorageBackend;
|
|
1372
|
+
notifySessionChanged();
|
|
1373
|
+
},
|
|
1374
|
+
// ── Bearer token ──────────────────────────────────────────────────
|
|
1375
|
+
getToken() {
|
|
1376
|
+
return _storage.get(ACCESS_KEY);
|
|
1377
|
+
},
|
|
1378
|
+
setToken(token) {
|
|
1379
|
+
_storage.set(ACCESS_KEY, token);
|
|
1380
|
+
notifySessionChanged();
|
|
1381
|
+
},
|
|
1382
|
+
getRefreshToken() {
|
|
1383
|
+
return _storage.get(REFRESH_KEY);
|
|
1384
|
+
},
|
|
1385
|
+
setRefreshToken(token) {
|
|
1386
|
+
_storage.set(REFRESH_KEY, token);
|
|
1387
|
+
notifySessionChanged();
|
|
1388
|
+
},
|
|
1389
|
+
clearTokens() {
|
|
1390
|
+
_storage.set(ACCESS_KEY, null);
|
|
1391
|
+
_storage.set(REFRESH_KEY, null);
|
|
1392
|
+
notifySessionChanged();
|
|
1393
|
+
},
|
|
1394
|
+
/** Session-aware: token PRESENT and not past its `exp` (or a live refresh
|
|
1395
|
+
* token exists that can mint one). Prefer `getSnapshot().status` in React. */
|
|
1396
|
+
isAuthenticated() {
|
|
1397
|
+
return computeSnapshot().status === "authenticated";
|
|
1398
|
+
},
|
|
1399
|
+
// ── Session (the ONE write path for login/logout flows) ──────────
|
|
1400
|
+
/**
|
|
1401
|
+
* Persist a token pair atomically. Every login flow (OTP verify, 2FA,
|
|
1402
|
+
* OAuth callback) and the refresh handler should end here — do NOT
|
|
1403
|
+
* scatter `setToken`/`setRefreshToken` pairs through app code.
|
|
1404
|
+
* `refresh: undefined` keeps the current refresh token (access-only
|
|
1405
|
+
* rotation); `refresh: null` explicitly drops it.
|
|
1406
|
+
*/
|
|
1407
|
+
setSession(tokens) {
|
|
1408
|
+
_storage.set(ACCESS_KEY, tokens.access);
|
|
1409
|
+
if (tokens.refresh !== void 0) _storage.set(REFRESH_KEY, tokens.refresh);
|
|
1410
|
+
notifySessionChanged();
|
|
1411
|
+
},
|
|
1412
|
+
clearSession() {
|
|
1413
|
+
auth.clearTokens();
|
|
1414
|
+
},
|
|
1415
|
+
// ── Reactive snapshot (for useSyncExternalStore) ──────────────────
|
|
1416
|
+
/**
|
|
1417
|
+
* @example React:
|
|
1418
|
+
* const session = useSyncExternalStore(
|
|
1419
|
+
* auth.subscribe, auth.getSnapshot, auth.getServerSnapshot,
|
|
1420
|
+
* );
|
|
1421
|
+
* const isAuthenticated = session.status === 'authenticated';
|
|
1422
|
+
*/
|
|
1423
|
+
getSnapshot() {
|
|
1424
|
+
return _snapshot;
|
|
1425
|
+
},
|
|
1426
|
+
getServerSnapshot() {
|
|
1427
|
+
return SERVER_SNAPSHOT;
|
|
1428
|
+
},
|
|
1429
|
+
subscribe(listener) {
|
|
1430
|
+
ensureStorageSync();
|
|
1431
|
+
_sessionListeners.add(listener);
|
|
1432
|
+
notifySessionChanged();
|
|
1433
|
+
return () => {
|
|
1434
|
+
_sessionListeners.delete(listener);
|
|
1435
|
+
if (_sessionListeners.size === 0 && _expiryTimer !== null) {
|
|
1436
|
+
clearTimeout(_expiryTimer);
|
|
1437
|
+
_expiryTimer = null;
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
},
|
|
1441
|
+
/**
|
|
1442
|
+
* Fired on TERMINAL 401 — after the refresh+retry path is exhausted.
|
|
1443
|
+
* The store has already cleared the session before calling back, so
|
|
1444
|
+
* handlers only need to route to login (no clear-then-redirect
|
|
1445
|
+
* ordering to get wrong). Returns an unsubscribe function; multiple
|
|
1446
|
+
* handlers compose (unlike the legacy single-slot `onUnauthorized`).
|
|
1447
|
+
*/
|
|
1448
|
+
onSessionExpired(cb) {
|
|
1449
|
+
_sessionExpiredHandlers.add(cb);
|
|
1450
|
+
return () => {
|
|
1451
|
+
_sessionExpiredHandlers.delete(cb);
|
|
1452
|
+
};
|
|
1453
|
+
},
|
|
1454
|
+
// ── API key ───────────────────────────────────────────────────────
|
|
1455
|
+
getApiKey() {
|
|
1456
|
+
return _apiKeyOverride ?? _storage.get(API_KEY_KEY) ?? defaultApiKey();
|
|
1457
|
+
},
|
|
1458
|
+
setApiKey(key) {
|
|
1459
|
+
_apiKeyOverride = key;
|
|
1460
|
+
},
|
|
1461
|
+
setApiKeyPersist(key) {
|
|
1462
|
+
_apiKeyOverride = key;
|
|
1463
|
+
_storage.set(API_KEY_KEY, key);
|
|
1464
|
+
},
|
|
1465
|
+
clearApiKey() {
|
|
1466
|
+
_apiKeyOverride = null;
|
|
1467
|
+
_storage.set(API_KEY_KEY, null);
|
|
1468
|
+
},
|
|
1469
|
+
// ── Locale ────────────────────────────────────────────────────────
|
|
1470
|
+
getLocale() {
|
|
1471
|
+
return _localeOverride ?? detectLocale();
|
|
1472
|
+
},
|
|
1473
|
+
setLocale(locale) {
|
|
1474
|
+
_localeOverride = locale;
|
|
1475
|
+
},
|
|
1476
|
+
// ── Base URL ──────────────────────────────────────────────────────
|
|
1477
|
+
getBaseUrl() {
|
|
1478
|
+
const url = _baseUrlOverride ?? defaultBaseUrl();
|
|
1479
|
+
return url.replace(/\/$/, "");
|
|
1480
|
+
},
|
|
1481
|
+
setBaseUrl(url) {
|
|
1482
|
+
_baseUrlOverride = url ? url.replace(/\/$/, "") : null;
|
|
1483
|
+
pushClientConfig();
|
|
1484
|
+
},
|
|
1485
|
+
// ── Credentials toggle ────────────────────────────────────────────
|
|
1486
|
+
getWithCredentials() {
|
|
1487
|
+
return _withCredentials;
|
|
1488
|
+
},
|
|
1489
|
+
setWithCredentials(value) {
|
|
1490
|
+
_withCredentials = value;
|
|
1491
|
+
pushClientConfig();
|
|
1492
|
+
},
|
|
1493
|
+
// ── 401 handler ───────────────────────────────────────────────────
|
|
1494
|
+
/**
|
|
1495
|
+
* Fired when the server returns 401 AND no refresh path recovers it
|
|
1496
|
+
* (no refresh token, no refresh handler, refresh failed, or retry
|
|
1497
|
+
* still 401). The app should clear local state and redirect to login.
|
|
1498
|
+
*
|
|
1499
|
+
* NOT fired for 401 that gets transparently recovered by the refresh
|
|
1500
|
+
* handler — those are invisible to callers.
|
|
1501
|
+
*/
|
|
1502
|
+
onUnauthorized(cb) {
|
|
1503
|
+
_onUnauthorized = cb;
|
|
1504
|
+
},
|
|
1505
|
+
/**
|
|
1506
|
+
* Register the refresh strategy. The handler receives the current
|
|
1507
|
+
* refresh token and must call your refresh endpoint, returning
|
|
1508
|
+
* `{ access, refresh? }` on success or `null` on failure.
|
|
1509
|
+
*
|
|
1510
|
+
* @example
|
|
1511
|
+
* auth.setRefreshHandler(async (refresh) => {
|
|
1512
|
+
* const { data } = await Auth.tokenRefreshCreate({ body: { refresh } });
|
|
1513
|
+
* return data ? { access: data.access, refresh: data.refresh } : null;
|
|
1514
|
+
* });
|
|
1515
|
+
*/
|
|
1516
|
+
setRefreshHandler(fn) {
|
|
1517
|
+
_refreshHandler = fn;
|
|
1518
|
+
},
|
|
1519
|
+
/**
|
|
1520
|
+
* Proactively run the registered refresh handler right now, reusing the
|
|
1521
|
+
* SAME single-flight promise as the 401-recovery interceptor. Callers
|
|
1522
|
+
* (e.g. an expiry timer / focus / reconnect) get token rotation,
|
|
1523
|
+
* de-duplication and rotated-token persistence for free — they must NOT
|
|
1524
|
+
* re-implement any of it. Returns the fresh access token, or null if
|
|
1525
|
+
* there is no handler / no refresh token / the refresh failed.
|
|
1526
|
+
*/
|
|
1527
|
+
refreshNow() {
|
|
1528
|
+
return tryRefresh();
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
__name(tryRefresh, "tryRefresh");
|
|
1532
|
+
__name(expireSession, "expireSession");
|
|
1533
|
+
__name(dpopEnabled, "dpopEnabled");
|
|
1534
|
+
_DPOP_DB = "cfg-auth";
|
|
1535
|
+
_DPOP_STORE = "keys";
|
|
1536
|
+
_DPOP_KEY_ID = "dpop-ec-p256";
|
|
1537
|
+
__name(_idbOpen, "_idbOpen");
|
|
1538
|
+
__name(_idbGet, "_idbGet");
|
|
1539
|
+
__name(_idbPut, "_idbPut");
|
|
1540
|
+
_dpopKeyPromise = null;
|
|
1541
|
+
__name(_getDpopKeyPair, "_getDpopKeyPair");
|
|
1542
|
+
__name(_b64urlFromBytes, "_b64urlFromBytes");
|
|
1543
|
+
__name(_b64urlFromString, "_b64urlFromString");
|
|
1544
|
+
__name(_publicJwk, "_publicJwk");
|
|
1545
|
+
__name(_makeDpopProof, "_makeDpopProof");
|
|
1546
|
+
__name(installAuthOnClient, "installAuthOnClient");
|
|
1547
|
+
auth.setRefreshHandler(async (refresh) => {
|
|
1548
|
+
try {
|
|
1549
|
+
const { CfgAccountsAuth: CfgAccountsAuth2 } = await Promise.resolve().then(() => (init_sdk_gen(), sdk_gen_exports));
|
|
1550
|
+
const { data } = await CfgAccountsAuth2.cfgAccountsTokenRefreshCreate({
|
|
1551
|
+
body: { refresh },
|
|
1552
|
+
throwOnError: true
|
|
1553
|
+
});
|
|
1554
|
+
return data?.access ? { access: data.access, refresh: data.refresh ?? refresh } : null;
|
|
1555
|
+
} catch {
|
|
1556
|
+
return null;
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1313
1561
|
|
|
1314
1562
|
// src/_api/generated/client.gen.ts
|
|
1315
|
-
var client
|
|
1316
|
-
|
|
1563
|
+
var client;
|
|
1564
|
+
var init_client_gen2 = __esm({
|
|
1565
|
+
"src/_api/generated/client.gen.ts"() {
|
|
1566
|
+
init_client();
|
|
1567
|
+
init_auth();
|
|
1568
|
+
client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
1569
|
+
installAuthOnClient(client);
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1317
1572
|
|
|
1318
1573
|
// src/_api/generated/sdk.gen.ts
|
|
1319
|
-
var
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
...options
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Regenerate API key
|
|
1345
|
-
*
|
|
1346
|
-
* Generate a new API key. The full key is returned only once.
|
|
1347
|
-
*/
|
|
1348
|
-
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1349
|
-
return (options.client ?? client).post({
|
|
1350
|
-
security: [
|
|
1351
|
-
{ scheme: "bearer", type: "http" },
|
|
1352
|
-
{
|
|
1353
|
-
in: "cookie",
|
|
1354
|
-
name: "sessionid",
|
|
1355
|
-
type: "apiKey"
|
|
1356
|
-
},
|
|
1357
|
-
{ name: "X-API-Key", type: "apiKey" }
|
|
1358
|
-
],
|
|
1359
|
-
url: "/cfg/accounts/api-key/regenerate/",
|
|
1360
|
-
...options,
|
|
1361
|
-
headers: {
|
|
1362
|
-
"Content-Type": "application/json",
|
|
1363
|
-
...options.headers
|
|
1574
|
+
var sdk_gen_exports = {};
|
|
1575
|
+
__export(sdk_gen_exports, {
|
|
1576
|
+
CfgAccounts: () => CfgAccounts,
|
|
1577
|
+
CfgAccountsApiKey: () => CfgAccountsApiKey,
|
|
1578
|
+
CfgAccountsAuth: () => CfgAccountsAuth,
|
|
1579
|
+
CfgAccountsOauth: () => CfgAccountsOauth,
|
|
1580
|
+
CfgAccountsProfile: () => CfgAccountsProfile,
|
|
1581
|
+
CfgCentrifugo: () => CfgCentrifugo,
|
|
1582
|
+
CfgTotp: () => CfgTotp,
|
|
1583
|
+
CfgTotpBackupCodes: () => CfgTotpBackupCodes,
|
|
1584
|
+
CfgTotpSetup: () => CfgTotpSetup,
|
|
1585
|
+
CfgTotpVerify: () => CfgTotpVerify
|
|
1586
|
+
});
|
|
1587
|
+
var CfgAccountsApiKey, CfgAccountsOauth, CfgAccounts, CfgAccountsProfile, CfgAccountsAuth, CfgCentrifugo, CfgTotpBackupCodes, CfgTotp, CfgTotpSetup, CfgTotpVerify;
|
|
1588
|
+
var init_sdk_gen = __esm({
|
|
1589
|
+
"src/_api/generated/sdk.gen.ts"() {
|
|
1590
|
+
init_client();
|
|
1591
|
+
init_client_gen2();
|
|
1592
|
+
CfgAccountsApiKey = class {
|
|
1593
|
+
static {
|
|
1594
|
+
__name(this, "CfgAccountsApiKey");
|
|
1364
1595
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
...options,
|
|
1385
|
-
headers: {
|
|
1386
|
-
"Content-Type": "application/json",
|
|
1387
|
-
...options.headers
|
|
1596
|
+
/**
|
|
1597
|
+
* Get API key details
|
|
1598
|
+
*
|
|
1599
|
+
* Retrieve the current user's API key (masked) and metadata.
|
|
1600
|
+
*/
|
|
1601
|
+
static cfgAccountsApiKeyRetrieve(options) {
|
|
1602
|
+
return (options?.client ?? client).get({
|
|
1603
|
+
security: [
|
|
1604
|
+
{ scheme: "bearer", type: "http" },
|
|
1605
|
+
{
|
|
1606
|
+
in: "cookie",
|
|
1607
|
+
name: "sessionid",
|
|
1608
|
+
type: "apiKey"
|
|
1609
|
+
},
|
|
1610
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1611
|
+
],
|
|
1612
|
+
url: "/cfg/accounts/api-key/",
|
|
1613
|
+
...options
|
|
1614
|
+
});
|
|
1388
1615
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1616
|
+
/**
|
|
1617
|
+
* Regenerate API key
|
|
1618
|
+
*
|
|
1619
|
+
* Generate a new API key. The full key is returned only once.
|
|
1620
|
+
*/
|
|
1621
|
+
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1622
|
+
return (options.client ?? client).post({
|
|
1623
|
+
security: [
|
|
1624
|
+
{ scheme: "bearer", type: "http" },
|
|
1625
|
+
{
|
|
1626
|
+
in: "cookie",
|
|
1627
|
+
name: "sessionid",
|
|
1628
|
+
type: "apiKey"
|
|
1629
|
+
},
|
|
1630
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1631
|
+
],
|
|
1632
|
+
url: "/cfg/accounts/api-key/regenerate/",
|
|
1633
|
+
...options,
|
|
1634
|
+
headers: {
|
|
1635
|
+
"Content-Type": "application/json",
|
|
1636
|
+
...options.headers
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1412
1639
|
}
|
|
1413
|
-
|
|
1640
|
+
/**
|
|
1641
|
+
* Reveal API key
|
|
1642
|
+
*
|
|
1643
|
+
* Return the current full API key WITHOUT rotating it. The same durable value every one of the user's agents uses — for the signed-in user to copy and paste into agent onboarding. Default GET stays masked; this is the explicit reveal action.
|
|
1644
|
+
*/
|
|
1645
|
+
static cfgAccountsApiKeyRevealCreate(options) {
|
|
1646
|
+
return (options.client ?? client).post({
|
|
1647
|
+
security: [
|
|
1648
|
+
{ scheme: "bearer", type: "http" },
|
|
1649
|
+
{
|
|
1650
|
+
in: "cookie",
|
|
1651
|
+
name: "sessionid",
|
|
1652
|
+
type: "apiKey"
|
|
1653
|
+
},
|
|
1654
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1655
|
+
],
|
|
1656
|
+
url: "/cfg/accounts/api-key/reveal/",
|
|
1657
|
+
...options,
|
|
1658
|
+
headers: {
|
|
1659
|
+
"Content-Type": "application/json",
|
|
1660
|
+
...options.headers
|
|
1661
|
+
}
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Test API key
|
|
1666
|
+
*
|
|
1667
|
+
* Test whether an API key is valid without consuming it.
|
|
1668
|
+
*/
|
|
1669
|
+
static cfgAccountsApiKeyTestCreate(options) {
|
|
1670
|
+
return (options.client ?? client).post({
|
|
1671
|
+
security: [
|
|
1672
|
+
{ scheme: "bearer", type: "http" },
|
|
1673
|
+
{
|
|
1674
|
+
in: "cookie",
|
|
1675
|
+
name: "sessionid",
|
|
1676
|
+
type: "apiKey"
|
|
1677
|
+
},
|
|
1678
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1679
|
+
],
|
|
1680
|
+
url: "/cfg/accounts/api-key/test/",
|
|
1681
|
+
...options,
|
|
1682
|
+
headers: {
|
|
1683
|
+
"Content-Type": "application/json",
|
|
1684
|
+
...options.headers
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
CfgAccountsOauth = class {
|
|
1690
|
+
static {
|
|
1691
|
+
__name(this, "CfgAccountsOauth");
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* List OAuth connections
|
|
1695
|
+
*
|
|
1696
|
+
* Get all OAuth connections for the current user.
|
|
1697
|
+
*/
|
|
1698
|
+
static cfgAccountsOauthConnectionsList(options) {
|
|
1699
|
+
return (options?.client ?? client).get({
|
|
1700
|
+
security: [
|
|
1701
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1702
|
+
{ scheme: "bearer", type: "http" },
|
|
1703
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1704
|
+
],
|
|
1705
|
+
url: "/cfg/accounts/oauth/connections/",
|
|
1706
|
+
...options
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Disconnect OAuth provider
|
|
1711
|
+
*
|
|
1712
|
+
* Remove OAuth connection for the specified provider.
|
|
1713
|
+
*/
|
|
1714
|
+
static cfgAccountsOauthDisconnectCreate(options) {
|
|
1715
|
+
return (options.client ?? client).post({
|
|
1716
|
+
security: [
|
|
1717
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1718
|
+
{ scheme: "bearer", type: "http" },
|
|
1719
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1720
|
+
],
|
|
1721
|
+
url: "/cfg/accounts/oauth/disconnect/",
|
|
1722
|
+
...options,
|
|
1723
|
+
headers: {
|
|
1724
|
+
"Content-Type": "application/json",
|
|
1725
|
+
...options.headers
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Start GitHub OAuth
|
|
1731
|
+
*
|
|
1732
|
+
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1733
|
+
*/
|
|
1734
|
+
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
1735
|
+
return (options?.client ?? client).post({
|
|
1736
|
+
url: "/cfg/accounts/oauth/github/authorize/",
|
|
1737
|
+
...options,
|
|
1738
|
+
headers: {
|
|
1739
|
+
"Content-Type": "application/json",
|
|
1740
|
+
...options?.headers
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Complete GitHub OAuth
|
|
1746
|
+
*
|
|
1747
|
+
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1748
|
+
*/
|
|
1749
|
+
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1750
|
+
return (options.client ?? client).post({
|
|
1751
|
+
url: "/cfg/accounts/oauth/github/callback/",
|
|
1752
|
+
...options,
|
|
1753
|
+
headers: {
|
|
1754
|
+
"Content-Type": "application/json",
|
|
1755
|
+
...options.headers
|
|
1756
|
+
}
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* List OAuth providers
|
|
1761
|
+
*
|
|
1762
|
+
* Get list of available OAuth providers for authentication.
|
|
1763
|
+
*/
|
|
1764
|
+
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1765
|
+
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
CfgAccounts = class {
|
|
1769
|
+
static {
|
|
1770
|
+
__name(this, "CfgAccounts");
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Request OTP code to email.
|
|
1774
|
+
*/
|
|
1775
|
+
static cfgAccountsOtpRequestCreate(options) {
|
|
1776
|
+
return (options.client ?? client).post({
|
|
1777
|
+
security: [
|
|
1778
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1779
|
+
{ scheme: "bearer", type: "http" },
|
|
1780
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1781
|
+
],
|
|
1782
|
+
url: "/cfg/accounts/otp/request/",
|
|
1783
|
+
...options,
|
|
1784
|
+
headers: {
|
|
1785
|
+
"Content-Type": "application/json",
|
|
1786
|
+
...options.headers
|
|
1787
|
+
}
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1792
|
+
*
|
|
1793
|
+
* If user has 2FA enabled:
|
|
1794
|
+
* - Returns requires_2fa=True with session_id
|
|
1795
|
+
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1796
|
+
*
|
|
1797
|
+
* If user has no 2FA:
|
|
1798
|
+
* - Returns JWT tokens and user data directly
|
|
1799
|
+
*/
|
|
1800
|
+
static cfgAccountsOtpVerifyCreate(options) {
|
|
1801
|
+
return (options.client ?? client).post({
|
|
1802
|
+
security: [
|
|
1803
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1804
|
+
{ scheme: "bearer", type: "http" },
|
|
1805
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1806
|
+
],
|
|
1807
|
+
url: "/cfg/accounts/otp/verify/",
|
|
1808
|
+
...options,
|
|
1809
|
+
headers: {
|
|
1810
|
+
"Content-Type": "application/json",
|
|
1811
|
+
...options.headers
|
|
1812
|
+
}
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
CfgAccountsProfile = class {
|
|
1817
|
+
static {
|
|
1818
|
+
__name(this, "CfgAccountsProfile");
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Get current user profile
|
|
1822
|
+
*
|
|
1823
|
+
* Retrieve the current authenticated user's profile information.
|
|
1824
|
+
*/
|
|
1825
|
+
static cfgAccountsProfileRetrieve(options) {
|
|
1826
|
+
return (options?.client ?? client).get({
|
|
1827
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1828
|
+
in: "cookie",
|
|
1829
|
+
name: "sessionid",
|
|
1830
|
+
type: "apiKey"
|
|
1831
|
+
}],
|
|
1832
|
+
url: "/cfg/accounts/profile/",
|
|
1833
|
+
...options
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Upload user avatar
|
|
1838
|
+
*
|
|
1839
|
+
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1840
|
+
*/
|
|
1841
|
+
static cfgAccountsProfileAvatarCreate(options) {
|
|
1842
|
+
return (options?.client ?? client).post({
|
|
1843
|
+
...formDataBodySerializer,
|
|
1844
|
+
security: [
|
|
1845
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1846
|
+
{ scheme: "bearer", type: "http" },
|
|
1847
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1848
|
+
],
|
|
1849
|
+
url: "/cfg/accounts/profile/avatar/",
|
|
1850
|
+
...options,
|
|
1851
|
+
headers: {
|
|
1852
|
+
"Content-Type": null,
|
|
1853
|
+
...options?.headers
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Delete user account
|
|
1859
|
+
*
|
|
1860
|
+
*
|
|
1861
|
+
* Permanently delete the current user's account.
|
|
1862
|
+
*
|
|
1863
|
+
* This operation:
|
|
1864
|
+
* - Deactivates the account (user cannot log in)
|
|
1865
|
+
* - Anonymizes personal data (GDPR compliance)
|
|
1866
|
+
* - Frees up the email address for re-registration
|
|
1867
|
+
* - Preserves audit trail
|
|
1868
|
+
*
|
|
1869
|
+
* The account can be restored by an administrator if needed.
|
|
1870
|
+
*
|
|
1871
|
+
*/
|
|
1872
|
+
static cfgAccountsProfileDeleteCreate(options) {
|
|
1873
|
+
return (options?.client ?? client).post({
|
|
1874
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1875
|
+
in: "cookie",
|
|
1876
|
+
name: "sessionid",
|
|
1877
|
+
type: "apiKey"
|
|
1878
|
+
}],
|
|
1879
|
+
url: "/cfg/accounts/profile/delete/",
|
|
1880
|
+
...options
|
|
1881
|
+
});
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Partial update user profile
|
|
1885
|
+
*
|
|
1886
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1887
|
+
*/
|
|
1888
|
+
static cfgAccountsProfilePartialPartialUpdate(options) {
|
|
1889
|
+
return (options?.client ?? client).patch({
|
|
1890
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1891
|
+
in: "cookie",
|
|
1892
|
+
name: "sessionid",
|
|
1893
|
+
type: "apiKey"
|
|
1894
|
+
}],
|
|
1895
|
+
url: "/cfg/accounts/profile/partial/",
|
|
1896
|
+
...options,
|
|
1897
|
+
headers: {
|
|
1898
|
+
"Content-Type": "application/json",
|
|
1899
|
+
...options?.headers
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Partial update user profile
|
|
1905
|
+
*
|
|
1906
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1907
|
+
*/
|
|
1908
|
+
static cfgAccountsProfilePartialUpdate(options) {
|
|
1909
|
+
return (options?.client ?? client).put({
|
|
1910
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1911
|
+
in: "cookie",
|
|
1912
|
+
name: "sessionid",
|
|
1913
|
+
type: "apiKey"
|
|
1914
|
+
}],
|
|
1915
|
+
url: "/cfg/accounts/profile/partial/",
|
|
1916
|
+
...options,
|
|
1917
|
+
headers: {
|
|
1918
|
+
"Content-Type": "application/json",
|
|
1919
|
+
...options?.headers
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Update user profile
|
|
1925
|
+
*
|
|
1926
|
+
* Update the current authenticated user's profile information.
|
|
1927
|
+
*/
|
|
1928
|
+
static cfgAccountsProfileUpdatePartialUpdate(options) {
|
|
1929
|
+
return (options?.client ?? client).patch({
|
|
1930
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1931
|
+
in: "cookie",
|
|
1932
|
+
name: "sessionid",
|
|
1933
|
+
type: "apiKey"
|
|
1934
|
+
}],
|
|
1935
|
+
url: "/cfg/accounts/profile/update/",
|
|
1936
|
+
...options,
|
|
1937
|
+
headers: {
|
|
1938
|
+
"Content-Type": "application/json",
|
|
1939
|
+
...options?.headers
|
|
1940
|
+
}
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Update user profile
|
|
1945
|
+
*
|
|
1946
|
+
* Update the current authenticated user's profile information.
|
|
1947
|
+
*/
|
|
1948
|
+
static cfgAccountsProfileUpdateUpdate(options) {
|
|
1949
|
+
return (options?.client ?? client).put({
|
|
1950
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1951
|
+
in: "cookie",
|
|
1952
|
+
name: "sessionid",
|
|
1953
|
+
type: "apiKey"
|
|
1954
|
+
}],
|
|
1955
|
+
url: "/cfg/accounts/profile/update/",
|
|
1956
|
+
...options,
|
|
1957
|
+
headers: {
|
|
1958
|
+
"Content-Type": "application/json",
|
|
1959
|
+
...options?.headers
|
|
1960
|
+
}
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1964
|
+
CfgAccountsAuth = class {
|
|
1965
|
+
static {
|
|
1966
|
+
__name(this, "CfgAccountsAuth");
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Revoke a refresh token (logout).
|
|
1970
|
+
*
|
|
1971
|
+
* Blacklists the posted refresh token so it can never mint another access
|
|
1972
|
+
* token. Called best-effort by the client's logout — without it, "logout"
|
|
1973
|
+
* is purely client-side and a stolen refresh token survives until expiry.
|
|
1974
|
+
*/
|
|
1975
|
+
static cfgAccountsTokenBlacklistCreate(options) {
|
|
1976
|
+
return (options.client ?? client).post({
|
|
1977
|
+
url: "/cfg/accounts/token/blacklist/",
|
|
1978
|
+
...options,
|
|
1979
|
+
headers: {
|
|
1980
|
+
"Content-Type": "application/json",
|
|
1981
|
+
...options.headers
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Refresh JWT token.
|
|
1987
|
+
*
|
|
1988
|
+
* DPoP-aware: when the incoming refresh token is key-bound (`cnf.jkt`), the
|
|
1989
|
+
* rotated access/refresh in the response are re-stamped with the same `cnf`
|
|
1990
|
+
* (stock SimpleJWT drops it from the derived access), and a matching DPoP
|
|
1991
|
+
* proof is required on the refresh request — so a stolen refresh token can't
|
|
1992
|
+
* be used to mint fresh tokens.
|
|
1993
|
+
*/
|
|
1994
|
+
static cfgAccountsTokenRefreshCreate(options) {
|
|
1995
|
+
return (options.client ?? client).post({
|
|
1996
|
+
url: "/cfg/accounts/token/refresh/",
|
|
1997
|
+
...options,
|
|
1998
|
+
headers: {
|
|
1999
|
+
"Content-Type": "application/json",
|
|
2000
|
+
...options.headers
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
CfgCentrifugo = class {
|
|
2006
|
+
static {
|
|
2007
|
+
__name(this, "CfgCentrifugo");
|
|
2008
|
+
}
|
|
2009
|
+
/**
|
|
2010
|
+
* Get Centrifugo connection token
|
|
2011
|
+
*
|
|
2012
|
+
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
2013
|
+
*/
|
|
2014
|
+
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
2015
|
+
return (options?.client ?? client).get({
|
|
2016
|
+
security: [
|
|
2017
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2018
|
+
{ scheme: "bearer", type: "http" },
|
|
2019
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2020
|
+
],
|
|
2021
|
+
url: "/cfg/centrifugo/auth/token/",
|
|
2022
|
+
...options
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
CfgTotpBackupCodes = class {
|
|
2027
|
+
static {
|
|
2028
|
+
__name(this, "CfgTotpBackupCodes");
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Get backup codes status for user.
|
|
2032
|
+
*/
|
|
2033
|
+
static cfgTotpBackupCodesRetrieve(options) {
|
|
2034
|
+
return (options?.client ?? client).get({
|
|
2035
|
+
security: [
|
|
2036
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2037
|
+
{ scheme: "bearer", type: "http" },
|
|
2038
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2039
|
+
],
|
|
2040
|
+
url: "/cfg/totp/backup-codes/",
|
|
2041
|
+
...options
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
/**
|
|
2045
|
+
* Regenerate backup codes.
|
|
2046
|
+
*
|
|
2047
|
+
* Requires TOTP code for verification.
|
|
2048
|
+
* Invalidates all existing codes.
|
|
2049
|
+
*/
|
|
2050
|
+
static cfgTotpBackupCodesRegenerateCreate(options) {
|
|
2051
|
+
return (options.client ?? client).post({
|
|
2052
|
+
security: [
|
|
2053
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2054
|
+
{ scheme: "bearer", type: "http" },
|
|
2055
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2056
|
+
],
|
|
2057
|
+
url: "/cfg/totp/backup-codes/regenerate/",
|
|
2058
|
+
...options,
|
|
2059
|
+
headers: {
|
|
2060
|
+
"Content-Type": "application/json",
|
|
2061
|
+
...options.headers
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
CfgTotp = class {
|
|
2067
|
+
static {
|
|
2068
|
+
__name(this, "CfgTotp");
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* List all TOTP devices for user.
|
|
2072
|
+
*/
|
|
2073
|
+
static cfgTotpDevicesRetrieve(options) {
|
|
2074
|
+
return (options?.client ?? client).get({
|
|
2075
|
+
security: [
|
|
2076
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2077
|
+
{ scheme: "bearer", type: "http" },
|
|
2078
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2079
|
+
],
|
|
2080
|
+
url: "/cfg/totp/devices/",
|
|
2081
|
+
...options
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Delete a TOTP device.
|
|
2086
|
+
*
|
|
2087
|
+
* Requires verification code if removing the last/primary device.
|
|
2088
|
+
*/
|
|
2089
|
+
static cfgTotpDevicesDestroy(options) {
|
|
2090
|
+
return (options.client ?? client).delete({
|
|
2091
|
+
security: [
|
|
2092
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2093
|
+
{ scheme: "bearer", type: "http" },
|
|
2094
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2095
|
+
],
|
|
2096
|
+
url: "/cfg/totp/devices/{id}/",
|
|
2097
|
+
...options
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Completely disable 2FA for account.
|
|
2102
|
+
*
|
|
2103
|
+
* Requires verification code.
|
|
2104
|
+
*/
|
|
2105
|
+
static cfgTotpDisableCreate(options) {
|
|
2106
|
+
return (options.client ?? client).post({
|
|
2107
|
+
security: [
|
|
2108
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2109
|
+
{ scheme: "bearer", type: "http" },
|
|
2110
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2111
|
+
],
|
|
2112
|
+
url: "/cfg/totp/disable/",
|
|
2113
|
+
...options,
|
|
2114
|
+
headers: {
|
|
2115
|
+
"Content-Type": "application/json",
|
|
2116
|
+
...options.headers
|
|
2117
|
+
}
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
};
|
|
2121
|
+
CfgTotpSetup = class {
|
|
2122
|
+
static {
|
|
2123
|
+
__name(this, "CfgTotpSetup");
|
|
2124
|
+
}
|
|
2125
|
+
/**
|
|
2126
|
+
* Start 2FA setup process.
|
|
2127
|
+
*
|
|
2128
|
+
* Creates a new TOTP device and returns QR code for scanning.
|
|
2129
|
+
*/
|
|
2130
|
+
static cfgTotpSetupCreate(options) {
|
|
2131
|
+
return (options?.client ?? client).post({
|
|
2132
|
+
security: [
|
|
2133
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2134
|
+
{ scheme: "bearer", type: "http" },
|
|
2135
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2136
|
+
],
|
|
2137
|
+
url: "/cfg/totp/setup/",
|
|
2138
|
+
...options,
|
|
2139
|
+
headers: {
|
|
2140
|
+
"Content-Type": "application/json",
|
|
2141
|
+
...options?.headers
|
|
2142
|
+
}
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Confirm 2FA setup with first valid code.
|
|
2147
|
+
*
|
|
2148
|
+
* Activates the device and generates backup codes.
|
|
2149
|
+
*/
|
|
2150
|
+
static cfgTotpSetupConfirmCreate(options) {
|
|
2151
|
+
return (options.client ?? client).post({
|
|
2152
|
+
security: [
|
|
2153
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2154
|
+
{ scheme: "bearer", type: "http" },
|
|
2155
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2156
|
+
],
|
|
2157
|
+
url: "/cfg/totp/setup/confirm/",
|
|
2158
|
+
...options,
|
|
2159
|
+
headers: {
|
|
2160
|
+
"Content-Type": "application/json",
|
|
2161
|
+
...options.headers
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
};
|
|
2166
|
+
CfgTotpVerify = class {
|
|
2167
|
+
static {
|
|
2168
|
+
__name(this, "CfgTotpVerify");
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Verify TOTP code for 2FA session.
|
|
2172
|
+
*
|
|
2173
|
+
* Completes authentication and returns JWT tokens on success.
|
|
2174
|
+
*/
|
|
2175
|
+
static cfgTotpVerifyCreate(options) {
|
|
2176
|
+
return (options.client ?? client).post({
|
|
2177
|
+
security: [
|
|
2178
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2179
|
+
{ scheme: "bearer", type: "http" },
|
|
2180
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2181
|
+
],
|
|
2182
|
+
url: "/cfg/totp/verify/",
|
|
2183
|
+
...options,
|
|
2184
|
+
headers: {
|
|
2185
|
+
"Content-Type": "application/json",
|
|
2186
|
+
...options.headers
|
|
2187
|
+
}
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Verify backup recovery code for 2FA session.
|
|
2192
|
+
*
|
|
2193
|
+
* Alternative verification method when TOTP device unavailable.
|
|
2194
|
+
*/
|
|
2195
|
+
static cfgTotpVerifyBackupCreate(options) {
|
|
2196
|
+
return (options.client ?? client).post({
|
|
2197
|
+
security: [
|
|
2198
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
2199
|
+
{ scheme: "bearer", type: "http" },
|
|
2200
|
+
{ name: "Authorization", type: "apiKey" }
|
|
2201
|
+
],
|
|
2202
|
+
url: "/cfg/totp/verify/backup/",
|
|
2203
|
+
...options,
|
|
2204
|
+
headers: {
|
|
2205
|
+
"Content-Type": "application/json",
|
|
2206
|
+
...options.headers
|
|
2207
|
+
}
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
1414
2211
|
}
|
|
1415
|
-
};
|
|
2212
|
+
});
|
|
2213
|
+
|
|
2214
|
+
// src/hooks/index.ts
|
|
2215
|
+
var hooks_exports = {};
|
|
2216
|
+
__export(hooks_exports, {
|
|
2217
|
+
useApiKey: () => useApiKey
|
|
2218
|
+
});
|
|
2219
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
2220
|
+
|
|
2221
|
+
// src/hooks/useApiKey.ts
|
|
2222
|
+
var import_react = require("react");
|
|
2223
|
+
|
|
2224
|
+
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts
|
|
2225
|
+
var import_mutation = __toESM(require("swr/mutation"), 1);
|
|
2226
|
+
init_sdk_gen();
|
|
1416
2227
|
|
|
1417
2228
|
// src/_api/generated/_cfg_accounts/schemas/APIKeyRegenerate.ts
|
|
1418
2229
|
var import_zod = require("zod");
|
|
@@ -1470,6 +2281,7 @@ __name(useCfgAccountsApiKeyRegenerateCreate, "useCfgAccountsApiKeyRegenerateCrea
|
|
|
1470
2281
|
|
|
1471
2282
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts
|
|
1472
2283
|
var import_swr = __toESM(require("swr"), 1);
|
|
2284
|
+
init_sdk_gen();
|
|
1473
2285
|
|
|
1474
2286
|
// src/_api/generated/_cfg_accounts/schemas/APIKey.ts
|
|
1475
2287
|
var import_zod2 = require("zod");
|
|
@@ -1530,6 +2342,7 @@ __name(useCfgAccountsApiKeyRetrieve, "useCfgAccountsApiKeyRetrieve");
|
|
|
1530
2342
|
|
|
1531
2343
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRevealCreate.ts
|
|
1532
2344
|
var import_mutation2 = __toESM(require("swr/mutation"), 1);
|
|
2345
|
+
init_sdk_gen();
|
|
1533
2346
|
|
|
1534
2347
|
// src/_api/generated/_cfg_accounts/schemas/APIKeyReveal.ts
|
|
1535
2348
|
var import_zod3 = require("zod");
|
|
@@ -1588,6 +2401,7 @@ __name(useCfgAccountsApiKeyRevealCreate, "useCfgAccountsApiKeyRevealCreate");
|
|
|
1588
2401
|
|
|
1589
2402
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts
|
|
1590
2403
|
var import_mutation3 = __toESM(require("swr/mutation"), 1);
|
|
2404
|
+
init_sdk_gen();
|
|
1591
2405
|
|
|
1592
2406
|
// src/_api/generated/_cfg_accounts/schemas/APIKeyTestResult.ts
|
|
1593
2407
|
var import_zod4 = require("zod");
|