@hypequery/clickhouse 1.2.7 → 1.2.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.
- package/dist/cli/bin.js +65 -23
- package/package.json +3 -2
package/dist/cli/bin.js
CHANGED
|
@@ -50,6 +50,8 @@ ${colors.bright}Options:${colors.reset}
|
|
|
50
50
|
--secure Use HTTPS/TLS for connection
|
|
51
51
|
--help, -h Show this help text
|
|
52
52
|
|
|
53
|
+
${colors.dim}Note: All options support both formats: --option=value or --option value${colors.reset}
|
|
54
|
+
|
|
53
55
|
${colors.bright}Environment variables:${colors.reset}
|
|
54
56
|
CLICKHOUSE_HOST ClickHouse server URL
|
|
55
57
|
VITE_CLICKHOUSE_HOST Alternative variable for Vite projects
|
|
@@ -70,9 +72,11 @@ ${colors.bright}Environment variables:${colors.reset}
|
|
|
70
72
|
${colors.bright}Examples:${colors.reset}
|
|
71
73
|
npx hypequery-generate-types
|
|
72
74
|
npx hypequery-generate-types --output=./src/types/db-schema.ts
|
|
75
|
+
npx hypequery-generate-types --output ./src/types/db-schema.ts
|
|
73
76
|
npx hypequery-generate-types --host=https://your-instance.clickhouse.cloud:8443 --secure
|
|
74
|
-
npx hypequery-generate-types --host
|
|
77
|
+
npx hypequery-generate-types --host http://localhost:8123 --username default --password password --database my_db
|
|
75
78
|
npx hypequery-generate-types --include-tables=users,orders,products
|
|
79
|
+
npx hypequery-generate-types --include-tables users,orders,products
|
|
76
80
|
`);
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -87,28 +91,66 @@ function parseArguments(args) {
|
|
|
87
91
|
secure: false
|
|
88
92
|
};
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
// Helper function to extract value from --param=value format
|
|
95
|
+
function getParamValue(arg, paramName) {
|
|
96
|
+
if (arg.startsWith(`${paramName}=`)) {
|
|
97
|
+
return arg.substring(paramName.length + 1); // +1 for the '=' character
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Helper function to get next argument as value
|
|
103
|
+
function getNextArgValue(args, index) {
|
|
104
|
+
return args[index + 1];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Parameter handlers map
|
|
108
|
+
const paramHandlers = {
|
|
109
|
+
'--output': (value) => config.output = value,
|
|
110
|
+
'--host': (value) => config.host = value,
|
|
111
|
+
'--username': (value) => config.username = value,
|
|
112
|
+
'--password': (value) => config.password = value,
|
|
113
|
+
'--database': (value) => config.database = value,
|
|
114
|
+
'--include-tables': (value) => config.includeTables = value.split(','),
|
|
115
|
+
'--exclude-tables': (value) => config.excludeTables = value.split(',')
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
for (let i = 0; i < args.length; i++) {
|
|
119
|
+
const arg = args[i];
|
|
120
|
+
let handled = false;
|
|
121
|
+
|
|
122
|
+
// Handle parameters with values
|
|
123
|
+
for (const [paramName, handler] of Object.entries(paramHandlers)) {
|
|
124
|
+
// Check for --param=value format
|
|
125
|
+
const value = getParamValue(arg, paramName);
|
|
126
|
+
if (value !== null) {
|
|
127
|
+
handler(value);
|
|
128
|
+
handled = true;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Check for --param value format
|
|
133
|
+
if (arg === paramName) {
|
|
134
|
+
const nextValue = getNextArgValue(args, i);
|
|
135
|
+
if (nextValue && !nextValue.startsWith('-')) {
|
|
136
|
+
handler(nextValue);
|
|
137
|
+
i++; // Skip the next argument since we consumed it
|
|
138
|
+
handled = true;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Handle boolean flags
|
|
145
|
+
if (!handled) {
|
|
146
|
+
if (arg === '--secure') {
|
|
147
|
+
config.secure = true;
|
|
148
|
+
} else if (arg === '--help' || arg === '-h') {
|
|
149
|
+
config.showHelp = true;
|
|
150
|
+
} else if (!arg.startsWith('-') && !config.output) {
|
|
151
|
+
// For backwards compatibility, treat the first non-flag argument as the output path
|
|
152
|
+
config.output = arg;
|
|
153
|
+
}
|
|
112
154
|
}
|
|
113
155
|
}
|
|
114
156
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/clickhouse",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "ClickHouse typescript query builder",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"license": "Apache-2.0",
|