Skip to content

Commit 546051d

Browse files
authored
feat: update dependencies (#149)
BREAKING CHANGE: `mongodb` was updated to v6. See the changelog at https://github.com/mongodb/node-mongodb-native/releases/tag/v6.0.0
1 parent 53c5118 commit 546051d

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

adonis-typings/odm.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,7 @@ declare module '@ioc:Zakodium/Mongodb/Odm' {
290290
): this;
291291
}
292292

293-
export interface QuerySortObject {
294-
[key: string]: SortDirection;
295-
}
293+
export type QuerySortObject = Record<string, SortDirection>;
296294

297295
export interface QueryContract<DocumentType> {
298296
/**
@@ -386,7 +384,7 @@ declare module '@ioc:Zakodium/Mongodb/Odm' {
386384
* List of keys used to search the user.
387385
* @default ['email']
388386
*/
389-
uids?: (keyof ModelAttributes<InstanceType<User>>)[];
387+
uids?: Array<keyof ModelAttributes<InstanceType<User>>>;
390388
/**
391389
* Unique key on the user object.
392390
* @default _id

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@
6565
"@adonisjs/core": "^5.9.0",
6666
"@adonisjs/logger": "^4.1.5",
6767
"@poppinss/cliui": "^3.0.5",
68-
"@types/jest": "^29.5.1",
69-
"@types/lodash": "^4.14.194",
68+
"@types/jest": "^29.5.5",
69+
"@types/lodash": "^4.14.198",
7070
"@types/pluralize": "0.0.29",
71-
"eslint": "^8.40.0",
72-
"eslint-config-zakodium": "^7.2.0",
73-
"jest": "^29.5.0",
74-
"prettier": "^2.8.8",
75-
"rimraf": "^5.0.0",
76-
"ts-jest": "^29.1.0",
77-
"typescript": "^5.0.4"
71+
"eslint": "^8.49.0",
72+
"eslint-config-zakodium": "^8.0.2",
73+
"jest": "^29.7.0",
74+
"prettier": "^3.0.3",
75+
"rimraf": "^5.0.1",
76+
"ts-jest": "^29.1.1",
77+
"typescript": "^5.2.2"
7878
},
7979
"dependencies": {
8080
"@poppinss/utils": "^5.0.0",
8181
"cli-table3": "^0.6.3",
8282
"lodash": "^4.17.21",
83-
"mongodb": "^5.5.0",
83+
"mongodb": "^6.1.0",
8484
"pluralize": "^8.0.0"
8585
}
8686
}

src/Database/Connection.ts

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enum ConnectionStatus {
1414
DISCONNECTED = 'DISCONNECTED',
1515
}
1616

17+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
1718
export declare interface Connection {
1819
on(
1920
event: 'connect',
@@ -37,6 +38,7 @@ export declare interface Connection {
3738
): this;
3839
}
3940

41+
// eslint-disable-next-line unicorn/prefer-event-target, @typescript-eslint/no-unsafe-declaration-merging
4042
export class Connection extends EventEmitter implements ConnectionContract {
4143
public readonly client: MongoClient;
4244
public readonly name: string;

src/Model/Model.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ export class BaseAutoIncrementModel extends BaseModel {
722722
{ $inc: { count: 1 } },
723723
{ ...driverOptions, upsert: true, returnDocument: 'after' },
724724
);
725-
assert(doc.value, 'upsert should always create a document');
726-
toSet._id = doc.value.count;
725+
assert(doc, 'upsert should always create a document');
726+
toSet._id = doc.count;
727727
// @ts-expect-error Unavoidable error, as _id is unknown here.
728728
await collection.insertOne(toSet, driverOptions);
729-
this.$attributes._id = doc.value.count;
729+
this.$attributes._id = doc.count;
730730
this.$isPersisted = true;
731731
} else {
732732
await collection.updateOne(

src/__tests__/Connection.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ afterAll(async () => {
1212
test('try to connect with good config', async () => {
1313
await connection.connect();
1414
await sleep(500);
15-
expect(logger.logs[logger.logs.length - 1]).toBeUndefined();
15+
expect(logger.logs.at(-1)).toBeUndefined();
1616
});
1717

1818
test('get collection', async () => {

test-utils/TestUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function getConnection(logger = getLogger()) {
3232
export function getMongodb(logger = getLogger()) {
3333
const database = `test-runner-${path
3434
.basename(expect.getState().testPath as string, '.test.ts')
35-
.replace(/\./g, '_')}`;
35+
.replaceAll('.', '_')}`;
3636
const mongoConfig: MongodbConfig = {
3737
connection: 'mongo',
3838
connections: {

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"outDir": "./lib",
88
"inlineSourceMap": true,
99
"strict": true,
10-
"lib": ["ES2020"],
11-
"target": "es2020",
10+
"lib": ["ES2021"],
11+
"target": "es2021",
1212
"strictFunctionTypes": false,
1313
"experimentalDecorators": true,
1414
"emitDecoratorMetadata": true,

0 commit comments

Comments
 (0)