@hypequery/cli 0.0.6 → 0.0.8

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 (68) hide show
  1. package/LICENSE +201 -0
  2. package/package.json +11 -11
  3. package/dist/bin/cli.d.ts +0 -3
  4. package/dist/bin/cli.d.ts.map +0 -1
  5. package/dist/bin/cli.js +0 -86
  6. package/dist/cli.d.ts +0 -4
  7. package/dist/cli.d.ts.map +0 -1
  8. package/dist/cli.js +0 -162
  9. package/dist/commands/create-api-types.d.ts +0 -6
  10. package/dist/commands/create-api-types.d.ts.map +0 -1
  11. package/dist/commands/create-api-types.js +0 -149
  12. package/dist/commands/dev.d.ts +0 -12
  13. package/dist/commands/dev.d.ts.map +0 -1
  14. package/dist/commands/dev.js +0 -249
  15. package/dist/commands/generate.d.ts +0 -8
  16. package/dist/commands/generate.d.ts.map +0 -1
  17. package/dist/commands/generate.js +0 -175
  18. package/dist/commands/init.d.ts +0 -9
  19. package/dist/commands/init.d.ts.map +0 -1
  20. package/dist/commands/init.js +0 -362
  21. package/dist/commands/toolkit.d.ts +0 -6
  22. package/dist/commands/toolkit.d.ts.map +0 -1
  23. package/dist/commands/toolkit.js +0 -159
  24. package/dist/generators/clickhouse.d.ts +0 -7
  25. package/dist/generators/clickhouse.d.ts.map +0 -1
  26. package/dist/generators/clickhouse.js +0 -229
  27. package/dist/generators/index.d.ts +0 -7
  28. package/dist/generators/index.d.ts.map +0 -1
  29. package/dist/generators/index.js +0 -13
  30. package/dist/templates/client.d.ts +0 -5
  31. package/dist/templates/client.d.ts.map +0 -1
  32. package/dist/templates/client.js +0 -6
  33. package/dist/templates/env.d.ts +0 -14
  34. package/dist/templates/env.d.ts.map +0 -1
  35. package/dist/templates/env.js +0 -37
  36. package/dist/templates/gitignore.d.ts +0 -13
  37. package/dist/templates/gitignore.d.ts.map +0 -1
  38. package/dist/templates/gitignore.js +0 -22
  39. package/dist/templates/queries.d.ts +0 -8
  40. package/dist/templates/queries.d.ts.map +0 -1
  41. package/dist/templates/queries.js +0 -27
  42. package/dist/test-utils.d.ts +0 -86
  43. package/dist/test-utils.d.ts.map +0 -1
  44. package/dist/test-utils.js +0 -153
  45. package/dist/utils/clickhouse-client.d.ts +0 -11
  46. package/dist/utils/clickhouse-client.d.ts.map +0 -1
  47. package/dist/utils/clickhouse-client.js +0 -86
  48. package/dist/utils/detect-database.d.ts +0 -21
  49. package/dist/utils/detect-database.d.ts.map +0 -1
  50. package/dist/utils/detect-database.js +0 -224
  51. package/dist/utils/ensure-ts-runtime.d.ts +0 -4
  52. package/dist/utils/ensure-ts-runtime.d.ts.map +0 -1
  53. package/dist/utils/ensure-ts-runtime.js +0 -66
  54. package/dist/utils/error-messages.d.ts +0 -6
  55. package/dist/utils/error-messages.d.ts.map +0 -1
  56. package/dist/utils/error-messages.js +0 -19
  57. package/dist/utils/find-files.d.ts +0 -21
  58. package/dist/utils/find-files.d.ts.map +0 -1
  59. package/dist/utils/find-files.js +0 -183
  60. package/dist/utils/load-api.d.ts +0 -2
  61. package/dist/utils/load-api.d.ts.map +0 -1
  62. package/dist/utils/load-api.js +0 -328
  63. package/dist/utils/logger.d.ts +0 -54
  64. package/dist/utils/logger.d.ts.map +0 -1
  65. package/dist/utils/logger.js +0 -122
  66. package/dist/utils/prompts.d.ts +0 -39
  67. package/dist/utils/prompts.d.ts.map +0 -1
  68. package/dist/utils/prompts.js +0 -282
@@ -1,328 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- 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);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- 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;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- var _a, _b, _c;
38
- import { pathToFileURL } from 'node:url';
39
- import { access, mkdtemp, writeFile, rm, mkdir } from 'node:fs/promises';
40
- import os from 'node:os';
41
- import path from 'node:path';
42
- import { build } from 'esbuild';
43
- if (typeof process.setMaxListeners === 'function') {
44
- process.setMaxListeners(0);
45
- }
46
- var TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts']);
47
- var tsconfigCache = new Map();
48
- export function loadApiModule(modulePath) {
49
- return __awaiter(this, void 0, void 0, function () {
50
- var resolved, _a, relativePath, extension, isTypeScript, moduleUrl, _b, mod, error_1, relativePath, api, relativePath, availableExports;
51
- var _c;
52
- return __generator(this, function (_d) {
53
- switch (_d.label) {
54
- case 0:
55
- resolved = path.resolve(process.cwd(), modulePath);
56
- _d.label = 1;
57
- case 1:
58
- _d.trys.push([1, 3, , 4]);
59
- return [4 /*yield*/, access(resolved)];
60
- case 2:
61
- _d.sent();
62
- return [3 /*break*/, 4];
63
- case 3:
64
- _a = _d.sent();
65
- 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");
70
- case 4:
71
- extension = path.extname(resolved).toLowerCase();
72
- isTypeScript = TYPESCRIPT_EXTENSIONS.has(extension);
73
- if (!isTypeScript) return [3 /*break*/, 6];
74
- return [4 /*yield*/, bundleTypeScriptModule(resolved)];
75
- case 5:
76
- _b = _d.sent();
77
- return [3 /*break*/, 7];
78
- case 6:
79
- _b = "".concat(pathToFileURL(resolved).href, "?t=").concat(Date.now());
80
- _d.label = 7;
81
- case 7:
82
- moduleUrl = _b;
83
- _d.label = 8;
84
- case 8:
85
- _d.trys.push([8, 10, , 11]);
86
- return [4 /*yield*/, import(moduleUrl)];
87
- case 9:
88
- mod = _d.sent();
89
- return [3 /*break*/, 11];
90
- case 10:
91
- error_1 = _d.sent();
92
- relativePath = path.relative(process.cwd(), resolved);
93
- throw new Error("Failed to load module: ".concat(relativePath, "\n\n") +
94
- "Error: ".concat(error_1.message, "\n\n") +
95
- (error_1.code === 'ERR_MODULE_NOT_FOUND'
96
- ? "This usually means:\n" +
97
- " \u2022 A dependency is missing (run 'npm install')\n" +
98
- " \u2022 An import path is incorrect\n"
99
- : "") +
100
- (error_1.stack ? "\nStack trace:\n".concat(error_1.stack, "\n") : ''));
101
- case 11:
102
- api = (_c = mod.api) !== null && _c !== void 0 ? _c : mod.default;
103
- if (!api || typeof api.handler !== 'function') {
104
- relativePath = path.relative(process.cwd(), resolved);
105
- availableExports = Object.keys(mod).filter(function (key) { return key !== '__esModule'; });
106
- throw new Error("Invalid API module: ".concat(relativePath, "\n\n") +
107
- "The module must export a 'defineServe' result as 'api'.\n\n" +
108
- (availableExports.length > 0
109
- ? "Found exports: ".concat(availableExports.join(', '), "\n\n")
110
- : "No exports found in the module.\n\n") +
111
- "Expected format:\n\n" +
112
- " import { initServe } from '@hypequery/serve';\n" +
113
- " \n" +
114
- " const { define, queries, query } = initServe({\n" +
115
- " context: () => ({ db }),\n" +
116
- " });\n" +
117
- " \n" +
118
- " export const api = define({\n" +
119
- " queries: queries({\n" +
120
- " myQuery: query.query(async ({ ctx }) => {\n" +
121
- " // ...\n" +
122
- " }),\n" +
123
- " }),\n" +
124
- " });\n");
125
- }
126
- return [2 /*return*/, api];
127
- }
128
- });
129
- });
130
- }
131
- var globalState = globalThis;
132
- var tempDirPromise = (_a = globalState.__hypequeryCliTempDirPromise) !== null && _a !== void 0 ? _a : null;
133
- var tempFiles = (_b = globalState.__hypequeryCliTempFiles) !== null && _b !== void 0 ? _b : new Set();
134
- var cleanupHooksInstalled = (_c = globalState.__hypequeryCliCleanupInstalled) !== null && _c !== void 0 ? _c : false;
135
- if (!globalState.__hypequeryCliTempFiles) {
136
- globalState.__hypequeryCliTempFiles = tempFiles;
137
- }
138
- function ensureTempDir() {
139
- var _this = this;
140
- installCleanupHooks();
141
- if (!tempDirPromise) {
142
- tempDirPromise = (function () { return __awaiter(_this, void 0, void 0, function () {
143
- var projectTempRoot, _a;
144
- return __generator(this, function (_b) {
145
- switch (_b.label) {
146
- case 0:
147
- projectTempRoot = path.join(process.cwd(), '.hypequery', 'tmp');
148
- _b.label = 1;
149
- case 1:
150
- _b.trys.push([1, 3, , 4]);
151
- return [4 /*yield*/, mkdir(projectTempRoot, { recursive: true })];
152
- case 2:
153
- _b.sent();
154
- return [2 /*return*/, mkdtemp(path.join(projectTempRoot, 'bundle-'))];
155
- case 3:
156
- _a = _b.sent();
157
- return [2 /*return*/, mkdtemp(path.join(os.tmpdir(), 'hypequery-cli-'))];
158
- case 4: return [2 /*return*/];
159
- }
160
- });
161
- }); })();
162
- globalState.__hypequeryCliTempDirPromise = tempDirPromise;
163
- }
164
- return tempDirPromise;
165
- }
166
- function cleanupTempFiles() {
167
- return __awaiter(this, void 0, void 0, function () {
168
- var _this = this;
169
- return __generator(this, function (_a) {
170
- switch (_a.label) {
171
- case 0:
172
- if (tempFiles.size === 0)
173
- return [2 /*return*/];
174
- return [4 /*yield*/, Promise.all(Array.from(tempFiles).map(function (file) { return __awaiter(_this, void 0, void 0, function () {
175
- var _a;
176
- return __generator(this, function (_b) {
177
- switch (_b.label) {
178
- case 0:
179
- _b.trys.push([0, 2, , 3]);
180
- return [4 /*yield*/, rm(file, { force: true })];
181
- case 1:
182
- _b.sent();
183
- return [3 /*break*/, 3];
184
- case 2:
185
- _a = _b.sent();
186
- return [3 /*break*/, 3];
187
- case 3: return [2 /*return*/];
188
- }
189
- });
190
- }); }))];
191
- case 1:
192
- _a.sent();
193
- tempFiles.clear();
194
- return [2 /*return*/];
195
- }
196
- });
197
- });
198
- }
199
- function installCleanupHooks() {
200
- if (cleanupHooksInstalled)
201
- return;
202
- cleanupHooksInstalled = true;
203
- globalState.__hypequeryCliCleanupInstalled = true;
204
- process.once('exit', function () {
205
- cleanupTempFiles().catch(function () { return undefined; });
206
- });
207
- ['SIGINT', 'SIGTERM'].forEach(function (signal) {
208
- process.once(signal, function () {
209
- cleanupTempFiles().catch(function () { return undefined; });
210
- process.exit();
211
- });
212
- });
213
- }
214
- function bundleTypeScriptModule(entryPath) {
215
- return __awaiter(this, void 0, void 0, function () {
216
- var relativePath, tsconfigPath, result, output, contents, tempDir, tempFile, error_2;
217
- var _a, _b, _c, _d;
218
- return __generator(this, function (_e) {
219
- switch (_e.label) {
220
- case 0:
221
- relativePath = path.relative(process.cwd(), entryPath);
222
- return [4 /*yield*/, findNearestTsconfig(entryPath)];
223
- case 1:
224
- tsconfigPath = _e.sent();
225
- _e.label = 2;
226
- case 2:
227
- _e.trys.push([2, 6, , 7]);
228
- return [4 /*yield*/, build({
229
- entryPoints: [entryPath],
230
- bundle: true,
231
- format: 'esm',
232
- platform: 'node',
233
- target: ['node18'],
234
- sourcemap: 'inline',
235
- write: false,
236
- logLevel: 'silent',
237
- absWorkingDir: process.cwd(),
238
- packages: 'external',
239
- tsconfig: tsconfigPath !== null && tsconfigPath !== void 0 ? tsconfigPath : undefined,
240
- loader: {
241
- '.ts': 'ts',
242
- '.tsx': 'tsx',
243
- '.mts': 'ts',
244
- '.cts': 'ts',
245
- },
246
- })];
247
- case 3:
248
- result = _e.sent();
249
- output = (_b = (_a = result.outputFiles) === null || _a === void 0 ? void 0 : _a.find(function (file) { return file.path.endsWith('.js'); })) !== null && _b !== void 0 ? _b : (_c = result.outputFiles) === null || _c === void 0 ? void 0 : _c[0];
250
- if (!output) {
251
- throw new Error('esbuild produced no output');
252
- }
253
- contents = "".concat(output.text, "\n//# sourceURL=").concat(pathToFileURL(entryPath).href);
254
- return [4 /*yield*/, ensureTempDir()];
255
- case 4:
256
- tempDir = _e.sent();
257
- tempFile = path.join(tempDir, "".concat(path.basename(entryPath).replace(/[^a-zA-Z0-9_-]/g, '_'), "-").concat(Date.now(), "-").concat(Math.random().toString(36).slice(2), ".mjs"));
258
- return [4 /*yield*/, writeFile(tempFile, contents, 'utf8')];
259
- case 5:
260
- _e.sent();
261
- tempFiles.add(tempFile);
262
- return [2 /*return*/, "".concat(pathToFileURL(tempFile).href, "?t=").concat(Date.now())];
263
- case 6:
264
- error_2 = _e.sent();
265
- throw new Error("Failed to compile ".concat(relativePath, " with esbuild.\n") +
266
- "Original error: ".concat((_d = error_2 === null || error_2 === void 0 ? void 0 : error_2.message) !== null && _d !== void 0 ? _d : error_2));
267
- case 7: return [2 /*return*/];
268
- }
269
- });
270
- });
271
- }
272
- function findNearestTsconfig(filePath) {
273
- return __awaiter(this, void 0, void 0, function () {
274
- var dir, visited, _loop_1, state_1;
275
- var _a;
276
- return __generator(this, function (_b) {
277
- switch (_b.label) {
278
- case 0:
279
- dir = path.dirname(filePath);
280
- visited = [];
281
- _loop_1 = function () {
282
- var cached_1, candidate, _c, parent_1;
283
- return __generator(this, function (_d) {
284
- switch (_d.label) {
285
- case 0:
286
- if (tsconfigCache.has(dir)) {
287
- cached_1 = (_a = tsconfigCache.get(dir)) !== null && _a !== void 0 ? _a : null;
288
- visited.forEach(function (pathname) { return tsconfigCache.set(pathname, cached_1); });
289
- return [2 /*return*/, { value: cached_1 }];
290
- }
291
- visited.push(dir);
292
- candidate = path.join(dir, 'tsconfig.json');
293
- _d.label = 1;
294
- case 1:
295
- _d.trys.push([1, 3, , 4]);
296
- return [4 /*yield*/, access(candidate)];
297
- case 2:
298
- _d.sent();
299
- tsconfigCache.set(dir, candidate);
300
- visited.forEach(function (pathname) { return tsconfigCache.set(pathname, candidate); });
301
- return [2 /*return*/, { value: candidate }];
302
- case 3:
303
- _c = _d.sent();
304
- parent_1 = path.dirname(dir);
305
- if (parent_1 === dir) {
306
- visited.forEach(function (pathname) { return tsconfigCache.set(pathname, null); });
307
- return [2 /*return*/, { value: null }];
308
- }
309
- dir = parent_1;
310
- return [3 /*break*/, 4];
311
- case 4: return [2 /*return*/];
312
- }
313
- });
314
- };
315
- _b.label = 1;
316
- case 1:
317
- if (!true) return [3 /*break*/, 3];
318
- return [5 /*yield**/, _loop_1()];
319
- case 2:
320
- state_1 = _b.sent();
321
- if (typeof state_1 === "object")
322
- return [2 /*return*/, state_1.value];
323
- return [3 /*break*/, 1];
324
- case 3: return [2 /*return*/];
325
- }
326
- });
327
- });
328
- }
@@ -1,54 +0,0 @@
1
- /**
2
- * Calm, professional CLI logger
3
- * Follows Vercel-style output: informative, actionable, no noise
4
- */
5
- export declare class Logger {
6
- private quiet;
7
- constructor(quiet?: boolean);
8
- /**
9
- * Success message with checkmark
10
- */
11
- success(message: string): void;
12
- /**
13
- * Error message with X mark
14
- */
15
- error(message: string): void;
16
- /**
17
- * Warning message with warning symbol
18
- */
19
- warn(message: string): void;
20
- /**
21
- * Info message (no symbol)
22
- */
23
- info(message: string): void;
24
- /**
25
- * Reload/change message
26
- */
27
- reload(message: string): void;
28
- /**
29
- * Section header
30
- */
31
- header(message: string): void;
32
- /**
33
- * Empty line
34
- */
35
- newline(): void;
36
- /**
37
- * Indented message (for sub-items)
38
- */
39
- indent(message: string): void;
40
- /**
41
- * Boxed URL output
42
- */
43
- box(lines: string[]): void;
44
- /**
45
- * Table output (for dev server stats)
46
- */
47
- table(headers: string[], rows: string[][]): void;
48
- /**
49
- * Raw console.log (bypass quiet mode)
50
- */
51
- raw(message: string): void;
52
- }
53
- export declare const logger: Logger;
54
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAU;gBAEX,KAAK,UAAQ;IAIzB;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM;IAMvB;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM;IAIrB;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM;IAMpB;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM;IAMpB;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM;IAMtB;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM;IAMtB;;OAEG;IACH,OAAO;IAMP;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM;IAMtB;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE;IAcnB;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAyBzC;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM;CAGpB;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
@@ -1,122 +0,0 @@
1
- import chalk from 'chalk';
2
- /**
3
- * Calm, professional CLI logger
4
- * Follows Vercel-style output: informative, actionable, no noise
5
- */
6
- var Logger = /** @class */ (function () {
7
- function Logger(quiet) {
8
- if (quiet === void 0) { quiet = false; }
9
- this.quiet = quiet;
10
- }
11
- /**
12
- * Success message with checkmark
13
- */
14
- Logger.prototype.success = function (message) {
15
- if (!this.quiet) {
16
- console.log(chalk.green('✓') + ' ' + message);
17
- }
18
- };
19
- /**
20
- * Error message with X mark
21
- */
22
- Logger.prototype.error = function (message) {
23
- console.error(chalk.red('✗') + ' ' + message);
24
- };
25
- /**
26
- * Warning message with warning symbol
27
- */
28
- Logger.prototype.warn = function (message) {
29
- if (!this.quiet) {
30
- console.warn(chalk.yellow('⚠') + ' ' + message);
31
- }
32
- };
33
- /**
34
- * Info message (no symbol)
35
- */
36
- Logger.prototype.info = function (message) {
37
- if (!this.quiet) {
38
- console.log(' ' + message);
39
- }
40
- };
41
- /**
42
- * Reload/change message
43
- */
44
- Logger.prototype.reload = function (message) {
45
- if (!this.quiet) {
46
- console.log(chalk.blue('↻') + ' ' + message);
47
- }
48
- };
49
- /**
50
- * Section header
51
- */
52
- Logger.prototype.header = function (message) {
53
- if (!this.quiet) {
54
- console.log('\n' + chalk.bold(message) + '\n');
55
- }
56
- };
57
- /**
58
- * Empty line
59
- */
60
- Logger.prototype.newline = function () {
61
- if (!this.quiet) {
62
- console.log();
63
- }
64
- };
65
- /**
66
- * Indented message (for sub-items)
67
- */
68
- Logger.prototype.indent = function (message) {
69
- if (!this.quiet) {
70
- console.log(' ' + message);
71
- }
72
- };
73
- /**
74
- * Boxed URL output
75
- */
76
- Logger.prototype.box = function (lines) {
77
- if (!this.quiet) {
78
- var maxLength = Math.max.apply(Math, lines.map(function (l) { return l.length; }));
79
- var border = '─'.repeat(maxLength + 4);
80
- console.log(' ┌' + border + '┐');
81
- for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
82
- var line = lines_1[_i];
83
- var padding = ' '.repeat(maxLength - line.length);
84
- console.log(' │ ' + line + padding + ' │');
85
- }
86
- console.log(' └' + border + '┘');
87
- }
88
- };
89
- /**
90
- * Table output (for dev server stats)
91
- */
92
- Logger.prototype.table = function (headers, rows) {
93
- if (!this.quiet) {
94
- var columnWidths_1 = headers.map(function (header, i) {
95
- var maxContentWidth = Math.max.apply(Math, rows.map(function (row) { return (row[i] || '').length; }));
96
- return Math.max(header.length, maxContentWidth);
97
- });
98
- // Header
99
- var headerRow = headers
100
- .map(function (h, i) { return h.padEnd(columnWidths_1[i]); })
101
- .join(' ');
102
- console.log(' ' + chalk.bold(headerRow));
103
- // Rows
104
- for (var _i = 0, rows_1 = rows; _i < rows_1.length; _i++) {
105
- var row = rows_1[_i];
106
- var formattedRow = row
107
- .map(function (cell, i) { return cell.padEnd(columnWidths_1[i]); })
108
- .join(' ');
109
- console.log(' ' + formattedRow);
110
- }
111
- }
112
- };
113
- /**
114
- * Raw console.log (bypass quiet mode)
115
- */
116
- Logger.prototype.raw = function (message) {
117
- console.log(message);
118
- };
119
- return Logger;
120
- }());
121
- export { Logger };
122
- export var logger = new Logger();
@@ -1,39 +0,0 @@
1
- import type { DatabaseType } from './detect-database.js';
2
- /**
3
- * Prompt for database type selection
4
- */
5
- export declare function promptDatabaseType(): Promise<DatabaseType | null>;
6
- /**
7
- * Prompt for ClickHouse connection details
8
- */
9
- export declare function promptClickHouseConnection(): Promise<{
10
- host: string;
11
- database: string;
12
- username: string;
13
- password: string;
14
- } | null>;
15
- /**
16
- * Prompt for output directory
17
- */
18
- export declare function promptOutputDirectory(): Promise<string>;
19
- /**
20
- * Prompt for example query generation
21
- */
22
- export declare function promptGenerateExample(): Promise<boolean>;
23
- /**
24
- * Prompt for table selection (for example query)
25
- */
26
- export declare function promptTableSelection(tables: string[]): Promise<string | null>;
27
- /**
28
- * Confirm overwrite of existing files
29
- */
30
- export declare function confirmOverwrite(files: string[]): Promise<boolean>;
31
- /**
32
- * Retry prompt for failed operations
33
- */
34
- export declare function promptRetry(message: string): Promise<boolean>;
35
- /**
36
- * Ask if user wants to continue without DB connection
37
- */
38
- export declare function promptContinueWithoutDb(): Promise<boolean>;
39
- //# sourceMappingURL=prompts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/utils/prompts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMzD;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAavE;AAED;;GAEG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAAC,CAkCR;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CA6B7D;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAS9D;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0BnF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CASxE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASnE;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAShE"}