This changes the easejs interface for DataApi, which requires adding the
param to everything. The TS interface was created in a previous commit and
already contained this parameter. The idea is to remove the easejs
interface in the future, but traits are a barrier to that atm.
DocumentServer and controller demonstrate the mess that we have with regards
to instantiating dependencies. This needs to change---DocumentServer itself
was something that was started but never fully realized. It makes this
incredibly confusing, difficult to follow, and complicates important error
handling that ought to be taking place. It also discourages implementing
additional dependencies.
I'm not going to go through and provide a ChangeLog-style commit message for
this commit. I'm too exhausted by this crap.
This was a bit involved because the system had to be made async all
the way up the stack. No attempt was made to clean up the mess up the
stack---no time.
* src/dapi/DataApiFactory.js
(fromType): [BC BREAK] Fix docblock. Add `api_name' param. Call
`#descLookup' and return promise.
(descLookup): Add method. Return promise resolving to provided
descriptor. Intended to be overridden by subtype.
* src/dapi/DataApiManager.js
(_dataApis): Update docblock to indicate that it now stores
promises.
(getApiData): Expect promise for `DataApiFactory#fromType' call.
* src/server/DocumentServer.js: (create): [BC BREAK] Accept
configuration. Look up dapi conf and pass to
`ServerDataApiFactory' ctor. Return promise.
* src/server/daemon/Daemon.js (_initRouters): Provide configuration.
* src/server/daemon/controller.js
(init): Accept configuration. Handle return of promise from
`_createDocumentServer'.
(_createDocumentServer): Accept configuration, providing to
`DocumentServer#create'. Because of aforementioned change to
`#create', returns promise.
* src/server/request/ServerDataApiFactory.js: Add StoreMissError
import.
(_conf): Add property.
(constructor): [BC BREAK] Accept configuration.
(descLookup): Add override. Look up configuration for provided
dapi.
* 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.
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.
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
It might be the case that we may want to post raw data in the future; in
fact, I can guarantee it. We'll cross that bridge when we come to it.
* src/dapi/http/XhrHttpImpl.js (openRequest): Set ContentType header
on POST
* test/dapi/http/XhrHttpImplTest.js: Modified accordingly
The Data API is being heavily refactored and tested; while moving files into the
Liza repository, I noticed some inefficiencies with the design. These are being
heavily improved upon.