@prisma/migrate 6.18.0-dev.11 → 6.18.0-dev.12

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.
@@ -33,7 +33,7 @@ __export(setupMongo_exports, {
33
33
  tearDownMongo: () => tearDownMongo
34
34
  });
35
35
  module.exports = __toCommonJS(setupMongo_exports);
36
- var import_chunk_OP2BDF75 = require("../chunk-OP2BDF75.js");
36
+ var import_chunk_Y5WDJ6P7 = require("../chunk-Y5WDJ6P7.js");
37
37
  var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
38
38
  var import_path = __toESM(require("path"));
39
39
  var require_bson = (0, import_chunk_2ESYSVXG.__commonJS)({
@@ -312,8 +312,8 @@ var require_bson = (0, import_chunk_2ESYSVXG.__commonJS)({
312
312
  }
313
313
  };
314
314
  function isReactNative() {
315
- const { navigator } = globalThis;
316
- return typeof navigator === "object" && navigator.product === "ReactNative";
315
+ const { navigator: navigator2 } = globalThis;
316
+ return typeof navigator2 === "object" && navigator2.product === "ReactNative";
317
317
  }
318
318
  function webMathRandomBytes(byteLength) {
319
319
  if (byteLength < 0) {
@@ -6675,8 +6675,8 @@ var require_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
6675
6675
  }
6676
6676
  function hasAtomicOperators(doc) {
6677
6677
  if (Array.isArray(doc)) {
6678
- for (const document of doc) {
6679
- if (hasAtomicOperators(document)) {
6678
+ for (const document2 of doc) {
6679
+ if (hasAtomicOperators(document2)) {
6680
6680
  return true;
6681
6681
  }
6682
6682
  }
@@ -8655,8 +8655,8 @@ var require_ordered = (0, import_chunk_2ESYSVXG.__commonJS)({
8655
8655
  constructor(collection, options) {
8656
8656
  super(collection, options, true);
8657
8657
  }
8658
- addToOperationsList(batchType, document) {
8659
- const bsonSize = BSON.calculateObjectSize(document, {
8658
+ addToOperationsList(batchType, document2) {
8659
+ const bsonSize = BSON.calculateObjectSize(document2, {
8660
8660
  checkKeys: false,
8661
8661
  // Since we don't know what the user selected for BSON options here,
8662
8662
  // err on the safe side, and check the size with ignoreUndefined: false.
@@ -8683,14 +8683,14 @@ var require_ordered = (0, import_chunk_2ESYSVXG.__commonJS)({
8683
8683
  if (batchType === common_1.BatchType.INSERT) {
8684
8684
  this.s.bulkResult.insertedIds.push({
8685
8685
  index: this.s.currentIndex,
8686
- _id: document._id
8686
+ _id: document2._id
8687
8687
  });
8688
8688
  }
8689
- if (Array.isArray(document)) {
8689
+ if (Array.isArray(document2)) {
8690
8690
  throw new error_1.MongoInvalidArgumentError("Operation passed in cannot be an Array");
8691
8691
  }
8692
8692
  this.s.currentBatch.originalIndexes.push(this.s.currentIndex);
8693
- this.s.currentBatch.operations.push(document);
8693
+ this.s.currentBatch.operations.push(document2);
8694
8694
  this.s.currentBatchSize += 1;
8695
8695
  this.s.currentBatchSizeBytes += maxKeySize + bsonSize;
8696
8696
  this.s.currentIndex += 1;
@@ -8719,8 +8719,8 @@ var require_unordered = (0, import_chunk_2ESYSVXG.__commonJS)({
8719
8719
  }
8720
8720
  return super.handleWriteError(writeResult);
8721
8721
  }
8722
- addToOperationsList(batchType, document) {
8723
- const bsonSize = BSON.calculateObjectSize(document, {
8722
+ addToOperationsList(batchType, document2) {
8723
+ const bsonSize = BSON.calculateObjectSize(document2, {
8724
8724
  checkKeys: false,
8725
8725
  // Since we don't know what the user selected for BSON options here,
8726
8726
  // err on the safe side, and check the size with ignoreUndefined: false.
@@ -8751,17 +8751,17 @@ var require_unordered = (0, import_chunk_2ESYSVXG.__commonJS)({
8751
8751
  this.s.batches.push(this.s.currentBatch);
8752
8752
  this.s.currentBatch = new common_1.Batch(batchType, this.s.currentIndex);
8753
8753
  }
8754
- if (Array.isArray(document)) {
8754
+ if (Array.isArray(document2)) {
8755
8755
  throw new error_1.MongoInvalidArgumentError("Operation passed in cannot be an Array");
8756
8756
  }
8757
- this.s.currentBatch.operations.push(document);
8757
+ this.s.currentBatch.operations.push(document2);
8758
8758
  this.s.currentBatch.originalIndexes.push(this.s.currentIndex);
8759
8759
  this.s.currentIndex = this.s.currentIndex + 1;
8760
8760
  if (batchType === common_1.BatchType.INSERT) {
8761
8761
  this.s.currentInsertBatch = this.s.currentBatch;
8762
8762
  this.s.bulkResult.insertedIds.push({
8763
8763
  index: this.s.bulkResult.insertedIds.length,
8764
- _id: document._id
8764
+ _id: document2._id
8765
8765
  });
8766
8766
  } else if (batchType === common_1.BatchType.UPDATE) {
8767
8767
  this.s.currentUpdateBatch = this.s.currentBatch;
@@ -10291,8 +10291,8 @@ var require_insert = (0, import_chunk_2ESYSVXG.__commonJS)({
10291
10291
  const coll = this.collection;
10292
10292
  const options = { ...this.options, ...this.bsonOptions, readPreference: this.readPreference };
10293
10293
  const writeConcern = write_concern_1.WriteConcern.fromOptions(options);
10294
- const bulkWriteOperation = new bulk_write_1.BulkWriteOperation(coll, this.docs.map((document) => ({
10295
- insertOne: { document }
10294
+ const bulkWriteOperation = new bulk_write_1.BulkWriteOperation(coll, this.docs.map((document2) => ({
10295
+ insertOne: { document: document2 }
10296
10296
  })), options);
10297
10297
  try {
10298
10298
  const res = await bulkWriteOperation.execute(server, session, timeoutContext);
@@ -20343,9 +20343,9 @@ var require_commands = (0, import_chunk_2ESYSVXG.__commonJS)({
20343
20343
  * @param buffer - The serialized document in raw BSON.
20344
20344
  * @returns The new total document sequence length.
20345
20345
  */
20346
- push(document, buffer) {
20346
+ push(document2, buffer) {
20347
20347
  this.serializedDocumentsLength += buffer.length;
20348
- this.documents.push(document);
20348
+ this.documents.push(document2);
20349
20349
  this.chunks.push(buffer);
20350
20350
  this.header?.writeInt32LE(4 + this.field.length + 1 + this.serializedDocumentsLength, 1);
20351
20351
  return this.serializedDocumentsLength + this.header.length;
@@ -20408,11 +20408,11 @@ var require_commands = (0, import_chunk_2ESYSVXG.__commonJS)({
20408
20408
  /**
20409
20409
  * Add the sections to the OP_MSG request's buffers and returns the length.
20410
20410
  */
20411
- makeSections(buffers, document) {
20412
- const sequencesBuffer = this.extractDocumentSequences(document);
20411
+ makeSections(buffers, document2) {
20412
+ const sequencesBuffer = this.extractDocumentSequences(document2);
20413
20413
  const payloadTypeBuffer = Buffer.allocUnsafe(1);
20414
20414
  payloadTypeBuffer[0] = 0;
20415
- const documentBuffer = this.serializeBson(document);
20415
+ const documentBuffer = this.serializeBson(document2);
20416
20416
  buffers.push(payloadTypeBuffer);
20417
20417
  buffers.push(documentBuffer);
20418
20418
  buffers.push(sequencesBuffer);
@@ -20423,12 +20423,12 @@ var require_commands = (0, import_chunk_2ESYSVXG.__commonJS)({
20423
20423
  * a buffer to be added as multiple sections after the initial type 0
20424
20424
  * section in the message.
20425
20425
  */
20426
- extractDocumentSequences(document) {
20426
+ extractDocumentSequences(document2) {
20427
20427
  const chunks = [];
20428
- for (const [key, value] of Object.entries(document)) {
20428
+ for (const [key, value] of Object.entries(document2)) {
20429
20429
  if (value instanceof DocumentSequence) {
20430
20430
  chunks.push(value.toBin());
20431
- delete document[key];
20431
+ delete document2[key];
20432
20432
  }
20433
20433
  }
20434
20434
  if (chunks.length > 0) {
@@ -20436,8 +20436,8 @@ var require_commands = (0, import_chunk_2ESYSVXG.__commonJS)({
20436
20436
  }
20437
20437
  return Buffer.alloc(0);
20438
20438
  }
20439
- serializeBson(document) {
20440
- return BSON.serialize(document, {
20439
+ serializeBson(document2) {
20440
+ return BSON.serialize(document2, {
20441
20441
  checkKeys: this.checkKeys,
20442
20442
  serializeFunctions: this.serializeFunctions,
20443
20443
  ignoreUndefined: this.ignoreUndefined
@@ -23867,18 +23867,18 @@ var require_sessions = (0, import_chunk_2ESYSVXG.__commonJS)({
23867
23867
  }
23868
23868
  return;
23869
23869
  }
23870
- function updateSessionFromResponse(session, document) {
23871
- if (document.$clusterTime) {
23872
- (0, common_1._advanceClusterTime)(session, document.$clusterTime);
23870
+ function updateSessionFromResponse(session, document2) {
23871
+ if (document2.$clusterTime) {
23872
+ (0, common_1._advanceClusterTime)(session, document2.$clusterTime);
23873
23873
  }
23874
- if (document.operationTime && session && session.supports.causalConsistency) {
23875
- session.advanceOperationTime(document.operationTime);
23874
+ if (document2.operationTime && session && session.supports.causalConsistency) {
23875
+ session.advanceOperationTime(document2.operationTime);
23876
23876
  }
23877
- if (document.recoveryToken && session && session.inTransaction()) {
23878
- session.transaction._recoveryToken = document.recoveryToken;
23877
+ if (document2.recoveryToken && session && session.inTransaction()) {
23878
+ session.transaction._recoveryToken = document2.recoveryToken;
23879
23879
  }
23880
23880
  if (session?.snapshotEnabled && session.snapshotTime == null) {
23881
- const atClusterTime = document.atClusterTime;
23881
+ const atClusterTime = document2.atClusterTime;
23882
23882
  if (atClusterTime) {
23883
23883
  session.snapshotTime = atClusterTime;
23884
23884
  }
@@ -24429,8 +24429,8 @@ var require_connection = (0, import_chunk_2ESYSVXG.__commonJS)({
24429
24429
  for await (const response of this.readMany(options)) {
24430
24430
  this.socket.setTimeout(0);
24431
24431
  const bson = response.parse();
24432
- const document = (responseType ?? responses_1.MongoDBResponse).make(bson);
24433
- yield document;
24432
+ const document2 = (responseType ?? responses_1.MongoDBResponse).make(bson);
24433
+ yield document2;
24434
24434
  this.throwIfAborted();
24435
24435
  this.socket.setTimeout(timeout);
24436
24436
  }
@@ -24451,34 +24451,34 @@ var require_connection = (0, import_chunk_2ESYSVXG.__commonJS)({
24451
24451
  raw: false,
24452
24452
  fieldsAsRaw: { [options.documentsReturnedIn]: true }
24453
24453
  };
24454
- let document = void 0;
24454
+ let document2 = void 0;
24455
24455
  let object = void 0;
24456
24456
  try {
24457
24457
  this.throwIfAborted();
24458
- for await (document of this.sendWire(message, options, responseType)) {
24458
+ for await (document2 of this.sendWire(message, options, responseType)) {
24459
24459
  object = void 0;
24460
24460
  if (options.session != null) {
24461
- (0, sessions_1.updateSessionFromResponse)(options.session, document);
24461
+ (0, sessions_1.updateSessionFromResponse)(options.session, document2);
24462
24462
  }
24463
- if (document.$clusterTime) {
24464
- this.clusterTime = document.$clusterTime;
24465
- this.emit(_Connection.CLUSTER_TIME_RECEIVED, document.$clusterTime);
24463
+ if (document2.$clusterTime) {
24464
+ this.clusterTime = document2.$clusterTime;
24465
+ this.emit(_Connection.CLUSTER_TIME_RECEIVED, document2.$clusterTime);
24466
24466
  }
24467
- if (document.ok === 0) {
24468
- if (options.timeoutContext?.csotEnabled() && document.isMaxTimeExpiredError) {
24467
+ if (document2.ok === 0) {
24468
+ if (options.timeoutContext?.csotEnabled() && document2.isMaxTimeExpiredError) {
24469
24469
  throw new error_1.MongoOperationTimeoutError("Server reported a timeout error", {
24470
- cause: new error_1.MongoServerError(object ??= document.toObject(bsonOptions))
24470
+ cause: new error_1.MongoServerError(object ??= document2.toObject(bsonOptions))
24471
24471
  });
24472
24472
  }
24473
- throw new error_1.MongoServerError(object ??= document.toObject(bsonOptions));
24473
+ throw new error_1.MongoServerError(object ??= document2.toObject(bsonOptions));
24474
24474
  }
24475
24475
  if (this.shouldEmitAndLogCommand) {
24476
- this.emitAndLogCommand(this.monitorCommands, _Connection.COMMAND_SUCCEEDED, message.databaseName, this.established, new command_monitoring_events_1.CommandSucceededEvent(this, message, options.noResponse ? void 0 : message.moreToCome ? { ok: 1 } : object ??= document.toObject(bsonOptions), started, this.description.serverConnectionId));
24476
+ this.emitAndLogCommand(this.monitorCommands, _Connection.COMMAND_SUCCEEDED, message.databaseName, this.established, new command_monitoring_events_1.CommandSucceededEvent(this, message, options.noResponse ? void 0 : message.moreToCome ? { ok: 1 } : object ??= document2.toObject(bsonOptions), started, this.description.serverConnectionId));
24477
24477
  }
24478
24478
  if (responseType == null) {
24479
- yield object ??= document.toObject(bsonOptions);
24479
+ yield object ??= document2.toObject(bsonOptions);
24480
24480
  } else {
24481
- yield document;
24481
+ yield document2;
24482
24482
  }
24483
24483
  this.throwIfAborted();
24484
24484
  }
@@ -24492,23 +24492,23 @@ var require_connection = (0, import_chunk_2ESYSVXG.__commonJS)({
24492
24492
  async command(ns, command, options = {}, responseType) {
24493
24493
  this.throwIfAborted();
24494
24494
  options.signal?.throwIfAborted();
24495
- for await (const document of this.sendCommand(ns, command, options, responseType)) {
24495
+ for await (const document2 of this.sendCommand(ns, command, options, responseType)) {
24496
24496
  if (options.timeoutContext?.csotEnabled()) {
24497
- if (responses_1.MongoDBResponse.is(document)) {
24498
- if (document.isMaxTimeExpiredError) {
24497
+ if (responses_1.MongoDBResponse.is(document2)) {
24498
+ if (document2.isMaxTimeExpiredError) {
24499
24499
  throw new error_1.MongoOperationTimeoutError("Server reported a timeout error", {
24500
- cause: new error_1.MongoServerError(document.toObject())
24500
+ cause: new error_1.MongoServerError(document2.toObject())
24501
24501
  });
24502
24502
  }
24503
24503
  } else {
24504
- if (Array.isArray(document?.writeErrors) && document.writeErrors.some((error2) => error2?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired) || document?.writeConcernError?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired) {
24504
+ if (Array.isArray(document2?.writeErrors) && document2.writeErrors.some((error2) => error2?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired) || document2?.writeConcernError?.code === error_1.MONGODB_ERROR_CODES.MaxTimeMSExpired) {
24505
24505
  throw new error_1.MongoOperationTimeoutError("Server reported a timeout error", {
24506
- cause: new error_1.MongoServerError(document)
24506
+ cause: new error_1.MongoServerError(document2)
24507
24507
  });
24508
24508
  }
24509
24509
  }
24510
24510
  }
24511
- return document;
24511
+ return document2;
24512
24512
  }
24513
24513
  throw new error_1.MongoUnexpectedServerResponseError("Unable to get response from server");
24514
24514
  }
@@ -27858,9 +27858,9 @@ var require_machine_workflow = (0, import_chunk_2ESYSVXG.__commonJS)({
27858
27858
  return {};
27859
27859
  }
27860
27860
  const token = await this.getTokenFromCacheOrEnv(connection, credentials);
27861
- const document = (0, command_builders_1.finishCommandDocument)(token);
27862
- document.db = credentials.source;
27863
- return { speculativeAuthenticate: document };
27861
+ const document2 = (0, command_builders_1.finishCommandDocument)(token);
27862
+ document2.db = credentials.source;
27863
+ return { speculativeAuthenticate: document2 };
27864
27864
  }
27865
27865
  /**
27866
27866
  * Get the token from the cache or environment.
@@ -28220,9 +28220,9 @@ var require_callback_workflow = (0, import_chunk_2ESYSVXG.__commonJS)({
28220
28220
  if (this.cache.hasAccessToken) {
28221
28221
  const accessToken = this.cache.getAccessToken();
28222
28222
  connection.accessToken = accessToken;
28223
- const document = (0, command_builders_1.finishCommandDocument)(accessToken);
28224
- document.db = credentials.source;
28225
- return { speculativeAuthenticate: document };
28223
+ const document2 = (0, command_builders_1.finishCommandDocument)(accessToken);
28224
+ document2.db = credentials.source;
28225
+ return { speculativeAuthenticate: document2 };
28226
28226
  }
28227
28227
  return {};
28228
28228
  }
@@ -30829,12 +30829,12 @@ var require_command_builder = (0, import_chunk_2ESYSVXG.__commonJS)({
30829
30829
  }
30830
30830
  }
30831
30831
  var buildInsertOneOperation = (model, index, pkFactory) => {
30832
- const document = {
30832
+ const document2 = {
30833
30833
  insert: index,
30834
30834
  document: model.document
30835
30835
  };
30836
- document.document._id = model.document._id ?? pkFactory.createPk();
30837
- return document;
30836
+ document2.document._id = model.document._id ?? pkFactory.createPk();
30837
+ return document2;
30838
30838
  };
30839
30839
  exports.buildInsertOneOperation = buildInsertOneOperation;
30840
30840
  var buildDeleteOneOperation = (model, index) => {
@@ -30846,18 +30846,18 @@ var require_command_builder = (0, import_chunk_2ESYSVXG.__commonJS)({
30846
30846
  };
30847
30847
  exports.buildDeleteManyOperation = buildDeleteManyOperation;
30848
30848
  function createDeleteOperation(model, index, multi) {
30849
- const document = {
30849
+ const document2 = {
30850
30850
  delete: index,
30851
30851
  multi,
30852
30852
  filter: model.filter
30853
30853
  };
30854
30854
  if (model.hint) {
30855
- document.hint = model.hint;
30855
+ document2.hint = model.hint;
30856
30856
  }
30857
30857
  if (model.collation) {
30858
- document.collation = model.collation;
30858
+ document2.collation = model.collation;
30859
30859
  }
30860
- return document;
30860
+ return document2;
30861
30861
  }
30862
30862
  var buildUpdateOneOperation = (model, index) => {
30863
30863
  return createUpdateOperation(model, index, false);
@@ -30874,46 +30874,46 @@ var require_command_builder = (0, import_chunk_2ESYSVXG.__commonJS)({
30874
30874
  }
30875
30875
  function createUpdateOperation(model, index, multi) {
30876
30876
  validateUpdate(model.update);
30877
- const document = {
30877
+ const document2 = {
30878
30878
  update: index,
30879
30879
  multi,
30880
30880
  filter: model.filter,
30881
30881
  updateMods: model.update
30882
30882
  };
30883
30883
  if (model.hint) {
30884
- document.hint = model.hint;
30884
+ document2.hint = model.hint;
30885
30885
  }
30886
30886
  if (model.upsert) {
30887
- document.upsert = model.upsert;
30887
+ document2.upsert = model.upsert;
30888
30888
  }
30889
30889
  if (model.arrayFilters) {
30890
- document.arrayFilters = model.arrayFilters;
30890
+ document2.arrayFilters = model.arrayFilters;
30891
30891
  }
30892
30892
  if (model.collation) {
30893
- document.collation = model.collation;
30893
+ document2.collation = model.collation;
30894
30894
  }
30895
- return document;
30895
+ return document2;
30896
30896
  }
30897
30897
  var buildReplaceOneOperation = (model, index) => {
30898
30898
  if ((0, utils_1.hasAtomicOperators)(model.replacement)) {
30899
30899
  throw new error_1.MongoAPIError("Client bulk write replace models must not contain atomic modifiers (start with $) and must not be empty.");
30900
30900
  }
30901
- const document = {
30901
+ const document2 = {
30902
30902
  update: index,
30903
30903
  multi: false,
30904
30904
  filter: model.filter,
30905
30905
  updateMods: model.replacement
30906
30906
  };
30907
30907
  if (model.hint) {
30908
- document.hint = model.hint;
30908
+ document2.hint = model.hint;
30909
30909
  }
30910
30910
  if (model.upsert) {
30911
- document.upsert = model.upsert;
30911
+ document2.upsert = model.upsert;
30912
30912
  }
30913
30913
  if (model.collation) {
30914
- document.collation = model.collation;
30914
+ document2.collation = model.collation;
30915
30915
  }
30916
- return document;
30916
+ return document2;
30917
30917
  };
30918
30918
  exports.buildReplaceOneOperation = buildReplaceOneOperation;
30919
30919
  function buildOperation(model, index, pkFactory) {
@@ -31011,26 +31011,26 @@ var require_results_merger = (0, import_chunk_2ESYSVXG.__commonJS)({
31011
31011
  async merge(cursor) {
31012
31012
  let writeConcernErrorResult;
31013
31013
  try {
31014
- for await (const document of cursor) {
31015
- if (document.ok === 1) {
31014
+ for await (const document2 of cursor) {
31015
+ if (document2.ok === 1) {
31016
31016
  if (this.options.verboseResults) {
31017
- this.processDocument(cursor, document);
31017
+ this.processDocument(cursor, document2);
31018
31018
  }
31019
31019
  } else {
31020
31020
  if (this.options.ordered) {
31021
31021
  const error2 = new error_1.MongoClientBulkWriteError({
31022
31022
  message: "Mongo client ordered bulk write encountered a write error."
31023
31023
  });
31024
- error2.writeErrors.set(document.idx + this.currentBatchOffset, {
31025
- code: document.code,
31026
- message: document.errmsg
31024
+ error2.writeErrors.set(document2.idx + this.currentBatchOffset, {
31025
+ code: document2.code,
31026
+ message: document2.errmsg
31027
31027
  });
31028
31028
  error2.partialResult = this.result;
31029
31029
  throw error2;
31030
31030
  } else {
31031
- this.writeErrors.set(document.idx + this.currentBatchOffset, {
31032
- code: document.code,
31033
- message: document.errmsg
31031
+ this.writeErrors.set(document2.idx + this.currentBatchOffset, {
31032
+ code: document2.code,
31033
+ message: document2.errmsg
31034
31034
  });
31035
31035
  }
31036
31036
  }
@@ -31047,9 +31047,9 @@ var require_results_merger = (0, import_chunk_2ESYSVXG.__commonJS)({
31047
31047
  writeConcernError: result.writeConcernError
31048
31048
  };
31049
31049
  if (this.options.verboseResults && result.cursor.firstBatch) {
31050
- for (const document of result.cursor.firstBatch) {
31051
- if (document.ok === 1) {
31052
- this.processDocument(cursor, document);
31050
+ for (const document2 of result.cursor.firstBatch) {
31051
+ if (document2.ok === 1) {
31052
+ this.processDocument(cursor, document2);
31053
31053
  }
31054
31054
  }
31055
31055
  }
@@ -31078,28 +31078,28 @@ var require_results_merger = (0, import_chunk_2ESYSVXG.__commonJS)({
31078
31078
  * @param cursor - The cursor.
31079
31079
  * @param document - The document to process.
31080
31080
  */
31081
- processDocument(cursor, document) {
31082
- const operation = cursor.operations[document.idx];
31081
+ processDocument(cursor, document2) {
31082
+ const operation = cursor.operations[document2.idx];
31083
31083
  if ("insert" in operation) {
31084
- this.result.insertResults?.set(document.idx + this.currentBatchOffset, {
31084
+ this.result.insertResults?.set(document2.idx + this.currentBatchOffset, {
31085
31085
  insertedId: operation.document._id
31086
31086
  });
31087
31087
  }
31088
31088
  if ("update" in operation) {
31089
31089
  const result = {
31090
- matchedCount: document.n,
31091
- modifiedCount: document.nModified ?? 0,
31090
+ matchedCount: document2.n,
31091
+ modifiedCount: document2.nModified ?? 0,
31092
31092
  // Check if the bulk did actually upsert.
31093
- didUpsert: document.upserted != null
31093
+ didUpsert: document2.upserted != null
31094
31094
  };
31095
- if (document.upserted) {
31096
- result.upsertedId = document.upserted._id;
31095
+ if (document2.upserted) {
31096
+ result.upsertedId = document2.upserted._id;
31097
31097
  }
31098
- this.result.updateResults?.set(document.idx + this.currentBatchOffset, result);
31098
+ this.result.updateResults?.set(document2.idx + this.currentBatchOffset, result);
31099
31099
  }
31100
31100
  if ("delete" in operation) {
31101
- this.result.deleteResults?.set(document.idx + this.currentBatchOffset, {
31102
- deletedCount: document.n
31101
+ this.result.deleteResults?.set(document2.idx + this.currentBatchOffset, {
31102
+ deletedCount: document2.n
31103
31103
  });
31104
31104
  }
31105
31105
  }
@@ -31107,12 +31107,12 @@ var require_results_merger = (0, import_chunk_2ESYSVXG.__commonJS)({
31107
31107
  * Increment the result counts.
31108
31108
  * @param document - The document with the results.
31109
31109
  */
31110
- incrementCounts(document) {
31111
- this.result.insertedCount += document.insertedCount;
31112
- this.result.upsertedCount += document.upsertedCount;
31113
- this.result.matchedCount += document.matchedCount;
31114
- this.result.modifiedCount += document.modifiedCount;
31115
- this.result.deletedCount += document.deletedCount;
31110
+ incrementCounts(document2) {
31111
+ this.result.insertedCount += document2.insertedCount;
31112
+ this.result.upsertedCount += document2.upsertedCount;
31113
+ this.result.matchedCount += document2.matchedCount;
31114
+ this.result.modifiedCount += document2.modifiedCount;
31115
+ this.result.deletedCount += document2.deletedCount;
31116
31116
  }
31117
31117
  };
31118
31118
  exports.ClientBulkWriteResultsMerger = ClientBulkWriteResultsMerger;
@@ -32470,9 +32470,9 @@ var require_abstract_cursor = (0, import_chunk_2ESYSVXG.__commonJS)({
32470
32470
  const bufferedDocs = [];
32471
32471
  const documentsToRead = Math.min(number ?? this.documents?.length ?? 0, this.documents?.length ?? 0);
32472
32472
  for (let count = 0; count < documentsToRead; count++) {
32473
- const document = this.documents?.shift(this.deserializationOptions);
32474
- if (document != null) {
32475
- bufferedDocs.push(document);
32473
+ const document2 = this.documents?.shift(this.deserializationOptions);
32474
+ if (document2 != null) {
32475
+ bufferedDocs.push(document2);
32476
32476
  }
32477
32477
  }
32478
32478
  return bufferedDocs;
@@ -32493,11 +32493,11 @@ var require_abstract_cursor = (0, import_chunk_2ESYSVXG.__commonJS)({
32493
32493
  if (this.cursorId != null && this.isDead && (this.documents?.length ?? 0) === 0) {
32494
32494
  return;
32495
32495
  }
32496
- const document = await this.next();
32497
- if (document === null) {
32496
+ const document2 = await this.next();
32497
+ if (document2 === null) {
32498
32498
  return;
32499
32499
  }
32500
- yield document;
32500
+ yield document2;
32501
32501
  this.signal?.throwIfAborted();
32502
32502
  }
32503
32503
  } finally {
@@ -32630,8 +32630,8 @@ var require_abstract_cursor = (0, import_chunk_2ESYSVXG.__commonJS)({
32630
32630
  if (typeof iterator !== "function") {
32631
32631
  throw new error_1.MongoInvalidArgumentError('Argument "iterator" must be a function');
32632
32632
  }
32633
- for await (const document of this) {
32634
- const result = iterator(document);
32633
+ for await (const document2 of this) {
32634
+ const result = iterator(document2);
32635
32635
  if (result === false) {
32636
32636
  break;
32637
32637
  }
@@ -32652,8 +32652,8 @@ var require_abstract_cursor = (0, import_chunk_2ESYSVXG.__commonJS)({
32652
32652
  async toArray() {
32653
32653
  this.signal?.throwIfAborted();
32654
32654
  const array = [];
32655
- for await (const document of this) {
32656
- array.push(document);
32655
+ for await (const document2 of this) {
32656
+ array.push(document2);
32657
32657
  const docs = this.readBufferedDocuments();
32658
32658
  if (this.transform != null) {
32659
32659
  for (const doc of docs) {
@@ -32952,11 +32952,11 @@ var require_abstract_cursor = (0, import_chunk_2ESYSVXG.__commonJS)({
32952
32952
  }
32953
32953
  }
32954
32954
  /** @internal */
32955
- async transformDocument(document) {
32955
+ async transformDocument(document2) {
32956
32956
  if (this.transform == null)
32957
- return document;
32957
+ return document2;
32958
32958
  try {
32959
- const transformedDocument = this.transform(document);
32959
+ const transformedDocument = this.transform(document2);
32960
32960
  if (transformedDocument === null) {
32961
32961
  const TRANSFORM_TO_NULL_ERROR = "Cursor returned a `null` document, but the cursor is not exhausted. Mapping documents to `null` is not supported in the cursor transform.";
32962
32962
  throw new error_1.MongoAPIError(TRANSFORM_TO_NULL_ERROR);
@@ -33890,11 +33890,11 @@ var require_common2 = (0, import_chunk_2ESYSVXG.__commonJS)({
33890
33890
  * await bulkOp.execute();
33891
33891
  * ```
33892
33892
  */
33893
- insert(document) {
33894
- (0, utils_1.maybeAddIdToDocuments)(this.collection, document, {
33893
+ insert(document2) {
33894
+ (0, utils_1.maybeAddIdToDocuments)(this.collection, document2, {
33895
33895
  forceServerObjectId: this.shouldForceServerObjectId()
33896
33896
  });
33897
- return this.addToOperationsList(exports.BatchType.INSERT, document);
33897
+ return this.addToOperationsList(exports.BatchType.INSERT, document2);
33898
33898
  }
33899
33899
  /**
33900
33900
  * Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.
@@ -33947,12 +33947,12 @@ var require_common2 = (0, import_chunk_2ESYSVXG.__commonJS)({
33947
33947
  }
33948
33948
  if ("insertOne" in op) {
33949
33949
  const forceServerObjectId = this.shouldForceServerObjectId();
33950
- const document = op.insertOne && op.insertOne.document == null ? (
33950
+ const document2 = op.insertOne && op.insertOne.document == null ? (
33951
33951
  // TODO(NODE-6003): remove support for omitting the `documents` subdocument in bulk inserts
33952
33952
  op.insertOne
33953
33953
  ) : op.insertOne.document;
33954
- (0, utils_1.maybeAddIdToDocuments)(this.collection, document, { forceServerObjectId });
33955
- return this.addToOperationsList(exports.BatchType.INSERT, document);
33954
+ (0, utils_1.maybeAddIdToDocuments)(this.collection, document2, { forceServerObjectId });
33955
+ return this.addToOperationsList(exports.BatchType.INSERT, document2);
33956
33956
  }
33957
33957
  if ("replaceOne" in op || "updateOne" in op || "updateMany" in op) {
33958
33958
  if ("replaceOne" in op) {
@@ -42969,7 +42969,7 @@ var require_utils4 = (0, import_chunk_2ESYSVXG.__commonJS)({
42969
42969
  "../../node_modules/.pnpm/mongoose@8.15.0_socks@2.7.1/node_modules/mongoose/lib/utils.js"(exports) {
42970
42970
  "use strict";
42971
42971
  var UUID = require_bson().UUID;
42972
- var ms = (0, import_chunk_OP2BDF75.require_ms)();
42972
+ var ms = (0, import_chunk_Y5WDJ6P7.require_ms)();
42973
42973
  var mpath = require_mpath();
42974
42974
  var ObjectId2 = require_objectid();
42975
42975
  var PopulateOptions = require_populateOptions();
@@ -55394,6 +55394,534 @@ var require_utils5 = (0, import_chunk_2ESYSVXG.__commonJS)({
55394
55394
  };
55395
55395
  }
55396
55396
  });
55397
+ var require_common4 = (0, import_chunk_2ESYSVXG.__commonJS)({
55398
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports, module2) {
55399
+ "use strict";
55400
+ function setup(env) {
55401
+ createDebug.debug = createDebug;
55402
+ createDebug.default = createDebug;
55403
+ createDebug.coerce = coerce;
55404
+ createDebug.disable = disable;
55405
+ createDebug.enable = enable;
55406
+ createDebug.enabled = enabled;
55407
+ createDebug.humanize = (0, import_chunk_Y5WDJ6P7.require_ms)();
55408
+ createDebug.destroy = destroy;
55409
+ Object.keys(env).forEach((key) => {
55410
+ createDebug[key] = env[key];
55411
+ });
55412
+ createDebug.names = [];
55413
+ createDebug.skips = [];
55414
+ createDebug.formatters = {};
55415
+ function selectColor(namespace) {
55416
+ let hash = 0;
55417
+ for (let i = 0; i < namespace.length; i++) {
55418
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
55419
+ hash |= 0;
55420
+ }
55421
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
55422
+ }
55423
+ createDebug.selectColor = selectColor;
55424
+ function createDebug(namespace) {
55425
+ let prevTime;
55426
+ let enableOverride = null;
55427
+ let namespacesCache;
55428
+ let enabledCache;
55429
+ function debug(...args) {
55430
+ if (!debug.enabled) {
55431
+ return;
55432
+ }
55433
+ const self = debug;
55434
+ const curr = Number(/* @__PURE__ */ new Date());
55435
+ const ms = curr - (prevTime || curr);
55436
+ self.diff = ms;
55437
+ self.prev = prevTime;
55438
+ self.curr = curr;
55439
+ prevTime = curr;
55440
+ args[0] = createDebug.coerce(args[0]);
55441
+ if (typeof args[0] !== "string") {
55442
+ args.unshift("%O");
55443
+ }
55444
+ let index = 0;
55445
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
55446
+ if (match === "%%") {
55447
+ return "%";
55448
+ }
55449
+ index++;
55450
+ const formatter = createDebug.formatters[format];
55451
+ if (typeof formatter === "function") {
55452
+ const val = args[index];
55453
+ match = formatter.call(self, val);
55454
+ args.splice(index, 1);
55455
+ index--;
55456
+ }
55457
+ return match;
55458
+ });
55459
+ createDebug.formatArgs.call(self, args);
55460
+ const logFn = self.log || createDebug.log;
55461
+ logFn.apply(self, args);
55462
+ }
55463
+ debug.namespace = namespace;
55464
+ debug.useColors = createDebug.useColors();
55465
+ debug.color = createDebug.selectColor(namespace);
55466
+ debug.extend = extend;
55467
+ debug.destroy = createDebug.destroy;
55468
+ Object.defineProperty(debug, "enabled", {
55469
+ enumerable: true,
55470
+ configurable: false,
55471
+ get: () => {
55472
+ if (enableOverride !== null) {
55473
+ return enableOverride;
55474
+ }
55475
+ if (namespacesCache !== createDebug.namespaces) {
55476
+ namespacesCache = createDebug.namespaces;
55477
+ enabledCache = createDebug.enabled(namespace);
55478
+ }
55479
+ return enabledCache;
55480
+ },
55481
+ set: (v) => {
55482
+ enableOverride = v;
55483
+ }
55484
+ });
55485
+ if (typeof createDebug.init === "function") {
55486
+ createDebug.init(debug);
55487
+ }
55488
+ return debug;
55489
+ }
55490
+ function extend(namespace, delimiter2) {
55491
+ const newDebug = createDebug(this.namespace + (typeof delimiter2 === "undefined" ? ":" : delimiter2) + namespace);
55492
+ newDebug.log = this.log;
55493
+ return newDebug;
55494
+ }
55495
+ function enable(namespaces) {
55496
+ createDebug.save(namespaces);
55497
+ createDebug.namespaces = namespaces;
55498
+ createDebug.names = [];
55499
+ createDebug.skips = [];
55500
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
55501
+ for (const ns of split) {
55502
+ if (ns[0] === "-") {
55503
+ createDebug.skips.push(ns.slice(1));
55504
+ } else {
55505
+ createDebug.names.push(ns);
55506
+ }
55507
+ }
55508
+ }
55509
+ function matchesTemplate(search, template) {
55510
+ let searchIndex = 0;
55511
+ let templateIndex = 0;
55512
+ let starIndex = -1;
55513
+ let matchIndex = 0;
55514
+ while (searchIndex < search.length) {
55515
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
55516
+ if (template[templateIndex] === "*") {
55517
+ starIndex = templateIndex;
55518
+ matchIndex = searchIndex;
55519
+ templateIndex++;
55520
+ } else {
55521
+ searchIndex++;
55522
+ templateIndex++;
55523
+ }
55524
+ } else if (starIndex !== -1) {
55525
+ templateIndex = starIndex + 1;
55526
+ matchIndex++;
55527
+ searchIndex = matchIndex;
55528
+ } else {
55529
+ return false;
55530
+ }
55531
+ }
55532
+ while (templateIndex < template.length && template[templateIndex] === "*") {
55533
+ templateIndex++;
55534
+ }
55535
+ return templateIndex === template.length;
55536
+ }
55537
+ function disable() {
55538
+ const namespaces = [
55539
+ ...createDebug.names,
55540
+ ...createDebug.skips.map((namespace) => "-" + namespace)
55541
+ ].join(",");
55542
+ createDebug.enable("");
55543
+ return namespaces;
55544
+ }
55545
+ function enabled(name) {
55546
+ for (const skip of createDebug.skips) {
55547
+ if (matchesTemplate(name, skip)) {
55548
+ return false;
55549
+ }
55550
+ }
55551
+ for (const ns of createDebug.names) {
55552
+ if (matchesTemplate(name, ns)) {
55553
+ return true;
55554
+ }
55555
+ }
55556
+ return false;
55557
+ }
55558
+ function coerce(val) {
55559
+ if (val instanceof Error) {
55560
+ return val.stack || val.message;
55561
+ }
55562
+ return val;
55563
+ }
55564
+ function destroy() {
55565
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
55566
+ }
55567
+ createDebug.enable(createDebug.load());
55568
+ return createDebug;
55569
+ }
55570
+ module2.exports = setup;
55571
+ }
55572
+ });
55573
+ var require_browser = (0, import_chunk_2ESYSVXG.__commonJS)({
55574
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports, module2) {
55575
+ "use strict";
55576
+ exports.formatArgs = formatArgs;
55577
+ exports.save = save;
55578
+ exports.load = load;
55579
+ exports.useColors = useColors;
55580
+ exports.storage = localstorage();
55581
+ exports.destroy = /* @__PURE__ */ (() => {
55582
+ let warned = false;
55583
+ return () => {
55584
+ if (!warned) {
55585
+ warned = true;
55586
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
55587
+ }
55588
+ };
55589
+ })();
55590
+ exports.colors = [
55591
+ "#0000CC",
55592
+ "#0000FF",
55593
+ "#0033CC",
55594
+ "#0033FF",
55595
+ "#0066CC",
55596
+ "#0066FF",
55597
+ "#0099CC",
55598
+ "#0099FF",
55599
+ "#00CC00",
55600
+ "#00CC33",
55601
+ "#00CC66",
55602
+ "#00CC99",
55603
+ "#00CCCC",
55604
+ "#00CCFF",
55605
+ "#3300CC",
55606
+ "#3300FF",
55607
+ "#3333CC",
55608
+ "#3333FF",
55609
+ "#3366CC",
55610
+ "#3366FF",
55611
+ "#3399CC",
55612
+ "#3399FF",
55613
+ "#33CC00",
55614
+ "#33CC33",
55615
+ "#33CC66",
55616
+ "#33CC99",
55617
+ "#33CCCC",
55618
+ "#33CCFF",
55619
+ "#6600CC",
55620
+ "#6600FF",
55621
+ "#6633CC",
55622
+ "#6633FF",
55623
+ "#66CC00",
55624
+ "#66CC33",
55625
+ "#9900CC",
55626
+ "#9900FF",
55627
+ "#9933CC",
55628
+ "#9933FF",
55629
+ "#99CC00",
55630
+ "#99CC33",
55631
+ "#CC0000",
55632
+ "#CC0033",
55633
+ "#CC0066",
55634
+ "#CC0099",
55635
+ "#CC00CC",
55636
+ "#CC00FF",
55637
+ "#CC3300",
55638
+ "#CC3333",
55639
+ "#CC3366",
55640
+ "#CC3399",
55641
+ "#CC33CC",
55642
+ "#CC33FF",
55643
+ "#CC6600",
55644
+ "#CC6633",
55645
+ "#CC9900",
55646
+ "#CC9933",
55647
+ "#CCCC00",
55648
+ "#CCCC33",
55649
+ "#FF0000",
55650
+ "#FF0033",
55651
+ "#FF0066",
55652
+ "#FF0099",
55653
+ "#FF00CC",
55654
+ "#FF00FF",
55655
+ "#FF3300",
55656
+ "#FF3333",
55657
+ "#FF3366",
55658
+ "#FF3399",
55659
+ "#FF33CC",
55660
+ "#FF33FF",
55661
+ "#FF6600",
55662
+ "#FF6633",
55663
+ "#FF9900",
55664
+ "#FF9933",
55665
+ "#FFCC00",
55666
+ "#FFCC33"
55667
+ ];
55668
+ function useColors() {
55669
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
55670
+ return true;
55671
+ }
55672
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
55673
+ return false;
55674
+ }
55675
+ let m;
55676
+ return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
55677
+ typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
55678
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
55679
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
55680
+ typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
55681
+ }
55682
+ function formatArgs(args) {
55683
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
55684
+ if (!this.useColors) {
55685
+ return;
55686
+ }
55687
+ const c = "color: " + this.color;
55688
+ args.splice(1, 0, c, "color: inherit");
55689
+ let index = 0;
55690
+ let lastC = 0;
55691
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
55692
+ if (match === "%%") {
55693
+ return;
55694
+ }
55695
+ index++;
55696
+ if (match === "%c") {
55697
+ lastC = index;
55698
+ }
55699
+ });
55700
+ args.splice(lastC, 0, c);
55701
+ }
55702
+ exports.log = console.debug || console.log || (() => {
55703
+ });
55704
+ function save(namespaces) {
55705
+ try {
55706
+ if (namespaces) {
55707
+ exports.storage.setItem("debug", namespaces);
55708
+ } else {
55709
+ exports.storage.removeItem("debug");
55710
+ }
55711
+ } catch (error2) {
55712
+ }
55713
+ }
55714
+ function load() {
55715
+ let r;
55716
+ try {
55717
+ r = exports.storage.getItem("debug");
55718
+ } catch (error2) {
55719
+ }
55720
+ if (!r && typeof process !== "undefined" && "env" in process) {
55721
+ r = process.env.DEBUG;
55722
+ }
55723
+ return r;
55724
+ }
55725
+ function localstorage() {
55726
+ try {
55727
+ return localStorage;
55728
+ } catch (error2) {
55729
+ }
55730
+ }
55731
+ module2.exports = require_common4()(exports);
55732
+ var { formatters } = module2.exports;
55733
+ formatters.j = function(v) {
55734
+ try {
55735
+ return JSON.stringify(v);
55736
+ } catch (error2) {
55737
+ return "[UnexpectedJSONParseError]: " + error2.message;
55738
+ }
55739
+ };
55740
+ }
55741
+ });
55742
+ var require_node2 = (0, import_chunk_2ESYSVXG.__commonJS)({
55743
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports, module2) {
55744
+ "use strict";
55745
+ var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
55746
+ var util = (0, import_chunk_2ESYSVXG.__require)("util");
55747
+ exports.init = init;
55748
+ exports.log = log;
55749
+ exports.formatArgs = formatArgs;
55750
+ exports.save = save;
55751
+ exports.load = load;
55752
+ exports.useColors = useColors;
55753
+ exports.destroy = util.deprecate(
55754
+ () => {
55755
+ },
55756
+ "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
55757
+ );
55758
+ exports.colors = [6, 2, 3, 4, 5, 1];
55759
+ try {
55760
+ const supportsColor = (0, import_chunk_Y5WDJ6P7.require_supports_color)();
55761
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
55762
+ exports.colors = [
55763
+ 20,
55764
+ 21,
55765
+ 26,
55766
+ 27,
55767
+ 32,
55768
+ 33,
55769
+ 38,
55770
+ 39,
55771
+ 40,
55772
+ 41,
55773
+ 42,
55774
+ 43,
55775
+ 44,
55776
+ 45,
55777
+ 56,
55778
+ 57,
55779
+ 62,
55780
+ 63,
55781
+ 68,
55782
+ 69,
55783
+ 74,
55784
+ 75,
55785
+ 76,
55786
+ 77,
55787
+ 78,
55788
+ 79,
55789
+ 80,
55790
+ 81,
55791
+ 92,
55792
+ 93,
55793
+ 98,
55794
+ 99,
55795
+ 112,
55796
+ 113,
55797
+ 128,
55798
+ 129,
55799
+ 134,
55800
+ 135,
55801
+ 148,
55802
+ 149,
55803
+ 160,
55804
+ 161,
55805
+ 162,
55806
+ 163,
55807
+ 164,
55808
+ 165,
55809
+ 166,
55810
+ 167,
55811
+ 168,
55812
+ 169,
55813
+ 170,
55814
+ 171,
55815
+ 172,
55816
+ 173,
55817
+ 178,
55818
+ 179,
55819
+ 184,
55820
+ 185,
55821
+ 196,
55822
+ 197,
55823
+ 198,
55824
+ 199,
55825
+ 200,
55826
+ 201,
55827
+ 202,
55828
+ 203,
55829
+ 204,
55830
+ 205,
55831
+ 206,
55832
+ 207,
55833
+ 208,
55834
+ 209,
55835
+ 214,
55836
+ 215,
55837
+ 220,
55838
+ 221
55839
+ ];
55840
+ }
55841
+ } catch (error2) {
55842
+ }
55843
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
55844
+ return /^debug_/i.test(key);
55845
+ }).reduce((obj, key) => {
55846
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
55847
+ return k.toUpperCase();
55848
+ });
55849
+ let val = process.env[key];
55850
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
55851
+ val = true;
55852
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
55853
+ val = false;
55854
+ } else if (val === "null") {
55855
+ val = null;
55856
+ } else {
55857
+ val = Number(val);
55858
+ }
55859
+ obj[prop] = val;
55860
+ return obj;
55861
+ }, {});
55862
+ function useColors() {
55863
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
55864
+ }
55865
+ function formatArgs(args) {
55866
+ const { namespace: name, useColors: useColors2 } = this;
55867
+ if (useColors2) {
55868
+ const c = this.color;
55869
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
55870
+ const prefix = ` ${colorCode};1m${name} \x1B[0m`;
55871
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
55872
+ args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
55873
+ } else {
55874
+ args[0] = getDate() + name + " " + args[0];
55875
+ }
55876
+ }
55877
+ function getDate() {
55878
+ if (exports.inspectOpts.hideDate) {
55879
+ return "";
55880
+ }
55881
+ return (/* @__PURE__ */ new Date()).toISOString() + " ";
55882
+ }
55883
+ function log(...args) {
55884
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
55885
+ }
55886
+ function save(namespaces) {
55887
+ if (namespaces) {
55888
+ process.env.DEBUG = namespaces;
55889
+ } else {
55890
+ delete process.env.DEBUG;
55891
+ }
55892
+ }
55893
+ function load() {
55894
+ return process.env.DEBUG;
55895
+ }
55896
+ function init(debug) {
55897
+ debug.inspectOpts = {};
55898
+ const keys = Object.keys(exports.inspectOpts);
55899
+ for (let i = 0; i < keys.length; i++) {
55900
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
55901
+ }
55902
+ }
55903
+ module2.exports = require_common4()(exports);
55904
+ var { formatters } = module2.exports;
55905
+ formatters.o = function(v) {
55906
+ this.inspectOpts.colors = this.useColors;
55907
+ return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
55908
+ };
55909
+ formatters.O = function(v) {
55910
+ this.inspectOpts.colors = this.useColors;
55911
+ return util.inspect(v, this.inspectOpts);
55912
+ };
55913
+ }
55914
+ });
55915
+ var require_src = (0, import_chunk_2ESYSVXG.__commonJS)({
55916
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports, module2) {
55917
+ "use strict";
55918
+ if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
55919
+ module2.exports = require_browser();
55920
+ } else {
55921
+ module2.exports = require_node2();
55922
+ }
55923
+ }
55924
+ });
55397
55925
  var require_permissions = (0, import_chunk_2ESYSVXG.__commonJS)({
55398
55926
  "../../node_modules/.pnpm/mquery@5.0.0/node_modules/mquery/lib/permissions.js"(exports) {
55399
55927
  "use strict";
@@ -55487,7 +56015,7 @@ var require_collection4 = (0, import_chunk_2ESYSVXG.__commonJS)({
55487
56015
  }
55488
56016
  }
55489
56017
  });
55490
- var require_node2 = (0, import_chunk_2ESYSVXG.__commonJS)({
56018
+ var require_node3 = (0, import_chunk_2ESYSVXG.__commonJS)({
55491
56019
  "../../node_modules/.pnpm/mquery@5.0.0/node_modules/mquery/lib/collection/node.js"(exports, module2) {
55492
56020
  "use strict";
55493
56021
  var Collection = require_collection4();
@@ -55585,7 +56113,7 @@ var require_collection5 = (0, import_chunk_2ESYSVXG.__commonJS)({
55585
56113
  if ("unknown" == env.type) {
55586
56114
  throw new Error("Unknown environment");
55587
56115
  }
55588
- module2.exports = env.isNode ? require_node2() : env.isMongo ? require_collection4() : require_collection4();
56116
+ module2.exports = env.isNode ? require_node3() : env.isMongo ? require_collection4() : require_collection4();
55589
56117
  }
55590
56118
  });
55591
56119
  var require_mquery = (0, import_chunk_2ESYSVXG.__commonJS)({
@@ -55594,7 +56122,7 @@ var require_mquery = (0, import_chunk_2ESYSVXG.__commonJS)({
55594
56122
  var assert = (0, import_chunk_2ESYSVXG.__require)("assert");
55595
56123
  var util = (0, import_chunk_2ESYSVXG.__require)("util");
55596
56124
  var utils = require_utils5();
55597
- var debug = (0, import_chunk_OP2BDF75.require_src)()("mquery");
56125
+ var debug = require_src()("mquery");
55598
56126
  function Query(criteria, options) {
55599
56127
  if (!(this instanceof Query))
55600
56128
  return new Query(criteria, options);
@@ -64320,15 +64848,15 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
64320
64848
  Model.bulkSave = async function bulkSave(documents, options) {
64321
64849
  options = options || {};
64322
64850
  if (options.timestamps != null) {
64323
- for (const document of documents) {
64324
- document.$__.saveOptions = document.$__.saveOptions || {};
64325
- document.$__.saveOptions.timestamps = options.timestamps;
64851
+ for (const document2 of documents) {
64852
+ document2.$__.saveOptions = document2.$__.saveOptions || {};
64853
+ document2.$__.saveOptions.timestamps = options.timestamps;
64326
64854
  }
64327
64855
  } else {
64328
- for (const document of documents) {
64329
- if (document.$__.timestamps != null) {
64330
- document.$__.saveOptions = document.$__.saveOptions || {};
64331
- document.$__.saveOptions.timestamps = document.$__.timestamps;
64856
+ for (const document2 of documents) {
64857
+ if (document2.$__.timestamps != null) {
64858
+ document2.$__.saveOptions = document2.$__.saveOptions || {};
64859
+ document2.$__.saveOptions.timestamps = document2.$__.timestamps;
64332
64860
  }
64333
64861
  }
64334
64862
  }
@@ -64353,24 +64881,24 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
64353
64881
  }
64354
64882
  const successfulDocuments = [];
64355
64883
  for (let i = 0; i < documents.length; i++) {
64356
- const document = documents[i];
64884
+ const document2 = documents[i];
64357
64885
  const documentError = bulkWriteError && bulkWriteError.writeErrors.find((writeError) => {
64358
64886
  const writeErrorDocumentId = writeError.err.op._id || writeError.err.op.q._id;
64359
- return writeErrorDocumentId.toString() === document._doc._id.toString();
64887
+ return writeErrorDocumentId.toString() === document2._doc._id.toString();
64360
64888
  });
64361
64889
  if (documentError == null) {
64362
- successfulDocuments.push(document);
64890
+ successfulDocuments.push(document2);
64363
64891
  }
64364
64892
  }
64365
- await Promise.all(successfulDocuments.map((document) => handleSuccessfulWrite(document)));
64893
+ await Promise.all(successfulDocuments.map((document2) => handleSuccessfulWrite(document2)));
64366
64894
  if (bulkWriteError != null) {
64367
64895
  throw bulkWriteError;
64368
64896
  }
64369
64897
  return bulkWriteResult;
64370
64898
  };
64371
- function buildPreSavePromise(document, options) {
64899
+ function buildPreSavePromise(document2, options) {
64372
64900
  return new Promise((resolve, reject) => {
64373
- document.schema.s.hooks.execPre("save", document, [options], (err) => {
64901
+ document2.schema.s.hooks.execPre("save", document2, [options], (err) => {
64374
64902
  if (err) {
64375
64903
  reject(err);
64376
64904
  return;
@@ -64379,13 +64907,13 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
64379
64907
  });
64380
64908
  });
64381
64909
  }
64382
- function handleSuccessfulWrite(document) {
64910
+ function handleSuccessfulWrite(document2) {
64383
64911
  return new Promise((resolve, reject) => {
64384
- if (document.$isNew) {
64385
- _setIsNew(document, false);
64912
+ if (document2.$isNew) {
64913
+ _setIsNew(document2, false);
64386
64914
  }
64387
- document.$__reset();
64388
- document.schema.s.hooks.execPost("save", document, [document], {}, (err) => {
64915
+ document2.$__reset();
64916
+ document2.schema.s.hooks.execPost("save", document2, [document2], {}, (err) => {
64389
64917
  if (err) {
64390
64918
  reject(err);
64391
64919
  return;
@@ -64513,39 +65041,39 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
64513
65041
  throw new Error(`bulkSave expects an array of documents to be passed, received \`${documents}\` instead`);
64514
65042
  }
64515
65043
  setDefaultOptions();
64516
- const writeOperations = documents.map((document, i) => {
65044
+ const writeOperations = documents.map((document2, i) => {
64517
65045
  if (!options.skipValidation) {
64518
- if (!(document instanceof Document)) {
65046
+ if (!(document2 instanceof Document)) {
64519
65047
  throw new Error(`documents.${i} was not a mongoose document, documents must be an array of mongoose documents (instanceof mongoose.Document).`);
64520
65048
  }
64521
65049
  if (options.validateBeforeSave == null || options.validateBeforeSave) {
64522
- const err = document.validateSync();
65050
+ const err = document2.validateSync();
64523
65051
  if (err != null) {
64524
65052
  throw err;
64525
65053
  }
64526
65054
  }
64527
65055
  }
64528
- const isANewDocument = document.isNew;
65056
+ const isANewDocument = document2.isNew;
64529
65057
  if (isANewDocument) {
64530
- const writeOperation = { insertOne: { document } };
65058
+ const writeOperation = { insertOne: { document: document2 } };
64531
65059
  utils.injectTimestampsOption(writeOperation.insertOne, options.timestamps);
64532
65060
  return writeOperation;
64533
65061
  }
64534
- const delta = document.$__delta();
65062
+ const delta = document2.$__delta();
64535
65063
  const isDocumentWithChanges = delta != null && !utils.isEmptyObject(delta[0]);
64536
65064
  if (isDocumentWithChanges) {
64537
- const where = document.$__where(delta[0]);
65065
+ const where = document2.$__where(delta[0]);
64538
65066
  const changes = delta[1];
64539
- _applyCustomWhere(document, where);
65067
+ _applyCustomWhere(document2, where);
64540
65068
  const shardKey = this.schema.options.shardKey;
64541
65069
  if (shardKey) {
64542
65070
  const paths = Object.keys(shardKey);
64543
65071
  const len = paths.length;
64544
65072
  for (let i2 = 0; i2 < len; ++i2) {
64545
- where[paths[i2]] = document[paths[i2]];
65073
+ where[paths[i2]] = document2[paths[i2]];
64546
65074
  }
64547
65075
  }
64548
- document.$__version(where, delta);
65076
+ document2.$__version(where, delta);
64549
65077
  const writeOperation = { updateOne: { filter: where, update: changes } };
64550
65078
  utils.injectTimestampsOption(writeOperation.updateOne, options.timestamps);
64551
65079
  return writeOperation;
@@ -64568,9 +65096,9 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
64568
65096
  }
64569
65097
  obj = applyProjection(obj, projection);
64570
65098
  }
64571
- const document = require_queryHelpers().createModel(this, obj, projection);
64572
- document.$init(obj, options);
64573
- return document;
65099
+ const document2 = require_queryHelpers().createModel(this, obj, projection);
65100
+ document2.$init(obj, options);
65101
+ return document2;
64574
65102
  };
64575
65103
  Model.updateMany = function updateMany(conditions, update, options) {
64576
65104
  _checkContext(this, "updateMany");