@askdb/sqlserver 0.1.0-beta.2 → 0.1.0-beta.20
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/NOTICE +10 -0
- package/README.md +53 -4
- package/dist/connector/describe.d.ts +4 -4
- package/dist/connector/describe.d.ts.map +1 -1
- package/dist/connector/describe.js +21 -84
- package/dist/connector/describe.js.map +1 -1
- package/dist/connector/provider.d.ts +2 -0
- package/dist/connector/provider.d.ts.map +1 -0
- package/dist/connector/provider.js +19 -0
- package/dist/connector/provider.js.map +1 -0
- package/dist/exec/sqlserver.d.ts +54 -5
- package/dist/exec/sqlserver.d.ts.map +1 -1
- package/dist/exec/sqlserver.js +288 -19
- package/dist/exec/sqlserver.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/label.d.ts +26 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +89 -0
- package/dist/label.js.map +1 -0
- package/package.json +14 -11
- package/dist/connector/glob.d.ts +0 -3
- package/dist/connector/glob.d.ts.map +0 -1
- package/dist/connector/glob.js +0 -23
- package/dist/connector/glob.js.map +0 -1
- package/dist/connector/ids.d.ts +0 -4
- package/dist/connector/ids.d.ts.map +0 -1
- package/dist/connector/ids.js +0 -8
- package/dist/connector/ids.js.map +0 -1
package/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
AskDB
|
|
2
|
+
Copyright 2026 Yahya Gilany
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Yahya Gilany and contributors.
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License.
|
|
8
|
+
You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
package/README.md
CHANGED
|
@@ -9,15 +9,24 @@ Microsoft SQL Server integration for AskDB. Bundles three pieces:
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
pnpm add @askdb/core @askdb/introspect @askdb/sqlserver
|
|
12
|
+
pnpm add @askdb/core @askdb/introspect @askdb/sqlserver ai
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
`ai` (Vercel AI SDK 6 or 7) is a required peer dependency of `@askdb/core`; your app owns its version.
|
|
16
|
+
|
|
15
17
|
`mssql` is an **optional peer dependency** — install it only when using live introspection mode:
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
pnpm add mssql
|
|
19
21
|
```
|
|
20
22
|
|
|
23
|
+
For one-off CLI introspection, include the driver in the same ephemeral command:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm dlx -p askdb -p mssql askdb introspect --engine sqlserver --url "$SQLSERVER_URL"
|
|
27
|
+
npx -p askdb -p mssql askdb introspect --engine sqlserver --url "$SQLSERVER_URL"
|
|
28
|
+
```
|
|
29
|
+
|
|
21
30
|
## Usage
|
|
22
31
|
|
|
23
32
|
### NL→SQL
|
|
@@ -46,7 +55,7 @@ const result = await introspect(
|
|
|
46
55
|
{
|
|
47
56
|
mode: "live",
|
|
48
57
|
runner: createSqlServerCatalogQueryRunner(
|
|
49
|
-
"Server=host,1433;Database=mydb;User Id=sa;Password=pass;",
|
|
58
|
+
"Server=host,1433;Database=mydb;User Id=sa;Password=pass;TrustServerCertificate=True;",
|
|
50
59
|
),
|
|
51
60
|
},
|
|
52
61
|
{ outDir: "./my-app.schema", schemaId: "my-app" },
|
|
@@ -54,10 +63,50 @@ const result = await introspect(
|
|
|
54
63
|
);
|
|
55
64
|
```
|
|
56
65
|
|
|
66
|
+
### Connection string formats
|
|
67
|
+
|
|
68
|
+
`createSqlServerCatalogQueryRunner` and `databaseUrl` in `askdb.config.ts` accept three formats:
|
|
69
|
+
|
|
70
|
+
| Format | Example |
|
|
71
|
+
|--------|---------|
|
|
72
|
+
| `mssql://` URL | `mssql://sa:pass@localhost:1433/MyDb` |
|
|
73
|
+
| Prisma `sqlserver://` | `sqlserver://localhost:1433;database=MyDb;user=sa;password=pass;encrypt=true` |
|
|
74
|
+
| ADO.NET (`Key=Value;`) | `Server=localhost,1433;Database=MyDb;User Id=sa;Password=pass;` |
|
|
75
|
+
|
|
76
|
+
In the Prisma form, wrap a value that contains `;` in curly braces, as Prisma does: `password={Pass:Word;}` is `Pass:Word;`. AskDB reads braces this way only where its earlier parser couldn't read the value, so strings that worked before keep connecting with the same values:
|
|
77
|
+
|
|
78
|
+
- A value is an escape when it starts with `{`, has a `;` before its first `}`, and ends at the first `}` that is followed only by blanks and then a `;` or the end of the string, where the `;`-separated piece that ends at that `}` has no `=`. Everything between the braces is the value, read verbatim: `{{a;b}}` is `{a;b}`.
|
|
79
|
+
- Any other brace is a plain character, as before: `password={abc}` is `{abc}`, and a `{` that is never closed is part of the value.
|
|
80
|
+
- Prisma reads every `{…}` as an escape, so a URL shared with Prisma that braces a value without a `;` (such as `password={Pass:Word}`) reaches SQL Server with its braces when AskDB connects.
|
|
81
|
+
- Prisma's credential keys `username`, `uid` and `pwd` are also read when `user` or `password` is absent (`username` before `uid`); the canonical key wins when both are set.
|
|
82
|
+
|
|
83
|
+
**TLS / self-signed certificates**
|
|
84
|
+
|
|
85
|
+
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:
|
|
86
|
+
|
|
87
|
+
- **`mssql://` URL** — append `?trustServerCertificate=true`:
|
|
88
|
+
```
|
|
89
|
+
mssql://sa:pass@localhost:1433/MyDb?trustServerCertificate=true
|
|
90
|
+
```
|
|
91
|
+
- **Prisma URL** — append `;trustServerCertificate=true`:
|
|
92
|
+
```
|
|
93
|
+
sqlserver://localhost:1433;database=MyDb;user=sa;password=pass;trustServerCertificate=true
|
|
94
|
+
```
|
|
95
|
+
- **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):
|
|
96
|
+
```
|
|
97
|
+
Server=localhost,1433;Database=MyDb;User Id=sa;Password=pass;Encrypt=True;TrustServerCertificate=True;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> **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`).
|
|
101
|
+
|
|
102
|
+
**Labels for display**
|
|
103
|
+
|
|
104
|
+
`sqlServerConnectorProvider` parses a connection into display-safe parts, so a connector registry's `connectionLabel()` (and the `sourceLabel` from `resolveConnection()`) shows only the host, port and database from any of the three formats: `Server=localhost,1433;Database=app;User Id=sa;Password=pass;` becomes `sqlserver://localhost:1433/app`. The parts come from the same code the connection uses: `resolveConnectionInput()` for `mssql://` and `sqlserver://`, and `@tediousjs/connection-string` (the parser `mssql` uses, a dependency of this package) for ADO.NET strings, so the label names the host and database the driver will use. A string the driver rejects, a named instance or pipe, an `@` in the `sqlserver://` form, a `sqlserver://` string that can be read more than one way (it holds a `{`, a quote, a piece without `=`, or an empty piece before another one), or JDBC becomes `configured sqlserver connection`.
|
|
105
|
+
|
|
57
106
|
## Captured metadata
|
|
58
107
|
|
|
59
|
-
Tables, views, columns (SQL Server native type strings), primary keys, unique constraints, foreign keys (with referential actions), and indexes.
|
|
108
|
+
Tables, views, columns (SQL Server native type strings), primary keys, unique constraints, foreign keys (with referential actions), and indexes. Objects shipped by SQL Server itself (`is_ms_shipped = 1`, e.g. replication `MS*` tables) are excluded.
|
|
60
109
|
|
|
61
110
|
## License
|
|
62
111
|
|
|
63
|
-
Apache-2.0
|
|
112
|
+
Apache-2.0 © [Yahya Gilany](https://yahyagilany.io). See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CatalogQueryRunner, IntrospectionFilters, IntrospectionResult } from "@askdb/introspect";
|
|
2
|
-
import { compileTableFilters } from "
|
|
2
|
+
import { compileTableFilters } from "@askdb/introspect/kit";
|
|
3
3
|
export type DescribeSqlServerInput = {
|
|
4
4
|
runner: CatalogQueryRunner;
|
|
5
5
|
filters?: IntrospectionFilters;
|
|
@@ -8,9 +8,9 @@ export type DescribeSqlServerInput = {
|
|
|
8
8
|
};
|
|
9
9
|
/** Internal: the catalog SQL strings, exposed for snapshot-based tests. */
|
|
10
10
|
export declare const SQLSERVER_CATALOG_SQL: {
|
|
11
|
-
readonly tables: "SELECT\n s.name AS schema_name,\n t.name AS table_name,\n 'BASE TABLE' AS table_type\nFROM sys.tables t\nJOIN sys.schemas s ON s.schema_id = t.schema_id\nUNION ALL\nSELECT\n s.name AS schema_name,\n v.name AS table_name,\n 'VIEW' AS table_type\nFROM sys.views v\nJOIN sys.schemas s ON s.schema_id = v.schema_id\nORDER BY schema_name, table_name";
|
|
12
|
-
readonly views: "SELECT\n s.name AS schema_name,\n v.name AS view_name,\n m.definition AS view_definition\nFROM sys.views v\nJOIN sys.schemas s ON s.schema_id = v.schema_id\nLEFT JOIN sys.sql_modules m ON m.object_id = v.object_id\nORDER BY s.name, v.name";
|
|
13
|
-
readonly columns: "SELECT\n s.name AS schema_name,\n o.name AS table_name,\n c.name AS column_name,\n c.column_id AS ordinal_position,\n typ.name AS type_name,\n c.max_length AS max_length,\n c.precision AS precision_v,\n c.scale AS scale,\n c.is_nullable AS is_nullable\nFROM sys.columns c\nJOIN sys.objects o ON o.object_id = c.object_id\nJOIN sys.schemas s ON s.schema_id = o.schema_id\nJOIN sys.types typ ON typ.user_type_id = c.user_type_id\nWHERE o.type IN ('U','V')\nORDER BY s.name, o.name, c.column_id";
|
|
11
|
+
readonly tables: "SELECT\n s.name AS schema_name,\n t.name AS table_name,\n 'BASE TABLE' AS table_type\nFROM sys.tables t\nJOIN sys.schemas s ON s.schema_id = t.schema_id\nWHERE t.is_ms_shipped = 0\nUNION ALL\nSELECT\n s.name AS schema_name,\n v.name AS table_name,\n 'VIEW' AS table_type\nFROM sys.views v\nJOIN sys.schemas s ON s.schema_id = v.schema_id\nWHERE v.is_ms_shipped = 0\nORDER BY schema_name, table_name";
|
|
12
|
+
readonly views: "SELECT\n s.name AS schema_name,\n v.name AS view_name,\n m.definition AS view_definition\nFROM sys.views v\nJOIN sys.schemas s ON s.schema_id = v.schema_id\nLEFT JOIN sys.sql_modules m ON m.object_id = v.object_id\nWHERE v.is_ms_shipped = 0\nORDER BY s.name, v.name";
|
|
13
|
+
readonly columns: "SELECT\n s.name AS schema_name,\n o.name AS table_name,\n c.name AS column_name,\n c.column_id AS ordinal_position,\n typ.name AS type_name,\n c.max_length AS max_length,\n c.precision AS precision_v,\n c.scale AS scale,\n c.is_nullable AS is_nullable\nFROM sys.columns c\nJOIN sys.objects o ON o.object_id = c.object_id\nJOIN sys.schemas s ON s.schema_id = o.schema_id\nJOIN sys.types typ ON typ.user_type_id = c.user_type_id\nWHERE o.type IN ('U','V')\n AND o.is_ms_shipped = 0\nORDER BY s.name, o.name, c.column_id";
|
|
14
14
|
readonly constraints: "SELECT\n s.name AS schema_name,\n t.name AS table_name,\n i.name AS constraint_name,\n c.name AS column_name,\n ic.key_ordinal AS ordinal_position,\n CASE WHEN i.is_primary_key = 1 THEN 'PRIMARY KEY' ELSE 'UNIQUE' END AS constraint_type\nFROM sys.indexes i\nJOIN sys.tables t ON t.object_id = i.object_id\nJOIN sys.schemas s ON s.schema_id = t.schema_id\nJOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id\nJOIN sys.columns c ON c.object_id = ic.object_id AND c.column_id = ic.column_id\nWHERE (i.is_primary_key = 1 OR i.is_unique_constraint = 1)\n AND ic.is_included_column = 0\nORDER BY s.name, t.name, i.name, ic.key_ordinal";
|
|
15
15
|
readonly foreign_keys: "SELECT\n s.name AS schema_name,\n pt.name AS table_name,\n fk.name AS constraint_name,\n pc.name AS column_name,\n fkc.constraint_column_id AS ordinal_position,\n rs.name AS referenced_schema,\n rt.name AS referenced_table,\n rc.name AS referenced_column,\n fk.update_referential_action AS update_action,\n fk.delete_referential_action AS delete_action\nFROM sys.foreign_keys fk\nJOIN sys.tables pt ON pt.object_id = fk.parent_object_id\nJOIN sys.schemas s ON s.schema_id = pt.schema_id\nJOIN sys.tables rt ON rt.object_id = fk.referenced_object_id\nJOIN sys.schemas rs ON rs.schema_id = rt.schema_id\nJOIN sys.foreign_key_columns fkc ON fkc.constraint_object_id = fk.object_id\nJOIN sys.columns pc ON pc.object_id = fkc.parent_object_id AND pc.column_id = fkc.parent_column_id\nJOIN sys.columns rc ON rc.object_id = fkc.referenced_object_id AND rc.column_id = fkc.referenced_column_id\nORDER BY s.name, pt.name, fk.name, fkc.constraint_column_id";
|
|
16
16
|
readonly indexes: "SELECT\n s.name AS schema_name,\n t.name AS table_name,\n i.name AS index_name,\n c.name AS column_name,\n ic.key_ordinal AS ordinal_position,\n i.is_unique AS is_unique,\n i.type_desc AS method\nFROM sys.indexes i\nJOIN sys.tables t ON t.object_id = i.object_id\nJOIN sys.schemas s ON s.schema_id = t.schema_id\nJOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id\nJOIN sys.columns c ON c.object_id = ic.object_id AND c.column_id = ic.column_id\nWHERE i.is_primary_key = 0\n AND i.is_unique_constraint = 0\n AND i.name IS NOT NULL\n AND ic.is_included_column = 0\nORDER BY s.name, t.name, i.name, ic.key_ordinal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/connector/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EAWpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/connector/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EAWpB,MAAM,mBAAmB,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ters } from "
|
|
2
|
-
import { makeColumnId, makeTableId } from "./ids.js";
|
|
1
|
+
import { ambiguousFilterWarnings, buildOrderedGroups, byName, compileTableFilters, groupBy, makeColumnId, makeTableId, rowsToRecords, sortedUnique, } from "@askdb/introspect/kit";
|
|
3
2
|
/**
|
|
4
3
|
* System schemas excluded from the default introspection.
|
|
5
4
|
* Honors the engine-agnostic `excludeSchemas` filter additively.
|
|
@@ -21,12 +20,18 @@ const DEFAULT_SYSTEM_SCHEMAS = new Set([
|
|
|
21
20
|
// sys.* catalog queries. Tables/views, columns (no comments/defaults yet —
|
|
22
21
|
// follow-up), PKs + UNIQUE constraints via sys.indexes, FKs via sys.foreign_keys,
|
|
23
22
|
// non-PK/non-UNIQUE indexes for completeness.
|
|
23
|
+
//
|
|
24
|
+
// Objects with `is_ms_shipped = 1` are created by SQL Server itself or its
|
|
25
|
+
// features (replication `MS*` tables, CDC/change-tracking artifacts, etc.) —
|
|
26
|
+
// often in `dbo`, so the system-schema list alone does not catch them. They are
|
|
27
|
+
// excluded from the table/view listing (and their columns) at the source.
|
|
24
28
|
const SQL_TABLES = `SELECT
|
|
25
29
|
s.name AS schema_name,
|
|
26
30
|
t.name AS table_name,
|
|
27
31
|
'BASE TABLE' AS table_type
|
|
28
32
|
FROM sys.tables t
|
|
29
33
|
JOIN sys.schemas s ON s.schema_id = t.schema_id
|
|
34
|
+
WHERE t.is_ms_shipped = 0
|
|
30
35
|
UNION ALL
|
|
31
36
|
SELECT
|
|
32
37
|
s.name AS schema_name,
|
|
@@ -34,6 +39,7 @@ SELECT
|
|
|
34
39
|
'VIEW' AS table_type
|
|
35
40
|
FROM sys.views v
|
|
36
41
|
JOIN sys.schemas s ON s.schema_id = v.schema_id
|
|
42
|
+
WHERE v.is_ms_shipped = 0
|
|
37
43
|
ORDER BY schema_name, table_name`;
|
|
38
44
|
const SQL_VIEWS = `SELECT
|
|
39
45
|
s.name AS schema_name,
|
|
@@ -42,6 +48,7 @@ const SQL_VIEWS = `SELECT
|
|
|
42
48
|
FROM sys.views v
|
|
43
49
|
JOIN sys.schemas s ON s.schema_id = v.schema_id
|
|
44
50
|
LEFT JOIN sys.sql_modules m ON m.object_id = v.object_id
|
|
51
|
+
WHERE v.is_ms_shipped = 0
|
|
45
52
|
ORDER BY s.name, v.name`;
|
|
46
53
|
const SQL_COLUMNS = `SELECT
|
|
47
54
|
s.name AS schema_name,
|
|
@@ -58,6 +65,7 @@ JOIN sys.objects o ON o.object_id = c.object_id
|
|
|
58
65
|
JOIN sys.schemas s ON s.schema_id = o.schema_id
|
|
59
66
|
JOIN sys.types typ ON typ.user_type_id = c.user_type_id
|
|
60
67
|
WHERE o.type IN ('U','V')
|
|
68
|
+
AND o.is_ms_shipped = 0
|
|
61
69
|
ORDER BY s.name, o.name, c.column_id`;
|
|
62
70
|
const SQL_CONSTRAINTS = `SELECT
|
|
63
71
|
s.name AS schema_name,
|
|
@@ -124,20 +132,7 @@ export const SQLSERVER_CATALOG_SQL = {
|
|
|
124
132
|
export async function describeSqlServer(input) {
|
|
125
133
|
const runner = input.runner;
|
|
126
134
|
const tableFilter = compileTableFilters(input.filters?.tables);
|
|
127
|
-
const run = async (sql) =>
|
|
128
|
-
const result = await runner(sql);
|
|
129
|
-
if (result.rows.length === 0)
|
|
130
|
-
return [];
|
|
131
|
-
const idx = new Map();
|
|
132
|
-
for (let i = 0; i < result.columns.length; i++)
|
|
133
|
-
idx.set(result.columns[i], i);
|
|
134
|
-
return result.rows.map((row) => {
|
|
135
|
-
const record = {};
|
|
136
|
-
for (const [name, i] of idx)
|
|
137
|
-
record[name] = row[i];
|
|
138
|
-
return record;
|
|
139
|
-
});
|
|
140
|
-
};
|
|
135
|
+
const run = async (sql) => rowsToRecords(await runner(sql));
|
|
141
136
|
const [tableRows, viewRows, columnRows, constraintRows, fkRows, indexRows] = await Promise.all([
|
|
142
137
|
run(SQL_TABLES),
|
|
143
138
|
run(SQL_VIEWS),
|
|
@@ -173,15 +168,7 @@ export function foldSqlServerResult(input) {
|
|
|
173
168
|
return false;
|
|
174
169
|
return true;
|
|
175
170
|
};
|
|
176
|
-
const colsByTable =
|
|
177
|
-
for (const c of input.columnRows) {
|
|
178
|
-
if (!includes(c.schema_name))
|
|
179
|
-
continue;
|
|
180
|
-
const key = `${c.schema_name}.${c.table_name}`;
|
|
181
|
-
const list = colsByTable.get(key) ?? [];
|
|
182
|
-
list.push(c);
|
|
183
|
-
colsByTable.set(key, list);
|
|
184
|
-
}
|
|
171
|
+
const colsByTable = groupByQualified(input.columnRows, includes);
|
|
185
172
|
const constraintsByTable = groupByQualified(input.constraintRows, includes);
|
|
186
173
|
const fksByTable = groupByQualified(input.fkRows, includes);
|
|
187
174
|
const indexesByTable = groupByQualified(input.indexRows, includes);
|
|
@@ -250,12 +237,7 @@ export function foldSqlServerResult(input) {
|
|
|
250
237
|
enums: [],
|
|
251
238
|
sequences: [],
|
|
252
239
|
}));
|
|
253
|
-
|
|
254
|
-
const matched = namespaces.some((ns) => ns.tables.some((t) => compileTableFilters([pattern])(`${ns.name}.${t.name}`)) ||
|
|
255
|
-
ns.views.some((v) => compileTableFilters([pattern])(`${ns.name}.${v.name}`)));
|
|
256
|
-
if (!matched)
|
|
257
|
-
warnings.push({ code: "ambiguous_filter", filter: pattern });
|
|
258
|
-
}
|
|
240
|
+
warnings.push(...ambiguousFilterWarnings(input.declaredFilters, namespaces.flatMap((ns) => [...ns.tables, ...ns.views].map((t) => `${ns.name}.${t.name}`))));
|
|
259
241
|
const schema = { schemaId: input.schemaId, schemas: namespaces };
|
|
260
242
|
const isEmpty = namespaces.length === 0;
|
|
261
243
|
return { schema, warnings, isEmpty, viewDefinitions, provider: "sqlserver" };
|
|
@@ -293,34 +275,12 @@ function renderType(c) {
|
|
|
293
275
|
return c.type_name;
|
|
294
276
|
}
|
|
295
277
|
function buildUniques(rows) {
|
|
296
|
-
|
|
297
|
-
for (const r of rows) {
|
|
298
|
-
if (r.constraint_type !== "UNIQUE")
|
|
299
|
-
continue;
|
|
300
|
-
const list = byName.get(r.constraint_name) ?? [];
|
|
301
|
-
list.push(r);
|
|
302
|
-
byName.set(r.constraint_name, list);
|
|
303
|
-
}
|
|
304
|
-
return Array.from(byName, ([name, list]) => ({
|
|
305
|
-
name,
|
|
306
|
-
columns: list
|
|
307
|
-
.slice()
|
|
308
|
-
.sort((a, b) => a.ordinal_position - b.ordinal_position)
|
|
309
|
-
.map((r) => r.column_name),
|
|
310
|
-
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
278
|
+
return buildOrderedGroups(rows.filter((r) => r.constraint_type === "UNIQUE"), (r) => r.constraint_name, (r) => r.ordinal_position, (name, ordered) => ({ name, columns: ordered.map((r) => r.column_name) }));
|
|
311
279
|
}
|
|
312
280
|
function buildForeignKeys(rows) {
|
|
313
|
-
|
|
314
|
-
for (const r of rows) {
|
|
315
|
-
const list = byName.get(r.constraint_name) ?? [];
|
|
316
|
-
list.push(r);
|
|
317
|
-
byName.set(r.constraint_name, list);
|
|
318
|
-
}
|
|
319
|
-
const fks = [];
|
|
320
|
-
for (const [name, list] of byName) {
|
|
321
|
-
const ordered = list.slice().sort((a, b) => a.ordinal_position - b.ordinal_position);
|
|
281
|
+
return buildOrderedGroups(rows, (r) => r.constraint_name, (r) => r.ordinal_position, (name, ordered) => {
|
|
322
282
|
const sample = ordered[0];
|
|
323
|
-
|
|
283
|
+
return {
|
|
324
284
|
name,
|
|
325
285
|
columns: ordered.map((r) => r.column_name),
|
|
326
286
|
references: {
|
|
@@ -330,9 +290,8 @@ function buildForeignKeys(rows) {
|
|
|
330
290
|
},
|
|
331
291
|
onDelete: mapAction(sample.delete_action),
|
|
332
292
|
onUpdate: mapAction(sample.update_action),
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return fks.sort((a, b) => a.name.localeCompare(b.name));
|
|
293
|
+
};
|
|
294
|
+
});
|
|
336
295
|
}
|
|
337
296
|
function mapAction(code) {
|
|
338
297
|
switch (code) {
|
|
@@ -349,14 +308,7 @@ function mapAction(code) {
|
|
|
349
308
|
}
|
|
350
309
|
}
|
|
351
310
|
function buildIndexes(rows) {
|
|
352
|
-
|
|
353
|
-
for (const r of rows) {
|
|
354
|
-
const list = byName.get(r.index_name) ?? [];
|
|
355
|
-
list.push(r);
|
|
356
|
-
byName.set(r.index_name, list);
|
|
357
|
-
}
|
|
358
|
-
return Array.from(byName, ([name, list]) => {
|
|
359
|
-
const ordered = list.slice().sort((a, b) => a.ordinal_position - b.ordinal_position);
|
|
311
|
+
return buildOrderedGroups(rows, (r) => r.index_name, (r) => r.ordinal_position, (name, ordered) => {
|
|
360
312
|
const sample = ordered[0];
|
|
361
313
|
return {
|
|
362
314
|
name,
|
|
@@ -364,24 +316,9 @@ function buildIndexes(rows) {
|
|
|
364
316
|
unique: sample.is_unique === 1 || sample.is_unique === true,
|
|
365
317
|
method: sample.method,
|
|
366
318
|
};
|
|
367
|
-
})
|
|
319
|
+
});
|
|
368
320
|
}
|
|
369
321
|
function groupByQualified(rows, includes) {
|
|
370
|
-
|
|
371
|
-
for (const r of rows) {
|
|
372
|
-
if (!includes(r.schema_name))
|
|
373
|
-
continue;
|
|
374
|
-
const key = `${r.schema_name}.${r.table_name}`;
|
|
375
|
-
const list = out.get(key) ?? [];
|
|
376
|
-
list.push(r);
|
|
377
|
-
out.set(key, list);
|
|
378
|
-
}
|
|
379
|
-
return out;
|
|
380
|
-
}
|
|
381
|
-
function sortedUnique(values) {
|
|
382
|
-
return Array.from(new Set(values)).sort((a, b) => a.localeCompare(b));
|
|
383
|
-
}
|
|
384
|
-
function byName(a, b) {
|
|
385
|
-
return a.name.localeCompare(b.name);
|
|
322
|
+
return groupBy(rows.filter((r) => includes(r.schema_name)), (r) => `${r.schema_name}.${r.table_name}`);
|
|
386
323
|
}
|
|
387
324
|
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/connector/describe.ts"],"names":[],"mappings":"AAeA,OAAO,E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,CAAC,CAAC,CAAC,UAAU,EACnB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,EACzB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QAChB,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;QAC3B,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;YAC1C,MAAM,EAAE,MAAM,CAAC,SAAS,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,IAAI;YAC3D,MAAM,EAAE,MAAM,CAAC,MAAM;SACH,CAAC;IACvB,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,IAAS,EACT,QAAyC;IAEzC,OAAO,OAAO,CACZ,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,UAAU,EAAE,CAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/connector/provider.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,0BAA0B,sDAcrC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineLiveConnectorProvider } from "@askdb/introspect/kit";
|
|
2
|
+
import { createSqlServerConnector } from "./index.js";
|
|
3
|
+
import { createSqlServerCatalogQueryRunner } from "../exec/sqlserver.js";
|
|
4
|
+
import { parseSqlServerConnection } from "../label.js";
|
|
5
|
+
export const sqlServerConnectorProvider = defineLiveConnectorProvider({
|
|
6
|
+
provider: "sqlserver",
|
|
7
|
+
displayName: "SQL Server",
|
|
8
|
+
runtimeKey: "sqlserverDatabaseUrl",
|
|
9
|
+
connectionNoun: "a connection URL",
|
|
10
|
+
missingConnection: {
|
|
11
|
+
cli: "Provide --url <sqlserver-url> (or set introspection.providerConfig.sqlserver.databaseUrl / ASKDB_INTROSPECT_SQLSERVER_URL / DATABASE_URL).",
|
|
12
|
+
config: "No SQL Server connection configured. Set introspection.providerConfig.sqlserver.databaseUrl in askdb.config.ts (bound to an env var in .env).",
|
|
13
|
+
},
|
|
14
|
+
fromExportUnsupported: "--from-export is currently supported only for --engine postgres (got sqlserver).",
|
|
15
|
+
createConnector: createSqlServerConnector,
|
|
16
|
+
createRunner: (url) => createSqlServerCatalogQueryRunner(url),
|
|
17
|
+
connectionLabelParts: parseSqlServerConnection,
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/connector/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,2BAA2B,CAAC;IACpE,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,YAAY;IACzB,UAAU,EAAE,sBAAsB;IAClC,cAAc,EAAE,kBAAkB;IAClC,iBAAiB,EAAE;QACjB,GAAG,EAAE,4IAA4I;QACjJ,MAAM,EACJ,+IAA+I;KAClJ;IACD,qBAAqB,EAAE,kFAAkF;IACzG,eAAe,EAAE,wBAAwB;IACzC,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iCAAiC,CAAC,GAAG,CAAC;IAC7D,oBAAoB,EAAE,wBAAwB;CAC/C,CAAC,CAAC"}
|
package/dist/exec/sqlserver.d.ts
CHANGED
|
@@ -1,11 +1,60 @@
|
|
|
1
1
|
import type { CatalogQueryRunner } from "@askdb/introspect";
|
|
2
|
+
import { type DriverLoadOptions } from "@askdb/introspect/kit";
|
|
2
3
|
export type { CatalogQueryResult, CatalogQueryRunner } from "@askdb/introspect";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
type MssqlModule = typeof import("mssql");
|
|
5
|
+
type MssqlDriverModule = MssqlModule;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve and cache the optional `mssql` peer driver, with the same lazy-import
|
|
8
|
+
* + project-root fallback behavior as the catalog runner.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadMssqlDriver(options?: DriverLoadOptions): Promise<MssqlDriverModule>;
|
|
11
|
+
export declare function isMssqlDriverInstalled(options?: DriverLoadOptions): boolean;
|
|
12
|
+
export type MssqlConfigInput = {
|
|
13
|
+
server: string;
|
|
14
|
+
port?: number;
|
|
15
|
+
database?: string;
|
|
16
|
+
user?: string;
|
|
17
|
+
password?: string;
|
|
18
|
+
options?: {
|
|
19
|
+
encrypt?: boolean;
|
|
20
|
+
trustServerCertificate?: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* mssql v12 uses @tediousjs/connection-string v1.x, which has two known gaps:
|
|
25
|
+
*
|
|
26
|
+
* 1. URL format (`mssql://…`, `sqlserver://…`) — the library is a pure ADO.NET
|
|
27
|
+
* key=value parser and silently produces an empty config, leaving `server`
|
|
28
|
+
* undefined. We detect these schemes and parse them into config objects.
|
|
29
|
+
*
|
|
30
|
+
* 2. ADO.NET multi-word keys with spaces — the library schema uses the no-space
|
|
31
|
+
* form (`trustservercertificate`) but ADO.NET client tools emit keys with
|
|
32
|
+
* spaces (`Trust Server Certificate`). After lowercasing by the parser these
|
|
33
|
+
* never match the schema, so options like TrustServerCertificate are silently
|
|
34
|
+
* dropped. We normalise the affected keys before passing the string to mssql.
|
|
35
|
+
*
|
|
36
|
+
* ADO.NET strings are identified as anything that is not a URL (no `://`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveConnectionInput(connectionString: string): string | MssqlConfigInput;
|
|
39
|
+
/**
|
|
40
|
+
* True when a Prisma-style `sqlserver://` string can be read more than one
|
|
41
|
+
* way, so a display label must not trust its parts: it has a `{` (an escape
|
|
42
|
+
* only around a whole value holding a `;`, while Prisma reads every `{…}` as
|
|
43
|
+
* one), a quote, a segment that
|
|
44
|
+
* isn't `key=value` (an unbraced `;` inside a value), an empty segment before
|
|
45
|
+
* another one, or an unclosed `{`. The connection still uses
|
|
46
|
+
* `parsePrismaSqlServerUrl`'s reading.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isPrismaSqlServerUrlAmbiguous(connectionString: string): boolean;
|
|
5
49
|
/**
|
|
6
50
|
* Build the built-in `mssql`-backed catalog query runner used by live SQL
|
|
7
|
-
* Server introspection.
|
|
8
|
-
*
|
|
51
|
+
* Server introspection. `connectionString` may be:
|
|
52
|
+
* - ADO.NET format: `Server=host,1433;Database=db;User Id=u;Password=p;`
|
|
53
|
+
* - `mssql://` URL: `mssql://user:pass@host:1433/database`
|
|
54
|
+
* - Prisma format: `sqlserver://host:1433;database=db;user=u;password=p`
|
|
55
|
+
*
|
|
56
|
+
* mssql v12+ only understands ADO.NET strings; URL formats are converted to a
|
|
57
|
+
* config object automatically.
|
|
9
58
|
*/
|
|
10
|
-
export declare function createSqlServerCatalogQueryRunner(connectionString: string): CatalogQueryRunner;
|
|
59
|
+
export declare function createSqlServerCatalogQueryRunner(connectionString: string, options?: DriverLoadOptions): CatalogQueryRunner;
|
|
11
60
|
//# 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;
|
|
1
|
+
{"version":3,"file":"sqlserver.d.ts","s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} from "@askdb/core";
|
|
2
|
+
import { createOptionalDriverLoader, rethrowDriverImportError, isDriverInstalled, missingDriverMessage, } from "@askdb/introspect/kit";
|
|
2
3
|
/**
|
|
3
4
|
* Lazily resolve the optional `mssql` peer dependency. Mirrors the lazy-load
|
|
4
5
|
* pattern in `@askdb/postgres` / `@askdb/mysql` so consumers with a custom
|
|
5
6
|
* `CatalogQueryRunner` can import `@askdb/sqlserver` without `mssql` installed.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const mssqlLoader = createOptionalDriverLoader({
|
|
9
|
+
packageName: "mssql",
|
|
10
|
+
importDriver: () => import("mssql").catch(rethrowDriverImportError),
|
|
11
|
+
missingMessage: missingDriverMessage({ engine: "SQL Server", packageName: "mssql" }),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Resolve and cache the optional `mssql` peer driver, with the same lazy-import
|
|
15
|
+
* + project-root fallback behavior as the catalog runner.
|
|
16
|
+
*/
|
|
17
|
+
export async function loadMssqlDriver(options) {
|
|
18
|
+
const mod = await mssqlLoader.load(options);
|
|
19
|
+
return mod.default ?? mod;
|
|
20
|
+
}
|
|
21
|
+
export function isMssqlDriverInstalled(options) {
|
|
22
|
+
return isDriverInstalled("mssql", options);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* mssql v12 uses @tediousjs/connection-string v1.x, which has two known gaps:
|
|
26
|
+
*
|
|
27
|
+
* 1. URL format (`mssql://…`, `sqlserver://…`) — the library is a pure ADO.NET
|
|
28
|
+
* key=value parser and silently produces an empty config, leaving `server`
|
|
29
|
+
* undefined. We detect these schemes and parse them into config objects.
|
|
30
|
+
*
|
|
31
|
+
* 2. ADO.NET multi-word keys with spaces — the library schema uses the no-space
|
|
32
|
+
* form (`trustservercertificate`) but ADO.NET client tools emit keys with
|
|
33
|
+
* spaces (`Trust Server Certificate`). After lowercasing by the parser these
|
|
34
|
+
* never match the schema, so options like TrustServerCertificate are silently
|
|
35
|
+
* dropped. We normalise the affected keys before passing the string to mssql.
|
|
36
|
+
*
|
|
37
|
+
* ADO.NET strings are identified as anything that is not a URL (no `://`).
|
|
38
|
+
*/
|
|
39
|
+
export function resolveConnectionInput(connectionString) {
|
|
40
|
+
if (connectionString.startsWith("mssql://")) {
|
|
41
|
+
return parseMssqlSchemeUrl(connectionString);
|
|
42
|
+
}
|
|
43
|
+
if (connectionString.startsWith("sqlserver://")) {
|
|
44
|
+
return parsePrismaSqlServerUrl(connectionString);
|
|
45
|
+
}
|
|
46
|
+
// ADO.NET string: normalise multi-word keys that @tediousjs/connection-string
|
|
47
|
+
// v1.x does not recognise in their spaced form.
|
|
48
|
+
if (!connectionString.includes("://")) {
|
|
49
|
+
return normalizeAdoNetString(connectionString);
|
|
50
|
+
}
|
|
51
|
+
return connectionString;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @tediousjs/connection-string v1.x schema uses camelCase/no-space forms as
|
|
55
|
+
* keys, but ADO.NET clients (VS Code mssql, SSMS) emit the space-separated
|
|
56
|
+
* forms. Map each affected key to the form the schema actually recognises.
|
|
57
|
+
*/
|
|
58
|
+
const ADO_NET_KEY_NORMALISATIONS = [
|
|
59
|
+
[/Trust\s+Server\s+Certificate\s*=/gi, "TrustServerCertificate="],
|
|
60
|
+
[/Application\s+Intent\s*=/gi, "ApplicationIntent="],
|
|
61
|
+
[/Multiple\s+Active\s+Result\s+Sets\s*=/gi, "MultipleActiveResultSets="],
|
|
62
|
+
[/Connect\s+Retry\s+Count\s*=/gi, "ConnectRetryCount="],
|
|
63
|
+
[/Connect\s+Retry\s+Interval\s*=/gi, "ConnectRetryInterval="],
|
|
64
|
+
[/Transparent\s+Network\s+IP\s+Resolution\s*=/gi, "TransparentNetworkIpResolution="],
|
|
65
|
+
];
|
|
66
|
+
function normalizeAdoNetString(connectionString) {
|
|
67
|
+
let result = connectionString;
|
|
68
|
+
for (const [pattern, replacement] of ADO_NET_KEY_NORMALISATIONS) {
|
|
69
|
+
result = result.replace(pattern, replacement);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
function parseMssqlSchemeUrl(connectionString) {
|
|
74
|
+
const url = new URL(connectionString);
|
|
75
|
+
const server = url.hostname;
|
|
76
|
+
if (!server) {
|
|
77
|
+
throw new AskDbError("Cannot parse server hostname from SQL Server connection URL. " +
|
|
78
|
+
"Expected format: mssql://USER:PASSWORD@HOST:PORT/DATABASE");
|
|
79
|
+
}
|
|
80
|
+
const port = url.port ? parseInt(url.port, 10) : undefined;
|
|
81
|
+
const database = url.pathname.length > 1 ? url.pathname.slice(1) : undefined;
|
|
82
|
+
const user = url.username ? decodeURIComponent(url.username) : undefined;
|
|
83
|
+
const password = url.password ? decodeURIComponent(url.password) : undefined;
|
|
84
|
+
const encrypt = url.searchParams.get("encrypt");
|
|
85
|
+
const trustCert = url.searchParams.get("trustServerCertificate") ?? url.searchParams.get("TrustServerCertificate");
|
|
86
|
+
return {
|
|
87
|
+
server,
|
|
88
|
+
...(port !== undefined && !Number.isNaN(port) ? { port } : {}),
|
|
89
|
+
...(database ? { database } : {}),
|
|
90
|
+
...(user ? { user } : {}),
|
|
91
|
+
...(password ? { password } : {}),
|
|
92
|
+
options: {
|
|
93
|
+
...(encrypt !== null ? { encrypt: !["false", "0", "no"].includes(encrypt.toLowerCase()) } : {}),
|
|
94
|
+
...(trustCert !== null ? { trustServerCertificate: !["false", "0", "no"].includes(trustCert.toLowerCase()) } : {}),
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Parse Prisma's SQL Server connection URL,
|
|
100
|
+
* `sqlserver://HOST[:PORT][;key=value…]`.
|
|
101
|
+
*
|
|
102
|
+
* Backward compatible with the parser this replaces for every string it could
|
|
103
|
+
* read: it connects with exactly the same values as before. Segments are split on `;`,
|
|
104
|
+
* a key ends at its first `=` (so `password=a=b` is `a=b`), keys are trimmed
|
|
105
|
+
* and lower-cased, values are trimmed, non-ASCII is fine, a segment without
|
|
106
|
+
* `=` or with an empty key or value is skipped, and a later key replaces an
|
|
107
|
+
* earlier one. The host part ends at its last `:`, and a port that isn't a
|
|
108
|
+
* number is ignored.
|
|
109
|
+
*
|
|
110
|
+
* On top of that it reads Prisma's `{…}` escaping (Prisma's SQL Server docs:
|
|
111
|
+
* "If your credentials contain `: \ = ; / [ ] { }`, wrap values in curly
|
|
112
|
+
* braces", e.g. `password={Pass:Word;}`), but only where the old parser never
|
|
113
|
+
* read the value as written: a value that starts with `{`, has a `;` before its
|
|
114
|
+
* first `}`, and ends at a `}` whose `;`-separated piece holds no `=`. The old
|
|
115
|
+
* parser cut such a value at its first `;` and dropped that last piece (a piece
|
|
116
|
+
* without `=` is skipped), so it never connected with the value the user wrote.
|
|
117
|
+
* The value is everything between the braces, read verbatim, so `;`, `=` and
|
|
118
|
+
* braces inside it are part of it (`{{a;b}}` is `{a;b}`); it ends at the first
|
|
119
|
+
* `}` followed only by blanks and then `;` or the end of the string.
|
|
120
|
+
*
|
|
121
|
+
* Any other `{` or `}` is a plain character, as before: `password={abc}` is
|
|
122
|
+
* `{abc}`, and an unclosed `{` is part of the value. Braces that close before
|
|
123
|
+
* any `;` never reach into a later value (`password={ab}cd;user={me}` reads
|
|
124
|
+
* `{ab}cd` and `{me}`), and neither does a `{` whose closing `}` ends a later
|
|
125
|
+
* `key=value` piece (`password={Xy7;user={me}` reads `{Xy7` and `{me}`).
|
|
126
|
+
* This is where it differs from Prisma, which reads every `{…}` as an escape
|
|
127
|
+
* (`{abc}` is `abc`) and ends it at the first `}`.
|
|
128
|
+
*
|
|
129
|
+
* Prisma's credential aliases are read (`username` and `uid` for `user`,
|
|
130
|
+
* `pwd` for `password`) only when the canonical key is absent: the old parser
|
|
131
|
+
* dropped them, so such a string had no credentials, and where the canonical
|
|
132
|
+
* key is present it still wins. `initial catalog` is not, because the old parser ignored it and
|
|
133
|
+
* the connection used the login's default database; reading it now would
|
|
134
|
+
* change where a working string connects.
|
|
135
|
+
*/
|
|
136
|
+
function parsePrismaSqlServerUrl(connectionString) {
|
|
137
|
+
const segments = splitPrismaSegments(connectionString.slice("sqlserver://".length));
|
|
138
|
+
const hostPart = unbrace(segments[0]);
|
|
139
|
+
const colonIdx = hostPart.lastIndexOf(":");
|
|
140
|
+
const server = colonIdx === -1 ? hostPart : hostPart.slice(0, colonIdx);
|
|
141
|
+
const portStr = colonIdx === -1 ? undefined : hostPart.slice(colonIdx + 1);
|
|
142
|
+
const port = portStr ? parseInt(portStr, 10) : undefined;
|
|
143
|
+
if (!server) {
|
|
144
|
+
throw new AskDbError("Cannot parse server hostname from Prisma-style SQL Server URL. " +
|
|
145
|
+
"Expected: sqlserver://HOST:PORT;database=DATABASE;user=USER;password=PASSWORD");
|
|
146
|
+
}
|
|
147
|
+
const params = {};
|
|
148
|
+
for (const segment of segments.slice(1)) {
|
|
149
|
+
const eq = segment.findIndex((piece) => !piece.braced && piece.text.includes("="));
|
|
150
|
+
if (eq === -1)
|
|
151
|
+
continue;
|
|
152
|
+
const split = segment[eq].text.indexOf("=");
|
|
153
|
+
const keyPieces = [...segment.slice(0, eq), { braced: false, text: segment[eq].text.slice(0, split) }];
|
|
154
|
+
const valuePieces = [{ braced: false, text: segment[eq].text.slice(split + 1) }, ...segment.slice(eq + 1)];
|
|
155
|
+
const key = unbrace(keyPieces).trim().toLowerCase();
|
|
156
|
+
const value = trimUnbraced(valuePieces);
|
|
157
|
+
if (key && value)
|
|
158
|
+
params[key] = value;
|
|
15
159
|
}
|
|
16
|
-
|
|
160
|
+
// The canonical key wins, as it did when the aliases were ignored; an alias
|
|
161
|
+
// is used only when the canonical key is absent.
|
|
162
|
+
const pick = (...keys) => keys.map((key) => params[key]).find((value) => value !== undefined);
|
|
163
|
+
const database = params["database"];
|
|
164
|
+
const user = pick("user", "username", "uid");
|
|
165
|
+
const password = pick("password", "pwd");
|
|
166
|
+
return {
|
|
167
|
+
server,
|
|
168
|
+
...(port !== undefined && !Number.isNaN(port) ? { port } : {}),
|
|
169
|
+
...(database ? { database } : {}),
|
|
170
|
+
...(user ? { user } : {}),
|
|
171
|
+
...(password ? { password } : {}),
|
|
172
|
+
options: {
|
|
173
|
+
...(params["encrypt"] !== undefined ? { encrypt: params["encrypt"].toLowerCase() === "true" } : {}),
|
|
174
|
+
...(params["trustservercertificate"] !== undefined
|
|
175
|
+
? { trustServerCertificate: params["trustservercertificate"].toLowerCase() === "true" }
|
|
176
|
+
: {}),
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* True when a Prisma-style `sqlserver://` string can be read more than one
|
|
182
|
+
* way, so a display label must not trust its parts: it has a `{` (an escape
|
|
183
|
+
* only around a whole value holding a `;`, while Prisma reads every `{…}` as
|
|
184
|
+
* one), a quote, a segment that
|
|
185
|
+
* isn't `key=value` (an unbraced `;` inside a value), an empty segment before
|
|
186
|
+
* another one, or an unclosed `{`. The connection still uses
|
|
187
|
+
* `parsePrismaSqlServerUrl`'s reading.
|
|
188
|
+
*/
|
|
189
|
+
export function isPrismaSqlServerUrlAmbiguous(connectionString) {
|
|
190
|
+
const rest = connectionString.slice("sqlserver://".length);
|
|
191
|
+
if (/[{'"]/.test(rest))
|
|
192
|
+
return true;
|
|
193
|
+
const segments = rest.split(";").slice(1);
|
|
194
|
+
return segments.some((segment, i) => {
|
|
195
|
+
const last = i === segments.length - 1;
|
|
196
|
+
if (segment.trim() === "")
|
|
197
|
+
return !last;
|
|
198
|
+
return !segment.includes("=");
|
|
199
|
+
});
|
|
17
200
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Split on `;` outside an escaping `{…}`; each segment keeps its braced and
|
|
203
|
+
* plain pieces. A value is an escape (see `parsePrismaSqlServerUrl`) when it
|
|
204
|
+
* starts with `{` (after `key=` and blanks), has a `;` before its first `}`,
|
|
205
|
+
* and ends at a `}` followed only by blanks before the next `;` or the end of
|
|
206
|
+
* the string. Everything else, including the host part, splits on every `;`.
|
|
207
|
+
*/
|
|
208
|
+
function splitPrismaSegments(input) {
|
|
209
|
+
const hostEnd = input.indexOf(";");
|
|
210
|
+
if (hostEnd === -1)
|
|
211
|
+
return [[{ braced: false, text: input }]];
|
|
212
|
+
const segments = [[{ braced: false, text: input.slice(0, hostEnd) }]];
|
|
213
|
+
let pos = hostEnd + 1;
|
|
214
|
+
while (pos <= input.length) {
|
|
215
|
+
const next = input.indexOf(";", pos);
|
|
216
|
+
const end = next === -1 ? input.length : next;
|
|
217
|
+
const escape = escapedValue(input, pos, end);
|
|
218
|
+
if (escape) {
|
|
219
|
+
segments.push([
|
|
220
|
+
{ braced: false, text: input.slice(pos, escape.open) },
|
|
221
|
+
{ braced: true, text: input.slice(escape.open + 1, escape.close) },
|
|
222
|
+
{ braced: false, text: input.slice(escape.close + 1, escape.end) },
|
|
223
|
+
].filter((piece) => piece.braced || piece.text !== ""));
|
|
224
|
+
pos = escape.end + 1;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
segments.push(end > pos ? [{ braced: false, text: input.slice(pos, end) }] : []);
|
|
228
|
+
pos = end + 1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return segments;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The escaping `{…}` of the segment starting at `start` (whose first `;` is at
|
|
235
|
+
* `firstSemi`), or `undefined`: the value must start with `{`, a `;` must come
|
|
236
|
+
* before the first `}` after it, the first `}` followed only by blanks and then
|
|
237
|
+
* `;` or the end of the input closes it, and the `;`-separated piece that `}`
|
|
238
|
+
* ends must hold no `=` (the old parser skipped that piece).
|
|
239
|
+
*/
|
|
240
|
+
function escapedValue(input, start, firstSemi) {
|
|
241
|
+
const eq = input.indexOf("=", start);
|
|
242
|
+
if (eq === -1 || eq >= firstSemi)
|
|
243
|
+
return undefined;
|
|
244
|
+
let open = eq + 1;
|
|
245
|
+
while (input[open] === " " || input[open] === "\t")
|
|
246
|
+
open++;
|
|
247
|
+
if (input[open] !== "{")
|
|
248
|
+
return undefined;
|
|
249
|
+
// A `}` before the value's first `;` means the braces wrap no `;`: plain text.
|
|
250
|
+
const firstClose = input.indexOf("}", open + 1);
|
|
251
|
+
if (firstClose === -1 || firstClose < firstSemi)
|
|
252
|
+
return undefined;
|
|
253
|
+
const closing = /\}[ \t]*(?:;|$)/g;
|
|
254
|
+
closing.lastIndex = open + 1;
|
|
255
|
+
const match = closing.exec(input);
|
|
256
|
+
if (!match)
|
|
257
|
+
return undefined;
|
|
258
|
+
const close = match.index;
|
|
259
|
+
// The piece the `}` ends is a `key=value` the old parser read: plain text.
|
|
260
|
+
if (input.slice(input.lastIndexOf(";", close) + 1, close).includes("="))
|
|
261
|
+
return undefined;
|
|
262
|
+
const end = match[0].endsWith(";") ? close + match[0].length - 1 : input.length;
|
|
263
|
+
return { open, close, end };
|
|
264
|
+
}
|
|
265
|
+
function unbrace(pieces) {
|
|
266
|
+
return pieces.map((piece) => piece.text).join("");
|
|
267
|
+
}
|
|
268
|
+
/** Join the pieces, trimming whitespace only from unbraced text at either end. */
|
|
269
|
+
function trimUnbraced(pieces) {
|
|
270
|
+
const copy = pieces.map((piece) => ({ ...piece }));
|
|
271
|
+
while (copy.length > 0 && !copy[0].braced) {
|
|
272
|
+
copy[0].text = copy[0].text.trimStart();
|
|
273
|
+
if (copy[0].text !== "")
|
|
274
|
+
break;
|
|
275
|
+
copy.shift();
|
|
276
|
+
}
|
|
277
|
+
while (copy.length > 0 && !copy[copy.length - 1].braced) {
|
|
278
|
+
const last = copy[copy.length - 1];
|
|
279
|
+
last.text = last.text.trimEnd();
|
|
280
|
+
if (last.text !== "")
|
|
281
|
+
break;
|
|
282
|
+
copy.pop();
|
|
283
|
+
}
|
|
284
|
+
return unbrace(copy);
|
|
21
285
|
}
|
|
22
|
-
async function runSqlServerCatalogQuery(connectionString, sql, params) {
|
|
23
|
-
const mod = await
|
|
286
|
+
async function runSqlServerCatalogQuery(connectionString, sql, params, options) {
|
|
287
|
+
const mod = await mssqlLoader.load(options);
|
|
24
288
|
const mssql = mod.default ?? mod;
|
|
25
|
-
const pool = new mssql.ConnectionPool(connectionString);
|
|
289
|
+
const pool = new mssql.ConnectionPool(resolveConnectionInput(connectionString));
|
|
26
290
|
await pool.connect();
|
|
27
291
|
try {
|
|
28
292
|
const request = pool.request();
|
|
@@ -51,10 +315,15 @@ async function runSqlServerCatalogQuery(connectionString, sql, params) {
|
|
|
51
315
|
}
|
|
52
316
|
/**
|
|
53
317
|
* Build the built-in `mssql`-backed catalog query runner used by live SQL
|
|
54
|
-
* Server introspection.
|
|
55
|
-
*
|
|
318
|
+
* Server introspection. `connectionString` may be:
|
|
319
|
+
* - ADO.NET format: `Server=host,1433;Database=db;User Id=u;Password=p;`
|
|
320
|
+
* - `mssql://` URL: `mssql://user:pass@host:1433/database`
|
|
321
|
+
* - Prisma format: `sqlserver://host:1433;database=db;user=u;password=p`
|
|
322
|
+
*
|
|
323
|
+
* mssql v12+ only understands ADO.NET strings; URL formats are converted to a
|
|
324
|
+
* config object automatically.
|
|
56
325
|
*/
|
|
57
|
-
export function createSqlServerCatalogQueryRunner(connectionString) {
|
|
58
|
-
return (sql, params) => runSqlServerCatalogQuery(connectionString, sql, params);
|
|
326
|
+
export function createSqlServerCatalogQueryRunner(connectionString, options) {
|
|
327
|
+
return (sql, params) => runSqlServerCatalogQuery(connectionString, sql, params, options);
|
|
59
328
|
}
|
|
60
329
|
//# sourceMappingURL=sqlserver.js.map
|
|
@@ -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,I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A2B;IAE3B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3F,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { SQLSERVER_DIALECT, type DialectSpec as SqlServerDialect, } from "@askdb/core";
|
|
9
9
|
export { createSqlServerConnector, describeSqlServer, SQLSERVER_CATALOG_SQL, type DescribeSqlServerInput, type SqlServerIntrospectionInput, } from "./connector/index.js";
|
|
10
|
-
export { createSqlServerCatalogQueryRunner, type CatalogQueryResult, type CatalogQueryRunner, } from "./exec/sqlserver.js";
|
|
10
|
+
export { createSqlServerCatalogQueryRunner, loadMssqlDriver, isMssqlDriverInstalled, resolveConnectionInput, type CatalogQueryResult, type CatalogQueryRunner, type MssqlConfigInput, } from "./exec/sqlserver.js";
|
|
11
|
+
export { sqlServerConnectorProvider } from "./connector/provider.js";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,IAAI,gBAAgB,GACrC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,GACjC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,iCAAiC,EACjC,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,IAAI,gBAAgB,GACrC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,GACjC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { SQLSERVER_DIALECT, } from "@askdb/core";
|
|
9
9
|
export { createSqlServerConnector, describeSqlServer, SQLSERVER_CATALOG_SQL, } from "./connector/index.js";
|
|
10
|
-
export { createSqlServerCatalogQueryRunner, } from "./exec/sqlserver.js";
|
|
10
|
+
export { createSqlServerCatalogQueryRunner, loadMssqlDriver, isMssqlDriverInstalled, resolveConnectionInput, } from "./exec/sqlserver.js";
|
|
11
|
+
export { sqlServerConnectorProvider } from "./connector/provider.js";
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,GAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,GAGtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,iCAAiC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,GAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,GAGtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GAIvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/label.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ConnectionLabelParts } from "@askdb/introspect/kit";
|
|
2
|
+
/**
|
|
3
|
+
* The display-safe parts of a SQL Server connection string, read by the same
|
|
4
|
+
* code the connection uses — never a reimplementation of the grammar
|
|
5
|
+
* (ADR 0011):
|
|
6
|
+
*
|
|
7
|
+
* - `resolveConnectionInput()` turns `mssql://…` and Prisma's
|
|
8
|
+
* `sqlserver://host:port;key=value` form into `{ server, port, database }`
|
|
9
|
+
* (the latter backward compatible, plus Prisma's `{…}` escapes where they wrap a `;`), and hands
|
|
10
|
+
* ADO.NET strings to `mssql`;
|
|
11
|
+
* - `mssql` parses ADO.NET strings with `@tediousjs/connection-string`
|
|
12
|
+
* (`parse(…).toSchema(MSSQL_SCHEMA)`), then splits `data source` into
|
|
13
|
+
* server, instance and port. The split below mirrors that step; a
|
|
14
|
+
* differential test checks the result against `mssql`'s own
|
|
15
|
+
* `ConnectionPool.parseConnectionString`.
|
|
16
|
+
*
|
|
17
|
+
* Returns `undefined` (the registry labels it `configured sqlserver
|
|
18
|
+
* connection`) when a parser throws, when there is no server, for a named
|
|
19
|
+
* instance or named pipe, for any other scheme, for an `@` in the
|
|
20
|
+
* `sqlserver://` form (it has no userinfo) or a `sqlserver://` string that can be
|
|
21
|
+
* read more than one way (`isPrismaSqlServerUrlAmbiguous`), and for an `@` or `#` after the
|
|
22
|
+
* host of an `mssql://` URL (a password containing `/`, `?` or `#` is split
|
|
23
|
+
* there). `formatConnectionLabel`'s allowlist is the second check.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseSqlServerConnection(input: string): ConnectionLabelParts | undefined;
|
|
26
|
+
//# sourceMappingURL=label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../src/label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAmBxF"}
|
package/dist/label.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { MSSQL_SCHEMA, parse } from "@tediousjs/connection-string";
|
|
2
|
+
import { isPrismaSqlServerUrlAmbiguous, resolveConnectionInput } from "./exec/sqlserver.js";
|
|
3
|
+
/**
|
|
4
|
+
* The display-safe parts of a SQL Server connection string, read by the same
|
|
5
|
+
* code the connection uses — never a reimplementation of the grammar
|
|
6
|
+
* (ADR 0011):
|
|
7
|
+
*
|
|
8
|
+
* - `resolveConnectionInput()` turns `mssql://…` and Prisma's
|
|
9
|
+
* `sqlserver://host:port;key=value` form into `{ server, port, database }`
|
|
10
|
+
* (the latter backward compatible, plus Prisma's `{…}` escapes where they wrap a `;`), and hands
|
|
11
|
+
* ADO.NET strings to `mssql`;
|
|
12
|
+
* - `mssql` parses ADO.NET strings with `@tediousjs/connection-string`
|
|
13
|
+
* (`parse(…).toSchema(MSSQL_SCHEMA)`), then splits `data source` into
|
|
14
|
+
* server, instance and port. The split below mirrors that step; a
|
|
15
|
+
* differential test checks the result against `mssql`'s own
|
|
16
|
+
* `ConnectionPool.parseConnectionString`.
|
|
17
|
+
*
|
|
18
|
+
* Returns `undefined` (the registry labels it `configured sqlserver
|
|
19
|
+
* connection`) when a parser throws, when there is no server, for a named
|
|
20
|
+
* instance or named pipe, for any other scheme, for an `@` in the
|
|
21
|
+
* `sqlserver://` form (it has no userinfo) or a `sqlserver://` string that can be
|
|
22
|
+
* read more than one way (`isPrismaSqlServerUrlAmbiguous`), and for an `@` or `#` after the
|
|
23
|
+
* host of an `mssql://` URL (a password containing `/`, `?` or `#` is split
|
|
24
|
+
* there). `formatConnectionLabel`'s allowlist is the second check.
|
|
25
|
+
*/
|
|
26
|
+
export function parseSqlServerConnection(input) {
|
|
27
|
+
let resolved;
|
|
28
|
+
try {
|
|
29
|
+
resolved = resolveConnectionInput(input);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (typeof resolved === "string") {
|
|
35
|
+
return resolved.includes("://") ? undefined : adoNetParts(resolved);
|
|
36
|
+
}
|
|
37
|
+
if (input.startsWith("sqlserver://") && (input.includes("@") || isPrismaSqlServerUrlAmbiguous(input))) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
if (input.startsWith("mssql://") && !mssqlUrlIsUnambiguous(input))
|
|
41
|
+
return undefined;
|
|
42
|
+
return partsWithHost({
|
|
43
|
+
host: resolved.server,
|
|
44
|
+
port: resolved.port === undefined ? undefined : String(resolved.port),
|
|
45
|
+
database: resolved.database,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function mssqlUrlIsUnambiguous(input) {
|
|
49
|
+
const url = new URL(input);
|
|
50
|
+
return url.hash === "" && !`${url.pathname}${url.search}`.includes("@");
|
|
51
|
+
}
|
|
52
|
+
function adoNetParts(connectionString) {
|
|
53
|
+
let schema;
|
|
54
|
+
try {
|
|
55
|
+
schema = parse(connectionString).toSchema(MSSQL_SCHEMA);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const dataSource = schema["data source"];
|
|
61
|
+
const database = schema["initial catalog"];
|
|
62
|
+
if (typeof dataSource !== "string" || (database !== undefined && typeof database !== "string")) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
// mssql's `data source` handling: `np:` is rejected, `tcp:` stripped,
|
|
66
|
+
// `server\instance` names an instance, `server,port` sets the port.
|
|
67
|
+
if (/^np:/i.test(dataSource))
|
|
68
|
+
return undefined;
|
|
69
|
+
const address = dataSource.replace(/^tcp:/i, "");
|
|
70
|
+
if (address.includes("\\"))
|
|
71
|
+
return undefined;
|
|
72
|
+
// Trimmed only around a `,port`, as mssql does: `tcp: leak` keeps its space.
|
|
73
|
+
const comma = /^(.*),(.*)$/.exec(address);
|
|
74
|
+
const server = comma ? comma[1].trim() : address;
|
|
75
|
+
const port = comma ? comma[2].trim() : undefined;
|
|
76
|
+
const host = server === "." || /^\((local|\.|localdb)\)$/i.test(server) ? "localhost" : server;
|
|
77
|
+
return partsWithHost({ host, port, database });
|
|
78
|
+
}
|
|
79
|
+
/** The parts, or `undefined` (the fallback label) when there is no host: `Server=;Database=app` falls back rather than showing `sqlserver:///app`. */
|
|
80
|
+
function partsWithHost({ host, port, database, }) {
|
|
81
|
+
if (host === "")
|
|
82
|
+
return undefined;
|
|
83
|
+
return {
|
|
84
|
+
host,
|
|
85
|
+
...(port !== undefined && port !== "" ? { port } : {}),
|
|
86
|
+
...(database !== undefined && database !== "" ? { database } : {}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../src/label.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa;IACpD,IAAI,QAAmD,CAAC;IACxD,IAAI,CAAC;QACH,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,QA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SAAS,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askdb/sqlserver",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.20",
|
|
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",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"schema-v2",
|
|
13
13
|
"introspection"
|
|
14
14
|
],
|
|
15
|
-
"homepage": "https://
|
|
15
|
+
"homepage": "https://askdb.tools/guides/switch-engines/",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/Ygilany/AskDB/issues"
|
|
18
18
|
},
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"author": "Yahya Gilany",
|
|
26
26
|
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
27
28
|
"main": "./dist/index.js",
|
|
28
29
|
"types": "./dist/index.d.ts",
|
|
29
30
|
"exports": {
|
|
30
31
|
".": {
|
|
31
32
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.js"
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
"files": [
|
|
@@ -39,14 +41,15 @@
|
|
|
39
41
|
"NOTICE"
|
|
40
42
|
],
|
|
41
43
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
44
|
+
"node": ">=22.23.4"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
|
-
"@askdb/core": "0.
|
|
46
|
-
"@askdb/introspect": "0.3.0-beta.
|
|
47
|
+
"@askdb/core": "1.0.0-beta.44",
|
|
48
|
+
"@askdb/introspect": "0.3.0-beta.18",
|
|
49
|
+
"@tediousjs/connection-string": "^1.1.0"
|
|
47
50
|
},
|
|
48
51
|
"peerDependencies": {
|
|
49
|
-
"mssql": ">=
|
|
52
|
+
"mssql": ">=12"
|
|
50
53
|
},
|
|
51
54
|
"peerDependenciesMeta": {
|
|
52
55
|
"mssql": {
|
|
@@ -54,10 +57,10 @@
|
|
|
54
57
|
}
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@types/mssql": "^
|
|
58
|
-
"mssql": "^
|
|
59
|
-
"typescript": "^
|
|
60
|
-
"vitest": "^
|
|
60
|
+
"@types/mssql": "^12.3.0",
|
|
61
|
+
"mssql": "^12.7.13",
|
|
62
|
+
"typescript": "^6.0.3",
|
|
63
|
+
"vitest": "^5.0.5"
|
|
61
64
|
},
|
|
62
65
|
"scripts": {
|
|
63
66
|
"build": "tsc -p tsconfig.build.json",
|
package/dist/connector/glob.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/connector/glob.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC;AAE7D,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,GAC1C,WAAW,CAIb"}
|
package/dist/connector/glob.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** Minimal glob matcher — identical to the postgres / mysql / sqlite connectors. */
|
|
2
|
-
function compileGlob(pattern) {
|
|
3
|
-
let out = "^";
|
|
4
|
-
for (const ch of pattern) {
|
|
5
|
-
if (ch === "*")
|
|
6
|
-
out += ".*";
|
|
7
|
-
else if (ch === "?")
|
|
8
|
-
out += ".";
|
|
9
|
-
else if (/[.+^${}()|[\]\\]/.test(ch))
|
|
10
|
-
out += "\\" + ch;
|
|
11
|
-
else
|
|
12
|
-
out += ch;
|
|
13
|
-
}
|
|
14
|
-
out += "$";
|
|
15
|
-
return new RegExp(out);
|
|
16
|
-
}
|
|
17
|
-
export function compileTableFilters(patterns) {
|
|
18
|
-
if (!patterns || patterns.length === 0)
|
|
19
|
-
return () => true;
|
|
20
|
-
const compiled = patterns.map(compileGlob);
|
|
21
|
-
return (qualifiedName) => compiled.some((re) => re.test(qualifiedName));
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=glob.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/connector/glob.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,SAAS,WAAW,CAAC,OAAe;IAClC,IAAI,GAAG,GAAG,GAAG,CAAC;IACd,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,EAAE,KAAK,GAAG;YAAE,GAAG,IAAI,IAAI,CAAC;aACvB,IAAI,EAAE,KAAK,GAAG;YAAE,GAAG,IAAI,GAAG,CAAC;aAC3B,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;;YAClD,GAAG,IAAI,EAAE,CAAC;IACjB,CAAC;IACD,GAAG,IAAI,GAAG,CAAC;IACX,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAID,MAAM,UAAU,mBAAmB,CACjC,QAA2C;IAE3C,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IAC1D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/connector/ids.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** Schema v2 ID conventions — aligned with the postgres / mysql / sqlite connectors. */
|
|
2
|
-
export declare function makeTableId(schemaName: string, tableName: string): string;
|
|
3
|
-
export declare function makeColumnId(schemaName: string, tableName: string, columnName: string): string;
|
|
4
|
-
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/connector/ids.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER"}
|
package/dist/connector/ids.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Schema v2 ID conventions — aligned with the postgres / mysql / sqlite connectors. */
|
|
2
|
-
export function makeTableId(schemaName, tableName) {
|
|
3
|
-
return `table:${schemaName}.${tableName}`;
|
|
4
|
-
}
|
|
5
|
-
export function makeColumnId(schemaName, tableName, columnName) {
|
|
6
|
-
return `table:${schemaName}.${tableName}#${columnName}`;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=ids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/connector/ids.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,UAAkB,EAAE,SAAiB;IAC/D,OAAO,SAAS,UAAU,IAAI,SAAS,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,UAAkB,EAClB,SAAiB,EACjB,UAAkB;IAElB,OAAO,SAAS,UAAU,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;AAC1D,CAAC"}
|