@lobb-js/lobb-ext-reports 0.1.34 → 0.3.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 (50) hide show
  1. package/.dockerignore +4 -1
  2. package/.env.example +10 -0
  3. package/.vscode/settings.json +5 -0
  4. package/CHANGELOG.md +87 -18
  5. package/README.md +1 -29
  6. package/extensions/reports/collectionRoutes.ts +10 -0
  7. package/extensions/reports/collections/charts.ts +47 -0
  8. package/extensions/reports/collections/index.ts +11 -0
  9. package/extensions/reports/collections/reports.ts +30 -0
  10. package/extensions/reports/controllers/chartsController.ts +78 -0
  11. package/extensions/reports/index.ts +24 -0
  12. package/extensions/reports/meta.ts +218 -0
  13. package/extensions/reports/migrations.ts +3 -0
  14. package/extensions/reports/openapi.ts +39 -0
  15. package/extensions/reports/relations.ts +17 -0
  16. package/extensions/reports/studio/tests/analytics.spec.ts +26 -0
  17. package/extensions/reports/studio/tests/package.json +1 -0
  18. package/extensions/reports/studio/tests/playwright.config.cjs +27 -0
  19. package/extensions/reports/studioExtension.json +1 -0
  20. package/extensions/reports/tests/configs/simple.ts +55 -0
  21. package/extensions/reports/tests/reports.test.ts +105 -0
  22. package/lobb.ts +55 -0
  23. package/package.json +31 -7
  24. package/scripts/postpublish.sh +12 -0
  25. package/scripts/prepublish.sh +17 -0
  26. package/studio/app.html +12 -0
  27. package/studio/routes/+layout.svelte +7 -0
  28. package/studio/routes/+layout.ts +1 -0
  29. package/studio/routes/[...path]/+page.svelte +6 -0
  30. package/svelte.config.js +23 -7
  31. package/todo.md +11 -0
  32. package/tsconfig.app.json +3 -3
  33. package/tsconfig.json +11 -5
  34. package/vite.config.ts +4 -8
  35. package/Dockerfile +0 -29
  36. package/components.json +0 -16
  37. package/extension.types.ts +0 -28
  38. package/index.html +0 -13
  39. package/nginx.conf +0 -17
  40. package/src/app.css +0 -124
  41. package/src/main.ts +0 -14
  42. /package/{src → extensions/reports/studio}/index.ts +0 -0
  43. /package/{src → extensions/reports/studio}/lib/components/dv_fields_buttons/query_ai_button/index.svelte +0 -0
  44. /package/{src → extensions/reports/studio}/lib/components/pages/reports/components/chart.svelte +0 -0
  45. /package/{src → extensions/reports/studio}/lib/components/pages/reports/components/charts/chartJs.svelte +0 -0
  46. /package/{src → extensions/reports/studio}/lib/components/pages/reports/components/charts/table.svelte +0 -0
  47. /package/{src → extensions/reports/studio}/lib/components/pages/reports/components/report.svelte +0 -0
  48. /package/{src → extensions/reports/studio}/lib/components/pages/reports/index.svelte +0 -0
  49. /package/{src → extensions/reports/studio}/lib/index.ts +0 -0
  50. /package/{src → extensions/reports/studio}/lib/utils.ts +0 -0
package/.dockerignore CHANGED
@@ -1,4 +1,7 @@
1
1
  node_modules
2
- dist
3
2
  .git
3
+ .gitignore
4
4
  *.md
5
+ .vscode
6
+ studio/node_modules
7
+ studio/dist
package/.env.example ADDED
@@ -0,0 +1,10 @@
1
+ # Database
2
+ DATABASE_HOST=localhost
3
+ DATABASE_PORT=5432
4
+ DATABASE_USER=test
5
+ DATABASE_PASSWORD=test
6
+ DATABASE_NAME=reports-ext
7
+
8
+ # Web Server
9
+ WEB_SERVER_HOST=0.0.0.0
10
+ WEB_SERVER_PORT=3000
@@ -0,0 +1,5 @@
1
+ {
2
+ "deno.disablePaths": [
3
+ "studio"
4
+ ]
5
+ }
package/CHANGELOG.md CHANGED
@@ -2,61 +2,130 @@
2
2
  All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
3
3
 
4
4
  - - -
5
- ## reports-ext-studio@0.1.34 - 2026-03-13
5
+ ## reports-ext@0.3.1 - 2026-03-28
6
6
  #### Bug Fixes
7
+ - adding readme to all packages - (3a9264a) - malik ben
8
+ #### Miscellaneous Chores
9
+ - add publishConfig and fix ext packages for npm publishing - (49747e9) - malik ben
10
+
11
+ - - -
12
+
13
+ ## reports-ext@0.3.0 - 2026-03-28
14
+ #### Features
15
+ - (**reports-ext**) migrate to Bun - (3d9f927) - malik ben
16
+ - (**reports-ext,storage-ext**) convert studio from Svelte SPA to SvelteKit - (3cd7f63) - malik ben
17
+ - replace hasDashboardExtension with virtual:lobb-studio-extensions module - (437cb2e) - malik ben
18
+ #### Bug Fixes
19
+ - add /studio subpath exports to ext packages, update studio pages to use them - (c0b9a82) - malik ben
20
+ - untrack .svelte-kit from mindhar, fix process leak and $lib imports, update ai sdk versions - (017f784) - malik ben
7
21
  - chaning $lib to relative path - (c6d9e8f) - malik ben
8
22
  #### Miscellaneous Chores
23
+ - (**reports-ext**) move extension logic and tests to extensions/reports, flatten studio, add Playwright tests - (f814cbf) - malik ben
24
+ - (**version**) 0.25.2 - (a62acb9) - Cocogitto Bot
25
+ - (**version**) 0.25.1 - (afe7e69) - Cocogitto Bot
26
+ - (**version**) 0.25.0 - (77a383c) - Cocogitto Bot
27
+ - (**version**) 0.24.0 - (a8cb605) - Cocogitto Bot
28
+ - (**version**) 0.23.0 - (60f357e) - Cocogitto Bot
9
29
  - (**version**) 0.22.0 - (6510e32) - Cocogitto Bot
10
30
  - (**version**) 0.21.0 - (c973aa9) - Cocogitto Bot
31
+ - (**version**) 0.20.0 - (06cc303) - Cocogitto Bot
32
+ - add dev:studio/build:studio scripts, fix Dockerfiles, remove --build flag - (1595975) - malik ben
33
+ - add prepublish/postpublish scripts to extension packages for standalone compatibility - (4d6108f) - malik ben
34
+ - centralize studio app.css in @lobb-js/studio package, remove local copies - (05192dc) - malik ben
35
+ - rename @lobb/ scope to @lobb-js/ across all packages and apps - (cce4ce0) - malik ben
36
+ - add start/build scripts and gitignore build dir across all projects - (58f539d) - malik ben
37
+ - update CLAUDE.md to enforce no-commit-without-explicit-instruction rule - (6d63a42) - malik ben
38
+ - remove all deno.json and deno.lock files from the monorepo - (84ca5d4) - malik ben
39
+ - replace workspace:* with exact versions in all package.json files - (74fbdb7) - malik ben
40
+ - rename __studio to studio and remove unused studio dirs - (77fb932) - malik ben
41
+ - rename studio directory to __studio for faker-ext, llm-ext, mail-ext, reports-ext, storage-ext - (47e754a) - malik ben
42
+ - bump deno docker image to 2.6.6 across all Dockerfiles - (a2865b4) - malik ben
11
43
 
12
44
  - - -
13
45
 
14
- ## reports-ext-studio@0.1.33 - 2026-03-01
15
- #### Bug Fixes
16
- - (**studio**) prevent @lobb-js/studio version shadowing in extensions - (cd674b9) - malik ben
46
+ ## reports-ext@0.2.0 - 2026-03-01
47
+ #### Features
48
+ - (**mindhar**) add storage extension integration - (bca6368) - malik ben
17
49
  #### Miscellaneous Chores
18
- - (**version**) 0.15.0 - (0c2c345) - Cocogitto Bot
19
- - fixing the /studio base issue - (de6686f) - Malik Najjar
50
+ - (**version**) 0.18.0 - (efc553f) - Cocogitto Bot
51
+ - (**version**) 0.17.0 - (4174f0c) - Cocogitto Bot
52
+ - (**version**) 0.16.0 - (9508655) - Cocogitto Bot
53
+ - (**version**) 0.14.11 - (ad92b61) - Cocogitto Bot
54
+ - (**version**) 0.14.8 - (0e6c1cb) - Cocogitto Bot
20
55
 
21
56
  - - -
22
57
 
23
- ## reports-ext-studio@0.1.32 - 2026-02-22
58
+ ## reports-ext@0.1.34 - 2026-02-22
24
59
  #### Bug Fixes
25
- - adding a studio prefix for the studio app - (6607b5a) - malik ben
60
+ - coggito publishing packages order fix - (573c75e) - malik ben
26
61
  #### Miscellaneous Chores
27
- - (**version**) 0.14.2 - (6ecdc1d) - Cocogitto Bot
62
+ - (**version**) 0.14.3 - (76abe92) - Cocogitto Bot
63
+
64
+ - - -
65
+
66
+ ## reports-ext@0.1.33 - 2026-02-22
67
+ #### Bug Fixes
68
+ - made the collectionService become an property in the main lobb object - (146e4cb) - malik ben
28
69
 
29
70
  - - -
30
71
 
31
- ## reports-ext-studio@0.1.31 - 2026-02-21
72
+ ## reports-ext@0.1.32 - 2026-02-21
32
73
  #### Bug Fixes
33
74
  - using default export instead of named export for extensions - (37dd485) - malik ben
75
+ #### Refactoring
76
+ - moving ui_input into the ui property of the field - (8a9edf0) - Malik Najjar
77
+
78
+ - - -
79
+
80
+ ## reports-ext@0.1.31 - 2026-02-20
81
+ #### Bug Fixes
82
+ - fix reports extension race condition - (6dd72ba) - Malik Najjar
34
83
  #### Miscellaneous Chores
35
- - (**version**) 0.14.0 - (7d2eb87) - Cocogitto Bot
84
+ - (**version**) 0.13.2 - (39b0145) - Cocogitto Bot
85
+
86
+ - - -
87
+
88
+ ## reports-ext@0.1.30 - 2026-02-19
89
+ #### Bug Fixes
90
+ - concurent racing fix - (0eeda5f) - malik ben
36
91
 
37
92
  - - -
38
93
 
39
- ## reports-ext-studio@0.1.30 - 2026-02-19
94
+ ## reports-ext@0.1.29 - 2026-02-19
40
95
  #### Bug Fixes
41
- - fixing the issue of the reports extension - (5e8c2d2) - Malik Najjar
96
+ - adding testing logs - (69ab047) - malik ben
42
97
  #### Miscellaneous Chores
98
+ - (**version**) 0.12.3 - (cd06fc0) - Cocogitto Bot
99
+ - (**version**) 0.12.2 - (35b2ff3) - Cocogitto Bot
43
100
  - (**version**) 0.12.1 - (c548105) - Cocogitto Bot
101
+ - adding testing logs - (ef42d92) - malik ben
44
102
 
45
103
  - - -
46
104
 
47
- ## reports-ext-studio@0.1.29 - 2026-02-19
105
+ ## reports-ext@0.1.28 - 2026-02-19
48
106
  #### Bug Fixes
49
107
  - making the reports work - (1b87561) - Malik Najjar
50
108
  #### Miscellaneous Chores
51
- - fix building issue - (3b0d356) - malik ben
109
+ - (**version**) 0.11.1 - (659ebd3) - Cocogitto Bot
110
+ - (**version**) 0.11.0 - (3f4f47e) - Cocogitto Bot
111
+ - (**version**) 0.10.0 - (5d79b6e) - Cocogitto Bot
112
+ - (**version**) 0.8.0 - (fdee7ca) - Cocogitto Bot
52
113
 
53
114
  - - -
54
115
 
55
- ## reports-ext-studio@0.1.28 - 2026-02-17
116
+ ## reports-ext@0.1.27 - 2026-02-15
56
117
  #### Bug Fixes
57
- - fixing the standalone issue - (1a70a51) - Malik Najjar
118
+ - fix deno publish issue - (e8dcc4f) - malik ben
119
+ - issue fix - (63d66d3) - malik ben
58
120
  #### Miscellaneous Chores
59
- - (**version**) 0.10.9 - (19ac765) - Cocogitto Bot
121
+ - (**version**) 0.5.5 - (d4dedeb) - Cocogitto Bot
122
+ - (**version**) 0.5.4 - (1ca3970) - Cocogitto Bot
123
+ - (**version**) 0.5.3 - (dcdb9cb) - Cocogitto Bot
124
+ - (**version**) 0.5.2 - (aa66e29) - Cocogitto Bot
125
+ - (**version**) 0.5.1 - (41b7c35) - Cocogitto Bot
126
+ - (**version**) 0.5.0 - (af63147) - Cocogitto Bot
127
+ - (**version**) 0.4.4 - (eaed3b4) - Cocogitto Bot
128
+ - (**version**) 0.4.3 - (ea9ec49) - Cocogitto Bot
60
129
 
61
130
  - - -
62
131
 
package/README.md CHANGED
@@ -1,29 +1 @@
1
- # Reports Extension - Studio
2
-
3
- This directory contains the frontend/dashboard interface for the reports extension.
4
-
5
- ## Structure
6
-
7
- ```
8
- studio/
9
- ├── src/
10
- │ ├── index.ts # Extension entry point
11
- │ ├── main.ts # Vite app entry
12
- │ ├── pages/ # UI pages
13
- │ │ └── reports/ # Reports pages
14
- │ └── dv_fields_buttons/ # Custom field buttons
15
- ├── public/ # Static assets
16
- ├── index.html # HTML entry point
17
- ├── vite.config.ts # Vite configuration
18
- ├── tailwind.config.ts # Tailwind CSS configuration
19
- └── tsconfig.json # TypeScript configuration
20
- ```
21
-
22
- ## Features
23
-
24
- The studio interface includes:
25
- - Report builder UI with chart visualization
26
- - Chart.js integration for various chart types
27
- - Data table views
28
- - Custom field buttons for AI-powered queries
29
- - Report management interface
1
+ # @lobb-js/lobb-ext-reports
@@ -0,0 +1,10 @@
1
+ import type { Hono } from "hono";
2
+
3
+ import { ChartsController } from "./controllers/chartsController.ts";
4
+
5
+ export function collectionRoutes(route: Hono) {
6
+ route.get(
7
+ "/reports_charts/:id",
8
+ ChartsController.findOne,
9
+ );
10
+ }
@@ -0,0 +1,47 @@
1
+ import type { CollectionConfig } from "@lobb-js/core";
2
+
3
+ export const charts: CollectionConfig = {
4
+ "indexes": {},
5
+ "fields": {
6
+ "id": {
7
+ "type": "integer",
8
+ },
9
+ "report_id": {
10
+ "type": "integer",
11
+ "validators": {
12
+ "required": true,
13
+ },
14
+ },
15
+ "title": {
16
+ "type": "string",
17
+ "length": 255,
18
+ "validators": {
19
+ "required": true,
20
+ },
21
+ },
22
+ "description": {
23
+ "type": "string",
24
+ "length": 255,
25
+ },
26
+ "chart": {
27
+ "type": "text",
28
+ "validators": {
29
+ "required": true,
30
+ },
31
+ "pre_processors": {
32
+ "default":
33
+ "async function chart(query: QueryFn, context: Record<string, unknown>) {\n\treturn {\n\t\ttype: 'table',\n\t\tinput: {\n\t\t\tdata: []\n\t\t}\n\t};\n}",
34
+ },
35
+ "ui": {
36
+ "input": {
37
+ "type": "code",
38
+ "args": {
39
+ "type": "typescript",
40
+ "types":
41
+ "type QueryFn = <T>(sql: string, args?: Record<string, any>) => Promise<T[]>;",
42
+ },
43
+ },
44
+ },
45
+ },
46
+ },
47
+ };
@@ -0,0 +1,11 @@
1
+ import type { CollectionConfig } from "@lobb-js/core";
2
+
3
+ import { reports } from "./reports.ts";
4
+ import { charts } from "./charts.ts";
5
+
6
+ export function collections(): Record<string, CollectionConfig> {
7
+ const collectionsSchemas: Record<string, CollectionConfig> = {};
8
+ collectionsSchemas["reports_dashboards"] = reports;
9
+ collectionsSchemas["reports_charts"] = charts;
10
+ return collectionsSchemas;
11
+ }
@@ -0,0 +1,30 @@
1
+ import type { CollectionConfig } from "@lobb-js/core";
2
+
3
+ export const reports: CollectionConfig = {
4
+ "indexes": {
5
+ "name_index": {
6
+ "unique": true,
7
+ "fields": {
8
+ "name": {
9
+ "order": "asc",
10
+ },
11
+ },
12
+ },
13
+ },
14
+ "fields": {
15
+ "id": {
16
+ "type": "integer",
17
+ },
18
+ "name": {
19
+ "type": "string",
20
+ "length": 255,
21
+ "validators": {
22
+ "required": true,
23
+ },
24
+ },
25
+ "description": {
26
+ "type": "string",
27
+ "length": 255,
28
+ },
29
+ },
30
+ };
@@ -0,0 +1,78 @@
1
+ import type { Context } from "hono";
2
+ import type { Lobb } from "@lobb-js/core";
3
+ import { LobbError } from "@lobb-js/core";
4
+
5
+ export class ChartsController {
6
+ public static async findOne(c: Context) {
7
+ const lobb = c.get("lobb") as Lobb;
8
+ const reportRecordId = c.req.param("id");
9
+ const actionQuery = c.req.query("action");
10
+ const context = c.req.query("context");
11
+
12
+ if (actionQuery) {
13
+ if (actionQuery === "run_query") {
14
+ return await handleRunQuery(
15
+ reportRecordId,
16
+ lobb,
17
+ c,
18
+ JSON.parse(context ?? "{}"),
19
+ );
20
+ } else {
21
+ throw new LobbError({
22
+ code: "BAD_REQUEST",
23
+ message:
24
+ `The passed (${actionQuery}) action query param is not supported`,
25
+ });
26
+ }
27
+ }
28
+
29
+ return await lobb.collectionControllers.findOne(
30
+ c,
31
+ ) as Response;
32
+ }
33
+ }
34
+
35
+ async function handleRunQuery(
36
+ reportRecordId: string,
37
+ lobb: Lobb,
38
+ c: Context,
39
+ context: Record<string, unknown>,
40
+ ) {
41
+ const driver = lobb.databaseService.getDriver();
42
+ const pool = driver.getConnection();
43
+ using client = await pool.connect();
44
+
45
+ const chartRecord = (await lobb.collectionService.findOne({
46
+ collectionName: "reports_charts",
47
+ client,
48
+ id: reportRecordId,
49
+ })).data;
50
+
51
+ if (!chartRecord) {
52
+ throw new LobbError({
53
+ code: "NOT_FOUND",
54
+ message: `The chart you are looking for does not exist.`,
55
+ });
56
+ }
57
+
58
+ const pendingQueries: Promise<unknown>[] = [];
59
+
60
+ async function query(sql: string, args: Record<string, any>) {
61
+ const promise = client.query(sql, args).then((result) => result.rows);
62
+ pendingQueries.push(promise);
63
+ return await promise;
64
+ }
65
+
66
+ try {
67
+ const chartReturnedValue = await lobb.utils.runParsedFunction(
68
+ chartRecord.chart,
69
+ query,
70
+ context,
71
+ );
72
+ await Promise.allSettled(pendingQueries);
73
+ return c.json(chartReturnedValue, 200);
74
+ } catch (error) {
75
+ await Promise.allSettled(pendingQueries);
76
+ throw error;
77
+ }
78
+ }
@@ -0,0 +1,24 @@
1
+ import type { Extension } from "@lobb-js/core";
2
+
3
+ import packageJson from "../../package.json" with { type: "json" };
4
+ import studioExtension from "./studioExtension.json" with { type: "json" };
5
+ import { collections } from "./collections/index.ts";
6
+ import { migrations } from "./migrations.ts";
7
+ import { meta } from "./meta.ts";
8
+ import { collectionRoutes } from "./collectionRoutes.ts";
9
+ import { openapi } from "./openapi.ts";
10
+ import { relations } from "./relations.ts";
11
+
12
+ export default function extension(): Extension {
13
+ return {
14
+ version: packageJson.version,
15
+ name: "reports",
16
+ collectionRoutes: collectionRoutes,
17
+ collections: collections,
18
+ relations: relations,
19
+ migrations: migrations,
20
+ meta: meta,
21
+ openapi: openapi,
22
+ dashboard: studioExtension,
23
+ };
24
+ }
@@ -0,0 +1,218 @@
1
+ import type { Lobb } from "@lobb-js/core";
2
+
3
+ // TODO: I dont think we need this. check it and remove it
4
+ export const charts_schema = {
5
+ "line": {
6
+ "description": "This schema represents a line chart configuration.",
7
+ "type": "object",
8
+ "properties": {
9
+ "data": {
10
+ "type": "object",
11
+ "description": "The data section for the chart.",
12
+ "properties": {
13
+ "labels": {
14
+ "type": "array",
15
+ "description": "An array of labels for the x-axis.",
16
+ "items": {
17
+ "type": "string",
18
+ "description":
19
+ "A label representing a single data point on the x-axis.",
20
+ },
21
+ },
22
+ "datasets": {
23
+ "type": "array",
24
+ "description":
25
+ "An array of dataset configurations, each representing a line in the chart.",
26
+ "items": {
27
+ "type": "object",
28
+ "properties": {
29
+ "label": {
30
+ "type": "string",
31
+ "description":
32
+ "The label for the dataset, shown in the chart legend.",
33
+ },
34
+ "data": {
35
+ "type": "array",
36
+ "description":
37
+ "An array of numeric data points for the line.",
38
+ "items": {
39
+ "type": "number",
40
+ "description":
41
+ "A single numeric value representing a point on the line.",
42
+ },
43
+ },
44
+ },
45
+ "required": ["label", "data"],
46
+ "additionalProperties": false,
47
+ },
48
+ },
49
+ },
50
+ "required": ["labels", "datasets"],
51
+ },
52
+ },
53
+ "required": ["data"],
54
+ },
55
+ "bar": {
56
+ "description": "This schema represents a bar chart configuration.",
57
+ "type": "object",
58
+ "properties": {
59
+ "data": {
60
+ "type": "object",
61
+ "description": "The data section for the chart.",
62
+ "properties": {
63
+ "labels": {
64
+ "type": "array",
65
+ "description": "An array of labels for the x-axis.",
66
+ "items": {
67
+ "type": "string",
68
+ "description":
69
+ "A label representing a single data point on the x-axis.",
70
+ },
71
+ },
72
+ "datasets": {
73
+ "type": "array",
74
+ "description":
75
+ "An array of dataset configurations, each representing a bar in the chart.",
76
+ "items": {
77
+ "type": "object",
78
+ "properties": {
79
+ "label": {
80
+ "type": "string",
81
+ "description":
82
+ "The label for the dataset, shown in the chart legend.",
83
+ },
84
+ "data": {
85
+ "type": "array",
86
+ "description": "An array of numeric data points for the bar.",
87
+ "items": {
88
+ "type": "number",
89
+ "description":
90
+ "A single numeric value representing a point for the bar.",
91
+ },
92
+ },
93
+ },
94
+ "required": ["label", "data"],
95
+ "additionalProperties": false,
96
+ },
97
+ },
98
+ },
99
+ "required": ["labels", "datasets"],
100
+ },
101
+ },
102
+ "required": ["data"],
103
+ },
104
+ "bubble": {
105
+ "description": "This schema represents a bubble chart configuration.",
106
+ "type": "object",
107
+ "properties": {
108
+ "data": {
109
+ "type": "object",
110
+ "properties": {
111
+ "datasets": {
112
+ "type": "array",
113
+ "description":
114
+ "An array of dataset objects, each representing a series of bubbles in the chart.",
115
+ "items": {
116
+ "type": "object",
117
+ "properties": {
118
+ "label": {
119
+ "type": "string",
120
+ "description":
121
+ "A label for the dataset, used to identify it in the chart legend.",
122
+ },
123
+ "data": {
124
+ "type": "array",
125
+ "description":
126
+ "An array of objects representing each bubble in the dataset. Each object contains the 'x' and 'y' position along with the bubble's radius ('r').",
127
+ "items": {
128
+ "type": "object",
129
+ "properties": {
130
+ "x": {
131
+ "type": "number",
132
+ "description": "The x-coordinate of the bubble.",
133
+ },
134
+ "y": {
135
+ "type": "number",
136
+ "description": "The y-coordinate of the bubble.",
137
+ },
138
+ "r": {
139
+ "type": "number",
140
+ "description": "The radius of the bubble.",
141
+ },
142
+ },
143
+ "required": ["x", "y", "r"],
144
+ },
145
+ },
146
+ },
147
+ "required": ["label", "data"],
148
+ },
149
+ },
150
+ },
151
+ "required": ["datasets"],
152
+ },
153
+ },
154
+ "required": ["data"],
155
+ },
156
+ "doughnut": {
157
+ "description": "This schema represents a doughnut chart configuration.",
158
+ "type": "object",
159
+ "properties": {
160
+ "data": {
161
+ "type": "object",
162
+ "properties": {
163
+ "labels": {
164
+ "type": "array",
165
+ "items": {
166
+ "type": "string",
167
+ },
168
+ "description":
169
+ "An array of labels for each segment of the doughnut chart.",
170
+ },
171
+ "datasets": {
172
+ "type": "array",
173
+ "items": {
174
+ "type": "object",
175
+ "properties": {
176
+ "label": {
177
+ "type": "string",
178
+ "description":
179
+ "The label for the dataset, which can be displayed in the legend.",
180
+ },
181
+ "data": {
182
+ "type": "array",
183
+ "items": {
184
+ "type": "number",
185
+ },
186
+ "description":
187
+ "An array of numbers corresponding to the data points for each label.",
188
+ },
189
+ "backgroundColor": {
190
+ "type": "array",
191
+ "items": {
192
+ "type": "string",
193
+ },
194
+ "description":
195
+ "An array of colors for each segment of the doughnut chart.",
196
+ },
197
+ },
198
+ "required": ["label", "data"],
199
+ "description":
200
+ "An array of datasets for the doughnut chart, where each dataset corresponds to a set of data points and properties.",
201
+ },
202
+ "description": "An array of datasets for the doughnut chart.",
203
+ },
204
+ },
205
+ "required": ["labels", "datasets"],
206
+ "description":
207
+ "The data object containing the labels and datasets for the doughnut chart.",
208
+ },
209
+ },
210
+ "required": ["data"],
211
+ },
212
+ };
213
+
214
+ export const meta = async (lobb: Lobb) => {
215
+ return {
216
+ charts_schema: charts_schema,
217
+ };
218
+ };
@@ -0,0 +1,3 @@
1
+ import type { MigrationProps, Migrations } from "@lobb-js/core";
2
+
3
+ export const migrations: Migrations = {};
@@ -0,0 +1,39 @@
1
+ import type { OpenAPIV3_1 } from "openapi-types";
2
+
3
+ export const paths: OpenAPIV3_1.Document["paths"] = {
4
+ "/api/collections/reports_charts/{id}": {
5
+ "get": {
6
+ "parameters": [
7
+ {
8
+ "name": "id",
9
+ "in": "path",
10
+ "required": true,
11
+ "description": "The record ID of storage.",
12
+ "schema": {
13
+ "type": "integer",
14
+ "example": 10,
15
+ },
16
+ },
17
+ {
18
+ "name": "action",
19
+ "in": "query",
20
+ "description":
21
+ "Used to execute the DB query of the chart to get its analytics data.",
22
+ "schema": {
23
+ "type": "string",
24
+ "example": "run_query",
25
+ },
26
+ },
27
+ ],
28
+ "responses": {
29
+ "200": {
30
+ "description": "Successful operation",
31
+ },
32
+ },
33
+ },
34
+ },
35
+ };
36
+
37
+ export const openapi = {
38
+ paths: paths,
39
+ };