amazon-states-language-service
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -9,3 +9,3 @@ /*! | ||
readonly INVALID_START_AT: "The value of \"StartAt\" property must be the name of an existing state."; | ||
readonly INVALID_JSON_PATH: "The value for the field must be a valid JSONPath."; | ||
readonly INVALID_JSON_PATH_OR_INTRINSIC: "The value for the field must be a valid JSONPath or intrinsic function expression."; | ||
readonly UNREACHABLE_STATE: "The state cannot be reached. It must be referenced by at least one other state."; | ||
@@ -12,0 +12,0 @@ readonly NO_TERMINAL_STATE: "No terminal state. The state machine must have at least one terminal state (a state in which the \"End\" property is set to true)."; |
@@ -11,3 +11,3 @@ "use strict"; | ||
INVALID_START_AT: 'The value of "StartAt" property must be the name of an existing state.', | ||
INVALID_JSON_PATH: 'The value for the field must be a valid JSONPath.', | ||
INVALID_JSON_PATH_OR_INTRINSIC: 'The value for the field must be a valid JSONPath or intrinsic function expression.', | ||
UNREACHABLE_STATE: 'The state cannot be reached. It must be referenced by at least one other state.', | ||
@@ -14,0 +14,0 @@ NO_TERMINAL_STATE: 'No terminal state. The state machine must have at least one terminal state (a state in which the "End" property is set to true).', |
@@ -17,2 +17,3 @@ "use strict"; | ||
const validationSchema_1 = __importDefault(require("./validationSchema")); | ||
const INTRINSIC_FUNC_REGEX = /^States\.(JsonToString|Format|StringToJson|Array)\(.+\)$/; | ||
function stateNameExistsInPropNode(nextPropNode, stateNames, document, message) { | ||
@@ -27,2 +28,9 @@ var _a; | ||
} | ||
function isIntrinsicFunction(text) { | ||
const intrinsicText = text.trimRight(); | ||
return INTRINSIC_FUNC_REGEX.test(intrinsicText); | ||
} | ||
function isJsonPath(text) { | ||
return text.startsWith('$'); | ||
} | ||
function validateParameters(parametersPropNode, document) { | ||
@@ -35,6 +43,6 @@ let diagnostics = []; | ||
const propValue = prop.valueNode.value; | ||
if (typeof propValue !== 'string' || !propValue.startsWith('$')) { | ||
if (typeof propValue !== 'string' || !(isJsonPath(propValue) || isIntrinsicFunction(propValue))) { | ||
const { length, offset } = prop.valueNode; | ||
const range = vscode_json_languageservice_1.Range.create(document.positionAt(offset), document.positionAt(offset + length)); | ||
diagnostics.push(vscode_json_languageservice_1.Diagnostic.create(range, diagnosticStrings_1.MESSAGES.INVALID_JSON_PATH, vscode_json_languageservice_1.DiagnosticSeverity.Error)); | ||
diagnostics.push(vscode_json_languageservice_1.Diagnostic.create(range, diagnosticStrings_1.MESSAGES.INVALID_JSON_PATH_OR_INTRINSIC, vscode_json_languageservice_1.DiagnosticSeverity.Error)); | ||
} | ||
@@ -146,4 +154,9 @@ } | ||
const validateCatchResult = validateArrayNext('Catch', oneStateValueNode, stateNames, document); | ||
const resultSelectorPropNode = astUtilityFunctions_1.findPropChildByName(oneStateValueNode, 'ResultSelector'); | ||
diagnostics = diagnostics.concat(validateCatchResult.diagnostics); | ||
reachedStates = Object.assign(Object.assign({}, reachedStates), validateCatchResult.reachedStates); | ||
if (resultSelectorPropNode) { | ||
const resultSelectorDiagnostics = validateParameters(resultSelectorPropNode, document); | ||
diagnostics = diagnostics.concat(resultSelectorDiagnostics); | ||
} | ||
} | ||
@@ -150,0 +163,0 @@ switch (stateType) { |
@@ -27,5 +27,8 @@ /*! | ||
Parameters: boolean; | ||
ResultSelector: boolean; | ||
ResultPath: boolean; | ||
TimeoutSeconds: boolean; | ||
TimeoutSecondsPath: boolean; | ||
HeartbeatSeconds: boolean; | ||
HeartbeatSecondsPath: boolean; | ||
Retry: { | ||
@@ -82,2 +85,3 @@ 'Fn:ArrayOf': string; | ||
Parameters: boolean; | ||
ResultSelector: boolean; | ||
Retry: { | ||
@@ -99,2 +103,3 @@ 'Fn:ArrayOf': string; | ||
Parameters: boolean; | ||
ResultSelector: boolean; | ||
Retry: { | ||
@@ -115,6 +120,9 @@ 'Fn:ArrayOf': string; | ||
}; | ||
BooleanEquals: boolean; | ||
Not: { | ||
'Fn:ValueOf': string; | ||
}; | ||
Or: { | ||
'Fn:ArrayOf': string; | ||
}; | ||
BooleanEquals: boolean; | ||
NumericEquals: boolean; | ||
@@ -125,5 +133,2 @@ NumericGreaterThan: boolean; | ||
NumericLessThanEquals: boolean; | ||
Or: { | ||
'Fn:ArrayOf': string; | ||
}; | ||
StringEquals: boolean; | ||
@@ -139,2 +144,25 @@ StringGreaterThan: boolean; | ||
TimestampLessThanEquals: boolean; | ||
BooleanEqualsPath: boolean; | ||
NumericEqualsPath: boolean; | ||
NumericGreaterThanPath: boolean; | ||
NumericGreaterThanEqualsPath: boolean; | ||
NumericLessThanPath: boolean; | ||
NumericLessThanEqualsPath: boolean; | ||
StringEqualsPath: boolean; | ||
StringGreaterThanPath: boolean; | ||
StringGreaterThanEqualsPath: boolean; | ||
StringLessThanPath: boolean; | ||
StringLessThanEqualsPath: boolean; | ||
TimestampEqualsPath: boolean; | ||
TimestampGreaterThanPath: boolean; | ||
TimestampGreaterThanEqualsPath: boolean; | ||
TimestampLessThanPath: boolean; | ||
TimestampLessThanEqualsPath: boolean; | ||
StringMatches: boolean; | ||
IsNull: boolean; | ||
IsPresent: boolean; | ||
IsNumeric: boolean; | ||
IsString: boolean; | ||
IsBoolean: boolean; | ||
IsTimestamp: boolean; | ||
}; | ||
@@ -141,0 +169,0 @@ ChoiceRule: { |
@@ -29,5 +29,8 @@ "use strict"; | ||
Parameters: true, | ||
ResultSelector: true, | ||
ResultPath: true, | ||
TimeoutSeconds: true, | ||
TimeoutSecondsPath: true, | ||
HeartbeatSeconds: true, | ||
HeartbeatSecondsPath: true, | ||
Retry: { | ||
@@ -84,2 +87,3 @@ 'Fn:ArrayOf': 'Retrier' | ||
Parameters: true, | ||
ResultSelector: true, | ||
Retry: { | ||
@@ -101,2 +105,3 @@ 'Fn:ArrayOf': 'Retrier' | ||
Parameters: true, | ||
ResultSelector: true, | ||
Retry: { | ||
@@ -117,6 +122,9 @@ 'Fn:ArrayOf': 'Retrier' | ||
}, | ||
BooleanEquals: true, | ||
Not: { | ||
'Fn:ValueOf': 'NestedChoiceRule' | ||
}, | ||
Or: { | ||
'Fn:ArrayOf': 'NestedChoiceRule' | ||
}, | ||
BooleanEquals: true, | ||
NumericEquals: true, | ||
@@ -127,5 +135,2 @@ NumericGreaterThan: true, | ||
NumericLessThanEquals: true, | ||
Or: { | ||
'Fn:ArrayOf': 'NestedChoiceRule' | ||
}, | ||
StringEquals: true, | ||
@@ -140,3 +145,26 @@ StringGreaterThan: true, | ||
TimestampLessThan: true, | ||
TimestampLessThanEquals: true | ||
TimestampLessThanEquals: true, | ||
BooleanEqualsPath: true, | ||
NumericEqualsPath: true, | ||
NumericGreaterThanPath: true, | ||
NumericGreaterThanEqualsPath: true, | ||
NumericLessThanPath: true, | ||
NumericLessThanEqualsPath: true, | ||
StringEqualsPath: true, | ||
StringGreaterThanPath: true, | ||
StringGreaterThanEqualsPath: true, | ||
StringLessThanPath: true, | ||
StringLessThanEqualsPath: true, | ||
TimestampEqualsPath: true, | ||
TimestampGreaterThanPath: true, | ||
TimestampGreaterThanEqualsPath: true, | ||
TimestampLessThanPath: true, | ||
TimestampLessThanEqualsPath: true, | ||
StringMatches: true, | ||
IsNull: true, | ||
IsPresent: true, | ||
IsNumeric: true, | ||
IsString: true, | ||
IsBoolean: true, | ||
IsTimestamp: true | ||
}, | ||
@@ -143,0 +171,0 @@ ChoiceRule: { |
@@ -15,3 +15,3 @@ { | ||
"license": "MIT", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"publisher": "aws", | ||
@@ -18,0 +18,0 @@ "categories": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253719
3786