bson 6.2.0 → 6.4.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.
package/bson.d.ts CHANGED
@@ -150,14 +150,16 @@ export { BSON }
150
150
  * @public
151
151
  * @category Error
152
152
  *
153
- * `BSONError` objects are thrown when BSON ecounters an error.
153
+ * `BSONError` objects are thrown when BSON encounters an error.
154
154
  *
155
155
  * This is the parent class for all the other errors thrown by this library.
156
156
  */
157
157
  export declare class BSONError extends Error {
158
158
  /* Excluded from this release type: bsonError */
159
159
  get name(): string;
160
- constructor(message: string);
160
+ constructor(message: string, options?: {
161
+ cause?: unknown;
162
+ });
161
163
  /**
162
164
  * @public
163
165
  *
@@ -617,8 +619,6 @@ export declare interface Int32Extended {
617
619
  $numberInt: string;
618
620
  }
619
621
 
620
- declare const kId: unique symbol;
621
-
622
622
  /**
623
623
  * A class representing a 64-bit integer
624
624
  * @public
@@ -991,12 +991,45 @@ export declare class ObjectId extends BSONValue {
991
991
  get _bsontype(): 'ObjectId';
992
992
  /* Excluded from this release type: index */
993
993
  static cacheHexString: boolean;
994
- /* Excluded from this release type: [kId] */
994
+ /* Excluded from this release type: buffer */
995
995
  /* Excluded from this release type: __id */
996
996
  /**
997
- * Create an ObjectId type
997
+ * Create ObjectId from a number.
998
+ *
999
+ * @param inputId - A number.
1000
+ * @deprecated Instead, use `static createFromTime()` to set a numeric value for the new ObjectId.
1001
+ */
1002
+ constructor(inputId: number);
1003
+ /**
1004
+ * Create ObjectId from a 24 character hex string.
1005
+ *
1006
+ * @param inputId - A 24 character hex string.
1007
+ */
1008
+ constructor(inputId: string);
1009
+ /**
1010
+ * Create ObjectId from the BSON ObjectId type.
1011
+ *
1012
+ * @param inputId - The BSON ObjectId type.
1013
+ */
1014
+ constructor(inputId: ObjectId);
1015
+ /**
1016
+ * Create ObjectId from the object type that has the toHexString method.
1017
+ *
1018
+ * @param inputId - The ObjectIdLike type.
1019
+ */
1020
+ constructor(inputId: ObjectIdLike);
1021
+ /**
1022
+ * Create ObjectId from a 12 byte binary Buffer.
1023
+ *
1024
+ * @param inputId - A 12 byte binary Buffer.
1025
+ */
1026
+ constructor(inputId: Uint8Array);
1027
+ /** To generate a new ObjectId, use ObjectId() with no argument. */
1028
+ constructor();
1029
+ /**
1030
+ * Implementation overload.
998
1031
  *
999
- * @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.
1032
+ * @param inputId - All input types that are used in the constructor implementation.
1000
1033
  */
1001
1034
  constructor(inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array);
1002
1035
  /**
@@ -1031,6 +1064,7 @@ export declare class ObjectId extends BSONValue {
1031
1064
  /** Returns the generation date (accurate up to the second) that this ID was generated. */
1032
1065
  getTimestamp(): Date;
1033
1066
  /* Excluded from this release type: createPk */
1067
+ /* Excluded from this release type: serializeInto */
1034
1068
  /**
1035
1069
  * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
1036
1070
  *