Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(idempotency): Add function wrapper and decorator (#1262)
* feat: initial idempotency classes * feat: refactor persistence layer classes into their own folder * feat: rename idempotency config to differentiate from idempotency options * feat: added type for a generic function * feat: remove idempotency configuration for this FR * feat: refactored type of function to accept any combo of parameters * feat: adding PersistenceLayer * feat: PersistenceLayer unit tests for saveInProgress * feat: added saveSuccess * feat: added getRecord * feat: added delete record * feat: branch coverage and cleaning up imports * feat: added more tests * feat: deleted unused methods * feat: added comments * feat: implement get command for dynamo persistence layer * feat: implement get command for dynamo persistence layer * feat: allow for data attr to be passed and return in persistence layer get * feat: added implementation for delete, update, put * feat: create condition on put for not in progress status * feat: use inprogress enum for status * feat: added error when unable to get record for idempotency key * feat: added error for conditional write of an existing record * feat: tests added for put record on dynamo persistence layer * feat: implemented the idempotency record functions for status, expiry, and json response * test: check if the status is expired * test: idempotency record is not expired and status maintained * feat: added tests for get record * feat: add aws-sdk-client-mock jest assertion library * feat: add unit tests for update record and delete record * feat: remove optional chaining from item made unnecessary with error branch * feat: remove unused block * feat: refactored mock child class to be shared amongst dynamo persistence layer tests * test: add path to get the response data from the data record * feat: added branch to handle conditional check failure * feat: add configuration option to dynamo client creation to remove undefined values * feat: change how time is measured to seconds * feat: change type of the response/result to a record * feat:updated imports * feat: added save in progress to handle already existing records in dynamo * feat: add log message for the already in progress error * feat: change the anyfunction type definition to also include a sync function * refactor: create constructor object for dynamo persistence layer * fix: remove temp eslint disable * fix: adjust verbiage on test blocks Co-authored-by: ijemmy <ijemmy@users.noreply.github.com> * style: put constructor parameters onto one line for readability * fix: update dynamo persistence layer tests to use new construtor options * fix: remove unneeded eslint ignore from persistence layer * style: put parameters for dynamo client command object onto one line for readability * fix: move lib-dynamo dep under the correct package * refactor: change idempotency record to use options object in contructor * feat: add consistent read to dynamo persistence layer * fix: revert changes to layer-publisher package-lock * feat added the call to the function in the idempotency handler and add overarching error scenario * feat: add logic to invoke function if it has not already been called; add logic to call the idempotency hander * chore: move and enhance comment on question * chore: update comments * feat: use new record formatting for idempotent function wrapper * test: add test case for issues even getting to save the record in persistence layer * chore: refactoring test suite for idempotent wrapper * chore: clean up comments * feat: added decorator for idempotency * chore: get rid of extra private member on the idempotency handler class * chore: refactor to use class for options * chore: bring in old version of package-locks * chore: update paths for interface * chore: remove env files * chore: rename file * chore: renaming test names and function names for idempotency decorator/wrapper --------- Co-authored-by: vgphoenixcampos <111440293+vgphoenixcampos@users.noreply.github.com> Co-authored-by: jeffrey-baker-vg <jeffrey_w-m_baker@vanguard.com> Co-authored-by: Phoenix Campos <phoenix_campos@vanguard.com> Co-authored-by: ijemmy <ijemmy@users.noreply.github.com>
- Loading branch information