@djangocfg/api 2.1.55 → 2.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.cjs +28 -15
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +6 -6
- package/dist/auth.d.ts +6 -6
- package/dist/auth.mjs +28 -15
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +56 -17
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +17 -17
- package/dist/clients.d.ts +17 -17
- package/dist/clients.mjs +56 -17
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +763 -12
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +11 -11
- package/dist/hooks.d.ts +11 -11
- package/dist/hooks.mjs +763 -12
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +893 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -41
- package/dist/index.d.ts +59 -41
- package/dist/index.mjs +893 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts +2 -2
- package/src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +1 -1
- package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +1 -1
- package/src/generated/cfg_accounts/api-instance.ts +61 -13
- package/src/generated/cfg_centrifugo/api-instance.ts +61 -13
- package/src/generated/cfg_totp/CLAUDE.md +90 -0
- package/src/generated/cfg_totp/_utils/fetchers/index.ts +33 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp.ts +49 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_management.ts +108 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_setup.ts +153 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_verification.ts +152 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +152 -0
- package/src/generated/cfg_totp/_utils/hooks/index.ts +33 -0
- package/src/generated/cfg_totp/_utils/hooks/totp.ts +42 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__2fa_management.ts +58 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__2fa_setup.ts +63 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__2fa_verification.ts +62 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +59 -0
- package/src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts +19 -0
- package/src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts +21 -0
- package/src/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts +21 -0
- package/src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +26 -0
- package/src/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts +19 -0
- package/src/generated/cfg_totp/_utils/schemas/PaginatedDeviceListList.schema.ts +24 -0
- package/src/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts +19 -0
- package/src/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts +23 -0
- package/src/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts +20 -0
- package/src/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts +24 -0
- package/src/generated/cfg_totp/_utils/schemas/index.ts +32 -0
- package/src/generated/cfg_totp/api-instance.ts +180 -0
- package/src/generated/cfg_totp/client.ts +313 -0
- package/src/generated/cfg_totp/enums.ts +12 -0
- package/src/generated/cfg_totp/errors.ts +117 -0
- package/src/generated/cfg_totp/http.ts +104 -0
- package/src/generated/cfg_totp/index.ts +302 -0
- package/src/generated/cfg_totp/logger.ts +260 -0
- package/src/generated/cfg_totp/retry.ts +176 -0
- package/src/generated/cfg_totp/schema.json +859 -0
- package/src/generated/cfg_totp/storage.ts +162 -0
- package/src/generated/cfg_totp/totp/client.ts +23 -0
- package/src/generated/cfg_totp/totp/index.ts +3 -0
- package/src/generated/cfg_totp/totp/models.ts +1 -0
- package/src/generated/cfg_totp/totp__2fa_management/client.ts +41 -0
- package/src/generated/cfg_totp/totp__2fa_management/index.ts +3 -0
- package/src/generated/cfg_totp/totp__2fa_management/models.ts +60 -0
- package/src/generated/cfg_totp/totp__2fa_setup/client.ts +32 -0
- package/src/generated/cfg_totp/totp__2fa_setup/index.ts +3 -0
- package/src/generated/cfg_totp/totp__2fa_setup/models.ts +54 -0
- package/src/generated/cfg_totp/totp__2fa_verification/client.ts +32 -0
- package/src/generated/cfg_totp/totp__2fa_verification/index.ts +3 -0
- package/src/generated/cfg_totp/totp__2fa_verification/models.ts +44 -0
- package/src/generated/cfg_totp/totp__backup_codes/client.ts +31 -0
- package/src/generated/cfg_totp/totp__backup_codes/index.ts +3 -0
- package/src/generated/cfg_totp/totp__backup_codes/models.ts +37 -0
- package/src/generated/cfg_totp/validation-events.ts +134 -0
- package/src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts +2 -2
- package/src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts +1 -1
- package/src/generated/cfg_webpush/api-instance.ts +61 -13
package/dist/index.d.cts
CHANGED
|
@@ -821,7 +821,7 @@ declare class MemoryStorageAdapter$1 implements StorageAdapter$1 {
|
|
|
821
821
|
*/
|
|
822
822
|
declare const CentrifugoTokenSchema: z.ZodObject<{
|
|
823
823
|
token: z.ZodString;
|
|
824
|
-
centrifugo_url: z.ZodURL
|
|
824
|
+
centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
825
825
|
expires_at: z.ZodISODateTime;
|
|
826
826
|
channels: z.ZodArray<z.ZodString>;
|
|
827
827
|
}, z.core.$strip>;
|
|
@@ -841,8 +841,8 @@ type CentrifugoToken = z.infer<typeof CentrifugoTokenSchema>;
|
|
|
841
841
|
* Request to start OAuth flow.
|
|
842
842
|
*/
|
|
843
843
|
declare const OAuthAuthorizeRequestRequestSchema: z.ZodObject<{
|
|
844
|
-
redirect_uri: z.ZodOptional<z.ZodURL
|
|
845
|
-
source_url: z.ZodOptional<z.ZodURL
|
|
844
|
+
redirect_uri: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
845
|
+
source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
846
846
|
}, z.core.$strip>;
|
|
847
847
|
/**
|
|
848
848
|
* Infer TypeScript type from Zod schema
|
|
@@ -860,7 +860,7 @@ type OAuthAuthorizeRequestRequest = z.infer<typeof OAuthAuthorizeRequestRequestS
|
|
|
860
860
|
* Response with OAuth authorization URL.
|
|
861
861
|
*/
|
|
862
862
|
declare const OAuthAuthorizeResponseSchema: z.ZodObject<{
|
|
863
|
-
authorization_url: z.ZodURL
|
|
863
|
+
authorization_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
864
864
|
state: z.ZodString;
|
|
865
865
|
}, z.core.$strip>;
|
|
866
866
|
/**
|
|
@@ -881,7 +881,7 @@ type OAuthAuthorizeResponse = z.infer<typeof OAuthAuthorizeResponseSchema>;
|
|
|
881
881
|
declare const OAuthCallbackRequestRequestSchema: z.ZodObject<{
|
|
882
882
|
code: z.ZodString;
|
|
883
883
|
state: z.ZodString;
|
|
884
|
-
redirect_uri: z.ZodOptional<z.ZodURL
|
|
884
|
+
redirect_uri: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
885
885
|
}, z.core.$strip>;
|
|
886
886
|
/**
|
|
887
887
|
* Infer TypeScript type from Zod schema
|
|
@@ -904,7 +904,7 @@ declare const OAuthConnectionSchema: z.ZodObject<{
|
|
|
904
904
|
provider_display: z.ZodString;
|
|
905
905
|
provider_username: z.ZodString;
|
|
906
906
|
provider_email: z.ZodEmail;
|
|
907
|
-
provider_avatar_url: z.ZodURL
|
|
907
|
+
provider_avatar_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
908
908
|
connected_at: z.ZodISODateTime;
|
|
909
909
|
last_login_at: z.ZodISODateTime;
|
|
910
910
|
}, z.core.$strip>;
|
|
@@ -961,7 +961,7 @@ type OAuthError = z.infer<typeof OAuthErrorSchema>;
|
|
|
961
961
|
* Response with available OAuth providers.
|
|
962
962
|
*/
|
|
963
963
|
declare const OAuthProvidersResponseSchema: z.ZodObject<{
|
|
964
|
-
providers: z.ZodArray<z.ZodRecord<z.ZodString, z.
|
|
964
|
+
providers: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
965
965
|
}, z.core.$strip>;
|
|
966
966
|
/**
|
|
967
967
|
* Infer TypeScript type from Zod schema
|
|
@@ -981,7 +981,7 @@ type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>;
|
|
|
981
981
|
declare const OAuthTokenResponseSchema: z.ZodObject<{
|
|
982
982
|
access: z.ZodString;
|
|
983
983
|
refresh: z.ZodString;
|
|
984
|
-
user: z.ZodRecord<z.ZodString, z.
|
|
984
|
+
user: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
985
985
|
is_new_user: z.ZodBoolean;
|
|
986
986
|
is_new_connection: z.ZodBoolean;
|
|
987
987
|
}, z.core.$strip>;
|
|
@@ -1021,7 +1021,7 @@ type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>;
|
|
|
1021
1021
|
declare const OTPRequestRequestSchema: z.ZodObject<{
|
|
1022
1022
|
identifier: z.ZodString;
|
|
1023
1023
|
channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
|
|
1024
|
-
source_url: z.ZodOptional<z.ZodURL
|
|
1024
|
+
source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1025
1025
|
}, z.core.$strip>;
|
|
1026
1026
|
/**
|
|
1027
1027
|
* Infer TypeScript type from Zod schema
|
|
@@ -1060,7 +1060,7 @@ declare const OTPVerifyRequestSchema: z.ZodObject<{
|
|
|
1060
1060
|
identifier: z.ZodString;
|
|
1061
1061
|
otp: z.ZodString;
|
|
1062
1062
|
channel: z.ZodOptional<z.ZodEnum<typeof OTPVerifyRequestChannel>>;
|
|
1063
|
-
source_url: z.ZodOptional<z.ZodURL
|
|
1063
|
+
source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1064
1064
|
}, z.core.$strip>;
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Infer TypeScript type from Zod schema
|
|
@@ -1091,7 +1091,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
1091
1091
|
company: z.ZodOptional<z.ZodString>;
|
|
1092
1092
|
phone: z.ZodOptional<z.ZodString>;
|
|
1093
1093
|
position: z.ZodOptional<z.ZodString>;
|
|
1094
|
-
avatar: z.ZodNullable<z.ZodURL
|
|
1094
|
+
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1095
1095
|
is_staff: z.ZodBoolean;
|
|
1096
1096
|
is_superuser: z.ZodBoolean;
|
|
1097
1097
|
date_joined: z.ZodISODateTime;
|
|
@@ -1099,7 +1099,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
1099
1099
|
unanswered_messages_count: z.ZodInt;
|
|
1100
1100
|
centrifugo: z.ZodNullable<z.ZodObject<{
|
|
1101
1101
|
token: z.ZodString;
|
|
1102
|
-
centrifugo_url: z.ZodURL
|
|
1102
|
+
centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
1103
1103
|
expires_at: z.ZodISODateTime;
|
|
1104
1104
|
channels: z.ZodArray<z.ZodString>;
|
|
1105
1105
|
}, z.core.$strip>>;
|
|
@@ -1182,7 +1182,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
1182
1182
|
company: z.ZodOptional<z.ZodString>;
|
|
1183
1183
|
phone: z.ZodOptional<z.ZodString>;
|
|
1184
1184
|
position: z.ZodOptional<z.ZodString>;
|
|
1185
|
-
avatar: z.ZodNullable<z.ZodURL
|
|
1185
|
+
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1186
1186
|
is_staff: z.ZodBoolean;
|
|
1187
1187
|
is_superuser: z.ZodBoolean;
|
|
1188
1188
|
date_joined: z.ZodISODateTime;
|
|
@@ -1190,7 +1190,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
1190
1190
|
unanswered_messages_count: z.ZodInt;
|
|
1191
1191
|
centrifugo: z.ZodNullable<z.ZodObject<{
|
|
1192
1192
|
token: z.ZodString;
|
|
1193
|
-
centrifugo_url: z.ZodURL
|
|
1193
|
+
centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
1194
1194
|
expires_at: z.ZodISODateTime;
|
|
1195
1195
|
channels: z.ZodArray<z.ZodString>;
|
|
1196
1196
|
}, z.core.$strip>>;
|
|
@@ -1503,30 +1503,38 @@ declare namespace index$4 {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
|
|
1505
1505
|
/**
|
|
1506
|
-
* Global API Instance - Singleton configuration
|
|
1506
|
+
* Global API Instance - Singleton configuration with auto-configuration support
|
|
1507
1507
|
*
|
|
1508
|
-
* This module provides a global API instance that
|
|
1509
|
-
*
|
|
1508
|
+
* This module provides a global API instance that auto-configures from
|
|
1509
|
+
* environment variables or can be configured manually.
|
|
1510
1510
|
*
|
|
1511
|
-
*
|
|
1511
|
+
* AUTO-CONFIGURATION (recommended):
|
|
1512
|
+
* Set one of these environment variables and the API will auto-configure:
|
|
1513
|
+
* - NEXT_PUBLIC_API_URL (Next.js)
|
|
1514
|
+
* - VITE_API_URL (Vite)
|
|
1515
|
+
* - REACT_APP_API_URL (Create React App)
|
|
1516
|
+
* - API_URL (generic)
|
|
1517
|
+
*
|
|
1518
|
+
* Then just use fetchers and hooks directly:
|
|
1519
|
+
* ```typescript
|
|
1520
|
+
* import { getUsers } from './_utils/fetchers'
|
|
1521
|
+
* const users = await getUsers({ page: 1 })
|
|
1522
|
+
* ```
|
|
1523
|
+
*
|
|
1524
|
+
* MANUAL CONFIGURATION:
|
|
1512
1525
|
* ```typescript
|
|
1513
|
-
* // Configure once (e.g., in your app entry point)
|
|
1514
1526
|
* import { configureAPI } from './api-instance'
|
|
1515
1527
|
*
|
|
1516
1528
|
* configureAPI({
|
|
1517
1529
|
* baseUrl: 'https://api.example.com',
|
|
1518
1530
|
* token: 'your-jwt-token'
|
|
1519
1531
|
* })
|
|
1520
|
-
*
|
|
1521
|
-
* // Then use fetchers and hooks anywhere without configuration
|
|
1522
|
-
* import { getUsers } from './fetchers'
|
|
1523
|
-
* const users = await getUsers({ page: 1 })
|
|
1524
1532
|
* ```
|
|
1525
1533
|
*
|
|
1526
1534
|
* For SSR or multiple instances:
|
|
1527
1535
|
* ```typescript
|
|
1528
1536
|
* import { API } from './index'
|
|
1529
|
-
* import { getUsers } from './fetchers'
|
|
1537
|
+
* import { getUsers } from './_utils/fetchers'
|
|
1530
1538
|
*
|
|
1531
1539
|
* const api = new API('https://api.example.com')
|
|
1532
1540
|
* const users = await getUsers({ page: 1 }, api)
|
|
@@ -1535,11 +1543,12 @@ declare namespace index$4 {
|
|
|
1535
1543
|
|
|
1536
1544
|
/**
|
|
1537
1545
|
* Get the global API instance
|
|
1538
|
-
*
|
|
1546
|
+
* Auto-configures from environment variables on first call if not manually configured.
|
|
1547
|
+
* @throws Error if API is not configured and no env variable is set
|
|
1539
1548
|
*/
|
|
1540
1549
|
declare function getAPIInstance$1(): API$1;
|
|
1541
1550
|
/**
|
|
1542
|
-
* Check if API is configured
|
|
1551
|
+
* Check if API is configured (or can be auto-configured)
|
|
1543
1552
|
*/
|
|
1544
1553
|
declare function isAPIConfigured$1(): boolean;
|
|
1545
1554
|
/**
|
|
@@ -2287,8 +2296,8 @@ declare class MemoryStorageAdapter implements StorageAdapter {
|
|
|
2287
2296
|
declare const SendPushRequestRequestSchema: z.ZodObject<{
|
|
2288
2297
|
title: z.ZodString;
|
|
2289
2298
|
body: z.ZodString;
|
|
2290
|
-
icon: z.ZodOptional<z.ZodNullable<z.ZodURL
|
|
2291
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodURL
|
|
2299
|
+
icon: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>>;
|
|
2300
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>>;
|
|
2292
2301
|
}, z.core.$strip>;
|
|
2293
2302
|
/**
|
|
2294
2303
|
* Infer TypeScript type from Zod schema
|
|
@@ -2325,7 +2334,7 @@ type SendPushResponse = z.infer<typeof SendPushResponseSchema>;
|
|
|
2325
2334
|
* Request serializer for subscribing to push notifications.
|
|
2326
2335
|
*/
|
|
2327
2336
|
declare const SubscribeRequestRequestSchema: z.ZodObject<{
|
|
2328
|
-
endpoint: z.ZodURL
|
|
2337
|
+
endpoint: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
2329
2338
|
keys: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
2330
2339
|
}, z.core.$strip>;
|
|
2331
2340
|
/**
|
|
@@ -2533,30 +2542,38 @@ declare namespace index$1 {
|
|
|
2533
2542
|
}
|
|
2534
2543
|
|
|
2535
2544
|
/**
|
|
2536
|
-
* Global API Instance - Singleton configuration
|
|
2545
|
+
* Global API Instance - Singleton configuration with auto-configuration support
|
|
2537
2546
|
*
|
|
2538
|
-
* This module provides a global API instance that
|
|
2539
|
-
*
|
|
2547
|
+
* This module provides a global API instance that auto-configures from
|
|
2548
|
+
* environment variables or can be configured manually.
|
|
2540
2549
|
*
|
|
2541
|
-
*
|
|
2550
|
+
* AUTO-CONFIGURATION (recommended):
|
|
2551
|
+
* Set one of these environment variables and the API will auto-configure:
|
|
2552
|
+
* - NEXT_PUBLIC_API_URL (Next.js)
|
|
2553
|
+
* - VITE_API_URL (Vite)
|
|
2554
|
+
* - REACT_APP_API_URL (Create React App)
|
|
2555
|
+
* - API_URL (generic)
|
|
2556
|
+
*
|
|
2557
|
+
* Then just use fetchers and hooks directly:
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* import { getUsers } from './_utils/fetchers'
|
|
2560
|
+
* const users = await getUsers({ page: 1 })
|
|
2561
|
+
* ```
|
|
2562
|
+
*
|
|
2563
|
+
* MANUAL CONFIGURATION:
|
|
2542
2564
|
* ```typescript
|
|
2543
|
-
* // Configure once (e.g., in your app entry point)
|
|
2544
2565
|
* import { configureAPI } from './api-instance'
|
|
2545
2566
|
*
|
|
2546
2567
|
* configureAPI({
|
|
2547
2568
|
* baseUrl: 'https://api.example.com',
|
|
2548
2569
|
* token: 'your-jwt-token'
|
|
2549
2570
|
* })
|
|
2550
|
-
*
|
|
2551
|
-
* // Then use fetchers and hooks anywhere without configuration
|
|
2552
|
-
* import { getUsers } from './fetchers'
|
|
2553
|
-
* const users = await getUsers({ page: 1 })
|
|
2554
2571
|
* ```
|
|
2555
2572
|
*
|
|
2556
2573
|
* For SSR or multiple instances:
|
|
2557
2574
|
* ```typescript
|
|
2558
2575
|
* import { API } from './index'
|
|
2559
|
-
* import { getUsers } from './fetchers'
|
|
2576
|
+
* import { getUsers } from './_utils/fetchers'
|
|
2560
2577
|
*
|
|
2561
2578
|
* const api = new API('https://api.example.com')
|
|
2562
2579
|
* const users = await getUsers({ page: 1 }, api)
|
|
@@ -2565,11 +2582,12 @@ declare namespace index$1 {
|
|
|
2565
2582
|
|
|
2566
2583
|
/**
|
|
2567
2584
|
* Get the global API instance
|
|
2568
|
-
*
|
|
2585
|
+
* Auto-configures from environment variables on first call if not manually configured.
|
|
2586
|
+
* @throws Error if API is not configured and no env variable is set
|
|
2569
2587
|
*/
|
|
2570
2588
|
declare function getAPIInstance(): API;
|
|
2571
2589
|
/**
|
|
2572
|
-
* Check if API is configured
|
|
2590
|
+
* Check if API is configured (or can be auto-configured)
|
|
2573
2591
|
*/
|
|
2574
2592
|
declare function isAPIConfigured(): boolean;
|
|
2575
2593
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -821,7 +821,7 @@ declare class MemoryStorageAdapter$1 implements StorageAdapter$1 {
|
|
|
821
821
|
*/
|
|
822
822
|
declare const CentrifugoTokenSchema: z.ZodObject<{
|
|
823
823
|
token: z.ZodString;
|
|
824
|
-
centrifugo_url: z.ZodURL
|
|
824
|
+
centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
825
825
|
expires_at: z.ZodISODateTime;
|
|
826
826
|
channels: z.ZodArray<z.ZodString>;
|
|
827
827
|
}, z.core.$strip>;
|
|
@@ -841,8 +841,8 @@ type CentrifugoToken = z.infer<typeof CentrifugoTokenSchema>;
|
|
|
841
841
|
* Request to start OAuth flow.
|
|
842
842
|
*/
|
|
843
843
|
declare const OAuthAuthorizeRequestRequestSchema: z.ZodObject<{
|
|
844
|
-
redirect_uri: z.ZodOptional<z.ZodURL
|
|
845
|
-
source_url: z.ZodOptional<z.ZodURL
|
|
844
|
+
redirect_uri: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
845
|
+
source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
846
846
|
}, z.core.$strip>;
|
|
847
847
|
/**
|
|
848
848
|
* Infer TypeScript type from Zod schema
|
|
@@ -860,7 +860,7 @@ type OAuthAuthorizeRequestRequest = z.infer<typeof OAuthAuthorizeRequestRequestS
|
|
|
860
860
|
* Response with OAuth authorization URL.
|
|
861
861
|
*/
|
|
862
862
|
declare const OAuthAuthorizeResponseSchema: z.ZodObject<{
|
|
863
|
-
authorization_url: z.ZodURL
|
|
863
|
+
authorization_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
864
864
|
state: z.ZodString;
|
|
865
865
|
}, z.core.$strip>;
|
|
866
866
|
/**
|
|
@@ -881,7 +881,7 @@ type OAuthAuthorizeResponse = z.infer<typeof OAuthAuthorizeResponseSchema>;
|
|
|
881
881
|
declare const OAuthCallbackRequestRequestSchema: z.ZodObject<{
|
|
882
882
|
code: z.ZodString;
|
|
883
883
|
state: z.ZodString;
|
|
884
|
-
redirect_uri: z.ZodOptional<z.ZodURL
|
|
884
|
+
redirect_uri: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
885
885
|
}, z.core.$strip>;
|
|
886
886
|
/**
|
|
887
887
|
* Infer TypeScript type from Zod schema
|
|
@@ -904,7 +904,7 @@ declare const OAuthConnectionSchema: z.ZodObject<{
|
|
|
904
904
|
provider_display: z.ZodString;
|
|
905
905
|
provider_username: z.ZodString;
|
|
906
906
|
provider_email: z.ZodEmail;
|
|
907
|
-
provider_avatar_url: z.ZodURL
|
|
907
|
+
provider_avatar_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
908
908
|
connected_at: z.ZodISODateTime;
|
|
909
909
|
last_login_at: z.ZodISODateTime;
|
|
910
910
|
}, z.core.$strip>;
|
|
@@ -961,7 +961,7 @@ type OAuthError = z.infer<typeof OAuthErrorSchema>;
|
|
|
961
961
|
* Response with available OAuth providers.
|
|
962
962
|
*/
|
|
963
963
|
declare const OAuthProvidersResponseSchema: z.ZodObject<{
|
|
964
|
-
providers: z.ZodArray<z.ZodRecord<z.ZodString, z.
|
|
964
|
+
providers: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
965
965
|
}, z.core.$strip>;
|
|
966
966
|
/**
|
|
967
967
|
* Infer TypeScript type from Zod schema
|
|
@@ -981,7 +981,7 @@ type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>;
|
|
|
981
981
|
declare const OAuthTokenResponseSchema: z.ZodObject<{
|
|
982
982
|
access: z.ZodString;
|
|
983
983
|
refresh: z.ZodString;
|
|
984
|
-
user: z.ZodRecord<z.ZodString, z.
|
|
984
|
+
user: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
985
985
|
is_new_user: z.ZodBoolean;
|
|
986
986
|
is_new_connection: z.ZodBoolean;
|
|
987
987
|
}, z.core.$strip>;
|
|
@@ -1021,7 +1021,7 @@ type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>;
|
|
|
1021
1021
|
declare const OTPRequestRequestSchema: z.ZodObject<{
|
|
1022
1022
|
identifier: z.ZodString;
|
|
1023
1023
|
channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
|
|
1024
|
-
source_url: z.ZodOptional<z.ZodURL
|
|
1024
|
+
source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1025
1025
|
}, z.core.$strip>;
|
|
1026
1026
|
/**
|
|
1027
1027
|
* Infer TypeScript type from Zod schema
|
|
@@ -1060,7 +1060,7 @@ declare const OTPVerifyRequestSchema: z.ZodObject<{
|
|
|
1060
1060
|
identifier: z.ZodString;
|
|
1061
1061
|
otp: z.ZodString;
|
|
1062
1062
|
channel: z.ZodOptional<z.ZodEnum<typeof OTPVerifyRequestChannel>>;
|
|
1063
|
-
source_url: z.ZodOptional<z.ZodURL
|
|
1063
|
+
source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1064
1064
|
}, z.core.$strip>;
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Infer TypeScript type from Zod schema
|
|
@@ -1091,7 +1091,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
1091
1091
|
company: z.ZodOptional<z.ZodString>;
|
|
1092
1092
|
phone: z.ZodOptional<z.ZodString>;
|
|
1093
1093
|
position: z.ZodOptional<z.ZodString>;
|
|
1094
|
-
avatar: z.ZodNullable<z.ZodURL
|
|
1094
|
+
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1095
1095
|
is_staff: z.ZodBoolean;
|
|
1096
1096
|
is_superuser: z.ZodBoolean;
|
|
1097
1097
|
date_joined: z.ZodISODateTime;
|
|
@@ -1099,7 +1099,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
1099
1099
|
unanswered_messages_count: z.ZodInt;
|
|
1100
1100
|
centrifugo: z.ZodNullable<z.ZodObject<{
|
|
1101
1101
|
token: z.ZodString;
|
|
1102
|
-
centrifugo_url: z.ZodURL
|
|
1102
|
+
centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
1103
1103
|
expires_at: z.ZodISODateTime;
|
|
1104
1104
|
channels: z.ZodArray<z.ZodString>;
|
|
1105
1105
|
}, z.core.$strip>>;
|
|
@@ -1182,7 +1182,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
1182
1182
|
company: z.ZodOptional<z.ZodString>;
|
|
1183
1183
|
phone: z.ZodOptional<z.ZodString>;
|
|
1184
1184
|
position: z.ZodOptional<z.ZodString>;
|
|
1185
|
-
avatar: z.ZodNullable<z.ZodURL
|
|
1185
|
+
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
1186
1186
|
is_staff: z.ZodBoolean;
|
|
1187
1187
|
is_superuser: z.ZodBoolean;
|
|
1188
1188
|
date_joined: z.ZodISODateTime;
|
|
@@ -1190,7 +1190,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
1190
1190
|
unanswered_messages_count: z.ZodInt;
|
|
1191
1191
|
centrifugo: z.ZodNullable<z.ZodObject<{
|
|
1192
1192
|
token: z.ZodString;
|
|
1193
|
-
centrifugo_url: z.ZodURL
|
|
1193
|
+
centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
1194
1194
|
expires_at: z.ZodISODateTime;
|
|
1195
1195
|
channels: z.ZodArray<z.ZodString>;
|
|
1196
1196
|
}, z.core.$strip>>;
|
|
@@ -1503,30 +1503,38 @@ declare namespace index$4 {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
|
|
1505
1505
|
/**
|
|
1506
|
-
* Global API Instance - Singleton configuration
|
|
1506
|
+
* Global API Instance - Singleton configuration with auto-configuration support
|
|
1507
1507
|
*
|
|
1508
|
-
* This module provides a global API instance that
|
|
1509
|
-
*
|
|
1508
|
+
* This module provides a global API instance that auto-configures from
|
|
1509
|
+
* environment variables or can be configured manually.
|
|
1510
1510
|
*
|
|
1511
|
-
*
|
|
1511
|
+
* AUTO-CONFIGURATION (recommended):
|
|
1512
|
+
* Set one of these environment variables and the API will auto-configure:
|
|
1513
|
+
* - NEXT_PUBLIC_API_URL (Next.js)
|
|
1514
|
+
* - VITE_API_URL (Vite)
|
|
1515
|
+
* - REACT_APP_API_URL (Create React App)
|
|
1516
|
+
* - API_URL (generic)
|
|
1517
|
+
*
|
|
1518
|
+
* Then just use fetchers and hooks directly:
|
|
1519
|
+
* ```typescript
|
|
1520
|
+
* import { getUsers } from './_utils/fetchers'
|
|
1521
|
+
* const users = await getUsers({ page: 1 })
|
|
1522
|
+
* ```
|
|
1523
|
+
*
|
|
1524
|
+
* MANUAL CONFIGURATION:
|
|
1512
1525
|
* ```typescript
|
|
1513
|
-
* // Configure once (e.g., in your app entry point)
|
|
1514
1526
|
* import { configureAPI } from './api-instance'
|
|
1515
1527
|
*
|
|
1516
1528
|
* configureAPI({
|
|
1517
1529
|
* baseUrl: 'https://api.example.com',
|
|
1518
1530
|
* token: 'your-jwt-token'
|
|
1519
1531
|
* })
|
|
1520
|
-
*
|
|
1521
|
-
* // Then use fetchers and hooks anywhere without configuration
|
|
1522
|
-
* import { getUsers } from './fetchers'
|
|
1523
|
-
* const users = await getUsers({ page: 1 })
|
|
1524
1532
|
* ```
|
|
1525
1533
|
*
|
|
1526
1534
|
* For SSR or multiple instances:
|
|
1527
1535
|
* ```typescript
|
|
1528
1536
|
* import { API } from './index'
|
|
1529
|
-
* import { getUsers } from './fetchers'
|
|
1537
|
+
* import { getUsers } from './_utils/fetchers'
|
|
1530
1538
|
*
|
|
1531
1539
|
* const api = new API('https://api.example.com')
|
|
1532
1540
|
* const users = await getUsers({ page: 1 }, api)
|
|
@@ -1535,11 +1543,12 @@ declare namespace index$4 {
|
|
|
1535
1543
|
|
|
1536
1544
|
/**
|
|
1537
1545
|
* Get the global API instance
|
|
1538
|
-
*
|
|
1546
|
+
* Auto-configures from environment variables on first call if not manually configured.
|
|
1547
|
+
* @throws Error if API is not configured and no env variable is set
|
|
1539
1548
|
*/
|
|
1540
1549
|
declare function getAPIInstance$1(): API$1;
|
|
1541
1550
|
/**
|
|
1542
|
-
* Check if API is configured
|
|
1551
|
+
* Check if API is configured (or can be auto-configured)
|
|
1543
1552
|
*/
|
|
1544
1553
|
declare function isAPIConfigured$1(): boolean;
|
|
1545
1554
|
/**
|
|
@@ -2287,8 +2296,8 @@ declare class MemoryStorageAdapter implements StorageAdapter {
|
|
|
2287
2296
|
declare const SendPushRequestRequestSchema: z.ZodObject<{
|
|
2288
2297
|
title: z.ZodString;
|
|
2289
2298
|
body: z.ZodString;
|
|
2290
|
-
icon: z.ZodOptional<z.ZodNullable<z.ZodURL
|
|
2291
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodURL
|
|
2299
|
+
icon: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>>;
|
|
2300
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>>;
|
|
2292
2301
|
}, z.core.$strip>;
|
|
2293
2302
|
/**
|
|
2294
2303
|
* Infer TypeScript type from Zod schema
|
|
@@ -2325,7 +2334,7 @@ type SendPushResponse = z.infer<typeof SendPushResponseSchema>;
|
|
|
2325
2334
|
* Request serializer for subscribing to push notifications.
|
|
2326
2335
|
*/
|
|
2327
2336
|
declare const SubscribeRequestRequestSchema: z.ZodObject<{
|
|
2328
|
-
endpoint: z.ZodURL
|
|
2337
|
+
endpoint: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
2329
2338
|
keys: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
2330
2339
|
}, z.core.$strip>;
|
|
2331
2340
|
/**
|
|
@@ -2533,30 +2542,38 @@ declare namespace index$1 {
|
|
|
2533
2542
|
}
|
|
2534
2543
|
|
|
2535
2544
|
/**
|
|
2536
|
-
* Global API Instance - Singleton configuration
|
|
2545
|
+
* Global API Instance - Singleton configuration with auto-configuration support
|
|
2537
2546
|
*
|
|
2538
|
-
* This module provides a global API instance that
|
|
2539
|
-
*
|
|
2547
|
+
* This module provides a global API instance that auto-configures from
|
|
2548
|
+
* environment variables or can be configured manually.
|
|
2540
2549
|
*
|
|
2541
|
-
*
|
|
2550
|
+
* AUTO-CONFIGURATION (recommended):
|
|
2551
|
+
* Set one of these environment variables and the API will auto-configure:
|
|
2552
|
+
* - NEXT_PUBLIC_API_URL (Next.js)
|
|
2553
|
+
* - VITE_API_URL (Vite)
|
|
2554
|
+
* - REACT_APP_API_URL (Create React App)
|
|
2555
|
+
* - API_URL (generic)
|
|
2556
|
+
*
|
|
2557
|
+
* Then just use fetchers and hooks directly:
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* import { getUsers } from './_utils/fetchers'
|
|
2560
|
+
* const users = await getUsers({ page: 1 })
|
|
2561
|
+
* ```
|
|
2562
|
+
*
|
|
2563
|
+
* MANUAL CONFIGURATION:
|
|
2542
2564
|
* ```typescript
|
|
2543
|
-
* // Configure once (e.g., in your app entry point)
|
|
2544
2565
|
* import { configureAPI } from './api-instance'
|
|
2545
2566
|
*
|
|
2546
2567
|
* configureAPI({
|
|
2547
2568
|
* baseUrl: 'https://api.example.com',
|
|
2548
2569
|
* token: 'your-jwt-token'
|
|
2549
2570
|
* })
|
|
2550
|
-
*
|
|
2551
|
-
* // Then use fetchers and hooks anywhere without configuration
|
|
2552
|
-
* import { getUsers } from './fetchers'
|
|
2553
|
-
* const users = await getUsers({ page: 1 })
|
|
2554
2571
|
* ```
|
|
2555
2572
|
*
|
|
2556
2573
|
* For SSR or multiple instances:
|
|
2557
2574
|
* ```typescript
|
|
2558
2575
|
* import { API } from './index'
|
|
2559
|
-
* import { getUsers } from './fetchers'
|
|
2576
|
+
* import { getUsers } from './_utils/fetchers'
|
|
2560
2577
|
*
|
|
2561
2578
|
* const api = new API('https://api.example.com')
|
|
2562
2579
|
* const users = await getUsers({ page: 1 }, api)
|
|
@@ -2565,11 +2582,12 @@ declare namespace index$1 {
|
|
|
2565
2582
|
|
|
2566
2583
|
/**
|
|
2567
2584
|
* Get the global API instance
|
|
2568
|
-
*
|
|
2585
|
+
* Auto-configures from environment variables on first call if not manually configured.
|
|
2586
|
+
* @throws Error if API is not configured and no env variable is set
|
|
2569
2587
|
*/
|
|
2570
2588
|
declare function getAPIInstance(): API;
|
|
2571
2589
|
/**
|
|
2572
|
-
* Check if API is configured
|
|
2590
|
+
* Check if API is configured (or can be auto-configured)
|
|
2573
2591
|
*/
|
|
2574
2592
|
declare function isAPIConfigured(): boolean;
|
|
2575
2593
|
/**
|