@adminforth/dashboard 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +103 -15
  2. package/custom/api/dashboardApi.ts +9 -8
  3. package/custom/model/dashboard.types.ts +63 -270
  4. package/custom/model/dashboardTopics.ts +5 -0
  5. package/custom/runtime/DashboardGroup.vue +2 -2
  6. package/custom/runtime/DashboardPage.vue +17 -7
  7. package/custom/runtime/DashboardRuntime.vue +20 -8
  8. package/custom/runtime/WidgetRenderer.vue +1 -2
  9. package/custom/runtime/WidgetShell.vue +3 -3
  10. package/custom/skills/adminforth-dashboard/SKILL.md +110 -3
  11. package/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
  12. package/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
  13. package/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
  14. package/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
  15. package/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
  16. package/custom/widgets/chart/ChartWidget.vue +24 -18
  17. package/{dist/custom/widgets/chart/funnel → custom/widgets/chart}/FunnelChart.vue +80 -78
  18. package/{dist/custom/widgets/chart/line → custom/widgets/chart}/LineChart.vue +2 -2
  19. package/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
  20. package/{dist/custom/widgets/chart/stacked-bar → custom/widgets/chart}/StackedBarChart.vue +97 -95
  21. package/custom/widgets/chart/chart.types.ts +0 -28
  22. package/dist/custom/api/dashboardApi.d.ts +4 -7
  23. package/dist/custom/api/dashboardApi.js +5 -0
  24. package/dist/custom/api/dashboardApi.ts +9 -8
  25. package/dist/custom/model/dashboard.types.d.ts +40 -31
  26. package/dist/custom/model/dashboard.types.js +13 -152
  27. package/dist/custom/model/dashboard.types.ts +63 -270
  28. package/dist/custom/model/dashboardTopics.d.ts +2 -0
  29. package/dist/custom/model/dashboardTopics.js +8 -0
  30. package/dist/custom/model/dashboardTopics.ts +5 -0
  31. package/dist/custom/queries/useDashboardConfig.d.ts +116 -96
  32. package/dist/custom/queries/useWidgetData.d.ts +116 -96
  33. package/dist/custom/runtime/DashboardGroup.vue +2 -2
  34. package/dist/custom/runtime/DashboardPage.vue +17 -7
  35. package/dist/custom/runtime/DashboardRuntime.vue +20 -8
  36. package/dist/custom/runtime/WidgetRenderer.vue +1 -2
  37. package/dist/custom/runtime/WidgetShell.vue +3 -3
  38. package/dist/custom/skills/adminforth-dashboard/SKILL.md +110 -3
  39. package/dist/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
  40. package/dist/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
  41. package/dist/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
  42. package/dist/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
  43. package/dist/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
  44. package/dist/custom/widgets/chart/ChartWidget.vue +24 -18
  45. package/{custom/widgets/chart/funnel → dist/custom/widgets/chart}/FunnelChart.vue +80 -78
  46. package/{custom/widgets/chart/line → dist/custom/widgets/chart}/LineChart.vue +2 -2
  47. package/dist/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
  48. package/{custom/widgets/chart/stacked-bar → dist/custom/widgets/chart}/StackedBarChart.vue +97 -95
  49. package/dist/custom/widgets/chart/chart.types.d.ts +0 -2
  50. package/dist/custom/widgets/chart/chart.types.js +0 -23
  51. package/dist/custom/widgets/chart/chart.types.ts +0 -28
  52. package/dist/endpoint/dashboard.d.ts +6 -2
  53. package/dist/endpoint/dashboard.js +29 -5
  54. package/dist/endpoint/groups.d.ts +2 -21
  55. package/dist/endpoint/groups.js +18 -16
  56. package/dist/endpoint/widgets.d.ts +2 -4
  57. package/dist/endpoint/widgets.js +28 -74
  58. package/dist/index.js +1 -3
  59. package/dist/schema/api.d.ts +2172 -500
  60. package/dist/schema/api.js +21 -13
  61. package/dist/schema/widget.d.ts +1076 -263
  62. package/dist/schema/widget.js +108 -49
  63. package/dist/services/dashboardConfigService.d.ts +0 -10
  64. package/dist/services/dashboardConfigService.js +6 -21
  65. package/dist/services/widgetDataService.d.ts +2 -1
  66. package/dist/services/widgetDataService.js +266 -206
  67. package/endpoint/dashboard.ts +47 -7
  68. package/endpoint/groups.ts +25 -42
  69. package/endpoint/widgets.ts +41 -96
  70. package/index.ts +0 -3
  71. package/package.json +3 -3
  72. package/schema/api.ts +23 -13
  73. package/schema/widget.ts +119 -55
  74. package/services/dashboardConfigService.ts +6 -25
  75. package/services/widgetDataService.ts +350 -237
  76. package/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
  77. package/dist/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
  78. package/dist/services/widgetConfigValidator.d.ts +0 -8
  79. package/dist/services/widgetConfigValidator.js +0 -27
  80. package/services/widgetConfigValidator.ts +0 -61
@@ -1,30 +1,11 @@
1
1
  import type { AdminUser, IHttpServer } from 'adminforth';
2
2
  import type { DashboardConfig } from '../custom/model/dashboard.types.js';
3
- type DashboardRecord = {
4
- id: string;
5
- slug: string;
6
- label: string;
7
- revision: number;
8
- config: unknown;
9
- };
3
+ import type { DashboardRecord, PersistedDashboardResponse } from '../services/dashboardConfigService.js';
10
4
  type GroupEndpointsContext = {
11
5
  canEditDashboard: (adminUser: AdminUser) => boolean;
12
6
  getDashboardRecord: (slug: string) => Promise<DashboardRecord | null>;
13
7
  parseStoredDashboardConfig: (config: unknown) => DashboardConfig;
14
- persistDashboardConfig: (dashboard: DashboardRecord, config: DashboardConfig) => Promise<{
15
- id: string;
16
- slug: string;
17
- label: string;
18
- revision: number;
19
- config: DashboardConfig;
20
- }>;
21
- buildDashboardResponse: (dashboard: DashboardRecord) => {
22
- id: string;
23
- slug: string;
24
- label: string;
25
- revision: number;
26
- config: DashboardConfig;
27
- };
8
+ persistDashboardConfig: (dashboard: DashboardRecord, config: DashboardConfig) => Promise<PersistedDashboardResponse>;
28
9
  };
29
10
  export declare function registerGroupEndpoints(server: IHttpServer, ctx: GroupEndpointsContext): void;
30
11
  export {};
@@ -21,8 +21,7 @@ export function registerGroupEndpoints(server, ctx) {
21
21
  response.setStatus(403);
22
22
  return { error: 'Dashboard edit is not allowed' };
23
23
  }
24
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
25
- const dashboard = yield ctx.getDashboardRecord(slug);
24
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
26
25
  if (!dashboard) {
27
26
  response.setStatus(404);
28
27
  return { error: 'Dashboard not found' };
@@ -48,9 +47,8 @@ export function registerGroupEndpoints(server, ctx) {
48
47
  response.setStatus(403);
49
48
  return { error: 'Dashboard edit is not allowed' };
50
49
  }
51
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
52
- const groupId = String((body === null || body === void 0 ? void 0 : body.groupId) || '');
53
- const dashboard = yield ctx.getDashboardRecord(slug);
50
+ const groupId = body.groupId;
51
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
54
52
  if (!dashboard) {
55
53
  response.setStatus(404);
56
54
  return { error: 'Dashboard not found' };
@@ -61,8 +59,10 @@ export function registerGroupEndpoints(server, ctx) {
61
59
  response.setStatus(404);
62
60
  return { error: 'Dashboard group not found' };
63
61
  }
62
+ const nextGroup = Object.assign(Object.assign({}, body.config), { id: group.id, order: group.order });
64
63
  return ctx.persistDashboardConfig(dashboard, Object.assign(Object.assign({}, config), { groups: config.groups.map((item) => item.id === groupId
65
- ? Object.assign(Object.assign({}, body.config), { id: group.id, order: group.order }) : item) }));
64
+ ? nextGroup
65
+ : item) }));
66
66
  }),
67
67
  });
68
68
  server.endpoint({
@@ -76,24 +76,27 @@ export function registerGroupEndpoints(server, ctx) {
76
76
  response.setStatus(403);
77
77
  return { error: 'Dashboard edit is not allowed' };
78
78
  }
79
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
80
- const groupId = String((body === null || body === void 0 ? void 0 : body.groupId) || '');
81
- const direction = (body === null || body === void 0 ? void 0 : body.direction) === 'down' ? 'down' : 'up';
82
- const dashboard = yield ctx.getDashboardRecord(slug);
79
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
83
80
  if (!dashboard) {
84
81
  response.setStatus(404);
85
82
  return { error: 'Dashboard not found' };
86
83
  }
87
84
  const config = ctx.parseStoredDashboardConfig(dashboard.config);
88
85
  const sortedGroups = [...config.groups].sort((a, b) => a.order - b.order);
89
- const currentIndex = sortedGroups.findIndex((group) => group.id === groupId);
86
+ const currentIndex = sortedGroups.findIndex((group) => group.id === body.groupId);
90
87
  if (currentIndex === -1) {
91
88
  response.setStatus(404);
92
89
  return { error: 'Dashboard group not found' };
93
90
  }
94
- const targetIndex = direction === 'up' ? currentIndex - 1 : currentIndex + 1;
91
+ const targetIndex = body.direction === 'up' ? currentIndex - 1 : currentIndex + 1;
95
92
  if (targetIndex < 0 || targetIndex >= sortedGroups.length) {
96
- return ctx.buildDashboardResponse(dashboard);
93
+ return {
94
+ id: dashboard.id,
95
+ slug: dashboard.slug,
96
+ label: dashboard.label,
97
+ revision: dashboard.revision,
98
+ config: ctx.parseStoredDashboardConfig(dashboard.config),
99
+ };
97
100
  }
98
101
  const reorderedGroups = [...sortedGroups];
99
102
  const [group] = reorderedGroups.splice(currentIndex, 1);
@@ -112,9 +115,8 @@ export function registerGroupEndpoints(server, ctx) {
112
115
  response.setStatus(403);
113
116
  return { error: 'Dashboard edit is not allowed' };
114
117
  }
115
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
116
- const groupId = String((body === null || body === void 0 ? void 0 : body.groupId) || '');
117
- const dashboard = yield ctx.getDashboardRecord(slug);
118
+ const groupId = body.groupId;
119
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
118
120
  if (!dashboard) {
119
121
  response.setStatus(404);
120
122
  return { error: 'Dashboard not found' };
@@ -1,19 +1,17 @@
1
1
  import type { AdminUser, IHttpServer } from 'adminforth';
2
- import type { DashboardConfig, DashboardWidgetConfig } from '../custom/model/dashboard.types.js';
3
- import type { DashboardWidgetConfigValidationError } from '../schema/widget.js';
2
+ import type { DashboardConfig, DashboardVariables, DashboardWidgetConfig } from '../custom/model/dashboard.types.js';
4
3
  import type { DashboardRecord, PersistedDashboardResponse } from '../services/dashboardConfigService.js';
5
4
  type WidgetEndpointsContext = {
6
5
  canEditDashboard: (adminUser: AdminUser) => boolean;
7
6
  getDashboardRecord: (slug: string) => Promise<DashboardRecord | null>;
8
7
  parseStoredDashboardConfig: (config: unknown) => DashboardConfig;
9
8
  persistDashboardConfig: (dashboard: DashboardRecord, config: DashboardConfig) => Promise<PersistedDashboardResponse>;
10
- buildDashboardResponse: (dashboard: DashboardRecord) => PersistedDashboardResponse;
11
- validateDashboardWidgetApiConfig: (widget: DashboardWidgetConfig) => DashboardWidgetConfigValidationError[];
12
9
  getWidgetData: (widget: DashboardWidgetConfig, options?: {
13
10
  pagination?: {
14
11
  page: number;
15
12
  pageSize: number;
16
13
  };
14
+ variables?: DashboardVariables;
17
15
  }) => Promise<unknown>;
18
16
  };
19
17
  export declare function registerWidgetEndpoints(server: IHttpServer, ctx: WidgetEndpointsContext): void;
@@ -8,35 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { randomUUID } from 'crypto';
11
- import { normalizeDashboardWidgetConfig, } from '../custom/model/dashboard.types.js';
12
11
  import { DashboardApiResponseSchema, DashboardWidgetDataResponseSchema, GroupIdRequestSchema, MoveWidgetRequestSchema, SetWidgetConfigRequestSchema, WidgetDataRequestSchema, WidgetIdRequestSchema, } from '../schema/api.js';
13
- import { StoredWidgetConfigSchema } from '../schema/widget.js';
14
- function formatWidgetConfigValidationErrors(error) {
15
- return error.issues.map((issue) => ({
16
- field: issue.path.length ? formatWidgetConfigFieldPath(issue.path.map(String).join('.')) : 'config',
17
- message: issue.message,
18
- }));
19
- }
20
- function formatWidgetConfigApiValidationErrors(errors) {
21
- return errors.map((error) => (Object.assign(Object.assign({}, error), { field: formatWidgetConfigFieldPath(error.field) })));
22
- }
23
- function formatWidgetConfigFieldPath(field) {
24
- const fieldAliases = new Map([
25
- ['minWidth', 'min_width'],
26
- ['maxWidth', 'max_width'],
27
- ['groupBy', 'group_by'],
28
- ['orderBy', 'order_by'],
29
- ['pageSize', 'page_size'],
30
- ['timeSeries', 'time_series'],
31
- ['valueField', 'value_field'],
32
- ['targetValue', 'target_value'],
33
- ['targetField', 'target_field'],
34
- ]);
35
- return field
36
- .split('.')
37
- .map((segment) => { var _a; return (_a = fieldAliases.get(segment)) !== null && _a !== void 0 ? _a : segment; })
38
- .join('.');
39
- }
40
12
  export function registerWidgetEndpoints(server, ctx) {
41
13
  server.endpoint({
42
14
  method: 'POST',
@@ -49,23 +21,21 @@ export function registerWidgetEndpoints(server, ctx) {
49
21
  response.setStatus(403);
50
22
  return { error: 'Dashboard edit is not allowed' };
51
23
  }
52
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
53
- const groupId = String((body === null || body === void 0 ? void 0 : body.groupId) || '');
54
- const dashboard = yield ctx.getDashboardRecord(slug);
24
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
55
25
  if (!dashboard) {
56
26
  response.setStatus(404);
57
27
  return { error: 'Dashboard not found' };
58
28
  }
59
29
  const config = ctx.parseStoredDashboardConfig(dashboard.config);
60
- const group = config.groups.find((item) => item.id === groupId);
30
+ const group = config.groups.find((item) => item.id === body.groupId);
61
31
  if (!group) {
62
32
  response.setStatus(404);
63
33
  return { error: 'Dashboard group not found' };
64
34
  }
65
- const nextOrder = config.widgets.filter((item) => item.group_id === groupId).length + 1;
35
+ const nextOrder = config.widgets.filter((item) => item.group_id === body.groupId).length + 1;
66
36
  const widget = {
67
37
  id: `widget_${randomUUID()}`,
68
- group_id: groupId,
38
+ group_id: body.groupId,
69
39
  label: 'New widget',
70
40
  size: 'small',
71
41
  order: nextOrder,
@@ -85,16 +55,13 @@ export function registerWidgetEndpoints(server, ctx) {
85
55
  response.setStatus(403);
86
56
  return { error: 'Dashboard edit is not allowed' };
87
57
  }
88
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
89
- const widgetId = String((body === null || body === void 0 ? void 0 : body.widgetId) || '');
90
- const direction = (body === null || body === void 0 ? void 0 : body.direction) === 'down' ? 'down' : 'up';
91
- const dashboard = yield ctx.getDashboardRecord(slug);
58
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
92
59
  if (!dashboard) {
93
60
  response.setStatus(404);
94
61
  return { error: 'Dashboard not found' };
95
62
  }
96
63
  const config = ctx.parseStoredDashboardConfig(dashboard.config);
97
- const widget = config.widgets.find((item) => item.id === widgetId);
64
+ const widget = config.widgets.find((item) => item.id === body.widgetId);
98
65
  if (!widget) {
99
66
  response.setStatus(404);
100
67
  return { error: 'Dashboard widget not found' };
@@ -102,10 +69,16 @@ export function registerWidgetEndpoints(server, ctx) {
102
69
  const sortedWidgets = config.widgets
103
70
  .filter((item) => item.group_id === widget.group_id)
104
71
  .sort((a, b) => a.order - b.order);
105
- const currentIndex = sortedWidgets.findIndex((item) => item.id === widgetId);
106
- const targetIndex = direction === 'up' ? currentIndex - 1 : currentIndex + 1;
72
+ const currentIndex = sortedWidgets.findIndex((item) => item.id === body.widgetId);
73
+ const targetIndex = body.direction === 'up' ? currentIndex - 1 : currentIndex + 1;
107
74
  if (targetIndex < 0 || targetIndex >= sortedWidgets.length) {
108
- return ctx.buildDashboardResponse(dashboard);
75
+ return {
76
+ id: dashboard.id,
77
+ slug: dashboard.slug,
78
+ label: dashboard.label,
79
+ revision: dashboard.revision,
80
+ config: ctx.parseStoredDashboardConfig(dashboard.config),
81
+ };
109
82
  }
110
83
  const reorderedWidgets = [...sortedWidgets];
111
84
  const [movedWidget] = reorderedWidgets.splice(currentIndex, 1);
@@ -128,15 +101,13 @@ export function registerWidgetEndpoints(server, ctx) {
128
101
  response.setStatus(403);
129
102
  return { error: 'Dashboard edit is not allowed' };
130
103
  }
131
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
132
- const widgetId = String((body === null || body === void 0 ? void 0 : body.widgetId) || '');
133
- const dashboard = yield ctx.getDashboardRecord(slug);
104
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
134
105
  if (!dashboard) {
135
106
  response.setStatus(404);
136
107
  return { error: 'Dashboard not found' };
137
108
  }
138
109
  const config = ctx.parseStoredDashboardConfig(dashboard.config);
139
- const nextWidgets = config.widgets.filter((item) => item.id !== widgetId);
110
+ const nextWidgets = config.widgets.filter((item) => item.id !== body.widgetId);
140
111
  if (nextWidgets.length === config.widgets.length) {
141
112
  response.setStatus(404);
142
113
  return { error: 'Dashboard widget not found' };
@@ -155,38 +126,22 @@ export function registerWidgetEndpoints(server, ctx) {
155
126
  response.setStatus(403);
156
127
  return { error: 'Dashboard edit is not allowed' };
157
128
  }
158
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
159
- const widgetId = String((body === null || body === void 0 ? void 0 : body.widgetId) || '');
160
- const dashboard = yield ctx.getDashboardRecord(slug);
129
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
161
130
  if (!dashboard) {
162
131
  response.setStatus(404);
163
132
  return { error: 'Dashboard not found' };
164
133
  }
165
134
  const config = ctx.parseStoredDashboardConfig(dashboard.config);
166
- const widget = config.widgets.find((item) => item.id === widgetId);
135
+ const widget = config.widgets.find((item) => item.id === body.widgetId);
167
136
  if (!widget) {
168
137
  response.setStatus(404);
169
138
  return { error: 'Dashboard widget not found' };
170
139
  }
171
- const parsedWidgetConfig = StoredWidgetConfigSchema.safeParse(normalizeDashboardWidgetConfig(body.config));
172
- if (!parsedWidgetConfig.success) {
173
- response.setStatus(422);
174
- return {
175
- error: 'Invalid widget config',
176
- validationErrors: formatWidgetConfigValidationErrors(parsedWidgetConfig.error),
177
- };
178
- }
179
- const typedWidgetConfig = parsedWidgetConfig.data;
180
- const apiValidationErrors = ctx.validateDashboardWidgetApiConfig(typedWidgetConfig);
181
- if (apiValidationErrors.length) {
182
- response.setStatus(422);
183
- return {
184
- error: 'Invalid widget config',
185
- validationErrors: formatWidgetConfigApiValidationErrors(apiValidationErrors),
186
- };
187
- }
188
- return ctx.persistDashboardConfig(dashboard, Object.assign(Object.assign({}, config), { widgets: config.widgets.map((item) => item.id === widgetId
189
- ? Object.assign(Object.assign({}, typedWidgetConfig), { id: widget.id, group_id: widget.group_id, order: widget.order }) : item) }));
140
+ const typedWidgetConfig = body.config;
141
+ const nextWidget = Object.assign(Object.assign({}, typedWidgetConfig), { id: widget.id, group_id: widget.group_id, order: widget.order });
142
+ return ctx.persistDashboardConfig(dashboard, Object.assign(Object.assign({}, config), { widgets: config.widgets.map((item) => item.id === body.widgetId
143
+ ? nextWidget
144
+ : item) }));
190
145
  }),
191
146
  });
192
147
  server.endpoint({
@@ -196,15 +151,13 @@ export function registerWidgetEndpoints(server, ctx) {
196
151
  request_schema: WidgetDataRequestSchema,
197
152
  response_schema: DashboardWidgetDataResponseSchema,
198
153
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response }) {
199
- const slug = String((body === null || body === void 0 ? void 0 : body.slug) || 'default');
200
- const widgetId = String((body === null || body === void 0 ? void 0 : body.widgetId) || '');
201
- const dashboard = yield ctx.getDashboardRecord(slug);
154
+ const dashboard = yield ctx.getDashboardRecord(body.slug);
202
155
  if (!dashboard) {
203
156
  response.setStatus(404);
204
157
  return { error: 'Dashboard not found' };
205
158
  }
206
159
  const config = ctx.parseStoredDashboardConfig(dashboard.config);
207
- const widget = config.widgets.find((item) => item.id === widgetId);
160
+ const widget = config.widgets.find((item) => item.id === body.widgetId);
208
161
  if (!widget) {
209
162
  response.setStatus(404);
210
163
  return { error: 'Dashboard widget not found' };
@@ -212,7 +165,8 @@ export function registerWidgetEndpoints(server, ctx) {
212
165
  return {
213
166
  widget,
214
167
  data: yield ctx.getWidgetData(widget, {
215
- pagination: body === null || body === void 0 ? void 0 : body.pagination,
168
+ pagination: body.pagination,
169
+ variables: widget.variables,
216
170
  }),
217
171
  };
218
172
  }),
package/dist/index.js CHANGED
@@ -15,7 +15,6 @@ import { registerGroupEndpoints } from "./endpoint/groups.js";
15
15
  import { registerWidgetEndpoints } from './endpoint/widgets.js';
16
16
  import { createDashboardConfigService } from "./services/dashboardConfigService.js";
17
17
  import { createWidgetDataService } from "./services/widgetDataService.js";
18
- import { createWidgetConfigValidatorService } from "./services/widgetConfigValidator.js";
19
18
  const DEFAULT_DASHBOARD_CONFIG = {
20
19
  version: 1,
21
20
  groups: [{
@@ -112,8 +111,7 @@ export default class DashboardPlugin extends AdminForthPlugin {
112
111
  setupEndpoints(server) {
113
112
  const dashboardConfigService = createDashboardConfigService(this.adminforth, this.options.dashboardConfigsResourceId);
114
113
  const widgetDataService = createWidgetDataService(this.adminforth);
115
- const widgetConfigValidatorService = createWidgetConfigValidatorService(this.adminforth);
116
- const ctx = Object.assign(Object.assign(Object.assign({ adminforth: this.adminforth, dashboardConfigsResourceId: this.options.dashboardConfigsResourceId, canEditDashboard }, dashboardConfigService), widgetDataService), widgetConfigValidatorService);
114
+ const ctx = Object.assign(Object.assign({ adminforth: this.adminforth, dashboardConfigsResourceId: this.options.dashboardConfigsResourceId, canEditDashboard }, dashboardConfigService), widgetDataService);
117
115
  registerDashboardEndpoints(server, ctx);
118
116
  registerGroupEndpoints(server, ctx);
119
117
  registerWidgetEndpoints(server, ctx);