Skip to content

Commit

Permalink
build: upgrade dependencies (#852)
Browse files Browse the repository at this point in the history
## What

This upgrades `mongodb` and some dev dependencies.

Closes #CR-22366

## Why

 —

## Notes

—
  • Loading branch information
Zhenya Tikhonov authored Feb 13, 2024
1 parent 88bc9b9 commit cf8e8e4
Show file tree
Hide file tree
Showing 7 changed files with 2,621 additions and 2,580 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const archiveWithMerge = async function (
collection
) {
var result = sourceCollectionObj.aggregate([
{ $match: { _id: { $lte: ObjectId(cutoffDateId) } } },
{ $match: { _id: { $lte: new ObjectId(cutoffDateId) } } },
{
$merge: {
into: { db: targetDB, coll: targetCollection },
Expand All @@ -96,7 +96,7 @@ const archiveWithMerge = async function (
checkCursorState(result, collection, targetCollection);

await sourceCollectionObj.deleteMany({
_id: { $lte: ObjectId(cutoffDateId) },
_id: { $lte: new ObjectId(cutoffDateId) },
});
};
///////////////////////////////////////////////////////////////////////////////////
Expand All @@ -107,7 +107,7 @@ const archiveWithOut = async function (
collection
) {
var result = sourceCollectionObj.aggregate([
{ $match: { _id: { $lte: ObjectId(cutoffDateId) } } },
{ $match: { _id: { $lte: new ObjectId(cutoffDateId) } } },
{ $out: targetCollection },
]);

Expand All @@ -116,7 +116,7 @@ const archiveWithOut = async function (
checkCursorState(result, collection, targetCollection);

await sourceCollectionObj.deleteMany({
_id: { $lte: ObjectId(cutoffDateId) },
_id: { $lte: new ObjectId(cutoffDateId) },
});
};
///////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ const offloadToFile = async function (
const logsCursor = await collectionObj
.find({
_id: {
$gte: ObjectId(lowerBoundId),
$lt: ObjectId(upperBoundId),
$gte: new ObjectId(lowerBoundId),
$lt: new ObjectId(upperBoundId),
},
});

await writeLogsToFile(upperBound, lowerBound, collection, logsCursor, path);

await collectionObj.deleteMany({
_id: {
$gte: ObjectId(lowerBoundId),
$lt: ObjectId(upperBoundId),
$gte: new ObjectId(lowerBoundId),
$lt: new ObjectId(upperBoundId),
},
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/interface/cli/commands/offline-logs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function writeLogsToFile(
}

function getMinDate(minLog) {
const minLogId = ObjectId(minLog._id);
const minLogId = new ObjectId(minLog._id);
return moment(minLogId.getTimestamp()).startOf('day');
}

Expand Down Expand Up @@ -127,7 +127,7 @@ async function collectionExists(dbObject, targetCollection) {

async function findMinLog(collectionObj, UpperBoundDateId) {
const minLog = await collectionObj
.find({ _id: { $lt: ObjectId(UpperBoundDateId) } })
.find({ _id: { $lt: new ObjectId(UpperBoundDateId) } })
.sort({ _id: 1 })
.limit(1)
.toArray();
Expand Down
24 changes: 12 additions & 12 deletions lib/interface/cli/commands/root/root.sdk.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('root commands', () => {
});

describe('create', () => {
describe('context', async () => {
describe('context', () => {
it('should handle creation from spec', async () => {
const argv = {
filename: {
Expand All @@ -56,7 +56,7 @@ describe('root commands', () => {
});
});

describe('pipeline', async () => {
describe('pipeline', () => {
it('should handle creation from spec', async () => {
const argv = {
filename: {
Expand All @@ -73,7 +73,7 @@ describe('root commands', () => {
});

describe('delete', () => {
describe('context', async () => {
describe('context', () => {
it('should handle deletion by spec', async () => {
const argv = {
filename: {
Expand All @@ -88,7 +88,7 @@ describe('root commands', () => {
});
});

describe('pipeline', async () => {
describe('pipeline', () => {
it('should handle deletion by spec', async () => {
const argv = {
filename: {
Expand All @@ -105,7 +105,7 @@ describe('root commands', () => {
});

describe('replace', () => {
describe('context', async () => {
describe('context', () => {
it('should handle replacing by spec', async () => {
const argv = {
filename: {
Expand All @@ -120,7 +120,7 @@ describe('root commands', () => {
});
});

describe('pipeline', async () => {
describe('pipeline', () => {
it('should handle replacing by spec', async () => {
const argv = {
filename: {
Expand All @@ -137,7 +137,7 @@ describe('root commands', () => {
});

describe('validate', () => {
describe('Not valid yaml ', async () => {
describe('Not valid yaml ', () => {
it('should throw error for not valid file', async () => {
const argv = {
filenames: ['./__mocks__/codefresh.yml'],
Expand All @@ -150,23 +150,23 @@ describe('root commands', () => {
});

describe('version', () => {
describe('api', async () => {
describe('api', () => {
it('should handle getting version', async () => {
const argv = { component: 'api' };
await versionCmd.handler(argv);
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
});
});

describe('hermes', async () => {
describe('hermes', () => {
it('should handle getting version', async () => {
const argv = { component: 'hermes' };
await versionCmd.handler(argv);
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
});
});

describe('nomios', async () => {
describe('nomios', () => {
it('should handle getting version', async () => {
const argv = { component: 'nomios' };
await versionCmd.handler(argv);
Expand All @@ -178,7 +178,7 @@ describe('root commands', () => {
describe('Approve pending-approval workflow', () => {
it('should handle approve from spec', async () => {
const argv = {
buildId: 'buildId'
buildId: 'buildId',
};
await approveCmd.handler(argv);
await verifyResponsesReturned([DEFAULT_RESPONSE, DEFAULT_RESPONSE]); // eslint-disable-line
Expand All @@ -188,7 +188,7 @@ describe('root commands', () => {
describe('Deny pending-approval workflow', () => {
it('should handle deny from spec', async () => {
const argv = {
buildId: 'buildId'
buildId: 'buildId',
};
await denyCmd.handler(argv);
await verifyResponsesReturned([DEFAULT_RESPONSE, DEFAULT_RESPONSE]); // eslint-disable-line
Expand Down
4 changes: 2 additions & 2 deletions lib/interface/cli/commands/workflow/wait.cmd.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const _ = require('lodash');
const CFError = require('cf-errors');
const Command = require('../../Command');
const { ObjectID } = require('mongodb');
const { ObjectId } = require('mongodb');
const moment = require('moment');
const { sdk } = require('../../../../logic');
const Promise = require('bluebird');
Expand Down Expand Up @@ -55,7 +55,7 @@ const wait = new Command({
const descriptive = argv.d || argv.v;

_.forEach(workflowIds, (workflowId) => {
if (!ObjectID.isValid(workflowId)) {
if (!ObjectId.isValid(workflowId)) {
throw new CFError({
message: `Passed build id: ${workflowId} is not valid`,
});
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.87.2",
"version": "0.87.3",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down Expand Up @@ -72,7 +72,7 @@
"lodash": "^4.17.21",
"mkdirp": "^0.5.1",
"moment": "^2.29.4",
"mongodb": "^3.7.3",
"mongodb": "^4.17.2",
"node-forge": "^1.3.0",
"ora": "^5.4.1",
"prettyjson": "^1.2.5",
Expand All @@ -95,9 +95,9 @@
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^24.7.0",
"eslint-plugin-jest": "^27.6.3",
"hugo-cli": "^0.5.4",
"jest": "^23.6.0",
"jest": "^29.7.0",
"pkg": "5.5.2"
},
"bugs": {
Expand Down
Loading

0 comments on commit cf8e8e4

Please sign in to comment.