@askdb/sqlserver 0.1.0-beta.11 → 0.1.0-beta.13

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
@@ -18,6 +18,13 @@ pnpm add @askdb/core @askdb/introspect @askdb/sqlserver
18
18
  pnpm add mssql
19
19
  ```
20
20
 
21
+ For one-off CLI introspection, include the driver in the same ephemeral command:
22
+
23
+ ```bash
24
+ pnpm dlx -p askdb -p mssql askdb introspect --engine sqlserver --url "$SQLSERVER_URL"
25
+ npx -p askdb -p mssql askdb introspect --engine sqlserver --url "$SQLSERVER_URL"
26
+ ```
27
+
21
28
  ## Usage
22
29
 
23
30
  ### NL→SQL
@@ -46,7 +53,7 @@ const result = await introspect(
46
53
  {
47
54
  mode: "live",
48
55
  runner: createSqlServerCatalogQueryRunner(
49
- "Server=host,1433;Database=mydb;User Id=sa;Password=pass;",
56
+ "Server=host,1433;Database=mydb;User Id=sa;Password=pass;TrustServerCertificate=True;",
50
57
  ),
51
58
  },
52
59
  { outDir: "./my-app.schema", schemaId: "my-app" },
@@ -54,6 +61,35 @@ const result = await introspect(
54
61
  );
55
62
  ```
56
63
 
64
+ ### Connection string formats
65
+
66
+ `createSqlServerCatalogQueryRunner` and `databaseUrl` in `askdb.config.ts` accept three formats:
67
+
68
+ | Format | Example |
69
+ |--------|---------|
70
+ | `mssql://` URL | `mssql://sa:pass@localhost:1433/MyDb` |
71
+ | Prisma `sqlserver://` | `sqlserver://localhost:1433;database=MyDb;user=sa;password=pass;encrypt=true` |
72
+ | ADO.NET (`Key=Value;`) | `Server=localhost,1433;Database=MyDb;User Id=sa;Password=pass;` |
73
+
74
+ **TLS / self-signed certificates**
75
+
76
+ SQL Server uses TLS by default. If you connect to a local or dev instance with a self-signed certificate you will see a `self-signed certificate` error unless you tell the driver to trust it:
77
+
78
+ - **`mssql://` URL** — append `?trustServerCertificate=true`:
79
+ ```
80
+ mssql://sa:pass@localhost:1433/MyDb?trustServerCertificate=true
81
+ ```
82
+ - **Prisma URL** — append `;trustServerCertificate=true`:
83
+ ```
84
+ sqlserver://localhost:1433;database=MyDb;user=sa;password=pass;trustServerCertificate=true
85
+ ```
86
+ - **ADO.NET string** — add `TrustServerCertificate=True;` (note: use the camelCase form without spaces — `Trust Server Certificate` with spaces is a known parsing gap in mssql v12):
87
+ ```
88
+ Server=localhost,1433;Database=MyDb;User Id=sa;Password=pass;Encrypt=True;TrustServerCertificate=True;
89
+ ```
90
+
91
+ > **Never set `TrustServerCertificate=True` in production** unless you have verified the server's certificate through another means. Use a properly signed certificate, or install the CA cert in the system trust store (`NODE_EXTRA_CA_CERTS` / `--use-system-ca`).
92
+
57
93
  ## Captured metadata
58
94
 
59
95
  Tables, views, columns (SQL Server native type strings), primary keys, unique constraints, foreign keys (with referential actions), and indexes.
@@ -2,10 +2,42 @@ import type { CatalogQueryRunner } from "@askdb/introspect";
2
2
  export type { CatalogQueryResult, CatalogQueryRunner } from "@askdb/introspect";
3
3
  /** @internal exposed for tests that need to reset the lazy `mssql` cache. */
4
4
  export declare function __resetMssqlModuleCacheForTests(): void;
5
+ type MssqlConfigInput = {
6
+ server: string;
7
+ port?: number;
8
+ database?: string;
9
+ user?: string;
10
+ password?: string;
11
+ options?: {
12
+ encrypt?: boolean;
13
+ trustServerCertificate?: boolean;
14
+ };
15
+ };
16
+ /**
17
+ * mssql v12 uses @tediousjs/connection-string v1.x, which has two known gaps:
18
+ *
19
+ * 1. URL format (`mssql://…`, `sqlserver://…`) — the library is a pure ADO.NET
20
+ * key=value parser and silently produces an empty config, leaving `server`
21
+ * undefined. We detect these schemes and parse them into config objects.
22
+ *
23
+ * 2. ADO.NET multi-word keys with spaces — the library schema uses the no-space
24
+ * form (`trustservercertificate`) but ADO.NET client tools emit keys with
25
+ * spaces (`Trust Server Certificate`). After lowercasing by the parser these
26
+ * never match the schema, so options like TrustServerCertificate are silently
27
+ * dropped. We normalise the affected keys before passing the string to mssql.
28
+ *
29
+ * ADO.NET strings are identified as anything that is not a URL (no `://`).
30
+ */
31
+ export declare function resolveConnectionInput(connectionString: string): string | MssqlConfigInput;
5
32
  /**
6
33
  * Build the built-in `mssql`-backed catalog query runner used by live SQL
7
- * Server introspection. `connectionString` follows the standard mssql URI
8
- * (`mssql://user:pass@host:port/database`) or the Server=...; format.
34
+ * Server introspection. `connectionString` may be:
35
+ * - ADO.NET format: `Server=host,1433;Database=db;User Id=u;Password=p;`
36
+ * - `mssql://` URL: `mssql://user:pass@host:1433/database`
37
+ * - Prisma format: `sqlserver://host:1433;database=db;user=u;password=p`
38
+ *
39
+ * mssql v12+ only understands ADO.NET strings; URL formats are converted to a
40
+ * config object automatically.
9
41
  */
10
42
  export declare function createSqlServerCatalogQueryRunner(connectionString: string): CatalogQueryRunner;
11
43
  //# sourceMappingURL=sqlserver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlserver.d.ts","sourceRoot":"","sources":["../../src/exec/sqlserver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA2BhF,6EAA6E;AAC7E,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAkCD;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,gBAAgB,EAAE,MAAM,GAAG,kBAAkB,CAE9F"}
1
+ {"version":3,"file":"sqlserver.d.ts","sourceRoot":"","sources":["../../src/exec/sqlserver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAKhF,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAyDhF,6EAA6E;AAC7E,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAED,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACnE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAa1F;AA+HD;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAAC,gBAAgB,EAAE,MAAM,GAAG,kBAAkB,CAE9F"}
@@ -1,16 +1,52 @@
1
1
  import { AskDbError } from "@askdb/core";
2
+ import { createRequire } from "node:module";
3
+ import { join } from "node:path";
4
+ import { pathToFileURL } from "node:url";
2
5
  /**
3
6
  * Lazily resolve the optional `mssql` peer dependency. Mirrors the lazy-load
4
7
  * pattern in `@askdb/postgres` / `@askdb/mysql` so consumers with a custom
5
8
  * `CatalogQueryRunner` can import `@askdb/sqlserver` without `mssql` installed.
6
9
  */
7
10
  let mssqlModulePromise;
11
+ function isModuleResolutionFailure(cause, packageName) {
12
+ if (!(cause instanceof Error))
13
+ return false;
14
+ const nestedCause = cause.cause;
15
+ if (nestedCause && nestedCause !== cause && isModuleResolutionFailure(nestedCause, packageName)) {
16
+ return true;
17
+ }
18
+ const code = cause.code;
19
+ if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND")
20
+ return false;
21
+ return cause.message.includes(packageName);
22
+ }
23
+ async function importOptionalMssql() {
24
+ try {
25
+ return await import("mssql");
26
+ }
27
+ catch (cause) {
28
+ if (!isModuleResolutionFailure(cause, "mssql"))
29
+ throw cause;
30
+ const projectRequire = createRequire(join(process.cwd(), "package.json"));
31
+ try {
32
+ const resolved = projectRequire.resolve("mssql");
33
+ return (await import(pathToFileURL(resolved).href));
34
+ }
35
+ catch (projectCause) {
36
+ if (!isModuleResolutionFailure(projectCause, "mssql"))
37
+ throw projectCause;
38
+ throw new AggregateError([cause, projectCause], "Unable to resolve optional `mssql` peer dependency");
39
+ }
40
+ }
41
+ }
8
42
  async function loadMssqlOrThrow() {
9
43
  if (!mssqlModulePromise) {
10
- mssqlModulePromise = import("mssql").catch((cause) => {
44
+ mssqlModulePromise = importOptionalMssql().catch((cause) => {
11
45
  mssqlModulePromise = undefined;
12
46
  throw new AskDbError("The built-in SQL Server catalog query runner requires the optional `mssql` peer dependency. " +
13
- "Install it (e.g. `pnpm add mssql`) or pass a custom catalog query runner to the SQL Server connector.", cause);
47
+ "Install it in your project (e.g. `pnpm add mssql`) or include it in the same one-off command " +
48
+ "(e.g. `pnpm dlx -p askdb -p mssql askdb ...` or `npx -p askdb -p mssql askdb ...`). " +
49
+ "You can also pass a custom catalog query runner to the SQL Server connector.", cause);
14
50
  });
15
51
  }
16
52
  return mssqlModulePromise;
@@ -19,10 +55,122 @@ async function loadMssqlOrThrow() {
19
55
  export function __resetMssqlModuleCacheForTests() {
20
56
  mssqlModulePromise = undefined;
21
57
  }
58
+ /**
59
+ * mssql v12 uses @tediousjs/connection-string v1.x, which has two known gaps:
60
+ *
61
+ * 1. URL format (`mssql://…`, `sqlserver://…`) — the library is a pure ADO.NET
62
+ * key=value parser and silently produces an empty config, leaving `server`
63
+ * undefined. We detect these schemes and parse them into config objects.
64
+ *
65
+ * 2. ADO.NET multi-word keys with spaces — the library schema uses the no-space
66
+ * form (`trustservercertificate`) but ADO.NET client tools emit keys with
67
+ * spaces (`Trust Server Certificate`). After lowercasing by the parser these
68
+ * never match the schema, so options like TrustServerCertificate are silently
69
+ * dropped. We normalise the affected keys before passing the string to mssql.
70
+ *
71
+ * ADO.NET strings are identified as anything that is not a URL (no `://`).
72
+ */
73
+ export function resolveConnectionInput(connectionString) {
74
+ if (connectionString.startsWith("mssql://")) {
75
+ return parseMssqlSchemeUrl(connectionString);
76
+ }
77
+ if (connectionString.startsWith("sqlserver://")) {
78
+ return parsePrismaSqlServerUrl(connectionString);
79
+ }
80
+ // ADO.NET string: normalise multi-word keys that @tediousjs/connection-string
81
+ // v1.x does not recognise in their spaced form.
82
+ if (!connectionString.includes("://")) {
83
+ return normalizeAdoNetString(connectionString);
84
+ }
85
+ return connectionString;
86
+ }
87
+ /**
88
+ * @tediousjs/connection-string v1.x schema uses camelCase/no-space forms as
89
+ * keys, but ADO.NET clients (VS Code mssql, SSMS) emit the space-separated
90
+ * forms. Map each affected key to the form the schema actually recognises.
91
+ */
92
+ const ADO_NET_KEY_NORMALISATIONS = [
93
+ [/Trust\s+Server\s+Certificate\s*=/gi, "TrustServerCertificate="],
94
+ [/Application\s+Intent\s*=/gi, "ApplicationIntent="],
95
+ [/Multiple\s+Active\s+Result\s+Sets\s*=/gi, "MultipleActiveResultSets="],
96
+ [/Connect\s+Retry\s+Count\s*=/gi, "ConnectRetryCount="],
97
+ [/Connect\s+Retry\s+Interval\s*=/gi, "ConnectRetryInterval="],
98
+ [/Transparent\s+Network\s+IP\s+Resolution\s*=/gi, "TransparentNetworkIpResolution="],
99
+ ];
100
+ function normalizeAdoNetString(connectionString) {
101
+ let result = connectionString;
102
+ for (const [pattern, replacement] of ADO_NET_KEY_NORMALISATIONS) {
103
+ result = result.replace(pattern, replacement);
104
+ }
105
+ return result;
106
+ }
107
+ function parseMssqlSchemeUrl(connectionString) {
108
+ const url = new URL(connectionString);
109
+ const server = url.hostname;
110
+ if (!server) {
111
+ throw new AskDbError("Cannot parse server hostname from SQL Server connection URL. " +
112
+ "Expected format: mssql://USER:PASSWORD@HOST:PORT/DATABASE");
113
+ }
114
+ const port = url.port ? parseInt(url.port, 10) : undefined;
115
+ const database = url.pathname.length > 1 ? url.pathname.slice(1) : undefined;
116
+ const user = url.username ? decodeURIComponent(url.username) : undefined;
117
+ const password = url.password ? decodeURIComponent(url.password) : undefined;
118
+ const encrypt = url.searchParams.get("encrypt");
119
+ const trustCert = url.searchParams.get("trustServerCertificate") ?? url.searchParams.get("TrustServerCertificate");
120
+ return {
121
+ server,
122
+ ...(port !== undefined && !Number.isNaN(port) ? { port } : {}),
123
+ ...(database ? { database } : {}),
124
+ ...(user ? { user } : {}),
125
+ ...(password ? { password } : {}),
126
+ options: {
127
+ ...(encrypt !== null ? { encrypt: !["false", "0", "no"].includes(encrypt.toLowerCase()) } : {}),
128
+ ...(trustCert !== null ? { trustServerCertificate: !["false", "0", "no"].includes(trustCert.toLowerCase()) } : {}),
129
+ },
130
+ };
131
+ }
132
+ function parsePrismaSqlServerUrl(connectionString) {
133
+ // Prisma format: sqlserver://HOST:PORT;database=DATABASE;user=USER;password=PASSWORD;encrypt=true
134
+ const withoutScheme = connectionString.slice("sqlserver://".length);
135
+ const firstSemiIdx = withoutScheme.indexOf(";");
136
+ const hostPart = firstSemiIdx === -1 ? withoutScheme : withoutScheme.slice(0, firstSemiIdx);
137
+ const paramsPart = firstSemiIdx === -1 ? "" : withoutScheme.slice(firstSemiIdx + 1);
138
+ const colonIdx = hostPart.lastIndexOf(":");
139
+ const server = colonIdx === -1 ? hostPart : hostPart.slice(0, colonIdx);
140
+ const portStr = colonIdx === -1 ? undefined : hostPart.slice(colonIdx + 1);
141
+ const port = portStr ? parseInt(portStr, 10) : undefined;
142
+ if (!server) {
143
+ throw new AskDbError("Cannot parse server hostname from Prisma-style SQL Server URL. " +
144
+ "Expected: sqlserver://HOST:PORT;database=DATABASE;user=USER;password=PASSWORD");
145
+ }
146
+ const params = {};
147
+ for (const part of paramsPart.split(";")) {
148
+ const eqIdx = part.indexOf("=");
149
+ if (eqIdx === -1)
150
+ continue;
151
+ const key = part.slice(0, eqIdx).trim().toLowerCase();
152
+ const value = part.slice(eqIdx + 1).trim();
153
+ if (key && value)
154
+ params[key] = value;
155
+ }
156
+ return {
157
+ server,
158
+ ...(port !== undefined && !Number.isNaN(port) ? { port } : {}),
159
+ ...(params["database"] ? { database: params["database"] } : {}),
160
+ ...(params["user"] ? { user: params["user"] } : {}),
161
+ ...(params["password"] ? { password: params["password"] } : {}),
162
+ options: {
163
+ ...(params["encrypt"] !== undefined ? { encrypt: params["encrypt"].toLowerCase() === "true" } : {}),
164
+ ...(params["trustservercertificate"] !== undefined
165
+ ? { trustServerCertificate: params["trustservercertificate"].toLowerCase() === "true" }
166
+ : {}),
167
+ },
168
+ };
169
+ }
22
170
  async function runSqlServerCatalogQuery(connectionString, sql, params) {
23
171
  const mod = await loadMssqlOrThrow();
24
172
  const mssql = mod.default ?? mod;
25
- const pool = new mssql.ConnectionPool(connectionString);
173
+ const pool = new mssql.ConnectionPool(resolveConnectionInput(connectionString));
26
174
  await pool.connect();
27
175
  try {
28
176
  const request = pool.request();
@@ -51,8 +199,13 @@ async function runSqlServerCatalogQuery(connectionString, sql, params) {
51
199
  }
52
200
  /**
53
201
  * Build the built-in `mssql`-backed catalog query runner used by live SQL
54
- * Server introspection. `connectionString` follows the standard mssql URI
55
- * (`mssql://user:pass@host:port/database`) or the Server=...; format.
202
+ * Server introspection. `connectionString` may be:
203
+ * - ADO.NET format: `Server=host,1433;Database=db;User Id=u;Password=p;`
204
+ * - `mssql://` URL: `mssql://user:pass@host:1433/database`
205
+ * - Prisma format: `sqlserver://host:1433;database=db;user=u;password=p`
206
+ *
207
+ * mssql v12+ only understands ADO.NET strings; URL formats are converted to a
208
+ * config object automatically.
56
209
  */
57
210
  export function createSqlServerCatalogQueryRunner(connectionString) {
58
211
  return (sql, params) => runSqlServerCatalogQuery(connectionString, sql, params);
@@ -1 +1 @@
1
- {"version":3,"file":"sqlserver.js","sourceRoot":"","sources":["../../src/exec/sqlserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASzC;;;;GAIG;AACH,IAAI,kBAAoD,CAAC;AAEzD,KAAK,UAAU,gBAAgB;IAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,CAA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,CAAC;IACjC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,UAAU;YAAE,MAAM,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,IAAI,UAAU,CAAC,oCAAoC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzE,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iCAAiC,CAAC,gBAAwB;IACxE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAClF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askdb/sqlserver",
3
- "version": "0.1.0-beta.11",
3
+ "version": "0.1.0-beta.13",
4
4
  "description": "AskDB Microsoft SQL Server integration: introspection connector via sys.* catalog views and an mssql-backed catalog query runner. Pairs with @askdb/core's SQLSERVER_DIALECT.",
5
5
  "keywords": [
6
6
  "askdb",
@@ -47,7 +47,7 @@
47
47
  "@askdb/introspect": "0.3.0-beta.12"
48
48
  },
49
49
  "peerDependencies": {
50
- "mssql": ">=10"
50
+ "mssql": ">=12"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "mssql": {
@@ -55,10 +55,10 @@
55
55
  }
56
56
  },
57
57
  "devDependencies": {
58
- "@types/mssql": "^9.1.11",
59
- "mssql": "^11.0.1",
60
- "typescript": "^5.9.3",
61
- "vitest": "^3.2.6"
58
+ "@types/mssql": "^12.3.0",
59
+ "mssql": "^12.5.5",
60
+ "typescript": "^6.0.3",
61
+ "vitest": "^4.1.8"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "tsc -p tsconfig.build.json",