@tellescope/utilities 1.72.1 → 1.73.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.
- package/lib/cjs/ObjectId/bson_value.d.ts +10 -0
- package/lib/cjs/ObjectId/bson_value.d.ts.map +1 -0
- package/lib/cjs/ObjectId/bson_value.js +20 -0
- package/lib/cjs/ObjectId/bson_value.js.map +1 -0
- package/lib/cjs/ObjectId/constants.d.ts +107 -0
- package/lib/cjs/ObjectId/constants.d.ts.map +1 -0
- package/lib/cjs/ObjectId/constants.js +108 -0
- package/lib/cjs/ObjectId/constants.js.map +1 -0
- package/lib/cjs/ObjectId/error.d.ts +50 -0
- package/lib/cjs/ObjectId/error.d.ts.map +1 -0
- package/lib/cjs/ObjectId/error.js +117 -0
- package/lib/cjs/ObjectId/error.js.map +1 -0
- package/lib/cjs/ObjectId/objectid.d.ts +96 -0
- package/lib/cjs/ObjectId/objectid.d.ts.map +1 -0
- package/lib/cjs/ObjectId/objectid.js +300 -0
- package/lib/cjs/ObjectId/objectid.js.map +1 -0
- package/lib/cjs/ObjectId/parser/utils.d.ts +8 -0
- package/lib/cjs/ObjectId/parser/utils.d.ts.map +1 -0
- package/lib/cjs/ObjectId/parser/utils.js +32 -0
- package/lib/cjs/ObjectId/parser/utils.js.map +1 -0
- package/lib/cjs/ObjectId/utils/byte_utils.d.ts +46 -0
- package/lib/cjs/ObjectId/utils/byte_utils.d.ts.map +1 -0
- package/lib/cjs/ObjectId/utils/byte_utils.js +48 -0
- package/lib/cjs/ObjectId/utils/byte_utils.js.map +1 -0
- package/lib/cjs/ObjectId/utils/node_byte_utils.d.ts +31 -0
- package/lib/cjs/ObjectId/utils/node_byte_utils.d.ts.map +1 -0
- package/lib/cjs/ObjectId/utils/node_byte_utils.js +95 -0
- package/lib/cjs/ObjectId/utils/node_byte_utils.js.map +1 -0
- package/lib/cjs/ObjectId/utils/web_byte_utils.d.ts +27 -0
- package/lib/cjs/ObjectId/utils/web_byte_utils.d.ts.map +1 -0
- package/lib/cjs/ObjectId/utils/web_byte_utils.js +126 -0
- package/lib/cjs/ObjectId/utils/web_byte_utils.js.map +1 -0
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.d.ts.map +1 -1
- package/lib/cjs/utils.js +5 -4
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/ObjectId/bson_value.d.ts +10 -0
- package/lib/esm/ObjectId/bson_value.d.ts.map +1 -0
- package/lib/esm/ObjectId/bson_value.js +17 -0
- package/lib/esm/ObjectId/bson_value.js.map +1 -0
- package/lib/esm/ObjectId/constants.d.ts +107 -0
- package/lib/esm/ObjectId/constants.d.ts.map +1 -0
- package/lib/esm/ObjectId/constants.js +105 -0
- package/lib/esm/ObjectId/constants.js.map +1 -0
- package/lib/esm/ObjectId/error.d.ts +50 -0
- package/lib/esm/ObjectId/error.d.ts.map +1 -0
- package/lib/esm/ObjectId/error.js +114 -0
- package/lib/esm/ObjectId/error.js.map +1 -0
- package/lib/esm/ObjectId/objectid.d.ts +96 -0
- package/lib/esm/ObjectId/objectid.d.ts.map +1 -0
- package/lib/esm/ObjectId/objectid.js +297 -0
- package/lib/esm/ObjectId/objectid.js.map +1 -0
- package/lib/esm/ObjectId/parser/utils.d.ts +8 -0
- package/lib/esm/ObjectId/parser/utils.d.ts.map +1 -0
- package/lib/esm/ObjectId/parser/utils.js +22 -0
- package/lib/esm/ObjectId/parser/utils.js.map +1 -0
- package/lib/esm/ObjectId/utils/byte_utils.d.ts +46 -0
- package/lib/esm/ObjectId/utils/byte_utils.d.ts.map +1 -0
- package/lib/esm/ObjectId/utils/byte_utils.js +45 -0
- package/lib/esm/ObjectId/utils/byte_utils.js.map +1 -0
- package/lib/esm/ObjectId/utils/node_byte_utils.d.ts +31 -0
- package/lib/esm/ObjectId/utils/node_byte_utils.d.ts.map +1 -0
- package/lib/esm/ObjectId/utils/node_byte_utils.js +91 -0
- package/lib/esm/ObjectId/utils/node_byte_utils.js.map +1 -0
- package/lib/esm/ObjectId/utils/web_byte_utils.d.ts +27 -0
- package/lib/esm/ObjectId/utils/web_byte_utils.d.ts.map +1 -0
- package/lib/esm/ObjectId/utils/web_byte_utils.js +122 -0
- package/lib/esm/ObjectId/utils/web_byte_utils.js.map +1 -0
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.d.ts.map +1 -1
- package/lib/esm/utils.js +2 -1
- package/lib/esm/utils.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -6
- package/src/ObjectId/LICENSE.md +201 -0
- package/src/ObjectId/README.txt +1 -0
- package/src/ObjectId/bson_value.ts +18 -0
- package/src/ObjectId/constants.ts +141 -0
- package/src/ObjectId/error.ts +83 -0
- package/src/ObjectId/objectid.ts +325 -0
- package/src/ObjectId/parser/utils.ts +29 -0
- package/src/ObjectId/utils/byte_utils.ts +61 -0
- package/src/ObjectId/utils/node_byte_utils.ts +141 -0
- package/src/ObjectId/utils/web_byte_utils.ts +190 -0
- package/src/utils.ts +3 -1
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
var __extends = (this && this.__extends) || (function () {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
+
return extendStatics(d, b);
|
|
9
|
+
};
|
|
10
|
+
return function (d, b) {
|
|
11
|
+
if (typeof b !== "function" && b !== null)
|
|
12
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
+
extendStatics(d, b);
|
|
14
|
+
function __() { this.constructor = d; }
|
|
15
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ObjectId = void 0;
|
|
20
|
+
var bson_value_1 = require("./bson_value");
|
|
21
|
+
var error_1 = require("./error");
|
|
22
|
+
var utils_1 = require("./parser/utils");
|
|
23
|
+
var byte_utils_1 = require("./utils/byte_utils");
|
|
24
|
+
// Regular expression that checks for hex value
|
|
25
|
+
var checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$');
|
|
26
|
+
// Unique sequence for the current process (initialized on first use)
|
|
27
|
+
var PROCESS_UNIQUE = null;
|
|
28
|
+
var kId = Symbol('id');
|
|
29
|
+
/**
|
|
30
|
+
* A class representation of the BSON ObjectId type.
|
|
31
|
+
* @public
|
|
32
|
+
* @category BSONType
|
|
33
|
+
*/
|
|
34
|
+
var ObjectId = /** @class */ (function (_super) {
|
|
35
|
+
__extends(ObjectId, _super);
|
|
36
|
+
/**
|
|
37
|
+
* Create an ObjectId type
|
|
38
|
+
*
|
|
39
|
+
* @param inputId - Can be a 24 character hex string, 12 byte binary Buffer, or a number.
|
|
40
|
+
*/
|
|
41
|
+
function ObjectId(inputId) {
|
|
42
|
+
var _this = _super.call(this) || this;
|
|
43
|
+
// workingId is set based on type of input and whether valid id exists for the input
|
|
44
|
+
var workingId;
|
|
45
|
+
if (typeof inputId === 'object' && inputId && 'id' in inputId) {
|
|
46
|
+
if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
|
|
47
|
+
throw new error_1.BSONError('Argument passed in must have an id that is of type string or Buffer');
|
|
48
|
+
}
|
|
49
|
+
if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
|
|
50
|
+
workingId = byte_utils_1.ByteUtils.fromHex(inputId.toHexString());
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
workingId = inputId.id;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
workingId = inputId;
|
|
58
|
+
}
|
|
59
|
+
// the following cases use workingId to construct an ObjectId
|
|
60
|
+
if (workingId == null || typeof workingId === 'number') {
|
|
61
|
+
// The most common use case (blank id, new objectId instance)
|
|
62
|
+
// Generate a new id
|
|
63
|
+
_this[kId] = ObjectId.generate(typeof workingId === 'number' ? workingId : undefined);
|
|
64
|
+
}
|
|
65
|
+
else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
|
|
66
|
+
// If intstanceof matches we can escape calling ensure buffer in Node.js environments
|
|
67
|
+
_this[kId] = byte_utils_1.ByteUtils.toLocalBufferType(workingId);
|
|
68
|
+
}
|
|
69
|
+
else if (typeof workingId === 'string') {
|
|
70
|
+
if (workingId.length === 12) {
|
|
71
|
+
// TODO(NODE-4361): Remove string of length 12 support
|
|
72
|
+
var bytes = byte_utils_1.ByteUtils.fromUTF8(workingId);
|
|
73
|
+
if (bytes.byteLength === 12) {
|
|
74
|
+
_this[kId] = bytes;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new error_1.BSONError('Argument passed in must be a string of 12 bytes');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (workingId.length === 24 && checkForHexRegExp.test(workingId)) {
|
|
81
|
+
_this[kId] = byte_utils_1.ByteUtils.fromHex(workingId);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
throw new error_1.BSONError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
throw new error_1.BSONError('Argument passed in does not match the accepted types');
|
|
89
|
+
}
|
|
90
|
+
// If we are caching the hex string
|
|
91
|
+
if (ObjectId.cacheHexString) {
|
|
92
|
+
_this.__id = byte_utils_1.ByteUtils.toHex(_this.id);
|
|
93
|
+
}
|
|
94
|
+
return _this;
|
|
95
|
+
}
|
|
96
|
+
Object.defineProperty(ObjectId.prototype, "_bsontype", {
|
|
97
|
+
get: function () {
|
|
98
|
+
return 'ObjectId';
|
|
99
|
+
},
|
|
100
|
+
enumerable: false,
|
|
101
|
+
configurable: true
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(ObjectId.prototype, "id", {
|
|
104
|
+
/**
|
|
105
|
+
* The ObjectId bytes
|
|
106
|
+
* @readonly
|
|
107
|
+
*/
|
|
108
|
+
get: function () {
|
|
109
|
+
return this[kId];
|
|
110
|
+
},
|
|
111
|
+
set: function (value) {
|
|
112
|
+
this[kId] = value;
|
|
113
|
+
if (ObjectId.cacheHexString) {
|
|
114
|
+
this.__id = byte_utils_1.ByteUtils.toHex(value);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
enumerable: false,
|
|
118
|
+
configurable: true
|
|
119
|
+
});
|
|
120
|
+
/** Returns the ObjectId id as a 24 character hex string representation */
|
|
121
|
+
ObjectId.prototype.toHexString = function () {
|
|
122
|
+
if (ObjectId.cacheHexString && this.__id) {
|
|
123
|
+
return this.__id;
|
|
124
|
+
}
|
|
125
|
+
var hexString = byte_utils_1.ByteUtils.toHex(this.id);
|
|
126
|
+
if (ObjectId.cacheHexString && !this.__id) {
|
|
127
|
+
this.__id = hexString;
|
|
128
|
+
}
|
|
129
|
+
return hexString;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Update the ObjectId index
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
ObjectId.getInc = function () {
|
|
136
|
+
return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Generate a 12 byte id buffer used in ObjectId's
|
|
140
|
+
*
|
|
141
|
+
* @param time - pass in a second based timestamp.
|
|
142
|
+
*/
|
|
143
|
+
ObjectId.generate = function (time) {
|
|
144
|
+
if ('number' !== typeof time) {
|
|
145
|
+
time = Math.floor(Date.now() / 1000);
|
|
146
|
+
}
|
|
147
|
+
var inc = ObjectId.getInc();
|
|
148
|
+
var buffer = byte_utils_1.ByteUtils.allocate(12);
|
|
149
|
+
// 4-byte timestamp
|
|
150
|
+
byte_utils_1.BSONDataView.fromUint8Array(buffer).setUint32(0, time, false);
|
|
151
|
+
// set PROCESS_UNIQUE if yet not initialized
|
|
152
|
+
if (PROCESS_UNIQUE === null) {
|
|
153
|
+
PROCESS_UNIQUE = byte_utils_1.ByteUtils.randomBytes(5);
|
|
154
|
+
}
|
|
155
|
+
// 5-byte process unique
|
|
156
|
+
buffer[4] = PROCESS_UNIQUE[0];
|
|
157
|
+
buffer[5] = PROCESS_UNIQUE[1];
|
|
158
|
+
buffer[6] = PROCESS_UNIQUE[2];
|
|
159
|
+
buffer[7] = PROCESS_UNIQUE[3];
|
|
160
|
+
buffer[8] = PROCESS_UNIQUE[4];
|
|
161
|
+
// 3-byte counter
|
|
162
|
+
buffer[11] = inc & 0xff;
|
|
163
|
+
buffer[10] = (inc >> 8) & 0xff;
|
|
164
|
+
buffer[9] = (inc >> 16) & 0xff;
|
|
165
|
+
return buffer;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Converts the id into a 24 character hex string for printing, unless encoding is provided.
|
|
169
|
+
* @param encoding - hex or base64
|
|
170
|
+
*/
|
|
171
|
+
ObjectId.prototype.toString = function (encoding) {
|
|
172
|
+
// Is the id a buffer then use the buffer toString method to return the format
|
|
173
|
+
if (encoding === 'base64')
|
|
174
|
+
return byte_utils_1.ByteUtils.toBase64(this.id);
|
|
175
|
+
if (encoding === 'hex')
|
|
176
|
+
return this.toHexString();
|
|
177
|
+
return this.toHexString();
|
|
178
|
+
};
|
|
179
|
+
/** Converts to its JSON the 24 character hex string representation. */
|
|
180
|
+
ObjectId.prototype.toJSON = function () {
|
|
181
|
+
return this.toHexString();
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Compares the equality of this ObjectId with `otherID`.
|
|
185
|
+
*
|
|
186
|
+
* @param otherId - ObjectId instance to compare against.
|
|
187
|
+
*/
|
|
188
|
+
ObjectId.prototype.equals = function (otherId) {
|
|
189
|
+
if (otherId === undefined || otherId === null) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
if (otherId instanceof ObjectId) {
|
|
193
|
+
return this[kId][11] === otherId[kId][11] && byte_utils_1.ByteUtils.equals(this[kId], otherId[kId]);
|
|
194
|
+
}
|
|
195
|
+
if (typeof otherId === 'string' &&
|
|
196
|
+
ObjectId.isValid(otherId) &&
|
|
197
|
+
otherId.length === 12 &&
|
|
198
|
+
(0, utils_1.isUint8Array)(this.id)) {
|
|
199
|
+
return byte_utils_1.ByteUtils.equals(this.id, byte_utils_1.ByteUtils.fromISO88591(otherId));
|
|
200
|
+
}
|
|
201
|
+
if (typeof otherId === 'string' && ObjectId.isValid(otherId) && otherId.length === 24) {
|
|
202
|
+
return otherId.toLowerCase() === this.toHexString();
|
|
203
|
+
}
|
|
204
|
+
if (typeof otherId === 'string' && ObjectId.isValid(otherId) && otherId.length === 12) {
|
|
205
|
+
return byte_utils_1.ByteUtils.equals(byte_utils_1.ByteUtils.fromUTF8(otherId), this.id);
|
|
206
|
+
}
|
|
207
|
+
if (typeof otherId === 'object' &&
|
|
208
|
+
'toHexString' in otherId &&
|
|
209
|
+
typeof otherId.toHexString === 'function') {
|
|
210
|
+
var otherIdString = otherId.toHexString();
|
|
211
|
+
var thisIdString = this.toHexString().toLowerCase();
|
|
212
|
+
return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
215
|
+
};
|
|
216
|
+
/** Returns the generation date (accurate up to the second) that this ID was generated. */
|
|
217
|
+
ObjectId.prototype.getTimestamp = function () {
|
|
218
|
+
var timestamp = new Date();
|
|
219
|
+
var time = byte_utils_1.BSONDataView.fromUint8Array(this.id).getUint32(0, false);
|
|
220
|
+
timestamp.setTime(Math.floor(time) * 1000);
|
|
221
|
+
return timestamp;
|
|
222
|
+
};
|
|
223
|
+
/** @internal */
|
|
224
|
+
ObjectId.createPk = function () {
|
|
225
|
+
return new ObjectId();
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.
|
|
229
|
+
*
|
|
230
|
+
* @param time - an integer number representing a number of seconds.
|
|
231
|
+
*/
|
|
232
|
+
ObjectId.createFromTime = function (time) {
|
|
233
|
+
var buffer = byte_utils_1.ByteUtils.fromNumberArray([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
234
|
+
// Encode time into first 4 bytes
|
|
235
|
+
byte_utils_1.BSONDataView.fromUint8Array(buffer).setUint32(0, time, false);
|
|
236
|
+
// Return the new objectId
|
|
237
|
+
return new ObjectId(buffer);
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Creates an ObjectId from a hex string representation of an ObjectId.
|
|
241
|
+
*
|
|
242
|
+
* @param hexString - create a ObjectId from a passed in 24 character hexstring.
|
|
243
|
+
*/
|
|
244
|
+
ObjectId.createFromHexString = function (hexString) {
|
|
245
|
+
if ((hexString === null || hexString === void 0 ? void 0 : hexString.length) !== 24) {
|
|
246
|
+
throw new error_1.BSONError('hex string must be 24 characters');
|
|
247
|
+
}
|
|
248
|
+
return new ObjectId(byte_utils_1.ByteUtils.fromHex(hexString));
|
|
249
|
+
};
|
|
250
|
+
/** Creates an ObjectId instance from a base64 string */
|
|
251
|
+
ObjectId.createFromBase64 = function (base64) {
|
|
252
|
+
if ((base64 === null || base64 === void 0 ? void 0 : base64.length) !== 16) {
|
|
253
|
+
throw new error_1.BSONError('base64 string must be 16 characters');
|
|
254
|
+
}
|
|
255
|
+
return new ObjectId(byte_utils_1.ByteUtils.fromBase64(base64));
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Checks if a value is a valid bson ObjectId
|
|
259
|
+
*
|
|
260
|
+
* @param id - ObjectId instance to validate.
|
|
261
|
+
*/
|
|
262
|
+
ObjectId.isValid = function (id) {
|
|
263
|
+
if (id == null)
|
|
264
|
+
return false;
|
|
265
|
+
try {
|
|
266
|
+
new ObjectId(id);
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
catch (_a) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
/** @internal */
|
|
274
|
+
ObjectId.prototype.toExtendedJSON = function () {
|
|
275
|
+
if (this.toHexString)
|
|
276
|
+
return { $oid: this.toHexString() };
|
|
277
|
+
return { $oid: this.toString('hex') };
|
|
278
|
+
};
|
|
279
|
+
/** @internal */
|
|
280
|
+
ObjectId.fromExtendedJSON = function (doc) {
|
|
281
|
+
return new ObjectId(doc.$oid);
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Converts to a string representation of this Id.
|
|
285
|
+
*
|
|
286
|
+
* @returns return the 24 character hex string representation.
|
|
287
|
+
* @internal
|
|
288
|
+
*/
|
|
289
|
+
ObjectId.prototype[Symbol.for('nodejs.util.inspect.custom')] = function () {
|
|
290
|
+
return this.inspect();
|
|
291
|
+
};
|
|
292
|
+
ObjectId.prototype.inspect = function () {
|
|
293
|
+
return "new ObjectId(\"".concat(this.toHexString(), "\")");
|
|
294
|
+
};
|
|
295
|
+
/** @internal */
|
|
296
|
+
ObjectId.index = Math.floor(Math.random() * 0xffffff);
|
|
297
|
+
return ObjectId;
|
|
298
|
+
}(bson_value_1.BSONValue));
|
|
299
|
+
exports.ObjectId = ObjectId;
|
|
300
|
+
//# sourceMappingURL=objectid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectid.js","sourceRoot":"","sources":["../../../src/ObjectId/objectid.ts"],"names":[],"mappings":";AAAA,GAAG;;;;;;;;;;;;;;;;;;AAEH,2CAAyC;AACzC,iCAAoC;AACpC,wCAA8C;AAC9C,iDAA6D;AAE7D,+CAA+C;AAC/C,IAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAE1D,qEAAqE;AACrE,IAAI,cAAc,GAAsB,IAAI,CAAC;AAc7C,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,C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,CAAC;QAE7B,IAAI;YACF,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,IAAI,CAAC;SACb;QAAC,WAAM;YACN,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IAED,gBAAgB;IAChB,iCAAc,GAAd;QACE,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IACxC,CAAC;IAED,gBAAgB;IACT,yBAAgB,GAAvB,UAAwB,GAAqB;QAC3C,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,mBAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,GAA1C;QACE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,0BAAO,GAAP;QACE,OAAO,yBAAiB,IAAI,CAAC,WAAW,EAAE,QAAI,CAAC;IACjD,CAAC;IA9RD,gBAAgB;IACD,cAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC;IA8R9D,eAAC;CAAA,AApSD,CAA8B,sBAAS,GAoStC;AApSY,4BAAQ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function isAnyArrayBuffer(value: unknown): value is ArrayBuffer;
|
|
2
|
+
export declare function isUint8Array(value: unknown): value is Uint8Array;
|
|
3
|
+
export declare function isBigInt64Array(value: unknown): value is BigInt64Array;
|
|
4
|
+
export declare function isBigUInt64Array(value: unknown): value is BigUint64Array;
|
|
5
|
+
export declare function isRegExp(d: unknown): d is RegExp;
|
|
6
|
+
export declare function isMap(d: unknown): d is Map<unknown, unknown>;
|
|
7
|
+
export declare function isDate(d: unknown): d is Date;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/ObjectId/parser/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAIrE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEhD;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAE5D;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAE5C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDate = exports.isMap = exports.isRegExp = exports.isBigUInt64Array = exports.isBigInt64Array = exports.isUint8Array = exports.isAnyArrayBuffer = void 0;
|
|
4
|
+
function isAnyArrayBuffer(value) {
|
|
5
|
+
return ['[object ArrayBuffer]', '[object SharedArrayBuffer]'].includes(Object.prototype.toString.call(value));
|
|
6
|
+
}
|
|
7
|
+
exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
|
8
|
+
function isUint8Array(value) {
|
|
9
|
+
return Object.prototype.toString.call(value) === '[object Uint8Array]';
|
|
10
|
+
}
|
|
11
|
+
exports.isUint8Array = isUint8Array;
|
|
12
|
+
function isBigInt64Array(value) {
|
|
13
|
+
return Object.prototype.toString.call(value) === '[object BigInt64Array]';
|
|
14
|
+
}
|
|
15
|
+
exports.isBigInt64Array = isBigInt64Array;
|
|
16
|
+
function isBigUInt64Array(value) {
|
|
17
|
+
return Object.prototype.toString.call(value) === '[object BigUint64Array]';
|
|
18
|
+
}
|
|
19
|
+
exports.isBigUInt64Array = isBigUInt64Array;
|
|
20
|
+
function isRegExp(d) {
|
|
21
|
+
return Object.prototype.toString.call(d) === '[object RegExp]';
|
|
22
|
+
}
|
|
23
|
+
exports.isRegExp = isRegExp;
|
|
24
|
+
function isMap(d) {
|
|
25
|
+
return Object.prototype.toString.call(d) === '[object Map]';
|
|
26
|
+
}
|
|
27
|
+
exports.isMap = isMap;
|
|
28
|
+
function isDate(d) {
|
|
29
|
+
return Object.prototype.toString.call(d) === '[object Date]';
|
|
30
|
+
}
|
|
31
|
+
exports.isDate = isDate;
|
|
32
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/ObjectId/parser/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,OAAO,CAAC,sBAAsB,EAAE,4BAA4B,CAAC,CAAC,QAAQ,CACpE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CACtC,CAAC;AACJ,CAAC;AAJD,4CAIC;AAED,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,qBAAqB,CAAC;AACzE,CAAC;AAFD,oCAEC;AAED,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,wBAAwB,CAAC;AAC5E,CAAC;AAFD,0CAEC;AAED,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,yBAAyB,CAAC;AAC7E,CAAC;AAFD,4CAEC;AAED,SAAgB,QAAQ,CAAC,CAAU;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB,CAAC;AACjE,CAAC;AAFD,4BAEC;AAED,SAAgB,KAAK,CAAC,CAAU;IAC9B,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC;AAC9D,CAAC;AAFD,sBAEC;AAED,SAAgB,MAAM,CAAC,CAAU;IAC/B,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC;AAC/D,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export type ByteUtils = {
|
|
3
|
+
/** Transforms the input to an instance of Buffer if running on node, otherwise Uint8Array */
|
|
4
|
+
toLocalBufferType(buffer: Uint8Array | ArrayBufferView | ArrayBuffer): Uint8Array;
|
|
5
|
+
/** Create empty space of size */
|
|
6
|
+
allocate: (size: number) => Uint8Array;
|
|
7
|
+
/** Check if two Uint8Arrays are deep equal */
|
|
8
|
+
equals: (a: Uint8Array, b: Uint8Array) => boolean;
|
|
9
|
+
/** Check if two Uint8Arrays are deep equal */
|
|
10
|
+
fromNumberArray: (array: number[]) => Uint8Array;
|
|
11
|
+
/** Create a Uint8Array from a base64 string */
|
|
12
|
+
fromBase64: (base64: string) => Uint8Array;
|
|
13
|
+
/** Create a base64 string from bytes */
|
|
14
|
+
toBase64: (buffer: Uint8Array) => string;
|
|
15
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
16
|
+
fromISO88591: (codePoints: string) => Uint8Array;
|
|
17
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
18
|
+
toISO88591: (buffer: Uint8Array) => string;
|
|
19
|
+
/** Create a Uint8Array from a hex string */
|
|
20
|
+
fromHex: (hex: string) => Uint8Array;
|
|
21
|
+
/** Create a hex string from bytes */
|
|
22
|
+
toHex: (buffer: Uint8Array) => string;
|
|
23
|
+
/** Create a Uint8Array containing utf8 code units from a string */
|
|
24
|
+
fromUTF8: (text: string) => Uint8Array;
|
|
25
|
+
/** Create a string from utf8 code units */
|
|
26
|
+
toUTF8: (buffer: Uint8Array, start: number, end: number) => string;
|
|
27
|
+
/** Get the utf8 code unit count from a string if it were to be transformed to utf8 */
|
|
28
|
+
utf8ByteLength: (input: string) => number;
|
|
29
|
+
/** Encode UTF8 bytes generated from `source` string into `destination` at byteOffset. Returns the number of bytes encoded. */
|
|
30
|
+
encodeUTF8Into(destination: Uint8Array, source: string, byteOffset: number): number;
|
|
31
|
+
/** Generate a Uint8Array filled with random bytes with byteLength */
|
|
32
|
+
randomBytes(byteLength: number): Uint8Array;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* This is the only ByteUtils that should be used across the rest of the BSON library.
|
|
36
|
+
*
|
|
37
|
+
* The type annotation is important here, it asserts that each of the platform specific
|
|
38
|
+
* utils implementations are compatible with the common one.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare const ByteUtils: ByteUtils;
|
|
43
|
+
export declare class BSONDataView extends DataView {
|
|
44
|
+
static fromUint8Array(input: Uint8Array): DataView;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=byte_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte_utils.d.ts","sourceRoot":"","sources":["../../../../src/ObjectId/utils/byte_utils.ts"],"names":[],"mappings":"AAGA,gBAAgB;AAChB,MAAM,MAAM,SAAS,GAAG;IACtB,6FAA6F;IAC7F,iBAAiB,CAAC,MAAM,EAAE,UAAU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WF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,SAA4D,CAAC;AAErF,qBAAa,YAAa,SAAQ,QAAQ;IACxC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU;CAGxC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var _a;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.BSONDataView = exports.ByteUtils = void 0;
|
|
20
|
+
var node_byte_utils_1 = require("./node_byte_utils");
|
|
21
|
+
var web_byte_utils_1 = require("./web_byte_utils");
|
|
22
|
+
/**
|
|
23
|
+
* Check that a global Buffer exists that is a function and
|
|
24
|
+
* does not have a '_isBuffer' property defined on the prototype
|
|
25
|
+
* (this is to prevent using the npm buffer)
|
|
26
|
+
*/
|
|
27
|
+
var hasGlobalBuffer = typeof Buffer === 'function' && ((_a = Buffer.prototype) === null || _a === void 0 ? void 0 : _a._isBuffer) !== true;
|
|
28
|
+
/**
|
|
29
|
+
* This is the only ByteUtils that should be used across the rest of the BSON library.
|
|
30
|
+
*
|
|
31
|
+
* The type annotation is important here, it asserts that each of the platform specific
|
|
32
|
+
* utils implementations are compatible with the common one.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
exports.ByteUtils = hasGlobalBuffer ? node_byte_utils_1.nodeJsByteUtils : web_byte_utils_1.webByteUtils;
|
|
37
|
+
var BSONDataView = /** @class */ (function (_super) {
|
|
38
|
+
__extends(BSONDataView, _super);
|
|
39
|
+
function BSONDataView() {
|
|
40
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
41
|
+
}
|
|
42
|
+
BSONDataView.fromUint8Array = function (input) {
|
|
43
|
+
return new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
44
|
+
};
|
|
45
|
+
return BSONDataView;
|
|
46
|
+
}(DataView));
|
|
47
|
+
exports.BSONDataView = BSONDataView;
|
|
48
|
+
//# sourceMappingURL=byte_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte_utils.js","sourceRoot":"","sources":["../../../../src/ObjectId/utils/byte_utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,qDAAoD;AACpD,mDAAgD;AAsChD;;;;GAIG;AACH,IAAM,eAAe,GAAG,OAAO,MAAM,KAAK,UAAU,IAAI,CAAA,MAAA,MAAM,CAAC,SAAS,0CAAE,SAAS,MAAK,IAAI,CAAC;AAE7F;;;;;;;GAOG;AACU,QAAA,SAAS,GAAc,eAAe,CAAC,CAAC,CAAC,iCAAe,CAAC,CAAC,CAAC,6BAAY,CAAC;AAErF;IAAkC,gCAAQ;IAA1C;;IAIA,CAAC;IAHQ,2BAAc,GAArB,UAAsB,KAAiB;QACrC,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;IACH,mBAAC;AAAD,CAAC,AAJD,CAAkC,QAAQ,GAIzC;AAJY,oCAAY"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type NodeJsEncoding = 'base64' | 'hex' | 'utf8' | 'binary';
|
|
2
|
+
type NodeJsBuffer = ArrayBufferView & Uint8Array & {
|
|
3
|
+
write(string: string, offset: number, length: undefined, encoding: 'utf8'): number;
|
|
4
|
+
copy(target: Uint8Array, targetStart: number, sourceStart: number, sourceEnd: number): number;
|
|
5
|
+
toString: (this: Uint8Array, encoding: NodeJsEncoding, start?: number, end?: number) => string;
|
|
6
|
+
equals: (this: Uint8Array, other: Uint8Array) => boolean;
|
|
7
|
+
};
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function nodejsMathRandomBytes(byteLength: number): NodeJsBuffer;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const nodeJsByteUtils: {
|
|
12
|
+
toLocalBufferType(potentialBuffer: Uint8Array | NodeJsBuffer | ArrayBuffer): NodeJsBuffer;
|
|
13
|
+
allocate(size: number): NodeJsBuffer;
|
|
14
|
+
equals(a: Uint8Array, b: Uint8Array): boolean;
|
|
15
|
+
fromNumberArray(array: number[]): NodeJsBuffer;
|
|
16
|
+
fromBase64(base64: string): NodeJsBuffer;
|
|
17
|
+
toBase64(buffer: Uint8Array): string;
|
|
18
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
19
|
+
fromISO88591(codePoints: string): NodeJsBuffer;
|
|
20
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
21
|
+
toISO88591(buffer: Uint8Array): string;
|
|
22
|
+
fromHex(hex: string): NodeJsBuffer;
|
|
23
|
+
toHex(buffer: Uint8Array): string;
|
|
24
|
+
fromUTF8(text: string): NodeJsBuffer;
|
|
25
|
+
toUTF8(buffer: Uint8Array, start: number, end: number): string;
|
|
26
|
+
utf8ByteLength(input: string): number;
|
|
27
|
+
encodeUTF8Into(buffer: Uint8Array, source: string, byteOffset: number): number;
|
|
28
|
+
randomBytes: (byteLength: number) => Uint8Array;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=node_byte_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_byte_utils.d.ts","sourceRoot":"","sources":["../../../../src/ObjectId/utils/node_byte_utils.ts"],"names":[],"mappings":"AAEA,KAAK,cAAc,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAC3D,KAAK,YAAY,GAAG,eAAe,GACjC,UAAU,GAAG;IACX,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IACnF,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9F,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/F,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;CAC1D,CAAC;AAiBJ,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,gBAIvD;AAyBD,gBAAgB;AAChB,eAAO,MAAM,eAAe;uCACS,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY;mBA2B1E,MAAM,GAAG,YAAY;cAI1B,UAAU,KAAK,UAAU,GAAG,OAAO;2BAItB,MAAM,EAAE,GAAG,YAAY;uBAI3B,MAAM,GAAG,YAAY;qBAIvB,UAAU,GAAG,MAAM;IAIpC,oIAAoI;6BAC3G,MAAM,GAAG,YAAY;IAI9C,oIAAoI;uBACjH,UAAU,GAAG,MAAM;iBAIzB,MAAM,GAAG,YAAY;kBAIpB,UAAU,GAAG,MAAM;mBAIlB,MAAM,GAAG,YAAY;mBAIrB,UAAU,SAAS,MAAM,OAAO,MAAM,GAAG,MAAM;0BAIxC,MAAM,GAAG,MAAM;2BAId,UAAU,UAAU,MAAM,cAAc,MAAM,GAAG,MAAM;8BAvF1C,MAAM,KAAK,UAAU;CA4F1D,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeJsByteUtils = exports.nodejsMathRandomBytes = void 0;
|
|
4
|
+
var error_1 = require("../error");
|
|
5
|
+
/** @internal */
|
|
6
|
+
function nodejsMathRandomBytes(byteLength) {
|
|
7
|
+
return exports.nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, function () { return Math.floor(Math.random() * 256); }));
|
|
8
|
+
}
|
|
9
|
+
exports.nodejsMathRandomBytes = nodejsMathRandomBytes;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
* WARNING: REQUIRE WILL BE REWRITTEN
|
|
13
|
+
*
|
|
14
|
+
* This code is carefully used by require_rewriter.mjs any modifications must be reflected in the plugin.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* "crypto" is the only dependency BSON needs. This presents a problem for creating a bundle of the BSON library
|
|
18
|
+
* in an es module format that can be used both on the browser and in Node.js. In Node.js when BSON is imported as
|
|
19
|
+
* an es module, there will be no global require function defined, making the code below fallback to the much less desireable math.random bytes.
|
|
20
|
+
* In order to make our es module bundle work as expected on Node.js we need to change this `require()` to a dynamic import, and the dynamic
|
|
21
|
+
* import must be top-level awaited since es modules are async. So we rely on a custom rollup plugin to seek out the following lines of code
|
|
22
|
+
* and replace `require` with `await import` and the IIFE line (`nodejsRandomBytes = (() => { ... })()`) with `nodejsRandomBytes = await (async () => { ... })()`
|
|
23
|
+
* when generating an es module bundle.
|
|
24
|
+
*/
|
|
25
|
+
var nodejsRandomBytes = (function () {
|
|
26
|
+
try {
|
|
27
|
+
return require('crypto').randomBytes;
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return nodejsMathRandomBytes;
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
/** @internal */
|
|
34
|
+
exports.nodeJsByteUtils = {
|
|
35
|
+
toLocalBufferType: function (potentialBuffer) {
|
|
36
|
+
var _a;
|
|
37
|
+
if (Buffer.isBuffer(potentialBuffer)) {
|
|
38
|
+
return potentialBuffer;
|
|
39
|
+
}
|
|
40
|
+
if (ArrayBuffer.isView(potentialBuffer)) {
|
|
41
|
+
return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
|
|
42
|
+
}
|
|
43
|
+
var stringTag = (_a = potentialBuffer === null || potentialBuffer === void 0 ? void 0 : potentialBuffer[Symbol.toStringTag]) !== null && _a !== void 0 ? _a : Object.prototype.toString.call(potentialBuffer);
|
|
44
|
+
if (stringTag === 'ArrayBuffer' ||
|
|
45
|
+
stringTag === 'SharedArrayBuffer' ||
|
|
46
|
+
stringTag === '[object ArrayBuffer]' ||
|
|
47
|
+
stringTag === '[object SharedArrayBuffer]') {
|
|
48
|
+
return Buffer.from(potentialBuffer);
|
|
49
|
+
}
|
|
50
|
+
throw new error_1.BSONError("Cannot create Buffer from ".concat(String(potentialBuffer)));
|
|
51
|
+
},
|
|
52
|
+
allocate: function (size) {
|
|
53
|
+
return Buffer.alloc(size);
|
|
54
|
+
},
|
|
55
|
+
equals: function (a, b) {
|
|
56
|
+
return exports.nodeJsByteUtils.toLocalBufferType(a).equals(b);
|
|
57
|
+
},
|
|
58
|
+
fromNumberArray: function (array) {
|
|
59
|
+
return Buffer.from(array);
|
|
60
|
+
},
|
|
61
|
+
fromBase64: function (base64) {
|
|
62
|
+
return Buffer.from(base64, 'base64');
|
|
63
|
+
},
|
|
64
|
+
toBase64: function (buffer) {
|
|
65
|
+
return exports.nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
|
|
66
|
+
},
|
|
67
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
68
|
+
fromISO88591: function (codePoints) {
|
|
69
|
+
return Buffer.from(codePoints, 'binary');
|
|
70
|
+
},
|
|
71
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
72
|
+
toISO88591: function (buffer) {
|
|
73
|
+
return exports.nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
|
|
74
|
+
},
|
|
75
|
+
fromHex: function (hex) {
|
|
76
|
+
return Buffer.from(hex, 'hex');
|
|
77
|
+
},
|
|
78
|
+
toHex: function (buffer) {
|
|
79
|
+
return exports.nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
|
|
80
|
+
},
|
|
81
|
+
fromUTF8: function (text) {
|
|
82
|
+
return Buffer.from(text, 'utf8');
|
|
83
|
+
},
|
|
84
|
+
toUTF8: function (buffer, start, end) {
|
|
85
|
+
return exports.nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
|
|
86
|
+
},
|
|
87
|
+
utf8ByteLength: function (input) {
|
|
88
|
+
return Buffer.byteLength(input, 'utf8');
|
|
89
|
+
},
|
|
90
|
+
encodeUTF8Into: function (buffer, source, byteOffset) {
|
|
91
|
+
return exports.nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
|
|
92
|
+
},
|
|
93
|
+
randomBytes: nodejsRandomBytes
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=node_byte_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_byte_utils.js","sourceRoot":"","sources":["../../../../src/ObjectId/utils/node_byte_utils.ts"],"names":[],"mappings":";;;AAAA,kCAAqC;AA0BrC,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,OAAO,uBAAe,CAAC,eAAe,CACpC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,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MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,cAAc,YAAC,MAAkB,EAAE,MAAc,EAAE,UAAkB;QACnE,OAAO,uBAAe,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAChG,CAAC;IAED,WAAW,EAAE,iBAAiB;CAC/B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type ArrayBufferViewWithTag = ArrayBufferView & {
|
|
2
|
+
[Symbol.toStringTag]?: string;
|
|
3
|
+
};
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function webMathRandomBytes(byteLength: number): Uint8Array;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare const webByteUtils: {
|
|
8
|
+
toLocalBufferType(potentialUint8array: Uint8Array | ArrayBufferViewWithTag | ArrayBuffer): Uint8Array;
|
|
9
|
+
allocate(size: number): Uint8Array;
|
|
10
|
+
equals(a: Uint8Array, b: Uint8Array): boolean;
|
|
11
|
+
fromNumberArray(array: number[]): Uint8Array;
|
|
12
|
+
fromBase64(base64: string): Uint8Array;
|
|
13
|
+
toBase64(uint8array: Uint8Array): string;
|
|
14
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
15
|
+
fromISO88591(codePoints: string): Uint8Array;
|
|
16
|
+
/** **Legacy** binary strings are an outdated method of data transfer. Do not add public API support for interpreting this format */
|
|
17
|
+
toISO88591(uint8array: Uint8Array): string;
|
|
18
|
+
fromHex(hex: string): Uint8Array;
|
|
19
|
+
toHex(uint8array: Uint8Array): string;
|
|
20
|
+
fromUTF8(text: string): Uint8Array;
|
|
21
|
+
toUTF8(uint8array: Uint8Array, start: number, end: number): string;
|
|
22
|
+
utf8ByteLength(input: string): number;
|
|
23
|
+
encodeUTF8Into(buffer: Uint8Array, source: string, byteOffset: number): number;
|
|
24
|
+
randomBytes: (byteLength: number) => Uint8Array;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=web_byte_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web_byte_utils.d.ts","sourceRoot":"","sources":["../../../../src/ObjectId/utils/web_byte_utils.ts"],"names":[],"mappings":"AA0BA,KAAK,sBAAsB,GAAG,eAAe,GAAG;IAC9C,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAOF,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,cAOpD;AA0BD,gBAAgB;AAChB,eAAO,MAAM,YAAY;2CAEA,UAAU,GAAG,sBAAsB,GAAG,WAAW,GACrE,UAAU;mBA8BE,MAAM,GAAG,UAAU;cAOxB,UAAU,KAAK,UAAU,GAAG,OAAO;2BAYtB,MAAM,EAAE,GAAG,UAAU;uBAIzB,MAAM,GAAG,UAAU;yBAIjB,UAAU,GAAG,MAAM;IAIxC,oIAAoI;6BAC3G,MAAM,GAAG,UAAU;IAI5C,oIAAoI;2BAC7G,UAAU,GAAG,MAAM;iBAI7B,MAAM,GAAG,UAAU;sBAsBd,UAAU,GAAG,MAAM;mBAItB,MAAM,GAAG,UAAU;uBAIf,UAAU,SAAS,MAAM,OAAO,MAAM,GAAG,MAAM;0BAI5C,MAAM,GAAG,MAAM;2BAId,UAAU,UAAU,MAAM,cAAc,MAAM,GAAG,MAAM;8BAxI7C,MAAM,KAAK,UAAU;CA+IvD,CAAC"}
|