-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
Use Case
As a driver engineer,
I want the FLE bindings in the driver to be modernized and de-duplicated,
So that we can have a modern development environment that matches the driver.
This is part 1 of an internal refactor, part 2 is here: https://jira.mongodb.org/browse/NODE-5470.
User Impact
n/a, internal refactor.
Dependencies
- n/a
Unknowns
- Can we share connection creation logic between the driver and FLE (FLE opens sockets to connect to KMS servers)?
- Follow up ticket, can be done after the FLE refactor.
- Should we attempt to consolidate the Azure kms provider's implementation of `get` with `request` from our utils?
- Not in this PR. The signatures and return types for both utilities are different enough that it doesn't make sense to share them without a larger refactor.
Acceptance Criteria
Implementation Requirements
- Convert to Typescript
- files
-
-
- src/client-side/client-side-encryption/providers/*ts
- src/client-side/client-side-encryption/errors.js
-
- Enable linting for the FLE bindings and fix lint issues as encountered
- Remove all jsdoc types
- If the jsdoc is a doc comment, convert to TSDoc
- If the jsdoc is a type documentation, convert to TS and use the Typescript type instead
- Make all MongoCrypt errors extend from `MongoError`.
- Move credential providers imports of aws credential providers and gcp-metadata into `deps.ts`.
- credential providers already exists and shouldn't require additional work
- create an optional peer dependency for `gcp-metadata`. ensure it is lazy imported.
If all of FLE is converted to TS:
- disable allowJs in the tsconfig
- enable linting for the src/client-side-encryption and test/client-side-encryption directories.
Out of scope:
- Adding overloads for async methods that take callbacks. we plan to remove these later, so we can `ts-expect-error` any TS errors that arise and link to <Jira ticket>
- adding TS support for `maybeCallback` or `maybePromise` (same reason as above)
Testing Requirements
- All FLE unit tests should be converted to Typescript
- credentialProviders.test.js
- requirements.js (only because it needs to be done eventually and may as well do it in the first PR).
- All unit tests and integration tests should pass
- Add unit tests asserting that MongoCryptErrors are subclasses of MongoError.
- Add unit tests asserting that the driver works with / without gcp-metadata following the pattern in `optional_require.test.ts`.
Documentation Requirements
- _Docs changes are deferred to https://jira.mongodb.org/browse/NODE-5423._
Follow Up Requirements
- n/a