* src/server/daemon/controller.js (getUnixTimestamp): New method. Not
ideal, but better than where it was.
(_initExportService): Pass to TokenDao constructor.
* src/server/token/TokenDao.ts (_getTimestamp): New field.
(constructor)[get_timestamp]: New param.
(updateToken): Use it.
* test/server/token/TokenDaoTest.ts: Provide stub timestamp function.
Our coding standards are to create a separate file for classes and
interfaces, but this is a bit different: this "interface" is more like a
struct, and it's used to define the return type of a method of this
class. Since it's inherently coupled, I'm keeping it in the same file.
The idea is that the caller will provide its own abstraction rather than
continuing to export this one. Note that Typescript does support
re-exporting symbols if need be.
* src/server/daemon/controller.js: Adjust import of TokenDao (TS compiles
default modules as `default').
* src/server/service/TokenedService.js: Adjust import of TokenDao.
* src/server/token/TokenDao.ts: Export TokenDao as `default'. Export
TokenData.
* test/server/token/TokenDaoTest.ts: Adjust import of TokenDao. Import
TokenData.
This makes minimal changes to TokenedService, even though there is obvious
refactoring that can be done to reduce duplication, because the class is
currently untested.
* src/server/service/TokenedService.js (_getQuoteToken, generateToken,
killToken, acceptToken, completeToken): Expect promise.
* src/server/token/TokenDao.ts (updateToken, getToken): Remove callback
param, return Promise.
* test/server/token/TokenDaoTest.ts: Use promises.
* package.json.in (devDependencies)[chai-as-promised]: Restrict version.
[@types/chai-as-promised]: Add and restrict to same version. Otherwise,
there is a typescript incompatibility.
This tests the existing state of TokenDao before additional modifications
are made. This commit also further refines the types introduced in a
previous commit.
This is also the first test written in Typescript.
* package.json.in (devDependencies): Add node, chai, and mocha types.
* src/server/token/TokenDao.ts (updateToken): `data` accepts null (as it
should). Do not conditionall add data to object (it doesn't matter for
later retrieval). Note nondeterminism with date. More concise syntax
for object fields.
* src/server/token/TokenQueryResult.ts: Make all fields readonly.
(TokenStatus): Date is no longer optional (see above mention).
* src/types/mongodb.d.ts: Remove generics (erroneously added).
(Collection)[update]: Remove 3-argument declaration (see comment).
* test/server/token/TokenDaoTest.ts: New test case.
This was previously hard-coded to "exports", which is so named because the
system is currently used only to export data to another system.
This change retains the previous functionality.
* src/server/daemon/controller.js (_initExportService): Pass new TokenDao
argument.
* src/server/token/TokenDao.ts (TokenDao)[_rootField]: New property.
(constructor, getToken, _genRoot): Use it.
This adds type information for both MongoCollection and some details about
the structure of the data itself as it is stored in the database.
* src/server/token/TokenDao.ts: Import types from TokenQueryResult.
(TokenType): Move to TokenQueryResult module.
(TokenData)[status]: string=>TokenStatus.
(TokenDao)[_collection]: Remove optional type specifier.
[_collection]: Make readonly.
[updateToken]: Use TokenStatus type for token_entry.
[getToken]: Add return type. Add type for query result. Remove useless
length check (no such field exists). Add types for variables.
[_getLatestToken]: Use interface instead of inline type definition.
[_getRequestedToken]: Use type definition for `data' instead of
`any'. Add type of variable.
* src/server/token/TokenQueryResult.ts: Define structure of data in Mongo.
* src/types/mongodb.d.ts: Add type information for methods used by TokenDao.
This is no longer going to be coupled with the concept of a "service",
though it'll continue to be used by it.
* src/server/daemon/controller.js: Change TokenDao import path.
* src/server/service/TokenedService.js: Likewise.
* src/server/service/TokenDao.ts: Rename (delete).
* src/server/token/TokenDao.ts: New name.
This is the first test of integrating typescript. I'm using the `export ='
syntax to keep imports the same using `require', but note that the `new'
keyword is now required for instantiation (whereas it was not with easejs).
* .gitignore (tsconfig.tsbuildinfo): Ignore generated file (used for
incremental builds).
* Makefile.am (tsout): New variable an recipe.
(modindex, check): Depend on tsout.
* dummy.ts: New (temporary) file. Will be removed once we have at least one
ts file.
* npm-shrinkwrap.json: Update.
* package.json.in (devDependencies)[typescript]: New dependency.
* tsconfig.json: New configuration file.
When a question has been removed, but exists in a bucket for an existing
quote, it cannot find the element to hide and it ends up showing all (or
mostly all) question elements. We are ignoring this case since the
possible side effects of ignoring them are less severe than what happens
now. Additionally, the way this works will be changing in the future.
I've long been opposed to adding this delay, but a proper fix (for deferred,
async rating) that meets the needs of our current project will require
changes that I don't have time to take on for a little while. As such, this
will be a temporary solution for hopefully no more than a month's time.
* src/client/Client.js (_initBeforeLoadHook): Pass value to event in
addition to step id.
* src/client/event/RateEventHandler.js: Implement delay.
DEV-6145
The quicksave feature was added back in 2011 when the framework was somewhat
unstable---we were taking calls from users and it wasn't a pleasent
experience to tell them that they had to refresh the page to work around
some issue with bad state, and lose all unsaved data.
This feature is now more trouble than it's worth, since it causes a number
of bugs and can even cause data corruption. If this is reintroduced in the
future, I'd prefer it be done by periodically saving quote state after every
or a few bucket modifications, to permit Meteor-like features.
This keeps the feature available on the client as a heartbeat for quote
locking; this can be removed in the future when we handle distributed
locking.
* src/client/Client.js (_changeQuote): Stop setting quicksave data from
request.
(_mergeQuickSaveData): Remove now-unused method.
(_createUi): Stop merging quicksave data on render.
(saveStaging): Add note that this method is now only used as a heartbeat.
* src/client/quote/ClientQuote.js (saveStaging): Add comment indicating that
this is now used for a heartbeat.
(setQuickSaveData, getQuickSaveData): Remove methods.
* src/quote/BaseQuote.js (_quickSaveData): Remove field.
(setQuickSaveData, getQuickSaveData): Remove methods.
* src/server/Server.js (initQuote): Do not create or initialize quicksave
data.
(handleQuickSave): Remove method.
* src/server/daemon/controller.js (doRoute): Return empty reply without
processing quicksave data. Continue touching session to retain quote
lock.
* src/server/db/MongoServerDao.js (saveQuote): Do not clear quicksave.
(quickSaveQuote): Remove method.
The PHP objects in the session from PHP7 cannot be unserialized. Since
they are not needed, we can safely ignore them.
Co-Authored-By: Jim Grundner <james.grundner@rtspecialty.com>
The nature of this bug was two-fold:
1.) A new Date was being instantiated with seconds,
but the constructor expects milliseconds.
2.) The expiration period was not cast to a number,
causing an expression to concatenate strings instead of
adding numeric values; this greatly increased the actual
expiration date.
Prior to this change, a single generic message was always shown simply
stating that the quote had been locked. These changes now allow for
different messages to be displayed in different circumstances.