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

Merge Prod Release into Master #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10,299 changes: 4,710 additions & 5,589 deletions package-lock.json

Large diffs are not rendered by default.

72 changes: 34 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,60 +48,56 @@
"tools-setup": "echo 'pipeline requires this'"
},
"dependencies": {
"@aws-sdk/client-s3": "3.537.0",
"@aws-sdk/s3-request-presigner": "3.540.0",
"@smithy/smithy-client": "2.5.0",
"@smithy/types": "2.12.0",
"@aws-sdk/client-s3": "3.583.0",
"@aws-sdk/s3-request-presigner": "3.583.0",
"@smithy/smithy-client": "3.0.1",
"@smithy/types": "3.0.0",
"aws-lambda": "1.0.7",
"express": "4.19.2",
"serverless-http": "3.2.0",
"source-map-support": "0.5.21"
},
"devDependencies": {
"@commitlint/cli": "17.7.1",
"@commitlint/config-conventional": "17.7.0",
"@dvsa/eslint-config-ts": "3.0.0",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@dvsa/eslint-config-ts": "3.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.0.4",
"@semantic-release/npm": "10.0.4",
"@serverless/typescript": "3.30.1",
"@smithy/util-stream": "2.2.0",
"@types/aws-lambda": "8.10.119",
"@types/jest": "29.5.3",
"@types/node": "20.5.0",
"@types/supertest": "2.0.12",
"@typescript-eslint/eslint-plugin": "6.3.0",
"@typescript-eslint/parser": "6.3.0",
"@semantic-release/github": "10.0.5",
"@semantic-release/npm": "12.0.1",
"@serverless/typescript": "3.38.0",
"@smithy/util-stream": "3.0.1",
"@types/aws-lambda": "8.10.138",
"@types/jest": "29.5.12",
"@types/node": "20.12.12",
"@types/supertest": "6.0.2",
"aws-sdk-client-mock": "4.0.0",
"clean-webpack-plugin": "4.0.0",
"commitlint-plugin-function-rules": "2.0.2",
"concurrently": "8.2.0",
"commitlint-plugin-function-rules": "4.0.0",
"concurrently": "8.2.2",
"cross-env": "7.0.3",
"eslint": "8.47.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-jest": "27.2.3",
"eslint-plugin-prettier": "5.0.0",
"fork-ts-checker-webpack-plugin": "6.0.8",
"husky": "8.0.3",
"jest": "29.6.2",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"fork-ts-checker-webpack-plugin": "9.0.2",
"husky": "9.0.11",
"jest": "29.7.0",
"json-serverless": "1.6.16",
"npm-run-all": "4.1.5",
"prettier": "3.0.1",
"rimraf": "5.0.1",
"semantic-release": "21.0.7",
"prettier": "3.2.5",
"rimraf": "5.0.7",
"semantic-release": "23.1.1",
"serverless": "3.34.0",
"serverless-dotenv-plugin": "6.0.0",
"serverless-offline": "12.0.4",
"serverless-s3-local": "0.7.2",
"serverless-webpack": "5.13.0",
"serverless-offline": "13.6.0",
"serverless-s3-local": "0.8.4",
"serverless-webpack": "5.14.0",
"sonar-scanner": "3.1.0",
"supertest": "6.3.3",
"ts-jest": "29.1.1",
"ts-loader": "9.4.4",
"ts-node": "10.9.1",
"typescript": "5.1.6",
"webpack": "5.88.2",
"supertest": "7.0.0",
"ts-jest": "29.1.3",
"ts-loader": "9.5.1",
"ts-node": "10.9.2",
"typescript": "5.4.5",
"webpack": "5.91.0",
"webpack-node-externals": "3.0.0"
},
"author": "",
Expand Down
6 changes: 1 addition & 5 deletions scripts/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ module.exports = (async () => {
},
plugins: [
new ForkTsCheckerWebpackPlugin({
typescript: true,
eslint: {
enabled: false,
files: path.resolve(__dirname, '..', 'src/**/*.{ts,js}'),
},
typescript: {},
}),
],
};
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/domain/getCertificate.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { mockClient } from 'aws-sdk-client-mock';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import TestNumberError from '../../../src/errors/TestNumberError';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getCertificate from '../../../src/domain/getCertificate';
import IncorrectFileTypeError from '../../../src/errors/IncorrectFileTypeError';
import MissingBucketNameError from '../../../src/errors/MissingBucketNameError';
import MissingFolderNameError from '../../../src/errors/MissingFolderNameError';
import NoBodyError from '../../../src/errors/NoBodyError';
import TestNumberError from '../../../src/errors/TestNumberError';
import VinError from '../../../src/errors/VinError';
import CertificateDetails from '../../../src/interfaces/CertificateDetails';
import getCertificate from '../../../src/domain/getCertificate';
import IncorrectFileTypeError from '../../../src/errors/IncorrectFileTypeError';
import MissingFolderNameError from '../../../src/errors/MissingFolderNameError';

describe('getCertificate', () => {
it('returns an internal server error if the bucket is undefined', async () => {
Expand Down Expand Up @@ -77,7 +78,7 @@ describe('getCertificate', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

const event: CertificateDetails = {
testNumber: 'W10I02544',
Expand Down Expand Up @@ -132,7 +133,7 @@ describe('getCertificate', () => {
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('Certificate Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: CertificateDetails = {
testNumber: 'W10I02544',
Expand All @@ -154,7 +155,7 @@ describe('getCertificate', () => {
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('Certificate Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: CertificateDetails = {
testNumber: 'W10I02544',
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/domain/getFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { mockClient } from 'aws-sdk-client-mock';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import MissingBucketNameError from '../../../src/errors/MissingBucketNameError';
import NoBodyError from '../../../src/errors/NoBodyError';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getFile from '../../../src/domain/getFile';
import FileNameError from '../../../src/errors/FileNameError';
import IncorrectFileTypeError from '../../../src/errors/IncorrectFileTypeError';
import MissingBucketNameError from '../../../src/errors/MissingBucketNameError';
import MissingFolderNameError from '../../../src/errors/MissingFolderNameError';
import NoBodyError from '../../../src/errors/NoBodyError';
import FileDetails from '../../../src/interfaces/FileDetails';
import getFile from '../../../src/domain/getFile';
import FileNameError from '../../../src/errors/FileNameError';

describe('getFile', () => {
it('returns an internal server error if the bucket is undefined', async () => {
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('getFile', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

const event: FileDetails = {
fileName: 'adr_pass_123_2024-01-22T11:48:16.035Z',
Expand Down Expand Up @@ -112,7 +113,7 @@ describe('getFile', () => {

const body = Buffer.from('File Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: FileDetails = {
fileName: 'adr_pass_123_2024-01-22T11:48:16.035Z',
Expand All @@ -132,7 +133,7 @@ describe('getFile', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('File Content');
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: FileDetails = {
fileName: 'adr_pass_123_2024-01-22T11:48:16.035Z',
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/domain/getLetter.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { mockClient } from 'aws-sdk-client-mock';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getLetter from '../../../src/domain/getLetter';
import IncorrectFileTypeError from '../../../src/errors/IncorrectFileTypeError';
import MissingBucketNameError from '../../../src/errors/MissingBucketNameError';
import MissingFolderNameError from '../../../src/errors/MissingFolderNameError';
import NoBodyError from '../../../src/errors/NoBodyError';
import SystemNumberError from '../../../src/errors/SystemNumberError';
import VinError from '../../../src/errors/VinError';
import LetterDetails from '../../../src/interfaces/LetterDetails';
import IncorrectFileTypeError from '../../../src/errors/IncorrectFileTypeError';
import MissingFolderNameError from '../../../src/errors/MissingFolderNameError';
import getLetter from '../../../src/domain/getLetter';
import SystemNumberError from '../../../src/errors/SystemNumberError';

describe('getLetter', () => {
it('returns an internal server error if the bucket is undefined', async () => {
Expand Down Expand Up @@ -77,7 +78,7 @@ describe('getLetter', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

const event: LetterDetails = {
systemNumber: '123456',
Expand Down Expand Up @@ -132,7 +133,7 @@ describe('getLetter', () => {
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('Letter Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: LetterDetails = {
systemNumber: '123456',
Expand All @@ -154,7 +155,7 @@ describe('getLetter', () => {
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('Letter Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: LetterDetails = {
systemNumber: '123456',
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/domain/getPlate.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { mockClient } from 'aws-sdk-client-mock';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import MissingBucketNameError from '../../../src/errors/MissingBucketNameError';
import PlateSerialNumberError from '../../../src/errors/PlateSerialNumberError';
import NoBodyError from '../../../src/errors/NoBodyError';
import PlateDetails from '../../../src/interfaces/PlateDetails';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getPlate from '../../../src/domain/getPlate';
import IncorrectFileTypeError from '../../../src/errors/IncorrectFileTypeError';
import MissingBucketNameError from '../../../src/errors/MissingBucketNameError';
import MissingFolderNameError from '../../../src/errors/MissingFolderNameError';
import NoBodyError from '../../../src/errors/NoBodyError';
import PlateSerialNumberError from '../../../src/errors/PlateSerialNumberError';
import PlateDetails from '../../../src/interfaces/PlateDetails';

describe('getPlate', () => {
it('returns an internal server error if the bucket is undefined', async () => {
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('getPlate', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

const event: PlateDetails = {
plateSerialNumber: 'plate_123456',
Expand Down Expand Up @@ -114,7 +115,7 @@ describe('getPlate', () => {
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('Plate Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: PlateDetails = {
plateSerialNumber: 'plate_123456',
Expand All @@ -135,7 +136,7 @@ describe('getPlate', () => {
const sdkStream = sdkStreamMixin(stream);
const body = Buffer.from('Plate Content');

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });

const event: PlateDetails = {
plateSerialNumber: 'plate_123456',
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/infrastructure/s3/s3CertService.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getFromS3 from '../../../../src/infrastructure/s3/s3CertService';

describe('S3 Certificate Service', () => {
Expand Down Expand Up @@ -58,7 +59,7 @@ describe('S3 Certificate Service', () => {
const mockS3Client = mockClient(S3Client);
const s3 = new S3Client({});

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });
const responseBody = await getFromS3(s3, bucket, folder, certNumber, vin);

expect(await responseBody.transformToString()).toBe('Success!');
Expand All @@ -76,7 +77,7 @@ describe('S3 Certificate Service', () => {
stream.push('Success!');
stream.push(null);
const sdkStream = sdkStreamMixin(stream);
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

await expect(getFromS3(s3, bucket, folder, certNumber, vin)).rejects.toThrow();
});
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/infrastructure/s3/s3FileService.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getFromS3 from '../../../../src/infrastructure/s3/s3FileService';

describe('S3 File Service', () => {
Expand Down Expand Up @@ -53,7 +54,7 @@ describe('S3 File Service', () => {
const mockS3Client = mockClient(S3Client);
const s3 = new S3Client({});

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });
const responseBody = await getFromS3(s3, bucket, folder, fileName);

expect(await responseBody.transformToString()).toBe('Success!');
Expand All @@ -70,7 +71,7 @@ describe('S3 File Service', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

await expect(getFromS3(s3, bucket, folder, fileName)).rejects.toThrow();
});
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/infrastructure/s3/s3LetterService.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Readable } from 'stream';
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { StreamingBlobPayloadOutputTypes } from '@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types';
import { sdkStreamMixin } from '@smithy/util-stream';
import { mockClient } from 'aws-sdk-client-mock';
import { Readable } from 'stream';
import getFromS3 from '../../../../src/infrastructure/s3/s3LetterService';

describe('S3 Letter Service', () => {
Expand Down Expand Up @@ -60,7 +61,7 @@ describe('S3 Letter Service', () => {
const mockS3Client = mockClient(S3Client);
const s3 = new S3Client({});

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'application/octet-stream' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'application/octet-stream' });
const responseBody = await getFromS3(s3, bucket, folder, systemNumber, vin);

expect(await responseBody.transformToString()).toBe('Success!');
Expand All @@ -80,7 +81,7 @@ describe('S3 Letter Service', () => {
stream.push(null);
const sdkStream = sdkStreamMixin(stream);

mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream, ContentType: 'image/jpg' });
mockS3Client.on(GetObjectCommand).resolves({ Body: sdkStream as StreamingBlobPayloadOutputTypes, ContentType: 'image/jpg' });

await expect(getFromS3(s3, bucket, folder, systemNumber, vin)).rejects.toThrow();
});
Expand Down
Loading
Loading