[@types/bson] Updated BSON types (#27259)

* `Binary`: Added `sub_type` property.
* `Code`: Added `code` and `scope` properties
* Added missing `Int32` type
* `Decimal128`: Added `bytes` property
* `BSONRegExp`: Added `pattern` and `options` properties
* `Symbol`: Added `valueOf()` method
This commit is contained in:
Andrey Tselishchev
2018-07-20 17:33:17 -07:00
committed by Wesley Wigham
parent efce430c49
commit 960c7ef8a0
+30
View File
@@ -131,6 +131,8 @@ export class Binary {
/** The underlying Buffer which stores the binary data. */
readonly buffer: Buffer;
/** Binary data subtype */
readonly sub_type?: number;
/** The length of the binary. */
length(): number;
@@ -146,11 +148,16 @@ export class Binary {
/** A class representation of the BSON Code type. */
export class Code {
/**
* @param code A string or function.
* @param scope An optional scope for the function.
*/
constructor(code: string | Function, scope?: any);
readonly code: string | Function;
readonly scope?: any;
}
/**
@@ -180,6 +187,16 @@ export class Double {
valueOf(): number;
}
/** A class representation of the BSON Int32 type. */
export class Int32 {
/**
* @param value The number we want to represent as an int32.
*/
constructor(value: number);
valueOf(): number;
}
/**
* Base class for Long and Timestamp.
* In original js-node@1.0.x code 'Timestamp' is a 100% copy-paste of 'Long'
@@ -315,6 +332,9 @@ export class Decimal128 {
*/
constructor(bytes: Buffer);
/** A buffer containing the raw Decimal128 bytes. */
readonly bytes: Buffer;
toJSON(): string;
toString(): string;
}
@@ -386,7 +406,12 @@ export { ObjectID as ObjectId };
/** A class representation of the BSON RegExp type. */
export class BSONRegExp {
constructor(pattern: string, options: string);
readonly pattern: string;
readonly options: string;
}
/**
@@ -394,7 +419,12 @@ export class BSONRegExp {
* @deprecated
*/
export class Symbol {
constructor(value: string);
/** Access the wrapped string value. */
valueOf(): string;
}
/** A class representation of the BSON Timestamp type. */