Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianfalleiro authored Jan 27, 2025
2 parents c512067 + d89025b commit d580ae8
Show file tree
Hide file tree
Showing 45 changed files with 6,716 additions and 3,993 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# For all files (*), aws/atlas-dev-support is required as reviewer
* @aws/atlas-aws-nodejs-wrapper
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/#semantic-versioning-200).

## [1.1.0] - 2024-12-12

### :magic_wand: Added

- [Configuration Profiles](./docs/using-the-nodejs-wrapper/UsingTheNodejsWrapper.md#configuration-profiles) provide an alternative way of loading plugins and providing configuration parameters ([PR #338](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/338)).
- New network related [configuration parameters](./docs/using-the-nodejs-wrapper/UsingTheNodejsWrapper.md#aws-advanced-nodejs-wrapper-parameters):
- setKeepAlive method ([PR #339](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/339))
- set connect and query timeouts ([PR #342](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/342))
- Fastest Response Strategy Plugin selects reader based on fastest response time ([PR #345](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/345)).
- Simple connection tutorial using Prisma ORM. See [Using The NodeJS Wrapper with Prisma ORM](./examples/prisma_example/README.md).
- Added configuration parameter connectionProvider ([PR #330](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/330)).
- This replaces the setConnectionProvider method. For an example, see: [Using Internal Connection Pooling](./docs/using-the-nodejs-wrapper/using-plugins/UsingTheReadWriteSplittingPlugin.md/#internal-connection-pooling)

### :crab: Changed

- Deprecated configuration parameter [mysqlQueryTimeout](./docs/using-the-nodejs-wrapper/UsingTheNodejsWrapper.md#aws-advanced-nodejs-wrapper-parameters).
- Updated documentation on host patterns, custom endpoints, and prerequisites for the Okta and ADFS Plugins ([PR #319](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/319)) & ([PR #327](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/327)).
- Migrated to AWS JS SDK v3 ([PR #331](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/331)).
- Optimized getHostInfoByStrategy and acceptsStrategy calls for the Plugin Manager ([PR #332](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/332)).
- Updated AwsClient#releaseResources to be a static method called at the end of an application ([PR #333](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/333)) & [PR #347](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/347)).
- Updated Session State logging to display false values ([PR #337](https://github.com/aws/aws-advanced-nodejs-wrapper/pull/337)).

## [1.0.0] - 2024-11-19

The Amazon Web Services (AWS) Advanced NodeJS Wrapper allows an application to take advantage of the features of clustered Aurora databases.
Expand Down
4 changes: 2 additions & 2 deletions common/lib/authentication/aws_secrets_manager_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin {
return await connectFunc();
}
}
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledException", error.name, error.message));
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.name, error.message));
}
throw error;
}
Expand All @@ -149,7 +149,7 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin {
} else if (error instanceof Error && error.message.includes("AWS SDK error")) {
logAndThrowError(Messages.get("AwsSecretsManagerConnectionPlugin.endpointOverrideInvalidConnection", error.message));
} else {
logAndThrowError(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledException", error.message));
logAndThrowError(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.message));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/lib/authentication/iam_authentication_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class IamAuthenticationPlugin extends AbstractConnectionPlugin {
try {
return await connectFunc();
} catch (e) {
logger.debug(Messages.get("Authentication.connectException", (e as Error).message));
logger.debug(Messages.get("Authentication.connectError", (e as Error).message));
if (!this.pluginService.isLoginError(e as Error) || !isCachedToken) {
throw e;
}
Expand Down
5 changes: 2 additions & 3 deletions common/lib/host_list_provider/host_list_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
limitations under the License.
*/

import { AwsClient } from "../aws_client";
import { HostInfo } from "../host_info";
import { HostRole } from "../host_role";
import { DatabaseDialect } from "../database_dialect/database_dialect";
import { ClientWrapper } from "../client_wrapper";

export interface DynamicHostListProvider extends HostListProvider {}
export type DynamicHostListProvider = HostListProvider;

export interface StaticHostListProvider extends HostListProvider {}
export type StaticHostListProvider = HostListProvider;

export interface HostListProvider {
refresh(): Promise<HostInfo[]>;
Expand Down
4 changes: 2 additions & 2 deletions common/lib/plugin_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class PluginManager {
try {
host = plugin.getHostInfoByStrategy(role, strategy, hosts);
} catch (error) {
// This plugin does not support the provided strategy, ignore the exception and move on
// This plugin does not support the provided strategy, ignore the error and move on.
}
}
}
Expand All @@ -338,7 +338,7 @@ export class PluginManager {
return host;
}
} catch (error) {
// This plugin does not support the provided strategy, ignore the exception and move on
// This plugin does not support the provided strategy, ignore the error and move on.
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions common/lib/plugins/efm/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ export class MonitorImpl implements Monitor {
});
}
} catch (error: any) {
logger.debug(Messages.get("MonitorImpl.exceptionDuringMonitoringContinue", error.message));
logger.debug(Messages.get("MonitorImpl.errorDuringMonitoringContinue", error.message));
}
}
} catch (error: any) {
logger.debug(Messages.get("MonitorImpl.exceptionDuringMonitoringStop", error.message));
logger.debug(Messages.get("MonitorImpl.errorDuringMonitoringStop", error.message));
} finally {
this.stopped = true;
await this.endMonitoringClient();
Expand Down
2 changes: 1 addition & 1 deletion common/lib/plugins/efm/monitor_connection_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class MonitorConnectionContext {
this.telemetryAbortedConnectionCounter.inc();
} catch (error: any) {
// ignore
logger.debug(Messages.get("MonitorConnectionContext.exceptionAbortingConnection", error.message));
logger.debug(Messages.get("MonitorConnectionContext.errorAbortingConnection", error.message));
}
this.abortedConnectionCounter++;
}
Expand Down
6 changes: 3 additions & 3 deletions common/lib/plugins/failover/failover_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {

return await methodFunc();
} catch (e: any) {
logger.debug(Messages.get("Failover.detectedException", e.message));
logger.debug(Messages.get("Failover.detectedError", e.message));
if (this._lastError !== e && this.shouldErrorTriggerClientSwitch(e)) {
await this.invalidateCurrentClient();
const currentHostInfo = this.pluginService.getCurrentHostInfo();
Expand Down Expand Up @@ -368,7 +368,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
const result = await this._readerFailoverHandler.failover(this.pluginService.getHosts(), failedHost);

if (result) {
const error = result.exception;
const error = result.error;
if (error) {
throw error;
}
Expand Down Expand Up @@ -424,7 +424,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
const result = await this._writerFailoverHandler.failover(this.pluginService.getHosts());

if (result) {
const error = result.exception;
const error = result.error;
if (error) {
throw error;
}
Expand Down
4 changes: 2 additions & 2 deletions common/lib/plugins/failover/reader_failover_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class ClusterAwareReaderFailoverHandler implements ReaderFailoverHandler
// submit connection attempt tasks in batches of 2
try {
const result = await this.getResultFromNextTaskBatch(hosts, i, failoverTaskId);
if (result && (result.isConnected || result.exception)) {
if (result && (result.isConnected || result.error)) {
return result;
}
} catch (error) {
Expand Down Expand Up @@ -326,7 +326,7 @@ class ConnectionAttemptTask {
} catch (error) {
this.pluginService.setAvailability(this.newHost.allAliases, HostAvailability.NOT_AVAILABLE);
if (error instanceof Error) {
// Propagate exceptions that are not caused by network errors.
// Propagate errors that are not caused by network errors.
if (!this.pluginService.isNetworkError(error)) {
return new ReaderFailoverResult(null, null, false, error, this.taskId);
}
Expand Down
6 changes: 3 additions & 3 deletions common/lib/plugins/failover/reader_failover_result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export class ReaderFailoverResult {
readonly client: ClientWrapper | null;
readonly newHost: HostInfo | null;
readonly isConnected: boolean;
readonly exception?: Error;
readonly error?: Error;
readonly taskId?: number;

constructor(client: ClientWrapper | null, newHost: HostInfo | null, isConnected: boolean, exception?: Error, taskId?: number) {
constructor(client: ClientWrapper | null, newHost: HostInfo | null, isConnected: boolean, error?: Error, taskId?: number) {
this.client = client;
this.newHost = newHost;
this.isConnected = isConnected;
this.exception = exception;
this.error = error;
this.taskId = taskId;
}
}
10 changes: 5 additions & 5 deletions common/lib/plugins/failover/writer_failover_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class ClusterAwareWriterFailoverHandler implements WriterFailoverHandler
.then((result) => {
selectedTask = result.taskName;
// If the first resolved promise is connected or has an error, return it.
if (result.isConnected || result.exception || singleTask) {
if (result.isConnected || result.error || singleTask) {
return result;
}

Expand Down Expand Up @@ -239,9 +239,9 @@ class ReconnectToWriterHandlerTask {
await this.pluginService.forceRefreshHostList(this.currentClient);
latestTopology = this.pluginService.getHosts();
} catch (error) {
// Propagate exceptions that are not caused by network errors.
// Propagate errors that are not caused by network errors.
if (error instanceof AwsWrapperError && !this.pluginService.isNetworkError(error)) {
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskAEncounteredException", error.message));
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskAEncounteredError", error.message));
return new WriterFailoverResult(false, false, [], ClusterAwareWriterFailoverHandler.RECONNECT_WRITER_TASK, null, error);
}
}
Expand Down Expand Up @@ -342,7 +342,7 @@ class WaitForNewWriterHandlerTask {

return new WriterFailoverResult(true, true, this.currentTopology, ClusterAwareWriterFailoverHandler.WAIT_NEW_WRITER_TASK, this.currentClient);
} catch (error: any) {
logger.error(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredException", error.message));
logger.error(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredError", error.message));
throw error;
} finally {
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskBFinished"));
Expand Down Expand Up @@ -410,7 +410,7 @@ class WaitForNewWriterHandlerTask {
}
}
} catch (error: any) {
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredException", error.message));
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredError", error.message));
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions common/lib/plugins/failover/writer_failover_result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export class WriterFailoverResult {
readonly topology: HostInfo[];
readonly client: ClientWrapper | null;
readonly taskName: string;
readonly exception: Error | undefined;
readonly error: Error | undefined;

constructor(isConnected: boolean, isNewHost: boolean, topology: HostInfo[], taskName: string, client: ClientWrapper | null, exception?: Error) {
constructor(isConnected: boolean, isNewHost: boolean, topology: HostInfo[], taskName: string, client: ClientWrapper | null, error?: Error) {
this.isConnected = isConnected;
this.isNewHost = isNewHost;
this.topology = topology;
this.client = client;
this.taskName = taskName;
this.exception = exception;
this.error = error;
}
}
2 changes: 1 addition & 1 deletion common/lib/plugins/federated_auth/federated_auth_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class FederatedAuthPlugin extends AbstractConnectionPlugin {
await this.updateAuthenticationToken(hostInfo, props, region, cacheKey, host);
return await connectFunc();
} catch (e: any) {
throw new AwsWrapperError(Messages.get("SamlAuthPlugin.unhandledException", e.message));
throw new AwsWrapperError(Messages.get("SamlAuthPlugin.unhandledError", e.message));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions common/lib/plugins/federated_auth/okta_auth_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ export class OktaAuthPlugin extends AbstractConnectionPlugin {
return await connectFunc();
} catch (e: any) {
if (!this.pluginService.isLoginError(e as Error) || !isCachedToken) {
logger.debug(Messages.get("Authentication.connectException", e.message));
logger.debug(Messages.get("Authentication.connectError", e.message));
throw e;
}
try {
await this.updateAuthenticationToken(hostInfo, props, region, cacheKey, host);
return await connectFunc();
} catch (e: any) {
throw new AwsWrapperError(Messages.get("SamlAuthPlugin.unhandledException", e.message));
throw new AwsWrapperError(Messages.get("SamlAuthPlugin.unhandledError", e.message));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/lib/plugins/limitless/limitless_router_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class LimitlessRouterServiceImpl implements LimitlessRouterService {
}
await sleep(retryIntervalMs);
} catch (e) {
logger.debug(Messages.get("LimitlessRouterServiceImpl.getLimitlessRoutersException", e.message));
logger.debug(Messages.get("LimitlessRouterServiceImpl.getLimitlessRoutersError", e.message));
}
} while (remainingAttempts-- >= 0);

Expand Down
4 changes: 2 additions & 2 deletions common/lib/plugins/read_write_splitting_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ export class ReadWriteSplittingPlugin extends AbstractConnectionPlugin implement
return await executeFunc();
} catch (error: any) {
if (error instanceof FailoverError) {
logger.debug(Messages.get("ReadWriteSplittingPlugin.failoverExceptionWhileExecutingCommand", methodName));
logger.debug(Messages.get("ReadWriteSplittingPlugin.failoverErrorWhileExecutingCommand", methodName));
await this.closeIdleClients();
} else {
logger.debug(Messages.get("ReadWriteSplittingPlugin.exceptionWhileExecutingCommand", methodName, error.message));
logger.debug(Messages.get("ReadWriteSplittingPlugin.errorWhileExecutingCommand", methodName, error.message));
}

throw error;
Expand Down
2 changes: 1 addition & 1 deletion common/lib/pooled_connection_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

import { ConnectionProvider } from "./connection_provider";

export interface PooledConnectionProvider extends ConnectionProvider {}
export type PooledConnectionProvider = ConnectionProvider;
Loading

0 comments on commit d580ae8

Please sign in to comment.