@prisma/migrate 6.18.0-dev.12 → 6.18.0-dev.13
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/bin.js +3 -3
- package/dist/{chunk-IVZSWYCG.js → chunk-H5CDIF7X.js} +31 -55
- package/dist/chunk-OP2BDF75.js +792 -0
- package/dist/commands/MigrateDiff.js +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/setupMSSQL.js +774 -778
- package/dist/utils/setupMongo.js +164 -692
- package/package.json +11 -11
- package/dist/chunk-Y5WDJ6P7.js +0 -263
package/dist/utils/setupMongo.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(setupMongo_exports, {
|
|
|
33
33
|
tearDownMongo: () => tearDownMongo
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(setupMongo_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_OP2BDF75 = require("../chunk-OP2BDF75.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
|
|
316
|
-
return typeof
|
|
315
|
+
const { navigator } = globalThis;
|
|
316
|
+
return typeof navigator === "object" && navigator.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
|
|
6679
|
-
if (hasAtomicOperators(
|
|
6678
|
+
for (const document of doc) {
|
|
6679
|
+
if (hasAtomicOperators(document)) {
|
|
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,
|
|
8659
|
-
const bsonSize = BSON.calculateObjectSize(
|
|
8658
|
+
addToOperationsList(batchType, document) {
|
|
8659
|
+
const bsonSize = BSON.calculateObjectSize(document, {
|
|
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:
|
|
8686
|
+
_id: document._id
|
|
8687
8687
|
});
|
|
8688
8688
|
}
|
|
8689
|
-
if (Array.isArray(
|
|
8689
|
+
if (Array.isArray(document)) {
|
|
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(
|
|
8693
|
+
this.s.currentBatch.operations.push(document);
|
|
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,
|
|
8723
|
-
const bsonSize = BSON.calculateObjectSize(
|
|
8722
|
+
addToOperationsList(batchType, document) {
|
|
8723
|
+
const bsonSize = BSON.calculateObjectSize(document, {
|
|
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(
|
|
8754
|
+
if (Array.isArray(document)) {
|
|
8755
8755
|
throw new error_1.MongoInvalidArgumentError("Operation passed in cannot be an Array");
|
|
8756
8756
|
}
|
|
8757
|
-
this.s.currentBatch.operations.push(
|
|
8757
|
+
this.s.currentBatch.operations.push(document);
|
|
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:
|
|
8764
|
+
_id: document._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((
|
|
10295
|
-
insertOne: { document
|
|
10294
|
+
const bulkWriteOperation = new bulk_write_1.BulkWriteOperation(coll, this.docs.map((document) => ({
|
|
10295
|
+
insertOne: { document }
|
|
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(
|
|
20346
|
+
push(document, buffer) {
|
|
20347
20347
|
this.serializedDocumentsLength += buffer.length;
|
|
20348
|
-
this.documents.push(
|
|
20348
|
+
this.documents.push(document);
|
|
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,
|
|
20412
|
-
const sequencesBuffer = this.extractDocumentSequences(
|
|
20411
|
+
makeSections(buffers, document) {
|
|
20412
|
+
const sequencesBuffer = this.extractDocumentSequences(document);
|
|
20413
20413
|
const payloadTypeBuffer = Buffer.allocUnsafe(1);
|
|
20414
20414
|
payloadTypeBuffer[0] = 0;
|
|
20415
|
-
const documentBuffer = this.serializeBson(
|
|
20415
|
+
const documentBuffer = this.serializeBson(document);
|
|
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(
|
|
20426
|
+
extractDocumentSequences(document) {
|
|
20427
20427
|
const chunks = [];
|
|
20428
|
-
for (const [key, value] of Object.entries(
|
|
20428
|
+
for (const [key, value] of Object.entries(document)) {
|
|
20429
20429
|
if (value instanceof DocumentSequence) {
|
|
20430
20430
|
chunks.push(value.toBin());
|
|
20431
|
-
delete
|
|
20431
|
+
delete document[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(
|
|
20440
|
-
return BSON.serialize(
|
|
20439
|
+
serializeBson(document) {
|
|
20440
|
+
return BSON.serialize(document, {
|
|
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,
|
|
23871
|
-
if (
|
|
23872
|
-
(0, common_1._advanceClusterTime)(session,
|
|
23870
|
+
function updateSessionFromResponse(session, document) {
|
|
23871
|
+
if (document.$clusterTime) {
|
|
23872
|
+
(0, common_1._advanceClusterTime)(session, document.$clusterTime);
|
|
23873
23873
|
}
|
|
23874
|
-
if (
|
|
23875
|
-
session.advanceOperationTime(
|
|
23874
|
+
if (document.operationTime && session && session.supports.causalConsistency) {
|
|
23875
|
+
session.advanceOperationTime(document.operationTime);
|
|
23876
23876
|
}
|
|
23877
|
-
if (
|
|
23878
|
-
session.transaction._recoveryToken =
|
|
23877
|
+
if (document.recoveryToken && session && session.inTransaction()) {
|
|
23878
|
+
session.transaction._recoveryToken = document.recoveryToken;
|
|
23879
23879
|
}
|
|
23880
23880
|
if (session?.snapshotEnabled && session.snapshotTime == null) {
|
|
23881
|
-
const atClusterTime =
|
|
23881
|
+
const atClusterTime = document.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
|
|
24433
|
-
yield
|
|
24432
|
+
const document = (responseType ?? responses_1.MongoDBResponse).make(bson);
|
|
24433
|
+
yield document;
|
|
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
|
|
24454
|
+
let document = void 0;
|
|
24455
24455
|
let object = void 0;
|
|
24456
24456
|
try {
|
|
24457
24457
|
this.throwIfAborted();
|
|
24458
|
-
for await (
|
|
24458
|
+
for await (document of this.sendWire(message, options, responseType)) {
|
|
24459
24459
|
object = void 0;
|
|
24460
24460
|
if (options.session != null) {
|
|
24461
|
-
(0, sessions_1.updateSessionFromResponse)(options.session,
|
|
24461
|
+
(0, sessions_1.updateSessionFromResponse)(options.session, document);
|
|
24462
24462
|
}
|
|
24463
|
-
if (
|
|
24464
|
-
this.clusterTime =
|
|
24465
|
-
this.emit(_Connection.CLUSTER_TIME_RECEIVED,
|
|
24463
|
+
if (document.$clusterTime) {
|
|
24464
|
+
this.clusterTime = document.$clusterTime;
|
|
24465
|
+
this.emit(_Connection.CLUSTER_TIME_RECEIVED, document.$clusterTime);
|
|
24466
24466
|
}
|
|
24467
|
-
if (
|
|
24468
|
-
if (options.timeoutContext?.csotEnabled() &&
|
|
24467
|
+
if (document.ok === 0) {
|
|
24468
|
+
if (options.timeoutContext?.csotEnabled() && document.isMaxTimeExpiredError) {
|
|
24469
24469
|
throw new error_1.MongoOperationTimeoutError("Server reported a timeout error", {
|
|
24470
|
-
cause: new error_1.MongoServerError(object ??=
|
|
24470
|
+
cause: new error_1.MongoServerError(object ??= document.toObject(bsonOptions))
|
|
24471
24471
|
});
|
|
24472
24472
|
}
|
|
24473
|
-
throw new error_1.MongoServerError(object ??=
|
|
24473
|
+
throw new error_1.MongoServerError(object ??= document.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 ??=
|
|
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));
|
|
24477
24477
|
}
|
|
24478
24478
|
if (responseType == null) {
|
|
24479
|
-
yield object ??=
|
|
24479
|
+
yield object ??= document.toObject(bsonOptions);
|
|
24480
24480
|
} else {
|
|
24481
|
-
yield
|
|
24481
|
+
yield document;
|
|
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
|
|
24495
|
+
for await (const document of this.sendCommand(ns, command, options, responseType)) {
|
|
24496
24496
|
if (options.timeoutContext?.csotEnabled()) {
|
|
24497
|
-
if (responses_1.MongoDBResponse.is(
|
|
24498
|
-
if (
|
|
24497
|
+
if (responses_1.MongoDBResponse.is(document)) {
|
|
24498
|
+
if (document.isMaxTimeExpiredError) {
|
|
24499
24499
|
throw new error_1.MongoOperationTimeoutError("Server reported a timeout error", {
|
|
24500
|
-
cause: new error_1.MongoServerError(
|
|
24500
|
+
cause: new error_1.MongoServerError(document.toObject())
|
|
24501
24501
|
});
|
|
24502
24502
|
}
|
|
24503
24503
|
} else {
|
|
24504
|
-
if (Array.isArray(
|
|
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) {
|
|
24505
24505
|
throw new error_1.MongoOperationTimeoutError("Server reported a timeout error", {
|
|
24506
|
-
cause: new error_1.MongoServerError(
|
|
24506
|
+
cause: new error_1.MongoServerError(document)
|
|
24507
24507
|
});
|
|
24508
24508
|
}
|
|
24509
24509
|
}
|
|
24510
24510
|
}
|
|
24511
|
-
return
|
|
24511
|
+
return document;
|
|
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
|
|
27862
|
-
|
|
27863
|
-
return { speculativeAuthenticate:
|
|
27861
|
+
const document = (0, command_builders_1.finishCommandDocument)(token);
|
|
27862
|
+
document.db = credentials.source;
|
|
27863
|
+
return { speculativeAuthenticate: document };
|
|
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
|
|
28224
|
-
|
|
28225
|
-
return { speculativeAuthenticate:
|
|
28223
|
+
const document = (0, command_builders_1.finishCommandDocument)(accessToken);
|
|
28224
|
+
document.db = credentials.source;
|
|
28225
|
+
return { speculativeAuthenticate: document };
|
|
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
|
|
30832
|
+
const document = {
|
|
30833
30833
|
insert: index,
|
|
30834
30834
|
document: model.document
|
|
30835
30835
|
};
|
|
30836
|
-
|
|
30837
|
-
return
|
|
30836
|
+
document.document._id = model.document._id ?? pkFactory.createPk();
|
|
30837
|
+
return document;
|
|
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
|
|
30849
|
+
const document = {
|
|
30850
30850
|
delete: index,
|
|
30851
30851
|
multi,
|
|
30852
30852
|
filter: model.filter
|
|
30853
30853
|
};
|
|
30854
30854
|
if (model.hint) {
|
|
30855
|
-
|
|
30855
|
+
document.hint = model.hint;
|
|
30856
30856
|
}
|
|
30857
30857
|
if (model.collation) {
|
|
30858
|
-
|
|
30858
|
+
document.collation = model.collation;
|
|
30859
30859
|
}
|
|
30860
|
-
return
|
|
30860
|
+
return document;
|
|
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
|
|
30877
|
+
const document = {
|
|
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
|
-
|
|
30884
|
+
document.hint = model.hint;
|
|
30885
30885
|
}
|
|
30886
30886
|
if (model.upsert) {
|
|
30887
|
-
|
|
30887
|
+
document.upsert = model.upsert;
|
|
30888
30888
|
}
|
|
30889
30889
|
if (model.arrayFilters) {
|
|
30890
|
-
|
|
30890
|
+
document.arrayFilters = model.arrayFilters;
|
|
30891
30891
|
}
|
|
30892
30892
|
if (model.collation) {
|
|
30893
|
-
|
|
30893
|
+
document.collation = model.collation;
|
|
30894
30894
|
}
|
|
30895
|
-
return
|
|
30895
|
+
return document;
|
|
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
|
|
30901
|
+
const document = {
|
|
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
|
-
|
|
30908
|
+
document.hint = model.hint;
|
|
30909
30909
|
}
|
|
30910
30910
|
if (model.upsert) {
|
|
30911
|
-
|
|
30911
|
+
document.upsert = model.upsert;
|
|
30912
30912
|
}
|
|
30913
30913
|
if (model.collation) {
|
|
30914
|
-
|
|
30914
|
+
document.collation = model.collation;
|
|
30915
30915
|
}
|
|
30916
|
-
return
|
|
30916
|
+
return document;
|
|
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
|
|
31015
|
-
if (
|
|
31014
|
+
for await (const document of cursor) {
|
|
31015
|
+
if (document.ok === 1) {
|
|
31016
31016
|
if (this.options.verboseResults) {
|
|
31017
|
-
this.processDocument(cursor,
|
|
31017
|
+
this.processDocument(cursor, document);
|
|
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(
|
|
31025
|
-
code:
|
|
31026
|
-
message:
|
|
31024
|
+
error2.writeErrors.set(document.idx + this.currentBatchOffset, {
|
|
31025
|
+
code: document.code,
|
|
31026
|
+
message: document.errmsg
|
|
31027
31027
|
});
|
|
31028
31028
|
error2.partialResult = this.result;
|
|
31029
31029
|
throw error2;
|
|
31030
31030
|
} else {
|
|
31031
|
-
this.writeErrors.set(
|
|
31032
|
-
code:
|
|
31033
|
-
message:
|
|
31031
|
+
this.writeErrors.set(document.idx + this.currentBatchOffset, {
|
|
31032
|
+
code: document.code,
|
|
31033
|
+
message: document.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
|
|
31051
|
-
if (
|
|
31052
|
-
this.processDocument(cursor,
|
|
31050
|
+
for (const document of result.cursor.firstBatch) {
|
|
31051
|
+
if (document.ok === 1) {
|
|
31052
|
+
this.processDocument(cursor, document);
|
|
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,
|
|
31082
|
-
const operation = cursor.operations[
|
|
31081
|
+
processDocument(cursor, document) {
|
|
31082
|
+
const operation = cursor.operations[document.idx];
|
|
31083
31083
|
if ("insert" in operation) {
|
|
31084
|
-
this.result.insertResults?.set(
|
|
31084
|
+
this.result.insertResults?.set(document.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:
|
|
31091
|
-
modifiedCount:
|
|
31090
|
+
matchedCount: document.n,
|
|
31091
|
+
modifiedCount: document.nModified ?? 0,
|
|
31092
31092
|
// Check if the bulk did actually upsert.
|
|
31093
|
-
didUpsert:
|
|
31093
|
+
didUpsert: document.upserted != null
|
|
31094
31094
|
};
|
|
31095
|
-
if (
|
|
31096
|
-
result.upsertedId =
|
|
31095
|
+
if (document.upserted) {
|
|
31096
|
+
result.upsertedId = document.upserted._id;
|
|
31097
31097
|
}
|
|
31098
|
-
this.result.updateResults?.set(
|
|
31098
|
+
this.result.updateResults?.set(document.idx + this.currentBatchOffset, result);
|
|
31099
31099
|
}
|
|
31100
31100
|
if ("delete" in operation) {
|
|
31101
|
-
this.result.deleteResults?.set(
|
|
31102
|
-
deletedCount:
|
|
31101
|
+
this.result.deleteResults?.set(document.idx + this.currentBatchOffset, {
|
|
31102
|
+
deletedCount: document.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(
|
|
31111
|
-
this.result.insertedCount +=
|
|
31112
|
-
this.result.upsertedCount +=
|
|
31113
|
-
this.result.matchedCount +=
|
|
31114
|
-
this.result.modifiedCount +=
|
|
31115
|
-
this.result.deletedCount +=
|
|
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;
|
|
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
|
|
32474
|
-
if (
|
|
32475
|
-
bufferedDocs.push(
|
|
32473
|
+
const document = this.documents?.shift(this.deserializationOptions);
|
|
32474
|
+
if (document != null) {
|
|
32475
|
+
bufferedDocs.push(document);
|
|
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
|
|
32497
|
-
if (
|
|
32496
|
+
const document = await this.next();
|
|
32497
|
+
if (document === null) {
|
|
32498
32498
|
return;
|
|
32499
32499
|
}
|
|
32500
|
-
yield
|
|
32500
|
+
yield document;
|
|
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
|
|
32634
|
-
const result = iterator(
|
|
32633
|
+
for await (const document of this) {
|
|
32634
|
+
const result = iterator(document);
|
|
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
|
|
32656
|
-
array.push(
|
|
32655
|
+
for await (const document of this) {
|
|
32656
|
+
array.push(document);
|
|
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(
|
|
32955
|
+
async transformDocument(document) {
|
|
32956
32956
|
if (this.transform == null)
|
|
32957
|
-
return
|
|
32957
|
+
return document;
|
|
32958
32958
|
try {
|
|
32959
|
-
const transformedDocument = this.transform(
|
|
32959
|
+
const transformedDocument = this.transform(document);
|
|
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(
|
|
33894
|
-
(0, utils_1.maybeAddIdToDocuments)(this.collection,
|
|
33893
|
+
insert(document) {
|
|
33894
|
+
(0, utils_1.maybeAddIdToDocuments)(this.collection, document, {
|
|
33895
33895
|
forceServerObjectId: this.shouldForceServerObjectId()
|
|
33896
33896
|
});
|
|
33897
|
-
return this.addToOperationsList(exports.BatchType.INSERT,
|
|
33897
|
+
return this.addToOperationsList(exports.BatchType.INSERT, document);
|
|
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
|
|
33950
|
+
const document = 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,
|
|
33955
|
-
return this.addToOperationsList(exports.BatchType.INSERT,
|
|
33954
|
+
(0, utils_1.maybeAddIdToDocuments)(this.collection, document, { forceServerObjectId });
|
|
33955
|
+
return this.addToOperationsList(exports.BatchType.INSERT, document);
|
|
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,
|
|
42972
|
+
var ms = (0, import_chunk_OP2BDF75.require_ms)();
|
|
42973
42973
|
var mpath = require_mpath();
|
|
42974
42974
|
var ObjectId2 = require_objectid();
|
|
42975
42975
|
var PopulateOptions = require_populateOptions();
|
|
@@ -55394,534 +55394,6 @@ 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
|
-
});
|
|
55925
55397
|
var require_permissions = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
55926
55398
|
"../../node_modules/.pnpm/mquery@5.0.0/node_modules/mquery/lib/permissions.js"(exports) {
|
|
55927
55399
|
"use strict";
|
|
@@ -56015,7 +55487,7 @@ var require_collection4 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
56015
55487
|
}
|
|
56016
55488
|
}
|
|
56017
55489
|
});
|
|
56018
|
-
var
|
|
55490
|
+
var require_node2 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
56019
55491
|
"../../node_modules/.pnpm/mquery@5.0.0/node_modules/mquery/lib/collection/node.js"(exports, module2) {
|
|
56020
55492
|
"use strict";
|
|
56021
55493
|
var Collection = require_collection4();
|
|
@@ -56113,7 +55585,7 @@ var require_collection5 = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
56113
55585
|
if ("unknown" == env.type) {
|
|
56114
55586
|
throw new Error("Unknown environment");
|
|
56115
55587
|
}
|
|
56116
|
-
module2.exports = env.isNode ?
|
|
55588
|
+
module2.exports = env.isNode ? require_node2() : env.isMongo ? require_collection4() : require_collection4();
|
|
56117
55589
|
}
|
|
56118
55590
|
});
|
|
56119
55591
|
var require_mquery = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
@@ -56122,7 +55594,7 @@ var require_mquery = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
56122
55594
|
var assert = (0, import_chunk_2ESYSVXG.__require)("assert");
|
|
56123
55595
|
var util = (0, import_chunk_2ESYSVXG.__require)("util");
|
|
56124
55596
|
var utils = require_utils5();
|
|
56125
|
-
var debug = require_src()("mquery");
|
|
55597
|
+
var debug = (0, import_chunk_OP2BDF75.require_src)()("mquery");
|
|
56126
55598
|
function Query(criteria, options) {
|
|
56127
55599
|
if (!(this instanceof Query))
|
|
56128
55600
|
return new Query(criteria, options);
|
|
@@ -64848,15 +64320,15 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
64848
64320
|
Model.bulkSave = async function bulkSave(documents, options) {
|
|
64849
64321
|
options = options || {};
|
|
64850
64322
|
if (options.timestamps != null) {
|
|
64851
|
-
for (const
|
|
64852
|
-
|
|
64853
|
-
|
|
64323
|
+
for (const document of documents) {
|
|
64324
|
+
document.$__.saveOptions = document.$__.saveOptions || {};
|
|
64325
|
+
document.$__.saveOptions.timestamps = options.timestamps;
|
|
64854
64326
|
}
|
|
64855
64327
|
} else {
|
|
64856
|
-
for (const
|
|
64857
|
-
if (
|
|
64858
|
-
|
|
64859
|
-
|
|
64328
|
+
for (const document of documents) {
|
|
64329
|
+
if (document.$__.timestamps != null) {
|
|
64330
|
+
document.$__.saveOptions = document.$__.saveOptions || {};
|
|
64331
|
+
document.$__.saveOptions.timestamps = document.$__.timestamps;
|
|
64860
64332
|
}
|
|
64861
64333
|
}
|
|
64862
64334
|
}
|
|
@@ -64881,24 +64353,24 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
64881
64353
|
}
|
|
64882
64354
|
const successfulDocuments = [];
|
|
64883
64355
|
for (let i = 0; i < documents.length; i++) {
|
|
64884
|
-
const
|
|
64356
|
+
const document = documents[i];
|
|
64885
64357
|
const documentError = bulkWriteError && bulkWriteError.writeErrors.find((writeError) => {
|
|
64886
64358
|
const writeErrorDocumentId = writeError.err.op._id || writeError.err.op.q._id;
|
|
64887
|
-
return writeErrorDocumentId.toString() ===
|
|
64359
|
+
return writeErrorDocumentId.toString() === document._doc._id.toString();
|
|
64888
64360
|
});
|
|
64889
64361
|
if (documentError == null) {
|
|
64890
|
-
successfulDocuments.push(
|
|
64362
|
+
successfulDocuments.push(document);
|
|
64891
64363
|
}
|
|
64892
64364
|
}
|
|
64893
|
-
await Promise.all(successfulDocuments.map((
|
|
64365
|
+
await Promise.all(successfulDocuments.map((document) => handleSuccessfulWrite(document)));
|
|
64894
64366
|
if (bulkWriteError != null) {
|
|
64895
64367
|
throw bulkWriteError;
|
|
64896
64368
|
}
|
|
64897
64369
|
return bulkWriteResult;
|
|
64898
64370
|
};
|
|
64899
|
-
function buildPreSavePromise(
|
|
64371
|
+
function buildPreSavePromise(document, options) {
|
|
64900
64372
|
return new Promise((resolve, reject) => {
|
|
64901
|
-
|
|
64373
|
+
document.schema.s.hooks.execPre("save", document, [options], (err) => {
|
|
64902
64374
|
if (err) {
|
|
64903
64375
|
reject(err);
|
|
64904
64376
|
return;
|
|
@@ -64907,13 +64379,13 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
64907
64379
|
});
|
|
64908
64380
|
});
|
|
64909
64381
|
}
|
|
64910
|
-
function handleSuccessfulWrite(
|
|
64382
|
+
function handleSuccessfulWrite(document) {
|
|
64911
64383
|
return new Promise((resolve, reject) => {
|
|
64912
|
-
if (
|
|
64913
|
-
_setIsNew(
|
|
64384
|
+
if (document.$isNew) {
|
|
64385
|
+
_setIsNew(document, false);
|
|
64914
64386
|
}
|
|
64915
|
-
|
|
64916
|
-
|
|
64387
|
+
document.$__reset();
|
|
64388
|
+
document.schema.s.hooks.execPost("save", document, [document], {}, (err) => {
|
|
64917
64389
|
if (err) {
|
|
64918
64390
|
reject(err);
|
|
64919
64391
|
return;
|
|
@@ -65041,39 +64513,39 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
65041
64513
|
throw new Error(`bulkSave expects an array of documents to be passed, received \`${documents}\` instead`);
|
|
65042
64514
|
}
|
|
65043
64515
|
setDefaultOptions();
|
|
65044
|
-
const writeOperations = documents.map((
|
|
64516
|
+
const writeOperations = documents.map((document, i) => {
|
|
65045
64517
|
if (!options.skipValidation) {
|
|
65046
|
-
if (!(
|
|
64518
|
+
if (!(document instanceof Document)) {
|
|
65047
64519
|
throw new Error(`documents.${i} was not a mongoose document, documents must be an array of mongoose documents (instanceof mongoose.Document).`);
|
|
65048
64520
|
}
|
|
65049
64521
|
if (options.validateBeforeSave == null || options.validateBeforeSave) {
|
|
65050
|
-
const err =
|
|
64522
|
+
const err = document.validateSync();
|
|
65051
64523
|
if (err != null) {
|
|
65052
64524
|
throw err;
|
|
65053
64525
|
}
|
|
65054
64526
|
}
|
|
65055
64527
|
}
|
|
65056
|
-
const isANewDocument =
|
|
64528
|
+
const isANewDocument = document.isNew;
|
|
65057
64529
|
if (isANewDocument) {
|
|
65058
|
-
const writeOperation = { insertOne: { document
|
|
64530
|
+
const writeOperation = { insertOne: { document } };
|
|
65059
64531
|
utils.injectTimestampsOption(writeOperation.insertOne, options.timestamps);
|
|
65060
64532
|
return writeOperation;
|
|
65061
64533
|
}
|
|
65062
|
-
const delta =
|
|
64534
|
+
const delta = document.$__delta();
|
|
65063
64535
|
const isDocumentWithChanges = delta != null && !utils.isEmptyObject(delta[0]);
|
|
65064
64536
|
if (isDocumentWithChanges) {
|
|
65065
|
-
const where =
|
|
64537
|
+
const where = document.$__where(delta[0]);
|
|
65066
64538
|
const changes = delta[1];
|
|
65067
|
-
_applyCustomWhere(
|
|
64539
|
+
_applyCustomWhere(document, where);
|
|
65068
64540
|
const shardKey = this.schema.options.shardKey;
|
|
65069
64541
|
if (shardKey) {
|
|
65070
64542
|
const paths = Object.keys(shardKey);
|
|
65071
64543
|
const len = paths.length;
|
|
65072
64544
|
for (let i2 = 0; i2 < len; ++i2) {
|
|
65073
|
-
where[paths[i2]] =
|
|
64545
|
+
where[paths[i2]] = document[paths[i2]];
|
|
65074
64546
|
}
|
|
65075
64547
|
}
|
|
65076
|
-
|
|
64548
|
+
document.$__version(where, delta);
|
|
65077
64549
|
const writeOperation = { updateOne: { filter: where, update: changes } };
|
|
65078
64550
|
utils.injectTimestampsOption(writeOperation.updateOne, options.timestamps);
|
|
65079
64551
|
return writeOperation;
|
|
@@ -65096,9 +64568,9 @@ var require_model = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
65096
64568
|
}
|
|
65097
64569
|
obj = applyProjection(obj, projection);
|
|
65098
64570
|
}
|
|
65099
|
-
const
|
|
65100
|
-
|
|
65101
|
-
return
|
|
64571
|
+
const document = require_queryHelpers().createModel(this, obj, projection);
|
|
64572
|
+
document.$init(obj, options);
|
|
64573
|
+
return document;
|
|
65102
64574
|
};
|
|
65103
64575
|
Model.updateMany = function updateMany(conditions, update, options) {
|
|
65104
64576
|
_checkContext(this, "updateMany");
|