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

asl-validator

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asl-validator - npm Package Compare versions

Comparing version 3.0.4 to 3.0.5

33

dist/src/checks/duplicate-payload-template-fields.js

@@ -14,24 +14,7 @@ "use strict";

var errorMessages = [];
var valuesToInspect = [];
try {
valuesToInspect = (0, jsonpath_plus_1.JSONPath)({
json: definition,
// this uses some extensions to the original JSONPath spec supported by the lib
//
// extension 1: @property.match enables matching on the matched property name.
// This finds and selects all nodes with a name ending in .$
// extension 2: ^ operator twice at the end selects the parent node instead of the value for the node
//
// also, don't miss the array offset [0] before selecting the grandparent.
// There may be multiple fields within a node that could be in conflict.
// We're checking all the keys in the parent node, so we only need a single
// result for that parent.
path: "$..[Parameters,ResultSelector]..*[?(@property.match(/^.+\\.\\$$/))][0]^^"
});
}
catch (err) {
// need to revisit this since the JSONPath lib throws an error when it encounters an array
// Error: jsonPath: _$_property.match is not a function: _$_property.match(/^.+\.\$$/)
}
valuesToInspect.forEach(function (parent) {
var valuesToInspect = (0, jsonpath_plus_1.JSONPath)({
json: definition,
path: "$..[Parameters,ResultSelector]"
});
var inspectKeys = function (parent) {
var keys = {};

@@ -48,6 +31,10 @@ Object.keys(parent).forEach(function (key) {

keys[keyPostEval] = current ? current + 1 : 1;
if (typeof parent[key] === "object") {
inspectKeys(parent[key]);
}
});
});
};
valuesToInspect.forEach(function (parent) { return inspectKeys(parent); });
return errorMessages;
};
exports.mustNotHaveDuplicateFieldNamesAfterEvaluation = mustNotHaveDuplicateFieldNamesAfterEvaluation;
{
"name": "asl-validator",
"version": "3.0.4",
"version": "3.0.5",
"description": "Amazon States Language validator",

@@ -5,0 +5,0 @@ "main": "./dist/src/validator.js",

@@ -12,24 +12,8 @@ import {JSONPath} from 'jsonpath-plus';

const errorMessages: StateMachineError[] = [];
let valuesToInspect: Record<string, unknown>[] = [];
try {
valuesToInspect = JSONPath<Record<string, unknown>[]>({
json: definition,
// this uses some extensions to the original JSONPath spec supported by the lib
//
// extension 1: @property.match enables matching on the matched property name.
// This finds and selects all nodes with a name ending in .$
// extension 2: ^ operator twice at the end selects the parent node instead of the value for the node
//
// also, don't miss the array offset [0] before selecting the grandparent.
// There may be multiple fields within a node that could be in conflict.
// We're checking all the keys in the parent node, so we only need a single
// result for that parent.
path: `$..[Parameters,ResultSelector]..*[?(@property.match(/^.+\\.\\$$/))][0]^^`
})
} catch (err: unknown) {
// need to revisit this since the JSONPath lib throws an error when it encounters an array
// Error: jsonPath: _$_property.match is not a function: _$_property.match(/^.+\.\$$/)
}
const valuesToInspect: Record<string, unknown>[] = JSONPath<Record<string, unknown>[]>({
json: definition,
path: `$..[Parameters,ResultSelector]`
})
valuesToInspect.forEach((parent) => {
const inspectKeys = (parent: Record<string, unknown>): void => {
const keys: Record<string, number> = {};

@@ -46,5 +30,10 @@ Object.keys(parent).forEach((key) => {

keys[keyPostEval] = current ? current + 1 : 1;
if (typeof parent[key] === "object") {
inspectKeys(parent[key] as Record<string, unknown>);
}
});
});
}
valuesToInspect.forEach((parent) => inspectKeys(parent));
return errorMessages;
}
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