bson 6.3.0 → 6.5.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
@@ -24,6 +24,8 @@ export declare class Binary extends BSONValue {
24
24
  static readonly SUBTYPE_ENCRYPTED = 6;
25
25
  /** Column BSON type */
26
26
  static readonly SUBTYPE_COLUMN = 7;
27
+ /** Sensitive BSON type */
28
+ static readonly SUBTYPE_SENSITIVE = 8;
27
29
  /** User BSON type */
28
30
  static readonly SUBTYPE_USER_DEFINED = 128;
29
31
  buffer: Uint8Array;
@@ -140,12 +142,25 @@ declare namespace BSON {
140
142
  BSONRuntimeError,
141
143
  BSONType,
142
144
  EJSON,
145
+ onDemand,
143
146
  Document,
144
147
  CalculateObjectSizeOptions
145
148
  }
146
149
  }
147
150
  export { BSON }
148
151
 
152
+ /**
153
+ * @public
154
+ * @experimental
155
+ */
156
+ declare type BSONElement = [
157
+ type: number,
158
+ nameOffset: number,
159
+ nameLength: number,
160
+ offset: number,
161
+ length: number
162
+ ];
163
+
149
164
  /**
150
165
  * @public
151
166
  * @category Error
@@ -172,6 +187,21 @@ export declare class BSONError extends Error {
172
187
  static isBSONError(value: unknown): value is BSONError;
173
188
  }
174
189
 
190
+ /**
191
+ * @public
192
+ * @category Error
193
+ *
194
+ * @experimental
195
+ *
196
+ * An error generated when BSON bytes are invalid.
197
+ * Reports the offset the parser was able to reach before encountering the error.
198
+ */
199
+ declare class BSONOffsetError extends BSONError {
200
+ get name(): 'BSONOffsetError';
201
+ offset: number;
202
+ constructor(message: string, offset: number);
203
+ }
204
+
175
205
  /**
176
206
  * A class representation of the BSON RegExp type.
177
207
  * @public
@@ -619,8 +649,6 @@ export declare interface Int32Extended {
619
649
  $numberInt: string;
620
650
  }
621
651
 
622
- declare const kId: unique symbol;
623
-
624
652
  /**
625
653
  * A class representing a 64-bit integer
626
654
  * @public
@@ -993,7 +1021,7 @@ export declare class ObjectId extends BSONValue {
993
1021
  get _bsontype(): 'ObjectId';
994
1022
  /* Excluded from this release type: index */
995
1023
  static cacheHexString: boolean;
996
- /* Excluded from this release type: [kId] */
1024
+ /* Excluded from this release type: buffer */
997
1025
  /* Excluded from this release type: __id */
998
1026
  /**
999
1027
  * Create ObjectId from a number.
@@ -1066,6 +1094,7 @@ export declare class ObjectId extends BSONValue {
1066
1094
  /** Returns the generation date (accurate up to the second) that this ID was generated. */
1067
1095
  getTimestamp(): Date;
1068
1096
  /* Excluded from this release type: createPk */
1097
+ /* Excluded from this release type: serializeInto */
1069
1098
  /**
1070
1099
  * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
1071
1100
  *
@@ -1107,6 +1136,26 @@ export declare interface ObjectIdLike {
1107
1136
  toHexString(): string;
1108
1137
  }
1109
1138
 
1139
+ /**
1140
+ * @experimental
1141
+ * @public
1142
+ *
1143
+ * A new set of BSON APIs that are currently experimental and not intended for production use.
1144
+ */
1145
+ declare type OnDemand = {
1146
+ BSONOffsetError: {
1147
+ new (message: string, offset: number): BSONOffsetError;
1148
+ isBSONError(value: unknown): value is BSONError;
1149
+ };
1150
+ parseToElements: (this: void, bytes: Uint8Array, startOffset?: number) => Iterable<BSONElement>;
1151
+ };
1152
+
1153
+ /**
1154
+ * @experimental
1155
+ * @public
1156
+ */
1157
+ export declare const onDemand: OnDemand;
1158
+
1110
1159
  /**
1111
1160
  * Parse an Extended JSON string, constructing the JavaScript value or object described by that
1112
1161
  * string.