@djangocfg/api 1.2.15 → 1.2.17

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.
Files changed (52) hide show
  1. package/dist/index.cjs +2478 -3259
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1332 -1955
  4. package/dist/index.d.ts +1332 -1955
  5. package/dist/index.mjs +2461 -3222
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/cfg/contexts/index.ts +0 -4
  9. package/src/cfg/generated/_utils/fetchers/cfg__tasks.ts +36 -96
  10. package/src/cfg/generated/_utils/hooks/cfg__tasks.ts +38 -122
  11. package/src/cfg/generated/_utils/schemas/PaginatedTaskLogListList.schema.ts +24 -0
  12. package/src/cfg/generated/_utils/schemas/TaskLog.schema.ts +42 -0
  13. package/src/cfg/generated/_utils/schemas/TaskLogDetail.schema.ts +50 -0
  14. package/src/cfg/generated/_utils/schemas/TaskLogList.schema.ts +35 -0
  15. package/src/cfg/generated/_utils/schemas/TaskLogStats.schema.ts +30 -0
  16. package/src/cfg/generated/_utils/schemas/index.ts +5 -8
  17. package/src/cfg/generated/cfg__tasks/client.ts +52 -49
  18. package/src/cfg/generated/cfg__tasks/models.ts +169 -106
  19. package/src/cfg/generated/enums.ts +60 -56
  20. package/src/cfg/generated/schema.ts +859 -552
  21. package/src/index.ts +0 -3
  22. package/src/cfg/contexts/TasksContext.tsx +0 -242
  23. package/src/cfg/generated/_utils/schemas/APIResponse.schema.ts +0 -22
  24. package/src/cfg/generated/_utils/schemas/APIResponseRequest.schema.ts +0 -22
  25. package/src/cfg/generated/_utils/schemas/QueueAction.schema.ts +0 -21
  26. package/src/cfg/generated/_utils/schemas/QueueActionRequest.schema.ts +0 -21
  27. package/src/cfg/generated/_utils/schemas/QueueStatus.schema.ts +0 -23
  28. package/src/cfg/generated/_utils/schemas/TaskStatistics.schema.ts +0 -22
  29. package/src/cfg/generated/_utils/schemas/WorkerAction.schema.ts +0 -22
  30. package/src/cfg/generated/_utils/schemas/WorkerActionRequest.schema.ts +0 -22
  31. package/src/cfg/services_deprecated/README.md +0 -53
  32. package/src/cfg/services_deprecated/auth/AuthService.ts +0 -165
  33. package/src/cfg/services_deprecated/auth/index.ts +0 -7
  34. package/src/cfg/services_deprecated/index.ts +0 -31
  35. package/src/cfg/services_deprecated/leads/LeadsService.ts +0 -133
  36. package/src/cfg/services_deprecated/leads/index.ts +0 -7
  37. package/src/cfg/services_deprecated/newsletter/BulkEmailService.ts +0 -35
  38. package/src/cfg/services_deprecated/newsletter/CampaignsService.ts +0 -138
  39. package/src/cfg/services_deprecated/newsletter/NewsletterService.ts +0 -79
  40. package/src/cfg/services_deprecated/newsletter/NewslettersListService.ts +0 -48
  41. package/src/cfg/services_deprecated/newsletter/index.ts +0 -10
  42. package/src/cfg/services_deprecated/payments/ApiKeysService.ts +0 -101
  43. package/src/cfg/services_deprecated/payments/DashboardService.ts +0 -112
  44. package/src/cfg/services_deprecated/payments/PaymentsService.ts +0 -159
  45. package/src/cfg/services_deprecated/payments/SubscriptionsService.ts +0 -101
  46. package/src/cfg/services_deprecated/payments/index.ts +0 -10
  47. package/src/cfg/services_deprecated/support/SupportService.ts +0 -142
  48. package/src/cfg/services_deprecated/support/index.ts +0 -7
  49. package/src/cfg/services_deprecated/tasks/TasksService.ts +0 -170
  50. package/src/cfg/services_deprecated/tasks/index.ts +0 -7
  51. package/src/cfg/services_deprecated/webhooks/WebhooksService.ts +0 -66
  52. package/src/cfg/services_deprecated/webhooks/index.ts +0 -7
package/src/index.ts CHANGED
@@ -31,9 +31,6 @@ export * from './cfg/generated';
31
31
  export { api } from './cfg/BaseClient';
32
32
  export { api as default } from './cfg/BaseClient';
33
33
 
34
- // Export all services (deprecated - use contexts instead)
35
- export * from './cfg/services_deprecated';
36
-
37
34
  // Export all contexts (React contexts for data management)
38
35
  export * from './cfg/contexts';
39
36
 
@@ -1,242 +0,0 @@
1
- "use client";
2
-
3
- import { createContext, useContext, ReactNode } from 'react';
4
- import { useSWRConfig } from 'swr';
5
- import { api } from '../BaseClient';
6
- import {
7
- useTasksApiTasksStatsRetrieve,
8
- useTasksApiQueuesStatusRetrieve,
9
- useTasksApiWorkersListRetrieve,
10
- useCreateTasksApiClearCreate,
11
- useCreateTasksApiClearQueuesCreate,
12
- useCreateTasksApiPurgeFailedCreate,
13
- useCreateTasksApiQueuesManageCreate,
14
- useCreateTasksApiWorkersManageCreate,
15
- } from '../generated/_utils/hooks/cfg__tasks';
16
- import type { API } from '../generated';
17
- import type {
18
- TaskStatistics,
19
- QueueStatus,
20
- APIResponseRequest,
21
- APIResponse,
22
- QueueActionRequest,
23
- QueueAction,
24
- WorkerActionRequest,
25
- WorkerAction,
26
- } from '../generated/_utils/schemas';
27
-
28
- // ─────────────────────────────────────────────────────────────────────────
29
- // Context Type
30
- // ─────────────────────────────────────────────────────────────────────────
31
-
32
- interface TasksContextValue {
33
- // Statistics
34
- stats: TaskStatistics | undefined;
35
- isLoadingStats: boolean;
36
- statsError: Error | null;
37
-
38
- // Queues
39
- queues: QueueStatus | undefined;
40
- isLoadingQueues: boolean;
41
- queuesError: Error | null;
42
-
43
- // Workers
44
- workers: APIResponse | undefined;
45
- isLoadingWorkers: boolean;
46
- workersError: Error | null;
47
-
48
- // Management operations
49
- clearTasks: (data: APIResponseRequest) => Promise<APIResponse>;
50
- clearQueues: (data: APIResponseRequest) => Promise<APIResponse>;
51
- purgeFailedTasks: (data: APIResponseRequest) => Promise<APIResponse>;
52
- queueAction: (data: QueueActionRequest) => Promise<QueueAction>;
53
- workerAction: (data: WorkerActionRequest) => Promise<WorkerAction>;
54
-
55
- // Refresh functions
56
- refreshStats: () => void;
57
- refreshQueues: () => void;
58
- refreshWorkers: () => void;
59
- refreshAll: () => void;
60
- }
61
-
62
- // ─────────────────────────────────────────────────────────────────────────
63
- // Context
64
- // ─────────────────────────────────────────────────────────────────────────
65
-
66
- const TasksContext = createContext<TasksContextValue | undefined>(undefined);
67
-
68
- // ─────────────────────────────────────────────────────────────────────────
69
- // Provider Props
70
- // ─────────────────────────────────────────────────────────────────────────
71
-
72
- interface TasksProviderProps {
73
- children: ReactNode;
74
- autoRefresh?: boolean;
75
- refreshInterval?: number; // in milliseconds
76
- }
77
-
78
- // ─────────────────────────────────────────────────────────────────────────
79
- // Provider Component
80
- // ─────────────────────────────────────────────────────────────────────────
81
-
82
- export function TasksProvider({
83
- children,
84
- autoRefresh = false,
85
- refreshInterval = 5000,
86
- }: TasksProviderProps) {
87
- const { mutate } = useSWRConfig();
88
-
89
- // ───────────────────────────────────────────────────────────────────────
90
- // Fetch Statistics
91
- // ───────────────────────────────────────────────────────────────────────
92
-
93
- const {
94
- data: stats,
95
- error: statsError,
96
- isLoading: isLoadingStats,
97
- mutate: mutateStats,
98
- } = useTasksApiTasksStatsRetrieve(api as unknown as API);
99
-
100
- // ───────────────────────────────────────────────────────────────────────
101
- // Fetch Queues
102
- // ───────────────────────────────────────────────────────────────────────
103
-
104
- const {
105
- data: queues,
106
- error: queuesError,
107
- isLoading: isLoadingQueues,
108
- mutate: mutateQueues,
109
- } = useTasksApiQueuesStatusRetrieve(api as unknown as API);
110
-
111
- // ───────────────────────────────────────────────────────────────────────
112
- // Fetch Workers
113
- // ───────────────────────────────────────────────────────────────────────
114
-
115
- const {
116
- data: workers,
117
- error: workersError,
118
- isLoading: isLoadingWorkers,
119
- mutate: mutateWorkers,
120
- } = useTasksApiWorkersListRetrieve(api as unknown as API);
121
-
122
- // ───────────────────────────────────────────────────────────────────────
123
- // Mutation Hooks
124
- // ───────────────────────────────────────────────────────────────────────
125
-
126
- const clearTasksMutation = useCreateTasksApiClearCreate();
127
- const clearQueuesMutation = useCreateTasksApiClearQueuesCreate();
128
- const purgeFailedMutation = useCreateTasksApiPurgeFailedCreate();
129
- const queueActionMutation = useCreateTasksApiQueuesManageCreate();
130
- const workerActionMutation = useCreateTasksApiWorkersManageCreate();
131
-
132
- // ───────────────────────────────────────────────────────────────────────
133
- // Operations
134
- // ───────────────────────────────────────────────────────────────────────
135
-
136
- const clearTasks = async (data: APIResponseRequest): Promise<APIResponse> => {
137
- const result = await clearTasksMutation(data, api as unknown as API);
138
- // Refresh all data after clearing
139
- await mutateStats();
140
- await mutateQueues();
141
- return result as APIResponse;
142
- };
143
-
144
- const clearQueues = async (data: APIResponseRequest): Promise<APIResponse> => {
145
- const result = await clearQueuesMutation(data, api as unknown as API);
146
- await mutateQueues();
147
- await mutateStats();
148
- return result as APIResponse;
149
- };
150
-
151
- const purgeFailedTasks = async (data: APIResponseRequest): Promise<APIResponse> => {
152
- const result = await purgeFailedMutation(data, api as unknown as API);
153
- await mutateStats();
154
- await mutateQueues();
155
- return result as APIResponse;
156
- };
157
-
158
- const queueAction = async (data: QueueActionRequest): Promise<QueueAction> => {
159
- const result = await queueActionMutation(data, api as unknown as API);
160
- await mutateQueues();
161
- await mutateStats();
162
- return result as QueueAction;
163
- };
164
-
165
- const workerAction = async (data: WorkerActionRequest): Promise<WorkerAction> => {
166
- const result = await workerActionMutation(data, api as unknown as API);
167
- await mutateWorkers();
168
- await mutateStats();
169
- return result as WorkerAction;
170
- };
171
-
172
- // ───────────────────────────────────────────────────────────────────────
173
- // Refresh Functions
174
- // ───────────────────────────────────────────────────────────────────────
175
-
176
- const refreshStats = () => mutateStats();
177
- const refreshQueues = () => mutateQueues();
178
- const refreshWorkers = () => mutateWorkers();
179
- const refreshAll = () => {
180
- mutateStats();
181
- mutateQueues();
182
- mutateWorkers();
183
- };
184
-
185
- // ───────────────────────────────────────────────────────────────────────
186
- // Context Value
187
- // ───────────────────────────────────────────────────────────────────────
188
-
189
- const value: TasksContextValue = {
190
- // Statistics
191
- stats,
192
- isLoadingStats,
193
- statsError,
194
-
195
- // Queues
196
- queues,
197
- isLoadingQueues,
198
- queuesError,
199
-
200
- // Workers
201
- workers,
202
- isLoadingWorkers,
203
- workersError,
204
-
205
- // Operations
206
- clearTasks,
207
- clearQueues,
208
- purgeFailedTasks,
209
- queueAction,
210
- workerAction,
211
-
212
- // Refresh
213
- refreshStats,
214
- refreshQueues,
215
- refreshWorkers,
216
- refreshAll,
217
- };
218
-
219
- return (
220
- <TasksContext.Provider value={value}>
221
- {children}
222
- </TasksContext.Provider>
223
- );
224
- }
225
-
226
- // ─────────────────────────────────────────────────────────────────────────
227
- // Hook
228
- // ─────────────────────────────────────────────────────────────────────────
229
-
230
- export function useTasks() {
231
- const context = useContext(TasksContext);
232
- if (context === undefined) {
233
- throw new Error('useTasks must be used within a TasksProvider');
234
- }
235
- return context;
236
- }
237
-
238
- // ─────────────────────────────────────────────────────────────────────────
239
- // Exports
240
- // ─────────────────────────────────────────────────────────────────────────
241
-
242
- export type { TasksContextValue, TasksProviderProps };
@@ -1,22 +0,0 @@
1
- /**
2
- * Zod schema for APIResponse
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Standard API response serializer.
6
- * */
7
- import { z } from 'zod'
8
-
9
- /**
10
- * Standard API response serializer.
11
- */
12
- export const APIResponseSchema = z.object({
13
- success: z.boolean(),
14
- message: z.string().optional(),
15
- error: z.string().optional(),
16
- data: z.record(z.string(), z.any()).optional(),
17
- })
18
-
19
- /**
20
- * Infer TypeScript type from Zod schema
21
- */
22
- export type APIResponse = z.infer<typeof APIResponseSchema>
@@ -1,22 +0,0 @@
1
- /**
2
- * Zod schema for APIResponseRequest
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Standard API response serializer.
6
- * */
7
- import { z } from 'zod'
8
-
9
- /**
10
- * Standard API response serializer.
11
- */
12
- export const APIResponseRequestSchema = z.object({
13
- success: z.boolean(),
14
- message: z.string().min(1).optional(),
15
- error: z.string().min(1).optional(),
16
- data: z.record(z.string(), z.any()).optional(),
17
- })
18
-
19
- /**
20
- * Infer TypeScript type from Zod schema
21
- */
22
- export type APIResponseRequest = z.infer<typeof APIResponseRequestSchema>
@@ -1,21 +0,0 @@
1
- /**
2
- * Zod schema for QueueAction
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Serializer for queue management actions.
6
- * */
7
- import { z } from 'zod'
8
- import * as Enums from '../../enums'
9
-
10
- /**
11
- * Serializer for queue management actions.
12
- */
13
- export const QueueActionSchema = z.object({
14
- action: z.nativeEnum(Enums.QueueActionAction),
15
- queue_names: z.array(z.string()).optional(),
16
- })
17
-
18
- /**
19
- * Infer TypeScript type from Zod schema
20
- */
21
- export type QueueAction = z.infer<typeof QueueActionSchema>
@@ -1,21 +0,0 @@
1
- /**
2
- * Zod schema for QueueActionRequest
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Serializer for queue management actions.
6
- * */
7
- import { z } from 'zod'
8
- import * as Enums from '../../enums'
9
-
10
- /**
11
- * Serializer for queue management actions.
12
- */
13
- export const QueueActionRequestSchema = z.object({
14
- action: z.nativeEnum(Enums.QueueActionRequestAction),
15
- queue_names: z.array(z.string().min(1)).optional(),
16
- })
17
-
18
- /**
19
- * Infer TypeScript type from Zod schema
20
- */
21
- export type QueueActionRequest = z.infer<typeof QueueActionRequestSchema>
@@ -1,23 +0,0 @@
1
- /**
2
- * Zod schema for QueueStatus
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Serializer for queue status data.
6
- * */
7
- import { z } from 'zod'
8
-
9
- /**
10
- * Serializer for queue status data.
11
- */
12
- export const QueueStatusSchema = z.object({
13
- queues: z.record(z.string(), z.any()),
14
- workers: z.int(),
15
- redis_connected: z.boolean(),
16
- timestamp: z.string(),
17
- error: z.string().optional(),
18
- })
19
-
20
- /**
21
- * Infer TypeScript type from Zod schema
22
- */
23
- export type QueueStatus = z.infer<typeof QueueStatusSchema>
@@ -1,22 +0,0 @@
1
- /**
2
- * Zod schema for TaskStatistics
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Serializer for task statistics data.
6
- * */
7
- import { z } from 'zod'
8
-
9
- /**
10
- * Serializer for task statistics data.
11
- */
12
- export const TaskStatisticsSchema = z.object({
13
- statistics: z.record(z.string(), z.any()),
14
- recent_tasks: z.array(z.record(z.string(), z.any())),
15
- timestamp: z.string(),
16
- error: z.string().optional(),
17
- })
18
-
19
- /**
20
- * Infer TypeScript type from Zod schema
21
- */
22
- export type TaskStatistics = z.infer<typeof TaskStatisticsSchema>
@@ -1,22 +0,0 @@
1
- /**
2
- * Zod schema for WorkerAction
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Serializer for worker management actions.
6
- * */
7
- import { z } from 'zod'
8
- import * as Enums from '../../enums'
9
-
10
- /**
11
- * Serializer for worker management actions.
12
- */
13
- export const WorkerActionSchema = z.object({
14
- action: z.nativeEnum(Enums.WorkerActionAction),
15
- processes: z.int().min(1.0).max(10.0).optional(),
16
- threads: z.int().min(1.0).max(20.0).optional(),
17
- })
18
-
19
- /**
20
- * Infer TypeScript type from Zod schema
21
- */
22
- export type WorkerAction = z.infer<typeof WorkerActionSchema>
@@ -1,22 +0,0 @@
1
- /**
2
- * Zod schema for WorkerActionRequest
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * * Serializer for worker management actions.
6
- * */
7
- import { z } from 'zod'
8
- import * as Enums from '../../enums'
9
-
10
- /**
11
- * Serializer for worker management actions.
12
- */
13
- export const WorkerActionRequestSchema = z.object({
14
- action: z.nativeEnum(Enums.WorkerActionRequestAction),
15
- processes: z.int().min(1.0).max(10.0).optional(),
16
- threads: z.int().min(1.0).max(20.0).optional(),
17
- })
18
-
19
- /**
20
- * Infer TypeScript type from Zod schema
21
- */
22
- export type WorkerActionRequest = z.infer<typeof WorkerActionRequestSchema>
@@ -1,53 +0,0 @@
1
- # ⚠️ DEPRECATED: Services
2
-
3
- This directory contains **deprecated** service implementations.
4
-
5
- ## Migration Guide
6
-
7
- **Old approach (deprecated):**
8
- ```typescript
9
- import { AuthService } from '@djangocfg/api';
10
-
11
- // Direct service calls
12
- const result = await AuthService.verifyOTP(email, code);
13
- ```
14
-
15
- **New approach (recommended):**
16
- ```typescript
17
- import { AccountsProvider, useAccountsContext } from '@djangocfg/api/cfg/contexts';
18
-
19
- function MyComponent() {
20
- return (
21
- <AccountsProvider>
22
- <ProfileComponent />
23
- </AccountsProvider>
24
- );
25
- }
26
-
27
- function ProfileComponent() {
28
- const { profile, isLoading, error } = useAccountsContext();
29
- // Use context data with SWR caching
30
- }
31
- ```
32
-
33
- ## Why migrate?
34
-
35
- 1. **SWR Integration**: Contexts use SWR for automatic caching, revalidation, and optimistic updates
36
- 2. **React-first**: Built for React components with hooks
37
- 3. **Type-safe**: Full TypeScript support with generated types
38
- 4. **Better UX**: Automatic loading states, error handling, and data synchronization
39
-
40
- ## Available Contexts
41
-
42
- - `AccountsProvider` / `useAccountsContext` - User profile management
43
- - More contexts coming soon...
44
-
45
- ## Deprecation Timeline
46
-
47
- - ✅ **Now**: Both services and contexts are available
48
- - 🔄 **Future**: Services will be removed in next major version
49
- - 📝 **Action**: Migrate to contexts before upgrading
50
-
51
- ## Need Help?
52
-
53
- Check the contexts documentation in `/packages/api/src/cfg/contexts/README.md`
@@ -1,165 +0,0 @@
1
- /**
2
- * Authentication Service
3
- *
4
- * Handles OTP authentication, token management, and user profile
5
- */
6
-
7
- import { BaseClient } from '../../BaseClient';
8
- import { APIError, CfgAccountsTypes, CfgUserProfileTypes, Enums } from '../../generated';
9
-
10
- export class AuthService extends BaseClient {
11
- /**
12
- * Request OTP code
13
- */
14
- static async requestOTP(
15
- identifier: string,
16
- channel?: Enums.OTPRequestRequestChannel
17
- ): Promise<{
18
- success: boolean;
19
- message?: string;
20
- error?: string;
21
- }> {
22
- try {
23
- const response = await this.api.cfg_accounts.otpRequestCreate({
24
- identifier,
25
- channel,
26
- });
27
- return { success: true, message: response.message };
28
- } catch (error) {
29
- if (error instanceof APIError) {
30
- return { success: false, error: error.errorMessage };
31
- }
32
- return { success: false, error: 'Network error' };
33
- }
34
- }
35
-
36
- /**
37
- * Verify OTP and login
38
- */
39
- static async verifyOTP(
40
- identifier: string,
41
- otp: string,
42
- channel?: Enums.OTPVerifyRequestChannel
43
- ): Promise<{
44
- success: boolean;
45
- user?: CfgUserProfileTypes.User;
46
- error?: string;
47
- fieldErrors?: Record<string, string[]>;
48
- }> {
49
- try {
50
- const { access, refresh } = await this.api.cfg_accounts.otpVerifyCreate({
51
- identifier,
52
- otp,
53
- channel,
54
- });
55
-
56
- this.api.setToken(access, refresh);
57
-
58
- const user = await this.api.cfg_user_profile.accountsProfileRetrieve();
59
-
60
- return { success: true, user };
61
- } catch (error) {
62
- if (error instanceof APIError) {
63
- if (error.isValidationError && error.fieldErrors) {
64
- return { success: false, fieldErrors: error.fieldErrors };
65
- }
66
- return { success: false, error: error.errorMessage };
67
- }
68
- return { success: false, error: 'Network error' };
69
- }
70
- }
71
-
72
- /**
73
- * Get current user profile
74
- */
75
- static async getCurrentUser(): Promise<{
76
- success: boolean;
77
- user?: CfgUserProfileTypes.User;
78
- error?: string;
79
- }> {
80
- try {
81
- const user = await this.api.cfg_user_profile.accountsProfileRetrieve();
82
- return { success: true, user };
83
- } catch (error) {
84
- if (error instanceof APIError) {
85
- return { success: false, error: error.errorMessage };
86
- }
87
- return { success: false, error: 'Network error' };
88
- }
89
- }
90
-
91
- /**
92
- * Update user profile
93
- */
94
- static async updateProfile(
95
- data: CfgUserProfileTypes.PatchedUserProfileUpdateRequest
96
- ): Promise<{
97
- success: boolean;
98
- user?: CfgUserProfileTypes.User;
99
- error?: string;
100
- fieldErrors?: Record<string, string[]>;
101
- }> {
102
- try {
103
- const user = await this.api.cfg_user_profile.accountsProfilePartialUpdate(data);
104
- return { success: true, user };
105
- } catch (error) {
106
- if (error instanceof APIError) {
107
- if (error.isValidationError && error.fieldErrors) {
108
- return { success: false, fieldErrors: error.fieldErrors };
109
- }
110
- return { success: false, error: error.errorMessage };
111
- }
112
- return { success: false, error: 'Network error' };
113
- }
114
- }
115
-
116
- /**
117
- * Refresh access token
118
- */
119
- static async refreshToken(): Promise<{ success: boolean; error?: string }> {
120
- const refresh = this.api.getRefreshToken();
121
- if (!refresh) {
122
- return { success: false, error: 'No refresh token' };
123
- }
124
-
125
- try {
126
- const { access } = await this.api.cfg_auth.accountsTokenRefreshCreate({ refresh });
127
- this.api.setToken(access);
128
- return { success: true };
129
- } catch (error) {
130
- this.api.clearTokens();
131
- if (error instanceof APIError) {
132
- return { success: false, error: error.errorMessage };
133
- }
134
- return { success: false, error: 'Network error' };
135
- }
136
- }
137
-
138
- /**
139
- * Logout user
140
- */
141
- static logout(): void {
142
- this.api.clearTokens();
143
- }
144
-
145
- /**
146
- * Check if user is authenticated
147
- */
148
- static isAuthenticated(): boolean {
149
- return this.api.isAuthenticated();
150
- }
151
-
152
- /**
153
- * Get access token
154
- */
155
- static getToken(): string | null {
156
- return this.api.getToken();
157
- }
158
-
159
- /**
160
- * Get refresh token
161
- */
162
- static getRefreshToken(): string | null {
163
- return this.api.getRefreshToken();
164
- }
165
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Auth Module
3
- *
4
- * Authentication and user profile services
5
- */
6
-
7
- export { AuthService } from './AuthService';