Skip to content

Commit cf8e8e4

Browse files
author
Zhenya Tikhonov
authored
build: upgrade dependencies (#852)
## What This upgrades `mongodb` and some dev dependencies. Closes #CR-22366 ## Why — ## Notes —
1 parent 88bc9b9 commit cf8e8e4

File tree

7 files changed

+2621
-2580
lines changed

7 files changed

+2621
-2580
lines changed

lib/interface/cli/commands/offline-logs/offload-to-collection.cmd.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const archiveWithMerge = async function (
8080
collection
8181
) {
8282
var result = sourceCollectionObj.aggregate([
83-
{ $match: { _id: { $lte: ObjectId(cutoffDateId) } } },
83+
{ $match: { _id: { $lte: new ObjectId(cutoffDateId) } } },
8484
{
8585
$merge: {
8686
into: { db: targetDB, coll: targetCollection },
@@ -96,7 +96,7 @@ const archiveWithMerge = async function (
9696
checkCursorState(result, collection, targetCollection);
9797

9898
await sourceCollectionObj.deleteMany({
99-
_id: { $lte: ObjectId(cutoffDateId) },
99+
_id: { $lte: new ObjectId(cutoffDateId) },
100100
});
101101
};
102102
///////////////////////////////////////////////////////////////////////////////////
@@ -107,7 +107,7 @@ const archiveWithOut = async function (
107107
collection
108108
) {
109109
var result = sourceCollectionObj.aggregate([
110-
{ $match: { _id: { $lte: ObjectId(cutoffDateId) } } },
110+
{ $match: { _id: { $lte: new ObjectId(cutoffDateId) } } },
111111
{ $out: targetCollection },
112112
]);
113113

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

118118
await sourceCollectionObj.deleteMany({
119-
_id: { $lte: ObjectId(cutoffDateId) },
119+
_id: { $lte: new ObjectId(cutoffDateId) },
120120
});
121121
};
122122
///////////////////////////////////////////////////////////////////////////////////

lib/interface/cli/commands/offline-logs/offload-to-file.cmd.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ const offloadToFile = async function (
6565
const logsCursor = await collectionObj
6666
.find({
6767
_id: {
68-
$gte: ObjectId(lowerBoundId),
69-
$lt: ObjectId(upperBoundId),
68+
$gte: new ObjectId(lowerBoundId),
69+
$lt: new ObjectId(upperBoundId),
7070
},
7171
});
7272

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

7575
await collectionObj.deleteMany({
7676
_id: {
77-
$gte: ObjectId(lowerBoundId),
78-
$lt: ObjectId(upperBoundId),
77+
$gte: new ObjectId(lowerBoundId),
78+
$lt: new ObjectId(upperBoundId),
7979
},
8080
});
8181
}

lib/interface/cli/commands/offline-logs/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async function writeLogsToFile(
5252
}
5353

5454
function getMinDate(minLog) {
55-
const minLogId = ObjectId(minLog._id);
55+
const minLogId = new ObjectId(minLog._id);
5656
return moment(minLogId.getTimestamp()).startOf('day');
5757
}
5858

@@ -127,7 +127,7 @@ async function collectionExists(dbObject, targetCollection) {
127127

128128
async function findMinLog(collectionObj, UpperBoundDateId) {
129129
const minLog = await collectionObj
130-
.find({ _id: { $lt: ObjectId(UpperBoundDateId) } })
130+
.find({ _id: { $lt: new ObjectId(UpperBoundDateId) } })
131131
.sort({ _id: 1 })
132132
.limit(1)
133133
.toArray();

lib/interface/cli/commands/root/root.sdk.spec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('root commands', () => {
4141
});
4242

4343
describe('create', () => {
44-
describe('context', async () => {
44+
describe('context', () => {
4545
it('should handle creation from spec', async () => {
4646
const argv = {
4747
filename: {
@@ -56,7 +56,7 @@ describe('root commands', () => {
5656
});
5757
});
5858

59-
describe('pipeline', async () => {
59+
describe('pipeline', () => {
6060
it('should handle creation from spec', async () => {
6161
const argv = {
6262
filename: {
@@ -73,7 +73,7 @@ describe('root commands', () => {
7373
});
7474

7575
describe('delete', () => {
76-
describe('context', async () => {
76+
describe('context', () => {
7777
it('should handle deletion by spec', async () => {
7878
const argv = {
7979
filename: {
@@ -88,7 +88,7 @@ describe('root commands', () => {
8888
});
8989
});
9090

91-
describe('pipeline', async () => {
91+
describe('pipeline', () => {
9292
it('should handle deletion by spec', async () => {
9393
const argv = {
9494
filename: {
@@ -105,7 +105,7 @@ describe('root commands', () => {
105105
});
106106

107107
describe('replace', () => {
108-
describe('context', async () => {
108+
describe('context', () => {
109109
it('should handle replacing by spec', async () => {
110110
const argv = {
111111
filename: {
@@ -120,7 +120,7 @@ describe('root commands', () => {
120120
});
121121
});
122122

123-
describe('pipeline', async () => {
123+
describe('pipeline', () => {
124124
it('should handle replacing by spec', async () => {
125125
const argv = {
126126
filename: {
@@ -137,7 +137,7 @@ describe('root commands', () => {
137137
});
138138

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

152152
describe('version', () => {
153-
describe('api', async () => {
153+
describe('api', () => {
154154
it('should handle getting version', async () => {
155155
const argv = { component: 'api' };
156156
await versionCmd.handler(argv);
157157
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
158158
});
159159
});
160160

161-
describe('hermes', async () => {
161+
describe('hermes', () => {
162162
it('should handle getting version', async () => {
163163
const argv = { component: 'hermes' };
164164
await versionCmd.handler(argv);
165165
await verifyResponsesReturned([DEFAULT_RESPONSE]); // eslint-disable-line
166166
});
167167
});
168168

169-
describe('nomios', async () => {
169+
describe('nomios', () => {
170170
it('should handle getting version', async () => {
171171
const argv = { component: 'nomios' };
172172
await versionCmd.handler(argv);
@@ -178,7 +178,7 @@ describe('root commands', () => {
178178
describe('Approve pending-approval workflow', () => {
179179
it('should handle approve from spec', async () => {
180180
const argv = {
181-
buildId: 'buildId'
181+
buildId: 'buildId',
182182
};
183183
await approveCmd.handler(argv);
184184
await verifyResponsesReturned([DEFAULT_RESPONSE, DEFAULT_RESPONSE]); // eslint-disable-line
@@ -188,7 +188,7 @@ describe('root commands', () => {
188188
describe('Deny pending-approval workflow', () => {
189189
it('should handle deny from spec', async () => {
190190
const argv = {
191-
buildId: 'buildId'
191+
buildId: 'buildId',
192192
};
193193
await denyCmd.handler(argv);
194194
await verifyResponsesReturned([DEFAULT_RESPONSE, DEFAULT_RESPONSE]); // eslint-disable-line

lib/interface/cli/commands/workflow/wait.cmd.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const _ = require('lodash');
22
const CFError = require('cf-errors');
33
const Command = require('../../Command');
4-
const { ObjectID } = require('mongodb');
4+
const { ObjectId } = require('mongodb');
55
const moment = require('moment');
66
const { sdk } = require('../../../../logic');
77
const Promise = require('bluebird');
@@ -55,7 +55,7 @@ const wait = new Command({
5555
const descriptive = argv.d || argv.v;
5656

5757
_.forEach(workflowIds, (workflowId) => {
58-
if (!ObjectID.isValid(workflowId)) {
58+
if (!ObjectId.isValid(workflowId)) {
5959
throw new CFError({
6060
message: `Passed build id: ${workflowId} is not valid`,
6161
});

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.87.2",
3+
"version": "0.87.3",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,
@@ -72,7 +72,7 @@
7272
"lodash": "^4.17.21",
7373
"mkdirp": "^0.5.1",
7474
"moment": "^2.29.4",
75-
"mongodb": "^3.7.3",
75+
"mongodb": "^4.17.2",
7676
"node-forge": "^1.3.0",
7777
"ora": "^5.4.1",
7878
"prettyjson": "^1.2.5",
@@ -95,9 +95,9 @@
9595
"eslint": "^7.32.0",
9696
"eslint-config-airbnb-base": "^15.0.0",
9797
"eslint-plugin-import": "^2.25.4",
98-
"eslint-plugin-jest": "^24.7.0",
98+
"eslint-plugin-jest": "^27.6.3",
9999
"hugo-cli": "^0.5.4",
100-
"jest": "^23.6.0",
100+
"jest": "^29.7.0",
101101
"pkg": "5.5.2"
102102
},
103103
"bugs": {

0 commit comments

Comments
 (0)