@djangocfg/api 1.2.4 → 1.2.6
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 +7562 -3753
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8096 -3976
- package/dist/index.d.ts +8096 -3976
- package/dist/index.mjs +7581 -3799
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/contexts/TasksContext.tsx +242 -0
- package/src/cfg/contexts/index.ts +3 -0
- package/src/cfg/generated/_utils/fetchers/cfg__accounts.ts +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__accounts__auth.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__accounts__user_profile.ts +6 -6
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo.ts +62 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_admin_api.ts +211 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +150 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +152 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard.ts +150 -0
- package/src/cfg/generated/_utils/fetchers/cfg__endpoints.ts +30 -1
- package/src/cfg/generated/_utils/fetchers/cfg__health.ts +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__knowbase.ts +57 -57
- package/src/cfg/generated/_utils/fetchers/cfg__leads.ts +6 -6
- package/src/cfg/generated/_utils/fetchers/cfg__leads__lead_submission.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter.ts +3 -3
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__bulk_email.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__campaigns.ts +6 -6
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__logs.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__newsletters.ts +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__subscriptions.ts +3 -3
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__testing.ts +1 -1
- package/src/cfg/generated/_utils/fetchers/cfg__payments.ts +8 -8
- package/src/cfg/generated/_utils/fetchers/cfg__support.ts +12 -12
- package/src/cfg/generated/_utils/fetchers/cfg__tasks.ts +10 -10
- package/src/cfg/generated/_utils/fetchers/index.ts +5 -2
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo.ts +49 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_admin_api.ts +246 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_monitoring.ts +137 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_testing.ts +171 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard.ts +137 -0
- package/src/cfg/generated/_utils/hooks/cfg__endpoints.ts +29 -0
- package/src/cfg/generated/_utils/hooks/index.ts +5 -2
- package/src/cfg/generated/_utils/schemas/ActivityEntry.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/AppStatistics.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelInfo.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoChannelsResult.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoClientInfo.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoError.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoHistoryResult.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoInfoResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoInfoResult.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoMetrics.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoNodeInfo.schema.ts +30 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceResult.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts +19 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoProcess.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoPublication.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/CentrifugoStreamPosition.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ChannelList.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/ChannelStatsSerializer.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/ConnectionTokenRequestRequest.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ConnectionTokenResponse.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/DashboardOverview.schema.ts +27 -0
- package/src/cfg/generated/_utils/schemas/HealthCheck.schema.ts +5 -7
- package/src/cfg/generated/_utils/schemas/ManualAckRequestRequest.schema.ts +20 -0
- package/src/cfg/generated/_utils/schemas/ManualAckResponse.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/OverviewStats.schema.ts +9 -12
- package/src/cfg/generated/_utils/schemas/PublishTestRequestRequest.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/PublishTestResponse.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/QuickAction.schema.ts +29 -0
- package/src/cfg/generated/_utils/schemas/RecentPublishes.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/StatCard.schema.ts +30 -0
- package/src/cfg/generated/_utils/schemas/SystemHealth.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/SystemHealthItem.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/SystemMetrics.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/URLPattern.schema.ts +26 -0
- package/src/cfg/generated/_utils/schemas/URLsList.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/UserStatistics.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/index.ts +42 -10
- package/src/cfg/generated/cfg__centrifugo/client.ts +30 -0
- package/src/cfg/generated/cfg__centrifugo/models.ts +0 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/client.ts +136 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_admin_api/models.ts +256 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/client.ts +160 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_monitoring/models.ts +92 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/client.ts +100 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/index.ts +2 -0
- package/src/cfg/generated/cfg__centrifugo__centrifugo_testing/models.ts +88 -0
- package/src/cfg/generated/cfg__dashboard/client.ts +106 -0
- package/src/cfg/generated/cfg__dashboard/index.ts +2 -0
- package/src/cfg/generated/cfg__dashboard/models.ts +108 -0
- package/src/cfg/generated/cfg__endpoints/client.ts +16 -0
- package/src/cfg/generated/cfg__endpoints/models.ts +44 -0
- package/src/cfg/generated/cfg__health/models.ts +7 -11
- package/src/cfg/generated/client.ts +15 -6
- package/src/cfg/generated/enums.ts +56 -0
- package/src/cfg/generated/index.ts +32 -20
- package/src/cfg/generated/schema.ts +4840 -2127
- package/src/cfg/generated/_utils/fetchers/cfg__ipc__ipcrpc_monitoring.ts +0 -179
- package/src/cfg/generated/_utils/fetchers/cfg__ipc__ipcrpc_testing.ts +0 -151
- package/src/cfg/generated/_utils/hooks/cfg__ipc__ipcrpc_monitoring.ts +0 -166
- package/src/cfg/generated/_utils/hooks/cfg__ipc__ipcrpc_testing.ts +0 -162
- package/src/cfg/generated/_utils/schemas/LoadTestRequestRequest.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/LoadTestResponse.schema.ts +0 -21
- package/src/cfg/generated/_utils/schemas/LoadTestStatus.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/MethodStat.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/MethodStats.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/NotificationStats.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/RPCRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/RecentRequests.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/TestRPCRequestRequest.schema.ts +0 -21
- package/src/cfg/generated/_utils/schemas/TestRPCResponse.schema.ts +0 -23
- package/src/cfg/generated/cfg__ipc__ipcrpc_monitoring/client.ts +0 -136
- package/src/cfg/generated/cfg__ipc__ipcrpc_monitoring/models.ts +0 -144
- package/src/cfg/generated/cfg__ipc__ipcrpc_testing/client.ts +0 -96
- package/src/cfg/generated/cfg__ipc__ipcrpc_testing/models.ts +0 -88
- /package/src/cfg/generated/{cfg__ipc__ipcrpc_monitoring → cfg__centrifugo}/index.ts +0 -0
- /package/src/cfg/generated/{cfg__ipc__ipcrpc_testing → cfg__centrifugo__centrifugo_admin_api}/index.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "DjangoCFG",
|
|
6
6
|
"url": "https://djangocfg.com"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^22.15.3",
|
|
69
69
|
"@types/react": "19.2.2",
|
|
70
70
|
"@types/react-dom": "19.2.1",
|
|
71
|
-
"@djangocfg/typescript-config": "^1.2.
|
|
71
|
+
"@djangocfg/typescript-config": "^1.2.6",
|
|
72
72
|
"react": "^19.1.0",
|
|
73
73
|
"react-dom": "^19.1.0",
|
|
74
74
|
"tsup": "^8.5.0",
|
|
@@ -0,0 +1,242 @@
|
|
|
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 };
|
|
@@ -46,3 +46,6 @@ export * from './payments';
|
|
|
46
46
|
// Knowbase (Chat, Documents, Sessions)
|
|
47
47
|
export * from './knowbase';
|
|
48
48
|
|
|
49
|
+
// Tasks (Dramatiq Task Management)
|
|
50
|
+
export { TasksProvider, useTasks } from './TasksContext';
|
|
51
|
+
export type { TasksContextValue, TasksProviderProps } from './TasksContext';
|
|
@@ -42,7 +42,7 @@ import type { API } from '../../index'
|
|
|
42
42
|
* @method POST
|
|
43
43
|
* @path /cfg/accounts/otp/request/
|
|
44
44
|
*/
|
|
45
|
-
export async function createAccountsOtpRequestCreate( data: OTPRequestRequest, client
|
|
45
|
+
export async function createAccountsOtpRequestCreate( data: OTPRequestRequest, client?: API
|
|
46
46
|
): Promise<OTPRequestResponse> {
|
|
47
47
|
const api = client || getAPIInstance()
|
|
48
48
|
const response = await api.cfg_accounts.otpRequestCreate(data)
|
|
@@ -56,7 +56,7 @@ export async function createAccountsOtpRequestCreate( data: OTPRequestRequest,
|
|
|
56
56
|
* @method POST
|
|
57
57
|
* @path /cfg/accounts/otp/verify/
|
|
58
58
|
*/
|
|
59
|
-
export async function createAccountsOtpVerifyCreate( data: OTPVerifyRequest, client
|
|
59
|
+
export async function createAccountsOtpVerifyCreate( data: OTPVerifyRequest, client?: API
|
|
60
60
|
): Promise<OTPVerifyResponse> {
|
|
61
61
|
const api = client || getAPIInstance()
|
|
62
62
|
const response = await api.cfg_accounts.otpVerifyCreate(data)
|
|
@@ -40,7 +40,7 @@ import type { API } from '../../index'
|
|
|
40
40
|
* @method POST
|
|
41
41
|
* @path /cfg/accounts/token/refresh/
|
|
42
42
|
*/
|
|
43
|
-
export async function createAccountsTokenRefreshCreate( data: TokenRefreshRequest, client
|
|
43
|
+
export async function createAccountsTokenRefreshCreate( data: TokenRefreshRequest, client?: API
|
|
44
44
|
): Promise<TokenRefresh> {
|
|
45
45
|
const api = client || getAPIInstance()
|
|
46
46
|
const response = await api.cfg_auth.accountsTokenRefreshCreate(data)
|
|
@@ -41,7 +41,7 @@ import type { API } from '../../index'
|
|
|
41
41
|
* @method GET
|
|
42
42
|
* @path /cfg/accounts/profile/
|
|
43
43
|
*/
|
|
44
|
-
export async function getAccountsProfileRetrieve( client
|
|
44
|
+
export async function getAccountsProfileRetrieve( client?: API
|
|
45
45
|
): Promise<User> {
|
|
46
46
|
const api = client || getAPIInstance()
|
|
47
47
|
const response = await api.cfg_user_profile.accountsProfileRetrieve()
|
|
@@ -55,7 +55,7 @@ export async function getAccountsProfileRetrieve( client?
|
|
|
55
55
|
* @method POST
|
|
56
56
|
* @path /cfg/accounts/profile/avatar/
|
|
57
57
|
*/
|
|
58
|
-
export async function createAccountsProfileAvatarCreate( data: any, client
|
|
58
|
+
export async function createAccountsProfileAvatarCreate( data: any, client?: API
|
|
59
59
|
): Promise<User> {
|
|
60
60
|
const api = client || getAPIInstance()
|
|
61
61
|
const response = await api.cfg_user_profile.accountsProfileAvatarCreate(data)
|
|
@@ -69,7 +69,7 @@ export async function createAccountsProfileAvatarCreate( data: any, client?
|
|
|
69
69
|
* @method PUT
|
|
70
70
|
* @path /cfg/accounts/profile/partial/
|
|
71
71
|
*/
|
|
72
|
-
export async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client
|
|
72
|
+
export async function partialUpdateAccountsProfilePartialUpdate( data: UserProfileUpdateRequest, client?: API
|
|
73
73
|
): Promise<User> {
|
|
74
74
|
const api = client || getAPIInstance()
|
|
75
75
|
const response = await api.cfg_user_profile.accountsProfilePartialUpdate(data)
|
|
@@ -83,7 +83,7 @@ export async function partialUpdateAccountsProfilePartialUpdate( data: UserProf
|
|
|
83
83
|
* @method PATCH
|
|
84
84
|
* @path /cfg/accounts/profile/partial/
|
|
85
85
|
*/
|
|
86
|
-
export async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client
|
|
86
|
+
export async function partialUpdateAccountsProfilePartialPartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: API
|
|
87
87
|
): Promise<User> {
|
|
88
88
|
const api = client || getAPIInstance()
|
|
89
89
|
const response = await api.cfg_user_profile.accountsProfilePartialPartialUpdate(data)
|
|
@@ -97,7 +97,7 @@ export async function partialUpdateAccountsProfilePartialPartialUpdate( data?:
|
|
|
97
97
|
* @method PUT
|
|
98
98
|
* @path /cfg/accounts/profile/update/
|
|
99
99
|
*/
|
|
100
|
-
export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client
|
|
100
|
+
export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdateRequest, client?: API
|
|
101
101
|
): Promise<User> {
|
|
102
102
|
const api = client || getAPIInstance()
|
|
103
103
|
const response = await api.cfg_user_profile.accountsProfileUpdateUpdate(data)
|
|
@@ -111,7 +111,7 @@ export async function updateAccountsProfileUpdateUpdate( data: UserProfileUpdat
|
|
|
111
111
|
* @method PATCH
|
|
112
112
|
* @path /cfg/accounts/profile/update/
|
|
113
113
|
*/
|
|
114
|
-
export async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client
|
|
114
|
+
export async function partialUpdateAccountsProfileUpdatePartialUpdate( data?: PatchedUserProfileUpdateRequest, client?: API
|
|
115
115
|
): Promise<User> {
|
|
116
116
|
const api = client || getAPIInstance()
|
|
117
117
|
const response = await api.cfg_user_profile.accountsProfileUpdatePartialUpdate(data)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed fetchers for Centrifugo
|
|
3
|
+
*
|
|
4
|
+
* Universal functions that work in any environment:
|
|
5
|
+
* - Next.js (App Router / Pages Router / Server Components)
|
|
6
|
+
* - React Native
|
|
7
|
+
* - Node.js backend
|
|
8
|
+
*
|
|
9
|
+
* These fetchers use Zod schemas for runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Configure API once (in your app entry point)
|
|
14
|
+
* import { configureAPI } from '../../api-instance'
|
|
15
|
+
* configureAPI({ baseUrl: 'https://api.example.com' })
|
|
16
|
+
*
|
|
17
|
+
* // Then use fetchers anywhere
|
|
18
|
+
* const users = await getUsers({ page: 1 })
|
|
19
|
+
*
|
|
20
|
+
* // With SWR
|
|
21
|
+
* const { data } = useSWR(['users', params], () => getUsers(params))
|
|
22
|
+
*
|
|
23
|
+
* // With React Query
|
|
24
|
+
* const { data } = useQuery(['users', params], () => getUsers(params))
|
|
25
|
+
*
|
|
26
|
+
* // In Server Component or SSR (pass custom client)
|
|
27
|
+
* import { API } from '../../index'
|
|
28
|
+
* const api = new API('https://api.example.com')
|
|
29
|
+
* const users = await getUsers({ page: 1 }, api)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { getAPIInstance } from '../../api-instance'
|
|
33
|
+
import type { API } from '../../index'
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* API operation
|
|
37
|
+
*
|
|
38
|
+
* @method GET
|
|
39
|
+
* @path /cfg/centrifugo/admin/api/monitor/channels/
|
|
40
|
+
*/
|
|
41
|
+
export async function getCentrifugoAdminApiMonitorChannelsRetrieve( client?: API
|
|
42
|
+
): Promise<any> {
|
|
43
|
+
const api = client || getAPIInstance()
|
|
44
|
+
const response = await api.cfg_centrifugo.adminApiMonitorChannelsRetrieve()
|
|
45
|
+
return response
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* API operation
|
|
51
|
+
*
|
|
52
|
+
* @method GET
|
|
53
|
+
* @path /cfg/centrifugo/monitor/channels/
|
|
54
|
+
*/
|
|
55
|
+
export async function getCentrifugoMonitorChannelsRetrieve( client?: API
|
|
56
|
+
): Promise<any> {
|
|
57
|
+
const api = client || getAPIInstance()
|
|
58
|
+
const response = await api.cfg_centrifugo.monitorChannelsRetrieve()
|
|
59
|
+
return response
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed fetchers for Centrifugo Admin API
|
|
3
|
+
*
|
|
4
|
+
* Universal functions that work in any environment:
|
|
5
|
+
* - Next.js (App Router / Pages Router / Server Components)
|
|
6
|
+
* - React Native
|
|
7
|
+
* - Node.js backend
|
|
8
|
+
*
|
|
9
|
+
* These fetchers use Zod schemas for runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Configure API once (in your app entry point)
|
|
14
|
+
* import { configureAPI } from '../../api-instance'
|
|
15
|
+
* configureAPI({ baseUrl: 'https://api.example.com' })
|
|
16
|
+
*
|
|
17
|
+
* // Then use fetchers anywhere
|
|
18
|
+
* const users = await getUsers({ page: 1 })
|
|
19
|
+
*
|
|
20
|
+
* // With SWR
|
|
21
|
+
* const { data } = useSWR(['users', params], () => getUsers(params))
|
|
22
|
+
*
|
|
23
|
+
* // With React Query
|
|
24
|
+
* const { data } = useQuery(['users', params], () => getUsers(params))
|
|
25
|
+
*
|
|
26
|
+
* // In Server Component or SSR (pass custom client)
|
|
27
|
+
* import { API } from '../../index'
|
|
28
|
+
* const api = new API('https://api.example.com')
|
|
29
|
+
* const users = await getUsers({ page: 1 }, api)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { CentrifugoChannelsRequestRequestSchema, type CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'
|
|
33
|
+
import { CentrifugoChannelsResponseSchema, type CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'
|
|
34
|
+
import { CentrifugoHistoryRequestRequestSchema, type CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'
|
|
35
|
+
import { CentrifugoHistoryResponseSchema, type CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'
|
|
36
|
+
import { CentrifugoInfoResponseSchema, type CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'
|
|
37
|
+
import { CentrifugoPresenceRequestRequestSchema, type CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'
|
|
38
|
+
import { CentrifugoPresenceResponseSchema, type CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'
|
|
39
|
+
import { CentrifugoPresenceStatsRequestRequestSchema, type CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'
|
|
40
|
+
import { CentrifugoPresenceStatsResponseSchema, type CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'
|
|
41
|
+
import { getAPIInstance } from '../../api-instance'
|
|
42
|
+
import type { API } from '../../index'
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get connection token for dashboard
|
|
46
|
+
*
|
|
47
|
+
* @method POST
|
|
48
|
+
* @path /cfg/centrifugo/admin/api/server/auth/token/
|
|
49
|
+
*/
|
|
50
|
+
export async function createCentrifugoAdminApiServerAuthTokenCreate( client?: API
|
|
51
|
+
): Promise<any> {
|
|
52
|
+
const api = client || getAPIInstance()
|
|
53
|
+
const response = await api.cfg_centrifugo_admin_api.serverAuthTokenCreate()
|
|
54
|
+
return response
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* List active channels
|
|
60
|
+
*
|
|
61
|
+
* @method POST
|
|
62
|
+
* @path /cfg/centrifugo/admin/api/server/channels/
|
|
63
|
+
*/
|
|
64
|
+
export async function createCentrifugoAdminApiServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: API
|
|
65
|
+
): Promise<CentrifugoChannelsResponse> {
|
|
66
|
+
const api = client || getAPIInstance()
|
|
67
|
+
const response = await api.cfg_centrifugo_admin_api.serverChannelsCreate(data)
|
|
68
|
+
return CentrifugoChannelsResponseSchema.parse(response)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get channel history
|
|
74
|
+
*
|
|
75
|
+
* @method POST
|
|
76
|
+
* @path /cfg/centrifugo/admin/api/server/history/
|
|
77
|
+
*/
|
|
78
|
+
export async function createCentrifugoAdminApiServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: API
|
|
79
|
+
): Promise<CentrifugoHistoryResponse> {
|
|
80
|
+
const api = client || getAPIInstance()
|
|
81
|
+
const response = await api.cfg_centrifugo_admin_api.serverHistoryCreate(data)
|
|
82
|
+
return CentrifugoHistoryResponseSchema.parse(response)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get Centrifugo server info
|
|
88
|
+
*
|
|
89
|
+
* @method POST
|
|
90
|
+
* @path /cfg/centrifugo/admin/api/server/info/
|
|
91
|
+
*/
|
|
92
|
+
export async function createCentrifugoAdminApiServerInfoCreate( client?: API
|
|
93
|
+
): Promise<CentrifugoInfoResponse> {
|
|
94
|
+
const api = client || getAPIInstance()
|
|
95
|
+
const response = await api.cfg_centrifugo_admin_api.serverInfoCreate()
|
|
96
|
+
return CentrifugoInfoResponseSchema.parse(response)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get channel presence
|
|
102
|
+
*
|
|
103
|
+
* @method POST
|
|
104
|
+
* @path /cfg/centrifugo/admin/api/server/presence/
|
|
105
|
+
*/
|
|
106
|
+
export async function createCentrifugoAdminApiServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: API
|
|
107
|
+
): Promise<CentrifugoPresenceResponse> {
|
|
108
|
+
const api = client || getAPIInstance()
|
|
109
|
+
const response = await api.cfg_centrifugo_admin_api.serverPresenceCreate(data)
|
|
110
|
+
return CentrifugoPresenceResponseSchema.parse(response)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get channel presence statistics
|
|
116
|
+
*
|
|
117
|
+
* @method POST
|
|
118
|
+
* @path /cfg/centrifugo/admin/api/server/presence-stats/
|
|
119
|
+
*/
|
|
120
|
+
export async function createCentrifugoAdminApiServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: API
|
|
121
|
+
): Promise<CentrifugoPresenceStatsResponse> {
|
|
122
|
+
const api = client || getAPIInstance()
|
|
123
|
+
const response = await api.cfg_centrifugo_admin_api.serverPresenceStatsCreate(data)
|
|
124
|
+
return CentrifugoPresenceStatsResponseSchema.parse(response)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Get connection token for dashboard
|
|
130
|
+
*
|
|
131
|
+
* @method POST
|
|
132
|
+
* @path /cfg/centrifugo/server/auth/token/
|
|
133
|
+
*/
|
|
134
|
+
export async function createCentrifugoServerAuthTokenCreate( client?: API
|
|
135
|
+
): Promise<any> {
|
|
136
|
+
const api = client || getAPIInstance()
|
|
137
|
+
const response = await api.cfg_centrifugo_admin_api.centrifugoServerAuthTokenCreate()
|
|
138
|
+
return response
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* List active channels
|
|
144
|
+
*
|
|
145
|
+
* @method POST
|
|
146
|
+
* @path /cfg/centrifugo/server/channels/
|
|
147
|
+
*/
|
|
148
|
+
export async function createCentrifugoServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: API
|
|
149
|
+
): Promise<CentrifugoChannelsResponse> {
|
|
150
|
+
const api = client || getAPIInstance()
|
|
151
|
+
const response = await api.cfg_centrifugo_admin_api.centrifugoServerChannelsCreate(data)
|
|
152
|
+
return CentrifugoChannelsResponseSchema.parse(response)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get channel history
|
|
158
|
+
*
|
|
159
|
+
* @method POST
|
|
160
|
+
* @path /cfg/centrifugo/server/history/
|
|
161
|
+
*/
|
|
162
|
+
export async function createCentrifugoServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: API
|
|
163
|
+
): Promise<CentrifugoHistoryResponse> {
|
|
164
|
+
const api = client || getAPIInstance()
|
|
165
|
+
const response = await api.cfg_centrifugo_admin_api.centrifugoServerHistoryCreate(data)
|
|
166
|
+
return CentrifugoHistoryResponseSchema.parse(response)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Get Centrifugo server info
|
|
172
|
+
*
|
|
173
|
+
* @method POST
|
|
174
|
+
* @path /cfg/centrifugo/server/info/
|
|
175
|
+
*/
|
|
176
|
+
export async function createCentrifugoServerInfoCreate( client?: API
|
|
177
|
+
): Promise<CentrifugoInfoResponse> {
|
|
178
|
+
const api = client || getAPIInstance()
|
|
179
|
+
const response = await api.cfg_centrifugo_admin_api.centrifugoServerInfoCreate()
|
|
180
|
+
return CentrifugoInfoResponseSchema.parse(response)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get channel presence
|
|
186
|
+
*
|
|
187
|
+
* @method POST
|
|
188
|
+
* @path /cfg/centrifugo/server/presence/
|
|
189
|
+
*/
|
|
190
|
+
export async function createCentrifugoServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: API
|
|
191
|
+
): Promise<CentrifugoPresenceResponse> {
|
|
192
|
+
const api = client || getAPIInstance()
|
|
193
|
+
const response = await api.cfg_centrifugo_admin_api.centrifugoServerPresenceCreate(data)
|
|
194
|
+
return CentrifugoPresenceResponseSchema.parse(response)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Get channel presence statistics
|
|
200
|
+
*
|
|
201
|
+
* @method POST
|
|
202
|
+
* @path /cfg/centrifugo/server/presence-stats/
|
|
203
|
+
*/
|
|
204
|
+
export async function createCentrifugoServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: API
|
|
205
|
+
): Promise<CentrifugoPresenceStatsResponse> {
|
|
206
|
+
const api = client || getAPIInstance()
|
|
207
|
+
const response = await api.cfg_centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data)
|
|
208
|
+
return CentrifugoPresenceStatsResponseSchema.parse(response)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|