Skip to content

Commit 342e908

Browse files
feat(NODE-5431): add node bindings v6 deprecations (#666)
1 parent 34f0ed4 commit 342e908

File tree

5 files changed

+132
-36
lines changed

5 files changed

+132
-36
lines changed

README.md

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ You can install `mongodb-client-encryption` with the following:
1111
npm install mongodb-client-encryption
1212
```
1313

14-
### Development
15-
#### Setup
14+
### Development
15+
#### Setup
1616

1717
Run the following command to build libmongocrypt and setup the node bindings for development:
1818

@@ -23,10 +23,10 @@ bash ./etc/build-static.sh
2323

2424
#### Testing
2525

26-
Some tests require a standalone server to be running with authentication enabled. Set up a single
26+
Some tests require a standalone server to be running with authentication enabled. Set up a single
2727
server running with the following conditions:
2828

29-
| param | value |
29+
| param | value |
3030
|-----------|-----------|
3131
| host | localhost |
3232
| port | 27017 |
@@ -41,28 +41,35 @@ npm test
4141

4242
# Documentation
4343

44+
## Deprecation Notice
45+
46+
There are breaking changes planned for this package. In the next major version, callbacks will be removed
47+
from the public API on all asynchronous functions. Additionally, the classes documented here will be
48+
moved into [node-mongodb-native](https://github.com/mongodb/node-mongodb-native).
49+
4450
## Classes
4551

4652
<dl>
4753
<dt><a href="#AutoEncrypter">AutoEncrypter</a></dt>
4854
<dd><p>An internal class to be used by the driver for auto encryption
4955
<strong>NOTE</strong>: Not meant to be instantiated directly, this is for internal use only.</p>
5056
</dd>
51-
<dt><a href="#ClientEncryption">ClientEncryption</a></dt>
52-
<dd><p>The public interface for explicit in-use encryption</p>
53-
</dd>
54-
<dt><a href="#MongoCryptError">MongoCryptError</a></dt>
57+
<dt><del><a href="#ClientEncryption">ClientEncryption</a></del></dt>
58+
<dd></dd>
59+
<dt><del><a href="#MongoCryptError">MongoCryptError</a></del></dt>
5560
<dd><p>An error indicating that something went wrong specifically with MongoDB Client Encryption</p>
5661
</dd>
57-
<dt><a href="#MongoCryptCreateDataKeyError">MongoCryptCreateDataKeyError</a></dt>
62+
<dt><del><a href="#MongoCryptCreateDataKeyError">MongoCryptCreateDataKeyError</a></del></dt>
5863
<dd><p>An error indicating that <code>ClientEncryption.createEncryptedCollection()</code> failed to create data keys</p>
5964
</dd>
60-
<dt><a href="#MongoCryptCreateEncryptedCollectionError">MongoCryptCreateEncryptedCollectionError</a></dt>
65+
<dt><del><a href="#MongoCryptCreateEncryptedCollectionError">MongoCryptCreateEncryptedCollectionError</a></del></dt>
6166
<dd><p>An error indicating that <code>ClientEncryption.createEncryptedCollection()</code> failed to create a collection</p>
6267
</dd>
63-
<dt><a href="#MongoCryptAzureKMSRequestError">MongoCryptAzureKMSRequestError</a></dt>
68+
<dt><del><a href="#MongoCryptAzureKMSRequestError">MongoCryptAzureKMSRequestError</a></del></dt>
6469
<dd><p>An error indicating that mongodb-client-encryption failed to auto-refresh Azure KMS credentials.</p>
6570
</dd>
71+
<dt><del><a href="#MongoCryptKMSRequestNetworkTimeoutError">MongoCryptKMSRequestNetworkTimeoutError</a></del></dt>
72+
<dd></dd>
6673
</dl>
6774

6875
## Typedefs
@@ -100,7 +107,7 @@ npm test
100107
Can be used for <a href="ClientEncryption.encrypt">ClientEncryption.encrypt</a>, and can be used to directly
101108
query for the data key itself against the key vault namespace.</p>
102109
</dd>
103-
<dt><a href="#ClientEncryptionCreateDataKeyCallback">ClientEncryptionCreateDataKeyCallback</a> : <code>function</code></dt>
110+
<dt><del><a href="#ClientEncryptionCreateDataKeyCallback">ClientEncryptionCreateDataKeyCallback</a> : <code>function</code></del></dt>
104111
<dd></dd>
105112
<dt><a href="#AWSEncryptionKeyOptions">AWSEncryptionKeyOptions</a> : <code>object</code></dt>
106113
<dd><p>Configuration options for making an AWS encryption key</p>
@@ -113,7 +120,7 @@ query for the data key itself against the key vault namespace.</p>
113120
</dd>
114121
<dt><a href="#RewrapManyDataKeyResult">RewrapManyDataKeyResult</a> : <code>object</code></dt>
115122
<dd></dd>
116-
<dt><a href="#ClientEncryptionEncryptCallback">ClientEncryptionEncryptCallback</a> : <code>function</code></dt>
123+
<dt><del><a href="#ClientEncryptionEncryptCallback">ClientEncryptionEncryptCallback</a> : <code>function</code></del></dt>
117124
<dd></dd>
118125
<dt><a href="#RangeOptions">RangeOptions</a> : <code>object</code></dt>
119126
<dd><p>min, max, sparsity, and range must match the values set in the encryptedFields of the destination collection.
@@ -282,12 +289,12 @@ the underlying C++ Bindings.
282289

283290
<a name="ClientEncryption"></a>
284291

285-
## ClientEncryption
286-
The public interface for explicit in-use encryption
287-
292+
## ~~ClientEncryption~~
293+
***Deprecated***
288294

289-
* [ClientEncryption](#ClientEncryption)
290295

296+
* ~~[ClientEncryption](#ClientEncryption)
297+
~~
291298
* [new ClientEncryption(client, options)](#new_ClientEncryption_new)
292299

293300
* _instance_
@@ -318,8 +325,8 @@ The public interface for explicit in-use encryption
318325
* [.askForKMSCredentials()](#ClientEncryption+askForKMSCredentials)
319326

320327
* _inner_
321-
* [~decryptCallback](#ClientEncryption..decryptCallback)
322-
328+
* ~~[~decryptCallback](#ClientEncryption..decryptCallback)
329+
~~
323330

324331
<a name="new_ClientEncryption_new"></a>
325332

@@ -369,7 +376,7 @@ new ClientEncryption(mongoClient, {
369376
| [options] | <code>object</code> | Options for creating the data key |
370377
| [options.masterKey] | [<code>AWSEncryptionKeyOptions</code>](#AWSEncryptionKeyOptions) \| [<code>AzureEncryptionKeyOptions</code>](#AzureEncryptionKeyOptions) \| [<code>GCPEncryptionKeyOptions</code>](#GCPEncryptionKeyOptions) | Idenfities a new KMS-specific key used to encrypt the new data key |
371378
| [options.keyAltNames] | <code>Array.&lt;string&gt;</code> | An optional list of string alternate names used to reference a key. If a key is created with alternate names, then encryption may refer to the key by the unique alternate name instead of by _id. |
372-
| [callback] | [<code>ClientEncryptionCreateDataKeyCallback</code>](#ClientEncryptionCreateDataKeyCallback) | Optional callback to invoke when key is created |
379+
| [callback] | [<code>ClientEncryptionCreateDataKeyCallback</code>](#ClientEncryptionCreateDataKeyCallback) | DEPRECATED - Callbacks will be removed in the next major version. Optional callback to invoke when key is created |
373380

374381
Creates a data key used for explicit encryption and inserts it into the key vault namespace
375382

@@ -606,7 +613,7 @@ and then create a new collection with the full set of encryptedFields.
606613
| --- | --- | --- |
607614
| value | <code>\*</code> | The value that you wish to serialize. Must be of a type that can be serialized into BSON |
608615
| options | [<code>EncryptOptions</code>](#EncryptOptions) | |
609-
| [callback] | [<code>ClientEncryptionEncryptCallback</code>](#ClientEncryptionEncryptCallback) | Optional callback to invoke when value is encrypted |
616+
| [callback] | [<code>ClientEncryptionEncryptCallback</code>](#ClientEncryptionEncryptCallback) | DEPRECATED: Callbacks will be removed in the next major version. Optional callback to invoke when value is encrypted |
610617

611618
Explicitly encrypt a provided value. Note that either `options.keyId` or `options.keyAltName` must
612619
be specified. Specifying both `options.keyId` and `options.keyAltName` is considered an error.
@@ -662,7 +669,7 @@ Only supported when queryType is "rangePreview" and algorithm is "RangePreview".
662669
| Param | Type | Description |
663670
| --- | --- | --- |
664671
| value | <code>Buffer</code> \| <code>Binary</code> | An encrypted value |
665-
| callback | [<code>decryptCallback</code>](#ClientEncryption..decryptCallback) | Optional callback to invoke when value is decrypted |
672+
| callback | [<code>decryptCallback</code>](#ClientEncryption..decryptCallback) | DEPRECATED - Callbacks will be removed in the next major version. Optional callback to invoke when value is decrypted |
666673

667674
Explicitly decrypt a provided encrypted value
668675

@@ -692,7 +699,9 @@ the original ones.
692699

693700
<a name="ClientEncryption..decryptCallback"></a>
694701

695-
### *ClientEncryption*~decryptCallback
702+
### ~~*ClientEncryption*~decryptCallback~~
703+
***Deprecated***
704+
696705

697706
| Param | Type | Description |
698707
| --- | --- | --- |
@@ -701,22 +710,30 @@ the original ones.
701710

702711
<a name="MongoCryptError"></a>
703712

704-
## MongoCryptError
713+
## ~~MongoCryptError~~
714+
***Deprecated***
715+
705716
An error indicating that something went wrong specifically with MongoDB Client Encryption
706717

707718
<a name="MongoCryptCreateDataKeyError"></a>
708719

709-
## MongoCryptCreateDataKeyError
720+
## ~~MongoCryptCreateDataKeyError~~
721+
***Deprecated***
722+
710723
An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create data keys
711724

712725
<a name="MongoCryptCreateEncryptedCollectionError"></a>
713726

714-
## MongoCryptCreateEncryptedCollectionError
727+
## ~~MongoCryptCreateEncryptedCollectionError~~
728+
***Deprecated***
729+
715730
An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create a collection
716731

717732
<a name="MongoCryptAzureKMSRequestError"></a>
718733

719-
## MongoCryptAzureKMSRequestError
734+
## ~~MongoCryptAzureKMSRequestError~~
735+
***Deprecated***
736+
720737
An error indicating that mongodb-client-encryption failed to auto-refresh Azure KMS credentials.
721738

722739
<a name="new_MongoCryptAzureKMSRequestError_new"></a>
@@ -728,6 +745,11 @@ An error indicating that mongodb-client-encryption failed to auto-refresh Azure
728745
| message | <code>string</code> |
729746
| body | <code>object</code> \| <code>undefined</code> |
730747

748+
<a name="MongoCryptKMSRequestNetworkTimeoutError"></a>
749+
750+
## ~~MongoCryptKMSRequestNetworkTimeoutError~~
751+
***Deprecated***
752+
731753
<a name="BSONValue"></a>
732754

733755
## BSONValue
@@ -821,7 +843,9 @@ query for the data key itself against the key vault namespace.
821843

822844
<a name="ClientEncryptionCreateDataKeyCallback"></a>
823845

824-
## ClientEncryptionCreateDataKeyCallback
846+
## ~~ClientEncryptionCreateDataKeyCallback~~
847+
***Deprecated***
848+
825849

826850
| Param | Type | Description |
827851
| --- | --- | --- |
@@ -881,7 +905,9 @@ Configuration options for making an Azure encryption key
881905

882906
<a name="ClientEncryptionEncryptCallback"></a>
883907

884-
## ClientEncryptionEncryptCallback
908+
## ~~ClientEncryptionEncryptCallback~~
909+
***Deprecated***
910+
885911

886912
| Param | Type | Description |
887913
| --- | --- | --- |

etc/README.hbs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ You can install `mongodb-client-encryption` with the following:
1111
npm install mongodb-client-encryption
1212
```
1313

14-
### Development
15-
#### Setup
14+
### Development
15+
#### Setup
1616

1717
Run the following command to build libmongocrypt and setup the node bindings for development:
1818

@@ -23,10 +23,10 @@ bash ./etc/build-static.sh
2323

2424
#### Testing
2525

26-
Some tests require a standalone server to be running with authentication enabled. Set up a single
26+
Some tests require a standalone server to be running with authentication enabled. Set up a single
2727
server running with the following conditions:
2828

29-
| param | value |
29+
| param | value |
3030
|-----------|-----------|
3131
| host | localhost |
3232
| port | 27017 |
@@ -41,4 +41,10 @@ npm test
4141

4242
# Documentation
4343

44+
## Deprecation Notice
45+
46+
There are breaking changes planned for this package. In the next major version, callbacks will be removed
47+
from the public API on all asynchronous functions. Additionally, the classes documented here will be
48+
moved into [node-mongodb-native](https://github.com/mongodb/node-mongodb-native).
49+
4450
{{>main}}

index.d.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,19 @@ export interface DataKey {
2828
}
2929

3030
/**
31+
* @deprecated This class will be moved into the [Node driver](https://github.com/mongodb/node-mongodb-native)
32+
* in the next major version and must be imported from the driver.
33+
*
3134
* An error indicating that something went wrong specifically with MongoDB Client Encryption
3235
*/
3336
export class MongoCryptError extends Error {
3437
cause?: Error;
3538
}
3639

3740
/**
41+
* @deprecated This class will be moved into the [Node driver](https://github.com/mongodb/node-mongodb-native)
42+
* in the next major version and must be imported from the driver.
43+
*
3844
* An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create a collection
3945
*/
4046
export class MongoCryptCreateEncryptedCollectionError extends MongoCryptError {
@@ -47,6 +53,9 @@ export class MongoCryptCreateEncryptedCollectionError extends MongoCryptError {
4753
}
4854

4955
/**
56+
* @deprecated This class will be moved into the [Node driver](https://github.com/mongodb/node-mongodb-native)
57+
* in the next major version and must be imported from the driver.
58+
*
5059
* An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create data keys
5160
*/
5261
export class MongoCryptCreateDataKeyError extends MongoCryptError {
@@ -59,13 +68,21 @@ export class MongoCryptCreateDataKeyError extends MongoCryptError {
5968
}
6069

6170
/**
71+
* @deprecated This class will be moved into the [Node driver](https://github.com/mongodb/node-mongodb-native)
72+
* in the next major version and must be imported from the driver.
73+
*
6274
* An error indicating that mongodb-client-encryption failed to auto-refresh Azure KMS credentials.
6375
*/
6476
export class MongoCryptAzureKMSRequestError extends MongoCryptError {
6577
/* The body of the IMDS request that produced the error, if present. */
6678
body?: Document ;
6779
}
6880

81+
/**
82+
* @deprecated This class will be moved into the [Node driver](https://github.com/mongodb/node-mongodb-native)
83+
* in the next major version and must be imported from the driver.
84+
*
85+
*/
6986
export class MongoCryptKMSRequestNetworkTimeoutError extends MongoCryptError {}
7087

7188
/**
@@ -78,6 +95,10 @@ export interface ProxyOptions {
7895
proxyPassword?: string;
7996
}
8097

98+
/**
99+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
100+
* use the Promise overloads instead.
101+
*/
81102
export interface ClientEncryptionCreateDataKeyCallback {
82103
/**
83104
* @param error If present, indicates an error that occurred in the creation of the data key
@@ -86,6 +107,10 @@ export interface ClientEncryptionCreateDataKeyCallback {
86107
(error?: Error, dataKeyId?: Binary): void;
87108
}
88109

110+
/**
111+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
112+
* use the Promise overloads instead.
113+
*/
89114
export interface ClientEncryptionEncryptCallback {
90115
/**
91116
* @param error If present, indicates an error that occurred in the process of encryption
@@ -94,6 +119,10 @@ export interface ClientEncryptionEncryptCallback {
94119
(error?: Error, result?: Binary): void;
95120
}
96121

122+
/**
123+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
124+
* use the Promise overloads instead.
125+
*/
97126
export interface ClientEncryptionDecryptCallback {
98127
/**
99128
* @param error If present, indicates an error that occurred in the process of decryption
@@ -479,6 +508,9 @@ export class ClientEncryption {
479508
): Promise<Binary>;
480509

481510
/**
511+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
512+
* use the Promise overloads instead.
513+
*
482514
* Creates a data key used for explicit encryption and inserts it into the key vault namespace
483515
* @param provider The KMS provider used for this data key. Must be `'aws'`, `'azure'`, `'gcp'`, or `'local'`
484516
* @param callback Callback to invoke when key is created
@@ -489,6 +521,9 @@ export class ClientEncryption {
489521
): void;
490522

491523
/**
524+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
525+
* use the Promise overloads instead.
526+
*
492527
* Creates a data key used for explicit encryption and inserts it into the key vault namespace
493528
* @param provider The KMS provider used for this data key. Must be `'aws'`, `'azure'`, `'gcp'`, or `'local'`
494529
* @param options Options for creating the data key
@@ -593,6 +628,9 @@ export class ClientEncryption {
593628
encrypt(value: any, options: ClientEncryptionEncryptOptions): Promise<Binary>;
594629

595630
/**
631+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
632+
* use the Promise overloads instead.
633+
*
596634
* Explicitly encrypt a provided value.
597635
* Note that either options.keyId or options.keyAltName must be specified.
598636
* Specifying both options.keyId and options.keyAltName is considered an error.
@@ -630,6 +668,9 @@ export class ClientEncryption {
630668
decrypt(value: Buffer | Binary): Promise<any>;
631669

632670
/**
671+
* @deprecated Callback overloads are deprecated and will be removed in the next major version. Please
672+
* use the Promise overloads instead.
673+
*
633674
* Explicitly decrypt a provided encrypted value
634675
* @param value An encrypted value
635676
* @param callback Callback to invoke when value is decrypted

0 commit comments

Comments
 (0)