bson 4.5.2 → 4.6.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/bower.json +1 -1
- package/bson.d.ts +39 -3
- package/dist/bson.browser.esm.js +320 -187
- package/dist/bson.browser.esm.js.map +1 -1
- package/dist/bson.browser.umd.js +323 -186
- package/dist/bson.browser.umd.js.map +1 -1
- package/dist/bson.bundle.js +323 -186
- package/dist/bson.bundle.js.map +1 -1
- package/dist/bson.esm.js +320 -187
- package/dist/bson.esm.js.map +1 -1
- package/lib/binary.js +11 -6
- package/lib/binary.js.map +1 -1
- package/lib/bson.js +11 -3
- package/lib/bson.js.map +1 -1
- package/lib/constants.js +5 -1
- package/lib/constants.js.map +1 -1
- package/lib/decimal128.js +13 -5
- package/lib/decimal128.js.map +1 -1
- package/lib/ensure_buffer.js +3 -2
- package/lib/ensure_buffer.js.map +1 -1
- package/lib/error.js +55 -0
- package/lib/error.js.map +1 -0
- package/lib/extended_json.js +11 -5
- package/lib/extended_json.js.map +1 -1
- package/lib/int_32.js +1 -1
- package/lib/int_32.js.map +1 -1
- package/lib/objectid.js +42 -47
- package/lib/objectid.js.map +1 -1
- package/lib/parser/calculate_size.js +2 -2
- package/lib/parser/calculate_size.js.map +1 -1
- package/lib/parser/deserializer.js +131 -53
- package/lib/parser/deserializer.js.map +1 -1
- package/lib/parser/serializer.js +16 -20
- package/lib/parser/serializer.js.map +1 -1
- package/lib/regexp.js +9 -2
- package/lib/regexp.js.map +1 -1
- package/lib/uuid.js +2 -1
- package/lib/uuid.js.map +1 -1
- package/lib/uuid_utils.js +2 -1
- package/lib/uuid_utils.js.map +1 -1
- package/package.json +4 -2
- package/src/binary.ts +11 -6
- package/src/bson.ts +7 -1
- package/src/constants.ts +6 -0
- package/src/decimal128.ts +12 -5
- package/src/ensure_buffer.ts +3 -2
- package/src/error.ts +23 -0
- package/src/extended_json.ts +13 -5
- package/src/int_32.ts +1 -1
- package/src/objectid.ts +44 -62
- package/src/parser/calculate_size.ts +2 -2
- package/src/parser/deserializer.ts +159 -57
- package/src/parser/serializer.ts +16 -17
- package/src/regexp.ts +14 -2
- package/src/uuid.ts +2 -1
- package/src/uuid_utils.ts +2 -1
package/bower.json
CHANGED
package/bson.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export declare class Binary {
|
|
|
20
20
|
static readonly SUBTYPE_UUID = 4;
|
|
21
21
|
/** MD5 BSON type */
|
|
22
22
|
static readonly SUBTYPE_MD5 = 5;
|
|
23
|
+
/** Encrypted BSON type */
|
|
24
|
+
static readonly SUBTYPE_ENCRYPTED = 6;
|
|
25
|
+
/** Column BSON type */
|
|
26
|
+
static readonly SUBTYPE_COLUMN = 7;
|
|
23
27
|
/** User BSON type */
|
|
24
28
|
static readonly SUBTYPE_USER_DEFINED = 128;
|
|
25
29
|
buffer: Buffer;
|
|
@@ -112,10 +116,14 @@ declare const BSON: {
|
|
|
112
116
|
deserialize: typeof deserialize;
|
|
113
117
|
calculateObjectSize: typeof calculateObjectSize;
|
|
114
118
|
deserializeStream: typeof deserializeStream;
|
|
119
|
+
BSONError: typeof BSONError;
|
|
120
|
+
BSONTypeError: typeof BSONTypeError;
|
|
115
121
|
};
|
|
116
122
|
export default BSON;
|
|
117
123
|
/* Excluded from this release type: BSON_BINARY_SUBTYPE_BYTE_ARRAY */
|
|
124
|
+
/* Excluded from this release type: BSON_BINARY_SUBTYPE_COLUMN */
|
|
118
125
|
/* Excluded from this release type: BSON_BINARY_SUBTYPE_DEFAULT */
|
|
126
|
+
/* Excluded from this release type: BSON_BINARY_SUBTYPE_ENCRYPTED */
|
|
119
127
|
/* Excluded from this release type: BSON_BINARY_SUBTYPE_FUNCTION */
|
|
120
128
|
/* Excluded from this release type: BSON_BINARY_SUBTYPE_MD5 */
|
|
121
129
|
/* Excluded from this release type: BSON_BINARY_SUBTYPE_USER_DEFINED */
|
|
@@ -146,6 +154,11 @@ export default BSON;
|
|
|
146
154
|
/* Excluded from this release type: BSON_INT32_MIN */
|
|
147
155
|
/* Excluded from this release type: BSON_INT64_MAX */
|
|
148
156
|
/* Excluded from this release type: BSON_INT64_MIN */
|
|
157
|
+
/** @public */
|
|
158
|
+
export declare class BSONError extends Error {
|
|
159
|
+
constructor(message: string);
|
|
160
|
+
readonly name: string;
|
|
161
|
+
}
|
|
149
162
|
/**
|
|
150
163
|
* A class representation of the BSON RegExp type.
|
|
151
164
|
* @public
|
|
@@ -194,6 +207,11 @@ export declare class BSONSymbol {
|
|
|
194
207
|
export declare interface BSONSymbolExtended {
|
|
195
208
|
$symbol: string;
|
|
196
209
|
}
|
|
210
|
+
/** @public */
|
|
211
|
+
export declare class BSONTypeError extends TypeError {
|
|
212
|
+
constructor(message: string);
|
|
213
|
+
readonly name: string;
|
|
214
|
+
}
|
|
197
215
|
/**
|
|
198
216
|
* Calculate the bson size for a passed in Javascript object.
|
|
199
217
|
*
|
|
@@ -323,6 +341,24 @@ export declare interface DeserializeOptions {
|
|
|
323
341
|
/** Offset into buffer to begin reading document from */
|
|
324
342
|
index?: number;
|
|
325
343
|
raw?: boolean;
|
|
344
|
+
/** Allows for opt-out utf-8 validation for all keys or
|
|
345
|
+
* specified keys. Must be all true or all false.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```js
|
|
349
|
+
* // disables validation on all keys
|
|
350
|
+
* validation: { utf8: false }
|
|
351
|
+
*
|
|
352
|
+
* // enables validation only on specified keys a, b, and c
|
|
353
|
+
* validation: { utf8: { a: true, b: true, c: true } }
|
|
354
|
+
*
|
|
355
|
+
* // disables validation only on specified keys a, b
|
|
356
|
+
* validation: { utf8: { a: false, b: false } }
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
validation?: {
|
|
360
|
+
utf8: boolean | Record<string, true> | Record<string, false>;
|
|
361
|
+
};
|
|
326
362
|
}
|
|
327
363
|
/**
|
|
328
364
|
* Deserialize stream data as BSON documents.
|
|
@@ -847,9 +883,9 @@ declare class ObjectId {
|
|
|
847
883
|
/**
|
|
848
884
|
* Create an ObjectId type
|
|
849
885
|
*
|
|
850
|
-
* @param
|
|
886
|
+
* @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.
|
|
851
887
|
*/
|
|
852
|
-
constructor(
|
|
888
|
+
constructor(inputId?: string | number | ObjectId | ObjectIdLike | Buffer | Uint8Array);
|
|
853
889
|
/*
|
|
854
890
|
* The ObjectId bytes
|
|
855
891
|
* @readonly
|
|
@@ -903,7 +939,7 @@ declare class ObjectId {
|
|
|
903
939
|
*
|
|
904
940
|
* @param id - ObjectId instance to validate.
|
|
905
941
|
*/
|
|
906
|
-
static isValid(id:
|
|
942
|
+
static isValid(id: string | number | ObjectId | ObjectIdLike | Buffer | Uint8Array): boolean;
|
|
907
943
|
/* Excluded from this release type: toExtendedJSON */
|
|
908
944
|
/* Excluded from this release type: fromExtendedJSON */
|
|
909
945
|
inspect(): string;
|