asl-validator
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "asl-validator", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Amazon States Language validator", | ||
@@ -35,3 +35,3 @@ "main": "./src/validator.js", | ||
"commander": "^5.1.0", | ||
"jsonpath": "^1.1.0" | ||
"jsonpath-plus": "^7.0.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
@@ -1,4 +0,4 @@ | ||
const jp = require('jsonpath'); | ||
const { JSONPath } = require('jsonpath-plus'); | ||
module.exports = (definition) => jp.query(definition, '$..[\'InputPath\',\'OutputPath\',\'ResultPath\']') | ||
module.exports = (definition) => JSONPath({ json: definition, path: '$..[InputPath,OutputPath,ResultPath]' }) | ||
.filter((path) => typeof path === 'string') | ||
@@ -15,3 +15,3 @@ .map((path) => { | ||
try { | ||
jp.parse(path); | ||
JSONPath({ path, json: definition }); | ||
return null; | ||
@@ -18,0 +18,0 @@ } catch (e) { |
@@ -1,2 +0,2 @@ | ||
const jp = require('jsonpath'); | ||
const { JSONPath } = require('jsonpath-plus'); | ||
@@ -6,3 +6,3 @@ module.exports = (definition) => { | ||
let machineStates = []; | ||
jp.query(definition, '$..[\'States\']') | ||
JSONPath({ json: definition, path: '$..States' }) | ||
.forEach((s) => { | ||
@@ -13,3 +13,3 @@ machineStates = machineStates.concat(Object.keys(s)); | ||
// retrieve all reachable states | ||
const reachableStates = jp.query(definition, '$..[\'StartAt\',\'Next\',\'Default\']') | ||
const reachableStates = JSONPath({ json: definition, path: '$..[StartAt,Next,Default]' }) | ||
.filter((path) => typeof path === 'string') | ||
@@ -16,0 +16,0 @@ .filter((path, pos, array) => array.indexOf(path) === pos); |
@@ -1,2 +0,2 @@ | ||
const jp = require('jsonpath'); | ||
const { JSONPath } = require('jsonpath-plus'); | ||
@@ -6,3 +6,3 @@ module.exports = (definition) => { | ||
const names = new Map(); | ||
jp.query(definition, '$..[\'States\']') | ||
JSONPath({ json: definition, path: '$..[\'States\']' }) | ||
.forEach((states) => { | ||
@@ -9,0 +9,0 @@ Object.keys(states).forEach((stateName) => { |
@@ -1,2 +0,2 @@ | ||
const jp = require('jsonpath'); | ||
const { JSONPath } = require('jsonpath-plus'); | ||
@@ -17,4 +17,4 @@ module.exports = (definition) => { | ||
const isContainer = ['Map', 'Parallel'].indexOf(nestedState.Type) >= 0; | ||
const path = isContainer ? '$.[\'Next\',\'Default\']' : '$..[\'Next\',\'Default\']'; | ||
states.push(...jp.query(nestedState, path)); | ||
const path = isContainer ? '$.[Next,Default]' : '$..[Next,Default]'; | ||
states.push(...JSONPath({ json: nestedState, path })); | ||
}); | ||
@@ -31,3 +31,3 @@ return states; | ||
// These are the only valid states to link to from within the branch | ||
jp.query(nestedStateMachine, '$.States').forEach((branchStates) => { | ||
JSONPath({ json: nestedStateMachine, path: '$.States' }).forEach((branchStates) => { | ||
availStateNames = availStateNames.concat(Object.keys(branchStates)); | ||
@@ -46,3 +46,3 @@ }); | ||
// link outside its branch. | ||
jp.query(definition, '$..[\'Branches\']') | ||
JSONPath({ json: definition, path: '$..Branches' }) | ||
.forEach((parallelBranches) => { | ||
@@ -63,3 +63,3 @@ parallelBranches.forEach((nestedStateMachine) => { | ||
// link outside its container. | ||
jp.query(definition, '$..[\'Iterator\']') | ||
JSONPath({ json: definition, path: '$..Iterator' }) | ||
.forEach((nestedStateMachine) => { | ||
@@ -66,0 +66,0 @@ const errs = validateNestedStateMachine(nestedStateMachine).map((state) => ({ |
@@ -18,2 +18,3 @@ const Ajv = require('ajv'); | ||
const stateNames = require('./lib/state-names'); | ||
const terminals = require('./lib/terminals'); | ||
@@ -51,2 +52,3 @@ function formatError(e) { | ||
postSchemaValidationErrors.push(...stateNames(definition)); | ||
postSchemaValidationErrors.push(...terminals(definition)); | ||
} | ||
@@ -53,0 +55,0 @@ |
45064
23
1151
+ Addedjsonpath-plus@^7.0.0
+ Addedjsonpath-plus@7.2.0(transitive)
- Removedjsonpath@^1.1.0
- Removeddeep-is@0.1.4(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@1.2.24.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedjsonpath@1.1.1(transitive)
- Removedlevn@0.3.0(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedstatic-eval@2.0.2(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedunderscore@1.12.1(transitive)
- Removedword-wrap@1.2.5(transitive)