@digipair/skill-mongodb 0.94.0-0 → 0.94.0-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/dist/index.esm.js CHANGED
@@ -23692,7 +23692,7 @@ function _non_iterable_rest$1$1() {
23692
23692
  function _non_iterable_spread$1$1() {
23693
23693
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
23694
23694
  }
23695
- function _object_spread$f(target) {
23695
+ function _object_spread$g(target) {
23696
23696
  for(var i = 1; i < arguments.length; i++){
23697
23697
  var source = arguments[i] != null ? arguments[i] : {};
23698
23698
  var ownKeys = Object.keys(source);
@@ -23707,7 +23707,7 @@ function _object_spread$f(target) {
23707
23707
  }
23708
23708
  return target;
23709
23709
  }
23710
- function ownKeys$c(object, enumerableOnly) {
23710
+ function ownKeys$d(object, enumerableOnly) {
23711
23711
  var keys = Object.keys(object);
23712
23712
  if (Object.getOwnPropertySymbols) {
23713
23713
  var symbols = Object.getOwnPropertySymbols(object);
@@ -23715,12 +23715,12 @@ function ownKeys$c(object, enumerableOnly) {
23715
23715
  }
23716
23716
  return keys;
23717
23717
  }
23718
- function _object_spread_props$c(target, source) {
23718
+ function _object_spread_props$d(target, source) {
23719
23719
  source = source != null ? source : {};
23720
23720
  if (Object.getOwnPropertyDescriptors) {
23721
23721
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
23722
23722
  } else {
23723
- ownKeys$c(Object(source)).forEach(function(key) {
23723
+ ownKeys$d(Object(source)).forEach(function(key) {
23724
23724
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23725
23725
  });
23726
23726
  }
@@ -23913,14 +23913,14 @@ function indent(str, spaces) {
23913
23913
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23914
23914
  // match is required
23915
23915
  if (!match) {
23916
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23916
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23917
23917
  v: nextMatch1
23918
23918
  };
23919
23919
  }
23920
23920
  var token = match.token, offset = match.offset;
23921
23921
  i1 += offset;
23922
23922
  if (token === ' ') {
23923
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23923
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23924
23924
  }
23925
23925
  tokens1 = _to_consumable_array$1$1(tokens1).concat([
23926
23926
  token
@@ -23939,7 +23939,7 @@ function indent(str, spaces) {
23939
23939
  if (contextKeys.some(function(el) {
23940
23940
  return el.startsWith(name);
23941
23941
  })) {
23942
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23942
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23943
23943
  }
23944
23944
  if (dateTimeIdentifiers.some(function(el) {
23945
23945
  return el === name;
@@ -23958,9 +23958,9 @@ function indent(str, spaces) {
23958
23958
  if (dateTimeIdentifiers.some(function(el) {
23959
23959
  return el.startsWith(name);
23960
23960
  })) {
23961
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23961
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23962
23962
  }
23963
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23963
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23964
23964
  v: nextMatch1
23965
23965
  };
23966
23966
  };
@@ -24113,7 +24113,7 @@ var dateTimeIdentifiers = Object.keys(dateTimeLiterals);
24113
24113
  */ key: "set",
24114
24114
  value: function set(key, value) {
24115
24115
  var constructor = /** @type { typeof VariableContext } */ this.constructor;
24116
- return constructor.of(_object_spread_props$c(_object_spread$f({}, this.value), _define_property$1$1({}, key, value)));
24116
+ return constructor.of(_object_spread_props$d(_object_spread$g({}, this.value), _define_property$1$1({}, key, value)));
24117
24117
  }
24118
24118
  },
24119
24119
  {
@@ -24177,7 +24177,7 @@ var dateTimeIdentifiers = Object.keys(dateTimeLiterals);
24177
24177
  if ((typeof context === "undefined" ? "undefined" : _type_of$1$1(context)) !== 'object') {
24178
24178
  return {};
24179
24179
  }
24180
- return _object_spread$f({}, context);
24180
+ return _object_spread$g({}, context);
24181
24181
  }
24182
24182
  },
24183
24183
  {
@@ -24195,13 +24195,13 @@ var dateTimeIdentifiers = Object.keys(dateTimeLiterals);
24195
24195
  return reduce(this.__unwrap(other), function(merged, value, key) {
24196
24196
  if (_instanceof$1$1(value, ValueProducer)) {
24197
24197
  // keep value producers in tact
24198
- return _object_spread_props$c(_object_spread$f({}, merged), _define_property$1$1({}, key, value));
24198
+ return _object_spread_props$d(_object_spread$g({}, merged), _define_property$1$1({}, key, value));
24199
24199
  }
24200
24200
  value = _this.__unwrap(value);
24201
24201
  if (has(merged, key)) {
24202
24202
  value = _this.__merge(_this.__unwrap(merged[key]), value);
24203
24203
  }
24204
- return _object_spread_props$c(_object_spread$f({}, merged), _define_property$1$1({}, key, value));
24204
+ return _object_spread_props$d(_object_spread$g({}, merged), _define_property$1$1({}, key, value));
24205
24205
  }, this.__unwrap(context));
24206
24206
  }
24207
24207
  }
@@ -24420,7 +24420,7 @@ var Variables = /*#__PURE__*/ function() {
24420
24420
  */ key: "assign",
24421
24421
  value: function assign() {
24422
24422
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
24423
- return Variables.of(_object_spread$f({}, this, options));
24423
+ return Variables.of(_object_spread$g({}, this, options));
24424
24424
  }
24425
24425
  },
24426
24426
  {
@@ -24435,7 +24435,7 @@ var Variables = /*#__PURE__*/ function() {
24435
24435
  context: this.context,
24436
24436
  parent: this.parent
24437
24437
  };
24438
- return Variables.of(_object_spread$f({}, defaultOptions, options));
24438
+ return Variables.of(_object_spread$g({}, defaultOptions, options));
24439
24439
  }
24440
24440
  }
24441
24441
  ], [
@@ -24883,7 +24883,7 @@ function _assert_this_initialized$q(self1) {
24883
24883
  }
24884
24884
  return self1;
24885
24885
  }
24886
- function _class_call_check$B(instance, Constructor) {
24886
+ function _class_call_check$C(instance, Constructor) {
24887
24887
  if (!(instance instanceof Constructor)) {
24888
24888
  throw new TypeError("Cannot call a class as a function");
24889
24889
  }
@@ -24905,7 +24905,7 @@ function _construct$2(Parent, args, Class) {
24905
24905
  }
24906
24906
  return _construct$2.apply(null, arguments);
24907
24907
  }
24908
- function _defineProperties$y(target, props) {
24908
+ function _defineProperties$z(target, props) {
24909
24909
  for(var i = 0; i < props.length; i++){
24910
24910
  var descriptor = props[i];
24911
24911
  descriptor.enumerable = descriptor.enumerable || false;
@@ -24914,11 +24914,11 @@ function _defineProperties$y(target, props) {
24914
24914
  Object.defineProperty(target, descriptor.key, descriptor);
24915
24915
  }
24916
24916
  }
24917
- function _create_class$y(Constructor, protoProps, staticProps) {
24918
- if (protoProps) _defineProperties$y(Constructor.prototype, protoProps);
24917
+ function _create_class$z(Constructor, protoProps, staticProps) {
24918
+ if (protoProps) _defineProperties$z(Constructor.prototype, protoProps);
24919
24919
  return Constructor;
24920
24920
  }
24921
- function _define_property$g(obj, key, value) {
24921
+ function _define_property$h(obj, key, value) {
24922
24922
  if (key in obj) {
24923
24923
  Object.defineProperty(obj, key, {
24924
24924
  value: value,
@@ -25156,7 +25156,7 @@ function typeCast(obj, type) {
25156
25156
  return null;
25157
25157
  }
25158
25158
  var Range = function Range(props) {
25159
- _class_call_check$B(this, Range);
25159
+ _class_call_check$C(this, Range);
25160
25160
  Object.assign(this, props);
25161
25161
  };
25162
25162
  function isNumber(obj) {
@@ -25262,11 +25262,11 @@ function equals(a, b) {
25262
25262
  }
25263
25263
  var FunctionWrapper = /*#__PURE__*/ function() {
25264
25264
  function FunctionWrapper(fn, parameterNames) {
25265
- _class_call_check$B(this, FunctionWrapper);
25265
+ _class_call_check$C(this, FunctionWrapper);
25266
25266
  this.fn = fn;
25267
25267
  this.parameterNames = parameterNames;
25268
25268
  }
25269
- _create_class$y(FunctionWrapper, [
25269
+ _create_class$z(FunctionWrapper, [
25270
25270
  {
25271
25271
  key: "invoke",
25272
25272
  value: function invoke(contextOrArgs) {
@@ -26214,7 +26214,7 @@ var builtins = {
26214
26214
  if (key in context) {
26215
26215
  return FALSE;
26216
26216
  }
26217
- return Object.assign(Object.assign({}, context), _define_property$g({}, entry.key, entry.value));
26217
+ return Object.assign(Object.assign({}, context), _define_property$h({}, entry.key, entry.value));
26218
26218
  }, {});
26219
26219
  if (context === FALSE) {
26220
26220
  return null;
@@ -26267,7 +26267,7 @@ var builtins = {
26267
26267
  return null;
26268
26268
  }
26269
26269
  }
26270
- return Object.assign(Object.assign({}, context), _define_property$g({}, key, value));
26270
+ return Object.assign(Object.assign({}, context), _define_property$h({}, key, value));
26271
26271
  }
26272
26272
  function matches(a, b) {
26273
26273
  return a === b;
@@ -26605,7 +26605,7 @@ var SyntaxError$1 = /*#__PURE__*/ function(Error1) {
26605
26605
  _inherits$q(SyntaxError1, Error1);
26606
26606
  var _super = _create_super$q(SyntaxError1);
26607
26607
  function SyntaxError1(message, details) {
26608
- _class_call_check$B(this, SyntaxError1);
26608
+ _class_call_check$C(this, SyntaxError1);
26609
26609
  var _this;
26610
26610
  _this = _super.call(this, message);
26611
26611
  Object.assign(_assert_this_initialized$q(_this), details);
@@ -26615,9 +26615,9 @@ var SyntaxError$1 = /*#__PURE__*/ function(Error1) {
26615
26615
  }(_wrap_native_super$2(Error));
26616
26616
  var Interpreter = /*#__PURE__*/ function() {
26617
26617
  function Interpreter() {
26618
- _class_call_check$B(this, Interpreter);
26618
+ _class_call_check$C(this, Interpreter);
26619
26619
  }
26620
- _create_class$y(Interpreter, [
26620
+ _create_class$z(Interpreter, [
26621
26621
  {
26622
26622
  key: "_buildExecutionTree",
26623
26623
  value: function _buildExecutionTree(tree, input) {
@@ -26965,7 +26965,7 @@ function evalNode(node, input, args) {
26965
26965
  return function(context) {
26966
26966
  return args.slice(1, -1).reduce(function(obj, arg) {
26967
26967
  var _arg = _sliced_to_array$d(arg(Object.assign(Object.assign({}, context), obj)), 2), key = _arg[0], value = _arg[1];
26968
- return Object.assign(Object.assign({}, obj), _define_property$g({}, key, value));
26968
+ return Object.assign(Object.assign({}, obj), _define_property$h({}, key, value));
26969
26969
  }, {});
26970
26970
  };
26971
26971
  case 'FunctionBody':
@@ -27430,7 +27430,7 @@ function extractValue(context, prop, _target) {
27430
27430
  'range'
27431
27431
  ].includes(getType(target))) {
27432
27432
  return target.map(function(t) {
27433
- return _define_property$g({}, prop, t);
27433
+ return _define_property$h({}, prop, t);
27434
27434
  });
27435
27435
  }
27436
27436
  return null;
@@ -28047,7 +28047,7 @@ function _assert_this_initialized$p(self) {
28047
28047
  }
28048
28048
  return self;
28049
28049
  }
28050
- function _class_call_check$A(instance, Constructor) {
28050
+ function _class_call_check$B(instance, Constructor) {
28051
28051
  if (!(instance instanceof Constructor)) {
28052
28052
  throw new TypeError("Cannot call a class as a function");
28053
28053
  }
@@ -28069,7 +28069,7 @@ function _construct$1(Parent, args, Class) {
28069
28069
  }
28070
28070
  return _construct$1.apply(null, arguments);
28071
28071
  }
28072
- function _defineProperties$x(target, props) {
28072
+ function _defineProperties$y(target, props) {
28073
28073
  for(var i = 0; i < props.length; i++){
28074
28074
  var descriptor = props[i];
28075
28075
  descriptor.enumerable = descriptor.enumerable || false;
@@ -28078,12 +28078,12 @@ function _defineProperties$x(target, props) {
28078
28078
  Object.defineProperty(target, descriptor.key, descriptor);
28079
28079
  }
28080
28080
  }
28081
- function _create_class$x(Constructor, protoProps, staticProps) {
28082
- if (protoProps) _defineProperties$x(Constructor.prototype, protoProps);
28083
- if (staticProps) _defineProperties$x(Constructor, staticProps);
28081
+ function _create_class$y(Constructor, protoProps, staticProps) {
28082
+ if (protoProps) _defineProperties$y(Constructor.prototype, protoProps);
28083
+ if (staticProps) _defineProperties$y(Constructor, staticProps);
28084
28084
  return Constructor;
28085
28085
  }
28086
- function _define_property$f(obj, key, value) {
28086
+ function _define_property$g(obj, key, value) {
28087
28087
  if (key in obj) {
28088
28088
  Object.defineProperty(obj, key, {
28089
28089
  value: value,
@@ -28158,7 +28158,7 @@ function _non_iterable_rest$6() {
28158
28158
  function _non_iterable_spread$2() {
28159
28159
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
28160
28160
  }
28161
- function _object_spread$e(target) {
28161
+ function _object_spread$f(target) {
28162
28162
  for(var i = 1; i < arguments.length; i++){
28163
28163
  var source = arguments[i] != null ? arguments[i] : {};
28164
28164
  var ownKeys = Object.keys(source);
@@ -28168,12 +28168,12 @@ function _object_spread$e(target) {
28168
28168
  }));
28169
28169
  }
28170
28170
  ownKeys.forEach(function(key) {
28171
- _define_property$f(target, key, source[key]);
28171
+ _define_property$g(target, key, source[key]);
28172
28172
  });
28173
28173
  }
28174
28174
  return target;
28175
28175
  }
28176
- function ownKeys$b(object, enumerableOnly) {
28176
+ function ownKeys$c(object, enumerableOnly) {
28177
28177
  var keys = Object.keys(object);
28178
28178
  if (Object.getOwnPropertySymbols) {
28179
28179
  var symbols = Object.getOwnPropertySymbols(object);
@@ -28181,12 +28181,12 @@ function ownKeys$b(object, enumerableOnly) {
28181
28181
  }
28182
28182
  return keys;
28183
28183
  }
28184
- function _object_spread_props$b(target, source) {
28184
+ function _object_spread_props$c(target, source) {
28185
28185
  source = source != null ? source : {};
28186
28186
  if (Object.getOwnPropertyDescriptors) {
28187
28187
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
28188
28188
  } else {
28189
- ownKeys$b(Object(source)).forEach(function(key) {
28189
+ ownKeys$c(Object(source)).forEach(function(key) {
28190
28190
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
28191
28191
  });
28192
28192
  }
@@ -28371,10 +28371,10 @@ var BSONError = /*#__PURE__*/ function(Error1) {
28371
28371
  _inherits$p(BSONError, Error1);
28372
28372
  var _super = _create_super$p(BSONError);
28373
28373
  function BSONError(message, options) {
28374
- _class_call_check$A(this, BSONError);
28374
+ _class_call_check$B(this, BSONError);
28375
28375
  return _super.call(this, message, options);
28376
28376
  }
28377
- _create_class$x(BSONError, [
28377
+ _create_class$y(BSONError, [
28378
28378
  {
28379
28379
  key: "bsonError",
28380
28380
  get: function get() {
@@ -28401,10 +28401,10 @@ var BSONVersionError = /*#__PURE__*/ function(BSONError) {
28401
28401
  _inherits$p(BSONVersionError, BSONError);
28402
28402
  var _super = _create_super$p(BSONVersionError);
28403
28403
  function BSONVersionError() {
28404
- _class_call_check$A(this, BSONVersionError);
28404
+ _class_call_check$B(this, BSONVersionError);
28405
28405
  return _super.call(this, "Unsupported BSON version, bson types must be from bson ".concat(BSON_MAJOR_VERSION, ".x.x"));
28406
28406
  }
28407
- _create_class$x(BSONVersionError, [
28407
+ _create_class$y(BSONVersionError, [
28408
28408
  {
28409
28409
  key: "name",
28410
28410
  get: function get() {
@@ -28418,10 +28418,10 @@ var BSONRuntimeError = /*#__PURE__*/ function(BSONError) {
28418
28418
  _inherits$p(BSONRuntimeError, BSONError);
28419
28419
  var _super = _create_super$p(BSONRuntimeError);
28420
28420
  function BSONRuntimeError(message) {
28421
- _class_call_check$A(this, BSONRuntimeError);
28421
+ _class_call_check$B(this, BSONRuntimeError);
28422
28422
  return _super.call(this, message);
28423
28423
  }
28424
- _create_class$x(BSONRuntimeError, [
28424
+ _create_class$y(BSONRuntimeError, [
28425
28425
  {
28426
28426
  key: "name",
28427
28427
  get: function get() {
@@ -28435,13 +28435,13 @@ var BSONOffsetError = /*#__PURE__*/ function(BSONError) {
28435
28435
  _inherits$p(BSONOffsetError, BSONError);
28436
28436
  var _super = _create_super$p(BSONOffsetError);
28437
28437
  function BSONOffsetError(message, offset, options) {
28438
- _class_call_check$A(this, BSONOffsetError);
28438
+ _class_call_check$B(this, BSONOffsetError);
28439
28439
  var _this;
28440
28440
  _this = _super.call(this, "".concat(message, ". offset: ").concat(offset), options);
28441
28441
  _this.offset = offset;
28442
28442
  return _this;
28443
28443
  }
28444
- _create_class$x(BSONOffsetError, [
28444
+ _create_class$y(BSONOffsetError, [
28445
28445
  {
28446
28446
  key: "name",
28447
28447
  get: function get() {
@@ -28748,9 +28748,9 @@ var hasGlobalBuffer = typeof Buffer === 'function' && ((_Buffer_prototype = Buff
28748
28748
  var ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
28749
28749
  var BSONValue = /*#__PURE__*/ function() {
28750
28750
  function BSONValue() {
28751
- _class_call_check$A(this, BSONValue);
28751
+ _class_call_check$B(this, BSONValue);
28752
28752
  }
28753
- _create_class$x(BSONValue, [
28753
+ _create_class$y(BSONValue, [
28754
28754
  {
28755
28755
  key: BSON_VERSION_SYMBOL,
28756
28756
  get: function get() {
@@ -28881,7 +28881,7 @@ var Binary = /*#__PURE__*/ function(BSONValue) {
28881
28881
  _inherits$p(Binary, BSONValue);
28882
28882
  var _super = _create_super$p(Binary);
28883
28883
  function Binary(buffer, subType) {
28884
- _class_call_check$A(this, Binary);
28884
+ _class_call_check$B(this, Binary);
28885
28885
  var _this;
28886
28886
  _this = _super.call(this);
28887
28887
  if (!(buffer == null) && typeof buffer === 'string' && !ArrayBuffer.isView(buffer) && !isAnyArrayBuffer(buffer) && !Array.isArray(buffer)) {
@@ -28897,7 +28897,7 @@ var Binary = /*#__PURE__*/ function(BSONValue) {
28897
28897
  }
28898
28898
  return _this;
28899
28899
  }
28900
- _create_class$x(Binary, [
28900
+ _create_class$y(Binary, [
28901
28901
  {
28902
28902
  key: "_bsontype",
28903
28903
  get: function get() {
@@ -29237,7 +29237,7 @@ var UUID = /*#__PURE__*/ function(Binary1) {
29237
29237
  _inherits$p(UUID, Binary1);
29238
29238
  var _super = _create_super$p(UUID);
29239
29239
  function UUID(input) {
29240
- _class_call_check$A(this, UUID);
29240
+ _class_call_check$B(this, UUID);
29241
29241
  var bytes;
29242
29242
  if (input == null) {
29243
29243
  bytes = UUID.generate();
@@ -29252,7 +29252,7 @@ var UUID = /*#__PURE__*/ function(Binary1) {
29252
29252
  }
29253
29253
  return _super.call(this, bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
29254
29254
  }
29255
- _create_class$x(UUID, [
29255
+ _create_class$y(UUID, [
29256
29256
  {
29257
29257
  key: "id",
29258
29258
  get: function get() {
@@ -29381,14 +29381,14 @@ var Code = /*#__PURE__*/ function(BSONValue) {
29381
29381
  _inherits$p(Code, BSONValue);
29382
29382
  var _super = _create_super$p(Code);
29383
29383
  function Code(code, scope) {
29384
- _class_call_check$A(this, Code);
29384
+ _class_call_check$B(this, Code);
29385
29385
  var _this;
29386
29386
  _this = _super.call(this);
29387
29387
  _this.code = code.toString();
29388
29388
  _this.scope = scope !== null && scope !== void 0 ? scope : null;
29389
29389
  return _this;
29390
29390
  }
29391
- _create_class$x(Code, [
29391
+ _create_class$y(Code, [
29392
29392
  {
29393
29393
  key: "_bsontype",
29394
29394
  get: function get() {
@@ -29453,7 +29453,7 @@ var DBRef = /*#__PURE__*/ function(BSONValue) {
29453
29453
  _inherits$p(DBRef, BSONValue);
29454
29454
  var _super = _create_super$p(DBRef);
29455
29455
  function DBRef(collection, oid, db, fields) {
29456
- _class_call_check$A(this, DBRef);
29456
+ _class_call_check$B(this, DBRef);
29457
29457
  var _this;
29458
29458
  _this = _super.call(this);
29459
29459
  var parts = collection.split('.');
@@ -29467,7 +29467,7 @@ var DBRef = /*#__PURE__*/ function(BSONValue) {
29467
29467
  _this.fields = fields || {};
29468
29468
  return _this;
29469
29469
  }
29470
- _create_class$x(DBRef, [
29470
+ _create_class$y(DBRef, [
29471
29471
  {
29472
29472
  key: "_bsontype",
29473
29473
  get: function get() {
@@ -29870,7 +29870,7 @@ var Long = /*#__PURE__*/ function(BSONValue) {
29870
29870
  var _super = _create_super$p(Long);
29871
29871
  function Long() {
29872
29872
  var lowOrValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, highOrUnsigned = arguments.length > 1 ? arguments[1] : void 0, unsigned = arguments.length > 2 ? arguments[2] : void 0;
29873
- _class_call_check$A(this, Long);
29873
+ _class_call_check$B(this, Long);
29874
29874
  var _this;
29875
29875
  _this = _super.call(this);
29876
29876
  var unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
@@ -29885,7 +29885,7 @@ var Long = /*#__PURE__*/ function(BSONValue) {
29885
29885
  _this.unsigned = res.unsigned;
29886
29886
  return _this;
29887
29887
  }
29888
- _create_class$x(Long, [
29888
+ _create_class$y(Long, [
29889
29889
  {
29890
29890
  key: "_bsontype",
29891
29891
  get: function get() {
@@ -30638,7 +30638,7 @@ var Long = /*#__PURE__*/ function(BSONValue) {
30638
30638
  {
30639
30639
  key: "fromExtendedJSON",
30640
30640
  value: function fromExtendedJSON(doc, options) {
30641
- var _$_object_spread = _object_spread$e({}, options), _object_spread_useBigInt64 = _$_object_spread.useBigInt64, useBigInt64 = _object_spread_useBigInt64 === void 0 ? false : _object_spread_useBigInt64, _object_spread_relaxed = _$_object_spread.relaxed, relaxed = _object_spread_relaxed === void 0 ? true : _object_spread_relaxed;
30641
+ var _$_object_spread = _object_spread$f({}, options), _object_spread_useBigInt64 = _$_object_spread.useBigInt64, useBigInt64 = _object_spread_useBigInt64 === void 0 ? false : _object_spread_useBigInt64, _object_spread_relaxed = _$_object_spread.relaxed, relaxed = _object_spread_relaxed === void 0 ? true : _object_spread_relaxed;
30642
30642
  if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
30643
30643
  throw new BSONError('$numberLong string is too long');
30644
30644
  }
@@ -30800,7 +30800,7 @@ var Decimal128 = /*#__PURE__*/ function(BSONValue) {
30800
30800
  _inherits$p(Decimal128, BSONValue);
30801
30801
  var _super = _create_super$p(Decimal128);
30802
30802
  function Decimal128(bytes) {
30803
- _class_call_check$A(this, Decimal128);
30803
+ _class_call_check$B(this, Decimal128);
30804
30804
  var _this;
30805
30805
  _this = _super.call(this);
30806
30806
  if (typeof bytes === 'string') {
@@ -30815,7 +30815,7 @@ var Decimal128 = /*#__PURE__*/ function(BSONValue) {
30815
30815
  }
30816
30816
  return _this;
30817
30817
  }
30818
- _create_class$x(Decimal128, [
30818
+ _create_class$y(Decimal128, [
30819
30819
  {
30820
30820
  key: "_bsontype",
30821
30821
  get: function get() {
@@ -31290,7 +31290,7 @@ var Double = /*#__PURE__*/ function(BSONValue) {
31290
31290
  _inherits$p(Double, BSONValue);
31291
31291
  var _super = _create_super$p(Double);
31292
31292
  function Double(value) {
31293
- _class_call_check$A(this, Double);
31293
+ _class_call_check$B(this, Double);
31294
31294
  var _this;
31295
31295
  _this = _super.call(this);
31296
31296
  if (_instanceof$b(value, Number)) {
@@ -31299,7 +31299,7 @@ var Double = /*#__PURE__*/ function(BSONValue) {
31299
31299
  _this.value = +value;
31300
31300
  return _this;
31301
31301
  }
31302
- _create_class$x(Double, [
31302
+ _create_class$y(Double, [
31303
31303
  {
31304
31304
  key: "_bsontype",
31305
31305
  get: function get() {
@@ -31384,7 +31384,7 @@ var Int32 = /*#__PURE__*/ function(BSONValue) {
31384
31384
  _inherits$p(Int32, BSONValue);
31385
31385
  var _super = _create_super$p(Int32);
31386
31386
  function Int32(value) {
31387
- _class_call_check$A(this, Int32);
31387
+ _class_call_check$B(this, Int32);
31388
31388
  var _this;
31389
31389
  _this = _super.call(this);
31390
31390
  if (_instanceof$b(value, Number)) {
@@ -31393,7 +31393,7 @@ var Int32 = /*#__PURE__*/ function(BSONValue) {
31393
31393
  _this.value = +value | 0;
31394
31394
  return _this;
31395
31395
  }
31396
- _create_class$x(Int32, [
31396
+ _create_class$y(Int32, [
31397
31397
  {
31398
31398
  key: "_bsontype",
31399
31399
  get: function get() {
@@ -31465,10 +31465,10 @@ var MaxKey = /*#__PURE__*/ function(BSONValue) {
31465
31465
  _inherits$p(MaxKey, BSONValue);
31466
31466
  var _super = _create_super$p(MaxKey);
31467
31467
  function MaxKey() {
31468
- _class_call_check$A(this, MaxKey);
31468
+ _class_call_check$B(this, MaxKey);
31469
31469
  return _super.apply(this, arguments);
31470
31470
  }
31471
- _create_class$x(MaxKey, [
31471
+ _create_class$y(MaxKey, [
31472
31472
  {
31473
31473
  key: "_bsontype",
31474
31474
  get: function get() {
@@ -31503,10 +31503,10 @@ var MinKey = /*#__PURE__*/ function(BSONValue) {
31503
31503
  _inherits$p(MinKey, BSONValue);
31504
31504
  var _super = _create_super$p(MinKey);
31505
31505
  function MinKey() {
31506
- _class_call_check$A(this, MinKey);
31506
+ _class_call_check$B(this, MinKey);
31507
31507
  return _super.apply(this, arguments);
31508
31508
  }
31509
- _create_class$x(MinKey, [
31509
+ _create_class$y(MinKey, [
31510
31510
  {
31511
31511
  key: "_bsontype",
31512
31512
  get: function get() {
@@ -31543,7 +31543,7 @@ var ObjectId = /*#__PURE__*/ function(BSONValue) {
31543
31543
  _inherits$p(ObjectId, BSONValue);
31544
31544
  var _super = _create_super$p(ObjectId);
31545
31545
  function ObjectId(inputId) {
31546
- _class_call_check$A(this, ObjectId);
31546
+ _class_call_check$B(this, ObjectId);
31547
31547
  var _this;
31548
31548
  _this = _super.call(this);
31549
31549
  var workingId;
@@ -31577,7 +31577,7 @@ var ObjectId = /*#__PURE__*/ function(BSONValue) {
31577
31577
  }
31578
31578
  return _this;
31579
31579
  }
31580
- _create_class$x(ObjectId, [
31580
+ _create_class$y(ObjectId, [
31581
31581
  {
31582
31582
  key: "_bsontype",
31583
31583
  get: function get() {
@@ -31923,7 +31923,7 @@ var BSONRegExp = /*#__PURE__*/ function(BSONValue) {
31923
31923
  _inherits$p(BSONRegExp, BSONValue);
31924
31924
  var _super = _create_super$p(BSONRegExp);
31925
31925
  function BSONRegExp(pattern, options) {
31926
- _class_call_check$A(this, BSONRegExp);
31926
+ _class_call_check$B(this, BSONRegExp);
31927
31927
  var _this;
31928
31928
  _this = _super.call(this);
31929
31929
  _this.pattern = pattern;
@@ -31941,7 +31941,7 @@ var BSONRegExp = /*#__PURE__*/ function(BSONValue) {
31941
31941
  }
31942
31942
  return _this;
31943
31943
  }
31944
- _create_class$x(BSONRegExp, [
31944
+ _create_class$y(BSONRegExp, [
31945
31945
  {
31946
31946
  key: "_bsontype",
31947
31947
  get: function get() {
@@ -32011,13 +32011,13 @@ var BSONSymbol = /*#__PURE__*/ function(BSONValue) {
32011
32011
  _inherits$p(BSONSymbol, BSONValue);
32012
32012
  var _super = _create_super$p(BSONSymbol);
32013
32013
  function BSONSymbol(value) {
32014
- _class_call_check$A(this, BSONSymbol);
32014
+ _class_call_check$B(this, BSONSymbol);
32015
32015
  var _this;
32016
32016
  _this = _super.call(this);
32017
32017
  _this.value = value;
32018
32018
  return _this;
32019
32019
  }
32020
- _create_class$x(BSONSymbol, [
32020
+ _create_class$y(BSONSymbol, [
32021
32021
  {
32022
32022
  key: "_bsontype",
32023
32023
  get: function get() {
@@ -32072,7 +32072,7 @@ var Timestamp = /*#__PURE__*/ function(LongWithoutOverridesClass) {
32072
32072
  _inherits$p(Timestamp, LongWithoutOverridesClass);
32073
32073
  var _super = _create_super$p(Timestamp);
32074
32074
  function Timestamp(low) {
32075
- _class_call_check$A(this, Timestamp);
32075
+ _class_call_check$B(this, Timestamp);
32076
32076
  var _this;
32077
32077
  if (low == null) {
32078
32078
  _this = _super.call(this, 0, 0, true);
@@ -32107,7 +32107,7 @@ var Timestamp = /*#__PURE__*/ function(LongWithoutOverridesClass) {
32107
32107
  }
32108
32108
  return _possible_constructor_return$p(_this);
32109
32109
  }
32110
- _create_class$x(Timestamp, [
32110
+ _create_class$y(Timestamp, [
32111
32111
  {
32112
32112
  key: "_bsontype",
32113
32113
  get: function get() {
@@ -32358,7 +32358,7 @@ function deserializeObject(buffer, index, options) {
32358
32358
  } else {
32359
32359
  var objectOptions = options;
32360
32360
  if (!globalUTFValidation) {
32361
- objectOptions = _object_spread_props$b(_object_spread$e({}, options), {
32361
+ objectOptions = _object_spread_props$c(_object_spread$f({}, options), {
32362
32362
  validation: {
32363
32363
  utf8: shouldValidateKey
32364
32364
  }
@@ -32373,12 +32373,12 @@ function deserializeObject(buffer, index, options) {
32373
32373
  var arrayOptions = options;
32374
32374
  var stopIndex = index + objectSize1;
32375
32375
  if (fieldsAsRaw && fieldsAsRaw[name]) {
32376
- arrayOptions = _object_spread_props$b(_object_spread$e({}, options), {
32376
+ arrayOptions = _object_spread_props$c(_object_spread$f({}, options), {
32377
32377
  raw: true
32378
32378
  });
32379
32379
  }
32380
32380
  if (!globalUTFValidation) {
32381
- arrayOptions = _object_spread_props$b(_object_spread$e({}, arrayOptions), {
32381
+ arrayOptions = _object_spread_props$c(_object_spread$f({}, arrayOptions), {
32382
32382
  validation: {
32383
32383
  utf8: shouldValidateKey
32384
32384
  }
@@ -36286,309 +36286,302 @@ var responses = {};
36286
36286
 
36287
36287
  var document$1 = {};
36288
36288
 
36289
- var hasRequiredDocument;
36290
-
36291
- function requireDocument () {
36292
- if (hasRequiredDocument) return document$1;
36293
- hasRequiredDocument = 1;
36294
- function _class_call_check(instance, Constructor) {
36295
- if (!(instance instanceof Constructor)) {
36296
- throw new TypeError("Cannot call a class as a function");
36297
- }
36298
- }
36299
- function _defineProperties(target, props) {
36300
- for(var i = 0; i < props.length; i++){
36301
- var descriptor = props[i];
36302
- descriptor.enumerable = descriptor.enumerable || false;
36303
- descriptor.configurable = true;
36304
- if ("value" in descriptor) descriptor.writable = true;
36305
- Object.defineProperty(target, descriptor.key, descriptor);
36306
- }
36307
- }
36308
- function _create_class(Constructor, protoProps, staticProps) {
36309
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
36310
- return Constructor;
36311
- }
36312
- function _define_property(obj, key, value) {
36313
- if (key in obj) {
36314
- Object.defineProperty(obj, key, {
36315
- value: value,
36316
- enumerable: true,
36317
- configurable: true,
36318
- writable: true
36319
- });
36320
- } else {
36321
- obj[key] = value;
36322
- }
36323
- return obj;
36324
- }
36325
- function _object_spread(target) {
36326
- for(var i = 1; i < arguments.length; i++){
36327
- var source = arguments[i] != null ? arguments[i] : {};
36328
- var ownKeys = Object.keys(source);
36329
- if (typeof Object.getOwnPropertySymbols === "function") {
36330
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
36331
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
36332
- }));
36333
- }
36334
- ownKeys.forEach(function(key) {
36335
- _define_property(target, key, source[key]);
36336
- });
36337
- }
36338
- return target;
36339
- }
36340
- function ownKeys(object, enumerableOnly) {
36341
- var keys = Object.keys(object);
36342
- if (Object.getOwnPropertySymbols) {
36343
- var symbols = Object.getOwnPropertySymbols(object);
36344
- keys.push.apply(keys, symbols);
36345
- }
36346
- return keys;
36347
- }
36348
- function _object_spread_props(target, source) {
36349
- source = source != null ? source : {};
36350
- if (Object.getOwnPropertyDescriptors) {
36351
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
36352
- } else {
36353
- ownKeys(Object(source)).forEach(function(key) {
36354
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
36355
- });
36356
- }
36357
- return target;
36358
- }
36359
- Object.defineProperty(document$1, "__esModule", {
36360
- value: true
36361
- });
36362
- document$1.OnDemandDocument = void 0;
36363
- var bson_1 = bson$2;
36364
- /** @internal */ var OnDemandDocument = /*#__PURE__*/ function() {
36365
- function OnDemandDocument(/** BSON bytes, this document begins at offset */ bson) {
36366
- var /** The start of the document */ offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, /** If this is an embedded document, indicates if this was a BSON array */ isArray = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, /** If elements was already calculated */ elements = arguments.length > 3 ? arguments[3] : void 0;
36367
- _class_call_check(this, OnDemandDocument);
36368
- this.bson = bson;
36369
- this.offset = offset;
36370
- this.isArray = isArray;
36371
- /**
36372
- * Maps JS strings to elements and jsValues for speeding up subsequent lookups.
36373
- * - If `false` then name does not exist in the BSON document
36374
- * - If `CachedBSONElement` instance name exists
36375
- * - If `cache[name].value == null` jsValue has not yet been parsed
36376
- * - Null/Undefined values do not get cached because they are zero-length values.
36377
- */ this.cache = Object.create(null);
36378
- /** Caches the index of elements that have been named */ this.indexFound = Object.create(null);
36379
- this.elements = elements !== null && elements !== void 0 ? elements : (0, bson_1.parseToElementsToArray)(this.bson, offset);
36380
- }
36381
- _create_class(OnDemandDocument, [
36382
- {
36383
- /** Only supports basic latin strings */ key: "isElementName",
36384
- value: function isElementName(name, element) {
36385
- var nameLength = element[2 /* BSONElementOffset.nameLength */ ];
36386
- var nameOffset = element[1 /* BSONElementOffset.nameOffset */ ];
36387
- if (name.length !== nameLength) return false;
36388
- var nameEnd = nameOffset + nameLength;
36389
- for(var byteIndex = nameOffset, charIndex = 0; charIndex < name.length && byteIndex < nameEnd; charIndex++, byteIndex++){
36390
- if (this.bson[byteIndex] !== name.charCodeAt(charIndex)) return false;
36391
- }
36392
- return true;
36393
- }
36394
- },
36395
- {
36396
- /**
36397
- * Seeks into the elements array for an element matching the given name.
36398
- *
36399
- * @remarks
36400
- * Caching:
36401
- * - Caches the existence of a property making subsequent look ups for non-existent properties return immediately
36402
- * - Caches names mapped to elements to avoid reiterating the array and comparing the name again
36403
- * - Caches the index at which an element has been found to prevent rechecking against elements already determined to belong to another name
36404
- *
36405
- * @param name - a basic latin string name of a BSON element
36406
- * @returns
36407
- */ key: "getElement",
36408
- value: function getElement(name) {
36409
- var cachedElement = this.cache[name];
36410
- if (cachedElement === false) return null;
36411
- if (cachedElement != null) {
36412
- return cachedElement;
36413
- }
36414
- if (typeof name === 'number') {
36415
- if (this.isArray) {
36416
- if (name < this.elements.length) {
36417
- var element = this.elements[name];
36418
- var cachedElement1 = {
36419
- element: element,
36420
- value: undefined
36421
- };
36422
- this.cache[name] = cachedElement1;
36423
- this.indexFound[name] = true;
36424
- return cachedElement1;
36425
- } else {
36426
- return null;
36427
- }
36428
- } else {
36429
- return null;
36430
- }
36431
- }
36432
- for(var index = 0; index < this.elements.length; index++){
36433
- var element1 = this.elements[index];
36434
- // skip this element if it has already been associated with a name
36435
- if (!(index in this.indexFound) && this.isElementName(name, element1)) {
36436
- var cachedElement2 = {
36437
- element: element1,
36438
- value: undefined
36439
- };
36440
- this.cache[name] = cachedElement2;
36441
- this.indexFound[index] = true;
36442
- return cachedElement2;
36443
- }
36444
- }
36445
- this.cache[name] = false;
36446
- return null;
36447
- }
36448
- },
36449
- {
36450
- key: "toJSValue",
36451
- value: function toJSValue(element, as) {
36452
- var type = element[0 /* BSONElementOffset.type */ ];
36453
- var offset = element[3 /* BSONElementOffset.offset */ ];
36454
- var length = element[4 /* BSONElementOffset.length */ ];
36455
- if (as !== type) {
36456
- return null;
36457
- }
36458
- switch(as){
36459
- case bson_1.BSONType.null:
36460
- case bson_1.BSONType.undefined:
36461
- return null;
36462
- case bson_1.BSONType.double:
36463
- return (0, bson_1.getFloat64LE)(this.bson, offset);
36464
- case bson_1.BSONType.int:
36465
- return (0, bson_1.getInt32LE)(this.bson, offset);
36466
- case bson_1.BSONType.long:
36467
- return (0, bson_1.getBigInt64LE)(this.bson, offset);
36468
- case bson_1.BSONType.bool:
36469
- return Boolean(this.bson[offset]);
36470
- case bson_1.BSONType.objectId:
36471
- return new bson_1.ObjectId(this.bson.subarray(offset, offset + 12));
36472
- case bson_1.BSONType.timestamp:
36473
- return new bson_1.Timestamp((0, bson_1.getBigInt64LE)(this.bson, offset));
36474
- case bson_1.BSONType.string:
36475
- return (0, bson_1.toUTF8)(this.bson, offset + 4, offset + length - 1, false);
36476
- case bson_1.BSONType.binData:
36477
- {
36478
- var totalBinarySize = (0, bson_1.getInt32LE)(this.bson, offset);
36479
- var subType = this.bson[offset + 4];
36480
- if (subType === 2) {
36481
- var subType2BinarySize = (0, bson_1.getInt32LE)(this.bson, offset + 1 + 4);
36482
- if (subType2BinarySize < 0) throw new bson_1.BSONError('Negative binary type element size found for subtype 0x02');
36483
- if (subType2BinarySize > totalBinarySize - 4) throw new bson_1.BSONError('Binary type with subtype 0x02 contains too long binary size');
36484
- if (subType2BinarySize < totalBinarySize - 4) throw new bson_1.BSONError('Binary type with subtype 0x02 contains too short binary size');
36485
- return new bson_1.Binary(this.bson.subarray(offset + 1 + 4 + 4, offset + 1 + 4 + 4 + subType2BinarySize), 2);
36486
- }
36487
- return new bson_1.Binary(this.bson.subarray(offset + 1 + 4, offset + 1 + 4 + totalBinarySize), subType);
36488
- }
36489
- case bson_1.BSONType.date:
36490
- // Pretend this is correct.
36491
- return new Date(Number((0, bson_1.getBigInt64LE)(this.bson, offset)));
36492
- case bson_1.BSONType.object:
36493
- return new OnDemandDocument(this.bson, offset);
36494
- case bson_1.BSONType.array:
36495
- return new OnDemandDocument(this.bson, offset, true);
36496
- default:
36497
- throw new bson_1.BSONError("Unsupported BSON type: ".concat(as));
36498
- }
36499
- }
36500
- },
36501
- {
36502
- /**
36503
- * Returns the number of elements in this BSON document
36504
- */ key: "size",
36505
- value: function size() {
36506
- return this.elements.length;
36507
- }
36508
- },
36509
- {
36510
- /**
36511
- * Checks for the existence of an element by name.
36512
- *
36513
- * @remarks
36514
- * Uses `getElement` with the expectation that will populate caches such that a `has` call
36515
- * followed by a `getElement` call will not repeat the cost paid by the first look up.
36516
- *
36517
- * @param name - element name
36518
- */ key: "has",
36519
- value: function has(name) {
36520
- var cachedElement = this.cache[name];
36521
- if (cachedElement === false) return false;
36522
- if (cachedElement != null) return true;
36523
- return this.getElement(name) != null;
36524
- }
36525
- },
36526
- {
36527
- key: "get",
36528
- value: function get(name, as, required) {
36529
- var element = this.getElement(name);
36530
- if (element == null) {
36531
- if (required === true) {
36532
- throw new bson_1.BSONError('BSON element "'.concat(name, '" is missing'));
36533
- } else {
36534
- return null;
36535
- }
36536
- }
36537
- if (element.value == null) {
36538
- var value = this.toJSValue(element.element, as);
36539
- if (value == null) {
36540
- if (required === true) {
36541
- throw new bson_1.BSONError('BSON element "'.concat(name, '" is missing'));
36542
- } else {
36543
- return null;
36544
- }
36545
- }
36546
- // It is important to never store null
36547
- element.value = value;
36548
- }
36549
- return element.value;
36550
- }
36551
- },
36552
- {
36553
- key: "getNumber",
36554
- value: function getNumber(name, required) {
36555
- var maybeBool = this.get(name, bson_1.BSONType.bool);
36556
- var bool = maybeBool == null ? null : maybeBool ? 1 : 0;
36557
- var maybeLong = this.get(name, bson_1.BSONType.long);
36558
- var long = maybeLong == null ? null : Number(maybeLong);
36559
- var _ref, _ref1;
36560
- var result = (_ref1 = (_ref = bool !== null && bool !== void 0 ? bool : long) !== null && _ref !== void 0 ? _ref : this.get(name, bson_1.BSONType.int)) !== null && _ref1 !== void 0 ? _ref1 : this.get(name, bson_1.BSONType.double);
36561
- if (required === true && result == null) {
36562
- throw new bson_1.BSONError('BSON element "'.concat(name, '" is missing'));
36563
- }
36564
- return result;
36565
- }
36566
- },
36567
- {
36568
- /**
36569
- * Deserialize this object, DOES NOT cache result so avoid multiple invocations
36570
- * @param options - BSON deserialization options
36571
- */ key: "toObject",
36572
- value: function toObject(options) {
36573
- return (0, bson_1.deserialize)(this.bson, _object_spread_props(_object_spread({}, options), {
36574
- index: this.offset,
36575
- allowObjectSmallerThanBufferSize: true
36576
- }));
36577
- }
36578
- },
36579
- {
36580
- /** Returns this document's bytes only */ key: "toBytes",
36581
- value: function toBytes() {
36582
- var size = (0, bson_1.getInt32LE)(this.bson, this.offset);
36583
- return this.bson.subarray(this.offset, this.offset + size);
36584
- }
36585
- }
36586
- ]);
36587
- return OnDemandDocument;
36588
- }();
36589
- document$1.OnDemandDocument = OnDemandDocument;
36590
- return document$1;
36289
+ function _class_call_check$A(instance, Constructor) {
36290
+ if (!(instance instanceof Constructor)) {
36291
+ throw new TypeError("Cannot call a class as a function");
36292
+ }
36293
+ }
36294
+ function _defineProperties$x(target, props) {
36295
+ for(var i = 0; i < props.length; i++){
36296
+ var descriptor = props[i];
36297
+ descriptor.enumerable = descriptor.enumerable || false;
36298
+ descriptor.configurable = true;
36299
+ if ("value" in descriptor) descriptor.writable = true;
36300
+ Object.defineProperty(target, descriptor.key, descriptor);
36301
+ }
36302
+ }
36303
+ function _create_class$x(Constructor, protoProps, staticProps) {
36304
+ if (protoProps) _defineProperties$x(Constructor.prototype, protoProps);
36305
+ return Constructor;
36306
+ }
36307
+ function _define_property$f(obj, key, value) {
36308
+ if (key in obj) {
36309
+ Object.defineProperty(obj, key, {
36310
+ value: value,
36311
+ enumerable: true,
36312
+ configurable: true,
36313
+ writable: true
36314
+ });
36315
+ } else {
36316
+ obj[key] = value;
36317
+ }
36318
+ return obj;
36591
36319
  }
36320
+ function _object_spread$e(target) {
36321
+ for(var i = 1; i < arguments.length; i++){
36322
+ var source = arguments[i] != null ? arguments[i] : {};
36323
+ var ownKeys = Object.keys(source);
36324
+ if (typeof Object.getOwnPropertySymbols === "function") {
36325
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
36326
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
36327
+ }));
36328
+ }
36329
+ ownKeys.forEach(function(key) {
36330
+ _define_property$f(target, key, source[key]);
36331
+ });
36332
+ }
36333
+ return target;
36334
+ }
36335
+ function ownKeys$b(object, enumerableOnly) {
36336
+ var keys = Object.keys(object);
36337
+ if (Object.getOwnPropertySymbols) {
36338
+ var symbols = Object.getOwnPropertySymbols(object);
36339
+ keys.push.apply(keys, symbols);
36340
+ }
36341
+ return keys;
36342
+ }
36343
+ function _object_spread_props$b(target, source) {
36344
+ source = source != null ? source : {};
36345
+ if (Object.getOwnPropertyDescriptors) {
36346
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
36347
+ } else {
36348
+ ownKeys$b(Object(source)).forEach(function(key) {
36349
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
36350
+ });
36351
+ }
36352
+ return target;
36353
+ }
36354
+ Object.defineProperty(document$1, "__esModule", {
36355
+ value: true
36356
+ });
36357
+ document$1.OnDemandDocument = void 0;
36358
+ var bson_1$8 = bson$2;
36359
+ /** @internal */ var OnDemandDocument = /*#__PURE__*/ function() {
36360
+ function OnDemandDocument(/** BSON bytes, this document begins at offset */ bson) {
36361
+ var /** The start of the document */ offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, /** If this is an embedded document, indicates if this was a BSON array */ isArray = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, /** If elements was already calculated */ elements = arguments.length > 3 ? arguments[3] : void 0;
36362
+ _class_call_check$A(this, OnDemandDocument);
36363
+ this.bson = bson;
36364
+ this.offset = offset;
36365
+ this.isArray = isArray;
36366
+ /**
36367
+ * Maps JS strings to elements and jsValues for speeding up subsequent lookups.
36368
+ * - If `false` then name does not exist in the BSON document
36369
+ * - If `CachedBSONElement` instance name exists
36370
+ * - If `cache[name].value == null` jsValue has not yet been parsed
36371
+ * - Null/Undefined values do not get cached because they are zero-length values.
36372
+ */ this.cache = Object.create(null);
36373
+ /** Caches the index of elements that have been named */ this.indexFound = Object.create(null);
36374
+ this.elements = elements !== null && elements !== void 0 ? elements : (0, bson_1$8.parseToElementsToArray)(this.bson, offset);
36375
+ }
36376
+ _create_class$x(OnDemandDocument, [
36377
+ {
36378
+ /** Only supports basic latin strings */ key: "isElementName",
36379
+ value: function isElementName(name, element) {
36380
+ var nameLength = element[2 /* BSONElementOffset.nameLength */ ];
36381
+ var nameOffset = element[1 /* BSONElementOffset.nameOffset */ ];
36382
+ if (name.length !== nameLength) return false;
36383
+ var nameEnd = nameOffset + nameLength;
36384
+ for(var byteIndex = nameOffset, charIndex = 0; charIndex < name.length && byteIndex < nameEnd; charIndex++, byteIndex++){
36385
+ if (this.bson[byteIndex] !== name.charCodeAt(charIndex)) return false;
36386
+ }
36387
+ return true;
36388
+ }
36389
+ },
36390
+ {
36391
+ /**
36392
+ * Seeks into the elements array for an element matching the given name.
36393
+ *
36394
+ * @remarks
36395
+ * Caching:
36396
+ * - Caches the existence of a property making subsequent look ups for non-existent properties return immediately
36397
+ * - Caches names mapped to elements to avoid reiterating the array and comparing the name again
36398
+ * - Caches the index at which an element has been found to prevent rechecking against elements already determined to belong to another name
36399
+ *
36400
+ * @param name - a basic latin string name of a BSON element
36401
+ * @returns
36402
+ */ key: "getElement",
36403
+ value: function getElement(name) {
36404
+ var cachedElement = this.cache[name];
36405
+ if (cachedElement === false) return null;
36406
+ if (cachedElement != null) {
36407
+ return cachedElement;
36408
+ }
36409
+ if (typeof name === 'number') {
36410
+ if (this.isArray) {
36411
+ if (name < this.elements.length) {
36412
+ var element = this.elements[name];
36413
+ var cachedElement1 = {
36414
+ element: element,
36415
+ value: undefined
36416
+ };
36417
+ this.cache[name] = cachedElement1;
36418
+ this.indexFound[name] = true;
36419
+ return cachedElement1;
36420
+ } else {
36421
+ return null;
36422
+ }
36423
+ } else {
36424
+ return null;
36425
+ }
36426
+ }
36427
+ for(var index = 0; index < this.elements.length; index++){
36428
+ var element1 = this.elements[index];
36429
+ // skip this element if it has already been associated with a name
36430
+ if (!(index in this.indexFound) && this.isElementName(name, element1)) {
36431
+ var cachedElement2 = {
36432
+ element: element1,
36433
+ value: undefined
36434
+ };
36435
+ this.cache[name] = cachedElement2;
36436
+ this.indexFound[index] = true;
36437
+ return cachedElement2;
36438
+ }
36439
+ }
36440
+ this.cache[name] = false;
36441
+ return null;
36442
+ }
36443
+ },
36444
+ {
36445
+ key: "toJSValue",
36446
+ value: function toJSValue(element, as) {
36447
+ var type = element[0 /* BSONElementOffset.type */ ];
36448
+ var offset = element[3 /* BSONElementOffset.offset */ ];
36449
+ var length = element[4 /* BSONElementOffset.length */ ];
36450
+ if (as !== type) {
36451
+ return null;
36452
+ }
36453
+ switch(as){
36454
+ case bson_1$8.BSONType.null:
36455
+ case bson_1$8.BSONType.undefined:
36456
+ return null;
36457
+ case bson_1$8.BSONType.double:
36458
+ return (0, bson_1$8.getFloat64LE)(this.bson, offset);
36459
+ case bson_1$8.BSONType.int:
36460
+ return (0, bson_1$8.getInt32LE)(this.bson, offset);
36461
+ case bson_1$8.BSONType.long:
36462
+ return (0, bson_1$8.getBigInt64LE)(this.bson, offset);
36463
+ case bson_1$8.BSONType.bool:
36464
+ return Boolean(this.bson[offset]);
36465
+ case bson_1$8.BSONType.objectId:
36466
+ return new bson_1$8.ObjectId(this.bson.subarray(offset, offset + 12));
36467
+ case bson_1$8.BSONType.timestamp:
36468
+ return new bson_1$8.Timestamp((0, bson_1$8.getBigInt64LE)(this.bson, offset));
36469
+ case bson_1$8.BSONType.string:
36470
+ return (0, bson_1$8.toUTF8)(this.bson, offset + 4, offset + length - 1, false);
36471
+ case bson_1$8.BSONType.binData:
36472
+ {
36473
+ var totalBinarySize = (0, bson_1$8.getInt32LE)(this.bson, offset);
36474
+ var subType = this.bson[offset + 4];
36475
+ if (subType === 2) {
36476
+ var subType2BinarySize = (0, bson_1$8.getInt32LE)(this.bson, offset + 1 + 4);
36477
+ if (subType2BinarySize < 0) throw new bson_1$8.BSONError('Negative binary type element size found for subtype 0x02');
36478
+ if (subType2BinarySize > totalBinarySize - 4) throw new bson_1$8.BSONError('Binary type with subtype 0x02 contains too long binary size');
36479
+ if (subType2BinarySize < totalBinarySize - 4) throw new bson_1$8.BSONError('Binary type with subtype 0x02 contains too short binary size');
36480
+ return new bson_1$8.Binary(this.bson.subarray(offset + 1 + 4 + 4, offset + 1 + 4 + 4 + subType2BinarySize), 2);
36481
+ }
36482
+ return new bson_1$8.Binary(this.bson.subarray(offset + 1 + 4, offset + 1 + 4 + totalBinarySize), subType);
36483
+ }
36484
+ case bson_1$8.BSONType.date:
36485
+ // Pretend this is correct.
36486
+ return new Date(Number((0, bson_1$8.getBigInt64LE)(this.bson, offset)));
36487
+ case bson_1$8.BSONType.object:
36488
+ return new OnDemandDocument(this.bson, offset);
36489
+ case bson_1$8.BSONType.array:
36490
+ return new OnDemandDocument(this.bson, offset, true);
36491
+ default:
36492
+ throw new bson_1$8.BSONError("Unsupported BSON type: ".concat(as));
36493
+ }
36494
+ }
36495
+ },
36496
+ {
36497
+ /**
36498
+ * Returns the number of elements in this BSON document
36499
+ */ key: "size",
36500
+ value: function size() {
36501
+ return this.elements.length;
36502
+ }
36503
+ },
36504
+ {
36505
+ /**
36506
+ * Checks for the existence of an element by name.
36507
+ *
36508
+ * @remarks
36509
+ * Uses `getElement` with the expectation that will populate caches such that a `has` call
36510
+ * followed by a `getElement` call will not repeat the cost paid by the first look up.
36511
+ *
36512
+ * @param name - element name
36513
+ */ key: "has",
36514
+ value: function has(name) {
36515
+ var cachedElement = this.cache[name];
36516
+ if (cachedElement === false) return false;
36517
+ if (cachedElement != null) return true;
36518
+ return this.getElement(name) != null;
36519
+ }
36520
+ },
36521
+ {
36522
+ key: "get",
36523
+ value: function get(name, as, required) {
36524
+ var element = this.getElement(name);
36525
+ if (element == null) {
36526
+ if (required === true) {
36527
+ throw new bson_1$8.BSONError('BSON element "'.concat(name, '" is missing'));
36528
+ } else {
36529
+ return null;
36530
+ }
36531
+ }
36532
+ if (element.value == null) {
36533
+ var value = this.toJSValue(element.element, as);
36534
+ if (value == null) {
36535
+ if (required === true) {
36536
+ throw new bson_1$8.BSONError('BSON element "'.concat(name, '" is missing'));
36537
+ } else {
36538
+ return null;
36539
+ }
36540
+ }
36541
+ // It is important to never store null
36542
+ element.value = value;
36543
+ }
36544
+ return element.value;
36545
+ }
36546
+ },
36547
+ {
36548
+ key: "getNumber",
36549
+ value: function getNumber(name, required) {
36550
+ var maybeBool = this.get(name, bson_1$8.BSONType.bool);
36551
+ var bool = maybeBool == null ? null : maybeBool ? 1 : 0;
36552
+ var maybeLong = this.get(name, bson_1$8.BSONType.long);
36553
+ var long = maybeLong == null ? null : Number(maybeLong);
36554
+ var _ref, _ref1;
36555
+ var result = (_ref1 = (_ref = bool !== null && bool !== void 0 ? bool : long) !== null && _ref !== void 0 ? _ref : this.get(name, bson_1$8.BSONType.int)) !== null && _ref1 !== void 0 ? _ref1 : this.get(name, bson_1$8.BSONType.double);
36556
+ if (required === true && result == null) {
36557
+ throw new bson_1$8.BSONError('BSON element "'.concat(name, '" is missing'));
36558
+ }
36559
+ return result;
36560
+ }
36561
+ },
36562
+ {
36563
+ /**
36564
+ * Deserialize this object, DOES NOT cache result so avoid multiple invocations
36565
+ * @param options - BSON deserialization options
36566
+ */ key: "toObject",
36567
+ value: function toObject(options) {
36568
+ return (0, bson_1$8.deserialize)(this.bson, _object_spread_props$b(_object_spread$e({}, options), {
36569
+ index: this.offset,
36570
+ allowObjectSmallerThanBufferSize: true
36571
+ }));
36572
+ }
36573
+ },
36574
+ {
36575
+ /** Returns this document's bytes only */ key: "toBytes",
36576
+ value: function toBytes() {
36577
+ var size = (0, bson_1$8.getInt32LE)(this.bson, this.offset);
36578
+ return this.bson.subarray(this.offset, this.offset + size);
36579
+ }
36580
+ }
36581
+ ]);
36582
+ return OnDemandDocument;
36583
+ }();
36584
+ document$1.OnDemandDocument = OnDemandDocument;
36592
36585
 
36593
36586
  var hasRequiredResponses;
36594
36587
 
@@ -36765,7 +36758,7 @@ function requireResponses () {
36765
36758
  var bson_1 = bson$2;
36766
36759
  var error_1 = error$1;
36767
36760
  var utils_1 = requireUtils$1();
36768
- var document_1 = requireDocument();
36761
+ var document_1 = document$1;
36769
36762
  /**
36770
36763
  * Accepts a BSON payload and checks for na "ok: 0" element.
36771
36764
  * This utility is intended to prevent calling response class constructors