aws-core-utils
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -15,2 +15,4 @@ 'use strict'; | ||
const Objects = require('core-functions/objects'); | ||
const Strings = require('core-functions/strings'); | ||
@@ -55,3 +57,3 @@ const stringify = Strings.stringify; | ||
// If no options were specified, then use an empty object | ||
const options = dynamoDBDocClientOptions ? dynamoDBDocClientOptions : {}; | ||
const options = dynamoDBDocClientOptions ? Objects.copy(dynamoDBDocClientOptions, true) : {}; | ||
@@ -58,0 +60,0 @@ // If no region was specified in the given dynamoDBDocClient options, then set it to the current region |
@@ -15,2 +15,4 @@ 'use strict'; | ||
const Objects = require('core-functions/objects'); | ||
const Strings = require('core-functions/strings'); | ||
@@ -52,3 +54,3 @@ const stringify = Strings.stringify; | ||
// If no options were specified, then use an empty object | ||
const options = kinesisOptions ? kinesisOptions : {}; | ||
const options = kinesisOptions ? Objects.copy(kinesisOptions, true) : {}; | ||
@@ -80,7 +82,2 @@ // If no region was specified in the given kinesis options, then set it to the current region | ||
const optionsUsed = kinesisOptionsByRegionKey.get(regionKey); | ||
// context.debug(`options = ${JSON.stringify(options)}`); | ||
// context.debug(`optionsUsed = ${JSON.stringify(optionsUsed)}`); | ||
// context.debug(`optionsUsed == options = ${optionsUsed == options}`); | ||
// context.debug(`optionsUsed === options = ${optionsUsed === options}`); | ||
// context.debug(`deepEqual(optionsUsed, options) = ${deepEqual(optionsUsed, options)}`); | ||
@@ -87,0 +84,0 @@ if (deepEqual(optionsUsed, options, strict)) { |
{ | ||
"name": "aws-core-utils", | ||
"version": "5.0.0", | ||
"version": "5.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.", | ||
@@ -14,4 +14,4 @@ "author": "Byron du Preez", | ||
"dependencies": { | ||
"core-functions": "^2.0.5", | ||
"logging-utils": "^3.0.0", | ||
"core-functions": "^2.0.7", | ||
"logging-utils": "^3.0.1", | ||
"deep-equal": "^1.0.1" | ||
@@ -18,0 +18,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# aws-core-utils v5.0.0 | ||
# aws-core-utils v5.0.1 | ||
@@ -294,2 +294,10 @@ Core utilities for working with Amazon Web Services (AWS), including ARNs, regions, stages, Lambdas, AWS errors, stream events, Kinesis, DynamoDB.DocumentClients, etc. | ||
### 5.0.1 | ||
- Changes to `kinesis-cache.js` module: | ||
- Changed `setKinesis` to only modify a copy of the given kinesisOptions to avoid side-effects | ||
- Changes to `dynamodb-doc-client-cache.js` module: | ||
- Changed `setDynamoDBDocClient` to only modify a copy of the given dynamoDBDocClientOptions to avoid side-effects | ||
- Updated `core-functions` dependency to version 2.0.7 | ||
- Updated `tape` dependency to 4.6.3 | ||
### 5.0.0 | ||
@@ -296,0 +304,0 @@ - Changes to `arns.js` module: |
@@ -35,4 +35,4 @@ 'use strict'; | ||
configureStageHandlingWithSettings: configureStageHandlingWithSettings, | ||
getDefaultStageHandlingSettings: getDefaultStageHandlingSettings, | ||
configureDefaultStageHandling: configureDefaultStageHandling, | ||
getDefaultStageHandlingSettings: getDefaultStageHandlingSettings, | ||
getStageHandlingSetting: getStageHandlingSetting, | ||
@@ -229,7 +229,2 @@ getStageHandlingFunction: getStageHandlingFunction, | ||
function select(opts, propertyName, defaultValue) { | ||
const value = opts ? opts[propertyName] : undefined; | ||
return isNotBlank(value) ? trim(value) : defaultValue | ||
} | ||
/** | ||
@@ -246,8 +241,8 @@ * Returns the default stage handling settings partially overridden by the given stage handling options (if any). | ||
function getDefaultStageHandlingSettings(options) { | ||
const settings = options && typeof options === 'object' ? Objects.copy(options, true) : {}; | ||
const defaults = loadDefaultStageHandlingOptions(); | ||
const defaultOptions = loadDefaultStageHandlingOptions(); | ||
Objects.merge(defaultOptions, settings, false, false); | ||
return { | ||
envStageName: select(options, 'envStageName', defaults.envStageName), | ||
const defaultSettings = { | ||
customToStage: undefined, | ||
@@ -258,13 +253,7 @@ convertAliasToStage: convertAliasToStage, | ||
extractStageFromStreamName: extractStageFromSuffixedStreamName, | ||
streamNameStageSeparator: select(options, 'streamNameStageSeparator', defaults.streamNameStageSeparator), | ||
injectStageIntoResourceName: toStageSuffixedResourceName, | ||
extractStageFromResourceName: extractStageFromSuffixedResourceName, | ||
resourceNameStageSeparator: select(options, 'resourceNameStageSeparator', defaults.resourceNameStageSeparator), | ||
injectInCase: select(options, 'injectInCase', defaults.injectInCase), | ||
extractInCase: select(options, 'extractInCase', defaults.extractInCase), | ||
defaultStage: select(options, 'defaultStage', undefined) | ||
}; | ||
return Objects.merge(defaultSettings, settings, false, false); | ||
} | ||
@@ -279,10 +268,13 @@ | ||
const options = require('./stages-options.json'); | ||
const defaultOptions = options ? options.stageHandlingOptions : undefined; | ||
return { | ||
envStageName: select(defaultOptions, 'envStageName', 'STAGE'), | ||
streamNameStageSeparator: select(defaultOptions, 'streamNameStageSeparator', '_'), | ||
resourceNameStageSeparator: select(defaultOptions, 'resourceNameStageSeparator', '_'), | ||
injectInCase: select(defaultOptions, 'injectInCase', 'upper'), | ||
extractInCase: select(defaultOptions, 'extractInCase', 'lower') | ||
const defaultOptions = options ? options.stageHandlingOptions : {}; | ||
const defaults = { | ||
envStageName: 'STAGE', | ||
streamNameStageSeparator: '_', | ||
resourceNameStageSeparator: '_', | ||
injectInCase: 'upper', | ||
extractInCase: 'lower', | ||
defaultStage: undefined | ||
}; | ||
return Objects.merge(defaults, defaultOptions, false, false); | ||
} | ||
@@ -330,2 +322,6 @@ | ||
function configureStageHandling(context, settings, options, otherSettings, otherOptions, forceConfiguration) { | ||
// Determine the stage handling settings to be used | ||
const settingsAvailable = settings && typeof settings === 'object'; | ||
const optionsAvailable = options && typeof options === 'object'; | ||
// // First configure all stage handling dependencies | ||
@@ -337,9 +333,6 @@ // configureDependencies(context, otherSettings, otherOptions, false); | ||
// Determine the stage handling settings to be used | ||
const settingsAvailable = settings && typeof settings === 'object'; | ||
const optionsAvailable = options && typeof options === 'object'; | ||
const defaultSettings = getDefaultStageHandlingSettings(options); | ||
const stageHandlingSettings = settingsAvailable ? | ||
optionsAvailable ? Objects.merge(options, settings, false, false) : settings : | ||
getDefaultStageHandlingSettings(options); | ||
Objects.merge(defaultSettings, settings, false, false) : defaultSettings; | ||
@@ -350,3 +343,3 @@ // Configure stage handling with the given or derived stage handling settings | ||
// Log a warning if no settings and no options were provided and the default settings were applied | ||
if (!settingsAvailable && (!options || typeof options !== 'object') && (forceConfiguration || !stageHandlingWasConfigured)) { | ||
if (!settingsAvailable && !optionsAvailable && (forceConfiguration || !stageHandlingWasConfigured)) { | ||
context.warn(`Stage handling was configured without settings or options - used default stage handling configuration (${stringify(stageHandlingSettings)})`); | ||
@@ -353,0 +346,0 @@ } |
{ | ||
"name": "aws-core-utils-tests", | ||
"description": "Unit tests for aws-core-utils modules", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"author": "Byron du Preez", | ||
@@ -15,5 +15,5 @@ "license": "Apache-2.0", | ||
"node-uuid": "^1.4.7", | ||
"tape": "^4.6.2" | ||
"tape": "^4.6.3" | ||
}, | ||
"repository": "https://github.com/byron-dupreez/aws-core-utils" | ||
} |
@@ -455,2 +455,5 @@ 'use strict'; | ||
defaultStage: 'defaultStage', | ||
// A simulated custom property | ||
myCustomProperty: 'myCustomProperty' | ||
}; | ||
@@ -457,0 +460,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
436
296095
4280
Updatedcore-functions@^2.0.7
Updatedlogging-utils@^3.0.1