@@ -5,12 +5,6 @@ import { DBRef } from './db_ref';
5
5
import { Decimal128 } from './decimal128' ;
6
6
import { Double } from './double' ;
7
7
import { ensureBuffer } from './ensure_buffer' ;
8
- import {
9
- deserialize as EJSON_deserialize ,
10
- parse as EJSON_parse ,
11
- serialize as EJSON_serialize ,
12
- stringify as EJSON_stringify
13
- } from './extended_json' ;
14
8
import { Int32 } from './int_32' ;
15
9
import { Long } from './long' ;
16
10
import { Map } from './map' ;
@@ -24,7 +18,8 @@ import { serializeInto as internalSerialize, SerializeOptions } from './parser/s
24
18
import { BSONRegExp } from './regexp' ;
25
19
import { BSONSymbol } from './symbol' ;
26
20
import { Timestamp } from './timestamp' ;
27
-
21
+ export { BinaryExtended , BinaryExtendedLegacy , BinarySequence } from './binary' ;
22
+ export { CodeExtended } from './code' ;
28
23
export {
29
24
BSON_BINARY_SUBTYPE_BYTE_ARRAY ,
30
25
BSON_BINARY_SUBTYPE_DEFAULT ,
@@ -61,6 +56,24 @@ export {
61
56
JS_INT_MAX ,
62
57
JS_INT_MIN
63
58
} from './constants' ;
59
+ export { DBRefLike } from './db_ref' ;
60
+ export { Decimal128Extended } from './decimal128' ;
61
+ export { DoubleExtended } from './double' ;
62
+ export { EJSON , EJSONOptions } from './extended_json' ;
63
+ export { Int32Extended } from './int_32' ;
64
+ export { LongExtended } from './long' ;
65
+ export { MaxKeyExtended } from './max_key' ;
66
+ export { MinKeyExtended } from './min_key' ;
67
+ export { ObjectIdExtended , ObjectIdLike } from './objectid' ;
68
+ export { BSONRegExpExtended , BSONRegExpExtendedLegacy } from './regexp' ;
69
+ export { BSONSymbolExtended } from './symbol' ;
70
+ export {
71
+ LongWithoutOverrides ,
72
+ LongWithoutOverridesClass ,
73
+ TimestampExtended ,
74
+ TimestampOverrides
75
+ } from './timestamp' ;
76
+ export { UUIDExtended } from './uuid' ;
64
77
export { SerializeOptions , DeserializeOptions } ;
65
78
export {
66
79
Code ,
@@ -83,13 +96,7 @@ export {
83
96
ObjectId as ObjectID
84
97
} ;
85
98
86
- export const EJSON = {
87
- parse : EJSON_parse ,
88
- stringify : EJSON_stringify ,
89
- serialize : EJSON_serialize ,
90
- deserialize : EJSON_deserialize
91
- } ;
92
-
99
+ /** @public */
93
100
export interface Document {
94
101
// eslint-disable-next-line @typescript-eslint/no-explicit-any
95
102
[ key : string ] : any ;
@@ -106,6 +113,7 @@ let buffer = Buffer.alloc(MAXSIZE);
106
113
* Sets the size of the internal serialization buffer.
107
114
*
108
115
* @param size - The desired size for the internal serialization buffer
116
+ * @public
109
117
*/
110
118
export function setInternalBufferSize ( size : number ) : void {
111
119
// Resize the internal serialization buffer if needed
@@ -119,6 +127,7 @@ export function setInternalBufferSize(size: number): void {
119
127
*
120
128
* @param object - the Javascript object to serialize.
121
129
* @returns Buffer object containing the serialized object.
130
+ * @public
122
131
*/
123
132
export function serialize ( object : Document , options : SerializeOptions = { } ) : Buffer {
124
133
// Unpack the options
@@ -164,6 +173,7 @@ export function serialize(object: Document, options: SerializeOptions = {}): Buf
164
173
* @param object - the Javascript object to serialize.
165
174
* @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.
166
175
* @returns the index pointing to the last written byte in the buffer.
176
+ * @public
167
177
*/
168
178
export function serializeWithBufferAndIndex (
169
179
object : Document ,
@@ -199,6 +209,7 @@ export function serializeWithBufferAndIndex(
199
209
*
200
210
* @param buffer - the buffer containing the serialized set of BSON documents.
201
211
* @returns returns the deserialized Javascript Object.
212
+ * @public
202
213
*/
203
214
export function deserialize (
204
215
buffer : Buffer | ArrayBufferView | ArrayBuffer ,
@@ -207,6 +218,7 @@ export function deserialize(
207
218
return internalDeserialize ( ensureBuffer ( buffer ) , options ) ;
208
219
}
209
220
221
+ /** @public */
210
222
export type CalculateObjectSizeOptions = Pick <
211
223
SerializeOptions ,
212
224
'serializeFunctions' | 'ignoreUndefined'
@@ -217,6 +229,7 @@ export type CalculateObjectSizeOptions = Pick<
217
229
*
218
230
* @param object - the Javascript object to calculate the BSON byte size for
219
231
* @returns size of BSON object in bytes
232
+ * @public
220
233
*/
221
234
export function calculateObjectSize (
222
235
object : Document ,
@@ -242,6 +255,7 @@ export function calculateObjectSize(
242
255
* @param docStartIndex - the index in the documents array from where to start inserting documents.
243
256
* @param options - additional options used for the deserialization.
244
257
* @returns next index in the buffer after deserialization **x** numbers of documents.
258
+ * @public
245
259
*/
246
260
export function deserializeStream (
247
261
data : Buffer | ArrayBufferView | ArrayBuffer ,
0 commit comments