@@ -5,12 +5,6 @@ import { DBRef } from './db_ref';
55import { Decimal128 } from './decimal128' ;
66import { Double } from './double' ;
77import { 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' ;
148import { Int32 } from './int_32' ;
159import { Long } from './long' ;
1610import { Map } from './map' ;
@@ -24,7 +18,8 @@ import { serializeInto as internalSerialize, SerializeOptions } from './parser/s
2418import { BSONRegExp } from './regexp' ;
2519import { BSONSymbol } from './symbol' ;
2620import { Timestamp } from './timestamp' ;
27-
21+ export { BinaryExtended , BinaryExtendedLegacy , BinarySequence } from './binary' ;
22+ export { CodeExtended } from './code' ;
2823export {
2924 BSON_BINARY_SUBTYPE_BYTE_ARRAY ,
3025 BSON_BINARY_SUBTYPE_DEFAULT ,
@@ -61,6 +56,24 @@ export {
6156 JS_INT_MAX ,
6257 JS_INT_MIN
6358} 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' ;
6477export { SerializeOptions , DeserializeOptions } ;
6578export {
6679 Code ,
@@ -83,13 +96,7 @@ export {
8396 ObjectId as ObjectID
8497} ;
8598
86- export const EJSON = {
87- parse : EJSON_parse ,
88- stringify : EJSON_stringify ,
89- serialize : EJSON_serialize ,
90- deserialize : EJSON_deserialize
91- } ;
92-
99+ /** @public */
93100export interface Document {
94101 // eslint-disable-next-line @typescript-eslint/no-explicit-any
95102 [ key : string ] : any ;
@@ -106,6 +113,7 @@ let buffer = Buffer.alloc(MAXSIZE);
106113 * Sets the size of the internal serialization buffer.
107114 *
108115 * @param size - The desired size for the internal serialization buffer
116+ * @public
109117 */
110118export function setInternalBufferSize ( size : number ) : void {
111119 // Resize the internal serialization buffer if needed
@@ -119,6 +127,7 @@ export function setInternalBufferSize(size: number): void {
119127 *
120128 * @param object - the Javascript object to serialize.
121129 * @returns Buffer object containing the serialized object.
130+ * @public
122131 */
123132export function serialize ( object : Document , options : SerializeOptions = { } ) : Buffer {
124133 // Unpack the options
@@ -164,6 +173,7 @@ export function serialize(object: Document, options: SerializeOptions = {}): Buf
164173 * @param object - the Javascript object to serialize.
165174 * @param finalBuffer - the Buffer you pre-allocated to store the serialized BSON object.
166175 * @returns the index pointing to the last written byte in the buffer.
176+ * @public
167177 */
168178export function serializeWithBufferAndIndex (
169179 object : Document ,
@@ -199,6 +209,7 @@ export function serializeWithBufferAndIndex(
199209 *
200210 * @param buffer - the buffer containing the serialized set of BSON documents.
201211 * @returns returns the deserialized Javascript Object.
212+ * @public
202213 */
203214export function deserialize (
204215 buffer : Buffer | ArrayBufferView | ArrayBuffer ,
@@ -207,6 +218,7 @@ export function deserialize(
207218 return internalDeserialize ( ensureBuffer ( buffer ) , options ) ;
208219}
209220
221+ /** @public */
210222export type CalculateObjectSizeOptions = Pick <
211223 SerializeOptions ,
212224 'serializeFunctions' | 'ignoreUndefined'
@@ -217,6 +229,7 @@ export type CalculateObjectSizeOptions = Pick<
217229 *
218230 * @param object - the Javascript object to calculate the BSON byte size for
219231 * @returns size of BSON object in bytes
232+ * @public
220233 */
221234export function calculateObjectSize (
222235 object : Document ,
@@ -242,6 +255,7 @@ export function calculateObjectSize(
242255 * @param docStartIndex - the index in the documents array from where to start inserting documents.
243256 * @param options - additional options used for the deserialization.
244257 * @returns next index in the buffer after deserialization **x** numbers of documents.
258+ * @public
245259 */
246260export function deserializeStream (
247261 data : Buffer | ArrayBufferView | ArrayBuffer ,
0 commit comments