@checkstack/dashboards-backend 0.0.0-stage → 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,45 @@
1
+ # @checkstack/dashboards-backend
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4df3788: AI agents (the chat assistant and MCP clients) can now build and edit dashboards. `dashboards.getBuildingBlocks` describes the grid, every visualization with its options schema, every registered data source with its query schema, an example query and the tools that find its ids, and the widgets. `dashboards.propose` validates a whole draft (panel types, options, queries, widget ids, grid bounds and overlaps), shows a layout picture and a per-panel diff for review, and creates or updates the dashboard through the contract on approval. A "Building dashboards" guidance section teaches the discover, draft, propose flow and layout conventions.
8
+
9
+ Each dashboard data source's query schema now lives in its plugin's `*-common` package as a `DashboardDataSourceSpec` (`defineDashboardDataSourceSpec`), shared by the frontend and registered by the backend through the new `dashboardBuildingBlocksExtensionPoint`. Built-in visualization option schemas moved to `@checkstack/dashboards-common`.
10
+
11
+ BREAKING CHANGES: `defineDashboardDataSource` now takes `{ spec, icon, defaultQuery, describeQuery, useQueryData, editor | loadEditor }`; move `pluginMetadata`, `id`, `label`, `description`, `produces` and `querySchema` into a spec in your `*-common` package. `createDashboard` and `updateDashboard` are no longer projected as AI tools; agents use `dashboards.propose`.
12
+
13
+ - 4df3788: AI agents with browser tools and vision can check the dashboards they build. The new `dashboards.inspect` tool, and the applied result of `dashboards.propose`, return a text picture of the layout plus a `viewUrl`, a `signInUrl` and (for public dashboards) a `publicUrl`, with steps for checking a screenshot. The "Building dashboards" guidance now ends with that check.
14
+
15
+ The sign-in page accepts `?returnTo=<path>` and opens that page after signing in (credential, custom-form and social sign-in). Only same-origin paths are followed. `@checkstack/auth-common` exports `AUTH_RETURN_TO_PARAM` and `signInPathReturningTo()`.
16
+
17
+ - 4df3788: Add system dashboards: Grafana-style dashboards built per catalog system. A 24-column drag-and-resize grid of panels, each fed by one or more queries against pluggable data sources and drawn by a pluggable visualization (time series with drag-to-zoom and legend stats, stat, gauge, bar gauge, table, logs, status and markdown text). Dashboards share a URL-driven time range (`?from=now-6h&to=now&refresh=30`) with quick ranges, custom ranges, zoom out and auto refresh, open panels full screen via `?viewPanel`, and export to and import from portable JSON. A "Service overview" starter template and a Dashboards card on the system page help you get started.
18
+
19
+ Extensibility: `@checkstack/dashboards-common` defines the `DashboardDataSourceSlot` / `defineDashboardDataSource` and `DashboardVisualizationSlot` / `defineDashboardVisualization` contracts plus the time-series, table and logs data-frame model. Panel data is fetched in the browser by each contributing plugin's own client, so it is always authorized as the viewing user. The backend stores only layouts (`plugin_dashboards.dashboards`), filters every read to dashboards the caller may read on systems the caller may read, gates creation on managing the parent system (with team ownership), and deletes a system's dashboards when the system is deleted.
20
+
21
+ Dashboards can also be **global** (no system): each query then picks its own system (`PanelQuery.systemId`). The start page becomes a configurable **home dashboard**: every start-page section is a **widget** (`dashboards.widget` panels, sized to their content) you can place on any dashboard, users pick their own home and admins set the organization-wide one (`getHomeDashboard`, `setMyHomeDashboard`, `resetMyHomeDashboard`, `setGlobalHomeDashboard`; stored in `plugin_dashboards.home_dashboards`), and customizing the built-in layout saves it as a global dashboard. Each dashboard has a **who can view** setting (`team`, `authenticated`, `roles` with `visibleRoleIds`, or `public`), enforced by the tested `canViewDashboard` on every read, with team ownership and grants managed from its settings. Public dashboards open at `/dashboards/public/<id>` without signing in via `getPublishedDashboard`, gated platform-wide by the new default-anonymous `dashboards.published.read` rule.
22
+
23
+ In view mode, widgets size to their content row by row: panels side by side keep one shared height, empty widgets collapse, and nothing is re-packed out of the stored layout.
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [4df3788]
28
+ - Updated dependencies [e70475a]
29
+ - Updated dependencies [422a2c4]
30
+ - Updated dependencies [f47e471]
31
+ - Updated dependencies [422a2c4]
32
+ - Updated dependencies [4df3788]
33
+ - Updated dependencies [4df3788]
34
+ - Updated dependencies [4df3788]
35
+ - Updated dependencies [54bff58]
36
+ - Updated dependencies [4df3788]
37
+ - @checkstack/ai-backend@0.12.1
38
+ - @checkstack/ai-common@0.8.0
39
+ - @checkstack/dashboards-common@0.1.0
40
+ - @checkstack/auth-common@0.20.0
41
+ - @checkstack/automation-backend@0.13.1
42
+ - @checkstack/catalog-backend@1.12.2
43
+ - @checkstack/backend-api@0.37.1
44
+ - @checkstack/catalog-common@2.10.1
45
+ - @checkstack/command-backend@0.3.7
@@ -0,0 +1,14 @@
1
+ CREATE TABLE "dashboards" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "system_id" text NOT NULL,
4
+ "title" text NOT NULL,
5
+ "description" text,
6
+ "tags" jsonb DEFAULT '[]'::jsonb NOT NULL,
7
+ "panels" jsonb DEFAULT '[]'::jsonb NOT NULL,
8
+ "settings" jsonb NOT NULL,
9
+ "created_by" text,
10
+ "created_at" timestamp DEFAULT now() NOT NULL,
11
+ "updated_at" timestamp DEFAULT now() NOT NULL
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE INDEX "dashboards_system_id_idx" ON "dashboards" USING btree ("system_id");
@@ -0,0 +1,8 @@
1
+ CREATE TABLE "home_dashboards" (
2
+ "scope" text PRIMARY KEY NOT NULL,
3
+ "dashboard_id" text NOT NULL,
4
+ "updated_at" timestamp DEFAULT now() NOT NULL
5
+ );
6
+ --> statement-breakpoint
7
+ ALTER TABLE "dashboards" ALTER COLUMN "system_id" DROP NOT NULL;--> statement-breakpoint
8
+ ALTER TABLE "home_dashboards" ADD CONSTRAINT "home_dashboards_dashboard_id_dashboards_id_fk" FOREIGN KEY ("dashboard_id") REFERENCES "dashboards"("id") ON DELETE cascade ON UPDATE no action;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "dashboards" ADD COLUMN "visibility" text DEFAULT 'authenticated' NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "dashboards" ADD COLUMN "visible_role_ids" jsonb DEFAULT '[]'::jsonb NOT NULL;
@@ -0,0 +1,112 @@
1
+ {
2
+ "id": "71d636d3-39cb-42a6-88b4-de50349803ff",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.dashboards": {
8
+ "name": "dashboards",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "system_id": {
18
+ "name": "system_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "title": {
24
+ "name": "title",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "description": {
30
+ "name": "description",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "tags": {
36
+ "name": "tags",
37
+ "type": "jsonb",
38
+ "primaryKey": false,
39
+ "notNull": true,
40
+ "default": "'[]'::jsonb"
41
+ },
42
+ "panels": {
43
+ "name": "panels",
44
+ "type": "jsonb",
45
+ "primaryKey": false,
46
+ "notNull": true,
47
+ "default": "'[]'::jsonb"
48
+ },
49
+ "settings": {
50
+ "name": "settings",
51
+ "type": "jsonb",
52
+ "primaryKey": false,
53
+ "notNull": true
54
+ },
55
+ "created_by": {
56
+ "name": "created_by",
57
+ "type": "text",
58
+ "primaryKey": false,
59
+ "notNull": false
60
+ },
61
+ "created_at": {
62
+ "name": "created_at",
63
+ "type": "timestamp",
64
+ "primaryKey": false,
65
+ "notNull": true,
66
+ "default": "now()"
67
+ },
68
+ "updated_at": {
69
+ "name": "updated_at",
70
+ "type": "timestamp",
71
+ "primaryKey": false,
72
+ "notNull": true,
73
+ "default": "now()"
74
+ }
75
+ },
76
+ "indexes": {
77
+ "dashboards_system_id_idx": {
78
+ "name": "dashboards_system_id_idx",
79
+ "columns": [
80
+ {
81
+ "expression": "system_id",
82
+ "isExpression": false,
83
+ "asc": true,
84
+ "nulls": "last"
85
+ }
86
+ ],
87
+ "isUnique": false,
88
+ "concurrently": false,
89
+ "method": "btree",
90
+ "with": {}
91
+ }
92
+ },
93
+ "foreignKeys": {},
94
+ "compositePrimaryKeys": {},
95
+ "uniqueConstraints": {},
96
+ "policies": {},
97
+ "checkConstraints": {},
98
+ "isRLSEnabled": false
99
+ }
100
+ },
101
+ "enums": {},
102
+ "schemas": {},
103
+ "sequences": {},
104
+ "roles": {},
105
+ "policies": {},
106
+ "views": {},
107
+ "_meta": {
108
+ "columns": {},
109
+ "schemas": {},
110
+ "tables": {}
111
+ }
112
+ }
@@ -0,0 +1,158 @@
1
+ {
2
+ "id": "c4154e5c-8624-4310-96d9-85d5c23c4b3c",
3
+ "prevId": "71d636d3-39cb-42a6-88b4-de50349803ff",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.dashboards": {
8
+ "name": "dashboards",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "system_id": {
18
+ "name": "system_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false
22
+ },
23
+ "title": {
24
+ "name": "title",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "description": {
30
+ "name": "description",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "tags": {
36
+ "name": "tags",
37
+ "type": "jsonb",
38
+ "primaryKey": false,
39
+ "notNull": true,
40
+ "default": "'[]'::jsonb"
41
+ },
42
+ "panels": {
43
+ "name": "panels",
44
+ "type": "jsonb",
45
+ "primaryKey": false,
46
+ "notNull": true,
47
+ "default": "'[]'::jsonb"
48
+ },
49
+ "settings": {
50
+ "name": "settings",
51
+ "type": "jsonb",
52
+ "primaryKey": false,
53
+ "notNull": true
54
+ },
55
+ "created_by": {
56
+ "name": "created_by",
57
+ "type": "text",
58
+ "primaryKey": false,
59
+ "notNull": false
60
+ },
61
+ "created_at": {
62
+ "name": "created_at",
63
+ "type": "timestamp",
64
+ "primaryKey": false,
65
+ "notNull": true,
66
+ "default": "now()"
67
+ },
68
+ "updated_at": {
69
+ "name": "updated_at",
70
+ "type": "timestamp",
71
+ "primaryKey": false,
72
+ "notNull": true,
73
+ "default": "now()"
74
+ }
75
+ },
76
+ "indexes": {
77
+ "dashboards_system_id_idx": {
78
+ "name": "dashboards_system_id_idx",
79
+ "columns": [
80
+ {
81
+ "expression": "system_id",
82
+ "isExpression": false,
83
+ "asc": true,
84
+ "nulls": "last"
85
+ }
86
+ ],
87
+ "isUnique": false,
88
+ "concurrently": false,
89
+ "method": "btree",
90
+ "with": {}
91
+ }
92
+ },
93
+ "foreignKeys": {},
94
+ "compositePrimaryKeys": {},
95
+ "uniqueConstraints": {},
96
+ "policies": {},
97
+ "checkConstraints": {},
98
+ "isRLSEnabled": false
99
+ },
100
+ "public.home_dashboards": {
101
+ "name": "home_dashboards",
102
+ "schema": "",
103
+ "columns": {
104
+ "scope": {
105
+ "name": "scope",
106
+ "type": "text",
107
+ "primaryKey": true,
108
+ "notNull": true
109
+ },
110
+ "dashboard_id": {
111
+ "name": "dashboard_id",
112
+ "type": "text",
113
+ "primaryKey": false,
114
+ "notNull": true
115
+ },
116
+ "updated_at": {
117
+ "name": "updated_at",
118
+ "type": "timestamp",
119
+ "primaryKey": false,
120
+ "notNull": true,
121
+ "default": "now()"
122
+ }
123
+ },
124
+ "indexes": {},
125
+ "foreignKeys": {
126
+ "home_dashboards_dashboard_id_dashboards_id_fk": {
127
+ "name": "home_dashboards_dashboard_id_dashboards_id_fk",
128
+ "tableFrom": "home_dashboards",
129
+ "tableTo": "dashboards",
130
+ "columnsFrom": [
131
+ "dashboard_id"
132
+ ],
133
+ "columnsTo": [
134
+ "id"
135
+ ],
136
+ "onDelete": "cascade",
137
+ "onUpdate": "no action"
138
+ }
139
+ },
140
+ "compositePrimaryKeys": {},
141
+ "uniqueConstraints": {},
142
+ "policies": {},
143
+ "checkConstraints": {},
144
+ "isRLSEnabled": false
145
+ }
146
+ },
147
+ "enums": {},
148
+ "schemas": {},
149
+ "sequences": {},
150
+ "roles": {},
151
+ "policies": {},
152
+ "views": {},
153
+ "_meta": {
154
+ "columns": {},
155
+ "schemas": {},
156
+ "tables": {}
157
+ }
158
+ }
@@ -0,0 +1,172 @@
1
+ {
2
+ "id": "41d5b543-9940-4228-89f2-2b1524b0c806",
3
+ "prevId": "c4154e5c-8624-4310-96d9-85d5c23c4b3c",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.dashboards": {
8
+ "name": "dashboards",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "system_id": {
18
+ "name": "system_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false
22
+ },
23
+ "title": {
24
+ "name": "title",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "description": {
30
+ "name": "description",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "tags": {
36
+ "name": "tags",
37
+ "type": "jsonb",
38
+ "primaryKey": false,
39
+ "notNull": true,
40
+ "default": "'[]'::jsonb"
41
+ },
42
+ "panels": {
43
+ "name": "panels",
44
+ "type": "jsonb",
45
+ "primaryKey": false,
46
+ "notNull": true,
47
+ "default": "'[]'::jsonb"
48
+ },
49
+ "visibility": {
50
+ "name": "visibility",
51
+ "type": "text",
52
+ "primaryKey": false,
53
+ "notNull": true,
54
+ "default": "'authenticated'"
55
+ },
56
+ "visible_role_ids": {
57
+ "name": "visible_role_ids",
58
+ "type": "jsonb",
59
+ "primaryKey": false,
60
+ "notNull": true,
61
+ "default": "'[]'::jsonb"
62
+ },
63
+ "settings": {
64
+ "name": "settings",
65
+ "type": "jsonb",
66
+ "primaryKey": false,
67
+ "notNull": true
68
+ },
69
+ "created_by": {
70
+ "name": "created_by",
71
+ "type": "text",
72
+ "primaryKey": false,
73
+ "notNull": false
74
+ },
75
+ "created_at": {
76
+ "name": "created_at",
77
+ "type": "timestamp",
78
+ "primaryKey": false,
79
+ "notNull": true,
80
+ "default": "now()"
81
+ },
82
+ "updated_at": {
83
+ "name": "updated_at",
84
+ "type": "timestamp",
85
+ "primaryKey": false,
86
+ "notNull": true,
87
+ "default": "now()"
88
+ }
89
+ },
90
+ "indexes": {
91
+ "dashboards_system_id_idx": {
92
+ "name": "dashboards_system_id_idx",
93
+ "columns": [
94
+ {
95
+ "expression": "system_id",
96
+ "isExpression": false,
97
+ "asc": true,
98
+ "nulls": "last"
99
+ }
100
+ ],
101
+ "isUnique": false,
102
+ "concurrently": false,
103
+ "method": "btree",
104
+ "with": {}
105
+ }
106
+ },
107
+ "foreignKeys": {},
108
+ "compositePrimaryKeys": {},
109
+ "uniqueConstraints": {},
110
+ "policies": {},
111
+ "checkConstraints": {},
112
+ "isRLSEnabled": false
113
+ },
114
+ "public.home_dashboards": {
115
+ "name": "home_dashboards",
116
+ "schema": "",
117
+ "columns": {
118
+ "scope": {
119
+ "name": "scope",
120
+ "type": "text",
121
+ "primaryKey": true,
122
+ "notNull": true
123
+ },
124
+ "dashboard_id": {
125
+ "name": "dashboard_id",
126
+ "type": "text",
127
+ "primaryKey": false,
128
+ "notNull": true
129
+ },
130
+ "updated_at": {
131
+ "name": "updated_at",
132
+ "type": "timestamp",
133
+ "primaryKey": false,
134
+ "notNull": true,
135
+ "default": "now()"
136
+ }
137
+ },
138
+ "indexes": {},
139
+ "foreignKeys": {
140
+ "home_dashboards_dashboard_id_dashboards_id_fk": {
141
+ "name": "home_dashboards_dashboard_id_dashboards_id_fk",
142
+ "tableFrom": "home_dashboards",
143
+ "tableTo": "dashboards",
144
+ "columnsFrom": [
145
+ "dashboard_id"
146
+ ],
147
+ "columnsTo": [
148
+ "id"
149
+ ],
150
+ "onDelete": "cascade",
151
+ "onUpdate": "no action"
152
+ }
153
+ },
154
+ "compositePrimaryKeys": {},
155
+ "uniqueConstraints": {},
156
+ "policies": {},
157
+ "checkConstraints": {},
158
+ "isRLSEnabled": false
159
+ }
160
+ },
161
+ "enums": {},
162
+ "schemas": {},
163
+ "sequences": {},
164
+ "roles": {},
165
+ "policies": {},
166
+ "views": {},
167
+ "_meta": {
168
+ "columns": {},
169
+ "schemas": {},
170
+ "tables": {}
171
+ }
172
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1796473337226,
9
+ "tag": "0000_ancient_abomination",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1796475533595,
16
+ "tag": "0001_vengeful_lenny_balinger",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1796475748476,
23
+ "tag": "0002_flat_hex",
24
+ "breakpoints": true
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "drizzle-kit";
2
+
3
+ export default defineConfig({
4
+ schema: "./src/schema.ts",
5
+ out: "./drizzle",
6
+ dialect: "postgresql",
7
+ });
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@checkstack/dashboards-backend",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "Elastic-2.0",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "checkstack": {
8
+ "type": "backend"
9
+ },
10
+ "scripts": {
11
+ "typecheck": "tsgo -b",
12
+ "generate": "drizzle-kit generate",
13
+ "lint": "bun run lint:code",
14
+ "lint:code": "eslint . --max-warnings 0",
15
+ "test": "bun test"
16
+ },
17
+ "dependencies": {
18
+ "@checkstack/ai-backend": "0.12.1",
19
+ "@checkstack/ai-common": "0.8.0",
20
+ "@checkstack/auth-common": "0.20.0",
21
+ "@checkstack/automation-backend": "0.13.1",
22
+ "@checkstack/backend-api": "0.37.1",
23
+ "@checkstack/catalog-backend": "1.12.2",
24
+ "@checkstack/catalog-common": "2.10.1",
25
+ "@checkstack/command-backend": "0.3.7",
26
+ "@checkstack/common": "0.25.0",
27
+ "@checkstack/dashboards-common": "0.1.0",
28
+ "@orpc/contract": "^1.15.7",
29
+ "@orpc/server": "1.15.0",
30
+ "drizzle-orm": "^0.45.0",
31
+ "zod": "^4.2.1"
32
+ },
33
+ "devDependencies": {
34
+ "@checkstack/drizzle-helper": "0.0.6",
35
+ "@checkstack/scripts": "0.7.9",
36
+ "@checkstack/test-utils-backend": "0.1.69",
37
+ "@checkstack/tsconfig": "0.0.7",
38
+ "@types/bun": "^1.0.0",
39
+ "drizzle-kit": "^0.31.10",
40
+ "typescript": "^5.0.0"
41
+ }
42
+ }