Skip to content

Commit

Permalink
Merge pull request #1687 from lukeautry/build
Browse files Browse the repository at this point in the history
fix: Build, chores
  • Loading branch information
WoH authored Sep 23, 2024
2 parents d17e4e5 + 879e560 commit 364288c
Show file tree
Hide file tree
Showing 24 changed files with 1,696 additions and 1,203 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^4.3.0",
"lerna": "^8.0.1",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"lerna": "^8.1.8",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"ts-node": "^10.9.2",
"typedoc": "^0.25.12"
"typedoc": "^0.26.7"
},
"resolutions": {
"typescript": "^5.2.2"
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@
"license": "MIT",
"dependencies": {
"@tsoa/runtime": "^6.4.0",
"@types/multer": "^1.4.11",
"@types/multer": "^1.4.12",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"handlebars": "^4.7.8",
"merge-anything": "^5.1.4",
"minimatch": "^9.0.1",
"ts-deepmerge": "^7.0.0",
"typescript": "^5.3.3",
"validator": "^13.11.0",
"yaml": "^2.4.1",
"ts-deepmerge": "^7.0.1",
"typescript": "^5.6.2",
"validator": "^13.12.0",
"yaml": "^2.5.1",
"yargs": "^17.7.1"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/minimatch": "^5.1.0",
"@types/node": "^18.0.0",
"@types/validator": "^13.11.7",
"@types/yargs": "^17.0.32",
"@types/validator": "^13.12.2",
"@types/yargs": "^17.0.33",
"copyfiles": "^2.4.1",
"rimraf": "^5.0.5"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/utils/swaggerUtils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const DEFAULT_REQUEST_MEDIA_TYPE = 'application/json';
export const DEFAULT_RESPONSE_MEDIA_TYPE = 'application/json';

export function getValue(type: 'string' | 'number' | 'integer' | 'boolean', member: unknown): string | number | boolean | null {
if (member === null) {
export function getValue(type: 'string' | 'number' | 'integer' | 'boolean' | undefined, member: unknown): string | number | boolean | null {
if (type == null || member == null) {
return null;
}

Expand Down
1 change: 1 addition & 0 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"skipLibCheck": true,
"strict": true
},
"exclude": ["src/routeGeneration/templates/**/*.hbs"],
Expand Down
14 changes: 7 additions & 7 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
"license": "MIT",
"dependencies": {
"@hapi/boom": "^10.0.1",
"@hapi/hapi": "^21.3.3",
"@hapi/hapi": "^21.3.10",
"@types/koa": "^2.15.0",
"@types/multer": "^1.4.11",
"express": "^4.18.3",
"reflect-metadata": "^0.2.1",
"validator": "^13.11.0"
"@types/multer": "^1.4.12",
"express": "^4.21.0",
"reflect-metadata": "^0.2.2",
"validator": "^13.12.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@types/validator": "^13.11.7",
"typescript": "^5.3.3"
"@types/validator": "^13.12.2",
"typescript": "^5.6.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsoa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@types/node": "^18.0.0",
"typescript": "^5.3.3"
"typescript": "^5.6.2"
},
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions tests/esm/integration/express.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import chai from 'chai';
const { expect } = chai;
import request from 'supertest';
import request, { Test } from 'supertest';
import { it, describe } from 'mocha';
import { app } from '../fixtures/express/server.js';
import type { TestModel } from '../fixtures/testModel.js';
import type TestAgent from 'supertest/lib/agent.js';

const basePath = '/v1';

Expand All @@ -19,7 +20,7 @@ describe('Express Server', () => {
return verifyRequest(verifyResponse, request => request.get(path), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
10 changes: 5 additions & 5 deletions tests/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
},
"engineStrict": true,
"devDependencies": {
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.6",
"@types/chai-as-promised": "^8.0.0",
"@types/mocha": "^10.0.8",
"@types/node": "^16.18.23",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"mocha": "^10.2.0",
"mocha": "^10.7.3",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.3.3"
"tslib": "^2.7.0",
"typescript": "^5.6.2"
}
}
9 changes: 5 additions & 4 deletions tests/integration/dynamic-controllers-express-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ValidateMapStringToNumber,
ValidateModel,
} from '../fixtures/testModel';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand Down Expand Up @@ -1097,12 +1098,12 @@ describe('Express Server', () => {
},
request => {
return request.get(basePath + '/ParameterTest/Header').set({
age: 45,
age: '45',
firstname: 'Tony',
gender: 'MALE',
human: true,
human: 'true',
last_name: 'Stark',
weight: 82.1,
weight: '82.1',
});
},
200,
Expand Down Expand Up @@ -1228,7 +1229,7 @@ describe('Express Server', () => {
return verifyRequest(verifyResponse, request => request.post(path).send(data), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/express-router-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'mocha';
import * as request from 'supertest';
import { app } from '../fixtures/express-router/server';
import { TestModel } from '../fixtures/testModel';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand All @@ -25,7 +26,7 @@ describe('Express Router Server', () => {
return verifyRequest(verifyResponse, request => request.get(path), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
11 changes: 9 additions & 2 deletions tests/integration/express-server-custom-multer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'mocha';
import { resolve } from 'path';
import * as request from 'supertest';
import { app } from '../fixtures/express/server';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand Down Expand Up @@ -169,15 +170,21 @@ describe('Express Server With custom multer', () => {
request =>
Object.keys(formData).reduce((req, key) => {
const values = [].concat(formData[key]);
values.forEach((v: any) => (v.startsWith('@') ? req.attach(key, resolve(__dirname, v.slice(1))) : req.field(key, v)));
values.forEach((v: string) => {
if (v.startsWith('@')) {
req.attach(key, resolve(__dirname, v.slice(1)));
} else {
req.field(key, v);
}
});
return req;
}, request.post(path)),
expectedStatus,
);
}
});

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/express-server-root-security.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'mocha';
import * as request from 'supertest';
import { app } from '../fixtures/express-root-security/server';
import { TestModel, UserResponseModel } from '../fixtures/testModel';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand Down Expand Up @@ -40,7 +41,7 @@ describe('Express Server with api_key Root Security', () => {
it('returns 401 for an invalid key', () => {
return verifyGetRequest(basePath + '/NoSecurity?access_token=invalid', emptyHandler, 401);
});

it('returns a model with a valid key', () => {
return verifyGetRequest(basePath + '/NoSecurity?access_token=abc123456', (_err, res) => {
const model = res.body as UserResponseModel;
Expand All @@ -54,7 +55,7 @@ describe('Express Server with api_key Root Security', () => {
return verifyRequest(verifyResponse, request => request.get(path), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
21 changes: 14 additions & 7 deletions tests/integration/express-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ValidateMapStringToNumber,
ValidateModel,
} from '../fixtures/testModel';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand Down Expand Up @@ -1295,12 +1296,12 @@ describe('Express Server', () => {
},
request => {
return request.get(basePath + '/ParameterTest/Header').set({
age: 45,
age: '45',
firstname: 'Tony',
gender: 'MALE',
human: true,
human: 'true',
last_name: 'Stark',
weight: 82.1,
weight: '82.1',
});
},
200,
Expand All @@ -1323,8 +1324,8 @@ describe('Express Server', () => {
return request.get(basePath + '/ParameterTest/Header').set({
age: 'asdf',
gender: 'male',
human: 123,
last_name: 123,
human: '123',
last_name: '123',
weight: 'hello',
});
},
Expand Down Expand Up @@ -1649,7 +1650,13 @@ describe('Express Server', () => {
request =>
Object.keys(formData).reduce((req, key) => {
const values = [].concat(formData[key]);
values.forEach((v: any) => (v.startsWith('@') ? req.attach(key, resolve(__dirname, v.slice(1))) : req.field(key, v)));
values.forEach((v: string) => {
if (v.startsWith('@')) {
req.attach(key, resolve(__dirname, v.slice(1)));
} else {
req.field(key, v);
}
});
return req;
}, request.post(path)),
expectedStatus,
Expand All @@ -1665,7 +1672,7 @@ describe('Express Server', () => {
return verifyRequest(verifyResponse, request => request.post(path).send(data), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
17 changes: 12 additions & 5 deletions tests/integration/hapi-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as request from 'supertest';
import { stateOf } from '../fixtures/controllers/middlewaresHapiController';
import { server } from '../fixtures/hapi/server';
import { Gender, GenericModel, GenericRequest, Model, ParameterTestModel, TestClassModel, TestModel, ValidateMapStringToAny, ValidateMapStringToNumber, ValidateModel } from '../fixtures/testModel';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand Down Expand Up @@ -1191,12 +1192,12 @@ describe('Hapi Server', () => {
},
request => {
return request.get(basePath + '/ParameterTest/Header').set({
age: 45,
age: '45',
firstname: 'Tony',
gender: 'MALE',
human: true,
human: 'true',
last_name: 'Stark',
weight: 82.1,
weight: '82.1',
});
},
200,
Expand Down Expand Up @@ -1532,7 +1533,13 @@ describe('Hapi Server', () => {
request =>
Object.keys(formData).reduce((req, key) => {
const values = [].concat(formData[key]);
values.forEach((v: any) => (v.startsWith('@') ? req.attach(key, resolve(__dirname, v.slice(1))) : req.field(key, v)));
values.forEach((v: string) => {
if (v.startsWith('@')) {
req.attach(key, resolve(__dirname, v.slice(1)));
} else {
req.field(key, v);
}
});
return req;
}, request.post(path)),
expectedStatus,
Expand All @@ -1548,7 +1555,7 @@ describe('Hapi Server', () => {
return verifyRequest(verifyResponse, request => request.post(path).send(data), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: any) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: any) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(server.listener))
.expect(expectedStatus)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/inversify-async-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'reflect-metadata';
import * as request from 'supertest';
import { app } from '../fixtures/inversify-async/server';
import { TestModel } from '../fixtures/testModel';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand All @@ -29,7 +30,7 @@ describe('Inversify async IoC Express Server', () => {
return verifyRequest(verifyResponse, request => request.get(path), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/inversify-dynamic-container.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'mocha';
import 'reflect-metadata';
import * as request from 'supertest';
import { app } from '../fixtures/inversify-dynamic-container/server';
import TestAgent = require('supertest/lib/agent');

const basePath = '/v1';

Expand All @@ -18,7 +19,7 @@ describe('Inversify Express Server Dynamic Container', () => {
return verifyRequest(verifyResponse, request => request.get(path), expectedStatus);
}

function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: request.SuperTest<any>) => request.Test, expectedStatus = 200) {
function verifyRequest(verifyResponse: (err: any, res: request.Response) => any, methodOperation: (request: TestAgent<request.Test>) => request.Test, expectedStatus = 200) {
return new Promise<void>((resolve, reject) => {
methodOperation(request(app))
.expect(expectedStatus)
Expand Down
Loading

0 comments on commit 364288c

Please sign in to comment.