@hypequery/cli 1.10.1 → 1.10.2
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.d.ts.map +1 -1
- package/dist/cli.js +0 -2
- package/dist/commands/dev.d.ts +0 -11
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +6 -61
- package/package.json +2 -5
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAa9B,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAKpE;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAa9B,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAKpE;AAgLD,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -78,8 +78,6 @@ program
|
|
|
78
78
|
.option('--cache <provider>', 'Cache provider (memory|redis)')
|
|
79
79
|
.option('--redis-url <url>', 'Redis connection URL')
|
|
80
80
|
.option('--open', 'Open browser automatically')
|
|
81
|
-
.option('--ui-experimental', 'Serve the experimental query UI at /__dev (unstable, not for production use)')
|
|
82
|
-
.option('--no-telemetry', 'Disable anonymous playground usage telemetry')
|
|
83
81
|
.option('--cors', 'Enable CORS')
|
|
84
82
|
.option('--path <path>', 'Analytics directory (loads <path>/api.ts or <path>/queries.ts)')
|
|
85
83
|
.option('-q, --quiet', 'Suppress startup messages')
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -8,17 +8,6 @@ export interface DevOptions {
|
|
|
8
8
|
open?: boolean;
|
|
9
9
|
cors?: boolean;
|
|
10
10
|
path?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Opt into the experimental query UI/gateway at /__dev. Off by default —
|
|
13
|
-
* the UI is not release-ready; behaviour and flag may change or go away.
|
|
14
|
-
*/
|
|
15
|
-
uiExperimental?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Anonymous playground usage telemetry. Commander sets this to `false` when
|
|
18
|
-
* `--no-telemetry` is passed; otherwise it is undefined (telemetry follows
|
|
19
|
-
* its usual endpoint/env gating).
|
|
20
|
-
*/
|
|
21
|
-
telemetry?: boolean;
|
|
22
11
|
}
|
|
23
12
|
export declare function devCommand(file?: string, options?: DevOptions): Promise<void>;
|
|
24
13
|
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,iBAiOvE"}
|
package/dist/commands/dev.js
CHANGED
|
@@ -26,30 +26,6 @@ function displayQueriesFileNotFoundError(commandName) {
|
|
|
26
26
|
logger.indent(`hypequery ${commandName} ./path/to/api.ts`);
|
|
27
27
|
logger.newline();
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Attempt to create the local gateway from @hypequery/gateway. The package is an
|
|
31
|
-
* optional dependency, so it may be absent; in that case we return null (with a
|
|
32
|
-
* hint) and `hypequery dev` still runs as a plain server.
|
|
33
|
-
*/
|
|
34
|
-
async function createGatewayIfAvailable(api, telemetryDisabled) {
|
|
35
|
-
try {
|
|
36
|
-
const { createGateway } = await import('@hypequery/gateway');
|
|
37
|
-
return (await createGateway(api, {
|
|
38
|
-
projectName: path.basename(process.cwd()),
|
|
39
|
-
devToken: process.env.HYPEQUERY_DEV_TOKEN,
|
|
40
|
-
telemetryDisabled,
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
-
if (message.includes('Cannot find') || message.includes('ERR_MODULE_NOT_FOUND')) {
|
|
46
|
-
logger.warn('Playground UI not installed. Install @hypequery/gateway to enable it.');
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
logger.warn(`Playground failed to start: ${message}`);
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
29
|
export async function devCommand(file, options = {}) {
|
|
54
30
|
// Step 1: Find queries file
|
|
55
31
|
const queriesFile = file
|
|
@@ -64,7 +40,6 @@ export async function devCommand(file, options = {}) {
|
|
|
64
40
|
logger.info(`Found: ${path.relative(process.cwd(), queriesFile)}`);
|
|
65
41
|
logger.newline();
|
|
66
42
|
let currentServer = null;
|
|
67
|
-
let currentGateway = null;
|
|
68
43
|
let lifecycleOperation = Promise.resolve();
|
|
69
44
|
let shutdownRequested = false;
|
|
70
45
|
const shouldWatch = options.watch !== false; // Default to true
|
|
@@ -74,31 +49,12 @@ export async function devCommand(file, options = {}) {
|
|
|
74
49
|
return queued;
|
|
75
50
|
};
|
|
76
51
|
const stopCurrentRuntime = async () => {
|
|
77
|
-
const gateway = currentGateway;
|
|
78
52
|
const server = currentServer;
|
|
79
|
-
// Clear
|
|
80
|
-
// cannot stop the same
|
|
81
|
-
currentGateway = null;
|
|
53
|
+
// Clear the reference before awaiting teardown so a second signal or
|
|
54
|
+
// restart cannot stop the same server twice.
|
|
82
55
|
currentServer = null;
|
|
83
|
-
let teardownError;
|
|
84
|
-
if (gateway) {
|
|
85
|
-
try {
|
|
86
|
-
await gateway.shutdown();
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
teardownError = error;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
56
|
if (server) {
|
|
93
|
-
|
|
94
|
-
await server.stop();
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
teardownError ??= error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (teardownError) {
|
|
101
|
-
throw teardownError;
|
|
57
|
+
await server.stop();
|
|
102
58
|
}
|
|
103
59
|
};
|
|
104
60
|
const startServer = async () => {
|
|
@@ -127,19 +83,12 @@ export async function devCommand(file, options = {}) {
|
|
|
127
83
|
logger.header('hypequery dev');
|
|
128
84
|
logger.success(`Registered ${queryCount} ${queryCount === 1 ? 'query' : 'queries'}`);
|
|
129
85
|
logger.newline();
|
|
130
|
-
// The query UI is experimental and strictly opt-in; the default dev
|
|
131
|
-
// server is unchanged.
|
|
132
|
-
const gateway = options.uiExperimental
|
|
133
|
-
? await createGatewayIfAvailable(api, options.telemetry === false)
|
|
134
|
-
: null;
|
|
135
|
-
currentGateway = gateway;
|
|
136
86
|
// Start the server
|
|
137
87
|
const { serveDev } = await import('@hypequery/serve/dev');
|
|
138
88
|
currentServer = await serveDev(api, {
|
|
139
89
|
port: options.port,
|
|
140
90
|
hostname: options.hostname,
|
|
141
91
|
quiet: true,
|
|
142
|
-
mount: gateway?.mount,
|
|
143
92
|
});
|
|
144
93
|
const address = currentServer.server.address();
|
|
145
94
|
const port = typeof address === 'object' && address ? address.port : options.port || 4000;
|
|
@@ -151,9 +100,6 @@ export async function devCommand(file, options = {}) {
|
|
|
151
100
|
`Docs: ${baseUrl}${api.basePath ?? ''}${docsPath}`,
|
|
152
101
|
`OpenAPI: ${baseUrl}${api.basePath ?? ''}${openapiPath}`,
|
|
153
102
|
];
|
|
154
|
-
if (gateway?.uiAvailable) {
|
|
155
|
-
boxLines.unshift(`Playground: ${baseUrl}/__dev`);
|
|
156
|
-
}
|
|
157
103
|
logger.box(boxLines);
|
|
158
104
|
logger.newline();
|
|
159
105
|
logger.success(`Ready in ${process.uptime().toFixed(0)}ms`);
|
|
@@ -181,9 +127,8 @@ export async function devCommand(file, options = {}) {
|
|
|
181
127
|
}
|
|
182
128
|
}
|
|
183
129
|
catch (error) {
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
// resources acquired by this attempt before retrying or exiting.
|
|
130
|
+
// If server startup or later setup fails, tear down any resources
|
|
131
|
+
// acquired by this attempt before retrying or exiting.
|
|
187
132
|
try {
|
|
188
133
|
await stopCurrentRuntime();
|
|
189
134
|
}
|
|
@@ -220,7 +165,7 @@ export async function devCommand(file, options = {}) {
|
|
|
220
165
|
const restartServer = () => queueLifecycleOperation(async () => {
|
|
221
166
|
if (shutdownRequested)
|
|
222
167
|
return;
|
|
223
|
-
if (currentServer
|
|
168
|
+
if (currentServer) {
|
|
224
169
|
logger.newline();
|
|
225
170
|
logger.reload('File changed, restarting...');
|
|
226
171
|
logger.newline();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/cli",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Command-line interface for hypequery",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,9 +22,6 @@
|
|
|
22
22
|
"@hypequery/deployment": "0.5.1",
|
|
23
23
|
"@hypequery/protocol": "0.9.0"
|
|
24
24
|
},
|
|
25
|
-
"optionalDependencies": {
|
|
26
|
-
"@hypequery/gateway": "0.2.0"
|
|
27
|
-
},
|
|
28
25
|
"peerDependencies": {
|
|
29
26
|
"@hypequery/clickhouse": "*",
|
|
30
27
|
"@hypequery/serve": "*"
|
|
@@ -40,7 +37,7 @@
|
|
|
40
37
|
"@vitest/coverage-v8": "^3.2.6",
|
|
41
38
|
"typescript": "^5.7.3",
|
|
42
39
|
"vitest": "^3.2.6",
|
|
43
|
-
"@hypequery/clickhouse": "2.5.
|
|
40
|
+
"@hypequery/clickhouse": "2.5.2",
|
|
44
41
|
"@hypequery/serve": "0.14.0"
|
|
45
42
|
},
|
|
46
43
|
"repository": {
|