@djangocfg/api 1.2.16 → 1.2.18
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 +1893 -1113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1616 -289
- package/dist/index.d.ts +1616 -289
- package/dist/index.mjs +1826 -1051
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard.ts +89 -0
- package/src/cfg/generated/_utils/fetchers/cfg__tasks.ts +9 -7
- package/src/cfg/generated/_utils/fetchers/index.ts +1 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard.ts +77 -0
- package/src/cfg/generated/_utils/hooks/cfg__tasks.ts +9 -7
- package/src/cfg/generated/_utils/hooks/index.ts +1 -0
- package/src/cfg/generated/_utils/schemas/DashboardOverview.schema.ts +16 -8
- package/src/cfg/generated/_utils/schemas/TaskLogOverview.schema.ts +43 -0
- package/src/cfg/generated/_utils/schemas/TaskLogTimeline.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/TaskLogTimelineItem.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/TasksByQueue.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/TasksByStatus.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/index.ts +5 -0
- package/src/cfg/generated/cfg__dashboard/client.ts +48 -0
- package/src/cfg/generated/cfg__dashboard/index.ts +2 -0
- package/src/cfg/generated/cfg__dashboard/models.ts +0 -0
- package/src/cfg/generated/cfg__dashboard__dashboard_overview/models.ts +179 -9
- package/src/cfg/generated/cfg__support/client.ts +30 -12
- package/src/cfg/generated/cfg__tasks/client.ts +38 -31
- package/src/cfg/generated/cfg__tasks/models.ts +82 -0
- package/src/cfg/generated/client.ts +3 -0
- package/src/cfg/generated/index.ts +5 -0
- package/src/cfg/generated/schema.ts +656 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
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.18",
|
|
72
72
|
"react": "^19.1.0",
|
|
73
73
|
"react-dom": "^19.1.0",
|
|
74
74
|
"tsup": "^8.5.0",
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed fetchers for Dashboard
|
|
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
|
+
|
|
34
|
+
/**
|
|
35
|
+
* API operation
|
|
36
|
+
*
|
|
37
|
+
* @method GET
|
|
38
|
+
* @path /cfg/dashboard/api/django_q2/
|
|
39
|
+
*/
|
|
40
|
+
export async function getDashboardApiDjangoQ2Retrieve( client?: any
|
|
41
|
+
): Promise<any> {
|
|
42
|
+
const api = client || getAPIInstance()
|
|
43
|
+
const response = await api.cfg_dashboard.apiDjangoQ2Retrieve()
|
|
44
|
+
return response
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* API operation
|
|
50
|
+
*
|
|
51
|
+
* @method GET
|
|
52
|
+
* @path /cfg/dashboard/api/django_q2/schedules/
|
|
53
|
+
*/
|
|
54
|
+
export async function getDashboardApiDjangoQ2SchedulesRetrieve( client?: any
|
|
55
|
+
): Promise<any> {
|
|
56
|
+
const api = client || getAPIInstance()
|
|
57
|
+
const response = await api.cfg_dashboard.apiDjangoQ2SchedulesRetrieve()
|
|
58
|
+
return response
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* API operation
|
|
64
|
+
*
|
|
65
|
+
* @method GET
|
|
66
|
+
* @path /cfg/dashboard/api/django_q2/status/
|
|
67
|
+
*/
|
|
68
|
+
export async function getDashboardApiDjangoQ2StatusRetrieve( client?: any
|
|
69
|
+
): Promise<any> {
|
|
70
|
+
const api = client || getAPIInstance()
|
|
71
|
+
const response = await api.cfg_dashboard.apiDjangoQ2StatusRetrieve()
|
|
72
|
+
return response
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* API operation
|
|
78
|
+
*
|
|
79
|
+
* @method GET
|
|
80
|
+
* @path /cfg/dashboard/api/django_q2/tasks/
|
|
81
|
+
*/
|
|
82
|
+
export async function getDashboardApiDjangoQ2TasksRetrieve( client?: any
|
|
83
|
+
): Promise<any> {
|
|
84
|
+
const api = client || getAPIInstance()
|
|
85
|
+
const response = await api.cfg_dashboard.apiDjangoQ2TasksRetrieve()
|
|
86
|
+
return response
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
import { PaginatedTaskLogListListSchema, type PaginatedTaskLogListList } from '../schemas/PaginatedTaskLogListList.schema'
|
|
33
33
|
import { TaskLogSchema, type TaskLog } from '../schemas/TaskLog.schema'
|
|
34
34
|
import { TaskLogDetailSchema, type TaskLogDetail } from '../schemas/TaskLogDetail.schema'
|
|
35
|
+
import { TaskLogOverviewSchema, type TaskLogOverview } from '../schemas/TaskLogOverview.schema'
|
|
35
36
|
import { TaskLogStatsSchema, type TaskLogStats } from '../schemas/TaskLogStats.schema'
|
|
37
|
+
import { TaskLogTimelineSchema, type TaskLogTimeline } from '../schemas/TaskLogTimeline.schema'
|
|
36
38
|
import { getAPIInstance } from '../../api-instance'
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -78,21 +80,21 @@ export async function getTasksLogsRelatedRetrieve( id: number, client?: any
|
|
|
78
80
|
|
|
79
81
|
|
|
80
82
|
/**
|
|
81
|
-
*
|
|
83
|
+
* Task System Overview
|
|
82
84
|
*
|
|
83
85
|
* @method GET
|
|
84
86
|
* @path /cfg/tasks/logs/overview/
|
|
85
87
|
*/
|
|
86
88
|
export async function getTasksLogsOverviewRetrieve( client?: any
|
|
87
|
-
): Promise<
|
|
89
|
+
): Promise<TaskLogOverview> {
|
|
88
90
|
const api = client || getAPIInstance()
|
|
89
91
|
const response = await api.cfg_tasks.logsOverviewRetrieve()
|
|
90
|
-
return
|
|
92
|
+
return TaskLogOverviewSchema.parse(response)
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
|
|
94
96
|
/**
|
|
95
|
-
*
|
|
97
|
+
* Task Execution Statistics
|
|
96
98
|
*
|
|
97
99
|
* @method GET
|
|
98
100
|
* @path /cfg/tasks/logs/stats/
|
|
@@ -106,16 +108,16 @@ export async function getTasksLogsStatsRetrieve( client?: any
|
|
|
106
108
|
|
|
107
109
|
|
|
108
110
|
/**
|
|
109
|
-
*
|
|
111
|
+
* Task Execution Timeline
|
|
110
112
|
*
|
|
111
113
|
* @method GET
|
|
112
114
|
* @path /cfg/tasks/logs/timeline/
|
|
113
115
|
*/
|
|
114
116
|
export async function getTasksLogsTimelineRetrieve( client?: any
|
|
115
|
-
): Promise<
|
|
117
|
+
): Promise<TaskLogTimeline> {
|
|
116
118
|
const api = client || getAPIInstance()
|
|
117
119
|
const response = await api.cfg_tasks.logsTimelineRetrieve()
|
|
118
|
-
return
|
|
120
|
+
return TaskLogTimelineSchema.parse(response)
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
|
|
@@ -32,6 +32,7 @@ export * from './cfg__centrifugo'
|
|
|
32
32
|
export * from './cfg__centrifugo__centrifugo_admin_api'
|
|
33
33
|
export * from './cfg__centrifugo__centrifugo_monitoring'
|
|
34
34
|
export * from './cfg__centrifugo__centrifugo_testing'
|
|
35
|
+
export * from './cfg__dashboard'
|
|
35
36
|
export * from './cfg__dashboard__dashboard_activity'
|
|
36
37
|
export * from './cfg__dashboard__dashboard_api_zones'
|
|
37
38
|
export * from './cfg__dashboard__dashboard_charts'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for Dashboard
|
|
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__dashboard'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* API operation
|
|
24
|
+
*
|
|
25
|
+
* @method GET
|
|
26
|
+
* @path /cfg/dashboard/api/django_q2/
|
|
27
|
+
*/
|
|
28
|
+
export function useDashboardApiDjangoQ2Retrieve(client?: API): ReturnType<typeof useSWR<any>> {
|
|
29
|
+
return useSWR<any>(
|
|
30
|
+
'cfg-dashboard-api-django-q2',
|
|
31
|
+
() => Fetchers.getDashboardApiDjangoQ2Retrieve(client)
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* API operation
|
|
38
|
+
*
|
|
39
|
+
* @method GET
|
|
40
|
+
* @path /cfg/dashboard/api/django_q2/schedules/
|
|
41
|
+
*/
|
|
42
|
+
export function useDashboardApiDjangoQ2SchedulesRetrieve(client?: API): ReturnType<typeof useSWR<any>> {
|
|
43
|
+
return useSWR<any>(
|
|
44
|
+
'cfg-dashboard-api-django-q2-schedule',
|
|
45
|
+
() => Fetchers.getDashboardApiDjangoQ2SchedulesRetrieve(client)
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* API operation
|
|
52
|
+
*
|
|
53
|
+
* @method GET
|
|
54
|
+
* @path /cfg/dashboard/api/django_q2/status/
|
|
55
|
+
*/
|
|
56
|
+
export function useDashboardApiDjangoQ2StatusRetrieve(client?: API): ReturnType<typeof useSWR<any>> {
|
|
57
|
+
return useSWR<any>(
|
|
58
|
+
'cfg-dashboard-api-django-q2-statu',
|
|
59
|
+
() => Fetchers.getDashboardApiDjangoQ2StatusRetrieve(client)
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* API operation
|
|
66
|
+
*
|
|
67
|
+
* @method GET
|
|
68
|
+
* @path /cfg/dashboard/api/django_q2/tasks/
|
|
69
|
+
*/
|
|
70
|
+
export function useDashboardApiDjangoQ2TasksRetrieve(client?: API): ReturnType<typeof useSWR<any>> {
|
|
71
|
+
return useSWR<any>(
|
|
72
|
+
'cfg-dashboard-api-django-q2-task',
|
|
73
|
+
() => Fetchers.getDashboardApiDjangoQ2TasksRetrieve(client)
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
@@ -21,7 +21,9 @@ import type { API } from '../../index'
|
|
|
21
21
|
import type { PaginatedTaskLogListList } from '../schemas/PaginatedTaskLogListList.schema'
|
|
22
22
|
import type { TaskLog } from '../schemas/TaskLog.schema'
|
|
23
23
|
import type { TaskLogDetail } from '../schemas/TaskLogDetail.schema'
|
|
24
|
+
import type { TaskLogOverview } from '../schemas/TaskLogOverview.schema'
|
|
24
25
|
import type { TaskLogStats } from '../schemas/TaskLogStats.schema'
|
|
26
|
+
import type { TaskLogTimeline } from '../schemas/TaskLogTimeline.schema'
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* API operation
|
|
@@ -66,13 +68,13 @@ export function useTasksLogsRelatedRetrieve(id: number, client?: API): ReturnTyp
|
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
71
|
+
* Task System Overview
|
|
70
72
|
*
|
|
71
73
|
* @method GET
|
|
72
74
|
* @path /cfg/tasks/logs/overview/
|
|
73
75
|
*/
|
|
74
|
-
export function useTasksLogsOverviewRetrieve(client?: API): ReturnType<typeof useSWR<
|
|
75
|
-
return useSWR<
|
|
76
|
+
export function useTasksLogsOverviewRetrieve(client?: API): ReturnType<typeof useSWR<TaskLogOverview>> {
|
|
77
|
+
return useSWR<TaskLogOverview>(
|
|
76
78
|
'cfg-tasks-logs-overview',
|
|
77
79
|
() => Fetchers.getTasksLogsOverviewRetrieve(client)
|
|
78
80
|
)
|
|
@@ -80,7 +82,7 @@ export function useTasksLogsOverviewRetrieve(client?: API): ReturnType<typeof us
|
|
|
80
82
|
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
|
-
*
|
|
85
|
+
* Task Execution Statistics
|
|
84
86
|
*
|
|
85
87
|
* @method GET
|
|
86
88
|
* @path /cfg/tasks/logs/stats/
|
|
@@ -94,13 +96,13 @@ export function useTasksLogsStatsRetrieve(client?: API): ReturnType<typeof useSW
|
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
/**
|
|
97
|
-
*
|
|
99
|
+
* Task Execution Timeline
|
|
98
100
|
*
|
|
99
101
|
* @method GET
|
|
100
102
|
* @path /cfg/tasks/logs/timeline/
|
|
101
103
|
*/
|
|
102
|
-
export function useTasksLogsTimelineRetrieve(client?: API): ReturnType<typeof useSWR<
|
|
103
|
-
return useSWR<
|
|
104
|
+
export function useTasksLogsTimelineRetrieve(client?: API): ReturnType<typeof useSWR<TaskLogTimeline>> {
|
|
105
|
+
return useSWR<TaskLogTimeline>(
|
|
104
106
|
'cfg-tasks-logs-timeline',
|
|
105
107
|
() => Fetchers.getTasksLogsTimelineRetrieve(client)
|
|
106
108
|
)
|
|
@@ -44,6 +44,7 @@ export * from './cfg__newsletter__testing'
|
|
|
44
44
|
export * from './cfg__accounts__user_profile'
|
|
45
45
|
export * from './cfg__accounts'
|
|
46
46
|
export * from './cfg__centrifugo'
|
|
47
|
+
export * from './cfg__dashboard'
|
|
47
48
|
export * from './cfg__endpoints'
|
|
48
49
|
export * from './cfg__health'
|
|
49
50
|
export * from './cfg__knowbase'
|
|
@@ -3,21 +3,29 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This schema provides runtime validation and type inference.
|
|
5
5
|
* * Main serializer for dashboard overview endpoint.
|
|
6
|
-
Uses
|
|
6
|
+
Uses typed serializers for proper OpenAPI schema generation.
|
|
7
7
|
* */
|
|
8
8
|
import { z } from 'zod'
|
|
9
|
+
import { ActivityEntrySchema } from './ActivityEntry.schema'
|
|
10
|
+
import { AppStatisticsSchema } from './AppStatistics.schema'
|
|
11
|
+
import { QuickActionSchema } from './QuickAction.schema'
|
|
12
|
+
import { StatCardSchema } from './StatCard.schema'
|
|
13
|
+
import { SystemHealthSchema } from './SystemHealth.schema'
|
|
14
|
+
import { SystemMetricsSchema } from './SystemMetrics.schema'
|
|
15
|
+
import { UserStatisticsSchema } from './UserStatistics.schema'
|
|
9
16
|
|
|
10
17
|
/**
|
|
11
18
|
* Main serializer for dashboard overview endpoint.
|
|
12
|
-
Uses
|
|
19
|
+
Uses typed serializers for proper OpenAPI schema generation.
|
|
13
20
|
*/
|
|
14
21
|
export const DashboardOverviewSchema = z.object({
|
|
15
|
-
stat_cards: z.array(
|
|
16
|
-
system_health:
|
|
17
|
-
quick_actions: z.array(
|
|
18
|
-
recent_activity: z.array(
|
|
19
|
-
system_metrics:
|
|
20
|
-
user_statistics:
|
|
22
|
+
stat_cards: z.array(StatCardSchema),
|
|
23
|
+
system_health: SystemHealthSchema,
|
|
24
|
+
quick_actions: z.array(QuickActionSchema),
|
|
25
|
+
recent_activity: z.array(ActivityEntrySchema),
|
|
26
|
+
system_metrics: SystemMetricsSchema,
|
|
27
|
+
user_statistics: UserStatisticsSchema,
|
|
28
|
+
app_statistics: z.array(AppStatisticsSchema).optional(),
|
|
21
29
|
timestamp: z.string(),
|
|
22
30
|
})
|
|
23
31
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for TaskLogOverview
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Overview of task system with proper structure.
|
|
6
|
+
|
|
7
|
+
Provides high-level statistics about the entire task system:
|
|
8
|
+
- Total tasks count (all-time)
|
|
9
|
+
- Active queues list
|
|
10
|
+
- Recent failures (last 24h)
|
|
11
|
+
- Tasks distribution by queue (as array)
|
|
12
|
+
- Tasks distribution by status (as array)
|
|
13
|
+
|
|
14
|
+
Used by /cfg/tasks/logs/overview/ endpoint.
|
|
15
|
+
* */
|
|
16
|
+
import { z } from 'zod'
|
|
17
|
+
import { TasksByQueueSchema } from './TasksByQueue.schema'
|
|
18
|
+
import { TasksByStatusSchema } from './TasksByStatus.schema'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Overview of task system with proper structure.
|
|
22
|
+
|
|
23
|
+
Provides high-level statistics about the entire task system:
|
|
24
|
+
- Total tasks count (all-time)
|
|
25
|
+
- Active queues list
|
|
26
|
+
- Recent failures (last 24h)
|
|
27
|
+
- Tasks distribution by queue (as array)
|
|
28
|
+
- Tasks distribution by status (as array)
|
|
29
|
+
|
|
30
|
+
Used by /cfg/tasks/logs/overview/ endpoint.
|
|
31
|
+
*/
|
|
32
|
+
export const TaskLogOverviewSchema = z.object({
|
|
33
|
+
total_tasks: z.int(),
|
|
34
|
+
active_queues: z.array(z.string()),
|
|
35
|
+
recent_failures: z.int(),
|
|
36
|
+
tasks_by_queue: z.array(TasksByQueueSchema),
|
|
37
|
+
tasks_by_status: z.array(TasksByStatusSchema),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Infer TypeScript type from Zod schema
|
|
42
|
+
*/
|
|
43
|
+
export type TaskLogOverview = z.infer<typeof TaskLogOverviewSchema>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for TaskLogTimeline
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Timeline response wrapper.
|
|
6
|
+
|
|
7
|
+
Returns timeline data as array of time-bucketed statistics.
|
|
8
|
+
Used by /cfg/tasks/logs/timeline/ endpoint.
|
|
9
|
+
* */
|
|
10
|
+
import { z } from 'zod'
|
|
11
|
+
import { TaskLogTimelineItemSchema } from './TaskLogTimelineItem.schema'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Timeline response wrapper.
|
|
15
|
+
|
|
16
|
+
Returns timeline data as array of time-bucketed statistics.
|
|
17
|
+
Used by /cfg/tasks/logs/timeline/ endpoint.
|
|
18
|
+
*/
|
|
19
|
+
export const TaskLogTimelineSchema = z.object({
|
|
20
|
+
period_hours: z.int(),
|
|
21
|
+
interval: z.string(),
|
|
22
|
+
data: z.array(TaskLogTimelineItemSchema),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Infer TypeScript type from Zod schema
|
|
27
|
+
*/
|
|
28
|
+
export type TaskLogTimeline = z.infer<typeof TaskLogTimelineSchema>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for TaskLogTimelineItem
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Single timeline data point.
|
|
6
|
+
|
|
7
|
+
Represents aggregated task statistics for a specific time period.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Single timeline data point.
|
|
13
|
+
|
|
14
|
+
Represents aggregated task statistics for a specific time period.
|
|
15
|
+
*/
|
|
16
|
+
export const TaskLogTimelineItemSchema = z.object({
|
|
17
|
+
timestamp: z.iso.datetime(),
|
|
18
|
+
total: z.int(),
|
|
19
|
+
successful: z.int(),
|
|
20
|
+
failed: z.int(),
|
|
21
|
+
in_progress: z.int().optional(),
|
|
22
|
+
avg_duration_ms: z.number().optional(),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Infer TypeScript type from Zod schema
|
|
27
|
+
*/
|
|
28
|
+
export type TaskLogTimelineItem = z.infer<typeof TaskLogTimelineItemSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for TasksByQueue
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Tasks count by queue.
|
|
6
|
+
|
|
7
|
+
Used in overview endpoint for tasks_by_queue list.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tasks count by queue.
|
|
13
|
+
|
|
14
|
+
Used in overview endpoint for tasks_by_queue list.
|
|
15
|
+
*/
|
|
16
|
+
export const TasksByQueueSchema = z.object({
|
|
17
|
+
queue_name: z.string(),
|
|
18
|
+
count: z.int(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type TasksByQueue = z.infer<typeof TasksByQueueSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for TasksByStatus
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Tasks count by status.
|
|
6
|
+
|
|
7
|
+
Used in overview endpoint for tasks_by_status list.
|
|
8
|
+
* */
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tasks count by status.
|
|
13
|
+
|
|
14
|
+
Used in overview endpoint for tasks_by_status list.
|
|
15
|
+
*/
|
|
16
|
+
export const TasksByStatusSchema = z.object({
|
|
17
|
+
status: z.string(),
|
|
18
|
+
count: z.int(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type TasksByStatus = z.infer<typeof TasksByStatusSchema>
|
|
@@ -169,7 +169,12 @@ export * from './SystemMetrics.schema'
|
|
|
169
169
|
export * from './TaskLog.schema'
|
|
170
170
|
export * from './TaskLogDetail.schema'
|
|
171
171
|
export * from './TaskLogList.schema'
|
|
172
|
+
export * from './TaskLogOverview.schema'
|
|
172
173
|
export * from './TaskLogStats.schema'
|
|
174
|
+
export * from './TaskLogTimeline.schema'
|
|
175
|
+
export * from './TaskLogTimelineItem.schema'
|
|
176
|
+
export * from './TasksByQueue.schema'
|
|
177
|
+
export * from './TasksByStatus.schema'
|
|
173
178
|
export * from './TestEmailRequest.schema'
|
|
174
179
|
export * from './Ticket.schema'
|
|
175
180
|
export * from './TicketRequest.schema'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as Models from "./models";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* API endpoints for Dashboard.
|
|
6
|
+
*/
|
|
7
|
+
export class CfgDashboard {
|
|
8
|
+
private client: any;
|
|
9
|
+
|
|
10
|
+
constructor(client: any) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get complete Django-Q2 summary. GET /api/django_q2/ Returns status,
|
|
16
|
+
* schedules, and recent tasks.
|
|
17
|
+
*/
|
|
18
|
+
async apiDjangoQ2Retrieve(): Promise<any> {
|
|
19
|
+
const response = await this.client.request('GET', "/cfg/dashboard/api/django_q2/");
|
|
20
|
+
return response;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get all scheduled tasks. GET /api/django_q2/schedules/
|
|
25
|
+
*/
|
|
26
|
+
async apiDjangoQ2SchedulesRetrieve(): Promise<any> {
|
|
27
|
+
const response = await this.client.request('GET', "/cfg/dashboard/api/django_q2/schedules/");
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get Django-Q2 cluster status. GET /api/django_q2/status/
|
|
33
|
+
*/
|
|
34
|
+
async apiDjangoQ2StatusRetrieve(): Promise<any> {
|
|
35
|
+
const response = await this.client.request('GET', "/cfg/dashboard/api/django_q2/status/");
|
|
36
|
+
return response;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get recent task executions. GET /api/django_q2/tasks/ Query params: -
|
|
41
|
+
* limit: Number of tasks to return (default: 20)
|
|
42
|
+
*/
|
|
43
|
+
async apiDjangoQ2TasksRetrieve(): Promise<any> {
|
|
44
|
+
const response = await this.client.request('GET', "/cfg/dashboard/api/django_q2/tasks/");
|
|
45
|
+
return response;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
File without changes
|