@djangocfg/api 1.2.18 → 1.2.20
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 +13762 -11037
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5828 -2659
- package/dist/index.d.ts +5828 -2659
- package/dist/index.mjs +11188 -8496
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_monitoring.ts +122 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_jobs.ts +105 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_monitoring.ts +77 -0
- package/src/cfg/generated/_utils/fetchers/{cfg__dashboard.ts → cfg__rq__rq_queues.ts} +21 -20
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_registries.ts +132 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_schedules.ts +92 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_testing.ts +120 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_workers.ts +62 -0
- package/src/cfg/generated/_utils/fetchers/index.ts +8 -2
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_monitoring.ts +110 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_jobs.ts +106 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_monitoring.ts +65 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_queues.ts +82 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_registries.ts +132 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_schedules.ts +89 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_testing.ts +124 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_workers.ts +50 -0
- package/src/cfg/generated/_utils/hooks/index.ts +8 -2
- package/src/cfg/generated/_utils/schemas/JobActionResponse.schema.ts +26 -0
- package/src/cfg/generated/_utils/schemas/JobDetail.schema.ts +40 -0
- package/src/cfg/generated/_utils/schemas/JobList.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/MethodList.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/MethodStatsSerializer.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/QueueDetail.schema.ts +34 -0
- package/src/cfg/generated/_utils/schemas/QueueStats.schema.ts +31 -0
- package/src/cfg/generated/_utils/schemas/RQConfig.schema.ts +29 -0
- package/src/cfg/generated/_utils/schemas/RecentRequests.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/RunDemoRequestRequest.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/ScheduleActionResponse.schema.ts +22 -0
- package/src/cfg/generated/_utils/schemas/ScheduleCreateRequest.schema.ts +39 -0
- package/src/cfg/generated/_utils/schemas/ScheduledJob.schema.ts +32 -0
- package/src/cfg/generated/_utils/schemas/ServiceList.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/ServiceStatsSerializer.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/StressTestRequestRequest.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/TestScenario.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/TestingActionResponse.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/Worker.schema.ts +31 -0
- package/src/cfg/generated/_utils/schemas/WorkerStats.schema.ts +31 -0
- package/src/cfg/generated/_utils/schemas/index.ts +20 -10
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/client.ts +129 -0
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/models.ts +124 -0
- package/src/cfg/generated/cfg__rq__rq_jobs/client.ts +76 -0
- package/src/cfg/generated/cfg__rq__rq_jobs/models.ts +62 -0
- package/src/cfg/generated/cfg__rq__rq_monitoring/client.ts +45 -0
- package/src/cfg/generated/cfg__rq__rq_monitoring/index.ts +2 -0
- package/src/cfg/generated/cfg__rq__rq_monitoring/models.ts +39 -0
- package/src/cfg/generated/cfg__rq__rq_queues/client.ts +78 -0
- package/src/cfg/generated/cfg__rq__rq_queues/index.ts +2 -0
- package/src/cfg/generated/cfg__rq__rq_queues/models.ts +33 -0
- package/src/cfg/generated/cfg__rq__rq_registries/client.ts +161 -0
- package/src/cfg/generated/cfg__rq__rq_registries/index.ts +2 -0
- package/src/cfg/generated/cfg__rq__rq_registries/models.ts +17 -0
- package/src/cfg/generated/cfg__rq__rq_schedules/client.ts +91 -0
- package/src/cfg/generated/cfg__rq__rq_schedules/index.ts +2 -0
- package/src/cfg/generated/cfg__rq__rq_schedules/models.ts +84 -0
- package/src/cfg/generated/cfg__rq__rq_testing/client.ts +96 -0
- package/src/cfg/generated/cfg__rq__rq_testing/index.ts +2 -0
- package/src/cfg/generated/cfg__rq__rq_testing/models.ts +68 -0
- package/src/cfg/generated/cfg__rq__rq_workers/client.ts +46 -0
- package/src/cfg/generated/cfg__rq__rq_workers/index.ts +2 -0
- package/src/cfg/generated/cfg__rq__rq_workers/models.ts +52 -0
- package/src/cfg/generated/client.ts +24 -6
- package/src/cfg/generated/enums.ts +36 -60
- package/src/cfg/generated/index.ts +40 -10
- package/src/cfg/generated/schema.ts +6391 -4704
- package/src/cfg/generated/_utils/fetchers/cfg__tasks.ts +0 -123
- package/src/cfg/generated/_utils/hooks/cfg__dashboard.ts +0 -77
- package/src/cfg/generated/_utils/hooks/cfg__tasks.ts +0 -111
- package/src/cfg/generated/_utils/schemas/PaginatedTaskLogListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/TaskLog.schema.ts +0 -42
- package/src/cfg/generated/_utils/schemas/TaskLogDetail.schema.ts +0 -50
- package/src/cfg/generated/_utils/schemas/TaskLogList.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/TaskLogOverview.schema.ts +0 -43
- package/src/cfg/generated/_utils/schemas/TaskLogStats.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/TaskLogTimeline.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/TaskLogTimelineItem.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/TasksByQueue.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/TasksByStatus.schema.ts +0 -24
- package/src/cfg/generated/cfg__dashboard/client.ts +0 -48
- package/src/cfg/generated/cfg__dashboard/models.ts +0 -0
- package/src/cfg/generated/cfg__tasks/client.ts +0 -104
- package/src/cfg/generated/cfg__tasks/models.ts +0 -285
- /package/src/cfg/generated/{cfg__dashboard → cfg__grpc__grpc_monitoring}/index.ts +0 -0
- /package/src/cfg/generated/{cfg__tasks → cfg__rq__rq_jobs}/index.ts +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for RQ Registries
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__rq__rq_registries'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { JobActionResponse } from '../schemas/JobActionResponse.schema'
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* List deferred jobs
|
|
25
|
+
*
|
|
26
|
+
* @method GET
|
|
27
|
+
* @path /cfg/rq/jobs/registries/deferred/
|
|
28
|
+
*/
|
|
29
|
+
export function useRqJobsRegistriesDeferredList(params?: { queue?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
30
|
+
return useSWR<any>(
|
|
31
|
+
params ? ['cfg-rq-jobs-registries-deferred', params] : 'cfg-rq-jobs-registries-deferred',
|
|
32
|
+
() => Fetchers.getRqJobsRegistriesDeferredList(params, client)
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* List failed jobs
|
|
39
|
+
*
|
|
40
|
+
* @method GET
|
|
41
|
+
* @path /cfg/rq/jobs/registries/failed/
|
|
42
|
+
*/
|
|
43
|
+
export function useRqJobsRegistriesFailedList(params?: { queue?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
44
|
+
return useSWR<any>(
|
|
45
|
+
params ? ['cfg-rq-jobs-registries-failed', params] : 'cfg-rq-jobs-registries-failed',
|
|
46
|
+
() => Fetchers.getRqJobsRegistriesFailedList(params, client)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Clear failed jobs registry
|
|
53
|
+
*
|
|
54
|
+
* @method POST
|
|
55
|
+
* @path /cfg/rq/jobs/registries/failed/clear/
|
|
56
|
+
*/
|
|
57
|
+
export function useCreateRqJobsRegistriesFailedClearCreate() {
|
|
58
|
+
const { mutate } = useSWRConfig()
|
|
59
|
+
|
|
60
|
+
return async (params: { queue: string }, client?: API): Promise<JobActionResponse> => {
|
|
61
|
+
const result = await Fetchers.createRqJobsRegistriesFailedClearCreate(params, client)
|
|
62
|
+
// Revalidate related queries
|
|
63
|
+
mutate('cfg-rq-jobs-registries-failed-clear')
|
|
64
|
+
return result
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Requeue all failed jobs
|
|
71
|
+
*
|
|
72
|
+
* @method POST
|
|
73
|
+
* @path /cfg/rq/jobs/registries/failed/requeue-all/
|
|
74
|
+
*/
|
|
75
|
+
export function useCreateRqJobsRegistriesFailedRequeueAllCreate() {
|
|
76
|
+
const { mutate } = useSWRConfig()
|
|
77
|
+
|
|
78
|
+
return async (params: { queue: string }, client?: API): Promise<JobActionResponse> => {
|
|
79
|
+
const result = await Fetchers.createRqJobsRegistriesFailedRequeueAllCreate(params, client)
|
|
80
|
+
// Revalidate related queries
|
|
81
|
+
mutate('cfg-rq-jobs-registries-failed-requeue-all')
|
|
82
|
+
return result
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* List finished jobs
|
|
89
|
+
*
|
|
90
|
+
* @method GET
|
|
91
|
+
* @path /cfg/rq/jobs/registries/finished/
|
|
92
|
+
*/
|
|
93
|
+
export function useRqJobsRegistriesFinishedList(params?: { queue?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
94
|
+
return useSWR<any>(
|
|
95
|
+
params ? ['cfg-rq-jobs-registries-finished', params] : 'cfg-rq-jobs-registries-finished',
|
|
96
|
+
() => Fetchers.getRqJobsRegistriesFinishedList(params, client)
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Clear finished jobs registry
|
|
103
|
+
*
|
|
104
|
+
* @method POST
|
|
105
|
+
* @path /cfg/rq/jobs/registries/finished/clear/
|
|
106
|
+
*/
|
|
107
|
+
export function useCreateRqJobsRegistriesFinishedClearCreate() {
|
|
108
|
+
const { mutate } = useSWRConfig()
|
|
109
|
+
|
|
110
|
+
return async (params: { queue: string }, client?: API): Promise<JobActionResponse> => {
|
|
111
|
+
const result = await Fetchers.createRqJobsRegistriesFinishedClearCreate(params, client)
|
|
112
|
+
// Revalidate related queries
|
|
113
|
+
mutate('cfg-rq-jobs-registries-finished-clear')
|
|
114
|
+
return result
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* List started jobs
|
|
121
|
+
*
|
|
122
|
+
* @method GET
|
|
123
|
+
* @path /cfg/rq/jobs/registries/started/
|
|
124
|
+
*/
|
|
125
|
+
export function useRqJobsRegistriesStartedList(params?: { queue?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
126
|
+
return useSWR<any>(
|
|
127
|
+
params ? ['cfg-rq-jobs-registries-started', params] : 'cfg-rq-jobs-registries-started',
|
|
128
|
+
() => Fetchers.getRqJobsRegistriesStartedList(params, client)
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for RQ Schedules
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__rq__rq_schedules'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { ScheduleActionResponse } from '../schemas/ScheduleActionResponse.schema'
|
|
22
|
+
import type { ScheduleCreateRequest } from '../schemas/ScheduleCreateRequest.schema'
|
|
23
|
+
import type { ScheduledJob } from '../schemas/ScheduledJob.schema'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List scheduled jobs
|
|
27
|
+
*
|
|
28
|
+
* @method GET
|
|
29
|
+
* @path /cfg/rq/schedules/
|
|
30
|
+
*/
|
|
31
|
+
export function useRqSchedulesList(params?: { queue?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
32
|
+
return useSWR<any>(
|
|
33
|
+
params ? ['cfg-rq-schedules', params] : 'cfg-rq-schedules',
|
|
34
|
+
() => Fetchers.getRqSchedulesList(params, client)
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Create scheduled job
|
|
41
|
+
*
|
|
42
|
+
* @method POST
|
|
43
|
+
* @path /cfg/rq/schedules/
|
|
44
|
+
*/
|
|
45
|
+
export function useCreateRqSchedulesCreate() {
|
|
46
|
+
const { mutate } = useSWRConfig()
|
|
47
|
+
|
|
48
|
+
return async (data: ScheduleCreateRequest, client?: API): Promise<ScheduleActionResponse> => {
|
|
49
|
+
const result = await Fetchers.createRqSchedulesCreate(data, client)
|
|
50
|
+
// Revalidate related queries
|
|
51
|
+
mutate('cfg-rq-schedules')
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get scheduled job details
|
|
59
|
+
*
|
|
60
|
+
* @method GET
|
|
61
|
+
* @path /cfg/rq/schedules/{id}/
|
|
62
|
+
*/
|
|
63
|
+
export function useRqSchedulesRetrieve(id: string, pk: string, params?: { queue?: string }, client?: API): ReturnType<typeof useSWR<ScheduledJob>> {
|
|
64
|
+
return useSWR<ScheduledJob>(
|
|
65
|
+
['cfg-rq-schedule', id],
|
|
66
|
+
() => Fetchers.getRqSchedulesRetrieve(id, pk, params, client)
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Cancel scheduled job
|
|
73
|
+
*
|
|
74
|
+
* @method DELETE
|
|
75
|
+
* @path /cfg/rq/schedules/{id}/
|
|
76
|
+
*/
|
|
77
|
+
export function useDeleteRqSchedulesDestroy() {
|
|
78
|
+
const { mutate } = useSWRConfig()
|
|
79
|
+
|
|
80
|
+
return async (id: string, pk: string, params?: { queue?: string }, client?: API): Promise<ScheduleActionResponse> => {
|
|
81
|
+
const result = await Fetchers.deleteRqSchedulesDestroy(id, pk, params, client)
|
|
82
|
+
// Revalidate related queries
|
|
83
|
+
mutate('cfg-rq-schedules')
|
|
84
|
+
mutate('cfg-rq-schedule')
|
|
85
|
+
return result
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for RQ Testing
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__rq__rq_testing'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { RunDemoRequestRequest } from '../schemas/RunDemoRequestRequest.schema'
|
|
22
|
+
import type { StressTestRequestRequest } from '../schemas/StressTestRequestRequest.schema'
|
|
23
|
+
import type { TestingActionResponse } from '../schemas/TestingActionResponse.schema'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List test scenarios
|
|
27
|
+
*
|
|
28
|
+
* @method GET
|
|
29
|
+
* @path /cfg/rq/testing/
|
|
30
|
+
*/
|
|
31
|
+
export function useRqTestingList(client?: API): ReturnType<typeof useSWR<any>> {
|
|
32
|
+
return useSWR<any>(
|
|
33
|
+
'cfg-rq-testing',
|
|
34
|
+
() => Fetchers.getRqTestingList(client)
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Cleanup test jobs
|
|
41
|
+
*
|
|
42
|
+
* @method DELETE
|
|
43
|
+
* @path /cfg/rq/testing/cleanup/
|
|
44
|
+
*/
|
|
45
|
+
export function useDeleteRqTestingCleanupDestroy() {
|
|
46
|
+
const { mutate } = useSWRConfig()
|
|
47
|
+
|
|
48
|
+
return async (params?: { delete_demo_jobs_only?: boolean; queue?: string; registries?: string }, client?: API): Promise<TestingActionResponse> => {
|
|
49
|
+
const result = await Fetchers.deleteRqTestingCleanupDestroy(params, client)
|
|
50
|
+
// Revalidate related queries
|
|
51
|
+
mutate('cfg-rq-testing-cleanup')
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get test results
|
|
59
|
+
*
|
|
60
|
+
* @method GET
|
|
61
|
+
* @path /cfg/rq/testing/results/
|
|
62
|
+
*/
|
|
63
|
+
export function useRqTestingResultsRetrieve(params?: { queue?: string; scenario?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
64
|
+
return useSWR<any>(
|
|
65
|
+
params ? ['cfg-rq-testing-result', params] : 'cfg-rq-testing-result',
|
|
66
|
+
() => Fetchers.getRqTestingResultsRetrieve(params, client)
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Run demo task
|
|
73
|
+
*
|
|
74
|
+
* @method POST
|
|
75
|
+
* @path /cfg/rq/testing/run-demo/
|
|
76
|
+
*/
|
|
77
|
+
export function useCreateRqTestingRunDemoCreate() {
|
|
78
|
+
const { mutate } = useSWRConfig()
|
|
79
|
+
|
|
80
|
+
return async (data: RunDemoRequestRequest, client?: API): Promise<TestingActionResponse> => {
|
|
81
|
+
const result = await Fetchers.createRqTestingRunDemoCreate(data, client)
|
|
82
|
+
// Revalidate related queries
|
|
83
|
+
mutate('cfg-rq-testing-run-demo')
|
|
84
|
+
return result
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Schedule demo tasks
|
|
91
|
+
*
|
|
92
|
+
* @method POST
|
|
93
|
+
* @path /cfg/rq/testing/schedule-demo/
|
|
94
|
+
*/
|
|
95
|
+
export function useCreateRqTestingScheduleDemoCreate() {
|
|
96
|
+
const { mutate } = useSWRConfig()
|
|
97
|
+
|
|
98
|
+
return async (data: any, client?: API): Promise<TestingActionResponse> => {
|
|
99
|
+
const result = await Fetchers.createRqTestingScheduleDemoCreate(data, client)
|
|
100
|
+
// Revalidate related queries
|
|
101
|
+
mutate('cfg-rq-testing-schedule-demo')
|
|
102
|
+
return result
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Stress test
|
|
109
|
+
*
|
|
110
|
+
* @method POST
|
|
111
|
+
* @path /cfg/rq/testing/stress-test/
|
|
112
|
+
*/
|
|
113
|
+
export function useCreateRqTestingStressTestCreate() {
|
|
114
|
+
const { mutate } = useSWRConfig()
|
|
115
|
+
|
|
116
|
+
return async (data: StressTestRequestRequest, client?: API): Promise<TestingActionResponse> => {
|
|
117
|
+
const result = await Fetchers.createRqTestingStressTestCreate(data, client)
|
|
118
|
+
// Revalidate related queries
|
|
119
|
+
mutate('cfg-rq-testing-stress-test')
|
|
120
|
+
return result
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for RQ Workers
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__rq__rq_workers'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { WorkerStats } from '../schemas/WorkerStats.schema'
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* List all workers
|
|
25
|
+
*
|
|
26
|
+
* @method GET
|
|
27
|
+
* @path /cfg/rq/workers/
|
|
28
|
+
*/
|
|
29
|
+
export function useRqWorkersList(params?: { queue?: string; state?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
30
|
+
return useSWR<any>(
|
|
31
|
+
params ? ['cfg-rq-workers', params] : 'cfg-rq-workers',
|
|
32
|
+
() => Fetchers.getRqWorkersList(params, client)
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get worker statistics
|
|
39
|
+
*
|
|
40
|
+
* @method GET
|
|
41
|
+
* @path /cfg/rq/workers/stats/
|
|
42
|
+
*/
|
|
43
|
+
export function useRqWorkersStatsRetrieve(client?: API): ReturnType<typeof useSWR<WorkerStats>> {
|
|
44
|
+
return useSWR<WorkerStats>(
|
|
45
|
+
'cfg-rq-workers-stat',
|
|
46
|
+
() => Fetchers.getRqWorkersStatsRetrieve(client)
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
@@ -39,17 +39,23 @@ export * from './cfg__dashboard__dashboard_system'
|
|
|
39
39
|
export * from './cfg__leads__lead_submission'
|
|
40
40
|
export * from './cfg__newsletter__logs'
|
|
41
41
|
export * from './cfg__newsletter__newsletters'
|
|
42
|
+
export * from './cfg__rq__rq_jobs'
|
|
43
|
+
export * from './cfg__rq__rq_monitoring'
|
|
44
|
+
export * from './cfg__rq__rq_queues'
|
|
45
|
+
export * from './cfg__rq__rq_registries'
|
|
46
|
+
export * from './cfg__rq__rq_schedules'
|
|
47
|
+
export * from './cfg__rq__rq_testing'
|
|
48
|
+
export * from './cfg__rq__rq_workers'
|
|
42
49
|
export * from './cfg__newsletter__subscriptions'
|
|
43
50
|
export * from './cfg__newsletter__testing'
|
|
44
51
|
export * from './cfg__accounts__user_profile'
|
|
45
52
|
export * from './cfg__accounts'
|
|
46
53
|
export * from './cfg__centrifugo'
|
|
47
|
-
export * from './cfg__dashboard'
|
|
48
54
|
export * from './cfg__endpoints'
|
|
55
|
+
export * from './cfg__grpc__grpc_monitoring'
|
|
49
56
|
export * from './cfg__health'
|
|
50
57
|
export * from './cfg__knowbase'
|
|
51
58
|
export * from './cfg__leads'
|
|
52
59
|
export * from './cfg__newsletter'
|
|
53
60
|
export * from './cfg__payments'
|
|
54
61
|
export * from './cfg__support'
|
|
55
|
-
export * from './cfg__tasks'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for JobActionResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Job action response serializer.
|
|
6
|
+
|
|
7
|
+
Used for job management actions (requeue, delete, etc.).
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Job action response serializer.
|
|
13
|
+
|
|
14
|
+
Used for job management actions (requeue, delete, etc.).
|
|
15
|
+
*/
|
|
16
|
+
export const JobActionResponseSchema = z.object({
|
|
17
|
+
success: z.boolean(),
|
|
18
|
+
message: z.string(),
|
|
19
|
+
job_id: z.string(),
|
|
20
|
+
action: z.string(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Infer TypeScript type from Zod schema
|
|
25
|
+
*/
|
|
26
|
+
export type JobActionResponse = z.infer<typeof JobActionResponseSchema>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for JobDetail
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Detailed job information serializer.
|
|
6
|
+
|
|
7
|
+
Provides comprehensive job details including result and metadata.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Detailed job information serializer.
|
|
13
|
+
|
|
14
|
+
Provides comprehensive job details including result and metadata.
|
|
15
|
+
*/
|
|
16
|
+
export const JobDetailSchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
func_name: z.string(),
|
|
19
|
+
args: z.array(z.string()).optional(),
|
|
20
|
+
kwargs: z.record(z.string(), z.any()).optional(),
|
|
21
|
+
created_at: z.iso.datetime(),
|
|
22
|
+
enqueued_at: z.iso.datetime().nullable().optional(),
|
|
23
|
+
started_at: z.iso.datetime().nullable().optional(),
|
|
24
|
+
ended_at: z.iso.datetime().nullable().optional(),
|
|
25
|
+
status: z.string(),
|
|
26
|
+
queue: z.string(),
|
|
27
|
+
worker_name: z.string().nullable().optional(),
|
|
28
|
+
timeout: z.int().nullable().optional(),
|
|
29
|
+
result_ttl: z.int().nullable().optional(),
|
|
30
|
+
failure_ttl: z.int().nullable().optional(),
|
|
31
|
+
result: z.string().nullable().optional(),
|
|
32
|
+
exc_info: z.string().nullable().optional(),
|
|
33
|
+
meta: z.record(z.string(), z.any()).optional(),
|
|
34
|
+
dependency_ids: z.array(z.string()).optional(),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Infer TypeScript type from Zod schema
|
|
39
|
+
*/
|
|
40
|
+
export type JobDetail = z.infer<typeof JobDetailSchema>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for JobList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Job list item serializer.
|
|
6
|
+
|
|
7
|
+
Provides basic job information for list views.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Job list item serializer.
|
|
13
|
+
|
|
14
|
+
Provides basic job information for list views.
|
|
15
|
+
*/
|
|
16
|
+
export const JobListSchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
func_name: z.string(),
|
|
19
|
+
created_at: z.iso.datetime(),
|
|
20
|
+
status: z.string(),
|
|
21
|
+
queue: z.string(),
|
|
22
|
+
timeout: z.int().nullable().optional(),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Infer TypeScript type from Zod schema
|
|
27
|
+
*/
|
|
28
|
+
export type JobList = z.infer<typeof JobListSchema>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for MethodList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * List of gRPC methods with statistics.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { MethodStatsSerializerSchema } from './MethodStatsSerializer.schema'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* List of gRPC methods with statistics.
|
|
12
|
+
*/
|
|
13
|
+
export const MethodListSchema = z.object({
|
|
14
|
+
methods: z.array(MethodStatsSerializerSchema),
|
|
15
|
+
total_methods: z.int(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type MethodList = z.infer<typeof MethodListSchema>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for MethodStatsSerializer
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Statistics for a single gRPC method.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Statistics for a single gRPC method.
|
|
11
|
+
*/
|
|
12
|
+
export const MethodStatsSerializerSchema = z.object({
|
|
13
|
+
method_name: z.string(),
|
|
14
|
+
service_name: z.string(),
|
|
15
|
+
total: z.int(),
|
|
16
|
+
successful: z.int(),
|
|
17
|
+
errors: z.int(),
|
|
18
|
+
avg_duration_ms: z.number(),
|
|
19
|
+
last_activity_at: z.string().nullable(),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Infer TypeScript type from Zod schema
|
|
24
|
+
*/
|
|
25
|
+
export type MethodStatsSerializer = z.infer<typeof MethodStatsSerializerSchema>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for QueueDetail
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Detailed queue information serializer.
|
|
6
|
+
|
|
7
|
+
Provides comprehensive queue statistics and metadata.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Detailed queue information serializer.
|
|
13
|
+
|
|
14
|
+
Provides comprehensive queue statistics and metadata.
|
|
15
|
+
*/
|
|
16
|
+
export const QueueDetailSchema = z.object({
|
|
17
|
+
name: z.string(),
|
|
18
|
+
count: z.int(),
|
|
19
|
+
queued_jobs: z.int().optional(),
|
|
20
|
+
started_jobs: z.int().optional(),
|
|
21
|
+
finished_jobs: z.int().optional(),
|
|
22
|
+
failed_jobs: z.int().optional(),
|
|
23
|
+
deferred_jobs: z.int().optional(),
|
|
24
|
+
scheduled_jobs: z.int().optional(),
|
|
25
|
+
workers: z.int().optional(),
|
|
26
|
+
oldest_job_timestamp: z.iso.datetime().nullable().optional(),
|
|
27
|
+
connection_kwargs: z.record(z.string(), z.any()).optional(),
|
|
28
|
+
is_async: z.boolean().optional(),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Infer TypeScript type from Zod schema
|
|
33
|
+
*/
|
|
34
|
+
export type QueueDetail = z.infer<typeof QueueDetailSchema>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for QueueStats
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Queue statistics serializer.
|
|
6
|
+
|
|
7
|
+
Provides basic queue statistics.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Queue statistics serializer.
|
|
13
|
+
|
|
14
|
+
Provides basic queue statistics.
|
|
15
|
+
*/
|
|
16
|
+
export const QueueStatsSchema = z.object({
|
|
17
|
+
name: z.string(),
|
|
18
|
+
count: z.int(),
|
|
19
|
+
queued_jobs: z.int().optional(),
|
|
20
|
+
started_jobs: z.int().optional(),
|
|
21
|
+
finished_jobs: z.int().optional(),
|
|
22
|
+
failed_jobs: z.int().optional(),
|
|
23
|
+
deferred_jobs: z.int().optional(),
|
|
24
|
+
scheduled_jobs: z.int().optional(),
|
|
25
|
+
workers: z.int().optional(),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Infer TypeScript type from Zod schema
|
|
30
|
+
*/
|
|
31
|
+
export type QueueStats = z.infer<typeof QueueStatsSchema>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for RQConfig
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * RQ configuration serializer.
|
|
6
|
+
|
|
7
|
+
Returns current RQ configuration from django-cfg.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* RQ configuration serializer.
|
|
13
|
+
|
|
14
|
+
Returns current RQ configuration from django-cfg.
|
|
15
|
+
*/
|
|
16
|
+
export const RQConfigSchema = z.object({
|
|
17
|
+
enabled: z.boolean(),
|
|
18
|
+
queues: z.record(z.string(), z.any()),
|
|
19
|
+
async_mode: z.boolean().optional(),
|
|
20
|
+
show_admin_link: z.boolean().optional(),
|
|
21
|
+
prometheus_enabled: z.boolean().optional(),
|
|
22
|
+
api_token_configured: z.boolean().optional(),
|
|
23
|
+
schedules: z.array(z.string()).optional(),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Infer TypeScript type from Zod schema
|
|
28
|
+
*/
|
|
29
|
+
export type RQConfig = z.infer<typeof RQConfigSchema>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for RecentRequests
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Recent gRPC requests list.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Recent gRPC requests list.
|
|
11
|
+
*/
|
|
12
|
+
export const RecentRequestsSchema = z.object({
|
|
13
|
+
requests: 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 RecentRequests = z.infer<typeof RecentRequestsSchema>
|