@djangocfg/api 2.1.139 → 2.1.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-server.cjs +2 -199
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +2 -199
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +11 -836
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +11 -836
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +40 -1077
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +209 -754
- package/dist/clients.d.ts +209 -754
- package/dist/clients.mjs +40 -1077
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +0 -1198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -1211
- package/dist/index.d.ts +229 -1211
- package/dist/index.mjs +0 -1198
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/auth/hooks/useAuthForm.ts +1 -1
- package/src/auth/hooks/useAuthGuard.ts +1 -2
- package/src/auth/hooks/useAutoAuth.ts +1 -2
- package/src/auth/hooks/useDeleteAccount.ts +1 -1
- package/src/auth/hooks/useGithubAuth.ts +1 -2
- package/src/auth/hooks/useTokenRefresh.ts +1 -0
- package/src/auth/hooks/useTwoFactor.ts +1 -2
- package/src/clients.ts +2 -12
- package/src/index.ts +0 -6
- package/src/generated/cfg_webpush/CLAUDE.md +0 -63
- package/src/generated/cfg_webpush/_utils/fetchers/index.ts +0 -29
- package/src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts +0 -211
- package/src/generated/cfg_webpush/_utils/hooks/index.ts +0 -29
- package/src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts +0 -79
- package/src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts +0 -22
- package/src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts +0 -20
- package/src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts +0 -20
- package/src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts +0 -21
- package/src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts +0 -19
- package/src/generated/cfg_webpush/_utils/schemas/index.ts +0 -24
- package/src/generated/cfg_webpush/api-instance.ts +0 -180
- package/src/generated/cfg_webpush/client.ts +0 -322
- package/src/generated/cfg_webpush/errors.ts +0 -117
- package/src/generated/cfg_webpush/http.ts +0 -110
- package/src/generated/cfg_webpush/index.ts +0 -275
- package/src/generated/cfg_webpush/logger.ts +0 -260
- package/src/generated/cfg_webpush/retry.ts +0 -176
- package/src/generated/cfg_webpush/schema.json +0 -302
- package/src/generated/cfg_webpush/storage.ts +0 -162
- package/src/generated/cfg_webpush/validation-events.ts +0 -134
- package/src/generated/cfg_webpush/webpush__web_push/client.ts +0 -45
- package/src/generated/cfg_webpush/webpush__web_push/index.ts +0 -3
- package/src/generated/cfg_webpush/webpush__web_push/models.ts +0 -65
- package/src/hooks/webpush.ts +0 -12
package/dist/clients.mjs
CHANGED
|
@@ -5148,1000 +5148,6 @@ var API3 = class {
|
|
|
5148
5148
|
}
|
|
5149
5149
|
};
|
|
5150
5150
|
|
|
5151
|
-
// src/generated/cfg_webpush/webpush__web_push/client.ts
|
|
5152
|
-
var WebPush = class {
|
|
5153
|
-
static {
|
|
5154
|
-
__name(this, "WebPush");
|
|
5155
|
-
}
|
|
5156
|
-
constructor(client) {
|
|
5157
|
-
this.client = client;
|
|
5158
|
-
}
|
|
5159
|
-
/**
|
|
5160
|
-
* Send push notification
|
|
5161
|
-
*
|
|
5162
|
-
* Send push notification to all active subscriptions for the authenticated
|
|
5163
|
-
* user.
|
|
5164
|
-
*/
|
|
5165
|
-
async webpushSendCreate(data) {
|
|
5166
|
-
const response = await this.client.request("POST", "/cfg/webpush/send/", { body: data });
|
|
5167
|
-
return response;
|
|
5168
|
-
}
|
|
5169
|
-
/**
|
|
5170
|
-
* Subscribe to push notifications
|
|
5171
|
-
*
|
|
5172
|
-
* Save push subscription from browser for the authenticated user.
|
|
5173
|
-
*/
|
|
5174
|
-
async webpushSubscribeCreate(data) {
|
|
5175
|
-
const response = await this.client.request("POST", "/cfg/webpush/subscribe/", { body: data });
|
|
5176
|
-
return response;
|
|
5177
|
-
}
|
|
5178
|
-
/**
|
|
5179
|
-
* Get VAPID public key
|
|
5180
|
-
*
|
|
5181
|
-
* Get VAPID public key for client subscription.
|
|
5182
|
-
*/
|
|
5183
|
-
async webpushVapidRetrieve() {
|
|
5184
|
-
const response = await this.client.request("GET", "/cfg/webpush/vapid/");
|
|
5185
|
-
return response;
|
|
5186
|
-
}
|
|
5187
|
-
};
|
|
5188
|
-
|
|
5189
|
-
// src/generated/cfg_webpush/http.ts
|
|
5190
|
-
var FetchAdapter4 = class {
|
|
5191
|
-
static {
|
|
5192
|
-
__name(this, "FetchAdapter");
|
|
5193
|
-
}
|
|
5194
|
-
async request(request) {
|
|
5195
|
-
const { method, url, headers, body, params, formData, binaryBody } = request;
|
|
5196
|
-
let finalUrl = url;
|
|
5197
|
-
if (params) {
|
|
5198
|
-
const searchParams = new URLSearchParams();
|
|
5199
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
5200
|
-
if (value !== null && value !== void 0) {
|
|
5201
|
-
searchParams.append(key, String(value));
|
|
5202
|
-
}
|
|
5203
|
-
});
|
|
5204
|
-
const queryString = searchParams.toString();
|
|
5205
|
-
if (queryString) {
|
|
5206
|
-
finalUrl = url.includes("?") ? `${url}&${queryString}` : `${url}?${queryString}`;
|
|
5207
|
-
}
|
|
5208
|
-
}
|
|
5209
|
-
const finalHeaders = { ...headers };
|
|
5210
|
-
let requestBody;
|
|
5211
|
-
if (formData) {
|
|
5212
|
-
requestBody = formData;
|
|
5213
|
-
} else if (binaryBody) {
|
|
5214
|
-
finalHeaders["Content-Type"] = "application/octet-stream";
|
|
5215
|
-
requestBody = binaryBody;
|
|
5216
|
-
} else if (body) {
|
|
5217
|
-
finalHeaders["Content-Type"] = "application/json";
|
|
5218
|
-
requestBody = JSON.stringify(body);
|
|
5219
|
-
}
|
|
5220
|
-
const response = await fetch(finalUrl, {
|
|
5221
|
-
method,
|
|
5222
|
-
headers: finalHeaders,
|
|
5223
|
-
body: requestBody,
|
|
5224
|
-
credentials: "include"
|
|
5225
|
-
// Include Django session cookies
|
|
5226
|
-
});
|
|
5227
|
-
let data = null;
|
|
5228
|
-
const contentType = response.headers.get("content-type");
|
|
5229
|
-
if (response.status !== 204 && contentType?.includes("application/json")) {
|
|
5230
|
-
data = await response.json();
|
|
5231
|
-
} else if (response.status !== 204) {
|
|
5232
|
-
data = await response.text();
|
|
5233
|
-
}
|
|
5234
|
-
const responseHeaders = {};
|
|
5235
|
-
response.headers.forEach((value, key) => {
|
|
5236
|
-
responseHeaders[key] = value;
|
|
5237
|
-
});
|
|
5238
|
-
return {
|
|
5239
|
-
data,
|
|
5240
|
-
status: response.status,
|
|
5241
|
-
statusText: response.statusText,
|
|
5242
|
-
headers: responseHeaders
|
|
5243
|
-
};
|
|
5244
|
-
}
|
|
5245
|
-
};
|
|
5246
|
-
|
|
5247
|
-
// src/generated/cfg_webpush/errors.ts
|
|
5248
|
-
var APIError4 = class extends Error {
|
|
5249
|
-
constructor(statusCode, statusText, response, url, message) {
|
|
5250
|
-
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
5251
|
-
this.statusCode = statusCode;
|
|
5252
|
-
this.statusText = statusText;
|
|
5253
|
-
this.response = response;
|
|
5254
|
-
this.url = url;
|
|
5255
|
-
this.name = "APIError";
|
|
5256
|
-
}
|
|
5257
|
-
static {
|
|
5258
|
-
__name(this, "APIError");
|
|
5259
|
-
}
|
|
5260
|
-
/**
|
|
5261
|
-
* Get error details from response.
|
|
5262
|
-
* DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
|
|
5263
|
-
*/
|
|
5264
|
-
get details() {
|
|
5265
|
-
if (typeof this.response === "object" && this.response !== null) {
|
|
5266
|
-
return this.response;
|
|
5267
|
-
}
|
|
5268
|
-
return null;
|
|
5269
|
-
}
|
|
5270
|
-
/**
|
|
5271
|
-
* Get field-specific validation errors from DRF.
|
|
5272
|
-
* Returns: { "field_name": ["error1", "error2"], ... }
|
|
5273
|
-
*/
|
|
5274
|
-
get fieldErrors() {
|
|
5275
|
-
const details = this.details;
|
|
5276
|
-
if (!details) return null;
|
|
5277
|
-
const fieldErrors = {};
|
|
5278
|
-
for (const [key, value] of Object.entries(details)) {
|
|
5279
|
-
if (Array.isArray(value)) {
|
|
5280
|
-
fieldErrors[key] = value;
|
|
5281
|
-
}
|
|
5282
|
-
}
|
|
5283
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
5284
|
-
}
|
|
5285
|
-
/**
|
|
5286
|
-
* Get single error message from DRF.
|
|
5287
|
-
* Checks for "detail", "message", or first field error.
|
|
5288
|
-
*/
|
|
5289
|
-
get errorMessage() {
|
|
5290
|
-
const details = this.details;
|
|
5291
|
-
if (!details) return this.message;
|
|
5292
|
-
if (details.detail) {
|
|
5293
|
-
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
5294
|
-
}
|
|
5295
|
-
if (details.message) {
|
|
5296
|
-
return String(details.message);
|
|
5297
|
-
}
|
|
5298
|
-
const fieldErrors = this.fieldErrors;
|
|
5299
|
-
if (fieldErrors) {
|
|
5300
|
-
const firstField = Object.keys(fieldErrors)[0];
|
|
5301
|
-
if (firstField) {
|
|
5302
|
-
return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
5303
|
-
}
|
|
5304
|
-
}
|
|
5305
|
-
return this.message;
|
|
5306
|
-
}
|
|
5307
|
-
// Helper methods for common HTTP status codes
|
|
5308
|
-
get isValidationError() {
|
|
5309
|
-
return this.statusCode === 400;
|
|
5310
|
-
}
|
|
5311
|
-
get isAuthError() {
|
|
5312
|
-
return this.statusCode === 401;
|
|
5313
|
-
}
|
|
5314
|
-
get isPermissionError() {
|
|
5315
|
-
return this.statusCode === 403;
|
|
5316
|
-
}
|
|
5317
|
-
get isNotFoundError() {
|
|
5318
|
-
return this.statusCode === 404;
|
|
5319
|
-
}
|
|
5320
|
-
get isServerError() {
|
|
5321
|
-
return this.statusCode >= 500 && this.statusCode < 600;
|
|
5322
|
-
}
|
|
5323
|
-
};
|
|
5324
|
-
var NetworkError4 = class extends Error {
|
|
5325
|
-
constructor(message, url, originalError) {
|
|
5326
|
-
super(message);
|
|
5327
|
-
this.url = url;
|
|
5328
|
-
this.originalError = originalError;
|
|
5329
|
-
this.name = "NetworkError";
|
|
5330
|
-
}
|
|
5331
|
-
static {
|
|
5332
|
-
__name(this, "NetworkError");
|
|
5333
|
-
}
|
|
5334
|
-
};
|
|
5335
|
-
|
|
5336
|
-
// src/generated/cfg_webpush/logger.ts
|
|
5337
|
-
import { createConsola as createConsola4 } from "consola";
|
|
5338
|
-
var DEFAULT_CONFIG4 = {
|
|
5339
|
-
enabled: process.env.NODE_ENV !== "production",
|
|
5340
|
-
logRequests: true,
|
|
5341
|
-
logResponses: true,
|
|
5342
|
-
logErrors: true,
|
|
5343
|
-
logBodies: true,
|
|
5344
|
-
logHeaders: false
|
|
5345
|
-
};
|
|
5346
|
-
var SENSITIVE_HEADERS4 = [
|
|
5347
|
-
"authorization",
|
|
5348
|
-
"cookie",
|
|
5349
|
-
"set-cookie",
|
|
5350
|
-
"x-api-key",
|
|
5351
|
-
"x-csrf-token"
|
|
5352
|
-
];
|
|
5353
|
-
var APILogger4 = class {
|
|
5354
|
-
static {
|
|
5355
|
-
__name(this, "APILogger");
|
|
5356
|
-
}
|
|
5357
|
-
constructor(config = {}) {
|
|
5358
|
-
this.config = { ...DEFAULT_CONFIG4, ...config };
|
|
5359
|
-
this.consola = config.consola || createConsola4({
|
|
5360
|
-
level: this.config.enabled ? 4 : 0
|
|
5361
|
-
});
|
|
5362
|
-
}
|
|
5363
|
-
/**
|
|
5364
|
-
* Enable logging
|
|
5365
|
-
*/
|
|
5366
|
-
enable() {
|
|
5367
|
-
this.config.enabled = true;
|
|
5368
|
-
}
|
|
5369
|
-
/**
|
|
5370
|
-
* Disable logging
|
|
5371
|
-
*/
|
|
5372
|
-
disable() {
|
|
5373
|
-
this.config.enabled = false;
|
|
5374
|
-
}
|
|
5375
|
-
/**
|
|
5376
|
-
* Update configuration
|
|
5377
|
-
*/
|
|
5378
|
-
setConfig(config) {
|
|
5379
|
-
this.config = { ...this.config, ...config };
|
|
5380
|
-
}
|
|
5381
|
-
/**
|
|
5382
|
-
* Filter sensitive headers
|
|
5383
|
-
*/
|
|
5384
|
-
filterHeaders(headers) {
|
|
5385
|
-
if (!headers) return {};
|
|
5386
|
-
const filtered = {};
|
|
5387
|
-
Object.keys(headers).forEach((key) => {
|
|
5388
|
-
const lowerKey = key.toLowerCase();
|
|
5389
|
-
if (SENSITIVE_HEADERS4.includes(lowerKey)) {
|
|
5390
|
-
filtered[key] = "***";
|
|
5391
|
-
} else {
|
|
5392
|
-
filtered[key] = headers[key] || "";
|
|
5393
|
-
}
|
|
5394
|
-
});
|
|
5395
|
-
return filtered;
|
|
5396
|
-
}
|
|
5397
|
-
/**
|
|
5398
|
-
* Log request
|
|
5399
|
-
*/
|
|
5400
|
-
logRequest(request) {
|
|
5401
|
-
if (!this.config.enabled || !this.config.logRequests) return;
|
|
5402
|
-
const { method, url, headers, body } = request;
|
|
5403
|
-
this.consola.start(`${method} ${url}`);
|
|
5404
|
-
if (this.config.logHeaders && headers) {
|
|
5405
|
-
this.consola.debug("Headers:", this.filterHeaders(headers));
|
|
5406
|
-
}
|
|
5407
|
-
if (this.config.logBodies && body) {
|
|
5408
|
-
this.consola.debug("Body:", body);
|
|
5409
|
-
}
|
|
5410
|
-
}
|
|
5411
|
-
/**
|
|
5412
|
-
* Log response
|
|
5413
|
-
*/
|
|
5414
|
-
logResponse(request, response) {
|
|
5415
|
-
if (!this.config.enabled || !this.config.logResponses) return;
|
|
5416
|
-
const { method, url } = request;
|
|
5417
|
-
const { status, statusText, data, duration } = response;
|
|
5418
|
-
const statusColor = status >= 500 ? "red" : status >= 400 ? "yellow" : status >= 300 ? "cyan" : "green";
|
|
5419
|
-
this.consola.success(
|
|
5420
|
-
`${method} ${url} ${status} ${statusText} (${duration}ms)`
|
|
5421
|
-
);
|
|
5422
|
-
if (this.config.logBodies && data) {
|
|
5423
|
-
this.consola.debug("Response:", data);
|
|
5424
|
-
}
|
|
5425
|
-
}
|
|
5426
|
-
/**
|
|
5427
|
-
* Log error
|
|
5428
|
-
*/
|
|
5429
|
-
logError(request, error) {
|
|
5430
|
-
if (!this.config.enabled || !this.config.logErrors) return;
|
|
5431
|
-
const { method, url } = request;
|
|
5432
|
-
const { message, statusCode, fieldErrors, duration } = error;
|
|
5433
|
-
this.consola.error(
|
|
5434
|
-
`${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
|
|
5435
|
-
);
|
|
5436
|
-
this.consola.error("Message:", message);
|
|
5437
|
-
if (fieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
5438
|
-
this.consola.error("Field Errors:");
|
|
5439
|
-
Object.entries(fieldErrors).forEach(([field, errors]) => {
|
|
5440
|
-
errors.forEach((err) => {
|
|
5441
|
-
this.consola.error(` \u2022 ${field}: ${err}`);
|
|
5442
|
-
});
|
|
5443
|
-
});
|
|
5444
|
-
}
|
|
5445
|
-
}
|
|
5446
|
-
/**
|
|
5447
|
-
* Log general info
|
|
5448
|
-
*/
|
|
5449
|
-
info(message, ...args) {
|
|
5450
|
-
if (!this.config.enabled) return;
|
|
5451
|
-
this.consola.info(message, ...args);
|
|
5452
|
-
}
|
|
5453
|
-
/**
|
|
5454
|
-
* Log warning
|
|
5455
|
-
*/
|
|
5456
|
-
warn(message, ...args) {
|
|
5457
|
-
if (!this.config.enabled) return;
|
|
5458
|
-
this.consola.warn(message, ...args);
|
|
5459
|
-
}
|
|
5460
|
-
/**
|
|
5461
|
-
* Log error
|
|
5462
|
-
*/
|
|
5463
|
-
error(message, ...args) {
|
|
5464
|
-
if (!this.config.enabled) return;
|
|
5465
|
-
this.consola.error(message, ...args);
|
|
5466
|
-
}
|
|
5467
|
-
/**
|
|
5468
|
-
* Log debug
|
|
5469
|
-
*/
|
|
5470
|
-
debug(message, ...args) {
|
|
5471
|
-
if (!this.config.enabled) return;
|
|
5472
|
-
this.consola.debug(message, ...args);
|
|
5473
|
-
}
|
|
5474
|
-
/**
|
|
5475
|
-
* Log success
|
|
5476
|
-
*/
|
|
5477
|
-
success(message, ...args) {
|
|
5478
|
-
if (!this.config.enabled) return;
|
|
5479
|
-
this.consola.success(message, ...args);
|
|
5480
|
-
}
|
|
5481
|
-
/**
|
|
5482
|
-
* Create a sub-logger with prefix
|
|
5483
|
-
*/
|
|
5484
|
-
withTag(tag) {
|
|
5485
|
-
return this.consola.withTag(tag);
|
|
5486
|
-
}
|
|
5487
|
-
};
|
|
5488
|
-
var defaultLogger4 = new APILogger4();
|
|
5489
|
-
|
|
5490
|
-
// src/generated/cfg_webpush/retry.ts
|
|
5491
|
-
import pRetry4, { AbortError as AbortError4 } from "p-retry";
|
|
5492
|
-
var DEFAULT_RETRY_CONFIG4 = {
|
|
5493
|
-
retries: 3,
|
|
5494
|
-
factor: 2,
|
|
5495
|
-
minTimeout: 1e3,
|
|
5496
|
-
maxTimeout: 6e4,
|
|
5497
|
-
randomize: true,
|
|
5498
|
-
onFailedAttempt: /* @__PURE__ */ __name(() => {
|
|
5499
|
-
}, "onFailedAttempt")
|
|
5500
|
-
};
|
|
5501
|
-
function shouldRetry4(error) {
|
|
5502
|
-
if (error instanceof NetworkError4) {
|
|
5503
|
-
return true;
|
|
5504
|
-
}
|
|
5505
|
-
if (error instanceof APIError4) {
|
|
5506
|
-
const status = error.statusCode;
|
|
5507
|
-
if (status >= 500 && status < 600) {
|
|
5508
|
-
return true;
|
|
5509
|
-
}
|
|
5510
|
-
if (status === 429) {
|
|
5511
|
-
return true;
|
|
5512
|
-
}
|
|
5513
|
-
return false;
|
|
5514
|
-
}
|
|
5515
|
-
return true;
|
|
5516
|
-
}
|
|
5517
|
-
__name(shouldRetry4, "shouldRetry");
|
|
5518
|
-
async function withRetry4(fn, config) {
|
|
5519
|
-
const finalConfig = { ...DEFAULT_RETRY_CONFIG4, ...config };
|
|
5520
|
-
return pRetry4(
|
|
5521
|
-
async () => {
|
|
5522
|
-
try {
|
|
5523
|
-
return await fn();
|
|
5524
|
-
} catch (error) {
|
|
5525
|
-
if (!shouldRetry4(error)) {
|
|
5526
|
-
throw new AbortError4(error);
|
|
5527
|
-
}
|
|
5528
|
-
throw error;
|
|
5529
|
-
}
|
|
5530
|
-
},
|
|
5531
|
-
{
|
|
5532
|
-
retries: finalConfig.retries,
|
|
5533
|
-
factor: finalConfig.factor,
|
|
5534
|
-
minTimeout: finalConfig.minTimeout,
|
|
5535
|
-
maxTimeout: finalConfig.maxTimeout,
|
|
5536
|
-
randomize: finalConfig.randomize,
|
|
5537
|
-
onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {
|
|
5538
|
-
const pRetryError = error;
|
|
5539
|
-
finalConfig.onFailedAttempt({
|
|
5540
|
-
error: pRetryError,
|
|
5541
|
-
attemptNumber: pRetryError.attemptNumber,
|
|
5542
|
-
retriesLeft: pRetryError.retriesLeft
|
|
5543
|
-
});
|
|
5544
|
-
} : void 0
|
|
5545
|
-
}
|
|
5546
|
-
);
|
|
5547
|
-
}
|
|
5548
|
-
__name(withRetry4, "withRetry");
|
|
5549
|
-
|
|
5550
|
-
// src/generated/cfg_webpush/client.ts
|
|
5551
|
-
var APIClient4 = class {
|
|
5552
|
-
constructor(baseUrl, options) {
|
|
5553
|
-
this.logger = null;
|
|
5554
|
-
this.retryConfig = null;
|
|
5555
|
-
this.tokenGetter = null;
|
|
5556
|
-
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
5557
|
-
this.httpClient = options?.httpClient || new FetchAdapter4();
|
|
5558
|
-
this.tokenGetter = options?.tokenGetter || null;
|
|
5559
|
-
if (options?.loggerConfig !== void 0) {
|
|
5560
|
-
this.logger = new APILogger4(options.loggerConfig);
|
|
5561
|
-
}
|
|
5562
|
-
if (options?.retryConfig !== void 0) {
|
|
5563
|
-
this.retryConfig = options.retryConfig;
|
|
5564
|
-
}
|
|
5565
|
-
this.web_push = new WebPush(this);
|
|
5566
|
-
}
|
|
5567
|
-
static {
|
|
5568
|
-
__name(this, "APIClient");
|
|
5569
|
-
}
|
|
5570
|
-
/**
|
|
5571
|
-
* Get CSRF token from cookies (for SessionAuthentication).
|
|
5572
|
-
*
|
|
5573
|
-
* Returns null if cookie doesn't exist (JWT-only auth).
|
|
5574
|
-
*/
|
|
5575
|
-
getCsrfToken() {
|
|
5576
|
-
const name = "csrftoken";
|
|
5577
|
-
const value = `; ${document.cookie}`;
|
|
5578
|
-
const parts = value.split(`; ${name}=`);
|
|
5579
|
-
if (parts.length === 2) {
|
|
5580
|
-
return parts.pop()?.split(";").shift() || null;
|
|
5581
|
-
}
|
|
5582
|
-
return null;
|
|
5583
|
-
}
|
|
5584
|
-
/**
|
|
5585
|
-
* Get the base URL for building streaming/download URLs.
|
|
5586
|
-
*/
|
|
5587
|
-
getBaseUrl() {
|
|
5588
|
-
return this.baseUrl;
|
|
5589
|
-
}
|
|
5590
|
-
/**
|
|
5591
|
-
* Get JWT token for URL authentication (used in streaming endpoints).
|
|
5592
|
-
* Returns null if no token getter is configured or no token is available.
|
|
5593
|
-
*/
|
|
5594
|
-
getToken() {
|
|
5595
|
-
return this.tokenGetter ? this.tokenGetter() : null;
|
|
5596
|
-
}
|
|
5597
|
-
/**
|
|
5598
|
-
* Make HTTP request with Django CSRF and session handling.
|
|
5599
|
-
* Automatically retries on network errors and 5xx server errors.
|
|
5600
|
-
*/
|
|
5601
|
-
async request(method, path, options) {
|
|
5602
|
-
if (this.retryConfig) {
|
|
5603
|
-
return withRetry4(() => this._makeRequest(method, path, options), {
|
|
5604
|
-
...this.retryConfig,
|
|
5605
|
-
onFailedAttempt: /* @__PURE__ */ __name((info) => {
|
|
5606
|
-
if (this.logger) {
|
|
5607
|
-
this.logger.warn(
|
|
5608
|
-
`Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} for ${method} ${path}: ${info.error.message}`
|
|
5609
|
-
);
|
|
5610
|
-
}
|
|
5611
|
-
this.retryConfig?.onFailedAttempt?.(info);
|
|
5612
|
-
}, "onFailedAttempt")
|
|
5613
|
-
});
|
|
5614
|
-
}
|
|
5615
|
-
return this._makeRequest(method, path, options);
|
|
5616
|
-
}
|
|
5617
|
-
/**
|
|
5618
|
-
* Internal request method (without retry wrapper).
|
|
5619
|
-
* Used by request() method with optional retry logic.
|
|
5620
|
-
*/
|
|
5621
|
-
async _makeRequest(method, path, options) {
|
|
5622
|
-
const url = this.baseUrl ? `${this.baseUrl}${path}` : path;
|
|
5623
|
-
const startTime = Date.now();
|
|
5624
|
-
const headers = {
|
|
5625
|
-
...options?.headers || {}
|
|
5626
|
-
};
|
|
5627
|
-
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
5628
|
-
headers["Content-Type"] = "application/json";
|
|
5629
|
-
}
|
|
5630
|
-
if (this.logger) {
|
|
5631
|
-
this.logger.logRequest({
|
|
5632
|
-
method,
|
|
5633
|
-
url,
|
|
5634
|
-
headers,
|
|
5635
|
-
body: options?.formData || options?.body,
|
|
5636
|
-
timestamp: startTime
|
|
5637
|
-
});
|
|
5638
|
-
}
|
|
5639
|
-
try {
|
|
5640
|
-
const response = await this.httpClient.request({
|
|
5641
|
-
method,
|
|
5642
|
-
url,
|
|
5643
|
-
headers,
|
|
5644
|
-
params: options?.params,
|
|
5645
|
-
body: options?.body,
|
|
5646
|
-
formData: options?.formData,
|
|
5647
|
-
binaryBody: options?.binaryBody
|
|
5648
|
-
});
|
|
5649
|
-
const duration = Date.now() - startTime;
|
|
5650
|
-
if (response.status >= 400) {
|
|
5651
|
-
const error = new APIError4(
|
|
5652
|
-
response.status,
|
|
5653
|
-
response.statusText,
|
|
5654
|
-
response.data,
|
|
5655
|
-
url
|
|
5656
|
-
);
|
|
5657
|
-
if (this.logger) {
|
|
5658
|
-
this.logger.logError(
|
|
5659
|
-
{
|
|
5660
|
-
method,
|
|
5661
|
-
url,
|
|
5662
|
-
headers,
|
|
5663
|
-
body: options?.formData || options?.body,
|
|
5664
|
-
timestamp: startTime
|
|
5665
|
-
},
|
|
5666
|
-
{
|
|
5667
|
-
message: error.message,
|
|
5668
|
-
statusCode: response.status,
|
|
5669
|
-
duration,
|
|
5670
|
-
timestamp: Date.now()
|
|
5671
|
-
}
|
|
5672
|
-
);
|
|
5673
|
-
}
|
|
5674
|
-
throw error;
|
|
5675
|
-
}
|
|
5676
|
-
if (this.logger) {
|
|
5677
|
-
this.logger.logResponse(
|
|
5678
|
-
{
|
|
5679
|
-
method,
|
|
5680
|
-
url,
|
|
5681
|
-
headers,
|
|
5682
|
-
body: options?.formData || options?.body,
|
|
5683
|
-
timestamp: startTime
|
|
5684
|
-
},
|
|
5685
|
-
{
|
|
5686
|
-
status: response.status,
|
|
5687
|
-
statusText: response.statusText,
|
|
5688
|
-
data: response.data,
|
|
5689
|
-
duration,
|
|
5690
|
-
timestamp: Date.now()
|
|
5691
|
-
}
|
|
5692
|
-
);
|
|
5693
|
-
}
|
|
5694
|
-
return response.data;
|
|
5695
|
-
} catch (error) {
|
|
5696
|
-
const duration = Date.now() - startTime;
|
|
5697
|
-
if (error instanceof APIError4) {
|
|
5698
|
-
throw error;
|
|
5699
|
-
}
|
|
5700
|
-
const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
|
|
5701
|
-
if (this.logger) {
|
|
5702
|
-
if (isCORSError) {
|
|
5703
|
-
this.logger.error(`\u{1F6AB} CORS Error: ${method} ${url}`);
|
|
5704
|
-
this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
|
|
5705
|
-
this.logger.error(` \u2192 Configure security_domains parameter on the server`);
|
|
5706
|
-
} else {
|
|
5707
|
-
this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
|
|
5708
|
-
this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
|
|
5709
|
-
}
|
|
5710
|
-
}
|
|
5711
|
-
if (typeof window !== "undefined") {
|
|
5712
|
-
try {
|
|
5713
|
-
if (isCORSError) {
|
|
5714
|
-
window.dispatchEvent(new CustomEvent("cors-error", {
|
|
5715
|
-
detail: {
|
|
5716
|
-
url,
|
|
5717
|
-
method,
|
|
5718
|
-
error: error instanceof Error ? error.message : String(error),
|
|
5719
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
5720
|
-
},
|
|
5721
|
-
bubbles: true,
|
|
5722
|
-
cancelable: false
|
|
5723
|
-
}));
|
|
5724
|
-
} else {
|
|
5725
|
-
window.dispatchEvent(new CustomEvent("network-error", {
|
|
5726
|
-
detail: {
|
|
5727
|
-
url,
|
|
5728
|
-
method,
|
|
5729
|
-
error: error instanceof Error ? error.message : String(error),
|
|
5730
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
5731
|
-
},
|
|
5732
|
-
bubbles: true,
|
|
5733
|
-
cancelable: false
|
|
5734
|
-
}));
|
|
5735
|
-
}
|
|
5736
|
-
} catch (eventError) {
|
|
5737
|
-
}
|
|
5738
|
-
}
|
|
5739
|
-
const networkError = error instanceof Error ? new NetworkError4(error.message, url, error) : new NetworkError4("Unknown error", url);
|
|
5740
|
-
if (this.logger) {
|
|
5741
|
-
this.logger.logError(
|
|
5742
|
-
{
|
|
5743
|
-
method,
|
|
5744
|
-
url,
|
|
5745
|
-
headers,
|
|
5746
|
-
body: options?.formData || options?.body,
|
|
5747
|
-
timestamp: startTime
|
|
5748
|
-
},
|
|
5749
|
-
{
|
|
5750
|
-
message: networkError.message,
|
|
5751
|
-
duration,
|
|
5752
|
-
timestamp: Date.now()
|
|
5753
|
-
}
|
|
5754
|
-
);
|
|
5755
|
-
}
|
|
5756
|
-
throw networkError;
|
|
5757
|
-
}
|
|
5758
|
-
}
|
|
5759
|
-
};
|
|
5760
|
-
|
|
5761
|
-
// src/generated/cfg_webpush/storage.ts
|
|
5762
|
-
var LocalStorageAdapter4 = class {
|
|
5763
|
-
static {
|
|
5764
|
-
__name(this, "LocalStorageAdapter");
|
|
5765
|
-
}
|
|
5766
|
-
constructor(logger) {
|
|
5767
|
-
this.logger = logger;
|
|
5768
|
-
}
|
|
5769
|
-
getItem(key) {
|
|
5770
|
-
try {
|
|
5771
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
5772
|
-
const value = localStorage.getItem(key);
|
|
5773
|
-
this.logger?.debug(`LocalStorage.getItem("${key}"): ${value ? "found" : "not found"}`);
|
|
5774
|
-
return value;
|
|
5775
|
-
}
|
|
5776
|
-
this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
|
|
5777
|
-
} catch (error) {
|
|
5778
|
-
this.logger?.error("LocalStorage.getItem failed:", error);
|
|
5779
|
-
}
|
|
5780
|
-
return null;
|
|
5781
|
-
}
|
|
5782
|
-
setItem(key, value) {
|
|
5783
|
-
try {
|
|
5784
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
5785
|
-
localStorage.setItem(key, value);
|
|
5786
|
-
this.logger?.debug(`LocalStorage.setItem("${key}"): success`);
|
|
5787
|
-
} else {
|
|
5788
|
-
this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
|
|
5789
|
-
}
|
|
5790
|
-
} catch (error) {
|
|
5791
|
-
this.logger?.error("LocalStorage.setItem failed:", error);
|
|
5792
|
-
}
|
|
5793
|
-
}
|
|
5794
|
-
removeItem(key) {
|
|
5795
|
-
try {
|
|
5796
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
5797
|
-
localStorage.removeItem(key);
|
|
5798
|
-
this.logger?.debug(`LocalStorage.removeItem("${key}"): success`);
|
|
5799
|
-
} else {
|
|
5800
|
-
this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
|
|
5801
|
-
}
|
|
5802
|
-
} catch (error) {
|
|
5803
|
-
this.logger?.error("LocalStorage.removeItem failed:", error);
|
|
5804
|
-
}
|
|
5805
|
-
}
|
|
5806
|
-
};
|
|
5807
|
-
|
|
5808
|
-
// src/generated/cfg_webpush/_utils/schemas/index.ts
|
|
5809
|
-
var schemas_exports4 = {};
|
|
5810
|
-
__export(schemas_exports4, {
|
|
5811
|
-
SendPushRequestRequestSchema: () => SendPushRequestRequestSchema,
|
|
5812
|
-
SendPushResponseSchema: () => SendPushResponseSchema,
|
|
5813
|
-
SubscribeRequestRequestSchema: () => SubscribeRequestRequestSchema,
|
|
5814
|
-
SubscribeResponseSchema: () => SubscribeResponseSchema,
|
|
5815
|
-
VapidPublicKeyResponseSchema: () => VapidPublicKeyResponseSchema
|
|
5816
|
-
});
|
|
5817
|
-
|
|
5818
|
-
// src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
|
|
5819
|
-
import { z as z72 } from "zod";
|
|
5820
|
-
var SendPushRequestRequestSchema = z72.object({
|
|
5821
|
-
title: z72.string().min(1).max(255),
|
|
5822
|
-
body: z72.string().min(1),
|
|
5823
|
-
icon: z72.union([z72.url(), z72.literal("")]).nullable().optional(),
|
|
5824
|
-
url: z72.union([z72.url(), z72.literal("")]).nullable().optional()
|
|
5825
|
-
});
|
|
5826
|
-
|
|
5827
|
-
// src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
|
|
5828
|
-
import { z as z73 } from "zod";
|
|
5829
|
-
var SendPushResponseSchema = z73.object({
|
|
5830
|
-
success: z73.boolean(),
|
|
5831
|
-
sent_to: z73.int()
|
|
5832
|
-
});
|
|
5833
|
-
|
|
5834
|
-
// src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
|
|
5835
|
-
import { z as z74 } from "zod";
|
|
5836
|
-
var SubscribeRequestRequestSchema = z74.object({
|
|
5837
|
-
endpoint: z74.union([z74.url(), z74.literal("")]),
|
|
5838
|
-
keys: z74.record(z74.string(), z74.string().min(1))
|
|
5839
|
-
});
|
|
5840
|
-
|
|
5841
|
-
// src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
|
|
5842
|
-
import { z as z75 } from "zod";
|
|
5843
|
-
var SubscribeResponseSchema = z75.object({
|
|
5844
|
-
success: z75.boolean(),
|
|
5845
|
-
subscription_id: z75.int(),
|
|
5846
|
-
created: z75.boolean()
|
|
5847
|
-
});
|
|
5848
|
-
|
|
5849
|
-
// src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
|
|
5850
|
-
import { z as z76 } from "zod";
|
|
5851
|
-
var VapidPublicKeyResponseSchema = z76.object({
|
|
5852
|
-
publicKey: z76.string()
|
|
5853
|
-
});
|
|
5854
|
-
|
|
5855
|
-
// src/generated/cfg_webpush/_utils/fetchers/index.ts
|
|
5856
|
-
var fetchers_exports4 = {};
|
|
5857
|
-
__export(fetchers_exports4, {
|
|
5858
|
-
createWebpushSendCreate: () => createWebpushSendCreate,
|
|
5859
|
-
createWebpushSubscribeCreate: () => createWebpushSubscribeCreate,
|
|
5860
|
-
getWebpushVapidRetrieve: () => getWebpushVapidRetrieve
|
|
5861
|
-
});
|
|
5862
|
-
|
|
5863
|
-
// src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
|
|
5864
|
-
import { consola as consola13 } from "consola";
|
|
5865
|
-
|
|
5866
|
-
// src/generated/cfg_webpush/api-instance.ts
|
|
5867
|
-
var globalAPI4 = null;
|
|
5868
|
-
var autoConfigAttempted4 = false;
|
|
5869
|
-
function tryAutoConfigureFromEnv4() {
|
|
5870
|
-
if (autoConfigAttempted4) return;
|
|
5871
|
-
autoConfigAttempted4 = true;
|
|
5872
|
-
if (globalAPI4) return;
|
|
5873
|
-
if (typeof process === "undefined" || !process.env) return;
|
|
5874
|
-
const baseUrl = process.env.NEXT_PUBLIC_API_URL || process.env.VITE_API_URL || process.env.REACT_APP_API_URL || process.env.API_URL;
|
|
5875
|
-
if (baseUrl) {
|
|
5876
|
-
globalAPI4 = new API4(baseUrl);
|
|
5877
|
-
}
|
|
5878
|
-
}
|
|
5879
|
-
__name(tryAutoConfigureFromEnv4, "tryAutoConfigureFromEnv");
|
|
5880
|
-
function getAPIInstance4() {
|
|
5881
|
-
tryAutoConfigureFromEnv4();
|
|
5882
|
-
if (!globalAPI4) {
|
|
5883
|
-
throw new Error(
|
|
5884
|
-
'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\n\nExample:\n import { configureAPI } from "./api-instance"\n configureAPI({ baseUrl: "https://api.example.com" })\n\nOr set environment variable: NEXT_PUBLIC_API_URL, VITE_API_URL, or REACT_APP_API_URL'
|
|
5885
|
-
);
|
|
5886
|
-
}
|
|
5887
|
-
return globalAPI4;
|
|
5888
|
-
}
|
|
5889
|
-
__name(getAPIInstance4, "getAPIInstance");
|
|
5890
|
-
|
|
5891
|
-
// src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
|
|
5892
|
-
async function createWebpushSendCreate(data, client) {
|
|
5893
|
-
const api = client || getAPIInstance4();
|
|
5894
|
-
const response = await api.web_push.webpushSendCreate(data);
|
|
5895
|
-
try {
|
|
5896
|
-
return SendPushResponseSchema.parse(response);
|
|
5897
|
-
} catch (error) {
|
|
5898
|
-
consola13.error("\u274C Zod Validation Failed");
|
|
5899
|
-
consola13.box(`createWebpushSendCreate
|
|
5900
|
-
Path: /cfg/webpush/send/
|
|
5901
|
-
Method: POST`);
|
|
5902
|
-
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
5903
|
-
consola13.error("Validation Issues:");
|
|
5904
|
-
error.issues.forEach((issue, index) => {
|
|
5905
|
-
consola13.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
5906
|
-
consola13.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
5907
|
-
if (issue.expected) consola13.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
5908
|
-
if (issue.received) consola13.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
5909
|
-
});
|
|
5910
|
-
}
|
|
5911
|
-
consola13.error("Response data:", response);
|
|
5912
|
-
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
5913
|
-
try {
|
|
5914
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
5915
|
-
detail: {
|
|
5916
|
-
operation: "createWebpushSendCreate",
|
|
5917
|
-
path: "/cfg/webpush/send/",
|
|
5918
|
-
method: "POST",
|
|
5919
|
-
error,
|
|
5920
|
-
response,
|
|
5921
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
5922
|
-
},
|
|
5923
|
-
bubbles: true,
|
|
5924
|
-
cancelable: false
|
|
5925
|
-
});
|
|
5926
|
-
window.dispatchEvent(event);
|
|
5927
|
-
} catch (eventError) {
|
|
5928
|
-
consola13.warn("Failed to dispatch validation error event:", eventError);
|
|
5929
|
-
}
|
|
5930
|
-
}
|
|
5931
|
-
throw error;
|
|
5932
|
-
}
|
|
5933
|
-
}
|
|
5934
|
-
__name(createWebpushSendCreate, "createWebpushSendCreate");
|
|
5935
|
-
async function createWebpushSubscribeCreate(data, client) {
|
|
5936
|
-
const api = client || getAPIInstance4();
|
|
5937
|
-
const response = await api.web_push.webpushSubscribeCreate(data);
|
|
5938
|
-
try {
|
|
5939
|
-
return SubscribeResponseSchema.parse(response);
|
|
5940
|
-
} catch (error) {
|
|
5941
|
-
consola13.error("\u274C Zod Validation Failed");
|
|
5942
|
-
consola13.box(`createWebpushSubscribeCreate
|
|
5943
|
-
Path: /cfg/webpush/subscribe/
|
|
5944
|
-
Method: POST`);
|
|
5945
|
-
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
5946
|
-
consola13.error("Validation Issues:");
|
|
5947
|
-
error.issues.forEach((issue, index) => {
|
|
5948
|
-
consola13.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
5949
|
-
consola13.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
5950
|
-
if (issue.expected) consola13.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
5951
|
-
if (issue.received) consola13.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
5952
|
-
});
|
|
5953
|
-
}
|
|
5954
|
-
consola13.error("Response data:", response);
|
|
5955
|
-
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
5956
|
-
try {
|
|
5957
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
5958
|
-
detail: {
|
|
5959
|
-
operation: "createWebpushSubscribeCreate",
|
|
5960
|
-
path: "/cfg/webpush/subscribe/",
|
|
5961
|
-
method: "POST",
|
|
5962
|
-
error,
|
|
5963
|
-
response,
|
|
5964
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
5965
|
-
},
|
|
5966
|
-
bubbles: true,
|
|
5967
|
-
cancelable: false
|
|
5968
|
-
});
|
|
5969
|
-
window.dispatchEvent(event);
|
|
5970
|
-
} catch (eventError) {
|
|
5971
|
-
consola13.warn("Failed to dispatch validation error event:", eventError);
|
|
5972
|
-
}
|
|
5973
|
-
}
|
|
5974
|
-
throw error;
|
|
5975
|
-
}
|
|
5976
|
-
}
|
|
5977
|
-
__name(createWebpushSubscribeCreate, "createWebpushSubscribeCreate");
|
|
5978
|
-
async function getWebpushVapidRetrieve(client) {
|
|
5979
|
-
const api = client || getAPIInstance4();
|
|
5980
|
-
const response = await api.web_push.webpushVapidRetrieve();
|
|
5981
|
-
try {
|
|
5982
|
-
return VapidPublicKeyResponseSchema.parse(response);
|
|
5983
|
-
} catch (error) {
|
|
5984
|
-
consola13.error("\u274C Zod Validation Failed");
|
|
5985
|
-
consola13.box(`getWebpushVapidRetrieve
|
|
5986
|
-
Path: /cfg/webpush/vapid/
|
|
5987
|
-
Method: GET`);
|
|
5988
|
-
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
5989
|
-
consola13.error("Validation Issues:");
|
|
5990
|
-
error.issues.forEach((issue, index) => {
|
|
5991
|
-
consola13.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
5992
|
-
consola13.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
5993
|
-
if (issue.expected) consola13.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
5994
|
-
if (issue.received) consola13.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
5995
|
-
});
|
|
5996
|
-
}
|
|
5997
|
-
consola13.error("Response data:", response);
|
|
5998
|
-
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
5999
|
-
try {
|
|
6000
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
6001
|
-
detail: {
|
|
6002
|
-
operation: "getWebpushVapidRetrieve",
|
|
6003
|
-
path: "/cfg/webpush/vapid/",
|
|
6004
|
-
method: "GET",
|
|
6005
|
-
error,
|
|
6006
|
-
response,
|
|
6007
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
6008
|
-
},
|
|
6009
|
-
bubbles: true,
|
|
6010
|
-
cancelable: false
|
|
6011
|
-
});
|
|
6012
|
-
window.dispatchEvent(event);
|
|
6013
|
-
} catch (eventError) {
|
|
6014
|
-
consola13.warn("Failed to dispatch validation error event:", eventError);
|
|
6015
|
-
}
|
|
6016
|
-
}
|
|
6017
|
-
throw error;
|
|
6018
|
-
}
|
|
6019
|
-
}
|
|
6020
|
-
__name(getWebpushVapidRetrieve, "getWebpushVapidRetrieve");
|
|
6021
|
-
|
|
6022
|
-
// src/generated/cfg_webpush/index.ts
|
|
6023
|
-
var TOKEN_KEY4 = "auth_token";
|
|
6024
|
-
var REFRESH_TOKEN_KEY4 = "refresh_token";
|
|
6025
|
-
var API4 = class {
|
|
6026
|
-
constructor(baseUrl, options) {
|
|
6027
|
-
this._token = null;
|
|
6028
|
-
this._refreshToken = null;
|
|
6029
|
-
this.baseUrl = baseUrl;
|
|
6030
|
-
this.options = options;
|
|
6031
|
-
const logger = options?.loggerConfig ? new APILogger4(options.loggerConfig) : void 0;
|
|
6032
|
-
this.storage = options?.storage || new LocalStorageAdapter4(logger);
|
|
6033
|
-
this._loadTokensFromStorage();
|
|
6034
|
-
this._client = new APIClient4(this.baseUrl, {
|
|
6035
|
-
retryConfig: this.options?.retryConfig,
|
|
6036
|
-
loggerConfig: this.options?.loggerConfig,
|
|
6037
|
-
tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
|
|
6038
|
-
});
|
|
6039
|
-
this._injectAuthHeader();
|
|
6040
|
-
this.web_push = this._client.web_push;
|
|
6041
|
-
}
|
|
6042
|
-
static {
|
|
6043
|
-
__name(this, "API");
|
|
6044
|
-
}
|
|
6045
|
-
_loadTokensFromStorage() {
|
|
6046
|
-
this._token = this.storage.getItem(TOKEN_KEY4);
|
|
6047
|
-
this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY4);
|
|
6048
|
-
}
|
|
6049
|
-
_reinitClients() {
|
|
6050
|
-
this._client = new APIClient4(this.baseUrl, {
|
|
6051
|
-
retryConfig: this.options?.retryConfig,
|
|
6052
|
-
loggerConfig: this.options?.loggerConfig,
|
|
6053
|
-
tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
|
|
6054
|
-
});
|
|
6055
|
-
this._injectAuthHeader();
|
|
6056
|
-
this.web_push = this._client.web_push;
|
|
6057
|
-
}
|
|
6058
|
-
_injectAuthHeader() {
|
|
6059
|
-
const originalRequest = this._client.request.bind(this._client);
|
|
6060
|
-
this._client.request = async (method, path, options) => {
|
|
6061
|
-
const token = this.getToken();
|
|
6062
|
-
const mergedOptions = {
|
|
6063
|
-
...options,
|
|
6064
|
-
headers: {
|
|
6065
|
-
...options?.headers || {},
|
|
6066
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
6067
|
-
}
|
|
6068
|
-
};
|
|
6069
|
-
return originalRequest(method, path, mergedOptions);
|
|
6070
|
-
};
|
|
6071
|
-
}
|
|
6072
|
-
/**
|
|
6073
|
-
* Get current JWT token
|
|
6074
|
-
*/
|
|
6075
|
-
getToken() {
|
|
6076
|
-
return this.storage.getItem(TOKEN_KEY4);
|
|
6077
|
-
}
|
|
6078
|
-
/**
|
|
6079
|
-
* Get current refresh token
|
|
6080
|
-
*/
|
|
6081
|
-
getRefreshToken() {
|
|
6082
|
-
return this.storage.getItem(REFRESH_TOKEN_KEY4);
|
|
6083
|
-
}
|
|
6084
|
-
/**
|
|
6085
|
-
* Set JWT token and refresh token
|
|
6086
|
-
* @param token - JWT access token
|
|
6087
|
-
* @param refreshToken - JWT refresh token (optional)
|
|
6088
|
-
*/
|
|
6089
|
-
setToken(token, refreshToken) {
|
|
6090
|
-
this._token = token;
|
|
6091
|
-
this.storage.setItem(TOKEN_KEY4, token);
|
|
6092
|
-
if (refreshToken) {
|
|
6093
|
-
this._refreshToken = refreshToken;
|
|
6094
|
-
this.storage.setItem(REFRESH_TOKEN_KEY4, refreshToken);
|
|
6095
|
-
}
|
|
6096
|
-
this._reinitClients();
|
|
6097
|
-
}
|
|
6098
|
-
/**
|
|
6099
|
-
* Clear all tokens
|
|
6100
|
-
*/
|
|
6101
|
-
clearTokens() {
|
|
6102
|
-
this._token = null;
|
|
6103
|
-
this._refreshToken = null;
|
|
6104
|
-
this.storage.removeItem(TOKEN_KEY4);
|
|
6105
|
-
this.storage.removeItem(REFRESH_TOKEN_KEY4);
|
|
6106
|
-
this._reinitClients();
|
|
6107
|
-
}
|
|
6108
|
-
/**
|
|
6109
|
-
* Check if user is authenticated
|
|
6110
|
-
*/
|
|
6111
|
-
isAuthenticated() {
|
|
6112
|
-
return !!this.getToken();
|
|
6113
|
-
}
|
|
6114
|
-
/**
|
|
6115
|
-
* Update base URL and reinitialize clients
|
|
6116
|
-
* @param url - New base URL
|
|
6117
|
-
*/
|
|
6118
|
-
setBaseUrl(url) {
|
|
6119
|
-
this.baseUrl = url;
|
|
6120
|
-
this._reinitClients();
|
|
6121
|
-
}
|
|
6122
|
-
/**
|
|
6123
|
-
* Get current base URL
|
|
6124
|
-
*/
|
|
6125
|
-
getBaseUrl() {
|
|
6126
|
-
return this.baseUrl;
|
|
6127
|
-
}
|
|
6128
|
-
/**
|
|
6129
|
-
* Get OpenAPI schema path
|
|
6130
|
-
* @returns Path to the OpenAPI schema JSON file
|
|
6131
|
-
*
|
|
6132
|
-
* Note: The OpenAPI schema is available in the schema.json file.
|
|
6133
|
-
* You can load it dynamically using:
|
|
6134
|
-
* ```typescript
|
|
6135
|
-
* const schema = await fetch('./schema.json').then(r => r.json());
|
|
6136
|
-
* // or using fs in Node.js:
|
|
6137
|
-
* // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
|
|
6138
|
-
* ```
|
|
6139
|
-
*/
|
|
6140
|
-
getSchemaPath() {
|
|
6141
|
-
return "./schema.json";
|
|
6142
|
-
}
|
|
6143
|
-
};
|
|
6144
|
-
|
|
6145
5151
|
// src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts
|
|
6146
5152
|
import { useSWRConfig } from "swr";
|
|
6147
5153
|
function useCreateAccountsTokenRefreshCreate() {
|
|
@@ -6285,46 +5291,9 @@ function useCreateAccountsOtpVerifyCreate() {
|
|
|
6285
5291
|
}
|
|
6286
5292
|
__name(useCreateAccountsOtpVerifyCreate, "useCreateAccountsOtpVerifyCreate");
|
|
6287
5293
|
|
|
6288
|
-
// src/generated/
|
|
5294
|
+
// src/generated/cfg_centrifugo/_utils/hooks/index.ts
|
|
6289
5295
|
var hooks_exports = {};
|
|
6290
5296
|
__export(hooks_exports, {
|
|
6291
|
-
useCreateWebpushSendCreate: () => useCreateWebpushSendCreate,
|
|
6292
|
-
useCreateWebpushSubscribeCreate: () => useCreateWebpushSubscribeCreate,
|
|
6293
|
-
useWebpushVapidRetrieve: () => useWebpushVapidRetrieve
|
|
6294
|
-
});
|
|
6295
|
-
|
|
6296
|
-
// src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts
|
|
6297
|
-
import useSWR3 from "swr";
|
|
6298
|
-
import { useSWRConfig as useSWRConfig5 } from "swr";
|
|
6299
|
-
function useCreateWebpushSendCreate() {
|
|
6300
|
-
const { mutate } = useSWRConfig5();
|
|
6301
|
-
return async (data, client) => {
|
|
6302
|
-
const result = await createWebpushSendCreate(data, client);
|
|
6303
|
-
mutate("cfg-webpush-send");
|
|
6304
|
-
return result;
|
|
6305
|
-
};
|
|
6306
|
-
}
|
|
6307
|
-
__name(useCreateWebpushSendCreate, "useCreateWebpushSendCreate");
|
|
6308
|
-
function useCreateWebpushSubscribeCreate() {
|
|
6309
|
-
const { mutate } = useSWRConfig5();
|
|
6310
|
-
return async (data, client) => {
|
|
6311
|
-
const result = await createWebpushSubscribeCreate(data, client);
|
|
6312
|
-
mutate("cfg-webpush-subscribe");
|
|
6313
|
-
return result;
|
|
6314
|
-
};
|
|
6315
|
-
}
|
|
6316
|
-
__name(useCreateWebpushSubscribeCreate, "useCreateWebpushSubscribeCreate");
|
|
6317
|
-
function useWebpushVapidRetrieve(client) {
|
|
6318
|
-
return useSWR3(
|
|
6319
|
-
"cfg-webpush-vapid",
|
|
6320
|
-
() => getWebpushVapidRetrieve(client)
|
|
6321
|
-
);
|
|
6322
|
-
}
|
|
6323
|
-
__name(useWebpushVapidRetrieve, "useWebpushVapidRetrieve");
|
|
6324
|
-
|
|
6325
|
-
// src/generated/cfg_centrifugo/_utils/hooks/index.ts
|
|
6326
|
-
var hooks_exports2 = {};
|
|
6327
|
-
__export(hooks_exports2, {
|
|
6328
5297
|
useCentrifugoAuthTokenRetrieve: () => useCentrifugoAuthTokenRetrieve,
|
|
6329
5298
|
useCentrifugoMonitorChannelsRetrieve: () => useCentrifugoMonitorChannelsRetrieve,
|
|
6330
5299
|
useCentrifugoMonitorHealthRetrieve: () => useCentrifugoMonitorHealthRetrieve,
|
|
@@ -6343,9 +5312,9 @@ __export(hooks_exports2, {
|
|
|
6343
5312
|
});
|
|
6344
5313
|
|
|
6345
5314
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts
|
|
6346
|
-
import { useSWRConfig as
|
|
5315
|
+
import { useSWRConfig as useSWRConfig5 } from "swr";
|
|
6347
5316
|
function useCreateCentrifugoServerAuthTokenCreate() {
|
|
6348
|
-
const { mutate } =
|
|
5317
|
+
const { mutate } = useSWRConfig5();
|
|
6349
5318
|
return async (client) => {
|
|
6350
5319
|
const result = await createCentrifugoServerAuthTokenCreate(client);
|
|
6351
5320
|
mutate("cfg-centrifugo-server-auth-token");
|
|
@@ -6354,7 +5323,7 @@ function useCreateCentrifugoServerAuthTokenCreate() {
|
|
|
6354
5323
|
}
|
|
6355
5324
|
__name(useCreateCentrifugoServerAuthTokenCreate, "useCreateCentrifugoServerAuthTokenCreate");
|
|
6356
5325
|
function useCreateCentrifugoServerChannelsCreate() {
|
|
6357
|
-
const { mutate } =
|
|
5326
|
+
const { mutate } = useSWRConfig5();
|
|
6358
5327
|
return async (data, client) => {
|
|
6359
5328
|
const result = await createCentrifugoServerChannelsCreate(data, client);
|
|
6360
5329
|
mutate("cfg-centrifugo-server-channels");
|
|
@@ -6363,7 +5332,7 @@ function useCreateCentrifugoServerChannelsCreate() {
|
|
|
6363
5332
|
}
|
|
6364
5333
|
__name(useCreateCentrifugoServerChannelsCreate, "useCreateCentrifugoServerChannelsCreate");
|
|
6365
5334
|
function useCreateCentrifugoServerHistoryCreate() {
|
|
6366
|
-
const { mutate } =
|
|
5335
|
+
const { mutate } = useSWRConfig5();
|
|
6367
5336
|
return async (data, client) => {
|
|
6368
5337
|
const result = await createCentrifugoServerHistoryCreate(data, client);
|
|
6369
5338
|
mutate("cfg-centrifugo-server-history");
|
|
@@ -6372,7 +5341,7 @@ function useCreateCentrifugoServerHistoryCreate() {
|
|
|
6372
5341
|
}
|
|
6373
5342
|
__name(useCreateCentrifugoServerHistoryCreate, "useCreateCentrifugoServerHistoryCreate");
|
|
6374
5343
|
function useCreateCentrifugoServerInfoCreate() {
|
|
6375
|
-
const { mutate } =
|
|
5344
|
+
const { mutate } = useSWRConfig5();
|
|
6376
5345
|
return async (client) => {
|
|
6377
5346
|
const result = await createCentrifugoServerInfoCreate(client);
|
|
6378
5347
|
mutate("cfg-centrifugo-server-info");
|
|
@@ -6381,7 +5350,7 @@ function useCreateCentrifugoServerInfoCreate() {
|
|
|
6381
5350
|
}
|
|
6382
5351
|
__name(useCreateCentrifugoServerInfoCreate, "useCreateCentrifugoServerInfoCreate");
|
|
6383
5352
|
function useCreateCentrifugoServerPresenceCreate() {
|
|
6384
|
-
const { mutate } =
|
|
5353
|
+
const { mutate } = useSWRConfig5();
|
|
6385
5354
|
return async (data, client) => {
|
|
6386
5355
|
const result = await createCentrifugoServerPresenceCreate(data, client);
|
|
6387
5356
|
mutate("cfg-centrifugo-server-presence");
|
|
@@ -6390,7 +5359,7 @@ function useCreateCentrifugoServerPresenceCreate() {
|
|
|
6390
5359
|
}
|
|
6391
5360
|
__name(useCreateCentrifugoServerPresenceCreate, "useCreateCentrifugoServerPresenceCreate");
|
|
6392
5361
|
function useCreateCentrifugoServerPresenceStatsCreate() {
|
|
6393
|
-
const { mutate } =
|
|
5362
|
+
const { mutate } = useSWRConfig5();
|
|
6394
5363
|
return async (data, client) => {
|
|
6395
5364
|
const result = await createCentrifugoServerPresenceStatsCreate(data, client);
|
|
6396
5365
|
mutate("cfg-centrifugo-server-presence-stats");
|
|
@@ -6400,9 +5369,9 @@ function useCreateCentrifugoServerPresenceStatsCreate() {
|
|
|
6400
5369
|
__name(useCreateCentrifugoServerPresenceStatsCreate, "useCreateCentrifugoServerPresenceStatsCreate");
|
|
6401
5370
|
|
|
6402
5371
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts
|
|
6403
|
-
import
|
|
5372
|
+
import useSWR3 from "swr";
|
|
6404
5373
|
function useCentrifugoAuthTokenRetrieve(client) {
|
|
6405
|
-
return
|
|
5374
|
+
return useSWR3(
|
|
6406
5375
|
"cfg-centrifugo-auth-token",
|
|
6407
5376
|
() => getCentrifugoAuthTokenRetrieve(client)
|
|
6408
5377
|
);
|
|
@@ -6410,37 +5379,37 @@ function useCentrifugoAuthTokenRetrieve(client) {
|
|
|
6410
5379
|
__name(useCentrifugoAuthTokenRetrieve, "useCentrifugoAuthTokenRetrieve");
|
|
6411
5380
|
|
|
6412
5381
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts
|
|
6413
|
-
import
|
|
5382
|
+
import useSWR4 from "swr";
|
|
6414
5383
|
function useCentrifugoMonitorChannelsRetrieve(params, client) {
|
|
6415
|
-
return
|
|
5384
|
+
return useSWR4(
|
|
6416
5385
|
params ? ["cfg-centrifugo-monitor-channel", params] : "cfg-centrifugo-monitor-channel",
|
|
6417
5386
|
() => getCentrifugoMonitorChannelsRetrieve(params, client)
|
|
6418
5387
|
);
|
|
6419
5388
|
}
|
|
6420
5389
|
__name(useCentrifugoMonitorChannelsRetrieve, "useCentrifugoMonitorChannelsRetrieve");
|
|
6421
5390
|
function useCentrifugoMonitorHealthRetrieve(client) {
|
|
6422
|
-
return
|
|
5391
|
+
return useSWR4(
|
|
6423
5392
|
"cfg-centrifugo-monitor-health",
|
|
6424
5393
|
() => getCentrifugoMonitorHealthRetrieve(client)
|
|
6425
5394
|
);
|
|
6426
5395
|
}
|
|
6427
5396
|
__name(useCentrifugoMonitorHealthRetrieve, "useCentrifugoMonitorHealthRetrieve");
|
|
6428
5397
|
function useCentrifugoMonitorOverviewRetrieve(params, client) {
|
|
6429
|
-
return
|
|
5398
|
+
return useSWR4(
|
|
6430
5399
|
params ? ["cfg-centrifugo-monitor-overview", params] : "cfg-centrifugo-monitor-overview",
|
|
6431
5400
|
() => getCentrifugoMonitorOverviewRetrieve(params, client)
|
|
6432
5401
|
);
|
|
6433
5402
|
}
|
|
6434
5403
|
__name(useCentrifugoMonitorOverviewRetrieve, "useCentrifugoMonitorOverviewRetrieve");
|
|
6435
5404
|
function useCentrifugoMonitorPublishesList(params, client) {
|
|
6436
|
-
return
|
|
5405
|
+
return useSWR4(
|
|
6437
5406
|
params ? ["cfg-centrifugo-monitor-publishes", params] : "cfg-centrifugo-monitor-publishes",
|
|
6438
5407
|
() => getCentrifugoMonitorPublishesList(params, client)
|
|
6439
5408
|
);
|
|
6440
5409
|
}
|
|
6441
5410
|
__name(useCentrifugoMonitorPublishesList, "useCentrifugoMonitorPublishesList");
|
|
6442
5411
|
function useCentrifugoMonitorTimelineRetrieve(params, client) {
|
|
6443
|
-
return
|
|
5412
|
+
return useSWR4(
|
|
6444
5413
|
params ? ["cfg-centrifugo-monitor-timeline", params] : "cfg-centrifugo-monitor-timeline",
|
|
6445
5414
|
() => getCentrifugoMonitorTimelineRetrieve(params, client)
|
|
6446
5415
|
);
|
|
@@ -6448,9 +5417,9 @@ function useCentrifugoMonitorTimelineRetrieve(params, client) {
|
|
|
6448
5417
|
__name(useCentrifugoMonitorTimelineRetrieve, "useCentrifugoMonitorTimelineRetrieve");
|
|
6449
5418
|
|
|
6450
5419
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts
|
|
6451
|
-
import { useSWRConfig as
|
|
5420
|
+
import { useSWRConfig as useSWRConfig6 } from "swr";
|
|
6452
5421
|
function useCreateCentrifugoTestingPublishTestCreate() {
|
|
6453
|
-
const { mutate } =
|
|
5422
|
+
const { mutate } = useSWRConfig6();
|
|
6454
5423
|
return async (data, client) => {
|
|
6455
5424
|
const result = await createCentrifugoTestingPublishTestCreate(data, client);
|
|
6456
5425
|
mutate("cfg-centrifugo-testing-publish-test");
|
|
@@ -6459,7 +5428,7 @@ function useCreateCentrifugoTestingPublishTestCreate() {
|
|
|
6459
5428
|
}
|
|
6460
5429
|
__name(useCreateCentrifugoTestingPublishTestCreate, "useCreateCentrifugoTestingPublishTestCreate");
|
|
6461
5430
|
function useCreateCentrifugoTestingPublishWithLoggingCreate() {
|
|
6462
|
-
const { mutate } =
|
|
5431
|
+
const { mutate } = useSWRConfig6();
|
|
6463
5432
|
return async (data, client) => {
|
|
6464
5433
|
const result = await createCentrifugoTestingPublishWithLoggingCreate(data, client);
|
|
6465
5434
|
mutate("cfg-centrifugo-testing-publish-with-logging");
|
|
@@ -6468,7 +5437,7 @@ function useCreateCentrifugoTestingPublishWithLoggingCreate() {
|
|
|
6468
5437
|
}
|
|
6469
5438
|
__name(useCreateCentrifugoTestingPublishWithLoggingCreate, "useCreateCentrifugoTestingPublishWithLoggingCreate");
|
|
6470
5439
|
function useCreateCentrifugoTestingSendAckCreate() {
|
|
6471
|
-
const { mutate } =
|
|
5440
|
+
const { mutate } = useSWRConfig6();
|
|
6472
5441
|
return async (data, client) => {
|
|
6473
5442
|
const result = await createCentrifugoTestingSendAckCreate(data, client);
|
|
6474
5443
|
mutate("cfg-centrifugo-testing-send-ack");
|
|
@@ -6478,8 +5447,8 @@ function useCreateCentrifugoTestingSendAckCreate() {
|
|
|
6478
5447
|
__name(useCreateCentrifugoTestingSendAckCreate, "useCreateCentrifugoTestingSendAckCreate");
|
|
6479
5448
|
|
|
6480
5449
|
// src/generated/cfg_totp/_utils/hooks/index.ts
|
|
6481
|
-
var
|
|
6482
|
-
__export(
|
|
5450
|
+
var hooks_exports2 = {};
|
|
5451
|
+
__export(hooks_exports2, {
|
|
6483
5452
|
useCreateTotpBackupCodesRegenerateCreate: () => useCreateTotpBackupCodesRegenerateCreate,
|
|
6484
5453
|
useCreateTotpDisableCreate: () => useCreateTotpDisableCreate,
|
|
6485
5454
|
useCreateTotpSetupConfirmCreate: () => useCreateTotpSetupConfirmCreate,
|
|
@@ -6492,17 +5461,17 @@ __export(hooks_exports3, {
|
|
|
6492
5461
|
});
|
|
6493
5462
|
|
|
6494
5463
|
// src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts
|
|
6495
|
-
import
|
|
6496
|
-
import { useSWRConfig as
|
|
5464
|
+
import useSWR5 from "swr";
|
|
5465
|
+
import { useSWRConfig as useSWRConfig7 } from "swr";
|
|
6497
5466
|
function useTotpBackupCodesRetrieve(client) {
|
|
6498
|
-
return
|
|
5467
|
+
return useSWR5(
|
|
6499
5468
|
"cfg-totp-backup-code",
|
|
6500
5469
|
() => getTotpBackupCodesRetrieve(client)
|
|
6501
5470
|
);
|
|
6502
5471
|
}
|
|
6503
5472
|
__name(useTotpBackupCodesRetrieve, "useTotpBackupCodesRetrieve");
|
|
6504
5473
|
function useCreateTotpBackupCodesRegenerateCreate() {
|
|
6505
|
-
const { mutate } =
|
|
5474
|
+
const { mutate } = useSWRConfig7();
|
|
6506
5475
|
return async (data, client) => {
|
|
6507
5476
|
const result = await createTotpBackupCodesRegenerateCreate(data, client);
|
|
6508
5477
|
mutate("cfg-totp-backup-codes-regenerate");
|
|
@@ -6512,17 +5481,17 @@ function useCreateTotpBackupCodesRegenerateCreate() {
|
|
|
6512
5481
|
__name(useCreateTotpBackupCodesRegenerateCreate, "useCreateTotpBackupCodesRegenerateCreate");
|
|
6513
5482
|
|
|
6514
5483
|
// src/generated/cfg_totp/_utils/hooks/totp__totp_management.ts
|
|
6515
|
-
import
|
|
6516
|
-
import { useSWRConfig as
|
|
5484
|
+
import useSWR6 from "swr";
|
|
5485
|
+
import { useSWRConfig as useSWRConfig8 } from "swr";
|
|
6517
5486
|
function useTotpDevicesList(params, client) {
|
|
6518
|
-
return
|
|
5487
|
+
return useSWR6(
|
|
6519
5488
|
params ? ["cfg-totp-devices", params] : "cfg-totp-devices",
|
|
6520
5489
|
() => getTotpDevicesList(params, client)
|
|
6521
5490
|
);
|
|
6522
5491
|
}
|
|
6523
5492
|
__name(useTotpDevicesList, "useTotpDevicesList");
|
|
6524
5493
|
function useCreateTotpDisableCreate() {
|
|
6525
|
-
const { mutate } =
|
|
5494
|
+
const { mutate } = useSWRConfig8();
|
|
6526
5495
|
return async (data, client) => {
|
|
6527
5496
|
const result = await createTotpDisableCreate(data, client);
|
|
6528
5497
|
mutate("cfg-totp-disable");
|
|
@@ -6532,9 +5501,9 @@ function useCreateTotpDisableCreate() {
|
|
|
6532
5501
|
__name(useCreateTotpDisableCreate, "useCreateTotpDisableCreate");
|
|
6533
5502
|
|
|
6534
5503
|
// src/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts
|
|
6535
|
-
import { useSWRConfig as
|
|
5504
|
+
import { useSWRConfig as useSWRConfig9 } from "swr";
|
|
6536
5505
|
function useCreateTotpSetupCreate() {
|
|
6537
|
-
const { mutate } =
|
|
5506
|
+
const { mutate } = useSWRConfig9();
|
|
6538
5507
|
return async (data, client) => {
|
|
6539
5508
|
const result = await createTotpSetupCreate(data, client);
|
|
6540
5509
|
mutate("cfg-totp-setup");
|
|
@@ -6543,7 +5512,7 @@ function useCreateTotpSetupCreate() {
|
|
|
6543
5512
|
}
|
|
6544
5513
|
__name(useCreateTotpSetupCreate, "useCreateTotpSetupCreate");
|
|
6545
5514
|
function useCreateTotpSetupConfirmCreate() {
|
|
6546
|
-
const { mutate } =
|
|
5515
|
+
const { mutate } = useSWRConfig9();
|
|
6547
5516
|
return async (data, client) => {
|
|
6548
5517
|
const result = await createTotpSetupConfirmCreate(data, client);
|
|
6549
5518
|
mutate("cfg-totp-setup-confirm");
|
|
@@ -6553,9 +5522,9 @@ function useCreateTotpSetupConfirmCreate() {
|
|
|
6553
5522
|
__name(useCreateTotpSetupConfirmCreate, "useCreateTotpSetupConfirmCreate");
|
|
6554
5523
|
|
|
6555
5524
|
// src/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts
|
|
6556
|
-
import { useSWRConfig as
|
|
5525
|
+
import { useSWRConfig as useSWRConfig10 } from "swr";
|
|
6557
5526
|
function useCreateTotpVerifyCreate() {
|
|
6558
|
-
const { mutate } =
|
|
5527
|
+
const { mutate } = useSWRConfig10();
|
|
6559
5528
|
return async (data, client) => {
|
|
6560
5529
|
const result = await createTotpVerifyCreate(data, client);
|
|
6561
5530
|
mutate("cfg-totp-verify");
|
|
@@ -6564,7 +5533,7 @@ function useCreateTotpVerifyCreate() {
|
|
|
6564
5533
|
}
|
|
6565
5534
|
__name(useCreateTotpVerifyCreate, "useCreateTotpVerifyCreate");
|
|
6566
5535
|
function useCreateTotpVerifyBackupCreate() {
|
|
6567
|
-
const { mutate } =
|
|
5536
|
+
const { mutate } = useSWRConfig10();
|
|
6568
5537
|
return async (data, client) => {
|
|
6569
5538
|
const result = await createTotpVerifyBackupCreate(data, client);
|
|
6570
5539
|
mutate("cfg-totp-verify-backup");
|
|
@@ -6574,9 +5543,9 @@ function useCreateTotpVerifyBackupCreate() {
|
|
|
6574
5543
|
__name(useCreateTotpVerifyBackupCreate, "useCreateTotpVerifyBackupCreate");
|
|
6575
5544
|
|
|
6576
5545
|
// src/generated/cfg_totp/_utils/hooks/totp.ts
|
|
6577
|
-
import { useSWRConfig as
|
|
5546
|
+
import { useSWRConfig as useSWRConfig11 } from "swr";
|
|
6578
5547
|
function useDeleteTotpDevicesDestroy() {
|
|
6579
|
-
const { mutate } =
|
|
5548
|
+
const { mutate } = useSWRConfig11();
|
|
6580
5549
|
return async (id, client) => {
|
|
6581
5550
|
const result = await deleteTotpDevicesDestroy(id, client);
|
|
6582
5551
|
mutate("cfg-totp-devices");
|
|
@@ -6592,14 +5561,13 @@ var apiUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
|
|
|
6592
5561
|
var storage = new LocalStorageAdapter();
|
|
6593
5562
|
var apiAccounts = new API(apiUrl, { storage });
|
|
6594
5563
|
var apiTotp = new API3(apiUrl, { storage });
|
|
6595
|
-
var apiWebPush = new API4(apiUrl, { storage });
|
|
6596
5564
|
var apiCentrifugo = new API2(apiUrl, { storage });
|
|
6597
5565
|
export {
|
|
6598
5566
|
AccountDeleteResponseSchema,
|
|
6599
5567
|
API as AccountsAPI,
|
|
6600
5568
|
API2 as CentrifugoAPI,
|
|
6601
5569
|
fetchers_exports2 as CentrifugoFetchers,
|
|
6602
|
-
|
|
5570
|
+
hooks_exports as CentrifugoHooks,
|
|
6603
5571
|
CentrifugoTokenSchema,
|
|
6604
5572
|
schemas_exports2 as CentrifugoTypes,
|
|
6605
5573
|
CfgAccountsProfileAvatarCreateRequestSchema,
|
|
@@ -6622,18 +5590,13 @@ export {
|
|
|
6622
5590
|
TokenRefreshSchema,
|
|
6623
5591
|
API3 as TotpAPI,
|
|
6624
5592
|
fetchers_exports3 as TotpFetchers,
|
|
6625
|
-
|
|
5593
|
+
hooks_exports2 as TotpHooks,
|
|
6626
5594
|
schemas_exports3 as TotpTypes,
|
|
6627
5595
|
UserProfileUpdateRequestSchema,
|
|
6628
5596
|
UserSchema,
|
|
6629
|
-
API4 as WebPushAPI,
|
|
6630
|
-
fetchers_exports4 as WebPushFetchers,
|
|
6631
|
-
hooks_exports as WebPushHooks,
|
|
6632
|
-
schemas_exports4 as WebPushTypes,
|
|
6633
5597
|
apiAccounts,
|
|
6634
5598
|
apiCentrifugo,
|
|
6635
5599
|
apiTotp,
|
|
6636
|
-
apiWebPush,
|
|
6637
5600
|
createAccountsOauthDisconnectCreate,
|
|
6638
5601
|
createAccountsOauthGithubAuthorizeCreate,
|
|
6639
5602
|
createAccountsOauthGithubCallbackCreate,
|