@hypequery/cli 1.2.1 → 1.3.0

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 CHANGED
@@ -108,6 +108,17 @@ Options:
108
108
  - `--tables <names>`: comma-separated table list
109
109
  - `--exclude-tables <names>`: comma-separated tables to exclude
110
110
 
111
+ ### `hypequery generate:manifest`
112
+
113
+ Generates a static React hook route manifest from an exported HypeQuery API.
114
+
115
+ ```bash
116
+ npx hypequery generate:manifest analytics/api.ts --output analytics/hypequery-manifest.json
117
+ ```
118
+
119
+ The output is the exact serializable JSON returned by `api.manifest()`, including
120
+ semantic keys such as `dataset:orders`.
121
+
111
122
  ## Non-interactive Setup
112
123
 
113
124
  `hypequery init --no-interactive` reads:
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;AAMpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAa9B,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAKpE;AAuHD,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAa9B,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;EAKpE;AAgID,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/cli.js CHANGED
@@ -5,6 +5,7 @@ import { initCommand } from './commands/init.js';
5
5
  import { devCommand } from './commands/dev.js';
6
6
  import { generateCommand } from './commands/generate.js';
7
7
  import { generateDatasetsCommand } from './commands/generate-datasets.js';
8
+ import { generateManifestCommand } from './commands/generate-manifest.js';
8
9
  const program = new Command();
9
10
  function getCliVersion() {
10
11
  try {
@@ -97,6 +98,13 @@ program
97
98
  .action(runCommand(async (options) => {
98
99
  await generateDatasetsCommand(options);
99
100
  }));
101
+ program
102
+ .command('generate:manifest <api>')
103
+ .description('Generate a static React hook manifest from a hypequery API module')
104
+ .option('-o, --output <path>', 'Output JSON file (default: analytics/hypequery-manifest.json)')
105
+ .action(runCommand(async (api, options) => {
106
+ await generateManifestCommand(api, options);
107
+ }));
100
108
  // Help command
101
109
  program
102
110
  .command('help [command]')
@@ -126,6 +134,7 @@ program.on('--help', () => {
126
134
  console.log(' hypequery generate --output analytics/schema.ts');
127
135
  console.log(' hypequery generate:types --output analytics/schema.ts');
128
136
  console.log(' hypequery generate:datasets');
137
+ console.log(' hypequery generate:manifest analytics/api.ts --output analytics/hypequery-manifest.json');
129
138
  console.log('');
130
139
  console.log('Docs: https://hypequery.com/docs');
131
140
  });
@@ -0,0 +1,5 @@
1
+ export interface GenerateManifestOptions {
2
+ output?: string;
3
+ }
4
+ export declare function generateManifestCommand(apiPath: string | undefined, options?: GenerateManifestOptions): Promise<void>;
5
+ //# sourceMappingURL=generate-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-manifest.d.ts","sourceRoot":"","sources":["../../src/commands/generate-manifest.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,GAAE,uBAA4B,iBAyBtC"}
@@ -0,0 +1,21 @@
1
+ import { mkdir, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { loadApiModule } from '../utils/load-api.js';
4
+ import { logger } from '../utils/logger.js';
5
+ export async function generateManifestCommand(apiPath, options = {}) {
6
+ if (!apiPath) {
7
+ throw new Error('Missing API module path.\n\n' +
8
+ 'Usage: hypequery generate:manifest analytics/api.ts --output analytics/hypequery-manifest.json');
9
+ }
10
+ const outputPath = options.output ?? 'analytics/hypequery-manifest.json';
11
+ const api = await loadApiModule(apiPath);
12
+ if (!api || typeof api.manifest !== 'function') {
13
+ throw new Error(`Invalid API module: ${apiPath}\n\n` +
14
+ `The exported API must provide a manifest() method. ` +
15
+ `Export the value returned by createAPI() or initServe(...).serve(...).`);
16
+ }
17
+ const manifest = api.manifest();
18
+ await mkdir(path.dirname(outputPath), { recursive: true });
19
+ await writeFile(outputPath, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
20
+ logger.success(`Manifest written to ${outputPath}`);
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypequery/cli",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Command-line interface for hypequery",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -32,11 +32,11 @@
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.11.30",
34
34
  "@types/prompts": "^2.4.9",
35
- "@vitest/coverage-v8": "^2.1.6",
35
+ "@vitest/coverage-v8": "^3.2.6",
36
36
  "typescript": "^5.7.3",
37
- "vitest": "^2.1.6",
37
+ "vitest": "^3.2.6",
38
38
  "@hypequery/clickhouse": "2.1.2",
39
- "@hypequery/serve": "0.5.0"
39
+ "@hypequery/serve": "0.6.0"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",