@lssm/example.analytics-dashboard 0.0.0-canary-20251216035145 → 0.0.0-canary-20251217023603
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/dashboard/dashboard.contracts.js +119 -1
- package/dist/dashboard/dashboard.enum.js +42 -1
- package/dist/dashboard/dashboard.presentation.js +76 -0
- package/dist/dashboard/dashboard.schema.js +235 -1
- package/dist/dashboard/index.js +5 -1
- package/dist/dashboard.feature.js +164 -1
- package/dist/docs/analytics-dashboard.docblock.js +60 -5
- package/dist/docs/index.js +1 -1
- package/dist/events.js +112 -0
- package/dist/example.js +50 -1
- package/dist/index.js +8 -1
- package/dist/query/index.js +5 -1
- package/dist/query/query.contracts.js +65 -1
- package/dist/query/query.enum.js +15 -1
- package/dist/query/query.presentation.js +50 -0
- package/dist/query/query.schema.js +156 -1
- package/dist/query-engine/index.js +185 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -1
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import{registerDocBlocks
|
|
1
|
+
import { registerDocBlocks } from "@lssm/lib.contracts/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/docs/analytics-dashboard.docblock.ts
|
|
4
|
+
registerDocBlocks([
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.analytics-dashboard",
|
|
7
|
+
title: "Analytics Dashboard",
|
|
8
|
+
summary: "Multi-tenant analytics with dashboards, widgets, query builder, and scheduled reports built on the Event Bus.",
|
|
9
|
+
kind: "reference",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/analytics-dashboard",
|
|
12
|
+
tags: [
|
|
13
|
+
"analytics",
|
|
14
|
+
"dashboards",
|
|
15
|
+
"bi",
|
|
16
|
+
"queries"
|
|
17
|
+
],
|
|
18
|
+
body: `## Entities
|
|
2
19
|
|
|
3
20
|
- Dashboard, Widget, Query, Report.
|
|
4
21
|
- Widget/query configs stay declarative for regeneration.
|
|
@@ -22,7 +39,17 @@ import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.exampl
|
|
|
22
39
|
|
|
23
40
|
- Enforce org scoping for multi-tenant isolation.
|
|
24
41
|
- Use Feature Flags for beta widgets; Metering to track query volume.
|
|
25
|
-
`
|
|
42
|
+
`
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "docs.examples.analytics-dashboard.goal",
|
|
46
|
+
title: "Analytics Dashboard — Goal",
|
|
47
|
+
summary: "Why this template matters and what success looks like.",
|
|
48
|
+
kind: "goal",
|
|
49
|
+
visibility: "public",
|
|
50
|
+
route: "/docs/examples/analytics-dashboard/goal",
|
|
51
|
+
tags: ["analytics", "goal"],
|
|
52
|
+
body: `## Why it matters
|
|
26
53
|
- Give teams a regenerable analytics workspace that stays in sync with Event Bus, Usage/Metering, and presentations.
|
|
27
54
|
- Avoid dashboard drift by keeping schema-first widgets/queries.
|
|
28
55
|
|
|
@@ -32,7 +59,17 @@ import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.exampl
|
|
|
32
59
|
|
|
33
60
|
## Success criteria
|
|
34
61
|
- Dashboards can be regenerated safely from spec changes.
|
|
35
|
-
- Queries/widgets have enforced validation; PII is redacted per policy.`
|
|
62
|
+
- Queries/widgets have enforced validation; PII is redacted per policy.`
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "docs.examples.analytics-dashboard.usage",
|
|
66
|
+
title: "Analytics Dashboard — Usage",
|
|
67
|
+
summary: "How to seed, extend, and safely regenerate dashboards.",
|
|
68
|
+
kind: "usage",
|
|
69
|
+
visibility: "public",
|
|
70
|
+
route: "/docs/examples/analytics-dashboard/usage",
|
|
71
|
+
tags: ["analytics", "usage"],
|
|
72
|
+
body: `## Setup
|
|
36
73
|
1) Seed dashboards/widgets (via template registry) to preload sample queries.
|
|
37
74
|
2) Configure org/tenant scope and attach Usage/Metering for cost/sampling controls.
|
|
38
75
|
|
|
@@ -43,7 +80,21 @@ import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.exampl
|
|
|
43
80
|
|
|
44
81
|
## Guardrails
|
|
45
82
|
- Keep all query inputs validated; mark PII paths in policy.
|
|
46
|
-
- Use Audit Trail for report deliveries; Notifications for scheduled sends.`
|
|
83
|
+
- Use Audit Trail for report deliveries; Notifications for scheduled sends.`
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "docs.examples.analytics-dashboard.constraints",
|
|
87
|
+
title: "Analytics Dashboard — Constraints & Safety",
|
|
88
|
+
summary: "Internal guardrails for queries, widgets, and regeneration.",
|
|
89
|
+
kind: "reference",
|
|
90
|
+
visibility: "internal",
|
|
91
|
+
route: "/docs/examples/analytics-dashboard/constraints",
|
|
92
|
+
tags: [
|
|
93
|
+
"analytics",
|
|
94
|
+
"constraints",
|
|
95
|
+
"internal"
|
|
96
|
+
],
|
|
97
|
+
body: `## Constraints
|
|
47
98
|
- Queries and widgets must declare inputs/validation in spec; no ad-hoc query strings.
|
|
48
99
|
- Regeneration must preserve sampling/windowing semantics; document changes explicitly.
|
|
49
100
|
- Events/usage metrics should remain consistent with Metering/Audit wiring.
|
|
@@ -55,4 +106,8 @@ import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.exampl
|
|
|
55
106
|
## Verification
|
|
56
107
|
- Add fixtures for widget/query schema changes and scheduled reports.
|
|
57
108
|
- Run regeneration diff when adjusting query builders; ensure UI/markdown targets updated.
|
|
58
|
-
- Confirm feature-flagged widgets default to safe/off for new tenants.`
|
|
109
|
+
- Confirm feature-flagged widgets default to safe/off for new tenants.`
|
|
110
|
+
}
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
//#endregion
|
package/dist/docs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./analytics-dashboard.docblock.js";
|
|
1
|
+
import "./analytics-dashboard.docblock.js";
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@lssm/lib.schema";
|
|
2
|
+
import { defineEvent } from "@lssm/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/events.ts
|
|
5
|
+
const DashboardEventPayload = defineSchemaModel({
|
|
6
|
+
name: "DashboardEventPayload",
|
|
7
|
+
description: "Payload for dashboard events",
|
|
8
|
+
fields: {
|
|
9
|
+
dashboardId: {
|
|
10
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
11
|
+
isOptional: false
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
orgId: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
createdBy: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
timestamp: {
|
|
26
|
+
type: ScalarTypeEnum.DateTime(),
|
|
27
|
+
isOptional: false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const WidgetEventPayload = defineSchemaModel({
|
|
32
|
+
name: "WidgetEventPayload",
|
|
33
|
+
description: "Payload for widget events",
|
|
34
|
+
fields: {
|
|
35
|
+
widgetId: {
|
|
36
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
37
|
+
isOptional: false
|
|
38
|
+
},
|
|
39
|
+
dashboardId: {
|
|
40
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
41
|
+
isOptional: false
|
|
42
|
+
},
|
|
43
|
+
widgetType: {
|
|
44
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
45
|
+
isOptional: false
|
|
46
|
+
},
|
|
47
|
+
orgId: {
|
|
48
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
49
|
+
isOptional: false
|
|
50
|
+
},
|
|
51
|
+
timestamp: {
|
|
52
|
+
type: ScalarTypeEnum.DateTime(),
|
|
53
|
+
isOptional: false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const QueryEventPayload = defineSchemaModel({
|
|
58
|
+
name: "QueryEventPayload",
|
|
59
|
+
description: "Payload for query events",
|
|
60
|
+
fields: {
|
|
61
|
+
queryId: {
|
|
62
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
63
|
+
isOptional: false
|
|
64
|
+
},
|
|
65
|
+
name: {
|
|
66
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
67
|
+
isOptional: false
|
|
68
|
+
},
|
|
69
|
+
queryType: {
|
|
70
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
71
|
+
isOptional: false
|
|
72
|
+
},
|
|
73
|
+
orgId: {
|
|
74
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
75
|
+
isOptional: false
|
|
76
|
+
},
|
|
77
|
+
createdBy: {
|
|
78
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
79
|
+
isOptional: false
|
|
80
|
+
},
|
|
81
|
+
timestamp: {
|
|
82
|
+
type: ScalarTypeEnum.DateTime(),
|
|
83
|
+
isOptional: false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const DashboardCreatedEvent = defineEvent({
|
|
88
|
+
name: "analytics.dashboard.created",
|
|
89
|
+
version: 1,
|
|
90
|
+
description: "A dashboard was created.",
|
|
91
|
+
payload: DashboardEventPayload
|
|
92
|
+
});
|
|
93
|
+
const WidgetAddedEvent = defineEvent({
|
|
94
|
+
name: "analytics.widget.added",
|
|
95
|
+
version: 1,
|
|
96
|
+
description: "A widget was added to a dashboard.",
|
|
97
|
+
payload: WidgetEventPayload
|
|
98
|
+
});
|
|
99
|
+
const QueryCreatedEvent = defineEvent({
|
|
100
|
+
name: "analytics.query.created",
|
|
101
|
+
version: 1,
|
|
102
|
+
description: "A query was created.",
|
|
103
|
+
payload: QueryEventPayload
|
|
104
|
+
});
|
|
105
|
+
const AnalyticsDashboardEvents = {
|
|
106
|
+
DashboardCreatedEvent,
|
|
107
|
+
WidgetAddedEvent,
|
|
108
|
+
QueryCreatedEvent
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
export { AnalyticsDashboardEvents, DashboardCreatedEvent, QueryCreatedEvent, WidgetAddedEvent };
|
package/dist/example.js
CHANGED
|
@@ -1 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/example.ts
|
|
2
|
+
const example = {
|
|
3
|
+
id: "analytics-dashboard",
|
|
4
|
+
title: "Analytics Dashboard",
|
|
5
|
+
summary: "Tenant-scoped dashboards, widgets, query builder, and scheduled reports (spec-first widgets/queries).",
|
|
6
|
+
tags: [
|
|
7
|
+
"analytics",
|
|
8
|
+
"dashboards",
|
|
9
|
+
"bi",
|
|
10
|
+
"queries"
|
|
11
|
+
],
|
|
12
|
+
kind: "template",
|
|
13
|
+
visibility: "public",
|
|
14
|
+
docs: {
|
|
15
|
+
rootDocId: "docs.examples.analytics-dashboard",
|
|
16
|
+
goalDocId: "docs.examples.analytics-dashboard.goal",
|
|
17
|
+
usageDocId: "docs.examples.analytics-dashboard.usage",
|
|
18
|
+
constraintsDocId: "docs.examples.analytics-dashboard.constraints"
|
|
19
|
+
},
|
|
20
|
+
entrypoints: {
|
|
21
|
+
packageName: "@lssm/example.analytics-dashboard",
|
|
22
|
+
feature: "./feature",
|
|
23
|
+
contracts: "./contracts",
|
|
24
|
+
presentations: "./presentations",
|
|
25
|
+
handlers: "./handlers",
|
|
26
|
+
docs: "./docs"
|
|
27
|
+
},
|
|
28
|
+
surfaces: {
|
|
29
|
+
templates: true,
|
|
30
|
+
sandbox: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
modes: [
|
|
33
|
+
"playground",
|
|
34
|
+
"specs",
|
|
35
|
+
"builder",
|
|
36
|
+
"markdown",
|
|
37
|
+
"evolution"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
studio: {
|
|
41
|
+
enabled: true,
|
|
42
|
+
installable: true
|
|
43
|
+
},
|
|
44
|
+
mcp: { enabled: true }
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var example_default = example;
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { example_default as default };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AnalyticsDashboardFeature } from "./dashboard.feature.js";
|
|
2
|
+
import { QueryTypeEnum } from "./query/query.enum.js";
|
|
3
|
+
import { CreateQueryInputModel, ExecuteQueryInputModel, QueryModel, QueryResultModel } from "./query/query.schema.js";
|
|
4
|
+
import { CreateQueryContract, ExecuteQueryContract } from "./query/query.contracts.js";
|
|
5
|
+
import "./query/index.js";
|
|
6
|
+
import { BasicQueryEngine, InMemoryQueryCache, createQueryEngine } from "./query-engine/index.js";
|
|
7
|
+
|
|
8
|
+
export { AnalyticsDashboardFeature, BasicQueryEngine, CreateQueryContract, CreateQueryInputModel, ExecuteQueryContract, ExecuteQueryInputModel, InMemoryQueryCache, QueryModel, QueryResultModel, QueryTypeEnum, createQueryEngine };
|
package/dist/query/index.js
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{QueryTypeEnum
|
|
1
|
+
import { QueryTypeEnum } from "./query.enum.js";
|
|
2
|
+
import { CreateQueryInputModel, ExecuteQueryInputModel, QueryModel, QueryResultModel } from "./query.schema.js";
|
|
3
|
+
import { CreateQueryContract, ExecuteQueryContract } from "./query.contracts.js";
|
|
4
|
+
|
|
5
|
+
export { CreateQueryContract, CreateQueryInputModel, ExecuteQueryContract, ExecuteQueryInputModel, QueryModel, QueryResultModel, QueryTypeEnum };
|
|
@@ -1 +1,65 @@
|
|
|
1
|
-
import{CreateQueryInputModel
|
|
1
|
+
import { CreateQueryInputModel, ExecuteQueryInputModel, QueryModel, QueryResultModel } from "./query.schema.js";
|
|
2
|
+
import { defineCommand, defineQuery } from "@lssm/lib.contracts/spec";
|
|
3
|
+
|
|
4
|
+
//#region src/query/query.contracts.ts
|
|
5
|
+
const OWNERS = ["@example.analytics-dashboard"];
|
|
6
|
+
/**
|
|
7
|
+
* Create a data query.
|
|
8
|
+
*/
|
|
9
|
+
const CreateQueryContract = defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: "analytics.query.create",
|
|
12
|
+
version: 1,
|
|
13
|
+
stability: "stable",
|
|
14
|
+
owners: [...OWNERS],
|
|
15
|
+
tags: [
|
|
16
|
+
"analytics",
|
|
17
|
+
"query",
|
|
18
|
+
"create"
|
|
19
|
+
],
|
|
20
|
+
description: "Create a data query.",
|
|
21
|
+
goal: "Define reusable data queries.",
|
|
22
|
+
context: "Query builder."
|
|
23
|
+
},
|
|
24
|
+
io: {
|
|
25
|
+
input: CreateQueryInputModel,
|
|
26
|
+
output: QueryModel
|
|
27
|
+
},
|
|
28
|
+
policy: { auth: "user" },
|
|
29
|
+
sideEffects: {
|
|
30
|
+
emits: [{
|
|
31
|
+
name: "analytics.query.created",
|
|
32
|
+
version: 1,
|
|
33
|
+
when: "Query created",
|
|
34
|
+
payload: QueryModel
|
|
35
|
+
}],
|
|
36
|
+
audit: ["analytics.query.created"]
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Execute a data query.
|
|
41
|
+
*/
|
|
42
|
+
const ExecuteQueryContract = defineQuery({
|
|
43
|
+
meta: {
|
|
44
|
+
name: "analytics.query.execute",
|
|
45
|
+
version: 1,
|
|
46
|
+
stability: "stable",
|
|
47
|
+
owners: [...OWNERS],
|
|
48
|
+
tags: [
|
|
49
|
+
"analytics",
|
|
50
|
+
"query",
|
|
51
|
+
"execute"
|
|
52
|
+
],
|
|
53
|
+
description: "Execute a data query.",
|
|
54
|
+
goal: "Fetch data for visualizations.",
|
|
55
|
+
context: "Dashboard rendering."
|
|
56
|
+
},
|
|
57
|
+
io: {
|
|
58
|
+
input: ExecuteQueryInputModel,
|
|
59
|
+
output: QueryResultModel
|
|
60
|
+
},
|
|
61
|
+
policy: { auth: "user" }
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { CreateQueryContract, ExecuteQueryContract };
|
package/dist/query/query.enum.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import{defineEnum
|
|
1
|
+
import { defineEnum } from "@lssm/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/query/query.enum.ts
|
|
4
|
+
/**
|
|
5
|
+
* Query type enum.
|
|
6
|
+
*/
|
|
7
|
+
const QueryTypeEnum = defineEnum("QueryType", [
|
|
8
|
+
"SQL",
|
|
9
|
+
"METRIC",
|
|
10
|
+
"AGGREGATION",
|
|
11
|
+
"CUSTOM"
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { QueryTypeEnum };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { QueryModel } from "./query.schema.js";
|
|
2
|
+
|
|
3
|
+
//#region src/query/query.presentation.ts
|
|
4
|
+
const QueriesListPresentation = {
|
|
5
|
+
meta: {
|
|
6
|
+
name: "analytics.query.list",
|
|
7
|
+
version: 1,
|
|
8
|
+
description: "List of saved queries",
|
|
9
|
+
domain: "analytics",
|
|
10
|
+
owners: ["@analytics-dashboard"],
|
|
11
|
+
tags: [
|
|
12
|
+
"analytics",
|
|
13
|
+
"queries",
|
|
14
|
+
"list"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
source: {
|
|
18
|
+
type: "component",
|
|
19
|
+
framework: "react",
|
|
20
|
+
componentKey: "QueriesList",
|
|
21
|
+
props: QueryModel
|
|
22
|
+
},
|
|
23
|
+
targets: ["react", "markdown"],
|
|
24
|
+
policy: { flags: ["analytics.queries.enabled"] }
|
|
25
|
+
};
|
|
26
|
+
const QueryBuilderPresentation = {
|
|
27
|
+
meta: {
|
|
28
|
+
name: "analytics.query.builder",
|
|
29
|
+
version: 1,
|
|
30
|
+
description: "Visual query builder interface",
|
|
31
|
+
domain: "analytics",
|
|
32
|
+
owners: ["@analytics-dashboard"],
|
|
33
|
+
tags: [
|
|
34
|
+
"analytics",
|
|
35
|
+
"query",
|
|
36
|
+
"builder"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
source: {
|
|
40
|
+
type: "component",
|
|
41
|
+
framework: "react",
|
|
42
|
+
componentKey: "QueryBuilder",
|
|
43
|
+
props: QueryModel
|
|
44
|
+
},
|
|
45
|
+
targets: ["react"],
|
|
46
|
+
policy: { flags: ["analytics.queries.enabled"] }
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { QueriesListPresentation, QueryBuilderPresentation };
|
|
@@ -1 +1,156 @@
|
|
|
1
|
-
import{QueryTypeEnum
|
|
1
|
+
import { QueryTypeEnum } from "./query.enum.js";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@lssm/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/query/query.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* A data query.
|
|
7
|
+
*/
|
|
8
|
+
const QueryModel = defineSchemaModel({
|
|
9
|
+
name: "QueryModel",
|
|
10
|
+
fields: {
|
|
11
|
+
id: {
|
|
12
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
13
|
+
isOptional: false
|
|
14
|
+
},
|
|
15
|
+
name: {
|
|
16
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
17
|
+
isOptional: false
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
21
|
+
isOptional: true
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
type: QueryTypeEnum,
|
|
25
|
+
isOptional: false
|
|
26
|
+
},
|
|
27
|
+
definition: {
|
|
28
|
+
type: ScalarTypeEnum.JSON(),
|
|
29
|
+
isOptional: false
|
|
30
|
+
},
|
|
31
|
+
sql: {
|
|
32
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
33
|
+
isOptional: true
|
|
34
|
+
},
|
|
35
|
+
cacheTtlSeconds: {
|
|
36
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
37
|
+
isOptional: false
|
|
38
|
+
},
|
|
39
|
+
isShared: {
|
|
40
|
+
type: ScalarTypeEnum.Boolean(),
|
|
41
|
+
isOptional: false
|
|
42
|
+
},
|
|
43
|
+
createdAt: {
|
|
44
|
+
type: ScalarTypeEnum.DateTime(),
|
|
45
|
+
isOptional: false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Query execution result.
|
|
51
|
+
*/
|
|
52
|
+
const QueryResultModel = defineSchemaModel({
|
|
53
|
+
name: "QueryResultModel",
|
|
54
|
+
fields: {
|
|
55
|
+
queryId: {
|
|
56
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
57
|
+
isOptional: false
|
|
58
|
+
},
|
|
59
|
+
data: {
|
|
60
|
+
type: ScalarTypeEnum.JSON(),
|
|
61
|
+
isOptional: false
|
|
62
|
+
},
|
|
63
|
+
columns: {
|
|
64
|
+
type: ScalarTypeEnum.JSON(),
|
|
65
|
+
isOptional: false
|
|
66
|
+
},
|
|
67
|
+
rowCount: {
|
|
68
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
69
|
+
isOptional: false
|
|
70
|
+
},
|
|
71
|
+
executionTimeMs: {
|
|
72
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
73
|
+
isOptional: false
|
|
74
|
+
},
|
|
75
|
+
cachedAt: {
|
|
76
|
+
type: ScalarTypeEnum.DateTime(),
|
|
77
|
+
isOptional: true
|
|
78
|
+
},
|
|
79
|
+
error: {
|
|
80
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
81
|
+
isOptional: true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* Input for creating a query.
|
|
87
|
+
*/
|
|
88
|
+
const CreateQueryInputModel = defineSchemaModel({
|
|
89
|
+
name: "CreateQueryInput",
|
|
90
|
+
fields: {
|
|
91
|
+
name: {
|
|
92
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
93
|
+
isOptional: false
|
|
94
|
+
},
|
|
95
|
+
description: {
|
|
96
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
97
|
+
isOptional: true
|
|
98
|
+
},
|
|
99
|
+
type: {
|
|
100
|
+
type: QueryTypeEnum,
|
|
101
|
+
isOptional: false
|
|
102
|
+
},
|
|
103
|
+
definition: {
|
|
104
|
+
type: ScalarTypeEnum.JSON(),
|
|
105
|
+
isOptional: false
|
|
106
|
+
},
|
|
107
|
+
sql: {
|
|
108
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
109
|
+
isOptional: true
|
|
110
|
+
},
|
|
111
|
+
metricIds: {
|
|
112
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
113
|
+
isArray: true,
|
|
114
|
+
isOptional: true
|
|
115
|
+
},
|
|
116
|
+
cacheTtlSeconds: {
|
|
117
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
118
|
+
isOptional: true
|
|
119
|
+
},
|
|
120
|
+
isShared: {
|
|
121
|
+
type: ScalarTypeEnum.Boolean(),
|
|
122
|
+
isOptional: true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
/**
|
|
127
|
+
* Input for executing a query.
|
|
128
|
+
*/
|
|
129
|
+
const ExecuteQueryInputModel = defineSchemaModel({
|
|
130
|
+
name: "ExecuteQueryInput",
|
|
131
|
+
fields: {
|
|
132
|
+
queryId: {
|
|
133
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
134
|
+
isOptional: false
|
|
135
|
+
},
|
|
136
|
+
parameters: {
|
|
137
|
+
type: ScalarTypeEnum.JSON(),
|
|
138
|
+
isOptional: true
|
|
139
|
+
},
|
|
140
|
+
dateRange: {
|
|
141
|
+
type: ScalarTypeEnum.JSON(),
|
|
142
|
+
isOptional: true
|
|
143
|
+
},
|
|
144
|
+
filters: {
|
|
145
|
+
type: ScalarTypeEnum.JSON(),
|
|
146
|
+
isOptional: true
|
|
147
|
+
},
|
|
148
|
+
forceRefresh: {
|
|
149
|
+
type: ScalarTypeEnum.Boolean(),
|
|
150
|
+
isOptional: true
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
export { CreateQueryInputModel, ExecuteQueryInputModel, QueryModel, QueryResultModel };
|