1
0
Fork 0
Commit Graph

740 Commits (d7f01e12c8ef0d3b4f4e9f6598ca65d2558750b1)

Author SHA1 Message Date
Mike Gerwitz 9ea66c0440 TokenDao: Lift out nondeterminism (date)
* 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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 9dd1ae3428 TokenDao: Export as default alongside TokenData
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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz c90757a6d3 TokenDao: Callbacks=>promises
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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 9eb5d6c118 package.json.in: Restrict chai-as-promised and add @types
* 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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 18e86ebfe7 TokenDao: Add test and further refine types
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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 742955a671 TokenDao: Make root field configurable
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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz b83f13f480 TokenDao: Add type information for Mongo interactions
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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz c909599ab5 TokenDao: Move to src/server/{service=>token}
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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 22bfb6071b Makefile.am: Copyright range update 2019-10-17 11:47:14 -04:00
Mike Gerwitz 5fafe4a469 Generate .gitignores for compiled JS files
This will help until all files are typescript.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 5a1b84c271 TokenDao: Typescript conversion
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).
2019-10-17 11:47:14 -04:00
Mike Gerwitz bacefb0752 Build typescript files
* .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.
2019-10-17 11:47:14 -04:00
Mike Gerwitz 4f8aa3c90b FieldVisibilityEventHandler: Fix arrow function notation
This was a syntax recognized back in the day.
2019-10-17 11:47:14 -04:00
Joseph Frazer 20ddff0f6e [DEV-5872] Catch when an element is not present
Merge branch 'jira-5872'

* jira-5872:
  [DEV-5872] Catch when an element is not present
2019-09-26 13:46:50 -04:00
Joseph Frazer 28cac6917f [DEV-5872] Catch when an element is not present
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.
2019-09-26 13:24:39 -04:00
Mike Gerwitz 0553060f42 Add optional rate event delay
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
2019-09-19 10:54:21 -04:00
Joseph Frazer b2c05fb136 [DEV-5657] Check for TLD in email addresses
Merge branch 'jira-5657'

* jira-5657:
  [DEV-5657] Check for TLD in email addresses
2019-09-12 11:29:34 -04: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 27d570578d quicksave: Remove saving and restoring of state
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.
2019-09-04 11:59:36 -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
Mike Gerwitz 2c49156ba3 controller: Add missing returns
This was broken when the controller was made async; the returns were
converted into resolves.
2019-08-28 15:17:04 -04:00
Schaffer, Austin f16d8f53ec [DEV-5752] Allow override for dynamic submit messages
See merge request floss/liza!61
2019-08-01 15:53:13 -04:00
Schaffer, Austin 858efdce84 [DEV-5752] Allow override for dynamic submit messages 2019-08-01 15:53:13 -04:00
Goldsmith, Mark 20b06ee64d [DEV-5618] Expose meta bucket to init route
See merge request floss/liza!60
2019-08-01 13:37:31 -04:00
Mark Goldsmith 6e99e65167 [DEV-5618] Expose meta bucket to init route 2019-08-01 12:20:22 -04:00
Sarah Chintomby c808cbce19 Merge branch 'jira-5546' into 'master'
[DEV-5546]  relativeDate method should work when using an edge case for the month

See merge request floss/liza!59
2019-06-18 12:32:56 -04:00
Sarah Chintomby c55235d7d4 [DEV-5546] Move edge case code for month 2019-06-18 12:14:36 -04:00
Sarah Chintomby 716f2b1a32 [DEV-5546] Update to use setUTCDate 2019-06-18 12:14:36 -04:00
Sarah Chintomby 3372e433d7 [DEV-5546] Update getdate to universal time 2019-06-18 12:14:36 -04:00
Sarah Chintomby 8f0b12bd3a [DEV-5546] Change getdate to getUTCDate 2019-06-18 12:14:36 -04:00
Sarah Chintomby 53f3e2317e [DEV-5546] Fix calc relativedate for day and also month concerning edge cases 2019-06-18 12:14:36 -04:00
Mike Gerwitz 5ad78461de HACKING: Mention semver 2019-06-17 10:55:30 -04:00
Chase Gregory 823e91c8bb [DEV-5333] Expose formatted expiration date 2019-06-17 10:25:56 -04:00
Austin Schaffer 9637fc22e1 [DEV-5333] Pass last rated date from the server quote back to the client quote
Correct and add more elaborate tests for RateEventHandler
2019-06-17 08:28:19 -04:00
Austin Schaffer 23889cbfca [DEV-5333] Use the correct function for day calculations 2019-06-14 10:40:49 -04:00
Austin Schaffer 723a7f7ff7 [DEV-5333] Expose initialRatedDate to the client from the bucket
[DEV-5333] WIP

Add RateEventHandlerTest and fix RatingServiceSubmitNotifyTest

WIP: Add RateEventHandlerTest

Add stubs for RateEventHandlerTest

Finish RateEventHandlerTest

Move done to fix test bug
2019-06-14 10:40:46 -04:00
Joseph Frazer 2f0fea8f49 Revert "[DEV-5492] Do not unserialize PHP objects in _sf2_attributes"
This reverts commit 981ba45d7c, reversing
changes made to e5917418fa.
2019-06-11 10:36:07 -04:00
Joseph Frazer 981ba45d7c [DEV-5492] Do not unserialize PHP objects in _sf2_attributes
Merge branch 'jira-5492'

* jira-5492:
  Revert "[DEV-5492] Add basic tests for UserSession.js"
  [DEV-5492] Do not unserialize PHP objects in _sf2_attributes
  [DEV-5492] Add basic tests for UserSession.js
2019-06-10 13:28:49 -04:00
Joseph Frazer 2b2b3fe78c Revert "[DEV-5492] Add basic tests for UserSession.js"
This reverts commit 29822599d6.
2019-06-10 11:52:51 -04:00
Joseph Frazer 5b08c981c3 [DEV-5492] Do not unserialize PHP objects in _sf2_attributes
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>
2019-06-10 11:19:04 -04:00
Joseph Frazer 29822599d6 [DEV-5492] Add basic tests for UserSession.js 2019-06-10 11:15:49 -04:00
Mark Goldsmith e5917418fa [DEV-5255] Fix setStartDate to use startData
See merge request floss/liza!56
2019-06-06 16:49:45 -04:00
Mark Goldsmith 6e65b1f1e6 [DEV-5255] Fix setStartDate to use startData 2019-06-06 15:29:01 -04:00
Corey Vollmer 8285fe629c [DEV-3514] Fix bug with expiration date calculation
See merge request floss/liza!55
2019-05-30 14:30:48 -04:00
Andrew Fanton 0be64040f8 [DEV-3514] Fix bug with expiration date calculation
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.
2019-05-30 14:29:55 -04:00
Corey Vollmer e8c468a13b Merge branch 'jira-5254' into 'master'
[DEV-5254] Expose last rated timestamp with other metadata

See merge request floss/liza!54
2019-05-30 14:26:37 -04:00
Austin Schaffer c1082d2a9d [DEV-5254] Expose lastPremDate for the data warehouse 2019-05-30 10:15:25 -04:00
Mike Gerwitz 6edd5297a2 Lock quotes past expiration date 2019-05-29 15:09:37 -04:00
Andrew Fanton f569a7e94d [DEV-3514] Display message explaining why quote is locked
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.
2019-05-28 16:33:08 -04:00
Andrew Fanton 5a5c2ca629 [DEV-3514] Lock quotes that exceed expiration date 2019-05-28 16:33:05 -04:00