@hypequery/cli 1.1.0 → 1.1.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.
@@ -3,5 +3,7 @@ export interface ClickHouseGeneratorOptions {
3
3
  includeTables?: string[];
4
4
  excludeTables?: string[];
5
5
  }
6
+ declare const clickhouseToTsType: (type: string) => string;
7
+ export { clickhouseToTsType };
6
8
  export declare function generateClickHouseTypes(options: ClickHouseGeneratorOptions): Promise<void>;
7
9
  //# sourceMappingURL=clickhouse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clickhouse.d.ts","sourceRoot":"","sources":["../../src/generators/clickhouse.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA4HD,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,iBA0ChF"}
1
+ {"version":3,"file":"clickhouse.d.ts","sourceRoot":"","sources":["../../src/generators/clickhouse.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAmGD,QAAA,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAsC1C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAgC9B,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,iBA0ChF"}
@@ -39,57 +39,53 @@ import path from 'node:path';
39
39
  import { getClickHouseClient } from '../utils/clickhouse-client.js';
40
40
  var DEFAULT_WARNING = 'Warning: No tables match the filter criteria. Check your include/exclude options.';
41
41
  var capitalizeFirstLetter = function (value) { return value.charAt(0).toUpperCase() + value.slice(1); };
42
- var clickhouseToTsType = function (type) {
43
- if (type.startsWith('Array(')) {
44
- var innerType = type.slice(6, -1);
45
- return "Array<".concat(clickhouseToTsType(innerType), ">");
46
- }
47
- if (type.startsWith('Nullable(')) {
48
- var innerType = type.slice(9, -1);
49
- return "".concat(clickhouseToTsType(innerType), " | null");
50
- }
51
- if (type.startsWith('Map(')) {
52
- var mapContent = type.slice(4, -1);
53
- var commaIndex = mapContent.lastIndexOf(',');
54
- if (commaIndex !== -1) {
55
- var keyType = mapContent.substring(0, commaIndex).trim();
56
- var valueType = mapContent.substring(commaIndex + 1).trim();
57
- var keyTsType = 'string';
58
- if (keyType === 'LowCardinality(String)') {
59
- keyTsType = 'string';
60
- }
61
- else if (keyType.includes('Int') || keyType.includes('UInt')) {
62
- keyTsType = 'number';
63
- }
64
- var valueTsType = 'unknown';
65
- if (valueType.startsWith('Array(')) {
66
- var innerType = valueType.slice(6, -1);
67
- valueTsType = "Array<".concat(clickhouseToTsType(innerType), ">");
68
- }
69
- else if (valueType.startsWith('Nullable(')) {
70
- var innerType = valueType.slice(9, -1);
71
- valueTsType = "".concat(clickhouseToTsType(innerType), " | null");
72
- }
73
- else {
74
- valueTsType = clickhouseToTsType(valueType);
75
- }
76
- return "Record<".concat(keyTsType, ", ").concat(valueTsType, ">");
42
+ function splitTopLevelArgs(value) {
43
+ var parts = [];
44
+ var current = '';
45
+ var depth = 0;
46
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
47
+ var char = value_1[_i];
48
+ if (char === '(') {
49
+ depth += 1;
50
+ current += char;
51
+ continue;
77
52
  }
78
- return 'Record<string, unknown>';
53
+ if (char === ')') {
54
+ depth -= 1;
55
+ current += char;
56
+ continue;
57
+ }
58
+ if (char === ',' && depth === 0) {
59
+ parts.push(current.trim());
60
+ current = '';
61
+ continue;
62
+ }
63
+ current += char;
79
64
  }
80
- switch (type.toLowerCase()) {
65
+ if (current.trim()) {
66
+ parts.push(current.trim());
67
+ }
68
+ return parts;
69
+ }
70
+ function unwrapType(type, wrapperName) {
71
+ var prefix = "".concat(wrapperName, "(");
72
+ return type.startsWith(prefix) && type.endsWith(')') ? type.slice(prefix.length, -1) : null;
73
+ }
74
+ function getPrimitiveTsType(type) {
75
+ var lowerType = type.toLowerCase();
76
+ switch (lowerType) {
81
77
  case 'string':
82
- case 'fixedstring':
78
+ case 'uuid':
83
79
  return 'string';
84
80
  case 'int8':
85
81
  case 'int16':
86
82
  case 'int32':
87
83
  case 'uint8':
88
- case 'int64':
89
84
  case 'uint16':
90
85
  case 'uint32':
91
- case 'uint64':
92
86
  return 'number';
87
+ case 'int64':
88
+ case 'uint64':
93
89
  case 'uint128':
94
90
  case 'uint256':
95
91
  case 'int128':
@@ -108,9 +104,56 @@ var clickhouseToTsType = function (type) {
108
104
  case 'boolean':
109
105
  return 'boolean';
110
106
  default:
111
- return 'string';
107
+ if (type.startsWith('FixedString('))
108
+ return 'string';
109
+ if (type.startsWith('Decimal('))
110
+ return 'number';
111
+ if (type.startsWith('DateTime64('))
112
+ return 'string';
113
+ if (type.startsWith('DateTime('))
114
+ return 'string';
115
+ if (type.startsWith('Enum8('))
116
+ return 'string';
117
+ if (type.startsWith('Enum16('))
118
+ return 'string';
119
+ return null;
120
+ }
121
+ }
122
+ var clickhouseToTsType = function (type) {
123
+ var wrappedArrayType = unwrapType(type, 'Array');
124
+ if (wrappedArrayType) {
125
+ return "Array<".concat(clickhouseToTsType(wrappedArrayType), ">");
126
+ }
127
+ var wrappedNullableType = unwrapType(type, 'Nullable');
128
+ if (wrappedNullableType) {
129
+ return "".concat(clickhouseToTsType(wrappedNullableType), " | null");
130
+ }
131
+ var wrappedLowCardinalityType = unwrapType(type, 'LowCardinality');
132
+ if (wrappedLowCardinalityType) {
133
+ return clickhouseToTsType(wrappedLowCardinalityType);
134
+ }
135
+ var wrappedTupleType = unwrapType(type, 'Tuple');
136
+ if (wrappedTupleType) {
137
+ var tupleParts = splitTopLevelArgs(wrappedTupleType);
138
+ return "[".concat(tupleParts.map(clickhouseToTsType).join(', '), "]");
139
+ }
140
+ var wrappedMapType = unwrapType(type, 'Map');
141
+ if (wrappedMapType) {
142
+ var mapParts = splitTopLevelArgs(wrappedMapType);
143
+ if (mapParts.length === 2) {
144
+ var valueType = mapParts[1];
145
+ // JSON object keys are strings even when ClickHouse map keys are numeric.
146
+ return "Record<string, ".concat(clickhouseToTsType(valueType), ">");
147
+ }
148
+ return 'Record<string, unknown>';
112
149
  }
150
+ var primitiveType = getPrimitiveTsType(type);
151
+ if (primitiveType)
152
+ return primitiveType;
153
+ // Unsupported or more complex ClickHouse types currently preserve the historical fallback.
154
+ return 'string';
113
155
  };
156
+ export { clickhouseToTsType };
114
157
  function fetchTables(includeTables, excludeTables) {
115
158
  return __awaiter(this, void 0, void 0, function () {
116
159
  var client, tablesQuery, tables;
@@ -1,2 +1,3 @@
1
1
  export declare function loadApiModule(modulePath: string): Promise<any>;
2
+ export declare function loadModule(modulePath: string): Promise<any>;
2
3
  //# sourceMappingURL=load-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-api.d.ts","sourceRoot":"","sources":["../../src/utils/load-api.ts"],"names":[],"mappings":"AAaA,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,gBA0ErD"}
1
+ {"version":3,"file":"load-api.d.ts","sourceRoot":"","sources":["../../src/utils/load-api.ts"],"names":[],"mappings":"AAaA,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,gBAkDrD;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,gBAkClD"}
@@ -47,92 +47,116 @@ var TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts']);
47
47
  var tsconfigCache = new Map();
48
48
  export function loadApiModule(modulePath) {
49
49
  return __awaiter(this, void 0, void 0, function () {
50
- var resolved, _a, relativePath, extension, isTypeScript, moduleUrl, _b, mod, importOverride, _c, error_1, relativePath, api, relativePath, availableExports;
51
- var _d;
52
- return __generator(this, function (_e) {
53
- switch (_e.label) {
50
+ var resolved, mod, error_1, relativePath, api, relativePath, availableExports;
51
+ var _a;
52
+ return __generator(this, function (_b) {
53
+ switch (_b.label) {
54
54
  case 0:
55
55
  resolved = path.resolve(process.cwd(), modulePath);
56
- _e.label = 1;
56
+ _b.label = 1;
57
57
  case 1:
58
- _e.trys.push([1, 3, , 4]);
58
+ _b.trys.push([1, 3, , 4]);
59
+ return [4 /*yield*/, loadModule(modulePath)];
60
+ case 2:
61
+ mod = _b.sent();
62
+ return [3 /*break*/, 4];
63
+ case 3:
64
+ error_1 = _b.sent();
65
+ if (error_1 instanceof Error && error_1.message.startsWith('File not found:')) {
66
+ relativePath = path.relative(process.cwd(), resolved);
67
+ throw new Error("File not found: ".concat(relativePath, "\n\n") +
68
+ "Make sure the file exists and the path is correct.\n" +
69
+ "You can specify a different file with:\n" +
70
+ " hypequery dev path/to/your/queries.ts");
71
+ }
72
+ throw error_1;
73
+ case 4:
74
+ api = (_a = mod.api) !== null && _a !== void 0 ? _a : mod.default;
75
+ if (!api || typeof api.handler !== 'function') {
76
+ relativePath = path.relative(process.cwd(), resolved);
77
+ availableExports = Object.keys(mod).filter(function (key) { return key !== '__esModule'; });
78
+ throw new Error("Invalid API module: ".concat(relativePath, "\n\n") +
79
+ "The module must export a 'defineServe' result as 'api'.\n\n" +
80
+ (availableExports.length > 0
81
+ ? "Found exports: ".concat(availableExports.join(', '), "\n\n")
82
+ : "No exports found in the module.\n\n") +
83
+ "Expected format:\n\n" +
84
+ " import { initServe } from '@hypequery/serve';\n" +
85
+ " \n" +
86
+ " const { define, queries, query } = initServe({\n" +
87
+ " context: () => ({ db }),\n" +
88
+ " });\n" +
89
+ " \n" +
90
+ " export const api = define({\n" +
91
+ " queries: queries({\n" +
92
+ " myQuery: query.query(async ({ ctx }) => {\n" +
93
+ " // ...\n" +
94
+ " }),\n" +
95
+ " }),\n" +
96
+ " });\n");
97
+ }
98
+ return [2 /*return*/, api];
99
+ }
100
+ });
101
+ });
102
+ }
103
+ export function loadModule(modulePath) {
104
+ return __awaiter(this, void 0, void 0, function () {
105
+ var resolved, _a, relativePath, extension, isTypeScript, moduleUrl, _b, importOverride, _c, error_2, relativePath;
106
+ return __generator(this, function (_d) {
107
+ switch (_d.label) {
108
+ case 0:
109
+ resolved = path.resolve(process.cwd(), modulePath);
110
+ _d.label = 1;
111
+ case 1:
112
+ _d.trys.push([1, 3, , 4]);
59
113
  return [4 /*yield*/, access(resolved)];
60
114
  case 2:
61
- _e.sent();
115
+ _d.sent();
62
116
  return [3 /*break*/, 4];
63
117
  case 3:
64
- _a = _e.sent();
118
+ _a = _d.sent();
65
119
  relativePath = path.relative(process.cwd(), resolved);
66
- throw new Error("File not found: ".concat(relativePath, "\n\n") +
67
- "Make sure the file exists and the path is correct.\n" +
68
- "You can specify a different file with:\n" +
69
- " hypequery dev path/to/your/queries.ts");
120
+ throw new Error("File not found: ".concat(relativePath));
70
121
  case 4:
71
122
  extension = path.extname(resolved).toLowerCase();
72
123
  isTypeScript = TYPESCRIPT_EXTENSIONS.has(extension);
73
124
  if (!isTypeScript) return [3 /*break*/, 6];
74
125
  return [4 /*yield*/, bundleTypeScriptModule(resolved)];
75
126
  case 5:
76
- _b = _e.sent();
127
+ _b = _d.sent();
77
128
  return [3 /*break*/, 7];
78
129
  case 6:
79
130
  _b = "".concat(pathToFileURL(resolved).href, "?t=").concat(Date.now());
80
- _e.label = 7;
131
+ _d.label = 7;
81
132
  case 7:
82
133
  moduleUrl = _b;
83
- _e.label = 8;
134
+ _d.label = 8;
84
135
  case 8:
85
- _e.trys.push([8, 13, , 14]);
136
+ _d.trys.push([8, 13, , 14]);
86
137
  importOverride = globalState.__hypequeryCliImportOverride;
87
138
  if (!importOverride) return [3 /*break*/, 10];
88
139
  return [4 /*yield*/, importOverride(moduleUrl)];
89
140
  case 9:
90
- _c = _e.sent();
141
+ _c = _d.sent();
91
142
  return [3 /*break*/, 12];
92
143
  case 10: return [4 /*yield*/, import(/* @vite-ignore */ moduleUrl)];
93
144
  case 11:
94
- _c = _e.sent();
95
- _e.label = 12;
96
- case 12:
97
- mod = _c;
98
- return [3 /*break*/, 14];
145
+ _c = _d.sent();
146
+ _d.label = 12;
147
+ case 12: return [2 /*return*/, _c];
99
148
  case 13:
100
- error_1 = _e.sent();
149
+ error_2 = _d.sent();
101
150
  relativePath = path.relative(process.cwd(), resolved);
102
151
  throw new Error("Failed to load module: ".concat(relativePath, "\n\n") +
103
- "Error: ".concat(error_1.message, "\n\n") +
104
- (error_1.code === 'ERR_MODULE_NOT_FOUND'
152
+ "Error: ".concat(error_2.message, "\n\n") +
153
+ (error_2.code === 'ERR_MODULE_NOT_FOUND'
105
154
  ? "This usually means:\n" +
106
155
  " \u2022 A dependency is missing (run 'npm install')\n" +
107
156
  " \u2022 An import path is incorrect\n"
108
157
  : "") +
109
- (error_1.stack ? "\nStack trace:\n".concat(error_1.stack, "\n") : ''));
110
- case 14:
111
- api = (_d = mod.api) !== null && _d !== void 0 ? _d : mod.default;
112
- if (!api || typeof api.handler !== 'function') {
113
- relativePath = path.relative(process.cwd(), resolved);
114
- availableExports = Object.keys(mod).filter(function (key) { return key !== '__esModule'; });
115
- throw new Error("Invalid API module: ".concat(relativePath, "\n\n") +
116
- "The module must export a 'defineServe' result as 'api'.\n\n" +
117
- (availableExports.length > 0
118
- ? "Found exports: ".concat(availableExports.join(', '), "\n\n")
119
- : "No exports found in the module.\n\n") +
120
- "Expected format:\n\n" +
121
- " import { initServe } from '@hypequery/serve';\n" +
122
- " \n" +
123
- " const { define, queries, query } = initServe({\n" +
124
- " context: () => ({ db }),\n" +
125
- " });\n" +
126
- " \n" +
127
- " export const api = define({\n" +
128
- " queries: queries({\n" +
129
- " myQuery: query.query(async ({ ctx }) => {\n" +
130
- " // ...\n" +
131
- " }),\n" +
132
- " }),\n" +
133
- " });\n");
134
- }
135
- return [2 /*return*/, api];
158
+ (error_2.stack ? "\nStack trace:\n".concat(error_2.stack, "\n") : ''));
159
+ case 14: return [2 /*return*/];
136
160
  }
137
161
  });
138
162
  });
@@ -294,7 +318,7 @@ function installCleanupHooks() {
294
318
  }
295
319
  function bundleTypeScriptModule(entryPath) {
296
320
  return __awaiter(this, void 0, void 0, function () {
297
- var relativePath, tsconfigPath, result, output, tempDir, timestamp, tempFile, contents, error_2;
321
+ var relativePath, tsconfigPath, result, output, tempDir, timestamp, tempFile, contents, error_3;
298
322
  var _a, _b, _c, _d;
299
323
  return __generator(this, function (_e) {
300
324
  switch (_e.label) {
@@ -345,9 +369,9 @@ function bundleTypeScriptModule(entryPath) {
345
369
  tempFiles.add(tempFile);
346
370
  return [2 /*return*/, "".concat(pathToFileURL(tempFile).href, "?t=").concat(timestamp)];
347
371
  case 6:
348
- error_2 = _e.sent();
372
+ error_3 = _e.sent();
349
373
  throw new Error("Failed to compile ".concat(relativePath, " with esbuild.\n") +
350
- "Original error: ".concat((_d = error_2 === null || error_2 === void 0 ? void 0 : error_2.message) !== null && _d !== void 0 ? _d : error_2));
374
+ "Original error: ".concat((_d = error_3 === null || error_3 === void 0 ? void 0 : error_3.message) !== null && _d !== void 0 ? _d : error_3));
351
375
  case 7: return [2 /*return*/];
352
376
  }
353
377
  });
@@ -0,0 +1,7 @@
1
+ import type { ResolvedHypequeryClickHouseConfig } from '@hypequery/clickhouse';
2
+ export declare const DEFAULT_HYPEQUERY_CONFIG_PATH = "hypequery.config.ts";
3
+ export declare const DEFAULT_MIGRATIONS_OUT_DIR = "./migrations";
4
+ export declare const DEFAULT_MIGRATIONS_TABLE = "_hypequery_migrations";
5
+ export declare const DEFAULT_MIGRATIONS_PREFIX: "timestamp";
6
+ export declare function loadHypequeryConfig(configPath?: string): Promise<ResolvedHypequeryClickHouseConfig>;
7
+ //# sourceMappingURL=load-hypequery-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-hypequery-config.d.ts","sourceRoot":"","sources":["../../src/utils/load-hypequery-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AACnE,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AACzD,eAAO,MAAM,wBAAwB,0BAA0B,CAAC;AAChE,eAAO,MAAM,yBAAyB,EAAG,WAAoB,CAAC;AAE9D,wBAAsB,mBAAmB,CACvC,UAAU,SAAgC,GACzC,OAAO,CAAC,iCAAiC,CAAC,CA0C5C"}
@@ -0,0 +1,89 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { loadModule } from './load-api.js';
49
+ export var DEFAULT_HYPEQUERY_CONFIG_PATH = 'hypequery.config.ts';
50
+ export var DEFAULT_MIGRATIONS_OUT_DIR = './migrations';
51
+ export var DEFAULT_MIGRATIONS_TABLE = '_hypequery_migrations';
52
+ export var DEFAULT_MIGRATIONS_PREFIX = 'timestamp';
53
+ export function loadHypequeryConfig() {
54
+ return __awaiter(this, arguments, void 0, function (configPath) {
55
+ var mod, candidate, config;
56
+ var _a, _b, _c, _d, _e, _f, _g;
57
+ if (configPath === void 0) { configPath = DEFAULT_HYPEQUERY_CONFIG_PATH; }
58
+ return __generator(this, function (_h) {
59
+ switch (_h.label) {
60
+ case 0: return [4 /*yield*/, loadModule(configPath)];
61
+ case 1:
62
+ mod = _h.sent();
63
+ candidate = (_a = mod.default) !== null && _a !== void 0 ? _a : mod.config;
64
+ if (!candidate || typeof candidate !== 'object') {
65
+ throw new Error("Invalid hypequery config: ".concat(configPath, "\n\n") +
66
+ "The config module must export a ClickHouse config as the default export.");
67
+ }
68
+ config = candidate;
69
+ if (config.dialect !== 'clickhouse') {
70
+ throw new Error("Invalid hypequery config: ".concat(configPath, "\n\n") +
71
+ "Expected \"dialect\" to be \"clickhouse\".");
72
+ }
73
+ if (typeof config.schema !== 'string' || config.schema.length === 0) {
74
+ throw new Error("Invalid hypequery config: ".concat(configPath, "\n\n") +
75
+ "Expected \"schema\" to be a non-empty string.");
76
+ }
77
+ if (!config.dbCredentials || typeof config.dbCredentials !== 'object') {
78
+ throw new Error("Invalid hypequery config: ".concat(configPath, "\n\n") +
79
+ "Expected \"dbCredentials\" to be defined.");
80
+ }
81
+ return [2 /*return*/, __assign(__assign({}, config), { migrations: {
82
+ out: (_c = (_b = config.migrations) === null || _b === void 0 ? void 0 : _b.out) !== null && _c !== void 0 ? _c : DEFAULT_MIGRATIONS_OUT_DIR,
83
+ table: (_e = (_d = config.migrations) === null || _d === void 0 ? void 0 : _d.table) !== null && _e !== void 0 ? _e : DEFAULT_MIGRATIONS_TABLE,
84
+ prefix: (_g = (_f = config.migrations) === null || _f === void 0 ? void 0 : _f.prefix) !== null && _g !== void 0 ? _g : DEFAULT_MIGRATIONS_PREFIX,
85
+ } })];
86
+ }
87
+ });
88
+ });
89
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypequery/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Command-line interface for hypequery",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "@vitest/coverage-v8": "^2.1.6",
36
36
  "typescript": "^5.7.3",
37
37
  "vitest": "^2.1.6",
38
- "@hypequery/clickhouse": "1.6.0",
38
+ "@hypequery/clickhouse": "1.6.2",
39
39
  "@hypequery/serve": "0.2.0"
40
40
  },
41
41
  "repository": {