Socket
Socket
Sign inDemoInstall

fiftyone.pipeline.engines

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fiftyone.pipeline.engines - npm Package Compare versions

Comparing version 4.1.2 to 4.2.0

errorMessages.js

4

aspectData.js

@@ -31,2 +31,4 @@ /* *********************************************************************

const util = require('util');
const errorMessages = require('./errorMessages');
const ElementData = require51('fiftyone.pipeline.core').ElementData;

@@ -89,3 +91,3 @@ const MissingPropertyServiceBase = require('./missingPropertyService');

if (!this.flowElement.restrictedProperties.includes(key)) {
throw `Property ${key} was excluded from ${this.flowElement.dataKey}`;
throw util.format(errorMessages.propertyExcluded, key);
}

@@ -92,0 +94,0 @@ }

@@ -38,3 +38,3 @@ /* *********************************************************************

// First require the core Pipeline
const FiftyOnePipelineCore = require('fiftyone.pipeline.core');
const FiftyOnePipelineCore = require(__dirname + '/../../fiftyone.pipeline.core');

@@ -179,33 +179,35 @@ // Next require the engines extension that extends flowElements to support

const server = http.createServer((req, res) => {
const flowData = pipeline.createFlowData();
// Add any information from the request
// (headers, cookies and additional client side provided information)
flowData.evidence.addFromRequest(req);
flowData.process().then(function () {
// Output the date of birth form with any results if they exist
const output = `
<h1>Starsigns</h1>
${flowData.astrology.starSign
? '<p>Your starsign is ' +
flowData.astrology.starSign + ' </p>'
: '<p>Add your date of birth to get your starsign</p>'
}
<form>
<label for='dateOfBirth'>Date of birth</label>
<input type='date' name='dateOfBirth' id='dateOfBirth'>
<input type='submit'>
</form>
`;
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
res.end(output);
});
if (req.url !== '/favicon.ico') {
const flowData = pipeline.createFlowData();
// Add any information from the request
// (headers, cookies and additional client side provided information)
flowData.evidence.addFromRequest(req);
flowData.process().then(function () {
// Output the date of birth form with any results if they exist
const output = `
<h1>Starsigns</h1>
${flowData.astrology.starSign
? '<p>Your starsign is ' +
flowData.astrology.starSign + ' </p>'
: '<p>Add your date of birth to get your starsign</p>'
}
<form>
<label for='dateOfBirth'>Date of birth</label>
<input type='date' name='dateOfBirth' id='dateOfBirth'>
<input type='submit'>
</form>
`;
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
res.end(output);
});
}
});

@@ -212,0 +214,0 @@

@@ -23,2 +23,5 @@ /* *********************************************************************

const util = require('util');
const errorMessages = require('./errorMessages');
/**

@@ -39,6 +42,46 @@ * Base class for a missing property service that throws

check (key, flowElement) {
throw 'Property ' + key + ' not found in ' + flowElement.dataKey;
let message = util.format(errorMessages.genericMissingProperties, key) +
(typeof flowElement === 'undefined' ? '' : ' in data for element "' + flowElement.dataKey) + '".';
if (this._isCloudEngine(flowElement)) {
if (typeof flowElement.properties === 'undefined') {
message = message +
util.format(errorMessages.cloudNoPropertiesAccess,
flowElement.dataKey);
} else {
var properties = Object.getOwnPropertyNames(flowElement.properties);
if (properties.includes(key) === false) {
message = message +
util.format(errorMessages.cloudNoPropertyAccess,
flowElement.dataKey, properties.join(', '));
} else {
message = message + util.format(errorMessages.cloudReasonUnknown);
}
}
} else {
message = message + util.format(errorMessages.noReasonUnknown);
}
throw message;
}
/**
* Return true if the supplied flow element is a CloudEngine, false if not.
* @param {flowElement} flowElement The flow element to check
*/
_isCloudEngine (flowElement) {
try {
if (flowElement.__proto__ === null) {
return false;
} else {
return flowElement.__proto__.constructor.name === 'CloudEngine' ||
this._isCloudEngine(flowElement.__proto__);
}
} catch (e) {
// If some error ocurred, then assume this is not a cloud engine.
return false;
}
}
}
module.exports = MissingPropertyService;
{
"name": "fiftyone.pipeline.engines",
"version": "4.1.2",
"version": "4.2.0",
"description": "Shared base functionality for implementing engines for the 51Degrees Pipeline API",

@@ -14,3 +14,3 @@ "main": "index.js",

"dependencies": {
"fiftyone.pipeline.core": "^4.1.0-beta"
"fiftyone.pipeline.core": "^4.2.0"
},

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

@@ -23,2 +23,4 @@ /* *********************************************************************

const util = require('util');
const errorMessages = require('../errorMessages');
const Engine = require(__dirname + '/../engine');

@@ -93,3 +95,4 @@ const PipelineBuilder = require(

} catch (e) {
expect(e.indexOf('excluded') !== -1).toBe(true);
expect(e.indexOf(
util.format(errorMessages.propertyExcluded, 'two')) !== -1).toBe(true);
}

@@ -106,3 +109,6 @@

} catch (e) {
expect(e.indexOf('not found') !== -1).toBe(true);
expect(e.indexOf(
util.format(errorMessages.genericMissingProperties, 'three') +
' in data for element "testEngine".' +
util.format(errorMessages.noReasonUnknown)) !== -1).toBe(true);
}

@@ -109,0 +115,0 @@

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