@hypequery/cli 1.1.2 → 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.
- package/README.md +26 -2
- package/dist/bin/cli.js +21 -81
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +72 -116
- package/dist/commands/dev.d.ts +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +180 -255
- package/dist/commands/generate-datasets.d.ts +14 -0
- package/dist/commands/generate-datasets.d.ts.map +1 -0
- package/dist/commands/generate-datasets.js +96 -0
- package/dist/commands/generate.d.ts +2 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +112 -167
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +337 -370
- package/dist/generators/clickhouse.d.ts +1 -1
- package/dist/generators/clickhouse.d.ts.map +1 -1
- package/dist/generators/clickhouse.js +10 -269
- package/dist/generators/dataset-generator.d.ts +16 -0
- package/dist/generators/dataset-generator.d.ts.map +1 -0
- package/dist/generators/dataset-generator.js +246 -0
- package/dist/generators/index.js +3 -3
- package/dist/templates/api.d.ts +9 -0
- package/dist/templates/api.d.ts.map +1 -0
- package/dist/templates/api.js +26 -0
- package/dist/templates/auth-scaffold.d.ts +17 -0
- package/dist/templates/auth-scaffold.d.ts.map +1 -0
- package/dist/templates/auth-scaffold.js +41 -0
- package/dist/templates/client.js +10 -1
- package/dist/templates/datasets.d.ts +5 -0
- package/dist/templates/datasets.d.ts.map +1 -0
- package/dist/templates/datasets.js +23 -0
- package/dist/templates/env.js +19 -8
- package/dist/templates/gitignore.js +4 -1
- package/dist/templates/queries.d.ts +3 -0
- package/dist/templates/queries.d.ts.map +1 -1
- package/dist/templates/queries.js +66 -10
- package/dist/test-utils.d.ts +0 -71
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/test-utils.js +12 -137
- package/dist/utils/clickhouse-client.js +10 -57
- package/dist/utils/clickhouse-sql.d.ts +6 -0
- package/dist/utils/clickhouse-sql.d.ts.map +1 -0
- package/dist/utils/clickhouse-sql.js +18 -0
- package/dist/utils/clickhouse-type-utils.d.ts +6 -0
- package/dist/utils/clickhouse-type-utils.d.ts.map +1 -0
- package/dist/utils/clickhouse-type-utils.js +59 -0
- package/dist/utils/dependency-installer.d.ts +4 -2
- package/dist/utils/dependency-installer.d.ts.map +1 -1
- package/dist/utils/dependency-installer.js +93 -170
- package/dist/utils/detect-database.js +84 -195
- package/dist/utils/find-files.d.ts +3 -1
- package/dist/utils/find-files.d.ts.map +1 -1
- package/dist/utils/find-files.js +82 -148
- package/dist/utils/load-api.d.ts.map +1 -1
- package/dist/utils/load-api.js +207 -396
- package/dist/utils/logger.js +38 -42
- package/dist/utils/prompts.d.ts +14 -0
- package/dist/utils/prompts.d.ts.map +1 -1
- package/dist/utils/prompts.js +170 -219
- package/dist/utils/runtime-guards.d.ts +4 -0
- package/dist/utils/runtime-guards.d.ts.map +1 -0
- package/dist/utils/runtime-guards.js +9 -0
- package/dist/utils/sha256.d.ts +2 -0
- package/dist/utils/sha256.d.ts.map +1 -0
- package/dist/utils/sha256.js +4 -0
- package/package.json +3 -8
- package/dist/utils/error-messages.d.ts +0 -6
- package/dist/utils/error-messages.d.ts.map +0 -1
- package/dist/utils/error-messages.js +0 -19
- package/dist/utils/load-hypequery-config.d.ts +0 -7
- package/dist/utils/load-hypequery-config.d.ts.map +0 -1
- package/dist/utils/load-hypequery-config.js +0 -89
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/cli",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Command-line interface for hypequery",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,15 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@hypequery/clickhouse": "*",
|
|
25
|
-
"@hypequery/schema": "*",
|
|
26
25
|
"@hypequery/serve": "*"
|
|
27
26
|
},
|
|
28
27
|
"peerDependenciesMeta": {
|
|
29
28
|
"@hypequery/clickhouse": {
|
|
30
29
|
"optional": true
|
|
31
|
-
},
|
|
32
|
-
"@hypequery/schema": {
|
|
33
|
-
"optional": true
|
|
34
30
|
}
|
|
35
31
|
},
|
|
36
32
|
"devDependencies": {
|
|
@@ -39,9 +35,8 @@
|
|
|
39
35
|
"@vitest/coverage-v8": "^2.1.6",
|
|
40
36
|
"typescript": "^5.7.3",
|
|
41
37
|
"vitest": "^2.1.6",
|
|
42
|
-
"@hypequery/
|
|
43
|
-
"@hypequery/serve": "0.
|
|
44
|
-
"@hypequery/clickhouse": "2.0.0"
|
|
38
|
+
"@hypequery/clickhouse": "2.1.2",
|
|
39
|
+
"@hypequery/serve": "0.5.0"
|
|
45
40
|
},
|
|
46
41
|
"repository": {
|
|
47
42
|
"type": "git",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-messages.d.ts","sourceRoot":"","sources":["../../src/utils/error-messages.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAazE"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { logger } from './logger.js';
|
|
2
|
-
/**
|
|
3
|
-
* Display error when queries file cannot be found
|
|
4
|
-
* @param commandName - Name of the command for the usage example
|
|
5
|
-
*/
|
|
6
|
-
export function displayQueriesFileNotFoundError(commandName) {
|
|
7
|
-
logger.error('Could not find queries file');
|
|
8
|
-
logger.newline();
|
|
9
|
-
logger.info('Expected one of:');
|
|
10
|
-
logger.indent('• analytics/queries.ts');
|
|
11
|
-
logger.indent('• src/analytics/queries.ts');
|
|
12
|
-
logger.indent('• hypequery.ts');
|
|
13
|
-
logger.newline();
|
|
14
|
-
logger.info("Did you run 'hypequery init'?");
|
|
15
|
-
logger.newline();
|
|
16
|
-
logger.info('Or specify the file explicitly:');
|
|
17
|
-
logger.indent("hypequery ".concat(commandName, " ./path/to/queries.ts"));
|
|
18
|
-
logger.newline();
|
|
19
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ResolvedHypequeryClickHouseConfig } from '@hypequery/schema';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,mBAAmB,CAAC;AAG3B,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"}
|
|
@@ -1,89 +0,0 @@
|
|
|
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
|
-
}
|