Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-core-utils

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-core-utils - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

2

package.json
{
"name": "aws-core-utils",
"version": "3.0.1",
"version": "3.0.2",
"description": "Core utilities for working with Amazon Web Services (AWS), including ARNs, regions, stages, Lambdas, AWS errors, stream events, Kinesis, DynamoDB.DocumentClients, etc.",

@@ -5,0 +5,0 @@ "author": "Byron du Preez",

@@ -1,2 +0,2 @@

# aws-core-utils v3.0.1
# aws-core-utils v3.0.2

@@ -170,9 +170,10 @@ Core utilities for working with Amazon Web Services (AWS), including ARNs, regions, stages, Lambdas, AWS errors, stream events, Kinesis, DynamoDB.DocumentClients, etc.

const stages = require('aws-core-utils/stages');
const config = require('./config.json'); // ... or your own config file
const settings = undefined; // ... or your own custom settings
const options = require('./config.json'); // ... or your own custom options
// ... EITHER using the default stage handling configuration partially customised via config.stageHandlingOptions
stages.configureDefaultStageHandling(context, config.stageHandlingOptions, forceConfiguration);
stages.configureDefaultStageHandling(context, options.stageHandlingOptions, settings, options, forceConfiguration);
// ... OR using your own custom stage-handling configuration
const stageHandlingSettings = stages.getDefaultStageHandlingSettings(config.stageHandlingOptions);
const stageHandlingSettings = stages.getDefaultStageHandlingSettings(options.stageHandlingOptions);
// Optionally override the default stage handling functions with your own custom functions

@@ -185,8 +186,8 @@ // stageHandlingSettings.customToStage = undefined;

// stageHandlingSettings.extractStageFromResourceName = stages.DEFAULTS.extractStageFromSuffixedResourceName;
stages.configureStageHandling(context, stageHandlingSettings, forceConfiguration);
stages.configureStageHandling(context, stageHandlingSettings, settings, options, forceConfiguration);
// ... OR using completely customised stage handling settings
const settings = {
const stageHandlingSettings2 = {
customToStage: myCustomToStageFunction, // or undefined if not needed
convertAliasToStage: myConvertAliasToStageFunction, // or undefined to knockout using aliases as stages
convertAliasToStage: myConvertAliasToStageFunction, // or undefined to knockout using AWS aliases as stages

@@ -206,3 +207,3 @@ injectStageIntoStreamName: myInjectStageIntoStreamNameFunction,

}
stages.configureStageHandling(context, settings, forceConfiguration);
stages.configureStageHandling(context, stageHandlingSettings2, settings, options, forceConfiguration);

@@ -281,2 +282,11 @@

### 3.0.2
- Changes to `stages.js` module:
- Added `configureDependenciesIfNotConfigured` function to configure stage handling dependencies (i.e. only logging for now)
- Changed `configureStageHandlingIfNotConfigured` function to first invoke new `configureDependenciesIfNotConfigured` function
- Changed `configureStageHandling` function to accept `otherSettings` and `otherOptions` as 3rd & 4th arguments to
enable configuration of dependencies and to first invoke invoke new `configureDependenciesIfNotConfigured` function
- Changed `configureDefaultStageHandling` function to accept `otherSettings` and `otherOptions` as 3rd & 4th arguments
to enable configuration of dependencies and to always invoke `configureStageHandling`
### 3.0.1

@@ -283,0 +293,0 @@ - Changes to `stages.js` module:

@@ -162,2 +162,6 @@ 'use strict';

* @param {StageHandlingSettings} settings - the new stage handling settings to use
* @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 no corresponding other settings are provided
* @param {LoggingOptions|undefined} [otherOptions.loggingOptions] - optional logging options to use to configure logging
* @param {boolean|undefined} [forceConfiguration] - whether or not to force configuration of the given settings, which

@@ -167,3 +171,5 @@ * will override any previously configured stage handling settings on the given context

*/
function configureStageHandling(context, settings, forceConfiguration) {
function configureStageHandling(context, settings, otherSettings, otherOptions, forceConfiguration) {
// Configure all dependencies if not configured
configureDependenciesIfNotConfigured(context, otherSettings, otherOptions, configureStageHandling.name);

@@ -203,2 +209,6 @@ // If forceConfiguration is false check if the given context already has stage handling configured on it

* @param {StageHandlingOptions|undefined} [options] - optional stage handling options to use to override the 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 no corresponding other settings are provided
* @param {LoggingOptions|undefined} [otherOptions.loggingOptions] - optional logging options to use to configure logging
* @param {boolean|undefined} forceConfiguration - whether or not to force configuration of the default settings, which

@@ -208,11 +218,5 @@ * will override any previously configured stage handling settings on the given context

*/
function configureDefaultStageHandling(context, options, forceConfiguration) {
// If forceConfiguration is false check if the given context already has stage handling configured on it
// and, if so, do nothing more and simply return the context as is (to prevent overriding an earlier configuration)
if (!forceConfiguration && isStageHandlingConfigured(context)) {
return context;
}
function configureDefaultStageHandling(context, options, otherSettings, otherOptions, forceConfiguration) {
const settings = getDefaultStageHandlingSettings(options);
return configureStageHandling(context, settings, forceConfiguration);
return configureStageHandling(context, settings, otherSettings, otherOptions, forceConfiguration);
}

@@ -275,2 +279,20 @@

/**
* Configures the given context with the stage handling dependencies (currently only logging) using the given other
* settings and given other options.
*
* @param {Object} context - the context onto which to configure the given stream processing dependencies
* @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 no corresponding other settings are 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 context object configured with stream processing dependencies
*/
function configureDependenciesIfNotConfigured(context, otherSettings, otherOptions, caller) {
// Configure logging if not configured yet
logging.configureLoggingIfNotConfigured(context, otherSettings ? otherSettings.loggingSettings : undefined,
otherOptions ? otherOptions.loggingOptions : undefined, undefined, caller);
}
/**
* Returns the value of the named stage handling setting (if any) on the given context.

@@ -324,5 +346,4 @@ * @param context - the context from which to fetch the named setting's value

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 all dependencies if not configured
configureDependenciesIfNotConfigured(context, otherSettings, otherOptions, configureStageHandlingIfNotConfigured.name);

@@ -333,6 +354,6 @@ // Configure stage handling if not already configured

context.warn(`Stage handling was not configured${caller ? ` before calling ${caller}` : ''} - using stage handling settings (${stringify(settings)})`);
configureStageHandling(context, settings, true);
configureStageHandling(context, settings, otherSettings, otherOptions, 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);
configureDefaultStageHandling(context, options, otherSettings, otherOptions, true);
}

@@ -339,0 +360,0 @@ }

{
"name": "aws-core-utils-tests",
"description": "Unit tests for aws-core-utils modules",
"version": "3.0.1",
"version": "3.0.2",
"author": "Byron du Preez",

@@ -6,0 +6,0 @@ "license": "Apache-2.0",

@@ -21,7 +21,7 @@ 'use strict';

// Stream name qualification
const toStageQualifiedStreamName = stages.toStageQualifiedStreamName;
const extractStageFromQualifiedStreamName = stages.extractStageFromQualifiedStreamName;
// const toStageQualifiedStreamName = stages.toStageQualifiedStreamName;
// const extractStageFromQualifiedStreamName = stages.extractStageFromQualifiedStreamName;
// Resource name qualification
const toStageQualifiedResourceName = stages.toStageQualifiedResourceName;
const extractStageFromQualifiedResourceName = stages.extractStageFromQualifiedResourceName;
// const toStageQualifiedResourceName = stages.toStageQualifiedResourceName;
// const extractStageFromQualifiedResourceName = stages.extractStageFromQualifiedResourceName;

@@ -39,4 +39,4 @@ // DEFAULTS - default implementations

// Generic utils
const toStageSuffixedName = stages.DEFAULTS.toStageSuffixedName;
const toCase = stages.DEFAULTS.toCase
// const toStageSuffixedName = stages.DEFAULTS.toStageSuffixedName;
const toCase = stages.DEFAULTS.toCase;

@@ -52,6 +52,6 @@ const Strings = require('core-functions/strings');

// Constants
const latestFunctionVersion = samples.latestFunctionVersion;
// const latestFunctionVersion = samples.latestFunctionVersion;
// General
const sampleNumberString = samples.sampleNumberString;
// const sampleNumberString = samples.sampleNumberString;

@@ -141,3 +141,3 @@ // For AWS contexts

};
configureStageHandling(context, settings, forceConfiguration);
configureStageHandling(context, settings, undefined, undefined, forceConfiguration);

@@ -227,3 +227,3 @@ const after = context.stageHandling;

// Configure it
configureDefaultStageHandling(context, forceConfiguration, t);
configureDefaultStageHandling(context, undefined, undefined, undefined, forceConfiguration);

@@ -230,0 +230,0 @@ const after = context.stageHandling;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc