Skip to content

Commit

Permalink
chore: bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
L2jLiga committed Oct 18, 2023
1 parent 4fdf597 commit be38da6
Show file tree
Hide file tree
Showing 45 changed files with 1,885 additions and 1,653 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.13.1, 16.x, 18.x, 19.x]
node-version: [20.x]

permissions:
checks: write
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- BREAKING: dropped Node.js 10, 12 and 14, minimal required is 16.13.1 LTS
- BREAKING: dropped Node.js 10-19, minimal required is 20.8.1 LTS
- BREAKING: bump minimal TS version to 5.0
- BREAKING: dropped Fastify v3 support
- BREAKING: moved dependency injection functionality into separate package
- BREAKING: dropped `getInstanceByToken` method
- BREAKING: bump minimal TS version to 4.7

## 3.x.y

Expand Down
12 changes: 6 additions & 6 deletions examples/async-initializer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"fastify": "^4.17.0",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4",
"@fastify-decorators/simple-di": "^4.0.0-next.4"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
18 changes: 9 additions & 9 deletions examples/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"@fastify/aws-lambda": "^3.2.0",
"fastify": "^4.17.0",
"@fastify/aws-lambda": "^3.3.0",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4",
"@fastify-decorators/simple-di": "^4.0.0-next.4"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"@vercel/ncc": "^0.36.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"@vercel/ncc": "^0.38.0",
"cross-env": "^7.0.3",
"jest": "^29.4.1",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"tslib": "^2.5.2",
"typescript": "^4.9.5"
"ts-jest": "^29.1.1",
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
14 changes: 7 additions & 7 deletions examples/controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"fastify": "^4.17.0",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4",
"@fastify-decorators/simple-di": "^4.0.0-next.4"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^5.0.4",
"undici": "^5.22.1"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2",
"undici": "^5.26.3"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
2 changes: 2 additions & 0 deletions examples/controllers/test/e2e/dependency-injection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { app } from '../../src/index.js';

const request = Undici.request;

// TODO : Rework with Fetch

describe('Controllers dependency injection tests', () => {
beforeAll(() => app.listen());
afterAll(() => app.close());
Expand Down
12 changes: 6 additions & 6 deletions examples/injecting-requests-in-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"fastify": "^4.17.0",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4",
"@fastify-decorators/simple-di": "^4.0.0-next.4"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
12 changes: 6 additions & 6 deletions examples/request-handlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"fastify": "^4.17.0",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^5.0.4"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
18 changes: 9 additions & 9 deletions examples/swagger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"@fastify/swagger": "^8.3.1",
"@fastify/swagger-ui": "^1.3.0",
"@fastify/swagger": "^8.12.0",
"@fastify/swagger-ui": "^1.10.1",
"@fastify-decorators/simple-di": "^4.0.0-next.4",
"@sinclair/typebox": "^0.31.8",
"fastify": "^4.17.0",
"@sinclair/typebox": "^0.31.17",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^5.0.4"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
12 changes: 6 additions & 6 deletions examples/typedi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"fastify": "^4.17.0",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4",
"@fastify-decorators/typedi": "^4.0.0-next.4",
"typedi": "^0.10.0"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^5.0.4"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
16 changes: 8 additions & 8 deletions examples/typeorm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
},
"dependencies": {
"@fastify/swagger": "^8.3.1",
"@fastify/swagger-ui": "^1.3.0",
"fastify": "^4.17.0",
"@fastify/swagger": "^8.12.0",
"@fastify/swagger-ui": "^1.10.1",
"fastify": "^4.24.2",
"fastify-decorators": "^4.0.0-next.4",
"@fastify-decorators/simple-di": "^4.0.0-next.4",
"sqlite3": "^5.1.6",
"typeorm": "^0.3.17"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/node": "~16.18.12",
"jest": "^29.4.1",
"@types/jest": "^29.5.5",
"@types/node": "~20.8.6",
"jest": "^29.7.0",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^29.0.5",
"typescript": "^5.0.4"
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"jest-junit": {
"outputDirectory": "../../test-results",
Expand Down
6 changes: 3 additions & 3 deletions lib/bootstrap/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://github.com/L2jLiga/fastify-decorators/blob/master/LICENSE
*/

import type { FastifyInstance, FastifyPluginAsync } from 'fastify';
import type { FastifyInstance } from 'fastify';
import fp from 'fastify-plugin';
import { lstatSync, opendirSync, PathLike } from 'node:fs';
import type { AutoLoadConfig } from '../interfaces/bootstrap-config.js';
Expand All @@ -18,8 +18,8 @@ import { isValidRegistrable } from '../utils/validators.js';

const defaultMask = /\.(handler|controller)\./;

export const bootstrap: FastifyPluginAsync<BootstrapConfig> = fp<BootstrapConfig>(
async (fastifyInstance, config) => {
export const bootstrap = fp<BootstrapConfig>(
async (fastifyInstance: FastifyInstance, config: BootstrapConfig): Promise<void> => {
// 1. Load all modules
const toBootstrap = new Set<Constructable>();
if ('directory' in config) await transformAndWait(autoLoadModules(config), toBootstrap.add.bind(toBootstrap));
Expand Down
5 changes: 3 additions & 2 deletions lib/decorators/error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { ensureErrorHandlers } from './helpers/class-properties.js';
export function ErrorHandler(): PropertyDecorator;
export function ErrorHandler(code: string): PropertyDecorator;
export function ErrorHandler<T extends Error>(configuration: Constructable<T>): PropertyDecorator;
export function ErrorHandler<T extends ErrorConstructor>(parameter?: T | string): PropertyDecorator {
return function ({ constructor }: { constructor: any }, handlerName: string | symbol) {
export function ErrorHandler<T extends ErrorConstructor>(configuration: T): PropertyDecorator;
export function ErrorHandler<T extends ErrorConstructor>(parameter?: T | string | null | undefined): PropertyDecorator {
return function ({ constructor }, handlerName) {
ensureErrorHandlers(constructor);

if (parameter == null) {
Expand Down
18 changes: 9 additions & 9 deletions lib/decorators/helpers/class-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { Constructable } from '../../plugins/index.js';
import { ERROR_HANDLERS, HANDLERS, HOOKS } from '../../symbols/index.js';
import { Container } from './container.js';

export function ensureHandlers(target: { [HANDLERS]?: Container<IHandler> }): asserts target is { [HANDLERS]: Container<IHandler> } {
if (!(target[HANDLERS] && Object.prototype.hasOwnProperty.call(target, HANDLERS))) {
export function ensureHandlers<T extends object>(target: T): asserts target is T & { [HANDLERS]: Container<IHandler> } {
if (!(HANDLERS in target && target[HANDLERS] && Object.prototype.hasOwnProperty.call(target, HANDLERS))) {
Reflect.defineProperty(target, HANDLERS, {
value: new Container(target[HANDLERS] as Container<IHandler>),
value: new Container((target as unknown as Record<typeof HANDLERS, Container<IHandler>>)[HANDLERS]),
enumerable: false,
configurable: false,
writable: false,
Expand All @@ -26,10 +26,10 @@ export function hasHandlers<Class extends Constructable>(target: Class): target
return HANDLERS in target;
}

export function ensureErrorHandlers(target: { [ERROR_HANDLERS]?: Container<IErrorHandler> }): asserts target is { [ERROR_HANDLERS]: Container<IErrorHandler> } {
if (!(target[ERROR_HANDLERS] && Object.prototype.hasOwnProperty.call(target, ERROR_HANDLERS))) {
export function ensureErrorHandlers<T extends object>(target: T): asserts target is T & { [ERROR_HANDLERS]: Container<IErrorHandler> } {
if (!(ERROR_HANDLERS in target && target[ERROR_HANDLERS] && Object.prototype.hasOwnProperty.call(target, ERROR_HANDLERS))) {
Reflect.defineProperty(target, ERROR_HANDLERS, {
value: new Container(target[ERROR_HANDLERS] as Container<IErrorHandler>),
value: new Container((target as unknown as Record<typeof ERROR_HANDLERS, Container<IErrorHandler>>)[ERROR_HANDLERS]),
enumerable: false,
configurable: false,
writable: false,
Expand All @@ -41,10 +41,10 @@ export function hasErrorHandlers<Class extends Constructable>(target: Class): ta
return ERROR_HANDLERS in target;
}

export function ensureHooks(target: { [HOOKS]?: Container<IHook> }): asserts target is { [HOOKS]: Container<IHook> } {
if (!(target[HOOKS] && Object.prototype.hasOwnProperty.call(target, HOOKS))) {
export function ensureHooks<T extends object>(target: T): asserts target is T & { [HOOKS]: Container<IHook> } {
if (!(HOOKS in target && target[HOOKS] && Object.prototype.hasOwnProperty.call(target, HOOKS))) {
Reflect.defineProperty(target, HOOKS, {
value: new Container(target[HOOKS] as Container<IHook>),
value: new Container((target as unknown as Record<typeof HOOKS, Container<IHook>>)[HOOKS]),
enumerable: false,
configurable: false,
writable: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/decorators/helpers/ensure-registrable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { Registrable } from '../../plugins/index.js';
import { CREATOR } from '../../symbols/index.js';

export function ensureRegistrable(target: unknown): asserts target is Registrable {
export function ensureRegistrable<OriginalType = unknown, CastAs = unknown>(target: OriginalType): asserts target is OriginalType & Registrable<CastAs> {
if (target instanceof Function) {
if (!(CREATOR in target) || target[CREATOR] == null) {
Object.defineProperty(target, CREATOR, { value: {} });
Expand Down
Loading

0 comments on commit be38da6

Please sign in to comment.