@ascdong/nexus 0.1.0 → 0.1.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.js CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from "node:fs";
3
+ import { pathToFileURL } from "node:url";
2
4
  import { Command } from "commander";
3
5
  import { register } from "./core/registry.js";
4
6
  import { ConnectorError, exitCodeFor } from "./core/errors.js";
@@ -17,7 +19,7 @@ export function registerConnectors() {
17
19
  }
18
20
  export function buildProgram() {
19
21
  const program = new Command();
20
- program.name("nexus").description("Unified Azure data access CLI").version("0.1.0");
22
+ program.name("nexus").description("Unified Azure data access CLI").version("0.1.2");
21
23
  registerConnectorCommand(program);
22
24
  registerQueryCommand(program);
23
25
  registerSchemaCommand(program);
@@ -40,7 +42,17 @@ async function main() {
40
42
  process.exit(1);
41
43
  }
42
44
  }
43
- const invokedDirectly = process.argv[1] && import.meta.url === `file://${process.argv[1]}`;
45
+ const invokedDirectly = (() => {
46
+ const entry = process.argv[1];
47
+ if (!entry)
48
+ return false;
49
+ try {
50
+ return import.meta.url === pathToFileURL(realpathSync(entry)).href;
51
+ }
52
+ catch {
53
+ return false;
54
+ }
55
+ })();
44
56
  if (invokedDirectly) {
45
57
  main();
46
58
  }
@@ -56,7 +56,7 @@ export function makeLogAnalyticsConnector(config, cred) {
56
56
  return runQuery(statement, options?.maxRows ?? DEFAULT_MAX_ROWS);
57
57
  },
58
58
  async listTables() {
59
- const rs = await runQuery("union withsource=TableName * | distinct TableName | sort by TableName asc", 5000);
59
+ const rs = await runQuery("search * | distinct $table | project TableName=$table | sort by TableName asc", 5000);
60
60
  return rs.rows.map((r) => ({ name: String(r[0]) }));
61
61
  },
62
62
  async describeTable(table) {
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@ascdong/nexus",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Unified Azure data access CLI for Log Analytics, Kusto, Azure SQL, and Storage Account",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "nexus": "dist/cli.js"
8
8
  },
9
9
  "files": ["dist", "README.md"],
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
10
13
  "scripts": {
11
14
  "build": "tsc",
12
15
  "dev": "bun run src/cli.ts",