Rather than leaving a token in a DONE state, we should either transition to
ACCEPTED or DEAD depending on whether the token was superceded.
* src/server/dapi/TokenedDataApi.ts (_replyUnlessStale): Accept token when
not superceded, otherwise kill.
[store]: New param.
(request): Use it.
* test/server/dapi/TokenedDataApiTest.ts: Update accordingly.
Just trying to reduce some boilerplate. I kept this as a separate commit to
illustrate clearly how this type of things is done since we'll have people
learning TypeScript.
* src/types/misc.ts (NodeCallback<T,R>): New type.
* src/server/dapi/TokenedDataApi.ts: Use it.
* test/server/dapi/TokenedDataApiTest.ts: Use it.
This integrates the PersistentTokenStore into the DataAPI system via a
decorator. Unfortunately, it requires an API change and propagating data
through the system is a huge mess, which is the topic of a following
commit. The API modification was a compromise.
This modifies the interface of DataApi to include a third parameter. I am
continuing to export the old easejs interface for an incremental migration
away from it. That old interface will be modified next commit, since
it requires modifying a lot of files and will muddy up this commit.
* src/dapi/DataApi.ts: Rename from js. Add types. Add new interface.
Continue exporting old.
* src/server/dapi/TokenedDataApi.ts: New class.
* test/server/dapi/TokenedDataApiTest.ts: New test cases.