typeorm 0.3.15-dev.3a72e35 → 0.3.15-dev.f6a3ce7

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