From 39f21635fd3217d99a2a364bc0bdc6320b585cf2 Mon Sep 17 00:00:00 2001 From: Bulat Gabidullin Date: Tue, 19 Jan 2021 14:44:40 -0600 Subject: [PATCH 1/5] bugfix/VMO-2010/NumericBlockMaxCharactersValidation - Replaced ValidationException with PromptValidationException in all prompt implementations because that is what BasePrompt is catching in its 'set value()'. Fixed BasePrompt not resetting this.error after a valid value was entered. Fixed SelectManyPrompt demanding non-empty selections[] when choices[] is empty. --- dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/AdvancedSelectOnePrompt.js | 6 +++--- dist/domain/prompt/AdvancedSelectOnePrompt.js.map | 2 +- dist/domain/prompt/BasePrompt.d.ts.map | 2 +- dist/domain/prompt/BasePrompt.js | 1 + dist/domain/prompt/BasePrompt.js.map | 2 +- dist/domain/prompt/NumericPrompt.d.ts.map | 2 +- dist/domain/prompt/NumericPrompt.js | 4 ++-- dist/domain/prompt/NumericPrompt.js.map | 2 +- dist/domain/prompt/OpenPrompt.d.ts.map | 2 +- dist/domain/prompt/OpenPrompt.js | 2 +- dist/domain/prompt/OpenPrompt.js.map | 2 +- dist/domain/prompt/SelectManyPrompt.d.ts.map | 2 +- dist/domain/prompt/SelectManyPrompt.js | 4 ++-- dist/domain/prompt/SelectManyPrompt.js.map | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/SelectOnePrompt.js | 2 +- dist/domain/prompt/SelectOnePrompt.js.map | 2 +- src/domain/prompt/AdvancedSelectOnePrompt.ts | 8 ++++---- src/domain/prompt/BasePrompt.ts | 1 + src/domain/prompt/NumericPrompt.ts | 6 +++--- src/domain/prompt/OpenPrompt.ts | 4 ++-- src/domain/prompt/SelectManyPrompt.ts | 6 +++--- src/domain/prompt/SelectOnePrompt.ts | 4 ++-- 24 files changed, 37 insertions(+), 35 deletions(-) diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map index 1ec37539..9fdf4ae5 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"AdvancedSelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAAsB,MAAM,OAAO,CAAA;AAExH,eAAO,MAAM,8BAA8B,sBAAsB,CAAA;AAEjE,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACrF,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;CA2B/E"} \ No newline at end of file +{"version":3,"file":"AdvancedSelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAA4B,MAAM,OAAO,CAAA;AAE9H,eAAO,MAAM,8BAA8B,sBAAsB,CAAA;AAEjE,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACrF,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;CA2B/E"} \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.js b/dist/domain/prompt/AdvancedSelectOnePrompt.js index 5a783c98..f13410be 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.js +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.js @@ -6,19 +6,19 @@ exports.ADVANCED_SELECT_ONE_PROMPT_KEY = 'AdvancedSelectOne'; class AdvancedSelectOnePrompt extends __1.BasePrompt { validate(selectedRow, choiceRows) { const { choiceRowFields, isResponseRequired } = this.config; - __1.assertNotNull(choiceRows, () => 'choiceRows must be non-null', message => new __1.ValidationException(message)); + __1.assertNotNull(choiceRows, () => 'choiceRows must be non-null', message => new __1.PromptValidationException(message)); if (isResponseRequired) { const hasSelectedRow = choiceRows.some(row => selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.every(selection => { const columnIndex = choiceRowFields.indexOf(selection.name); if (columnIndex < 0) { - throw new __1.ValidationException(`Failed to find a column called: ${selection.name}`); + throw new __1.PromptValidationException(`Failed to find a column called: ${selection.name}`); } else { return selection.value === row[columnIndex]; } })); if (!hasSelectedRow) { - throw new __1.ValidationException(`Failed to find the given row: ${selectedRow}`); + throw new __1.PromptValidationException(`Failed to find the given row: ${selectedRow}`); } } return true; diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.js.map b/dist/domain/prompt/AdvancedSelectOnePrompt.js.map index d9532650..e0feaddd 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.js.map +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"AdvancedSelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAwH;AAE3G,QAAA,8BAA8B,GAAG,mBAAmB,CAAA;AAEjE,MAAa,uBAAwB,SAAQ,cAA0C;IACrF,QAAQ,CAAC,WAAkC,EAAE,UAAuB;QAClE,MAAM,EAAC,eAAe,EAAE,kBAAkB,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzD,iBAAa,CACX,UAAU,EACV,GAAG,EAAE,CAAC,6BAA6B,EACnC,OAAO,CAAC,EAAE,CAAC,IAAI,uBAAmB,CAAC,OAAO,CAAC,CAC5C,CAAA;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC3D,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,uBAAmB,CAAC,mCAAmC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;iBACnF;qBAAM;oBACL,OAAO,SAAS,CAAC,KAAK,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;iBAC5C;YACH,CAAC,CAAC,CACH,CAAA;YACD,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,uBAAmB,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAA;aAC9E;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA5BD,0DA4BC"} \ No newline at end of file +{"version":3,"file":"AdvancedSelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8H;AAEjH,QAAA,8BAA8B,GAAG,mBAAmB,CAAA;AAEjE,MAAa,uBAAwB,SAAQ,cAA0C;IACrF,QAAQ,CAAC,WAAkC,EAAE,UAAuB;QAClE,MAAM,EAAC,eAAe,EAAE,kBAAkB,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzD,iBAAa,CACX,UAAU,EACV,GAAG,EAAE,CAAC,6BAA6B,EACnC,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC3D,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,6BAAyB,CAAC,mCAAmC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;iBACzF;qBAAM;oBACL,OAAO,SAAS,CAAC,KAAK,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;iBAC5C;YACH,CAAC,CAAC,CACH,CAAA;YACD,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,6BAAyB,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAA;aACpF;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA5BD,0DA4BC"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.d.ts.map b/dist/domain/prompt/BasePrompt.d.ts.map index 9e3dc4bf..d74abea9 100644 --- a/dist/domain/prompt/BasePrompt.d.ts.map +++ b/dist/domain/prompt/BasePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":"AAkBA,OAAO,EAIL,MAAM,EACN,WAAW,EACX,OAAO,EACP,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EAE1B,MAAM,OAAO,CAAA;AAEd,oBAAY,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AAMxD,8BAAsB,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IAGtE,MAAM,EAAE,CAAC;IAAS,aAAa,EAAE,MAAM;IAAS,MAAM,EAAE,WAAW;IAFtF,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAAO;gBAE3B,MAAM,EAAE,CAAC,EAAS,aAAa,EAAE,MAAM,EAAS,MAAM,EAAE,WAAW;IAKtF,IAAI,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,CAGtB;IASD,IAAI,KAAK,CAAC,GAAG,E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,wBAAwB,GAAG,SAAS,CAAC;IASlF,OAAO,IAAI,OAAO;IAYzB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO;CAC7C"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.js b/dist/domain/prompt/BasePrompt.js index c2877091..076c6e86 100644 --- a/dist/domain/prompt/BasePrompt.js +++ b/dist/domain/prompt/BasePrompt.js @@ -16,6 +16,7 @@ class BasePrompt { set value(val) { try { this.validate(val); + this.error = null; } catch (e) { if (!(e instanceof __1.PromptValidationException)) { diff --git a/dist/domain/prompt/BasePrompt.js.map b/dist/domain/prompt/BasePrompt.js.map index 6ea1d1fb..92ba48c9 100644 --- a/dist/domain/prompt/BasePrompt.js.map +++ b/dist/domain/prompt/BasePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAWc;AAQd,MAAsB,UAAU;IAG9B,YAAmB,MAAS,EAAS,aAAqB,EAAS,MAAmB;QAAnE,WAAM,GAAN,MAAM,CAAG;QAAS,kBAAa,GAAb,aAAa,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAa;QAFtF,UAAK,GAAqC,IAAI,CAAA;IAI9C,CAAC;IAGD,IAAI,KAAK;QAEP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;IAC1B,CAAC;IASD,IAAI,KAAK,CAAC,GAAe;QACvB,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,YAAY,6BAAyB,CAAC,EAAE;gBAC7C,MAAM,CAAC,CAAA;aACR;YAED,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;SACf;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAA;IACzB,CAAC;IAGD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAA;IACjC,CAAC;IAED,IAAI,KAAK;QACP,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA;QAC/B,MAAM,IAAI,GAAG,uBAAmB,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QACzD,MAAM,IAAI,GAAG,gBAAY,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAE3C,IAAI;YACF,OAAO,iBAAa,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,YAAY,uBAAmB,CAAC,EAAE;gBACvC,MAAM,CAAC,CAAA;aACR;YAED,OAAM;SACP;IACH,CAAC;IAEK,OAAO,CAAC,GAA2B;;YAEvC,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;aACjB;YAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;QAC1B,CAAC;KAAA;IAEM,OAAO;QACZ,IAAI;YACF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAOF;AA7ED,gCA6EC"} \ No newline at end of file +{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAWc;AAQd,MAAsB,UAAU;IAG9B,YAAmB,MAAS,EAAS,aAAqB,EAAS,MAAmB;QAAnE,WAAM,GAAN,MAAM,CAAG;QAAS,kBAAa,GAAb,aAAa,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAa;QAFtF,UAAK,GAAqC,IAAI,CAAA;IAI9C,CAAC;IAG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,CAAC,KAAK,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAOF;AA9ED,gCA8EC"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts.map b/dist/domain/prompt/NumericPrompt.d.ts.map index 591ad7b3..9a535ec2 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts.map +++ b/dist/domain/prompt/NumericPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAsB,MAAM,OAAO,CAAA;AAE3E,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,QAAQ,CAAC,SAAS,aAAY;IAErC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAiB/B"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAEjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,QAAQ,CAAC,SAAS,aAAY;IAErC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAiB/B"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.js b/dist/domain/prompt/NumericPrompt.js index 369892b9..dbf46b5b 100644 --- a/dist/domain/prompt/NumericPrompt.js +++ b/dist/domain/prompt/NumericPrompt.js @@ -10,10 +10,10 @@ class NumericPrompt extends __1.BasePrompt { } const { min, max } = this.config; if (min != null && val < min) { - throw new __1.ValidationException('Value provided is less than allowed'); + throw new __1.PromptValidationException('Value provided is less than allowed'); } if (max != null && val > max) { - throw new __1.ValidationException('Value provided is greater than allowed'); + throw new __1.PromptValidationException('Value provided is greater than allowed'); } return true; } diff --git a/dist/domain/prompt/NumericPrompt.js.map b/dist/domain/prompt/NumericPrompt.js.map index 6e2154f9..64a8e6a1 100644 --- a/dist/domain/prompt/NumericPrompt.js.map +++ b/dist/domain/prompt/NumericPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA2E;AAE9D,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IAGjE,QAAQ,CAAC,GAAW;QAClB,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,EAAE;YACrC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,uBAAmB,CAAC,qCAAqC,CAAC,CAAA;SACrE;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,uBAAmB,CAAC,wCAAwC,CAAC,CAAA;SACxE;QAED,OAAO,IAAI,CAAA;IACb,CAAC;;AAnBH,sCAoBC;AAnBiB,uBAAS,GAAG,SAAS,CAAA"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AAEpE,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IAGjE,QAAQ,CAAC,GAAW;QAClB,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,EAAE;YACrC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;;AAnBH,sCAoBC;AAnBiB,uBAAS,GAAG,SAAS,CAAA"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts.map b/dist/domain/prompt/OpenPrompt.d.ts.map index 90d49a91..34cefda3 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts.map +++ b/dist/domain/prompt/OpenPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAsB,MAAM,OAAO,CAAA;AAExE,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAW/B"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAW/B"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.js b/dist/domain/prompt/OpenPrompt.js index ebf09e28..064df66a 100644 --- a/dist/domain/prompt/OpenPrompt.js +++ b/dist/domain/prompt/OpenPrompt.js @@ -7,7 +7,7 @@ class OpenPrompt extends __1.BasePrompt { validate(val) { const { maxResponseCharacters: maxLength } = this.config; if (maxLength != null && val.length > maxLength) { - throw new __1.ValidationException('Too many characters on value provided'); + throw new __1.PromptValidationException('Too many characters on value provided'); } return true; } diff --git a/dist/domain/prompt/OpenPrompt.js.map b/dist/domain/prompt/OpenPrompt.js.map index 46b68009..2f97dc4a 100644 --- a/dist/domain/prompt/OpenPrompt.js.map +++ b/dist/domain/prompt/OpenPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAwE;AAE3D,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,QAAQ,CAAC,GAAW;QAClB,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,uBAAmB,CAAC,uCAAuC,CAAC,CAAA;SACvE;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAZD,gCAYC"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,QAAQ,CAAC,GAAW;QAClB,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAZD,gCAYC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts.map b/dist/domain/prompt/SelectManyPrompt.d.ts.map index 41ca3319..f6f63442 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts.map +++ b/dist/domain/prompt/SelectManyPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,OAAO,EAA0B,uBAAuB,EAAsB,MAAM,OAAO,CAAA;AAG/G,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO;CAkBhD"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,OAAO,EAA0B,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGrH,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO;CAkBhD"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.js b/dist/domain/prompt/SelectManyPrompt.js index 70f7ec53..46c17018 100644 --- a/dist/domain/prompt/SelectManyPrompt.js +++ b/dist/domain/prompt/SelectManyPrompt.js @@ -12,8 +12,8 @@ class SelectManyPrompt extends __1.BasePrompt { if (!isResponseRequired) { return true; } - if (selections.length === 0) { - throw new __1.ValidationException(exports.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); + if (choices.length !== 0 && selections.length === 0) { + throw new __1.PromptValidationException(exports.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); } const invalidChoices = lodash_1.difference(selections, lodash_1.map(choices, 'key')); if (invalidChoices.length !== 0) { diff --git a/dist/domain/prompt/SelectManyPrompt.js.map b/dist/domain/prompt/SelectManyPrompt.js.map index 8dac2bc1..9a8b31a6 100644 --- a/dist/domain/prompt/SelectManyPrompt.js.map +++ b/dist/domain/prompt/SelectManyPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA+G;AAC/G,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,QAAQ,CAAC,UAA4B;QACnC,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,MAAM,IAAI,uBAAmB,CAAC,+CAAuC,CAAC,CAAA;SACvE;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,0BAAsB,CAAiB,kDAA0C,EAAE,cAAc,CAAC,CAAA;SAC7G;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnBD,4CAmBC"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAqH;AACrH,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,QAAQ,CAAC,UAA4B;QACnC,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,0BAAsB,CAAiB,kDAA0C,EAAE,cAAc,CAAC,CAAA;SAC7G;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnBD,4CAmBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts.map b/dist/domain/prompt/SelectOnePrompt.d.ts.map index 23889696..e39b2c0c 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/SelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAAsB,MAAM,OAAO,CAAA;AAE7E,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;CAS7C"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;CAS7C"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.js b/dist/domain/prompt/SelectOnePrompt.js index fbcf2e16..4dfc1ce0 100644 --- a/dist/domain/prompt/SelectOnePrompt.js +++ b/dist/domain/prompt/SelectOnePrompt.js @@ -7,7 +7,7 @@ class SelectOnePrompt extends __1.BasePrompt { validate(choiceKey) { const { isResponseRequired, choices } = this.config; if (isResponseRequired && choices.find(({ key }) => key === choiceKey) == null) { - throw new __1.ValidationException('Value provided must be in list of choices'); + throw new __1.PromptValidationException('Value provided must be in list of choices'); } return true; } diff --git a/dist/domain/prompt/SelectOnePrompt.js.map b/dist/domain/prompt/SelectOnePrompt.js.map index e748ef5f..77a7c41c 100644 --- a/dist/domain/prompt/SelectOnePrompt.js.map +++ b/dist/domain/prompt/SelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA6E;AAEhE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,QAAQ,CAAC,SAAyB;QAChC,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,uBAAmB,CAAC,2CAA2C,CAAC,CAAA;SAC3E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAVD,0CAUC"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,QAAQ,CAAC,SAAyB;QAChC,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAVD,0CAUC"} \ No newline at end of file diff --git a/src/domain/prompt/AdvancedSelectOnePrompt.ts b/src/domain/prompt/AdvancedSelectOnePrompt.ts index 9b066ddd..58fa7462 100644 --- a/src/domain/prompt/AdvancedSelectOnePrompt.ts +++ b/src/domain/prompt/AdvancedSelectOnePrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {assertNotNull, BasePrompt, IAdvancedSelectOne, IAdvancedSelectOnePromptConfig, ValidationException} from '../..' +import {assertNotNull, BasePrompt, IAdvancedSelectOne, IAdvancedSelectOnePromptConfig, PromptValidationException} from '../..' export const ADVANCED_SELECT_ONE_PROMPT_KEY = 'AdvancedSelectOne' @@ -28,7 +28,7 @@ export class AdvancedSelectOnePrompt extends BasePrompt 'choiceRows must be non-null', - message => new ValidationException(message) + message => new PromptValidationException(message) ) if (isResponseRequired) { @@ -36,14 +36,14 @@ export class AdvancedSelectOnePrompt extends BasePrompt { const columnIndex = choiceRowFields.indexOf(selection.name) if (columnIndex < 0) { - throw new ValidationException(`Failed to find a column called: ${selection.name}`) + throw new PromptValidationException(`Failed to find a column called: ${selection.name}`) } else { return selection.value === row[columnIndex] } }) ) if (!hasSelectedRow) { - throw new ValidationException(`Failed to find the given row: ${selectedRow}`) + throw new PromptValidationException(`Failed to find the given row: ${selectedRow}`) } } diff --git a/src/domain/prompt/BasePrompt.ts b/src/domain/prompt/BasePrompt.ts index c49bf1f5..0f9bb6f2 100644 --- a/src/domain/prompt/BasePrompt.ts +++ b/src/domain/prompt/BasePrompt.ts @@ -58,6 +58,7 @@ export abstract class BasePrompt> implements set value(val: T['value']) { try { this.validate(val) + this.error = null } catch (e) { if (!(e instanceof PromptValidationException)) { throw e diff --git a/src/domain/prompt/NumericPrompt.ts b/src/domain/prompt/NumericPrompt.ts index 2d545c63..f779205c 100644 --- a/src/domain/prompt/NumericPrompt.ts +++ b/src/domain/prompt/NumericPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, INumericPromptConfig, ValidationException} from '../..' +import {BasePrompt, INumericPromptConfig, PromptValidationException} from '../..' export const NUMERIC_PROMPT_KEY = 'Numeric' @@ -36,11 +36,11 @@ export class NumericPrompt extends BasePrompt { const {min, max} = this.config if (min != null && val < min) { - throw new ValidationException('Value provided is less than allowed') + throw new PromptValidationException('Value provided is less than allowed') } if (max != null && val > max) { - throw new ValidationException('Value provided is greater than allowed') + throw new PromptValidationException('Value provided is greater than allowed') } return true diff --git a/src/domain/prompt/OpenPrompt.ts b/src/domain/prompt/OpenPrompt.ts index 205e8bdf..ca3d8c56 100644 --- a/src/domain/prompt/OpenPrompt.ts +++ b/src/domain/prompt/OpenPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, IOpenPromptConfig, ValidationException} from '../..' +import {BasePrompt, IOpenPromptConfig, PromptValidationException} from '../..' export const OPEN_PROMPT_KEY = 'Open' @@ -32,7 +32,7 @@ export class OpenPrompt extends BasePrompt { if (maxLength != null && val.length > maxLength) { // todo: add ability to provide validation codes to ValidationException for use as comparator in consumers // todo: need a method to define resources frontend needs from backend - throw new ValidationException('Too many characters on value provided') + throw new PromptValidationException('Too many characters on value provided') } return true diff --git a/src/domain/prompt/SelectManyPrompt.ts b/src/domain/prompt/SelectManyPrompt.ts index 84c3b54b..3c695cba 100644 --- a/src/domain/prompt/SelectManyPrompt.ts +++ b/src/domain/prompt/SelectManyPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, IChoice, InvalidChoiceException, ISelectManyPromptConfig, ValidationException} from '../..' +import {BasePrompt, IChoice, InvalidChoiceException, ISelectManyPromptConfig, PromptValidationException} from '../..' import {difference, map} from 'lodash' export const INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = 'At least one selection is required, but none provided' @@ -36,8 +36,8 @@ export class SelectManyPrompt extends BasePrompt { return true } - if (selections.length === 0) { - throw new ValidationException(INVALID_AT_LEAST_ONE_SELECTION_REQUIRED) + if (choices.length !== 0 && selections.length === 0) { + throw new PromptValidationException(INVALID_AT_LEAST_ONE_SELECTION_REQUIRED) } const invalidChoices = difference(selections, map(choices, 'key')) diff --git a/src/domain/prompt/SelectOnePrompt.ts b/src/domain/prompt/SelectOnePrompt.ts index faf9a0a5..0872528b 100644 --- a/src/domain/prompt/SelectOnePrompt.ts +++ b/src/domain/prompt/SelectOnePrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, ISelectOnePromptConfig, ValidationException} from '../..' +import {BasePrompt, ISelectOnePromptConfig, PromptValidationException} from '../..' export const SELECT_ONE_PROMPT_KEY = 'SelectOne' @@ -30,7 +30,7 @@ export class SelectOnePrompt extends BasePrompt { const {isResponseRequired, choices} = this.config if (isResponseRequired && choices.find(({key}) => key === choiceKey) == null) { - throw new ValidationException('Value provided must be in list of choices') + throw new PromptValidationException('Value provided must be in list of choices') } return true From d009f93e2da8a0259292ed3041dc72f81450fc9f Mon Sep 17 00:00:00 2001 From: Bulat Gabidullin Date: Tue, 19 Jan 2021 16:53:22 -0600 Subject: [PATCH 2/5] bugfix/VMO-2010/NumericBlockMaxCharactersValidation - This commit is a suggestion. Added null and undefined handling in all prompt.validate() implementations because IPromptConfig.value can be null or undefined. Removed BasePrompt.error as redundant (we assign the value anyway, even if the value is not valid), maybe it's better to use isValid() instead? --- dist/__tests__/prompt/BasePrompt.spec.js | 2 +- dist/__tests__/prompt/BasePrompt.spec.js.map | 2 +- dist/domain/prompt/BasePrompt.d.ts | 3 +-- dist/domain/prompt/BasePrompt.d.ts.map | 2 +- dist/domain/prompt/BasePrompt.js | 3 --- dist/domain/prompt/BasePrompt.js.map | 2 +- dist/domain/prompt/IPrompt.d.ts | 3 +-- dist/domain/prompt/IPrompt.d.ts.map | 2 +- dist/domain/prompt/NumericPrompt.d.ts | 2 +- dist/domain/prompt/NumericPrompt.d.ts.map | 2 +- dist/domain/prompt/NumericPrompt.js | 2 +- dist/domain/prompt/NumericPrompt.js.map | 2 +- dist/domain/prompt/OpenPrompt.d.ts | 2 +- dist/domain/prompt/OpenPrompt.d.ts.map | 2 +- dist/domain/prompt/OpenPrompt.js | 3 +++ dist/domain/prompt/OpenPrompt.js.map | 2 +- dist/domain/prompt/SelectManyPrompt.d.ts | 4 ++-- dist/domain/prompt/SelectManyPrompt.d.ts.map | 2 +- dist/domain/prompt/SelectManyPrompt.js | 3 +++ dist/domain/prompt/SelectManyPrompt.js.map | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/SelectOnePrompt.js | 3 +++ dist/domain/prompt/SelectOnePrompt.js.map | 2 +- src/__tests__/prompt/BasePrompt.spec.ts | 2 +- src/domain/prompt/BasePrompt.ts | 10 +--------- src/domain/prompt/IPrompt.ts | 4 +--- src/domain/prompt/NumericPrompt.ts | 4 ++-- src/domain/prompt/OpenPrompt.ts | 6 +++++- src/domain/prompt/SelectManyPrompt.ts | 6 +++++- src/domain/prompt/SelectOnePrompt.ts | 6 +++++- 31 files changed, 50 insertions(+), 44 deletions(-) diff --git a/dist/__tests__/prompt/BasePrompt.spec.js b/dist/__tests__/prompt/BasePrompt.spec.js index 956675e7..c39721f6 100644 --- a/dist/__tests__/prompt/BasePrompt.spec.js +++ b/dist/__tests__/prompt/BasePrompt.spec.js @@ -18,7 +18,7 @@ describe('BasePrompt', () => { const ctx = dataset.contexts[1]; const runner = new __1.FlowRunner(ctx); const prompt = new __1.MessagePrompt(config, 'abc-123', runner); - expect(prompt.error).toBeNull(); + expect(prompt.isValid()).toBe(true); })); }); }); diff --git a/dist/__tests__/prompt/BasePrompt.spec.js.map b/dist/__tests__/prompt/BasePrompt.spec.js.map index 7c2e8694..a94c994f 100644 --- a/dist/__tests__/prompt/BasePrompt.spec.js.map +++ b/dist/__tests__/prompt/BasePrompt.spec.js.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.spec.js","sourceRoot":"","sources":["../../../src/__tests__/prompt/BasePrompt.spec.ts"],"names":[],"mappings":";;;AAAA,6BAQc;AACd,mDAAmE;AAEnE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,OAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,+BAAoB,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,EAAE,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;YACrB,EAAE,CAAC,gEAAgE,EAAE,GAAS,EAAE;gBAC9E,MAAM,MAAM,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;gBACtD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAA0B,CAAA;gBACxD,MAAM,MAAM,GAAG,IAAI,cAAU,CAAC,GAAG,CAAC,CAAA;gBAClC,MAAM,MAAM,GAAG,IAAI,iBAAa,CAAC,MAA8B,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;gBAEnF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAA;YACjC,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,uCAAuC,EAAE,GAAS,EAAE;YACrD,MAAM,MAAM,GAAuB,OA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,CAAA;AACJ,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.d.ts b/dist/domain/prompt/BasePrompt.d.ts index c85e7be8..7a1c529e 100644 --- a/dist/domain/prompt/BasePrompt.d.ts +++ b/dist/domain/prompt/BasePrompt.d.ts @@ -1,10 +1,9 @@ -import { IBlock, IFlowRunner, IPrompt, IPromptConfig, IRichCursorInputRequired, PromptValidationException } from '../..'; +import { IBlock, IFlowRunner, IPrompt, IPromptConfig, IRichCursorInputRequired } from '../..'; export declare type TGenericPrompt = IPrompt>; export declare abstract class BasePrompt> implements IPrompt { config: T; interactionId: string; runner: IFlowRunner; - error: PromptValidationException | null; constructor(config: T, interactionId: string, runner: IFlowRunner); get value(): T['value']; set value(val: T['value']); diff --git a/dist/domain/prompt/BasePrompt.d.ts.map b/dist/domain/prompt/BasePrompt.d.ts.map index d74abea9..10b96b35 100644 --- a/dist/domain/prompt/BasePrompt.d.ts.map +++ b/dist/domain/prompt/BasePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":"AAkBA,OAAO,EAIL,MAAM,EACN,WAAW,EACX,OAAO,EACP,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EAE1B,MAAM,OAAO,CAAA;AAEd,oBAAY,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AAMxD,8BAAsB,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IAGtE,MAAM,EAAE,CAAC;IAAS,aAAa,EAAE,MAAM;IAAS,MAAM,EAAE,WAAW;IAFtF,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAAO;gBAE3B,MAAM,EAAE,CAAC,EAAS,aAAa,EAAE,MAAM,EAAS,MAAM,EAAE,WAAW;IAKtF,IA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AAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IASlF,OAAO,IAAI,OAAO;IAYzB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO;CAC7C"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.js b/dist/domain/prompt/BasePrompt.js index 076c6e86..5d0493a4 100644 --- a/dist/domain/prompt/BasePrompt.js +++ b/dist/domain/prompt/BasePrompt.js @@ -8,7 +8,6 @@ class BasePrompt { this.config = config; this.interactionId = interactionId; this.runner = runner; - this.error = null; } get value() { return this.config.value; @@ -16,13 +15,11 @@ class BasePrompt { set value(val) { try { this.validate(val); - this.error = null; } catch (e) { if (!(e instanceof __1.PromptValidationException)) { throw e; } - this.error = e; } this.config.value = val; } diff --git a/dist/domain/prompt/BasePrompt.js.map b/dist/domain/prompt/BasePrompt.js.map index 92ba48c9..cd960dd2 100644 --- a/dist/domain/prompt/BasePrompt.js.map +++ b/dist/domain/prompt/BasePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAWc;AAQd,MAAsB,UAAU;IAG9B,YAAmB,MAAS,EAAS,aAAqB,EAAS,MAAmB;QAAnE,WAAM,GAAN,MAAM,CAAG;QAAS,kBAAa,GAAb,aAAa,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAa;QAFtF,UAAK,GAAqC,IAAI,CAAA;IAI9C,CAAC;IAGD,IAAI,KAAK;QAEP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;IAC1B,CAAC;IASD,IAAI,KAAK,CAAC,GAAe;QACvB,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;SAClB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,YAAY,6BAAyB,CAAC,EAAE;gBAC7C,MAAM,CAAC,CAAA;aACR;YAED,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;SACf;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAA;IACzB,CAAC;IAGD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAA;IACjC,CAAC;IAED,IAAI,KAAK;QACP,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA;QAC/B,MAAM,IAAI,GAAG,uBAAmB,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QACzD,MAAM,IAAI,GAAG,gBAAY,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAE3C,IAAI;YACF,OAAO,iBAAa,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,YAAY,uBAAmB,CAAC,EAAE;gBACvC,MAAM,CAAC,CAAA;aACR;YAED,OAAM;SACP;IACH,CAAC;IAEK,OAAO,CAAC,GAA2B;;YAEvC,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;aACjB;YAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;QAC1B,CAAC;KAAA;IAEM,OAAO;QACZ,IAAI;YACF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAOF;AA9ED,gCA8EC"} \ No newline at end of file +{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAWc;AAQd,MAAsB,UAAU;IAC9B,YAAmB,MAAS,E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;YACF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAOF;AAtED,gCAsEC"} \ No newline at end of file diff --git a/dist/domain/prompt/IPrompt.d.ts b/dist/domain/prompt/IPrompt.d.ts index 1ffa2497..27c7899a 100644 --- a/dist/domain/prompt/IPrompt.d.ts +++ b/dist/domain/prompt/IPrompt.d.ts @@ -1,11 +1,10 @@ -import { BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired, PromptValidationException } from '../..'; +import { BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired } from '../..'; export interface IPrompt> { interactionId: string; config: PromptConfigType; runner: IFlowRunner; block?: IBlock; value: PromptConfigType['value']; - error: PromptValidationException | null; isValid(): boolean; validate(val: PromptConfigType['value']): boolean; fulfill(val: PromptConfigType['value']): Promise; diff --git a/dist/domain/prompt/IPrompt.d.ts.map b/dist/domain/prompt/IPrompt.d.ts.map index 04417813..98e117b0 100644 --- a/dist/domain/prompt/IPrompt.d.ts.map +++ b/dist/domain/prompt/IPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"IPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/IPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,wBAAwB,EAAE,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAM1G,MAAM,WAAW,OAAO,CAAC,gBAAgB,SAAS,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxF,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,gBAAgB,CAAA;IACxB,MAAM,EAAE,WAAW,CAAA;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAEhC,KAAK,EAAE,yBAAy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O,CAAC,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;CACvF;AAMD,MAAM,WAAW,aAAa,CAAC,CAAC,CAAE,SAAQ,iBAAiB;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,kBAAkB,EAAE,OAAO,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,CAAC,CAAA;CACV;AAGD,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAI,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;CAC5E"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts b/dist/domain/prompt/NumericPrompt.d.ts index 1ef036c4..fb005eb6 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts +++ b/dist/domain/prompt/NumericPrompt.d.ts @@ -2,6 +2,6 @@ import { BasePrompt, INumericPromptConfig } from '../..'; export declare const NUMERIC_PROMPT_KEY = "Numeric"; export declare class NumericPrompt extends BasePrompt { static readonly promptKey = "Numeric"; - validate(val: number): boolean; + validate(val: INumericPromptConfig['value']): boolean; } //# sourceMappingURL=NumericPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts.map b/dist/domain/prompt/NumericPrompt.d.ts.map index 9a535ec2..f0c53e11 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts.map +++ b/dist/domain/prompt/NumericPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAEjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,QAAQ,CAAC,SAAS,aAAY;IAErC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAiB/B"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAEjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,QAAQ,CAAC,SAAS,aAAY;IAErC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,OAAO;CAiBtD"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.js b/dist/domain/prompt/NumericPrompt.js index dbf46b5b..b2e88651 100644 --- a/dist/domain/prompt/NumericPrompt.js +++ b/dist/domain/prompt/NumericPrompt.js @@ -5,7 +5,7 @@ const __1 = require("../.."); exports.NUMERIC_PROMPT_KEY = 'Numeric'; class NumericPrompt extends __1.BasePrompt { validate(val) { - if (Number.isNaN(val) || val === null) { + if (Number.isNaN(val) || val == null) { return false; } const { min, max } = this.config; diff --git a/dist/domain/prompt/NumericPrompt.js.map b/dist/domain/prompt/NumericPrompt.js.map index 64a8e6a1..1a7fd7c6 100644 --- a/dist/domain/prompt/NumericPrompt.js.map +++ b/dist/domain/prompt/NumericPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AAEpE,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IAGjE,QAAQ,CAAC,GAAW;QAClB,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,IAAI,EAAE;YACrC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;;AAnBH,sCAoBC;AAnBiB,uBAAS,GAAG,SAAS,CAAA"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AAEpE,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IAGjE,QAAQ,CAAC,GAAkC;QACzC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;YACpC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;;AAnBH,sCAoBC;AAnBiB,uBAAS,GAAG,SAAS,CAAA"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts b/dist/domain/prompt/OpenPrompt.d.ts index c5577ae7..8954b45d 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts +++ b/dist/domain/prompt/OpenPrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IOpenPromptConfig } from '../..'; export declare const OPEN_PROMPT_KEY = "Open"; export declare class OpenPrompt extends BasePrompt { - validate(val: string): boolean; + validate(val: IOpenPromptConfig['value']): boolean; } //# sourceMappingURL=OpenPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts.map b/dist/domain/prompt/OpenPrompt.d.ts.map index 34cefda3..debbb9b3 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts.map +++ b/dist/domain/prompt/OpenPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAW/B"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,OAAO;CAenD"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.js b/dist/domain/prompt/OpenPrompt.js index 064df66a..658cd79e 100644 --- a/dist/domain/prompt/OpenPrompt.js +++ b/dist/domain/prompt/OpenPrompt.js @@ -5,6 +5,9 @@ const __1 = require("../.."); exports.OPEN_PROMPT_KEY = 'Open'; class OpenPrompt extends __1.BasePrompt { validate(val) { + if (val == null) { + return false; + } const { maxResponseCharacters: maxLength } = this.config; if (maxLength != null && val.length > maxLength) { throw new __1.PromptValidationException('Too many characters on value provided'); diff --git a/dist/domain/prompt/OpenPrompt.js.map b/dist/domain/prompt/OpenPrompt.js.map index 2f97dc4a..fdaedd63 100644 --- a/dist/domain/prompt/OpenPrompt.js.map +++ b/dist/domain/prompt/OpenPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,QAAQ,CAAC,GAAW;QAClB,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAZD,gCAYC"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,QAAQ,CAAC,GAA+B;QACtC,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhBD,gCAgBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts b/dist/domain/prompt/SelectManyPrompt.d.ts index f52fc695..e5113711 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts +++ b/dist/domain/prompt/SelectManyPrompt.d.ts @@ -1,8 +1,8 @@ -import { BasePrompt, IChoice, ISelectManyPromptConfig } from '../..'; +import { BasePrompt, ISelectManyPromptConfig } from '../..'; export declare const INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = "At least one selection is required, but none provided"; export declare const INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK = "All selections must be valid choices on block"; export declare const SELECT_MANY_PROMPT_KEY = "SelectMany"; export declare class SelectManyPrompt extends BasePrompt { - validate(selections: IChoice['key'][]): boolean; + validate(selections: ISelectManyPromptConfig['value']): boolean; } //# sourceMappingURL=SelectManyPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts.map b/dist/domain/prompt/SelectManyPrompt.d.ts.map index f6f63442..4a16192e 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts.map +++ b/dist/domain/prompt/SelectManyPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,OAAO,EAA0B,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGrH,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO;CAkBhD"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAmC,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGrH,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,OAAO;CAsBhE"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.js b/dist/domain/prompt/SelectManyPrompt.js index 46c17018..63350b94 100644 --- a/dist/domain/prompt/SelectManyPrompt.js +++ b/dist/domain/prompt/SelectManyPrompt.js @@ -8,6 +8,9 @@ exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK = 'All selections must be val exports.SELECT_MANY_PROMPT_KEY = 'SelectMany'; class SelectManyPrompt extends __1.BasePrompt { validate(selections) { + if (selections == null) { + return false; + } const { isResponseRequired, choices } = this.config; if (!isResponseRequired) { return true; diff --git a/dist/domain/prompt/SelectManyPrompt.js.map b/dist/domain/prompt/SelectManyPrompt.js.map index 9a8b31a6..b40d60e4 100644 --- a/dist/domain/prompt/SelectManyPrompt.js.map +++ b/dist/domain/prompt/SelectManyPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAqH;AACrH,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,QAAQ,CAAC,UAA4B;QACnC,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,0BAAsB,CAAiB,kDAA0C,EAAE,cAAc,CAAC,CAAA;SAC7G;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnBD,4CAmBC"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAqH;AACrH,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,QAAQ,CAAC,UAA4C;QACnD,IAAI,UAAU,IAAI,IAAI,EAAE;YACtB,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,0BAAsB,CAAiB,kDAA0C,EAAE,cAAc,CAAC,CAAA;SAC7G;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAvBD,4CAuBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts b/dist/domain/prompt/SelectOnePrompt.d.ts index 5d31db48..2d7f8316 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts +++ b/dist/domain/prompt/SelectOnePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, ISelectOnePromptConfig } from '../..'; export declare const SELECT_ONE_PROMPT_KEY = "SelectOne"; export declare class SelectOnePrompt extends BasePrompt { - validate(choiceKey?: string | null): boolean; + validate(choiceKey: ISelectOnePromptConfig['value']): boolean; } //# sourceMappingURL=SelectOnePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts.map b/dist/domain/prompt/SelectOnePrompt.d.ts.map index e39b2c0c..2b985299 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/SelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;CAS7C"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,OAAO;CAa9D"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.js b/dist/domain/prompt/SelectOnePrompt.js index 4dfc1ce0..b8d4cecb 100644 --- a/dist/domain/prompt/SelectOnePrompt.js +++ b/dist/domain/prompt/SelectOnePrompt.js @@ -5,6 +5,9 @@ const __1 = require("../.."); exports.SELECT_ONE_PROMPT_KEY = 'SelectOne'; class SelectOnePrompt extends __1.BasePrompt { validate(choiceKey) { + if (choiceKey == null) { + return false; + } const { isResponseRequired, choices } = this.config; if (isResponseRequired && choices.find(({ key }) => key === choiceKey) == null) { throw new __1.PromptValidationException('Value provided must be in list of choices'); diff --git a/dist/domain/prompt/SelectOnePrompt.js.map b/dist/domain/prompt/SelectOnePrompt.js.map index 77a7c41c..1b0f7d04 100644 --- a/dist/domain/prompt/SelectOnePrompt.js.map +++ b/dist/domain/prompt/SelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,QAAQ,CAAC,SAAyB;QAChC,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAVD,0CAUC"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,QAAQ,CAAC,SAA0C;QACjD,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAdD,0CAcC"} \ No newline at end of file diff --git a/src/__tests__/prompt/BasePrompt.spec.ts b/src/__tests__/prompt/BasePrompt.spec.ts index 2996d7b5..ec6fe397 100644 --- a/src/__tests__/prompt/BasePrompt.spec.ts +++ b/src/__tests__/prompt/BasePrompt.spec.ts @@ -28,7 +28,7 @@ describe('BasePrompt', () => { const runner = new FlowRunner(ctx) const prompt = new MessagePrompt(config as IMessagePromptConfig, 'abc-123', runner) - expect(prompt.error).toBeNull() + expect(prompt.isValid()).toBe(true) }) }) }) diff --git a/src/domain/prompt/BasePrompt.ts b/src/domain/prompt/BasePrompt.ts index 0f9bb6f2..8567e924 100644 --- a/src/domain/prompt/BasePrompt.ts +++ b/src/domain/prompt/BasePrompt.ts @@ -36,8 +36,6 @@ export type TGenericPrompt = IPrompt> * implementations. */ export abstract class BasePrompt> implements IPrompt { - error: PromptValidationException | null = null - constructor(public config: T, public interactionId: string, public runner: IFlowRunner) { // todo: add canPerformEarlyExit() behaviour } @@ -49,24 +47,18 @@ export abstract class BasePrompt> implements } /** - * Set local {@link IPromptConfig.value}. This action is guarded by {@link validate}, where the result of - * {@link validate} is applied to {@link isValid}. Any exceptions raised by {@link validate} are applied to - * {@link error} property. + * Set local {@link IPromptConfig.value}. This action is guarded by {@link validate}. * * It's important to note that {@link value} property will be set (proxied onto local {@link IPromptConfig.value}) * regardless of any {@link PromptValidationException}s raised. */ set value(val: T['value']) { try { this.validate(val) - this.error = null } catch (e) { if (!(e instanceof PromptValidationException)) { throw e } - - this.error = e } - this.config.value = val } diff --git a/src/domain/prompt/IPrompt.ts b/src/domain/prompt/IPrompt.ts index d1d18437..45d1a10a 100644 --- a/src/domain/prompt/IPrompt.ts +++ b/src/domain/prompt/IPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired, PromptValidationException} from '../..' +import {BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired} from '../..' /** * Primary interface for interacting with an {@link IContact}; typically not immplemented fully, it is recommended that @@ -30,8 +30,6 @@ export interface IPrompt { static readonly promptKey = 'Numeric' - validate(val: number): boolean { - if (Number.isNaN(val) || val === null) { + validate(val: INumericPromptConfig['value']): boolean { + if (Number.isNaN(val) || val == null) { return false } diff --git a/src/domain/prompt/OpenPrompt.ts b/src/domain/prompt/OpenPrompt.ts index ca3d8c56..425f9b7c 100644 --- a/src/domain/prompt/OpenPrompt.ts +++ b/src/domain/prompt/OpenPrompt.ts @@ -26,7 +26,11 @@ export const OPEN_PROMPT_KEY = 'Open' * from an {@link IContact}. */ export class OpenPrompt extends BasePrompt { - validate(val: string): boolean { + validate(val: IOpenPromptConfig['value']): boolean { + if (val == null) { + return false + } + const {maxResponseCharacters: maxLength} = this.config if (maxLength != null && val.length > maxLength) { diff --git a/src/domain/prompt/SelectManyPrompt.ts b/src/domain/prompt/SelectManyPrompt.ts index 3c695cba..c58b0206 100644 --- a/src/domain/prompt/SelectManyPrompt.ts +++ b/src/domain/prompt/SelectManyPrompt.ts @@ -29,7 +29,11 @@ export const SELECT_MANY_PROMPT_KEY = 'SelectMany' * least one, from an {@link IContact}. */ export class SelectManyPrompt extends BasePrompt { - validate(selections: IChoice['key'][]): boolean { + validate(selections: ISelectManyPromptConfig['value']): boolean { + if (selections == null) { + return false + } + const {isResponseRequired, choices} = this.config if (!isResponseRequired) { diff --git a/src/domain/prompt/SelectOnePrompt.ts b/src/domain/prompt/SelectOnePrompt.ts index 0872528b..4247ba74 100644 --- a/src/domain/prompt/SelectOnePrompt.ts +++ b/src/domain/prompt/SelectOnePrompt.ts @@ -26,7 +26,11 @@ export const SELECT_ONE_PROMPT_KEY = 'SelectOne' * {@link IContact}. */ export class SelectOnePrompt extends BasePrompt { - validate(choiceKey?: string | null): boolean { + validate(choiceKey: ISelectOnePromptConfig['value']): boolean { + if (choiceKey == null) { + return false + } + const {isResponseRequired, choices} = this.config if (isResponseRequired && choices.find(({key}) => key === choiceKey) == null) { From 45e2d72d94f59854f472f04f140ec1310321bea0 Mon Sep 17 00:00:00 2001 From: Bulat Gabidullin Date: Wed, 20 Jan 2021 16:12:30 -0600 Subject: [PATCH 3/5] bugfix/VMO-2010/NumericBlockMaxCharactersValidation - Replaced prompt validate() with validateOrThrow() that has a different signature (returns void instead of boolean) which removes the ambiguity of how to use it. The validate() remains in the BasePrompt if the user of the library might need it, it returns boolean and doesn't throw. Fixed validateOrThrow implementations' return and throw lines. Cleaned up BasePrompt: removed try-catch from 'set value' as we assign the value even if there is an error thrown, changed the fulfill() so that it throws an error if the value is invalid which means the flow runner doesn't proceed/run with an invalid value anymore. Updated tests and readme file. --- README.md | 42 +++++++------------ .../__tests__/prompt/SelectManyPrompt.spec.js | 9 ++-- .../prompt/SelectManyPrompt.spec.js.map | 2 +- dist/domain/FlowRunner.d.ts.map | 2 +- dist/domain/FlowRunner.js | 8 +--- dist/domain/FlowRunner.js.map | 2 +- .../prompt/AdvancedSelectOnePrompt.d.ts | 2 +- .../prompt/AdvancedSelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/AdvancedSelectOnePrompt.js | 5 ++- .../prompt/AdvancedSelectOnePrompt.js.map | 2 +- dist/domain/prompt/BasePrompt.d.ts | 3 +- dist/domain/prompt/BasePrompt.d.ts.map | 2 +- dist/domain/prompt/BasePrompt.js | 19 ++++----- dist/domain/prompt/BasePrompt.js.map | 2 +- dist/domain/prompt/IPrompt.d.ts | 1 + dist/domain/prompt/IPrompt.d.ts.map | 2 +- dist/domain/prompt/MessagePrompt.d.ts | 2 +- dist/domain/prompt/MessagePrompt.d.ts.map | 2 +- dist/domain/prompt/MessagePrompt.js | 4 +- dist/domain/prompt/MessagePrompt.js.map | 2 +- dist/domain/prompt/NumericPrompt.d.ts | 3 +- dist/domain/prompt/NumericPrompt.d.ts.map | 2 +- dist/domain/prompt/NumericPrompt.js | 7 ++-- dist/domain/prompt/NumericPrompt.js.map | 2 +- dist/domain/prompt/OpenPrompt.d.ts | 2 +- dist/domain/prompt/OpenPrompt.d.ts.map | 2 +- dist/domain/prompt/OpenPrompt.js | 6 +-- dist/domain/prompt/OpenPrompt.js.map | 2 +- dist/domain/prompt/SelectManyPrompt.d.ts | 2 +- dist/domain/prompt/SelectManyPrompt.d.ts.map | 2 +- dist/domain/prompt/SelectManyPrompt.js | 10 ++--- dist/domain/prompt/SelectManyPrompt.js.map | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/SelectOnePrompt.js | 6 +-- dist/domain/prompt/SelectOnePrompt.js.map | 2 +- src/__tests__/prompt/SelectManyPrompt.spec.ts | 26 ++++++------ src/domain/FlowRunner.ts | 7 +--- src/domain/prompt/AdvancedSelectOnePrompt.ts | 10 ++++- src/domain/prompt/BasePrompt.ts | 38 +++++++---------- src/domain/prompt/IPrompt.ts | 5 ++- src/domain/prompt/MessagePrompt.ts | 4 +- src/domain/prompt/NumericPrompt.ts | 8 ++-- src/domain/prompt/OpenPrompt.ts | 6 +-- src/domain/prompt/SelectManyPrompt.ts | 12 +++--- src/domain/prompt/SelectOnePrompt.ts | 6 +-- 46 files changed, 132 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index 521ea725..15f3c3f4 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ ## What are Flows? -Flows are a modern paradign for describing the logic of digital information systems that interact with individuals, -often for the purpose of (a) collecting data or (b) providing information through interactive requests. -Some common examples of this are in mobile services using voice-based or SMS-based conversations over basic mobile -phones. Flows follow the "flowchart" paradigm, consisting of actions (nodes) and connections between actions, which can +Flows are a modern paradign for describing the logic of digital information systems that interact with individuals, +often for the purpose of (a) collecting data or (b) providing information through interactive requests. +Some common examples of this are in mobile services using voice-based or SMS-based conversations over basic mobile +phones. Flows follow the "flowchart" paradigm, consisting of actions (nodes) and connections between actions, which can incorporate decision-making logic. More details and definitions of components within this ecosystem at: https://floip.gitbooks.io/flow-specification/content/ @@ -16,9 +16,9 @@ Flow Runner is a concrete implementation of the Flow Interoperability specificat ## Usage example 1: Basic -To begin and set up, we first need to create a context to run a flow with. We have exposed a helper method with sane defaults to support this called `createContextDataObjectFor(contact)`. +To begin and set up, we first need to create a context to run a flow with. We have exposed a helper method with sane defaults to support this called `createContextDataObjectFor(contact)`. -Context is the single piece of truth to the state of the current run, which must adhere to the IContext interface (source found at: src/flow-spec/IContext.ts). We've designed this tool in such a way that we can pause execution between any interactive interaction and resume exactly where we'd left off. The context object is all we need, and it's 100% JSON-serializable. +Context is the single piece of truth to the state of the current run, which must adhere to the IContext interface (source found at: src/flow-spec/IContext.ts). We've designed this tool in such a way that we can pause execution between any interactive interaction and resume exactly where we'd left off. The context object is all we need, and it's 100% JSON-serializable. Contact is any concrete implementation of the exposed interface `IContact`, which only requires three props as follows: @@ -33,7 +33,7 @@ interface IContact { Next, we create a runner instance by providing the newly generated context data object as the first parameter. -And lastly, invoke `run()`. +And lastly, invoke `run()`. ```typescript const context: IContext = createContextDataObjectFor( @@ -59,7 +59,7 @@ We can inspect how the run went through a few different artifacts: ## Usage example 2: Interactive blocks with Prompts -Some Flows contain Blocks that require interaction with the Contact (via the host application) during their execution in order to fulfill their role within the Flow. This is accomplished through an interface exposed as IPrompt (src/domain/prompt/IPrompt.ts). +Some Flows contain Blocks that require interaction with the Contact (via the host application) during their execution in order to fulfill their role within the Flow. This is accomplished through an interface exposed as IPrompt (src/domain/prompt/IPrompt.ts). When running a flow, the runner will sprint full speed ahead until reaching a block requiring interaction, at which point the runner will pause, return a cursor (containing an IPrompt), and wait until further action is taken. @@ -83,9 +83,9 @@ const {prompt}: IRichCursorInputRequired = prompt.fulfill('Jenso Ubla')! --- -The prompt's requirements are preconfigured in the corresponding block before the run is begun. An example of configuration that could take place are min/max constraints when requiring numeric input. +The prompt's requirements are preconfigured in the corresponding block before the run is begun. An example of configuration that could take place are min/max constraints when requiring numeric input. -Note that at the lowest level, the `validate(input)` method is called when attempting to set a value on the prompt instance. What this means is that we'll see `PromptValidationException` s bubbled at all levels: +Note that at the lowest level, the `validateOrThrow(input)` method is called when attempting to set a value on the prompt instance. What this means is that we'll see `PromptValidationException` s bubbled at all levels: ```typescript > prompt.fulfill(200) @@ -98,17 +98,7 @@ Error: Value provided is greater than allowed ``` ```typescript -> prompt.value = 200 - -Error: Value provided is greater than allowed - - at NumericPrompt.validate (src/domain/prompt/NumericPrompt.ts:20:13) - at NumericPrompt.set value [as value] (src/domain/prompt/BasePrompt.ts:46:27) - at NumericPrompt.fulfill (src/domain/prompt/BasePrompt.ts:63:15) -``` - -```typescript -> prompt.validate(200) +> prompt.validateOrThrow(200) Error: Value provided is greater than allowed @@ -157,7 +147,7 @@ interface ICursor { } ``` -Sometimes we need a bit more data to pass around and some functional behaviour to work with. This is where the concept of hydration/dehydration comes in. With an `ICursor`'s corresponding `IContext`, we can swap between our primitive and rich cursor formats. +Sometimes we need a bit more data to pass around and some functional behaviour to work with. This is where the concept of hydration/dehydration comes in. With an `ICursor`'s corresponding `IContext`, we can swap between our primitive and rich cursor formats. ``` const richCursor: IRichCursor = runner.hydrateRichCursorFrom(context) @@ -251,7 +241,7 @@ It should be noted here, that after satisfying a prompt, and taking action on ru ## Usage example 4: Customization of block runners -Sometimes we need to perform some additional customization of our `IBlockRunner` collection before beginning the Flow run. +Sometimes we need to perform some additional customization of our `IBlockRunner` collection before beginning the Flow run. > Please be very wary of modifying this configuration amidst a partially completed flow run, this has the potential for reducing the predictability and consistency of resulting run data. @@ -273,7 +263,7 @@ const runnerFactoryStore: IBlockRunnerFactoryStore = createDefaultBlockRunnerSto const messageBlockRunnerFactory: TBlockRunnerFactory = runnerFactoryStore.get('MobilePrimitives\\Message') // ... and new block runners can be added -runnerFactoryStore.set('MobilePrimitives\\Message', (block, ctx) => +runnerFactoryStore.set('MobilePrimitives\\Message', (block, ctx) => new MessageBlockRunner(block as IMessageBlock, ctx)) const runner: IFlowRunner = new FlowRunner(context, runnerFactoryStore) @@ -353,7 +343,7 @@ class NumericResponseBlockRunner implements IBlockRunner { ## Usage example 5: Customization of FlowRunner via `IBehaviour` -`IBehaviour`s are our first pass at solving for extensibility within the FlowRunner itself. +`IBehaviour`s are our first pass at solving for extensibility within the FlowRunner itself. ```typescript interface IBehaviour { @@ -386,4 +376,4 @@ runner.behaviours.basicBacktracking = new BasicBacktrackingBehaviour(context) A couple examples of how we've found behaviours useful are: - traversing back through interaction history -- improving performance through caching values +- improving performance through caching values diff --git a/dist/__tests__/prompt/SelectManyPrompt.spec.js b/dist/__tests__/prompt/SelectManyPrompt.spec.js index 7c992515..172bbef3 100644 --- a/dist/__tests__/prompt/SelectManyPrompt.spec.js +++ b/dist/__tests__/prompt/SelectManyPrompt.spec.js @@ -19,7 +19,7 @@ describe('SelectManyPrompt', () => { describe('when a response isRequired', () => { it('should raise when some selections are invalid', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = ['choice-A', 'choice-B', 'key-not-in-prompt-config', 'choice-C']; - verifyValidationThrows(prompt.validate.bind(prompt, selections), __1.InvalidChoiceException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, ['key-not-in-prompt-config']); + verifyValidationThrows(prompt.validateOrThrow.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK); })); it('should raise when all selections are invalid', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = [ @@ -28,11 +28,11 @@ describe('SelectManyPrompt', () => { 'key-not-in-prompt-config-C', 'key-not-in-prompt-config-D', ]; - verifyValidationThrows(prompt.validate.bind(prompt, selections), __1.InvalidChoiceException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, selections); + verifyValidationThrows(prompt.validateOrThrow.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK); })); it('should raise when no selections are provided', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = []; - verifyValidationThrows(prompt.validate.bind(prompt, selections), __1.ValidationException, __1.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); + verifyValidationThrows(prompt.validateOrThrow.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); })); }); it('should return true when all selections are valid', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { @@ -46,7 +46,7 @@ describe('SelectManyPrompt', () => { })); }); }); -const verifyValidationThrows = (invoker, ErrorType, msg, choices) => { +const verifyValidationThrows = (invoker, ErrorType, msg) => { try { invoker(); expect(true).toBeFalsy(); @@ -54,7 +54,6 @@ const verifyValidationThrows = (invoker, ErrorType, msg, choices) => { catch (e) { expect(e).toBeInstanceOf(ErrorType); expect(e.message).toEqual(msg); - expect(e.choices).toEqual(choices); } }; //# sourceMappingURL=SelectManyPrompt.spec.js.map \ No newline at end of file diff --git a/dist/__tests__/prompt/SelectManyPrompt.spec.js.map b/dist/__tests__/prompt/SelectManyPrompt.spec.js.map index 69d19f17..a44210e3 100644 --- a/dist/__tests__/prompt/SelectManyPrompt.spec.js.map +++ b/dist/__tests__/prompt/SelectManyPrompt.spec.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.spec.js","sourceRoot":"","sources":["../../../src/__tests__/prompt/SelectManyPrompt.spec.ts"],"names":[],"mappings":";;;AAAA,6BAWc;AACd,mDAAmE;AAEnE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,OAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,+BAAoB,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,IAAI,MAAwB,CAAA;QAC5B,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,MAAM,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YACtD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAA0B,CAAA;YACxD,MAAM,MAAM,GAAG,IAAI,cAAU,CAAC,GAAG,CAAC,CAAA;YAElC,MAAM,GAAG,IAAI,oBAAgB,CAAC,MAAiC,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;QACtF,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;YAC1C,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;gBAC7D,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,0BAA0B,EAAE,UAAU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CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChD,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAyB,CAAC,OAAiB,EAAE,SAAmB,EAAE,GAAW,EAAE,OAA0B,EAAE,EAAE;IACvI,IAAI;QACF,OAAO,EAAE,CAAA;QAIT,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAA;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;QACnC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC9B,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;KACnC;AACH,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.spec.js","sourceRoot":"","sources":["../../../src/__tests__/prompt/SelectManyPrompt.spec.ts"],"names":[],"mappings":";;;AAAA,6BAUc;AACd,mDAAmE;AAEnE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,OAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,+BAAoB,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,IAAI,MAAwB,CAAA;QAC5B,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,MAAM,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YACtD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAA0B,CAAA;YACxD,MAAM,MAAM,GAAG,IAAI,cAAU,CAAC,GAAG,CAAC,CAAA;YAElC,MAAM,GAAG,IAAI,oBAAgB,CAAC,M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,GAAS,EAAE;YACtF,MAAM,CAAC,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAA;YAExC,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,0BAA0B,EAAE,UAAU,CAAC,CAAA;YACnF,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChD,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAyB,CAAC,OAAiB,EAAE,SAAmB,EAAE,GAAW,EAAE,EAAE;IAC3G,IAAI;QACF,OAAO,EAAE,CAAA;QAIT,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAA;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;QACnC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;KAC/B;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/domain/FlowRunner.d.ts.map b/dist/domain/FlowRunner.d.ts.map index 54545bb9..164ce658 100644 --- a/dist/domain/FlowRunner.d.ts.map +++ b/dist/domain/FlowRunner.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"FlowRunner.d.ts","sourceRoot":"","sources":["../../src/domain/FlowRunner.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,0BAA0B,EAAS,MAAM,KAAK,CAAA;AAEtD,OAAO,EAQL,UAAU,EACV,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EAExB,QAAQ,EAER,eAAe,EACf,kBAAkB,EAClB,OAAO,EAEP,WAAW,EACX,YAAY,EAEZ,aAAa,EAKb,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,wBAAwB,EAWxB,i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,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAC,OAAO;QAKjD,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,uBAAuB,GAAG,UAAU,CAAC,OAAO;QAKpG,cAAc,CAAC,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC,OAAO;QAK7D,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,UAAU,CAAC,OAAO;QAK7E,eAAe,CAAC,CAAC,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO;QAK5F,KAAK,IAAI,UAAU;KAIpB;CACF"} \ No newline at end of file diff --git a/dist/domain/FlowRunner.js b/dist/domain/FlowRunner.js index 90f59edd..24b38a62 100644 --- a/dist/domain/FlowRunner.js +++ b/dist/domain/FlowRunner.js @@ -95,13 +95,7 @@ class FlowRunner { return true; } const { prompt } = this.hydrateRichCursorFrom(ctx); - try { - prompt.validate(prompt.value); - return false; - } - catch (e) { - return true; - } + return !prompt.isValid(); } cacheInteractionByBlockName({ uuid, entryAt }, { name, config: { prompt } }, context = this.context) { if (!('blockInteractionsByBlockName' in this.context.sessionVars)) { diff --git a/dist/domain/FlowRunner.js.map b/dist/domain/FlowRunner.js.map index f59f9d9c..5a4b393d 100644 --- a/dist/domain/FlowRunner.js.map +++ b/dist/domain/FlowRunner.js.map @@ -1 +1 @@ -{"version":3,"file":"FlowRunner.js","sourceRoot":"","sources":["../../src/domain/FlowRunner.ts"],"names":[],"mappings":";;;;AAoBA,6BAAsD;AACtD,mCAAuE;AACvE,0BAsDW;AAEX,MAAa,uBAAwB,SAAQ,GAAgC;CAAuC;AAApH,0DAAoH;AAUpH,MAAM,uBAAuB,GAA4B;IACvD,8BAA0B;CAE3B,CAAA;AAKY,QAAA,2BAA2B,GAAG,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;AAK1E,SAAgB,6BA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C;QAED,KAAK;YACH,iBAAa,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,kFAAkF,CAAC,CAAA;YACrH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;QACvH,CAAC;KACF;IApCY,kBAAO,UAoCnB,CAAA;AACH,CAAC,EAvCgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAuC1B"} \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts index 252c0e5e..c7d2ba82 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IAdvancedSelectOne, IAdvancedSelectOnePromptConfig } from '../..'; export declare const ADVANCED_SELECT_ONE_PROMPT_KEY = "AdvancedSelectOne"; export declare class AdvancedSelectOnePrompt extends BasePrompt { - validate(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): boolean; + validateOrThrow(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): void; } //# sourceMappingURL=AdvancedSelectOnePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map index 9fdf4ae5..115e53b1 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"AdvancedSelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAA4B,MAAM,OAAO,CAAA;AAE9H,eAAO,MAAM,8BAA8B,sBAAsB,CAAA;AAEjE,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACrF,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO;CA2B/E"} \ No newline at end of file +{"version":3,"file":"AdvancedSelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAA4B,MAAM,OAAO,CAAA;AAE9H,eAAO,MAAM,8BAA8B,sBAAsB,CAAA;AAEjE,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACrF,eAAe,CAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI;CAiCnF"} \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.js b/dist/domain/prompt/AdvancedSelectOnePrompt.js index f13410be..70a6b286 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.js +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.js @@ -4,8 +4,9 @@ exports.AdvancedSelectOnePrompt = exports.ADVANCED_SELECT_ONE_PROMPT_KEY = void const __1 = require("../.."); exports.ADVANCED_SELECT_ONE_PROMPT_KEY = 'AdvancedSelectOne'; class AdvancedSelectOnePrompt extends __1.BasePrompt { - validate(selectedRow, choiceRows) { + validateOrThrow(selectedRow, choiceRows) { const { choiceRowFields, isResponseRequired } = this.config; + __1.assertNotNull(selectedRow, () => 'Value provided is null or undefined', message => new __1.PromptValidationException(message)); __1.assertNotNull(choiceRows, () => 'choiceRows must be non-null', message => new __1.PromptValidationException(message)); if (isResponseRequired) { const hasSelectedRow = choiceRows.some(row => selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.every(selection => { @@ -21,7 +22,7 @@ class AdvancedSelectOnePrompt extends __1.BasePrompt { throw new __1.PromptValidationException(`Failed to find the given row: ${selectedRow}`); } } - return true; + return; } } exports.AdvancedSelectOnePrompt = AdvancedSelectOnePrompt; diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.js.map b/dist/domain/prompt/AdvancedSelectOnePrompt.js.map index e0feaddd..47dbaebf 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.js.map +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"AdvancedSelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8H;AAEjH,QAAA,8BAA8B,GAAG,mBAAmB,CAAA;AAEjE,MAAa,uBAAwB,SAAQ,cAA0C;IACrF,QAAQ,CAAC,WAAkC,EAAE,UAAuB;QAClE,MAAM,EAAC,eAAe,EAAE,kBAAkB,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzD,iBAAa,CACX,UAAU,EACV,GAAG,EAAE,CAAC,6BAA6B,EACnC,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC3D,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,6BAAyB,CAAC,mCAAmC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;iBACzF;qBAAM;oBACL,OAAO,SAAS,CAAC,KAAK,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;iBAC5C;YACH,CAAC,CAAC,CACH,CAAA;YACD,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,6BAAyB,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAA;aACpF;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA5BD,0DA4BC"} \ No newline at end of file +{"version":3,"file":"AdvancedSelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8H;AAEjH,QAAA,8BAA8B,GAAG,mBAAmB,CAAA;AAEjE,MAAa,uBAAwB,SAAQ,cAA0C;IACrF,eAAe,CAAC,WAAkC,EAAE,UAAuB;QACzE,MAAM,EAAC,eAAe,EAAE,kBAAkB,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzD,iBAAa,CACX,WAAW,EACX,GAAG,EAAE,CAAC,qCAAqC,EAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,iBAAa,CACX,UAAU,EACV,GAAG,EAAE,CAAC,6BAA6B,EACnC,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC3D,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,6BAAyB,CAAC,mCAAmC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;iBACzF;qBAAM;oBACL,OAAO,SAAS,CAAC,KAAK,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;iBAC5C;YACH,CAAC,CAAC,CACH,CAAA;YACD,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,6BAAyB,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAA;aACpF;SACF;QAED,OAAM;IACR,CAAC;CACF;AAlCD,0DAkCC"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.d.ts b/dist/domain/prompt/BasePrompt.d.ts index 7a1c529e..49fa2848 100644 --- a/dist/domain/prompt/BasePrompt.d.ts +++ b/dist/domain/prompt/BasePrompt.d.ts @@ -11,6 +11,7 @@ export declare abstract class BasePrompt> im get block(): IBlock | undefined; fulfill(val: T['value'] | undefined): Promise; isValid(): boolean; - abstract validate(val?: T['value']): boolean; + abstract validateOrThrow(val?: T['value']): void; + validate(val?: T['value']): boolean; } //# sourceMappingURL=BasePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.d.ts.map b/dist/domain/prompt/BasePrompt.d.ts.map index 10b96b35..3820fc94 100644 --- a/dist/domain/prompt/BasePrompt.d.ts.map +++ b/dist/domain/prompt/BasePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":"AAkBA,OAAO,EAIL,MAAM,EACN,WAAW,EACX,OAAO,EACP,aAAa,EACb,wBAAwB,EAGzB,MAAM,OAAO,CAAA;AAEd,oBAAY,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AAMxD,8BAAsB,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM,EAAE,CAAC;IAAS,aAAa,EAAE,MAAM;IAAS,MAAM,EAAE,WAAW;gBAAnE,MAAM,EAAE,CAAC,EAAS,aAAa,EAAE,MAAM,EAAS,MAAM,EAAE,W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,GAAG,SAAS,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAOlF,OAAO,IAAI,OAAO;IASzB,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI;IAEhD,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO;CAQpC"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.js b/dist/domain/prompt/BasePrompt.js index 5d0493a4..6214031d 100644 --- a/dist/domain/prompt/BasePrompt.js +++ b/dist/domain/prompt/BasePrompt.js @@ -13,14 +13,6 @@ class BasePrompt { return this.config.value; } set value(val) { - try { - this.validate(val); - } - catch (e) { - if (!(e instanceof __1.PromptValidationException)) { - throw e; - } - } this.config.value = val; } get isEmpty() { @@ -42,15 +34,18 @@ class BasePrompt { } fulfill(val) { return tslib_1.__awaiter(this, void 0, void 0, function* () { - if (val !== undefined) { - this.value = val; - } + this.value = val; + this.validateOrThrow(val); return this.runner.run(); }); } isValid() { + return this.validate(this.config.value); + } + validate(val) { try { - return this.validate(this.config.value); + this.validateOrThrow(val); + return true; } catch (e) { return false; diff --git a/dist/domain/prompt/BasePrompt.js.map b/dist/domain/prompt/BasePrompt.js.map index cd960dd2..65e2b5e3 100644 --- a/dist/domain/prompt/BasePrompt.js.map +++ b/dist/domain/prompt/BasePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAWc;AAQd,MAAsB,UAAU;IAC9B,YAAmB,MAAS,EAAS,aAAqB,EAAS,MAAmB;QAAnE,WAAM,GAAN,MAAM,CAAG;QAAS,kBAAa,GAAb,aAAa,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAa;IAEtF,CAAC;IAGD,IAAI,KAAK;QAEP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;IAC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CAAC,CAAA;IACzC,CAAC;IASD,QAAQ,CAAC,GAAgB;QACvB,IAAI;YACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CACF;AA/DD,gCA+DC"} \ No newline at end of file diff --git a/dist/domain/prompt/IPrompt.d.ts b/dist/domain/prompt/IPrompt.d.ts index 27c7899a..170dbfaf 100644 --- a/dist/domain/prompt/IPrompt.d.ts +++ b/dist/domain/prompt/IPrompt.d.ts @@ -6,6 +6,7 @@ export interface IPrompt; } diff --git a/dist/domain/prompt/IPrompt.d.ts.map b/dist/domain/prompt/IPrompt.d.ts.map index 98e117b0..e199621d 100644 --- a/dist/domain/prompt/IPrompt.d.ts.map +++ b/dist/domain/prompt/IPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"IPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/IPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,wBAAwB,EAAC,MAAM,OAAO,CAAA;AAM/E,MAAM,WAAW,OAAO,CAAC,gBAAgB,SAAS,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxF,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,gBAAgB,CAAA;IACxB,MAAM,EAAE,WAAW,CAAA;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAGhC,OAAO,IAAI,OAAO,CAAA;IAGlB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAGjD,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;CACvF;AAMD,M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AAE,MAAM,CAAA;IACZ,kBAAkB,EAAE,OAAO,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,CAAC,CAAA;CACV;AAGD,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;CAC7E"} \ No newline at end of file diff --git a/dist/domain/prompt/MessagePrompt.d.ts b/dist/domain/prompt/MessagePrompt.d.ts index 4a37b79a..11378fb8 100644 --- a/dist/domain/prompt/MessagePrompt.d.ts +++ b/dist/domain/prompt/MessagePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IMessagePromptConfig } from '../..'; export declare const MESSAGE_PROMPT_KEY = "Message"; export declare class MessagePrompt extends BasePrompt { - validate(): boolean; + validateOrThrow(): void; } //# sourceMappingURL=MessagePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/MessagePrompt.d.ts.map b/dist/domain/prompt/MessagePrompt.d.ts.map index c71d9458..cbc0ae89 100644 --- a/dist/domain/prompt/MessagePrompt.d.ts.map +++ b/dist/domain/prompt/MessagePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"MessagePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,OAAO,CAAA;AAEtD,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAK3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,QAAQ,IAAI,OAAO;CAGpB"} \ No newline at end of file +{"version":3,"file":"MessagePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,OAAO,CAAA;AAEtD,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAK3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,eAAe,IAAI,IAAI;CAGxB"} \ No newline at end of file diff --git a/dist/domain/prompt/MessagePrompt.js b/dist/domain/prompt/MessagePrompt.js index ca8081ca..c6a18425 100644 --- a/dist/domain/prompt/MessagePrompt.js +++ b/dist/domain/prompt/MessagePrompt.js @@ -4,8 +4,8 @@ exports.MessagePrompt = exports.MESSAGE_PROMPT_KEY = void 0; const __1 = require("../.."); exports.MESSAGE_PROMPT_KEY = 'Message'; class MessagePrompt extends __1.BasePrompt { - validate() { - return true; + validateOrThrow() { + return; } } exports.MessagePrompt = MessagePrompt; diff --git a/dist/domain/prompt/MessagePrompt.js.map b/dist/domain/prompt/MessagePrompt.js.map index a3ad59e6..b7399149 100644 --- a/dist/domain/prompt/MessagePrompt.js.map +++ b/dist/domain/prompt/MessagePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"MessagePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAsD;AAEzC,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAK3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,QAAQ;QACN,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAJD,sCAIC"} \ No newline at end of file +{"version":3,"file":"MessagePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAsD;AAEzC,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAK3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,eAAe;QACb,OAAM;IACR,CAAC;CACF;AAJD,sCAIC"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts b/dist/domain/prompt/NumericPrompt.d.ts index fb005eb6..4c6c5c02 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts +++ b/dist/domain/prompt/NumericPrompt.d.ts @@ -1,7 +1,6 @@ import { BasePrompt, INumericPromptConfig } from '../..'; export declare const NUMERIC_PROMPT_KEY = "Numeric"; export declare class NumericPrompt extends BasePrompt { - static readonly promptKey = "Numeric"; - validate(val: INumericPromptConfig['value']): boolean; + validateOrThrow(val: INumericPromptConfig['value']): void; } //# sourceMappingURL=NumericPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts.map b/dist/domain/prompt/NumericPrompt.d.ts.map index f0c53e11..e103e203 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts.map +++ b/dist/domain/prompt/NumericPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAEjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,QAAQ,CAAC,SAAS,aAAY;IAErC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,OAAO;CAiBtD"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAEjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,eAAe,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,IAAI;CAiB1D"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.js b/dist/domain/prompt/NumericPrompt.js index b2e88651..14d48d12 100644 --- a/dist/domain/prompt/NumericPrompt.js +++ b/dist/domain/prompt/NumericPrompt.js @@ -4,9 +4,9 @@ exports.NumericPrompt = exports.NUMERIC_PROMPT_KEY = void 0; const __1 = require("../.."); exports.NUMERIC_PROMPT_KEY = 'Numeric'; class NumericPrompt extends __1.BasePrompt { - validate(val) { + validateOrThrow(val) { if (Number.isNaN(val) || val == null) { - return false; + throw new __1.PromptValidationException('Value provided is null, undefined, or not a number'); } const { min, max } = this.config; if (min != null && val < min) { @@ -15,9 +15,8 @@ class NumericPrompt extends __1.BasePrompt { if (max != null && val > max) { throw new __1.PromptValidationException('Value provided is greater than allowed'); } - return true; + return; } } exports.NumericPrompt = NumericPrompt; -NumericPrompt.promptKey = 'Numeric'; //# sourceMappingURL=NumericPrompt.js.map \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.js.map b/dist/domain/prompt/NumericPrompt.js.map index 1a7fd7c6..90a651ee 100644 --- a/dist/domain/prompt/NumericPrompt.js.map +++ b/dist/domain/prompt/NumericPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AAEpE,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IAGjE,QAAQ,CAAC,GAAkC;QACzC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;YACpC,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;;AAnBH,sCAoBC;AAnBiB,uBAAS,GAAG,SAAS,CAAA"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AAEpE,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,eAAe,CAAC,GAAkC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;YACpC,MAAM,IAAI,6BAAyB,CAAC,oDAAoD,CAAC,CAAA;SAC1F;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAM;IACR,CAAC;CACF;AAlBD,sCAkBC"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts b/dist/domain/prompt/OpenPrompt.d.ts index 8954b45d..9697a3f6 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts +++ b/dist/domain/prompt/OpenPrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IOpenPromptConfig } from '../..'; export declare const OPEN_PROMPT_KEY = "Open"; export declare class OpenPrompt extends BasePrompt { - validate(val: IOpenPromptConfig['value']): boolean; + validateOrThrow(val: IOpenPromptConfig['value']): void; } //# sourceMappingURL=OpenPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts.map b/dist/domain/prompt/OpenPrompt.d.ts.map index debbb9b3..e551a7d4 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts.map +++ b/dist/domain/prompt/OpenPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,OAAO;CAenD"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,IAAI;CAevD"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.js b/dist/domain/prompt/OpenPrompt.js index 658cd79e..a7c3f27c 100644 --- a/dist/domain/prompt/OpenPrompt.js +++ b/dist/domain/prompt/OpenPrompt.js @@ -4,15 +4,15 @@ exports.OpenPrompt = exports.OPEN_PROMPT_KEY = void 0; const __1 = require("../.."); exports.OPEN_PROMPT_KEY = 'Open'; class OpenPrompt extends __1.BasePrompt { - validate(val) { + validateOrThrow(val) { if (val == null) { - return false; + throw new __1.PromptValidationException('Value provided is null, undefined, or not a number'); } const { maxResponseCharacters: maxLength } = this.config; if (maxLength != null && val.length > maxLength) { throw new __1.PromptValidationException('Too many characters on value provided'); } - return true; + return; } } exports.OpenPrompt = OpenPrompt; diff --git a/dist/domain/prompt/OpenPrompt.js.map b/dist/domain/prompt/OpenPrompt.js.map index fdaedd63..833ae2fb 100644 --- a/dist/domain/prompt/OpenPrompt.js.map +++ b/dist/domain/prompt/OpenPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,QAAQ,CAAC,GAA+B;QACtC,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhBD,gCAgBC"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,eAAe,CAAC,GAA+B;QAC7C,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,IAAI,6BAAyB,CAAC,oDAAoD,CAAC,CAAA;SAC1F;QAED,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAM;IACR,CAAC;CACF;AAhBD,gCAgBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts b/dist/domain/prompt/SelectManyPrompt.d.ts index e5113711..42d0d44d 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts +++ b/dist/domain/prompt/SelectManyPrompt.d.ts @@ -3,6 +3,6 @@ export declare const INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = "At least one sel export declare const INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK = "All selections must be valid choices on block"; export declare const SELECT_MANY_PROMPT_KEY = "SelectMany"; export declare class SelectManyPrompt extends BasePrompt { - validate(selections: ISelectManyPromptConfig['value']): boolean; + validateOrThrow(selections: ISelectManyPromptConfig['value']): void; } //# sourceMappingURL=SelectManyPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts.map b/dist/domain/prompt/SelectManyPrompt.d.ts.map index 4a16192e..b0675d0b 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts.map +++ b/dist/domain/prompt/SelectManyPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAmC,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGrH,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,OAAO;CAsBhE"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGpF,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,eAAe,CAAC,UAAU,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI;CAsBpE"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.js b/dist/domain/prompt/SelectManyPrompt.js index 63350b94..a7ce3aa4 100644 --- a/dist/domain/prompt/SelectManyPrompt.js +++ b/dist/domain/prompt/SelectManyPrompt.js @@ -7,22 +7,22 @@ exports.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = 'At least one selection is req exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK = 'All selections must be valid choices on block'; exports.SELECT_MANY_PROMPT_KEY = 'SelectMany'; class SelectManyPrompt extends __1.BasePrompt { - validate(selections) { + validateOrThrow(selections) { if (selections == null) { - return false; + throw new __1.PromptValidationException('Value provided is null or undefined'); } const { isResponseRequired, choices } = this.config; if (!isResponseRequired) { - return true; + return; } if (choices.length !== 0 && selections.length === 0) { throw new __1.PromptValidationException(exports.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); } const invalidChoices = lodash_1.difference(selections, lodash_1.map(choices, 'key')); if (invalidChoices.length !== 0) { - throw new __1.InvalidChoiceException(exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, invalidChoices); + throw new __1.PromptValidationException(exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK); } - return true; + return; } } exports.SelectManyPrompt = SelectManyPrompt; diff --git a/dist/domain/prompt/SelectManyPrompt.js.map b/dist/domain/prompt/SelectManyPrompt.js.map index b40d60e4..035d1ff4 100644 --- a/dist/domain/prompt/SelectManyPrompt.js.map +++ b/dist/domain/prompt/SelectManyPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAqH;AACrH,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,QAAQ,CAAC,UAA4C;QACnD,IAAI,UAAU,IAAI,IAAI,EAAE;YACtB,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,0BAAsB,CAAiB,kDAA0C,EAAE,cAAc,CAAC,CAAA;SAC7G;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAvBD,4CAuBC"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAoF;AACpF,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,eAAe,CAAC,UAA4C;QAC1D,IAAI,UAAU,IAAI,IAAI,EAAE;YACtB,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAM;SACP;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,6BAAyB,CAAC,kDAA0C,CAAC,CAAA;SAChF;QAED,OAAM;IACR,CAAC;CACF;AAvBD,4CAuBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts b/dist/domain/prompt/SelectOnePrompt.d.ts index 2d7f8316..2f650f95 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts +++ b/dist/domain/prompt/SelectOnePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, ISelectOnePromptConfig } from '../..'; export declare const SELECT_ONE_PROMPT_KEY = "SelectOne"; export declare class SelectOnePrompt extends BasePrompt { - validate(choiceKey: ISelectOnePromptConfig['value']): boolean; + validateOrThrow(choiceKey: ISelectOnePromptConfig['value']): void; } //# sourceMappingURL=SelectOnePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts.map b/dist/domain/prompt/SelectOnePrompt.d.ts.map index 2b985299..cc9849a8 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/SelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,OAAO;CAa9D"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,eAAe,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,IAAI;CAalE"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.js b/dist/domain/prompt/SelectOnePrompt.js index b8d4cecb..59ccf357 100644 --- a/dist/domain/prompt/SelectOnePrompt.js +++ b/dist/domain/prompt/SelectOnePrompt.js @@ -4,15 +4,15 @@ exports.SelectOnePrompt = exports.SELECT_ONE_PROMPT_KEY = void 0; const __1 = require("../.."); exports.SELECT_ONE_PROMPT_KEY = 'SelectOne'; class SelectOnePrompt extends __1.BasePrompt { - validate(choiceKey) { + validateOrThrow(choiceKey) { if (choiceKey == null) { - return false; + throw new __1.PromptValidationException('Value provided is null or undefined'); } const { isResponseRequired, choices } = this.config; if (isResponseRequired && choices.find(({ key }) => key === choiceKey) == null) { throw new __1.PromptValidationException('Value provided must be in list of choices'); } - return true; + return; } } exports.SelectOnePrompt = SelectOnePrompt; diff --git a/dist/domain/prompt/SelectOnePrompt.js.map b/dist/domain/prompt/SelectOnePrompt.js.map index 1b0f7d04..bbff7de2 100644 --- a/dist/domain/prompt/SelectOnePrompt.js.map +++ b/dist/domain/prompt/SelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,QAAQ,CAAC,SAA0C;QACjD,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,OAAO,KAAK,CAAA;SACb;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAdD,0CAcC"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,eAAe,CAAC,SAA0C;QACxD,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAM;IACR,CAAC;CACF;AAdD,0CAcC"} \ No newline at end of file diff --git a/src/__tests__/prompt/SelectManyPrompt.spec.ts b/src/__tests__/prompt/SelectManyPrompt.spec.ts index dfa7bf17..b3f8b76b 100644 --- a/src/__tests__/prompt/SelectManyPrompt.spec.ts +++ b/src/__tests__/prompt/SelectManyPrompt.spec.ts @@ -4,11 +4,10 @@ import { IContextInputRequired, INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, INVALID_AT_LEAST_ONE_SELECTION_REQUIRED, - InvalidChoiceException, IPromptConfig, ISelectManyPromptConfig, + PromptValidationException, SelectManyPrompt, - ValidationException, } from '../..' import {createDefaultDataset, IDataset} from '../fixtures/IDataset' @@ -34,10 +33,9 @@ describe('SelectManyPrompt', () => { const selections = ['choice-A', 'choice-B', 'key-not-in-prompt-config', 'choice-C'] verifyValidationThrows( - prompt.validate.bind(prompt, selections), - InvalidChoiceException, - INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, - ['key-not-in-prompt-config'] + prompt.validateOrThrow.bind(prompt, selections), + PromptValidationException, + INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK ) }) @@ -50,16 +48,19 @@ describe('SelectManyPrompt', () => { ] verifyValidationThrows( - prompt.validate.bind(prompt, selections), - InvalidChoiceException, - INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, - selections + prompt.validateOrThrow.bind(prompt, selections), + PromptValidationException, + INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK ) }) it('should raise when no selections are provided', async () => { const selections: IChoice['key'][] = [] - verifyValidationThrows(prompt.validate.bind(prompt, selections), ValidationException, INVALID_AT_LEAST_ONE_SELECTION_REQUIRED) + verifyValidationThrows( + prompt.validateOrThrow.bind(prompt, selections), + PromptValidationException, + INVALID_AT_LEAST_ONE_SELECTION_REQUIRED + ) }) }) @@ -77,7 +78,7 @@ describe('SelectManyPrompt', () => { }) }) -const verifyValidationThrows = /**/ (invoker: Function, ErrorType: Function, msg: string, choices?: IChoice['key'][]) => { +const verifyValidationThrows = /**/ (invoker: Function, ErrorType: Function, msg: string) => { try { invoker() @@ -87,6 +88,5 @@ const verifyValidationThrows = /**/ (invoker: Function, ErrorTy } catch (e) { expect(e).toBeInstanceOf(ErrorType) expect(e.message).toEqual(msg) - expect(e.choices).toEqual(choices) } } diff --git a/src/domain/FlowRunner.ts b/src/domain/FlowRunner.ts index 8ee14fdf..9dcb0ccf 100644 --- a/src/domain/FlowRunner.ts +++ b/src/domain/FlowRunner.ts @@ -255,12 +255,7 @@ export class FlowRunner implements IFlowRunner, IFlowNavigator, IPromptBuilder { const {prompt}: IRichCursorInputRequired = this.hydrateRichCursorFrom(ctx as IContextInputRequired) as IRichCursorInputRequired - try { - prompt.validate(prompt.value) - return false - } catch (e) { - return true - } + return !prompt.isValid() } // todo: this could be findFirstExitOnActiveFlowBlockFor to an Expressions Behaviour diff --git a/src/domain/prompt/AdvancedSelectOnePrompt.ts b/src/domain/prompt/AdvancedSelectOnePrompt.ts index 58fa7462..5e05e32d 100644 --- a/src/domain/prompt/AdvancedSelectOnePrompt.ts +++ b/src/domain/prompt/AdvancedSelectOnePrompt.ts @@ -22,9 +22,15 @@ import {assertNotNull, BasePrompt, IAdvancedSelectOne, IAdvancedSelectOnePromptC export const ADVANCED_SELECT_ONE_PROMPT_KEY = 'AdvancedSelectOne' export class AdvancedSelectOnePrompt extends BasePrompt { - validate(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): boolean { + validateOrThrow(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): void { const {choiceRowFields, isResponseRequired} = this.config + assertNotNull( + selectedRow, + () => 'Value provided is null or undefined', + message => new PromptValidationException(message) + ) + assertNotNull( choiceRows, () => 'choiceRows must be non-null', @@ -47,6 +53,6 @@ export class AdvancedSelectOnePrompt extends BasePrompt> implements return this.config.value } - /** - * Set local {@link IPromptConfig.value}. This action is guarded by {@link validate}. - * - * It's important to note that {@link value} property will be set (proxied onto local {@link IPromptConfig.value}) - * regardless of any {@link PromptValidationException}s raised. */ + /** Set local {@link IPromptConfig.value} */ set value(val: T['value']) { - try { - this.validate(val) - } catch (e) { - if (!(e instanceof PromptValidationException)) { - throw e - } - } this.config.value = val } @@ -84,25 +72,29 @@ export abstract class BasePrompt> implements } async fulfill(val: T['value'] | undefined): Promise { - // allow prompt.fulfill() for continuation - if (val !== undefined) { - this.value = val - } + this.value = val + this.validateOrThrow(val) return this.runner.run() } public isValid(): boolean { - try { - return this.validate(this.config.value) - } catch (e) { - return false - } + return this.validate(this.config.value) } /** * Template method to be implemented by concrete {@link IPrompt} implementations. * @param val + * @throws PromptValidationException */ - abstract validate(val?: T['value']): boolean + abstract validateOrThrow(val?: T['value']): void + + validate(val?: T['value']): boolean { + try { + this.validateOrThrow(val) + return true + } catch (e) { + return false + } + } } diff --git a/src/domain/prompt/IPrompt.ts b/src/domain/prompt/IPrompt.ts index 45d1a10a..f79c8b44 100644 --- a/src/domain/prompt/IPrompt.ts +++ b/src/domain/prompt/IPrompt.ts @@ -34,6 +34,9 @@ export interface IPrompt { - new(config: T, interactionId: string, runner: IFlowRunner): BasePrompt + new (config: T, interactionId: string, runner: IFlowRunner): BasePrompt } diff --git a/src/domain/prompt/MessagePrompt.ts b/src/domain/prompt/MessagePrompt.ts index e9c6f30c..a98a4bb3 100644 --- a/src/domain/prompt/MessagePrompt.ts +++ b/src/domain/prompt/MessagePrompt.ts @@ -25,7 +25,7 @@ export const MESSAGE_PROMPT_KEY = 'Message' * Concrete implementation of {@link BasePrompt} to present a message to an {@link IContact}. */ export class MessagePrompt extends BasePrompt { - validate(): boolean { - return true + validateOrThrow(): void { + return } } diff --git a/src/domain/prompt/NumericPrompt.ts b/src/domain/prompt/NumericPrompt.ts index 7bc67e6f..f7d2fab5 100644 --- a/src/domain/prompt/NumericPrompt.ts +++ b/src/domain/prompt/NumericPrompt.ts @@ -26,11 +26,9 @@ export const NUMERIC_PROMPT_KEY = 'Numeric' * {@link IContact}. */ export class NumericPrompt extends BasePrompt { - static readonly promptKey = 'Numeric' - - validate(val: INumericPromptConfig['value']): boolean { + validateOrThrow(val: INumericPromptConfig['value']): void { if (Number.isNaN(val) || val == null) { - return false + throw new PromptValidationException('Value provided is null, undefined, or not a number') } const {min, max} = this.config @@ -43,6 +41,6 @@ export class NumericPrompt extends BasePrompt { throw new PromptValidationException('Value provided is greater than allowed') } - return true + return } } diff --git a/src/domain/prompt/OpenPrompt.ts b/src/domain/prompt/OpenPrompt.ts index 425f9b7c..d12a3d42 100644 --- a/src/domain/prompt/OpenPrompt.ts +++ b/src/domain/prompt/OpenPrompt.ts @@ -26,9 +26,9 @@ export const OPEN_PROMPT_KEY = 'Open' * from an {@link IContact}. */ export class OpenPrompt extends BasePrompt { - validate(val: IOpenPromptConfig['value']): boolean { + validateOrThrow(val: IOpenPromptConfig['value']): void { if (val == null) { - return false + throw new PromptValidationException('Value provided is null, undefined, or not a number') } const {maxResponseCharacters: maxLength} = this.config @@ -39,6 +39,6 @@ export class OpenPrompt extends BasePrompt { throw new PromptValidationException('Too many characters on value provided') } - return true + return } } diff --git a/src/domain/prompt/SelectManyPrompt.ts b/src/domain/prompt/SelectManyPrompt.ts index c58b0206..b68d7214 100644 --- a/src/domain/prompt/SelectManyPrompt.ts +++ b/src/domain/prompt/SelectManyPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, IChoice, InvalidChoiceException, ISelectManyPromptConfig, PromptValidationException} from '../..' +import {BasePrompt, ISelectManyPromptConfig, PromptValidationException} from '../..' import {difference, map} from 'lodash' export const INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = 'At least one selection is required, but none provided' @@ -29,15 +29,15 @@ export const SELECT_MANY_PROMPT_KEY = 'SelectMany' * least one, from an {@link IContact}. */ export class SelectManyPrompt extends BasePrompt { - validate(selections: ISelectManyPromptConfig['value']): boolean { + validateOrThrow(selections: ISelectManyPromptConfig['value']): void { if (selections == null) { - return false + throw new PromptValidationException('Value provided is null or undefined') } const {isResponseRequired, choices} = this.config if (!isResponseRequired) { - return true + return } if (choices.length !== 0 && selections.length === 0) { @@ -46,9 +46,9 @@ export class SelectManyPrompt extends BasePrompt { const invalidChoices = difference(selections, map(choices, 'key')) if (invalidChoices.length !== 0) { - throw new InvalidChoiceException(INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, invalidChoices) + throw new PromptValidationException(INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK) } - return true + return } } diff --git a/src/domain/prompt/SelectOnePrompt.ts b/src/domain/prompt/SelectOnePrompt.ts index 4247ba74..8a683496 100644 --- a/src/domain/prompt/SelectOnePrompt.ts +++ b/src/domain/prompt/SelectOnePrompt.ts @@ -26,9 +26,9 @@ export const SELECT_ONE_PROMPT_KEY = 'SelectOne' * {@link IContact}. */ export class SelectOnePrompt extends BasePrompt { - validate(choiceKey: ISelectOnePromptConfig['value']): boolean { + validateOrThrow(choiceKey: ISelectOnePromptConfig['value']): void { if (choiceKey == null) { - return false + throw new PromptValidationException('Value provided is null or undefined') } const {isResponseRequired, choices} = this.config @@ -37,6 +37,6 @@ export class SelectOnePrompt extends BasePrompt { throw new PromptValidationException('Value provided must be in list of choices') } - return true + return } } From 00abb9cb294ff07935ae7e528746bf2375826a42 Mon Sep 17 00:00:00 2001 From: Bulat Gabidullin Date: Fri, 22 Jan 2021 14:00:48 -0600 Subject: [PATCH 4/5] bugfix/VMO-2010/NumericBlockMaxCharactersValidation - Undid some of the changes: removed validateOrThrow (now there is validate() that returns void or throws, and isValid() that returns boolean), added InvalidChoiceException back (but now it extends PromptValidationException). Updated NumericPrompt validate() using lodash isFinite(). --- README.md | 4 +- src/__tests__/prompt/SelectManyPrompt.spec.ts | 30 ++++++------- .../exceptions/InvalidChoiceException.ts | 4 +- src/domain/prompt/AdvancedSelectOnePrompt.ts | 2 +- src/domain/prompt/BasePrompt.ts | 45 +++++++++++++------ src/domain/prompt/IPrompt.ts | 11 +++-- src/domain/prompt/MessagePrompt.ts | 2 +- src/domain/prompt/NumericPrompt.ts | 7 +-- src/domain/prompt/OpenPrompt.ts | 4 +- src/domain/prompt/SelectManyPrompt.ts | 6 +-- src/domain/prompt/SelectOnePrompt.ts | 2 +- 11 files changed, 68 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 15f3c3f4..b28b6762 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ const {prompt}: IRichCursorInputRequired = prompt.fulfill('Jenso Ubla')! The prompt's requirements are preconfigured in the corresponding block before the run is begun. An example of configuration that could take place are min/max constraints when requiring numeric input. -Note that at the lowest level, the `validateOrThrow(input)` method is called when attempting to set a value on the prompt instance. What this means is that we'll see `PromptValidationException` s bubbled at all levels: +Note that at the lowest level, the `validate(input)` method is called when attempting to set a value on the prompt instance. What this means is that we'll see `PromptValidationException` s bubbled at all levels: ```typescript > prompt.fulfill(200) @@ -98,7 +98,7 @@ Error: Value provided is greater than allowed ``` ```typescript -> prompt.validateOrThrow(200) +> prompt.validate(200) Error: Value provided is greater than allowed diff --git a/src/__tests__/prompt/SelectManyPrompt.spec.ts b/src/__tests__/prompt/SelectManyPrompt.spec.ts index b3f8b76b..0721e1cc 100644 --- a/src/__tests__/prompt/SelectManyPrompt.spec.ts +++ b/src/__tests__/prompt/SelectManyPrompt.spec.ts @@ -4,10 +4,11 @@ import { IContextInputRequired, INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, INVALID_AT_LEAST_ONE_SELECTION_REQUIRED, + InvalidChoiceException, IPromptConfig, ISelectManyPromptConfig, - PromptValidationException, SelectManyPrompt, + PromptValidationException, } from '../..' import {createDefaultDataset, IDataset} from '../fixtures/IDataset' @@ -33,9 +34,10 @@ describe('SelectManyPrompt', () => { const selections = ['choice-A', 'choice-B', 'key-not-in-prompt-config', 'choice-C'] verifyValidationThrows( - prompt.validateOrThrow.bind(prompt, selections), - PromptValidationException, - INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK + prompt.validate.bind(prompt, selections), + InvalidChoiceException, + INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, + ['key-not-in-prompt-config'] ) }) @@ -48,37 +50,34 @@ describe('SelectManyPrompt', () => { ] verifyValidationThrows( - prompt.validateOrThrow.bind(prompt, selections), - PromptValidationException, - INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK + prompt.validate.bind(prompt, selections), + InvalidChoiceException, + INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, + selections ) }) it('should raise when no selections are provided', async () => { const selections: IChoice['key'][] = [] - verifyValidationThrows( - prompt.validateOrThrow.bind(prompt, selections), - PromptValidationException, - INVALID_AT_LEAST_ONE_SELECTION_REQUIRED - ) + verifyValidationThrows(prompt.validate.bind(prompt, selections), PromptValidationException, INVALID_AT_LEAST_ONE_SELECTION_REQUIRED) }) }) it('should return true when all selections are valid', async () => { const selections = ['choice-A', 'choice-D'] - expect(prompt.validate(selections)).toBe(true) + expect(() => prompt.validate(selections)).not.toThrow() }) it('should raise when some selections are invalid when isRequired is false', async () => { prompt.config.isResponseRequired = false const selections = ['choice-A', 'choice-B', 'key-not-in-prompt-config', 'choice-C'] - expect(prompt.validate(selections)).toBe(true) + expect(() => prompt.validate(selections)).not.toThrow() }) }) }) -const verifyValidationThrows = /**/ (invoker: Function, ErrorType: Function, msg: string) => { +const verifyValidationThrows = /**/ (invoker: Function, ErrorType: Function, msg: string, choices?: IChoice['key'][]) => { try { invoker() @@ -88,5 +87,6 @@ const verifyValidationThrows = /**/ (invoker: Function, ErrorTy } catch (e) { expect(e).toBeInstanceOf(ErrorType) expect(e.message).toEqual(msg) + expect(e.choices).toEqual(choices) } } diff --git a/src/domain/exceptions/InvalidChoiceException.ts b/src/domain/exceptions/InvalidChoiceException.ts index 5bb07fbf..55c47211 100644 --- a/src/domain/exceptions/InvalidChoiceException.ts +++ b/src/domain/exceptions/InvalidChoiceException.ts @@ -17,10 +17,12 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ +import {PromptValidationException} from './PromptValidationException' + /** * Generic exception for selection validation; typically leveraged by {@link IPrompt} implementations. */ -export class InvalidChoiceException extends Error { +export class InvalidChoiceException extends PromptValidationException { constructor(message?: string, public choices?: ChoiceType[]) { super(message) } diff --git a/src/domain/prompt/AdvancedSelectOnePrompt.ts b/src/domain/prompt/AdvancedSelectOnePrompt.ts index 5e05e32d..a95beed5 100644 --- a/src/domain/prompt/AdvancedSelectOnePrompt.ts +++ b/src/domain/prompt/AdvancedSelectOnePrompt.ts @@ -22,7 +22,7 @@ import {assertNotNull, BasePrompt, IAdvancedSelectOne, IAdvancedSelectOnePromptC export const ADVANCED_SELECT_ONE_PROMPT_KEY = 'AdvancedSelectOne' export class AdvancedSelectOnePrompt extends BasePrompt { - validateOrThrow(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): void { + validate(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): void { const {choiceRowFields, isResponseRequired} = this.config assertNotNull( diff --git a/src/domain/prompt/BasePrompt.ts b/src/domain/prompt/BasePrompt.ts index df6784ce..6cf0aaad 100644 --- a/src/domain/prompt/BasePrompt.ts +++ b/src/domain/prompt/BasePrompt.ts @@ -25,6 +25,7 @@ import { IPrompt, IPromptConfig, IRichCursorInputRequired, + PromptValidationException, ValidationException, } from '../..' @@ -35,6 +36,8 @@ export type TGenericPrompt = IPrompt> * implementations. */ export abstract class BasePrompt> implements IPrompt { + error: PromptValidationException | null = null + constructor(public config: T, public interactionId: string, public runner: IFlowRunner) { // todo: add canPerformEarlyExit() behaviour } @@ -45,8 +48,24 @@ export abstract class BasePrompt> implements return this.config.value } - /** Set local {@link IPromptConfig.value} */ + /** + * Set local {@link IPromptConfig.value}. This action is guarded by {@link validate}. + * Any exceptions raised by {@link validate} are applied to {@link error} property. + * + * It's important to note that {@link value} property will be set (proxied onto local {@link IPromptConfig.value}) + * regardless of any {@link PromptValidationException}s raised. */ set value(val: T['value']) { + this.error = null + try { + this.validate(val) + } catch (e) { + if (!(e instanceof PromptValidationException)) { + throw e + } + + this.error = e + } + this.config.value = val } @@ -72,14 +91,21 @@ export abstract class BasePrompt> implements } async fulfill(val: T['value'] | undefined): Promise { - this.value = val - this.validateOrThrow(val) + // allow prompt.fulfill() for continuation + if (val !== undefined) { + this.value = val + } return this.runner.run() } public isValid(): boolean { - return this.validate(this.config.value) + try { + this.validate(this.config.value) + return true + } catch (e) { + return false + } } /** @@ -87,14 +113,5 @@ export abstract class BasePrompt> implements * @param val * @throws PromptValidationException */ - abstract validateOrThrow(val?: T['value']): void - - validate(val?: T['value']): boolean { - try { - this.validateOrThrow(val) - return true - } catch (e) { - return false - } - } + abstract validate(val?: T['value']): void } diff --git a/src/domain/prompt/IPrompt.ts b/src/domain/prompt/IPrompt.ts index f79c8b44..c7284754 100644 --- a/src/domain/prompt/IPrompt.ts +++ b/src/domain/prompt/IPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired} from '../..' +import {BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired, PromptValidationException} from '../..' /** * Primary interface for interacting with an {@link IContact}; typically not immplemented fully, it is recommended that @@ -30,15 +30,14 @@ export interface IPrompt diff --git a/src/domain/prompt/MessagePrompt.ts b/src/domain/prompt/MessagePrompt.ts index a98a4bb3..0495bba9 100644 --- a/src/domain/prompt/MessagePrompt.ts +++ b/src/domain/prompt/MessagePrompt.ts @@ -25,7 +25,7 @@ export const MESSAGE_PROMPT_KEY = 'Message' * Concrete implementation of {@link BasePrompt} to present a message to an {@link IContact}. */ export class MessagePrompt extends BasePrompt { - validateOrThrow(): void { + validate(): void { return } } diff --git a/src/domain/prompt/NumericPrompt.ts b/src/domain/prompt/NumericPrompt.ts index f7d2fab5..edb6d320 100644 --- a/src/domain/prompt/NumericPrompt.ts +++ b/src/domain/prompt/NumericPrompt.ts @@ -18,6 +18,7 @@ **/ import {BasePrompt, INumericPromptConfig, PromptValidationException} from '../..' +import {isFinite} from 'lodash' export const NUMERIC_PROMPT_KEY = 'Numeric' @@ -26,9 +27,9 @@ export const NUMERIC_PROMPT_KEY = 'Numeric' * {@link IContact}. */ export class NumericPrompt extends BasePrompt { - validateOrThrow(val: INumericPromptConfig['value']): void { - if (Number.isNaN(val) || val == null) { - throw new PromptValidationException('Value provided is null, undefined, or not a number') + validate(val: INumericPromptConfig['value']): void { + if (val == null || !isFinite(val)) { + throw new PromptValidationException('Value provided is not a number') } const {min, max} = this.config diff --git a/src/domain/prompt/OpenPrompt.ts b/src/domain/prompt/OpenPrompt.ts index d12a3d42..b60e2b66 100644 --- a/src/domain/prompt/OpenPrompt.ts +++ b/src/domain/prompt/OpenPrompt.ts @@ -26,9 +26,9 @@ export const OPEN_PROMPT_KEY = 'Open' * from an {@link IContact}. */ export class OpenPrompt extends BasePrompt { - validateOrThrow(val: IOpenPromptConfig['value']): void { + validate(val: IOpenPromptConfig['value']): void { if (val == null) { - throw new PromptValidationException('Value provided is null, undefined, or not a number') + throw new PromptValidationException('Value provided is null or undefined') } const {maxResponseCharacters: maxLength} = this.config diff --git a/src/domain/prompt/SelectManyPrompt.ts b/src/domain/prompt/SelectManyPrompt.ts index b68d7214..1edeafa2 100644 --- a/src/domain/prompt/SelectManyPrompt.ts +++ b/src/domain/prompt/SelectManyPrompt.ts @@ -17,7 +17,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ -import {BasePrompt, ISelectManyPromptConfig, PromptValidationException} from '../..' +import {BasePrompt, IChoice, InvalidChoiceException, ISelectManyPromptConfig, PromptValidationException} from '../..' import {difference, map} from 'lodash' export const INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = 'At least one selection is required, but none provided' @@ -29,7 +29,7 @@ export const SELECT_MANY_PROMPT_KEY = 'SelectMany' * least one, from an {@link IContact}. */ export class SelectManyPrompt extends BasePrompt { - validateOrThrow(selections: ISelectManyPromptConfig['value']): void { + validate(selections: ISelectManyPromptConfig['value']): void { if (selections == null) { throw new PromptValidationException('Value provided is null or undefined') } @@ -46,7 +46,7 @@ export class SelectManyPrompt extends BasePrompt { const invalidChoices = difference(selections, map(choices, 'key')) if (invalidChoices.length !== 0) { - throw new PromptValidationException(INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK) + throw new InvalidChoiceException(INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, invalidChoices) } return diff --git a/src/domain/prompt/SelectOnePrompt.ts b/src/domain/prompt/SelectOnePrompt.ts index 8a683496..9b27c78d 100644 --- a/src/domain/prompt/SelectOnePrompt.ts +++ b/src/domain/prompt/SelectOnePrompt.ts @@ -26,7 +26,7 @@ export const SELECT_ONE_PROMPT_KEY = 'SelectOne' * {@link IContact}. */ export class SelectOnePrompt extends BasePrompt { - validateOrThrow(choiceKey: ISelectOnePromptConfig['value']): void { + validate(choiceKey: ISelectOnePromptConfig['value']): void { if (choiceKey == null) { throw new PromptValidationException('Value provided is null or undefined') } From bdf21c6ee0f923269c8ca4a922a15d8f947da650 Mon Sep 17 00:00:00 2001 From: Bulat Gabidullin Date: Mon, 25 Jan 2021 08:12:34 -0600 Subject: [PATCH 5/5] bugfix/VMO-2010/NumericBlockMaxCharactersValidation - Forgot to build the project, built now. Plus a minor change in BasePrompt.spec.ts (refactored the test back to the original form) and BasePrompt.ts (elaborated the code comment using Brett's suggestion in PR's conversation). --- dist/__tests__/prompt/BasePrompt.spec.js | 2 +- dist/__tests__/prompt/BasePrompt.spec.js.map | 2 +- .../__tests__/prompt/SelectManyPrompt.spec.js | 13 ++++++------ .../prompt/SelectManyPrompt.spec.js.map | 2 +- .../exceptions/InvalidChoiceException.d.ts | 3 ++- .../InvalidChoiceException.d.ts.map | 2 +- .../exceptions/InvalidChoiceException.js | 3 ++- .../exceptions/InvalidChoiceException.js.map | 2 +- .../prompt/AdvancedSelectOnePrompt.d.ts | 2 +- .../prompt/AdvancedSelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/AdvancedSelectOnePrompt.js | 2 +- .../prompt/AdvancedSelectOnePrompt.js.map | 2 +- dist/domain/prompt/BasePrompt.d.ts | 6 +++--- dist/domain/prompt/BasePrompt.d.ts.map | 2 +- dist/domain/prompt/BasePrompt.js | 21 +++++++++++++------ dist/domain/prompt/BasePrompt.js.map | 2 +- dist/domain/prompt/IPrompt.d.ts | 6 +++--- dist/domain/prompt/IPrompt.d.ts.map | 2 +- dist/domain/prompt/MessagePrompt.d.ts | 2 +- dist/domain/prompt/MessagePrompt.d.ts.map | 2 +- dist/domain/prompt/MessagePrompt.js | 2 +- dist/domain/prompt/MessagePrompt.js.map | 2 +- dist/domain/prompt/NumericPrompt.d.ts | 2 +- dist/domain/prompt/NumericPrompt.d.ts.map | 2 +- dist/domain/prompt/NumericPrompt.js | 7 ++++--- dist/domain/prompt/NumericPrompt.js.map | 2 +- dist/domain/prompt/OpenPrompt.d.ts | 2 +- dist/domain/prompt/OpenPrompt.d.ts.map | 2 +- dist/domain/prompt/OpenPrompt.js | 4 ++-- dist/domain/prompt/OpenPrompt.js.map | 2 +- dist/domain/prompt/SelectManyPrompt.d.ts | 2 +- dist/domain/prompt/SelectManyPrompt.d.ts.map | 2 +- dist/domain/prompt/SelectManyPrompt.js | 4 ++-- dist/domain/prompt/SelectManyPrompt.js.map | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts | 2 +- dist/domain/prompt/SelectOnePrompt.d.ts.map | 2 +- dist/domain/prompt/SelectOnePrompt.js | 2 +- dist/domain/prompt/SelectOnePrompt.js.map | 2 +- src/__tests__/prompt/BasePrompt.spec.ts | 2 +- src/domain/prompt/BasePrompt.ts | 3 ++- src/domain/prompt/IPrompt.ts | 2 +- 41 files changed, 73 insertions(+), 59 deletions(-) diff --git a/dist/__tests__/prompt/BasePrompt.spec.js b/dist/__tests__/prompt/BasePrompt.spec.js index c39721f6..956675e7 100644 --- a/dist/__tests__/prompt/BasePrompt.spec.js +++ b/dist/__tests__/prompt/BasePrompt.spec.js @@ -18,7 +18,7 @@ describe('BasePrompt', () => { const ctx = dataset.contexts[1]; const runner = new __1.FlowRunner(ctx); const prompt = new __1.MessagePrompt(config, 'abc-123', runner); - expect(prompt.isValid()).toBe(true); + expect(prompt.error).toBeNull(); })); }); }); diff --git a/dist/__tests__/prompt/BasePrompt.spec.js.map b/dist/__tests__/prompt/BasePrompt.spec.js.map index a94c994f..7c2e8694 100644 --- a/dist/__tests__/prompt/BasePrompt.spec.js.map +++ b/dist/__tests__/prompt/BasePrompt.spec.js.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.spec.js","sourceRoot":"","sources":["../../../src/__tests__/prompt/BasePrompt.spec.ts"],"names":[],"mappings":";;;AAAA,6BAQc;AACd,mDAAmE;AAEnE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAI,OAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,+BAAoB,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,EAAE,CAAA;IACxB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;YACrB,EAAE,CAAC,gEAAgE,EAAE,GAAS,EAAE;gBAC9E,MAAM,MAAM,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CA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,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YACtD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAA0B,CAAA;YACxD,MAAM,MAAM,GAAG,IAAI,cAAU,CAAC,GAAG,CAAC,CAAA;YAClC,MAAM,kBAAkB,GAAG,sCAAsC,CAAA;YACjE,MAAM,MAAM,GAAG,IAAI,iBAAa,CAAC,MAA8B,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAA;YAE5F,uBAAmB,CAAC,kBAAkB,EAAE,GAAG,CAAE,CAAC,OAAO,GAAG,mBAAmB,CAAA;YAC3E,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAA;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/__tests__/prompt/SelectManyPrompt.spec.js b/dist/__tests__/prompt/SelectManyPrompt.spec.js index 172bbef3..9b1634c3 100644 --- a/dist/__tests__/prompt/SelectManyPrompt.spec.js +++ b/dist/__tests__/prompt/SelectManyPrompt.spec.js @@ -19,7 +19,7 @@ describe('SelectManyPrompt', () => { describe('when a response isRequired', () => { it('should raise when some selections are invalid', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = ['choice-A', 'choice-B', 'key-not-in-prompt-config', 'choice-C']; - verifyValidationThrows(prompt.validateOrThrow.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK); + verifyValidationThrows(prompt.validate.bind(prompt, selections), __1.InvalidChoiceException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, ['key-not-in-prompt-config']); })); it('should raise when all selections are invalid', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = [ @@ -28,25 +28,25 @@ describe('SelectManyPrompt', () => { 'key-not-in-prompt-config-C', 'key-not-in-prompt-config-D', ]; - verifyValidationThrows(prompt.validateOrThrow.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK); + verifyValidationThrows(prompt.validate.bind(prompt, selections), __1.InvalidChoiceException, __1.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, selections); })); it('should raise when no selections are provided', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = []; - verifyValidationThrows(prompt.validateOrThrow.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); + verifyValidationThrows(prompt.validate.bind(prompt, selections), __1.PromptValidationException, __1.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED); })); }); it('should return true when all selections are valid', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const selections = ['choice-A', 'choice-D']; - expect(prompt.validate(selections)).toBe(true); + expect(() => prompt.validate(selections)).not.toThrow(); })); it('should raise when some selections are invalid when isRequired is false', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { prompt.config.isResponseRequired = false; const selections = ['choice-A', 'choice-B', 'key-not-in-prompt-config', 'choice-C']; - expect(prompt.validate(selections)).toBe(true); + expect(() => prompt.validate(selections)).not.toThrow(); })); }); }); -const verifyValidationThrows = (invoker, ErrorType, msg) => { +const verifyValidationThrows = (invoker, ErrorType, msg, choices) => { try { invoker(); expect(true).toBeFalsy(); @@ -54,6 +54,7 @@ const verifyValidationThrows = (invoker, ErrorType, msg) => { catch (e) { expect(e).toBeInstanceOf(ErrorType); expect(e.message).toEqual(msg); + expect(e.choices).toEqual(choices); } }; //# sourceMappingURL=SelectManyPrompt.spec.js.map \ No newline at end of file diff --git a/dist/__tests__/prompt/SelectManyPrompt.spec.js.map b/dist/__tests__/prompt/SelectManyPrompt.spec.js.map index a44210e3..f6617fab 100644 --- a/dist/__tests__/prompt/SelectManyPrompt.spec.js.map +++ b/dist/__tests__/prompt/SelectManyPrompt.spec.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.spec.js","source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C,OAAO,CAAC,GAAG,CAAC,CAAA;KAC/B;AACH,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.spec.js","sourceRoot":"","sources":["../../../src/__tests__/prompt/SelectManyPrompt.spec.ts"],"names":[],"mappings":";;;AAAA,6BAWc;AACd,mDAAmE;AAEnE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,OAAiB,CAAA;IAErB,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,+BAAoB,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,IAAI,MAAwB,CAAA;QAC5B,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,MAAM,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YACtD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAA0B,CAAA;YACxD,MAAM,MAAM,GAAG,IAAI,cAAU,CAAC,GAAG,CAAC,CAAA;YAElC,MAAM,GAAG,IAAI,oBAAgB,CAAC,MAAiC,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;QACtF,CAAC,CAAC,CAAA;QAEF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;YAC1C,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;gBAC7D,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,0BAA0B,EAAE,UAAU,CAAC,CAAA;gBAEnF,sBAAsB,CACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EACxC,0BAAsB,EACtB,8CAA0C,EAC1C,CAAC,0BAA0B,CAAC,CAC7B,CAAA;YACH,CAAC,CAAA,CAAC,CAAA;YAEF,EAAE,CAAC,8CAA8C,EAAE,GAAS,EAAE;gBAC5D,MAAM,UAAU,GAAG;oBACjB,4BAA4B;oBAC5B,4BAA4B;oBAC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T,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAA;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;QACnC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC9B,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;KACnC;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/domain/exceptions/InvalidChoiceException.d.ts b/dist/domain/exceptions/InvalidChoiceException.d.ts index 838b3b80..deb19396 100644 --- a/dist/domain/exceptions/InvalidChoiceException.d.ts +++ b/dist/domain/exceptions/InvalidChoiceException.d.ts @@ -1,4 +1,5 @@ -export declare class InvalidChoiceException extends Error { +import { PromptValidationException } from './PromptValidationException'; +export declare class InvalidChoiceException extends PromptValidationException { choices?: ChoiceType[] | undefined; constructor(message?: string, choices?: ChoiceType[] | undefined); } diff --git a/dist/domain/exceptions/InvalidChoiceException.d.ts.map b/dist/domain/exceptions/InvalidChoiceException.d.ts.map index b1aca5c9..a55fdb9b 100644 --- a/dist/domain/exceptions/InvalidChoiceException.d.ts.map +++ b/dist/domain/exceptions/InvalidChoiceException.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"InvalidChoiceException.d.ts","sourceRoot":"","sources":["../../../src/domain/exceptions/InvalidChoiceException.ts"],"names":[],"mappings":"AAsBA,qBAAa,sBAAsB,CAAC,UAAU,CAAE,SAAQ,KAAK;IACtB,OAAO,CAAC;gBAAjC,OAAO,CAAC,EAAE,MAAM,EAAS,OAAO,CAAC,0BAAc;CAG5D"} \ No newline at end of file +{"version":3,"file":"InvalidChoiceException.d.ts","sourceRoot":"","sources":["../../../src/domain/exceptions/InvalidChoiceException.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AAKrE,qBAAa,sBAAsB,CAAC,UAAU,CAAE,SAAQ,yBAAyB;IAC1C,OAAO,CAAC;gBAAjC,OAAO,CAAC,EAAE,MAAM,EAAS,OAAO,CAAC,0BAAc;CAG5D"} \ No newline at end of file diff --git a/dist/domain/exceptions/InvalidChoiceException.js b/dist/domain/exceptions/InvalidChoiceException.js index 53c510ca..8571b308 100644 --- a/dist/domain/exceptions/InvalidChoiceException.js +++ b/dist/domain/exceptions/InvalidChoiceException.js @@ -1,7 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InvalidChoiceException = void 0; -class InvalidChoiceException extends Error { +const PromptValidationException_1 = require("./PromptValidationException"); +class InvalidChoiceException extends PromptValidationException_1.PromptValidationException { constructor(message, choices) { super(message); this.choices = choices; diff --git a/dist/domain/exceptions/InvalidChoiceException.js.map b/dist/domain/exceptions/InvalidChoiceException.js.map index d13ed114..d58992b7 100644 --- a/dist/domain/exceptions/InvalidChoiceException.js.map +++ b/dist/domain/exceptions/InvalidChoiceException.js.map @@ -1 +1 @@ -{"version":3,"file":"InvalidChoiceException.js","sourceRoot":"","sources":["../../../src/domain/exceptions/InvalidChoiceException.ts"],"names":[],"mappings":";;;AAsBA,MAAa,sBAAmC,SAAQ,KAAK;IAC3D,YAAY,OAAgB,EAAS,OAAsB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QADqB,YAAO,GAAP,OAAO,CAAe;IAE3D,CAAC;CACF;AAJD,wDAIC"} \ No newline at end of file +{"version":3,"file":"InvalidChoiceException.js","sourceRoot":"","sources":["../../../src/domain/exceptions/InvalidChoiceException.ts"],"names":[],"mappings":";;;AAmBA,2EAAqE;AAKrE,MAAa,sBAAmC,SAAQ,qDAAyB;IAC/E,YAAY,OAAgB,EAAS,OAAsB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QADqB,YAAO,GAAP,OAAO,CAAe;IAE3D,CAAC;CACF;AAJD,wDAIC"} \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts index c7d2ba82..eaebe23e 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IAdvancedSelectOne, IAdvancedSelectOnePromptConfig } from '../..'; export declare const ADVANCED_SELECT_ONE_PROMPT_KEY = "AdvancedSelectOne"; export declare class AdvancedSelectOnePrompt extends BasePrompt { - validateOrThrow(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): void; + validate(selectedRow?: IAdvancedSelectOne[], choiceRows?: string[][]): void; } //# sourceMappingURL=AdvancedSelectOnePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map index 115e53b1..53590247 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"AdvancedSelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAA4B,MAAM,OAAO,CAAA;AAE9H,eAAO,MAAM,8BAA8B,sBAAsB,CAAA;AAEjE,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACrF,eAAe,CAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI;CAiCnF"} \ No newline at end of file +{"version":3,"file":"AdvancedSelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAA4B,MAAM,OAAO,CAAA;AAE9H,eAAO,MAAM,8BAA8B,sBAAsB,CAAA;AAEjE,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACrF,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI;CAiC5E"} \ No newline at end of file diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.js b/dist/domain/prompt/AdvancedSelectOnePrompt.js index 70a6b286..58544e16 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.js +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.js @@ -4,7 +4,7 @@ exports.AdvancedSelectOnePrompt = exports.ADVANCED_SELECT_ONE_PROMPT_KEY = void const __1 = require("../.."); exports.ADVANCED_SELECT_ONE_PROMPT_KEY = 'AdvancedSelectOne'; class AdvancedSelectOnePrompt extends __1.BasePrompt { - validateOrThrow(selectedRow, choiceRows) { + validate(selectedRow, choiceRows) { const { choiceRowFields, isResponseRequired } = this.config; __1.assertNotNull(selectedRow, () => 'Value provided is null or undefined', message => new __1.PromptValidationException(message)); __1.assertNotNull(choiceRows, () => 'choiceRows must be non-null', message => new __1.PromptValidationException(message)); diff --git a/dist/domain/prompt/AdvancedSelectOnePrompt.js.map b/dist/domain/prompt/AdvancedSelectOnePrompt.js.map index 47dbaebf..56064daf 100644 --- a/dist/domain/prompt/AdvancedSelectOnePrompt.js.map +++ b/dist/domain/prompt/AdvancedSelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"AdvancedSelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8H;AAEjH,QAAA,8BAA8B,GAAG,mBAAmB,CAAA;AAEjE,MAAa,uBAAwB,SAAQ,cAA0C;IACrF,eAAe,CAAC,WAAkC,EAAE,UAAuB;QACzE,MAAM,EAAC,eAAe,EAAE,kBAAkB,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzD,iBAAa,CACX,WAAW,EACX,GAAG,EAAE,CAAC,qCAAqC,EAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,iBAAa,CACX,UAAU,EACV,GAAG,EAAE,CAAC,6BAA6B,EACnC,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC3D,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,6BAAyB,CAAC,mCAAmC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;iBACzF;qBAAM;oBACL,OAAO,SAAS,CAAC,KAAK,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;iBAC5C;YACH,CAAC,CAAC,CACH,CAAA;YACD,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,6BAAyB,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAA;aACpF;SACF;QAED,OAAM;IACR,CAAC;CACF;AAlCD,0DAkCC"} \ No newline at end of file +{"version":3,"file":"AdvancedSelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/AdvancedSelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8H;AAEjH,QAAA,8BAA8B,GAAG,mBAAmB,CAAA;AAEjE,MAAa,uBAAwB,SAAQ,cAA0C;IACrF,QAAQ,CAAC,WAAkC,EAAE,UAAuB;QAClE,MAAM,EAAC,eAAe,EAAE,kBAAkB,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzD,iBAAa,CACX,WAAW,EACX,GAAG,EAAE,CAAC,qCAAqC,EAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,iBAAa,CACX,UAAU,EACV,GAAG,EAAE,CAAC,6BAA6B,EACnC,OAAO,CAAC,EAAE,CAAC,IAAI,6BAAyB,CAAC,OAAO,CAAC,CAClD,CAAA;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAC3D,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,6BAAyB,CAAC,mCAAmC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;iBACzF;qBAAM;oBACL,OAAO,SAAS,CAAC,KAAK,KAAK,GAAG,CAAC,WAAW,CAAC,CAAA;iBAC5C;YACH,CAAC,CAAC,CACH,CAAA;YACD,IAAI,CAAC,cAAc,EAAE;gBACnB,MAAM,IAAI,6BAAyB,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAA;aACpF;SACF;QAED,OAAM;IACR,CAAC;CACF;AAlCD,0DAkCC"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.d.ts b/dist/domain/prompt/BasePrompt.d.ts index 49fa2848..e55deaca 100644 --- a/dist/domain/prompt/BasePrompt.d.ts +++ b/dist/domain/prompt/BasePrompt.d.ts @@ -1,9 +1,10 @@ -import { IBlock, IFlowRunner, IPrompt, IPromptConfig, IRichCursorInputRequired } from '../..'; +import { IBlock, IFlowRunner, IPrompt, IPromptConfig, IRichCursorInputRequired, PromptValidationException } from '../..'; export declare type TGenericPrompt = IPrompt>; export declare abstract class BasePrompt> implements IPrompt { config: T; interactionId: string; runner: IFlowRunner; + error: PromptValidationException | null; constructor(config: T, interactionId: string, runner: IFlowRunner); get value(): T['value']; set value(val: T['value']); @@ -11,7 +12,6 @@ export declare abstract class BasePrompt> im get block(): IBlock | undefined; fulfill(val: T['value'] | undefined): Promise; isValid(): boolean; - abstract validateOrThrow(val?: T['value']): void; - validate(val?: T['value']): boolean; + abstract validate(val?: T['value']): void; } //# sourceMappingURL=BasePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.d.ts.map b/dist/domain/prompt/BasePrompt.d.ts.map index 3820fc94..d297bdad 100644 --- a/dist/domain/prompt/BasePrompt.d.ts.map +++ b/dist/domain/prompt/BasePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":"AAkBA,OAAO,EAIL,MAAM,EACN,WAAW,EACX,OAAO,EACP,aAAa,EACb,wBAAwB,EAEzB,MAAM,OAAO,CAAA;AAEd,oBAAY,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AAMxD,8BAAsB,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM,EAAE,CAAC;IAAS,aAAa,EAAE,MAAM;IAAS,MAAM,EAAE,WAAW;gBAAnE,MAAM,EAAE,CAAC,EAAS,aAAa,EAAE,MAAM,EAAS,MAAM,EAAE,WAAW;IAKtF,IAAI,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,CAGtB;IAGD,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,EAExB;IAGD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAc9B;IAEK,OAAO,CA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AAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI;CAC1C"} \ No newline at end of file diff --git a/dist/domain/prompt/BasePrompt.js b/dist/domain/prompt/BasePrompt.js index 6214031d..b4abec05 100644 --- a/dist/domain/prompt/BasePrompt.js +++ b/dist/domain/prompt/BasePrompt.js @@ -8,11 +8,22 @@ class BasePrompt { this.config = config; this.interactionId = interactionId; this.runner = runner; + this.error = null; } get value() { return this.config.value; } set value(val) { + this.error = null; + try { + this.validate(val); + } + catch (e) { + if (!(e instanceof __1.PromptValidationException)) { + throw e; + } + this.error = e; + } this.config.value = val; } get isEmpty() { @@ -34,17 +45,15 @@ class BasePrompt { } fulfill(val) { return tslib_1.__awaiter(this, void 0, void 0, function* () { - this.value = val; - this.validateOrThrow(val); + if (val !== undefined) { + this.value = val; + } return this.runner.run(); }); } isValid() { - return this.validate(this.config.value); - } - validate(val) { try { - this.validateOrThrow(val); + this.validate(this.config.value); return true; } catch (e) { diff --git a/dist/domain/prompt/BasePrompt.js.map b/dist/domain/prompt/BasePrompt.js.map index 65e2b5e3..a809758f 100644 --- a/dist/domain/prompt/BasePrompt.js.map +++ b/dist/domain/prompt/BasePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAUc;AAQd,MAAsB,UAAU;IAC9B,YAAmB,MAAS,EAAS,aAAqB,EAAS,MAAmB;QAAnE,WAAM,GAAN,MAAM,CAAG;QAAS,kBAAa,GAAb,aAAa,CAAQ;QAAS,WAAM,GAAN,MAAM,CAAa;IAEtF,CAAC;IAGD,IAAI,KAAK;QAEP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;IAC1B,CAAC;IAGD,IAAI,KAAK,CAAC,GAAe;QACvB,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAA;IACzB,CAAC;IAGD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAA;IACjC,CAAC;IAED,IAAI,KAAK;QACP,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA;QAC/B,MAAM,IAAI,GAAG,uBAAmB,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QACzD,MAAM,IAAI,GAAG,gBAAY,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAE3C,IAAI;YACF,OAAO,iBAAa,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,YAAY,uBAAmB,CAAC,EAAE;gBACvC,MAAM,CAAC,CAAA;aACR;YAED,OAAM;SACP;IACH,CAAC;IAEK,OAAO,CAAC,GAA2B;;YACvC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;YAChB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;YAEzB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;QAC1B,CAAC;KAAA;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC;IASD,QAAQ,CAAC,GAAgB;QACvB,IAAI;YACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CACF;AA/DD,gCA+DC"} \ No newline at end of file +{"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/BasePrompt.ts"],"names":[],"mappings":";;;;AAkBA,6BAWc;AAQd,MAAsB,UAAU;IAG9B,YAAmB,MAAS,EAAS,aAAqB,EAAS,MAAmB;QAAnE,WAAM,GAAN,MAAM,CAAG;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AAG,EAAE,CAAA;QAC1B,CAAC;KAAA;IAEM,OAAO;QACZ,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAChC,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAQF;AAhFD,gCAgFC"} \ No newline at end of file diff --git a/dist/domain/prompt/IPrompt.d.ts b/dist/domain/prompt/IPrompt.d.ts index 170dbfaf..332d6347 100644 --- a/dist/domain/prompt/IPrompt.d.ts +++ b/dist/domain/prompt/IPrompt.d.ts @@ -1,13 +1,13 @@ -import { BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired } from '../..'; +import { BasePrompt, IBlock, IFlowRunner, IRichCursorInputRequired, PromptValidationException } from '../..'; export interface IPrompt> { interactionId: string; config: PromptConfigType; runner: IFlowRunner; block?: IBlock; value: PromptConfigType['value']; + error: PromptValidationException | null; isValid(): boolean; - validateOrThrow(val: PromptConfigType['value']): void; - validate(val: PromptConfigType['value']): boolean; + validate(val: PromptConfigType['value']): void; fulfill(val: PromptConfigType['value']): Promise; } export interface IPromptConfig extends IBasePromptConfig { diff --git a/dist/domain/prompt/IPrompt.d.ts.map b/dist/domain/prompt/IPrompt.d.ts.map index e199621d..64784780 100644 --- a/dist/domain/prompt/IPrompt.d.ts.map +++ b/dist/domain/prompt/IPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"IPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/IPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,wBAAwB,EAAC,MAAM,OAAO,CAAA;AAM/E,MAAM,WAAW,OAAO,CAAC,gBAAgB,SAAS,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxF,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,gBAAgB,CAAA;I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AAE,MAAM,CAAA;IACd,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAEhC,KAAK,EAAE,yBAAyB,GAAG,IAAI,CAAA;IAGvC,OAAO,IAAI,OAAO,CAAA;IAGlB,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAG9C,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;CACvF;AAMD,MAAM,WAAW,aAAa,CAAC,CAAC,CAAE,SAAQ,iBAAiB;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,kBAAkB,EAAE,OAAO,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,CAAC,CAAA;CACV;AAGD,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;CAC7E"} \ No newline at end of file diff --git a/dist/domain/prompt/MessagePrompt.d.ts b/dist/domain/prompt/MessagePrompt.d.ts index 11378fb8..072b7b72 100644 --- a/dist/domain/prompt/MessagePrompt.d.ts +++ b/dist/domain/prompt/MessagePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IMessagePromptConfig } from '../..'; export declare const MESSAGE_PROMPT_KEY = "Message"; export declare class MessagePrompt extends BasePrompt { - validateOrThrow(): void; + validate(): void; } //# sourceMappingURL=MessagePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/MessagePrompt.d.ts.map b/dist/domain/prompt/MessagePrompt.d.ts.map index cbc0ae89..bffa3f7c 100644 --- a/dist/domain/prompt/MessagePrompt.d.ts.map +++ b/dist/domain/prompt/MessagePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"MessagePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,OAAO,CAAA;AAEtD,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAK3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,eAAe,IAAI,IAAI;CAGxB"} \ No newline at end of file +{"version":3,"file":"MessagePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,OAAO,CAAA;AAEtD,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAK3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,QAAQ,IAAI,IAAI;CAGjB"} \ No newline at end of file diff --git a/dist/domain/prompt/MessagePrompt.js b/dist/domain/prompt/MessagePrompt.js index c6a18425..771012f4 100644 --- a/dist/domain/prompt/MessagePrompt.js +++ b/dist/domain/prompt/MessagePrompt.js @@ -4,7 +4,7 @@ exports.MessagePrompt = exports.MESSAGE_PROMPT_KEY = void 0; const __1 = require("../.."); exports.MESSAGE_PROMPT_KEY = 'Message'; class MessagePrompt extends __1.BasePrompt { - validateOrThrow() { + validate() { return; } } diff --git a/dist/domain/prompt/MessagePrompt.js.map b/dist/domain/prompt/MessagePrompt.js.map index b7399149..664781be 100644 --- a/dist/domain/prompt/MessagePrompt.js.map +++ b/dist/domain/prompt/MessagePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"MessagePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAsD;AAEzC,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAK3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,eAAe;QACb,OAAM;IACR,CAAC;CACF;AAJD,sCAIC"} \ No newline at end of file +{"version":3,"file":"MessagePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/MessagePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAsD;AAEzC,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAK3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,QAAQ;QACN,OAAM;IACR,CAAC;CACF;AAJD,sCAIC"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts b/dist/domain/prompt/NumericPrompt.d.ts index 4c6c5c02..f725ec90 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts +++ b/dist/domain/prompt/NumericPrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, INumericPromptConfig } from '../..'; export declare const NUMERIC_PROMPT_KEY = "Numeric"; export declare class NumericPrompt extends BasePrompt { - validateOrThrow(val: INumericPromptConfig['value']): void; + validate(val: INumericPromptConfig['value']): void; } //# sourceMappingURL=NumericPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.d.ts.map b/dist/domain/prompt/NumericPrompt.d.ts.map index e103e203..de623488 100644 --- a/dist/domain/prompt/NumericPrompt.d.ts.map +++ b/dist/domain/prompt/NumericPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAEjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,eAAe,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,IAAI;CAiB1D"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAGjF,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAM3C,qBAAa,aAAc,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACjE,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,IAAI;CAiBnD"} \ No newline at end of file diff --git a/dist/domain/prompt/NumericPrompt.js b/dist/domain/prompt/NumericPrompt.js index 14d48d12..42861f42 100644 --- a/dist/domain/prompt/NumericPrompt.js +++ b/dist/domain/prompt/NumericPrompt.js @@ -2,11 +2,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.NumericPrompt = exports.NUMERIC_PROMPT_KEY = void 0; const __1 = require("../.."); +const lodash_1 = require("lodash"); exports.NUMERIC_PROMPT_KEY = 'Numeric'; class NumericPrompt extends __1.BasePrompt { - validateOrThrow(val) { - if (Number.isNaN(val) || val == null) { - throw new __1.PromptValidationException('Value provided is null, undefined, or not a number'); + validate(val) { + if (val == null || !lodash_1.isFinite(val)) { + throw new __1.PromptValidationException('Value provided is not a number'); } const { min, max } = this.config; if (min != null && val < min) { diff --git a/dist/domain/prompt/NumericPrompt.js.map b/dist/domain/prompt/NumericPrompt.js.map index 90a651ee..082c3867 100644 --- a/dist/domain/prompt/NumericPrompt.js.map +++ b/dist/domain/prompt/NumericPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AAEpE,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,eAAe,CAAC,GAAkC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;YACpC,MAAM,IAAI,6BAAyB,CAAC,oDAAoD,CAAC,CAAA;SAC1F;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAM;IACR,CAAC;CACF;AAlBD,sCAkBC"} \ No newline at end of file +{"version":3,"file":"NumericPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/NumericPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAiF;AACjF,mCAA+B;AAElB,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAM3C,MAAa,aAAc,SAAQ,cAAgC;IACjE,QAAQ,CAAC,GAAkC;QACzC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,iBAAQ,CAAC,GAAG,CAAC,EAAE;YACjC,MAAM,IAAI,6BAAyB,CAAC,gCAAgC,CAAC,CAAA;SACtE;QAED,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;YAC5B,MAAM,IAAI,6BAAyB,CAAC,wCAAwC,CAAC,CAAA;SAC9E;QAED,OAAM;IACR,CAAC;CACF;AAlBD,sCAkBC"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts b/dist/domain/prompt/OpenPrompt.d.ts index 9697a3f6..063eba04 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts +++ b/dist/domain/prompt/OpenPrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, IOpenPromptConfig } from '../..'; export declare const OPEN_PROMPT_KEY = "Open"; export declare class OpenPrompt extends BasePrompt { - validateOrThrow(val: IOpenPromptConfig['value']): void; + validate(val: IOpenPromptConfig['value']): void; } //# sourceMappingURL=OpenPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.d.ts.map b/dist/domain/prompt/OpenPrompt.d.ts.map index e551a7d4..d97b8ac2 100644 --- a/dist/domain/prompt/OpenPrompt.d.ts.map +++ b/dist/domain/prompt/OpenPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,IAAI;CAevD"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAA;AAE9E,eAAO,MAAM,eAAe,SAAS,CAAA;AAMrC,qBAAa,UAAW,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,IAAI;CAehD"} \ No newline at end of file diff --git a/dist/domain/prompt/OpenPrompt.js b/dist/domain/prompt/OpenPrompt.js index a7c3f27c..d52c70cc 100644 --- a/dist/domain/prompt/OpenPrompt.js +++ b/dist/domain/prompt/OpenPrompt.js @@ -4,9 +4,9 @@ exports.OpenPrompt = exports.OPEN_PROMPT_KEY = void 0; const __1 = require("../.."); exports.OPEN_PROMPT_KEY = 'Open'; class OpenPrompt extends __1.BasePrompt { - validateOrThrow(val) { + validate(val) { if (val == null) { - throw new __1.PromptValidationException('Value provided is null, undefined, or not a number'); + throw new __1.PromptValidationException('Value provided is null or undefined'); } const { maxResponseCharacters: maxLength } = this.config; if (maxLength != null && val.length > maxLength) { diff --git a/dist/domain/prompt/OpenPrompt.js.map b/dist/domain/prompt/OpenPrompt.js.map index 833ae2fb..eb859343 100644 --- a/dist/domain/prompt/OpenPrompt.js.map +++ b/dist/domain/prompt/OpenPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,eAAe,CAAC,GAA+B;QAC7C,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,IAAI,6BAAyB,CAAC,oDAAoD,CAAC,CAAA;SAC1F;QAED,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAM;IACR,CAAC;CACF;AAhBD,gCAgBC"} \ No newline at end of file +{"version":3,"file":"OpenPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/OpenPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAA8E;AAEjE,QAAA,eAAe,GAAG,MAAM,CAAA;AAMrC,MAAa,UAAW,SAAQ,cAA6B;IAC3D,QAAQ,CAAC,GAA+B;QACtC,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,qBAAqB,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEtD,IAAI,SAAS,IAAI,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;YAG/C,MAAM,IAAI,6BAAyB,CAAC,uCAAuC,CAAC,CAAA;SAC7E;QAED,OAAM;IACR,CAAC;CACF;AAhBD,gCAgBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts b/dist/domain/prompt/SelectManyPrompt.d.ts index 42d0d44d..bfad1a7e 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts +++ b/dist/domain/prompt/SelectManyPrompt.d.ts @@ -3,6 +3,6 @@ export declare const INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = "At least one sel export declare const INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK = "All selections must be valid choices on block"; export declare const SELECT_MANY_PROMPT_KEY = "SelectMany"; export declare class SelectManyPrompt extends BasePrompt { - validateOrThrow(selections: ISelectManyPromptConfig['value']): void; + validate(selections: ISelectManyPromptConfig['value']): void; } //# sourceMappingURL=SelectManyPrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.d.ts.map b/dist/domain/prompt/SelectManyPrompt.d.ts.map index b0675d0b..5a42e9ca 100644 --- a/dist/domain/prompt/SelectManyPrompt.d.ts.map +++ b/dist/domain/prompt/SelectManyPrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGpF,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,eAAe,CAAC,UAAU,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI;CAsBpE"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAmC,uBAAuB,EAA4B,MAAM,OAAO,CAAA;AAGrH,eAAO,MAAM,uCAAuC,0DAA0D,CAAA;AAC9G,eAAO,MAAM,0CAA0C,kDAAkD,CAAA;AACzG,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAMlD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,IAAI;CAsB7D"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectManyPrompt.js b/dist/domain/prompt/SelectManyPrompt.js index a7ce3aa4..0f08f90a 100644 --- a/dist/domain/prompt/SelectManyPrompt.js +++ b/dist/domain/prompt/SelectManyPrompt.js @@ -7,7 +7,7 @@ exports.INVALID_AT_LEAST_ONE_SELECTION_REQUIRED = 'At least one selection is req exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK = 'All selections must be valid choices on block'; exports.SELECT_MANY_PROMPT_KEY = 'SelectMany'; class SelectManyPrompt extends __1.BasePrompt { - validateOrThrow(selections) { + validate(selections) { if (selections == null) { throw new __1.PromptValidationException('Value provided is null or undefined'); } @@ -20,7 +20,7 @@ class SelectManyPrompt extends __1.BasePrompt { } const invalidChoices = lodash_1.difference(selections, lodash_1.map(choices, 'key')); if (invalidChoices.length !== 0) { - throw new __1.PromptValidationException(exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK); + throw new __1.InvalidChoiceException(exports.INVALID_ALL_SELECTIONS_MUST_EXIST_ON_BLOCK, invalidChoices); } return; } diff --git a/dist/domain/prompt/SelectManyPrompt.js.map b/dist/domain/prompt/SelectManyPrompt.js.map index 035d1ff4..df51149f 100644 --- a/dist/domain/prompt/SelectManyPrompt.js.map +++ b/dist/domain/prompt/SelectManyPrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAoF;AACpF,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,eAAe,CAAC,UAA4C;QAC1D,IAAI,UAAU,IAAI,IAAI,EAAE;YACtB,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAM;SACP;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,6BAAyB,CAAC,kDAA0C,CAAC,CAAA;SAChF;QAED,OAAM;IACR,CAAC;CACF;AAvBD,4CAuBC"} \ No newline at end of file +{"version":3,"file":"SelectManyPrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectManyPrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAqH;AACrH,mCAAsC;AAEzB,QAAA,uCAAuC,GAAG,uDAAuD,CAAA;AACjG,QAAA,0CAA0C,GAAG,+CAA+C,CAAA;AAC5F,QAAA,sBAAsB,GAAG,YAAY,CAAA;AAMlD,MAAa,gBAAiB,SAAQ,cAAmC;IACvE,QAAQ,CAAC,UAA4C;QACnD,IAAI,UAAU,IAAI,IAAI,EAAE;YACtB,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAM;SACP;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACnD,MAAM,IAAI,6BAAyB,CAAC,+CAAuC,CAAC,CAAA;SAC7E;QAED,MAAM,cAAc,GAAG,mBAAU,CAAC,UAAU,EAAE,YAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;QAClE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,MAAM,IAAI,0BAAsB,CAAiB,kDAA0C,EAAE,cAAc,CAAC,CAAA;SAC7G;QAED,OAAM;IACR,CAAC;CACF;AAvBD,4CAuBC"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts b/dist/domain/prompt/SelectOnePrompt.d.ts index 2f650f95..88d812d9 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts +++ b/dist/domain/prompt/SelectOnePrompt.d.ts @@ -1,6 +1,6 @@ import { BasePrompt, ISelectOnePromptConfig } from '../..'; export declare const SELECT_ONE_PROMPT_KEY = "SelectOne"; export declare class SelectOnePrompt extends BasePrompt { - validateOrThrow(choiceKey: ISelectOnePromptConfig['value']): void; + validate(choiceKey: ISelectOnePromptConfig['value']): void; } //# sourceMappingURL=SelectOnePrompt.d.ts.map \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.d.ts.map b/dist/domain/prompt/SelectOnePrompt.d.ts.map index cc9849a8..ab5592b2 100644 --- a/dist/domain/prompt/SelectOnePrompt.d.ts.map +++ b/dist/domain/prompt/SelectOnePrompt.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,eAAe,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,IAAI;CAalE"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.d.ts","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAE,sBAAsB,EAA4B,MAAM,OAAO,CAAA;AAEnF,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAMhD,qBAAa,eAAgB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,IAAI;CAa3D"} \ No newline at end of file diff --git a/dist/domain/prompt/SelectOnePrompt.js b/dist/domain/prompt/SelectOnePrompt.js index 59ccf357..e8f3a992 100644 --- a/dist/domain/prompt/SelectOnePrompt.js +++ b/dist/domain/prompt/SelectOnePrompt.js @@ -4,7 +4,7 @@ exports.SelectOnePrompt = exports.SELECT_ONE_PROMPT_KEY = void 0; const __1 = require("../.."); exports.SELECT_ONE_PROMPT_KEY = 'SelectOne'; class SelectOnePrompt extends __1.BasePrompt { - validateOrThrow(choiceKey) { + validate(choiceKey) { if (choiceKey == null) { throw new __1.PromptValidationException('Value provided is null or undefined'); } diff --git a/dist/domain/prompt/SelectOnePrompt.js.map b/dist/domain/prompt/SelectOnePrompt.js.map index bbff7de2..738757eb 100644 --- a/dist/domain/prompt/SelectOnePrompt.js.map +++ b/dist/domain/prompt/SelectOnePrompt.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,eAAe,CAAC,SAA0C;QACxD,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAM;IACR,CAAC;CACF;AAdD,0CAcC"} \ No newline at end of file +{"version":3,"file":"SelectOnePrompt.js","sourceRoot":"","sources":["../../../src/domain/prompt/SelectOnePrompt.ts"],"names":[],"mappings":";;;AAmBA,6BAAmF;AAEtE,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAMhD,MAAa,eAAgB,SAAQ,cAAkC;IACrE,QAAQ,CAAC,SAA0C;QACjD,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,6BAAyB,CAAC,qCAAqC,CAAC,CAAA;SAC3E;QAED,MAAM,EAAC,kBAAkB,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QAEjD,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAC,EAAE,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,EAAE;YAC5E,MAAM,IAAI,6BAAyB,CAAC,2CAA2C,CAAC,CAAA;SACjF;QAED,OAAM;IACR,CAAC;CACF;AAdD,0CAcC"} \ No newline at end of file diff --git a/src/__tests__/prompt/BasePrompt.spec.ts b/src/__tests__/prompt/BasePrompt.spec.ts index ec6fe397..2996d7b5 100644 --- a/src/__tests__/prompt/BasePrompt.spec.ts +++ b/src/__tests__/prompt/BasePrompt.spec.ts @@ -28,7 +28,7 @@ describe('BasePrompt', () => { const runner = new FlowRunner(ctx) const prompt = new MessagePrompt(config as IMessagePromptConfig, 'abc-123', runner) - expect(prompt.isValid()).toBe(true) + expect(prompt.error).toBeNull() }) }) }) diff --git a/src/domain/prompt/BasePrompt.ts b/src/domain/prompt/BasePrompt.ts index 6cf0aaad..6ad15458 100644 --- a/src/domain/prompt/BasePrompt.ts +++ b/src/domain/prompt/BasePrompt.ts @@ -91,7 +91,8 @@ export abstract class BasePrompt> implements } async fulfill(val: T['value'] | undefined): Promise { - // allow prompt.fulfill() for continuation + // We need to exempt setting this.value when prompt.fulfill() is called without any arguments, + // because it would reset our state to "uninitialized" due to val being undefined if (val !== undefined) { this.value = val } diff --git a/src/domain/prompt/IPrompt.ts b/src/domain/prompt/IPrompt.ts index c7284754..74127da3 100644 --- a/src/domain/prompt/IPrompt.ts +++ b/src/domain/prompt/IPrompt.ts @@ -30,7 +30,7 @@ export interface IPrompt