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