@hypequery/datasets 0.2.1 → 0.4.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/dist/contract.d.ts +101 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +161 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type DatasetCatalogSource, type DimensionCatalogEntry, type MeasureCatalogEntry, type MetricCatalogEntry, type FilterCatalogEntry, type RelationshipCatalogEntry } from './catalog.js';
|
|
2
|
+
import type { DatasetLimits } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Version of the semantic contract format. Bump when the serialized shape
|
|
5
|
+
* changes in a way that snapshot consumers must account for.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SEMANTIC_CONTRACT_VERSION = 1;
|
|
8
|
+
export interface ContractDimension {
|
|
9
|
+
type: DimensionCatalogEntry['type'];
|
|
10
|
+
column?: string;
|
|
11
|
+
sql?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
filterable: boolean;
|
|
15
|
+
groupable: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ContractMeasure {
|
|
18
|
+
aggregation: MeasureCatalogEntry['aggregation'];
|
|
19
|
+
field: string;
|
|
20
|
+
sql?: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ContractMetric {
|
|
25
|
+
kind: MetricCatalogEntry['kind'];
|
|
26
|
+
valueType: MetricCatalogEntry['valueType'];
|
|
27
|
+
label?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
dimensions: string[];
|
|
30
|
+
measures?: string[];
|
|
31
|
+
filters: string[];
|
|
32
|
+
grains: string[];
|
|
33
|
+
grain?: string;
|
|
34
|
+
requires?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface ContractFilter {
|
|
37
|
+
field: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
operators: string[];
|
|
41
|
+
valueType?: FilterCatalogEntry['valueType'];
|
|
42
|
+
}
|
|
43
|
+
export interface ContractRelationship {
|
|
44
|
+
kind: RelationshipCatalogEntry['kind'];
|
|
45
|
+
target: string;
|
|
46
|
+
from: string;
|
|
47
|
+
to: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ContractDataset {
|
|
50
|
+
name: string;
|
|
51
|
+
source: string;
|
|
52
|
+
tenantKey?: string;
|
|
53
|
+
timeKey?: string;
|
|
54
|
+
requiresTenant: boolean;
|
|
55
|
+
supportedGrains: string[];
|
|
56
|
+
dimensions: Record<string, ContractDimension>;
|
|
57
|
+
measures: Record<string, ContractMeasure>;
|
|
58
|
+
metrics: Record<string, ContractMetric>;
|
|
59
|
+
filters: Record<string, ContractFilter>;
|
|
60
|
+
relationships: Record<string, ContractRelationship>;
|
|
61
|
+
limits?: DatasetLimits;
|
|
62
|
+
}
|
|
63
|
+
export interface SemanticContract {
|
|
64
|
+
version: number;
|
|
65
|
+
datasets: Record<string, ContractDataset>;
|
|
66
|
+
contentHash: string;
|
|
67
|
+
}
|
|
68
|
+
type SemanticContractWithoutHash = Omit<SemanticContract, 'contentHash'>;
|
|
69
|
+
export interface SerializeSemanticContractOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Include raw `sql` escape-hatch expressions for dimensions/measures.
|
|
72
|
+
*
|
|
73
|
+
* Defaults to `true` for trusted contexts (snapshots, CI, codegen) where the
|
|
74
|
+
* SQL already lives in the developer's source. Set to `false` when serving the
|
|
75
|
+
* contract to untrusted consumers so internal SQL is not exposed.
|
|
76
|
+
*/
|
|
77
|
+
includeSql?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Builds a deterministic semantic contract from dataset instances.
|
|
81
|
+
*
|
|
82
|
+
* The contract is a normalized, sorted projection of the dataset catalog with a
|
|
83
|
+
* version marker and content hash. Object keys and unordered arrays are sorted,
|
|
84
|
+
* and SQL escape hatches are whitespace-normalized so logically equal models
|
|
85
|
+
* produce identical JSON and hashes. This is the shared source consumed by
|
|
86
|
+
* snapshots, diffs, CI validation, docs, and codegen.
|
|
87
|
+
*/
|
|
88
|
+
export declare function serializeSemanticContract(datasets: Record<string, DatasetCatalogSource>, options?: SerializeSemanticContractOptions): SemanticContract;
|
|
89
|
+
/**
|
|
90
|
+
* Serializes a contract with stable formatting for writing to disk and hashing.
|
|
91
|
+
*/
|
|
92
|
+
export declare function contractToStableJson(contract: SemanticContract | SemanticContractWithoutHash): string;
|
|
93
|
+
/**
|
|
94
|
+
* Computes the SHA-256 content hash for a normalized contract.
|
|
95
|
+
*
|
|
96
|
+
* Uses `@noble/hashes` (audited, isomorphic, synchronous) rather than
|
|
97
|
+
* `node:crypto` so the contract stays usable in browser/edge runtimes.
|
|
98
|
+
*/
|
|
99
|
+
export declare function hashContract(contract: SemanticContract | SemanticContractWithoutHash): string;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC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
import { bytesToHex } from '@noble/hashes/utils';
|
|
3
|
+
import { getDatasetCatalogs, } from './catalog.js';
|
|
4
|
+
/**
|
|
5
|
+
* Version of the semantic contract format. Bump when the serialized shape
|
|
6
|
+
* changes in a way that snapshot consumers must account for.
|
|
7
|
+
*/
|
|
8
|
+
export const SEMANTIC_CONTRACT_VERSION = 1;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a deterministic semantic contract from dataset instances.
|
|
11
|
+
*
|
|
12
|
+
* The contract is a normalized, sorted projection of the dataset catalog with a
|
|
13
|
+
* version marker and content hash. Object keys and unordered arrays are sorted,
|
|
14
|
+
* and SQL escape hatches are whitespace-normalized so logically equal models
|
|
15
|
+
* produce identical JSON and hashes. This is the shared source consumed by
|
|
16
|
+
* snapshots, diffs, CI validation, docs, and codegen.
|
|
17
|
+
*/
|
|
18
|
+
export function serializeSemanticContract(datasets, options = {}) {
|
|
19
|
+
const includeSql = options.includeSql ?? true;
|
|
20
|
+
const catalogs = getDatasetCatalogs(datasets);
|
|
21
|
+
const contract = {
|
|
22
|
+
version: SEMANTIC_CONTRACT_VERSION,
|
|
23
|
+
datasets: sortedRecord(Object.entries(catalogs).map(([name, catalog]) => [name, datasetToContract(catalog, includeSql)])),
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
...contract,
|
|
27
|
+
contentHash: hashContract(contract),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function datasetToContract(catalog, includeSql) {
|
|
31
|
+
return {
|
|
32
|
+
name: catalog.name,
|
|
33
|
+
source: catalog.source,
|
|
34
|
+
...(catalog.tenantKey !== undefined ? { tenantKey: catalog.tenantKey } : {}),
|
|
35
|
+
...(catalog.timeKey !== undefined ? { timeKey: catalog.timeKey } : {}),
|
|
36
|
+
requiresTenant: catalog.requiresTenant,
|
|
37
|
+
supportedGrains: uniqueSorted(catalog.supportedGrains),
|
|
38
|
+
dimensions: sortedRecord(Object.entries(catalog.dimensions).map(([name, entry]) => [name, dimensionToContract(entry, includeSql)])),
|
|
39
|
+
measures: sortedRecord(Object.entries(catalog.measures).map(([name, entry]) => [name, measureToContract(entry, includeSql)])),
|
|
40
|
+
metrics: sortedRecord(Object.entries(catalog.metrics).map(([name, entry]) => [name, metricToContract(entry)])),
|
|
41
|
+
filters: sortedRecord(Object.entries(catalog.filters).map(([name, entry]) => [name, filterToContract(entry)])),
|
|
42
|
+
relationships: sortedRecord(Object.entries(catalog.relationships).map(([name, entry]) => [name, relationshipToContract(entry)])),
|
|
43
|
+
...(catalog.limits !== undefined ? { limits: limitsToContract(catalog.limits) } : {}),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Emits dataset limits with a fixed key order. The source object's key order is
|
|
48
|
+
* author-controlled, so normalizing it keeps the contract hash stable for
|
|
49
|
+
* logically identical limits.
|
|
50
|
+
*/
|
|
51
|
+
function limitsToContract(limits) {
|
|
52
|
+
return {
|
|
53
|
+
...(limits.maxDimensions !== undefined ? { maxDimensions: limits.maxDimensions } : {}),
|
|
54
|
+
...(limits.maxFilters !== undefined ? { maxFilters: limits.maxFilters } : {}),
|
|
55
|
+
...(limits.maxMeasures !== undefined ? { maxMeasures: limits.maxMeasures } : {}),
|
|
56
|
+
...(limits.maxResultSize !== undefined ? { maxResultSize: limits.maxResultSize } : {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function dimensionToContract(entry, includeSql) {
|
|
60
|
+
return {
|
|
61
|
+
type: entry.type,
|
|
62
|
+
...(entry.column !== undefined ? { column: entry.column } : {}),
|
|
63
|
+
...(includeSql && entry.sql !== undefined ? { sql: normalizeSql(entry.sql) } : {}),
|
|
64
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
65
|
+
...(entry.description !== undefined ? { description: entry.description } : {}),
|
|
66
|
+
filterable: entry.filterable,
|
|
67
|
+
groupable: entry.groupable,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function measureToContract(entry, includeSql) {
|
|
71
|
+
return {
|
|
72
|
+
aggregation: entry.aggregation,
|
|
73
|
+
field: entry.field,
|
|
74
|
+
...(includeSql && entry.sql !== undefined ? { sql: normalizeSql(entry.sql) } : {}),
|
|
75
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
76
|
+
...(entry.description !== undefined ? { description: entry.description } : {}),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function metricToContract(entry) {
|
|
80
|
+
return {
|
|
81
|
+
kind: entry.kind,
|
|
82
|
+
valueType: entry.valueType,
|
|
83
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
84
|
+
...(entry.description !== undefined ? { description: entry.description } : {}),
|
|
85
|
+
dimensions: uniqueSorted(entry.dimensions),
|
|
86
|
+
...(entry.measures !== undefined ? { measures: uniqueSorted(entry.measures) } : {}),
|
|
87
|
+
filters: uniqueSorted(entry.filters),
|
|
88
|
+
grains: uniqueSorted(entry.grains),
|
|
89
|
+
...(entry.grain !== undefined ? { grain: entry.grain } : {}),
|
|
90
|
+
...(entry.requires !== undefined ? { requires: uniqueSorted(entry.requires) } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function filterToContract(entry) {
|
|
94
|
+
return {
|
|
95
|
+
field: entry.field,
|
|
96
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
97
|
+
...(entry.description !== undefined ? { description: entry.description } : {}),
|
|
98
|
+
operators: uniqueSorted(entry.operators ?? []),
|
|
99
|
+
...(entry.valueType !== undefined ? { valueType: entry.valueType } : {}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function relationshipToContract(entry) {
|
|
103
|
+
return {
|
|
104
|
+
kind: entry.kind,
|
|
105
|
+
target: entry.target,
|
|
106
|
+
from: entry.from,
|
|
107
|
+
to: entry.to,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Serializes a contract with stable formatting for writing to disk and hashing.
|
|
112
|
+
*/
|
|
113
|
+
export function contractToStableJson(contract) {
|
|
114
|
+
return JSON.stringify(contract, null, 2);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Computes the SHA-256 content hash for a normalized contract.
|
|
118
|
+
*
|
|
119
|
+
* Uses `@noble/hashes` (audited, isomorphic, synchronous) rather than
|
|
120
|
+
* `node:crypto` so the contract stays usable in browser/edge runtimes.
|
|
121
|
+
*/
|
|
122
|
+
export function hashContract(contract) {
|
|
123
|
+
return bytesToHex(sha256(contractToStableJson(contract)));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Locale-independent string comparison by UTF-16 code unit. Used everywhere the
|
|
127
|
+
* contract sorts, so the content hash is stable across environments (CI ICU
|
|
128
|
+
* versions, locales) rather than depending on `localeCompare`.
|
|
129
|
+
*/
|
|
130
|
+
function compareStrings(left, right) {
|
|
131
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
132
|
+
}
|
|
133
|
+
/** Builds an object whose keys are inserted in sorted order for stable JSON. */
|
|
134
|
+
function sortedRecord(entries) {
|
|
135
|
+
return Object.fromEntries([...entries].sort(([left], [right]) => compareStrings(left, right)));
|
|
136
|
+
}
|
|
137
|
+
/** Deduplicates and sorts a list so logically-equal sets serialize identically. */
|
|
138
|
+
function uniqueSorted(values) {
|
|
139
|
+
return Array.from(new Set(values)).sort(compareStrings);
|
|
140
|
+
}
|
|
141
|
+
/** Normalizes SQL escape-hatch whitespace so equivalent SQL hashes identically. */
|
|
142
|
+
function normalizeSql(sql) {
|
|
143
|
+
const lines = sql
|
|
144
|
+
.replace(/\r\n/g, '\n')
|
|
145
|
+
.split('\n')
|
|
146
|
+
.map(line => line.replace(/\s+$/g, ''));
|
|
147
|
+
while (lines.length > 0 && lines[0].trim() === '') {
|
|
148
|
+
lines.shift();
|
|
149
|
+
}
|
|
150
|
+
while (lines.length > 0 && lines[lines.length - 1].trim() === '') {
|
|
151
|
+
lines.pop();
|
|
152
|
+
}
|
|
153
|
+
const indents = lines
|
|
154
|
+
.filter(line => line.trim().length > 0)
|
|
155
|
+
.map(line => line.match(/^\s*/)?.[0].length ?? 0);
|
|
156
|
+
const minIndent = indents.length > 0 ? Math.min(...indents) : 0;
|
|
157
|
+
return lines
|
|
158
|
+
.map(line => line.slice(minIndent))
|
|
159
|
+
.join('\n')
|
|
160
|
+
.trim();
|
|
161
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export { divide, multiply, subtract, add, nullIfZero, coalesce, round, floor, ce
|
|
|
7
7
|
export { eq, neq, gt, gte, lt, lte, inList, notInList, between, like, asc, desc, filter, order, } from './query-helpers.js';
|
|
8
8
|
export { createDatasetRegistry } from './registry.js';
|
|
9
9
|
export { getDatasetCatalog, getDatasetCatalogs } from './catalog.js';
|
|
10
|
-
export type { DatasetCatalog, DatasetCatalogMap, DimensionCatalogEntry, MeasureCatalogEntry, MetricCatalogEntry, FilterCatalogEntry, RelationshipCatalogEntry, } from './catalog.js';
|
|
10
|
+
export type { DatasetCatalog, DatasetCatalogMap, DatasetCatalogSource, DimensionCatalogEntry, MeasureCatalogEntry, MetricCatalogEntry, FilterCatalogEntry, RelationshipCatalogEntry, } from './catalog.js';
|
|
11
|
+
export { serializeSemanticContract, contractToStableJson, hashContract, SEMANTIC_CONTRACT_VERSION, } from './contract.js';
|
|
12
|
+
export type { SemanticContract, SerializeSemanticContractOptions, ContractDataset, ContractDimension, ContractMeasure, ContractMetric, ContractFilter, ContractRelationship, } from './contract.js';
|
|
11
13
|
export { generateDatasetTools, toOpenAITools, toAISDKTools, toMcpTools, } from './tools.js';
|
|
12
14
|
export type { AISDKToolDefinition, DatasetToolAnalytics, DatasetToolMode, GenerateDatasetToolsOptions, JsonSchema, McpToolDefinition, OpenAIToolDefinition, SemanticToolDefinition, } from './tools.js';
|
|
13
15
|
export { createDatasetClient } from './executor.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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AAe,EACf,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export { eq, neq, gt, gte, lt, lte, inList, notInList, between, like, asc, desc,
|
|
|
16
16
|
export { createDatasetRegistry } from './registry.js';
|
|
17
17
|
// Catalog
|
|
18
18
|
export { getDatasetCatalog, getDatasetCatalogs } from './catalog.js';
|
|
19
|
+
// Semantic contract (stable, hashable export for snapshots/diffs/validation)
|
|
20
|
+
export { serializeSemanticContract, contractToStableJson, hashContract, SEMANTIC_CONTRACT_VERSION, } from './contract.js';
|
|
19
21
|
// Agent/tool metadata
|
|
20
22
|
export { generateDatasetTools, toOpenAITools, toAISDKTools, toMcpTools, } from './tools.js';
|
|
21
23
|
// Dataset client
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/datasets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Semantic layer for defining datasets, metrics, and semantic queries",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@noble/hashes": "^1.8.0",
|
|
32
33
|
"zod": "^3.22.4"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|