@contractspec/example.analytics-dashboard 1.44.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/LICENSE +21 -0
- package/README.md +281 -0
- package/dist/dashboard/dashboard.enum.d.ts +18 -0
- package/dist/dashboard/dashboard.enum.d.ts.map +1 -0
- package/dist/dashboard/dashboard.enum.js +43 -0
- package/dist/dashboard/dashboard.enum.js.map +1 -0
- package/dist/dashboard/dashboard.operation.d.ts +537 -0
- package/dist/dashboard/dashboard.operation.d.ts.map +1 -0
- package/dist/dashboard/dashboard.operation.js +213 -0
- package/dist/dashboard/dashboard.operation.js.map +1 -0
- package/dist/dashboard/dashboard.presentation.d.ts +9 -0
- package/dist/dashboard/dashboard.presentation.d.ts.map +1 -0
- package/dist/dashboard/dashboard.presentation.js +90 -0
- package/dist/dashboard/dashboard.presentation.js.map +1 -0
- package/dist/dashboard/dashboard.schema.d.ts +333 -0
- package/dist/dashboard/dashboard.schema.d.ts.map +1 -0
- package/dist/dashboard/dashboard.schema.js +236 -0
- package/dist/dashboard/dashboard.schema.js.map +1 -0
- package/dist/dashboard/index.d.ts +4 -0
- package/dist/dashboard/index.js +5 -0
- package/dist/dashboard.feature.d.ts +8 -0
- package/dist/dashboard.feature.d.ts.map +1 -0
- package/dist/dashboard.feature.js +166 -0
- package/dist/dashboard.feature.js.map +1 -0
- package/dist/docs/analytics-dashboard.docblock.d.ts +1 -0
- package/dist/docs/analytics-dashboard.docblock.js +114 -0
- package/dist/docs/analytics-dashboard.docblock.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/events.d.ts +149 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +128 -0
- package/dist/events.js.map +1 -0
- package/dist/example.d.ts +40 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +51 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/query/index.d.ts +4 -0
- package/dist/query/index.js +5 -0
- package/dist/query/query.enum.d.ts +10 -0
- package/dist/query/query.enum.d.ts.map +1 -0
- package/dist/query/query.enum.js +16 -0
- package/dist/query/query.enum.js.map +1 -0
- package/dist/query/query.operation.d.ts +181 -0
- package/dist/query/query.operation.d.ts.map +1 -0
- package/dist/query/query.operation.js +113 -0
- package/dist/query/query.operation.js.map +1 -0
- package/dist/query/query.presentation.d.ts +8 -0
- package/dist/query/query.presentation.d.ts.map +1 -0
- package/dist/query/query.presentation.js +60 -0
- package/dist/query/query.presentation.js.map +1 -0
- package/dist/query/query.schema.d.ts +143 -0
- package/dist/query/query.schema.d.ts.map +1 -0
- package/dist/query/query.schema.js +157 -0
- package/dist/query/query.schema.js.map +1 -0
- package/dist/query-engine/index.d.ts +106 -0
- package/dist/query-engine/index.d.ts.map +1 -0
- package/dist/query-engine/index.js +189 -0
- package/dist/query-engine/index.js.map +1 -0
- package/package.json +91 -0
|
@@ -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,
|
|
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,
|
|
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,
|
|
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,\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,\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,\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 { PresentationSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/query/query.presentation.d.ts
|
|
4
|
+
declare const QueriesListPresentation: PresentationSpec;
|
|
5
|
+
declare const QueryBuilderPresentation: 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":";;;cAIa,yBAAyB;cAyBzB,0BAA0B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { QueryModel } from "./query.schema.js";
|
|
2
|
+
import { StabilityEnum } from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/query/query.presentation.ts
|
|
5
|
+
const QueriesListPresentation = {
|
|
6
|
+
meta: {
|
|
7
|
+
key: "analytics.query.list",
|
|
8
|
+
version: 1,
|
|
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 = {
|
|
32
|
+
meta: {
|
|
33
|
+
key: "analytics.query.builder",
|
|
34
|
+
version: 1,
|
|
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":["QueriesListPresentation: PresentationSpec","QueryBuilderPresentation: PresentationSpec"],"sources":["../../src/query/query.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { QueryModel } from './query.schema';\n\nexport const QueriesListPresentation: PresentationSpec = {\n meta: {\n key: 'analytics.query.list',\n version: 1,\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: PresentationSpec = {\n meta: {\n key: 'analytics.query.builder',\n version: 1,\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":";;;;AAIA,MAAaA,0BAA4C;CACvD,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;AAED,MAAaC,2BAA6C;CACxD,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"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema250 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_schema250.SchemaModel<{
|
|
8
|
+
id: {
|
|
9
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
10
|
+
isOptional: false;
|
|
11
|
+
};
|
|
12
|
+
name: {
|
|
13
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
14
|
+
isOptional: false;
|
|
15
|
+
};
|
|
16
|
+
description: {
|
|
17
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
18
|
+
isOptional: true;
|
|
19
|
+
};
|
|
20
|
+
type: {
|
|
21
|
+
type: _contractspec_lib_schema250.EnumType<[string, string, string, string]>;
|
|
22
|
+
isOptional: false;
|
|
23
|
+
};
|
|
24
|
+
definition: {
|
|
25
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
26
|
+
isOptional: false;
|
|
27
|
+
};
|
|
28
|
+
sql: {
|
|
29
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
30
|
+
isOptional: true;
|
|
31
|
+
};
|
|
32
|
+
cacheTtlSeconds: {
|
|
33
|
+
type: _contractspec_lib_schema250.FieldType<number, number>;
|
|
34
|
+
isOptional: false;
|
|
35
|
+
};
|
|
36
|
+
isShared: {
|
|
37
|
+
type: _contractspec_lib_schema250.FieldType<boolean, boolean>;
|
|
38
|
+
isOptional: false;
|
|
39
|
+
};
|
|
40
|
+
createdAt: {
|
|
41
|
+
type: _contractspec_lib_schema250.FieldType<Date, string>;
|
|
42
|
+
isOptional: false;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Query execution result.
|
|
47
|
+
*/
|
|
48
|
+
declare const QueryResultModel: _contractspec_lib_schema250.SchemaModel<{
|
|
49
|
+
queryId: {
|
|
50
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
51
|
+
isOptional: false;
|
|
52
|
+
};
|
|
53
|
+
data: {
|
|
54
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
55
|
+
isOptional: false;
|
|
56
|
+
};
|
|
57
|
+
columns: {
|
|
58
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
59
|
+
isOptional: false;
|
|
60
|
+
};
|
|
61
|
+
rowCount: {
|
|
62
|
+
type: _contractspec_lib_schema250.FieldType<number, number>;
|
|
63
|
+
isOptional: false;
|
|
64
|
+
};
|
|
65
|
+
executionTimeMs: {
|
|
66
|
+
type: _contractspec_lib_schema250.FieldType<number, number>;
|
|
67
|
+
isOptional: false;
|
|
68
|
+
};
|
|
69
|
+
cachedAt: {
|
|
70
|
+
type: _contractspec_lib_schema250.FieldType<Date, string>;
|
|
71
|
+
isOptional: true;
|
|
72
|
+
};
|
|
73
|
+
error: {
|
|
74
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
75
|
+
isOptional: true;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Input for creating a query.
|
|
80
|
+
*/
|
|
81
|
+
declare const CreateQueryInputModel: _contractspec_lib_schema250.SchemaModel<{
|
|
82
|
+
name: {
|
|
83
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
84
|
+
isOptional: false;
|
|
85
|
+
};
|
|
86
|
+
description: {
|
|
87
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
88
|
+
isOptional: true;
|
|
89
|
+
};
|
|
90
|
+
type: {
|
|
91
|
+
type: _contractspec_lib_schema250.EnumType<[string, string, string, string]>;
|
|
92
|
+
isOptional: false;
|
|
93
|
+
};
|
|
94
|
+
definition: {
|
|
95
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
96
|
+
isOptional: false;
|
|
97
|
+
};
|
|
98
|
+
sql: {
|
|
99
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
100
|
+
isOptional: true;
|
|
101
|
+
};
|
|
102
|
+
metricIds: {
|
|
103
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
104
|
+
isArray: true;
|
|
105
|
+
isOptional: true;
|
|
106
|
+
};
|
|
107
|
+
cacheTtlSeconds: {
|
|
108
|
+
type: _contractspec_lib_schema250.FieldType<number, number>;
|
|
109
|
+
isOptional: true;
|
|
110
|
+
};
|
|
111
|
+
isShared: {
|
|
112
|
+
type: _contractspec_lib_schema250.FieldType<boolean, boolean>;
|
|
113
|
+
isOptional: true;
|
|
114
|
+
};
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Input for executing a query.
|
|
118
|
+
*/
|
|
119
|
+
declare const ExecuteQueryInputModel: _contractspec_lib_schema250.SchemaModel<{
|
|
120
|
+
queryId: {
|
|
121
|
+
type: _contractspec_lib_schema250.FieldType<string, string>;
|
|
122
|
+
isOptional: false;
|
|
123
|
+
};
|
|
124
|
+
parameters: {
|
|
125
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
126
|
+
isOptional: true;
|
|
127
|
+
};
|
|
128
|
+
dateRange: {
|
|
129
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
130
|
+
isOptional: true;
|
|
131
|
+
};
|
|
132
|
+
filters: {
|
|
133
|
+
type: _contractspec_lib_schema250.FieldType<unknown, unknown>;
|
|
134
|
+
isOptional: true;
|
|
135
|
+
};
|
|
136
|
+
forceRefresh: {
|
|
137
|
+
type: _contractspec_lib_schema250.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.schema.js","names":[],"sources":["../../src/query/query.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { QueryTypeEnum } from './query.enum';\n\n/**\n * A data query.\n */\nexport const QueryModel = defineSchemaModel({\n name: 'QueryModel',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n type: { type: QueryTypeEnum, isOptional: false },\n definition: { type: ScalarTypeEnum.JSON(), isOptional: false },\n sql: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cacheTtlSeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n isShared: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Query execution result.\n */\nexport const QueryResultModel = defineSchemaModel({\n name: 'QueryResultModel',\n fields: {\n queryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n data: { type: ScalarTypeEnum.JSON(), isOptional: false },\n columns: { type: ScalarTypeEnum.JSON(), isOptional: false },\n rowCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n executionTimeMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n cachedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for creating a query.\n */\nexport const CreateQueryInputModel = defineSchemaModel({\n name: 'CreateQueryInput',\n fields: {\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n type: { type: QueryTypeEnum, isOptional: false },\n definition: { type: ScalarTypeEnum.JSON(), isOptional: false },\n sql: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metricIds: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n cacheTtlSeconds: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n isShared: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\n/**\n * Input for executing a query.\n */\nexport const ExecuteQueryInputModel = defineSchemaModel({\n name: 'ExecuteQueryInput',\n fields: {\n queryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n parameters: { type: ScalarTypeEnum.JSON(), isOptional: true },\n dateRange: { type: ScalarTypeEnum.JSON(), isOptional: true },\n filters: { type: ScalarTypeEnum.JSON(), isOptional: true },\n forceRefresh: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,aAAa,kBAAkB;CAC1C,MAAM;CACN,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,MAAM;GAAE,MAAM;GAAe,YAAY;GAAO;EAChD,YAAY;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC9D,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACjE,iBAAiB;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAC3E,UAAU;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EAC/D,WAAW;GAAE,MA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GAAE,YAAY;GAAM;EAC5D,SAAS;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EAC1D,cAAc;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAM;EACnE;CACF,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//#region src/query-engine/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Analytics Query Engine
|
|
4
|
+
*
|
|
5
|
+
* Provides query execution and caching for analytics dashboards.
|
|
6
|
+
*/
|
|
7
|
+
interface QueryDefinition {
|
|
8
|
+
type: 'SQL' | 'METRIC' | 'AGGREGATION' | 'CUSTOM';
|
|
9
|
+
sql?: string;
|
|
10
|
+
metricIds?: string[];
|
|
11
|
+
aggregation?: AggregationDefinition;
|
|
12
|
+
custom?: CustomQueryDefinition;
|
|
13
|
+
}
|
|
14
|
+
interface AggregationDefinition {
|
|
15
|
+
source: string;
|
|
16
|
+
measures: MeasureDefinition[];
|
|
17
|
+
dimensions: DimensionDefinition[];
|
|
18
|
+
filters?: FilterDefinition[];
|
|
19
|
+
orderBy?: OrderByDefinition[];
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
interface MeasureDefinition {
|
|
23
|
+
name: string;
|
|
24
|
+
field: string;
|
|
25
|
+
aggregation: 'COUNT' | 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'COUNT_DISTINCT';
|
|
26
|
+
format?: string;
|
|
27
|
+
}
|
|
28
|
+
interface DimensionDefinition {
|
|
29
|
+
name: string;
|
|
30
|
+
field: string;
|
|
31
|
+
type?: 'TIME' | 'STRING' | 'NUMBER';
|
|
32
|
+
granularity?: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
33
|
+
}
|
|
34
|
+
interface FilterDefinition {
|
|
35
|
+
field: string;
|
|
36
|
+
operator: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin' | 'contains' | 'between';
|
|
37
|
+
value: unknown;
|
|
38
|
+
}
|
|
39
|
+
interface OrderByDefinition {
|
|
40
|
+
field: string;
|
|
41
|
+
direction: 'ASC' | 'DESC';
|
|
42
|
+
}
|
|
43
|
+
interface CustomQueryDefinition {
|
|
44
|
+
handler: string;
|
|
45
|
+
parameters: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
interface QueryParameters {
|
|
48
|
+
dateRange?: {
|
|
49
|
+
start: Date;
|
|
50
|
+
end: Date;
|
|
51
|
+
granularity?: string;
|
|
52
|
+
};
|
|
53
|
+
filters?: FilterDefinition[];
|
|
54
|
+
parameters?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface QueryResult {
|
|
57
|
+
data: Record<string, unknown>[];
|
|
58
|
+
columns: ColumnDefinition[];
|
|
59
|
+
rowCount: number;
|
|
60
|
+
executionTimeMs: number;
|
|
61
|
+
cached: boolean;
|
|
62
|
+
cachedAt?: Date;
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
interface ColumnDefinition {
|
|
66
|
+
name: string;
|
|
67
|
+
type: 'STRING' | 'NUMBER' | 'DATE' | 'BOOLEAN';
|
|
68
|
+
label?: string;
|
|
69
|
+
format?: string;
|
|
70
|
+
}
|
|
71
|
+
interface IQueryEngine {
|
|
72
|
+
execute(definition: QueryDefinition, params: QueryParameters): Promise<QueryResult>;
|
|
73
|
+
validateQuery(definition: QueryDefinition): {
|
|
74
|
+
valid: boolean;
|
|
75
|
+
errors: string[];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface IQueryCache {
|
|
79
|
+
get(key: string): Promise<QueryResult | null>;
|
|
80
|
+
set(key: string, result: QueryResult, ttlSeconds: number): Promise<void>;
|
|
81
|
+
invalidate(pattern: string): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
declare class InMemoryQueryCache implements IQueryCache {
|
|
84
|
+
private cache;
|
|
85
|
+
get(key: string): Promise<QueryResult | null>;
|
|
86
|
+
set(key: string, result: QueryResult, ttlSeconds: number): Promise<void>;
|
|
87
|
+
invalidate(pattern: string): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
declare class BasicQueryEngine implements IQueryEngine {
|
|
90
|
+
private cache;
|
|
91
|
+
constructor(cache?: IQueryCache);
|
|
92
|
+
execute(definition: QueryDefinition, params: QueryParameters): Promise<QueryResult>;
|
|
93
|
+
validateQuery(definition: QueryDefinition): {
|
|
94
|
+
valid: boolean;
|
|
95
|
+
errors: string[];
|
|
96
|
+
};
|
|
97
|
+
private buildCacheKey;
|
|
98
|
+
private executeAggregation;
|
|
99
|
+
private executeMetric;
|
|
100
|
+
private executeSql;
|
|
101
|
+
private generateMockData;
|
|
102
|
+
}
|
|
103
|
+
declare function createQueryEngine(cache?: IQueryCache): IQueryEngine;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { AggregationDefinition, BasicQueryEngine, ColumnDefinition, CustomQueryDefinition, DimensionDefinition, FilterDefinition, IQueryCache, IQueryEngine, InMemoryQueryCache, MeasureDefinition, OrderByDefinition, QueryDefinition, QueryParameters, QueryResult, createQueryEngine };
|
|
106
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/query-engine/index.ts"],"sourcesContent":[],"mappings":";;AAQA;AAQA;;;AAIY,UAZK,eAAA,CAYL;EACA,IAAA,EAAA,KAAA,GAAA,QAAA,GAAA,aAAA,GAAA,QAAA;EAAiB,GAAA,CAAA,EAAA,MAAA;EAIZ,SAAA,CAAA,EAAA,MAAA,EAAiB;EAOjB,WAAA,CAAA,EApBD,qBAoBoB;EAOnB,MAAA,CAAA,EA1BN,qBA0BsB;AAgBjC;AAKiB,UA5CA,qBAAA,CA8CH;EAGG,MAAA,EAAA,MAAA;EAEN,QAAA,EAjDC,iBAiDD,EAAA;EACF,UAAA,EAjDK,mBAiDL,EAAA;EAGG,OAAA,CAAA,EAnDA,gBAmDA,EAAA;EACG,OAAA,CAAA,EAnDH,iB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