@izara_project/izara-core-library-asynchronous-flow 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/AsyncFlowSharedLib.js +13 -10
package/package.json
CHANGED
|
@@ -817,21 +817,24 @@ module.exports.validateStartKeyParam = (
|
|
|
817
817
|
_izContext,
|
|
818
818
|
startKey,
|
|
819
819
|
partitionKeyFieldName,
|
|
820
|
-
sortKeyFieldName
|
|
820
|
+
sortKeyFieldName
|
|
821
821
|
) => {
|
|
822
|
+
const stringNotEmptyRegex = /^[A-Za-z0-9_-]+$/;
|
|
823
|
+
|
|
824
|
+
if (
|
|
825
|
+
!partitionKeyFieldName || !sortKeyFieldName
|
|
826
|
+
|| !stringNotEmptyRegex.test(partitionKeyFieldName)
|
|
827
|
+
|| !stringNotEmptyRegex.test(sortKeyFieldName)
|
|
828
|
+
) {
|
|
829
|
+
throw new NoRetryError("validateStartKeyParam: Invalid partitionKeyFieldName or sortKeyFieldName");
|
|
830
|
+
}
|
|
822
831
|
|
|
823
832
|
if (startKey && Object.keys(startKey).length != 0) {
|
|
824
|
-
if (
|
|
825
|
-
startKey
|
|
826
|
-
!startKey[partitionKeyFieldName]
|
|
827
|
-
) {
|
|
828
|
-
startKey = false; // we can type check for false to see if invalid
|
|
829
|
-
}
|
|
830
|
-
if (sortKeyFieldName !== null && sortKeyFieldName !== undefined && !startKey[sortKeyFieldName]) {
|
|
831
|
-
startKey = false;
|
|
833
|
+
if (!startKey[partitionKeyFieldName] || !startKey[sortKeyFieldName]) {
|
|
834
|
+
throw new NoRetryError("validateStartKeyParam: Invalid startKey, missing partitionKeyFieldName or sortKeyFieldName");
|
|
832
835
|
}
|
|
833
836
|
} else {
|
|
834
|
-
startKey = null; // if empty set to null so lib functions process correctly
|
|
837
|
+
startKey = null; // if empty set to null so lib functions process correctly
|
|
835
838
|
}
|
|
836
839
|
|
|
837
840
|
return startKey;
|