Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-8693 - Dependency updates #5430

Merged
merged 64 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
9eb7cc2
BC-8693 - run npm audit fix
SevenWaysDP Jan 14, 2025
6990979
BC-8693 - update all packages to minor and patch version
SevenWaysDP Jan 14, 2025
9788306
BC-8693 - fix tsc errors
SevenWaysDP Jan 14, 2025
b26b83d
update nanoid to version 5.0.9
SevenWaysDP Jan 15, 2025
e3d9734
update uuid package to version 11.0.5
SevenWaysDP Jan 15, 2025
9674815
update cross-spawn to version 6.0.6 and add overrides in package.json
SevenWaysDP Jan 15, 2025
99a09e1
update mongodb to version 4.17.2 and adjust dependencies in package.json
SevenWaysDP Jan 15, 2025
721aefb
update jose package to version 2.0.7
SevenWaysDP Jan 15, 2025
05f2252
update @golevelup/nestjs-rabbitmq to version 5.6.1
SevenWaysDP Jan 15, 2025
1ccc69a
update nanoid package to version 3.3.8
SevenWaysDP Jan 15, 2025
74bc3c7
add setup function to mock repository response in school-system-optio…
SevenWaysDP Jan 15, 2025
590e596
refactor: simplify config service mock in local.strategy.spec.ts and …
SevenWaysDP Jan 15, 2025
722f716
revert jest types
SevenWaysDP Jan 15, 2025
5c5bf13
update mongoose to version 6.13.5
SevenWaysDP Jan 15, 2025
1a1b583
chore: downgrade @golevelup/ts-jest to version 0.5.0
SevenWaysDP Jan 15, 2025
6c2f0d3
fix test but WHY???
SevenWaysDP Jan 15, 2025
177b977
fix tests
SevenWaysDP Jan 15, 2025
6064a4f
Merge remote-tracking branch 'origin/main' into BC-8693
SevenWaysDP Jan 15, 2025
d5fe09d
chore: update mocha to version 11.0.1
SevenWaysDP Jan 15, 2025
a3ad3b1
update deps
SevenWaysDP Jan 16, 2025
0dfec41
test: mock fileTypeStream in FilesStorageService upload tests
SevenWaysDP Jan 16, 2025
eb1b5c4
Merge branch 'main' into BC-8693
SevenWaysDP Jan 16, 2025
fb8c9a4
refactor: replace decode with jwtDecode in Etherpad tests
SevenWaysDP Jan 16, 2025
ed9109c
chore: downgrade jsdom to version 23.2.0 and update dependencies
SevenWaysDP Jan 17, 2025
eca458b
Merge branch 'main' into BC-8693
SevenWaysDP Jan 17, 2025
beb22b6
Merge branch 'main' into BC-8693
SevenWaysDP Jan 17, 2025
95e6b46
refactor: update JWT strategy options and improve file system adapter…
SevenWaysDP Jan 17, 2025
9862913
fixup! refactor: update JWT strategy options and improve file system …
SevenWaysDP Jan 17, 2025
2770eb9
refactor: remove jwt-decode dependency and replace with jsonwebtoken …
SevenWaysDP Jan 20, 2025
65c8f1b
chore: update simple-oauth2 and related dependencies to latest versions
SevenWaysDP Jan 20, 2025
397129d
Merge remote-tracking branch 'origin/main' into BC-8693
SevenWaysDP Jan 20, 2025
f334b2a
refactor: remove strip-bom dependency and implement custom BOM stripp…
SevenWaysDP Jan 20, 2025
0c05c9d
fixup! refactor: remove strip-bom dependency and implement custom BOM…
SevenWaysDP Jan 20, 2025
1e29a25
refactor: remove @jest-mock/express dependency from package.json and …
SevenWaysDP Jan 20, 2025
8cd5caf
chore: update @faker-js/faker to version 9.4.0 in package.json and pa…
SevenWaysDP Jan 20, 2025
d02e632
chore: update @types/supertest to version 6.0.2 package.json and pack…
SevenWaysDP Jan 20, 2025
bace8e3
chore: update @aws-sdk/lib-storage and @aws-sdk/client-s3 to version …
SevenWaysDP Jan 20, 2025
28e9488
chore: update file-type to version 20.0.0
SevenWaysDP Jan 20, 2025
2a0169a
fixup! chore: update file-type to version 20.0.0
SevenWaysDP Jan 20, 2025
855c434
update axios-mock-adapter to 2.1.0
SevenWaysDP Jan 20, 2025
a6c0d5e
chore: update rewire to version 7.0.0 in package.json and package-loc…
SevenWaysDP Jan 20, 2025
d105c12
chore: update nyc to version 17.1.0 in package.json and package-lock.…
SevenWaysDP Jan 20, 2025
1ea207f
Merge branch 'main' into BC-8693
SevenWaysDP Jan 20, 2025
c5d8875
chore: remove unused dependencies from package.json and package-lock.…
SevenWaysDP Jan 20, 2025
97f80bc
chore: remove unnecessary eslint directive from update-element-conten…
SevenWaysDP Jan 21, 2025
8ea9ed0
Merge branch 'main' into BC-8693
SevenWaysDP Jan 21, 2025
5059752
chore: update INestApplication type to include Server in API tests
SevenWaysDP Jan 21, 2025
4945c26
Merge remote-tracking branch 'origin/BC-8693' into BC-8693
SevenWaysDP Jan 21, 2025
8baba54
chore: update allowed licenses in dependency review workflow
SevenWaysDP Jan 21, 2025
0a54b93
chore: update allowed licenses in dependency review workflow to inclu…
SevenWaysDP Jan 21, 2025
fbe3bd2
chore: update allowed licenses format in dependency review workflow
SevenWaysDP Jan 21, 2025
14bd4f3
chore: format allowed licenses list in dependency review workflow
SevenWaysDP Jan 21, 2025
884e552
chore: streamline allowed licenses format in dependency review workflow
SevenWaysDP Jan 21, 2025
eed03ad
chore: update allowed licenses format in dependency review workflow
SevenWaysDP Jan 21, 2025
b99a6d5
chore: format allowed licenses list in dependency review workflow for…
SevenWaysDP Jan 21, 2025
274b993
chore: improve formatting of allowed licenses list in dependency revi…
SevenWaysDP Jan 21, 2025
6cc9553
chore: update allowed licenses format in dependency review workflow f…
SevenWaysDP Jan 21, 2025
7332e50
yaml
Loki-Afro Jan 21, 2025
a1331ce
Merge branch 'main' into BC-8693
Loki-Afro Jan 21, 2025
0423c05
yaml
Loki-Afro Jan 21, 2025
e270129
yaml
Loki-Afro Jan 21, 2025
93fa8b7
added missing licenses
Loki-Afro Jan 21, 2025
ad4646e
update mongoose dependency to version 6.13.8
SevenWaysDP Jan 21, 2025
a3f077e
Merge branch 'main' into BC-8693
SevenWaysDP Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,17 @@ jobs:
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
allow-licenses: AGPL-3.0-only, LGPL-3.0, MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, X11, 0BSD, GPL-3.0, Unlicense, CC0-1.0
allow-licenses: |
AGPL-3.0-only,
LGPL-3.0,
MIT,
Apache-2.0,
BSD-2-Clause,
BSD-3-Clause,
ISC,
X11,
0BSD,
GPL-3.0,
Unlicense,
CC0-1.0,
allow-ghsas: 'GHSA-vxvm-qww3-2fh7'
3 changes: 2 additions & 1 deletion apps/server/src/apps/helpers/swagger.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ServerTestModule } from '@modules/server';
import { INestApplication } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import type { Server } from 'node:net';
import request from 'supertest';
import { enableOpenApiDocs } from './swagger';

describe('swagger setup', () => {
describe('when adding swagger to an app', () => {
let app: INestApplication;
let app: INestApplication<Server>;

beforeAll(async () => {
app = await NestFactory.create(ServerTestModule);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ConfigService } from '@nestjs/config';
import { Algorithm } from 'jsonwebtoken';
import { JwtFromRequestFunction, StrategyOptions } from 'passport-jwt';
import { JwtAuthGuardConfig } from '../config';

Expand All @@ -8,7 +9,7 @@ export class JwtStrategyOptionsFactory {
configService: ConfigService<JwtAuthGuardConfig>
): StrategyOptions {
const publicKey = configService.getOrThrow<string>('JWT_PUBLIC_KEY');
const algorithm = configService.getOrThrow<string>('JWT_SIGNING_ALGORITHM');
const algorithm = configService.getOrThrow<string>('JWT_SIGNING_ALGORITHM') as Algorithm;

const options = {
jwtFromRequest: jwtFromRequestFunction,
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/infra/file-system/file-system.adapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Injectable } from '@nestjs/common';
import { promises as fsp, existsSync } from 'fs';
import { existsSync, promises as fsp } from 'fs';
import os from 'os';
import path from 'path';

import rimraf = require('rimraf');
import { rimrafSync } from 'rimraf';

const { mkdir, readdir, writeFile, readFile, mkdtemp } = fsp;

Expand Down Expand Up @@ -77,7 +77,7 @@ export class FileSystemAdapter {
*/
async removeDirRecursive(folderPath: string): Promise<void> {
// fs.rm changed in node 14.14, use rimraf instead
rimraf.sync(folderPath);
rimrafSync(folderPath);
return Promise.resolve();
}

Expand Down
13 changes: 7 additions & 6 deletions apps/server/src/infra/s3-client/s3-client.adapter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,21 +255,22 @@ describe('S3ClientAdapter', () => {
const setup = () => {
const { file } = createFile();
const { pathToFile } = createParameter();
const error = new InternalServerErrorException('S3ClientAdapter:create');
const error = new Error('Connection Error');
const expectedError = new InternalServerErrorException('S3ClientAdapter:create', { cause: error });

const uploadDoneMock = jest.spyOn(Upload.prototype, 'done').mockRejectedValueOnce(error);

const restoreMocks = () => {
uploadDoneMock.mockRestore();
};

return { file, pathToFile, error, restoreMocks };
return { file, pathToFile, expectedError, restoreMocks };
};

it('should throw error from client', async () => {
const { file, pathToFile, error, restoreMocks } = setup();
const { file, pathToFile, expectedError, restoreMocks } = setup();

await expect(service.create(pathToFile, file)).rejects.toThrow(error);
await expect(service.create(pathToFile, file)).rejects.toThrow(expectedError);

restoreMocks();
});
Expand Down Expand Up @@ -451,13 +452,13 @@ describe('S3ClientAdapter', () => {
const setup = () => {
const { pathToFile } = createParameter();
const filePath = 'directory/test.txt';
const error = new Error('testError');
const error = new Error('S3ClientAdapter:delete');
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
client.send.mockResolvedValueOnce({ Contents: [{ Key: filePath }] });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
client.send.mockRejectedValueOnce(error);
client.send.mockRejectedValueOnce();
CeEv marked this conversation as resolved.
Show resolved Hide resolved

const expectedError = new InternalServerErrorException(
'S3ClientAdapter:deleteDirectory',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,12 @@ describe('AccountDbService', () => {
};

it('should update account', async () => {
const { mockStudentUser, mockTeacherAccount } = setup();
const { mockTeacherAccount } = setup();

const ret = await accountService.save(mockTeacherAccount);

expect(ret).toBeDefined();
expect(ret).toMatchObject({
id: mockTeacherAccount.id,
username: mockTeacherAccount.username,
activated: mockTeacherAccount.activated,
systemId: mockTeacherAccount.systemId,
userId: new ObjectId(mockStudentUser.id),
});
expect(ret).toEqual(mockTeacherAccount);
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AccountEntityToDoMapper } from './account-entity-to-do.mapper';
import { AccountEntity } from '../../../domain/entity/account.entity';
import { accountFactory } from '../../../testing';
import { AccountEntityToDoMapper } from './account-entity-to-do.mapper';

describe('AccountEntityToDoMapper', () => {
beforeEach(() => {
Expand All @@ -16,7 +16,7 @@ describe('AccountEntityToDoMapper', () => {
describe('mapToDo', () => {
describe('When mapping AccountEntity to Account', () => {
const setup = () => {
const accountEntity = accountFactory.withAllProperties().buildWithId({}, '000000000000000000000001');
const accountEntity = accountFactory.withAllProperties().buildWithId();

const missingSystemUserIdEntity: AccountEntity = accountFactory.withoutSystemAndUserId().build();

Expand All @@ -28,7 +28,21 @@ describe('AccountEntityToDoMapper', () => {

const ret = AccountEntityToDoMapper.mapToDo(accountEntity);

expect({ ...ret.getProps(), _id: accountEntity._id }).toMatchObject(accountEntity);
expect({ ...ret.getProps(), _id: accountEntity._id }).toMatchObject({
id: accountEntity.id,
createdAt: accountEntity.createdAt,
updatedAt: accountEntity.updatedAt,
userId: accountEntity.userId?.toHexString(),
systemId: accountEntity.systemId?.toHexString(),
username: accountEntity.username,
password: accountEntity.password,
token: accountEntity.token,
credentialHash: accountEntity.credentialHash,
lastLogin: accountEntity.lastLogin,
expiresAt: accountEntity.expiresAt,
activated: accountEntity.activated,
deactivatedAt: accountEntity.deactivatedAt,
});
});

it('should ignore missing ids', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { SchulcloudTheme } from '@shared/domain/types';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import type { Server } from 'node:net';
import { of } from 'rxjs';
import request from 'supertest';
import { serverConfig, ServerTestModule } from '../../../server';
Expand All @@ -21,7 +22,7 @@ describe('Alert Controller api', () => {
const component1 = createComponent(1, 1);
const component2 = createComponent(2, 2);

let app: INestApplication;
let app: INestApplication<Server>;
let httpService: DeepMocked<HttpService>;

beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import jwt from 'jsonwebtoken';
import moment from 'moment';
import type { Server } from 'node:net';
import request, { Response } from 'supertest';
import { LdapAuthorizationBodyParams, LocalAuthorizationBodyParams, OauthLoginResponse } from '../dto';

Expand Down Expand Up @@ -71,7 +72,7 @@ jest.mock('jwks-rsa', () => () => {
describe('Login Controller (api)', () => {
const basePath = '/authentication';

let app: INestApplication;
let app: INestApplication<Server>;
let em: EntityManager;

const defaultPassword = 'DummyPasswd!1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { IdentityManagementOauthService } from '@infra/identity-management';
import { Account } from '@modules/account';
import { accountDoFactory } from '@modules/account/testing';
import { ServerConfig } from '@modules/server';
import { UnauthorizedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { User } from '@shared/domain/entity';
Expand Down Expand Up @@ -30,7 +29,7 @@ describe('LocalStrategy', () => {
await setupEntities();
authenticationServiceMock = createMock<AuthenticationService>();
idmOauthServiceMock = createMock<IdentityManagementOauthService>();
configServiceMock = createMock<ConfigService<ServerConfig, true>>();
configServiceMock = createMock<ConfigService>();
userRepoMock = createMock<UserRepo>();
strategy = new LocalStrategy(authenticationServiceMock, idmOauthServiceMock, configServiceMock, userRepoMock);
mockUser = userFactory.withRoleByName(RoleName.STUDENT).buildWithId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class FileContentBody {
}

export class FileElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.FILE })
@ApiProperty({ type: () => ContentElementType.FILE })
type!: ContentElementType.FILE;

@ValidateNested()
Expand Down Expand Up @@ -60,7 +60,7 @@ export class LinkContentBody {
}

export class LinkElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.LINK })
@ApiProperty({ type: () => ContentElementType.LINK })
type!: ContentElementType.LINK;

@ValidateNested()
Expand All @@ -75,7 +75,7 @@ export class DrawingContentBody {
}

export class DrawingElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.DRAWING })
@ApiProperty({ type: () => ContentElementType.DRAWING })
type!: ContentElementType.DRAWING;

@ValidateNested()
Expand All @@ -94,7 +94,7 @@ export class RichTextContentBody {
}

export class RichTextElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.RICH_TEXT })
@ApiProperty({ type: () => ContentElementType.RICH_TEXT })
type!: ContentElementType.RICH_TEXT;

@ValidateNested()
Expand All @@ -112,7 +112,7 @@ export class SubmissionContainerContentBody {
}

export class SubmissionContainerElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.SUBMISSION_CONTAINER })
@ApiProperty({ type: () => ContentElementType.SUBMISSION_CONTAINER })
type!: ContentElementType.SUBMISSION_CONTAINER;

@ValidateNested()
Expand All @@ -128,7 +128,7 @@ export class ExternalToolContentBody {
}

export class ExternalToolElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.EXTERNAL_TOOL })
@ApiProperty({ type: () => ContentElementType.EXTERNAL_TOOL })
type!: ContentElementType.EXTERNAL_TOOL;

@ValidateNested()
Expand All @@ -143,7 +143,7 @@ export class VideoConferenceContentBody {
}

export class VideoConferenceElementContentBody extends ElementContentBody {
@ApiProperty({ type: ContentElementType.VIDEO_CONFERENCE })
@ApiProperty({ type: () => ContentElementType.VIDEO_CONFERENCE })
type!: ContentElementType.VIDEO_CONFERENCE;

@ValidateNested()
Expand Down Expand Up @@ -188,7 +188,7 @@ export class UpdateElementContentBodyParams {
{ $ref: getSchemaPath(VideoConferenceElementContentBody) },
],
})
data!:
public data!:
| FileElementContentBody
| LinkElementContentBody
| RichTextElementContentBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ describe('Collaborative Storage Service', () => {

describe('Update TeamPermissions For Role', () => {
it('should call the adapter', async () => {
mockId = 'mockId';
jest.spyOn(service, 'findTeamById').mockResolvedValue({
id: 'testId',
name: 'testTeam',
Expand All @@ -108,6 +109,7 @@ describe('Collaborative Storage Service', () => {
});

it('should throw a forbidden exception', async () => {
mockId = 'mockId';
authService.checkPermission.mockImplementation(() => {
throw new ForbiddenException();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ConfigModule } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { CoursesApi } from '@src/infra/courses-client/generated';
import { axiosResponseFactory } from '@testing/factory/axios-response.factory';
import type { Server } from 'node:net';
import supertest from 'supertest';
import { CommonCartridgeApiModule } from '../common-cartridge-api.app.module';
import { CommonCartridgeFileBuilder } from '../export/builders/common-cartridge-file-builder';
Expand All @@ -29,7 +30,7 @@ jest.mock('../../../infra/auth-guard/decorator/jwt-auth.decorator', () => {

describe('CommonCartridgeController (API)', () => {
let module: TestingModule;
let app: INestApplication;
let app: INestApplication<Server>;

beforeAll(async () => {
module = await Test.createTestingModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { fileRecordFactory } from '@testing/factory/filerecord.factory';
import { schoolEntityFactory } from '@testing/factory/school-entity.factory';
import { UserAndAccountTestFactory } from '@testing/factory/user-and-account.test.factory';
import NodeClam from 'clamscan';
import type { Server } from 'node:net';
import request from 'supertest';
import { FileRecord } from '../../entity';
import { FilesStorageTestModule } from '../../files-storage-test.module';
Expand All @@ -18,9 +19,9 @@ const baseRouteName = '/file-security';
const scanResult: ScanResultParams = { virus_detected: false };

class API {
app: INestApplication;
app: INestApplication<Server>;

constructor(app: INestApplication) {
constructor(app: INestApplication<Server>) {
this.app = app;
}

Expand All @@ -39,7 +40,7 @@ class API {
}

describe(`${baseRouteName} (api)`, () => {
let app: INestApplication;
let app: INestApplication<Server>;
let em: EntityManager;
let api: API;
let validId: string;
Expand Down
Loading
Loading