@djangocfg/api 2.1.139 → 2.1.140
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/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/index.d.cts
CHANGED
|
@@ -17,7 +17,7 @@ interface TokenRefresh$1 {
|
|
|
17
17
|
refresh: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
declare namespace models$
|
|
20
|
+
declare namespace models$3 {
|
|
21
21
|
export type { TokenRefresh$1 as TokenRefresh, TokenRefreshRequest$1 as TokenRefreshRequest };
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -151,7 +151,7 @@ interface OAuthProvidersResponse$1 {
|
|
|
151
151
|
providers: Array<Record<string, any>>;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
declare namespace models$
|
|
154
|
+
declare namespace models$2 {
|
|
155
155
|
export type { OAuthAuthorizeRequestRequest$1 as OAuthAuthorizeRequestRequest, OAuthAuthorizeResponse$1 as OAuthAuthorizeResponse, OAuthCallbackRequestRequest$1 as OAuthCallbackRequestRequest, OAuthDisconnectRequestRequest$1 as OAuthDisconnectRequestRequest, OAuthError$1 as OAuthError, OAuthProvidersResponse$1 as OAuthProvidersResponse, OAuthTokenResponse$1 as OAuthTokenResponse };
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -283,7 +283,7 @@ interface CentrifugoToken$2 {
|
|
|
283
283
|
channels: Array<string>;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
declare namespace models$
|
|
286
|
+
declare namespace models$1 {
|
|
287
287
|
export type { AccountDeleteResponse$1 as AccountDeleteResponse, CentrifugoToken$2 as CentrifugoToken, CfgAccountsProfileAvatarCreateRequest$1 as CfgAccountsProfileAvatarCreateRequest, PatchedUserProfileUpdateRequest$1 as PatchedUserProfileUpdateRequest, User$2 as User, UserProfileUpdateRequest$1 as UserProfileUpdateRequest };
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -461,7 +461,7 @@ interface CentrifugoToken$1 {
|
|
|
461
461
|
channels: Array<string>;
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
declare namespace models
|
|
464
|
+
declare namespace models {
|
|
465
465
|
export type { CentrifugoToken$1 as CentrifugoToken, OTPErrorResponse$1 as OTPErrorResponse, OTPRequestRequest$1 as OTPRequestRequest, OTPRequestResponse$1 as OTPRequestResponse, OTPVerifyRequest$1 as OTPVerifyRequest, OTPVerifyResponse$1 as OTPVerifyResponse, User$1 as User };
|
|
466
466
|
}
|
|
467
467
|
|
|
@@ -490,7 +490,7 @@ declare class Accounts {
|
|
|
490
490
|
* Allows switching between fetch/axios/httpx without changing generated code.
|
|
491
491
|
* Provides unified interface for making HTTP requests.
|
|
492
492
|
*/
|
|
493
|
-
interface HttpRequest
|
|
493
|
+
interface HttpRequest {
|
|
494
494
|
method: string;
|
|
495
495
|
url: string;
|
|
496
496
|
headers?: Record<string, string>;
|
|
@@ -501,7 +501,7 @@ interface HttpRequest$1 {
|
|
|
501
501
|
/** Binary data for octet-stream uploads */
|
|
502
502
|
binaryBody?: Blob | ArrayBuffer;
|
|
503
503
|
}
|
|
504
|
-
interface HttpResponse
|
|
504
|
+
interface HttpResponse<T = any> {
|
|
505
505
|
data: T;
|
|
506
506
|
status: number;
|
|
507
507
|
statusText: string;
|
|
@@ -511,15 +511,15 @@ interface HttpResponse$1<T = any> {
|
|
|
511
511
|
* HTTP Client Adapter Interface.
|
|
512
512
|
* Implement this to use custom HTTP clients (axios, httpx, etc.)
|
|
513
513
|
*/
|
|
514
|
-
interface HttpClientAdapter
|
|
515
|
-
request<T = any>(request: HttpRequest
|
|
514
|
+
interface HttpClientAdapter {
|
|
515
|
+
request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
|
|
516
516
|
}
|
|
517
517
|
/**
|
|
518
518
|
* Default Fetch API adapter.
|
|
519
519
|
* Uses native browser fetch() with proper error handling.
|
|
520
520
|
*/
|
|
521
|
-
declare class FetchAdapter
|
|
522
|
-
request<T = any>(request: HttpRequest
|
|
521
|
+
declare class FetchAdapter implements HttpClientAdapter {
|
|
522
|
+
request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
/**
|
|
@@ -533,7 +533,7 @@ declare class FetchAdapter$1 implements HttpClientAdapter$1 {
|
|
|
533
533
|
/**
|
|
534
534
|
* Request log data
|
|
535
535
|
*/
|
|
536
|
-
interface RequestLog
|
|
536
|
+
interface RequestLog {
|
|
537
537
|
method: string;
|
|
538
538
|
url: string;
|
|
539
539
|
headers?: Record<string, string>;
|
|
@@ -543,7 +543,7 @@ interface RequestLog$1 {
|
|
|
543
543
|
/**
|
|
544
544
|
* Response log data
|
|
545
545
|
*/
|
|
546
|
-
interface ResponseLog
|
|
546
|
+
interface ResponseLog {
|
|
547
547
|
status: number;
|
|
548
548
|
statusText: string;
|
|
549
549
|
data?: any;
|
|
@@ -553,7 +553,7 @@ interface ResponseLog$1 {
|
|
|
553
553
|
/**
|
|
554
554
|
* Error log data
|
|
555
555
|
*/
|
|
556
|
-
interface ErrorLog
|
|
556
|
+
interface ErrorLog {
|
|
557
557
|
message: string;
|
|
558
558
|
statusCode?: number;
|
|
559
559
|
fieldErrors?: Record<string, string[]>;
|
|
@@ -563,7 +563,7 @@ interface ErrorLog$1 {
|
|
|
563
563
|
/**
|
|
564
564
|
* Logger configuration
|
|
565
565
|
*/
|
|
566
|
-
interface LoggerConfig
|
|
566
|
+
interface LoggerConfig {
|
|
567
567
|
/** Enable logging */
|
|
568
568
|
enabled: boolean;
|
|
569
569
|
/** Log requests */
|
|
@@ -582,10 +582,10 @@ interface LoggerConfig$1 {
|
|
|
582
582
|
/**
|
|
583
583
|
* API Logger class
|
|
584
584
|
*/
|
|
585
|
-
declare class APILogger
|
|
585
|
+
declare class APILogger {
|
|
586
586
|
private config;
|
|
587
587
|
private consola;
|
|
588
|
-
constructor(config?: Partial<LoggerConfig
|
|
588
|
+
constructor(config?: Partial<LoggerConfig>);
|
|
589
589
|
/**
|
|
590
590
|
* Enable logging
|
|
591
591
|
*/
|
|
@@ -597,7 +597,7 @@ declare class APILogger$1 {
|
|
|
597
597
|
/**
|
|
598
598
|
* Update configuration
|
|
599
599
|
*/
|
|
600
|
-
setConfig(config: Partial<LoggerConfig
|
|
600
|
+
setConfig(config: Partial<LoggerConfig>): void;
|
|
601
601
|
/**
|
|
602
602
|
* Filter sensitive headers
|
|
603
603
|
*/
|
|
@@ -605,15 +605,15 @@ declare class APILogger$1 {
|
|
|
605
605
|
/**
|
|
606
606
|
* Log request
|
|
607
607
|
*/
|
|
608
|
-
logRequest(request: RequestLog
|
|
608
|
+
logRequest(request: RequestLog): void;
|
|
609
609
|
/**
|
|
610
610
|
* Log response
|
|
611
611
|
*/
|
|
612
|
-
logResponse(request: RequestLog
|
|
612
|
+
logResponse(request: RequestLog, response: ResponseLog): void;
|
|
613
613
|
/**
|
|
614
614
|
* Log error
|
|
615
615
|
*/
|
|
616
|
-
logError(request: RequestLog
|
|
616
|
+
logError(request: RequestLog, error: ErrorLog): void;
|
|
617
617
|
/**
|
|
618
618
|
* Log general info
|
|
619
619
|
*/
|
|
@@ -649,7 +649,7 @@ declare class APILogger$1 {
|
|
|
649
649
|
/**
|
|
650
650
|
* Information about a failed retry attempt.
|
|
651
651
|
*/
|
|
652
|
-
interface FailedAttemptInfo
|
|
652
|
+
interface FailedAttemptInfo {
|
|
653
653
|
/** The error that caused the failure */
|
|
654
654
|
error: Error;
|
|
655
655
|
/** The attempt number (1-indexed) */
|
|
@@ -662,7 +662,7 @@ interface FailedAttemptInfo$1 {
|
|
|
662
662
|
*
|
|
663
663
|
* Uses exponential backoff with jitter by default to avoid thundering herd.
|
|
664
664
|
*/
|
|
665
|
-
interface RetryConfig
|
|
665
|
+
interface RetryConfig {
|
|
666
666
|
/**
|
|
667
667
|
* Maximum number of retry attempts.
|
|
668
668
|
* @default 3
|
|
@@ -692,12 +692,12 @@ interface RetryConfig$1 {
|
|
|
692
692
|
/**
|
|
693
693
|
* Callback called on each failed attempt.
|
|
694
694
|
*/
|
|
695
|
-
onFailedAttempt?: (info: FailedAttemptInfo
|
|
695
|
+
onFailedAttempt?: (info: FailedAttemptInfo) => void;
|
|
696
696
|
}
|
|
697
697
|
/**
|
|
698
698
|
* Default retry configuration.
|
|
699
699
|
*/
|
|
700
|
-
declare const DEFAULT_RETRY_CONFIG
|
|
700
|
+
declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
|
|
701
701
|
/**
|
|
702
702
|
* Determine if an error should trigger a retry.
|
|
703
703
|
*
|
|
@@ -714,7 +714,7 @@ declare const DEFAULT_RETRY_CONFIG$1: Required<RetryConfig$1>;
|
|
|
714
714
|
* @param error - The error to check
|
|
715
715
|
* @returns true if should retry, false otherwise
|
|
716
716
|
*/
|
|
717
|
-
declare function shouldRetry
|
|
717
|
+
declare function shouldRetry(error: any): boolean;
|
|
718
718
|
/**
|
|
719
719
|
* Wrap a function with retry logic.
|
|
720
720
|
*
|
|
@@ -730,7 +730,7 @@ declare function shouldRetry$1(error: any): boolean;
|
|
|
730
730
|
* );
|
|
731
731
|
* ```
|
|
732
732
|
*/
|
|
733
|
-
declare function withRetry
|
|
733
|
+
declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
734
734
|
|
|
735
735
|
/**
|
|
736
736
|
* Async API client for Django CFG API.
|
|
@@ -747,7 +747,7 @@ declare function withRetry$1<T>(fn: () => Promise<T>, config?: RetryConfig$1): P
|
|
|
747
747
|
* });
|
|
748
748
|
* ```
|
|
749
749
|
*/
|
|
750
|
-
declare class APIClient
|
|
750
|
+
declare class APIClient {
|
|
751
751
|
private baseUrl;
|
|
752
752
|
private httpClient;
|
|
753
753
|
private logger;
|
|
@@ -758,9 +758,9 @@ declare class APIClient$1 {
|
|
|
758
758
|
user_profile: UserProfile;
|
|
759
759
|
accounts: Accounts;
|
|
760
760
|
constructor(baseUrl: string, options?: {
|
|
761
|
-
httpClient?: HttpClientAdapter
|
|
762
|
-
loggerConfig?: Partial<LoggerConfig
|
|
763
|
-
retryConfig?: RetryConfig
|
|
761
|
+
httpClient?: HttpClientAdapter;
|
|
762
|
+
loggerConfig?: Partial<LoggerConfig>;
|
|
763
|
+
retryConfig?: RetryConfig;
|
|
764
764
|
tokenGetter?: () => string | null;
|
|
765
765
|
});
|
|
766
766
|
/**
|
|
@@ -808,7 +808,7 @@ declare class APIClient$1 {
|
|
|
808
808
|
/**
|
|
809
809
|
* Storage adapter interface for cross-platform token storage.
|
|
810
810
|
*/
|
|
811
|
-
interface StorageAdapter
|
|
811
|
+
interface StorageAdapter {
|
|
812
812
|
getItem(key: string): string | null;
|
|
813
813
|
setItem(key: string, value: string): void;
|
|
814
814
|
removeItem(key: string): void;
|
|
@@ -820,9 +820,9 @@ interface StorageAdapter$1 {
|
|
|
820
820
|
* Note: This adapter uses window.localStorage and should only be used in browser/client environments.
|
|
821
821
|
* For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.
|
|
822
822
|
*/
|
|
823
|
-
declare class LocalStorageAdapter
|
|
823
|
+
declare class LocalStorageAdapter implements StorageAdapter {
|
|
824
824
|
private logger?;
|
|
825
|
-
constructor(logger?: APILogger
|
|
825
|
+
constructor(logger?: APILogger);
|
|
826
826
|
getItem(key: string): string | null;
|
|
827
827
|
setItem(key: string, value: string): void;
|
|
828
828
|
removeItem(key: string): void;
|
|
@@ -831,9 +831,9 @@ declare class LocalStorageAdapter$1 implements StorageAdapter$1 {
|
|
|
831
831
|
* Cookie-based storage adapter for SSR and browser environments.
|
|
832
832
|
* Useful for Next.js, Nuxt.js, and other SSR frameworks.
|
|
833
833
|
*/
|
|
834
|
-
declare class CookieStorageAdapter
|
|
834
|
+
declare class CookieStorageAdapter implements StorageAdapter {
|
|
835
835
|
private logger?;
|
|
836
|
-
constructor(logger?: APILogger
|
|
836
|
+
constructor(logger?: APILogger);
|
|
837
837
|
getItem(key: string): string | null;
|
|
838
838
|
setItem(key: string, value: string): void;
|
|
839
839
|
removeItem(key: string): void;
|
|
@@ -842,10 +842,10 @@ declare class CookieStorageAdapter$1 implements StorageAdapter$1 {
|
|
|
842
842
|
* In-memory storage adapter for Node.js, Electron, and testing environments.
|
|
843
843
|
* Data is stored in RAM and cleared when process exits.
|
|
844
844
|
*/
|
|
845
|
-
declare class MemoryStorageAdapter
|
|
845
|
+
declare class MemoryStorageAdapter implements StorageAdapter {
|
|
846
846
|
private storage;
|
|
847
847
|
private logger?;
|
|
848
|
-
constructor(logger?: APILogger
|
|
848
|
+
constructor(logger?: APILogger);
|
|
849
849
|
getItem(key: string): string | null;
|
|
850
850
|
setItem(key: string, value: string): void;
|
|
851
851
|
removeItem(key: string): void;
|
|
@@ -1361,50 +1361,50 @@ type UserProfileUpdateRequest = z.infer<typeof UserProfileUpdateRequestSchema>;
|
|
|
1361
1361
|
* ```
|
|
1362
1362
|
*/
|
|
1363
1363
|
|
|
1364
|
-
type index$
|
|
1365
|
-
declare const index$
|
|
1366
|
-
type index$
|
|
1367
|
-
declare const index$
|
|
1368
|
-
type index$
|
|
1369
|
-
declare const index$
|
|
1370
|
-
type index$
|
|
1371
|
-
declare const index$
|
|
1372
|
-
type index$
|
|
1373
|
-
declare const index$
|
|
1374
|
-
type index$
|
|
1375
|
-
declare const index$
|
|
1376
|
-
type index$
|
|
1377
|
-
declare const index$
|
|
1378
|
-
type index$
|
|
1379
|
-
declare const index$
|
|
1380
|
-
type index$
|
|
1381
|
-
declare const index$
|
|
1382
|
-
type index$
|
|
1383
|
-
declare const index$
|
|
1384
|
-
type index$
|
|
1385
|
-
declare const index$
|
|
1386
|
-
type index$
|
|
1387
|
-
declare const index$
|
|
1388
|
-
type index$
|
|
1389
|
-
declare const index$
|
|
1390
|
-
type index$
|
|
1391
|
-
declare const index$
|
|
1392
|
-
type index$
|
|
1393
|
-
declare const index$
|
|
1394
|
-
type index$
|
|
1395
|
-
declare const index$
|
|
1396
|
-
type index$
|
|
1397
|
-
declare const index$
|
|
1398
|
-
type index$
|
|
1399
|
-
type index$
|
|
1400
|
-
declare const index$
|
|
1401
|
-
declare const index$
|
|
1402
|
-
type index$
|
|
1403
|
-
type index$
|
|
1404
|
-
declare const index$
|
|
1405
|
-
declare const index$
|
|
1406
|
-
declare namespace index$
|
|
1407
|
-
export { type index$
|
|
1364
|
+
type index$2_AccountDeleteResponse = AccountDeleteResponse;
|
|
1365
|
+
declare const index$2_AccountDeleteResponseSchema: typeof AccountDeleteResponseSchema;
|
|
1366
|
+
type index$2_CentrifugoToken = CentrifugoToken;
|
|
1367
|
+
declare const index$2_CentrifugoTokenSchema: typeof CentrifugoTokenSchema;
|
|
1368
|
+
type index$2_CfgAccountsProfileAvatarCreateRequest = CfgAccountsProfileAvatarCreateRequest;
|
|
1369
|
+
declare const index$2_CfgAccountsProfileAvatarCreateRequestSchema: typeof CfgAccountsProfileAvatarCreateRequestSchema;
|
|
1370
|
+
type index$2_OAuthAuthorizeRequestRequest = OAuthAuthorizeRequestRequest;
|
|
1371
|
+
declare const index$2_OAuthAuthorizeRequestRequestSchema: typeof OAuthAuthorizeRequestRequestSchema;
|
|
1372
|
+
type index$2_OAuthAuthorizeResponse = OAuthAuthorizeResponse;
|
|
1373
|
+
declare const index$2_OAuthAuthorizeResponseSchema: typeof OAuthAuthorizeResponseSchema;
|
|
1374
|
+
type index$2_OAuthCallbackRequestRequest = OAuthCallbackRequestRequest;
|
|
1375
|
+
declare const index$2_OAuthCallbackRequestRequestSchema: typeof OAuthCallbackRequestRequestSchema;
|
|
1376
|
+
type index$2_OAuthConnection = OAuthConnection;
|
|
1377
|
+
declare const index$2_OAuthConnectionSchema: typeof OAuthConnectionSchema;
|
|
1378
|
+
type index$2_OAuthDisconnectRequestRequest = OAuthDisconnectRequestRequest;
|
|
1379
|
+
declare const index$2_OAuthDisconnectRequestRequestSchema: typeof OAuthDisconnectRequestRequestSchema;
|
|
1380
|
+
type index$2_OAuthError = OAuthError;
|
|
1381
|
+
declare const index$2_OAuthErrorSchema: typeof OAuthErrorSchema;
|
|
1382
|
+
type index$2_OAuthProvidersResponse = OAuthProvidersResponse;
|
|
1383
|
+
declare const index$2_OAuthProvidersResponseSchema: typeof OAuthProvidersResponseSchema;
|
|
1384
|
+
type index$2_OAuthTokenResponse = OAuthTokenResponse;
|
|
1385
|
+
declare const index$2_OAuthTokenResponseSchema: typeof OAuthTokenResponseSchema;
|
|
1386
|
+
type index$2_OTPErrorResponse = OTPErrorResponse;
|
|
1387
|
+
declare const index$2_OTPErrorResponseSchema: typeof OTPErrorResponseSchema;
|
|
1388
|
+
type index$2_OTPRequestRequest = OTPRequestRequest;
|
|
1389
|
+
declare const index$2_OTPRequestRequestSchema: typeof OTPRequestRequestSchema;
|
|
1390
|
+
type index$2_OTPRequestResponse = OTPRequestResponse;
|
|
1391
|
+
declare const index$2_OTPRequestResponseSchema: typeof OTPRequestResponseSchema;
|
|
1392
|
+
type index$2_OTPVerifyRequest = OTPVerifyRequest;
|
|
1393
|
+
declare const index$2_OTPVerifyRequestSchema: typeof OTPVerifyRequestSchema;
|
|
1394
|
+
type index$2_OTPVerifyResponse = OTPVerifyResponse;
|
|
1395
|
+
declare const index$2_OTPVerifyResponseSchema: typeof OTPVerifyResponseSchema;
|
|
1396
|
+
type index$2_PatchedUserProfileUpdateRequest = PatchedUserProfileUpdateRequest;
|
|
1397
|
+
declare const index$2_PatchedUserProfileUpdateRequestSchema: typeof PatchedUserProfileUpdateRequestSchema;
|
|
1398
|
+
type index$2_TokenRefresh = TokenRefresh;
|
|
1399
|
+
type index$2_TokenRefreshRequest = TokenRefreshRequest;
|
|
1400
|
+
declare const index$2_TokenRefreshRequestSchema: typeof TokenRefreshRequestSchema;
|
|
1401
|
+
declare const index$2_TokenRefreshSchema: typeof TokenRefreshSchema;
|
|
1402
|
+
type index$2_User = User;
|
|
1403
|
+
type index$2_UserProfileUpdateRequest = UserProfileUpdateRequest;
|
|
1404
|
+
declare const index$2_UserProfileUpdateRequestSchema: typeof UserProfileUpdateRequestSchema;
|
|
1405
|
+
declare const index$2_UserSchema: typeof UserSchema;
|
|
1406
|
+
declare namespace index$2 {
|
|
1407
|
+
export { type index$2_AccountDeleteResponse as AccountDeleteResponse, index$2_AccountDeleteResponseSchema as AccountDeleteResponseSchema, type index$2_CentrifugoToken as CentrifugoToken, index$2_CentrifugoTokenSchema as CentrifugoTokenSchema, type index$2_CfgAccountsProfileAvatarCreateRequest as CfgAccountsProfileAvatarCreateRequest, index$2_CfgAccountsProfileAvatarCreateRequestSchema as CfgAccountsProfileAvatarCreateRequestSchema, type index$2_OAuthAuthorizeRequestRequest as OAuthAuthorizeRequestRequest, index$2_OAuthAuthorizeRequestRequestSchema as OAuthAuthorizeRequestRequestSchema, type index$2_OAuthAuthorizeResponse as OAuthAuthorizeResponse, index$2_OAuthAuthorizeResponseSchema as OAuthAuthorizeResponseSchema, type index$2_OAuthCallbackRequestRequest as OAuthCallbackRequestRequest, index$2_OAuthCallbackRequestRequestSchema as OAuthCallbackRequestRequestSchema, type index$2_OAuthConnection as OAuthConnection, index$2_OAuthConnectionSchema as OAuthConnectionSchema, type index$2_OAuthDisconnectRequestRequest as OAuthDisconnectRequestRequest, index$2_OAuthDisconnectRequestRequestSchema as OAuthDisconnectRequestRequestSchema, type index$2_OAuthError as OAuthError, index$2_OAuthErrorSchema as OAuthErrorSchema, type index$2_OAuthProvidersResponse as OAuthProvidersResponse, index$2_OAuthProvidersResponseSchema as OAuthProvidersResponseSchema, type index$2_OAuthTokenResponse as OAuthTokenResponse, index$2_OAuthTokenResponseSchema as OAuthTokenResponseSchema, type index$2_OTPErrorResponse as OTPErrorResponse, index$2_OTPErrorResponseSchema as OTPErrorResponseSchema, type index$2_OTPRequestRequest as OTPRequestRequest, index$2_OTPRequestRequestSchema as OTPRequestRequestSchema, type index$2_OTPRequestResponse as OTPRequestResponse, index$2_OTPRequestResponseSchema as OTPRequestResponseSchema, type index$2_OTPVerifyRequest as OTPVerifyRequest, index$2_OTPVerifyRequestSchema as OTPVerifyRequestSchema, type index$2_OTPVerifyResponse as OTPVerifyResponse, index$2_OTPVerifyResponseSchema as OTPVerifyResponseSchema, type index$2_PatchedUserProfileUpdateRequest as PatchedUserProfileUpdateRequest, index$2_PatchedUserProfileUpdateRequestSchema as PatchedUserProfileUpdateRequestSchema, type index$2_TokenRefresh as TokenRefresh, type index$2_TokenRefreshRequest as TokenRefreshRequest, index$2_TokenRefreshRequestSchema as TokenRefreshRequestSchema, index$2_TokenRefreshSchema as TokenRefreshSchema, type index$2_User as User, type index$2_UserProfileUpdateRequest as UserProfileUpdateRequest, index$2_UserProfileUpdateRequestSchema as UserProfileUpdateRequestSchema, index$2_UserSchema as UserSchema };
|
|
1408
1408
|
}
|
|
1409
1409
|
|
|
1410
1410
|
/**
|
|
@@ -1427,7 +1427,7 @@ declare namespace index$5 {
|
|
|
1427
1427
|
/**
|
|
1428
1428
|
* Validation error event detail
|
|
1429
1429
|
*/
|
|
1430
|
-
interface ValidationErrorDetail
|
|
1430
|
+
interface ValidationErrorDetail {
|
|
1431
1431
|
/** Operation/function name that failed validation */
|
|
1432
1432
|
operation: string;
|
|
1433
1433
|
/** API endpoint path */
|
|
@@ -1444,7 +1444,7 @@ interface ValidationErrorDetail$1 {
|
|
|
1444
1444
|
/**
|
|
1445
1445
|
* Custom event type for Zod validation errors
|
|
1446
1446
|
*/
|
|
1447
|
-
type ValidationErrorEvent
|
|
1447
|
+
type ValidationErrorEvent = CustomEvent<ValidationErrorDetail>;
|
|
1448
1448
|
/**
|
|
1449
1449
|
* Dispatch a Zod validation error event.
|
|
1450
1450
|
*
|
|
@@ -1453,7 +1453,7 @@ type ValidationErrorEvent$1 = CustomEvent<ValidationErrorDetail$1>;
|
|
|
1453
1453
|
*
|
|
1454
1454
|
* @param detail - Validation error details
|
|
1455
1455
|
*/
|
|
1456
|
-
declare function dispatchValidationError
|
|
1456
|
+
declare function dispatchValidationError(detail: ValidationErrorDetail): void;
|
|
1457
1457
|
/**
|
|
1458
1458
|
* Add a global listener for Zod validation errors.
|
|
1459
1459
|
*
|
|
@@ -1471,14 +1471,14 @@ declare function dispatchValidationError$1(detail: ValidationErrorDetail$1): voi
|
|
|
1471
1471
|
* cleanup();
|
|
1472
1472
|
* ```
|
|
1473
1473
|
*/
|
|
1474
|
-
declare function onValidationError
|
|
1474
|
+
declare function onValidationError(callback: (detail: ValidationErrorDetail) => void): () => void;
|
|
1475
1475
|
/**
|
|
1476
1476
|
* Format Zod error for logging/display.
|
|
1477
1477
|
*
|
|
1478
1478
|
* @param error - Zod validation error
|
|
1479
1479
|
* @returns Formatted error message
|
|
1480
1480
|
*/
|
|
1481
|
-
declare function formatZodError
|
|
1481
|
+
declare function formatZodError(error: ZodError): string;
|
|
1482
1482
|
|
|
1483
1483
|
/**
|
|
1484
1484
|
* API operation
|
|
@@ -1616,23 +1616,23 @@ declare function partialUpdateAccountsProfileUpdatePartialUpdate(data?: PatchedU
|
|
|
1616
1616
|
* ```
|
|
1617
1617
|
*/
|
|
1618
1618
|
|
|
1619
|
-
declare const index$
|
|
1620
|
-
declare const index$
|
|
1621
|
-
declare const index$
|
|
1622
|
-
declare const index$
|
|
1623
|
-
declare const index$
|
|
1624
|
-
declare const index$
|
|
1625
|
-
declare const index$
|
|
1626
|
-
declare const index$
|
|
1627
|
-
declare const index$
|
|
1628
|
-
declare const index$
|
|
1629
|
-
declare const index$
|
|
1630
|
-
declare const index$
|
|
1631
|
-
declare const index$
|
|
1632
|
-
declare const index$
|
|
1633
|
-
declare const index$
|
|
1634
|
-
declare namespace index$
|
|
1635
|
-
export { index$
|
|
1619
|
+
declare const index$1_createAccountsOauthDisconnectCreate: typeof createAccountsOauthDisconnectCreate;
|
|
1620
|
+
declare const index$1_createAccountsOauthGithubAuthorizeCreate: typeof createAccountsOauthGithubAuthorizeCreate;
|
|
1621
|
+
declare const index$1_createAccountsOauthGithubCallbackCreate: typeof createAccountsOauthGithubCallbackCreate;
|
|
1622
|
+
declare const index$1_createAccountsOtpRequestCreate: typeof createAccountsOtpRequestCreate;
|
|
1623
|
+
declare const index$1_createAccountsOtpVerifyCreate: typeof createAccountsOtpVerifyCreate;
|
|
1624
|
+
declare const index$1_createAccountsProfileAvatarCreate: typeof createAccountsProfileAvatarCreate;
|
|
1625
|
+
declare const index$1_createAccountsProfileDeleteCreate: typeof createAccountsProfileDeleteCreate;
|
|
1626
|
+
declare const index$1_createAccountsTokenRefreshCreate: typeof createAccountsTokenRefreshCreate;
|
|
1627
|
+
declare const index$1_getAccountsOauthConnectionsList: typeof getAccountsOauthConnectionsList;
|
|
1628
|
+
declare const index$1_getAccountsOauthProvidersRetrieve: typeof getAccountsOauthProvidersRetrieve;
|
|
1629
|
+
declare const index$1_getAccountsProfileRetrieve: typeof getAccountsProfileRetrieve;
|
|
1630
|
+
declare const index$1_partialUpdateAccountsProfilePartialPartialUpdate: typeof partialUpdateAccountsProfilePartialPartialUpdate;
|
|
1631
|
+
declare const index$1_partialUpdateAccountsProfilePartialUpdate: typeof partialUpdateAccountsProfilePartialUpdate;
|
|
1632
|
+
declare const index$1_partialUpdateAccountsProfileUpdatePartialUpdate: typeof partialUpdateAccountsProfileUpdatePartialUpdate;
|
|
1633
|
+
declare const index$1_updateAccountsProfileUpdateUpdate: typeof updateAccountsProfileUpdateUpdate;
|
|
1634
|
+
declare namespace index$1 {
|
|
1635
|
+
export { index$1_createAccountsOauthDisconnectCreate as createAccountsOauthDisconnectCreate, index$1_createAccountsOauthGithubAuthorizeCreate as createAccountsOauthGithubAuthorizeCreate, index$1_createAccountsOauthGithubCallbackCreate as createAccountsOauthGithubCallbackCreate, index$1_createAccountsOtpRequestCreate as createAccountsOtpRequestCreate, index$1_createAccountsOtpVerifyCreate as createAccountsOtpVerifyCreate, index$1_createAccountsProfileAvatarCreate as createAccountsProfileAvatarCreate, index$1_createAccountsProfileDeleteCreate as createAccountsProfileDeleteCreate, index$1_createAccountsTokenRefreshCreate as createAccountsTokenRefreshCreate, index$1_getAccountsOauthConnectionsList as getAccountsOauthConnectionsList, index$1_getAccountsOauthProvidersRetrieve as getAccountsOauthProvidersRetrieve, index$1_getAccountsProfileRetrieve as getAccountsProfileRetrieve, index$1_partialUpdateAccountsProfilePartialPartialUpdate as partialUpdateAccountsProfilePartialPartialUpdate, index$1_partialUpdateAccountsProfilePartialUpdate as partialUpdateAccountsProfilePartialUpdate, index$1_partialUpdateAccountsProfileUpdatePartialUpdate as partialUpdateAccountsProfileUpdatePartialUpdate, index$1_updateAccountsProfileUpdateUpdate as updateAccountsProfileUpdateUpdate };
|
|
1636
1636
|
}
|
|
1637
1637
|
|
|
1638
1638
|
/**
|
|
@@ -1679,11 +1679,11 @@ declare namespace index$4 {
|
|
|
1679
1679
|
* Auto-configures from environment variables on first call if not manually configured.
|
|
1680
1680
|
* @throws Error if API is not configured and no env variable is set
|
|
1681
1681
|
*/
|
|
1682
|
-
declare function getAPIInstance
|
|
1682
|
+
declare function getAPIInstance(): API;
|
|
1683
1683
|
/**
|
|
1684
1684
|
* Check if API is configured (or can be auto-configured)
|
|
1685
1685
|
*/
|
|
1686
|
-
declare function isAPIConfigured
|
|
1686
|
+
declare function isAPIConfigured(): boolean;
|
|
1687
1687
|
/**
|
|
1688
1688
|
* Configure the global API instance
|
|
1689
1689
|
*
|
|
@@ -1702,30 +1702,30 @@ declare function isAPIConfigured$1(): boolean;
|
|
|
1702
1702
|
* })
|
|
1703
1703
|
* ```
|
|
1704
1704
|
*/
|
|
1705
|
-
declare function configureAPI
|
|
1705
|
+
declare function configureAPI(config: {
|
|
1706
1706
|
baseUrl: string;
|
|
1707
1707
|
token?: string;
|
|
1708
1708
|
refreshToken?: string;
|
|
1709
|
-
options?: APIOptions
|
|
1710
|
-
}): API
|
|
1709
|
+
options?: APIOptions;
|
|
1710
|
+
}): API;
|
|
1711
1711
|
/**
|
|
1712
1712
|
* Reconfigure the global API instance with new settings
|
|
1713
1713
|
* Useful for updating tokens or base URL
|
|
1714
1714
|
*/
|
|
1715
|
-
declare function reconfigureAPI
|
|
1715
|
+
declare function reconfigureAPI(updates: {
|
|
1716
1716
|
baseUrl?: string;
|
|
1717
1717
|
token?: string;
|
|
1718
1718
|
refreshToken?: string;
|
|
1719
|
-
}): API
|
|
1719
|
+
}): API;
|
|
1720
1720
|
/**
|
|
1721
1721
|
* Clear tokens from the global API instance
|
|
1722
1722
|
*/
|
|
1723
|
-
declare function clearAPITokens
|
|
1723
|
+
declare function clearAPITokens(): void;
|
|
1724
1724
|
/**
|
|
1725
1725
|
* Reset the global API instance
|
|
1726
1726
|
* Useful for testing or logout scenarios
|
|
1727
1727
|
*/
|
|
1728
|
-
declare function resetAPI
|
|
1728
|
+
declare function resetAPI(): void;
|
|
1729
1729
|
|
|
1730
1730
|
/**
|
|
1731
1731
|
* API Error Classes
|
|
@@ -1749,7 +1749,7 @@ declare function resetAPI$1(): void;
|
|
|
1749
1749
|
* }
|
|
1750
1750
|
* ```
|
|
1751
1751
|
*/
|
|
1752
|
-
declare class APIError
|
|
1752
|
+
declare class APIError extends Error {
|
|
1753
1753
|
statusCode: number;
|
|
1754
1754
|
statusText: string;
|
|
1755
1755
|
response: any;
|
|
@@ -1779,7 +1779,7 @@ declare class APIError$1 extends Error {
|
|
|
1779
1779
|
/**
|
|
1780
1780
|
* Network Error (connection failed, timeout, etc.)
|
|
1781
1781
|
*/
|
|
1782
|
-
declare class NetworkError
|
|
1782
|
+
declare class NetworkError extends Error {
|
|
1783
1783
|
url: string;
|
|
1784
1784
|
originalError?: Error;
|
|
1785
1785
|
constructor(message: string, url: string, originalError?: Error);
|
|
@@ -1819,17 +1819,17 @@ declare class NetworkError$1 extends Error {
|
|
|
1819
1819
|
* ```
|
|
1820
1820
|
*/
|
|
1821
1821
|
|
|
1822
|
-
declare const TOKEN_KEY
|
|
1823
|
-
declare const REFRESH_TOKEN_KEY
|
|
1824
|
-
interface APIOptions
|
|
1822
|
+
declare const TOKEN_KEY = "auth_token";
|
|
1823
|
+
declare const REFRESH_TOKEN_KEY = "refresh_token";
|
|
1824
|
+
interface APIOptions {
|
|
1825
1825
|
/** Custom storage adapter (defaults to LocalStorageAdapter) */
|
|
1826
|
-
storage?: StorageAdapter
|
|
1826
|
+
storage?: StorageAdapter;
|
|
1827
1827
|
/** Retry configuration for failed requests */
|
|
1828
|
-
retryConfig?: RetryConfig
|
|
1828
|
+
retryConfig?: RetryConfig;
|
|
1829
1829
|
/** Logger configuration */
|
|
1830
|
-
loggerConfig?: Partial<LoggerConfig
|
|
1830
|
+
loggerConfig?: Partial<LoggerConfig>;
|
|
1831
1831
|
}
|
|
1832
|
-
declare class API
|
|
1832
|
+
declare class API {
|
|
1833
1833
|
private baseUrl;
|
|
1834
1834
|
private _client;
|
|
1835
1835
|
private _token;
|
|
@@ -1840,7 +1840,7 @@ declare class API$1 {
|
|
|
1840
1840
|
oauth: Oauth;
|
|
1841
1841
|
user_profile: UserProfile;
|
|
1842
1842
|
accounts: Accounts;
|
|
1843
|
-
constructor(baseUrl: string, options?: APIOptions
|
|
1843
|
+
constructor(baseUrl: string, options?: APIOptions);
|
|
1844
1844
|
private _loadTokensFromStorage;
|
|
1845
1845
|
private _reinitClients;
|
|
1846
1846
|
private _injectAuthHeader;
|
|
@@ -1890,65 +1890,110 @@ declare class API$1 {
|
|
|
1890
1890
|
getSchemaPath(): string;
|
|
1891
1891
|
}
|
|
1892
1892
|
|
|
1893
|
-
type
|
|
1894
|
-
declare const
|
|
1895
|
-
type
|
|
1896
|
-
declare const
|
|
1897
|
-
type
|
|
1898
|
-
declare const
|
|
1899
|
-
type
|
|
1900
|
-
declare const
|
|
1901
|
-
type
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
declare const
|
|
1911
|
-
type
|
|
1912
|
-
|
|
1913
|
-
type
|
|
1914
|
-
declare const
|
|
1915
|
-
type
|
|
1916
|
-
|
|
1917
|
-
type
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
type
|
|
1922
|
-
declare const
|
|
1923
|
-
type
|
|
1924
|
-
declare const
|
|
1925
|
-
type
|
|
1926
|
-
declare const
|
|
1927
|
-
type
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
declare const
|
|
1931
|
-
type
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
declare const
|
|
1935
|
-
|
|
1936
|
-
declare const
|
|
1937
|
-
|
|
1938
|
-
declare const
|
|
1939
|
-
|
|
1940
|
-
declare const
|
|
1941
|
-
|
|
1942
|
-
declare const
|
|
1943
|
-
|
|
1944
|
-
declare const
|
|
1945
|
-
|
|
1946
|
-
declare const
|
|
1947
|
-
|
|
1948
|
-
declare const
|
|
1949
|
-
|
|
1950
|
-
declare
|
|
1951
|
-
|
|
1893
|
+
type index_API = API;
|
|
1894
|
+
declare const index_API: typeof API;
|
|
1895
|
+
type index_APIClient = APIClient;
|
|
1896
|
+
declare const index_APIClient: typeof APIClient;
|
|
1897
|
+
type index_APIError = APIError;
|
|
1898
|
+
declare const index_APIError: typeof APIError;
|
|
1899
|
+
type index_APILogger = APILogger;
|
|
1900
|
+
declare const index_APILogger: typeof APILogger;
|
|
1901
|
+
type index_APIOptions = APIOptions;
|
|
1902
|
+
type index_AccountDeleteResponse = AccountDeleteResponse;
|
|
1903
|
+
declare const index_AccountDeleteResponseSchema: typeof AccountDeleteResponseSchema;
|
|
1904
|
+
type index_CentrifugoToken = CentrifugoToken;
|
|
1905
|
+
declare const index_CentrifugoTokenSchema: typeof CentrifugoTokenSchema;
|
|
1906
|
+
type index_CfgAccountsProfileAvatarCreateRequest = CfgAccountsProfileAvatarCreateRequest;
|
|
1907
|
+
declare const index_CfgAccountsProfileAvatarCreateRequestSchema: typeof CfgAccountsProfileAvatarCreateRequestSchema;
|
|
1908
|
+
type index_CookieStorageAdapter = CookieStorageAdapter;
|
|
1909
|
+
declare const index_CookieStorageAdapter: typeof CookieStorageAdapter;
|
|
1910
|
+
declare const index_DEFAULT_RETRY_CONFIG: typeof DEFAULT_RETRY_CONFIG;
|
|
1911
|
+
type index_ErrorLog = ErrorLog;
|
|
1912
|
+
type index_FailedAttemptInfo = FailedAttemptInfo;
|
|
1913
|
+
type index_FetchAdapter = FetchAdapter;
|
|
1914
|
+
declare const index_FetchAdapter: typeof FetchAdapter;
|
|
1915
|
+
type index_HttpClientAdapter = HttpClientAdapter;
|
|
1916
|
+
type index_HttpRequest = HttpRequest;
|
|
1917
|
+
type index_HttpResponse<T = any> = HttpResponse<T>;
|
|
1918
|
+
type index_LocalStorageAdapter = LocalStorageAdapter;
|
|
1919
|
+
declare const index_LocalStorageAdapter: typeof LocalStorageAdapter;
|
|
1920
|
+
type index_LoggerConfig = LoggerConfig;
|
|
1921
|
+
type index_MemoryStorageAdapter = MemoryStorageAdapter;
|
|
1922
|
+
declare const index_MemoryStorageAdapter: typeof MemoryStorageAdapter;
|
|
1923
|
+
type index_NetworkError = NetworkError;
|
|
1924
|
+
declare const index_NetworkError: typeof NetworkError;
|
|
1925
|
+
type index_OAuthAuthorizeRequestRequest = OAuthAuthorizeRequestRequest;
|
|
1926
|
+
declare const index_OAuthAuthorizeRequestRequestSchema: typeof OAuthAuthorizeRequestRequestSchema;
|
|
1927
|
+
type index_OAuthAuthorizeResponse = OAuthAuthorizeResponse;
|
|
1928
|
+
declare const index_OAuthAuthorizeResponseSchema: typeof OAuthAuthorizeResponseSchema;
|
|
1929
|
+
type index_OAuthCallbackRequestRequest = OAuthCallbackRequestRequest;
|
|
1930
|
+
declare const index_OAuthCallbackRequestRequestSchema: typeof OAuthCallbackRequestRequestSchema;
|
|
1931
|
+
type index_OAuthConnection = OAuthConnection;
|
|
1932
|
+
declare const index_OAuthConnectionSchema: typeof OAuthConnectionSchema;
|
|
1933
|
+
type index_OAuthDisconnectRequestRequest = OAuthDisconnectRequestRequest;
|
|
1934
|
+
declare const index_OAuthDisconnectRequestRequestSchema: typeof OAuthDisconnectRequestRequestSchema;
|
|
1935
|
+
type index_OAuthError = OAuthError;
|
|
1936
|
+
declare const index_OAuthErrorSchema: typeof OAuthErrorSchema;
|
|
1937
|
+
type index_OAuthProvidersResponse = OAuthProvidersResponse;
|
|
1938
|
+
declare const index_OAuthProvidersResponseSchema: typeof OAuthProvidersResponseSchema;
|
|
1939
|
+
type index_OAuthTokenResponse = OAuthTokenResponse;
|
|
1940
|
+
declare const index_OAuthTokenResponseSchema: typeof OAuthTokenResponseSchema;
|
|
1941
|
+
type index_OTPErrorResponse = OTPErrorResponse;
|
|
1942
|
+
declare const index_OTPErrorResponseSchema: typeof OTPErrorResponseSchema;
|
|
1943
|
+
type index_OTPRequestRequest = OTPRequestRequest;
|
|
1944
|
+
declare const index_OTPRequestRequestSchema: typeof OTPRequestRequestSchema;
|
|
1945
|
+
type index_OTPRequestResponse = OTPRequestResponse;
|
|
1946
|
+
declare const index_OTPRequestResponseSchema: typeof OTPRequestResponseSchema;
|
|
1947
|
+
type index_OTPVerifyRequest = OTPVerifyRequest;
|
|
1948
|
+
declare const index_OTPVerifyRequestSchema: typeof OTPVerifyRequestSchema;
|
|
1949
|
+
type index_OTPVerifyResponse = OTPVerifyResponse;
|
|
1950
|
+
declare const index_OTPVerifyResponseSchema: typeof OTPVerifyResponseSchema;
|
|
1951
|
+
type index_PatchedUserProfileUpdateRequest = PatchedUserProfileUpdateRequest;
|
|
1952
|
+
declare const index_PatchedUserProfileUpdateRequestSchema: typeof PatchedUserProfileUpdateRequestSchema;
|
|
1953
|
+
declare const index_REFRESH_TOKEN_KEY: typeof REFRESH_TOKEN_KEY;
|
|
1954
|
+
type index_RequestLog = RequestLog;
|
|
1955
|
+
type index_ResponseLog = ResponseLog;
|
|
1956
|
+
type index_RetryConfig = RetryConfig;
|
|
1957
|
+
type index_StorageAdapter = StorageAdapter;
|
|
1958
|
+
declare const index_TOKEN_KEY: typeof TOKEN_KEY;
|
|
1959
|
+
type index_TokenRefresh = TokenRefresh;
|
|
1960
|
+
type index_TokenRefreshRequest = TokenRefreshRequest;
|
|
1961
|
+
declare const index_TokenRefreshRequestSchema: typeof TokenRefreshRequestSchema;
|
|
1962
|
+
declare const index_TokenRefreshSchema: typeof TokenRefreshSchema;
|
|
1963
|
+
type index_User = User;
|
|
1964
|
+
type index_UserProfileUpdateRequest = UserProfileUpdateRequest;
|
|
1965
|
+
declare const index_UserProfileUpdateRequestSchema: typeof UserProfileUpdateRequestSchema;
|
|
1966
|
+
declare const index_UserSchema: typeof UserSchema;
|
|
1967
|
+
type index_ValidationErrorDetail = ValidationErrorDetail;
|
|
1968
|
+
type index_ValidationErrorEvent = ValidationErrorEvent;
|
|
1969
|
+
declare const index_clearAPITokens: typeof clearAPITokens;
|
|
1970
|
+
declare const index_configureAPI: typeof configureAPI;
|
|
1971
|
+
declare const index_createAccountsOauthDisconnectCreate: typeof createAccountsOauthDisconnectCreate;
|
|
1972
|
+
declare const index_createAccountsOauthGithubAuthorizeCreate: typeof createAccountsOauthGithubAuthorizeCreate;
|
|
1973
|
+
declare const index_createAccountsOauthGithubCallbackCreate: typeof createAccountsOauthGithubCallbackCreate;
|
|
1974
|
+
declare const index_createAccountsOtpRequestCreate: typeof createAccountsOtpRequestCreate;
|
|
1975
|
+
declare const index_createAccountsOtpVerifyCreate: typeof createAccountsOtpVerifyCreate;
|
|
1976
|
+
declare const index_createAccountsProfileAvatarCreate: typeof createAccountsProfileAvatarCreate;
|
|
1977
|
+
declare const index_createAccountsProfileDeleteCreate: typeof createAccountsProfileDeleteCreate;
|
|
1978
|
+
declare const index_createAccountsTokenRefreshCreate: typeof createAccountsTokenRefreshCreate;
|
|
1979
|
+
declare const index_dispatchValidationError: typeof dispatchValidationError;
|
|
1980
|
+
declare const index_formatZodError: typeof formatZodError;
|
|
1981
|
+
declare const index_getAPIInstance: typeof getAPIInstance;
|
|
1982
|
+
declare const index_getAccountsOauthConnectionsList: typeof getAccountsOauthConnectionsList;
|
|
1983
|
+
declare const index_getAccountsOauthProvidersRetrieve: typeof getAccountsOauthProvidersRetrieve;
|
|
1984
|
+
declare const index_getAccountsProfileRetrieve: typeof getAccountsProfileRetrieve;
|
|
1985
|
+
declare const index_isAPIConfigured: typeof isAPIConfigured;
|
|
1986
|
+
declare const index_onValidationError: typeof onValidationError;
|
|
1987
|
+
declare const index_partialUpdateAccountsProfilePartialPartialUpdate: typeof partialUpdateAccountsProfilePartialPartialUpdate;
|
|
1988
|
+
declare const index_partialUpdateAccountsProfilePartialUpdate: typeof partialUpdateAccountsProfilePartialUpdate;
|
|
1989
|
+
declare const index_partialUpdateAccountsProfileUpdatePartialUpdate: typeof partialUpdateAccountsProfileUpdatePartialUpdate;
|
|
1990
|
+
declare const index_reconfigureAPI: typeof reconfigureAPI;
|
|
1991
|
+
declare const index_resetAPI: typeof resetAPI;
|
|
1992
|
+
declare const index_shouldRetry: typeof shouldRetry;
|
|
1993
|
+
declare const index_updateAccountsProfileUpdateUpdate: typeof updateAccountsProfileUpdateUpdate;
|
|
1994
|
+
declare const index_withRetry: typeof withRetry;
|
|
1995
|
+
declare namespace index {
|
|
1996
|
+
export { index_API as API, index_APIClient as APIClient, index_APIError as APIError, index_APILogger as APILogger, type index_APIOptions as APIOptions, type index_AccountDeleteResponse as AccountDeleteResponse, index_AccountDeleteResponseSchema as AccountDeleteResponseSchema, models as AccountsTypes, models$3 as AuthTypes, type index_CentrifugoToken as CentrifugoToken, index_CentrifugoTokenSchema as CentrifugoTokenSchema, type index_CfgAccountsProfileAvatarCreateRequest as CfgAccountsProfileAvatarCreateRequest, index_CfgAccountsProfileAvatarCreateRequestSchema as CfgAccountsProfileAvatarCreateRequestSchema, index_CookieStorageAdapter as CookieStorageAdapter, index_DEFAULT_RETRY_CONFIG as DEFAULT_RETRY_CONFIG, enums as Enums, type index_ErrorLog as ErrorLog, type index_FailedAttemptInfo as FailedAttemptInfo, index_FetchAdapter as FetchAdapter, index$1 as Fetchers, type index_HttpClientAdapter as HttpClientAdapter, type index_HttpRequest as HttpRequest, type index_HttpResponse as HttpResponse, index_LocalStorageAdapter as LocalStorageAdapter, type index_LoggerConfig as LoggerConfig, index_MemoryStorageAdapter as MemoryStorageAdapter, index_NetworkError as NetworkError, type index_OAuthAuthorizeRequestRequest as OAuthAuthorizeRequestRequest, index_OAuthAuthorizeRequestRequestSchema as OAuthAuthorizeRequestRequestSchema, type index_OAuthAuthorizeResponse as OAuthAuthorizeResponse, index_OAuthAuthorizeResponseSchema as OAuthAuthorizeResponseSchema, type index_OAuthCallbackRequestRequest as OAuthCallbackRequestRequest, index_OAuthCallbackRequestRequestSchema as OAuthCallbackRequestRequestSchema, type index_OAuthConnection as OAuthConnection, index_OAuthConnectionSchema as OAuthConnectionSchema, type index_OAuthDisconnectRequestRequest as OAuthDisconnectRequestRequest, index_OAuthDisconnectRequestRequestSchema as OAuthDisconnectRequestRequestSchema, type index_OAuthError as OAuthError, index_OAuthErrorSchema as OAuthErrorSchema, type index_OAuthProvidersResponse as OAuthProvidersResponse, index_OAuthProvidersResponseSchema as OAuthProvidersResponseSchema, type index_OAuthTokenResponse as OAuthTokenResponse, index_OAuthTokenResponseSchema as OAuthTokenResponseSchema, type index_OTPErrorResponse as OTPErrorResponse, index_OTPErrorResponseSchema as OTPErrorResponseSchema, type index_OTPRequestRequest as OTPRequestRequest, index_OTPRequestRequestSchema as OTPRequestRequestSchema, type index_OTPRequestResponse as OTPRequestResponse, index_OTPRequestResponseSchema as OTPRequestResponseSchema, type index_OTPVerifyRequest as OTPVerifyRequest, index_OTPVerifyRequestSchema as OTPVerifyRequestSchema, type index_OTPVerifyResponse as OTPVerifyResponse, index_OTPVerifyResponseSchema as OTPVerifyResponseSchema, models$2 as OauthTypes, type index_PatchedUserProfileUpdateRequest as PatchedUserProfileUpdateRequest, index_PatchedUserProfileUpdateRequestSchema as PatchedUserProfileUpdateRequestSchema, index_REFRESH_TOKEN_KEY as REFRESH_TOKEN_KEY, type index_RequestLog as RequestLog, type index_ResponseLog as ResponseLog, type index_RetryConfig as RetryConfig, index$2 as Schemas, type index_StorageAdapter as StorageAdapter, index_TOKEN_KEY as TOKEN_KEY, type index_TokenRefresh as TokenRefresh, type index_TokenRefreshRequest as TokenRefreshRequest, index_TokenRefreshRequestSchema as TokenRefreshRequestSchema, index_TokenRefreshSchema as TokenRefreshSchema, type index_User as User, models$1 as UserProfileTypes, type index_UserProfileUpdateRequest as UserProfileUpdateRequest, index_UserProfileUpdateRequestSchema as UserProfileUpdateRequestSchema, index_UserSchema as UserSchema, type index_ValidationErrorDetail as ValidationErrorDetail, type index_ValidationErrorEvent as ValidationErrorEvent, index_clearAPITokens as clearAPITokens, index_configureAPI as configureAPI, index_createAccountsOauthDisconnectCreate as createAccountsOauthDisconnectCreate, index_createAccountsOauthGithubAuthorizeCreate as createAccountsOauthGithubAuthorizeCreate, index_createAccountsOauthGithubCallbackCreate as createAccountsOauthGithubCallbackCreate, index_createAccountsOtpRequestCreate as createAccountsOtpRequestCreate, index_createAccountsOtpVerifyCreate as createAccountsOtpVerifyCreate, index_createAccountsProfileAvatarCreate as createAccountsProfileAvatarCreate, index_createAccountsProfileDeleteCreate as createAccountsProfileDeleteCreate, index_createAccountsTokenRefreshCreate as createAccountsTokenRefreshCreate, API as default, index_dispatchValidationError as dispatchValidationError, index_formatZodError as formatZodError, index_getAPIInstance as getAPIInstance, index_getAccountsOauthConnectionsList as getAccountsOauthConnectionsList, index_getAccountsOauthProvidersRetrieve as getAccountsOauthProvidersRetrieve, index_getAccountsProfileRetrieve as getAccountsProfileRetrieve, index_isAPIConfigured as isAPIConfigured, index_onValidationError as onValidationError, index_partialUpdateAccountsProfilePartialPartialUpdate as partialUpdateAccountsProfilePartialPartialUpdate, index_partialUpdateAccountsProfilePartialUpdate as partialUpdateAccountsProfilePartialUpdate, index_partialUpdateAccountsProfileUpdatePartialUpdate as partialUpdateAccountsProfileUpdatePartialUpdate, index_reconfigureAPI as reconfigureAPI, index_resetAPI as resetAPI, index_shouldRetry as shouldRetry, index_updateAccountsProfileUpdateUpdate as updateAccountsProfileUpdateUpdate, index_withRetry as withRetry };
|
|
1952
1997
|
}
|
|
1953
1998
|
|
|
1954
1999
|
/**
|
|
@@ -1980,1033 +2025,6 @@ type ConnectionTokenResponse = z.infer<typeof ConnectionTokenResponseSchema>;
|
|
|
1980
2025
|
*/
|
|
1981
2026
|
declare function getCentrifugoAuthTokenRetrieve(client?: any): Promise<ConnectionTokenResponse>;
|
|
1982
2027
|
|
|
1983
|
-
/**
|
|
1984
|
-
* Request serializer for sending push notifications.
|
|
1985
|
-
*
|
|
1986
|
-
* Request model (no read-only fields).
|
|
1987
|
-
*/
|
|
1988
|
-
interface SendPushRequestRequest$1 {
|
|
1989
|
-
/** Notification title */
|
|
1990
|
-
title: string;
|
|
1991
|
-
/** Notification body */
|
|
1992
|
-
body: string;
|
|
1993
|
-
/** Notification icon URL */
|
|
1994
|
-
icon?: string | null;
|
|
1995
|
-
/** URL to open on click */
|
|
1996
|
-
url?: string | null;
|
|
1997
|
-
}
|
|
1998
|
-
/**
|
|
1999
|
-
* Response serializer for send push endpoint.
|
|
2000
|
-
*
|
|
2001
|
-
* Response model (includes read-only fields).
|
|
2002
|
-
*/
|
|
2003
|
-
interface SendPushResponse$1 {
|
|
2004
|
-
/** Whether send was successful */
|
|
2005
|
-
success: boolean;
|
|
2006
|
-
/** Number of devices notification was sent to */
|
|
2007
|
-
sent_to: number;
|
|
2008
|
-
}
|
|
2009
|
-
/**
|
|
2010
|
-
* Request serializer for subscribing to push notifications.
|
|
2011
|
-
*
|
|
2012
|
-
* Request model (no read-only fields).
|
|
2013
|
-
*/
|
|
2014
|
-
interface SubscribeRequestRequest$1 {
|
|
2015
|
-
/** Push service endpoint URL from browser */
|
|
2016
|
-
endpoint: string;
|
|
2017
|
-
/** Encryption keys (p256dh and auth) */
|
|
2018
|
-
keys: Record<string, any>;
|
|
2019
|
-
}
|
|
2020
|
-
/**
|
|
2021
|
-
* Response serializer for subscription endpoint.
|
|
2022
|
-
*
|
|
2023
|
-
* Response model (includes read-only fields).
|
|
2024
|
-
*/
|
|
2025
|
-
interface SubscribeResponse$1 {
|
|
2026
|
-
/** Whether subscription was successful */
|
|
2027
|
-
success: boolean;
|
|
2028
|
-
/** ID of the subscription */
|
|
2029
|
-
subscription_id: number;
|
|
2030
|
-
/** Whether subscription was newly created */
|
|
2031
|
-
created: boolean;
|
|
2032
|
-
}
|
|
2033
|
-
/**
|
|
2034
|
-
* Response serializer for VAPID public key endpoint.
|
|
2035
|
-
*
|
|
2036
|
-
* Response model (includes read-only fields).
|
|
2037
|
-
*/
|
|
2038
|
-
interface VapidPublicKeyResponse$1 {
|
|
2039
|
-
/** VAPID public key for client subscription */
|
|
2040
|
-
publicKey: string;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
declare namespace models {
|
|
2044
|
-
export type { SendPushRequestRequest$1 as SendPushRequestRequest, SendPushResponse$1 as SendPushResponse, SubscribeRequestRequest$1 as SubscribeRequestRequest, SubscribeResponse$1 as SubscribeResponse, VapidPublicKeyResponse$1 as VapidPublicKeyResponse };
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
/**
|
|
2048
|
-
* API endpoints for Web Push.
|
|
2049
|
-
*/
|
|
2050
|
-
declare class WebPush {
|
|
2051
|
-
private client;
|
|
2052
|
-
constructor(client: any);
|
|
2053
|
-
/**
|
|
2054
|
-
* Send push notification
|
|
2055
|
-
*
|
|
2056
|
-
* Send push notification to all active subscriptions for the authenticated
|
|
2057
|
-
* user.
|
|
2058
|
-
*/
|
|
2059
|
-
webpushSendCreate(data: SendPushRequestRequest$1): Promise<SendPushResponse$1>;
|
|
2060
|
-
/**
|
|
2061
|
-
* Subscribe to push notifications
|
|
2062
|
-
*
|
|
2063
|
-
* Save push subscription from browser for the authenticated user.
|
|
2064
|
-
*/
|
|
2065
|
-
webpushSubscribeCreate(data: SubscribeRequestRequest$1): Promise<SubscribeResponse$1>;
|
|
2066
|
-
/**
|
|
2067
|
-
* Get VAPID public key
|
|
2068
|
-
*
|
|
2069
|
-
* Get VAPID public key for client subscription.
|
|
2070
|
-
*/
|
|
2071
|
-
webpushVapidRetrieve(): Promise<VapidPublicKeyResponse$1>;
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
/**
|
|
2075
|
-
* HTTP Client Adapter Pattern
|
|
2076
|
-
*
|
|
2077
|
-
* Allows switching between fetch/axios/httpx without changing generated code.
|
|
2078
|
-
* Provides unified interface for making HTTP requests.
|
|
2079
|
-
*/
|
|
2080
|
-
interface HttpRequest {
|
|
2081
|
-
method: string;
|
|
2082
|
-
url: string;
|
|
2083
|
-
headers?: Record<string, string>;
|
|
2084
|
-
body?: any;
|
|
2085
|
-
params?: Record<string, any>;
|
|
2086
|
-
/** FormData for file uploads (multipart/form-data) */
|
|
2087
|
-
formData?: FormData;
|
|
2088
|
-
/** Binary data for octet-stream uploads */
|
|
2089
|
-
binaryBody?: Blob | ArrayBuffer;
|
|
2090
|
-
}
|
|
2091
|
-
interface HttpResponse<T = any> {
|
|
2092
|
-
data: T;
|
|
2093
|
-
status: number;
|
|
2094
|
-
statusText: string;
|
|
2095
|
-
headers: Record<string, string>;
|
|
2096
|
-
}
|
|
2097
|
-
/**
|
|
2098
|
-
* HTTP Client Adapter Interface.
|
|
2099
|
-
* Implement this to use custom HTTP clients (axios, httpx, etc.)
|
|
2100
|
-
*/
|
|
2101
|
-
interface HttpClientAdapter {
|
|
2102
|
-
request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
|
|
2103
|
-
}
|
|
2104
|
-
/**
|
|
2105
|
-
* Default Fetch API adapter.
|
|
2106
|
-
* Uses native browser fetch() with proper error handling.
|
|
2107
|
-
*/
|
|
2108
|
-
declare class FetchAdapter implements HttpClientAdapter {
|
|
2109
|
-
request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
/**
|
|
2113
|
-
* API Logger with Consola
|
|
2114
|
-
* Beautiful console logging for API requests and responses
|
|
2115
|
-
*
|
|
2116
|
-
* Installation:
|
|
2117
|
-
* npm install consola
|
|
2118
|
-
*/
|
|
2119
|
-
|
|
2120
|
-
/**
|
|
2121
|
-
* Request log data
|
|
2122
|
-
*/
|
|
2123
|
-
interface RequestLog {
|
|
2124
|
-
method: string;
|
|
2125
|
-
url: string;
|
|
2126
|
-
headers?: Record<string, string>;
|
|
2127
|
-
body?: any;
|
|
2128
|
-
timestamp: number;
|
|
2129
|
-
}
|
|
2130
|
-
/**
|
|
2131
|
-
* Response log data
|
|
2132
|
-
*/
|
|
2133
|
-
interface ResponseLog {
|
|
2134
|
-
status: number;
|
|
2135
|
-
statusText: string;
|
|
2136
|
-
data?: any;
|
|
2137
|
-
duration: number;
|
|
2138
|
-
timestamp: number;
|
|
2139
|
-
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Error log data
|
|
2142
|
-
*/
|
|
2143
|
-
interface ErrorLog {
|
|
2144
|
-
message: string;
|
|
2145
|
-
statusCode?: number;
|
|
2146
|
-
fieldErrors?: Record<string, string[]>;
|
|
2147
|
-
duration: number;
|
|
2148
|
-
timestamp: number;
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* Logger configuration
|
|
2152
|
-
*/
|
|
2153
|
-
interface LoggerConfig {
|
|
2154
|
-
/** Enable logging */
|
|
2155
|
-
enabled: boolean;
|
|
2156
|
-
/** Log requests */
|
|
2157
|
-
logRequests: boolean;
|
|
2158
|
-
/** Log responses */
|
|
2159
|
-
logResponses: boolean;
|
|
2160
|
-
/** Log errors */
|
|
2161
|
-
logErrors: boolean;
|
|
2162
|
-
/** Log request/response bodies */
|
|
2163
|
-
logBodies: boolean;
|
|
2164
|
-
/** Log headers (excluding sensitive ones) */
|
|
2165
|
-
logHeaders: boolean;
|
|
2166
|
-
/** Custom consola instance */
|
|
2167
|
-
consola?: ConsolaInstance;
|
|
2168
|
-
}
|
|
2169
|
-
/**
|
|
2170
|
-
* API Logger class
|
|
2171
|
-
*/
|
|
2172
|
-
declare class APILogger {
|
|
2173
|
-
private config;
|
|
2174
|
-
private consola;
|
|
2175
|
-
constructor(config?: Partial<LoggerConfig>);
|
|
2176
|
-
/**
|
|
2177
|
-
* Enable logging
|
|
2178
|
-
*/
|
|
2179
|
-
enable(): void;
|
|
2180
|
-
/**
|
|
2181
|
-
* Disable logging
|
|
2182
|
-
*/
|
|
2183
|
-
disable(): void;
|
|
2184
|
-
/**
|
|
2185
|
-
* Update configuration
|
|
2186
|
-
*/
|
|
2187
|
-
setConfig(config: Partial<LoggerConfig>): void;
|
|
2188
|
-
/**
|
|
2189
|
-
* Filter sensitive headers
|
|
2190
|
-
*/
|
|
2191
|
-
private filterHeaders;
|
|
2192
|
-
/**
|
|
2193
|
-
* Log request
|
|
2194
|
-
*/
|
|
2195
|
-
logRequest(request: RequestLog): void;
|
|
2196
|
-
/**
|
|
2197
|
-
* Log response
|
|
2198
|
-
*/
|
|
2199
|
-
logResponse(request: RequestLog, response: ResponseLog): void;
|
|
2200
|
-
/**
|
|
2201
|
-
* Log error
|
|
2202
|
-
*/
|
|
2203
|
-
logError(request: RequestLog, error: ErrorLog): void;
|
|
2204
|
-
/**
|
|
2205
|
-
* Log general info
|
|
2206
|
-
*/
|
|
2207
|
-
info(message: string, ...args: any[]): void;
|
|
2208
|
-
/**
|
|
2209
|
-
* Log warning
|
|
2210
|
-
*/
|
|
2211
|
-
warn(message: string, ...args: any[]): void;
|
|
2212
|
-
/**
|
|
2213
|
-
* Log error
|
|
2214
|
-
*/
|
|
2215
|
-
error(message: string, ...args: any[]): void;
|
|
2216
|
-
/**
|
|
2217
|
-
* Log debug
|
|
2218
|
-
*/
|
|
2219
|
-
debug(message: string, ...args: any[]): void;
|
|
2220
|
-
/**
|
|
2221
|
-
* Log success
|
|
2222
|
-
*/
|
|
2223
|
-
success(message: string, ...args: any[]): void;
|
|
2224
|
-
/**
|
|
2225
|
-
* Create a sub-logger with prefix
|
|
2226
|
-
*/
|
|
2227
|
-
withTag(tag: string): ConsolaInstance;
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2230
|
-
/**
|
|
2231
|
-
* Retry Configuration and Utilities
|
|
2232
|
-
*
|
|
2233
|
-
* Provides automatic retry logic for failed HTTP requests using p-retry.
|
|
2234
|
-
* Retries only on network errors and server errors (5xx), not client errors (4xx).
|
|
2235
|
-
*/
|
|
2236
|
-
/**
|
|
2237
|
-
* Information about a failed retry attempt.
|
|
2238
|
-
*/
|
|
2239
|
-
interface FailedAttemptInfo {
|
|
2240
|
-
/** The error that caused the failure */
|
|
2241
|
-
error: Error;
|
|
2242
|
-
/** The attempt number (1-indexed) */
|
|
2243
|
-
attemptNumber: number;
|
|
2244
|
-
/** Number of retries left */
|
|
2245
|
-
retriesLeft: number;
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* Retry configuration options.
|
|
2249
|
-
*
|
|
2250
|
-
* Uses exponential backoff with jitter by default to avoid thundering herd.
|
|
2251
|
-
*/
|
|
2252
|
-
interface RetryConfig {
|
|
2253
|
-
/**
|
|
2254
|
-
* Maximum number of retry attempts.
|
|
2255
|
-
* @default 3
|
|
2256
|
-
*/
|
|
2257
|
-
retries?: number;
|
|
2258
|
-
/**
|
|
2259
|
-
* Exponential backoff factor.
|
|
2260
|
-
* @default 2
|
|
2261
|
-
*/
|
|
2262
|
-
factor?: number;
|
|
2263
|
-
/**
|
|
2264
|
-
* Minimum wait time between retries (ms).
|
|
2265
|
-
* @default 1000
|
|
2266
|
-
*/
|
|
2267
|
-
minTimeout?: number;
|
|
2268
|
-
/**
|
|
2269
|
-
* Maximum wait time between retries (ms).
|
|
2270
|
-
* @default 60000
|
|
2271
|
-
*/
|
|
2272
|
-
maxTimeout?: number;
|
|
2273
|
-
/**
|
|
2274
|
-
* Add randomness to wait times (jitter).
|
|
2275
|
-
* Helps avoid thundering herd problem.
|
|
2276
|
-
* @default true
|
|
2277
|
-
*/
|
|
2278
|
-
randomize?: boolean;
|
|
2279
|
-
/**
|
|
2280
|
-
* Callback called on each failed attempt.
|
|
2281
|
-
*/
|
|
2282
|
-
onFailedAttempt?: (info: FailedAttemptInfo) => void;
|
|
2283
|
-
}
|
|
2284
|
-
/**
|
|
2285
|
-
* Default retry configuration.
|
|
2286
|
-
*/
|
|
2287
|
-
declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
|
|
2288
|
-
/**
|
|
2289
|
-
* Determine if an error should trigger a retry.
|
|
2290
|
-
*
|
|
2291
|
-
* Retries on:
|
|
2292
|
-
* - Network errors (connection refused, timeout, etc.)
|
|
2293
|
-
* - Server errors (5xx status codes)
|
|
2294
|
-
* - Rate limiting (429 status code)
|
|
2295
|
-
*
|
|
2296
|
-
* Does NOT retry on:
|
|
2297
|
-
* - Client errors (4xx except 429)
|
|
2298
|
-
* - Authentication errors (401, 403)
|
|
2299
|
-
* - Not found (404)
|
|
2300
|
-
*
|
|
2301
|
-
* @param error - The error to check
|
|
2302
|
-
* @returns true if should retry, false otherwise
|
|
2303
|
-
*/
|
|
2304
|
-
declare function shouldRetry(error: any): boolean;
|
|
2305
|
-
/**
|
|
2306
|
-
* Wrap a function with retry logic.
|
|
2307
|
-
*
|
|
2308
|
-
* @param fn - Async function to retry
|
|
2309
|
-
* @param config - Retry configuration
|
|
2310
|
-
* @returns Result of the function
|
|
2311
|
-
*
|
|
2312
|
-
* @example
|
|
2313
|
-
* ```typescript
|
|
2314
|
-
* const result = await withRetry(
|
|
2315
|
-
* async () => fetch('https://api.example.com/users'),
|
|
2316
|
-
* { retries: 5, minTimeout: 2000 }
|
|
2317
|
-
* );
|
|
2318
|
-
* ```
|
|
2319
|
-
*/
|
|
2320
|
-
declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
2321
|
-
|
|
2322
|
-
/**
|
|
2323
|
-
* Async API client for Django CFG API.
|
|
2324
|
-
*
|
|
2325
|
-
* Usage:
|
|
2326
|
-
* ```typescript
|
|
2327
|
-
* const client = new APIClient('https://api.example.com');
|
|
2328
|
-
* const users = await client.users.list();
|
|
2329
|
-
* const post = await client.posts.create(newPost);
|
|
2330
|
-
*
|
|
2331
|
-
* // Custom HTTP adapter (e.g., Axios)
|
|
2332
|
-
* const client = new APIClient('https://api.example.com', {
|
|
2333
|
-
* httpClient: new AxiosAdapter()
|
|
2334
|
-
* });
|
|
2335
|
-
* ```
|
|
2336
|
-
*/
|
|
2337
|
-
declare class APIClient {
|
|
2338
|
-
private baseUrl;
|
|
2339
|
-
private httpClient;
|
|
2340
|
-
private logger;
|
|
2341
|
-
private retryConfig;
|
|
2342
|
-
private tokenGetter;
|
|
2343
|
-
web_push: WebPush;
|
|
2344
|
-
constructor(baseUrl: string, options?: {
|
|
2345
|
-
httpClient?: HttpClientAdapter;
|
|
2346
|
-
loggerConfig?: Partial<LoggerConfig>;
|
|
2347
|
-
retryConfig?: RetryConfig;
|
|
2348
|
-
tokenGetter?: () => string | null;
|
|
2349
|
-
});
|
|
2350
|
-
/**
|
|
2351
|
-
* Get CSRF token from cookies (for SessionAuthentication).
|
|
2352
|
-
*
|
|
2353
|
-
* Returns null if cookie doesn't exist (JWT-only auth).
|
|
2354
|
-
*/
|
|
2355
|
-
getCsrfToken(): string | null;
|
|
2356
|
-
/**
|
|
2357
|
-
* Get the base URL for building streaming/download URLs.
|
|
2358
|
-
*/
|
|
2359
|
-
getBaseUrl(): string;
|
|
2360
|
-
/**
|
|
2361
|
-
* Get JWT token for URL authentication (used in streaming endpoints).
|
|
2362
|
-
* Returns null if no token getter is configured or no token is available.
|
|
2363
|
-
*/
|
|
2364
|
-
getToken(): string | null;
|
|
2365
|
-
/**
|
|
2366
|
-
* Make HTTP request with Django CSRF and session handling.
|
|
2367
|
-
* Automatically retries on network errors and 5xx server errors.
|
|
2368
|
-
*/
|
|
2369
|
-
request<T>(method: string, path: string, options?: {
|
|
2370
|
-
params?: Record<string, any>;
|
|
2371
|
-
body?: any;
|
|
2372
|
-
formData?: FormData;
|
|
2373
|
-
binaryBody?: Blob | ArrayBuffer;
|
|
2374
|
-
headers?: Record<string, string>;
|
|
2375
|
-
}): Promise<T>;
|
|
2376
|
-
/**
|
|
2377
|
-
* Internal request method (without retry wrapper).
|
|
2378
|
-
* Used by request() method with optional retry logic.
|
|
2379
|
-
*/
|
|
2380
|
-
private _makeRequest;
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
/**
|
|
2384
|
-
* Storage adapters for cross-platform token storage.
|
|
2385
|
-
*
|
|
2386
|
-
* Supports:
|
|
2387
|
-
* - LocalStorage (browser)
|
|
2388
|
-
* - Cookies (SSR/browser)
|
|
2389
|
-
* - Memory (Node.js/Electron/testing)
|
|
2390
|
-
*/
|
|
2391
|
-
|
|
2392
|
-
/**
|
|
2393
|
-
* Storage adapter interface for cross-platform token storage.
|
|
2394
|
-
*/
|
|
2395
|
-
interface StorageAdapter {
|
|
2396
|
-
getItem(key: string): string | null;
|
|
2397
|
-
setItem(key: string, value: string): void;
|
|
2398
|
-
removeItem(key: string): void;
|
|
2399
|
-
}
|
|
2400
|
-
/**
|
|
2401
|
-
* LocalStorage adapter with safe try-catch for browser environments.
|
|
2402
|
-
* Works in modern browsers with localStorage support.
|
|
2403
|
-
*
|
|
2404
|
-
* Note: This adapter uses window.localStorage and should only be used in browser/client environments.
|
|
2405
|
-
* For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.
|
|
2406
|
-
*/
|
|
2407
|
-
declare class LocalStorageAdapter implements StorageAdapter {
|
|
2408
|
-
private logger?;
|
|
2409
|
-
constructor(logger?: APILogger);
|
|
2410
|
-
getItem(key: string): string | null;
|
|
2411
|
-
setItem(key: string, value: string): void;
|
|
2412
|
-
removeItem(key: string): void;
|
|
2413
|
-
}
|
|
2414
|
-
/**
|
|
2415
|
-
* Cookie-based storage adapter for SSR and browser environments.
|
|
2416
|
-
* Useful for Next.js, Nuxt.js, and other SSR frameworks.
|
|
2417
|
-
*/
|
|
2418
|
-
declare class CookieStorageAdapter implements StorageAdapter {
|
|
2419
|
-
private logger?;
|
|
2420
|
-
constructor(logger?: APILogger);
|
|
2421
|
-
getItem(key: string): string | null;
|
|
2422
|
-
setItem(key: string, value: string): void;
|
|
2423
|
-
removeItem(key: string): void;
|
|
2424
|
-
}
|
|
2425
|
-
/**
|
|
2426
|
-
* In-memory storage adapter for Node.js, Electron, and testing environments.
|
|
2427
|
-
* Data is stored in RAM and cleared when process exits.
|
|
2428
|
-
*/
|
|
2429
|
-
declare class MemoryStorageAdapter implements StorageAdapter {
|
|
2430
|
-
private storage;
|
|
2431
|
-
private logger?;
|
|
2432
|
-
constructor(logger?: APILogger);
|
|
2433
|
-
getItem(key: string): string | null;
|
|
2434
|
-
setItem(key: string, value: string): void;
|
|
2435
|
-
removeItem(key: string): void;
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
/**
|
|
2439
|
-
* Zod schema for SendPushRequestRequest
|
|
2440
|
-
*
|
|
2441
|
-
* This schema provides runtime validation and type inference.
|
|
2442
|
-
* * Request serializer for sending push notifications.
|
|
2443
|
-
* */
|
|
2444
|
-
|
|
2445
|
-
/**
|
|
2446
|
-
* Request serializer for sending push notifications.
|
|
2447
|
-
*/
|
|
2448
|
-
declare const SendPushRequestRequestSchema: z.ZodObject<{
|
|
2449
|
-
title: z.ZodString;
|
|
2450
|
-
body: z.ZodString;
|
|
2451
|
-
icon: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>>;
|
|
2452
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>>;
|
|
2453
|
-
}, z.core.$strip>;
|
|
2454
|
-
/**
|
|
2455
|
-
* Infer TypeScript type from Zod schema
|
|
2456
|
-
*/
|
|
2457
|
-
type SendPushRequestRequest = z.infer<typeof SendPushRequestRequestSchema>;
|
|
2458
|
-
|
|
2459
|
-
/**
|
|
2460
|
-
* Zod schema for SendPushResponse
|
|
2461
|
-
*
|
|
2462
|
-
* This schema provides runtime validation and type inference.
|
|
2463
|
-
* * Response serializer for send push endpoint.
|
|
2464
|
-
* */
|
|
2465
|
-
|
|
2466
|
-
/**
|
|
2467
|
-
* Response serializer for send push endpoint.
|
|
2468
|
-
*/
|
|
2469
|
-
declare const SendPushResponseSchema: z.ZodObject<{
|
|
2470
|
-
success: z.ZodBoolean;
|
|
2471
|
-
sent_to: z.ZodInt;
|
|
2472
|
-
}, z.core.$strip>;
|
|
2473
|
-
/**
|
|
2474
|
-
* Infer TypeScript type from Zod schema
|
|
2475
|
-
*/
|
|
2476
|
-
type SendPushResponse = z.infer<typeof SendPushResponseSchema>;
|
|
2477
|
-
|
|
2478
|
-
/**
|
|
2479
|
-
* Zod schema for SubscribeRequestRequest
|
|
2480
|
-
*
|
|
2481
|
-
* This schema provides runtime validation and type inference.
|
|
2482
|
-
* * Request serializer for subscribing to push notifications.
|
|
2483
|
-
* */
|
|
2484
|
-
|
|
2485
|
-
/**
|
|
2486
|
-
* Request serializer for subscribing to push notifications.
|
|
2487
|
-
*/
|
|
2488
|
-
declare const SubscribeRequestRequestSchema: z.ZodObject<{
|
|
2489
|
-
endpoint: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
2490
|
-
keys: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
2491
|
-
}, z.core.$strip>;
|
|
2492
|
-
/**
|
|
2493
|
-
* Infer TypeScript type from Zod schema
|
|
2494
|
-
*/
|
|
2495
|
-
type SubscribeRequestRequest = z.infer<typeof SubscribeRequestRequestSchema>;
|
|
2496
|
-
|
|
2497
|
-
/**
|
|
2498
|
-
* Zod schema for SubscribeResponse
|
|
2499
|
-
*
|
|
2500
|
-
* This schema provides runtime validation and type inference.
|
|
2501
|
-
* * Response serializer for subscription endpoint.
|
|
2502
|
-
* */
|
|
2503
|
-
|
|
2504
|
-
/**
|
|
2505
|
-
* Response serializer for subscription endpoint.
|
|
2506
|
-
*/
|
|
2507
|
-
declare const SubscribeResponseSchema: z.ZodObject<{
|
|
2508
|
-
success: z.ZodBoolean;
|
|
2509
|
-
subscription_id: z.ZodInt;
|
|
2510
|
-
created: z.ZodBoolean;
|
|
2511
|
-
}, z.core.$strip>;
|
|
2512
|
-
/**
|
|
2513
|
-
* Infer TypeScript type from Zod schema
|
|
2514
|
-
*/
|
|
2515
|
-
type SubscribeResponse = z.infer<typeof SubscribeResponseSchema>;
|
|
2516
|
-
|
|
2517
|
-
/**
|
|
2518
|
-
* Zod schema for VapidPublicKeyResponse
|
|
2519
|
-
*
|
|
2520
|
-
* This schema provides runtime validation and type inference.
|
|
2521
|
-
* * Response serializer for VAPID public key endpoint.
|
|
2522
|
-
* */
|
|
2523
|
-
|
|
2524
|
-
/**
|
|
2525
|
-
* Response serializer for VAPID public key endpoint.
|
|
2526
|
-
*/
|
|
2527
|
-
declare const VapidPublicKeyResponseSchema: z.ZodObject<{
|
|
2528
|
-
publicKey: z.ZodString;
|
|
2529
|
-
}, z.core.$strip>;
|
|
2530
|
-
/**
|
|
2531
|
-
* Infer TypeScript type from Zod schema
|
|
2532
|
-
*/
|
|
2533
|
-
type VapidPublicKeyResponse = z.infer<typeof VapidPublicKeyResponseSchema>;
|
|
2534
|
-
|
|
2535
|
-
/**
|
|
2536
|
-
* Zod Schemas - Runtime validation and type inference
|
|
2537
|
-
*
|
|
2538
|
-
* Auto-generated from OpenAPI specification.
|
|
2539
|
-
* Provides runtime validation for API requests and responses.
|
|
2540
|
-
*
|
|
2541
|
-
* Usage:
|
|
2542
|
-
* ```typescript
|
|
2543
|
-
* import { UserSchema } from './schemas'
|
|
2544
|
-
*
|
|
2545
|
-
* // Validate data
|
|
2546
|
-
* const user = UserSchema.parse(data)
|
|
2547
|
-
*
|
|
2548
|
-
* // Type inference
|
|
2549
|
-
* type User = z.infer<typeof UserSchema>
|
|
2550
|
-
* ```
|
|
2551
|
-
*/
|
|
2552
|
-
|
|
2553
|
-
type index$2_SendPushRequestRequest = SendPushRequestRequest;
|
|
2554
|
-
declare const index$2_SendPushRequestRequestSchema: typeof SendPushRequestRequestSchema;
|
|
2555
|
-
type index$2_SendPushResponse = SendPushResponse;
|
|
2556
|
-
declare const index$2_SendPushResponseSchema: typeof SendPushResponseSchema;
|
|
2557
|
-
type index$2_SubscribeRequestRequest = SubscribeRequestRequest;
|
|
2558
|
-
declare const index$2_SubscribeRequestRequestSchema: typeof SubscribeRequestRequestSchema;
|
|
2559
|
-
type index$2_SubscribeResponse = SubscribeResponse;
|
|
2560
|
-
declare const index$2_SubscribeResponseSchema: typeof SubscribeResponseSchema;
|
|
2561
|
-
type index$2_VapidPublicKeyResponse = VapidPublicKeyResponse;
|
|
2562
|
-
declare const index$2_VapidPublicKeyResponseSchema: typeof VapidPublicKeyResponseSchema;
|
|
2563
|
-
declare namespace index$2 {
|
|
2564
|
-
export { type index$2_SendPushRequestRequest as SendPushRequestRequest, index$2_SendPushRequestRequestSchema as SendPushRequestRequestSchema, type index$2_SendPushResponse as SendPushResponse, index$2_SendPushResponseSchema as SendPushResponseSchema, type index$2_SubscribeRequestRequest as SubscribeRequestRequest, index$2_SubscribeRequestRequestSchema as SubscribeRequestRequestSchema, type index$2_SubscribeResponse as SubscribeResponse, index$2_SubscribeResponseSchema as SubscribeResponseSchema, type index$2_VapidPublicKeyResponse as VapidPublicKeyResponse, index$2_VapidPublicKeyResponseSchema as VapidPublicKeyResponseSchema };
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
/**
|
|
2568
|
-
* Zod Validation Events - Browser CustomEvent integration
|
|
2569
|
-
*
|
|
2570
|
-
* Dispatches browser CustomEvents when Zod validation fails, allowing
|
|
2571
|
-
* React/frontend apps to listen and handle validation errors globally.
|
|
2572
|
-
*
|
|
2573
|
-
* @example
|
|
2574
|
-
* ```typescript
|
|
2575
|
-
* // In your React app
|
|
2576
|
-
* window.addEventListener('zod-validation-error', (event) => {
|
|
2577
|
-
* const { operation, path, method, error, response } = event.detail;
|
|
2578
|
-
* console.error(`Validation failed for ${method} ${path}`, error);
|
|
2579
|
-
* // Show toast notification, log to Sentry, etc.
|
|
2580
|
-
* });
|
|
2581
|
-
* ```
|
|
2582
|
-
*/
|
|
2583
|
-
|
|
2584
|
-
/**
|
|
2585
|
-
* Validation error event detail
|
|
2586
|
-
*/
|
|
2587
|
-
interface ValidationErrorDetail {
|
|
2588
|
-
/** Operation/function name that failed validation */
|
|
2589
|
-
operation: string;
|
|
2590
|
-
/** API endpoint path */
|
|
2591
|
-
path: string;
|
|
2592
|
-
/** HTTP method */
|
|
2593
|
-
method: string;
|
|
2594
|
-
/** Zod validation error */
|
|
2595
|
-
error: ZodError;
|
|
2596
|
-
/** Raw response data that failed validation */
|
|
2597
|
-
response: any;
|
|
2598
|
-
/** Timestamp of the error */
|
|
2599
|
-
timestamp: Date;
|
|
2600
|
-
}
|
|
2601
|
-
/**
|
|
2602
|
-
* Custom event type for Zod validation errors
|
|
2603
|
-
*/
|
|
2604
|
-
type ValidationErrorEvent = CustomEvent<ValidationErrorDetail>;
|
|
2605
|
-
/**
|
|
2606
|
-
* Dispatch a Zod validation error event.
|
|
2607
|
-
*
|
|
2608
|
-
* Only dispatches in browser environment (when window is defined).
|
|
2609
|
-
* Safe to call in Node.js/SSR - will be a no-op.
|
|
2610
|
-
*
|
|
2611
|
-
* @param detail - Validation error details
|
|
2612
|
-
*/
|
|
2613
|
-
declare function dispatchValidationError(detail: ValidationErrorDetail): void;
|
|
2614
|
-
/**
|
|
2615
|
-
* Add a global listener for Zod validation errors.
|
|
2616
|
-
*
|
|
2617
|
-
* @param callback - Function to call when validation error occurs
|
|
2618
|
-
* @returns Cleanup function to remove the listener
|
|
2619
|
-
*
|
|
2620
|
-
* @example
|
|
2621
|
-
* ```typescript
|
|
2622
|
-
* const cleanup = onValidationError(({ operation, error }) => {
|
|
2623
|
-
* toast.error(`Validation failed in ${operation}`);
|
|
2624
|
-
* logToSentry(error);
|
|
2625
|
-
* });
|
|
2626
|
-
*
|
|
2627
|
-
* // Later, remove listener
|
|
2628
|
-
* cleanup();
|
|
2629
|
-
* ```
|
|
2630
|
-
*/
|
|
2631
|
-
declare function onValidationError(callback: (detail: ValidationErrorDetail) => void): () => void;
|
|
2632
|
-
/**
|
|
2633
|
-
* Format Zod error for logging/display.
|
|
2634
|
-
*
|
|
2635
|
-
* @param error - Zod validation error
|
|
2636
|
-
* @returns Formatted error message
|
|
2637
|
-
*/
|
|
2638
|
-
declare function formatZodError(error: ZodError): string;
|
|
2639
|
-
|
|
2640
|
-
/**
|
|
2641
|
-
* Send push notification
|
|
2642
|
-
*
|
|
2643
|
-
* @method POST
|
|
2644
|
-
* @path /cfg/webpush/send/
|
|
2645
|
-
*/
|
|
2646
|
-
declare function createWebpushSendCreate(data: SendPushRequestRequest, client?: any): Promise<SendPushResponse>;
|
|
2647
|
-
/**
|
|
2648
|
-
* Subscribe to push notifications
|
|
2649
|
-
*
|
|
2650
|
-
* @method POST
|
|
2651
|
-
* @path /cfg/webpush/subscribe/
|
|
2652
|
-
*/
|
|
2653
|
-
declare function createWebpushSubscribeCreate(data: SubscribeRequestRequest, client?: any): Promise<SubscribeResponse>;
|
|
2654
|
-
/**
|
|
2655
|
-
* Get VAPID public key
|
|
2656
|
-
*
|
|
2657
|
-
* @method GET
|
|
2658
|
-
* @path /cfg/webpush/vapid/
|
|
2659
|
-
*/
|
|
2660
|
-
declare function getWebpushVapidRetrieve(client?: any): Promise<VapidPublicKeyResponse>;
|
|
2661
|
-
|
|
2662
|
-
/**
|
|
2663
|
-
* Typed Fetchers - Universal API functions
|
|
2664
|
-
*
|
|
2665
|
-
* Auto-generated from OpenAPI specification.
|
|
2666
|
-
* These functions work in any JavaScript environment.
|
|
2667
|
-
*
|
|
2668
|
-
* Features:
|
|
2669
|
-
* - Runtime validation with Zod
|
|
2670
|
-
* - Type-safe parameters and responses
|
|
2671
|
-
* - Works with any data-fetching library (SWR, React Query, etc)
|
|
2672
|
-
* - Server Component compatible
|
|
2673
|
-
*
|
|
2674
|
-
* Usage:
|
|
2675
|
-
* ```typescript
|
|
2676
|
-
* import * as fetchers from './fetchers'
|
|
2677
|
-
*
|
|
2678
|
-
* // Direct usage
|
|
2679
|
-
* const user = await fetchers.getUser(1)
|
|
2680
|
-
*
|
|
2681
|
-
* // With SWR
|
|
2682
|
-
* const { data } = useSWR('user-1', () => fetchers.getUser(1))
|
|
2683
|
-
*
|
|
2684
|
-
* // With React Query
|
|
2685
|
-
* const { data } = useQuery(['user', 1], () => fetchers.getUser(1))
|
|
2686
|
-
* ```
|
|
2687
|
-
*/
|
|
2688
|
-
|
|
2689
|
-
declare const index$1_createWebpushSendCreate: typeof createWebpushSendCreate;
|
|
2690
|
-
declare const index$1_createWebpushSubscribeCreate: typeof createWebpushSubscribeCreate;
|
|
2691
|
-
declare const index$1_getWebpushVapidRetrieve: typeof getWebpushVapidRetrieve;
|
|
2692
|
-
declare namespace index$1 {
|
|
2693
|
-
export { index$1_createWebpushSendCreate as createWebpushSendCreate, index$1_createWebpushSubscribeCreate as createWebpushSubscribeCreate, index$1_getWebpushVapidRetrieve as getWebpushVapidRetrieve };
|
|
2694
|
-
}
|
|
2695
|
-
|
|
2696
|
-
/**
|
|
2697
|
-
* Global API Instance - Singleton configuration with auto-configuration support
|
|
2698
|
-
*
|
|
2699
|
-
* This module provides a global API instance that auto-configures from
|
|
2700
|
-
* environment variables or can be configured manually.
|
|
2701
|
-
*
|
|
2702
|
-
* AUTO-CONFIGURATION (recommended):
|
|
2703
|
-
* Set one of these environment variables and the API will auto-configure:
|
|
2704
|
-
* - NEXT_PUBLIC_API_URL (Next.js)
|
|
2705
|
-
* - VITE_API_URL (Vite)
|
|
2706
|
-
* - REACT_APP_API_URL (Create React App)
|
|
2707
|
-
* - API_URL (generic)
|
|
2708
|
-
*
|
|
2709
|
-
* Then just use fetchers and hooks directly:
|
|
2710
|
-
* ```typescript
|
|
2711
|
-
* import { getUsers } from './_utils/fetchers'
|
|
2712
|
-
* const users = await getUsers({ page: 1 })
|
|
2713
|
-
* ```
|
|
2714
|
-
*
|
|
2715
|
-
* MANUAL CONFIGURATION:
|
|
2716
|
-
* ```typescript
|
|
2717
|
-
* import { configureAPI } from './api-instance'
|
|
2718
|
-
*
|
|
2719
|
-
* configureAPI({
|
|
2720
|
-
* baseUrl: 'https://api.example.com',
|
|
2721
|
-
* token: 'your-jwt-token'
|
|
2722
|
-
* })
|
|
2723
|
-
* ```
|
|
2724
|
-
*
|
|
2725
|
-
* For SSR or multiple instances:
|
|
2726
|
-
* ```typescript
|
|
2727
|
-
* import { API } from './index'
|
|
2728
|
-
* import { getUsers } from './_utils/fetchers'
|
|
2729
|
-
*
|
|
2730
|
-
* const api = new API('https://api.example.com')
|
|
2731
|
-
* const users = await getUsers({ page: 1 }, api)
|
|
2732
|
-
* ```
|
|
2733
|
-
*/
|
|
2734
|
-
|
|
2735
|
-
/**
|
|
2736
|
-
* Get the global API instance
|
|
2737
|
-
* Auto-configures from environment variables on first call if not manually configured.
|
|
2738
|
-
* @throws Error if API is not configured and no env variable is set
|
|
2739
|
-
*/
|
|
2740
|
-
declare function getAPIInstance(): API;
|
|
2741
|
-
/**
|
|
2742
|
-
* Check if API is configured (or can be auto-configured)
|
|
2743
|
-
*/
|
|
2744
|
-
declare function isAPIConfigured(): boolean;
|
|
2745
|
-
/**
|
|
2746
|
-
* Configure the global API instance
|
|
2747
|
-
*
|
|
2748
|
-
* @param baseUrl - Base URL for the API
|
|
2749
|
-
* @param options - Optional configuration (storage, retry, logger)
|
|
2750
|
-
*
|
|
2751
|
-
* @example
|
|
2752
|
-
* ```typescript
|
|
2753
|
-
* configureAPI({
|
|
2754
|
-
* baseUrl: 'https://api.example.com',
|
|
2755
|
-
* token: 'jwt-token',
|
|
2756
|
-
* options: {
|
|
2757
|
-
* retryConfig: { maxRetries: 3 },
|
|
2758
|
-
* loggerConfig: { enabled: true }
|
|
2759
|
-
* }
|
|
2760
|
-
* })
|
|
2761
|
-
* ```
|
|
2762
|
-
*/
|
|
2763
|
-
declare function configureAPI(config: {
|
|
2764
|
-
baseUrl: string;
|
|
2765
|
-
token?: string;
|
|
2766
|
-
refreshToken?: string;
|
|
2767
|
-
options?: APIOptions;
|
|
2768
|
-
}): API;
|
|
2769
|
-
/**
|
|
2770
|
-
* Reconfigure the global API instance with new settings
|
|
2771
|
-
* Useful for updating tokens or base URL
|
|
2772
|
-
*/
|
|
2773
|
-
declare function reconfigureAPI(updates: {
|
|
2774
|
-
baseUrl?: string;
|
|
2775
|
-
token?: string;
|
|
2776
|
-
refreshToken?: string;
|
|
2777
|
-
}): API;
|
|
2778
|
-
/**
|
|
2779
|
-
* Clear tokens from the global API instance
|
|
2780
|
-
*/
|
|
2781
|
-
declare function clearAPITokens(): void;
|
|
2782
|
-
/**
|
|
2783
|
-
* Reset the global API instance
|
|
2784
|
-
* Useful for testing or logout scenarios
|
|
2785
|
-
*/
|
|
2786
|
-
declare function resetAPI(): void;
|
|
2787
|
-
|
|
2788
|
-
/**
|
|
2789
|
-
* API Error Classes
|
|
2790
|
-
*
|
|
2791
|
-
* Typed error classes with Django REST Framework support.
|
|
2792
|
-
*/
|
|
2793
|
-
/**
|
|
2794
|
-
* HTTP API Error with DRF field-specific validation errors.
|
|
2795
|
-
*
|
|
2796
|
-
* Usage:
|
|
2797
|
-
* ```typescript
|
|
2798
|
-
* try {
|
|
2799
|
-
* await api.users.create(userData);
|
|
2800
|
-
* } catch (error) {
|
|
2801
|
-
* if (error instanceof APIError) {
|
|
2802
|
-
* if (error.isValidationError) {
|
|
2803
|
-
* console.log('Field errors:', error.fieldErrors);
|
|
2804
|
-
* // { "email": ["Email already exists"], "username": ["Required"] }
|
|
2805
|
-
* }
|
|
2806
|
-
* }
|
|
2807
|
-
* }
|
|
2808
|
-
* ```
|
|
2809
|
-
*/
|
|
2810
|
-
declare class APIError extends Error {
|
|
2811
|
-
statusCode: number;
|
|
2812
|
-
statusText: string;
|
|
2813
|
-
response: any;
|
|
2814
|
-
url: string;
|
|
2815
|
-
constructor(statusCode: number, statusText: string, response: any, url: string, message?: string);
|
|
2816
|
-
/**
|
|
2817
|
-
* Get error details from response.
|
|
2818
|
-
* DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
|
|
2819
|
-
*/
|
|
2820
|
-
get details(): Record<string, any> | null;
|
|
2821
|
-
/**
|
|
2822
|
-
* Get field-specific validation errors from DRF.
|
|
2823
|
-
* Returns: { "field_name": ["error1", "error2"], ... }
|
|
2824
|
-
*/
|
|
2825
|
-
get fieldErrors(): Record<string, string[]> | null;
|
|
2826
|
-
/**
|
|
2827
|
-
* Get single error message from DRF.
|
|
2828
|
-
* Checks for "detail", "message", or first field error.
|
|
2829
|
-
*/
|
|
2830
|
-
get errorMessage(): string;
|
|
2831
|
-
get isValidationError(): boolean;
|
|
2832
|
-
get isAuthError(): boolean;
|
|
2833
|
-
get isPermissionError(): boolean;
|
|
2834
|
-
get isNotFoundError(): boolean;
|
|
2835
|
-
get isServerError(): boolean;
|
|
2836
|
-
}
|
|
2837
|
-
/**
|
|
2838
|
-
* Network Error (connection failed, timeout, etc.)
|
|
2839
|
-
*/
|
|
2840
|
-
declare class NetworkError extends Error {
|
|
2841
|
-
url: string;
|
|
2842
|
-
originalError?: Error;
|
|
2843
|
-
constructor(message: string, url: string, originalError?: Error);
|
|
2844
|
-
}
|
|
2845
|
-
|
|
2846
|
-
/**
|
|
2847
|
-
* Django CFG API - API Client with JWT Management
|
|
2848
|
-
*
|
|
2849
|
-
* Usage:
|
|
2850
|
-
* ```typescript
|
|
2851
|
-
* import { API } from './api';
|
|
2852
|
-
*
|
|
2853
|
-
* const api = new API('https://api.example.com');
|
|
2854
|
-
*
|
|
2855
|
-
* // Set JWT token
|
|
2856
|
-
* api.setToken('your-jwt-token', 'refresh-token');
|
|
2857
|
-
*
|
|
2858
|
-
* // Use API
|
|
2859
|
-
* const posts = await api.posts.list();
|
|
2860
|
-
* const user = await api.users.retrieve(1);
|
|
2861
|
-
*
|
|
2862
|
-
* // Check authentication
|
|
2863
|
-
* if (api.isAuthenticated()) {
|
|
2864
|
-
* // ...
|
|
2865
|
-
* }
|
|
2866
|
-
*
|
|
2867
|
-
* // Custom storage with logging (for Electron/Node.js)
|
|
2868
|
-
* import { MemoryStorageAdapter, APILogger } from './storage';
|
|
2869
|
-
* const logger = new APILogger({ enabled: true, logLevel: 'debug' });
|
|
2870
|
-
* const api = new API('https://api.example.com', {
|
|
2871
|
-
* storage: new MemoryStorageAdapter(logger),
|
|
2872
|
-
* loggerConfig: { enabled: true, logLevel: 'debug' }
|
|
2873
|
-
* });
|
|
2874
|
-
*
|
|
2875
|
-
* // Get OpenAPI schema
|
|
2876
|
-
* const schema = api.getSchema();
|
|
2877
|
-
* ```
|
|
2878
|
-
*/
|
|
2879
|
-
|
|
2880
|
-
declare const TOKEN_KEY = "auth_token";
|
|
2881
|
-
declare const REFRESH_TOKEN_KEY = "refresh_token";
|
|
2882
|
-
interface APIOptions {
|
|
2883
|
-
/** Custom storage adapter (defaults to LocalStorageAdapter) */
|
|
2884
|
-
storage?: StorageAdapter;
|
|
2885
|
-
/** Retry configuration for failed requests */
|
|
2886
|
-
retryConfig?: RetryConfig;
|
|
2887
|
-
/** Logger configuration */
|
|
2888
|
-
loggerConfig?: Partial<LoggerConfig>;
|
|
2889
|
-
}
|
|
2890
|
-
declare class API {
|
|
2891
|
-
private baseUrl;
|
|
2892
|
-
private _client;
|
|
2893
|
-
private _token;
|
|
2894
|
-
private _refreshToken;
|
|
2895
|
-
private storage;
|
|
2896
|
-
private options?;
|
|
2897
|
-
web_push: WebPush;
|
|
2898
|
-
constructor(baseUrl: string, options?: APIOptions);
|
|
2899
|
-
private _loadTokensFromStorage;
|
|
2900
|
-
private _reinitClients;
|
|
2901
|
-
private _injectAuthHeader;
|
|
2902
|
-
/**
|
|
2903
|
-
* Get current JWT token
|
|
2904
|
-
*/
|
|
2905
|
-
getToken(): string | null;
|
|
2906
|
-
/**
|
|
2907
|
-
* Get current refresh token
|
|
2908
|
-
*/
|
|
2909
|
-
getRefreshToken(): string | null;
|
|
2910
|
-
/**
|
|
2911
|
-
* Set JWT token and refresh token
|
|
2912
|
-
* @param token - JWT access token
|
|
2913
|
-
* @param refreshToken - JWT refresh token (optional)
|
|
2914
|
-
*/
|
|
2915
|
-
setToken(token: string, refreshToken?: string): void;
|
|
2916
|
-
/**
|
|
2917
|
-
* Clear all tokens
|
|
2918
|
-
*/
|
|
2919
|
-
clearTokens(): void;
|
|
2920
|
-
/**
|
|
2921
|
-
* Check if user is authenticated
|
|
2922
|
-
*/
|
|
2923
|
-
isAuthenticated(): boolean;
|
|
2924
|
-
/**
|
|
2925
|
-
* Update base URL and reinitialize clients
|
|
2926
|
-
* @param url - New base URL
|
|
2927
|
-
*/
|
|
2928
|
-
setBaseUrl(url: string): void;
|
|
2929
|
-
/**
|
|
2930
|
-
* Get current base URL
|
|
2931
|
-
*/
|
|
2932
|
-
getBaseUrl(): string;
|
|
2933
|
-
/**
|
|
2934
|
-
* Get OpenAPI schema path
|
|
2935
|
-
* @returns Path to the OpenAPI schema JSON file
|
|
2936
|
-
*
|
|
2937
|
-
* Note: The OpenAPI schema is available in the schema.json file.
|
|
2938
|
-
* You can load it dynamically using:
|
|
2939
|
-
* ```typescript
|
|
2940
|
-
* const schema = await fetch('./schema.json').then(r => r.json());
|
|
2941
|
-
* // or using fs in Node.js:
|
|
2942
|
-
* // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
|
|
2943
|
-
* ```
|
|
2944
|
-
*/
|
|
2945
|
-
getSchemaPath(): string;
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
type index_API = API;
|
|
2949
|
-
declare const index_API: typeof API;
|
|
2950
|
-
type index_APIClient = APIClient;
|
|
2951
|
-
declare const index_APIClient: typeof APIClient;
|
|
2952
|
-
type index_APIError = APIError;
|
|
2953
|
-
declare const index_APIError: typeof APIError;
|
|
2954
|
-
type index_APILogger = APILogger;
|
|
2955
|
-
declare const index_APILogger: typeof APILogger;
|
|
2956
|
-
type index_APIOptions = APIOptions;
|
|
2957
|
-
type index_CookieStorageAdapter = CookieStorageAdapter;
|
|
2958
|
-
declare const index_CookieStorageAdapter: typeof CookieStorageAdapter;
|
|
2959
|
-
declare const index_DEFAULT_RETRY_CONFIG: typeof DEFAULT_RETRY_CONFIG;
|
|
2960
|
-
type index_ErrorLog = ErrorLog;
|
|
2961
|
-
type index_FailedAttemptInfo = FailedAttemptInfo;
|
|
2962
|
-
type index_FetchAdapter = FetchAdapter;
|
|
2963
|
-
declare const index_FetchAdapter: typeof FetchAdapter;
|
|
2964
|
-
type index_HttpClientAdapter = HttpClientAdapter;
|
|
2965
|
-
type index_HttpRequest = HttpRequest;
|
|
2966
|
-
type index_HttpResponse<T = any> = HttpResponse<T>;
|
|
2967
|
-
type index_LocalStorageAdapter = LocalStorageAdapter;
|
|
2968
|
-
declare const index_LocalStorageAdapter: typeof LocalStorageAdapter;
|
|
2969
|
-
type index_LoggerConfig = LoggerConfig;
|
|
2970
|
-
type index_MemoryStorageAdapter = MemoryStorageAdapter;
|
|
2971
|
-
declare const index_MemoryStorageAdapter: typeof MemoryStorageAdapter;
|
|
2972
|
-
type index_NetworkError = NetworkError;
|
|
2973
|
-
declare const index_NetworkError: typeof NetworkError;
|
|
2974
|
-
declare const index_REFRESH_TOKEN_KEY: typeof REFRESH_TOKEN_KEY;
|
|
2975
|
-
type index_RequestLog = RequestLog;
|
|
2976
|
-
type index_ResponseLog = ResponseLog;
|
|
2977
|
-
type index_RetryConfig = RetryConfig;
|
|
2978
|
-
type index_SendPushRequestRequest = SendPushRequestRequest;
|
|
2979
|
-
declare const index_SendPushRequestRequestSchema: typeof SendPushRequestRequestSchema;
|
|
2980
|
-
type index_SendPushResponse = SendPushResponse;
|
|
2981
|
-
declare const index_SendPushResponseSchema: typeof SendPushResponseSchema;
|
|
2982
|
-
type index_StorageAdapter = StorageAdapter;
|
|
2983
|
-
type index_SubscribeRequestRequest = SubscribeRequestRequest;
|
|
2984
|
-
declare const index_SubscribeRequestRequestSchema: typeof SubscribeRequestRequestSchema;
|
|
2985
|
-
type index_SubscribeResponse = SubscribeResponse;
|
|
2986
|
-
declare const index_SubscribeResponseSchema: typeof SubscribeResponseSchema;
|
|
2987
|
-
declare const index_TOKEN_KEY: typeof TOKEN_KEY;
|
|
2988
|
-
type index_ValidationErrorDetail = ValidationErrorDetail;
|
|
2989
|
-
type index_ValidationErrorEvent = ValidationErrorEvent;
|
|
2990
|
-
type index_VapidPublicKeyResponse = VapidPublicKeyResponse;
|
|
2991
|
-
declare const index_VapidPublicKeyResponseSchema: typeof VapidPublicKeyResponseSchema;
|
|
2992
|
-
declare const index_clearAPITokens: typeof clearAPITokens;
|
|
2993
|
-
declare const index_configureAPI: typeof configureAPI;
|
|
2994
|
-
declare const index_createWebpushSendCreate: typeof createWebpushSendCreate;
|
|
2995
|
-
declare const index_createWebpushSubscribeCreate: typeof createWebpushSubscribeCreate;
|
|
2996
|
-
declare const index_dispatchValidationError: typeof dispatchValidationError;
|
|
2997
|
-
declare const index_formatZodError: typeof formatZodError;
|
|
2998
|
-
declare const index_getAPIInstance: typeof getAPIInstance;
|
|
2999
|
-
declare const index_getWebpushVapidRetrieve: typeof getWebpushVapidRetrieve;
|
|
3000
|
-
declare const index_isAPIConfigured: typeof isAPIConfigured;
|
|
3001
|
-
declare const index_onValidationError: typeof onValidationError;
|
|
3002
|
-
declare const index_reconfigureAPI: typeof reconfigureAPI;
|
|
3003
|
-
declare const index_resetAPI: typeof resetAPI;
|
|
3004
|
-
declare const index_shouldRetry: typeof shouldRetry;
|
|
3005
|
-
declare const index_withRetry: typeof withRetry;
|
|
3006
|
-
declare namespace index {
|
|
3007
|
-
export { index_API as API, index_APIClient as APIClient, index_APIError as APIError, index_APILogger as APILogger, type index_APIOptions as APIOptions, index_CookieStorageAdapter as CookieStorageAdapter, index_DEFAULT_RETRY_CONFIG as DEFAULT_RETRY_CONFIG, type index_ErrorLog as ErrorLog, type index_FailedAttemptInfo as FailedAttemptInfo, index_FetchAdapter as FetchAdapter, index$1 as Fetchers, type index_HttpClientAdapter as HttpClientAdapter, type index_HttpRequest as HttpRequest, type index_HttpResponse as HttpResponse, index_LocalStorageAdapter as LocalStorageAdapter, type index_LoggerConfig as LoggerConfig, index_MemoryStorageAdapter as MemoryStorageAdapter, index_NetworkError as NetworkError, index_REFRESH_TOKEN_KEY as REFRESH_TOKEN_KEY, type index_RequestLog as RequestLog, type index_ResponseLog as ResponseLog, type index_RetryConfig as RetryConfig, index$2 as Schemas, type index_SendPushRequestRequest as SendPushRequestRequest, index_SendPushRequestRequestSchema as SendPushRequestRequestSchema, type index_SendPushResponse as SendPushResponse, index_SendPushResponseSchema as SendPushResponseSchema, type index_StorageAdapter as StorageAdapter, type index_SubscribeRequestRequest as SubscribeRequestRequest, index_SubscribeRequestRequestSchema as SubscribeRequestRequestSchema, type index_SubscribeResponse as SubscribeResponse, index_SubscribeResponseSchema as SubscribeResponseSchema, index_TOKEN_KEY as TOKEN_KEY, type index_ValidationErrorDetail as ValidationErrorDetail, type index_ValidationErrorEvent as ValidationErrorEvent, type index_VapidPublicKeyResponse as VapidPublicKeyResponse, index_VapidPublicKeyResponseSchema as VapidPublicKeyResponseSchema, models as WebPushTypes, index_clearAPITokens as clearAPITokens, index_configureAPI as configureAPI, index_createWebpushSendCreate as createWebpushSendCreate, index_createWebpushSubscribeCreate as createWebpushSubscribeCreate, API as default, index_dispatchValidationError as dispatchValidationError, index_formatZodError as formatZodError, index_getAPIInstance as getAPIInstance, index_getWebpushVapidRetrieve as getWebpushVapidRetrieve, index_isAPIConfigured as isAPIConfigured, index_onValidationError as onValidationError, index_reconfigureAPI as reconfigureAPI, index_resetAPI as resetAPI, index_shouldRetry as shouldRetry, index_withRetry as withRetry };
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
2028
|
/**
|
|
3011
2029
|
* @djangocfg/api - Shared API Package
|
|
3012
2030
|
*
|
|
@@ -3017,14 +2035,14 @@ declare namespace index {
|
|
|
3017
2035
|
* - etc.
|
|
3018
2036
|
*/
|
|
3019
2037
|
|
|
3020
|
-
declare const api: API
|
|
2038
|
+
declare const api: API;
|
|
3021
2039
|
/**
|
|
3022
2040
|
* Base Client Class
|
|
3023
2041
|
*
|
|
3024
2042
|
* Service classes can extend this to access api instance
|
|
3025
2043
|
*/
|
|
3026
2044
|
declare class BaseClient {
|
|
3027
|
-
protected static api: API
|
|
2045
|
+
protected static api: API;
|
|
3028
2046
|
}
|
|
3029
2047
|
|
|
3030
|
-
export { API
|
|
2048
|
+
export { API, APIClient, APIError, APILogger, type APIOptions, type AccountDeleteResponse, AccountDeleteResponseSchema, models as AccountsTypes, models$3 as AuthTypes, BaseClient, type CentrifugoToken, CentrifugoTokenSchema, type CfgAccountsProfileAvatarCreateRequest, CfgAccountsProfileAvatarCreateRequestSchema, index as CfgAccountsTypes, CookieStorageAdapter, DEFAULT_RETRY_CONFIG, enums as Enums, type ErrorLog, type FailedAttemptInfo, FetchAdapter, index$1 as Fetchers, type HttpClientAdapter, type HttpRequest, type HttpResponse, LocalStorageAdapter, type LoggerConfig, MemoryStorageAdapter, NetworkError, type OAuthAuthorizeRequestRequest, OAuthAuthorizeRequestRequestSchema, type OAuthAuthorizeResponse, OAuthAuthorizeResponseSchema, type OAuthCallbackRequestRequest, OAuthCallbackRequestRequestSchema, type OAuthConnection, OAuthConnectionSchema, type OAuthDisconnectRequestRequest, OAuthDisconnectRequestRequestSchema, type OAuthError, OAuthErrorSchema, type OAuthProvidersResponse, OAuthProvidersResponseSchema, type OAuthTokenResponse, OAuthTokenResponseSchema, type OTPErrorResponse, OTPErrorResponseSchema, type OTPRequestRequest, OTPRequestRequestSchema, type OTPRequestResponse, OTPRequestResponseSchema, type OTPVerifyRequest, OTPVerifyRequestSchema, type OTPVerifyResponse, OTPVerifyResponseSchema, models$2 as OauthTypes, type PatchedUserProfileUpdateRequest, PatchedUserProfileUpdateRequestSchema, REFRESH_TOKEN_KEY, type RequestLog, type ResponseLog, type RetryConfig, index$2 as Schemas, type StorageAdapter, TOKEN_KEY, type TokenRefresh, type TokenRefreshRequest, TokenRefreshRequestSchema, TokenRefreshSchema, type User, models$1 as UserProfileTypes, type UserProfileUpdateRequest, UserProfileUpdateRequestSchema, UserSchema, type ValidationErrorDetail, type ValidationErrorEvent, api, clearAPITokens, configureAPI, createAccountsOauthDisconnectCreate, createAccountsOauthGithubAuthorizeCreate, createAccountsOauthGithubCallbackCreate, createAccountsOtpRequestCreate, createAccountsOtpVerifyCreate, createAccountsProfileAvatarCreate, createAccountsProfileDeleteCreate, createAccountsTokenRefreshCreate, dispatchValidationError, formatZodError, getAPIInstance, getAccountsOauthConnectionsList, getAccountsOauthProvidersRetrieve, getAccountsProfileRetrieve, getCentrifugoAuthTokenRetrieve, isAPIConfigured, onValidationError, partialUpdateAccountsProfilePartialPartialUpdate, partialUpdateAccountsProfilePartialUpdate, partialUpdateAccountsProfileUpdatePartialUpdate, reconfigureAPI, resetAPI, shouldRetry, updateAccountsProfileUpdateUpdate, withRetry };
|