@aws/aurora-dsql-postgresjs-connector 0.1.0

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 ADDED
@@ -0,0 +1,158 @@
1
+ # Aurora DSQL Connector for Postgres.js
2
+
3
+ The Aurora DSQL Connector for Postgres.js is a Node.js connector built on [Postgres.js](https://github.com/porsager/postgres)
4
+ that integrates IAM Authentication for connecting JavaScript applications to Amazon Aurora DSQL clusters.
5
+
6
+ The Aurora DSQL Connector for Postgres.js is designed as an authentication plugin that extends the functionality of the
7
+ Postgres.js client to enable applications to authenticate with Amazon Aurora DSQL using IAM credentials. The connector
8
+ does not connect directly to the database, but provides seamless IAM authentication on top of the underlying Postgres.js driver.
9
+
10
+ ## Benefits of the Connector
11
+
12
+ Amazon Aurora DSQL is a distributed SQL database service that provides high availability and scalability for
13
+ PostgreSQL-compatible applications. Aurora DSQL requires IAM-based authentication with time-limited tokens that
14
+ existing Node.js drivers do not natively support.
15
+
16
+ The idea behind the Aurora DSQL Connector for Postgres.js is to add an authentication layer on top of the Postgres.js
17
+ client that handles IAM token generation, allowing users to connect to Aurora DSQL without changing their existing Postgres.js workflows.
18
+
19
+ The Aurora DSQL Connector for Postgres.js works with most versions of Postgres.js. Users provide their own version by installing
20
+ Postgres.js directly.
21
+
22
+ ### Features
23
+
24
+ - **Automatic IAM Authentication** - Handles DSQL token generation and refresh
25
+ - **Built on Postgres.js** - Leverages the fast PostgreSQL client for Node.js
26
+ - **Region Auto-Discovery** - Extracts AWS region from DSQL cluster hostname
27
+ - **Full TypeScript Support** - Provides full type safety
28
+ - **Custom Credentials** - Support for custom AWS credential providers
29
+
30
+ ## Quick start guide
31
+
32
+ ### Requirements
33
+
34
+ - Node.js 20+
35
+ - AWS credentials configured (via AWS CLI, environment variables, or IAM roles)
36
+ - Access to an Aurora DSQL cluster
37
+
38
+ ### Installation
39
+
40
+ ```bash
41
+ npm install @aws/aurora-dsql-postgresjs-connector
42
+ # Postgres.js is a peer-dependency, so users must install it themselves
43
+ npm install postgres
44
+ ```
45
+
46
+ ### Basic Usage
47
+
48
+ ```typescript
49
+ import { auroraDSQLPostgres } from '@aws/aurora-dsql-postgresjs-connector';
50
+
51
+ const sql = auroraDSQLPostgres({
52
+ host: 'your-cluster.dsql.us-east-1.on.aws',
53
+ username: 'admin',
54
+
55
+ });
56
+
57
+ // Execute queries
58
+ const users = await sql`SELECT * FROM users WHERE age > ${25}`;
59
+ console.log(users);
60
+
61
+ // Clean up
62
+ await sql.end();
63
+ ```
64
+
65
+ #### Using cluster ID instead of host
66
+
67
+ ```typescript
68
+ const sql = auroraDSQLPostgres({
69
+ host: 'your-cluster-id',
70
+ region: 'us-east-1',
71
+ username: 'admin',
72
+
73
+ });
74
+ ```
75
+
76
+ ### Connection String
77
+
78
+ ```typescript
79
+ const sql = AuroraDSQLPostgres(
80
+ 'postgres://admin@your-cluster.dsql.us-east-1.on.aws'
81
+ );
82
+
83
+ const result = await sql`SELECT current_timestamp`;
84
+ ```
85
+
86
+ ### Advanced Configuration
87
+
88
+ ```typescript
89
+ import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
90
+
91
+ const sql = AuroraDSQLPostgres({
92
+ host: 'your-cluster.dsql.us-east-1.on.aws',
93
+ database: 'postgres',
94
+ username: 'admin',
95
+ customCredentialsProvider: fromNodeProviderChain(), // Optionally provide custom credentials provider
96
+ tokenDurationSecs: 3600, // Token expiration (seconds)
97
+
98
+ // Standard Postgres.js options
99
+ max: 20, // Connection pool size
100
+ ssl: { rejectUnauthorized: false } // SSL configuration
101
+ });
102
+ ```
103
+
104
+ ## Configuration Options
105
+
106
+ | Option | Type | Required | Description |
107
+ |-----------------------------|----------------------------------|----------|----------------------------------------------------------|
108
+ | `host` | `string` | Yes | DSQL cluster hostname or cluster ID |
109
+ | `database` | `string?` | No | Database name |
110
+ | `username` | `string?` | No | Database username (uses admin if not provided) |
111
+ | `region` | `string?` | No | AWS region (auto-detected from hostname if not provided) |
112
+ | `customCredentialsProvider` | `AwsCredentialIdentityProvider?` | No | Custom AWS credentials provider |
113
+ | `tokenDurationSecs` | `number?` | No | Token expiration time in seconds |
114
+
115
+ All standard [Postgres.js options](https://github.com/porsager/postgres?tab=readme-ov-file#connection-details) are also supported.
116
+
117
+ ## Authentication
118
+
119
+ The connector automatically handles DSQL authentication by generating tokens using the DSQL client token generator. If the
120
+ AWS region is not provided, it will be automatically parsed from the hostname provided.
121
+
122
+ For more information on authentication in Aurora DSQL, see the [user guide](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/authentication-authorization.html).
123
+
124
+ ### Admin vs Regular Users
125
+
126
+ - Users named `"admin"` automatically use admin authentication tokens
127
+ - All other users use regular authentication tokens
128
+ - Tokens are generated dynamically for each connection
129
+
130
+ ## Sample usage
131
+
132
+ An JavaScript example using the Aurora DSQL Connector for Postgres.js is available [here](example).
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ # Install dependencies
138
+ npm install
139
+
140
+ # Build the project
141
+ npm run build
142
+
143
+ # Set a cluster for use in integration tests
144
+ export CLUSTER_ENDPOINT=your-cluster.dsql.us-east-1.on.aws
145
+
146
+ # Run tests
147
+ npm run test
148
+
149
+ # Alternatively, run only unit or integration tests
150
+ npm run test:unit
151
+ npm run test:integration
152
+ ```
153
+
154
+ ## License
155
+ This software is released under the Apache 2.0 license.
156
+
157
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
158
+ SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,21 @@
1
+ import postgres, { PostgresType } from "postgres";
2
+ import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from "@aws-sdk/types";
3
+ export declare function auroraDSQLPostgres<T extends Record<string, postgres.PostgresType> = {}>(url: string, options?: AuroraDSQLConfig<T>): postgres.Sql<Record<string, postgres.PostgresType> extends T ? {} : {
4
+ [type in keyof T]: T[type] extends {
5
+ serialize: (value: infer R) => any;
6
+ parse: (raw: any) => infer R;
7
+ } ? R : never;
8
+ }>;
9
+ export declare function auroraDSQLPostgres<T extends Record<string, postgres.PostgresType> = {}>(options: AuroraDSQLConfig<T>): postgres.Sql<Record<string, postgres.PostgresType> extends T ? {} : {
10
+ [type in keyof T]: T[type] extends {
11
+ serialize: (value: infer R) => any;
12
+ parse: (raw: any) => infer R;
13
+ } ? R : never;
14
+ }>;
15
+ export interface AuroraDSQLConfig<T extends Record<string, PostgresType<T>>> extends Omit<postgres.Options<T>, 'password' | 'pass'> {
16
+ region?: string;
17
+ profile?: string;
18
+ tokenDurationSecs?: number;
19
+ customCredentialsProvider?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
20
+ }
21
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,EAAE,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,qBAAqB,EAAE,6BAA6B,EAAC,MAAM,gBAAgB,CAAC;AAWpF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,EACnF,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC9B,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG;KAClE,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS;QAC/B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC;QACnC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,CAAA;KAC/B,GAAG,CAAC,GAAG,KAAK;CAChB,CAAC,CAAC;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,EACnF,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC7B,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG;KAClE,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS;QAC/B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC;QACnC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,CAAA;KAC/B,GAAG,CAAC,GAAG,KAAK;CAChB,CAAC,CAAC;AA8GH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAE/H,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,yBAAyB,CAAC,EAAE,qBAAqB,GAAG,6BAA6B,CAAC;CAErF"}
package/dist/client.js ADDED
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import postgres from "postgres";
6
+ import { DsqlSigner } from "@aws-sdk/dsql-signer";
7
+ const ADMIN = "admin";
8
+ const DEFAULT_DATABASE = "postgres";
9
+ const DEFAULT_EXPIRY = 30; // Based on default Postgres.js connect_timeout
10
+ // String components of a DSQL hostname, <Cluster ID>.dsql.<region>.on.aws
11
+ const PRE_REGION_HOST_PATTERN = ".dsql.";
12
+ const POST_REGION_HOST_PATTERN = ".on.aws";
13
+ export function auroraDSQLPostgres(urlOrOptions, options) {
14
+ /* eslint-enable @typescript-eslint/no-explicit-any */
15
+ let opts;
16
+ let host;
17
+ let username;
18
+ let database;
19
+ let ssl;
20
+ if (typeof urlOrOptions === 'string') {
21
+ // Called with (url, options)
22
+ let parsedOptions = parseConnectionString(urlOrOptions);
23
+ host = options?.hostname || options?.host || parsedOptions.host || process.env.PGHOST;
24
+ username = options?.username || options?.user || parsedOptions.username || process.env.PGUSERNAME || process.env.USER || ADMIN;
25
+ database = options?.database || options?.db || parsedOptions.database || process.env.PGDATABASE;
26
+ ssl = options?.ssl || parsedOptions.ssl;
27
+ opts = { ...options };
28
+ }
29
+ else {
30
+ // Called with (options) only
31
+ host = urlOrOptions?.hostname || urlOrOptions?.host || process.env.PGHOST;
32
+ username = urlOrOptions?.username || urlOrOptions?.user || process.env.PGUSERNAME || process.env.USER || ADMIN;
33
+ database = urlOrOptions?.database || urlOrOptions?.db || process.env.PGDATABASE;
34
+ ssl = urlOrOptions?.ssl;
35
+ opts = { ...urlOrOptions };
36
+ }
37
+ if (Array.isArray(host)) {
38
+ throw new Error('Multi-host configurations are not supported for Aurora DSQL');
39
+ }
40
+ let region = opts.region || parseRegionFromHost(host);
41
+ if (isClusterID(host)) {
42
+ host = buildHostnameFromIdAndRegion(host, region);
43
+ opts.host = host;
44
+ }
45
+ let signerConfig = {
46
+ hostname: host,
47
+ region: opts.region || parseRegionFromHost(host),
48
+ expiresIn: opts.tokenDurationSecs ?? opts.connect_timeout ?? (process.env.PGCONNECT_TIMEOUT ? parseInt(process.env.PGCONNECT_TIMEOUT) : undefined) ?? DEFAULT_EXPIRY,
49
+ profile: opts.profile || process.env.AWS_PROFILE || "default",
50
+ };
51
+ if (opts.customCredentialsProvider) {
52
+ signerConfig.credentials = opts.customCredentialsProvider;
53
+ }
54
+ let signer = new DsqlSigner(signerConfig);
55
+ if (!database)
56
+ opts.database = DEFAULT_DATABASE;
57
+ if (!ssl)
58
+ opts.ssl = true;
59
+ const postgresOpts = {
60
+ ...opts,
61
+ pass: () => getToken(signer, username),
62
+ };
63
+ return typeof urlOrOptions === 'string' ? postgres(urlOrOptions, postgresOpts) : postgres(postgresOpts);
64
+ }
65
+ function parseConnectionString(url) {
66
+ let decodedUrl = decodeURI(url);
67
+ const parsed = new URL(decodedUrl);
68
+ // Check for multi-host
69
+ if (parsed.hostname?.includes(',')) {
70
+ throw new Error('Multi-host connection strings are not supported for Aurora DSQL');
71
+ }
72
+ return {
73
+ username: parsed.username,
74
+ host: parsed.hostname,
75
+ database: parsed.pathname?.slice(1),
76
+ ssl: parsed.searchParams.get("ssl") || parsed.searchParams.get("sslmode") || undefined,
77
+ };
78
+ }
79
+ function parseRegionFromHost(host) {
80
+ if (!host) {
81
+ throw new Error("Hostname is required to parse region");
82
+ }
83
+ const match = host.match(/^(?<instance>[^.]+)\.(?<dns>dsql(?:-[^.]+)?)\.(?<domain>(?<region>[a-zA-Z0-9-]+)\.on\.aws\.?)$/i);
84
+ if (match?.groups) {
85
+ return match.groups.region;
86
+ }
87
+ throw new Error(`Unable to parse region from hostname: ${host}`);
88
+ }
89
+ function isClusterID(host) {
90
+ return !host.includes(".");
91
+ }
92
+ function buildHostnameFromIdAndRegion(host, region) {
93
+ return host + PRE_REGION_HOST_PATTERN + region + POST_REGION_HOST_PATTERN;
94
+ }
95
+ async function getToken(signer, username) {
96
+ if (username === ADMIN) {
97
+ return await signer.getDbConnectAdminAuthToken();
98
+ }
99
+ else {
100
+ return await signer.getDbConnectAuthToken();
101
+ }
102
+ }
103
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,QAAwB,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAC,UAAU,EAAmB,MAAM,sBAAsB,CAAC;AAElE,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,gBAAgB,GAAG,UAAU,CAAC;AACpC,MAAM,cA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CAAC,CAAC;IAC5H,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,yCAAyC,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,4BAA4B,CAAC,IAAY,EAAE,MAA0B;IAC1E,OAAO,IAAI,GAAG,uBAAuB,GAAG,MAAM,GAAG,wBAAwB,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,MAAkB,EAAE,QAAgB;IACxD,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,MAAM,MAAM,CAAC,0BAA0B,EAAE,CAAC;IACrD,CAAC;SAAM,CAAC;QACJ,OAAO,MAAM,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAChD,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { auroraDSQLPostgres } from './client';
2
+ export type { AuroraDSQLConfig } from './client';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ export { auroraDSQLPostgres } from './client';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@aws/aurora-dsql-postgresjs-connector",
3
+ "version": "0.1.0",
4
+ "description": "An AWS Aurora DSQL connector with IAM authentication for Postgres.js",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/awslabs/aurora-dsql-nodejs-connector"
9
+ },
10
+ "homepage": "https://github.com/awslabs/aurora-dsql-nodejs-connector",
11
+ "keywords": ["aws", "aurora", "dsql", "postgres", "database", "iam", "authentication"],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "test": "jest",
21
+ "test:unit": "jest --testPathIgnorePatterns=test/integration",
22
+ "test:integration": "jest test/integration",
23
+ "test:all": "jest",
24
+ "test:watch": "jest --watch",
25
+ "dev": "tsc --watch",
26
+ "lint": "eslint src/**/*.ts test/**/*.ts",
27
+ "lint:fix": "eslint src/**/*.ts test/**/*.ts --fix"
28
+ },
29
+ "files": [
30
+ "dist/",
31
+ "README.md"
32
+ ],
33
+ "dependencies": {
34
+ "@aws-sdk/credential-providers": "^3.901.0",
35
+ "@aws-sdk/dsql-signer": "^3.920.0"
36
+ },
37
+ "peerDependencies": {
38
+ "postgres": "^3.4.7"
39
+ },
40
+ "devDependencies": {
41
+ "@eslint/js": "^9.37.0",
42
+ "@types/jest": "^29.5.14",
43
+ "@types/node": "^20.19.24",
44
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
45
+ "@typescript-eslint/parser": "^8.46.2",
46
+ "eslint": "^9.38.0",
47
+ "eslint-plugin-header": "^3.1.1",
48
+ "jest": "^29.7.0",
49
+ "postgres": "^3.4.7",
50
+ "ts-jest": "^29.4.5",
51
+ "typescript": "^5.9.3"
52
+ }
53
+ }