@smounters/imperium 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -0
  3. package/dist/core/app-tokens.d.ts +1 -1
  4. package/dist/core/application.d.ts +2 -2
  5. package/dist/core/application.js +2 -2
  6. package/dist/core/container.d.ts +2 -2
  7. package/dist/core/container.js +7 -7
  8. package/dist/core/index.d.ts +5 -5
  9. package/dist/core/index.js +4 -4
  10. package/dist/core/logger.d.ts +1 -1
  11. package/dist/core/reflector.d.ts +1 -1
  12. package/dist/core/reflector.js +1 -1
  13. package/dist/core/server.d.ts +2 -2
  14. package/dist/core/server.js +6 -6
  15. package/dist/decorators/di.decorators.d.ts +1 -1
  16. package/dist/decorators/filters.decorators.d.ts +1 -1
  17. package/dist/decorators/filters.decorators.js +2 -2
  18. package/dist/decorators/guards.decorators.d.ts +1 -1
  19. package/dist/decorators/guards.decorators.js +1 -1
  20. package/dist/decorators/http.decorators.js +1 -1
  21. package/dist/decorators/index.d.ts +9 -9
  22. package/dist/decorators/index.js +9 -9
  23. package/dist/decorators/interceptors.decorators.d.ts +1 -1
  24. package/dist/decorators/interceptors.decorators.js +1 -1
  25. package/dist/decorators/metadata.decorators.d.ts +1 -1
  26. package/dist/decorators/pipes.decorators.d.ts +1 -1
  27. package/dist/decorators/pipes.decorators.js +1 -1
  28. package/dist/decorators/rpc.decorators.d.ts +1 -1
  29. package/dist/decorators/rpc.decorators.js +1 -1
  30. package/dist/decorators/ws.decorators.js +1 -1
  31. package/dist/http/adapter.d.ts +2 -2
  32. package/dist/http/adapter.js +5 -5
  33. package/dist/http/index.d.ts +3 -3
  34. package/dist/http/index.js +3 -3
  35. package/dist/http/router-builder.d.ts +1 -1
  36. package/dist/http/router-builder.js +2 -2
  37. package/dist/http/utils.d.ts +1 -1
  38. package/dist/http/utils.js +5 -5
  39. package/dist/pipes/index.d.ts +1 -1
  40. package/dist/pipes/index.js +1 -1
  41. package/dist/pipes/zod.pipe.d.ts +1 -1
  42. package/dist/rpc/adapter.d.ts +2 -2
  43. package/dist/rpc/adapter.js +5 -5
  44. package/dist/rpc/index.d.ts +4 -4
  45. package/dist/rpc/index.js +4 -4
  46. package/dist/rpc/router-builder.d.ts +1 -1
  47. package/dist/rpc/router-builder.js +3 -3
  48. package/dist/rpc/streaming-adapter.d.ts +2 -2
  49. package/dist/rpc/streaming-adapter.js +5 -5
  50. package/dist/rpc/utils.d.ts +1 -1
  51. package/dist/rpc/utils.js +5 -5
  52. package/dist/services/config.service.js +2 -2
  53. package/dist/services/index.d.ts +2 -2
  54. package/dist/services/index.js +2 -2
  55. package/dist/services/logger.service.d.ts +1 -1
  56. package/dist/services/logger.service.js +2 -2
  57. package/dist/validation/app-config.js +1 -1
  58. package/dist/validation/index.d.ts +2 -2
  59. package/dist/validation/index.js +2 -2
  60. package/dist/ws/adapter.d.ts +2 -2
  61. package/dist/ws/adapter.js +4 -4
  62. package/dist/ws/index.d.ts +3 -3
  63. package/dist/ws/index.js +2 -2
  64. package/dist/ws/router-builder.d.ts +1 -1
  65. package/dist/ws/router-builder.js +2 -2
  66. package/package.json +13 -44
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to `@smounters/imperium` are documented in this file.
4
4
 
5
+ ## 1.1.3 - 2026-03-30
6
+
7
+ ### Added
8
+ - VitePress documentation for `@smounters/imperium-cron` and `@smounters/imperium-events`.
9
+ - Integration tests (16 tests across HTTP, guards, WebSocket, lifecycle).
10
+ - ESM compatibility: all relative imports use `.js` extensions.
11
+
12
+ ### Changed
13
+ - Migrated to `typescript-eslint` unified package with type-checked rules.
14
+ - Modernized ESLint config (`recommendedTypeChecked` + `stylisticTypeChecked`).
15
+ - Fixed floating promises, redundant types, unused imports.
16
+ - Rewritten README for external users.
17
+ - Monorepo restructure with pnpm workspaces.
18
+
5
19
  ## 1.1.0 - 2026-03-29
6
20
 
7
21
  ### Added
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  NestJS-inspired modular DI framework for TypeScript services. Unified HTTP + ConnectRPC + WebSocket server on a single Fastify instance.
4
4
 
5
+ Part of the [Imperium monorepo](https://github.com/smounters/imperium). See also: [`@smounters/imperium-cron`](https://www.npmjs.com/package/@smounters/imperium-cron).
6
+
5
7
  ## Features
6
8
 
7
9
  - **Module system** with `@Module`, `@Injectable`, guards, pipes, interceptors, filters
@@ -1,4 +1,4 @@
1
- import type { ExceptionFilterLike, GuardLike, InjectionToken, InterceptorLike, PipeLike } from "../types";
1
+ import type { ExceptionFilterLike, GuardLike, InjectionToken, InterceptorLike, PipeLike } from "../types.js";
2
2
  export declare const APP_GUARD: InjectionToken<GuardLike>;
3
3
  export declare const APP_INTERCEPTOR: InjectionToken<InterceptorLike>;
4
4
  export declare const APP_PIPE: InjectionToken<PipeLike>;
@@ -1,7 +1,7 @@
1
1
  import type { FastifyInstance } from "fastify";
2
- import type { InjectionToken, LoggerOptions, ModuleImport, ServerOptions } from "../types";
2
+ import type { InjectionToken, LoggerOptions, ModuleImport, ServerOptions } from "../types.js";
3
3
  import type { ZodType, output } from "zod";
4
- import { AppContainer } from "./container";
4
+ import { AppContainer } from "./container.js";
5
5
  export declare class Application {
6
6
  private static readonly DEFAULT_SHUTDOWN_SIGNALS;
7
7
  private static readonly DEFAULT_SHUTDOWN_TIMEOUT_MS;
@@ -1,5 +1,5 @@
1
- import { AppContainer } from "./container";
2
- import { startServer } from "./server";
1
+ import { AppContainer } from "./container.js";
2
+ import { startServer } from "./server.js";
3
3
  export class Application {
4
4
  static { this.DEFAULT_SHUTDOWN_SIGNALS = ["SIGINT", "SIGTERM"]; }
5
5
  static { this.DEFAULT_SHUTDOWN_TIMEOUT_MS = 15_000; }
@@ -1,8 +1,8 @@
1
1
  import "reflect-metadata";
2
2
  import { type DependencyContainer } from "tsyringe";
3
- import type { Constructor, ExceptionFilterLike, GuardLike, InjectionToken, InterceptorLike, LoggerOptions, ModuleImport, PipeLike } from "../types";
3
+ import type { Constructor, ExceptionFilterLike, GuardLike, InjectionToken, InterceptorLike, LoggerOptions, ModuleImport, PipeLike } from "../types.js";
4
4
  import type { ZodType, output } from "zod";
5
- import { type AppLogger } from "./logger";
5
+ import { type AppLogger } from "./logger.js";
6
6
  export declare class AppContainer {
7
7
  private readonly root;
8
8
  private readonly loadedModules;
@@ -1,13 +1,13 @@
1
1
  import "reflect-metadata";
2
2
  import { container, Lifecycle } from "tsyringe";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
- import { MODULE_KEY } from "../decorators/di.decorators";
5
- import { WS_GATEWAY_KEY } from "../decorators/ws.decorators";
6
- import { ConfigService, LoggerService } from "../services";
7
- import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from "./app-tokens";
8
- import { CONFIG_TOKEN } from "./config";
9
- import { createLogger, LOGGER_TOKEN } from "./logger";
10
- import { Reflector } from "./reflector";
4
+ import { MODULE_KEY } from "../decorators/di.decorators.js";
5
+ import { WS_GATEWAY_KEY } from "../decorators/ws.decorators.js";
6
+ import { ConfigService, LoggerService } from "../services/index.js";
7
+ import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from "./app-tokens.js";
8
+ import { CONFIG_TOKEN } from "./config.js";
9
+ import { createLogger, LOGGER_TOKEN } from "./logger.js";
10
+ import { Reflector } from "./reflector.js";
11
11
  function isDynamicModule(value) {
12
12
  return typeof value === "object" && value !== null && "module" in value && typeof value.module === "function";
13
13
  }
@@ -1,5 +1,5 @@
1
- export { Application } from "./application";
2
- export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from "./app-tokens";
3
- export { BadRequestException, ForbiddenException, HttpException, InternalServerErrorException, NotFoundException, UnauthorizedException, } from "./errors";
4
- export { Reflector } from "./reflector";
5
- export type * from "../types";
1
+ export { Application } from "./application.js";
2
+ export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from "./app-tokens.js";
3
+ export { BadRequestException, ForbiddenException, HttpException, InternalServerErrorException, NotFoundException, UnauthorizedException, } from "./errors.js";
4
+ export { Reflector } from "./reflector.js";
5
+ export type * from "../types.js";
@@ -1,4 +1,4 @@
1
- export { Application } from "./application";
2
- export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from "./app-tokens";
3
- export { BadRequestException, ForbiddenException, HttpException, InternalServerErrorException, NotFoundException, UnauthorizedException, } from "./errors";
4
- export { Reflector } from "./reflector";
1
+ export { Application } from "./application.js";
2
+ export { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from "./app-tokens.js";
3
+ export { BadRequestException, ForbiddenException, HttpException, InternalServerErrorException, NotFoundException, UnauthorizedException, } from "./errors.js";
4
+ export { Reflector } from "./reflector.js";
@@ -1,5 +1,5 @@
1
1
  import { Logger } from "tslog";
2
- import type { LoggerOptions } from "../types";
2
+ import type { LoggerOptions } from "../types.js";
3
3
  type LoggerPayload = Record<string, unknown>;
4
4
  export type AppLogger = Logger<LoggerPayload>;
5
5
  export declare const LOGGER_TOKEN: unique symbol;
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import type { MetadataKey } from "../types";
2
+ import type { MetadataKey } from "../types.js";
3
3
  type MetadataTarget = object | Function | undefined;
4
4
  export declare class Reflector {
5
5
  get<T = unknown>(metadataKey: MetadataKey, target: MetadataTarget): T | undefined;
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import "reflect-metadata";
8
- import { Injectable } from "../decorators/di.decorators";
8
+ import { Injectable } from "../decorators/di.decorators.js";
9
9
  let Reflector = class Reflector {
10
10
  get(metadataKey, target) {
11
11
  if (!target) {
@@ -1,7 +1,7 @@
1
1
  import "reflect-metadata";
2
2
  import { type FastifyInstance } from "fastify";
3
- import type { ServerOptions } from "../types";
4
- import { AppContainer } from "./container";
3
+ import type { ServerOptions } from "../types.js";
4
+ import { AppContainer } from "./container.js";
5
5
  type LegacyServerOptions = ServerOptions & {
6
6
  di: AppContainer;
7
7
  };
@@ -2,12 +2,12 @@ import "reflect-metadata";
2
2
  import { fastifyConnectPlugin } from "@connectrpc/connect-fastify";
3
3
  import fastifyCors from "@fastify/cors";
4
4
  import Fastify from "fastify";
5
- import { HTTP_ROUTES_KEY } from "../decorators/http.decorators";
6
- import { RPC_METHODS_KEY, RPC_SERVICE_KEY } from "../decorators/rpc.decorators";
7
- import { registerHttpRoutes } from "../http";
8
- import { buildConnectRoutes } from "../rpc";
9
- import { registerWsGateways } from "../ws";
10
- import { AppContainer } from "./container";
5
+ import { HTTP_ROUTES_KEY } from "../decorators/http.decorators.js";
6
+ import { RPC_METHODS_KEY, RPC_SERVICE_KEY } from "../decorators/rpc.decorators.js";
7
+ import { registerHttpRoutes } from "../http/index.js";
8
+ import { buildConnectRoutes } from "../rpc/index.js";
9
+ import { registerWsGateways } from "../ws/index.js";
10
+ import { AppContainer } from "./container.js";
11
11
  function normalizePrefix(prefix) {
12
12
  if (!prefix) {
13
13
  return "";
@@ -1,6 +1,6 @@
1
1
  import "reflect-metadata";
2
2
  import { inject, injectAll, injectable, Lifecycle } from "tsyringe";
3
- import type { InjectionToken, ModuleMeta } from "../types";
3
+ import type { InjectionToken, ModuleMeta } from "../types.js";
4
4
  export declare const MODULE_KEY: unique symbol;
5
5
  export declare function Module(meta: ModuleMeta): ClassDecorator;
6
6
  export declare const Injectable: typeof injectable;
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import type { Constructor, ExceptionFilterLike } from "../types";
2
+ import type { Constructor, ExceptionFilterLike } from "../types.js";
3
3
  export declare const FILTERS_KEY: unique symbol;
4
4
  export declare const CATCH_EXCEPTIONS_KEY: unique symbol;
5
5
  export declare function UseFilters(...filters: ExceptionFilterLike[]): ClassDecorator & MethodDecorator;
@@ -1,6 +1,6 @@
1
1
  import "reflect-metadata";
2
- import { Injectable } from "./di.decorators";
3
- import { appendArrayMetadata } from "./metadata.decorators";
2
+ import { Injectable } from "./di.decorators.js";
3
+ import { appendArrayMetadata } from "./metadata.decorators.js";
4
4
  export const FILTERS_KEY = Symbol("filters");
5
5
  export const CATCH_EXCEPTIONS_KEY = Symbol("filter:exceptions");
6
6
  export function UseFilters(...filters) {
@@ -1,4 +1,4 @@
1
1
  import "reflect-metadata";
2
- import type { GuardLike } from "../types";
2
+ import type { GuardLike } from "../types.js";
3
3
  export declare const GUARDS_KEY: unique symbol;
4
4
  export declare function UseGuards(...guards: GuardLike[]): ClassDecorator & MethodDecorator;
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import { appendArrayMetadata } from "./metadata.decorators";
2
+ import { appendArrayMetadata } from "./metadata.decorators.js";
3
3
  export const GUARDS_KEY = Symbol("guards");
4
4
  export function UseGuards(...guards) {
5
5
  return (target, propertyKey) => {
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import { Injectable } from "./di.decorators";
2
+ import { Injectable } from "./di.decorators.js";
3
3
  export const HTTP_ROUTES_KEY = Symbol("http:routes");
4
4
  export const HTTP_CONTROLLER_KEY = Symbol("http:controller");
5
5
  export const PARAMS_KEY = Symbol("http:params");
@@ -1,9 +1,9 @@
1
- export { Inject, InjectAll, Injectable, Module, Optional, Scope } from "./di.decorators";
2
- export { Catch, UseFilters } from "./filters.decorators";
3
- export { UseGuards } from "./guards.decorators";
4
- export { Body, Delete, Get, Header, HttpController, Param, Patch, Post, Put, Query, Req, Res } from "./http.decorators";
5
- export { UseInterceptors } from "./interceptors.decorators";
6
- export { SetMetadata } from "./metadata.decorators";
7
- export { UsePipes } from "./pipes.decorators";
8
- export { RpcAbortSignal, RpcContext, RpcData, RpcHeader, RpcHeaders, RpcMethod, RpcService } from "./rpc.decorators";
9
- export { WsConnection, WsGateway, WsHandler, WsMessage, WsRequest } from "./ws.decorators";
1
+ export { Inject, InjectAll, Injectable, Module, Optional, Scope } from "./di.decorators.js";
2
+ export { Catch, UseFilters } from "./filters.decorators.js";
3
+ export { UseGuards } from "./guards.decorators.js";
4
+ export { Body, Delete, Get, Header, HttpController, Param, Patch, Post, Put, Query, Req, Res } from "./http.decorators.js";
5
+ export { UseInterceptors } from "./interceptors.decorators.js";
6
+ export { SetMetadata } from "./metadata.decorators.js";
7
+ export { UsePipes } from "./pipes.decorators.js";
8
+ export { RpcAbortSignal, RpcContext, RpcData, RpcHeader, RpcHeaders, RpcMethod, RpcService } from "./rpc.decorators.js";
9
+ export { WsConnection, WsGateway, WsHandler, WsMessage, WsRequest } from "./ws.decorators.js";
@@ -1,9 +1,9 @@
1
- export { Inject, InjectAll, Injectable, Module, Optional, Scope } from "./di.decorators";
2
- export { Catch, UseFilters } from "./filters.decorators";
3
- export { UseGuards } from "./guards.decorators";
4
- export { Body, Delete, Get, Header, HttpController, Param, Patch, Post, Put, Query, Req, Res } from "./http.decorators";
5
- export { UseInterceptors } from "./interceptors.decorators";
6
- export { SetMetadata } from "./metadata.decorators";
7
- export { UsePipes } from "./pipes.decorators";
8
- export { RpcAbortSignal, RpcContext, RpcData, RpcHeader, RpcHeaders, RpcMethod, RpcService } from "./rpc.decorators";
9
- export { WsConnection, WsGateway, WsHandler, WsMessage, WsRequest } from "./ws.decorators";
1
+ export { Inject, InjectAll, Injectable, Module, Optional, Scope } from "./di.decorators.js";
2
+ export { Catch, UseFilters } from "./filters.decorators.js";
3
+ export { UseGuards } from "./guards.decorators.js";
4
+ export { Body, Delete, Get, Header, HttpController, Param, Patch, Post, Put, Query, Req, Res } from "./http.decorators.js";
5
+ export { UseInterceptors } from "./interceptors.decorators.js";
6
+ export { SetMetadata } from "./metadata.decorators.js";
7
+ export { UsePipes } from "./pipes.decorators.js";
8
+ export { RpcAbortSignal, RpcContext, RpcData, RpcHeader, RpcHeaders, RpcMethod, RpcService } from "./rpc.decorators.js";
9
+ export { WsConnection, WsGateway, WsHandler, WsMessage, WsRequest } from "./ws.decorators.js";
@@ -1,4 +1,4 @@
1
1
  import "reflect-metadata";
2
- import type { InterceptorLike } from "../types";
2
+ import type { InterceptorLike } from "../types.js";
3
3
  export declare const INTERCEPTORS_KEY: unique symbol;
4
4
  export declare function UseInterceptors(...inters: InterceptorLike[]): ClassDecorator & MethodDecorator;
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import { appendArrayMetadata } from "./metadata.decorators";
2
+ import { appendArrayMetadata } from "./metadata.decorators.js";
3
3
  export const INTERCEPTORS_KEY = Symbol("interceptors");
4
4
  export function UseInterceptors(...inters) {
5
5
  return (target, propertyKey) => {
@@ -1,4 +1,4 @@
1
1
  import "reflect-metadata";
2
- import type { MetadataKey } from "../types";
2
+ import type { MetadataKey } from "../types.js";
3
3
  export declare function SetMetadata<T = unknown>(metadataKey: MetadataKey, metadataValue: T): ClassDecorator & MethodDecorator;
4
4
  export declare function appendArrayMetadata<T>(metadataKey: MetadataKey, values: readonly T[], target: object, propertyKey?: string | symbol): void;
@@ -1,4 +1,4 @@
1
1
  import "reflect-metadata";
2
- import type { PipeLike } from "../types";
2
+ import type { PipeLike } from "../types.js";
3
3
  export declare const PIPES_KEY: unique symbol;
4
4
  export declare function UsePipes(...pipes: PipeLike[]): ClassDecorator & MethodDecorator;
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import { appendArrayMetadata } from "./metadata.decorators";
2
+ import { appendArrayMetadata } from "./metadata.decorators.js";
3
3
  export const PIPES_KEY = Symbol("pipes");
4
4
  export function UsePipes(...pipes) {
5
5
  return (target, propertyKey) => {
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import type { RpcMethodDescriptor, RpcServiceDescriptor } from "../core/types";
2
+ import type { RpcMethodDescriptor, RpcServiceDescriptor } from "../core/types.js";
3
3
  export declare const RPC_SERVICE_KEY: unique symbol;
4
4
  export declare const RPC_METHODS_KEY: unique symbol;
5
5
  export declare const RPC_PARAMS_KEY: unique symbol;
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import { Injectable } from "./di.decorators";
2
+ import { Injectable } from "./di.decorators.js";
3
3
  export const RPC_SERVICE_KEY = Symbol("rpc:service");
4
4
  export const RPC_METHODS_KEY = Symbol("rpc:methods");
5
5
  export const RPC_PARAMS_KEY = Symbol("rpc:params");
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import { Injectable } from "./di.decorators";
2
+ import { Injectable } from "./di.decorators.js";
3
3
  export const WS_GATEWAY_KEY = Symbol("ws:gateway");
4
4
  export const WS_HANDLERS_KEY = Symbol("ws:handlers");
5
5
  export const WS_PARAMS_KEY = Symbol("ws:params");
@@ -1,4 +1,4 @@
1
1
  import type { FastifyReply, FastifyRequest } from "fastify";
2
- import type { AppContainer } from "../core/container";
3
- import type { Constructor } from "../types";
2
+ import type { AppContainer } from "../core/container.js";
3
+ import type { Constructor } from "../types.js";
4
4
  export declare function createHttpHandler<TController extends Record<string, unknown>>(app: AppContainer, controller: Constructor<TController>, methodName: keyof TController & string): (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
@@ -1,8 +1,8 @@
1
- import { LoggerService } from "../services";
2
- import { ForbiddenException, toHttpError } from "../core/errors";
3
- import { CATCH_EXCEPTIONS_KEY } from "../decorators/filters.decorators";
4
- import { PARAMS_KEY } from "../decorators/http.decorators";
5
- import { collectFiltersForHttp, collectGuardsForHttp, collectInterceptorsForHttp, collectPipesForHttp } from "./utils";
1
+ import { LoggerService } from "../services/index.js";
2
+ import { ForbiddenException, toHttpError } from "../core/errors.js";
3
+ import { CATCH_EXCEPTIONS_KEY } from "../decorators/filters.decorators.js";
4
+ import { PARAMS_KEY } from "../decorators/http.decorators.js";
5
+ import { collectFiltersForHttp, collectGuardsForHttp, collectInterceptorsForHttp, collectPipesForHttp } from "./utils.js";
6
6
  function logHttpError(app, scope, details, error) {
7
7
  try {
8
8
  scope.resolve(LoggerService).error(details, error);
@@ -1,3 +1,3 @@
1
- export * from "./adapter";
2
- export * from "./router-builder";
3
- export * from "./utils";
1
+ export * from "./adapter.js";
2
+ export * from "./router-builder.js";
3
+ export * from "./utils.js";
@@ -1,3 +1,3 @@
1
- export * from "./adapter";
2
- export * from "./router-builder";
3
- export * from "./utils";
1
+ export * from "./adapter.js";
2
+ export * from "./router-builder.js";
3
+ export * from "./utils.js";
@@ -1,4 +1,4 @@
1
1
  import type { FastifyInstance } from "fastify";
2
2
  import "reflect-metadata";
3
- import type { AppContainer } from "../core/container";
3
+ import type { AppContainer } from "../core/container.js";
4
4
  export declare function registerHttpRoutes(server: FastifyInstance, di: AppContainer, globalPrefix?: string): void;
@@ -1,6 +1,6 @@
1
1
  import "reflect-metadata";
2
- import { HTTP_CONTROLLER_KEY, HTTP_ROUTES_KEY } from "../decorators/http.decorators";
3
- import { createHttpHandler } from "./adapter";
2
+ import { HTTP_CONTROLLER_KEY, HTTP_ROUTES_KEY } from "../decorators/http.decorators.js";
3
+ import { createHttpHandler } from "./adapter.js";
4
4
  function joinUrlPath(...segments) {
5
5
  const parts = segments
6
6
  .map((segment) => segment.trim())
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import type { Constructor, ExceptionFilterLike, GuardLike, InterceptorLike, PipeLike } from "../types";
2
+ import type { Constructor, ExceptionFilterLike, GuardLike, InterceptorLike, PipeLike } from "../types.js";
3
3
  export declare function collectGuardsForHttp(controller: Constructor, method: string, global: GuardLike[]): GuardLike[];
4
4
  export declare function collectInterceptorsForHttp(controller: Constructor, method: string, global: InterceptorLike[]): InterceptorLike[];
5
5
  export declare function collectPipesForHttp(controller: Constructor, method: string, global: PipeLike[]): PipeLike[];
@@ -1,9 +1,9 @@
1
1
  import "reflect-metadata";
2
- import { Reflector } from "../core/reflector";
3
- import { FILTERS_KEY } from "../decorators/filters.decorators";
4
- import { GUARDS_KEY } from "../decorators/guards.decorators";
5
- import { INTERCEPTORS_KEY } from "../decorators/interceptors.decorators";
6
- import { PIPES_KEY } from "../decorators/pipes.decorators";
2
+ import { Reflector } from "../core/reflector.js";
3
+ import { FILTERS_KEY } from "../decorators/filters.decorators.js";
4
+ import { GUARDS_KEY } from "../decorators/guards.decorators.js";
5
+ import { INTERCEPTORS_KEY } from "../decorators/interceptors.decorators.js";
6
+ import { PIPES_KEY } from "../decorators/pipes.decorators.js";
7
7
  const reflector = new Reflector();
8
8
  function enhancerKey(value) {
9
9
  if (typeof value === "function") {
@@ -1 +1 @@
1
- export * from "./zod.pipe";
1
+ export * from "./zod.pipe.js";
@@ -1 +1 @@
1
- export * from "./zod.pipe";
1
+ export * from "./zod.pipe.js";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { PipeTransform } from "../types";
2
+ import type { PipeTransform } from "../types.js";
3
3
  export declare class ZodPipe<TSchema extends z.ZodType> implements PipeTransform<unknown, z.infer<TSchema>> {
4
4
  private schema;
5
5
  constructor(schema: TSchema);
@@ -1,7 +1,7 @@
1
1
  import type { HandlerContext } from "@connectrpc/connect";
2
2
  import "reflect-metadata";
3
- import type { AppContainer } from "../core/container";
4
- import type { Constructor } from "../types";
3
+ import type { AppContainer } from "../core/container.js";
4
+ import type { Constructor } from "../types.js";
5
5
  type RpcResponse = Record<string, unknown>;
6
6
  export declare function createRpcHandler<TController extends Record<string, unknown>>(app: AppContainer, controller: Constructor<TController>, methodName: keyof TController & string): (req: unknown, context: HandlerContext) => Promise<RpcResponse>;
7
7
  export {};
@@ -1,9 +1,9 @@
1
1
  import "reflect-metadata";
2
- import { ForbiddenException, toConnectError } from "../core/errors";
3
- import { CATCH_EXCEPTIONS_KEY } from "../decorators/filters.decorators";
4
- import { RPC_PARAMS_KEY } from "../decorators/rpc.decorators";
5
- import { LoggerService } from "../services";
6
- import { collectFiltersForRpc, collectGuardsForRpc, collectInterceptorsForRpc, collectPipesForRpc } from "./utils";
2
+ import { ForbiddenException, toConnectError } from "../core/errors.js";
3
+ import { CATCH_EXCEPTIONS_KEY } from "../decorators/filters.decorators.js";
4
+ import { RPC_PARAMS_KEY } from "../decorators/rpc.decorators.js";
5
+ import { LoggerService } from "../services/index.js";
6
+ import { collectFiltersForRpc, collectGuardsForRpc, collectInterceptorsForRpc, collectPipesForRpc } from "./utils.js";
7
7
  function logRpcError(app, scope, details, error) {
8
8
  try {
9
9
  scope.resolve(LoggerService).error(details, error);
@@ -1,4 +1,4 @@
1
- export * from "./adapter";
2
- export * from "./streaming-adapter";
3
- export * from "./router-builder";
4
- export * from "./utils";
1
+ export * from "./adapter.js";
2
+ export * from "./streaming-adapter.js";
3
+ export * from "./router-builder.js";
4
+ export * from "./utils.js";
package/dist/rpc/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./adapter";
2
- export * from "./streaming-adapter";
3
- export * from "./router-builder";
4
- export * from "./utils";
1
+ export * from "./adapter.js";
2
+ export * from "./streaming-adapter.js";
3
+ export * from "./router-builder.js";
4
+ export * from "./utils.js";
@@ -1,4 +1,4 @@
1
1
  import type { ConnectRouter } from "@connectrpc/connect";
2
2
  import "reflect-metadata";
3
- import type { AppContainer } from "../core/container";
3
+ import type { AppContainer } from "../core/container.js";
4
4
  export declare function buildConnectRoutes(di: AppContainer): (router: ConnectRouter) => void;
@@ -1,7 +1,7 @@
1
1
  import "reflect-metadata";
2
- import { RPC_METHODS_KEY, RPC_SERVICE_KEY } from "../decorators/rpc.decorators";
3
- import { createRpcHandler } from "./adapter";
4
- import { createStreamingRpcHandler } from "./streaming-adapter";
2
+ import { RPC_METHODS_KEY, RPC_SERVICE_KEY } from "../decorators/rpc.decorators.js";
3
+ import { createRpcHandler } from "./adapter.js";
4
+ import { createStreamingRpcHandler } from "./streaming-adapter.js";
5
5
  export function buildConnectRoutes(di) {
6
6
  return (router) => {
7
7
  for (const ctrl of di.getControllers()) {
@@ -1,5 +1,5 @@
1
1
  import type { HandlerContext } from "@connectrpc/connect";
2
2
  import "reflect-metadata";
3
- import type { AppContainer } from "../core/container";
4
- import type { Constructor } from "../types";
3
+ import type { AppContainer } from "../core/container.js";
4
+ import type { Constructor } from "../types.js";
5
5
  export declare function createStreamingRpcHandler<TController extends Record<string, unknown>>(app: AppContainer, controller: Constructor<TController>, methodName: keyof TController & string): (req: unknown, context: HandlerContext) => AsyncIterable<unknown>;
@@ -1,9 +1,9 @@
1
1
  import "reflect-metadata";
2
- import { ForbiddenException, toConnectError } from "../core/errors";
3
- import { CATCH_EXCEPTIONS_KEY } from "../decorators/filters.decorators";
4
- import { RPC_PARAMS_KEY } from "../decorators/rpc.decorators";
5
- import { LoggerService } from "../services";
6
- import { collectFiltersForRpc, collectGuardsForRpc, collectPipesForRpc } from "./utils";
2
+ import { ForbiddenException, toConnectError } from "../core/errors.js";
3
+ import { CATCH_EXCEPTIONS_KEY } from "../decorators/filters.decorators.js";
4
+ import { RPC_PARAMS_KEY } from "../decorators/rpc.decorators.js";
5
+ import { LoggerService } from "../services/index.js";
6
+ import { collectFiltersForRpc, collectGuardsForRpc, collectPipesForRpc } from "./utils.js";
7
7
  function logRpcError(app, scope, details, error) {
8
8
  try {
9
9
  scope.resolve(LoggerService).error(details, error);
@@ -1,5 +1,5 @@
1
1
  import "reflect-metadata";
2
- import type { Constructor, ExceptionFilterLike, GuardLike, InterceptorLike, PipeLike } from "../types";
2
+ import type { Constructor, ExceptionFilterLike, GuardLike, InterceptorLike, PipeLike } from "../types.js";
3
3
  export declare function collectGuardsForRpc(controller: Constructor, method: string, global: GuardLike[]): GuardLike[];
4
4
  export declare function collectInterceptorsForRpc(controller: Constructor, method: string, global: InterceptorLike[]): InterceptorLike[];
5
5
  export declare function collectPipesForRpc(controller: Constructor, method: string, global: PipeLike[]): PipeLike[];
package/dist/rpc/utils.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import "reflect-metadata";
2
- import { Reflector } from "../core/reflector";
3
- import { FILTERS_KEY } from "../decorators/filters.decorators";
4
- import { GUARDS_KEY } from "../decorators/guards.decorators";
5
- import { INTERCEPTORS_KEY } from "../decorators/interceptors.decorators";
6
- import { PIPES_KEY } from "../decorators/pipes.decorators";
2
+ import { Reflector } from "../core/reflector.js";
3
+ import { FILTERS_KEY } from "../decorators/filters.decorators.js";
4
+ import { GUARDS_KEY } from "../decorators/guards.decorators.js";
5
+ import { INTERCEPTORS_KEY } from "../decorators/interceptors.decorators.js";
6
+ import { PIPES_KEY } from "../decorators/pipes.decorators.js";
7
7
  const reflector = new Reflector();
8
8
  function enhancerKey(value) {
9
9
  if (typeof value === "function") {
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
- import { CONFIG_TOKEN } from "../core/config";
14
- import { Inject, Injectable } from "../decorators";
13
+ import { CONFIG_TOKEN } from "../core/config.js";
14
+ import { Inject, Injectable } from "../decorators/index.js";
15
15
  let ConfigService = class ConfigService {
16
16
  constructor(config) {
17
17
  this.config = config;
@@ -1,2 +1,2 @@
1
- export * from "./config.service";
2
- export * from "./logger.service";
1
+ export * from "./config.service.js";
2
+ export * from "./logger.service.js";
@@ -1,2 +1,2 @@
1
- export * from "./config.service";
2
- export * from "./logger.service";
1
+ export * from "./config.service.js";
2
+ export * from "./logger.service.js";
@@ -1,4 +1,4 @@
1
- import { type AppLogger } from "../core/logger";
1
+ import { type AppLogger } from "../core/logger.js";
2
2
  export declare class LoggerService {
3
3
  private readonly logger;
4
4
  constructor(logger: AppLogger);
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
- import { LOGGER_TOKEN } from "../core/logger";
14
- import { Inject, Injectable } from "../decorators";
13
+ import { LOGGER_TOKEN } from "../core/logger.js";
14
+ import { Inject, Injectable } from "../decorators/index.js";
15
15
  let LoggerService = class LoggerService {
16
16
  constructor(logger) {
17
17
  this.logger = logger;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { booleanSchema, numberSchema, stringArraySchema } from "./common";
2
+ import { booleanSchema, numberSchema, stringArraySchema } from "./common.js";
3
3
  const LOG_LEVELS = ["silly", "trace", "debug", "info", "warn", "error", "fatal"];
4
4
  const LOG_TYPES = ["pretty", "json"];
5
5
  export const appConfigSchema = z.object({
@@ -1,2 +1,2 @@
1
- export * from "./app-config";
2
- export * from "./common";
1
+ export * from "./app-config.js";
2
+ export * from "./common.js";
@@ -1,2 +1,2 @@
1
- export * from "./app-config";
2
- export * from "./common";
1
+ export * from "./app-config.js";
2
+ export * from "./common.js";
@@ -1,6 +1,6 @@
1
1
  import type { FastifyRequest } from "fastify";
2
2
  import type { WebSocket } from "@fastify/websocket";
3
3
  import "reflect-metadata";
4
- import type { AppContainer } from "../core/container";
5
- import type { Constructor } from "../types";
4
+ import type { AppContainer } from "../core/container.js";
5
+ import type { Constructor } from "../types.js";
6
6
  export declare function handleWsConnection(app: AppContainer, gateway: Constructor, socket: WebSocket, request: FastifyRequest): void;
@@ -1,8 +1,8 @@
1
1
  import "reflect-metadata";
2
- import { GUARDS_KEY } from "../decorators/guards.decorators";
3
- import { WS_HANDLERS_KEY, WS_PARAMS_KEY } from "../decorators/ws.decorators";
4
- import { Reflector } from "../core/reflector";
5
- import { LoggerService } from "../services";
2
+ import { GUARDS_KEY } from "../decorators/guards.decorators.js";
3
+ import { WS_HANDLERS_KEY, WS_PARAMS_KEY } from "../decorators/ws.decorators.js";
4
+ import { Reflector } from "../core/reflector.js";
5
+ import { LoggerService } from "../services/index.js";
6
6
  const reflector = new Reflector();
7
7
  function collectGuardsForWs(gateway, app) {
8
8
  const classGuards = (reflector.get(GUARDS_KEY, gateway) ?? []);
@@ -1,3 +1,3 @@
1
- export { handleWsConnection } from "./adapter";
2
- export { registerWsGateways } from "./router-builder";
3
- export type { WsGatewayLifecycle, WsGatewayMeta, WsHandlerMeta, WsParamMeta, WsParamSource } from "./types";
1
+ export { handleWsConnection } from "./adapter.js";
2
+ export { registerWsGateways } from "./router-builder.js";
3
+ export type { WsGatewayLifecycle, WsGatewayMeta, WsHandlerMeta, WsParamMeta, WsParamSource } from "./types.js";
package/dist/ws/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { handleWsConnection } from "./adapter";
2
- export { registerWsGateways } from "./router-builder";
1
+ export { handleWsConnection } from "./adapter.js";
2
+ export { registerWsGateways } from "./router-builder.js";
@@ -1,4 +1,4 @@
1
1
  import type { FastifyInstance } from "fastify";
2
2
  import "reflect-metadata";
3
- import type { AppContainer } from "../core/container";
3
+ import type { AppContainer } from "../core/container.js";
4
4
  export declare function registerWsGateways(server: FastifyInstance, app: AppContainer): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import "reflect-metadata";
2
- import { WS_GATEWAY_KEY } from "../decorators/ws.decorators";
3
- import { handleWsConnection } from "./adapter";
2
+ import { WS_GATEWAY_KEY } from "../decorators/ws.decorators.js";
3
+ import { handleWsConnection } from "./adapter.js";
4
4
  export async function registerWsGateways(server, app) {
5
5
  const gateways = app.getWsGateways();
6
6
  if (gateways.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smounters/imperium",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "NestJS-like modular DI container with unified HTTP + Connect RPC server for TypeScript",
5
5
  "keywords": [
6
6
  "di",
@@ -48,31 +48,13 @@
48
48
  },
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "git+https://github.com/smounters/imperium.git"
52
- },
53
- "bugs": {
54
- "url": "https://github.com/smounters/imperium/issues"
51
+ "url": "git+https://github.com/smounters/imperium.git",
52
+ "directory": "packages/imperium"
55
53
  },
56
54
  "homepage": "https://smounters.github.io/imperium/",
57
55
  "engines": {
58
56
  "node": ">=20.0.0"
59
57
  },
60
- "scripts": {
61
- "build": "pnpm exec tsc -p tsconfig.json",
62
- "typecheck": "pnpm exec tsc -p tsconfig.json --noEmit",
63
- "lint": "eslint \"src/**/*.{ts,tsx}\"",
64
- "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
65
- "format": "prettier . --write",
66
- "format:check": "prettier . --check",
67
- "test": "vitest run",
68
- "test:watch": "vitest",
69
- "clean": "rm -rf dist",
70
- "docs:dev": "pnpm exec vitepress dev docs",
71
- "docs:build": "pnpm exec vitepress build docs",
72
- "docs:preview": "pnpm exec vitepress preview docs",
73
- "prepack": "pnpm run clean && pnpm run build",
74
- "prepublishOnly": "pnpm run clean && pnpm run build"
75
- },
76
58
  "peerDependencies": {
77
59
  "@connectrpc/connect": "^2.1.1",
78
60
  "@connectrpc/connect-fastify": "^2.1.1",
@@ -90,27 +72,14 @@
90
72
  "optional": true
91
73
  }
92
74
  },
93
- "devDependencies": {
94
- "@connectrpc/connect": "^2.1.1",
95
- "@connectrpc/connect-fastify": "^2.1.1",
96
- "@eslint/js": "^10.0.1",
97
- "@fastify/cors": "^11.2.0",
98
- "@fastify/websocket": "^11.2.0",
99
- "@types/node": "^25.5.0",
100
- "@types/ws": "^8.18.1",
101
- "eslint": "^10.1.0",
102
- "eslint-config-prettier": "^10.1.8",
103
- "fastify": "^5.8.4",
104
- "prettier": "^3.8.1",
105
- "reflect-metadata": "^0.2.2",
106
- "tslog": "^4.10.2",
107
- "tsyringe": "^4.10.0",
108
- "typescript": "^5.9.3",
109
- "typescript-eslint": "^8.57.2",
110
- "vite": "^8.0.3",
111
- "vitepress": "^1.6.4",
112
- "vitest": "^4.1.2",
113
- "ws": "^8.20.0",
114
- "zod": "^4.3.6"
75
+ "scripts": {
76
+ "build": "tsc -p tsconfig.json",
77
+ "typecheck": "tsc -p tsconfig.json --noEmit",
78
+ "lint": "eslint \"src/**/*.ts\"",
79
+ "lint:fix": "eslint \"src/**/*.ts\" --fix",
80
+ "test": "vitest run",
81
+ "clean": "rm -rf dist",
82
+ "docs:dev": "vitepress dev docs",
83
+ "docs:build": "vitepress build docs"
115
84
  }
116
- }
85
+ }