@contractspec/example.analytics-dashboard 0.0.0-canary-20260113170453

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +281 -0
  3. package/dist/dashboard/dashboard.enum.d.ts +18 -0
  4. package/dist/dashboard/dashboard.enum.d.ts.map +1 -0
  5. package/dist/dashboard/dashboard.enum.js +43 -0
  6. package/dist/dashboard/dashboard.enum.js.map +1 -0
  7. package/dist/dashboard/dashboard.operation.d.ts +537 -0
  8. package/dist/dashboard/dashboard.operation.d.ts.map +1 -0
  9. package/dist/dashboard/dashboard.operation.js +213 -0
  10. package/dist/dashboard/dashboard.operation.js.map +1 -0
  11. package/dist/dashboard/dashboard.presentation.d.ts +9 -0
  12. package/dist/dashboard/dashboard.presentation.d.ts.map +1 -0
  13. package/dist/dashboard/dashboard.presentation.js +90 -0
  14. package/dist/dashboard/dashboard.presentation.js.map +1 -0
  15. package/dist/dashboard/dashboard.schema.d.ts +333 -0
  16. package/dist/dashboard/dashboard.schema.d.ts.map +1 -0
  17. package/dist/dashboard/dashboard.schema.js +236 -0
  18. package/dist/dashboard/dashboard.schema.js.map +1 -0
  19. package/dist/dashboard/dashboard.test-spec.d.ts +10 -0
  20. package/dist/dashboard/dashboard.test-spec.d.ts.map +1 -0
  21. package/dist/dashboard/dashboard.test-spec.js +233 -0
  22. package/dist/dashboard/dashboard.test-spec.js.map +1 -0
  23. package/dist/dashboard/index.d.ts +4 -0
  24. package/dist/dashboard/index.js +5 -0
  25. package/dist/dashboard.feature.d.ts +17 -0
  26. package/dist/dashboard.feature.d.ts.map +1 -0
  27. package/dist/dashboard.feature.js +177 -0
  28. package/dist/dashboard.feature.js.map +1 -0
  29. package/dist/docs/analytics-dashboard.docblock.d.ts +1 -0
  30. package/dist/docs/analytics-dashboard.docblock.js +114 -0
  31. package/dist/docs/analytics-dashboard.docblock.js.map +1 -0
  32. package/dist/docs/index.d.ts +1 -0
  33. package/dist/docs/index.js +1 -0
  34. package/dist/events.d.ts +149 -0
  35. package/dist/events.d.ts.map +1 -0
  36. package/dist/events.js +128 -0
  37. package/dist/events.js.map +1 -0
  38. package/dist/example.d.ts +7 -0
  39. package/dist/example.d.ts.map +1 -0
  40. package/dist/example.js +58 -0
  41. package/dist/example.js.map +1 -0
  42. package/dist/handlers/analytics.handlers.d.ts +122 -0
  43. package/dist/handlers/analytics.handlers.d.ts.map +1 -0
  44. package/dist/handlers/analytics.handlers.js +310 -0
  45. package/dist/handlers/analytics.handlers.js.map +1 -0
  46. package/dist/handlers/index.d.ts +2 -0
  47. package/dist/handlers/index.js +3 -0
  48. package/dist/index.d.ts +12 -0
  49. package/dist/index.js +13 -0
  50. package/dist/query/index.d.ts +4 -0
  51. package/dist/query/index.js +5 -0
  52. package/dist/query/query.enum.d.ts +10 -0
  53. package/dist/query/query.enum.d.ts.map +1 -0
  54. package/dist/query/query.enum.js +16 -0
  55. package/dist/query/query.enum.js.map +1 -0
  56. package/dist/query/query.operation.d.ts +181 -0
  57. package/dist/query/query.operation.d.ts.map +1 -0
  58. package/dist/query/query.operation.js +113 -0
  59. package/dist/query/query.operation.js.map +1 -0
  60. package/dist/query/query.presentation.d.ts +8 -0
  61. package/dist/query/query.presentation.d.ts.map +1 -0
  62. package/dist/query/query.presentation.js +60 -0
  63. package/dist/query/query.presentation.js.map +1 -0
  64. package/dist/query/query.schema.d.ts +143 -0
  65. package/dist/query/query.schema.d.ts.map +1 -0
  66. package/dist/query/query.schema.js +157 -0
  67. package/dist/query/query.schema.js.map +1 -0
  68. package/dist/query/query.test-spec.d.ts +8 -0
  69. package/dist/query/query.test-spec.d.ts.map +1 -0
  70. package/dist/query/query.test-spec.js +124 -0
  71. package/dist/query/query.test-spec.js.map +1 -0
  72. package/dist/query-engine/index.d.ts +106 -0
  73. package/dist/query-engine/index.d.ts.map +1 -0
  74. package/dist/query-engine/index.js +189 -0
  75. package/dist/query-engine/index.js.map +1 -0
  76. package/dist/seeders/index.d.ts +10 -0
  77. package/dist/seeders/index.d.ts.map +1 -0
  78. package/dist/seeders/index.js +19 -0
  79. package/dist/seeders/index.js.map +1 -0
  80. package/dist/ui/AnalyticsDashboard.d.ts +7 -0
  81. package/dist/ui/AnalyticsDashboard.d.ts.map +1 -0
  82. package/dist/ui/AnalyticsDashboard.js +265 -0
  83. package/dist/ui/AnalyticsDashboard.js.map +1 -0
  84. package/dist/ui/hooks/index.d.ts +2 -0
  85. package/dist/ui/hooks/index.js +5 -0
  86. package/dist/ui/hooks/useAnalyticsData.d.ts +23 -0
  87. package/dist/ui/hooks/useAnalyticsData.d.ts.map +1 -0
  88. package/dist/ui/hooks/useAnalyticsData.js +73 -0
  89. package/dist/ui/hooks/useAnalyticsData.js.map +1 -0
  90. package/dist/ui/index.d.ts +6 -0
  91. package/dist/ui/index.js +6 -0
  92. package/dist/ui/renderers/analytics.markdown.d.ts +28 -0
  93. package/dist/ui/renderers/analytics.markdown.d.ts.map +1 -0
  94. package/dist/ui/renderers/analytics.markdown.js +264 -0
  95. package/dist/ui/renderers/analytics.markdown.js.map +1 -0
  96. package/dist/ui/renderers/index.d.ts +2 -0
  97. package/dist/ui/renderers/index.js +3 -0
  98. package/package.json +101 -0
@@ -0,0 +1,181 @@
1
+ import * as _contractspec_lib_contracts9 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema119 from "@contractspec/lib.schema";
3
+
4
+ //#region src/query/query.operation.d.ts
5
+ /**
6
+ * Create a data query.
7
+ */
8
+ declare const CreateQueryContract: _contractspec_lib_contracts9.OperationSpec<_contractspec_lib_schema119.SchemaModel<{
9
+ name: {
10
+ type: _contractspec_lib_schema119.FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ description: {
14
+ type: _contractspec_lib_schema119.FieldType<string, string>;
15
+ isOptional: true;
16
+ };
17
+ type: {
18
+ type: _contractspec_lib_schema119.EnumType<[string, string, string, string]>;
19
+ isOptional: false;
20
+ };
21
+ definition: {
22
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
23
+ isOptional: false;
24
+ };
25
+ sql: {
26
+ type: _contractspec_lib_schema119.FieldType<string, string>;
27
+ isOptional: true;
28
+ };
29
+ metricIds: {
30
+ type: _contractspec_lib_schema119.FieldType<string, string>;
31
+ isArray: true;
32
+ isOptional: true;
33
+ };
34
+ cacheTtlSeconds: {
35
+ type: _contractspec_lib_schema119.FieldType<number, number>;
36
+ isOptional: true;
37
+ };
38
+ isShared: {
39
+ type: _contractspec_lib_schema119.FieldType<boolean, boolean>;
40
+ isOptional: true;
41
+ };
42
+ }>, _contractspec_lib_schema119.SchemaModel<{
43
+ id: {
44
+ type: _contractspec_lib_schema119.FieldType<string, string>;
45
+ isOptional: false;
46
+ };
47
+ name: {
48
+ type: _contractspec_lib_schema119.FieldType<string, string>;
49
+ isOptional: false;
50
+ };
51
+ description: {
52
+ type: _contractspec_lib_schema119.FieldType<string, string>;
53
+ isOptional: true;
54
+ };
55
+ type: {
56
+ type: _contractspec_lib_schema119.EnumType<[string, string, string, string]>;
57
+ isOptional: false;
58
+ };
59
+ definition: {
60
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
61
+ isOptional: false;
62
+ };
63
+ sql: {
64
+ type: _contractspec_lib_schema119.FieldType<string, string>;
65
+ isOptional: true;
66
+ };
67
+ cacheTtlSeconds: {
68
+ type: _contractspec_lib_schema119.FieldType<number, number>;
69
+ isOptional: false;
70
+ };
71
+ isShared: {
72
+ type: _contractspec_lib_schema119.FieldType<boolean, boolean>;
73
+ isOptional: false;
74
+ };
75
+ createdAt: {
76
+ type: _contractspec_lib_schema119.FieldType<Date, string>;
77
+ isOptional: false;
78
+ };
79
+ }>, {
80
+ key: string;
81
+ version: string;
82
+ stability: string;
83
+ owners: "@example.analytics-dashboard"[];
84
+ tags: string[];
85
+ when: string;
86
+ payload: _contractspec_lib_schema119.SchemaModel<{
87
+ id: {
88
+ type: _contractspec_lib_schema119.FieldType<string, string>;
89
+ isOptional: false;
90
+ };
91
+ name: {
92
+ type: _contractspec_lib_schema119.FieldType<string, string>;
93
+ isOptional: false;
94
+ };
95
+ description: {
96
+ type: _contractspec_lib_schema119.FieldType<string, string>;
97
+ isOptional: true;
98
+ };
99
+ type: {
100
+ type: _contractspec_lib_schema119.EnumType<[string, string, string, string]>;
101
+ isOptional: false;
102
+ };
103
+ definition: {
104
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
105
+ isOptional: false;
106
+ };
107
+ sql: {
108
+ type: _contractspec_lib_schema119.FieldType<string, string>;
109
+ isOptional: true;
110
+ };
111
+ cacheTtlSeconds: {
112
+ type: _contractspec_lib_schema119.FieldType<number, number>;
113
+ isOptional: false;
114
+ };
115
+ isShared: {
116
+ type: _contractspec_lib_schema119.FieldType<boolean, boolean>;
117
+ isOptional: false;
118
+ };
119
+ createdAt: {
120
+ type: _contractspec_lib_schema119.FieldType<Date, string>;
121
+ isOptional: false;
122
+ };
123
+ }>;
124
+ }[]>;
125
+ /**
126
+ * Execute a data query.
127
+ */
128
+ declare const ExecuteQueryContract: _contractspec_lib_contracts9.OperationSpec<_contractspec_lib_schema119.SchemaModel<{
129
+ queryId: {
130
+ type: _contractspec_lib_schema119.FieldType<string, string>;
131
+ isOptional: false;
132
+ };
133
+ parameters: {
134
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
135
+ isOptional: true;
136
+ };
137
+ dateRange: {
138
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
139
+ isOptional: true;
140
+ };
141
+ filters: {
142
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
143
+ isOptional: true;
144
+ };
145
+ forceRefresh: {
146
+ type: _contractspec_lib_schema119.FieldType<boolean, boolean>;
147
+ isOptional: true;
148
+ };
149
+ }>, _contractspec_lib_schema119.SchemaModel<{
150
+ queryId: {
151
+ type: _contractspec_lib_schema119.FieldType<string, string>;
152
+ isOptional: false;
153
+ };
154
+ data: {
155
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
156
+ isOptional: false;
157
+ };
158
+ columns: {
159
+ type: _contractspec_lib_schema119.FieldType<unknown, unknown>;
160
+ isOptional: false;
161
+ };
162
+ rowCount: {
163
+ type: _contractspec_lib_schema119.FieldType<number, number>;
164
+ isOptional: false;
165
+ };
166
+ executionTimeMs: {
167
+ type: _contractspec_lib_schema119.FieldType<number, number>;
168
+ isOptional: false;
169
+ };
170
+ cachedAt: {
171
+ type: _contractspec_lib_schema119.FieldType<Date, string>;
172
+ isOptional: true;
173
+ };
174
+ error: {
175
+ type: _contractspec_lib_schema119.FieldType<string, string>;
176
+ isOptional: true;
177
+ };
178
+ }>, undefined>;
179
+ //#endregion
180
+ export { CreateQueryContract, ExecuteQueryContract };
181
+ //# sourceMappingURL=query.operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.operation.d.ts","names":[],"sources":["../../src/query/query.operation.ts"],"sourcesContent":[],"mappings":";;;;;;;cAgBa,kDAAmB,0CAAA;EAAnB,IAAA,EAAA;IA+CX,IAAA,EAAA,2BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;8CA/C8B,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;CAAA,CAAA,yCAAA,CAAA;EAoDnB,EAAA,EAAA;IA8BX,IAAA,EAlF8B,2BAAA,CAAA,SAkF9B,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;EA9B+B,CAAA;;;;;;;;;;IAAA,IAAA,uCAAA,CAAA,OAAA,EAAA,OAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAApB,mDAAoB,0CAAA;;UA8B/B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;UA9B+B,2BAAA,CAAA"}
@@ -0,0 +1,113 @@
1
+ import { CreateQueryInputModel, ExecuteQueryInputModel, QueryModel, QueryResultModel } from "./query.schema.js";
2
+ import { defineCommand, defineQuery } from "@contractspec/lib.contracts/operations";
3
+
4
+ //#region src/query/query.operation.ts
5
+ const OWNERS = ["@example.analytics-dashboard"];
6
+ /**
7
+ * Create a data query.
8
+ */
9
+ const CreateQueryContract = defineCommand({
10
+ meta: {
11
+ key: "analytics.query.create",
12
+ version: "1.0.0",
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
+ key: "analytics.query.created",
32
+ version: "1.0.0",
33
+ stability: "stable",
34
+ owners: [...OWNERS],
35
+ tags: [
36
+ "analytics",
37
+ "query",
38
+ "created"
39
+ ],
40
+ when: "Query created",
41
+ payload: QueryModel
42
+ }],
43
+ audit: ["analytics.query.created"]
44
+ },
45
+ acceptance: {
46
+ scenarios: [{
47
+ key: "create-query-happy-path",
48
+ given: ["User is authenticated"],
49
+ when: ["User submits valid query definition"],
50
+ then: ["Query is created", "QueryCreated event is emitted"]
51
+ }],
52
+ examples: [{
53
+ key: "create-sql-query",
54
+ input: {
55
+ name: "Monthly Revenue",
56
+ sql: "SELECT SUM(amount) FROM orders WHERE date >= :startDate"
57
+ },
58
+ output: {
59
+ id: "query-123",
60
+ name: "Monthly Revenue",
61
+ type: "sql"
62
+ }
63
+ }]
64
+ }
65
+ });
66
+ /**
67
+ * Execute a data query.
68
+ */
69
+ const ExecuteQueryContract = defineQuery({
70
+ meta: {
71
+ key: "analytics.query.execute",
72
+ version: "1.0.0",
73
+ stability: "stable",
74
+ owners: [...OWNERS],
75
+ tags: [
76
+ "analytics",
77
+ "query",
78
+ "execute"
79
+ ],
80
+ description: "Execute a data query.",
81
+ goal: "Fetch data for visualizations.",
82
+ context: "Dashboard rendering."
83
+ },
84
+ io: {
85
+ input: ExecuteQueryInputModel,
86
+ output: QueryResultModel
87
+ },
88
+ policy: { auth: "user" },
89
+ acceptance: {
90
+ scenarios: [{
91
+ key: "execute-query-happy-path",
92
+ given: ["Query exists"],
93
+ when: ["User executes query with parameters"],
94
+ then: ["Query results are returned"]
95
+ }],
96
+ examples: [{
97
+ key: "execute-with-params",
98
+ input: {
99
+ queryId: "query-123",
100
+ params: { startDate: "2025-01-01" }
101
+ },
102
+ output: {
103
+ columns: ["total"],
104
+ rows: [{ total: 5e4 }],
105
+ rowCount: 1
106
+ }
107
+ }]
108
+ }
109
+ });
110
+
111
+ //#endregion
112
+ export { CreateQueryContract, ExecuteQueryContract };
113
+ //# sourceMappingURL=query.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.operation.js","names":[],"sources":["../../src/query/query.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport {\n QueryModel,\n QueryResultModel,\n CreateQueryInputModel,\n ExecuteQueryInputModel,\n} from './query.schema';\n\nconst OWNERS = ['@example.analytics-dashboard'] as const;\n\n/**\n * Create a data query.\n */\nexport const CreateQueryContract = defineCommand({\n meta: {\n key: 'analytics.query.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['analytics', 'query', 'create'],\n description: 'Create a data query.',\n goal: 'Define reusable data queries.',\n context: 'Query builder.',\n },\n io: { input: CreateQueryInputModel, output: QueryModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'analytics.query.created',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['analytics', 'query', 'created'],\n when: 'Query created',\n payload: QueryModel,\n },\n ],\n audit: ['analytics.query.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-query-happy-path',\n given: ['User is authenticated'],\n when: ['User submits valid query definition'],\n then: ['Query is created', 'QueryCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-sql-query',\n input: {\n name: 'Monthly Revenue',\n sql: 'SELECT SUM(amount) FROM orders WHERE date >= :startDate',\n },\n output: { id: 'query-123', name: 'Monthly Revenue', type: 'sql' },\n },\n ],\n },\n});\n\n/**\n * Execute a data query.\n */\nexport const ExecuteQueryContract = defineQuery({\n meta: {\n key: 'analytics.query.execute',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['analytics', 'query', 'execute'],\n description: 'Execute a data query.',\n goal: 'Fetch data for visualizations.',\n context: 'Dashboard rendering.',\n },\n io: { input: ExecuteQueryInputModel, output: QueryResultModel },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'execute-query-happy-path',\n given: ['Query exists'],\n when: ['User executes query with parameters'],\n then: ['Query results are returned'],\n },\n ],\n examples: [\n {\n key: 'execute-with-params',\n input: { queryId: 'query-123', params: { startDate: '2025-01-01' } },\n output: { columns: ['total'], rows: [{ total: 50000 }], rowCount: 1 },\n },\n ],\n },\n});\n"],"mappings":";;;;AAWA,MAAM,SAAS,CAAC,+BAA+B;;;;AAK/C,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAa;GAAS;GAAS;EACtC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAY;CACxD,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,WAAW;GACX,QAAQ,CAAC,GAAG,OAAO;GACnB,MAAM;IAAC;IAAa;IAAS;IAAU;GACvC,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,0BAA0B;EACnC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,wBAAwB;GAChC,MAAM,CAAC,sCAAsC;GAC7C,MAAM,CAAC,oBAAoB,gCAAgC;GAC5D,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,MAAM;IACN,KAAK;IACN;GACD,QAAQ;IAAE,IAAI;IAAa,MAAM;IAAmB,MAAM;IAAO;GAClE,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAa;GAAS;GAAU;EACvC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAwB,QAAQ;EAAkB;CAC/D,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,eAAe;GACvB,MAAM,CAAC,sCAAsC;GAC7C,MAAM,CAAC,6BAA6B;GACrC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,SAAS;IAAa,QAAQ,EAAE,WAAW,cAAc;IAAE;GACpE,QAAQ;IAAE,SAAS,CAAC,QAAQ;IAAE,MAAM,CAAC,EAAE,OAAO,KAAO,CAAC;IAAE,UAAU;IAAG;GACtE,CACF;EACF;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import * as _contractspec_lib_contracts13 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/query/query.presentation.d.ts
4
+ declare const QueriesListPresentation: _contractspec_lib_contracts13.PresentationSpec;
5
+ declare const QueryBuilderPresentation: _contractspec_lib_contracts13.PresentationSpec;
6
+ //#endregion
7
+ export { QueriesListPresentation, QueryBuilderPresentation };
8
+ //# sourceMappingURL=query.presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.presentation.d.ts","names":[],"sources":["../../src/query/query.presentation.ts"],"sourcesContent":[],"mappings":";;;cAGa,yBAuBX,6BAAA,CAvBkC;cAyBvB,0BAuBX,6BAAA,CAvBmC"}
@@ -0,0 +1,60 @@
1
+ import { QueryModel } from "./query.schema.js";
2
+ import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/query/query.presentation.ts
5
+ const QueriesListPresentation = definePresentation({
6
+ meta: {
7
+ key: "analytics.query.list",
8
+ version: "1.0.0",
9
+ title: "Queries List",
10
+ description: "List of saved queries",
11
+ domain: "analytics",
12
+ owners: ["@analytics-dashboard"],
13
+ tags: [
14
+ "analytics",
15
+ "queries",
16
+ "list"
17
+ ],
18
+ stability: StabilityEnum.Experimental,
19
+ goal: "Browse and manage saved data queries.",
20
+ context: "The library of reusable data definitions."
21
+ },
22
+ source: {
23
+ type: "component",
24
+ framework: "react",
25
+ componentKey: "QueriesList",
26
+ props: QueryModel
27
+ },
28
+ targets: ["react", "markdown"],
29
+ policy: { flags: ["analytics.queries.enabled"] }
30
+ });
31
+ const QueryBuilderPresentation = definePresentation({
32
+ meta: {
33
+ key: "analytics.query.builder",
34
+ version: "1.0.0",
35
+ title: "Query Builder",
36
+ description: "Visual query builder interface",
37
+ domain: "analytics",
38
+ owners: ["@analytics-dashboard"],
39
+ tags: [
40
+ "analytics",
41
+ "query",
42
+ "builder"
43
+ ],
44
+ stability: StabilityEnum.Experimental,
45
+ goal: "Visually construct data queries and transformations.",
46
+ context: "Developer tool for data analysis."
47
+ },
48
+ source: {
49
+ type: "component",
50
+ framework: "react",
51
+ componentKey: "QueryBuilder",
52
+ props: QueryModel
53
+ },
54
+ targets: ["react"],
55
+ policy: { flags: ["analytics.queries.enabled"] }
56
+ });
57
+
58
+ //#endregion
59
+ export { QueriesListPresentation, QueryBuilderPresentation };
60
+ //# sourceMappingURL=query.presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.presentation.js","names":[],"sources":["../../src/query/query.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { QueryModel } from './query.schema';\n\nexport const QueriesListPresentation = definePresentation({\n meta: {\n key: 'analytics.query.list',\n version: '1.0.0',\n title: 'Queries List',\n description: 'List of saved queries',\n domain: 'analytics',\n owners: ['@analytics-dashboard'],\n tags: ['analytics', 'queries', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Browse and manage saved data queries.',\n context: 'The library of reusable data definitions.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'QueriesList',\n props: QueryModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['analytics.queries.enabled'],\n },\n});\n\nexport const QueryBuilderPresentation = definePresentation({\n meta: {\n key: 'analytics.query.builder',\n version: '1.0.0',\n title: 'Query Builder',\n description: 'Visual query builder interface',\n domain: 'analytics',\n owners: ['@analytics-dashboard'],\n tags: ['analytics', 'query', 'builder'],\n stability: StabilityEnum.Experimental,\n goal: 'Visually construct data queries and transformations.',\n context: 'Developer tool for data analysis.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'QueryBuilder',\n props: QueryModel,\n },\n targets: ['react'],\n policy: {\n flags: ['analytics.queries.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,0BAA0B,mBAAmB;CACxD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,uBAAuB;EAChC,MAAM;GAAC;GAAa;GAAW;GAAO;EACtC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,4BAA4B,EACrC;CACF,CAAC;AAEF,MAAa,2BAA2B,mBAAmB;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,uBAAuB;EAChC,MAAM;GAAC;GAAa;GAAS;GAAU;EACvC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,4BAA4B,EACrC;CACF,CAAC"}
@@ -0,0 +1,143 @@
1
+ import * as _contractspec_lib_schema162 from "@contractspec/lib.schema";
2
+
3
+ //#region src/query/query.schema.d.ts
4
+ /**
5
+ * A data query.
6
+ */
7
+ declare const QueryModel: _contractspec_lib_schema162.SchemaModel<{
8
+ id: {
9
+ type: _contractspec_lib_schema162.FieldType<string, string>;
10
+ isOptional: false;
11
+ };
12
+ name: {
13
+ type: _contractspec_lib_schema162.FieldType<string, string>;
14
+ isOptional: false;
15
+ };
16
+ description: {
17
+ type: _contractspec_lib_schema162.FieldType<string, string>;
18
+ isOptional: true;
19
+ };
20
+ type: {
21
+ type: _contractspec_lib_schema162.EnumType<[string, string, string, string]>;
22
+ isOptional: false;
23
+ };
24
+ definition: {
25
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
26
+ isOptional: false;
27
+ };
28
+ sql: {
29
+ type: _contractspec_lib_schema162.FieldType<string, string>;
30
+ isOptional: true;
31
+ };
32
+ cacheTtlSeconds: {
33
+ type: _contractspec_lib_schema162.FieldType<number, number>;
34
+ isOptional: false;
35
+ };
36
+ isShared: {
37
+ type: _contractspec_lib_schema162.FieldType<boolean, boolean>;
38
+ isOptional: false;
39
+ };
40
+ createdAt: {
41
+ type: _contractspec_lib_schema162.FieldType<Date, string>;
42
+ isOptional: false;
43
+ };
44
+ }>;
45
+ /**
46
+ * Query execution result.
47
+ */
48
+ declare const QueryResultModel: _contractspec_lib_schema162.SchemaModel<{
49
+ queryId: {
50
+ type: _contractspec_lib_schema162.FieldType<string, string>;
51
+ isOptional: false;
52
+ };
53
+ data: {
54
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
55
+ isOptional: false;
56
+ };
57
+ columns: {
58
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
59
+ isOptional: false;
60
+ };
61
+ rowCount: {
62
+ type: _contractspec_lib_schema162.FieldType<number, number>;
63
+ isOptional: false;
64
+ };
65
+ executionTimeMs: {
66
+ type: _contractspec_lib_schema162.FieldType<number, number>;
67
+ isOptional: false;
68
+ };
69
+ cachedAt: {
70
+ type: _contractspec_lib_schema162.FieldType<Date, string>;
71
+ isOptional: true;
72
+ };
73
+ error: {
74
+ type: _contractspec_lib_schema162.FieldType<string, string>;
75
+ isOptional: true;
76
+ };
77
+ }>;
78
+ /**
79
+ * Input for creating a query.
80
+ */
81
+ declare const CreateQueryInputModel: _contractspec_lib_schema162.SchemaModel<{
82
+ name: {
83
+ type: _contractspec_lib_schema162.FieldType<string, string>;
84
+ isOptional: false;
85
+ };
86
+ description: {
87
+ type: _contractspec_lib_schema162.FieldType<string, string>;
88
+ isOptional: true;
89
+ };
90
+ type: {
91
+ type: _contractspec_lib_schema162.EnumType<[string, string, string, string]>;
92
+ isOptional: false;
93
+ };
94
+ definition: {
95
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
96
+ isOptional: false;
97
+ };
98
+ sql: {
99
+ type: _contractspec_lib_schema162.FieldType<string, string>;
100
+ isOptional: true;
101
+ };
102
+ metricIds: {
103
+ type: _contractspec_lib_schema162.FieldType<string, string>;
104
+ isArray: true;
105
+ isOptional: true;
106
+ };
107
+ cacheTtlSeconds: {
108
+ type: _contractspec_lib_schema162.FieldType<number, number>;
109
+ isOptional: true;
110
+ };
111
+ isShared: {
112
+ type: _contractspec_lib_schema162.FieldType<boolean, boolean>;
113
+ isOptional: true;
114
+ };
115
+ }>;
116
+ /**
117
+ * Input for executing a query.
118
+ */
119
+ declare const ExecuteQueryInputModel: _contractspec_lib_schema162.SchemaModel<{
120
+ queryId: {
121
+ type: _contractspec_lib_schema162.FieldType<string, string>;
122
+ isOptional: false;
123
+ };
124
+ parameters: {
125
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
126
+ isOptional: true;
127
+ };
128
+ dateRange: {
129
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
130
+ isOptional: true;
131
+ };
132
+ filters: {
133
+ type: _contractspec_lib_schema162.FieldType<unknown, unknown>;
134
+ isOptional: true;
135
+ };
136
+ forceRefresh: {
137
+ type: _contractspec_lib_schema162.FieldType<boolean, boolean>;
138
+ isOptional: true;
139
+ };
140
+ }>;
141
+ //#endregion
142
+ export { CreateQueryInputModel, ExecuteQueryInputModel, QueryModel, QueryResultModel };
143
+ //# sourceMappingURL=query.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.schema.d.ts","names":[],"sources":["../../src/query/query.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAMa,cAAA,UAaX,8BAbqB,WAarB,CAAA;EAAA,EAAA,EAAA;UAAA,2BAAA,CAAA;;;;;;;;;;EAbqB,CAAA;EAkBV,IAAA,EAAA;IAWX,IAAA,sCAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;;;;;;;+CAX2B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;EAgBhB,CAAA;EAgBX,eAAA,EAAA;;;;;;;;;IAhBgC,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;IAqBrB,UAAA,EAAA,KAAA;EASX,CAAA;;;;;cA9CW,gBAqCsB,8BArCN,WAqCM,CAAA;EAAA,OAAA,EAAA;UA1BjC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,mDAAqB;;UAgBhC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,oDAAsB;;UASjC,2BAAA,CAAA"}
@@ -0,0 +1,157 @@
1
+ import { QueryTypeEnum } from "./query.enum.js";
2
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/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 };
157
+ //# sourceMappingURL=query.schema.js.map