Update Node_modules
This commit is contained in:
+15
@@ -1,3 +1,18 @@
|
||||
<a name="1.1.1"></a>
|
||||
## [1.1.1](https://github.com/mongodb/js-bson/compare/v1.1.0...v1.1.1) (2019-03-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **object-id:** support 4.x->1.x interop for MinKey and ObjectId ([53419a5](https://github.com/mongodb/js-bson/commit/53419a5))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* replace new Buffer with modern versions ([24aefba](https://github.com/mongodb/js-bson/commit/24aefba))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/mongodb/js-bson/compare/v1.0.9...v1.1.0) (2018-08-13)
|
||||
|
||||
|
||||
+2417
-2396
File diff suppressed because it is too large
Load Diff
+6
-4
@@ -9,6 +9,8 @@ if (typeof global !== 'undefined') {
|
||||
var Buffer = require('buffer').Buffer; // TODO just use global Buffer
|
||||
}
|
||||
|
||||
var utils = require('./parser/utils');
|
||||
|
||||
/**
|
||||
* A class representation of the BSON Binary type.
|
||||
*
|
||||
@@ -53,7 +55,7 @@ function Binary(buffer, subType) {
|
||||
if (typeof buffer === 'string') {
|
||||
// Different ways of writing the length of the string for the different types
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
this.buffer = new Buffer(buffer);
|
||||
this.buffer = utils.toBuffer(buffer);
|
||||
} else if (
|
||||
typeof Uint8Array !== 'undefined' ||
|
||||
Object.prototype.toString.call(buffer) === '[object Array]'
|
||||
@@ -68,7 +70,7 @@ function Binary(buffer, subType) {
|
||||
this.position = buffer.length;
|
||||
} else {
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
this.buffer = new Buffer(Binary.BUFFER_SIZE);
|
||||
this.buffer = utils.allocBuffer(Binary.BUFFER_SIZE);
|
||||
} else if (typeof Uint8Array !== 'undefined') {
|
||||
this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE));
|
||||
} else {
|
||||
@@ -107,7 +109,7 @@ Binary.prototype.put = function put(byte_value) {
|
||||
} else {
|
||||
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) {
|
||||
// Create additional overflow buffer
|
||||
var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length);
|
||||
var buffer = utils.allocBuffer(Binary.BUFFER_SIZE + this.buffer.length);
|
||||
// Combine the two buffers together
|
||||
this.buffer.copy(buffer, 0, 0, this.buffer.length);
|
||||
this.buffer = buffer;
|
||||
@@ -150,7 +152,7 @@ Binary.prototype.write = function write(string, offset) {
|
||||
var buffer = null;
|
||||
// If we are in node.js
|
||||
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(this.buffer)) {
|
||||
buffer = new Buffer(this.buffer.length + string.length);
|
||||
buffer = utils.allocBuffer(this.buffer.length + string.length);
|
||||
this.buffer.copy(buffer, 0, 0, this.buffer.length);
|
||||
} else if (Object.prototype.toString.call(this.buffer) === '[object Uint8Array]') {
|
||||
// Create a new buffer
|
||||
|
||||
+5
-4
@@ -18,7 +18,8 @@ var Map = require('./map'),
|
||||
// Parts of the parser
|
||||
var deserialize = require('./parser/deserializer'),
|
||||
serializer = require('./parser/serializer'),
|
||||
calculateObjectSize = require('./parser/calculate_size');
|
||||
calculateObjectSize = require('./parser/calculate_size'),
|
||||
utils = require('./parser/utils');
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
@@ -28,7 +29,7 @@ var deserialize = require('./parser/deserializer'),
|
||||
var MAXSIZE = 1024 * 1024 * 17;
|
||||
|
||||
// Current Internal Temporary Serialization Buffer
|
||||
var buffer = new Buffer(MAXSIZE);
|
||||
var buffer = utils.allocBuffer(MAXSIZE);
|
||||
|
||||
var BSON = function() {};
|
||||
|
||||
@@ -56,7 +57,7 @@ BSON.prototype.serialize = function serialize(object, options) {
|
||||
|
||||
// Resize the internal serialization buffer if needed
|
||||
if (buffer.length < minInternalBufferSize) {
|
||||
buffer = new Buffer(minInternalBufferSize);
|
||||
buffer = utils.allocBuffer(minInternalBufferSize);
|
||||
}
|
||||
|
||||
// Attempt to serialize
|
||||
@@ -71,7 +72,7 @@ BSON.prototype.serialize = function serialize(object, options) {
|
||||
[]
|
||||
);
|
||||
// Create the final buffer
|
||||
var finishedBuffer = new Buffer(serializationIndex);
|
||||
var finishedBuffer = utils.allocBuffer(serializationIndex);
|
||||
// Copy into the finished buffer
|
||||
buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);
|
||||
// Return the buffer
|
||||
|
||||
+13
-11
@@ -70,6 +70,8 @@ var INF_POSITIVE_BUFFER = [
|
||||
|
||||
var EXPONENT_REGEX = /^([-+])?(\d+)?$/;
|
||||
|
||||
var utils = require('./parser/utils');
|
||||
|
||||
// Detect if the value is a digit
|
||||
var isDigit = function(value) {
|
||||
return !isNaN(parseInt(value, 10));
|
||||
@@ -143,7 +145,7 @@ var lessThan = function(left, right) {
|
||||
};
|
||||
|
||||
// var longtoHex = function(value) {
|
||||
// var buffer = new Buffer(8);
|
||||
// var buffer = utils.allocBuffer(8);
|
||||
// var index = 0;
|
||||
// // Encode the low 64 bits of the decimal
|
||||
// // Encode low bits
|
||||
@@ -160,7 +162,7 @@ var lessThan = function(left, right) {
|
||||
// };
|
||||
|
||||
// var int32toHex = function(value) {
|
||||
// var buffer = new Buffer(4);
|
||||
// var buffer = utils.allocBuffer(4);
|
||||
// var index = 0;
|
||||
// // Encode the low 64 bits of the decimal
|
||||
// // Encode low bits
|
||||
@@ -265,9 +267,9 @@ Decimal128.fromString = function(string) {
|
||||
// Check if user passed Infinity or NaN
|
||||
if (!isDigit(string[index]) && string[index] !== '.') {
|
||||
if (string[index] === 'i' || string[index] === 'I') {
|
||||
return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));
|
||||
} else if (string[index] === 'N') {
|
||||
return new Decimal128(new Buffer(NAN_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(NAN_BUFFER));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +277,7 @@ Decimal128.fromString = function(string) {
|
||||
while (isDigit(string[index]) || string[index] === '.') {
|
||||
if (string[index] === '.') {
|
||||
if (sawRadix) {
|
||||
return new Decimal128(new Buffer(NAN_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(NAN_BUFFER));
|
||||
}
|
||||
|
||||
sawRadix = true;
|
||||
@@ -320,7 +322,7 @@ Decimal128.fromString = function(string) {
|
||||
|
||||
// No digits read
|
||||
if (!match || !match[2]) {
|
||||
return new Decimal128(new Buffer(NAN_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(NAN_BUFFER));
|
||||
}
|
||||
|
||||
// Get exponent
|
||||
@@ -332,7 +334,7 @@ Decimal128.fromString = function(string) {
|
||||
|
||||
// Return not a number
|
||||
if (string[index]) {
|
||||
return new Decimal128(new Buffer(NAN_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(NAN_BUFFER));
|
||||
}
|
||||
|
||||
// Done reading input
|
||||
@@ -380,7 +382,7 @@ Decimal128.fromString = function(string) {
|
||||
exponent = EXPONENT_MAX;
|
||||
break;
|
||||
} else {
|
||||
return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +414,7 @@ Decimal128.fromString = function(string) {
|
||||
exponent = EXPONENT_MAX;
|
||||
break;
|
||||
} else {
|
||||
return new Decimal128(new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));
|
||||
return new Decimal128(utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -462,7 +464,7 @@ Decimal128.fromString = function(string) {
|
||||
digits[dIdx] = 1;
|
||||
} else {
|
||||
return new Decimal128(
|
||||
new Buffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)
|
||||
utils.toBuffer(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -547,7 +549,7 @@ Decimal128.fromString = function(string) {
|
||||
}
|
||||
|
||||
// Encode into a buffer
|
||||
var buffer = new Buffer(16);
|
||||
var buffer = utils.allocBuffer(16);
|
||||
index = 0;
|
||||
|
||||
// Encode the low 64 bits of the decimal
|
||||
|
||||
+6
-4
@@ -1,6 +1,8 @@
|
||||
// Custom inspect property name / symbol.
|
||||
var inspect = 'inspect';
|
||||
|
||||
var utils = require('./parser/utils');
|
||||
|
||||
/**
|
||||
* Machine id.
|
||||
*
|
||||
@@ -58,7 +60,7 @@ var ObjectID = function ObjectID(id) {
|
||||
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
|
||||
);
|
||||
} else if (valid && typeof id === 'string' && id.length === 24 && hasBufferType) {
|
||||
return new ObjectID(new Buffer(id, 'hex'));
|
||||
return new ObjectID(utils.toBuffer(id, 'hex'));
|
||||
} else if (valid && typeof id === 'string' && id.length === 24) {
|
||||
return ObjectID.createFromHexString(id);
|
||||
} else if (id != null && id.length === 12) {
|
||||
@@ -158,7 +160,7 @@ ObjectID.prototype.generate = function(time) {
|
||||
: process.pid) % 0xffff;
|
||||
var inc = this.get_inc();
|
||||
// Buffer used
|
||||
var buffer = new Buffer(12);
|
||||
var buffer = utils.allocBuffer(12);
|
||||
// Encode time
|
||||
buffer[3] = time & 0xff;
|
||||
buffer[2] = (time >> 8) & 0xff;
|
||||
@@ -277,7 +279,7 @@ ObjectID.createPk = function createPk() {
|
||||
* @return {ObjectID} return the created ObjectID
|
||||
*/
|
||||
ObjectID.createFromTime = function createFromTime(time) {
|
||||
var buffer = new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
var buffer = utils.toBuffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
// Encode time into first 4 bytes
|
||||
buffer[3] = time & 0xff;
|
||||
buffer[2] = (time >> 8) & 0xff;
|
||||
@@ -315,7 +317,7 @@ ObjectID.createFromHexString = function createFromHexString(string) {
|
||||
}
|
||||
|
||||
// Use Buffer.from method if available
|
||||
if (hasBufferType) return new ObjectID(new Buffer(string, 'hex'));
|
||||
if (hasBufferType) return new ObjectID(utils.toBuffer(string, 'hex'));
|
||||
|
||||
// Calculate lengths
|
||||
var array = new _Buffer(12);
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ function calculateElement(name, value, serializeFunctions, isArray, ignoreUndefi
|
||||
value['_bsontype'] === 'MaxKey'
|
||||
) {
|
||||
return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + 1;
|
||||
} else if (value instanceof ObjectID || value['_bsontype'] === 'ObjectID') {
|
||||
} else if (value instanceof ObjectID || value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') {
|
||||
return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (12 + 1);
|
||||
} else if (value instanceof Date || isDate(value)) {
|
||||
return (name != null ? Buffer.byteLength(name, 'utf8') + 1 : 0) + (8 + 1);
|
||||
|
||||
+5
-3
@@ -14,6 +14,8 @@ var Long = require('../long').Long,
|
||||
BSONRegExp = require('../regexp').BSONRegExp,
|
||||
Binary = require('../binary').Binary;
|
||||
|
||||
var utils = require('./utils');
|
||||
|
||||
var deserialize = function(buffer, options, isArray) {
|
||||
options = options == null ? {} : options;
|
||||
var index = options && options.index ? options.index : 0;
|
||||
@@ -115,7 +117,7 @@ var deserializeObject = function(buffer, index, options, isArray) {
|
||||
object[name] = buffer.toString('utf8', index, index + stringSize - 1);
|
||||
index = index + stringSize;
|
||||
} else if (elementType === BSON.BSON_DATA_OID) {
|
||||
var oid = new Buffer(12);
|
||||
var oid = utils.allocBuffer(12);
|
||||
buffer.copy(oid, 0, index, index + 12);
|
||||
object[name] = new ObjectID(oid);
|
||||
index = index + 12;
|
||||
@@ -220,7 +222,7 @@ var deserializeObject = function(buffer, index, options, isArray) {
|
||||
}
|
||||
} else if (elementType === BSON.BSON_DATA_DECIMAL128) {
|
||||
// Buffer to contain the decimal bytes
|
||||
var bytes = new Buffer(16);
|
||||
var bytes = utils.allocBuffer(16);
|
||||
// Copy the next 16 bytes into the bytes buffer
|
||||
buffer.copy(bytes, 0, index, index + 16);
|
||||
// Update index
|
||||
@@ -520,7 +522,7 @@ var deserializeObject = function(buffer, index, options, isArray) {
|
||||
index = index + stringSize;
|
||||
|
||||
// Read the oid
|
||||
var oidBuffer = new Buffer(12);
|
||||
var oidBuffer = utils.allocBuffer(12);
|
||||
buffer.copy(oidBuffer, 0, index, index + 12);
|
||||
oid = new ObjectID(oidBuffer);
|
||||
|
||||
|
||||
+4
-5
@@ -2,7 +2,6 @@
|
||||
|
||||
var writeIEEE754 = require('../float_parser').writeIEEE754,
|
||||
Long = require('../long').Long,
|
||||
MinKey = require('../min_key').MinKey,
|
||||
Map = require('../map'),
|
||||
Binary = require('../binary').Binary;
|
||||
|
||||
@@ -251,7 +250,7 @@ var serializeMinMax = function(buffer, key, value, index, isArray) {
|
||||
// Write the type of either min or max key
|
||||
if (value === null) {
|
||||
buffer[index++] = BSON.BSON_DATA_NULL;
|
||||
} else if (value instanceof MinKey) {
|
||||
} else if (value._bsontype === 'MinKey') {
|
||||
buffer[index++] = BSON.BSON_DATA_MIN_KEY;
|
||||
} else {
|
||||
buffer[index++] = BSON.BSON_DATA_MAX_KEY;
|
||||
@@ -718,7 +717,7 @@ var serializeInto = function serializeInto(
|
||||
index = serializeNull(buffer, key, value, index, true);
|
||||
} else if (value === null) {
|
||||
index = serializeNull(buffer, key, value, index, true);
|
||||
} else if (value['_bsontype'] === 'ObjectID') {
|
||||
} else if (value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') {
|
||||
index = serializeObjectId(buffer, key, value, index, true);
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
index = serializeBuffer(buffer, key, value, index, true);
|
||||
@@ -826,7 +825,7 @@ var serializeInto = function serializeInto(
|
||||
// } else if (value === undefined && ignoreUndefined === true) {
|
||||
} else if (value === null || (value === undefined && ignoreUndefined === false)) {
|
||||
index = serializeNull(buffer, key, value, index);
|
||||
} else if (value['_bsontype'] === 'ObjectID') {
|
||||
} else if (value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') {
|
||||
index = serializeObjectId(buffer, key, value, index);
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
index = serializeBuffer(buffer, key, value, index);
|
||||
@@ -928,7 +927,7 @@ var serializeInto = function serializeInto(
|
||||
if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index);
|
||||
} else if (value === null) {
|
||||
index = serializeNull(buffer, key, value, index);
|
||||
} else if (value['_bsontype'] === 'ObjectID') {
|
||||
} else if (value['_bsontype'] === 'ObjectID' || value['_bsontype'] === 'ObjectId') {
|
||||
index = serializeObjectId(buffer, key, value, index);
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
index = serializeBuffer(buffer, key, value, index);
|
||||
|
||||
+15
-1
@@ -8,7 +8,21 @@ function normalizedFunctionString(fn) {
|
||||
return fn.toString().replace(/function *\(/, 'function (');
|
||||
}
|
||||
|
||||
function newBuffer(item, encoding) {
|
||||
return new Buffer(item, encoding);
|
||||
}
|
||||
|
||||
function allocBuffer() {
|
||||
return Buffer.alloc.apply(Buffer, arguments);
|
||||
}
|
||||
|
||||
function toBuffer() {
|
||||
return Buffer.from.apply(Buffer, arguments);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
normalizedFunctionString: normalizedFunctionString
|
||||
normalizedFunctionString: normalizedFunctionString,
|
||||
allocBuffer: typeof Buffer.alloc === 'function' ? allocBuffer : newBuffer,
|
||||
toBuffer: typeof Buffer.from === 'function' ? toBuffer : newBuffer
|
||||
};
|
||||
|
||||
|
||||
+11
-11
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"_from": "bson@~1.1.0",
|
||||
"_id": "bson@1.1.0",
|
||||
"_from": "bson@^1.1.1",
|
||||
"_id": "bson@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==",
|
||||
"_integrity": "sha512-jCGVYLoYMHDkOsbwJZBCqwMHyH4c+wzgI9hG7Z6SZJRXWr+x58pdIbm2i9a/jFGCkRJqRUr8eoI7lDWa0hTkxg==",
|
||||
"_location": "/bson",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "bson@~1.1.0",
|
||||
"raw": "bson@^1.1.1",
|
||||
"name": "bson",
|
||||
"escapedName": "bson",
|
||||
"rawSpec": "~1.1.0",
|
||||
"rawSpec": "^1.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.1.0"
|
||||
"fetchSpec": "^1.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mongodb-core",
|
||||
"/mongoose"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz",
|
||||
"_shasum": "bee57d1fb6a87713471af4e32bcae36de814b5b0",
|
||||
"_spec": "bson@~1.1.0",
|
||||
"_where": "D:\\Gitterra\\om\\node_modules\\mongoose",
|
||||
"_resolved": "https://registry.npmjs.org/bson/-/bson-1.1.1.tgz",
|
||||
"_shasum": "4330f5e99104c4e751e7351859e2d408279f2f13",
|
||||
"_spec": "bson@^1.1.1",
|
||||
"_where": "/home/erik/Documents/workspace_brackets/a1_BME_Project_Ohm/om/node_modules/mongodb-core",
|
||||
"author": {
|
||||
"name": "Christian Amor Kvalheim",
|
||||
"email": "christkv@gmail.com"
|
||||
@@ -84,5 +84,5 @@
|
||||
"lint": "eslint lib test",
|
||||
"test": "nodeunit ./test/node"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
"version": "1.1.1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user