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

machine

Package Overview
Dependencies
Maintainers
5
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machine - npm Package Compare versions

Comparing version 5.0.1 to 6.0.0

9

DEPENDENCIES.md

@@ -11,9 +11,10 @@ # Dependency Licenses

switchback@^1.1.3 : MIT
lodash@~2.4.1 : MIT
convert-to-ecmascript-compatible-varname@^0.1.0 : MIT
debug@^2.1.1 : MIT
lodash@^3.8.0 : MIT
object-hash@~0.3.0 : MIT
convert-to-ecmascript-compatible-varname@^0.1.0 : MIT
rttc@^2.0.5 : MIT
debug@^2.1.1 : MIT
switchback@^1.1.3 : MIT
ms@0.7.1 : MIT
lodash@~2.4.1 : MIT

@@ -20,0 +21,0 @@ Found a module that is incorrectly or not detected at all but does

@@ -51,2 +51,18 @@ /**

if (_.isUndefined(machine._configuredInputs[inputName])){
//
// NOTE: This step is crucial!
// This check in the machine runner is the only way to allows undefined values
// when there is an explicit example; even when that example is `*`.
//
// `rttc` normally treats everything as if it is required.
// So if you are validating against a nested `*` in the example, for instance,
// if the actual value is `undefined`, the validation will fail.
//
// That said, `undefined` _can_ make it past validation if it is attached
// to a key in a nested dictionary, or as an item in a nested array within
// a dict/array that is passed through `example: '*'`.
//
// In the same situation, but with `example: {}` or `example: []`, `undefined` items
// will be removed from arrays, and if there are any keys with `undefined` attached as
// a value, those keys will be stripped.
return;

@@ -78,2 +94,6 @@ }

// function, if one exists.
//
////////////////////////////////////////////////////////////////////////
// WARNING: THIS FEATURE WILL BE DEPRECATED IN AN UPCOMING RELEASE.
////////////////////////////////////////////////////////////////////////
var example;

@@ -88,27 +108,23 @@ try {

// Now infer the `typeSchema`.
var typeSchema;
// Use the example, if it exists.
if (!_.isUndefined(example)){
try {
typeSchema = rttc.infer(example);
}
catch (e) {
e.input = inputName;
errors.push(e);
return;
}
}
// If the input has no example, but it has an explicit `typeclass`,
// use that typeclass as the type schema for validation.
// infer a type schema from that `typeclass`
//
////////////////////////////////////////////////////////////////////////
// WARNING: THIS FEATURE WILL BE DEPRECATED IN AN UPCOMING RELEASE.
////////////////////////////////////////////////////////////////////////
if (_.isUndefined(typeSchema) && inputDef.typeclass){
// Handle typeclass array by setting the star array
// Handle typeclass array by setting `example: []`
if(inputDef.typeclass === 'array') {
typeSchema = ['*'];
typeSchema = [];
}
// Handle typeclass dictionary by setting an empty object
// Handle typeclass dictionary by setting `example: {}`
if(inputDef.typeclass === 'dictionary') {

@@ -118,24 +134,41 @@ typeSchema = {};

// But also ensure that the configured input value is not an array
if (_.isArray(machine._configuredInputs[inputName])){
errors.push((function (){
var _err = new Error(util.format('input %s: typeclass: dictionary, but an array was provided: %s', inputName, util.inspect(machine._configuredInputs[inputName], false, null)));
_err.code = 'E_TYPECLASS';
_err.input = inputName;
_err.reason = _err.message;
// _err.status = 400;
return _err;
})());
}
// if (_.isArray(machine._configuredInputs[inputName])){
// errors.push((function (){
// var _err = new Error(util.format('input %s: typeclass: dictionary, but an array was provided: %s', inputName, util.inspect(machine._configuredInputs[inputName], false, null)));
// _err.code = 'E_TYPECLASS';
// _err.input = inputName;
// _err.reason = _err.message;
// // _err.status = 400;
// return _err;
// })());
// }
}
// Handle typeclass * by setting a '*'
if(inputDef.typeclass === '*' || inputDef.typeclass === 'machine') {
if(inputDef.typeclass === '*') {
typeSchema = '*';
}
// Handle typeclass 'machine' (which will be deprecated soon) by setting a '*'
if (inputDef.typeclass === 'machine') {
typeSchema = '*';
}
}
// console.log('got typeSchema:', typeSchema,'from example:', example);
// Prefer the example over typeclass, if one exists.
if (!_.isUndefined(example)){
try {
typeSchema = rttc.infer(example);
}
catch (e) {
e.input = inputName;
errors.push(e);
return;
}
}
// Now that we have a type schema, validate and/or coerce the input value,
// pushing on any errors we detect.
// Now that we have a type schema, validate the input value
// (which oftentimes also sanitizes it a little bit)
// and push on any errors we detect.
var coercedInputValue;

@@ -142,0 +175,0 @@ try {

{
"name": "machine",
"version": "5.0.1",
"version": "6.0.0",
"description": "Configure and execute machines",

@@ -32,8 +32,8 @@ "main": "index.js",

"dependencies": {
"switchback": "^1.1.3",
"lodash": "~2.4.1",
"convert-to-ecmascript-compatible-varname": "^0.1.0",
"debug": "^2.1.1",
"lodash": "^3.8.0",
"object-hash": "~0.3.0",
"convert-to-ecmascript-compatible-varname": "^0.1.0",
"rttc": "^2.0.5",
"debug": "^2.1.1"
"switchback": "^1.1.3"
},

@@ -40,0 +40,0 @@ "devDependencies": {

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