Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cypress-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-mongodb - npm Package Compare versions

Comparing version 6.1.0 to 6.2.0

0

dist/commands/aggregation.d.ts

@@ -0,0 +0,0 @@ /// <reference types="node" />

2

dist/commands/aggregation.js

@@ -21,3 +21,3 @@ "use strict";

}
args.pipeline = (0, bson_1.serialize)(args.pipeline);
args.pipeline = (0, bson_1.serialize)(Object.fromEntries(args.pipeline.entries()));
return cy.task('aggregate', args).then(function (result) {

@@ -24,0 +24,0 @@ return Object.values((0, bson_1.deserialize)(Buffer.from(result)));

import Chainable = Cypress.Chainable;
export declare function createCollection(collection: string, options?: any): Chainable;
export declare function dropCollection(collection: string, options?: any): Chainable;

@@ -0,0 +0,0 @@ "use strict";

import Chainable = Cypress.Chainable;
import { Document } from 'mongodb';
export declare function runCommand(command: Document, options?: any): Chainable;

@@ -10,3 +10,3 @@ "use strict";

options: options,
command: command
command: command,
};

@@ -13,0 +13,0 @@ return cy.task('runCommand', args).then(function (result) {

@@ -0,0 +0,0 @@ import { Document } from 'mongodb';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Document } from 'mongodb';

@@ -56,3 +56,3 @@ "use strict";

if (result !== null)
return (0, bson_1.deserialize)(Buffer.from(result)).value;
return (0, bson_1.deserialize)(Buffer.from(result));
else

@@ -82,3 +82,3 @@ return null;

if (result !== null)
return (0, bson_1.deserialize)(Buffer.from(result)).value;
return (0, bson_1.deserialize)(Buffer.from(result));
else

@@ -85,0 +85,0 @@ return null;

@@ -0,0 +0,0 @@ import { Document } from 'mongodb';

@@ -42,3 +42,3 @@ "use strict";

}
args.documents = (0, bson_1.serialize)(args.documents);
args.documents = (0, bson_1.serialize)(Object.fromEntries(args.documents.entries()));
return cy.task('insertMany', args).then(function (result) {

@@ -45,0 +45,0 @@ return result;

@@ -0,0 +0,0 @@ import { Document } from 'mongodb';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Document } from 'mongodb';

@@ -0,0 +0,0 @@ "use strict";

/// <reference types="cypress" />
export declare function configurePlugin(on: Cypress.PluginEvents): void;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -189,5 +189,5 @@ if (y = 0, t) op = [op[0] & 2, t.value];

});
}
},
});
}
exports.configurePlugin = configurePlugin;

@@ -1,2 +0,1 @@

/// <reference types="node" />
export declare function aggregate(args: any): Promise<Buffer>;
export declare function aggregate(args: any): Promise<Uint8Array>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -51,6 +51,5 @@ if (y = 0, t) op = [op[0] & 2, t.value];

args.pipeline = Object.values(deserializedPipeline);
client = new mongodb_1.MongoClient(args.uri);
return [4, client.connect()];
return [4, mongodb_1.MongoClient.connect(args.uri)];
case 1:
_a.sent();
client = _a.sent();
_a.label = 2;

@@ -66,3 +65,3 @@ case 2:

result = _a.sent();
return [2, (0, bson_1.serialize)(result)];
return [2, (0, bson_1.serialize)(Object.fromEntries(result.entries()))];
case 4:

@@ -69,0 +68,0 @@ err_1 = _a.sent();

export declare function createCollection(args: any): Promise<unknown>;
export declare function dropCollection(args: any): Promise<unknown>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -59,9 +59,6 @@ if (y = 0, t) op = [op[0] & 2, t.value];

case 2:
_b.trys.push([2, 5, , 6]);
_b.trys.push([2, 4, 5, 7]);
return [4, database.createCollection(args.collection, args.options)];
case 3:
result = _b.sent();
return [4, client.close()];
case 4:
_b.sent();
if (result) {

@@ -73,4 +70,4 @@ return [2, 'Collection created'];

}
return [3, 6];
case 5:
return [3, 7];
case 4:
error_1 = _b.sent();

@@ -81,4 +78,8 @@ if (failSilently)

throw error_1;
return [3, 6];
case 6: return [2];
return [3, 7];
case 5: return [4, client.close()];
case 6:
_b.sent();
return [7];
case 7: return [2];
}

@@ -103,3 +104,3 @@ });

case 2:
_b.trys.push([2, 5, , 6]);
_b.trys.push([2, 4, 5, 7]);
database = client.db(args.database);

@@ -109,5 +110,2 @@ return [4, database.dropCollection(args.collection, args.options)];

result = _b.sent();
return [4, client.close()];
case 4:
_b.sent();
if (result) {

@@ -119,4 +117,4 @@ return [2, 'Collection dropped'];

}
return [3, 6];
case 5:
return [3, 7];
case 4:
error_2 = _b.sent();

@@ -127,4 +125,8 @@ if (failSilently)

throw error_2;
return [3, 6];
case 6: return [2];
return [3, 7];
case 5: return [4, client.close()];
case 6:
_b.sent();
return [7];
case 7: return [2];
}

@@ -131,0 +133,0 @@ });

export declare function runCommand(args: any): Promise<import("bson").Document>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -44,3 +44,3 @@ if (y = 0, t) op = [op[0] & 2, t.value];

return __awaiter(this, void 0, void 0, function () {
var client, database, result, error_1;
var client, database;
return __generator(this, function (_a) {

@@ -58,13 +58,9 @@ switch (_a.label) {

case 2:
_a.trys.push([2, 5, , 6]);
_a.trys.push([2, , 4, 6]);
return [4, database.command(args.command, args.options)];
case 3:
result = _a.sent();
return [4, client.close()];
case 4:
case 3: return [2, _a.sent()];
case 4: return [4, client.close()];
case 5:
_a.sent();
return [2, result];
case 5:
error_1 = _a.sent();
throw error_1;
return [7];
case 6: return [2];

@@ -71,0 +67,0 @@ }

export declare function deleteOne(args: any): Promise<string>;
export declare function deleteMany(args: any): Promise<string>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -51,2 +51,3 @@ if (y = 0, t) op = [op[0] & 2, t.value];

case 0:
_a.trys.push([0, , 2, 4]);
collection = client

@@ -58,6 +59,8 @@ .db(args.database)

result = _a.sent();
return [4, client.close()];
case 2:
return [2, result.deletedCount + ' document deleted'];
case 2: return [4, client.close()];
case 3:
_a.sent();
return [2, result.deletedCount + ' document deleted'];
return [7];
case 4: return [2];
}

@@ -69,9 +72,14 @@ });

function deleteMany(args) {
var _this = this;
args.filter = (0, bson_1.deserialize)(Buffer.from(args.filter));
return mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var collection, result;
return __awaiter(this, void 0, void 0, function () {
var client, collection, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
args.filter = (0, bson_1.deserialize)(Buffer.from(args.filter));
return [4, mongodb_1.MongoClient.connect(args.uri)];
case 1:
client = _a.sent();
_a.label = 2;
case 2:
_a.trys.push([2, , 4, 6]);
collection = client

@@ -81,12 +89,14 @@ .db(args.database)

return [4, collection.deleteMany(args.filter, args.options)];
case 1:
case 3:
result = _a.sent();
return [4, client.close()];
case 2:
return [2, result.deletedCount + ' documents deleted'];
case 4: return [4, client.close()];
case 5:
_a.sent();
return [2, result.deletedCount + ' documents deleted'];
return [7];
case 6: return [2];
}
});
}); });
});
}
exports.deleteMany = deleteMany;

@@ -1,5 +0,4 @@

/// <reference types="node" />
export declare function findOne(args: any): Promise<Buffer | null>;
export declare function findOneAndUpdate(args: any): Promise<Buffer | null>;
export declare function findOneAndDelete(args: any): Promise<Buffer | null>;
export declare function findMany(args: any): Promise<Buffer>;
export declare function findOne(args: any): Promise<Uint8Array | null>;
export declare function findOneAndUpdate(args: any): Promise<Uint8Array | null>;
export declare function findOneAndDelete(args: any): Promise<Uint8Array | null>;
export declare function findMany(args: any): Promise<Uint8Array>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -49,7 +49,7 @@ if (y = 0, t) op = [op[0] & 2, t.value];

return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var result, err_1;
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 5]);
_a.trys.push([0, , 2, 4]);
return [4, client

@@ -61,15 +61,10 @@ .db(args.database)

result = _a.sent();
return [4, client.close()];
case 2:
_a.sent();
if (result !== null)
return [2, (0, bson_1.serialize)(result)];
return [2, null];
case 2: return [4, client.close()];
case 3:
err_1 = _a.sent();
return [4, client.close()];
case 4:
_a.sent();
throw err_1;
case 5: return [2];
return [7];
case 4: return [2];
}

@@ -89,7 +84,7 @@ });

return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var result, err_2;
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 5]);
_a.trys.push([0, , 2, 4]);
return [4, client

@@ -101,15 +96,10 @@ .db(args.database)

result = _a.sent();
return [4, client.close()];
case 2:
_a.sent();
if (result !== null)
return [2, (0, bson_1.serialize)(result)];
return [2, null];
case 2: return [4, client.close()];
case 3:
err_2 = _a.sent();
return [4, client.close()];
case 4:
_a.sent();
throw err_2;
case 5: return [2];
return [7];
case 4: return [2];
}

@@ -129,7 +119,7 @@ });

return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var result, err_3;
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 5]);
_a.trys.push([0, , 2, 4]);
return [4, client

@@ -141,15 +131,10 @@ .db(args.database)

result = _a.sent();
return [4, client.close()];
case 2:
_a.sent();
if (result !== null)
return [2, (0, bson_1.serialize)(result)];
return [2, null];
case 2: return [4, client.close()];
case 3:
err_3 = _a.sent();
return [4, client.close()];
case 4:
_a.sent();
throw err_3;
case 5: return [2];
return [7];
case 4: return [2];
}

@@ -164,19 +149,27 @@ });

return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
args.query = (0, bson_1.deserialize)(Buffer.from(args.query));
return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) {
return client
.db(args.database)
.collection(args.collection)
.find(args.query, args.options)
.toArray()
.then(function (result) {
client.close();
return (0, bson_1.serialize)(result);
})
.catch(function (err) {
client.close();
throw err;
return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, , 2, 4]);
return [4, client
.db(args.database)
.collection(args.collection)
.find(args.query, args.options)
.toArray()];
case 1:
result = _a.sent();
return [2, (0, bson_1.serialize)(Object.fromEntries(result.entries()))];
case 2: return [4, client.close()];
case 3:
_a.sent();
return [7];
case 4: return [2];
}
});
})];
}); })];
});

@@ -183,0 +176,0 @@ });

export declare function insertOne(args: any): Promise<any>;
export declare function insertMany(args: any): Promise<any>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -49,22 +49,19 @@ if (y = 0, t) op = [op[0] & 2, t.value];

return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var collection, result, err_1;
var collection, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 5]);
collection = client.db(args.database).collection(args.collection);
_a.trys.push([0, , 2, 4]);
collection = client
.db(args.database)
.collection(args.collection);
return [4, collection.insertOne(args.document, args.options)];
case 1:
result = _a.sent();
return [4, client.close()];
case 2:
_a.sent();
return [2, result.insertedId];
case 2: return [4, client.close()];
case 3:
err_1 = _a.sent();
return [4, client.close()];
case 4:
_a.sent();
throw err_1;
case 5: return [2];
return [7];
case 4: return [2];
}

@@ -88,2 +85,3 @@ });

case 0:
_a.trys.push([0, , 2, 4]);
collection = client.db(args.database).collection(args.collection);

@@ -93,6 +91,8 @@ return [4, collection.insertMany(args.documents, args.options)];

result = _a.sent();
return [4, client.close()];
case 2:
return [2, result.insertedIds];
case 2: return [4, client.close()];
case 3:
_a.sent();
return [2, result.insertedIds];
return [7];
case 4: return [2];
}

@@ -99,0 +99,0 @@ });

@@ -1,3 +0,2 @@

/// <reference types="node" />
export declare function updateOne(args: any): Promise<Buffer | null>;
export declare function updateMany(args: any): Promise<Buffer | null>;
export declare function updateOne(args: any): Promise<Uint8Array | null>;
export declare function updateMany(args: any): Promise<Uint8Array | null>;

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -50,7 +50,7 @@ if (y = 0, t) op = [op[0] & 2, t.value];

return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var result, err_1;
var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 5]);
_a.trys.push([0, , 2, 4]);
return [4, client

@@ -62,13 +62,8 @@ .db(args.database)

result = _a.sent();
return [4, client.close()];
case 2:
_a.sent();
return [2, result ? (0, bson_1.serialize)(result) : null];
case 2: return [4, client.close()];
case 3:
err_1 = _a.sent();
return [4, client.close()];
case 4:
_a.sent();
throw err_1;
case 5: return [2];
return [7];
case 4: return [2];
}

@@ -88,7 +83,7 @@ });

return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () {
var database, collection, result, err_2;
var database, collection, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 5]);
_a.trys.push([0, , 2, 4]);
database = client.db(args.database);

@@ -99,13 +94,8 @@ collection = database.collection(args.collection);

result = _a.sent();
return [4, client.close()];
case 2:
_a.sent();
return [2, result ? (0, bson_1.serialize)(result) : null];
case 2: return [4, client.close()];
case 3:
err_2 = _a.sent();
return [4, client.close()];
case 4:
_a.sent();
throw err_2;
case 5: return [2];
return [7];
case 4: return [2];
}

@@ -112,0 +102,0 @@ });

export declare function validate(args: any): void;

@@ -0,0 +0,0 @@ "use strict";

{
"name": "cypress-mongodb",
"version": "6.1.0",
"version": "6.2.0",
"description": "Cypress MongoDB plugin",

@@ -30,3 +30,3 @@ "main": "./dist/index.js",

"dependencies": {
"mongodb": "4.10.0"
"mongodb": "6.0.0"
},

@@ -33,0 +33,0 @@ "devDependencies": {

@@ -272,18 +272,18 @@ # Introduction

| failSilently | `false` | Control if the command will fail or if the collection is not found |
| `createCollection` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/CreateCollectionOptions.html) |
| `dropCollection` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/DropCollectionOptions.html) |
| `insertOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/InsertOneOptions.html) |
| `insertMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/BulkWriteOptions.html) |
| `findOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/FindOptions.html) |
| `findMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/FindOptions.html) |
| `findOneAndUpdate` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/FindOneAndUpdateOptions.html) |
| `findOneAndDelete` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/FindOneAndDeleteOptions.html) |
| `updateOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/UpdateOptions.html) |
| `updateMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/UpdateOptions.html) |
| `deleteOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/DeleteOptions.html) |
| `deleteMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/DeleteOptions.html) |
| `aggregate` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/4.10/interfaces/AggregateOptions.html) |
| `createCollection` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/CreateCollectionOptions.html) |
| `dropCollection` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/DropCollectionOptions.html) |
| `insertOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/InsertOneOptions.html) |
| `insertMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/BulkWriteOptions.html) |
| `findOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/FindOptions.html) |
| `findMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/FindOptions.html) |
| `findOneAndUpdate` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/FindOneAndUpdateOptions.html) |
| `findOneAndDelete` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/FindOneAndDeleteOptions.html) |
| `updateOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/UpdateOptions.html) |
| `updateMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/UpdateOptions.html) |
| `deleteOne` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/DeleteOptions.html) |
| `deleteMany` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/DeleteOptions.html) |
| `aggregate` options | *N/A* | Refer to official [documentation](https://mongodb.github.io/node-mongodb-native/6.0/interfaces/AggregateOptions.html) |
# Reference
https://mongodb.github.io/node-mongodb-native/4.10/classes/Collection.html
https://mongodb.github.io/node-mongodb-native/6.0/

@@ -290,0 +290,0 @@ # Future development & support

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc