Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
"author": "",
"license": "MIT",
"dependencies": {
"@aws-sdk/rds-signer": "^3.1001.0",
"@azure/identity": "^4.8.0",
"@iarna/toml": "^2.2.5",
"@modelcontextprotocol/sdk": "^1.25.1",
"dotenv": "^16.4.7",
Expand All @@ -51,6 +49,8 @@
"zod": "^3.24.2"
},
"optionalDependencies": {
"@aws-sdk/rds-signer": "^3.1001.0",
"@azure/identity": "^4.8.0",
"better-sqlite3": "^11.9.0",
"mariadb": "^3.4.0",
"mssql": "^11.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/sqlserver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
ExecuteOptions,
ConnectorConfig,
} from "../interface.js";
import { DefaultAzureCredential } from "@azure/identity";
import { SafeURL } from "../../utils/safe-url.js";
import { obfuscateDSNPassword } from "../../utils/dsn-obfuscate.js";
import { SQLRowLimiter } from "../../utils/sql-row-limiter.js";
Expand Down Expand Up @@ -95,6 +94,7 @@ export class SQLServerDSNParser implements DSNParser {
switch (options.authentication) {
case "azure-active-directory-access-token": {
try {
const { DefaultAzureCredential } = await import("@azure/identity");
const credential = new DefaultAzureCredential();
const token = await credential.getToken("https://database.windows.net/");
Comment thread
tianzhou marked this conversation as resolved.
config.authentication = {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/aws-rds-signer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Signer } from "@aws-sdk/rds-signer";

export interface RdsAuthTokenParams {
hostname: string;
port: number;
Expand All @@ -13,6 +11,8 @@ export interface RdsAuthTokenParams {
* (AWS CLI profile, env vars, instance role, etc.).
*/
export async function generateRdsAuthToken(params: RdsAuthTokenParams): Promise<string> {
const { Signer } = await import("@aws-sdk/rds-signer");

const signer = new Signer({
Comment thread
tianzhou marked this conversation as resolved.
hostname: params.hostname,
port: params.port,
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
// Database drivers are optionalDependencies loaded at runtime via dynamic
// import(). They must be external so tsup does not bundle their CJS code
// into ESM chunks (which causes "Dynamic require of X is not supported").
Comment thread
tianzhou marked this conversation as resolved.
Outdated
external: ['pg', 'mysql2', 'mariadb', 'mssql', 'better-sqlite3'],
external: ['pg', 'mysql2', 'mariadb', 'mssql', 'better-sqlite3', '@aws-sdk/rds-signer', '@azure/identity'],
// Copy the employee-sqlite demo data to dist
async onSuccess() {
// Create target directory
Expand Down
Loading