bson 4.6.5 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/binary.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { Buffer } from 'buffer';
2
2
  import { ensureBuffer } from './ensure_buffer';
3
- import { uuidHexStringToBuffer } from './uuid_utils';
4
- import { UUID, UUIDExtended } from './uuid';
3
+ import { bufferToUuidHexString, uuidHexStringToBuffer, uuidValidateString } from './uuid_utils';
4
+ import { isUint8Array, randomBytes } from './parser/utils';
5
5
  import type { EJSONOptions } from './extended_json';
6
6
  import { BSONError, BSONTypeError } from './error';
7
+ import { BSON_BINARY_SUBTYPE_UUID_NEW } from './constants';
7
8
 
8
9
  /** @public */
9
10
  export type BinarySequence = Uint8Array | Buffer | number[];
@@ -277,7 +278,7 @@ export class Binary {
277
278
  if (!data) {
278
279
  throw new BSONTypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
279
280
  }
280
- return new Binary(data, type);
281
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
281
282
  }
282
283
 
283
284
  /** @internal */
@@ -292,3 +293,189 @@ export class Binary {
292
293
  }
293
294
 
294
295
  Object.defineProperty(Binary.prototype, '_bsontype', { value: 'Binary' });
296
+
297
+ /** @public */
298
+ export type UUIDExtended = {
299
+ $uuid: string;
300
+ };
301
+ const UUID_BYTE_LENGTH = 16;
302
+
303
+ /**
304
+ * A class representation of the BSON UUID type.
305
+ * @public
306
+ */
307
+ export class UUID extends Binary {
308
+ static cacheHexString: boolean;
309
+
310
+ /** UUID hexString cache @internal */
311
+ private __id?: string;
312
+
313
+ /**
314
+ * Create an UUID type
315
+ *
316
+ * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.
317
+ */
318
+ constructor(input?: string | Buffer | UUID) {
319
+ let bytes;
320
+ let hexStr;
321
+ if (input == null) {
322
+ bytes = UUID.generate();
323
+ } else if (input instanceof UUID) {
324
+ bytes = Buffer.from(input.buffer);
325
+ hexStr = input.__id;
326
+ } else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
327
+ bytes = ensureBuffer(input);
328
+ } else if (typeof input === 'string') {
329
+ bytes = uuidHexStringToBuffer(input);
330
+ } else {
331
+ throw new BSONTypeError(
332
+ 'Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).'
333
+ );
334
+ }
335
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
336
+ this.__id = hexStr;
337
+ }
338
+
339
+ /**
340
+ * The UUID bytes
341
+ * @readonly
342
+ */
343
+ get id(): Buffer {
344
+ return this.buffer;
345
+ }
346
+
347
+ set id(value: Buffer) {
348
+ this.buffer = value;
349
+
350
+ if (UUID.cacheHexString) {
351
+ this.__id = bufferToUuidHexString(value);
352
+ }
353
+ }
354
+
355
+ /**
356
+ * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)
357
+ * @param includeDashes - should the string exclude dash-separators.
358
+ * */
359
+ toHexString(includeDashes = true): string {
360
+ if (UUID.cacheHexString && this.__id) {
361
+ return this.__id;
362
+ }
363
+
364
+ const uuidHexString = bufferToUuidHexString(this.id, includeDashes);
365
+
366
+ if (UUID.cacheHexString) {
367
+ this.__id = uuidHexString;
368
+ }
369
+
370
+ return uuidHexString;
371
+ }
372
+
373
+ /**
374
+ * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.
375
+ */
376
+ toString(encoding?: string): string {
377
+ return encoding ? this.id.toString(encoding) : this.toHexString();
378
+ }
379
+
380
+ /**
381
+ * Converts the id into its JSON string representation.
382
+ * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
383
+ */
384
+ toJSON(): string {
385
+ return this.toHexString();
386
+ }
387
+
388
+ /**
389
+ * Compares the equality of this UUID with `otherID`.
390
+ *
391
+ * @param otherId - UUID instance to compare against.
392
+ */
393
+ equals(otherId: string | Buffer | UUID): boolean {
394
+ if (!otherId) {
395
+ return false;
396
+ }
397
+
398
+ if (otherId instanceof UUID) {
399
+ return otherId.id.equals(this.id);
400
+ }
401
+
402
+ try {
403
+ return new UUID(otherId).id.equals(this.id);
404
+ } catch {
405
+ return false;
406
+ }
407
+ }
408
+
409
+ /**
410
+ * Creates a Binary instance from the current UUID.
411
+ */
412
+ toBinary(): Binary {
413
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
414
+ }
415
+
416
+ /**
417
+ * Generates a populated buffer containing a v4 uuid
418
+ */
419
+ static generate(): Buffer {
420
+ const bytes = randomBytes(UUID_BYTE_LENGTH);
421
+
422
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
423
+ // Kindly borrowed from https://github.com/uuidjs/uuid/blob/master/src/v4.js
424
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
425
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
426
+
427
+ return Buffer.from(bytes);
428
+ }
429
+
430
+ /**
431
+ * Checks if a value is a valid bson UUID
432
+ * @param input - UUID, string or Buffer to validate.
433
+ */
434
+ static isValid(input: string | Buffer | UUID): boolean {
435
+ if (!input) {
436
+ return false;
437
+ }
438
+
439
+ if (input instanceof UUID) {
440
+ return true;
441
+ }
442
+
443
+ if (typeof input === 'string') {
444
+ return uuidValidateString(input);
445
+ }
446
+
447
+ if (isUint8Array(input)) {
448
+ // check for length & uuid version (https://tools.ietf.org/html/rfc4122#section-4.1.3)
449
+ if (input.length !== UUID_BYTE_LENGTH) {
450
+ return false;
451
+ }
452
+
453
+ return (input[6] & 0xf0) === 0x40 && (input[8] & 0x80) === 0x80;
454
+ }
455
+
456
+ return false;
457
+ }
458
+
459
+ /**
460
+ * Creates an UUID from a hex string representation of an UUID.
461
+ * @param hexString - 32 or 36 character hex string (dashes excluded/included).
462
+ */
463
+ static createFromHexString(hexString: string): UUID {
464
+ const buffer = uuidHexStringToBuffer(hexString);
465
+ return new UUID(buffer);
466
+ }
467
+
468
+ /**
469
+ * Converts to a string representation of this Id.
470
+ *
471
+ * @returns return the 36 character hex string representation.
472
+ * @internal
473
+ */
474
+ [Symbol.for('nodejs.util.inspect.custom')](): string {
475
+ return this.inspect();
476
+ }
477
+
478
+ inspect(): string {
479
+ return `new UUID("${this.toHexString()}")`;
480
+ }
481
+ }
package/src/bson.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Buffer } from 'buffer';
2
- import { Binary } from './binary';
2
+ import { Binary, UUID } from './binary';
3
3
  import { Code } from './code';
4
4
  import { DBRef } from './db_ref';
5
5
  import { Decimal128 } from './decimal128';
@@ -20,9 +20,8 @@ import { serializeInto as internalSerialize, SerializeOptions } from './parser/s
20
20
  import { BSONRegExp } from './regexp';
21
21
  import { BSONSymbol } from './symbol';
22
22
  import { Timestamp } from './timestamp';
23
- import { UUID } from './uuid';
24
- export { BinaryExtended, BinaryExtendedLegacy, BinarySequence } from './binary';
25
- export { CodeExtended } from './code';
23
+ export type { UUIDExtended, BinaryExtended, BinaryExtendedLegacy, BinarySequence } from './binary';
24
+ export type { CodeExtended } from './code';
26
25
  export {
27
26
  BSON_BINARY_SUBTYPE_BYTE_ARRAY,
28
27
  BSON_BINARY_SUBTYPE_DEFAULT,
@@ -59,25 +58,21 @@ export {
59
58
  BSON_INT64_MAX,
60
59
  BSON_INT64_MIN
61
60
  } from './constants';
62
- export { DBRefLike } from './db_ref';
63
- export { Decimal128Extended } from './decimal128';
64
- export { DoubleExtended } from './double';
65
- export { EJSON, EJSONOptions } from './extended_json';
66
- export { Int32Extended } from './int_32';
67
- export { LongExtended } from './long';
68
- export { MaxKeyExtended } from './max_key';
69
- export { MinKeyExtended } from './min_key';
70
- export { ObjectIdExtended, ObjectIdLike } from './objectid';
71
- export { BSONRegExpExtended, BSONRegExpExtendedLegacy } from './regexp';
72
- export { BSONSymbolExtended } from './symbol';
73
- export {
74
- LongWithoutOverrides,
75
- LongWithoutOverridesClass,
76
- TimestampExtended,
77
- TimestampOverrides
78
- } from './timestamp';
79
- export { UUIDExtended } from './uuid';
80
- export { SerializeOptions, DeserializeOptions };
61
+ export type { DBRefLike } from './db_ref';
62
+ export type { Decimal128Extended } from './decimal128';
63
+ export type { DoubleExtended } from './double';
64
+ export type { EJSONOptions } from './extended_json';
65
+ export { EJSON } from './extended_json';
66
+ export type { Int32Extended } from './int_32';
67
+ export type { LongExtended } from './long';
68
+ export type { MaxKeyExtended } from './max_key';
69
+ export type { MinKeyExtended } from './min_key';
70
+ export type { ObjectIdExtended, ObjectIdLike } from './objectid';
71
+ export type { BSONRegExpExtended, BSONRegExpExtendedLegacy } from './regexp';
72
+ export type { BSONSymbolExtended } from './symbol';
73
+ export type { LongWithoutOverrides, TimestampExtended, TimestampOverrides } from './timestamp';
74
+ export { LongWithoutOverridesClass } from './timestamp';
75
+ export type { SerializeOptions, DeserializeOptions };
81
76
  export {
82
77
  Code,
83
78
  Map,
package/src/double.ts CHANGED
@@ -52,23 +52,17 @@ export class Double {
52
52
  return this.value;
53
53
  }
54
54
 
55
- // NOTE: JavaScript has +0 and -0, apparently to model limit calculations. If a user
56
- // explicitly provided `-0` then we need to ensure the sign makes it into the output
57
55
  if (Object.is(Math.sign(this.value), -0)) {
58
- return { $numberDouble: `-${this.value.toFixed(1)}` };
56
+ // NOTE: JavaScript has +0 and -0, apparently to model limit calculations. If a user
57
+ // explicitly provided `-0` then we need to ensure the sign makes it into the output
58
+ return { $numberDouble: '-0.0' };
59
59
  }
60
60
 
61
- let $numberDouble: string;
62
61
  if (Number.isInteger(this.value)) {
63
- $numberDouble = this.value.toFixed(1);
64
- if ($numberDouble.length >= 13) {
65
- $numberDouble = this.value.toExponential(13).toUpperCase();
66
- }
62
+ return { $numberDouble: `${this.value}.0` };
67
63
  } else {
68
- $numberDouble = this.value.toString();
64
+ return { $numberDouble: `${this.value}` };
69
65
  }
70
-
71
- return { $numberDouble };
72
66
  }
73
67
 
74
68
  /** @internal */
@@ -417,6 +417,9 @@ function deserializeObject(
417
417
  value = buffer.slice(index, index + binarySize);
418
418
  } else {
419
419
  value = new Binary(buffer.slice(index, index + binarySize), subType);
420
+ if (subType === constants.BSON_BINARY_SUBTYPE_UUID_NEW) {
421
+ value = value.toUUID();
422
+ }
420
423
  }
421
424
  } else {
422
425
  const _buffer = Buffer.alloc(binarySize);
@@ -442,8 +445,10 @@ function deserializeObject(
442
445
 
443
446
  if (promoteBuffers && promoteValues) {
444
447
  value = _buffer;
448
+ } else if (subType === constants.BSON_BINARY_SUBTYPE_UUID_NEW) {
449
+ value = new Binary(buffer.slice(index, index + binarySize), subType).toUUID();
445
450
  } else {
446
- value = new Binary(_buffer, subType);
451
+ value = new Binary(buffer.slice(index, index + binarySize), subType);
447
452
  }
448
453
  }
449
454
 
package/lib/uuid.js DELETED
@@ -1,179 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UUID = void 0;
4
- var buffer_1 = require("buffer");
5
- var ensure_buffer_1 = require("./ensure_buffer");
6
- var binary_1 = require("./binary");
7
- var uuid_utils_1 = require("./uuid_utils");
8
- var utils_1 = require("./parser/utils");
9
- var error_1 = require("./error");
10
- var BYTE_LENGTH = 16;
11
- var kId = Symbol('id');
12
- /**
13
- * A class representation of the BSON UUID type.
14
- * @public
15
- */
16
- var UUID = /** @class */ (function () {
17
- /**
18
- * Create an UUID type
19
- *
20
- * @param input - Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.
21
- */
22
- function UUID(input) {
23
- if (typeof input === 'undefined') {
24
- // The most common use case (blank id, new UUID() instance)
25
- this.id = UUID.generate();
26
- }
27
- else if (input instanceof UUID) {
28
- this[kId] = buffer_1.Buffer.from(input.id);
29
- this.__id = input.__id;
30
- }
31
- else if (ArrayBuffer.isView(input) && input.byteLength === BYTE_LENGTH) {
32
- this.id = (0, ensure_buffer_1.ensureBuffer)(input);
33
- }
34
- else if (typeof input === 'string') {
35
- this.id = (0, uuid_utils_1.uuidHexStringToBuffer)(input);
36
- }
37
- else {
38
- throw new error_1.BSONTypeError('Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).');
39
- }
40
- }
41
- Object.defineProperty(UUID.prototype, "id", {
42
- /**
43
- * The UUID bytes
44
- * @readonly
45
- */
46
- get: function () {
47
- return this[kId];
48
- },
49
- set: function (value) {
50
- this[kId] = value;
51
- if (UUID.cacheHexString) {
52
- this.__id = (0, uuid_utils_1.bufferToUuidHexString)(value);
53
- }
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- /**
59
- * Generate a 16 byte uuid v4 buffer used in UUIDs
60
- */
61
- /**
62
- * Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)
63
- * @param includeDashes - should the string exclude dash-separators.
64
- * */
65
- UUID.prototype.toHexString = function (includeDashes) {
66
- if (includeDashes === void 0) { includeDashes = true; }
67
- if (UUID.cacheHexString && this.__id) {
68
- return this.__id;
69
- }
70
- var uuidHexString = (0, uuid_utils_1.bufferToUuidHexString)(this.id, includeDashes);
71
- if (UUID.cacheHexString) {
72
- this.__id = uuidHexString;
73
- }
74
- return uuidHexString;
75
- };
76
- /**
77
- * Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.
78
- */
79
- UUID.prototype.toString = function (encoding) {
80
- return encoding ? this.id.toString(encoding) : this.toHexString();
81
- };
82
- /**
83
- * Converts the id into its JSON string representation.
84
- * A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
85
- */
86
- UUID.prototype.toJSON = function () {
87
- return this.toHexString();
88
- };
89
- /**
90
- * Compares the equality of this UUID with `otherID`.
91
- *
92
- * @param otherId - UUID instance to compare against.
93
- */
94
- UUID.prototype.equals = function (otherId) {
95
- if (!otherId) {
96
- return false;
97
- }
98
- if (otherId instanceof UUID) {
99
- return otherId.id.equals(this.id);
100
- }
101
- try {
102
- return new UUID(otherId).id.equals(this.id);
103
- }
104
- catch (_a) {
105
- return false;
106
- }
107
- };
108
- /**
109
- * Creates a Binary instance from the current UUID.
110
- */
111
- UUID.prototype.toBinary = function () {
112
- return new binary_1.Binary(this.id, binary_1.Binary.SUBTYPE_UUID);
113
- };
114
- /**
115
- * Generates a populated buffer containing a v4 uuid
116
- */
117
- UUID.generate = function () {
118
- var bytes = (0, utils_1.randomBytes)(BYTE_LENGTH);
119
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
120
- // Kindly borrowed from https://github.com/uuidjs/uuid/blob/master/src/v4.js
121
- bytes[6] = (bytes[6] & 0x0f) | 0x40;
122
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
123
- return buffer_1.Buffer.from(bytes);
124
- };
125
- /**
126
- * Checks if a value is a valid bson UUID
127
- * @param input - UUID, string or Buffer to validate.
128
- */
129
- UUID.isValid = function (input) {
130
- if (!input) {
131
- return false;
132
- }
133
- if (input instanceof UUID) {
134
- return true;
135
- }
136
- if (typeof input === 'string') {
137
- return (0, uuid_utils_1.uuidValidateString)(input);
138
- }
139
- if ((0, utils_1.isUint8Array)(input)) {
140
- // check for length & uuid version (https://tools.ietf.org/html/rfc4122#section-4.1.3)
141
- if (input.length !== BYTE_LENGTH) {
142
- return false;
143
- }
144
- try {
145
- // get this byte as hex: xxxxxxxx-xxxx-XXxx-xxxx-xxxxxxxxxxxx
146
- // check first part as uuid version: xxxxxxxx-xxxx-Xxxx-xxxx-xxxxxxxxxxxx
147
- return parseInt(input[6].toString(16)[0], 10) === binary_1.Binary.SUBTYPE_UUID;
148
- }
149
- catch (_a) {
150
- return false;
151
- }
152
- }
153
- return false;
154
- };
155
- /**
156
- * Creates an UUID from a hex string representation of an UUID.
157
- * @param hexString - 32 or 36 character hex string (dashes excluded/included).
158
- */
159
- UUID.createFromHexString = function (hexString) {
160
- var buffer = (0, uuid_utils_1.uuidHexStringToBuffer)(hexString);
161
- return new UUID(buffer);
162
- };
163
- /**
164
- * Converts to a string representation of this Id.
165
- *
166
- * @returns return the 36 character hex string representation.
167
- * @internal
168
- */
169
- UUID.prototype[Symbol.for('nodejs.util.inspect.custom')] = function () {
170
- return this.inspect();
171
- };
172
- UUID.prototype.inspect = function () {
173
- return "new UUID(\"".concat(this.toHexString(), "\")");
174
- };
175
- return UUID;
176
- }());
177
- exports.UUID = UUID;
178
- Object.defineProperty(UUID.prototype, '_bsontype', { value: 'UUID' });
179
- //# sourceMappingURL=uuid.js.map
package/lib/uuid.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../src/uuid.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,iDAA+C;AAC/C,mCAAkC;AAClC,2CAAgG;AAChG,wCAA2D;AAC3D,iCAAwC;AAOxC,IAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzB;;;GAGG;AACH;IAWE;;;;OAIG;IACH,cAAY,KAA8B;QACxC,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAChC,2DAA2D;YAC3D,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;SAC3B;aAAM,IAAI,KAAK,YAAY,IAAI,EAAE;YAChC,IAAI,CAAC,GAAG,CAAC,GAAG,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;SACxB;aAAM,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,KAAK,WAAW,EAAE;YACxE,IAAI,CAAC,EAAE,GAAG,IAAA,4BAAY,EAAC,KAAK,CAAC,CAAC;SAC/B;aAAM,IAAI,OAAO,KAAK,KAAK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