@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.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(clients_exports, {
|
|
|
35
35
|
AccountsAPI: () => API,
|
|
36
36
|
CentrifugoAPI: () => API2,
|
|
37
37
|
CentrifugoFetchers: () => fetchers_exports2,
|
|
38
|
-
CentrifugoHooks: () =>
|
|
38
|
+
CentrifugoHooks: () => hooks_exports,
|
|
39
39
|
CentrifugoTokenSchema: () => CentrifugoTokenSchema,
|
|
40
40
|
CentrifugoTypes: () => schemas_exports2,
|
|
41
41
|
CfgAccountsProfileAvatarCreateRequestSchema: () => CfgAccountsProfileAvatarCreateRequestSchema,
|
|
@@ -58,18 +58,13 @@ __export(clients_exports, {
|
|
|
58
58
|
TokenRefreshSchema: () => TokenRefreshSchema,
|
|
59
59
|
TotpAPI: () => API3,
|
|
60
60
|
TotpFetchers: () => fetchers_exports3,
|
|
61
|
-
TotpHooks: () =>
|
|
61
|
+
TotpHooks: () => hooks_exports2,
|
|
62
62
|
TotpTypes: () => schemas_exports3,
|
|
63
63
|
UserProfileUpdateRequestSchema: () => UserProfileUpdateRequestSchema,
|
|
64
64
|
UserSchema: () => UserSchema,
|
|
65
|
-
WebPushAPI: () => API4,
|
|
66
|
-
WebPushFetchers: () => fetchers_exports4,
|
|
67
|
-
WebPushHooks: () => hooks_exports,
|
|
68
|
-
WebPushTypes: () => schemas_exports4,
|
|
69
65
|
apiAccounts: () => apiAccounts,
|
|
70
66
|
apiCentrifugo: () => apiCentrifugo,
|
|
71
67
|
apiTotp: () => apiTotp,
|
|
72
|
-
apiWebPush: () => apiWebPush,
|
|
73
68
|
createAccountsOauthDisconnectCreate: () => createAccountsOauthDisconnectCreate,
|
|
74
69
|
createAccountsOauthGithubAuthorizeCreate: () => createAccountsOauthGithubAuthorizeCreate,
|
|
75
70
|
createAccountsOauthGithubCallbackCreate: () => createAccountsOauthGithubCallbackCreate,
|
|
@@ -5245,1000 +5240,6 @@ var API3 = class {
|
|
|
5245
5240
|
}
|
|
5246
5241
|
};
|
|
5247
5242
|
|
|
5248
|
-
// src/generated/cfg_webpush/webpush__web_push/client.ts
|
|
5249
|
-
var WebPush = class {
|
|
5250
|
-
static {
|
|
5251
|
-
__name(this, "WebPush");
|
|
5252
|
-
}
|
|
5253
|
-
constructor(client) {
|
|
5254
|
-
this.client = client;
|
|
5255
|
-
}
|
|
5256
|
-
/**
|
|
5257
|
-
* Send push notification
|
|
5258
|
-
*
|
|
5259
|
-
* Send push notification to all active subscriptions for the authenticated
|
|
5260
|
-
* user.
|
|
5261
|
-
*/
|
|
5262
|
-
async webpushSendCreate(data) {
|
|
5263
|
-
const response = await this.client.request("POST", "/cfg/webpush/send/", { body: data });
|
|
5264
|
-
return response;
|
|
5265
|
-
}
|
|
5266
|
-
/**
|
|
5267
|
-
* Subscribe to push notifications
|
|
5268
|
-
*
|
|
5269
|
-
* Save push subscription from browser for the authenticated user.
|
|
5270
|
-
*/
|
|
5271
|
-
async webpushSubscribeCreate(data) {
|
|
5272
|
-
const response = await this.client.request("POST", "/cfg/webpush/subscribe/", { body: data });
|
|
5273
|
-
return response;
|
|
5274
|
-
}
|
|
5275
|
-
/**
|
|
5276
|
-
* Get VAPID public key
|
|
5277
|
-
*
|
|
5278
|
-
* Get VAPID public key for client subscription.
|
|
5279
|
-
*/
|
|
5280
|
-
async webpushVapidRetrieve() {
|
|
5281
|
-
const response = await this.client.request("GET", "/cfg/webpush/vapid/");
|
|
5282
|
-
return response;
|
|
5283
|
-
}
|
|
5284
|
-
};
|
|
5285
|
-
|
|
5286
|
-
// src/generated/cfg_webpush/http.ts
|
|
5287
|
-
var FetchAdapter4 = class {
|
|
5288
|
-
static {
|
|
5289
|
-
__name(this, "FetchAdapter");
|
|
5290
|
-
}
|
|
5291
|
-
async request(request) {
|
|
5292
|
-
const { method, url, headers, body, params, formData, binaryBody } = request;
|
|
5293
|
-
let finalUrl = url;
|
|
5294
|
-
if (params) {
|
|
5295
|
-
const searchParams = new URLSearchParams();
|
|
5296
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
5297
|
-
if (value !== null && value !== void 0) {
|
|
5298
|
-
searchParams.append(key, String(value));
|
|
5299
|
-
}
|
|
5300
|
-
});
|
|
5301
|
-
const queryString = searchParams.toString();
|
|
5302
|
-
if (queryString) {
|
|
5303
|
-
finalUrl = url.includes("?") ? `${url}&${queryString}` : `${url}?${queryString}`;
|
|
5304
|
-
}
|
|
5305
|
-
}
|
|
5306
|
-
const finalHeaders = { ...headers };
|
|
5307
|
-
let requestBody;
|
|
5308
|
-
if (formData) {
|
|
5309
|
-
requestBody = formData;
|
|
5310
|
-
} else if (binaryBody) {
|
|
5311
|
-
finalHeaders["Content-Type"] = "application/octet-stream";
|
|
5312
|
-
requestBody = binaryBody;
|
|
5313
|
-
} else if (body) {
|
|
5314
|
-
finalHeaders["Content-Type"] = "application/json";
|
|
5315
|
-
requestBody = JSON.stringify(body);
|
|
5316
|
-
}
|
|
5317
|
-
const response = await fetch(finalUrl, {
|
|
5318
|
-
method,
|
|
5319
|
-
headers: finalHeaders,
|
|
5320
|
-
body: requestBody,
|
|
5321
|
-
credentials: "include"
|
|
5322
|
-
// Include Django session cookies
|
|
5323
|
-
});
|
|
5324
|
-
let data = null;
|
|
5325
|
-
const contentType = response.headers.get("content-type");
|
|
5326
|
-
if (response.status !== 204 && contentType?.includes("application/json")) {
|
|
5327
|
-
data = await response.json();
|
|
5328
|
-
} else if (response.status !== 204) {
|
|
5329
|
-
data = await response.text();
|
|
5330
|
-
}
|
|
5331
|
-
const responseHeaders = {};
|
|
5332
|
-
response.headers.forEach((value, key) => {
|
|
5333
|
-
responseHeaders[key] = value;
|
|
5334
|
-
});
|
|
5335
|
-
return {
|
|
5336
|
-
data,
|
|
5337
|
-
status: response.status,
|
|
5338
|
-
statusText: response.statusText,
|
|
5339
|
-
headers: responseHeaders
|
|
5340
|
-
};
|
|
5341
|
-
}
|
|
5342
|
-
};
|
|
5343
|
-
|
|
5344
|
-
// src/generated/cfg_webpush/errors.ts
|
|
5345
|
-
var APIError4 = class extends Error {
|
|
5346
|
-
constructor(statusCode, statusText, response, url, message) {
|
|
5347
|
-
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
5348
|
-
this.statusCode = statusCode;
|
|
5349
|
-
this.statusText = statusText;
|
|
5350
|
-
this.response = response;
|
|
5351
|
-
this.url = url;
|
|
5352
|
-
this.name = "APIError";
|
|
5353
|
-
}
|
|
5354
|
-
static {
|
|
5355
|
-
__name(this, "APIError");
|
|
5356
|
-
}
|
|
5357
|
-
/**
|
|
5358
|
-
* Get error details from response.
|
|
5359
|
-
* DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
|
|
5360
|
-
*/
|
|
5361
|
-
get details() {
|
|
5362
|
-
if (typeof this.response === "object" && this.response !== null) {
|
|
5363
|
-
return this.response;
|
|
5364
|
-
}
|
|
5365
|
-
return null;
|
|
5366
|
-
}
|
|
5367
|
-
/**
|
|
5368
|
-
* Get field-specific validation errors from DRF.
|
|
5369
|
-
* Returns: { "field_name": ["error1", "error2"], ... }
|
|
5370
|
-
*/
|
|
5371
|
-
get fieldErrors() {
|
|
5372
|
-
const details = this.details;
|
|
5373
|
-
if (!details) return null;
|
|
5374
|
-
const fieldErrors = {};
|
|
5375
|
-
for (const [key, value] of Object.entries(details)) {
|
|
5376
|
-
if (Array.isArray(value)) {
|
|
5377
|
-
fieldErrors[key] = value;
|
|
5378
|
-
}
|
|
5379
|
-
}
|
|
5380
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
5381
|
-
}
|
|
5382
|
-
/**
|
|
5383
|
-
* Get single error message from DRF.
|
|
5384
|
-
* Checks for "detail", "message", or first field error.
|
|
5385
|
-
*/
|
|
5386
|
-
get errorMessage() {
|
|
5387
|
-
const details = this.details;
|
|
5388
|
-
if (!details) return this.message;
|
|
5389
|
-
if (details.detail) {
|
|
5390
|
-
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
5391
|
-
}
|
|
5392
|
-
if (details.message) {
|
|
5393
|
-
return String(details.message);
|
|
5394
|
-
}
|
|
5395
|
-
const fieldErrors = this.fieldErrors;
|
|
5396
|
-
if (fieldErrors) {
|
|
5397
|
-
const firstField = Object.keys(fieldErrors)[0];
|
|
5398
|
-
if (firstField) {
|
|
5399
|
-
return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
5400
|
-
}
|
|
5401
|
-
}
|
|
5402
|
-
return this.message;
|
|
5403
|
-
}
|
|
5404
|
-
// Helper methods for common HTTP status codes
|
|
5405
|
-
get isValidationError() {
|
|
5406
|
-
return this.statusCode === 400;
|
|
5407
|
-
}
|
|
5408
|
-
get isAuthError() {
|
|
5409
|
-
return this.statusCode === 401;
|
|
5410
|
-
}
|
|
5411
|
-
get isPermissionError() {
|
|
5412
|
-
return this.statusCode === 403;
|
|
5413
|
-
}
|
|
5414
|
-
get isNotFoundError() {
|
|
5415
|
-
return this.statusCode === 404;
|
|
5416
|
-
}
|
|
5417
|
-
get isServerError() {
|
|
5418
|
-
return this.statusCode >= 500 && this.statusCode < 600;
|
|
5419
|
-
}
|
|
5420
|
-
};
|
|
5421
|
-
var NetworkError4 = class extends Error {
|
|
5422
|
-
constructor(message, url, originalError) {
|
|
5423
|
-
super(message);
|
|
5424
|
-
this.url = url;
|
|
5425
|
-
this.originalError = originalError;
|
|
5426
|
-
this.name = "NetworkError";
|
|
5427
|
-
}
|
|
5428
|
-
static {
|
|
5429
|
-
__name(this, "NetworkError");
|
|
5430
|
-
}
|
|
5431
|
-
};
|
|
5432
|
-
|
|
5433
|
-
// src/generated/cfg_webpush/logger.ts
|
|
5434
|
-
var import_consola16 = require("consola");
|
|
5435
|
-
var DEFAULT_CONFIG4 = {
|
|
5436
|
-
enabled: process.env.NODE_ENV !== "production",
|
|
5437
|
-
logRequests: true,
|
|
5438
|
-
logResponses: true,
|
|
5439
|
-
logErrors: true,
|
|
5440
|
-
logBodies: true,
|
|
5441
|
-
logHeaders: false
|
|
5442
|
-
};
|
|
5443
|
-
var SENSITIVE_HEADERS4 = [
|
|
5444
|
-
"authorization",
|
|
5445
|
-
"cookie",
|
|
5446
|
-
"set-cookie",
|
|
5447
|
-
"x-api-key",
|
|
5448
|
-
"x-csrf-token"
|
|
5449
|
-
];
|
|
5450
|
-
var APILogger4 = class {
|
|
5451
|
-
static {
|
|
5452
|
-
__name(this, "APILogger");
|
|
5453
|
-
}
|
|
5454
|
-
constructor(config = {}) {
|
|
5455
|
-
this.config = { ...DEFAULT_CONFIG4, ...config };
|
|
5456
|
-
this.consola = config.consola || (0, import_consola16.createConsola)({
|
|
5457
|
-
level: this.config.enabled ? 4 : 0
|
|
5458
|
-
});
|
|
5459
|
-
}
|
|
5460
|
-
/**
|
|
5461
|
-
* Enable logging
|
|
5462
|
-
*/
|
|
5463
|
-
enable() {
|
|
5464
|
-
this.config.enabled = true;
|
|
5465
|
-
}
|
|
5466
|
-
/**
|
|
5467
|
-
* Disable logging
|
|
5468
|
-
*/
|
|
5469
|
-
disable() {
|
|
5470
|
-
this.config.enabled = false;
|
|
5471
|
-
}
|
|
5472
|
-
/**
|
|
5473
|
-
* Update configuration
|
|
5474
|
-
*/
|
|
5475
|
-
setConfig(config) {
|
|
5476
|
-
this.config = { ...this.config, ...config };
|
|
5477
|
-
}
|
|
5478
|
-
/**
|
|
5479
|
-
* Filter sensitive headers
|
|
5480
|
-
*/
|
|
5481
|
-
filterHeaders(headers) {
|
|
5482
|
-
if (!headers) return {};
|
|
5483
|
-
const filtered = {};
|
|
5484
|
-
Object.keys(headers).forEach((key) => {
|
|
5485
|
-
const lowerKey = key.toLowerCase();
|
|
5486
|
-
if (SENSITIVE_HEADERS4.includes(lowerKey)) {
|
|
5487
|
-
filtered[key] = "***";
|
|
5488
|
-
} else {
|
|
5489
|
-
filtered[key] = headers[key] || "";
|
|
5490
|
-
}
|
|
5491
|
-
});
|
|
5492
|
-
return filtered;
|
|
5493
|
-
}
|
|
5494
|
-
/**
|
|
5495
|
-
* Log request
|
|
5496
|
-
*/
|
|
5497
|
-
logRequest(request) {
|
|
5498
|
-
if (!this.config.enabled || !this.config.logRequests) return;
|
|
5499
|
-
const { method, url, headers, body } = request;
|
|
5500
|
-
this.consola.start(`${method} ${url}`);
|
|
5501
|
-
if (this.config.logHeaders && headers) {
|
|
5502
|
-
this.consola.debug("Headers:", this.filterHeaders(headers));
|
|
5503
|
-
}
|
|
5504
|
-
if (this.config.logBodies && body) {
|
|
5505
|
-
this.consola.debug("Body:", body);
|
|
5506
|
-
}
|
|
5507
|
-
}
|
|
5508
|
-
/**
|
|
5509
|
-
* Log response
|
|
5510
|
-
*/
|
|
5511
|
-
logResponse(request, response) {
|
|
5512
|
-
if (!this.config.enabled || !this.config.logResponses) return;
|
|
5513
|
-
const { method, url } = request;
|
|
5514
|
-
const { status, statusText, data, duration } = response;
|
|
5515
|
-
const statusColor = status >= 500 ? "red" : status >= 400 ? "yellow" : status >= 300 ? "cyan" : "green";
|
|
5516
|
-
this.consola.success(
|
|
5517
|
-
`${method} ${url} ${status} ${statusText} (${duration}ms)`
|
|
5518
|
-
);
|
|
5519
|
-
if (this.config.logBodies && data) {
|
|
5520
|
-
this.consola.debug("Response:", data);
|
|
5521
|
-
}
|
|
5522
|
-
}
|
|
5523
|
-
/**
|
|
5524
|
-
* Log error
|
|
5525
|
-
*/
|
|
5526
|
-
logError(request, error) {
|
|
5527
|
-
if (!this.config.enabled || !this.config.logErrors) return;
|
|
5528
|
-
const { method, url } = request;
|
|
5529
|
-
const { message, statusCode, fieldErrors, duration } = error;
|
|
5530
|
-
this.consola.error(
|
|
5531
|
-
`${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
|
|
5532
|
-
);
|
|
5533
|
-
this.consola.error("Message:", message);
|
|
5534
|
-
if (fieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
5535
|
-
this.consola.error("Field Errors:");
|
|
5536
|
-
Object.entries(fieldErrors).forEach(([field, errors]) => {
|
|
5537
|
-
errors.forEach((err) => {
|
|
5538
|
-
this.consola.error(` \u2022 ${field}: ${err}`);
|
|
5539
|
-
});
|
|
5540
|
-
});
|
|
5541
|
-
}
|
|
5542
|
-
}
|
|
5543
|
-
/**
|
|
5544
|
-
* Log general info
|
|
5545
|
-
*/
|
|
5546
|
-
info(message, ...args) {
|
|
5547
|
-
if (!this.config.enabled) return;
|
|
5548
|
-
this.consola.info(message, ...args);
|
|
5549
|
-
}
|
|
5550
|
-
/**
|
|
5551
|
-
* Log warning
|
|
5552
|
-
*/
|
|
5553
|
-
warn(message, ...args) {
|
|
5554
|
-
if (!this.config.enabled) return;
|
|
5555
|
-
this.consola.warn(message, ...args);
|
|
5556
|
-
}
|
|
5557
|
-
/**
|
|
5558
|
-
* Log error
|
|
5559
|
-
*/
|
|
5560
|
-
error(message, ...args) {
|
|
5561
|
-
if (!this.config.enabled) return;
|
|
5562
|
-
this.consola.error(message, ...args);
|
|
5563
|
-
}
|
|
5564
|
-
/**
|
|
5565
|
-
* Log debug
|
|
5566
|
-
*/
|
|
5567
|
-
debug(message, ...args) {
|
|
5568
|
-
if (!this.config.enabled) return;
|
|
5569
|
-
this.consola.debug(message, ...args);
|
|
5570
|
-
}
|
|
5571
|
-
/**
|
|
5572
|
-
* Log success
|
|
5573
|
-
*/
|
|
5574
|
-
success(message, ...args) {
|
|
5575
|
-
if (!this.config.enabled) return;
|
|
5576
|
-
this.consola.success(message, ...args);
|
|
5577
|
-
}
|
|
5578
|
-
/**
|
|
5579
|
-
* Create a sub-logger with prefix
|
|
5580
|
-
*/
|
|
5581
|
-
withTag(tag) {
|
|
5582
|
-
return this.consola.withTag(tag);
|
|
5583
|
-
}
|
|
5584
|
-
};
|
|
5585
|
-
var defaultLogger4 = new APILogger4();
|
|
5586
|
-
|
|
5587
|
-
// src/generated/cfg_webpush/retry.ts
|
|
5588
|
-
var import_p_retry4 = __toESM(require("p-retry"), 1);
|
|
5589
|
-
var DEFAULT_RETRY_CONFIG4 = {
|
|
5590
|
-
retries: 3,
|
|
5591
|
-
factor: 2,
|
|
5592
|
-
minTimeout: 1e3,
|
|
5593
|
-
maxTimeout: 6e4,
|
|
5594
|
-
randomize: true,
|
|
5595
|
-
onFailedAttempt: /* @__PURE__ */ __name(() => {
|
|
5596
|
-
}, "onFailedAttempt")
|
|
5597
|
-
};
|
|
5598
|
-
function shouldRetry4(error) {
|
|
5599
|
-
if (error instanceof NetworkError4) {
|
|
5600
|
-
return true;
|
|
5601
|
-
}
|
|
5602
|
-
if (error instanceof APIError4) {
|
|
5603
|
-
const status = error.statusCode;
|
|
5604
|
-
if (status >= 500 && status < 600) {
|
|
5605
|
-
return true;
|
|
5606
|
-
}
|
|
5607
|
-
if (status === 429) {
|
|
5608
|
-
return true;
|
|
5609
|
-
}
|
|
5610
|
-
return false;
|
|
5611
|
-
}
|
|
5612
|
-
return true;
|
|
5613
|
-
}
|
|
5614
|
-
__name(shouldRetry4, "shouldRetry");
|
|
5615
|
-
async function withRetry4(fn, config) {
|
|
5616
|
-
const finalConfig = { ...DEFAULT_RETRY_CONFIG4, ...config };
|
|
5617
|
-
return (0, import_p_retry4.default)(
|
|
5618
|
-
async () => {
|
|
5619
|
-
try {
|
|
5620
|
-
return await fn();
|
|
5621
|
-
} catch (error) {
|
|
5622
|
-
if (!shouldRetry4(error)) {
|
|
5623
|
-
throw new import_p_retry4.AbortError(error);
|
|
5624
|
-
}
|
|
5625
|
-
throw error;
|
|
5626
|
-
}
|
|
5627
|
-
},
|
|
5628
|
-
{
|
|
5629
|
-
retries: finalConfig.retries,
|
|
5630
|
-
factor: finalConfig.factor,
|
|
5631
|
-
minTimeout: finalConfig.minTimeout,
|
|
5632
|
-
maxTimeout: finalConfig.maxTimeout,
|
|
5633
|
-
randomize: finalConfig.randomize,
|
|
5634
|
-
onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {
|
|
5635
|
-
const pRetryError = error;
|
|
5636
|
-
finalConfig.onFailedAttempt({
|
|
5637
|
-
error: pRetryError,
|
|
5638
|
-
attemptNumber: pRetryError.attemptNumber,
|
|
5639
|
-
retriesLeft: pRetryError.retriesLeft
|
|
5640
|
-
});
|
|
5641
|
-
} : void 0
|
|
5642
|
-
}
|
|
5643
|
-
);
|
|
5644
|
-
}
|
|
5645
|
-
__name(withRetry4, "withRetry");
|
|
5646
|
-
|
|
5647
|
-
// src/generated/cfg_webpush/client.ts
|
|
5648
|
-
var APIClient4 = class {
|
|
5649
|
-
constructor(baseUrl, options) {
|
|
5650
|
-
this.logger = null;
|
|
5651
|
-
this.retryConfig = null;
|
|
5652
|
-
this.tokenGetter = null;
|
|
5653
|
-
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
5654
|
-
this.httpClient = options?.httpClient || new FetchAdapter4();
|
|
5655
|
-
this.tokenGetter = options?.tokenGetter || null;
|
|
5656
|
-
if (options?.loggerConfig !== void 0) {
|
|
5657
|
-
this.logger = new APILogger4(options.loggerConfig);
|
|
5658
|
-
}
|
|
5659
|
-
if (options?.retryConfig !== void 0) {
|
|
5660
|
-
this.retryConfig = options.retryConfig;
|
|
5661
|
-
}
|
|
5662
|
-
this.web_push = new WebPush(this);
|
|
5663
|
-
}
|
|
5664
|
-
static {
|
|
5665
|
-
__name(this, "APIClient");
|
|
5666
|
-
}
|
|
5667
|
-
/**
|
|
5668
|
-
* Get CSRF token from cookies (for SessionAuthentication).
|
|
5669
|
-
*
|
|
5670
|
-
* Returns null if cookie doesn't exist (JWT-only auth).
|
|
5671
|
-
*/
|
|
5672
|
-
getCsrfToken() {
|
|
5673
|
-
const name = "csrftoken";
|
|
5674
|
-
const value = `; ${document.cookie}`;
|
|
5675
|
-
const parts = value.split(`; ${name}=`);
|
|
5676
|
-
if (parts.length === 2) {
|
|
5677
|
-
return parts.pop()?.split(";").shift() || null;
|
|
5678
|
-
}
|
|
5679
|
-
return null;
|
|
5680
|
-
}
|
|
5681
|
-
/**
|
|
5682
|
-
* Get the base URL for building streaming/download URLs.
|
|
5683
|
-
*/
|
|
5684
|
-
getBaseUrl() {
|
|
5685
|
-
return this.baseUrl;
|
|
5686
|
-
}
|
|
5687
|
-
/**
|
|
5688
|
-
* Get JWT token for URL authentication (used in streaming endpoints).
|
|
5689
|
-
* Returns null if no token getter is configured or no token is available.
|
|
5690
|
-
*/
|
|
5691
|
-
getToken() {
|
|
5692
|
-
return this.tokenGetter ? this.tokenGetter() : null;
|
|
5693
|
-
}
|
|
5694
|
-
/**
|
|
5695
|
-
* Make HTTP request with Django CSRF and session handling.
|
|
5696
|
-
* Automatically retries on network errors and 5xx server errors.
|
|
5697
|
-
*/
|
|
5698
|
-
async request(method, path, options) {
|
|
5699
|
-
if (this.retryConfig) {
|
|
5700
|
-
return withRetry4(() => this._makeRequest(method, path, options), {
|
|
5701
|
-
...this.retryConfig,
|
|
5702
|
-
onFailedAttempt: /* @__PURE__ */ __name((info) => {
|
|
5703
|
-
if (this.logger) {
|
|
5704
|
-
this.logger.warn(
|
|
5705
|
-
`Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} for ${method} ${path}: ${info.error.message}`
|
|
5706
|
-
);
|
|
5707
|
-
}
|
|
5708
|
-
this.retryConfig?.onFailedAttempt?.(info);
|
|
5709
|
-
}, "onFailedAttempt")
|
|
5710
|
-
});
|
|
5711
|
-
}
|
|
5712
|
-
return this._makeRequest(method, path, options);
|
|
5713
|
-
}
|
|
5714
|
-
/**
|
|
5715
|
-
* Internal request method (without retry wrapper).
|
|
5716
|
-
* Used by request() method with optional retry logic.
|
|
5717
|
-
*/
|
|
5718
|
-
async _makeRequest(method, path, options) {
|
|
5719
|
-
const url = this.baseUrl ? `${this.baseUrl}${path}` : path;
|
|
5720
|
-
const startTime = Date.now();
|
|
5721
|
-
const headers = {
|
|
5722
|
-
...options?.headers || {}
|
|
5723
|
-
};
|
|
5724
|
-
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
5725
|
-
headers["Content-Type"] = "application/json";
|
|
5726
|
-
}
|
|
5727
|
-
if (this.logger) {
|
|
5728
|
-
this.logger.logRequest({
|
|
5729
|
-
method,
|
|
5730
|
-
url,
|
|
5731
|
-
headers,
|
|
5732
|
-
body: options?.formData || options?.body,
|
|
5733
|
-
timestamp: startTime
|
|
5734
|
-
});
|
|
5735
|
-
}
|
|
5736
|
-
try {
|
|
5737
|
-
const response = await this.httpClient.request({
|
|
5738
|
-
method,
|
|
5739
|
-
url,
|
|
5740
|
-
headers,
|
|
5741
|
-
params: options?.params,
|
|
5742
|
-
body: options?.body,
|
|
5743
|
-
formData: options?.formData,
|
|
5744
|
-
binaryBody: options?.binaryBody
|
|
5745
|
-
});
|
|
5746
|
-
const duration = Date.now() - startTime;
|
|
5747
|
-
if (response.status >= 400) {
|
|
5748
|
-
const error = new APIError4(
|
|
5749
|
-
response.status,
|
|
5750
|
-
response.statusText,
|
|
5751
|
-
response.data,
|
|
5752
|
-
url
|
|
5753
|
-
);
|
|
5754
|
-
if (this.logger) {
|
|
5755
|
-
this.logger.logError(
|
|
5756
|
-
{
|
|
5757
|
-
method,
|
|
5758
|
-
url,
|
|
5759
|
-
headers,
|
|
5760
|
-
body: options?.formData || options?.body,
|
|
5761
|
-
timestamp: startTime
|
|
5762
|
-
},
|
|
5763
|
-
{
|
|
5764
|
-
message: error.message,
|
|
5765
|
-
statusCode: response.status,
|
|
5766
|
-
duration,
|
|
5767
|
-
timestamp: Date.now()
|
|
5768
|
-
}
|
|
5769
|
-
);
|
|
5770
|
-
}
|
|
5771
|
-
throw error;
|
|
5772
|
-
}
|
|
5773
|
-
if (this.logger) {
|
|
5774
|
-
this.logger.logResponse(
|
|
5775
|
-
{
|
|
5776
|
-
method,
|
|
5777
|
-
url,
|
|
5778
|
-
headers,
|
|
5779
|
-
body: options?.formData || options?.body,
|
|
5780
|
-
timestamp: startTime
|
|
5781
|
-
},
|
|
5782
|
-
{
|
|
5783
|
-
status: response.status,
|
|
5784
|
-
statusText: response.statusText,
|
|
5785
|
-
data: response.data,
|
|
5786
|
-
duration,
|
|
5787
|
-
timestamp: Date.now()
|
|
5788
|
-
}
|
|
5789
|
-
);
|
|
5790
|
-
}
|
|
5791
|
-
return response.data;
|
|
5792
|
-
} catch (error) {
|
|
5793
|
-
const duration = Date.now() - startTime;
|
|
5794
|
-
if (error instanceof APIError4) {
|
|
5795
|
-
throw error;
|
|
5796
|
-
}
|
|
5797
|
-
const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
|
|
5798
|
-
if (this.logger) {
|
|
5799
|
-
if (isCORSError) {
|
|
5800
|
-
this.logger.error(`\u{1F6AB} CORS Error: ${method} ${url}`);
|
|
5801
|
-
this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
|
|
5802
|
-
this.logger.error(` \u2192 Configure security_domains parameter on the server`);
|
|
5803
|
-
} else {
|
|
5804
|
-
this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
|
|
5805
|
-
this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
|
|
5806
|
-
}
|
|
5807
|
-
}
|
|
5808
|
-
if (typeof window !== "undefined") {
|
|
5809
|
-
try {
|
|
5810
|
-
if (isCORSError) {
|
|
5811
|
-
window.dispatchEvent(new CustomEvent("cors-error", {
|
|
5812
|
-
detail: {
|
|
5813
|
-
url,
|
|
5814
|
-
method,
|
|
5815
|
-
error: error instanceof Error ? error.message : String(error),
|
|
5816
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
5817
|
-
},
|
|
5818
|
-
bubbles: true,
|
|
5819
|
-
cancelable: false
|
|
5820
|
-
}));
|
|
5821
|
-
} else {
|
|
5822
|
-
window.dispatchEvent(new CustomEvent("network-error", {
|
|
5823
|
-
detail: {
|
|
5824
|
-
url,
|
|
5825
|
-
method,
|
|
5826
|
-
error: error instanceof Error ? error.message : String(error),
|
|
5827
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
5828
|
-
},
|
|
5829
|
-
bubbles: true,
|
|
5830
|
-
cancelable: false
|
|
5831
|
-
}));
|
|
5832
|
-
}
|
|
5833
|
-
} catch (eventError) {
|
|
5834
|
-
}
|
|
5835
|
-
}
|
|
5836
|
-
const networkError = error instanceof Error ? new NetworkError4(error.message, url, error) : new NetworkError4("Unknown error", url);
|
|
5837
|
-
if (this.logger) {
|
|
5838
|
-
this.logger.logError(
|
|
5839
|
-
{
|
|
5840
|
-
method,
|
|
5841
|
-
url,
|
|
5842
|
-
headers,
|
|
5843
|
-
body: options?.formData || options?.body,
|
|
5844
|
-
timestamp: startTime
|
|
5845
|
-
},
|
|
5846
|
-
{
|
|
5847
|
-
message: networkError.message,
|
|
5848
|
-
duration,
|
|
5849
|
-
timestamp: Date.now()
|
|
5850
|
-
}
|
|
5851
|
-
);
|
|
5852
|
-
}
|
|
5853
|
-
throw networkError;
|
|
5854
|
-
}
|
|
5855
|
-
}
|
|
5856
|
-
};
|
|
5857
|
-
|
|
5858
|
-
// src/generated/cfg_webpush/storage.ts
|
|
5859
|
-
var LocalStorageAdapter4 = class {
|
|
5860
|
-
static {
|
|
5861
|
-
__name(this, "LocalStorageAdapter");
|
|
5862
|
-
}
|
|
5863
|
-
constructor(logger) {
|
|
5864
|
-
this.logger = logger;
|
|
5865
|
-
}
|
|
5866
|
-
getItem(key) {
|
|
5867
|
-
try {
|
|
5868
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
5869
|
-
const value = localStorage.getItem(key);
|
|
5870
|
-
this.logger?.debug(`LocalStorage.getItem("${key}"): ${value ? "found" : "not found"}`);
|
|
5871
|
-
return value;
|
|
5872
|
-
}
|
|
5873
|
-
this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
|
|
5874
|
-
} catch (error) {
|
|
5875
|
-
this.logger?.error("LocalStorage.getItem failed:", error);
|
|
5876
|
-
}
|
|
5877
|
-
return null;
|
|
5878
|
-
}
|
|
5879
|
-
setItem(key, value) {
|
|
5880
|
-
try {
|
|
5881
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
5882
|
-
localStorage.setItem(key, value);
|
|
5883
|
-
this.logger?.debug(`LocalStorage.setItem("${key}"): success`);
|
|
5884
|
-
} else {
|
|
5885
|
-
this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
|
|
5886
|
-
}
|
|
5887
|
-
} catch (error) {
|
|
5888
|
-
this.logger?.error("LocalStorage.setItem failed:", error);
|
|
5889
|
-
}
|
|
5890
|
-
}
|
|
5891
|
-
removeItem(key) {
|
|
5892
|
-
try {
|
|
5893
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
5894
|
-
localStorage.removeItem(key);
|
|
5895
|
-
this.logger?.debug(`LocalStorage.removeItem("${key}"): success`);
|
|
5896
|
-
} else {
|
|
5897
|
-
this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
|
|
5898
|
-
}
|
|
5899
|
-
} catch (error) {
|
|
5900
|
-
this.logger?.error("LocalStorage.removeItem failed:", error);
|
|
5901
|
-
}
|
|
5902
|
-
}
|
|
5903
|
-
};
|
|
5904
|
-
|
|
5905
|
-
// src/generated/cfg_webpush/_utils/schemas/index.ts
|
|
5906
|
-
var schemas_exports4 = {};
|
|
5907
|
-
__export(schemas_exports4, {
|
|
5908
|
-
SendPushRequestRequestSchema: () => SendPushRequestRequestSchema,
|
|
5909
|
-
SendPushResponseSchema: () => SendPushResponseSchema,
|
|
5910
|
-
SubscribeRequestRequestSchema: () => SubscribeRequestRequestSchema,
|
|
5911
|
-
SubscribeResponseSchema: () => SubscribeResponseSchema,
|
|
5912
|
-
VapidPublicKeyResponseSchema: () => VapidPublicKeyResponseSchema
|
|
5913
|
-
});
|
|
5914
|
-
|
|
5915
|
-
// src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
|
|
5916
|
-
var import_zod72 = require("zod");
|
|
5917
|
-
var SendPushRequestRequestSchema = import_zod72.z.object({
|
|
5918
|
-
title: import_zod72.z.string().min(1).max(255),
|
|
5919
|
-
body: import_zod72.z.string().min(1),
|
|
5920
|
-
icon: import_zod72.z.union([import_zod72.z.url(), import_zod72.z.literal("")]).nullable().optional(),
|
|
5921
|
-
url: import_zod72.z.union([import_zod72.z.url(), import_zod72.z.literal("")]).nullable().optional()
|
|
5922
|
-
});
|
|
5923
|
-
|
|
5924
|
-
// src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
|
|
5925
|
-
var import_zod73 = require("zod");
|
|
5926
|
-
var SendPushResponseSchema = import_zod73.z.object({
|
|
5927
|
-
success: import_zod73.z.boolean(),
|
|
5928
|
-
sent_to: import_zod73.z.int()
|
|
5929
|
-
});
|
|
5930
|
-
|
|
5931
|
-
// src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
|
|
5932
|
-
var import_zod74 = require("zod");
|
|
5933
|
-
var SubscribeRequestRequestSchema = import_zod74.z.object({
|
|
5934
|
-
endpoint: import_zod74.z.union([import_zod74.z.url(), import_zod74.z.literal("")]),
|
|
5935
|
-
keys: import_zod74.z.record(import_zod74.z.string(), import_zod74.z.string().min(1))
|
|
5936
|
-
});
|
|
5937
|
-
|
|
5938
|
-
// src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
|
|
5939
|
-
var import_zod75 = require("zod");
|
|
5940
|
-
var SubscribeResponseSchema = import_zod75.z.object({
|
|
5941
|
-
success: import_zod75.z.boolean(),
|
|
5942
|
-
subscription_id: import_zod75.z.int(),
|
|
5943
|
-
created: import_zod75.z.boolean()
|
|
5944
|
-
});
|
|
5945
|
-
|
|
5946
|
-
// src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
|
|
5947
|
-
var import_zod76 = require("zod");
|
|
5948
|
-
var VapidPublicKeyResponseSchema = import_zod76.z.object({
|
|
5949
|
-
publicKey: import_zod76.z.string()
|
|
5950
|
-
});
|
|
5951
|
-
|
|
5952
|
-
// src/generated/cfg_webpush/_utils/fetchers/index.ts
|
|
5953
|
-
var fetchers_exports4 = {};
|
|
5954
|
-
__export(fetchers_exports4, {
|
|
5955
|
-
createWebpushSendCreate: () => createWebpushSendCreate,
|
|
5956
|
-
createWebpushSubscribeCreate: () => createWebpushSubscribeCreate,
|
|
5957
|
-
getWebpushVapidRetrieve: () => getWebpushVapidRetrieve
|
|
5958
|
-
});
|
|
5959
|
-
|
|
5960
|
-
// src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
|
|
5961
|
-
var import_consola17 = require("consola");
|
|
5962
|
-
|
|
5963
|
-
// src/generated/cfg_webpush/api-instance.ts
|
|
5964
|
-
var globalAPI4 = null;
|
|
5965
|
-
var autoConfigAttempted4 = false;
|
|
5966
|
-
function tryAutoConfigureFromEnv4() {
|
|
5967
|
-
if (autoConfigAttempted4) return;
|
|
5968
|
-
autoConfigAttempted4 = true;
|
|
5969
|
-
if (globalAPI4) return;
|
|
5970
|
-
if (typeof process === "undefined" || !process.env) return;
|
|
5971
|
-
const baseUrl = process.env.NEXT_PUBLIC_API_URL || process.env.VITE_API_URL || process.env.REACT_APP_API_URL || process.env.API_URL;
|
|
5972
|
-
if (baseUrl) {
|
|
5973
|
-
globalAPI4 = new API4(baseUrl);
|
|
5974
|
-
}
|
|
5975
|
-
}
|
|
5976
|
-
__name(tryAutoConfigureFromEnv4, "tryAutoConfigureFromEnv");
|
|
5977
|
-
function getAPIInstance4() {
|
|
5978
|
-
tryAutoConfigureFromEnv4();
|
|
5979
|
-
if (!globalAPI4) {
|
|
5980
|
-
throw new Error(
|
|
5981
|
-
'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'
|
|
5982
|
-
);
|
|
5983
|
-
}
|
|
5984
|
-
return globalAPI4;
|
|
5985
|
-
}
|
|
5986
|
-
__name(getAPIInstance4, "getAPIInstance");
|
|
5987
|
-
|
|
5988
|
-
// src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
|
|
5989
|
-
async function createWebpushSendCreate(data, client) {
|
|
5990
|
-
const api = client || getAPIInstance4();
|
|
5991
|
-
const response = await api.web_push.webpushSendCreate(data);
|
|
5992
|
-
try {
|
|
5993
|
-
return SendPushResponseSchema.parse(response);
|
|
5994
|
-
} catch (error) {
|
|
5995
|
-
import_consola17.consola.error("\u274C Zod Validation Failed");
|
|
5996
|
-
import_consola17.consola.box(`createWebpushSendCreate
|
|
5997
|
-
Path: /cfg/webpush/send/
|
|
5998
|
-
Method: POST`);
|
|
5999
|
-
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
6000
|
-
import_consola17.consola.error("Validation Issues:");
|
|
6001
|
-
error.issues.forEach((issue, index) => {
|
|
6002
|
-
import_consola17.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
6003
|
-
import_consola17.consola.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
6004
|
-
if (issue.expected) import_consola17.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
6005
|
-
if (issue.received) import_consola17.consola.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
6006
|
-
});
|
|
6007
|
-
}
|
|
6008
|
-
import_consola17.consola.error("Response data:", response);
|
|
6009
|
-
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
6010
|
-
try {
|
|
6011
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
6012
|
-
detail: {
|
|
6013
|
-
operation: "createWebpushSendCreate",
|
|
6014
|
-
path: "/cfg/webpush/send/",
|
|
6015
|
-
method: "POST",
|
|
6016
|
-
error,
|
|
6017
|
-
response,
|
|
6018
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
6019
|
-
},
|
|
6020
|
-
bubbles: true,
|
|
6021
|
-
cancelable: false
|
|
6022
|
-
});
|
|
6023
|
-
window.dispatchEvent(event);
|
|
6024
|
-
} catch (eventError) {
|
|
6025
|
-
import_consola17.consola.warn("Failed to dispatch validation error event:", eventError);
|
|
6026
|
-
}
|
|
6027
|
-
}
|
|
6028
|
-
throw error;
|
|
6029
|
-
}
|
|
6030
|
-
}
|
|
6031
|
-
__name(createWebpushSendCreate, "createWebpushSendCreate");
|
|
6032
|
-
async function createWebpushSubscribeCreate(data, client) {
|
|
6033
|
-
const api = client || getAPIInstance4();
|
|
6034
|
-
const response = await api.web_push.webpushSubscribeCreate(data);
|
|
6035
|
-
try {
|
|
6036
|
-
return SubscribeResponseSchema.parse(response);
|
|
6037
|
-
} catch (error) {
|
|
6038
|
-
import_consola17.consola.error("\u274C Zod Validation Failed");
|
|
6039
|
-
import_consola17.consola.box(`createWebpushSubscribeCreate
|
|
6040
|
-
Path: /cfg/webpush/subscribe/
|
|
6041
|
-
Method: POST`);
|
|
6042
|
-
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
6043
|
-
import_consola17.consola.error("Validation Issues:");
|
|
6044
|
-
error.issues.forEach((issue, index) => {
|
|
6045
|
-
import_consola17.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
6046
|
-
import_consola17.consola.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
6047
|
-
if (issue.expected) import_consola17.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
6048
|
-
if (issue.received) import_consola17.consola.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
6049
|
-
});
|
|
6050
|
-
}
|
|
6051
|
-
import_consola17.consola.error("Response data:", response);
|
|
6052
|
-
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
6053
|
-
try {
|
|
6054
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
6055
|
-
detail: {
|
|
6056
|
-
operation: "createWebpushSubscribeCreate",
|
|
6057
|
-
path: "/cfg/webpush/subscribe/",
|
|
6058
|
-
method: "POST",
|
|
6059
|
-
error,
|
|
6060
|
-
response,
|
|
6061
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
6062
|
-
},
|
|
6063
|
-
bubbles: true,
|
|
6064
|
-
cancelable: false
|
|
6065
|
-
});
|
|
6066
|
-
window.dispatchEvent(event);
|
|
6067
|
-
} catch (eventError) {
|
|
6068
|
-
import_consola17.consola.warn("Failed to dispatch validation error event:", eventError);
|
|
6069
|
-
}
|
|
6070
|
-
}
|
|
6071
|
-
throw error;
|
|
6072
|
-
}
|
|
6073
|
-
}
|
|
6074
|
-
__name(createWebpushSubscribeCreate, "createWebpushSubscribeCreate");
|
|
6075
|
-
async function getWebpushVapidRetrieve(client) {
|
|
6076
|
-
const api = client || getAPIInstance4();
|
|
6077
|
-
const response = await api.web_push.webpushVapidRetrieve();
|
|
6078
|
-
try {
|
|
6079
|
-
return VapidPublicKeyResponseSchema.parse(response);
|
|
6080
|
-
} catch (error) {
|
|
6081
|
-
import_consola17.consola.error("\u274C Zod Validation Failed");
|
|
6082
|
-
import_consola17.consola.box(`getWebpushVapidRetrieve
|
|
6083
|
-
Path: /cfg/webpush/vapid/
|
|
6084
|
-
Method: GET`);
|
|
6085
|
-
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
6086
|
-
import_consola17.consola.error("Validation Issues:");
|
|
6087
|
-
error.issues.forEach((issue, index) => {
|
|
6088
|
-
import_consola17.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
6089
|
-
import_consola17.consola.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
6090
|
-
if (issue.expected) import_consola17.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
6091
|
-
if (issue.received) import_consola17.consola.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
6092
|
-
});
|
|
6093
|
-
}
|
|
6094
|
-
import_consola17.consola.error("Response data:", response);
|
|
6095
|
-
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
6096
|
-
try {
|
|
6097
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
6098
|
-
detail: {
|
|
6099
|
-
operation: "getWebpushVapidRetrieve",
|
|
6100
|
-
path: "/cfg/webpush/vapid/",
|
|
6101
|
-
method: "GET",
|
|
6102
|
-
error,
|
|
6103
|
-
response,
|
|
6104
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
6105
|
-
},
|
|
6106
|
-
bubbles: true,
|
|
6107
|
-
cancelable: false
|
|
6108
|
-
});
|
|
6109
|
-
window.dispatchEvent(event);
|
|
6110
|
-
} catch (eventError) {
|
|
6111
|
-
import_consola17.consola.warn("Failed to dispatch validation error event:", eventError);
|
|
6112
|
-
}
|
|
6113
|
-
}
|
|
6114
|
-
throw error;
|
|
6115
|
-
}
|
|
6116
|
-
}
|
|
6117
|
-
__name(getWebpushVapidRetrieve, "getWebpushVapidRetrieve");
|
|
6118
|
-
|
|
6119
|
-
// src/generated/cfg_webpush/index.ts
|
|
6120
|
-
var TOKEN_KEY4 = "auth_token";
|
|
6121
|
-
var REFRESH_TOKEN_KEY4 = "refresh_token";
|
|
6122
|
-
var API4 = class {
|
|
6123
|
-
constructor(baseUrl, options) {
|
|
6124
|
-
this._token = null;
|
|
6125
|
-
this._refreshToken = null;
|
|
6126
|
-
this.baseUrl = baseUrl;
|
|
6127
|
-
this.options = options;
|
|
6128
|
-
const logger = options?.loggerConfig ? new APILogger4(options.loggerConfig) : void 0;
|
|
6129
|
-
this.storage = options?.storage || new LocalStorageAdapter4(logger);
|
|
6130
|
-
this._loadTokensFromStorage();
|
|
6131
|
-
this._client = new APIClient4(this.baseUrl, {
|
|
6132
|
-
retryConfig: this.options?.retryConfig,
|
|
6133
|
-
loggerConfig: this.options?.loggerConfig,
|
|
6134
|
-
tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
|
|
6135
|
-
});
|
|
6136
|
-
this._injectAuthHeader();
|
|
6137
|
-
this.web_push = this._client.web_push;
|
|
6138
|
-
}
|
|
6139
|
-
static {
|
|
6140
|
-
__name(this, "API");
|
|
6141
|
-
}
|
|
6142
|
-
_loadTokensFromStorage() {
|
|
6143
|
-
this._token = this.storage.getItem(TOKEN_KEY4);
|
|
6144
|
-
this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY4);
|
|
6145
|
-
}
|
|
6146
|
-
_reinitClients() {
|
|
6147
|
-
this._client = new APIClient4(this.baseUrl, {
|
|
6148
|
-
retryConfig: this.options?.retryConfig,
|
|
6149
|
-
loggerConfig: this.options?.loggerConfig,
|
|
6150
|
-
tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
|
|
6151
|
-
});
|
|
6152
|
-
this._injectAuthHeader();
|
|
6153
|
-
this.web_push = this._client.web_push;
|
|
6154
|
-
}
|
|
6155
|
-
_injectAuthHeader() {
|
|
6156
|
-
const originalRequest = this._client.request.bind(this._client);
|
|
6157
|
-
this._client.request = async (method, path, options) => {
|
|
6158
|
-
const token = this.getToken();
|
|
6159
|
-
const mergedOptions = {
|
|
6160
|
-
...options,
|
|
6161
|
-
headers: {
|
|
6162
|
-
...options?.headers || {},
|
|
6163
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
6164
|
-
}
|
|
6165
|
-
};
|
|
6166
|
-
return originalRequest(method, path, mergedOptions);
|
|
6167
|
-
};
|
|
6168
|
-
}
|
|
6169
|
-
/**
|
|
6170
|
-
* Get current JWT token
|
|
6171
|
-
*/
|
|
6172
|
-
getToken() {
|
|
6173
|
-
return this.storage.getItem(TOKEN_KEY4);
|
|
6174
|
-
}
|
|
6175
|
-
/**
|
|
6176
|
-
* Get current refresh token
|
|
6177
|
-
*/
|
|
6178
|
-
getRefreshToken() {
|
|
6179
|
-
return this.storage.getItem(REFRESH_TOKEN_KEY4);
|
|
6180
|
-
}
|
|
6181
|
-
/**
|
|
6182
|
-
* Set JWT token and refresh token
|
|
6183
|
-
* @param token - JWT access token
|
|
6184
|
-
* @param refreshToken - JWT refresh token (optional)
|
|
6185
|
-
*/
|
|
6186
|
-
setToken(token, refreshToken) {
|
|
6187
|
-
this._token = token;
|
|
6188
|
-
this.storage.setItem(TOKEN_KEY4, token);
|
|
6189
|
-
if (refreshToken) {
|
|
6190
|
-
this._refreshToken = refreshToken;
|
|
6191
|
-
this.storage.setItem(REFRESH_TOKEN_KEY4, refreshToken);
|
|
6192
|
-
}
|
|
6193
|
-
this._reinitClients();
|
|
6194
|
-
}
|
|
6195
|
-
/**
|
|
6196
|
-
* Clear all tokens
|
|
6197
|
-
*/
|
|
6198
|
-
clearTokens() {
|
|
6199
|
-
this._token = null;
|
|
6200
|
-
this._refreshToken = null;
|
|
6201
|
-
this.storage.removeItem(TOKEN_KEY4);
|
|
6202
|
-
this.storage.removeItem(REFRESH_TOKEN_KEY4);
|
|
6203
|
-
this._reinitClients();
|
|
6204
|
-
}
|
|
6205
|
-
/**
|
|
6206
|
-
* Check if user is authenticated
|
|
6207
|
-
*/
|
|
6208
|
-
isAuthenticated() {
|
|
6209
|
-
return !!this.getToken();
|
|
6210
|
-
}
|
|
6211
|
-
/**
|
|
6212
|
-
* Update base URL and reinitialize clients
|
|
6213
|
-
* @param url - New base URL
|
|
6214
|
-
*/
|
|
6215
|
-
setBaseUrl(url) {
|
|
6216
|
-
this.baseUrl = url;
|
|
6217
|
-
this._reinitClients();
|
|
6218
|
-
}
|
|
6219
|
-
/**
|
|
6220
|
-
* Get current base URL
|
|
6221
|
-
*/
|
|
6222
|
-
getBaseUrl() {
|
|
6223
|
-
return this.baseUrl;
|
|
6224
|
-
}
|
|
6225
|
-
/**
|
|
6226
|
-
* Get OpenAPI schema path
|
|
6227
|
-
* @returns Path to the OpenAPI schema JSON file
|
|
6228
|
-
*
|
|
6229
|
-
* Note: The OpenAPI schema is available in the schema.json file.
|
|
6230
|
-
* You can load it dynamically using:
|
|
6231
|
-
* ```typescript
|
|
6232
|
-
* const schema = await fetch('./schema.json').then(r => r.json());
|
|
6233
|
-
* // or using fs in Node.js:
|
|
6234
|
-
* // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
|
|
6235
|
-
* ```
|
|
6236
|
-
*/
|
|
6237
|
-
getSchemaPath() {
|
|
6238
|
-
return "./schema.json";
|
|
6239
|
-
}
|
|
6240
|
-
};
|
|
6241
|
-
|
|
6242
5243
|
// src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts
|
|
6243
5244
|
var import_swr = require("swr");
|
|
6244
5245
|
function useCreateAccountsTokenRefreshCreate() {
|
|
@@ -6382,46 +5383,9 @@ function useCreateAccountsOtpVerifyCreate() {
|
|
|
6382
5383
|
}
|
|
6383
5384
|
__name(useCreateAccountsOtpVerifyCreate, "useCreateAccountsOtpVerifyCreate");
|
|
6384
5385
|
|
|
6385
|
-
// src/generated/
|
|
5386
|
+
// src/generated/cfg_centrifugo/_utils/hooks/index.ts
|
|
6386
5387
|
var hooks_exports = {};
|
|
6387
5388
|
__export(hooks_exports, {
|
|
6388
|
-
useCreateWebpushSendCreate: () => useCreateWebpushSendCreate,
|
|
6389
|
-
useCreateWebpushSubscribeCreate: () => useCreateWebpushSubscribeCreate,
|
|
6390
|
-
useWebpushVapidRetrieve: () => useWebpushVapidRetrieve
|
|
6391
|
-
});
|
|
6392
|
-
|
|
6393
|
-
// src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts
|
|
6394
|
-
var import_swr7 = __toESM(require("swr"), 1);
|
|
6395
|
-
var import_swr8 = require("swr");
|
|
6396
|
-
function useCreateWebpushSendCreate() {
|
|
6397
|
-
const { mutate } = (0, import_swr8.useSWRConfig)();
|
|
6398
|
-
return async (data, client) => {
|
|
6399
|
-
const result = await createWebpushSendCreate(data, client);
|
|
6400
|
-
mutate("cfg-webpush-send");
|
|
6401
|
-
return result;
|
|
6402
|
-
};
|
|
6403
|
-
}
|
|
6404
|
-
__name(useCreateWebpushSendCreate, "useCreateWebpushSendCreate");
|
|
6405
|
-
function useCreateWebpushSubscribeCreate() {
|
|
6406
|
-
const { mutate } = (0, import_swr8.useSWRConfig)();
|
|
6407
|
-
return async (data, client) => {
|
|
6408
|
-
const result = await createWebpushSubscribeCreate(data, client);
|
|
6409
|
-
mutate("cfg-webpush-subscribe");
|
|
6410
|
-
return result;
|
|
6411
|
-
};
|
|
6412
|
-
}
|
|
6413
|
-
__name(useCreateWebpushSubscribeCreate, "useCreateWebpushSubscribeCreate");
|
|
6414
|
-
function useWebpushVapidRetrieve(client) {
|
|
6415
|
-
return (0, import_swr7.default)(
|
|
6416
|
-
"cfg-webpush-vapid",
|
|
6417
|
-
() => getWebpushVapidRetrieve(client)
|
|
6418
|
-
);
|
|
6419
|
-
}
|
|
6420
|
-
__name(useWebpushVapidRetrieve, "useWebpushVapidRetrieve");
|
|
6421
|
-
|
|
6422
|
-
// src/generated/cfg_centrifugo/_utils/hooks/index.ts
|
|
6423
|
-
var hooks_exports2 = {};
|
|
6424
|
-
__export(hooks_exports2, {
|
|
6425
5389
|
useCentrifugoAuthTokenRetrieve: () => useCentrifugoAuthTokenRetrieve,
|
|
6426
5390
|
useCentrifugoMonitorChannelsRetrieve: () => useCentrifugoMonitorChannelsRetrieve,
|
|
6427
5391
|
useCentrifugoMonitorHealthRetrieve: () => useCentrifugoMonitorHealthRetrieve,
|
|
@@ -6440,9 +5404,9 @@ __export(hooks_exports2, {
|
|
|
6440
5404
|
});
|
|
6441
5405
|
|
|
6442
5406
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts
|
|
6443
|
-
var
|
|
5407
|
+
var import_swr7 = require("swr");
|
|
6444
5408
|
function useCreateCentrifugoServerAuthTokenCreate() {
|
|
6445
|
-
const { mutate } = (0,
|
|
5409
|
+
const { mutate } = (0, import_swr7.useSWRConfig)();
|
|
6446
5410
|
return async (client) => {
|
|
6447
5411
|
const result = await createCentrifugoServerAuthTokenCreate(client);
|
|
6448
5412
|
mutate("cfg-centrifugo-server-auth-token");
|
|
@@ -6451,7 +5415,7 @@ function useCreateCentrifugoServerAuthTokenCreate() {
|
|
|
6451
5415
|
}
|
|
6452
5416
|
__name(useCreateCentrifugoServerAuthTokenCreate, "useCreateCentrifugoServerAuthTokenCreate");
|
|
6453
5417
|
function useCreateCentrifugoServerChannelsCreate() {
|
|
6454
|
-
const { mutate } = (0,
|
|
5418
|
+
const { mutate } = (0, import_swr7.useSWRConfig)();
|
|
6455
5419
|
return async (data, client) => {
|
|
6456
5420
|
const result = await createCentrifugoServerChannelsCreate(data, client);
|
|
6457
5421
|
mutate("cfg-centrifugo-server-channels");
|
|
@@ -6460,7 +5424,7 @@ function useCreateCentrifugoServerChannelsCreate() {
|
|
|
6460
5424
|
}
|
|
6461
5425
|
__name(useCreateCentrifugoServerChannelsCreate, "useCreateCentrifugoServerChannelsCreate");
|
|
6462
5426
|
function useCreateCentrifugoServerHistoryCreate() {
|
|
6463
|
-
const { mutate } = (0,
|
|
5427
|
+
const { mutate } = (0, import_swr7.useSWRConfig)();
|
|
6464
5428
|
return async (data, client) => {
|
|
6465
5429
|
const result = await createCentrifugoServerHistoryCreate(data, client);
|
|
6466
5430
|
mutate("cfg-centrifugo-server-history");
|
|
@@ -6469,7 +5433,7 @@ function useCreateCentrifugoServerHistoryCreate() {
|
|
|
6469
5433
|
}
|
|
6470
5434
|
__name(useCreateCentrifugoServerHistoryCreate, "useCreateCentrifugoServerHistoryCreate");
|
|
6471
5435
|
function useCreateCentrifugoServerInfoCreate() {
|
|
6472
|
-
const { mutate } = (0,
|
|
5436
|
+
const { mutate } = (0, import_swr7.useSWRConfig)();
|
|
6473
5437
|
return async (client) => {
|
|
6474
5438
|
const result = await createCentrifugoServerInfoCreate(client);
|
|
6475
5439
|
mutate("cfg-centrifugo-server-info");
|
|
@@ -6478,7 +5442,7 @@ function useCreateCentrifugoServerInfoCreate() {
|
|
|
6478
5442
|
}
|
|
6479
5443
|
__name(useCreateCentrifugoServerInfoCreate, "useCreateCentrifugoServerInfoCreate");
|
|
6480
5444
|
function useCreateCentrifugoServerPresenceCreate() {
|
|
6481
|
-
const { mutate } = (0,
|
|
5445
|
+
const { mutate } = (0, import_swr7.useSWRConfig)();
|
|
6482
5446
|
return async (data, client) => {
|
|
6483
5447
|
const result = await createCentrifugoServerPresenceCreate(data, client);
|
|
6484
5448
|
mutate("cfg-centrifugo-server-presence");
|
|
@@ -6487,7 +5451,7 @@ function useCreateCentrifugoServerPresenceCreate() {
|
|
|
6487
5451
|
}
|
|
6488
5452
|
__name(useCreateCentrifugoServerPresenceCreate, "useCreateCentrifugoServerPresenceCreate");
|
|
6489
5453
|
function useCreateCentrifugoServerPresenceStatsCreate() {
|
|
6490
|
-
const { mutate } = (0,
|
|
5454
|
+
const { mutate } = (0, import_swr7.useSWRConfig)();
|
|
6491
5455
|
return async (data, client) => {
|
|
6492
5456
|
const result = await createCentrifugoServerPresenceStatsCreate(data, client);
|
|
6493
5457
|
mutate("cfg-centrifugo-server-presence-stats");
|
|
@@ -6497,9 +5461,9 @@ function useCreateCentrifugoServerPresenceStatsCreate() {
|
|
|
6497
5461
|
__name(useCreateCentrifugoServerPresenceStatsCreate, "useCreateCentrifugoServerPresenceStatsCreate");
|
|
6498
5462
|
|
|
6499
5463
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts
|
|
6500
|
-
var
|
|
5464
|
+
var import_swr8 = __toESM(require("swr"), 1);
|
|
6501
5465
|
function useCentrifugoAuthTokenRetrieve(client) {
|
|
6502
|
-
return (0,
|
|
5466
|
+
return (0, import_swr8.default)(
|
|
6503
5467
|
"cfg-centrifugo-auth-token",
|
|
6504
5468
|
() => getCentrifugoAuthTokenRetrieve(client)
|
|
6505
5469
|
);
|
|
@@ -6507,37 +5471,37 @@ function useCentrifugoAuthTokenRetrieve(client) {
|
|
|
6507
5471
|
__name(useCentrifugoAuthTokenRetrieve, "useCentrifugoAuthTokenRetrieve");
|
|
6508
5472
|
|
|
6509
5473
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts
|
|
6510
|
-
var
|
|
5474
|
+
var import_swr9 = __toESM(require("swr"), 1);
|
|
6511
5475
|
function useCentrifugoMonitorChannelsRetrieve(params, client) {
|
|
6512
|
-
return (0,
|
|
5476
|
+
return (0, import_swr9.default)(
|
|
6513
5477
|
params ? ["cfg-centrifugo-monitor-channel", params] : "cfg-centrifugo-monitor-channel",
|
|
6514
5478
|
() => getCentrifugoMonitorChannelsRetrieve(params, client)
|
|
6515
5479
|
);
|
|
6516
5480
|
}
|
|
6517
5481
|
__name(useCentrifugoMonitorChannelsRetrieve, "useCentrifugoMonitorChannelsRetrieve");
|
|
6518
5482
|
function useCentrifugoMonitorHealthRetrieve(client) {
|
|
6519
|
-
return (0,
|
|
5483
|
+
return (0, import_swr9.default)(
|
|
6520
5484
|
"cfg-centrifugo-monitor-health",
|
|
6521
5485
|
() => getCentrifugoMonitorHealthRetrieve(client)
|
|
6522
5486
|
);
|
|
6523
5487
|
}
|
|
6524
5488
|
__name(useCentrifugoMonitorHealthRetrieve, "useCentrifugoMonitorHealthRetrieve");
|
|
6525
5489
|
function useCentrifugoMonitorOverviewRetrieve(params, client) {
|
|
6526
|
-
return (0,
|
|
5490
|
+
return (0, import_swr9.default)(
|
|
6527
5491
|
params ? ["cfg-centrifugo-monitor-overview", params] : "cfg-centrifugo-monitor-overview",
|
|
6528
5492
|
() => getCentrifugoMonitorOverviewRetrieve(params, client)
|
|
6529
5493
|
);
|
|
6530
5494
|
}
|
|
6531
5495
|
__name(useCentrifugoMonitorOverviewRetrieve, "useCentrifugoMonitorOverviewRetrieve");
|
|
6532
5496
|
function useCentrifugoMonitorPublishesList(params, client) {
|
|
6533
|
-
return (0,
|
|
5497
|
+
return (0, import_swr9.default)(
|
|
6534
5498
|
params ? ["cfg-centrifugo-monitor-publishes", params] : "cfg-centrifugo-monitor-publishes",
|
|
6535
5499
|
() => getCentrifugoMonitorPublishesList(params, client)
|
|
6536
5500
|
);
|
|
6537
5501
|
}
|
|
6538
5502
|
__name(useCentrifugoMonitorPublishesList, "useCentrifugoMonitorPublishesList");
|
|
6539
5503
|
function useCentrifugoMonitorTimelineRetrieve(params, client) {
|
|
6540
|
-
return (0,
|
|
5504
|
+
return (0, import_swr9.default)(
|
|
6541
5505
|
params ? ["cfg-centrifugo-monitor-timeline", params] : "cfg-centrifugo-monitor-timeline",
|
|
6542
5506
|
() => getCentrifugoMonitorTimelineRetrieve(params, client)
|
|
6543
5507
|
);
|
|
@@ -6545,9 +5509,9 @@ function useCentrifugoMonitorTimelineRetrieve(params, client) {
|
|
|
6545
5509
|
__name(useCentrifugoMonitorTimelineRetrieve, "useCentrifugoMonitorTimelineRetrieve");
|
|
6546
5510
|
|
|
6547
5511
|
// src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts
|
|
6548
|
-
var
|
|
5512
|
+
var import_swr10 = require("swr");
|
|
6549
5513
|
function useCreateCentrifugoTestingPublishTestCreate() {
|
|
6550
|
-
const { mutate } = (0,
|
|
5514
|
+
const { mutate } = (0, import_swr10.useSWRConfig)();
|
|
6551
5515
|
return async (data, client) => {
|
|
6552
5516
|
const result = await createCentrifugoTestingPublishTestCreate(data, client);
|
|
6553
5517
|
mutate("cfg-centrifugo-testing-publish-test");
|
|
@@ -6556,7 +5520,7 @@ function useCreateCentrifugoTestingPublishTestCreate() {
|
|
|
6556
5520
|
}
|
|
6557
5521
|
__name(useCreateCentrifugoTestingPublishTestCreate, "useCreateCentrifugoTestingPublishTestCreate");
|
|
6558
5522
|
function useCreateCentrifugoTestingPublishWithLoggingCreate() {
|
|
6559
|
-
const { mutate } = (0,
|
|
5523
|
+
const { mutate } = (0, import_swr10.useSWRConfig)();
|
|
6560
5524
|
return async (data, client) => {
|
|
6561
5525
|
const result = await createCentrifugoTestingPublishWithLoggingCreate(data, client);
|
|
6562
5526
|
mutate("cfg-centrifugo-testing-publish-with-logging");
|
|
@@ -6565,7 +5529,7 @@ function useCreateCentrifugoTestingPublishWithLoggingCreate() {
|
|
|
6565
5529
|
}
|
|
6566
5530
|
__name(useCreateCentrifugoTestingPublishWithLoggingCreate, "useCreateCentrifugoTestingPublishWithLoggingCreate");
|
|
6567
5531
|
function useCreateCentrifugoTestingSendAckCreate() {
|
|
6568
|
-
const { mutate } = (0,
|
|
5532
|
+
const { mutate } = (0, import_swr10.useSWRConfig)();
|
|
6569
5533
|
return async (data, client) => {
|
|
6570
5534
|
const result = await createCentrifugoTestingSendAckCreate(data, client);
|
|
6571
5535
|
mutate("cfg-centrifugo-testing-send-ack");
|
|
@@ -6575,8 +5539,8 @@ function useCreateCentrifugoTestingSendAckCreate() {
|
|
|
6575
5539
|
__name(useCreateCentrifugoTestingSendAckCreate, "useCreateCentrifugoTestingSendAckCreate");
|
|
6576
5540
|
|
|
6577
5541
|
// src/generated/cfg_totp/_utils/hooks/index.ts
|
|
6578
|
-
var
|
|
6579
|
-
__export(
|
|
5542
|
+
var hooks_exports2 = {};
|
|
5543
|
+
__export(hooks_exports2, {
|
|
6580
5544
|
useCreateTotpBackupCodesRegenerateCreate: () => useCreateTotpBackupCodesRegenerateCreate,
|
|
6581
5545
|
useCreateTotpDisableCreate: () => useCreateTotpDisableCreate,
|
|
6582
5546
|
useCreateTotpSetupConfirmCreate: () => useCreateTotpSetupConfirmCreate,
|
|
@@ -6589,17 +5553,17 @@ __export(hooks_exports3, {
|
|
|
6589
5553
|
});
|
|
6590
5554
|
|
|
6591
5555
|
// src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts
|
|
6592
|
-
var
|
|
6593
|
-
var
|
|
5556
|
+
var import_swr11 = __toESM(require("swr"), 1);
|
|
5557
|
+
var import_swr12 = require("swr");
|
|
6594
5558
|
function useTotpBackupCodesRetrieve(client) {
|
|
6595
|
-
return (0,
|
|
5559
|
+
return (0, import_swr11.default)(
|
|
6596
5560
|
"cfg-totp-backup-code",
|
|
6597
5561
|
() => getTotpBackupCodesRetrieve(client)
|
|
6598
5562
|
);
|
|
6599
5563
|
}
|
|
6600
5564
|
__name(useTotpBackupCodesRetrieve, "useTotpBackupCodesRetrieve");
|
|
6601
5565
|
function useCreateTotpBackupCodesRegenerateCreate() {
|
|
6602
|
-
const { mutate } = (0,
|
|
5566
|
+
const { mutate } = (0, import_swr12.useSWRConfig)();
|
|
6603
5567
|
return async (data, client) => {
|
|
6604
5568
|
const result = await createTotpBackupCodesRegenerateCreate(data, client);
|
|
6605
5569
|
mutate("cfg-totp-backup-codes-regenerate");
|
|
@@ -6609,17 +5573,17 @@ function useCreateTotpBackupCodesRegenerateCreate() {
|
|
|
6609
5573
|
__name(useCreateTotpBackupCodesRegenerateCreate, "useCreateTotpBackupCodesRegenerateCreate");
|
|
6610
5574
|
|
|
6611
5575
|
// src/generated/cfg_totp/_utils/hooks/totp__totp_management.ts
|
|
6612
|
-
var
|
|
6613
|
-
var
|
|
5576
|
+
var import_swr13 = __toESM(require("swr"), 1);
|
|
5577
|
+
var import_swr14 = require("swr");
|
|
6614
5578
|
function useTotpDevicesList(params, client) {
|
|
6615
|
-
return (0,
|
|
5579
|
+
return (0, import_swr13.default)(
|
|
6616
5580
|
params ? ["cfg-totp-devices", params] : "cfg-totp-devices",
|
|
6617
5581
|
() => getTotpDevicesList(params, client)
|
|
6618
5582
|
);
|
|
6619
5583
|
}
|
|
6620
5584
|
__name(useTotpDevicesList, "useTotpDevicesList");
|
|
6621
5585
|
function useCreateTotpDisableCreate() {
|
|
6622
|
-
const { mutate } = (0,
|
|
5586
|
+
const { mutate } = (0, import_swr14.useSWRConfig)();
|
|
6623
5587
|
return async (data, client) => {
|
|
6624
5588
|
const result = await createTotpDisableCreate(data, client);
|
|
6625
5589
|
mutate("cfg-totp-disable");
|
|
@@ -6629,9 +5593,9 @@ function useCreateTotpDisableCreate() {
|
|
|
6629
5593
|
__name(useCreateTotpDisableCreate, "useCreateTotpDisableCreate");
|
|
6630
5594
|
|
|
6631
5595
|
// src/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts
|
|
6632
|
-
var
|
|
5596
|
+
var import_swr15 = require("swr");
|
|
6633
5597
|
function useCreateTotpSetupCreate() {
|
|
6634
|
-
const { mutate } = (0,
|
|
5598
|
+
const { mutate } = (0, import_swr15.useSWRConfig)();
|
|
6635
5599
|
return async (data, client) => {
|
|
6636
5600
|
const result = await createTotpSetupCreate(data, client);
|
|
6637
5601
|
mutate("cfg-totp-setup");
|
|
@@ -6640,7 +5604,7 @@ function useCreateTotpSetupCreate() {
|
|
|
6640
5604
|
}
|
|
6641
5605
|
__name(useCreateTotpSetupCreate, "useCreateTotpSetupCreate");
|
|
6642
5606
|
function useCreateTotpSetupConfirmCreate() {
|
|
6643
|
-
const { mutate } = (0,
|
|
5607
|
+
const { mutate } = (0, import_swr15.useSWRConfig)();
|
|
6644
5608
|
return async (data, client) => {
|
|
6645
5609
|
const result = await createTotpSetupConfirmCreate(data, client);
|
|
6646
5610
|
mutate("cfg-totp-setup-confirm");
|
|
@@ -6650,9 +5614,9 @@ function useCreateTotpSetupConfirmCreate() {
|
|
|
6650
5614
|
__name(useCreateTotpSetupConfirmCreate, "useCreateTotpSetupConfirmCreate");
|
|
6651
5615
|
|
|
6652
5616
|
// src/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts
|
|
6653
|
-
var
|
|
5617
|
+
var import_swr16 = require("swr");
|
|
6654
5618
|
function useCreateTotpVerifyCreate() {
|
|
6655
|
-
const { mutate } = (0,
|
|
5619
|
+
const { mutate } = (0, import_swr16.useSWRConfig)();
|
|
6656
5620
|
return async (data, client) => {
|
|
6657
5621
|
const result = await createTotpVerifyCreate(data, client);
|
|
6658
5622
|
mutate("cfg-totp-verify");
|
|
@@ -6661,7 +5625,7 @@ function useCreateTotpVerifyCreate() {
|
|
|
6661
5625
|
}
|
|
6662
5626
|
__name(useCreateTotpVerifyCreate, "useCreateTotpVerifyCreate");
|
|
6663
5627
|
function useCreateTotpVerifyBackupCreate() {
|
|
6664
|
-
const { mutate } = (0,
|
|
5628
|
+
const { mutate } = (0, import_swr16.useSWRConfig)();
|
|
6665
5629
|
return async (data, client) => {
|
|
6666
5630
|
const result = await createTotpVerifyBackupCreate(data, client);
|
|
6667
5631
|
mutate("cfg-totp-verify-backup");
|
|
@@ -6671,9 +5635,9 @@ function useCreateTotpVerifyBackupCreate() {
|
|
|
6671
5635
|
__name(useCreateTotpVerifyBackupCreate, "useCreateTotpVerifyBackupCreate");
|
|
6672
5636
|
|
|
6673
5637
|
// src/generated/cfg_totp/_utils/hooks/totp.ts
|
|
6674
|
-
var
|
|
5638
|
+
var import_swr17 = require("swr");
|
|
6675
5639
|
function useDeleteTotpDevicesDestroy() {
|
|
6676
|
-
const { mutate } = (0,
|
|
5640
|
+
const { mutate } = (0, import_swr17.useSWRConfig)();
|
|
6677
5641
|
return async (id, client) => {
|
|
6678
5642
|
const result = await deleteTotpDevicesDestroy(id, client);
|
|
6679
5643
|
mutate("cfg-totp-devices");
|
|
@@ -6689,6 +5653,5 @@ var apiUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
|
|
|
6689
5653
|
var storage = new LocalStorageAdapter();
|
|
6690
5654
|
var apiAccounts = new API(apiUrl, { storage });
|
|
6691
5655
|
var apiTotp = new API3(apiUrl, { storage });
|
|
6692
|
-
var apiWebPush = new API4(apiUrl, { storage });
|
|
6693
5656
|
var apiCentrifugo = new API2(apiUrl, { storage });
|
|
6694
5657
|
//# sourceMappingURL=clients.cjs.map
|