@bgord/bun 1.12.4 → 1.12.5
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/i18n.service.d.ts +0 -6
- package/dist/i18n.service.d.ts.map +1 -1
- package/dist/i18n.service.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/language-detector-cookie.strategy.d.ts +10 -0
- package/dist/language-detector-cookie.strategy.d.ts.map +1 -0
- package/dist/language-detector-cookie.strategy.js +11 -0
- package/dist/language-detector-cookie.strategy.js.map +1 -0
- package/dist/language-detector-header.strategy.d.ts +8 -0
- package/dist/language-detector-header.strategy.d.ts.map +1 -0
- package/dist/language-detector-header.strategy.js +15 -0
- package/dist/language-detector-header.strategy.js.map +1 -0
- package/dist/language-detector-hono.middleware.d.ts +13 -0
- package/dist/language-detector-hono.middleware.d.ts.map +1 -0
- package/dist/language-detector-hono.middleware.js +17 -0
- package/dist/language-detector-hono.middleware.js.map +1 -0
- package/dist/language-detector-query.strategy.d.ts +10 -0
- package/dist/language-detector-query.strategy.d.ts.map +1 -0
- package/dist/language-detector-query.strategy.js +11 -0
- package/dist/language-detector-query.strategy.js.map +1 -0
- package/dist/language-detector.middleware.d.ts +17 -0
- package/dist/language-detector.middleware.d.ts.map +1 -0
- package/dist/language-detector.middleware.js +20 -0
- package/dist/language-detector.middleware.js.map +1 -0
- package/dist/language-detector.strategy.d.ts +7 -0
- package/dist/language-detector.strategy.d.ts.map +1 -0
- package/dist/language-detector.strategy.js +2 -0
- package/dist/language-detector.strategy.js.map +1 -0
- package/dist/languages.vo.d.ts +13 -0
- package/dist/languages.vo.d.ts.map +1 -0
- package/dist/languages.vo.js +23 -0
- package/dist/languages.vo.js.map +1 -0
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.d.ts +5 -2
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.d.ts.map +1 -1
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.js +8 -3
- package/dist/modules/preferences/command-handlers/handleSetUserLanguageCommand.js.map +1 -1
- package/dist/modules/preferences/index.d.ts +0 -1
- package/dist/modules/preferences/index.d.ts.map +1 -1
- package/dist/modules/preferences/index.js +0 -1
- package/dist/modules/preferences/index.js.map +1 -1
- package/dist/modules/preferences/open-host-queries/user-language.d.ts +10 -7
- package/dist/modules/preferences/open-host-queries/user-language.d.ts.map +1 -1
- package/dist/modules/preferences/open-host-queries/user-language.js +7 -4
- package/dist/modules/preferences/open-host-queries/user-language.js.map +1 -1
- package/dist/modules/preferences/ports/user-language-query.d.ts +1 -1
- package/dist/modules/preferences/ports/user-language-query.d.ts.map +1 -1
- package/dist/modules/preferences/ports/user-language-resolver.d.ts +4 -3
- package/dist/modules/preferences/ports/user-language-resolver.d.ts.map +1 -1
- package/dist/modules/preferences/ports/user-language-resolver.js +4 -4
- package/dist/modules/preferences/ports/user-language-resolver.js.map +1 -1
- package/dist/prerequisite-verifier-translations.adapter.d.ts +4 -6
- package/dist/prerequisite-verifier-translations.adapter.d.ts.map +1 -1
- package/dist/prerequisite-verifier-translations.adapter.js +3 -3
- package/dist/prerequisite-verifier-translations.adapter.js.map +1 -1
- package/dist/setup-hono.service.d.ts +6 -4
- package/dist/setup-hono.service.d.ts.map +1 -1
- package/dist/setup-hono.service.js +2 -8
- package/dist/setup-hono.service.js.map +1 -1
- package/dist/translations-hono.handler.d.ts +8 -12
- package/dist/translations-hono.handler.d.ts.map +1 -1
- package/dist/translations-hono.handler.js.map +1 -1
- package/dist/translations.handler.d.ts +7 -7
- package/dist/translations.handler.d.ts.map +1 -1
- package/dist/translations.handler.js +1 -1
- package/dist/translations.handler.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/readme.md +10 -5
- package/src/i18n.service.ts +0 -8
- package/src/index.ts +7 -0
- package/src/language-detector-cookie.strategy.ts +16 -0
- package/src/language-detector-header.strategy.ts +23 -0
- package/src/language-detector-hono.middleware.ts +29 -0
- package/src/language-detector-query.strategy.ts +16 -0
- package/src/language-detector.middleware.ts +28 -0
- package/src/language-detector.strategy.ts +7 -0
- package/src/languages.vo.ts +27 -0
- package/src/modules/preferences/command-handlers/handleSetUserLanguageCommand.ts +11 -4
- package/src/modules/preferences/index.ts +0 -1
- package/src/modules/preferences/open-host-queries/user-language.ts +10 -7
- package/src/modules/preferences/ports/user-language-query.ts +1 -1
- package/src/modules/preferences/ports/user-language-resolver.ts +6 -3
- package/src/prerequisite-verifier-translations.adapter.ts +9 -7
- package/src/setup-hono.service.ts +10 -12
- package/src/translations-hono.handler.ts +8 -5
- package/src/translations.handler.ts +8 -9
- package/dist/modules/preferences/value-objects/index.d.ts +0 -2
- package/dist/modules/preferences/value-objects/index.d.ts.map +0 -1
- package/dist/modules/preferences/value-objects/index.js +0 -2
- package/dist/modules/preferences/value-objects/index.js.map +0 -1
- package/dist/modules/preferences/value-objects/supported-languages-set.d.ts +0 -10
- package/dist/modules/preferences/value-objects/supported-languages-set.d.ts.map +0 -1
- package/dist/modules/preferences/value-objects/supported-languages-set.js +0 -14
- package/dist/modules/preferences/value-objects/supported-languages-set.js.map +0 -1
- package/src/modules/preferences/value-objects/index.ts +0 -1
- package/src/modules/preferences/value-objects/supported-languages-set.ts +0 -17
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
|
+
import type { Languages } from "../../../languages.vo";
|
|
2
3
|
export interface UserLanguageResolverPort {
|
|
3
4
|
resolve(input: tools.LanguageType | null): tools.LanguageType | Promise<tools.LanguageType>;
|
|
4
5
|
}
|
|
@@ -8,9 +9,9 @@ export declare const UserLanguagePreferenceError: {
|
|
|
8
9
|
export declare class UserLanguageResolverThrowIfMissing implements UserLanguageResolverPort {
|
|
9
10
|
resolve(stored: tools.LanguageType | null): string;
|
|
10
11
|
}
|
|
11
|
-
export declare class UserLanguageResolverSystemDefaultFallback implements UserLanguageResolverPort {
|
|
12
|
-
private readonly
|
|
13
|
-
constructor(
|
|
12
|
+
export declare class UserLanguageResolverSystemDefaultFallback<T extends tools.LanguageType> implements UserLanguageResolverPort {
|
|
13
|
+
private readonly languages;
|
|
14
|
+
constructor(languages: Languages<T>);
|
|
14
15
|
resolve(stored: tools.LanguageType | null): string;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=user-language-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-language-resolver.d.ts","sourceRoot":"","sources":["../../../../src/modules/preferences/ports/user-language-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"user-language-resolver.d.ts","sourceRoot":"","sources":["../../../../src/modules/preferences/ports/user-language-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,GAAG,KAAK,CAAC,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;CAC7F;AAED,eAAO,MAAM,2BAA2B;;CAAkD,CAAC;AAE3F,qBAAa,kCAAmC,YAAW,wBAAwB;IACjF,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI;CAI1C;AAED,qBAAa,yCAAyC,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY,CACjF,YAAW,wBAAwB;IAEvB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAEpD,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI;CAG1C"}
|
|
@@ -7,12 +7,12 @@ export class UserLanguageResolverThrowIfMissing {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export class UserLanguageResolverSystemDefaultFallback {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
-
this.
|
|
10
|
+
languages;
|
|
11
|
+
constructor(languages) {
|
|
12
|
+
this.languages = languages;
|
|
13
13
|
}
|
|
14
14
|
resolve(stored) {
|
|
15
|
-
return stored ?? this.
|
|
15
|
+
return stored ?? this.languages.fallback;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=user-language-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-language-resolver.js","sourceRoot":"","sources":["../../../../src/modules/preferences/ports/user-language-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-language-resolver.js","sourceRoot":"","sources":["../../../../src/modules/preferences/ports/user-language-resolver.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC;AAE3F,MAAM,OAAO,kCAAkC;IAC7C,OAAO,CAAC,MAAiC;QACvC,IAAI,MAAM,IAAI,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;QACzE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,MAAM,OAAO,yCAAyC;IAGvB;IAA7B,YAA6B,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;IAAG,CAAC;IAExD,OAAO,CAAC,MAAiC;QACvC,OAAO,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
+
import type * as tools from "@bgord/tools";
|
|
1
2
|
import type { FileReaderJsonPort } from "./file-reader-json.port";
|
|
2
|
-
import type
|
|
3
|
+
import type { Languages } from "./languages.vo";
|
|
3
4
|
import type { LoggerPort } from "./logger.port";
|
|
4
5
|
import { type PrerequisiteVerificationResult, type PrerequisiteVerifierPort } from "./prerequisite-verifier.port";
|
|
5
6
|
type Dependencies = {
|
|
6
7
|
Logger: LoggerPort;
|
|
7
8
|
FileReaderJson: FileReaderJsonPort;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
supportedLanguages: types.I18nConfig["supportedLanguages"];
|
|
11
|
-
};
|
|
12
|
-
export declare class PrerequisiteVerifierTranslationsAdapter implements PrerequisiteVerifierPort {
|
|
10
|
+
export declare class PrerequisiteVerifierTranslationsAdapter<T extends tools.LanguageType> implements PrerequisiteVerifierPort {
|
|
13
11
|
private readonly config;
|
|
14
12
|
private readonly deps;
|
|
15
|
-
constructor(config:
|
|
13
|
+
constructor(config: Languages<T>, deps: Dependencies);
|
|
16
14
|
verify(): Promise<PrerequisiteVerificationResult>;
|
|
17
15
|
get kind(): string;
|
|
18
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerequisite-verifier-translations.adapter.d.ts","sourceRoot":"","sources":["../src/prerequisite-verifier-translations.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prerequisite-verifier-translations.adapter.d.ts","sourceRoot":"","sources":["../src/prerequisite-verifier-translations.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAC;AAQtC,KAAK,YAAY,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE/E,qBAAa,uCAAuC,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY,CAC/E,YAAW,wBAAwB;IAGjC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,IAAI,EAAE,YAAY;IAG/B,MAAM,IAAI,OAAO,CAAC,8BAA8B,CAAC;IAwCvD,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -8,10 +8,10 @@ export class PrerequisiteVerifierTranslationsAdapter {
|
|
|
8
8
|
this.deps = deps;
|
|
9
9
|
}
|
|
10
10
|
async verify() {
|
|
11
|
-
const supportedLanguages = Object.keys(this.config.supportedLanguages);
|
|
12
11
|
const i18n = new I18n(this.deps);
|
|
12
|
+
const languages = this.config.values;
|
|
13
13
|
const dictionary = {};
|
|
14
|
-
for (const language of
|
|
14
|
+
for (const language of languages) {
|
|
15
15
|
try {
|
|
16
16
|
const translations = await i18n.getTranslations(language);
|
|
17
17
|
dictionary[language] = Object.keys(translations);
|
|
@@ -26,7 +26,7 @@ export class PrerequisiteVerifierTranslationsAdapter {
|
|
|
26
26
|
const phrases = dictionary[language] ?? [];
|
|
27
27
|
// Stryker restore all
|
|
28
28
|
for (const phrase of phrases) {
|
|
29
|
-
for (const supportedLanguage of
|
|
29
|
+
for (const supportedLanguage of languages) {
|
|
30
30
|
const phraseExists = new Set(dictionary[supportedLanguage]).has(phrase);
|
|
31
31
|
if (!phraseExists)
|
|
32
32
|
problems.push({ key: phrase, existsIn: language, missingIn: supportedLanguage });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerequisite-verifier-translations.adapter.js","sourceRoot":"","sources":["../src/prerequisite-verifier-translations.adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"prerequisite-verifier-translations.adapter.js","sourceRoot":"","sources":["../src/prerequisite-verifier-translations.adap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C,YAAY;wBAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC;gBACtG,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,wBAAwB,CAAC,OAAO,CAAC;QAEnE,MAAM,OAAO,GAAG,QAAQ;aACrB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,OAAO,CAAC,GAAG,eAAe,OAAO,CAAC,QAAQ,gBAAgB,OAAO,CAAC,SAAS,EAAE,CAAC;aACvG,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,OAAO,wBAAwB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,IAAI;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
+
import * as tools from "@bgord/tools";
|
|
2
|
+
import type { MiddlewareHandler } from "hono";
|
|
1
3
|
import { cors } from "hono/cors";
|
|
2
4
|
import type { BuildInfoRepositoryStrategy } from "./build-info-repository.strategy";
|
|
3
5
|
import type { CacheResolverStrategy } from "./cache-resolver.strategy";
|
|
4
6
|
import type { ClockPort } from "./clock.port";
|
|
5
7
|
import type { HashContentStrategy } from "./hash-content.strategy";
|
|
6
8
|
import type { HttpLoggerConfig } from "./http-logger.middleware";
|
|
7
|
-
import type { I18nConfig } from "./i18n.service";
|
|
8
9
|
import type { IdProviderPort } from "./id-provider.port";
|
|
10
|
+
import type { LanguageDetectorMiddlewareConfig } from "./language-detector.middleware";
|
|
9
11
|
import type { LoggerPort } from "./logger.port";
|
|
10
12
|
import type { ShieldCsrfConfig } from "./shield-csrf.strategy";
|
|
11
13
|
import type { ShieldMaintenanceConfig } from "./shield-maintenance.strategy";
|
|
12
14
|
type Dependencies = {
|
|
13
15
|
Logger: LoggerPort;
|
|
14
16
|
IdProvider: IdProviderPort;
|
|
15
|
-
I18n: I18nConfig;
|
|
16
17
|
Clock: ClockPort;
|
|
17
18
|
CacheResolver: CacheResolverStrategy;
|
|
18
19
|
HashContent: HashContentStrategy;
|
|
19
20
|
BuildInfoRepository: BuildInfoRepositoryStrategy;
|
|
20
21
|
};
|
|
21
|
-
type Config = {
|
|
22
|
+
type Config<T extends tools.LanguageType> = {
|
|
22
23
|
csrf: ShieldCsrfConfig;
|
|
24
|
+
I18n: LanguageDetectorMiddlewareConfig<T>;
|
|
23
25
|
cors?: Parameters<typeof cors>[0];
|
|
24
26
|
httpLogger?: HttpLoggerConfig;
|
|
25
27
|
maintenanceMode?: ShieldMaintenanceConfig;
|
|
26
28
|
};
|
|
27
29
|
export declare class SetupHono {
|
|
28
|
-
static essentials(config: Config
|
|
30
|
+
static essentials<T extends tools.LanguageType>(config: Config<T>, deps: Dependencies): Array<MiddlewareHandler>;
|
|
29
31
|
}
|
|
30
32
|
export {};
|
|
31
33
|
//# sourceMappingURL=setup-hono.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-hono.service.d.ts","sourceRoot":"","sources":["../src/setup-hono.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-hono.service.d.ts","sourceRoot":"","sources":["../src/setup-hono.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAO7E,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,qBAAqB,CAAC;IACrC,WAAW,EAAE,mBAAmB,CAAC;IACjC,mBAAmB,EAAE,2BAA2B,CAAC;CAClD,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY,IAAI;IAC1C,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,gCAAgC,CAAC,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,eAAe,CAAC,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,qBAAa,SAAS;IAIpB,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY,EAC5C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,IAAI,EAAE,YAAY,GACjB,KAAK,CAAC,iBAAiB,CAAC;CA4C5B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
import { cors } from "hono/cors";
|
|
3
|
-
import { languageDetector } from "hono/language";
|
|
4
3
|
import { secureHeaders } from "hono/secure-headers";
|
|
5
4
|
import { ApiVersionHonoMiddleware } from "./api-version-hono.middleware";
|
|
6
5
|
import { CorrelationHonoMiddleware } from "./correlation-hono.middleware";
|
|
7
6
|
import { ETagExtractorHonoMiddleware } from "./etag-extractor-hono.middleware";
|
|
8
7
|
import { HttpLoggerHonoMiddleware } from "./http-logger-hono.middleware";
|
|
8
|
+
import { LanguageDetectorHonoMiddleware } from "./language-detector-hono.middleware";
|
|
9
9
|
import { ShieldCsrfHonoStrategy } from "./shield-csrf-hono.strategy";
|
|
10
10
|
import { ShieldMaintenanceHonoStrategy } from "./shield-maintenance-hono.strategy";
|
|
11
11
|
import { TimeZoneOffsetHonoMiddleware } from "./time-zone-offset-hono.middleware";
|
|
@@ -52,13 +52,7 @@ export class SetupHono {
|
|
|
52
52
|
maxAge: tools.Duration.Minutes(10).seconds,
|
|
53
53
|
...config.cors,
|
|
54
54
|
}),
|
|
55
|
-
|
|
56
|
-
supportedLanguages: Object.keys(deps.I18n.supportedLanguages),
|
|
57
|
-
fallbackLanguage: deps.I18n.defaultLanguage,
|
|
58
|
-
// Stryker disable all
|
|
59
|
-
caches: false,
|
|
60
|
-
// Stryker restore all
|
|
61
|
-
}),
|
|
55
|
+
new LanguageDetectorHonoMiddleware(config.I18n).handle(),
|
|
62
56
|
new TimeZoneOffsetHonoMiddleware().handle(),
|
|
63
57
|
new WeakETagExtractorHonoMiddleware().handle(),
|
|
64
58
|
new ETagExtractorHonoMiddleware().handle(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-hono.service.js","sourceRoot":"","sources":["../src/setup-hono.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"setup-hono.service.js","sourceRoot":"","sources":["../src/setup-hono.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,WA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AAK;gBACpC,yBAAyB,EAAE,KAAK;gBAChC,uBAAuB,EAAE,KAAK;gBAC9B,yBAAyB,EAAE,KAAK;gBAChC,kBAAkB,EAAE,KAAK;gBACzB,aAAa,EAAE,KAAK;aACrB,CAAC;YACF,IAAI,CAAC;gBACH,sBAAsB;gBACtB,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpB,iDAAiD;oBACjD,IAAI,CAAC,MAAM;wBAAE,OAAO,SAAS,CAAC;oBAE9B,oBAAoB;oBACpB,IAAI,MAAM,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM;wBAAE,OAAO,MAAM,CAAC;oBAExD,oBAAoB;oBACpB,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,sBAAsB;gBACtB,WAAW,EAAE,KAAK;gBAClB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO;gBAC1C,GAAG,MAAM,CAAC,IAAI;aACf,CAAC;YACF,IAAI,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;YACxD,IAAI,4BAA4B,EAAE,CAAC,MAAM,EAAE;YAC3C,IAAI,+BAA+B,EAAE,CAAC,MAAM,EAAE;YAC9C,IAAI,2BAA2B,EAAE,CAAC,MAAM,EAAE;YAC1C,IAAI,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;YAC9D,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;SACxC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
+
import type * as tools from "@bgord/tools";
|
|
1
2
|
import type { FileReaderJsonPort } from "./file-reader-json.port";
|
|
2
3
|
import type { HandlerHonoPort } from "./handler-hono.port";
|
|
4
|
+
import type { LanguageDetectorVariables } from "./language-detector-hono.middleware";
|
|
5
|
+
import type { Languages } from "./languages.vo";
|
|
3
6
|
import type { LoggerPort } from "./logger.port";
|
|
4
|
-
import { type TranslationsConfig } from "./translations.handler";
|
|
5
7
|
type Dependencies = {
|
|
6
8
|
FileReaderJson: FileReaderJsonPort;
|
|
7
9
|
Logger: LoggerPort;
|
|
8
10
|
};
|
|
9
|
-
export declare class TranslationsHonoHandler implements HandlerHonoPort {
|
|
11
|
+
export declare class TranslationsHonoHandler<T extends tools.LanguageType> implements HandlerHonoPort {
|
|
10
12
|
private readonly handler;
|
|
11
|
-
constructor(config:
|
|
12
|
-
handle(): [import("hono/types").H<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
language: import("@bgord/tools").LanguageType;
|
|
17
|
-
supportedLanguages: {
|
|
18
|
-
[x: string]: string;
|
|
19
|
-
};
|
|
20
|
-
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
|
|
13
|
+
constructor(config: Languages<T>, deps: Dependencies);
|
|
14
|
+
handle(): [import("hono/types").H<{
|
|
15
|
+
Variables: LanguageDetectorVariables;
|
|
16
|
+
}, string, {}, any>];
|
|
21
17
|
}
|
|
22
18
|
export {};
|
|
23
19
|
//# sourceMappingURL=translations-hono.handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations-hono.handler.d.ts","sourceRoot":"","sources":["../src/translations-hono.handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations-hono.handler.d.ts","sourceRoot":"","sources":["../src/translations-hono.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,KAAK,YAAY,GAAG;IAAE,cAAc,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAI/E,qBAAa,uBAAuB,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY,CAAE,YAAW,eAAe;IAC3F,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY;IAIpD,MAAM;mBACgD,yBAAyB;;CAOhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations-hono.handler.js","sourceRoot":"","sources":["../src/translations-hono.handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations-hono.handler.js","sourceRoot":"","sources":["../src/translations-hono.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAM7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAEhC,MAAM,OAAO,uBAAuB;IACjB,OAAO,CAAyB;IAEjD,YAAY,MAAoB,EAAE,IAAkB;QAClD,IAAI,CAAC,OAAO,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,MAAM;QACJ,OAAO,OAAO,CAAC,cAAc,CAAoD,KAAK,EAAE,CAAC,EAAE,EAAE;YAC3F,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAEpD,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { FileReaderJsonPort } from "./file-reader-json.port";
|
|
3
|
-
import { type
|
|
3
|
+
import { type TranslationsType } from "./i18n.service";
|
|
4
|
+
import type { Languages } from "./languages.vo";
|
|
4
5
|
import type { LoggerPort } from "./logger.port";
|
|
5
|
-
export type TranslationsConfig = TranslationsSupportedLanguagesType;
|
|
6
6
|
type Dependencies = {
|
|
7
7
|
FileReaderJson: FileReaderJsonPort;
|
|
8
8
|
Logger: LoggerPort;
|
|
9
9
|
};
|
|
10
|
-
export type TranslationsResult = {
|
|
10
|
+
export type TranslationsResult<T extends tools.LanguageType> = {
|
|
11
11
|
translations: TranslationsType;
|
|
12
12
|
language: tools.LanguageType;
|
|
13
|
-
supportedLanguages:
|
|
13
|
+
supportedLanguages: Languages<T>["supported"];
|
|
14
14
|
};
|
|
15
|
-
export declare class TranslationsHandler {
|
|
15
|
+
export declare class TranslationsHandler<T extends tools.LanguageType> {
|
|
16
16
|
private readonly config;
|
|
17
17
|
private readonly deps;
|
|
18
|
-
constructor(config:
|
|
19
|
-
execute(language:
|
|
18
|
+
constructor(config: Languages<T>, deps: Dependencies);
|
|
19
|
+
execute(language: tools.LanguageType): Promise<TranslationsResult<T>>;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
22
22
|
//# sourceMappingURL=translations.handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.handler.d.ts","sourceRoot":"","sources":["../src/translations.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAQ,KAAK,
|
|
1
|
+
{"version":3,"file":"translations.handler.d.ts","sourceRoot":"","sources":["../src/translations.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,KAAK,YAAY,GAAG;IAAE,cAAc,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY,IAAI;IAC7D,YAAY,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF,qBAAa,mBAAmB,CAAC,CAAC,SAAS,KAAK,CAAC,YAAY;IAEzD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,IAAI,EAAE,YAAY;IAG/B,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAS5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.handler.js","sourceRoot":"","sources":["../src/translations.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"translations.handler.js","sourceRoot":"","sources":["../src/translations.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAyB,MAAM,gBAAgB,CAAC;AAY7D,MAAM,OAAO,mBAAmB;IAEX;IACA;IAFnB,YACmB,MAAoB,EACpB,IAAkB;QADlB,WAAM,GAAN,MAAM,CAAc;QACpB,SAAI,GAAJ,IAAI,CAAc;IAClC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,QAA4B;QACxC,MAAM,YAAY,GAAG,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEzE,OAAO;YACL,YAAY;YACZ,QAAQ;YACR,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;SAC1C,CAAC;IACJ,CAAC;CACF"}
|