bson 5.3.0 → 6.0.0-alpha.0

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.
Files changed (70) hide show
  1. package/README.md +51 -43
  2. package/bson.d.ts +10 -23
  3. package/lib/bson.bundle.js +44 -71
  4. package/lib/bson.bundle.js.map +1 -1
  5. package/lib/bson.cjs +44 -71
  6. package/lib/bson.cjs.map +1 -1
  7. package/lib/bson.mjs +44 -71
  8. package/lib/bson.mjs.map +1 -1
  9. package/lib/bson.rn.cjs +4081 -0
  10. package/lib/bson.rn.cjs.map +1 -0
  11. package/package.json +26 -24
  12. package/src/binary.ts +19 -53
  13. package/src/bson.ts +2 -2
  14. package/src/constants.ts +1 -1
  15. package/src/objectid.ts +20 -37
  16. package/src/parser/deserializer.ts +8 -8
  17. package/src/timestamp.ts +7 -5
  18. package/src/utils/byte_utils.ts +2 -2
  19. package/src/utils/node_byte_utils.ts +3 -3
  20. package/src/utils/web_byte_utils.ts +2 -2
  21. package/vendor/base64/LICENSE-MIT.txt +20 -0
  22. package/vendor/base64/README.md +112 -0
  23. package/vendor/base64/base64.js +157 -0
  24. package/vendor/base64/package.json +43 -0
  25. package/vendor/text-encoding/LICENSE.md +237 -0
  26. package/vendor/text-encoding/README.md +111 -0
  27. package/vendor/text-encoding/index.js +9 -0
  28. package/vendor/text-encoding/lib/encoding-indexes.js +47 -0
  29. package/vendor/text-encoding/lib/encoding.js +3301 -0
  30. package/vendor/text-encoding/package.json +37 -0
  31. package/lib/binary.d.ts +0 -182
  32. package/lib/binary.d.ts.map +0 -1
  33. package/lib/bson.d.ts +0 -97
  34. package/lib/bson.d.ts.map +0 -1
  35. package/lib/bson_value.d.ts +0 -10
  36. package/lib/bson_value.d.ts.map +0 -1
  37. package/lib/code.d.ts +0 -32
  38. package/lib/code.d.ts.map +0 -1
  39. package/lib/constants.d.ts +0 -107
  40. package/lib/constants.d.ts.map +0 -1
  41. package/lib/db_ref.d.ts +0 -40
  42. package/lib/db_ref.d.ts.map +0 -1
  43. package/lib/decimal128.d.ts +0 -34
  44. package/lib/decimal128.d.ts.map +0 -1
  45. package/lib/double.d.ts +0 -35
  46. package/lib/double.d.ts.map +0 -1
  47. package/lib/error.d.ts +0 -50
  48. package/lib/error.d.ts.map +0 -1
  49. package/lib/extended_json.d.ts +0 -82
  50. package/lib/extended_json.d.ts.map +0 -1
  51. package/lib/index.d.ts +0 -4
  52. package/lib/index.d.ts.map +0 -1
  53. package/lib/int_32.d.ts +0 -35
  54. package/lib/int_32.d.ts.map +0 -1
  55. package/lib/long.d.ts +0 -323
  56. package/lib/long.d.ts.map +0 -1
  57. package/lib/max_key.d.ts +0 -19
  58. package/lib/max_key.d.ts.map +0 -1
  59. package/lib/min_key.d.ts +0 -19
  60. package/lib/min_key.d.ts.map +0 -1
  61. package/lib/objectid.d.ts +0 -96
  62. package/lib/objectid.d.ts.map +0 -1
  63. package/lib/regexp.d.ts +0 -36
  64. package/lib/regexp.d.ts.map +0 -1
  65. package/lib/symbol.d.ts +0 -28
  66. package/lib/symbol.d.ts.map +0 -1
  67. package/lib/timestamp.d.ts +0 -66
  68. package/lib/timestamp.d.ts.map +0 -1
  69. package/lib/validate_utf8.d.ts +0 -10
  70. package/lib/validate_utf8.d.ts.map +0 -1
package/lib/error.d.ts DELETED
@@ -1,50 +0,0 @@
1
- /**
2
- * @public
3
- * @category Error
4
- *
5
- * `BSONError` objects are thrown when BSON ecounters an error.
6
- *
7
- * This is the parent class for all the other errors thrown by this library.
8
- */
9
- export declare class BSONError extends Error {
10
- /**
11
- * @internal
12
- * The underlying algorithm for isBSONError may change to improve how strict it is
13
- * about determining if an input is a BSONError. But it must remain backwards compatible
14
- * with previous minors & patches of the current major version.
15
- */
16
- protected get bsonError(): true;
17
- get name(): string;
18
- constructor(message: string);
19
- /**
20
- * @public
21
- *
22
- * All errors thrown from the BSON library inherit from `BSONError`.
23
- * This method can assist with determining if an error originates from the BSON library
24
- * even if it does not pass an `instanceof` check against this class' constructor.
25
- *
26
- * @param value - any javascript value that needs type checking
27
- */
28
- static isBSONError(value: unknown): value is BSONError;
29
- }
30
- /**
31
- * @public
32
- * @category Error
33
- */
34
- export declare class BSONVersionError extends BSONError {
35
- get name(): 'BSONVersionError';
36
- constructor();
37
- }
38
- /**
39
- * @public
40
- * @category Error
41
- *
42
- * An error generated when BSON functions encounter an unexpected input
43
- * or reaches an unexpected/invalid internal state
44
- *
45
- */
46
- export declare class BSONRuntimeError extends BSONError {
47
- get name(): 'BSONRuntimeError';
48
- constructor(message: string);
49
- }
50
- //# sourceMappingURL=error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC;;;;;OAKG;IACH,SAAS,KAAK,SAAS,IAAI,IAAI,CAE9B;IAED,IAAa,IAAI,IAAI,MAAM,CAE1B;gBAEW,OAAO,EAAE,MAAM;IAI3B;;;;;;;;OAQG;WACW,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS;CAY9D;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,IAAI,IAAI,IAAI,kBAAkB,CAE7B;;CAOF;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,IAAI,IAAI,IAAI,kBAAkB,CAE7B;gBAEW,OAAO,EAAE,MAAM;CAG5B"}
@@ -1,82 +0,0 @@
1
- import type { Document } from './bson';
2
- /** @public */
3
- export type EJSONOptions = {
4
- /**
5
- * Output using the Extended JSON v1 spec
6
- * @defaultValue `false`
7
- */
8
- legacy?: boolean;
9
- /**
10
- * Enable Extended JSON's `relaxed` mode, which attempts to return native JS types where possible, rather than BSON types
11
- * @defaultValue `false` */
12
- relaxed?: boolean;
13
- /**
14
- * Enable native bigint support
15
- * @defaultValue `false`
16
- */
17
- useBigInt64?: boolean;
18
- };
19
- /**
20
- * Parse an Extended JSON string, constructing the JavaScript value or object described by that
21
- * string.
22
- *
23
- * @example
24
- * ```js
25
- * const { EJSON } = require('bson');
26
- * const text = '{ "int32": { "$numberInt": "10" } }';
27
- *
28
- * // prints { int32: { [String: '10'] _bsontype: 'Int32', value: '10' } }
29
- * console.log(EJSON.parse(text, { relaxed: false }));
30
- *
31
- * // prints { int32: 10 }
32
- * console.log(EJSON.parse(text));
33
- * ```
34
- */
35
- declare function parse(text: string, options?: EJSONOptions): any;
36
- /**
37
- * Converts a BSON document to an Extended JSON string, optionally replacing values if a replacer
38
- * function is specified or optionally including only the specified properties if a replacer array
39
- * is specified.
40
- *
41
- * @param value - The value to convert to extended JSON
42
- * @param replacer - A function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string
43
- * @param space - A String or Number object that's used to insert white space into the output JSON string for readability purposes.
44
- * @param options - Optional settings
45
- *
46
- * @example
47
- * ```js
48
- * const { EJSON } = require('bson');
49
- * const Int32 = require('mongodb').Int32;
50
- * const doc = { int32: new Int32(10) };
51
- *
52
- * // prints '{"int32":{"$numberInt":"10"}}'
53
- * console.log(EJSON.stringify(doc, { relaxed: false }));
54
- *
55
- * // prints '{"int32":10}'
56
- * console.log(EJSON.stringify(doc));
57
- * ```
58
- */
59
- declare function stringify(value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSONOptions, space?: string | number, options?: EJSONOptions): string;
60
- /**
61
- * Serializes an object to an Extended JSON string, and reparse it as a JavaScript object.
62
- *
63
- * @param value - The object to serialize
64
- * @param options - Optional settings passed to the `stringify` function
65
- */
66
- declare function EJSONserialize(value: any, options?: EJSONOptions): Document;
67
- /**
68
- * Deserializes an Extended JSON object into a plain JavaScript object with native/BSON types
69
- *
70
- * @param ejson - The Extended JSON object to deserialize
71
- * @param options - Optional settings passed to the parse method
72
- */
73
- declare function EJSONdeserialize(ejson: Document, options?: EJSONOptions): any;
74
- /** @public */
75
- declare const EJSON: {
76
- parse: typeof parse;
77
- stringify: typeof stringify;
78
- serialize: typeof EJSONserialize;
79
- deserialize: typeof EJSONdeserialize;
80
- };
81
- export { EJSON };
82
- //# sourceMappingURL=extended_json.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extended_json.d.ts","sourceRoot":"","sources":["../src/extended_json.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAuBvC,cAAc;AACd,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;+BAE2B;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAqWF;;;;;;;;;;;;;;;GAeG;AAEH,iBAAS,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,GAAG,CAcxD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,SAAS,CAEhB,KAAK,EAAE,GAAG,EAEV,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,YAAY,EAC7F,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,CAAC,EAAE,YAAY,GACrB,MAAM,CAgBR;AAED;;;;;GAKG;AAEH,iBAAS,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,QAAQ,CAGpE;AAED;;;;;GAKG;AAEH,iBAAS,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,GAAG,CAGtE;AAED,cAAc;AACd,QAAA,MAAM,KAAK,EAAE;IACX,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,SAAS,EAAE,OAAO,cAAc,CAAC;IACjC,WAAW,EAAE,OAAO,gBAAgB,CAAC;CAChB,CAAC;AAMxB,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as BSON from './bson';
2
- export * from './bson';
3
- export { BSON };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAK/B,cAAc,QAAQ,CAAC;AAKvB,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/lib/int_32.d.ts DELETED
@@ -1,35 +0,0 @@
1
- import { BSONValue } from './bson_value';
2
- import type { EJSONOptions } from './extended_json';
3
- /** @public */
4
- export interface Int32Extended {
5
- $numberInt: string;
6
- }
7
- /**
8
- * A class representation of a BSON Int32 type.
9
- * @public
10
- * @category BSONType
11
- */
12
- export declare class Int32 extends BSONValue {
13
- get _bsontype(): 'Int32';
14
- value: number;
15
- /**
16
- * Create an Int32 type
17
- *
18
- * @param value - the number we want to represent as an int32.
19
- */
20
- constructor(value: number | string);
21
- /**
22
- * Access the number value.
23
- *
24
- * @returns returns the wrapped int32 number.
25
- */
26
- valueOf(): number;
27
- toString(radix?: number): string;
28
- toJSON(): number;
29
- /** @internal */
30
- toExtendedJSON(options?: EJSONOptions): number | Int32Extended;
31
- /** @internal */
32
- static fromExtendedJSON(doc: Int32Extended, options?: EJSONOptions): number | Int32;
33
- inspect(): string;
34
- }
35
- //# sourceMappingURL=int_32.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"int_32.d.ts","sourceRoot":"","sources":["../src/int_32.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,cAAc;AACd,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,KAAM,SAAQ,SAAS;IAClC,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,KAAK,EAAG,MAAM,CAAC;IACf;;;;OAIG;gBACS,KAAK,EAAE,MAAM,GAAG,MAAM;IASlC;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAIjB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAIhC,MAAM,IAAI,MAAM;IAIhB,gBAAgB;IAChB,cAAc,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,aAAa;IAK9D,gBAAgB;IAChB,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,KAAK;IASnF,OAAO,IAAI,MAAM;CAGlB"}
package/lib/long.d.ts DELETED
@@ -1,323 +0,0 @@
1
- import { BSONValue } from './bson_value';
2
- import type { EJSONOptions } from './extended_json';
3
- import type { Timestamp } from './timestamp';
4
- /** @public */
5
- export interface LongExtended {
6
- $numberLong: string;
7
- }
8
- /**
9
- * A class representing a 64-bit integer
10
- * @public
11
- * @category BSONType
12
- * @remarks
13
- * The internal representation of a long is the two given signed, 32-bit values.
14
- * We use 32-bit pieces because these are the size of integers on which
15
- * Javascript performs bit-operations. For operations like addition and
16
- * multiplication, we split each number into 16 bit pieces, which can easily be
17
- * multiplied within Javascript's floating-point representation without overflow
18
- * or change in sign.
19
- * In the algorithms below, we frequently reduce the negative case to the
20
- * positive case by negating the input(s) and then post-processing the result.
21
- * Note that we must ALWAYS check specially whether those values are MIN_VALUE
22
- * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
23
- * a positive number, it overflows back into a negative). Not handling this
24
- * case would often result in infinite recursion.
25
- * Common constant values ZERO, ONE, NEG_ONE, etc. are found as static properties on this class.
26
- */
27
- export declare class Long extends BSONValue {
28
- get _bsontype(): 'Long';
29
- /** An indicator used to reliably determine if an object is a Long or not. */
30
- get __isLong__(): boolean;
31
- /**
32
- * The high 32 bits as a signed value.
33
- */
34
- high: number;
35
- /**
36
- * The low 32 bits as a signed value.
37
- */
38
- low: number;
39
- /**
40
- * Whether unsigned or not.
41
- */
42
- unsigned: boolean;
43
- /**
44
- * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
45
- * See the from* functions below for more convenient ways of constructing Longs.
46
- *
47
- * Acceptable signatures are:
48
- * - Long(low, high, unsigned?)
49
- * - Long(bigint, unsigned?)
50
- * - Long(string, unsigned?)
51
- *
52
- * @param low - The low (signed) 32 bits of the long
53
- * @param high - The high (signed) 32 bits of the long
54
- * @param unsigned - Whether unsigned or not, defaults to signed
55
- */
56
- constructor(low?: number | bigint | string, high?: number | boolean, unsigned?: boolean);
57
- static TWO_PWR_24: Long;
58
- /** Maximum unsigned value. */
59
- static MAX_UNSIGNED_VALUE: Long;
60
- /** Signed zero */
61
- static ZERO: Long;
62
- /** Unsigned zero. */
63
- static UZERO: Long;
64
- /** Signed one. */
65
- static ONE: Long;
66
- /** Unsigned one. */
67
- static UONE: Long;
68
- /** Signed negative one. */
69
- static NEG_ONE: Long;
70
- /** Maximum signed value. */
71
- static MAX_VALUE: Long;
72
- /** Minimum signed value. */
73
- static MIN_VALUE: Long;
74
- /**
75
- * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits.
76
- * Each is assumed to use 32 bits.
77
- * @param lowBits - The low 32 bits
78
- * @param highBits - The high 32 bits
79
- * @param unsigned - Whether unsigned or not, defaults to signed
80
- * @returns The corresponding Long value
81
- */
82
- static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
83
- /**
84
- * Returns a Long representing the given 32 bit integer value.
85
- * @param value - The 32 bit integer in question
86
- * @param unsigned - Whether unsigned or not, defaults to signed
87
- * @returns The corresponding Long value
88
- */
89
- static fromInt(value: number, unsigned?: boolean): Long;
90
- /**
91
- * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
92
- * @param value - The number in question
93
- * @param unsigned - Whether unsigned or not, defaults to signed
94
- * @returns The corresponding Long value
95
- */
96
- static fromNumber(value: number, unsigned?: boolean): Long;
97
- /**
98
- * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
99
- * @param value - The number in question
100
- * @param unsigned - Whether unsigned or not, defaults to signed
101
- * @returns The corresponding Long value
102
- */
103
- static fromBigInt(value: bigint, unsigned?: boolean): Long;
104
- /**
105
- * Returns a Long representation of the given string, written using the specified radix.
106
- * @param str - The textual representation of the Long
107
- * @param unsigned - Whether unsigned or not, defaults to signed
108
- * @param radix - The radix in which the text is written (2-36), defaults to 10
109
- * @returns The corresponding Long value
110
- */
111
- static fromString(str: string, unsigned?: boolean, radix?: number): Long;
112
- /**
113
- * Creates a Long from its byte representation.
114
- * @param bytes - Byte representation
115
- * @param unsigned - Whether unsigned or not, defaults to signed
116
- * @param le - Whether little or big endian, defaults to big endian
117
- * @returns The corresponding Long value
118
- */
119
- static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
120
- /**
121
- * Creates a Long from its little endian byte representation.
122
- * @param bytes - Little endian byte representation
123
- * @param unsigned - Whether unsigned or not, defaults to signed
124
- * @returns The corresponding Long value
125
- */
126
- static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
127
- /**
128
- * Creates a Long from its big endian byte representation.
129
- * @param bytes - Big endian byte representation
130
- * @param unsigned - Whether unsigned or not, defaults to signed
131
- * @returns The corresponding Long value
132
- */
133
- static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
134
- /**
135
- * Tests if the specified object is a Long.
136
- */
137
- static isLong(value: unknown): value is Long;
138
- /**
139
- * Converts the specified value to a Long.
140
- * @param unsigned - Whether unsigned or not, defaults to signed
141
- */
142
- static fromValue(val: number | string | {
143
- low: number;
144
- high: number;
145
- unsigned?: boolean;
146
- }, unsigned?: boolean): Long;
147
- /** Returns the sum of this and the specified Long. */
148
- add(addend: string | number | Long | Timestamp): Long;
149
- /**
150
- * Returns the sum of this and the specified Long.
151
- * @returns Sum
152
- */
153
- and(other: string | number | Long | Timestamp): Long;
154
- /**
155
- * Compares this Long's value with the specified's.
156
- * @returns 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
157
- */
158
- compare(other: string | number | Long | Timestamp): 0 | 1 | -1;
159
- /** This is an alias of {@link Long.compare} */
160
- comp(other: string | number | Long | Timestamp): 0 | 1 | -1;
161
- /**
162
- * Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.
163
- * @returns Quotient
164
- */
165
- divide(divisor: string | number | Long | Timestamp): Long;
166
- /**This is an alias of {@link Long.divide} */
167
- div(divisor: string | number | Long | Timestamp): Long;
168
- /**
169
- * Tests if this Long's value equals the specified's.
170
- * @param other - Other value
171
- */
172
- equals(other: string | number | Long | Timestamp): boolean;
173
- /** This is an alias of {@link Long.equals} */
174
- eq(other: string | number | Long | Timestamp): boolean;
175
- /** Gets the high 32 bits as a signed integer. */
176
- getHighBits(): number;
177
- /** Gets the high 32 bits as an unsigned integer. */
178
- getHighBitsUnsigned(): number;
179
- /** Gets the low 32 bits as a signed integer. */
180
- getLowBits(): number;
181
- /** Gets the low 32 bits as an unsigned integer. */
182
- getLowBitsUnsigned(): number;
183
- /** Gets the number of bits needed to represent the absolute value of this Long. */
184
- getNumBitsAbs(): number;
185
- /** Tests if this Long's value is greater than the specified's. */
186
- greaterThan(other: string | number | Long | Timestamp): boolean;
187
- /** This is an alias of {@link Long.greaterThan} */
188
- gt(other: string | number | Long | Timestamp): boolean;
189
- /** Tests if this Long's value is greater than or equal the specified's. */
190
- greaterThanOrEqual(other: string | number | Long | Timestamp): boolean;
191
- /** This is an alias of {@link Long.greaterThanOrEqual} */
192
- gte(other: string | number | Long | Timestamp): boolean;
193
- /** This is an alias of {@link Long.greaterThanOrEqual} */
194
- ge(other: string | number | Long | Timestamp): boolean;
195
- /** Tests if this Long's value is even. */
196
- isEven(): boolean;
197
- /** Tests if this Long's value is negative. */
198
- isNegative(): boolean;
199
- /** Tests if this Long's value is odd. */
200
- isOdd(): boolean;
201
- /** Tests if this Long's value is positive. */
202
- isPositive(): boolean;
203
- /** Tests if this Long's value equals zero. */
204
- isZero(): boolean;
205
- /** Tests if this Long's value is less than the specified's. */
206
- lessThan(other: string | number | Long | Timestamp): boolean;
207
- /** This is an alias of {@link Long#lessThan}. */
208
- lt(other: string | number | Long | Timestamp): boolean;
209
- /** Tests if this Long's value is less than or equal the specified's. */
210
- lessThanOrEqual(other: string | number | Long | Timestamp): boolean;
211
- /** This is an alias of {@link Long.lessThanOrEqual} */
212
- lte(other: string | number | Long | Timestamp): boolean;
213
- /** Returns this Long modulo the specified. */
214
- modulo(divisor: string | number | Long | Timestamp): Long;
215
- /** This is an alias of {@link Long.modulo} */
216
- mod(divisor: string | number | Long | Timestamp): Long;
217
- /** This is an alias of {@link Long.modulo} */
218
- rem(divisor: string | number | Long | Timestamp): Long;
219
- /**
220
- * Returns the product of this and the specified Long.
221
- * @param multiplier - Multiplier
222
- * @returns Product
223
- */
224
- multiply(multiplier: string | number | Long | Timestamp): Long;
225
- /** This is an alias of {@link Long.multiply} */
226
- mul(multiplier: string | number | Long | Timestamp): Long;
227
- /** Returns the Negation of this Long's value. */
228
- negate(): Long;
229
- /** This is an alias of {@link Long.negate} */
230
- neg(): Long;
231
- /** Returns the bitwise NOT of this Long. */
232
- not(): Long;
233
- /** Tests if this Long's value differs from the specified's. */
234
- notEquals(other: string | number | Long | Timestamp): boolean;
235
- /** This is an alias of {@link Long.notEquals} */
236
- neq(other: string | number | Long | Timestamp): boolean;
237
- /** This is an alias of {@link Long.notEquals} */
238
- ne(other: string | number | Long | Timestamp): boolean;
239
- /**
240
- * Returns the bitwise OR of this Long and the specified.
241
- */
242
- or(other: number | string | Long): Long;
243
- /**
244
- * Returns this Long with bits shifted to the left by the given amount.
245
- * @param numBits - Number of bits
246
- * @returns Shifted Long
247
- */
248
- shiftLeft(numBits: number | Long): Long;
249
- /** This is an alias of {@link Long.shiftLeft} */
250
- shl(numBits: number | Long): Long;
251
- /**
252
- * Returns this Long with bits arithmetically shifted to the right by the given amount.
253
- * @param numBits - Number of bits
254
- * @returns Shifted Long
255
- */
256
- shiftRight(numBits: number | Long): Long;
257
- /** This is an alias of {@link Long.shiftRight} */
258
- shr(numBits: number | Long): Long;
259
- /**
260
- * Returns this Long with bits logically shifted to the right by the given amount.
261
- * @param numBits - Number of bits
262
- * @returns Shifted Long
263
- */
264
- shiftRightUnsigned(numBits: Long | number): Long;
265
- /** This is an alias of {@link Long.shiftRightUnsigned} */
266
- shr_u(numBits: number | Long): Long;
267
- /** This is an alias of {@link Long.shiftRightUnsigned} */
268
- shru(numBits: number | Long): Long;
269
- /**
270
- * Returns the difference of this and the specified Long.
271
- * @param subtrahend - Subtrahend
272
- * @returns Difference
273
- */
274
- subtract(subtrahend: string | number | Long | Timestamp): Long;
275
- /** This is an alias of {@link Long.subtract} */
276
- sub(subtrahend: string | number | Long | Timestamp): Long;
277
- /** Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. */
278
- toInt(): number;
279
- /** Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). */
280
- toNumber(): number;
281
- /** Converts the Long to a BigInt (arbitrary precision). */
282
- toBigInt(): bigint;
283
- /**
284
- * Converts this Long to its byte representation.
285
- * @param le - Whether little or big endian, defaults to big endian
286
- * @returns Byte representation
287
- */
288
- toBytes(le?: boolean): number[];
289
- /**
290
- * Converts this Long to its little endian byte representation.
291
- * @returns Little endian byte representation
292
- */
293
- toBytesLE(): number[];
294
- /**
295
- * Converts this Long to its big endian byte representation.
296
- * @returns Big endian byte representation
297
- */
298
- toBytesBE(): number[];
299
- /**
300
- * Converts this Long to signed.
301
- */
302
- toSigned(): Long;
303
- /**
304
- * Converts the Long to a string written in the specified radix.
305
- * @param radix - Radix (2-36), defaults to 10
306
- * @throws RangeError If `radix` is out of range
307
- */
308
- toString(radix?: number): string;
309
- /** Converts this Long to unsigned. */
310
- toUnsigned(): Long;
311
- /** Returns the bitwise XOR of this Long and the given one. */
312
- xor(other: Long | number | string): Long;
313
- /** This is an alias of {@link Long.isZero} */
314
- eqz(): boolean;
315
- /** This is an alias of {@link Long.lessThanOrEqual} */
316
- le(other: string | number | Long | Timestamp): boolean;
317
- toExtendedJSON(options?: EJSONOptions): number | LongExtended;
318
- static fromExtendedJSON(doc: {
319
- $numberLong: string;
320
- }, options?: EJSONOptions): number | Long | bigint;
321
- inspect(): string;
322
- }
323
- //# sourceMappingURL=long.d.ts.map
package/lib/long.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"long.d.ts","sourceRoot":"","sources":["../src/long.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA+E7C,cAAc;AACd,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,IAAK,SAAQ,SAAS;IACjC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,6EAA6E;IAC7E,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,IAAI,EAAG,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,EAAG,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAG,OAAO,CAAC;IAEnB;;;;;;;;;;;;OAYG;gBACS,GAAG,GAAE,MAAM,GAAG,MAAM,GAAG,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,CAAC,EA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;IAC9C,GAAG,IAAI,OAAO;IAId,uDAAuD;IACvD,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAStD,cAAc,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,YAAY;IAI7D,MAAM,CAAC,gBAAgB,CACrB,GAAG,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,EAC5B,OAAO,CAAC,EAAE,YAAY,GACrB,MAAM,GAAG,IAAI,GAAG,MAAM;IA8BzB,OAAO,IAAI,MAAM;CAGlB"}
package/lib/max_key.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { BSONValue } from './bson_value';
2
- /** @public */
3
- export interface MaxKeyExtended {
4
- $maxKey: 1;
5
- }
6
- /**
7
- * A class representation of the BSON MaxKey type.
8
- * @public
9
- * @category BSONType
10
- */
11
- export declare class MaxKey extends BSONValue {
12
- get _bsontype(): 'MaxKey';
13
- /** @internal */
14
- toExtendedJSON(): MaxKeyExtended;
15
- /** @internal */
16
- static fromExtendedJSON(): MaxKey;
17
- inspect(): string;
18
- }
19
- //# sourceMappingURL=max_key.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"max_key.d.ts","sourceRoot":"","sources":["../src/max_key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,cAAc;AACd,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAC;CACZ;AAED;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,SAAS;IACnC,IAAI,SAAS,IAAI,QAAQ,CAExB;IAED,gBAAgB;IAChB,cAAc,IAAI,cAAc;IAIhC,gBAAgB;IAChB,MAAM,CAAC,gBAAgB,IAAI,MAAM;IASjC,OAAO,IAAI,MAAM;CAGlB"}
package/lib/min_key.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { BSONValue } from './bson_value';
2
- /** @public */
3
- export interface MinKeyExtended {
4
- $minKey: 1;
5
- }
6
- /**
7
- * A class representation of the BSON MinKey type.
8
- * @public
9
- * @category BSONType
10
- */
11
- export declare class MinKey extends BSONValue {
12
- get _bsontype(): 'MinKey';
13
- /** @internal */
14
- toExtendedJSON(): MinKeyExtended;
15
- /** @internal */
16
- static fromExtendedJSON(): MinKey;
17
- inspect(): string;
18
- }
19
- //# sourceMappingURL=min_key.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"min_key.d.ts","sourceRoot":"","sources":["../src/min_key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,cAAc;AACd,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAC;CACZ;AAED;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,SAAS;IACnC,IAAI,SAAS,IAAI,QAAQ,CAExB;IAED,gBAAgB;IAChB,cAAc,IAAI,cAAc;IAIhC,gBAAgB;IAChB,MAAM,CAAC,gBAAgB,IAAI,MAAM;IASjC,OAAO,IAAI,MAAM;CAGlB"}
package/lib/objectid.d.ts DELETED
@@ -1,96 +0,0 @@
1
- import { BSONValue } from './bson_value';
2
- /** @public */
3
- export interface ObjectIdLike {
4
- id: string | Uint8Array;
5
- __id?: string;
6
- toHexString(): string;
7
- }
8
- /** @public */
9
- export interface ObjectIdExtended {
10
- $oid: string;
11
- }
12
- declare const kId: unique symbol;
13
- /**
14
- * A class representation of the BSON ObjectId type.
15
- * @public
16
- * @category BSONType
17
- */
18
- export declare class ObjectId extends BSONValue {
19
- get _bsontype(): 'ObjectId';
20
- /** @internal */
21
- private static index;
22
- static cacheHexString: boolean;
23
- /** ObjectId Bytes @internal */
24
- private [kId];
25
- /** ObjectId hexString cache @internal */
26
- private __id?;
27
- /**
28
- * Create an ObjectId type
29
- *
30
- * @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.
31
- */
32
- constructor(inputId?: string | number | ObjectId | ObjectIdLike | Uint8Array);
33
- /**
34
- * The ObjectId bytes
35
- * @readonly
36
- */
37
- get id(): Uint8Array;
38
- set id(value: Uint8Array);
39
- /** Returns the ObjectId id as a 24 character hex string representation */
40
- toHexString(): string;
41
- /**
42
- * Update the ObjectId index
43
- * @internal
44
- */
45
- private static getInc;
46
- /**
47
- * Generate a 12 byte id buffer used in ObjectId's
48
- *
49
- * @param time - pass in a second based timestamp.
50
- */
51
- static generate(time?: number): Uint8Array;
52
- /**
53
- * Converts the id into a 24 character hex string for printing, unless encoding is provided.
54
- * @param encoding - hex or base64
55
- */
56
- toString(encoding?: 'hex' | 'base64'): string;
57
- /** Converts to its JSON the 24 character hex string representation. */
58
- toJSON(): string;
59
- /**
60
- * Compares the equality of this ObjectId with `otherID`.
61
- *
62
- * @param otherId - ObjectId instance to compare against.
63
- */
64
- equals(otherId: string | ObjectId | ObjectIdLike): boolean;
65
- /** Returns the generation date (accurate up to the second) that this ID was generated. */
66
- getTimestamp(): Date;
67
- /** @internal */
68
- static createPk(): ObjectId;
69
- /**
70
- * Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
71
- *
72
- * @param time - an integer number representing a number of seconds.
73
- */
74
- static createFromTime(time: number): ObjectId;
75
- /**
76
- * Creates an ObjectId from a hex string representation of an ObjectId.
77
- *
78
- * @param hexString - create a ObjectId from a passed in 24 character hexstring.
79
- */
80
- static createFromHexString(hexString: string): ObjectId;
81
- /** Creates an ObjectId instance from a base64 string */
82
- static createFromBase64(base64: string): ObjectId;
83
- /**
84
- * Checks if a value is a valid bson ObjectId
85
- *
86
- * @param id - ObjectId instance to validate.
87
- */
88
- static isValid(id: string | number | ObjectId | ObjectIdLike | Uint8Array): boolean;
89
- /** @internal */
90
- toExtendedJSON(): ObjectIdExtended;
91
- /** @internal */
92
- static fromExtendedJSON(doc: ObjectIdExtended): ObjectId;
93
- inspect(): string;
94
- }
95
- export {};
96
- //# sourceMappingURL=objectid.d.ts.map