asl-path-validator
Version:
Validates the path expressions for the Amazon States Language
24 lines • 802 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasVariable = exports.hasFunctions = exports.referencePathChecks = void 0;
const jsonpath_plus_1 = require("jsonpath-plus");
const find = (path, ast) => {
const results = (0, jsonpath_plus_1.JSONPath)({
path,
json: ast,
});
return results.length > 0;
};
const referencePathChecks = (ast) => {
return !find("$..[atmark,wildcard,negOffset,slice,recursiveDescent,multipleIndex,filter]", ast);
};
exports.referencePathChecks = referencePathChecks;
const hasFunctions = (ast) => {
return find("$..[func]", ast);
};
exports.hasFunctions = hasFunctions;
const hasVariable = (ast) => {
return find("$..[var]", ast);
};
exports.hasVariable = hasVariable;
//# sourceMappingURL=ast.js.map