@djangocfg/api 1.2.23 → 1.2.25
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/index.cjs +2770 -23332
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1908 -19148
- package/dist/index.d.ts +1908 -19148
- package/dist/index.mjs +2705 -23279
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/contexts/index.ts +0 -11
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo.ts +3 -2
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_auth.ts +48 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +5 -5
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +0 -16
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_api_keys.ts +78 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_monitoring.ts +5 -20
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_proto_files.ts +91 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_services.ts +5 -4
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_jobs.ts +10 -8
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_registries.ts +24 -22
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_schedules.ts +5 -4
- package/src/cfg/generated/_utils/fetchers/index.ts +3 -0
- package/src/cfg/generated/_utils/hooks/cfg__accounts.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__accounts__auth.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo.ts +3 -3
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_admin_api.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_auth.ts +35 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_monitoring.ts +5 -6
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_testing.ts +0 -21
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_activity.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_api_zones.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_charts.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_config.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_overview.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_statistics.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_system.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__endpoints.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_api_keys.ts +65 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_charts.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_configuration.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_monitoring.ts +5 -21
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_proto_files.ts +83 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_services.ts +3 -3
- package/src/cfg/generated/_utils/hooks/cfg__health.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__leads__lead_submission.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__newsletter.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__bulk_email.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__logs.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__newsletters.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__testing.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_jobs.ts +8 -6
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_monitoring.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_registries.ts +16 -14
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_schedules.ts +3 -2
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_workers.ts +0 -1
- package/src/cfg/generated/_utils/hooks/index.ts +3 -0
- package/src/cfg/generated/_utils/schemas/ApiKey.schema.ts +32 -0
- package/src/cfg/generated/_utils/schemas/ApiKeyStats.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoToken.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/Command.schema.ts +13 -0
- package/src/cfg/generated/_utils/schemas/ConnectionTokenResponse.schema.ts +3 -2
- package/src/cfg/generated/_utils/schemas/DashboardCharts.schema.ts +10 -10
- package/src/cfg/generated/_utils/schemas/GRPCCallRequestRequest.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/GRPCConfig.schema.ts +6 -6
- package/src/cfg/generated/_utils/schemas/{GRPCExampleSerializer.schema.ts → GRPCExample.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/GRPCExamplesList.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/{GRPCFeaturesSerializer.schema.ts → GRPCFeatures.schema.ts} +4 -4
- package/src/cfg/generated/_utils/schemas/{GRPCFrameworkConfigSerializer.schema.ts → GRPCFrameworkConfig.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/{GRPCInterceptorInfoSerializer.schema.ts → GRPCInterceptorInfo.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/GRPCOverviewStats.schema.ts +3 -1
- package/src/cfg/generated/_utils/schemas/GRPCRegisteredService.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/{GRPCServerConfigSerializer.schema.ts → GRPCServerConfig.schema.ts} +4 -4
- package/src/cfg/generated/_utils/schemas/GRPCServerInfo.schema.ts +6 -6
- package/src/cfg/generated/_utils/schemas/GRPCServerStatus.schema.ts +34 -0
- package/src/cfg/generated/_utils/schemas/{GRPCServiceInfoSerializer.schema.ts → GRPCServiceInfo.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/{GRPCStatsSerializer.schema.ts → GRPCStats.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/JobListRequest.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/{MethodInfoSerializer.schema.ts → MethodInfo.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/MethodList.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/{MethodStatsSerializer.schema.ts → MethodStats.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/{MethodSummarySerializer.schema.ts → MethodSummary.schema.ts} +5 -5
- package/src/cfg/generated/_utils/schemas/PaginatedApiKeyList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/PaginatedJobListList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/PaginatedPublishList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/PaginatedRecentRequestList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/PaginatedScheduledJobList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/PaginatedServiceSummaryList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/ProtoFileDetail.schema.ts +27 -0
- package/src/cfg/generated/_utils/schemas/ProtoFileList.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/ProtoGenerateError.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ProtoGenerateRequestRequest.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ProtoGenerateResponse.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/Publish.schema.ts +29 -0
- package/src/cfg/generated/_utils/schemas/{RecentErrorSerializer.schema.ts → RecentError.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/RecentRequest.schema.ts +5 -0
- package/src/cfg/generated/_utils/schemas/ServiceDetail.schema.ts +6 -6
- package/src/cfg/generated/_utils/schemas/ServiceMethods.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/{ServiceStatsSerializer.schema.ts → ServiceStats.schema.ts} +3 -3
- package/src/cfg/generated/_utils/schemas/ServiceSummary.schema.ts +26 -0
- package/src/cfg/generated/_utils/schemas/User.schema.ts +2 -0
- package/src/cfg/generated/_utils/schemas/index.ts +31 -21
- package/src/cfg/generated/cfg__accounts/models.ts +17 -0
- package/src/cfg/generated/cfg__accounts__user_profile/models.ts +17 -0
- package/src/cfg/generated/cfg__centrifugo/client.ts +1 -1
- package/src/cfg/generated/cfg__centrifugo/models.ts +19 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_auth/client.ts +26 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_auth/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_auth/models.ts +16 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/client.ts +6 -5
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/models.ts +37 -11
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/client.ts +0 -10
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/models.ts +0 -26
- package/src/cfg/generated/cfg__dashboard__dashboard_commands/models.ts +10 -1
- package/src/cfg/generated/cfg__grpc__grpc_api_keys/client.ts +56 -0
- package/src/cfg/generated/cfg__grpc__grpc_api_keys/index.ts +2 -0
- package/src/cfg/generated/cfg__grpc__grpc_api_keys/models.ts +79 -0
- package/src/cfg/generated/cfg__grpc__grpc_charts/models.ts +0 -96
- package/src/cfg/generated/cfg__grpc__grpc_configuration/models.ts +12 -12
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/client.ts +4 -25
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/models.ts +111 -49
- package/src/cfg/generated/cfg__grpc__grpc_proto_files/client.ts +54 -0
- package/src/cfg/generated/cfg__grpc__grpc_proto_files/index.ts +2 -0
- package/src/cfg/generated/cfg__grpc__grpc_proto_files/models.ts +35 -0
- package/src/cfg/generated/cfg__grpc__grpc_services/client.ts +6 -5
- package/src/cfg/generated/cfg__grpc__grpc_services/models.ts +57 -8
- package/src/cfg/generated/cfg__grpc__grpc_testing/models.ts +2 -2
- package/src/cfg/generated/cfg__rq__rq_jobs/client.ts +8 -8
- package/src/cfg/generated/cfg__rq__rq_jobs/models.ts +65 -0
- package/src/cfg/generated/cfg__rq__rq_registries/client.ts +37 -34
- package/src/cfg/generated/cfg__rq__rq_registries/models.ts +65 -0
- package/src/cfg/generated/cfg__rq__rq_schedules/client.ts +4 -4
- package/src/cfg/generated/cfg__rq__rq_schedules/models.ts +25 -0
- package/src/cfg/generated/client.ts +9 -0
- package/src/cfg/generated/index.ts +27 -8
- package/src/cfg/generated/{schema.ts → schema.json} +19166 -18258
- package/src/index.ts +7 -2
- package/src/types/auth.ts +40 -0
- package/src/types/index.ts +7 -0
- package/src/cfg/contexts/AccountsContext.tsx +0 -205
- package/src/cfg/generated/_utils/schemas/ConnectionTokenRequestRequest.schema.ts +0 -20
- package/src/cfg/generated/_utils/schemas/ErrorDistributionChartSerializer.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/MonitoringServiceStatsSerializer.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/RecentPublishes.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/RequestVolumeChartSerializer.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/ResponseTimeChartSerializer.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/ServerUptimeChartSerializer.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/ServiceActivityChartSerializer.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/ServiceList.schema.ts +0 -21
package/src/index.ts
CHANGED
|
@@ -29,11 +29,13 @@ export * from './cfg/generated';
|
|
|
29
29
|
|
|
30
30
|
// Export API instance (advanced usage)
|
|
31
31
|
export { api } from './cfg/BaseClient';
|
|
32
|
-
export { api as default } from './cfg/BaseClient';
|
|
33
32
|
|
|
34
33
|
// Export all contexts (React contexts for data management)
|
|
35
34
|
export * from './cfg/contexts';
|
|
36
35
|
|
|
36
|
+
// Export centralized types
|
|
37
|
+
export * from './types';
|
|
38
|
+
|
|
37
39
|
// Re-export all types and fetchers for convenience
|
|
38
40
|
// Usage: import { Schemas, Fetchers } from '@djangocfg/api'
|
|
39
41
|
export { Schemas, Fetchers } from './cfg/generated';
|
|
@@ -46,4 +48,7 @@ export type {
|
|
|
46
48
|
OTPVerifyResponse,
|
|
47
49
|
User,
|
|
48
50
|
// Add more types as needed
|
|
49
|
-
} from './cfg/generated/_utils/schemas';
|
|
51
|
+
} from './cfg/generated/_utils/schemas';
|
|
52
|
+
|
|
53
|
+
// Export API class type
|
|
54
|
+
export type { API } from './cfg/generated';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Types
|
|
3
|
+
*
|
|
4
|
+
* Centralized type exports for authentication and API schemas
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Export type definitions
|
|
8
|
+
export type {
|
|
9
|
+
User,
|
|
10
|
+
OTPRequestResponse,
|
|
11
|
+
OTPVerifyResponse,
|
|
12
|
+
TokenRefresh,
|
|
13
|
+
UserProfileUpdateRequest,
|
|
14
|
+
PatchedUserProfileUpdateRequest,
|
|
15
|
+
OTPRequestRequest,
|
|
16
|
+
OTPVerifyRequest,
|
|
17
|
+
} from '../cfg/generated/_utils/schemas';
|
|
18
|
+
|
|
19
|
+
// Export schema validators
|
|
20
|
+
export { PatchedUserProfileUpdateRequestSchema } from '../cfg/generated/_utils/schemas/PatchedUserProfileUpdateRequest.schema';
|
|
21
|
+
|
|
22
|
+
// Export API instance
|
|
23
|
+
export { api } from '../cfg/BaseClient';
|
|
24
|
+
|
|
25
|
+
// Re-export hooks
|
|
26
|
+
export {
|
|
27
|
+
usePartialUpdateAccountsProfilePartialUpdate,
|
|
28
|
+
useUpdateAccountsProfileUpdateUpdate,
|
|
29
|
+
useCreateAccountsProfileAvatarCreate,
|
|
30
|
+
} from '../cfg/generated/_utils/hooks/cfg__accounts__user_profile';
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
useCreateAccountsOtpRequestCreate,
|
|
34
|
+
useCreateAccountsOtpVerifyCreate,
|
|
35
|
+
} from '../cfg/generated/_utils/hooks/cfg__accounts';
|
|
36
|
+
|
|
37
|
+
export { useCreateAccountsTokenRefreshCreate } from '../cfg/generated/_utils/hooks/cfg__accounts__auth';
|
|
38
|
+
|
|
39
|
+
// Re-export fetchers
|
|
40
|
+
export { getAccountsProfileRetrieve } from '../cfg/generated/_utils/fetchers/cfg__accounts__user_profile';
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accounts Context
|
|
3
|
-
*
|
|
4
|
-
* Manages user authentication and profile operations using generated SWR hooks
|
|
5
|
-
*
|
|
6
|
-
* Features:
|
|
7
|
-
* - OTP-based authentication
|
|
8
|
-
* - User profile management
|
|
9
|
-
* - Avatar upload
|
|
10
|
-
* - Profile updates
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
"use client";
|
|
14
|
-
|
|
15
|
-
import { createContext, useContext, ReactNode } from 'react';
|
|
16
|
-
import { SWRConfig, useSWRConfig } from 'swr';
|
|
17
|
-
import { api } from '../BaseClient';
|
|
18
|
-
import {
|
|
19
|
-
useAccountsProfileRetrieve,
|
|
20
|
-
usePartialUpdateAccountsProfilePartialUpdate,
|
|
21
|
-
useUpdateAccountsProfileUpdateUpdate,
|
|
22
|
-
useCreateAccountsProfileAvatarCreate,
|
|
23
|
-
useCreateAccountsOtpRequestCreate,
|
|
24
|
-
useCreateAccountsOtpVerifyCreate,
|
|
25
|
-
useCreateAccountsTokenRefreshCreate,
|
|
26
|
-
} from '../generated/_utils/hooks';
|
|
27
|
-
import type { API } from '../generated';
|
|
28
|
-
import type {
|
|
29
|
-
User,
|
|
30
|
-
UserProfileUpdateRequest,
|
|
31
|
-
PatchedUserProfileUpdateRequest,
|
|
32
|
-
OTPRequestRequest,
|
|
33
|
-
OTPVerifyRequest,
|
|
34
|
-
OTPRequestResponse,
|
|
35
|
-
OTPVerifyResponse,
|
|
36
|
-
TokenRefresh,
|
|
37
|
-
} from '../generated/_utils/schemas';
|
|
38
|
-
|
|
39
|
-
// Re-export schemas for external use
|
|
40
|
-
export { PatchedUserProfileUpdateRequestSchema } from '../generated/_utils/schemas/PatchedUserProfileUpdateRequest.schema';
|
|
41
|
-
export type { PatchedUserProfileUpdateRequest };
|
|
42
|
-
|
|
43
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
44
|
-
// Context Type
|
|
45
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
46
|
-
|
|
47
|
-
export interface AccountsContextValue {
|
|
48
|
-
// Current user profile
|
|
49
|
-
profile?: User;
|
|
50
|
-
isLoadingProfile: boolean;
|
|
51
|
-
profileError: Error | null;
|
|
52
|
-
|
|
53
|
-
// Profile operations
|
|
54
|
-
updateProfile: (data: UserProfileUpdateRequest) => Promise<User>;
|
|
55
|
-
partialUpdateProfile: (data: PatchedUserProfileUpdateRequest) => Promise<User>;
|
|
56
|
-
uploadAvatar: (formData: FormData) => Promise<User>;
|
|
57
|
-
refreshProfile: () => Promise<User | undefined>;
|
|
58
|
-
|
|
59
|
-
// Authentication
|
|
60
|
-
requestOTP: (data: OTPRequestRequest) => Promise<OTPRequestResponse>;
|
|
61
|
-
verifyOTP: (data: OTPVerifyRequest) => Promise<OTPVerifyResponse>;
|
|
62
|
-
refreshToken: (refresh: string) => Promise<TokenRefresh>;
|
|
63
|
-
logout: () => void;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
67
|
-
// Context
|
|
68
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
69
|
-
|
|
70
|
-
const AccountsContext = createContext<AccountsContextValue | undefined>(undefined);
|
|
71
|
-
|
|
72
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
73
|
-
// Provider Component
|
|
74
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
75
|
-
|
|
76
|
-
interface AccountsProviderProps {
|
|
77
|
-
children: ReactNode;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function AccountsProvider({ children }: AccountsProviderProps) {
|
|
81
|
-
const { mutate } = useSWRConfig();
|
|
82
|
-
|
|
83
|
-
// SWR config - disable auto-revalidation
|
|
84
|
-
const swrConfig = {
|
|
85
|
-
revalidateOnFocus: false,
|
|
86
|
-
revalidateOnReconnect: false,
|
|
87
|
-
revalidateIfStale: false,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// Get current user profile
|
|
91
|
-
const {
|
|
92
|
-
data: profile,
|
|
93
|
-
error: profileError,
|
|
94
|
-
isLoading: isLoadingProfile,
|
|
95
|
-
mutate: mutateProfile,
|
|
96
|
-
} = useAccountsProfileRetrieve(api as unknown as API);
|
|
97
|
-
|
|
98
|
-
// Mutation hooks
|
|
99
|
-
const updateMutation = useUpdateAccountsProfileUpdateUpdate();
|
|
100
|
-
const partialUpdateMutation = usePartialUpdateAccountsProfilePartialUpdate();
|
|
101
|
-
const avatarMutation = useCreateAccountsProfileAvatarCreate();
|
|
102
|
-
const otpRequestMutation = useCreateAccountsOtpRequestCreate();
|
|
103
|
-
const otpVerifyMutation = useCreateAccountsOtpVerifyCreate();
|
|
104
|
-
const tokenRefreshMutation = useCreateAccountsTokenRefreshCreate();
|
|
105
|
-
|
|
106
|
-
// Refresh profile
|
|
107
|
-
const refreshProfile = async (): Promise<User | undefined> => {
|
|
108
|
-
return await mutateProfile();
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// Update profile (full)
|
|
112
|
-
const updateProfile = async (data: UserProfileUpdateRequest): Promise<User> => {
|
|
113
|
-
const result = await updateMutation(data, api as unknown as API);
|
|
114
|
-
await refreshProfile();
|
|
115
|
-
return result as User;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// Partial update profile
|
|
119
|
-
const partialUpdateProfile = async (data: PatchedUserProfileUpdateRequest): Promise<User> => {
|
|
120
|
-
const result = await partialUpdateMutation(data, api as unknown as API);
|
|
121
|
-
await refreshProfile();
|
|
122
|
-
return result as User;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// Upload avatar
|
|
126
|
-
const uploadAvatar = async (formData: FormData): Promise<User> => {
|
|
127
|
-
const result = await avatarMutation(formData, api as unknown as API);
|
|
128
|
-
await refreshProfile();
|
|
129
|
-
return result as User;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// Request OTP
|
|
133
|
-
const requestOTP = async (data: OTPRequestRequest): Promise<OTPRequestResponse> => {
|
|
134
|
-
const result = await otpRequestMutation(data, api as unknown as API);
|
|
135
|
-
return result as OTPRequestResponse;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// Verify OTP
|
|
139
|
-
const verifyOTP = async (data: OTPVerifyRequest): Promise<OTPVerifyResponse> => {
|
|
140
|
-
const result = await otpVerifyMutation(data, api as unknown as API);
|
|
141
|
-
|
|
142
|
-
// Automatically save tokens after successful verification
|
|
143
|
-
if (result.access && result.refresh) {
|
|
144
|
-
api.setToken(result.access, result.refresh);
|
|
145
|
-
// Refresh profile to load user data with new token
|
|
146
|
-
await refreshProfile();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return result as OTPVerifyResponse;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// Refresh token
|
|
153
|
-
const refreshToken = async (refresh: string): Promise<TokenRefresh> => {
|
|
154
|
-
const result = await tokenRefreshMutation({ refresh }, api as unknown as API);
|
|
155
|
-
|
|
156
|
-
// Automatically save new access token
|
|
157
|
-
if (result.access) {
|
|
158
|
-
api.setToken(result.access, refresh);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return result as TokenRefresh;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// Logout - clear tokens and invalidate profile cache
|
|
165
|
-
const logout = () => {
|
|
166
|
-
api.clearTokens();
|
|
167
|
-
// Invalidate profile cache to trigger re-fetch (which will fail and clear profile state)
|
|
168
|
-
mutateProfile(undefined, false);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const value: AccountsContextValue = {
|
|
172
|
-
profile,
|
|
173
|
-
isLoadingProfile,
|
|
174
|
-
profileError,
|
|
175
|
-
updateProfile,
|
|
176
|
-
partialUpdateProfile,
|
|
177
|
-
uploadAvatar,
|
|
178
|
-
refreshProfile,
|
|
179
|
-
requestOTP,
|
|
180
|
-
verifyOTP,
|
|
181
|
-
refreshToken,
|
|
182
|
-
logout,
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<SWRConfig value={swrConfig}>
|
|
187
|
-
<AccountsContext.Provider value={value}>
|
|
188
|
-
{children}
|
|
189
|
-
</AccountsContext.Provider>
|
|
190
|
-
</SWRConfig>
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
195
|
-
// Hook
|
|
196
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
197
|
-
|
|
198
|
-
export function useAccountsContext(): AccountsContextValue {
|
|
199
|
-
const context = useContext(AccountsContext);
|
|
200
|
-
if (!context) {
|
|
201
|
-
throw new Error('useAccountsContext must be used within AccountsProvider');
|
|
202
|
-
}
|
|
203
|
-
return context;
|
|
204
|
-
}
|
|
205
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ConnectionTokenRequestRequest
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Request model for connection token generation.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Request model for connection token generation.
|
|
11
|
-
*/
|
|
12
|
-
export const ConnectionTokenRequestRequestSchema = z.object({
|
|
13
|
-
user_id: z.string(),
|
|
14
|
-
channels: z.array(z.string()).optional(),
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Infer TypeScript type from Zod schema
|
|
19
|
-
*/
|
|
20
|
-
export type ConnectionTokenRequestRequest = z.infer<typeof ConnectionTokenRequestRequestSchema>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ErrorDistributionChartSerializer
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Error distribution chart data.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { ErrorDistributionDataPointSchema } from './ErrorDistributionDataPoint.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Error distribution chart data.
|
|
12
|
-
*/
|
|
13
|
-
export const ErrorDistributionChartSerializerSchema = z.object({
|
|
14
|
-
title: z.string().optional(),
|
|
15
|
-
error_types: z.array(ErrorDistributionDataPointSchema).optional(),
|
|
16
|
-
period_hours: z.int(),
|
|
17
|
-
total_errors: z.int(),
|
|
18
|
-
most_common_error: z.string().nullable().optional(),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type ErrorDistributionChartSerializer = z.infer<typeof ErrorDistributionChartSerializerSchema>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for MonitoringServiceStatsSerializer
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Statistics for a single gRPC service (monitoring endpoint).
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Statistics for a single gRPC service (monitoring endpoint).
|
|
11
|
-
*/
|
|
12
|
-
export const MonitoringServiceStatsSerializerSchema = z.object({
|
|
13
|
-
service_name: z.string(),
|
|
14
|
-
total: z.int(),
|
|
15
|
-
successful: z.int(),
|
|
16
|
-
errors: z.int(),
|
|
17
|
-
avg_duration_ms: z.number(),
|
|
18
|
-
last_activity_at: z.string().nullable(),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type MonitoringServiceStatsSerializer = z.infer<typeof MonitoringServiceStatsSerializerSchema>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for RecentPublishes
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Recent publishes list.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Recent publishes list.
|
|
11
|
-
*/
|
|
12
|
-
export const RecentPublishesSchema = z.object({
|
|
13
|
-
publishes: z.array(z.record(z.string(), z.any())),
|
|
14
|
-
count: z.int(),
|
|
15
|
-
total_available: z.int(),
|
|
16
|
-
offset: z.int().optional(),
|
|
17
|
-
has_more: z.boolean().optional(),
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Infer TypeScript type from Zod schema
|
|
22
|
-
*/
|
|
23
|
-
export type RecentPublishes = z.infer<typeof RecentPublishesSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for RequestVolumeChartSerializer
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Request volume over time chart data.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { RequestVolumeDataPointSchema } from './RequestVolumeDataPoint.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Request volume over time chart data.
|
|
12
|
-
*/
|
|
13
|
-
export const RequestVolumeChartSerializerSchema = z.object({
|
|
14
|
-
title: z.string().optional(),
|
|
15
|
-
data_points: z.array(RequestVolumeDataPointSchema).optional(),
|
|
16
|
-
period_hours: z.int(),
|
|
17
|
-
granularity: z.string(),
|
|
18
|
-
total_requests: z.int(),
|
|
19
|
-
avg_success_rate: z.number(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type RequestVolumeChartSerializer = z.infer<typeof RequestVolumeChartSerializerSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ResponseTimeChartSerializer
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Response time over time chart data.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { ResponseTimeDataPointSchema } from './ResponseTimeDataPoint.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Response time over time chart data.
|
|
12
|
-
*/
|
|
13
|
-
export const ResponseTimeChartSerializerSchema = z.object({
|
|
14
|
-
title: z.string().optional(),
|
|
15
|
-
data_points: z.array(ResponseTimeDataPointSchema).optional(),
|
|
16
|
-
period_hours: z.int(),
|
|
17
|
-
granularity: z.string(),
|
|
18
|
-
overall_avg_ms: z.number(),
|
|
19
|
-
overall_p95_ms: z.number(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type ResponseTimeChartSerializer = z.infer<typeof ResponseTimeChartSerializerSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ServerUptimeChartSerializer
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Server uptime over time chart data.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { ServerUptimeDataPointSchema } from './ServerUptimeDataPoint.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Server uptime over time chart data.
|
|
12
|
-
*/
|
|
13
|
-
export const ServerUptimeChartSerializerSchema = z.object({
|
|
14
|
-
title: z.string().optional(),
|
|
15
|
-
data_points: z.array(ServerUptimeDataPointSchema).optional(),
|
|
16
|
-
period_hours: z.int(),
|
|
17
|
-
granularity: z.string(),
|
|
18
|
-
total_servers: z.int(),
|
|
19
|
-
currently_running: z.int(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type ServerUptimeChartSerializer = z.infer<typeof ServerUptimeChartSerializerSchema>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ServiceActivityChartSerializer
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Service activity comparison chart data.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { ServiceActivityDataPointSchema } from './ServiceActivityDataPoint.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Service activity comparison chart data.
|
|
12
|
-
*/
|
|
13
|
-
export const ServiceActivityChartSerializerSchema = z.object({
|
|
14
|
-
title: z.string().optional(),
|
|
15
|
-
services: z.array(ServiceActivityDataPointSchema).optional(),
|
|
16
|
-
period_hours: z.int(),
|
|
17
|
-
total_services: z.int(),
|
|
18
|
-
most_active_service: z.string().nullable().optional(),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type ServiceActivityChartSerializer = z.infer<typeof ServiceActivityChartSerializerSchema>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ServiceList
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * List of gRPC services with statistics.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { MonitoringServiceStatsSerializerSchema } from './MonitoringServiceStatsSerializer.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* List of gRPC services with statistics.
|
|
12
|
-
*/
|
|
13
|
-
export const ServiceListSchema = z.object({
|
|
14
|
-
services: z.array(MonitoringServiceStatsSerializerSchema),
|
|
15
|
-
total_services: z.int(),
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Infer TypeScript type from Zod schema
|
|
20
|
-
*/
|
|
21
|
-
export type ServiceList = z.infer<typeof ServiceListSchema>
|