1
0
Fork 0
Commit Graph

240 Commits (c33adee21d9812ec131fb4e7b2bf34f93b505285)

Author SHA1 Message Date
Mike Gerwitz 642dd8deb3 Calc: Handle null values
`null' is used to represent a truncation in a diff.

* src/calc/Calc.js (_each): Proper null handling.
2017-08-10 14:46:01 -04:00
Mike Gerwitz 9b3ca7a90a Server: Fix botched logging of metadata promise error
* src/server/Server.js (_monitorMetadataPromise): Fix/remove invalid
  references.
2017-08-10 09:52:07 -04:00
Mike Gerwitz c1b6f796fe Add `quote' Data API type
* src/dapi/DataApiFactory.js (_createDataApi): Add support for
  `quote'.
* src/dapi/http/HttpDataApi.js (__construct): New `enctype' argument.
  (_encodeData, _encodeKeys): Remove former, rename latter to former.
  (encodeData, _urlEncode): Encode based on enctype and method.
  (*): Strict mode, es6 style.
2017-08-10 09:52:07 -04:00
Mike Gerwitz d31e12193a Add ResponseApply
* src/dapi/format/ResponseApply.js: Add trait.
* test/dapi/format/ResponseApplyTest.js: Test it.
2017-08-10 09:52:07 -04:00
Mike Gerwitz e2845b72ec RestrictedDataApi#request: Make virtual
This is a bug (as this prohibits mixin overrides).

* src/dapi/RestrictedDataApi.js (#request): Make method virtual.
2017-08-10 09:52:07 -04:00
Mike Gerwitz 020ca01458 HttpDataApi: Only serialize JSON on POST
* src/dapi/http/HttpDataApi.js (_encodeKeys): JSON.stringify on POST.
* test/dapi/http/HttpDataApiTest.js: Update tests accordingly.
  Add POST test.
2017-08-10 09:52:07 -04:00
Mike Gerwitz ae9c293518 DataApi: Update docblock and strict mode
This just updates the file a bit and provides a more specific
docblock (as used in HttpDataApi).

* src/dapi/DataApi.js: strict mode and var=>const.
  (request): Docblock update for params.
2017-08-10 09:52:07 -04:00
Mike Gerwitz 47cb736387 Add QuoteDataApi 2017-08-10 09:52:03 -04:00
Mike Gerwitz 4522525260 DataApi#request data param docblock correction
* src/dapi/DataApi.js (#request): Correct docblock for `data' param.
2017-08-04 11:45:24 -04:00
Mike Gerwitz 39d4e20e92 Add temporary ITableDialog for ColumnLink workaround
I'm still waiting to release GNU ease.js 0.2.9 because I still (after
months) am trying to secure a copyright waiver from my employer.  The
bugs affecting this were fixed back in December!

This works around the issue of traits extending named classes, and
some internal issues with extending constructors defined by the system
for traits.

https://mikegerwitz.com/projects/easejs/commit/?id=e93f3a70f9a699f1577df6ce3ba9201b2ea97542

So, this commit is temporary; revert after 0.2.9.

* src/ui/dialog/ITableDialog.js: Add interface (temporarily).
* src/ui/dialog/ColumnLink.js: Use it.
2017-07-31 10:26:24 -04:00
Mike Gerwitz 5bd6920588 ProcessManager: SIGHUP reinit method call fix
* src/server/rater/ProcessManager.js (init): Fix re-init method
  call (still referenced `exports'; has since been refactored into a
  class).
2017-07-25 16:06:41 -04:00
Mike Gerwitz 229a356a9a Do not convert non-truthy dapi return values to empty string
* src/dapi/DataApiManager.js (getDataExpansion): Explicit undefined
  check before triggering default (empty string).
* test/dapi/DataApiManagerTest.js: Add associated test cases.
2017-07-21 15:20:55 -04:00
Mike Gerwitz deeb5648b0 ProgramQuoteCleaner: Handle case of missing meta field data
* src/server/quote/ProgramQuoteCleaner.js (_fixMeta): `program.meta'
  does not exist on programs compiled previous to the proguic update.
2017-07-14 15:07:08 -04:00
Mike Gerwitz 2eacd310b2 Process metadata and provide to rate process
Prefixes with "meta:".

* src/server/Server.js (initQuote): Initialze metadata to empty.
* src/server/daemon/controller.js (createQuote): Add metabucket.
* src/server/db/MongoServerDao.js (saveQuote): Add additional
  documentation to docblock.  Save all metadata if no bucket data
  provided (which indicates a full quote save).  This happens on
  version change.
* src/server/rater/ProcessManager.js (_genData): Add method to merge
  metadata into bucket data with "meta:" prefix.
  (byId): Use merged data.
2017-07-10 10:09:24 -04:00
Mike Gerwitz 22c3a21cdf ServerSideQuote: Add metabucket
* src/server/quote/ServerSideQuote.js (_metabucket): Add field.
  (getMetabucket, setMetabucket, setMetadata): Add methods.
2017-07-10 10:09:24 -04:00
Mike Gerwitz 37f84b7da8 Initialize metadata on quote version change
Consequently, on quote load as well.

* src/server/quote/ProgramQuoteCleaner.js (_fixMeta): New method.
  (clean): Use it.
2017-07-10 10:09:22 -04:00
Mike Gerwitz e963761d22 DataProcessor {type=>param} docblock correction
I seem to like messing trivial things up.

* src/server/request/DataProcessor.js (constructor): Docblock fix.
2017-07-06 15:06:57 -04:00
Mike Gerwitz 4d22107a57 Create ProcessManager out of rater/service
* src/server/daemon/Daemon.js (__construct): Reference new class.
* src/server/rater/ProcessManager.js: Add class (extracted from
  service).
* src/server/rater/service.js: Refactored into ProcessManager.
2017-07-06 15:06:57 -04:00
Mike Gerwitz 00f457d3d8 DataProcessor code formatting fix (= alignment)
Was bugging the hell out of me.

* src/server/request/DataProcessor.js (constructor): Align `='s.
2017-07-06 15:06:57 -04:00
Mike Gerwitz 7e4d872db2 Rating s/thread/process/ terminology fix
It never was a thread; it's always been a process.

* src/server/rater/thread.js: Renamed.
* src/server/rater/process.js: Renamed from thread.js.
* src/server/rater/service.js: s/thread/process/.
2017-07-06 15:06:55 -04:00
Mike Gerwitz d961a16420 Shorten "unlock quote" string
A bit arbitrary, but it contains text that's coupled to the layout of
the UI, and it usually pushes the button down off of the bar.

* src/client/Client.js (_showLockedNotification): Remove end of
  "unlock quote" string.
2017-07-05 16:01:15 -04:00
Mike Gerwitz 81a829549c Remove accidentally committed console.log on script filename
* src/server/daemon/scripts.js: Remove console.log.
2017-07-05 11:40:27 -04:00
Mike Gerwitz c20fbbeded Rename {Rating=>Calc}Worksheet
The class was renamed, but not the file.  Whoops.

* src/ui/worksheet/CalcWorksheet.js: Rename from RatingWorksheet.js.
* src/ui/worksheet/RatingWorksheet.js: Remove file.
2017-06-29 16:21:48 -04:00
Mike Gerwitz c0d0f4b463 Revert CapturedUserResponse temporarily
This reverts CapturedUserResponse to the state it was in prior to
being extracted into liza.  The issue was supposed to have been
resolved by now, but I haven't wanted to make an ease.js release until
the company that bought the company I work for signs the copyright
waiver.  Which has been slow-going, to say the least.

The problem is that it is not recognizing a named trait extending a
class as a parameterized trait (it's not seeing __mixin).

* src/server/request/CapturedUserResponse.js: Use interface.
* src/server/request/IProtUserResponse.js: Add temporary interface.
2017-06-29 15:57:22 -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 0c24e3d280 Populate document metadata using Data APIs
What a cluster.

This was a lot of work to work around existing, bad APIs; there is no
time to refactor at the moment; this already took much longer than
expected.
2017-06-28 16:33:24 -04:00
Mike Gerwitz 65ab92f701 Add SpoofedNodeHttpImpl
Session spoofing is needed for making authenticated requests.
2017-06-28 15:51:18 -04:00
Mike Gerwitz d47d77bb5e Add server.meta.DapiMetaSource
Encapsulates the nasty.

* src/server/meta/DapiMetaSource.js: Add class.
* test/server/meta/DapiMetaSourceTest.js: Add test case.
2017-06-28 14:56:28 -04:00
Mike Gerwitz b3f8ed96dd Fix typo in RestrictedDataApi error
* src/dapi/RestrictedDataApi.js (_requestParamCheck): Unknown param
  error typo fix.
2017-06-28 14:56:28 -04:00
Mike Gerwitz 95c28d4db4 Extract Server construction into DocumentServer
* src/server/DocumentServer.js: Add facade.
* src/server/daemon/controller.js: Use it.
2017-06-28 14:56:26 -04:00
Mike Gerwitz 630af0a062 Add ability to provide origin to NodeHttpImpl
* src/dapi/http/NodeHttpImpl.js (_parseUrl): Add method.
  (__construct): Add argument.
  (requestData): Use it.

* test/dapi/http/NodeHttpImplTest.js: Add tests.
2017-06-21 13:55:15 -04:00
Mike Gerwitz a1d5e7d3c5 Instantiate appropriate HttpImpl
* src/dapi/DataApiFactory.js (fromType): Instantiate NodeHttpImpl when
  XMLHttpRequest is undefined.
2017-06-21 10:52:46 -04:00
Mike Gerwitz 624f35a489 XhrHttpImpl: throw {=>Http}Error
* src/dapi/http/XhrHttpImpl.js (serveError): Throw HttpError instead
  of Error.
* test/dapi/http/XhrHttpImplTest.js: Test updated accordingly.
2017-06-21 10:52:46 -04:00
Mike Gerwitz a3e359a050 Add node dapi HTTP implementation
* src/dapi/http/HttpError.js: Add error subtype.
* src/dapi/http/NodeHttpImpl.js: Add node-based HTTP impl.
* test/dapi/http/HttpErrorTest.js: Add test.
* test/dapi/http/NodeHttpImplTest.js: Add test.
2017-06-21 10:52:46 -04:00
Mike Gerwitz 3be28a7858 Re-add missing Server#_sanitizeBucketData return
During liberation, this was accidentally removed...which breaks stuff.

* src/server/Server.js (_sanitizeBucketData): Re-add missing return statement.
2017-06-21 10:52:41 -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 7567306123 FieldStyler: Remove classes not added by #addClass
This code assumed that no classes would be removed that were _not_
added by #addClass.  Well, that's false.

* src/ui/styler/FieldStyler.js (removeClass): Consider both spaces and
  boundary preceding class name.

* test/ui/styler/FieldStylerTest.js: Add test case.
2017-03-17 14:11:16 -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 6908e62206 Client: clear validation errors on dapi fieldLoaded
Previously, the system relied on the preStagingUpdate StagingBucket
event to do this implicitly, but that is no longer kicked off when
the diff doesn't produce any bucket changes.

* src/client/Client.js (_createProgram) [dapi]: Clear validation
  failures on dapi fieldLoaded.
2017-02-22 09:54:03 -05:00
Mike Gerwitz 45889f556f DataApiManager: emit fieldLoaded after request completes
The intent of this is to allow for clearing errors after fields
load (e.g. a "field loading" message if the user attempts to continue
past the step when a field hasn't yet finished loading).

* src/dapi/DataApiManager.js (getApiData): Emit fieldLoaded after
  request completes.
* test/dapi/DataApiManagerTest.js: Add test case.

DEV-2299
2017-02-22 09:53:59 -05: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 62996102a8 StagingBucket: Use strict mode (and fix accidental globals)
This fixes accidental global variables and enables strict mode to
prevent it in the future.

* src/bucket/StagingBucket.js: Enable strict mode.  Use const/let where
    appropriate instead of var.
2017-02-20 12:16:49 -05:00
Mike Gerwitz c5194b4ec5 StagingBucket: Do not process non-changes
Since changes trigger any event observers---which can be
expensive---it is ideal to ignore sets that do not result in any
changes to the bucket.

This also resolves issues with systems that are confused by empty
diffs.

* src/bucket/StagingBucket.js
  (_hasChanged): Add method.
  (setValues): Use it.

* test/bucket/StagingBucketTest.js: Add test case.

DEV-2299
2017-02-20 12:16:24 -05:00
Mike Gerwitz 4f7654c7c4 Liberate numerous bucket classes
* src/bucket/DelayedStagingBucket.js: Add class.
* src/bucket/QuoteDataBucket.js: Add class.
* src/bucket/StagingBucket.js: Add class.
* src/bucket/StagingBucketAutoDiscard.js: Add class.
* src/client/ClientDependencyFactory.js: Add class.
2017-02-17 15:14:17 -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 d99d1e3bed Program UI testing library 2017-02-16 09:12:44 -05:00
Mike Gerwitz 5f36d9272f Testing utilities for stubbing Program
This allows for testing assertions.  It's fairly primitive, but will
work for the time being.

* src/test/README: Add file.
* src/test/program/DummyClassifier.js: Add module.
* src/test/program/Program.js: Add class.
* src/test/program/util.js: Add module.
2017-02-15 14:19:33 -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 cc79f8e1f3 FieldVisibilityEventHandler: use new DataValidator API
I updated DataValidator but never updated the caller.  Damnit.  It's
an unfortunate side-effect of dynamic, loosely typed languages and
mitigating it requires what should be boilerplate functional tests (in
this case---functional tests are useful for many other integration
aspects).

* src/event/FieldVisibilityEventHandler.js
  (handle): Use updated DataValidator#clearFailures API, which has
    a different descriptor format.

* test/event/FieldVisibilityEventHandlerTest.js: Update test.
2017-02-09 15:20:23 -05:00
Mike Gerwitz 028606242a Integrate field visibility event handler
* src/client/Client.js
  (_hideField): Remove method (extracted into
    FieldVisibilityEventHandler).
  (handleEvent): Remove show/hide handling.
  (_handleClassMatch): Adjust to new class/API.

* src/client/ClientDependencyFactory.js
  (createClientEventHandler): Add show/hide event handlers.
2017-02-08 11:24:56 -05:00
Mike Gerwitz e26a7c3cac FieldVisibilityEventHandler: Add class
This extracts code from internal lovullo repo rating-fw (originally
Client#_hideFields), 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.

* src/event/FieldVisibilityEventHandler.js: Add class.
* test/event/FieldVisibilityEventHandlerTest.js: Add test case.
2017-02-08 11:24:56 -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 e7700e8b69 Liberate ClientDebug classes
This is a separate program of sorts that sits alongside and hooks the
Client.

* src/client/debug/AssertionClientDebugTab.js: Add class.
* src/client/debug/BucketClientDebugTab.js: Add class.
* src/client/debug/CalcClientDebugTab.js: Add class.
* src/client/debug/ClassifyClientDebugTab.js: Add class.
* src/client/debug/ClientDebug.js: Add class.
* src/client/debug/ClientDebugDialog.js: Add class.
* src/client/debug/ClientDebugTab.js: Add interface.
2017-02-08 11:24:56 -05:00
Mike Gerwitz dd7c2760f4 Client: Extract from internal repo
This thing is an ugly monstrosity that has witheld some pretty rough
development times.  As code is touched, it is being removed.

This depends on many things not yet in the liza repo; they'll be added
in time.

These classes were changed slightly to work within liza (e.g. paths).

* src/client/Client.js: Extract from rating-fw
  as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.

* src/client/ClientDependencyFactory.js: Extract from rating-fw
  as of 5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
2017-02-07 15:38:33 -05:00
Mike Gerwitz a65f568714 UnknownEventError: use ease.js
ease.js supports Error extending now.

* src/event/UnknownEventError.js: Use easejs.
2017-02-06 16:12:26 -05:00
Mike Gerwitz bd81e2e726 Liberate event handlers
These are extracted from rating-fw commit
5d4019f1973f9271f4b1bd24ce1f55b56ccda09e.
2017-02-06 16:12:26 -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 61a59db4e0 system.client: working data.diffStore
* src/system/client.js (data.diffStore): Compose all stores.
* test/system/clientTest.js: Update test case.

DEV-2296
2017-01-30 00:43: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 24180e704a Add DiffStore
* src/store/DiffStore.js: Add class.
* test/store/DiffStoreTest.js: Add test case.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 3289e42003 Update MemoryStore syntax to ES6
`#reduce` is much better.

* src/store/MemoryStore.js: Update syntax.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz 282c0acf54 Store#clear to return self
* src/store/MemoryStore.js (clear): Promise resolve to self.
* src/store/Store.js (clear): Update docblock.
* test/store/MemoryStoreTest.js: Update test case accordingly.

DEV-2296
2017-01-30 00:29:25 -05:00
Mike Gerwitz b62673791b Add PatternProxy Store trait
Life is so much less miserable now that the project is supporting ES6.

* src/store/PatternProxy.js: Add trait.
* src/store/StorePatternError.js: Add Error.
* test/store/PatternProxyTest.js: Add test case.

DEV-2296
2017-01-30 00:29:15 -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 4d981bd39f Store#add to return self
This allows for Promise chaining (and consequently temporary classes,
great for testing).

* src/store/MemoryStore.js
  (add): Resolve promise to self.
    Modify docblock.
* src/store/Store.js (add): Modify docblock.
* src/store/Cascading.js (add): Modify docblock.

* test/store/MemoryStoreTest.js: Modify test accordingly.

DEV-2296
2017-01-29 22:44:34 -05:00
Mike Gerwitz 38b4a58dde Began system/ with client
This will contain various factories (compounded in some cases) to
instantiate various parts of a coherent system.  It aims to replace
(as one of many pieces) the ClientDependencyFactory that's referenced
in the code, which is still part of rating-fw (internal LoVullo repo
from which liza is being liberated).

* src/system/client.js: Add module.
* test/system/clientTest.js: Add functional test case.

DEV-2296
2017-01-29 22:44:34 -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 0c18a6321a Add StoreMissError
Nice and trivial with the new easejs transparent error subtyping!

* src/store/StoreMissError.js: Add error class.
* src/store/MemoryStore.js (get): Use it.
* test/store/MemoryStoreTest.js (#get): Modify test to expect type.
2017-01-04 16:17:37 -05:00
Mike Gerwitz 7d97569027 Add MissLookup trait
* src/store/MissLookup.js: Add trait.
* test/store/MissLookupTest.js: Add test case.
2017-01-04 16:17:37 -05:00
Mike Gerwitz 0be39adfdb Make {,Memory}Store asynchronous
This isn't terribly useful as a general-purpose cache if it can't
handle async requests.
2017-01-04 16:17:35 -05:00
Mike Gerwitz 29f67bd157 Add store.Cascading
* src/store/Cascading.js: Add trait.
* test/store/CascadingTest.js: Add test case.
2017-01-03 09:11:18 -05:00
Mike Gerwitz d8d44130e8 Add {,Memory}Store
* src/store/Store.js: Add interface.
* src/store/MemoryStore.js: Add class.
* test/store/MemoryStoreTest.js: Add test case.
2017-01-03 09:10:53 -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 c124086673 Correct and test GeneralStepUi#scrollTo
* src/ui/step/GeneralStepUi.js (scrollTo):
  Will now abort after each error rather than falling through.
  Visibility error message will now show field index.

* test/ui/step/GeneralStepUiTest.js: Added respective test cases
2016-08-05 11:45:09 -04:00
Mike Gerwitz 66f78c8886 Accept jQuery in GeneralStepUi
This defaults to the global jQuery just so we don't break
everything (BC); that'll be removed in the future.

* src/ui/step/GeneralStepUi.js (__construct): Accept jQuery.
  (setContent): Use jQuery instance passed via ctor
2016-08-05 11:41:27 -04:00
Mike Gerwitz 72f29a9734 Corrected GeneralStepUi class name
* src/ui/step/GeneralStepUi.js: Class name {=>General}StepUi
2016-07-28 16:25:47 -04:00
Mike Gerwitz 8d68880712 Remove multitext answer styler
This can now be handled with the existing formatters, specifically the
MultiDimension trait.  Specifically, multitext simply handled the
styling of vectors.

* src/ui/ElementStyler.js (_answerStylers): Remove multilimit
2016-07-20 15:23:35 -04:00
Mike Gerwitz d0768e20ca Remove now-unneeded answer stylers
There are more to be removed; baby steps.

* src/ui/ElementStyler.js
  (_answerStylers.{limit,multilimit,acceptReject,limitReject): Removed
2016-06-28 10:27:59 -04: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