nesties 1.1.9 → 1.1.11

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.
@@ -1,22 +1,17 @@
1
1
  import { ExecutionContext } from '@nestjs/common';
2
2
  import { I18nModuleOptions } from './i18n-module.options';
3
- import { I18nMiddleware } from './i18n-middleware.type';
4
3
  import { ModuleRef } from '@nestjs/core';
5
- export declare class I18nService {
6
- private options;
4
+ import { I18n } from 'nfkit';
5
+ import { I18nNesties } from './i18n.types';
6
+ export declare class I18nService extends I18n<I18nNesties.Ex> {
7
+ private i18nServiceOptions;
7
8
  private moduleRef;
8
- constructor(options: I18nModuleOptions, moduleRef: ModuleRef);
9
- private resolver;
10
- private locales;
11
- private defaultLocale;
12
- private middlewares;
13
- middleware(mw: I18nMiddleware, prior?: boolean): void;
9
+ constructor(i18nServiceOptions: I18nModuleOptions, moduleRef: ModuleRef);
10
+ private _shadowMiddlewareMap;
14
11
  private logger;
15
- private buildFallbackChain;
16
- private applyMiddlewares;
17
- getExactLocale(locale: string): string;
12
+ middleware(mw: I18nNesties.Middleware, prior?: boolean): this;
13
+ removeMiddleware(mw: I18nNesties.Middleware): this;
14
+ private resolver;
18
15
  getExactLocaleFromRequest(ctx: ExecutionContext): Promise<string>;
19
- translateString(locale: string, text: string, ctx?: ExecutionContext): Promise<string>;
20
- translate<T>(locale: string, obj: T, ctx?: ExecutionContext): Promise<T>;
21
16
  translateRequest(ctx: ExecutionContext, obj: any): Promise<any>;
22
17
  }
@@ -0,0 +1,6 @@
1
+ import { ExecutionContext } from '@nestjs/common';
2
+ import { I18nMiddleware } from 'nfkit';
3
+ export declare namespace I18nNesties {
4
+ type Ex = [ctx?: ExecutionContext];
5
+ type Middleware = I18nMiddleware<Ex>;
6
+ }
@@ -4,6 +4,5 @@ export * from './i18n.module';
4
4
  export * from './i18n-decorator';
5
5
  export * from './i18n-factory';
6
6
  export * from './i18n.interceptor';
7
- export * from './i18n-middleware.type';
8
7
  export * from './middlewares';
9
8
  export * from './locale.pipe';
@@ -1,9 +1,4 @@
1
- import { I18nMiddleware } from '../i18n-middleware.type';
2
- import { Awaitable } from '../../utility/awaitable';
3
- import { ExecutionContext } from '@nestjs/common';
4
- export type I18nDictionary = Record<string, Record<string, string>>;
5
- type MatchType = 'exact' | 'hierarchy' | 'startsWith';
6
- export declare const I18nLookupMiddleware: (dict: I18nDictionary | ((locale: string, key: string, ctx?: ExecutionContext) => Awaitable<I18nDictionary>), options?: {
7
- matchType?: MatchType;
8
- }) => I18nMiddleware;
9
- export {};
1
+ import { I18nNesties } from '../i18n.types';
2
+ export declare const I18nLookupMiddleware: (dict: import("nfkit").I18nDictionary | ((locale: string, key: string, ctx?: import("@nestjs/common").ExecutionContext) => import("nfkit").Awaitable<import("nfkit").I18nDictionary>), options?: {
3
+ matchType?: "startsWith" | "exact" | "hierarchy";
4
+ }) => import("nfkit").I18nMiddleware<I18nNesties.Ex>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nesties",
3
3
  "description": "Nest.js utilities",
4
- "version": "1.1.9",
4
+ "version": "1.1.11",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
@@ -84,7 +84,7 @@
84
84
  "rxjs": ">=7.0.0"
85
85
  },
86
86
  "dependencies": {
87
- "nfkit": "^1.0.9",
87
+ "nfkit": "^1.0.10",
88
88
  "typed-reflector": "^1.0.13"
89
89
  }
90
90
  }
@@ -1,3 +0,0 @@
1
- import { ExecutionContext } from '@nestjs/common';
2
- import { Awaitable } from '../utility/awaitable';
3
- export type I18nMiddleware = (locale: string, key: string, next: () => Promise<string | undefined>, ctx?: ExecutionContext) => Awaitable<string | undefined>;