mongodb 6.7.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +20 -1
  2. package/lib/bson.js.map +1 -1
  3. package/lib/client-side-encryption/auto_encrypter.js +8 -61
  4. package/lib/client-side-encryption/auto_encrypter.js.map +1 -1
  5. package/lib/client-side-encryption/client_encryption.js +5 -5
  6. package/lib/client-side-encryption/client_encryption.js.map +1 -1
  7. package/lib/client-side-encryption/providers/index.js.map +1 -1
  8. package/lib/client-side-encryption/state_machine.js +15 -11
  9. package/lib/client-side-encryption/state_machine.js.map +1 -1
  10. package/lib/cmap/connection.js +22 -20
  11. package/lib/cmap/connection.js.map +1 -1
  12. package/lib/cmap/wire_protocol/on_demand/document.js +8 -5
  13. package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -1
  14. package/lib/cmap/wire_protocol/responses.js +116 -40
  15. package/lib/cmap/wire_protocol/responses.js.map +1 -1
  16. package/lib/collection.js +13 -2
  17. package/lib/collection.js.map +1 -1
  18. package/lib/constants.js +9 -1
  19. package/lib/constants.js.map +1 -1
  20. package/lib/cursor/abstract_cursor.js +231 -285
  21. package/lib/cursor/abstract_cursor.js.map +1 -1
  22. package/lib/cursor/aggregation_cursor.js +11 -19
  23. package/lib/cursor/aggregation_cursor.js.map +1 -1
  24. package/lib/cursor/change_stream_cursor.js +12 -14
  25. package/lib/cursor/change_stream_cursor.js.map +1 -1
  26. package/lib/cursor/find_cursor.js +64 -84
  27. package/lib/cursor/find_cursor.js.map +1 -1
  28. package/lib/cursor/list_collections_cursor.js +0 -1
  29. package/lib/cursor/list_collections_cursor.js.map +1 -1
  30. package/lib/cursor/list_indexes_cursor.js +0 -1
  31. package/lib/cursor/list_indexes_cursor.js.map +1 -1
  32. package/lib/cursor/run_command_cursor.js +4 -6
  33. package/lib/cursor/run_command_cursor.js.map +1 -1
  34. package/lib/error.js +10 -23
  35. package/lib/error.js.map +1 -1
  36. package/lib/index.js.map +1 -1
  37. package/lib/operations/aggregate.js +2 -2
  38. package/lib/operations/aggregate.js.map +1 -1
  39. package/lib/operations/bulk_write.js +1 -2
  40. package/lib/operations/bulk_write.js.map +1 -1
  41. package/lib/operations/command.js +2 -3
  42. package/lib/operations/command.js.map +1 -1
  43. package/lib/operations/execute_operation.js.map +1 -1
  44. package/lib/operations/find.js +2 -1
  45. package/lib/operations/find.js.map +1 -1
  46. package/lib/operations/get_more.js +1 -1
  47. package/lib/operations/get_more.js.map +1 -1
  48. package/lib/operations/indexes.js +2 -1
  49. package/lib/operations/indexes.js.map +1 -1
  50. package/lib/operations/list_collections.js +2 -1
  51. package/lib/operations/list_collections.js.map +1 -1
  52. package/lib/operations/run_command.js +1 -1
  53. package/lib/operations/run_command.js.map +1 -1
  54. package/lib/operations/update.js +2 -1
  55. package/lib/operations/update.js.map +1 -1
  56. package/lib/sdam/server.js +7 -2
  57. package/lib/sdam/server.js.map +1 -1
  58. package/lib/sessions.js +1 -1
  59. package/lib/sessions.js.map +1 -1
  60. package/lib/utils.js +45 -1
  61. package/lib/utils.js.map +1 -1
  62. package/lib/write_concern.js +17 -1
  63. package/lib/write_concern.js.map +1 -1
  64. package/mongodb.d.ts +187 -150
  65. package/package.json +2 -2
  66. package/src/bson.ts +1 -0
  67. package/src/client-side-encryption/auto_encrypter.ts +9 -70
  68. package/src/client-side-encryption/client_encryption.ts +33 -19
  69. package/src/client-side-encryption/providers/index.ts +118 -92
  70. package/src/client-side-encryption/state_machine.ts +22 -18
  71. package/src/cmap/connection.ts +46 -50
  72. package/src/cmap/wire_protocol/on_demand/document.ts +13 -6
  73. package/src/cmap/wire_protocol/responses.ts +140 -45
  74. package/src/collection.ts +25 -5
  75. package/src/constants.ts +9 -0
  76. package/src/cursor/abstract_cursor.ts +280 -373
  77. package/src/cursor/aggregation_cursor.ts +24 -33
  78. package/src/cursor/change_stream_cursor.ts +31 -48
  79. package/src/cursor/find_cursor.ts +77 -92
  80. package/src/cursor/list_collections_cursor.ts +3 -4
  81. package/src/cursor/list_indexes_cursor.ts +3 -4
  82. package/src/cursor/run_command_cursor.ts +13 -19
  83. package/src/error.ts +20 -30
  84. package/src/index.ts +19 -10
  85. package/src/operations/aggregate.ts +12 -5
  86. package/src/operations/bulk_write.ts +1 -2
  87. package/src/operations/command.ts +17 -3
  88. package/src/operations/delete.ts +2 -2
  89. package/src/operations/execute_operation.ts +0 -13
  90. package/src/operations/find.ts +7 -3
  91. package/src/operations/find_and_modify.ts +1 -1
  92. package/src/operations/get_more.ts +6 -10
  93. package/src/operations/indexes.ts +7 -3
  94. package/src/operations/list_collections.ts +8 -3
  95. package/src/operations/run_command.ts +16 -6
  96. package/src/operations/update.ts +2 -1
  97. package/src/sdam/server.ts +7 -2
  98. package/src/sessions.ts +1 -1
  99. package/src/utils.ts +52 -2
  100. package/src/write_concern.ts +18 -0
  101. package/lib/operations/count_documents.js +0 -31
  102. package/lib/operations/count_documents.js.map +0 -1
  103. package/src/operations/count_documents.ts +0 -46
package/mongodb.d.ts CHANGED
@@ -10,20 +10,27 @@ import type { ConnectionOptions as ConnectionOptions_2 , TLSSocket , TLSSocketOp
10
10
 
11
11
  /** @public */
12
12
  export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> {
13
- /* Excluded from this release type: [kId] */
14
- /* Excluded from this release type: [kSession] */
15
- /* Excluded from this release type: [kServer] */
16
- /* Excluded from this release type: [kNamespace] */
17
- /* Excluded from this release type: [kDocuments] */
18
- /* Excluded from this release type: [kClient] */
19
- /* Excluded from this release type: [kTransform] */
20
- /* Excluded from this release type: [kInitialized] */
21
- /* Excluded from this release type: [kClosed] */
22
- /* Excluded from this release type: [kKilled] */
23
- /* Excluded from this release type: [kOptions] */
13
+ /* Excluded from this release type: cursorId */
14
+ /* Excluded from this release type: cursorSession */
15
+ /* Excluded from this release type: selectedServer */
16
+ /* Excluded from this release type: cursorNamespace */
17
+ /* Excluded from this release type: documents */
18
+ /* Excluded from this release type: cursorClient */
19
+ /* Excluded from this release type: transform */
20
+ /* Excluded from this release type: initialized */
21
+ /* Excluded from this release type: isClosed */
22
+ /* Excluded from this release type: isKilled */
23
+ /* Excluded from this release type: cursorOptions */
24
24
  /** @event */
25
25
  static readonly CLOSE: "close";
26
26
  /* Excluded from this release type: __constructor */
27
+ /**
28
+ * The cursor has no id until it receives a response from the initial cursor creating command.
29
+ *
30
+ * It is non-zero for as long as the database has an open cursor.
31
+ *
32
+ * The initiating command may receive a zero id if the entire result is in the `firstBatch`.
33
+ */
27
34
  get id(): Long | undefined;
28
35
  /* Excluded from this release type: isDead */
29
36
  /* Excluded from this release type: client */
@@ -33,8 +40,14 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
33
40
  get readConcern(): ReadConcern | undefined;
34
41
  /* Excluded from this release type: session */
35
42
  /* Excluded from this release type: session */
36
- /* Excluded from this release type: cursorOptions */
43
+ /**
44
+ * The cursor is closed and all remaining locally buffered documents have been iterated.
45
+ */
37
46
  get closed(): boolean;
47
+ /**
48
+ * A `killCursors` command was attempted on this cursor.
49
+ * This is performed if the cursor id is non zero.
50
+ */
38
51
  get killed(): boolean;
39
52
  get loadBalanced(): boolean;
40
53
  /** Returns current buffered documents length */
@@ -153,7 +166,13 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
153
166
  abstract clone(): AbstractCursor<TSchema>;
154
167
  /* Excluded from this release type: _initialize */
155
168
  /* Excluded from this release type: getMore */
156
- /* Excluded from this release type: [kInit] */
169
+ /* Excluded from this release type: cursorInit */
170
+ /* Excluded from this release type: fetchBatch */
171
+ /* Excluded from this release type: cleanup */
172
+ /* Excluded from this release type: hasEmittedClose */
173
+ /* Excluded from this release type: emitClose */
174
+ /* Excluded from this release type: transformDocument */
175
+ /* Excluded from this release type: throwIfInitialized */
157
176
  }
158
177
 
159
178
  /** @public */
@@ -351,10 +370,9 @@ export declare interface AggregateOptions extends CommandOperationOptions {
351
370
  * @public
352
371
  */
353
372
  export declare class AggregationCursor<TSchema = any> extends AbstractCursor<TSchema> {
354
- /* Excluded from this release type: [kPipeline] */
355
- /* Excluded from this release type: [kOptions] */
373
+ readonly pipeline: Document[];
374
+ /* Excluded from this release type: aggregateOptions */
356
375
  /* Excluded from this release type: __constructor */
357
- get pipeline(): Document[];
358
376
  clone(): AggregationCursor<TSchema>;
359
377
  map<T>(transform: (doc: TSchema) => T): AggregationCursor<T>;
360
378
  /* Excluded from this release type: _initialize */
@@ -731,6 +749,23 @@ export declare interface AWSEncryptionKeyOptions {
731
749
  endpoint?: string | undefined;
732
750
  }
733
751
 
752
+ /** @public */
753
+ export declare interface AWSKMSProviderConfiguration {
754
+ /**
755
+ * The access key used for the AWS KMS provider
756
+ */
757
+ accessKeyId: string;
758
+ /**
759
+ * The secret access key used for the AWS KMS provider
760
+ */
761
+ secretAccessKey: string;
762
+ /**
763
+ * An optional AWS session token that will be used as the
764
+ * X-Amz-Security-Token header for AWS requests.
765
+ */
766
+ sessionToken?: string;
767
+ }
768
+
734
769
  /**
735
770
  * @public
736
771
  * Configuration options for making an Azure encryption key
@@ -750,6 +785,34 @@ export declare interface AzureEncryptionKeyOptions {
750
785
  keyVersion?: string | undefined;
751
786
  }
752
787
 
788
+ /** @public */
789
+ export declare type AzureKMSProviderConfiguration = {
790
+ /**
791
+ * The tenant ID identifies the organization for the account
792
+ */
793
+ tenantId: string;
794
+ /**
795
+ * The client ID to authenticate a registered application
796
+ */
797
+ clientId: string;
798
+ /**
799
+ * The client secret to authenticate a registered application
800
+ */
801
+ clientSecret: string;
802
+ /**
803
+ * If present, a host with optional port. E.g. "example.com" or "example.com:443".
804
+ * This is optional, and only needed if customer is using a non-commercial Azure instance
805
+ * (e.g. a government or China account, which use different URLs).
806
+ * Defaults to "login.microsoftonline.com"
807
+ */
808
+ identityPlatformEndpoint?: string | undefined;
809
+ } | {
810
+ /**
811
+ * If present, an access token to authenticate with Azure.
812
+ */
813
+ accessToken: string;
814
+ };
815
+
753
816
  /**
754
817
  * Keeps the state of a unordered batch so we can rewrite the results
755
818
  * correctly after command execution
@@ -784,6 +847,7 @@ export declare type BitwiseFilter = number /** numeric bit mask */ | Binary /**
784
847
 
785
848
  export { BSON }
786
849
 
850
+ /* Excluded from this release type: BSONElement */
787
851
  export { BSONRegExp }
788
852
 
789
853
  /**
@@ -1074,8 +1138,6 @@ export declare class ChangeStream<TSchema extends Document = Document, TChange e
1074
1138
  /* Excluded from this release type: _processErrorIteratorMode */
1075
1139
  }
1076
1140
 
1077
- /* Excluded from this release type: ChangeStreamAggregateRawResult */
1078
-
1079
1141
  /**
1080
1142
  * Only present when the `showExpandedEvents` flag is enabled.
1081
1143
  * @public
@@ -1754,7 +1816,7 @@ export declare interface ClientEncryptionCreateDataKeyProviderOptions {
1754
1816
  /**
1755
1817
  * Identifies a new KMS-specific key used to encrypt the new data key
1756
1818
  */
1757
- masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined;
1819
+ masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | KMIPEncryptionKeyOptions | undefined;
1758
1820
  /**
1759
1821
  * An optional list of string alternate names used to reference a key.
1760
1822
  * If a key is created with alternate names, then encryption may refer to the key by the unique alternate name instead of by _id.
@@ -1766,8 +1828,15 @@ export declare interface ClientEncryptionCreateDataKeyProviderOptions {
1766
1828
 
1767
1829
  /**
1768
1830
  * @public
1831
+ *
1832
+ * A data key provider. Allowed values:
1833
+ *
1834
+ * - aws, gcp, local, kmip or azure
1835
+ * - (`mongodb-client-encryption>=6.0.1` only) a named key, in the form of:
1836
+ * `aws:<name>`, `gcp:<name>`, `local:<name>`, `kmip:<name>`, `azure:<name>`
1837
+ * where `name` is an alphanumeric string, underscores allowed.
1769
1838
  */
1770
- export declare type ClientEncryptionDataKeyProvider = 'aws' | 'azure' | 'gcp' | 'local' | 'kmip';
1839
+ export declare type ClientEncryptionDataKeyProvider = keyof KMSProviders;
1771
1840
 
1772
1841
  /**
1773
1842
  * @public
@@ -1860,16 +1929,7 @@ export declare interface ClientEncryptionOptions {
1860
1929
  */
1861
1930
  export declare interface ClientEncryptionRewrapManyDataKeyProviderOptions {
1862
1931
  provider: ClientEncryptionDataKeyProvider;
1863
- masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined;
1864
- }
1865
-
1866
- /**
1867
- * @public
1868
- * @experimental
1869
- */
1870
- export declare interface ClientEncryptionRewrapManyDataKeyProviderOptions {
1871
- provider: ClientEncryptionDataKeyProvider;
1872
- masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined;
1932
+ masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | KMIPEncryptionKeyOptions | undefined;
1873
1933
  }
1874
1934
 
1875
1935
  /**
@@ -3064,7 +3124,7 @@ export declare interface ConnectOptions {
3064
3124
  export declare interface CountDocumentsOptions extends AggregateOptions {
3065
3125
  /** The number of documents to skip. */
3066
3126
  skip?: number;
3067
- /** The maximum amounts to count before aborting. */
3127
+ /** The maximum amount of documents to consider. */
3068
3128
  limit?: number;
3069
3129
  }
3070
3130
 
@@ -3168,6 +3228,7 @@ export declare type CSFLEKMSTlsOptions = {
3168
3228
  kmip?: ClientEncryptionTlsOptions;
3169
3229
  local?: ClientEncryptionTlsOptions;
3170
3230
  azure?: ClientEncryptionTlsOptions;
3231
+ [key: string]: ClientEncryptionTlsOptions | undefined;
3171
3232
  };
3172
3233
 
3173
3234
  /** @public */
@@ -3582,8 +3643,6 @@ export declare type EventEmitterWithState = {
3582
3643
  */
3583
3644
  export declare type EventsDescription = Record<string, GenericListener>;
3584
3645
 
3585
- /* Excluded from this release type: ExecutionResult */
3586
-
3587
3646
  /* Excluded from this release type: Explain */
3588
3647
 
3589
3648
  /** @public */
@@ -3662,9 +3721,9 @@ export declare interface FilterOperators<TValue> extends NonObjectIdLikeDocument
3662
3721
 
3663
3722
  /** @public */
3664
3723
  export declare class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
3665
- /* Excluded from this release type: [kFilter] */
3666
- /* Excluded from this release type: [kNumReturned] */
3667
- /* Excluded from this release type: [kBuiltOptions] */
3724
+ /* Excluded from this release type: cursorFilter */
3725
+ /* Excluded from this release type: numReturned */
3726
+ /* Excluded from this release type: findOptions */
3668
3727
  /* Excluded from this release type: __constructor */
3669
3728
  clone(): FindCursor<TSchema>;
3670
3729
  map<T>(transform: (doc: TSchema) => T): FindCursor<T>;
@@ -3990,6 +4049,28 @@ export declare interface GCPEncryptionKeyOptions {
3990
4049
  endpoint?: string | undefined;
3991
4050
  }
3992
4051
 
4052
+ /** @public */
4053
+ export declare type GCPKMSProviderConfiguration = {
4054
+ /**
4055
+ * The service account email to authenticate
4056
+ */
4057
+ email: string;
4058
+ /**
4059
+ * A PKCS#8 encrypted key. This can either be a base64 string or a binary representation
4060
+ */
4061
+ privateKey: string | Buffer;
4062
+ /**
4063
+ * If present, a host with optional port. E.g. "example.com" or "example.com:443".
4064
+ * Defaults to "oauth2.googleapis.com"
4065
+ */
4066
+ endpoint?: string | undefined;
4067
+ } | {
4068
+ /**
4069
+ * If present, an access token to authenticate with GCP.
4070
+ */
4071
+ accessToken: string;
4072
+ };
4073
+
3993
4074
  /** @public */
3994
4075
  export declare type GenericListener = (...args: any[]) => void;
3995
4076
 
@@ -4381,6 +4462,8 @@ export declare type InferIdType<TSchema> = TSchema extends {
4381
4462
  _id?: infer IdType;
4382
4463
  } ? unknown extends IdType ? ObjectId : IdType : ObjectId;
4383
4464
 
4465
+ /* Excluded from this release type: InitialCursorResponse */
4466
+
4384
4467
  /** @public */
4385
4468
  export declare interface InsertManyResult<TSchema = Document> {
4386
4469
  /** Indicates whether this write result was acknowledged. If not, then all other members of this result will be undefined */
@@ -4435,8 +4518,6 @@ export declare type Join<T extends unknown[], D extends string> = T extends [] ?
4435
4518
 
4436
4519
  /* Excluded from this release type: kBeforeHandshake */
4437
4520
 
4438
- /* Excluded from this release type: kBuiltOptions */
4439
-
4440
4521
  /* Excluded from this release type: kCancellationToken */
4441
4522
 
4442
4523
  /* Excluded from this release type: kCancellationToken_2 */
@@ -4447,12 +4528,8 @@ export declare type Join<T extends unknown[], D extends string> = T extends [] ?
4447
4528
 
4448
4529
  /* Excluded from this release type: kCheckedOut */
4449
4530
 
4450
- /* Excluded from this release type: kClient */
4451
-
4452
4531
  /* Excluded from this release type: kClosed */
4453
4532
 
4454
- /* Excluded from this release type: kClosed_2 */
4455
-
4456
4533
  /* Excluded from this release type: kConnectionCounter */
4457
4534
 
4458
4535
  /* Excluded from this release type: kConnections */
@@ -4461,8 +4538,6 @@ export declare type Join<T extends unknown[], D extends string> = T extends [] ?
4461
4538
 
4462
4539
  /* Excluded from this release type: kDecorateResult */
4463
4540
 
4464
- /* Excluded from this release type: kDocuments */
4465
-
4466
4541
  /* Excluded from this release type: kErrorLabels */
4467
4542
 
4468
4543
  /** @public */
@@ -4475,24 +4550,47 @@ export declare type KeysOfOtherType<TSchema, Type> = {
4475
4550
  [key in keyof TSchema]: NonNullable<TSchema[key]> extends Type ? never : key;
4476
4551
  }[keyof TSchema];
4477
4552
 
4478
- /* Excluded from this release type: kFilter */
4479
-
4480
4553
  /* Excluded from this release type: kGeneration */
4481
4554
 
4482
- /* Excluded from this release type: kId */
4483
-
4484
- /* Excluded from this release type: kInit */
4485
-
4486
- /* Excluded from this release type: kInitialized */
4487
-
4488
4555
  /* Excluded from this release type: kInternalClient */
4489
4556
 
4490
- /* Excluded from this release type: kKilled */
4491
-
4492
4557
  /* Excluded from this release type: kMetrics */
4493
4558
 
4494
4559
  /* Excluded from this release type: kMinPoolSizeTimer */
4495
4560
 
4561
+ /**
4562
+ * @public
4563
+ * Configuration options for making a KMIP encryption key
4564
+ */
4565
+ export declare interface KMIPEncryptionKeyOptions {
4566
+ /**
4567
+ * keyId is the KMIP Unique Identifier to a 96 byte KMIP Secret Data managed object.
4568
+ *
4569
+ * If keyId is omitted, a random 96 byte KMIP Secret Data managed object will be created.
4570
+ */
4571
+ keyId?: string;
4572
+ /**
4573
+ * Host with optional port.
4574
+ */
4575
+ endpoint?: string;
4576
+ /**
4577
+ * If true, this key should be decrypted by the KMIP server.
4578
+ *
4579
+ * Requires `mongodb-client-encryption>=6.0.1`.
4580
+ */
4581
+ delegated?: boolean;
4582
+ }
4583
+
4584
+ /** @public */
4585
+ export declare interface KMIPKMSProviderConfiguration {
4586
+ /**
4587
+ * The output endpoint string.
4588
+ * The endpoint consists of a hostname and port separated by a colon.
4589
+ * E.g. "example.com:123". A port is always present.
4590
+ */
4591
+ endpoint?: string;
4592
+ }
4593
+
4496
4594
  /* Excluded from this release type: kMode */
4497
4595
 
4498
4596
  /* Excluded from this release type: kMonitorId */
@@ -4500,117 +4598,43 @@ export declare type KeysOfOtherType<TSchema, Type> = {
4500
4598
  /**
4501
4599
  * @public
4502
4600
  * Configuration options that are used by specific KMS providers during key generation, encryption, and decryption.
4601
+ *
4602
+ * Named KMS providers _are not supported_ for automatic KMS credential fetching.
4503
4603
  */
4504
4604
  export declare interface KMSProviders {
4505
4605
  /**
4506
4606
  * Configuration options for using 'aws' as your KMS provider
4507
4607
  */
4508
- aws?: {
4509
- /**
4510
- * The access key used for the AWS KMS provider
4511
- */
4512
- accessKeyId: string;
4513
- /**
4514
- * The secret access key used for the AWS KMS provider
4515
- */
4516
- secretAccessKey: string;
4517
- /**
4518
- * An optional AWS session token that will be used as the
4519
- * X-Amz-Security-Token header for AWS requests.
4520
- */
4521
- sessionToken?: string;
4522
- } | Record<string, never>;
4608
+ aws?: AWSKMSProviderConfiguration | Record<string, never>;
4609
+ [key: `aws:${string}`]: AWSKMSProviderConfiguration;
4523
4610
  /**
4524
4611
  * Configuration options for using 'local' as your KMS provider
4525
4612
  */
4526
- local?: {
4527
- /**
4528
- * The master key used to encrypt/decrypt data keys.
4529
- * A 96-byte long Buffer or base64 encoded string.
4530
- */
4531
- key: Buffer | string;
4532
- };
4613
+ local?: LocalKMSProviderConfiguration;
4614
+ [key: `local:${string}`]: LocalKMSProviderConfiguration;
4533
4615
  /**
4534
4616
  * Configuration options for using 'kmip' as your KMS provider
4535
4617
  */
4536
- kmip?: {
4537
- /**
4538
- * The output endpoint string.
4539
- * The endpoint consists of a hostname and port separated by a colon.
4540
- * E.g. "example.com:123". A port is always present.
4541
- */
4542
- endpoint?: string;
4543
- };
4618
+ kmip?: KMIPKMSProviderConfiguration;
4619
+ [key: `kmip:${string}`]: KMIPKMSProviderConfiguration;
4544
4620
  /**
4545
4621
  * Configuration options for using 'azure' as your KMS provider
4546
4622
  */
4547
- azure?: {
4548
- /**
4549
- * The tenant ID identifies the organization for the account
4550
- */
4551
- tenantId: string;
4552
- /**
4553
- * The client ID to authenticate a registered application
4554
- */
4555
- clientId: string;
4556
- /**
4557
- * The client secret to authenticate a registered application
4558
- */
4559
- clientSecret: string;
4560
- /**
4561
- * If present, a host with optional port. E.g. "example.com" or "example.com:443".
4562
- * This is optional, and only needed if customer is using a non-commercial Azure instance
4563
- * (e.g. a government or China account, which use different URLs).
4564
- * Defaults to "login.microsoftonline.com"
4565
- */
4566
- identityPlatformEndpoint?: string | undefined;
4567
- } | {
4568
- /**
4569
- * If present, an access token to authenticate with Azure.
4570
- */
4571
- accessToken: string;
4572
- } | Record<string, never>;
4623
+ azure?: AzureKMSProviderConfiguration | Record<string, never>;
4624
+ [key: `azure:${string}`]: AzureKMSProviderConfiguration;
4573
4625
  /**
4574
4626
  * Configuration options for using 'gcp' as your KMS provider
4575
4627
  */
4576
- gcp?: {
4577
- /**
4578
- * The service account email to authenticate
4579
- */
4580
- email: string;
4581
- /**
4582
- * A PKCS#8 encrypted key. This can either be a base64 string or a binary representation
4583
- */
4584
- privateKey: string | Buffer;
4585
- /**
4586
- * If present, a host with optional port. E.g. "example.com" or "example.com:443".
4587
- * Defaults to "oauth2.googleapis.com"
4588
- */
4589
- endpoint?: string | undefined;
4590
- } | {
4591
- /**
4592
- * If present, an access token to authenticate with GCP.
4593
- */
4594
- accessToken: string;
4595
- } | Record<string, never>;
4628
+ gcp?: GCPKMSProviderConfiguration | Record<string, never>;
4629
+ [key: `gcp:${string}`]: GCPKMSProviderConfiguration;
4596
4630
  }
4597
4631
 
4598
- /* Excluded from this release type: kNamespace */
4599
-
4600
- /* Excluded from this release type: kNumReturned */
4601
-
4602
4632
  /* Excluded from this release type: kOptions */
4603
4633
 
4604
- /* Excluded from this release type: kOptions_2 */
4605
-
4606
- /* Excluded from this release type: kOptions_3 */
4607
-
4608
4634
  /* Excluded from this release type: kPending */
4609
4635
 
4610
4636
  /* Excluded from this release type: kPinnedConnection */
4611
4637
 
4612
- /* Excluded from this release type: kPipeline */
4613
-
4614
4638
  /* Excluded from this release type: kPoolState */
4615
4639
 
4616
4640
  /* Excluded from this release type: kProcessingWaitQueue */
@@ -4619,8 +4643,6 @@ export declare interface KMSProviders {
4619
4643
 
4620
4644
  /* Excluded from this release type: kServer_2 */
4621
4645
 
4622
- /* Excluded from this release type: kServer_3 */
4623
-
4624
4646
  /* Excluded from this release type: kServerError */
4625
4647
 
4626
4648
  /* Excluded from this release type: kServerSession */
@@ -4629,14 +4651,10 @@ export declare interface KMSProviders {
4629
4651
 
4630
4652
  /* Excluded from this release type: kSession */
4631
4653
 
4632
- /* Excluded from this release type: kSession_2 */
4633
-
4634
4654
  /* Excluded from this release type: kSnapshotEnabled */
4635
4655
 
4636
4656
  /* Excluded from this release type: kSnapshotTime */
4637
4657
 
4638
- /* Excluded from this release type: kTransform */
4639
-
4640
4658
  /* Excluded from this release type: kTxnNumberIncrement */
4641
4659
 
4642
4660
  /* Excluded from this release type: kWaitQueue */
@@ -4715,6 +4733,15 @@ export declare class ListSearchIndexesCursor extends AggregationCursor<{
4715
4733
  /** @public */
4716
4734
  export declare type ListSearchIndexesOptions = Omit<AggregateOptions, 'readConcern' | 'writeConcern'>;
4717
4735
 
4736
+ /** @public */
4737
+ export declare interface LocalKMSProviderConfiguration {
4738
+ /**
4739
+ * The master key used to encrypt/decrypt data keys.
4740
+ * A 96-byte long Buffer or base64 encoded string.
4741
+ */
4742
+ key: Binary | Uint8Array | string;
4743
+ }
4744
+
4718
4745
  /* Excluded from this release type: Log */
4719
4746
 
4720
4747
  /* Excluded from this release type: LogComponentSeveritiesClientOptions */
@@ -6191,7 +6218,9 @@ export declare class MongoUnexpectedServerResponseError extends MongoRuntimeErro
6191
6218
  *
6192
6219
  * @public
6193
6220
  **/
6194
- constructor(message: string);
6221
+ constructor(message: string, options?: {
6222
+ cause?: Error;
6223
+ });
6195
6224
  get name(): string;
6196
6225
  }
6197
6226
 
@@ -6201,8 +6230,8 @@ export declare class MongoUnexpectedServerResponseError extends MongoRuntimeErro
6201
6230
  * @category Error
6202
6231
  */
6203
6232
  export declare class MongoWriteConcernError extends MongoServerError {
6204
- /** The result document (provided if ok: 1) */
6205
- result?: Document;
6233
+ /** The result document */
6234
+ result: Document;
6206
6235
  /**
6207
6236
  * **Do not use this constructor!**
6208
6237
  *
@@ -6214,7 +6243,15 @@ export declare class MongoWriteConcernError extends MongoServerError {
6214
6243
  *
6215
6244
  * @public
6216
6245
  **/
6217
- constructor(message: ErrorDescription, result?: Document);
6246
+ constructor(result: {
6247
+ writeConcernError: {
6248
+ code: number;
6249
+ errmsg: string;
6250
+ codeName?: string;
6251
+ errInfo?: Document;
6252
+ };
6253
+ errorLabels?: string[];
6254
+ });
6218
6255
  get name(): string;
6219
6256
  }
6220
6257
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "6.7.0",
3
+ "version": "6.8.0",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -98,7 +98,7 @@
98
98
  "js-yaml": "^4.1.0",
99
99
  "mocha": "^10.4.0",
100
100
  "mocha-sinon": "^2.1.2",
101
- "mongodb-client-encryption": "^6.0.0",
101
+ "mongodb-client-encryption": "^6.0.1",
102
102
  "mongodb-legacy": "^6.0.1",
103
103
  "nyc": "^15.1.0",
104
104
  "prettier": "^2.8.8",
package/src/bson.ts CHANGED
@@ -27,6 +27,7 @@ export {
27
27
  UUID
28
28
  } from 'bson';
29
29
 
30
+ /** @internal */
30
31
  export type BSONElement = BSON.OnDemand['BSONElement'];
31
32
 
32
33
  export function parseToElementsToArray(bytes: Uint8Array, offset?: number): BSONElement[] {