New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

machinepack-localmachinepacks

Package Overview
Dependencies
Maintainers
5
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

machinepack-localmachinepacks - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

43

machines/build-machine-code.js

@@ -85,2 +85,5 @@ module.exports = {

couldNotParseFnInsideInput: {},
couldNotParseFnInsideExit: {},
couldNotParseFn: {

@@ -100,4 +103,39 @@ description: 'The provided `fn` could not be parsed as a function.'

var util = require('util');
var rttc = require('rttc');
var _ = require('lodash');
// Wrap any `getExample` function strings in a function wrapper, and convert
// to a real js function.
try {
inputs.exits = _.mapValues(inputs.exits, function (exitDef, exitId){
if (_.isString(exitDef.getExample)) {
exitDef.getExample = new Function('inputs','env', exitDef.getExample);
}
return exitDef;
});
}
catch (e){
return exits.couldNotParseFnInsideExit(e);
}
// Wrap any `validate` or `defaultsTo` function strings in a function wrapper,
// and convert to a real js function.
try {
inputs.inputs = _.mapValues(inputs.inputs, function (inputDef, inputId){
if (_.isString(inputDef.validate)) {
inputDef.validate = new Function('inputs','env', inputDef.validate);
}
// Hydrate any functions in the `defaultsTo`:
if (inputDef.defaultsTo) {
inputDef.defaultsTo = rttc.hydrate(inputDef.defaultsTo, rttc.infer(inputDef.example));
}
return inputDef;
});
}
catch (e){
return exits.couldNotParseFnInsideInput(e);
}
// Parse encoded `fn` to a real JavaScript function, then `toString` it again.

@@ -118,2 +156,3 @@ var fn;

}
// console.log('*********** BUILDING MACHINE CODE ************',util.inspect(inputs,{depth:null}));

@@ -143,3 +182,3 @@ var code = 'module.exports = {\n\n\n';

memo += util.format('\n\n %s: {%s\n },', name, _.reduce(def, function (submemo, value, key){
submemo += util.format('\n %s: %s,', key, util.inspect(value, false, null));
submemo += util.format('\n %s: %s,', key, rttc.compile(value));
return submemo;

@@ -151,3 +190,3 @@ },''));

memo += util.format('\n\n %s: {%s\n },', name, _.reduce(def, function (submemo, value, key){
submemo += util.format('\n %s: %s,', key, util.inspect(value, false, null));
submemo += util.format('\n %s: %s,', key, rttc.compile(value));
return submemo;

@@ -154,0 +193,0 @@ },''));

3

machines/write-pack.js

@@ -89,3 +89,4 @@ module.exports = {

}]
}), packData);
}), rttc.dehydrate(packData, true));
// ^Note that we dehydrate before coercing in order to ensure functions are stringified.

@@ -92,0 +93,0 @@ // Just in case...

{
"name": "machinepack-localmachinepacks",
"version": "1.7.0",
"version": "1.8.0",
"description": "Work with local machinepacks.",

@@ -30,3 +30,3 @@ "scripts": {

"open": "0.0.5",
"rttc": "^7.0.1"
"rttc": "^8.0.0"
},

@@ -33,0 +33,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