@hypequery/cli 1.2.0 → 1.2.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"dataset-generator.d.ts","sourceRoot":"","sources":["../../src/generators/dataset-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA6MD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,iBAyDtE"}
1
+ {"version":3,"file":"dataset-generator.d.ts","sourceRoot":"","sources":["../../src/generators/dataset-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAuPD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,iBAyDtE"}
@@ -68,6 +68,38 @@ function isNumericColumn(column) {
68
68
  type.includes('double') ||
69
69
  type.includes('decimal'));
70
70
  }
71
+ /**
72
+ * Check if a numeric column is more likely an identifier than an additive value.
73
+ */
74
+ function isIdentifierColumn(column) {
75
+ const originalName = column.name;
76
+ const name = column.name.toLowerCase();
77
+ return (name === 'id' ||
78
+ name === 'uuid' ||
79
+ name.endsWith('_id') ||
80
+ originalName.endsWith('Id') ||
81
+ name.includes('uuid') ||
82
+ isTenantColumn(column));
83
+ }
84
+ /**
85
+ * Check if a numeric column is a coordinate that should not be summed or averaged.
86
+ */
87
+ function isCoordinateColumn(column) {
88
+ const name = column.name.toLowerCase();
89
+ return (name === 'lat' ||
90
+ name === 'lng' ||
91
+ name === 'lon' ||
92
+ name === 'latitude' ||
93
+ name === 'longitude' ||
94
+ name.endsWith('_lat') ||
95
+ name.endsWith('_lng') ||
96
+ name.endsWith('_lon') ||
97
+ name.endsWith('_latitude') ||
98
+ name.endsWith('_longitude'));
99
+ }
100
+ function isMeasureCandidate(column) {
101
+ return isNumericColumn(column) && !isIdentifierColumn(column) && !isCoordinateColumn(column);
102
+ }
71
103
  /**
72
104
  * Convert table name to PascalCase for dataset variable name
73
105
  */
@@ -122,8 +154,9 @@ async function generateDatasetForTable(client, tableName) {
122
154
  dimensionLines.push(` ${fieldName}: dimension.${dimensionType}({ column: '${column.name}', label: '${label}' }),`);
123
155
  }
124
156
  }
125
- // Generate measures (for numeric columns only)
126
- const numericColumns = columns.filter(isNumericColumn).filter((c) => !isTenantColumn(c));
157
+ // Generate measures for numeric value columns only. IDs and coordinates stay
158
+ // dimensions because summing or averaging them is usually noise.
159
+ const numericColumns = columns.filter(isMeasureCandidate);
127
160
  const measureLines = [];
128
161
  if (numericColumns.length > 0) {
129
162
  measureLines.push(` // Count measures`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypequery/cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Command-line interface for hypequery",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  "@vitest/coverage-v8": "^2.1.6",
36
36
  "typescript": "^5.7.3",
37
37
  "vitest": "^2.1.6",
38
- "@hypequery/clickhouse": "2.1.0",
39
- "@hypequery/serve": "0.3.0"
38
+ "@hypequery/clickhouse": "2.1.2",
39
+ "@hypequery/serve": "0.5.0"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",