Skip to content

Latest commit

 

History

History
224 lines (151 loc) · 5.66 KB

CHANGELOG.md

File metadata and controls

224 lines (151 loc) · 5.66 KB

Changelog

This changelog follows the keep a changelog format to maintain a human readable changelog.

0.3.1 (2024-04-21)

Changed

  • Added missing @OnDisconnecting() export to index

0.3.0 (2024-04-21)

Breaking Changes

  • Middlewares without a defined namespace are registered on all namespaces

Changed

  • glob package updated from 10.0.0 to 10.3.12
  • path-to-regexp package updated from 6.2.1 to 6.2.2
  • reflect-metadata package updated from 0.1.13 to 0.2.2
  • socket.io package updated from 4.5.4 to 4.7.5

0.2.0 (2023-04-10)

Breaking Changes

  • Replaced ScopedContainerGetterParams with SocketEventContext

    BEFORE:

    scopedContainerGetter: (args: ScopedContainerGetterParams) => {
      // ...
    }

    AFTER:

    scopedContainerGetter: (args: SocketEventContext) => {
      // ...
    }

    Note: The new interface contains all properties of the previous

Added

  • Added scoped container dispose support
  • Added interceptor support
  • Added ack support

Changed

  • glob package updated from 8.1.0 to 10.0.0

0.1.2 (2023-01-30)

Added

  • Added scoped controller support

    // create and run socket server
    const server = new SocketControllers({
      ...
      scopedContainerGetter: (args: ScopedContainerGetterParams) => {
        // Return a container instance to be used to instantiate 
        // the controllers and their dependencies on each event
      }
    });

0.1.1 (2023-01-27)

Added

  • Added @OnDisconnecting() decorator

  • Added error type filter option to @EmitOnFail() decorator

    Example: @EmitOnFail('message', {errorType: TypeError})

  • Added index option to @MessageBody() decorator to be able to get multiple event arguments

    Note: If you don't specify the index it will return the first

  • Added support to use the same namespace for multiple controllers

    Note: The namespaces must match exactly, providing a differnet pattern will not work due to a socket.io limitation

Changed

  • glob package updated from 8.0.3 to 8.1.0

0.1.0 (2023-01-18)

Breaking Changes

  • Removed createSocketServer() in favor of constructor initialization

    BEFORE:

    import { useSocketServer } from 'socket-controllers';
    import { Server } from 'socket.io';
    
    const io = new Server(PORT);
    useSocketServer(io);

    AFTER:

    import { SocketControllers } from "socket-controllers";
    import { Server } from "socket.io";
    
    const io = new Server(PORT);
    new SocketControllers({io: io, container: YOUR_DI_CONTAINER});
  • Removed createSocketServer() in favor of constructor initialization

    BEFORE:

    import { createSocketServer } from 'socket-controllers';
    
    const io = createSocketServer(PORT);

    AFTER:

    import { SocketControllers } from "socket-controllers";
    
    const server = new SocketControllers({port: PORT, container: YOUR_DI_CONTAINER});
    const io = server.io;
  • Removed useContainer() in favor of constructor initialization

    BEFORE:

    import { useContainer } from 'socket-controllers';
    import { Container } from 'typedi';
    
    useContainer(Container);

    AFTER:

    import { SocketControllers } from "socket-controllers";
    import { Container } from 'typedi';
    
    const server = new SocketControllers({port: PORT, container: Container});

    Note: DI container is not included anymore, you have to provide your own.

  • Changed initialization parameters

    Before:

    interface SocketControllersOptions {
      controllers?: Function[] | string[];
      middlewares?: Function[] | string[];
      useClassTransformer?: boolean;
      classToPlainTransformOptions?: ClassTransformOptions;
      plainToClassTransformOptions?: ClassTransformOptions;
    }

    After:

    interface SocketControllersOptions {
      container: { get<T>(someClass: { new (...args: any[]): T } | Function): T };
      io?: Server;
      port?: number;
      controllers?: Function[] | string[];
      middlewares?: Function[] | string[];
      transformOption?: Partial<{
        transform?: boolean;
        parameterTransformOptions?: ClassTransformOptions;
        resultTransformOptions?: ClassTransformOptions;
      }>;
    }
  • Changed class-transformer property name in decorators that support class-transformer

    Before: classTransformOptions?: ClassTransformOptions

    After: transformOptions?: ClassTransformOptions

Added

  • Namespace scope support for middlewares
  • transform: boolean option to decorators that support class-transformer

Changed

  • class-transformer package updated from 0.1.6 to 0.5.1
  • path-to-regexp package updated from 3.0.0 to 6.2.1
  • reflect-metadata package updated from 0.1.10 to 0.1.13
  • socket.io package updated from 2.0.1 to 4.5.4
  • updated various dev dependencies

0.0.5 - 2020-02-04

Added

  • Added support dynamic namespace
  • Added NspParams, NspParam decorators to handle dynamic namespace name params
  • Allowed use function array for controllers and middlewares

Fixed

  • Import middlewares from directory