@gzl10/nexus-plugin-charts 0.13.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.
- package/dist/index.d.ts +49 -0
- package/dist/index.js +178 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ModuleContext, ModuleManifest, PluginManifest } from '@gzl10/nexus-sdk';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Chart Data Service
|
|
5
|
+
*
|
|
6
|
+
* Processes entity data and returns aggregated results for chart visualization.
|
|
7
|
+
* All heavy computation is done server-side to minimize client payload.
|
|
8
|
+
*/
|
|
9
|
+
type AggregationType = 'sum' | 'avg' | 'count' | 'min' | 'max';
|
|
10
|
+
interface ChartDataRequest {
|
|
11
|
+
/** Entity/table name to query */
|
|
12
|
+
entity: string;
|
|
13
|
+
/** FilterOperators to apply */
|
|
14
|
+
filters?: Record<string, unknown>;
|
|
15
|
+
/** Field to group by */
|
|
16
|
+
groupBy?: string;
|
|
17
|
+
/** Aggregation function */
|
|
18
|
+
aggregation?: AggregationType;
|
|
19
|
+
/** Field for X-axis */
|
|
20
|
+
xAxis: string;
|
|
21
|
+
/** Field for Y-axis (to aggregate) */
|
|
22
|
+
yAxis: string;
|
|
23
|
+
/** Maximum rows to return */
|
|
24
|
+
limit?: number;
|
|
25
|
+
/** Sort order */
|
|
26
|
+
sort?: 'asc' | 'desc';
|
|
27
|
+
}
|
|
28
|
+
interface ChartDataPoint {
|
|
29
|
+
x: string | number;
|
|
30
|
+
y: number;
|
|
31
|
+
label?: string;
|
|
32
|
+
group?: string;
|
|
33
|
+
}
|
|
34
|
+
interface ChartDataResponse {
|
|
35
|
+
data: ChartDataPoint[];
|
|
36
|
+
total: number;
|
|
37
|
+
aggregation?: AggregationType;
|
|
38
|
+
groupBy?: string;
|
|
39
|
+
}
|
|
40
|
+
declare function createChartService(ctx: ModuleContext): {
|
|
41
|
+
getChartData: (request: ChartDataRequest) => Promise<ChartDataResponse>;
|
|
42
|
+
getRawData: (entity: string, fields: string[], filters?: Record<string, unknown>, limit?: number) => Promise<Record<string, unknown>[]>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
declare const chartsModule: ModuleManifest;
|
|
46
|
+
|
|
47
|
+
declare const chartsPlugin: PluginManifest;
|
|
48
|
+
|
|
49
|
+
export { type AggregationType, type ChartDataPoint, type ChartDataRequest, type ChartDataResponse, chartsModule, chartsPlugin, createChartService, chartsPlugin as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// src/charts.service.ts
|
|
2
|
+
var VALID_AGGREGATIONS = /* @__PURE__ */ new Set(["sum", "avg", "count", "min", "max"]);
|
|
3
|
+
var AGGREGATION_SQL = {
|
|
4
|
+
sum: "SUM",
|
|
5
|
+
avg: "AVG",
|
|
6
|
+
count: "COUNT",
|
|
7
|
+
min: "MIN",
|
|
8
|
+
max: "MAX"
|
|
9
|
+
};
|
|
10
|
+
var SAFE_IDENTIFIER_RE = /^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/;
|
|
11
|
+
function assertSafeIdentifier(name, label) {
|
|
12
|
+
if (!SAFE_IDENTIFIER_RE.test(name)) {
|
|
13
|
+
throw new Error(`Invalid ${label}: "${name}" is not a valid column name`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function createChartService(ctx) {
|
|
17
|
+
const { db } = ctx;
|
|
18
|
+
async function getChartData(request) {
|
|
19
|
+
const {
|
|
20
|
+
entity,
|
|
21
|
+
filters = {},
|
|
22
|
+
groupBy,
|
|
23
|
+
aggregation = "sum",
|
|
24
|
+
xAxis,
|
|
25
|
+
yAxis,
|
|
26
|
+
limit = 100,
|
|
27
|
+
sort = "asc"
|
|
28
|
+
} = request;
|
|
29
|
+
if (!VALID_AGGREGATIONS.has(aggregation)) {
|
|
30
|
+
throw new Error(`Invalid aggregation: "${aggregation}"`);
|
|
31
|
+
}
|
|
32
|
+
assertSafeIdentifier(xAxis, "xAxis");
|
|
33
|
+
assertSafeIdentifier(yAxis, "yAxis");
|
|
34
|
+
if (groupBy) assertSafeIdentifier(groupBy, "groupBy");
|
|
35
|
+
const aggFn = AGGREGATION_SQL[aggregation];
|
|
36
|
+
const knex = db.knex;
|
|
37
|
+
let query = knex(entity);
|
|
38
|
+
if (Object.keys(filters).length > 0) {
|
|
39
|
+
const mod = await import("@gzl10/nexus-backend");
|
|
40
|
+
const applyFilters = mod.applyFilters;
|
|
41
|
+
query = applyFilters(query, filters);
|
|
42
|
+
}
|
|
43
|
+
const clampedLimit = Math.min(Math.max(limit, 1), 5e3);
|
|
44
|
+
if (groupBy) {
|
|
45
|
+
query = query.select(xAxis, groupBy).select(knex.raw(`${aggFn}(??) as ??`, [yAxis, "value"])).groupBy(xAxis, groupBy).orderBy(xAxis, sort).limit(clampedLimit);
|
|
46
|
+
} else {
|
|
47
|
+
query = query.select(xAxis).select(knex.raw(`${aggFn}(??) as ??`, [yAxis, "value"])).groupBy(xAxis).orderBy(xAxis, sort).limit(clampedLimit);
|
|
48
|
+
}
|
|
49
|
+
const rows = await query;
|
|
50
|
+
const data = rows.map((row) => ({
|
|
51
|
+
x: row[xAxis],
|
|
52
|
+
y: Number(row["value"]) || 0,
|
|
53
|
+
label: String(row[xAxis]),
|
|
54
|
+
group: groupBy ? String(row[groupBy]) : void 0
|
|
55
|
+
}));
|
|
56
|
+
return {
|
|
57
|
+
data,
|
|
58
|
+
total: data.length,
|
|
59
|
+
aggregation,
|
|
60
|
+
groupBy
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async function getRawData(entity, fields, filters = {}, limit = 1e3) {
|
|
64
|
+
for (const field of fields) {
|
|
65
|
+
assertSafeIdentifier(field, "field");
|
|
66
|
+
}
|
|
67
|
+
const knex = db.knex;
|
|
68
|
+
let query = knex(entity).select(fields).limit(Math.min(Math.max(limit, 1), 5e3));
|
|
69
|
+
if (Object.keys(filters).length > 0) {
|
|
70
|
+
const mod = await import("@gzl10/nexus-backend");
|
|
71
|
+
const applyFilters = mod.applyFilters;
|
|
72
|
+
query = applyFilters(query, filters);
|
|
73
|
+
}
|
|
74
|
+
return await query;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
getChartData,
|
|
78
|
+
getRawData
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/charts.routes.ts
|
|
83
|
+
function createChartRoutes(ctx) {
|
|
84
|
+
const router = ctx.core.createRouter();
|
|
85
|
+
const chartService = createChartService(ctx);
|
|
86
|
+
const auth = ctx.core.middleware["auth"];
|
|
87
|
+
if (!auth) {
|
|
88
|
+
throw new Error("Auth middleware is required for chart routes");
|
|
89
|
+
}
|
|
90
|
+
router.post("/data", auth, async (req, res, next) => {
|
|
91
|
+
try {
|
|
92
|
+
const request = req.body;
|
|
93
|
+
if (!request.entity || !request.xAxis || !request.yAxis) {
|
|
94
|
+
throw new ctx.core.errors.ValidationError(
|
|
95
|
+
"Missing required fields: entity, xAxis, yAxis"
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const subject = ctx.engine.getSubjectForTable(request.entity);
|
|
99
|
+
if (!subject) {
|
|
100
|
+
throw new ctx.core.errors.ValidationError(`Unknown entity: ${request.entity}`);
|
|
101
|
+
}
|
|
102
|
+
const ability = req.ability;
|
|
103
|
+
if (!ability.can("read", subject)) {
|
|
104
|
+
throw new ctx.core.errors.ForbiddenError(`Access denied to ${subject}`);
|
|
105
|
+
}
|
|
106
|
+
const result = await chartService.getChartData(request);
|
|
107
|
+
res.json(result);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
next(error);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
router.get("/raw/:entity", auth, async (req, res, next) => {
|
|
113
|
+
try {
|
|
114
|
+
const entity = req.params["entity"];
|
|
115
|
+
const { fields, limit } = req.query;
|
|
116
|
+
if (!entity) {
|
|
117
|
+
throw new ctx.core.errors.ValidationError("Missing entity parameter");
|
|
118
|
+
}
|
|
119
|
+
if (!fields || typeof fields !== "string") {
|
|
120
|
+
throw new ctx.core.errors.ValidationError(
|
|
121
|
+
"Missing required query param: fields (comma-separated)"
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const subject = ctx.engine.getSubjectForTable(entity);
|
|
125
|
+
if (!subject) {
|
|
126
|
+
throw new ctx.core.errors.ValidationError(`Unknown entity: ${entity}`);
|
|
127
|
+
}
|
|
128
|
+
const ability = req.ability;
|
|
129
|
+
if (!ability.can("read", subject)) {
|
|
130
|
+
throw new ctx.core.errors.ForbiddenError(`Access denied to ${subject}`);
|
|
131
|
+
}
|
|
132
|
+
const fieldList = fields.split(",").map((f) => f.trim());
|
|
133
|
+
const limitNum = typeof limit === "string" ? Number(limit) : 1e3;
|
|
134
|
+
const maxRows = Math.min(limitNum || 1e3, 5e3);
|
|
135
|
+
const result = await chartService.getRawData(entity, fieldList, {}, maxRows);
|
|
136
|
+
res.json({ data: result, total: result.length });
|
|
137
|
+
} catch (error) {
|
|
138
|
+
next(error);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
return router;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/index.ts
|
|
145
|
+
var chartsModule = {
|
|
146
|
+
name: "charts",
|
|
147
|
+
label: { en: "Charts", es: "Gr\xE1ficos" },
|
|
148
|
+
icon: "mdi:chart-line",
|
|
149
|
+
description: {
|
|
150
|
+
en: "Chart data aggregation and visualization endpoints",
|
|
151
|
+
es: "Endpoints de agregaci\xF3n y visualizaci\xF3n de datos para gr\xE1ficos"
|
|
152
|
+
},
|
|
153
|
+
category: "content",
|
|
154
|
+
definitions: [],
|
|
155
|
+
routes: createChartRoutes,
|
|
156
|
+
routePrefix: "/charts"
|
|
157
|
+
};
|
|
158
|
+
var chartsPlugin = {
|
|
159
|
+
name: "@gzl10/nexus-plugin-charts",
|
|
160
|
+
code: "CHT",
|
|
161
|
+
label: { en: "Charts", es: "Gr\xE1ficos" },
|
|
162
|
+
icon: "mdi:chart-line",
|
|
163
|
+
version: "0.13.1",
|
|
164
|
+
description: {
|
|
165
|
+
en: "Chart data aggregation and visualization endpoints",
|
|
166
|
+
es: "Endpoints de agregaci\xF3n y visualizaci\xF3n de datos para gr\xE1ficos"
|
|
167
|
+
},
|
|
168
|
+
category: "content",
|
|
169
|
+
modules: [chartsModule]
|
|
170
|
+
};
|
|
171
|
+
var index_default = chartsPlugin;
|
|
172
|
+
export {
|
|
173
|
+
chartsModule,
|
|
174
|
+
chartsPlugin,
|
|
175
|
+
createChartService,
|
|
176
|
+
index_default as default
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/charts.service.ts","../src/charts.routes.ts","../src/index.ts"],"sourcesContent":["import type { ModuleContext } from '@gzl10/nexus-sdk'\n\n/**\n * Chart Data Service\n *\n * Processes entity data and returns aggregated results for chart visualization.\n * All heavy computation is done server-side to minimize client payload.\n */\n\nexport type AggregationType = 'sum' | 'avg' | 'count' | 'min' | 'max'\n\nconst VALID_AGGREGATIONS = new Set<AggregationType>(['sum', 'avg', 'count', 'min', 'max'])\nconst AGGREGATION_SQL: Record<AggregationType, string> = {\n sum: 'SUM', avg: 'AVG', count: 'COUNT', min: 'MIN', max: 'MAX'\n}\n\n/** Safe SQL identifier: letters, digits, underscores. No dots, spaces, or special chars. */\nconst SAFE_IDENTIFIER_RE = /^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/\n\nexport interface ChartDataRequest {\n /** Entity/table name to query */\n entity: string\n /** FilterOperators to apply */\n filters?: Record<string, unknown>\n /** Field to group by */\n groupBy?: string\n /** Aggregation function */\n aggregation?: AggregationType\n /** Field for X-axis */\n xAxis: string\n /** Field for Y-axis (to aggregate) */\n yAxis: string\n /** Maximum rows to return */\n limit?: number\n /** Sort order */\n sort?: 'asc' | 'desc'\n}\n\nexport interface ChartDataPoint {\n x: string | number\n y: number\n label?: string\n group?: string\n}\n\nexport interface ChartDataResponse {\n data: ChartDataPoint[]\n total: number\n aggregation?: AggregationType\n groupBy?: string\n}\n\n/**\n * Validates a field name is a safe SQL identifier to prevent injection.\n * Rejects anything that isn't a simple column name (letters, digits, underscores).\n */\nfunction assertSafeIdentifier(name: string, label: string): void {\n if (!SAFE_IDENTIFIER_RE.test(name)) {\n throw new Error(`Invalid ${label}: \"${name}\" is not a valid column name`)\n }\n}\n\nexport function createChartService(ctx: ModuleContext) {\n const { db } = ctx\n\n /**\n * Get aggregated chart data from an entity\n */\n async function getChartData(request: ChartDataRequest): Promise<ChartDataResponse> {\n const {\n entity,\n filters = {},\n groupBy,\n aggregation = 'sum',\n xAxis,\n yAxis,\n limit = 100,\n sort = 'asc'\n } = request\n\n // Validate aggregation type\n if (!VALID_AGGREGATIONS.has(aggregation)) {\n throw new Error(`Invalid aggregation: \"${aggregation}\"`)\n }\n\n // Validate all field names are safe SQL identifiers\n assertSafeIdentifier(xAxis, 'xAxis')\n assertSafeIdentifier(yAxis, 'yAxis')\n if (groupBy) assertSafeIdentifier(groupBy, 'groupBy')\n\n const aggFn = AGGREGATION_SQL[aggregation]\n const knex = db.knex\n let query = knex(entity)\n\n // Apply filters using the existing filter helper\n if (Object.keys(filters).length > 0) {\n const mod = await import('@gzl10/nexus-backend') as any\n const applyFilters = mod.applyFilters as (qb: any, filters: Record<string, unknown>) => any\n query = applyFilters(query, filters)\n }\n\n // Field names are validated by assertSafeIdentifier above.\n // Use ?? (identifier binding) in knex.raw() for aggregation expressions.\n const clampedLimit = Math.min(Math.max(limit, 1), 5000)\n\n if (groupBy) {\n query = query\n .select(xAxis, groupBy)\n .select(knex.raw(`${aggFn}(??) as ??`, [yAxis, 'value']))\n .groupBy(xAxis, groupBy)\n .orderBy(xAxis, sort)\n .limit(clampedLimit)\n } else {\n query = query\n .select(xAxis)\n .select(knex.raw(`${aggFn}(??) as ??`, [yAxis, 'value']))\n .groupBy(xAxis)\n .orderBy(xAxis, sort)\n .limit(clampedLimit)\n }\n\n const rows = await query\n\n const data: ChartDataPoint[] = rows.map((row: Record<string, unknown>) => ({\n x: row[xAxis] as string | number,\n y: Number(row['value']) || 0,\n label: String(row[xAxis]),\n group: groupBy ? String(row[groupBy]) : undefined\n }))\n\n return {\n data,\n total: data.length,\n aggregation,\n groupBy\n }\n }\n\n /**\n * Get raw data without aggregation (for scatter plots, etc.)\n */\n async function getRawData(\n entity: string,\n fields: string[],\n filters: Record<string, unknown> = {},\n limit = 1000\n ): Promise<Record<string, unknown>[]> {\n // Validate all field names\n for (const field of fields) {\n assertSafeIdentifier(field, 'field')\n }\n\n const knex = db.knex\n let query = knex(entity).select(fields).limit(Math.min(Math.max(limit, 1), 5000))\n\n if (Object.keys(filters).length > 0) {\n const mod = await import('@gzl10/nexus-backend') as any\n const applyFilters = mod.applyFilters as (qb: any, filters: Record<string, unknown>) => any\n query = applyFilters(query, filters)\n }\n\n return await query\n }\n\n return {\n getChartData,\n getRawData\n }\n}\n","import type { ModuleContext, AuthRequest } from '@gzl10/nexus-sdk'\nimport { createChartService, type ChartDataRequest } from './charts.service.js'\n\n/**\n * Chart Routes\n *\n * REST endpoints for fetching aggregated chart data.\n */\nexport function createChartRoutes(ctx: ModuleContext) {\n const router = ctx.core.createRouter()\n const chartService = createChartService(ctx)\n const auth = ctx.core.middleware['auth']\n\n if (!auth) {\n throw new Error('Auth middleware is required for chart routes')\n }\n\n /**\n * POST /charts/data\n *\n * Get aggregated chart data from an entity.\n * Body: ChartDataRequest\n */\n router.post('/data', auth, async (req, res, next) => {\n try {\n const request = req.body as ChartDataRequest\n\n // Validate required fields\n if (!request.entity || !request.xAxis || !request.yAxis) {\n throw new ctx.core.errors.ValidationError(\n 'Missing required fields: entity, xAxis, yAxis'\n )\n }\n\n // Validate entity is registered and check CASL access\n const subject = ctx.engine.getSubjectForTable(request.entity)\n if (!subject) {\n throw new ctx.core.errors.ValidationError(`Unknown entity: ${request.entity}`)\n }\n\n const ability = (req as AuthRequest).ability\n if (!ability.can('read', subject)) {\n throw new ctx.core.errors.ForbiddenError(`Access denied to ${subject}`)\n }\n\n const result = await chartService.getChartData(request)\n res.json(result)\n } catch (error) {\n next(error)\n }\n })\n\n /**\n * GET /charts/raw/:entity\n *\n * Get raw entity data for custom chart processing.\n * Query params: fields (comma-separated), limit\n */\n router.get('/raw/:entity', auth, async (req, res, next) => {\n try {\n const entity = req.params['entity']\n const { fields, limit } = req.query\n\n if (!entity) {\n throw new ctx.core.errors.ValidationError('Missing entity parameter')\n }\n\n if (!fields || typeof fields !== 'string') {\n throw new ctx.core.errors.ValidationError(\n 'Missing required query param: fields (comma-separated)'\n )\n }\n\n // Validate entity is registered and check CASL access\n const subject = ctx.engine.getSubjectForTable(entity)\n if (!subject) {\n throw new ctx.core.errors.ValidationError(`Unknown entity: ${entity}`)\n }\n\n const ability = (req as AuthRequest).ability\n if (!ability.can('read', subject)) {\n throw new ctx.core.errors.ForbiddenError(`Access denied to ${subject}`)\n }\n\n const fieldList = fields.split(',').map(f => f.trim())\n const limitNum = typeof limit === 'string' ? Number(limit) : 1000\n const maxRows = Math.min(limitNum || 1000, 5000)\n\n const result = await chartService.getRawData(entity, fieldList, {}, maxRows)\n res.json({ data: result, total: result.length })\n } catch (error) {\n next(error)\n }\n })\n\n return router\n}\n","import type { PluginManifest, ModuleManifest } from '@gzl10/nexus-sdk'\nimport { createChartRoutes } from './charts.routes.js'\n\nexport { createChartService, type ChartDataRequest, type ChartDataResponse, type ChartDataPoint, type AggregationType } from './charts.service.js'\n\nconst chartsModule: ModuleManifest = {\n name: 'charts',\n label: { en: 'Charts', es: 'Gráficos' },\n icon: 'mdi:chart-line',\n description: {\n en: 'Chart data aggregation and visualization endpoints',\n es: 'Endpoints de agregación y visualización de datos para gráficos'\n },\n category: 'content',\n definitions: [],\n routes: createChartRoutes,\n routePrefix: '/charts'\n}\n\nexport { chartsModule }\n\nexport const chartsPlugin: PluginManifest = {\n name: '@gzl10/nexus-plugin-charts',\n code: 'CHT',\n label: { en: 'Charts', es: 'Gráficos' },\n icon: 'mdi:chart-line',\n version: '0.13.1',\n description: {\n en: 'Chart data aggregation and visualization endpoints',\n es: 'Endpoints de agregación y visualización de datos para gráficos'\n },\n category: 'content',\n modules: [chartsModule]\n}\n\nexport default chartsPlugin\n"],"mappings":";AAWA,IAAM,qBAAqB,oBAAI,IAAqB,CAAC,OAAO,OAAO,SAAS,OAAO,KAAK,CAAC;AACzF,IAAM,kBAAmD;AAAA,EACvD,KAAK;AAAA,EAAO,KAAK;AAAA,EAAO,OAAO;AAAA,EAAS,KAAK;AAAA,EAAO,KAAK;AAC3D;AAGA,IAAM,qBAAqB;AAuC3B,SAAS,qBAAqB,MAAc,OAAqB;AAC/D,MAAI,CAAC,mBAAmB,KAAK,IAAI,GAAG;AAClC,UAAM,IAAI,MAAM,WAAW,KAAK,MAAM,IAAI,8BAA8B;AAAA,EAC1E;AACF;AAEO,SAAS,mBAAmB,KAAoB;AACrD,QAAM,EAAE,GAAG,IAAI;AAKf,iBAAe,aAAa,SAAuD;AACjF,UAAM;AAAA,MACJ;AAAA,MACA,UAAU,CAAC;AAAA,MACX;AAAA,MACA,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,OAAO;AAAA,IACT,IAAI;AAGJ,QAAI,CAAC,mBAAmB,IAAI,WAAW,GAAG;AACxC,YAAM,IAAI,MAAM,yBAAyB,WAAW,GAAG;AAAA,IACzD;AAGA,yBAAqB,OAAO,OAAO;AACnC,yBAAqB,OAAO,OAAO;AACnC,QAAI,QAAS,sBAAqB,SAAS,SAAS;AAEpD,UAAM,QAAQ,gBAAgB,WAAW;AACzC,UAAM,OAAO,GAAG;AAChB,QAAI,QAAQ,KAAK,MAAM;AAGvB,QAAI,OAAO,KAAK,OAAO,EAAE,SAAS,GAAG;AACnC,YAAM,MAAM,MAAM,OAAO,sBAAsB;AAC/C,YAAM,eAAe,IAAI;AACzB,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AA,IACJ,IAAI;AAAA,EACN;AAAA,EACA,UAAU;AAAA,EACV,SAAS,CAAC,YAAY;AACxB;AAEA,IAAO,gBAAQ;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gzl10/nexus-plugin-charts",
|
|
3
|
+
"version": "0.13.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Chart data aggregation and visualization plugin for Nexus BaaS",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@gzl10/nexus-sdk": ">=0.13.0",
|
|
18
|
+
"@gzl10/nexus-backend": ">=0.13.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tsup": "^8.4.0",
|
|
22
|
+
"typescript": "^5.8.2",
|
|
23
|
+
"vitest": "^3.1.1",
|
|
24
|
+
"@gzl10/nexus-sdk": "0.14.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
}
|
|
31
|
+
}
|