aws-core-utils
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "aws-core-utils", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Core utilities for working with Amazon Web Services (AWS), including ARNs, regions, stages, Lambdas, AWS errors, stream events, Kinesis, DynamoDB.DocumentClients, etc.", | ||
@@ -15,3 +15,3 @@ "author": "Byron du Preez", | ||
"core-functions": "^2.0.3", | ||
"logging-utils": "^2.0.1", | ||
"logging-utils": "^2.0.3", | ||
"deep-equal": "^1.0.1" | ||
@@ -18,0 +18,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# aws-core-utils v3.0.0 | ||
# aws-core-utils v3.0.1 | ||
@@ -278,2 +278,8 @@ Core utilities for working with Amazon Web Services (AWS), including ARNs, regions, stages, Lambdas, AWS errors, stream events, Kinesis, DynamoDB.DocumentClients, etc. | ||
### 3.0.1 | ||
- Changes to `stages.js` module: | ||
- Added a convenience `configureStageHandlingIfNotConfigured` function | ||
- Changed `configureDefaultStageHandlingIfNotConfigured` function to use new `configureStageHandlingIfNotConfigured` function | ||
- Updated `logging-utils` dependency to version 2.0.3 | ||
### 3.0.0 | ||
@@ -280,0 +286,0 @@ - Changes to `stages.js` module: |
@@ -36,2 +36,3 @@ 'use strict'; | ||
getStageHandlingFunction: getStageHandlingFunction, | ||
configureStageHandlingIfNotConfigured: configureStageHandlingIfNotConfigured, | ||
// Stage resolution | ||
@@ -296,15 +297,40 @@ resolveStage: resolveStage, | ||
* @param {Object} context - the context to configure with default logging and stage handling | ||
* @param {string} caller - a short description to identify the caller of this function for logging purposes | ||
* @param {string|undefined} [caller] - optional arbitrary text to identify the caller of this function | ||
* @returns {Object} the given context | ||
*/ | ||
function configureDefaultStageHandlingIfNotConfigured(context, caller) { | ||
// Also configure logging if not already configured | ||
if (!logging.isLoggingConfigured(context)) { | ||
logging.configureDefaultLogging(context, undefined, undefined, true); | ||
context.warn(`Logging was not configured before calling ${caller} - using default logging configuration`); | ||
} | ||
return configureStageHandlingIfNotConfigured(context, undefined, undefined, undefined, undefined, caller); | ||
} | ||
/** | ||
* If no stage handling settings have been configured yet, then configure the given context with the given stage | ||
* handling settings (if any) otherwise with the default stage handling settings partially overridden by the given stage | ||
* handling options (if any). | ||
* | ||
* @param {Object} context - the context to configure | ||
* @param {StageHandlingSettings|undefined} [settings] - optional stage handling settings to use to configure stage handling | ||
* @param {StageHandlingOptions|undefined} [options] - optional stage handling options to use to override default options | ||
* @param {Object|undefined} [otherSettings] - optional other configuration settings to use | ||
* @param {LoggingSettings|undefined} [otherSettings.loggingSettings] - optional logging settings to use to configure logging | ||
* @param {Object|undefined} [otherOptions] - optional other configuration options to use if corresponding settings are not provided | ||
* @param {LoggingOptions|undefined} [otherOptions.loggingOptions] - optional logging options to use to configure logging | ||
* @param {string|undefined} [caller] - optional arbitrary text to identify the caller of this function | ||
* @returns {Object} the given context | ||
*/ | ||
function configureStageHandlingIfNotConfigured(context, settings, options, otherSettings, otherOptions, caller) { | ||
// Also configure logging if not already configured, since it is a dependency | ||
logging.configureLoggingIfNotConfigured(context, otherSettings ? otherSettings.loggingSettings : undefined, | ||
otherOptions ? otherOptions.loggingOptions : undefined, undefined, caller); | ||
// Configure stage handling if not already configured | ||
if (!isStageHandlingConfigured(context)) { | ||
context.warn(`Stage handling was not configured before calling ${caller} - using default stage handling configuration`); | ||
configureDefaultStageHandling(context, undefined, true); | ||
if (settings && typeof settings === 'object') { | ||
context.warn(`Stage handling was not configured${caller ? ` before calling ${caller}` : ''} - using stage handling settings (${stringify(settings)})`); | ||
configureStageHandling(context, settings, true); | ||
} else { | ||
context.warn(`Stage handling was not configured${caller ? ` before calling ${caller}` : ''} - using default stage handling configuration with options (${stringify(options)})`); | ||
configureDefaultStageHandling(context, options, true); | ||
} | ||
} | ||
return context; | ||
} | ||
@@ -311,0 +337,0 @@ |
{ | ||
"name": "aws-core-utils-tests", | ||
"description": "Unit tests for aws-core-utils modules", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"author": "Byron du Preez", | ||
@@ -6,0 +6,0 @@ "license": "Apache-2.0", |
247333
3659
372
Updatedlogging-utils@^2.0.3