@nest-boot/i18n 8.0.7-beta.0 → 8.0.7-beta.2
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.
- package/dist/decorators/inject-i18n.decorator.d.ts +4 -1
- package/dist/decorators/inject-i18n.decorator.js +4 -1
- package/dist/decorators/inject-i18n.decorator.js.map +1 -1
- package/dist/i18n.middleware.d.ts +6 -3
- package/dist/i18n.middleware.js +6 -3
- package/dist/i18n.middleware.js.map +1 -1
- package/dist/i18n.module.d.ts +12 -3
- package/dist/i18n.module.js +12 -3
- package/dist/i18n.module.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { Inject } from "@nestjs/common";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Decorator that injects the i18next instance into a constructor parameter or property.
|
|
4
|
+
* @returns Nest dependency injection decorator for the i18next instance.
|
|
5
|
+
*/
|
|
3
6
|
export declare const InjectI18n: () => ReturnType<typeof Inject>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Inject } from "@nestjs/common";
|
|
2
2
|
import { I18N } from "../i18n.constants.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Decorator that injects the i18next instance into a constructor parameter or property.
|
|
5
|
+
* @returns Nest dependency injection decorator for the i18next instance.
|
|
6
|
+
*/
|
|
4
7
|
export const InjectI18n = () => Inject(I18N);
|
|
5
8
|
//# sourceMappingURL=inject-i18n.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-i18n.decorator.js","sourceRoot":"","sources":["../../src/decorators/inject-i18n.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"inject-i18n.decorator.js","sourceRoot":"","sources":["../../src/decorators/inject-i18n.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAA8B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -4,16 +4,19 @@ import type { I18nModuleOptions } from "./interfaces/i18n-module-options.interfa
|
|
|
4
4
|
/**
|
|
5
5
|
* Middleware that detects the request language and stores the i18n instance in the request context.
|
|
6
6
|
*
|
|
7
|
-
* @remarks
|
|
8
7
|
* Uses `i18next-http-middleware` for language detection from headers,
|
|
9
8
|
* cookies, or query parameters, then makes the i18n instance available
|
|
10
9
|
* via {@link RequestContext}.
|
|
11
10
|
*/
|
|
12
11
|
export declare class I18nMiddleware implements NestMiddleware {
|
|
13
12
|
readonly options: I18nModuleOptions;
|
|
14
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* i18next-http-middleware handler.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
15
17
|
private readonly handler;
|
|
16
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new I18nMiddleware instance.
|
|
17
20
|
* @param options - i18next initialization and middleware options
|
|
18
21
|
*/
|
|
19
22
|
constructor(options: I18nModuleOptions);
|
package/dist/i18n.middleware.js
CHANGED
|
@@ -19,16 +19,19 @@ import { MODULE_OPTIONS_TOKEN } from "./i18n.module-definition.js";
|
|
|
19
19
|
/**
|
|
20
20
|
* Middleware that detects the request language and stores the i18n instance in the request context.
|
|
21
21
|
*
|
|
22
|
-
* @remarks
|
|
23
22
|
* Uses `i18next-http-middleware` for language detection from headers,
|
|
24
23
|
* cookies, or query parameters, then makes the i18n instance available
|
|
25
24
|
* via {@link RequestContext}.
|
|
26
25
|
*/
|
|
27
26
|
let I18nMiddleware = class I18nMiddleware {
|
|
28
27
|
options;
|
|
29
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* i18next-http-middleware handler.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
30
32
|
handler;
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new I18nMiddleware instance.
|
|
32
35
|
* @param options - i18next initialization and middleware options
|
|
33
36
|
*/
|
|
34
37
|
constructor(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.middleware.js","sourceRoot":"","sources":["../src/i18n.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAC;AAEzE,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE
|
|
1
|
+
{"version":3,"file":"i18n.middleware.js","sourceRoot":"","sources":["../src/i18n.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAC;AAEzE,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE;;;;;;GAMG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IAad;IAZX;;;OAGG;IACc,OAAO,CAAU;IAElC;;;OAGG;IACH,YAEW,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;QAEnC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,OAAc,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAgB;QAC/C,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA9BY,cAAc;IAD1B,UAAU,EAAE;IAaR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;;GAZpB,cAAc,CA8B1B"}
|
package/dist/i18n.module.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { type ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, type OPTIONS_TYPE } f
|
|
|
5
5
|
/**
|
|
6
6
|
* Module that provides i18n (internationalization) support via i18next.
|
|
7
7
|
*
|
|
8
|
-
* @remarks
|
|
9
8
|
* Initializes i18next with file-system backend and HTTP language detection,
|
|
10
9
|
* and makes the i18n instance available through dependency injection and
|
|
11
10
|
* the request context.
|
|
@@ -23,8 +22,18 @@ export declare class I18nModule extends ConfigurableModuleClass {
|
|
|
23
22
|
* @returns Dynamic module configuration
|
|
24
23
|
*/
|
|
25
24
|
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
26
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Merges i18next init options with defaults.
|
|
27
|
+
* @param options - Configuration for this operation.
|
|
28
|
+
* @param dynamicModule - Configured Nest dynamic module.
|
|
29
|
+
* @returns Dynamic module exposing the supplied provider.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
27
32
|
private static with;
|
|
28
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Registers i18n middleware after request context initialization.
|
|
35
|
+
* @param middlewareManager - Manager that registers request middleware.
|
|
36
|
+
* @param i18nMiddleware - Middleware that resolves the request language.
|
|
37
|
+
*/
|
|
29
38
|
constructor(middlewareManager: MiddlewareManager, i18nMiddleware: I18nMiddleware);
|
|
30
39
|
}
|
package/dist/i18n.module.js
CHANGED
|
@@ -21,7 +21,6 @@ i18next.use(Backend).use(LanguageDetector);
|
|
|
21
21
|
/**
|
|
22
22
|
* Module that provides i18n (internationalization) support via i18next.
|
|
23
23
|
*
|
|
24
|
-
* @remarks
|
|
25
24
|
* Initializes i18next with file-system backend and HTTP language detection,
|
|
26
25
|
* and makes the i18n instance available through dependency injection and
|
|
27
26
|
* the request context.
|
|
@@ -47,7 +46,13 @@ let I18nModule = class I18nModule extends ConfigurableModuleClass {
|
|
|
47
46
|
...this.with(options, super.registerAsync(options)),
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Merges i18next init options with defaults.
|
|
51
|
+
* @param options - Configuration for this operation.
|
|
52
|
+
* @param dynamicModule - Configured Nest dynamic module.
|
|
53
|
+
* @returns Dynamic module exposing the supplied provider.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
51
56
|
static with(options, dynamicModule) {
|
|
52
57
|
const provider = {
|
|
53
58
|
provide: I18N,
|
|
@@ -72,7 +77,11 @@ let I18nModule = class I18nModule extends ConfigurableModuleClass {
|
|
|
72
77
|
exports: [...(dynamicModule.exports ?? []), provider],
|
|
73
78
|
};
|
|
74
79
|
}
|
|
75
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Registers i18n middleware after request context initialization.
|
|
82
|
+
* @param middlewareManager - Manager that registers request middleware.
|
|
83
|
+
* @param i18nMiddleware - Middleware that resolves the request language.
|
|
84
|
+
*/
|
|
76
85
|
constructor(middlewareManager, i18nMiddleware) {
|
|
77
86
|
super();
|
|
78
87
|
middlewareManager
|
package/dist/i18n.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.module.js","sourceRoot":"","sources":["../src/i18n.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,OAAsB,MAAM,SAAS,CAAC;AAC7C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,uBAAuB,EACvB,oBAAoB,GAErB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"i18n.module.js","sourceRoot":"","sources":["../src/i18n.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,OAAsB,MAAM,SAAS,CAAC;AAC7C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL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S,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC;YACzD,OAAO,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC;SACtD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,YACE,iBAAoC,EACpC,cAA8B;QAE9B,KAAK,EAAE,CAAC;QAER,iBAAiB;aACd,KAAK,CAAC,cAAc,CAAC;aACrB,YAAY,CAAC,wBAAwB,CAAC;aACtC,SAAS,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;CACF,CAAA;AA5EY,UAAU;IAJtB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;QACjD,SAAS,EAAE,CAAC,cAAc,CAAC;KAC5B,CAAC;qCAmEqB,iBAAiB;QACpB,cAAc;GAnErB,UAAU,CA4EtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-boot/i18n",
|
|
3
|
-
"version": "8.0.7-beta.
|
|
3
|
+
"version": "8.0.7-beta.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/nest-boot/nest-boot.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@nestjs/common": "^12.0.1",
|
|
27
27
|
"@nestjs/core": "^12.0.1",
|
|
28
|
-
"@nestjs/platform-express": "^12.
|
|
28
|
+
"@nestjs/platform-express": "^12.1.2",
|
|
29
29
|
"@nestjs/testing": "^12.0.1",
|
|
30
30
|
"@types/express": "^5.0.6",
|
|
31
31
|
"@types/i18next-fs-backend": "^1.2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/supertest": "^7.2.1",
|
|
34
34
|
"@vitest/coverage-v8": "^4.1.11",
|
|
35
35
|
"eslint": "^9.39.3",
|
|
36
|
-
"express": "^5.
|
|
36
|
+
"express": "^5.3.0",
|
|
37
37
|
"i18next": "^26.4.0",
|
|
38
38
|
"i18next-fs-backend": "^2.6.7",
|
|
39
39
|
"i18next-http-middleware": "^3.9.8",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"typescript": "^6.0.3",
|
|
44
44
|
"vite-tsconfig-paths": "^5.1.4",
|
|
45
45
|
"vitest": "^4.1.11",
|
|
46
|
-
"@nest-boot/eslint-config": "^8.0.2-beta.
|
|
47
|
-
"@nest-boot/eslint-plugin": "^8.0.1-beta.
|
|
48
|
-
"@nest-boot/middleware": "^8.0.4-beta.
|
|
49
|
-
"@nest-boot/request-context": "^8.0.4-beta.
|
|
46
|
+
"@nest-boot/eslint-config": "^8.0.2-beta.3",
|
|
47
|
+
"@nest-boot/eslint-plugin": "^8.0.1-beta.4",
|
|
48
|
+
"@nest-boot/middleware": "^8.0.4-beta.1",
|
|
49
|
+
"@nest-boot/request-context": "^8.0.4-beta.2",
|
|
50
50
|
"@nest-boot/tsconfig": "^8.0.0-beta.4"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"i18next-http-middleware": "^3.0.0",
|
|
58
58
|
"reflect-metadata": "^0.2.2",
|
|
59
59
|
"rxjs": "^7.0.0",
|
|
60
|
-
"@nest-boot/
|
|
61
|
-
"@nest-boot/
|
|
60
|
+
"@nest-boot/request-context": "^8.0.4-beta.2",
|
|
61
|
+
"@nest-boot/middleware": "^8.0.4-beta.1"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|