@askdb/mysql 0.1.0-beta.18 → 0.1.0-beta.19
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 +7 -3
- package/dist/connector/describe.d.ts +2 -73
- package/dist/connector/describe.d.ts.map +1 -1
- package/dist/connector/describe.js +71 -98
- package/dist/connector/describe.js.map +1 -1
- package/dist/connector/provider.d.ts +1 -2
- package/dist/connector/provider.d.ts.map +1 -1
- package/dist/connector/provider.js +14 -15
- package/dist/connector/provider.js.map +1 -1
- package/dist/exec/mysql.d.ts +1 -10
- package/dist/exec/mysql.d.ts.map +1 -1
- package/dist/exec/mysql.js +15 -65
- package/dist/exec/mysql.js.map +1 -1
- package/dist/label.d.ts +17 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +37 -0
- package/dist/label.js.map +1 -0
- package/package.json +6 -7
- package/dist/connector/glob.d.ts +0 -3
- package/dist/connector/glob.d.ts.map +0 -1
- package/dist/connector/glob.js +0 -27
- package/dist/connector/glob.js.map +0 -1
- package/dist/connector/ids.d.ts +0 -9
- package/dist/connector/ids.d.ts.map +0 -1
- package/dist/connector/ids.js +0 -13
- package/dist/connector/ids.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,9 +9,11 @@ MySQL / MariaDB integration for AskDB. Bundles three pieces:
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
pnpm add @askdb/core @askdb/introspect @askdb/mysql
|
|
12
|
+
pnpm add @askdb/core @askdb/introspect @askdb/mysql 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
|
`mysql2` is an **optional peer dependency** — install it only when using live introspection mode:
|
|
16
18
|
|
|
17
19
|
```bash
|
|
@@ -58,7 +60,7 @@ const result = await introspect(
|
|
|
58
60
|
);
|
|
59
61
|
```
|
|
60
62
|
|
|
61
|
-
By default the connector reads the connection URL's database and renders it under the `public` namespace. To introspect several databases, list them in `filters.schemas`. Each database then becomes its own namespace, and foreign keys
|
|
63
|
+
By default the connector reads the connection URL's database and renders it under the `public` namespace. In that mode the connection string must name a database (`mysql://user:pass@host:3306/<database>`); introspection throws a clear error when the connection has no default database instead of returning an empty schema. To introspect several databases, list them in `filters.schemas`. Each database then becomes its own namespace, and foreign keys into another listed database keep the referenced database:
|
|
62
64
|
|
|
63
65
|
```ts
|
|
64
66
|
await introspect(
|
|
@@ -74,9 +76,11 @@ await introspect(
|
|
|
74
76
|
|
|
75
77
|
With the `askdb` CLI, set `introspection.schemas` in `askdb.config.ts`, or pass `--schemas app,sales`.
|
|
76
78
|
|
|
79
|
+
`mysqlConnectorProvider` 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 of a `mysql://` URL, read the way `mysql2` reads it (WHATWG `URL`; `mysql://root:S3cret@db:3306/shop` → `mysql://db:3306/shop`). Anything else becomes `configured mysql connection`.
|
|
80
|
+
|
|
77
81
|
## Captured metadata
|
|
78
82
|
|
|
79
|
-
Tables, views, columns (MySQL-native type strings), primary keys, unique constraints, foreign keys (with referential actions), and indexes.
|
|
83
|
+
Tables, views, columns (MySQL-native type strings), primary keys, unique constraints, foreign keys (with referential actions), and indexes. Only the connection's database, or the databases listed in `filters.schemas`, is introspected: foreign keys that reference a table in any other database are omitted and reported as a `cross_database_fk` warning.
|
|
80
84
|
|
|
81
85
|
## License
|
|
82
86
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { CatalogQueryRunner, IntrospectionFilters, IntrospectionResult } from "@askdb/introspect";
|
|
2
|
-
import { compileTableFilters } from "./glob.js";
|
|
3
2
|
export type DescribeMysqlInput = {
|
|
4
3
|
runner: CatalogQueryRunner;
|
|
5
4
|
filters?: IntrospectionFilters;
|
|
6
5
|
/** Optional `schemaId` for the resulting `SqlSchema`. Defaults to `"introspected"`. */
|
|
7
6
|
schemaId?: string;
|
|
8
7
|
};
|
|
9
|
-
/**
|
|
8
|
+
/** The default (connection-database) catalog SQL strings the connector issues, keyed by query name. */
|
|
10
9
|
export declare const MYSQL_CATALOG_SQL: {
|
|
11
10
|
readonly tables: `SELECT
|
|
12
11
|
table_schema AS table_schema,
|
|
@@ -85,77 +84,7 @@ ORDER BY table_schema, table_name, index_name, seq_in_index`;
|
|
|
85
84
|
FROM information_schema.views
|
|
86
85
|
WHERE ${string}
|
|
87
86
|
ORDER BY table_schema, table_name`;
|
|
88
|
-
|
|
89
|
-
type TableRow = {
|
|
90
|
-
table_schema: string;
|
|
91
|
-
table_name: string;
|
|
92
|
-
table_type: "BASE TABLE" | "VIEW" | string;
|
|
93
|
-
table_comment: string | null;
|
|
94
|
-
};
|
|
95
|
-
type ColumnRow = {
|
|
96
|
-
table_schema: string;
|
|
97
|
-
table_name: string;
|
|
98
|
-
column_name: string;
|
|
99
|
-
ordinal_position: number;
|
|
100
|
-
column_default: string | null;
|
|
101
|
-
is_nullable: "YES" | "NO" | string;
|
|
102
|
-
data_type: string;
|
|
103
|
-
column_type: string;
|
|
104
|
-
column_key: "PRI" | "UNI" | "MUL" | "" | string;
|
|
105
|
-
extra: string | null;
|
|
106
|
-
column_comment: string | null;
|
|
107
|
-
};
|
|
108
|
-
type ConstraintRow = {
|
|
109
|
-
table_schema: string;
|
|
110
|
-
constraint_name: string;
|
|
111
|
-
table_name: string;
|
|
112
|
-
column_name: string;
|
|
113
|
-
ordinal_position: number;
|
|
114
|
-
constraint_type: "PRIMARY KEY" | "UNIQUE" | string;
|
|
115
|
-
};
|
|
116
|
-
type ForeignKeyRow = {
|
|
117
|
-
table_schema: string;
|
|
118
|
-
constraint_name: string;
|
|
119
|
-
table_name: string;
|
|
120
|
-
column_name: string;
|
|
121
|
-
referenced_table_schema: string | null;
|
|
122
|
-
referenced_table_name: string;
|
|
123
|
-
referenced_column_name: string;
|
|
124
|
-
ordinal_position: number;
|
|
125
|
-
update_rule: string | null;
|
|
126
|
-
delete_rule: string | null;
|
|
127
|
-
};
|
|
128
|
-
type IndexRow = {
|
|
129
|
-
table_schema: string;
|
|
130
|
-
table_name: string;
|
|
131
|
-
index_name: string;
|
|
132
|
-
column_name: string | null;
|
|
133
|
-
seq_in_index: number;
|
|
134
|
-
non_unique: number;
|
|
135
|
-
index_type: string;
|
|
136
|
-
};
|
|
137
|
-
type ViewRow = {
|
|
138
|
-
table_schema: string;
|
|
139
|
-
table_name: string;
|
|
140
|
-
view_definition: string | null;
|
|
87
|
+
readonly current_database: "SELECT DATABASE() AS database_name";
|
|
141
88
|
};
|
|
142
89
|
export declare function describeMysql(input: DescribeMysqlInput): Promise<IntrospectionResult>;
|
|
143
|
-
type FoldInput = {
|
|
144
|
-
schemaId: string;
|
|
145
|
-
/**
|
|
146
|
-
* Maps a row's database to the namespace it renders under: the database name
|
|
147
|
-
* itself for a database list, `"public"` for the connection's database.
|
|
148
|
-
*/
|
|
149
|
-
namespaceOf: (database: string) => string;
|
|
150
|
-
tableFilter: ReturnType<typeof compileTableFilters>;
|
|
151
|
-
tableRows: TableRow[];
|
|
152
|
-
columnRows: ColumnRow[];
|
|
153
|
-
constraintRows: ConstraintRow[];
|
|
154
|
-
fkRows: ForeignKeyRow[];
|
|
155
|
-
indexRows: IndexRow[];
|
|
156
|
-
viewRows: ViewRow[];
|
|
157
|
-
declaredFilters: ReadonlyArray<string>;
|
|
158
|
-
};
|
|
159
|
-
export declare function foldMysqlResult(input: FoldInput): IntrospectionResult;
|
|
160
|
-
export {};
|
|
161
90
|
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/connector/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EAUpB,MAAM,mBAAmB,CAAC;AAkC3B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AA4GF,uGAAuG;AACvG,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGpB,CAAC;AAyDX,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAsD3F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { makeColumnId, makeTableId } from "
|
|
1
|
+
import { AskDbError, SINGLE_NAMESPACE_LABEL } from "@askdb/core";
|
|
2
|
+
import { ambiguousFilterWarnings, buildOrderedGroups, byName, compileTableFilters, groupBy, makeColumnId, makeTableId, mapFkAction, rowsToRecords, } from "@askdb/introspect/kit";
|
|
3
3
|
/**
|
|
4
4
|
* MySQL doesn't have Postgres-style schemas (each "schema" is a database).
|
|
5
5
|
*
|
|
@@ -9,12 +9,25 @@ import { makeColumnId, makeTableId } from "./ids.js";
|
|
|
9
9
|
* across engines.
|
|
10
10
|
* - **Database list (`filters.schemas`)**: the connector reads every listed
|
|
11
11
|
* database (`table_schema IN (…)`) and each becomes its own namespace, named
|
|
12
|
-
* after the database. Foreign keys
|
|
13
|
-
* database. `filters.excludeSchemas` removes entries from the list.
|
|
12
|
+
* after the database. Foreign keys into another listed database keep the
|
|
13
|
+
* referenced database. `filters.excludeSchemas` removes entries from the list.
|
|
14
14
|
* `introspection.schemas` (askdb.config.ts) and
|
|
15
15
|
* `askdb introspect --schemas` both feed this list.
|
|
16
|
+
*
|
|
17
|
+
* In both modes a foreign key into a database that wasn't introspected has no
|
|
18
|
+
* target in the artifact; it is skipped and reported as a `cross_database_fk`
|
|
19
|
+
* warning.
|
|
16
20
|
*/
|
|
17
|
-
const DEFAULT_NAMESPACE =
|
|
21
|
+
const DEFAULT_NAMESPACE = SINGLE_NAMESPACE_LABEL;
|
|
22
|
+
// information_schema is well-documented; pinning the SQL inside the package
|
|
23
|
+
// keeps the surface stable. Every query is scoped by one predicate on the
|
|
24
|
+
// schema column: `= DATABASE()` by default, or `IN (?, …)` for a database list.
|
|
25
|
+
//
|
|
26
|
+
// In the default mode `DATABASE()` is NULL when the connection has no default
|
|
27
|
+
// database (e.g. `mysql://host:3306` with no path) — every catalog query would
|
|
28
|
+
// then silently match nothing, so we check it up front and fail loudly instead
|
|
29
|
+
// of emitting an empty schema.
|
|
30
|
+
const SQL_CURRENT_DATABASE = `SELECT DATABASE() AS database_name`;
|
|
18
31
|
const connectionDatabase = (column) => `${column} = DATABASE()`;
|
|
19
32
|
function listedDatabases(count) {
|
|
20
33
|
const markers = Array.from({ length: count }, () => "?").join(", ");
|
|
@@ -101,8 +114,11 @@ WHERE ${scope("table_schema")}
|
|
|
101
114
|
ORDER BY table_schema, table_name`,
|
|
102
115
|
};
|
|
103
116
|
}
|
|
104
|
-
/**
|
|
105
|
-
export const MYSQL_CATALOG_SQL =
|
|
117
|
+
/** The default (connection-database) catalog SQL strings the connector issues, keyed by query name. */
|
|
118
|
+
export const MYSQL_CATALOG_SQL = {
|
|
119
|
+
current_database: SQL_CURRENT_DATABASE,
|
|
120
|
+
...catalogSql(connectionDatabase),
|
|
121
|
+
};
|
|
106
122
|
export async function describeMysql(input) {
|
|
107
123
|
const runner = input.runner;
|
|
108
124
|
const tableFilter = compileTableFilters(input.filters?.tables);
|
|
@@ -115,19 +131,18 @@ export async function describeMysql(input) {
|
|
|
115
131
|
// Every listed database was excluded: nothing to read.
|
|
116
132
|
if (listed && databases.length === 0)
|
|
117
133
|
return [];
|
|
118
|
-
|
|
119
|
-
if (result.rows.length === 0)
|
|
120
|
-
return [];
|
|
121
|
-
const idx = new Map();
|
|
122
|
-
for (let i = 0; i < result.columns.length; i++)
|
|
123
|
-
idx.set(result.columns[i], i);
|
|
124
|
-
return result.rows.map((row) => {
|
|
125
|
-
const record = {};
|
|
126
|
-
for (const [name, i] of idx)
|
|
127
|
-
record[name] = row[i];
|
|
128
|
-
return record;
|
|
129
|
-
});
|
|
134
|
+
return rowsToRecords(await runner(query, params));
|
|
130
135
|
};
|
|
136
|
+
// The default mode reads the connection's database; a database list names its own.
|
|
137
|
+
if (!listed) {
|
|
138
|
+
const [current] = await run(SQL_CURRENT_DATABASE);
|
|
139
|
+
if (!current?.database_name) {
|
|
140
|
+
throw new AskDbError("MySQL introspection needs a target database, but the connection has none selected " +
|
|
141
|
+
"(DATABASE() is NULL). Put the database name in the connection URL path, e.g. " +
|
|
142
|
+
"mysql://user:password@host:3306/<database>, or list databases with " +
|
|
143
|
+
"`introspection.schemas` / `--schemas`.");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
131
146
|
const [tableRows, columnRows, constraintRows, fkRows, indexRows, viewRows] = await Promise.all([
|
|
132
147
|
run(sql.tables),
|
|
133
148
|
run(sql.columns),
|
|
@@ -136,9 +151,14 @@ export async function describeMysql(input) {
|
|
|
136
151
|
run(sql.indexes),
|
|
137
152
|
run(sql.views),
|
|
138
153
|
]);
|
|
154
|
+
const readDatabases = new Set(tableRows.map((row) => row.table_schema));
|
|
139
155
|
return foldMysqlResult({
|
|
140
156
|
schemaId: input.schemaId ?? "introspected",
|
|
141
157
|
namespaceOf: listed ? (database) => database : () => DEFAULT_NAMESPACE,
|
|
158
|
+
// The databases the catalog returned rows for, spelled as the catalog spells
|
|
159
|
+
// them: with case-insensitive names (lower_case_table_names 1 or 2),
|
|
160
|
+
// `--schemas Shop` reads the database stored as `shop`.
|
|
161
|
+
isIntrospected: listed ? (database) => readDatabases.has(database) : undefined,
|
|
142
162
|
tableFilter,
|
|
143
163
|
tableRows,
|
|
144
164
|
columnRows,
|
|
@@ -153,7 +173,7 @@ export async function describeMysql(input) {
|
|
|
153
173
|
function tableKey(row) {
|
|
154
174
|
return `${row.table_schema}\u0000${row.table_name}`;
|
|
155
175
|
}
|
|
156
|
-
|
|
176
|
+
function foldMysqlResult(input) {
|
|
157
177
|
const warnings = [];
|
|
158
178
|
const columnsByTable = groupBy(input.columnRows, tableKey);
|
|
159
179
|
const constraintsByTable = groupBy(input.constraintRows, tableKey);
|
|
@@ -202,7 +222,7 @@ export function foldMysqlResult(input) {
|
|
|
202
222
|
comment: t.table_comment ?? undefined,
|
|
203
223
|
columns,
|
|
204
224
|
primaryKey: pkColumns.length > 0 ? { columns: pkColumns } : undefined,
|
|
205
|
-
foreignKeys: buildForeignKeys(fksByTable.get(key) ?? [], input
|
|
225
|
+
foreignKeys: buildForeignKeys(fksByTable.get(key) ?? [], input, warnings),
|
|
206
226
|
uniqueConstraints: buildUniques(constraints),
|
|
207
227
|
indexes: buildIndexes(indexesByTable.get(key) ?? []),
|
|
208
228
|
checkConstraints: [],
|
|
@@ -217,12 +237,7 @@ export function foldMysqlResult(input) {
|
|
|
217
237
|
const allTables = sortedNamespaces.flatMap((ns) => ns.tables);
|
|
218
238
|
const allViews = sortedNamespaces.flatMap((ns) => ns.views);
|
|
219
239
|
const isEmpty = allTables.length === 0 && allViews.length === 0;
|
|
220
|
-
|
|
221
|
-
const matches = compileTableFilters([pattern]);
|
|
222
|
-
const matched = allTables.some((t) => matches(`${t.schema}.${t.name}`)) || allViews.some((v) => matches(`${v.schema}.${v.name}`));
|
|
223
|
-
if (!matched)
|
|
224
|
-
warnings.push({ code: "ambiguous_filter", filter: pattern });
|
|
225
|
-
}
|
|
240
|
+
warnings.push(...ambiguousFilterWarnings(input.declaredFilters, [...allTables, ...allViews].map((t) => `${t.schema}.${t.name}`)));
|
|
226
241
|
const schema = {
|
|
227
242
|
schemaId: input.schemaId,
|
|
228
243
|
schemas: isEmpty ? [] : sortedNamespaces,
|
|
@@ -247,73 +262,44 @@ function buildColumn(namespace, table, c, pkSet) {
|
|
|
247
262
|
};
|
|
248
263
|
}
|
|
249
264
|
function buildUniques(constraints) {
|
|
250
|
-
|
|
251
|
-
for (const c of constraints) {
|
|
252
|
-
if (c.constraint_type !== "UNIQUE")
|
|
253
|
-
continue;
|
|
254
|
-
const list = byName.get(c.constraint_name) ?? [];
|
|
255
|
-
list.push(c);
|
|
256
|
-
byName.set(c.constraint_name, list);
|
|
257
|
-
}
|
|
258
|
-
return Array.from(byName, ([name, list]) => ({
|
|
259
|
-
name,
|
|
260
|
-
columns: list
|
|
261
|
-
.slice()
|
|
262
|
-
.sort((a, b) => a.ordinal_position - b.ordinal_position)
|
|
263
|
-
.map((r) => r.column_name),
|
|
264
|
-
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
265
|
+
return buildOrderedGroups(constraints.filter((c) => c.constraint_type === "UNIQUE"), (c) => c.constraint_name, (c) => c.ordinal_position, (name, ordered) => ({ name, columns: ordered.map((r) => r.column_name) }));
|
|
265
266
|
}
|
|
266
|
-
function buildForeignKeys(rows,
|
|
267
|
-
|
|
268
|
-
for (const r of rows) {
|
|
269
|
-
const list = byName.get(r.constraint_name) ?? [];
|
|
270
|
-
list.push(r);
|
|
271
|
-
byName.set(r.constraint_name, list);
|
|
272
|
-
}
|
|
273
|
-
const fks = [];
|
|
274
|
-
for (const [name, list] of byName) {
|
|
275
|
-
const ordered = list.slice().sort((a, b) => a.ordinal_position - b.ordinal_position);
|
|
267
|
+
function buildForeignKeys(rows, input, warnings) {
|
|
268
|
+
return buildOrderedGroups(rows, (r) => r.constraint_name, (r) => r.ordinal_position, (name, ordered) => {
|
|
276
269
|
const sample = ordered[0];
|
|
277
|
-
|
|
270
|
+
const referencedDatabase = sample.referenced_table_schema ?? sample.table_schema;
|
|
271
|
+
const introspected = input.isIntrospected
|
|
272
|
+
? input.isIntrospected(referencedDatabase)
|
|
273
|
+
: referencedDatabase === sample.table_schema;
|
|
274
|
+
// A FK into a database that wasn't introspected has no target in the
|
|
275
|
+
// artifact. Rendering it (e.g. as `public.<table>` in the default mode)
|
|
276
|
+
// would point at the wrong (or a missing) table — skip it and say so.
|
|
277
|
+
if (!introspected) {
|
|
278
|
+
warnings.push({
|
|
279
|
+
code: "cross_database_fk",
|
|
280
|
+
table: makeTableId(input.namespaceOf(sample.table_schema), sample.table_name),
|
|
281
|
+
constraint: name,
|
|
282
|
+
referencedDatabase,
|
|
283
|
+
referencedTable: sample.referenced_table_name,
|
|
284
|
+
});
|
|
285
|
+
return undefined;
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
278
288
|
name,
|
|
279
289
|
columns: ordered.map((r) => r.column_name),
|
|
280
290
|
references: {
|
|
281
|
-
// A
|
|
282
|
-
schema: namespaceOf(
|
|
291
|
+
// A FK into another listed database keeps that database as its namespace.
|
|
292
|
+
schema: input.namespaceOf(referencedDatabase),
|
|
283
293
|
table: sample.referenced_table_name,
|
|
284
294
|
columns: ordered.map((r) => r.referenced_column_name),
|
|
285
295
|
},
|
|
286
|
-
onDelete:
|
|
287
|
-
onUpdate:
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return fks.sort((a, b) => a.name.localeCompare(b.name));
|
|
291
|
-
}
|
|
292
|
-
function mapAction(rule) {
|
|
293
|
-
if (!rule)
|
|
294
|
-
return undefined;
|
|
295
|
-
const r = rule.toLowerCase();
|
|
296
|
-
if (r === "cascade")
|
|
297
|
-
return "cascade";
|
|
298
|
-
if (r === "restrict")
|
|
299
|
-
return "restrict";
|
|
300
|
-
if (r === "set null")
|
|
301
|
-
return "set null";
|
|
302
|
-
if (r === "set default")
|
|
303
|
-
return "set default";
|
|
304
|
-
if (r === "no action")
|
|
305
|
-
return "no action";
|
|
306
|
-
return undefined;
|
|
296
|
+
onDelete: mapFkAction(sample.delete_rule),
|
|
297
|
+
onUpdate: mapFkAction(sample.update_rule),
|
|
298
|
+
};
|
|
299
|
+
});
|
|
307
300
|
}
|
|
308
301
|
function buildIndexes(rows) {
|
|
309
|
-
|
|
310
|
-
for (const r of rows) {
|
|
311
|
-
const list = byName.get(r.index_name) ?? [];
|
|
312
|
-
list.push(r);
|
|
313
|
-
byName.set(r.index_name, list);
|
|
314
|
-
}
|
|
315
|
-
return Array.from(byName, ([name, list]) => {
|
|
316
|
-
const ordered = list.slice().sort((a, b) => a.seq_in_index - b.seq_in_index);
|
|
302
|
+
return buildOrderedGroups(rows, (r) => r.index_name, (r) => r.seq_in_index, (name, ordered) => {
|
|
317
303
|
const sample = ordered[0];
|
|
318
304
|
return {
|
|
319
305
|
name,
|
|
@@ -321,19 +307,6 @@ function buildIndexes(rows) {
|
|
|
321
307
|
unique: sample.non_unique === 0,
|
|
322
308
|
method: sample.index_type,
|
|
323
309
|
};
|
|
324
|
-
})
|
|
325
|
-
}
|
|
326
|
-
function groupBy(rows, key) {
|
|
327
|
-
const out = new Map();
|
|
328
|
-
for (const row of rows) {
|
|
329
|
-
const k = key(row);
|
|
330
|
-
const list = out.get(k) ?? [];
|
|
331
|
-
list.push(row);
|
|
332
|
-
out.set(k, list);
|
|
333
|
-
}
|
|
334
|
-
return out;
|
|
335
|
-
}
|
|
336
|
-
function byName(a, b) {
|
|
337
|
-
return a.name.localeCompare(b.name);
|
|
310
|
+
});
|
|
338
311
|
}
|
|
339
312
|
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/connector/describe.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAcnC,MAAM,kBAAkB,GAAU,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,eAAe,CAAC;AAEvE,SAAS,eAAe,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AE,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,IAAI,EAAE,CAAC;YAChD,MAAM,EAAE,MAAM,CAAC,UAAU,KAAK,CAAC;YAC/B,MAAM,EAAE,MAAM,CAAC,UAAU;SACP,CAAC;IACvB,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const mysqlConnectorProvider: ConnectorProviderAdapter;
|
|
1
|
+
export declare const mysqlConnectorProvider: import("@askdb/introspect").ConnectorProviderAdapter;
|
|
3
2
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/connector/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/connector/provider.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,sDAcjC,CAAC"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
import { defineLiveConnectorProvider } from "@askdb/introspect/kit";
|
|
1
2
|
import { createMysqlConnector } from "./index.js";
|
|
2
3
|
import { createMysqlCatalogQueryRunner } from "../exec/mysql.js";
|
|
3
|
-
|
|
4
|
+
import { parseMysqlConnection } from "../label.js";
|
|
5
|
+
export const mysqlConnectorProvider = defineLiveConnectorProvider({
|
|
4
6
|
provider: "mysql",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
input: {
|
|
12
|
-
mode: "live",
|
|
13
|
-
runner: createMysqlCatalogQueryRunner(config.url),
|
|
14
|
-
filters: config.filters,
|
|
15
|
-
},
|
|
16
|
-
connector: createMysqlConnector(),
|
|
17
|
-
};
|
|
7
|
+
displayName: "MySQL",
|
|
8
|
+
runtimeKey: "mysqlDatabaseUrl",
|
|
9
|
+
connectionNoun: "a connection URL",
|
|
10
|
+
missingConnection: {
|
|
11
|
+
cli: "Provide --url <mysql-url> (or set introspection.providerConfig.mysql.databaseUrl / ASKDB_INTROSPECT_MYSQL_URL / DATABASE_URL).",
|
|
12
|
+
config: "No MySQL connection configured. Set introspection.providerConfig.mysql.databaseUrl in askdb.config.ts (bound to an env var in .env).",
|
|
18
13
|
},
|
|
19
|
-
|
|
14
|
+
fromExportUnsupported: "--from-export is currently supported only for --engine postgres (got mysql).",
|
|
15
|
+
createConnector: createMysqlConnector,
|
|
16
|
+
createRunner: (url) => createMysqlCatalogQueryRunner(url),
|
|
17
|
+
connectionLabelParts: parseMysqlConnection,
|
|
18
|
+
});
|
|
20
19
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/connector/provider.ts"],"names":[],"mappings":"
|
|
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,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;IAChE,QAAQ,EAAE,OAAO;IACjB,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,kBAAkB;IAC9B,cAAc,EAAE,kBAAkB;IAClC,iBAAiB,EAAE;QACjB,GAAG,EAAE,gIAAgI;QACrI,MAAM,EACJ,sIAAsI;KACzI;IACD,qBAAqB,EAAE,8EAA8E;IACrG,eAAe,EAAE,oBAAoB;IACrC,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,6BAA6B,CAAC,GAAG,CAAC;IACzD,oBAAoB,EAAE,oBAAoB;CAC3C,CAAC,CAAC"}
|
package/dist/exec/mysql.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
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
|
-
* Lazily resolve the optional `mysql2` peer dependency. Mirrors the pattern in
|
|
5
|
-
* `@askdb/postgres` so consumers with a custom `CatalogQueryRunner` can use
|
|
6
|
-
* `@askdb/mysql` without installing `mysql2`.
|
|
7
|
-
*/
|
|
8
|
-
type DriverLoadOptions = {
|
|
9
|
-
resolveFrom?: string;
|
|
10
|
-
};
|
|
11
|
-
/** @internal exposed for tests that need to reset the lazy `mysql2` cache. */
|
|
12
|
-
export declare function __resetMysql2ModuleCacheForTests(): void;
|
|
13
4
|
type Mysql2DriverModule = typeof import("mysql2/promise");
|
|
14
5
|
/**
|
|
15
6
|
* Resolve and cache the optional `mysql2` peer driver, with the same lazy-import
|
package/dist/exec/mysql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../src/exec/mysql.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../src/exec/mysql.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAchF,KAAK,kBAAkB,GAAG,cAAc,gBAAgB,CAAC,CAAC;AAE1D;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAG/F;AAED,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAE5E;AA+BD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,kBAAkB,CAEpB"}
|
package/dist/exec/mysql.js
CHANGED
|
@@ -1,79 +1,29 @@
|
|
|
1
1
|
import { AskDbError } from "@askdb/core";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND")
|
|
15
|
-
return false;
|
|
16
|
-
return cause.message.includes(packageName);
|
|
17
|
-
}
|
|
18
|
-
async function importOptionalMysql2(opts) {
|
|
19
|
-
try {
|
|
20
|
-
return await import("mysql2/promise");
|
|
21
|
-
}
|
|
22
|
-
catch (cause) {
|
|
23
|
-
if (!isModuleResolutionFailure(cause, "mysql2"))
|
|
24
|
-
throw cause;
|
|
25
|
-
const fromDir = opts?.resolveFrom ?? process.cwd();
|
|
26
|
-
const projectRequire = createRequire(join(fromDir, "package.json"));
|
|
27
|
-
try {
|
|
28
|
-
const resolved = projectRequire.resolve("mysql2/promise");
|
|
29
|
-
return (await import(pathToFileURL(resolved).href));
|
|
30
|
-
}
|
|
31
|
-
catch (projectCause) {
|
|
32
|
-
if (!isModuleResolutionFailure(projectCause, "mysql2"))
|
|
33
|
-
throw projectCause;
|
|
34
|
-
throw new AggregateError([cause, projectCause], "Unable to resolve optional `mysql2` peer dependency");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async function loadMysql2OrThrow(opts) {
|
|
39
|
-
const key = opts?.resolveFrom;
|
|
40
|
-
let promise = mysql2ModulePromises.get(key);
|
|
41
|
-
if (!promise) {
|
|
42
|
-
promise = importOptionalMysql2(opts).catch((cause) => {
|
|
43
|
-
mysql2ModulePromises.delete(key);
|
|
44
|
-
throw new AskDbError("The built-in MySQL catalog query runner requires the optional `mysql2` peer dependency. " +
|
|
45
|
-
"Install it in your project (e.g. `pnpm add mysql2`) or include it in the same one-off command " +
|
|
46
|
-
"(e.g. `pnpm dlx -p askdb -p mysql2 askdb ...` or `npx -p askdb -p mysql2 askdb ...`). " +
|
|
47
|
-
"You can also pass a custom catalog query runner to the MySQL connector.", cause);
|
|
48
|
-
});
|
|
49
|
-
mysql2ModulePromises.set(key, promise);
|
|
50
|
-
}
|
|
51
|
-
return promise;
|
|
52
|
-
}
|
|
53
|
-
/** @internal exposed for tests that need to reset the lazy `mysql2` cache. */
|
|
54
|
-
export function __resetMysql2ModuleCacheForTests() {
|
|
55
|
-
mysql2ModulePromises.clear();
|
|
56
|
-
}
|
|
2
|
+
import { createOptionalDriverLoader, rethrowDriverImportError, isDriverInstalled, missingDriverMessage, } from "@askdb/introspect/kit";
|
|
3
|
+
/**
|
|
4
|
+
* Lazily resolve the optional `mysql2` peer dependency. Mirrors the pattern in
|
|
5
|
+
* `@askdb/postgres` so consumers with a custom `CatalogQueryRunner` can use
|
|
6
|
+
* `@askdb/mysql` without installing `mysql2`.
|
|
7
|
+
*/
|
|
8
|
+
const mysql2Loader = createOptionalDriverLoader({
|
|
9
|
+
packageName: "mysql2",
|
|
10
|
+
specifier: "mysql2/promise",
|
|
11
|
+
importDriver: () => import("mysql2/promise").catch(rethrowDriverImportError),
|
|
12
|
+
missingMessage: missingDriverMessage({ engine: "MySQL", packageName: "mysql2" }),
|
|
13
|
+
});
|
|
57
14
|
/**
|
|
58
15
|
* Resolve and cache the optional `mysql2` peer driver, with the same lazy-import
|
|
59
16
|
* + project-root fallback behavior as the catalog runner.
|
|
60
17
|
*/
|
|
61
18
|
export async function loadMysql2Driver(options) {
|
|
62
|
-
const mod = await
|
|
19
|
+
const mod = await mysql2Loader.load(options);
|
|
63
20
|
return mod.default ?? mod;
|
|
64
21
|
}
|
|
65
22
|
export function isMysql2DriverInstalled(options) {
|
|
66
|
-
|
|
67
|
-
const req = createRequire(join(options?.resolveFrom ?? process.cwd(), "package.json"));
|
|
68
|
-
req.resolve("mysql2");
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
23
|
+
return isDriverInstalled("mysql2", options);
|
|
74
24
|
}
|
|
75
25
|
async function runMysqlCatalogQuery(connectionString, sql, params, options) {
|
|
76
|
-
const mod = await
|
|
26
|
+
const mod = await mysql2Loader.load(options);
|
|
77
27
|
const mysql = mod.default ?? mod;
|
|
78
28
|
const connection = await mysql.createConnection(connectionString);
|
|
79
29
|
try {
|
package/dist/exec/mysql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql.js","sourceRoot":"","sources":["../../src/exec/mysql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"mysql.js","sourceRoot":"","sources":["../../src/exec/mysql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAI/B;;;;GAIG;AACH,MAAM,YAAY,GAAG,0BAA0B,CAAkC;IAC/E,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,gBAAgB;IAC3B,YAAY,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAgB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M,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QACtE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,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,+BAA+B,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;YAAS,CAAC;QACT,MAAM,UAAU,CAAC,GAAG,EAAE,CAAC;IACzB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAC3C,gBAAwB,EACxB,OAA2B;IAE3B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACvF,CAAC"}
|
package/dist/label.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ConnectionLabelParts } from "@askdb/introspect/kit";
|
|
2
|
+
/**
|
|
3
|
+
* The display-safe parts of a MySQL connection string, read the way `mysql2`
|
|
4
|
+
* reads it: `ConnectionConfig.parseUrl` is WHATWG `new URL(url)` with
|
|
5
|
+
* `host = decodeURIComponent(hostname)`, `port = port`, and
|
|
6
|
+
* `database = decodeURIComponent(pathname.slice(1))`. `mysql2` itself isn't a
|
|
7
|
+
* dependency here (it is ~630 KB with seven dependencies, and an optional
|
|
8
|
+
* peer), so this uses the same built-in parser and mapping; a differential test
|
|
9
|
+
* checks it against `mysql2`'s own `parseUrl` (ADR 0011).
|
|
10
|
+
*
|
|
11
|
+
* Returns `undefined` (the registry labels it `configured mysql connection`)
|
|
12
|
+
* when `new URL` throws, when the scheme isn't `mysql:`, or when an `@` or `#`
|
|
13
|
+
* sits after the host: a password containing `/`, `?` or `#` is split there.
|
|
14
|
+
* `formatConnectionLabel`'s allowlist is the second check.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseMysqlConnection(input: string): ConnectionLabelParts | undefined;
|
|
17
|
+
//# 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;AAElE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAkBpF"}
|
package/dist/label.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The display-safe parts of a MySQL connection string, read the way `mysql2`
|
|
3
|
+
* reads it: `ConnectionConfig.parseUrl` is WHATWG `new URL(url)` with
|
|
4
|
+
* `host = decodeURIComponent(hostname)`, `port = port`, and
|
|
5
|
+
* `database = decodeURIComponent(pathname.slice(1))`. `mysql2` itself isn't a
|
|
6
|
+
* dependency here (it is ~630 KB with seven dependencies, and an optional
|
|
7
|
+
* peer), so this uses the same built-in parser and mapping; a differential test
|
|
8
|
+
* checks it against `mysql2`'s own `parseUrl` (ADR 0011).
|
|
9
|
+
*
|
|
10
|
+
* Returns `undefined` (the registry labels it `configured mysql connection`)
|
|
11
|
+
* when `new URL` throws, when the scheme isn't `mysql:`, or when an `@` or `#`
|
|
12
|
+
* sits after the host: a password containing `/`, `?` or `#` is split there.
|
|
13
|
+
* `formatConnectionLabel`'s allowlist is the second check.
|
|
14
|
+
*/
|
|
15
|
+
export function parseMysqlConnection(input) {
|
|
16
|
+
let url;
|
|
17
|
+
let host;
|
|
18
|
+
let database;
|
|
19
|
+
try {
|
|
20
|
+
url = new URL(input);
|
|
21
|
+
host = decodeURIComponent(url.hostname);
|
|
22
|
+
database = decodeURIComponent(url.pathname.slice(1));
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
if (url.protocol !== "mysql:")
|
|
28
|
+
return undefined;
|
|
29
|
+
if (url.hash !== "" || `${url.pathname}${url.search}`.includes("@"))
|
|
30
|
+
return undefined;
|
|
31
|
+
return {
|
|
32
|
+
...(host !== "" ? { host } : {}),
|
|
33
|
+
...(url.port !== "" ? { port: url.port } : {}),
|
|
34
|
+
...(database !== "" ? { database } : {}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../src/label.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,GAAQ,CAAC;IACb,IAAI,IAAY,CAAC;IACjB,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxC,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,IAAI,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACtF,OAAO;QACL,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,GAAG,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askdb/mysql",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.19",
|
|
4
4
|
"description": "AskDB MySQL integration: introspection connector via information_schema and a mysql2-backed catalog query runner. Pairs with @askdb/core's MYSQL_DIALECT.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"askdb",
|
|
@@ -41,12 +41,11 @@
|
|
|
41
41
|
"NOTICE"
|
|
42
42
|
],
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=22.
|
|
44
|
+
"node": ">=22.23.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@askdb/
|
|
48
|
-
"@askdb/introspect": "0.3.0-beta.
|
|
49
|
-
"@askdb/core": "1.0.0-beta.43"
|
|
47
|
+
"@askdb/core": "1.0.0-beta.44",
|
|
48
|
+
"@askdb/introspect": "0.3.0-beta.18"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
51
|
"mysql2": ">=3"
|
|
@@ -57,9 +56,9 @@
|
|
|
57
56
|
}
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
|
-
"mysql2": "^3.24.
|
|
59
|
+
"mysql2": "^3.24.6",
|
|
61
60
|
"typescript": "^6.0.3",
|
|
62
|
-
"vitest": "^5.0.
|
|
61
|
+
"vitest": "^5.0.5"
|
|
63
62
|
},
|
|
64
63
|
"scripts": {
|
|
65
64
|
"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":"AAiBA,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,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal glob matcher for `IntrospectionFilters.tables`. Matches against
|
|
3
|
-
* `"<schema>.<name>"` strings; supports `*` (any run) and `?` (single char).
|
|
4
|
-
* Identical to the postgres connector's matcher.
|
|
5
|
-
*/
|
|
6
|
-
function compileGlob(pattern) {
|
|
7
|
-
let out = "^";
|
|
8
|
-
for (const ch of pattern) {
|
|
9
|
-
if (ch === "*")
|
|
10
|
-
out += ".*";
|
|
11
|
-
else if (ch === "?")
|
|
12
|
-
out += ".";
|
|
13
|
-
else if (/[.+^${}()|[\]\\]/.test(ch))
|
|
14
|
-
out += "\\" + ch;
|
|
15
|
-
else
|
|
16
|
-
out += ch;
|
|
17
|
-
}
|
|
18
|
-
out += "$";
|
|
19
|
-
return new RegExp(out);
|
|
20
|
-
}
|
|
21
|
-
export function compileTableFilters(patterns) {
|
|
22
|
-
if (!patterns || patterns.length === 0)
|
|
23
|
-
return () => true;
|
|
24
|
-
const compiled = patterns.map(compileGlob);
|
|
25
|
-
return (qualifiedName) => compiled.some((re) => re.test(qualifiedName));
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=glob.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/connector/glob.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,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,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema v2 ID conventions — kept aligned with `@askdb/postgres/connector/ids.ts`.
|
|
3
|
-
* MySQL doesn't have Postgres-style schemas, but to keep IDs stable and
|
|
4
|
-
* cross-engine queryable we always use the namespace `"public"` (the same
|
|
5
|
-
* convention `@askdb/prisma` uses for MySQL).
|
|
6
|
-
*/
|
|
7
|
-
export declare function makeTableId(schemaName: string, tableName: string): string;
|
|
8
|
-
export declare function makeColumnId(schemaName: string, tableName: string, columnName: string): string;
|
|
9
|
-
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/connector/ids.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,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,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema v2 ID conventions — kept aligned with `@askdb/postgres/connector/ids.ts`.
|
|
3
|
-
* MySQL doesn't have Postgres-style schemas, but to keep IDs stable and
|
|
4
|
-
* cross-engine queryable we always use the namespace `"public"` (the same
|
|
5
|
-
* convention `@askdb/prisma` uses for MySQL).
|
|
6
|
-
*/
|
|
7
|
-
export function makeTableId(schemaName, tableName) {
|
|
8
|
-
return `table:${schemaName}.${tableName}`;
|
|
9
|
-
}
|
|
10
|
-
export function makeColumnId(schemaName, tableName, columnName) {
|
|
11
|
-
return `table:${schemaName}.${tableName}#${columnName}`;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/connector/ids.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,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"}
|