1
0
Fork 0
Commit Graph

58 Commits (master)

Author SHA1 Message Date
Joseph Frazer aa2ba885af [DEV-6756] Prevent special chars from "local-part" of email address
The `"(),:;<>@[\]`` are allowed in the "local-part" of an email address
under certain circumstances, but our regex is not checking those
circumstances. It is better if we do not allow them until we improve
validation.
2019-12-23 08:26:54 -05:00
Mike Gerwitz 1e5a0fb701 events: Use EventEmitter from old version of Node
This was copied from a _very_ early version of node.  The problem is that,
for reasons not yet investigated, Node v12's EventEmitter (at least when
extended by easejs) is causing data to be shared across instances.

This kicks the can down the road a little bit.  The goal is to eventually
get rid of EventEmitter entirely.

Here's the script used to do the conversion in this commit:

git grep -l "require( 'events' )" -- src \
  | while read f; do
      path=$( sed 's|src/||;s|[^/]\+|..|g' <<< "$(dirname "$f")" )
      sed -i "s|require( 'events' )|require( '$path/events' )|" "$f"
    done
2019-11-08 13:06:18 -05:00
Joseph Frazer 28f938853a [DEV-5657] Check for TLD in email addresses
The DocuSign service rejects email addresses without a TLD, even though
they are valid.
2019-09-12 09:30:23 -04:00
Mike Gerwitz e058c8b509 Copyright range update
All files now have the same range, beginning from the conception of this
project.
2019-08-30 09:41:35 -04:00
Joseph Frazer a8d0b8c817 [DEV-3866] changes for new checkbox question type
The new checkbox question type is setup with an empty validator. When
checked, it was not unchecking because it was trying to behave like the
"noyes" questions. I updated the logic to not behave like that if there
is only one checkbox in a group.
2018-11-05 11:34:33 -05:00
Joseph Frazer aed5ddd1b7 Revert "[DEV-3011] Add validation and style for datalists"
This reverts commit 394dde7de7.
2018-09-24 11:03:30 -04:00
Joseph Frazer e17ace40ed Revert "[DEV-3011] Do not use "Number" validator for datalists."
This reverts commit e064378c99.
2018-09-24 11:03:27 -04:00
Joseph Frazer e064378c99 [DEV-3011] Do not use "Number" validator for datalists. 2018-09-12 13:50:52 -04:00
Joseph Frazer 394dde7de7 [DEV-3011] Add validation and style for datalists 2018-09-12 12:29:40 -04:00
Mike Gerwitz 0401860377 Cast value to string before validating
* src/validate/BucketDataValidator.js (_forEach): Cast data to string
  before passing to formatter, which expects a string.
2017-06-29 14:18:01 -04:00
Mike Gerwitz 1bb5191e3e LoVullo Associates => R-T Specialty
Copyright notices updated.  More casual references to "LoVullo
Associates" replaced with "RT Specialty / Lovullo", which will be "RT
Specialty Buffalo" in the future.  Or "RT Specialty", depending on how
this is rolled out.  Or "Ryan Specialty Group".  Who knows.

"R-T Specialty, LLC." is the legal name, which includes the dash.  Not
to be confused with a certain television network.
2017-06-08 14:48:43 -04:00
Mike Gerwitz 657573ab63 Near-complete liberation of liza
I have sat on releasing a lot of this code for years because I wanted
the liza repo to be in a pristine state---tests and all---which
required a great deal of refactoring.  Well, that never happened, and
time is up.

LoVullo Associates---my employer---has been purchased by another
company.  This means that any agreement with LoVullo regarding
releasing free software is going to have to be re-negotiated with this
new company, and I have no idea how those negotiations will go.  So,
I have no choice but to simply release everything in its current state,
or risk it being lost forever.

This represents work over the past 6--7 years, 99.9% of it written by
me.  This project has been my baby for quite some time, and has been
through a number of battles with deadlines and other unfortunate
circumstances; the scars show.  I also didn't really "know" JS when
starting this project.  Perhaps you can help improve upon it.

There are some odds-and-ends that could be committed.  And references
to insurance and LoVullo need to be removed to generalize this.

I hope that this will not be the last public commit for this project.
I'll fight the good fight and we'll see where that takes us.  Maybe
it'll be easy.

Happy hacking.
2017-06-08 14:38:28 -04:00
Mike Gerwitz 6bba4322bf ValidStateMonitor: Consider scalar diff to affect all indexes
Classifications often yield scalar results.  Since those results are
used directly in the diff, we have the situation where the expected
diff format (an array) is not provided.  Consistent with the rest of
the system, we should consider a scalar to affect every index.

* src/validate/ValidStateMonitor.js (_checkCauseFix): Consider scalar
    diffs to affect every index when checking for fixes.
* test/validate/ValidStateMonitorTest.js: Add test.
2017-03-17 11:17:42 -04:00
Mike Gerwitz 2ac393070a DataValidator: properly chain queue
This was not properly chain the promises---it was always chaining on
the original _pending (so, the first request) and never clearing
_pending after that point.

* src/validate/DataValidator.js (_onceReady): Properly chain.
* test/validate/DataValidatorTest.js: Updated test.  Don't ask.
2017-02-21 16:21:18 -05:00
Mike Gerwitz ac7ec6c5f2 DataValidator: Hold concurrent requests
Since we maintain state (as a kluge for the time being to integrate
with the rest of the system), we need to be careful to protect against
concurrent requests that might mess with it before the original
request is complete.

* src/validate/DataValidator.js
  (validate, updateFailures): Hold concurrent requests.
  (_onceReady): Add method.

* test/validate/DataValidatorTest.js: Add tests.
2017-02-17 11:31:32 -05:00
Mike Gerwitz eefd268abf Revert "DataValidator: Always clear store state"
This breaks everything. :x

This reverts commit e0c2e4dc86, reversing
changes made to e610372c84.
2017-02-16 16:49:29 -05:00
Mike Gerwitz 71024bd389 DataValidator: Queue validations when incomplete
* src/validate/DataValidator.js (validate): If a validation is
    ongoing, queue requests.

* test/validate/DataValidatorTest.js: Add test.

DEV-2299
2017-02-16 12:37:46 -05:00
Mike Gerwitz 3b1df602e1 DataValidator: Always clear store state
In practice, not clearing the store and allowing it to use previous
state has the effect of instantly "fixing" failures if there happens
to be more than one validation call.

This was a log of debugging for a one-line change.

* src/validate/DataValidator.js (_populateStore): Always clear store.
* test/validate/DataValidatorTest.js: Add test.

DEV-2299
2017-02-13 15:07:26 -05:00
Mike Gerwitz ed21707920 DataValidator, ValidStateMonitor: Add #clearFailures argument
This allows clearing only the specified failures.

* src/validate/ValidStateMonitor.js
  (clearFailures): Add `fields' argument.  Make method more concise.
  (_fixFailure): Handle clearing `_failures' record.

* src/validate/DataValidator.js
  (clearFailures): Add `fields' argument.

* test/validate/ValidStateMonitorTest.js: Add test.
* test/validate/DataValidatorTest.js: Add test.
2017-02-08 11:24:56 -05:00
Mike Gerwitz c7b5ce5595 DataValidator, ValidStateMonitor: Add #clearFailures
* src/validate/DataValidator.js (clearFailures): Add public method.
* test/validate/DataValidatorTest.js: Add #clearFailures test.

* src/validate/ValidStateMonitor.js (clearFailures): Add public method.
* test/validate/ValidStateMonitorTest.js: Add #clearFailures test.
2017-02-02 14:01:13 -05:00
Mike Gerwitz 0dcbd32202 DataValidator: accept classification results
* src/validate/DataValidator.js
  (validate): New `classes' parameter.  API BC break from previous
    commits.
  (populateStore, updateFailures): Generalize methods.

* test/validate/DataValidatorTest.js:
  Add associated test.
  Refactor existing tests to adhere to new API/expectations.

DEV-2206
2017-01-30 00:29:25 -05:00
Mike Gerwitz 28d74d7068 ValidStateMonitor: handle empty diff on past failure
See the description in the test case.  This is a bug fix.

* src/validate/ValidStateMonitor.js
  (_checkCauseFix): Do not consider an empty diff on a past failure to
    be a fix.

* test/validate/ValidStateMonitorTest.js: Add test.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 29fb75d1a3 ES6-ify ValidStateMonitor
This also helps to demonstrate how the more concise syntax improves
readability.

* src/validate/ValidStateMonitor.js: Syntax to ES6.

DEV-2296
2017-01-29 22:44:35 -05:00
Mike Gerwitz 2045c76f7e Integrate Store into DataValidator, ValidStateMonitor
ValidStateMonitor now uses a Store in place of the original primitive
object-based diff format.  The original format is translated by
DataValidator.  The code is in a transitional state, and considering
the amount of time we spend on various areas of this project, will
likely stay this way for a while.

* src/validate/DataValidator.js
  (__construct): Accept Store factory parameter.
  (_store_factory): Add field.
  (_createStores): Add method.
  (_validate): Handle Store.
  (updateFailures): Add method.
  (_populateStore): Add method.

* test/validate/DataValidatorTest.js: Add tests.

* src/validate/ValidStateMonitor.js
  (update): Enforce Store diff.
    Wait to process failures until fixes are calculated.
  (_checkFailureFix): Handle asynchronous, Promise-based diff.
  (_checkCauseFix): Extract logic from _checkCauseFix.

* test/validate/ValidStateMonitorTest.js:
  Modify test cases to be Promise-based and handle async calls where
  appropriate.  That was a friggin' expensive mess.

DEV-2296
2017-01-29 22:44:27 -05:00
Mike Gerwitz 203b25f10e Add DataValidator
This extracts some gross code from Client in the rating-fw repo, which
is responsible for gluing change validations together.

* src/validate/DataValidator.js: Add class.
* test/validate/DataValidatorTest.js: Add test case.

DEV-2296
2017-01-27 15:57:43 -05:00
Mike Gerwitz c8d77085ec Make BucketDataValidator public methods virtual
This class is terribly factored and not tested.

* src/validate/BucketDataValidator.js
  (validate,format): Make methods virtual.

DEV-2296
2017-01-27 15:57:43 -05:00
Mike Gerwitz fb3cd11265 ValidStateMonitor#update return Promise
Stepping stone to async. fix checks.

* src/validate/ValidStateMonitor.js
  (update, detectFixes, _checkFailureFix): Return Promise.
* test/validate/ValidStateMonitorTest.js: Update to use promises.

DEV-2296
2017-01-27 15:57:40 -05:00
Mike Gerwitz e883c45e35 Add Currency formatter
* src/validate/formatter/Currency.js: Add class.
2016-12-01 12:44:09 -05:00
Mike Gerwitz 5607bf1927 Replace Currency formatter with StringFormat
This is a much more general solution.

* src/validate/formatter/Currency.js: Remove trait.
* test/validate/formatter/CurrencyTest.js: Remove test case.

* src/validate/formatter/StringFormat.js: Add trait.
* test/validate/formatter/StringFormatTest.js: Add test case.
2016-12-01 08:47:23 -05:00
Mike Gerwitz ab3f5f4cb6 Validate correct Number format
* src/validate/formatter/Number.js
  (parse): Validate number format.

* test/validate/formatter/NumberTest.js: Modify accordingly.
2016-12-01 08:43:51 -05:00
Mike Gerwitz 5947e7646e Add scale to Number formatter
* src/validate/formatter/Number.js
  (__mixin): Add mixin ctor.
  (parse): Handle scale.
  (styleNumber): Handle scale.
  (scale, split): Add methods.

* test/validate/formatter/NumberTest.js: Modified accordingly.
2016-12-01 08:43:46 -05:00
Mike Gerwitz 6db99c8632 Add Currency formatter
* src/validate/formatter/Currency.js: Add trait.
* test/validate/formatter/CurrencyTest.js: Add test case.
2016-11-28 14:01:44 -05:00
Mike Gerwitz 14711cd4c6 Correct Number formatter docblock
* src/validate/formatter/Number.js: Correct trait docblock.
2016-11-28 14:01:09 -05:00
Mike Gerwitz 5ce106710e Add MultiDimension formatter
* src/validate/formatter/MultiDimension.js: Added
* test/validate/formatter/MultiDimensionTest.js: Added
2016-06-28 10:27:59 -04:00
Mike Gerwitz 8feb8f286a Add StandardLimitFormatter
This formats according to common insurance conventions for limits.

* src/validate/formatter/insurance/StandardLimitFormatter.js: Added.
2016-06-28 10:27:59 -04:00
Mike Gerwitz b90f6d7474 Add accept/reject styler
* src/validate/formatter/AcceptReject.js: Added.
* test/validate/formatter/AcceptRejectTest.js: Added.
2016-06-28 10:27:56 -04:00
Mike Gerwitz 31f3ab010e Add Limit formatter
* src/validate/formatter/insurance/Limit.js: Added
* test/validate/formatter/insurance/LimitTest.js: Added
2016-06-27 16:51:25 -04:00
Mike Gerwitz c0df3ef02e Add Number formatter
* src/validate/formatter/Number.js: Added
* test/validate/formatter/NumberTest.js: Added
2016-06-27 16:51:25 -04:00
Mike Gerwitz 8a26406468 Add MultiDelimited formatter trait
This will simplify, through composition, a number of other
validator-formatters.

* src/validate/formatter/MultiDelimited.js: Added
* test/validate/formatter/MultiDelimitedTest.js: Added
2016-06-27 16:51:17 -04:00
Mike Gerwitz 4aa88fc08c UnorderedList{Formatter=>} now a trait
This adds a great deal of flexibility through composition via trait
stacking.

* src/validate/formatter/UnorderedList.js: Renamed from
  UnorderedListFormatter; now a trait.

* test/validate/formatter/UnorderedListTest.js: Renamed from
  UnorderedListFormatterTest and adjusted to instantiate trait.
2016-06-24 15:57:10 -04:00
Mike Gerwitz ac52f42d1c Add EchoFormatter
* src/validate/formatter/EchoFormatter.js: Added.
* test/validate/formatter/EchoFormatterTest.js: Added.
2016-06-23 10:12:59 -04:00
Mike Gerwitz 391a819536 Liberated UnorderedListFormatter
These have been refacored from the original: rather than abusing what is now
the PatternFormatter, it is now its own class.

* src/validate/formatter/UnorderedListFormatter.js: Added.
* test/validate/formatter/UnorderedListFormatterTest.js: Added.
2016-06-23 09:14:05 -04:00
Mike Gerwitz d6cecf1ff6 VFormat => PatternFormatter with added interface
* src/validate/ValidatorFormatter.js: Interface added.
* src/validate/formatter/PatternFormatter.js: Renamed from ../VFormat.js.
* test/validate/formatter/PatternFormatterTest.js: Renamed from
  ../VFormatTest.js.
2016-06-22 15:59:12 -04:00
Mike Gerwitz a509e53a3e Liberate VFormat
This will likely undergo some refactoring.

* src/validate/VFormat.js: Added.
* test/validate/VFormatTest.js: Added.
2016-06-22 15:41:03 -04:00
Mike Gerwitz e6ede4ad3a ValidStateMonitor: merge subsequent failures before fixes
* src/validate/ValidStateMonitor.js (mergeFailures):
Another error on a field that previously failed will no longer overwrite the
previous failure, which caused issue when the causes changed (leaving fields
potentially unfixed).

* test/validate/ValidStateMonitorTest.js: Respective tests added.
2016-04-28 11:53:14 -04:00
Mike Gerwitz e406c198d2 Add Failure#merge
* src/validate/Failure.js (merge): Added
* test/validate/FailureTest.js: Respective tests added
2016-04-28 11:31:42 -04:00
Mike Gerwitz b3d3f4b7cd Remove support for string-style validation failures
* src/validate/ValidStateMonitor (_getCauses): Removed
Now requires that each failure be a Failure object.
2016-04-21 16:28:34 -04:00
Mike Gerwitz 0a8329b405 Support multiple validation failure causes
* src/validate/Failure.js (__construct): Takes an array of causes.
(getCauses): Now returns an array of causes.

* src/validate/ValidStateMonitor.js: Recognize fixes on array of causes.

* test/validate/FailureTest.js: Updated

* test/validate/ValidStateMonitorTest.js: Updated
2016-04-21 16:23:41 -04:00
Mike Gerwitz f624710451 Consider field failure cause when checking fixes
This maintains BC with the old string-based system.

* src/validate/ValidStateMonitor.js (_getCause): Added.
(detectFixes): Consider failure cause if available when checking for fixes.
2016-04-20 12:11:17 -04:00
Mike Gerwitz ac5d04e9a4 Add validation Failure
* src/validate/Failure.js: Added
* test/validate/FailureTtest.js: Added
2016-04-20 10:31:49 -04:00