bson 4.6.0 → 4.6.3

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 (58) hide show
  1. package/bower.json +1 -1
  2. package/bson-ts34.d.ts +1133 -0
  3. package/bson.d.ts +1228 -1118
  4. package/dist/bson.browser.esm.js +40 -35
  5. package/dist/bson.browser.esm.js.map +1 -1
  6. package/dist/bson.browser.umd.js +40 -35
  7. package/dist/bson.browser.umd.js.map +1 -1
  8. package/dist/bson.bundle.js +40 -35
  9. package/dist/bson.bundle.js.map +1 -1
  10. package/dist/bson.esm.js +40 -35
  11. package/dist/bson.esm.js.map +1 -1
  12. package/lib/binary.js +1 -0
  13. package/lib/binary.js.map +1 -1
  14. package/lib/code.js +1 -0
  15. package/lib/code.js.map +1 -1
  16. package/lib/db_ref.js +1 -0
  17. package/lib/db_ref.js.map +1 -1
  18. package/lib/decimal128.js +9 -1
  19. package/lib/decimal128.js.map +1 -1
  20. package/lib/double.js +1 -0
  21. package/lib/double.js.map +1 -1
  22. package/lib/int_32.js +1 -0
  23. package/lib/int_32.js.map +1 -1
  24. package/lib/long.js +1 -0
  25. package/lib/long.js.map +1 -1
  26. package/lib/max_key.js +1 -0
  27. package/lib/max_key.js.map +1 -1
  28. package/lib/min_key.js +1 -0
  29. package/lib/min_key.js.map +1 -1
  30. package/lib/objectid.js +10 -20
  31. package/lib/objectid.js.map +1 -1
  32. package/lib/parser/calculate_size.js +2 -2
  33. package/lib/parser/calculate_size.js.map +1 -1
  34. package/lib/parser/serializer.js +6 -11
  35. package/lib/parser/serializer.js.map +1 -1
  36. package/lib/regexp.js +1 -0
  37. package/lib/regexp.js.map +1 -1
  38. package/lib/symbol.js +1 -0
  39. package/lib/symbol.js.map +1 -1
  40. package/lib/timestamp.js +4 -1
  41. package/lib/timestamp.js.map +1 -1
  42. package/package.json +11 -3
  43. package/src/binary.ts +1 -0
  44. package/src/code.ts +1 -0
  45. package/src/db_ref.ts +1 -0
  46. package/src/decimal128.ts +8 -1
  47. package/src/double.ts +1 -0
  48. package/src/int_32.ts +1 -0
  49. package/src/long.ts +1 -0
  50. package/src/max_key.ts +1 -0
  51. package/src/min_key.ts +1 -0
  52. package/src/objectid.ts +13 -29
  53. package/src/parser/calculate_size.ts +2 -2
  54. package/src/parser/serializer.ts +6 -8
  55. package/src/regexp.ts +1 -0
  56. package/src/symbol.ts +1 -0
  57. package/src/timestamp.ts +4 -1
  58. package/HISTORY.md +0 -572
package/bson-ts34.d.ts ADDED
@@ -0,0 +1,1133 @@
1
+ import { Buffer } from 'buffer';
2
+ /**
3
+ * A class representation of the BSON Binary type.
4
+ * @public
5
+ * @category BSONType
6
+ */
7
+ export declare class Binary {
8
+ _bsontype: 'Binary';
9
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */
10
+ /** Initial buffer default size */
11
+ static readonly BUFFER_SIZE = 256;
12
+ /** Default BSON type */
13
+ static readonly SUBTYPE_DEFAULT = 0;
14
+ /** Function BSON type */
15
+ static readonly SUBTYPE_FUNCTION = 1;
16
+ /** Byte Array BSON type */
17
+ static readonly SUBTYPE_BYTE_ARRAY = 2;
18
+ /** Deprecated UUID BSON type @deprecated Please use SUBTYPE_UUID */
19
+ static readonly SUBTYPE_UUID_OLD = 3;
20
+ /** UUID BSON type */
21
+ static readonly SUBTYPE_UUID = 4;
22
+ /** MD5 BSON type */
23
+ static readonly SUBTYPE_MD5 = 5;
24
+ /** Encrypted BSON type */
25
+ static readonly SUBTYPE_ENCRYPTED = 6;
26
+ /** Column BSON type */
27
+ static readonly SUBTYPE_COLUMN = 7;
28
+ /** User BSON type */
29
+ static readonly SUBTYPE_USER_DEFINED = 128;
30
+ buffer: Buffer;
31
+ sub_type: number;
32
+ position: number;
33
+ /**
34
+ * @param buffer - a buffer object containing the binary data.
35
+ * @param subType - the option binary type.
36
+ */
37
+ constructor(buffer?: string | BinarySequence, subType?: number);
38
+ /**
39
+ * Updates this binary with byte_value.
40
+ *
41
+ * @param byteValue - a single byte we wish to write.
42
+ */
43
+ put(byteValue: string | number | Uint8Array | Buffer | number[]): void;
44
+ /**
45
+ * Writes a buffer or string to the binary.
46
+ *
47
+ * @param sequence - a string or buffer to be written to the Binary BSON object.
48
+ * @param offset - specify the binary of where to write the content.
49
+ */
50
+ write(sequence: string | BinarySequence, offset: number): void;
51
+ /**
52
+ * Reads **length** bytes starting at **position**.
53
+ *
54
+ * @param position - read from the given position in the Binary.
55
+ * @param length - the number of bytes to read.
56
+ */
57
+ read(position: number, length: number): BinarySequence;
58
+ /**
59
+ * Returns the value of this binary as a string.
60
+ * @param asRaw - Will skip converting to a string
61
+ * @remarks
62
+ * This is handy when calling this function conditionally for some key value pairs and not others
63
+ */
64
+ value(asRaw?: boolean): string | BinarySequence;
65
+ /** the length of the binary sequence */
66
+ length(): number;
67
+ toJSON(): string;
68
+ toString(format?: string): string;
69
+ /* Excluded from this release type: toExtendedJSON */
70
+ toUUID(): UUID;
71
+ /* Excluded from this release type: fromExtendedJSON */
72
+ inspect(): string;
73
+ }
74
+ /** @public */
75
+ export declare interface BinaryExtended {
76
+ $binary: {
77
+ subType: string;
78
+ base64: string;
79
+ };
80
+ }
81
+ /** @public */
82
+ export declare interface BinaryExtendedLegacy {
83
+ $type: string;
84
+ $binary: string;
85
+ }
86
+ /** @public */
87
+ export declare type BinarySequence = Uint8Array | Buffer | number[];
88
+ /**
89
+ * BSON default export
90
+ * @deprecated Please use named exports
91
+ * @privateRemarks
92
+ * We want to someday deprecate the default export,
93
+ * so none of the new TS types are being exported on the default
94
+ * @public
95
+ */
96
+ declare const BSON: {
97
+ Binary: typeof Binary;
98
+ Code: typeof Code;
99
+ DBRef: typeof DBRef;
100
+ Decimal128: typeof Decimal128;
101
+ Double: typeof Double;
102
+ Int32: typeof Int32;
103
+ Long: typeof Long;
104
+ UUID: typeof UUID;
105
+ Map: MapConstructor;
106
+ MaxKey: typeof MaxKey;
107
+ MinKey: typeof MinKey;
108
+ ObjectId: typeof ObjectId;
109
+ ObjectID: typeof ObjectId;
110
+ BSONRegExp: typeof BSONRegExp;
111
+ BSONSymbol: typeof BSONSymbol;
112
+ Timestamp: typeof Timestamp;
113
+ EJSON: typeof EJSON;
114
+ setInternalBufferSize: typeof setInternalBufferSize;
115
+ serialize: typeof serialize;
116
+ serializeWithBufferAndIndex: typeof serializeWithBufferAndIndex;
117
+ deserialize: typeof deserialize;
118
+ calculateObjectSize: typeof calculateObjectSize;
119
+ deserializeStream: typeof deserializeStream;
120
+ BSONError: typeof BSONError;
121
+ BSONTypeError: typeof BSONTypeError;
122
+ };
123
+ export default BSON;
124
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_BYTE_ARRAY */
125
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_COLUMN */
126
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */
127
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_ENCRYPTED */
128
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_FUNCTION */
129
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_MD5 */
130
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_USER_DEFINED */
131
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_UUID */
132
+ /* Excluded from this release type: BSON_BINARY_SUBTYPE_UUID_NEW */
133
+ /* Excluded from this release type: BSON_DATA_ARRAY */
134
+ /* Excluded from this release type: BSON_DATA_BINARY */
135
+ /* Excluded from this release type: BSON_DATA_BOOLEAN */
136
+ /* Excluded from this release type: BSON_DATA_CODE */
137
+ /* Excluded from this release type: BSON_DATA_CODE_W_SCOPE */
138
+ /* Excluded from this release type: BSON_DATA_DATE */
139
+ /* Excluded from this release type: BSON_DATA_DBPOINTER */
140
+ /* Excluded from this release type: BSON_DATA_DECIMAL128 */
141
+ /* Excluded from this release type: BSON_DATA_INT */
142
+ /* Excluded from this release type: BSON_DATA_LONG */
143
+ /* Excluded from this release type: BSON_DATA_MAX_KEY */
144
+ /* Excluded from this release type: BSON_DATA_MIN_KEY */
145
+ /* Excluded from this release type: BSON_DATA_NULL */
146
+ /* Excluded from this release type: BSON_DATA_NUMBER */
147
+ /* Excluded from this release type: BSON_DATA_OBJECT */
148
+ /* Excluded from this release type: BSON_DATA_OID */
149
+ /* Excluded from this release type: BSON_DATA_REGEXP */
150
+ /* Excluded from this release type: BSON_DATA_STRING */
151
+ /* Excluded from this release type: BSON_DATA_SYMBOL */
152
+ /* Excluded from this release type: BSON_DATA_TIMESTAMP */
153
+ /* Excluded from this release type: BSON_DATA_UNDEFINED */
154
+ /* Excluded from this release type: BSON_INT32_MAX */
155
+ /* Excluded from this release type: BSON_INT32_MIN */
156
+ /* Excluded from this release type: BSON_INT64_MAX */
157
+ /* Excluded from this release type: BSON_INT64_MIN */
158
+ /** @public */
159
+ export declare class BSONError extends Error {
160
+ constructor(message: string);
161
+ readonly name: string;
162
+ }
163
+ /**
164
+ * A class representation of the BSON RegExp type.
165
+ * @public
166
+ * @category BSONType
167
+ */
168
+ export declare class BSONRegExp {
169
+ _bsontype: 'BSONRegExp';
170
+ pattern: string;
171
+ options: string;
172
+ /**
173
+ * @param pattern - The regular expression pattern to match
174
+ * @param options - The regular expression options
175
+ */
176
+ constructor(pattern: string, options?: string);
177
+ static parseOptions(options?: string): string;
178
+ }
179
+ /** @public */
180
+ export declare interface BSONRegExpExtended {
181
+ $regularExpression: {
182
+ pattern: string;
183
+ options: string;
184
+ };
185
+ }
186
+ /** @public */
187
+ export declare interface BSONRegExpExtendedLegacy {
188
+ $regex: string | BSONRegExp;
189
+ $options: string;
190
+ }
191
+ /**
192
+ * A class representation of the BSON Symbol type.
193
+ * @public
194
+ * @category BSONType
195
+ */
196
+ export declare class BSONSymbol {
197
+ _bsontype: 'Symbol';
198
+ value: string;
199
+ /**
200
+ * @param value - the string representing the symbol.
201
+ */
202
+ constructor(value: string);
203
+ /** Access the wrapped string value. */
204
+ valueOf(): string;
205
+ toString(): string;
206
+ /* Excluded from this release type: inspect */
207
+ toJSON(): string;
208
+ }
209
+ /** @public */
210
+ export declare interface BSONSymbolExtended {
211
+ $symbol: string;
212
+ }
213
+ /** @public */
214
+ export declare class BSONTypeError extends TypeError {
215
+ constructor(message: string);
216
+ readonly name: string;
217
+ }
218
+ /**
219
+ * Calculate the bson size for a passed in Javascript object.
220
+ *
221
+ * @param object - the Javascript object to calculate the BSON byte size for
222
+ * @returns size of BSON object in bytes
223
+ * @public
224
+ */
225
+ export declare function calculateObjectSize(object: Document, options?: CalculateObjectSizeOptions): number;
226
+ /** @public */
227
+ export declare type CalculateObjectSizeOptions = Pick<SerializeOptions, 'serializeFunctions' | 'ignoreUndefined'>;
228
+ /**
229
+ * A class representation of the BSON Code type.
230
+ * @public
231
+ * @category BSONType
232
+ */
233
+ export declare class Code {
234
+ _bsontype: 'Code';
235
+ code: string | Function;
236
+ scope?: Document;
237
+ /**
238
+ * @param code - a string or function.
239
+ * @param scope - an optional scope for the function.
240
+ */
241
+ constructor(code: string | Function, scope?: Document);
242
+ toJSON(): {
243
+ code: string | Function;
244
+ scope?: Document;
245
+ };
246
+ /* Excluded from this release type: toExtendedJSON */
247
+ /* Excluded from this release type: fromExtendedJSON */
248
+ inspect(): string;
249
+ }
250
+ /** @public */
251
+ export declare interface CodeExtended {
252
+ $code: string | Function;
253
+ $scope?: Document;
254
+ }
255
+ /**
256
+ * A class representation of the BSON DBRef type.
257
+ * @public
258
+ * @category BSONType
259
+ */
260
+ export declare class DBRef {
261
+ _bsontype: 'DBRef';
262
+ collection: string;
263
+ oid: ObjectId;
264
+ db?: string;
265
+ fields: Document;
266
+ /**
267
+ * @param collection - the collection name.
268
+ * @param oid - the reference ObjectId.
269
+ * @param db - optional db name, if omitted the reference is local to the current db.
270
+ */
271
+ constructor(collection: string, oid: ObjectId, db?: string, fields?: Document);
272
+ /* Excluded from this release type: namespace */
273
+ /* Excluded from this release type: namespace */
274
+ toJSON(): DBRefLike & Document;
275
+ /* Excluded from this release type: toExtendedJSON */
276
+ /* Excluded from this release type: fromExtendedJSON */
277
+ inspect(): string;
278
+ }
279
+ /** @public */
280
+ export declare interface DBRefLike {
281
+ $ref: string;
282
+ $id: ObjectId;
283
+ $db?: string;
284
+ }
285
+ /**
286
+ * A class representation of the BSON Decimal128 type.
287
+ * @public
288
+ * @category BSONType
289
+ */
290
+ export declare class Decimal128 {
291
+ _bsontype: 'Decimal128';
292
+ readonly bytes: Buffer;
293
+ /**
294
+ * @param bytes - a buffer containing the raw Decimal128 bytes in little endian order,
295
+ * or a string representation as returned by .toString()
296
+ */
297
+ constructor(bytes: Buffer | string);
298
+ /**
299
+ * Create a Decimal128 instance from a string representation
300
+ *
301
+ * @param representation - a numeric string representation.
302
+ */
303
+ static fromString(representation: string): Decimal128;
304
+ /** Create a string representation of the raw Decimal128 value */
305
+ toString(): string;
306
+ toJSON(): Decimal128Extended;
307
+ /* Excluded from this release type: toExtendedJSON */
308
+ /* Excluded from this release type: fromExtendedJSON */
309
+ inspect(): string;
310
+ }
311
+ /** @public */
312
+ export declare interface Decimal128Extended {
313
+ $numberDecimal: string;
314
+ }
315
+ /**
316
+ * Deserialize data as BSON.
317
+ *
318
+ * @param buffer - the buffer containing the serialized set of BSON documents.
319
+ * @returns returns the deserialized Javascript Object.
320
+ * @public
321
+ */
322
+ export declare function deserialize(buffer: Buffer | ArrayBufferView | ArrayBuffer, options?: DeserializeOptions): Document;
323
+ /** @public */
324
+ export declare interface DeserializeOptions {
325
+ /** evaluate functions in the BSON document scoped to the object deserialized. */
326
+ evalFunctions?: boolean;
327
+ /** cache evaluated functions for reuse. */
328
+ cacheFunctions?: boolean;
329
+ /**
330
+ * use a crc32 code for caching, otherwise use the string of the function.
331
+ * @deprecated this option to use the crc32 function never worked as intended
332
+ * due to the fact that the crc32 function itself was never implemented.
333
+ * */
334
+ cacheFunctionsCrc32?: boolean;
335
+ /** when deserializing a Long will fit it into a Number if it's smaller than 53 bits */
336
+ promoteLongs?: boolean;
337
+ /** when deserializing a Binary will return it as a node.js Buffer instance. */
338
+ promoteBuffers?: boolean;
339
+ /** when deserializing will promote BSON values to their Node.js closest equivalent types. */
340
+ promoteValues?: boolean;
341
+ /** allow to specify if there what fields we wish to return as unserialized raw buffer. */
342
+ fieldsAsRaw?: Document;
343
+ /** return BSON regular expressions as BSONRegExp instances. */
344
+ bsonRegExp?: boolean;
345
+ /** allows the buffer to be larger than the parsed BSON object */
346
+ allowObjectSmallerThanBufferSize?: boolean;
347
+ /** Offset into buffer to begin reading document from */
348
+ index?: number;
349
+ raw?: boolean;
350
+ /** Allows for opt-out utf-8 validation for all keys or
351
+ * specified keys. Must be all true or all false.
352
+ *
353
+ * @example
354
+ * ```js
355
+ * // disables validation on all keys
356
+ * validation: { utf8: false }
357
+ *
358
+ * // enables validation only on specified keys a, b, and c
359
+ * validation: { utf8: { a: true, b: true, c: true } }
360
+ *
361
+ * // disables validation only on specified keys a, b
362
+ * validation: { utf8: { a: false, b: false } }
363
+ * ```
364
+ */
365
+ validation?: {
366
+ utf8: boolean | Record<string, true> | Record<string, false>;
367
+ };
368
+ }
369
+ /**
370
+ * Deserialize stream data as BSON documents.
371
+ *
372
+ * @param data - the buffer containing the serialized set of BSON documents.
373
+ * @param startIndex - the start index in the data Buffer where the deserialization is to start.
374
+ * @param numberOfDocuments - number of documents to deserialize.
375
+ * @param documents - an array where to store the deserialized documents.
376
+ * @param docStartIndex - the index in the documents array from where to start inserting documents.
377
+ * @param options - additional options used for the deserialization.
378
+ * @returns next index in the buffer after deserialization **x** numbers of documents.
379
+ * @public
380
+ */
381
+ export declare function deserializeStream(data: Buffer | ArrayBufferView | ArrayBuffer, startIndex: number, numberOfDocuments: number, documents: Document[], docStartIndex: number, options: DeserializeOptions): number;
382
+ /** @public */
383
+ export declare interface Document {
384
+ [key: string]: any;
385
+ }
386
+ /**
387
+ * A class representation of the BSON Double type.
388
+ * @public
389
+ * @category BSONType
390
+ */
391
+ export declare class Double {
392
+ _bsontype: 'Double';
393
+ value: number;
394
+ /**
395
+ * Create a Double type
396
+ *
397
+ * @param value - the number we want to represent as a double.
398
+ */
399
+ constructor(value: number);
400
+ /**
401
+ * Access the number value.
402
+ *
403
+ * @returns returns the wrapped double number.
404
+ */
405
+ valueOf(): number;
406
+ toJSON(): number;
407
+ toString(radix?: number): string;
408
+ /* Excluded from this release type: toExtendedJSON */
409
+ /* Excluded from this release type: fromExtendedJSON */
410
+ inspect(): string;
411
+ }
412
+ /** @public */
413
+ export declare interface DoubleExtended {
414
+ $numberDouble: string;
415
+ }
416
+ /**
417
+ * EJSON parse / stringify API
418
+ * @public
419
+ */
420
+ export declare namespace EJSON {
421
+ export interface Options {
422
+ /** Output using the Extended JSON v1 spec */
423
+ legacy?: boolean;
424
+ /** Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types */
425
+ relaxed?: boolean;
426
+ /**
427
+ * Disable Extended JSON's `relaxed` mode, which attempts to return BSON types where possible, rather than native JS types
428
+ * @deprecated Please use the relaxed property instead
429
+ */
430
+ strict?: boolean;
431
+ }
432
+ /**
433
+ * Parse an Extended JSON string, constructing the JavaScript value or object described by that
434
+ * string.
435
+ *
436
+ * @example
437
+ * ```js
438
+ * const { EJSON } = require('bson');
439
+ * const text = '{ "int32": { "$numberInt": "10" } }';
440
+ *
441
+ * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
442
+ * console.log(EJSON.parse(text, { relaxed: false }));
443
+ *
444
+ * // prints { int32: 10 }
445
+ * console.log(EJSON.parse(text));
446
+ * ```
447
+ */
448
+ export function parse(text: string, options?: EJSON.Options): SerializableTypes;
449
+ export type JSONPrimitive = string | number | boolean | null;
450
+ export type SerializableTypes = Document | Array<JSONPrimitive | Document> | JSONPrimitive;
451
+ /**
452
+ * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
453
+ * function is specified or optionally including only the specified properties if a replacer array
454
+ * is specified.
455
+ *
456
+ * @param value - The value to convert to extended JSON
457
+ * @param replacer - A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
458
+ * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes.
459
+ * @param options - Optional settings
460
+ *
461
+ * @example
462
+ * ```js
463
+ * const { EJSON } = require('bson');
464
+ * const Int32 = require('mongodb').Int32;
465
+ * const doc = { int32: new Int32(10) };
466
+ *
467
+ * // prints '{"int32":{"$numberInt":"10"}}'
468
+ * console.log(EJSON.stringify(doc, { relaxed: false }));
469
+ *
470
+ * // prints '{"int32":10}'
471
+ * console.log(EJSON.stringify(doc));
472
+ * ```
473
+ */
474
+ export function stringify(value: SerializableTypes, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSON.Options, space?: string | number, options?: EJSON.Options): string;
475
+ /**
476
+ * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.
477
+ *
478
+ * @param value - The object to serialize
479
+ * @param options - Optional settings passed to the `stringify` function
480
+ */
481
+ export function serialize(value: SerializableTypes, options?: EJSON.Options): Document;
482
+ /**
483
+ * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types
484
+ *
485
+ * @param ejson - The Extended JSON object to deserialize
486
+ * @param options - Optional settings passed to the parse method
487
+ */
488
+ export function deserialize(ejson: Document, options?: EJSON.Options): SerializableTypes;
489
+ }
490
+ /** @public */
491
+ export declare type EJSONOptions = EJSON.Options;
492
+ /**
493
+ * A class representation of a BSON Int32 type.
494
+ * @public
495
+ * @category BSONType
496
+ */
497
+ export declare class Int32 {
498
+ _bsontype: 'Int32';
499
+ value: number;
500
+ /**
501
+ * Create an Int32 type
502
+ *
503
+ * @param value - the number we want to represent as an int32.
504
+ */
505
+ constructor(value: number | string);
506
+ /**
507
+ * Access the number value.
508
+ *
509
+ * @returns returns the wrapped int32 number.
510
+ */
511
+ valueOf(): number;
512
+ toString(radix?: number): string;
513
+ toJSON(): number;
514
+ /* Excluded from this release type: toExtendedJSON */
515
+ /* Excluded from this release type: fromExtendedJSON */
516
+ inspect(): string;
517
+ }
518
+ /** @public */
519
+ export declare interface Int32Extended {
520
+ $numberInt: string;
521
+ }
522
+ declare const kId: unique symbol;
523
+ declare const kId_2: unique symbol;
524
+ /**
525
+ * A class representing a 64-bit integer
526
+ * @public
527
+ * @category BSONType
528
+ * @remarks
529
+ * The internal representation of a long is the two given signed, 32-bit values.
530
+ * We use 32-bit pieces because these are the size of integers on which
531
+ * Javascript performs bit-operations. For operations like addition and
532
+ * multiplication, we split each number into 16 bit pieces, which can easily be
533
+ * multiplied within Javascript's floating-point representation without overflow
534
+ * or change in sign.
535
+ * In the algorithms below, we frequently reduce the negative case to the
536
+ * positive case by negating the input(s) and then post-processing the result.
537
+ * Note that we must ALWAYS check specially whether those values are MIN_VALUE
538
+ * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
539
+ * a positive number, it overflows back into a negative). Not handling this
540
+ * case would often result in infinite recursion.
541
+ * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class.
542
+ */
543
+ export declare class Long {
544
+ _bsontype: 'Long';
545
+ /** An indicator used to reliably determine if an object is a Long or not. */
546
+ __isLong__: true;
547
+ /**
548
+ * The high 32 bits as a signed value.
549
+ */
550
+ high: number;
551
+ /**
552
+ * The low 32 bits as a signed value.
553
+ */
554
+ low: number;
555
+ /**
556
+ * Whether unsigned or not.
557
+ */
558
+ unsigned: boolean;
559
+ /**
560
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
561
+ * See the from* functions below for more convenient ways of constructing Longs.
562
+ *
563
+ * Acceptable signatures are:
564
+ * - Long(low, high, unsigned?)
565
+ * - Long(bigint, unsigned?)
566
+ * - Long(string, unsigned?)
567
+ *
568
+ * @param low - The low (signed) 32 bits of the long
569
+ * @param high - The high (signed) 32 bits of the long
570
+ * @param unsigned - Whether unsigned or not, defaults to signed
571
+ */
572
+ constructor(low?: number | bigint | string, high?: number | boolean, unsigned?: boolean);
573
+ static TWO_PWR_24: Long;
574
+ /** Maximum unsigned value. */
575
+ static MAX_UNSIGNED_VALUE: Long;
576
+ /** Signed zero */
577
+ static ZERO: Long;
578
+ /** Unsigned zero. */
579
+ static UZERO: Long;
580
+ /** Signed one. */
581
+ static ONE: Long;
582
+ /** Unsigned one. */
583
+ static UONE: Long;
584
+ /** Signed negative one. */
585
+ static NEG_ONE: Long;
586
+ /** Maximum signed value. */
587
+ static MAX_VALUE: Long;
588
+ /** Minimum signed value. */
589
+ static MIN_VALUE: Long;
590
+ /**
591
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits.
592
+ * Each is assumed to use 32 bits.
593
+ * @param lowBits - The low 32 bits
594
+ * @param highBits - The high 32 bits
595
+ * @param unsigned - Whether unsigned or not, defaults to signed
596
+ * @returns The corresponding Long value
597
+ */
598
+ static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
599
+ /**
600
+ * Returns a Long representing the given 32 bit integer value.
601
+ * @param value - The 32 bit integer in question
602
+ * @param unsigned - Whether unsigned or not, defaults to signed
603
+ * @returns The corresponding Long value
604
+ */
605
+ static fromInt(value: number, unsigned?: boolean): Long;
606
+ /**
607
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
608
+ * @param value - The number in question
609
+ * @param unsigned - Whether unsigned or not, defaults to signed
610
+ * @returns The corresponding Long value
611
+ */
612
+ static fromNumber(value: number, unsigned?: boolean): Long;
613
+ /**
614
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
615
+ * @param value - The number in question
616
+ * @param unsigned - Whether unsigned or not, defaults to signed
617
+ * @returns The corresponding Long value
618
+ */
619
+ static fromBigInt(value: bigint, unsigned?: boolean): Long;
620
+ /**
621
+ * Returns a Long representation of the given string, written using the specified radix.
622
+ * @param str - The textual representation of the Long
623
+ * @param unsigned - Whether unsigned or not, defaults to signed
624
+ * @param radix - The radix in which the text is written (2-36), defaults to 10
625
+ * @returns The corresponding Long value
626
+ */
627
+ static fromString(str: string, unsigned?: boolean, radix?: number): Long;
628
+ /**
629
+ * Creates a Long from its byte representation.
630
+ * @param bytes - Byte representation
631
+ * @param unsigned - Whether unsigned or not, defaults to signed
632
+ * @param le - Whether little or big endian, defaults to big endian
633
+ * @returns The corresponding Long value
634
+ */
635
+ static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
636
+ /**
637
+ * Creates a Long from its little endian byte representation.
638
+ * @param bytes - Little endian byte representation
639
+ * @param unsigned - Whether unsigned or not, defaults to signed
640
+ * @returns The corresponding Long value
641
+ */
642
+ static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
643
+ /**
644
+ * Creates a Long from its big endian byte representation.
645
+ * @param bytes - Big endian byte representation
646
+ * @param unsigned - Whether unsigned or not, defaults to signed
647
+ * @returns The corresponding Long value
648
+ */
649
+ static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
650
+ /**
651
+ * Tests if the specified object is a Long.
652
+ */
653
+ static isLong(value: any): value is Long;
654
+ /**
655
+ * Converts the specified value to a Long.
656
+ * @param unsigned - Whether unsigned or not, defaults to signed
657
+ */
658
+ static fromValue(val: number | string | {
659
+ low: number;
660
+ high: number;
661
+ unsigned?: boolean;
662
+ }, unsigned?: boolean): Long;
663
+ /** Returns the sum of this and the specified Long. */
664
+ add(addend: string | number | Long | Timestamp): Long;
665
+ /**
666
+ * Returns the sum of this and the specified Long.
667
+ * @returns Sum
668
+ */
669
+ and(other: string | number | Long | Timestamp): Long;
670
+ /**
671
+ * Compares this Long's value with the specified's.
672
+ * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
673
+ */
674
+ compare(other: string | number | Long | Timestamp): 0 | 1 | -1;
675
+ /** This is an alias of {@link Long.compare} */
676
+ comp(other: string | number | Long | Timestamp): 0 | 1 | -1;
677
+ /**
678
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.
679
+ * @returns Quotient
680
+ */
681
+ divide(divisor: string | number | Long | Timestamp): Long;
682
+ /**This is an alias of {@link Long.divide} */
683
+ div(divisor: string | number | Long | Timestamp): Long;
684
+ /**
685
+ * Tests if this Long's value equals the specified's.
686
+ * @param other - Other value
687
+ */
688
+ equals(other: string | number | Long | Timestamp): boolean;
689
+ /** This is an alias of {@link Long.equals} */
690
+ eq(other: string | number | Long | Timestamp): boolean;
691
+ /** Gets the high 32 bits as a signed integer. */
692
+ getHighBits(): number;
693
+ /** Gets the high 32 bits as an unsigned integer. */
694
+ getHighBitsUnsigned(): number;
695
+ /** Gets the low 32 bits as a signed integer. */
696
+ getLowBits(): number;
697
+ /** Gets the low 32 bits as an unsigned integer. */
698
+ getLowBitsUnsigned(): number;
699
+ /** Gets the number of bits needed to represent the absolute value of this Long. */
700
+ getNumBitsAbs(): number;
701
+ /** Tests if this Long's value is greater than the specified's. */
702
+ greaterThan(other: string | number | Long | Timestamp): boolean;
703
+ /** This is an alias of {@link Long.greaterThan} */
704
+ gt(other: string | number | Long | Timestamp): boolean;
705
+ /** Tests if this Long's value is greater than or equal the specified's. */
706
+ greaterThanOrEqual(other: string | number | Long | Timestamp): boolean;
707
+ /** This is an alias of {@link Long.greaterThanOrEqual} */
708
+ gte(other: string | number | Long | Timestamp): boolean;
709
+ /** This is an alias of {@link Long.greaterThanOrEqual} */
710
+ ge(other: string | number | Long | Timestamp): boolean;
711
+ /** Tests if this Long's value is even. */
712
+ isEven(): boolean;
713
+ /** Tests if this Long's value is negative. */
714
+ isNegative(): boolean;
715
+ /** Tests if this Long's value is odd. */
716
+ isOdd(): boolean;
717
+ /** Tests if this Long's value is positive. */
718
+ isPositive(): boolean;
719
+ /** Tests if this Long's value equals zero. */
720
+ isZero(): boolean;
721
+ /** Tests if this Long's value is less than the specified's. */
722
+ lessThan(other: string | number | Long | Timestamp): boolean;
723
+ /** This is an alias of {@link Long#lessThan}. */
724
+ lt(other: string | number | Long | Timestamp): boolean;
725
+ /** Tests if this Long's value is less than or equal the specified's. */
726
+ lessThanOrEqual(other: string | number | Long | Timestamp): boolean;
727
+ /** This is an alias of {@link Long.lessThanOrEqual} */
728
+ lte(other: string | number | Long | Timestamp): boolean;
729
+ /** Returns this Long modulo the specified. */
730
+ modulo(divisor: string | number | Long | Timestamp): Long;
731
+ /** This is an alias of {@link Long.modulo} */
732
+ mod(divisor: string | number | Long | Timestamp): Long;
733
+ /** This is an alias of {@link Long.modulo} */
734
+ rem(divisor: string | number | Long | Timestamp): Long;
735
+ /**
736
+ * Returns the product of this and the specified Long.
737
+ * @param multiplier - Multiplier
738
+ * @returns Product
739
+ */
740
+ multiply(multiplier: string | number | Long | Timestamp): Long;
741
+ /** This is an alias of {@link Long.multiply} */
742
+ mul(multiplier: string | number | Long | Timestamp): Long;
743
+ /** Returns the Negation of this Long's value. */
744
+ negate(): Long;
745
+ /** This is an alias of {@link Long.negate} */
746
+ neg(): Long;
747
+ /** Returns the bitwise NOT of this Long. */
748
+ not(): Long;
749
+ /** Tests if this Long's value differs from the specified's. */
750
+ notEquals(other: string | number | Long | Timestamp): boolean;
751
+ /** This is an alias of {@link Long.notEquals} */
752
+ neq(other: string | number | Long | Timestamp): boolean;
753
+ /** This is an alias of {@link Long.notEquals} */
754
+ ne(other: string | number | Long | Timestamp): boolean;
755
+ /**
756
+ * Returns the bitwise OR of this Long and the specified.
757
+ */
758
+ or(other: number | string | Long): Long;
759
+ /**
760
+ * Returns this Long with bits shifted to the left by the given amount.
761
+ * @param numBits - Number of bits
762
+ * @returns Shifted Long
763
+ */
764
+ shiftLeft(numBits: number | Long): Long;
765
+ /** This is an alias of {@link Long.shiftLeft} */
766
+ shl(numBits: number | Long): Long;
767
+ /**
768
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
769
+ * @param numBits - Number of bits
770
+ * @returns Shifted Long
771
+ */
772
+ shiftRight(numBits: number | Long): Long;
773
+ /** This is an alias of {@link Long.shiftRight} */
774
+ shr(numBits: number | Long): Long;
775
+ /**
776
+ * Returns this Long with bits logically shifted to the right by the given amount.
777
+ * @param numBits - Number of bits
778
+ * @returns Shifted Long
779
+ */
780
+ shiftRightUnsigned(numBits: Long | number): Long;
781
+ /** This is an alias of {@link Long.shiftRightUnsigned} */
782
+ shr_u(numBits: number | Long): Long;
783
+ /** This is an alias of {@link Long.shiftRightUnsigned} */
784
+ shru(numBits: number | Long): Long;
785
+ /**
786
+ * Returns the difference of this and the specified Long.
787
+ * @param subtrahend - Subtrahend
788
+ * @returns Difference
789
+ */
790
+ subtract(subtrahend: string | number | Long | Timestamp): Long;
791
+ /** This is an alias of {@link Long.subtract} */
792
+ sub(subtrahend: string | number | Long | Timestamp): Long;
793
+ /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */
794
+ toInt(): number;
795
+ /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */
796
+ toNumber(): number;
797
+ /** Converts the Long to a BigInt (arbitrary precision). */
798
+ toBigInt(): bigint;
799
+ /**
800
+ * Converts this Long to its byte representation.
801
+ * @param le - Whether little or big endian, defaults to big endian
802
+ * @returns Byte representation
803
+ */
804
+ toBytes(le?: boolean): number[];
805
+ /**
806
+ * Converts this Long to its little endian byte representation.
807
+ * @returns Little endian byte representation
808
+ */
809
+ toBytesLE(): number[];
810
+ /**
811
+ * Converts this Long to its big endian byte representation.
812
+ * @returns Big endian byte representation
813
+ */
814
+ toBytesBE(): number[];
815
+ /**
816
+ * Converts this Long to signed.
817
+ */
818
+ toSigned(): Long;
819
+ /**
820
+ * Converts the Long to a string written in the specified radix.
821
+ * @param radix - Radix (2-36), defaults to 10
822
+ * @throws RangeError If `radix` is out of range
823
+ */
824
+ toString(radix?: number): string;
825
+ /** Converts this Long to unsigned. */
826
+ toUnsigned(): Long;
827
+ /** Returns the bitwise XOR of this Long and the given one. */
828
+ xor(other: Long | number | string): Long;
829
+ /** This is an alias of {@link Long.isZero} */
830
+ eqz(): boolean;
831
+ /** This is an alias of {@link Long.lessThanOrEqual} */
832
+ le(other: string | number | Long | Timestamp): boolean;
833
+ toExtendedJSON(options?: EJSONOptions): number | LongExtended;
834
+ static fromExtendedJSON(doc: {
835
+ $numberLong: string;
836
+ }, options?: EJSONOptions): number | Long;
837
+ inspect(): string;
838
+ }
839
+ /** @public */
840
+ export declare interface LongExtended {
841
+ $numberLong: string;
842
+ }
843
+ /** @public */
844
+ export declare type LongWithoutOverrides = new (low: unknown, high?: number, unsigned?: boolean) => {
845
+ [P in Exclude<keyof Long, TimestampOverrides>]: Long[P];
846
+ };
847
+ /** @public */
848
+ export declare const LongWithoutOverridesClass: LongWithoutOverrides;
849
+ /** @public */
850
+ declare let Map_2: MapConstructor;
851
+ export { Map_2 as Map };
852
+ /**
853
+ * A class representation of the BSON MaxKey type.
854
+ * @public
855
+ * @category BSONType
856
+ */
857
+ export declare class MaxKey {
858
+ _bsontype: 'MaxKey';
859
+ constructor();
860
+ /* Excluded from this release type: toExtendedJSON */
861
+ /* Excluded from this release type: fromExtendedJSON */
862
+ inspect(): string;
863
+ }
864
+ /** @public */
865
+ export declare interface MaxKeyExtended {
866
+ $maxKey: 1;
867
+ }
868
+ /**
869
+ * A class representation of the BSON MinKey type.
870
+ * @public
871
+ * @category BSONType
872
+ */
873
+ export declare class MinKey {
874
+ _bsontype: 'MinKey';
875
+ constructor();
876
+ /* Excluded from this release type: toExtendedJSON */
877
+ /* Excluded from this release type: fromExtendedJSON */
878
+ inspect(): string;
879
+ }
880
+ /** @public */
881
+ export declare interface MinKeyExtended {
882
+ $minKey: 1;
883
+ }
884
+ /**
885
+ * A class representation of the BSON ObjectId type.
886
+ * @public
887
+ * @category BSONType
888
+ */
889
+ declare class ObjectId {
890
+ _bsontype: 'ObjectID';
891
+ /* Excluded from this release type: index */
892
+ static cacheHexString: boolean;
893
+ /* Excluded from this release type: [kId] */
894
+ /* Excluded from this release type: __id */
895
+ /**
896
+ * Create an ObjectId type
897
+ *
898
+ * @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.
899
+ */
900
+ constructor(inputId?: string | number | ObjectId | ObjectIdLike | Buffer | Uint8Array);
901
+ /*
902
+ * The ObjectId bytes
903
+ * @readonly
904
+ */
905
+ id: Buffer;
906
+ /*
907
+ * The generation time of this ObjectId instance
908
+ * @deprecated Please use getTimestamp / createFromTime which returns an int32 epoch
909
+ */
910
+ generationTime: number;
911
+ /** Returns the ObjectId id as a 24 character hex string representation */
912
+ toHexString(): string;
913
+ /* Excluded from this release type: getInc */
914
+ /**
915
+ * Generate a 12 byte id buffer used in ObjectId's
916
+ *
917
+ * @param time - pass in a second based timestamp.
918
+ */
919
+ static generate(time?: number): Buffer;
920
+ /**
921
+ * Converts the id into a 24 character hex string for printing
922
+ *
923
+ * @param format - The Buffer toString format parameter.
924
+ */
925
+ toString(format?: string): string;
926
+ /** Converts to its JSON the 24 character hex string representation. */
927
+ toJSON(): string;
928
+ /**
929
+ * Compares the equality of this ObjectId with `otherID`.
930
+ *
931
+ * @param otherId - ObjectId instance to compare against.
932
+ */
933
+ equals(otherId: string | ObjectId | ObjectIdLike): boolean;
934
+ /** Returns the generation date (accurate up to the second) that this ID was generated. */
935
+ getTimestamp(): Date;
936
+ /* Excluded from this release type: createPk */
937
+ /**
938
+ * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
939
+ *
940
+ * @param time - an integer number representing a number of seconds.
941
+ */
942
+ static createFromTime(time: number): ObjectId;
943
+ /**
944
+ * Creates an ObjectId from a hex string representation of an ObjectId.
945
+ *
946
+ * @param hexString - create a ObjectId from a passed in 24 character hexstring.
947
+ */
948
+ static createFromHexString(hexString: string): ObjectId;
949
+ /**
950
+ * Checks if a value is a valid bson ObjectId
951
+ *
952
+ * @param id - ObjectId instance to validate.
953
+ */
954
+ static isValid(id: string | number | ObjectId | ObjectIdLike | Buffer | Uint8Array): boolean;
955
+ /* Excluded from this release type: toExtendedJSON */
956
+ /* Excluded from this release type: fromExtendedJSON */
957
+ inspect(): string;
958
+ }
959
+ export { ObjectId as ObjectID };
960
+ export { ObjectId };
961
+ /** @public */
962
+ export declare interface ObjectIdExtended {
963
+ $oid: string;
964
+ }
965
+ /** @public */
966
+ export declare interface ObjectIdLike {
967
+ id: string | Buffer;
968
+ __id?: string;
969
+ toHexString(): string;
970
+ }
971
+ /**
972
+ * Serialize a Javascript object.
973
+ *
974
+ * @param object - the Javascript object to serialize.
975
+ * @returns Buffer object containing the serialized object.
976
+ * @public
977
+ */
978
+ export declare function serialize(object: Document, options?: SerializeOptions): Buffer;
979
+ /** @public */
980
+ export declare interface SerializeOptions {
981
+ /** the serializer will check if keys are valid. */
982
+ checkKeys?: boolean;
983
+ /** serialize the javascript functions **(default:false)**. */
984
+ serializeFunctions?: boolean;
985
+ /** serialize will not emit undefined fields **(default:true)** */
986
+ ignoreUndefined?: boolean;
987
+ /* Excluded from this release type: minInternalBufferSize */
988
+ /** the index in the buffer where we wish to start serializing into */
989
+ index?: number;
990
+ }
991
+ /**
992
+ * Serialize a Javascript object using a predefined Buffer and index into the buffer,
993
+ * useful when pre-allocating the space for serialization.
994
+ *
995
+ * @param object - the Javascript object to serialize.
996
+ * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.
997
+ * @returns the index pointing to the last written byte in the buffer.
998
+ * @public
999
+ */
1000
+ export declare function serializeWithBufferAndIndex(object: Document, finalBuffer: Buffer, options?: SerializeOptions): number;
1001
+ /**
1002
+ * Sets the size of the internal serialization buffer.
1003
+ *
1004
+ * @param size - The desired size for the internal serialization buffer
1005
+ * @public
1006
+ */
1007
+ export declare function setInternalBufferSize(size: number): void;
1008
+ /**
1009
+ * @public
1010
+ * @category BSONType
1011
+ * */
1012
+ export declare class Timestamp extends LongWithoutOverridesClass {
1013
+ _bsontype: 'Timestamp';
1014
+ static readonly MAX_VALUE: Long;
1015
+ /**
1016
+ * @param low - A 64-bit Long representing the Timestamp.
1017
+ */
1018
+ constructor(long: Long);
1019
+ /**
1020
+ * @param value - A pair of two values indicating timestamp and increment.
1021
+ */
1022
+ constructor(value: {
1023
+ t: number;
1024
+ i: number;
1025
+ });
1026
+ /**
1027
+ * @param low - the low (signed) 32 bits of the Timestamp.
1028
+ * @param high - the high (signed) 32 bits of the Timestamp.
1029
+ * @deprecated Please use `Timestamp({ t: high, i: low })` or `Timestamp(Long(low, high))` instead.
1030
+ */
1031
+ constructor(low: number, high: number);
1032
+ toJSON(): {
1033
+ $timestamp: string;
1034
+ };
1035
+ /** Returns a Timestamp represented by the given (32-bit) integer value. */
1036
+ static fromInt(value: number): Timestamp;
1037
+ /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */
1038
+ static fromNumber(value: number): Timestamp;
1039
+ /**
1040
+ * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.
1041
+ *
1042
+ * @param lowBits - the low 32-bits.
1043
+ * @param highBits - the high 32-bits.
1044
+ */
1045
+ static fromBits(lowBits: number, highBits: number): Timestamp;
1046
+ /**
1047
+ * Returns a Timestamp from the given string, optionally using the given radix.
1048
+ *
1049
+ * @param str - the textual representation of the Timestamp.
1050
+ * @param optRadix - the radix in which the text is written.
1051
+ */
1052
+ static fromString(str: string, optRadix: number): Timestamp;
1053
+ /* Excluded from this release type: toExtendedJSON */
1054
+ /* Excluded from this release type: fromExtendedJSON */
1055
+ inspect(): string;
1056
+ }
1057
+ /** @public */
1058
+ export declare interface TimestampExtended {
1059
+ $timestamp: {
1060
+ t: number;
1061
+ i: number;
1062
+ };
1063
+ }
1064
+ /** @public */
1065
+ export declare type TimestampOverrides = '_bsontype' | 'toExtendedJSON' | 'fromExtendedJSON' | 'inspect';
1066
+ /**
1067
+ * A class representation of the BSON UUID type.
1068
+ * @public
1069
+ */
1070
+ export declare class UUID {
1071
+ _bsontype: 'UUID';
1072
+ static cacheHexString: boolean;
1073
+ /* Excluded from this release type: [kId] */
1074
+ /* Excluded from this release type: __id */
1075
+ /**
1076
+ * Create an UUID type
1077
+ *
1078
+ * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.
1079
+ */
1080
+ constructor(input?: string | Buffer | UUID);
1081
+ /*
1082
+ * The UUID bytes
1083
+ * @readonly
1084
+ */
1085
+ id: Buffer;
1086
+ /**
1087
+ * Generate a 16 byte uuid v4 buffer used in UUIDs
1088
+ */
1089
+ /**
1090
+ * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)
1091
+ * @param includeDashes - should the string exclude dash-separators.
1092
+ * */
1093
+ toHexString(includeDashes?: boolean): string;
1094
+ /**
1095
+ * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.
1096
+ */
1097
+ toString(encoding?: string): string;
1098
+ /**
1099
+ * Converts the id into its JSON string representation.
1100
+ * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1101
+ */
1102
+ toJSON(): string;
1103
+ /**
1104
+ * Compares the equality of this UUID with `otherID`.
1105
+ *
1106
+ * @param otherId - UUID instance to compare against.
1107
+ */
1108
+ equals(otherId: string | Buffer | UUID): boolean;
1109
+ /**
1110
+ * Creates a Binary instance from the current UUID.
1111
+ */
1112
+ toBinary(): Binary;
1113
+ /**
1114
+ * Generates a populated buffer containing a v4 uuid
1115
+ */
1116
+ static generate(): Buffer;
1117
+ /**
1118
+ * Checks if a value is a valid bson UUID
1119
+ * @param input - UUID, string or Buffer to validate.
1120
+ */
1121
+ static isValid(input: string | Buffer | UUID): boolean;
1122
+ /**
1123
+ * Creates an UUID from a hex string representation of an UUID.
1124
+ * @param hexString - 32 or 36 character hex string (dashes excluded/included).
1125
+ */
1126
+ static createFromHexString(hexString: string): UUID;
1127
+ inspect(): string;
1128
+ }
1129
+ /** @public */
1130
+ export declare type UUIDExtended = {
1131
+ $uuid: string;
1132
+ };
1133
+ export {};