@bgord/bun 1.7.0 → 1.7.1
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/api-version.middleware.d.ts +1 -1
- package/dist/build-info-repository.service.d.ts +1 -1
- package/dist/build-info-repository.service.js +1 -1
- package/dist/file-reader-json-bun.adapter.d.ts +1 -1
- package/dist/file-reader-json-bun.adapter.js +1 -1
- package/dist/healthcheck.service.d.ts +1 -1
- package/dist/i18n.service.d.ts +1 -1
- package/dist/i18n.service.js +1 -1
- package/dist/prerequisite-verifier-translations.adapter.d.ts +1 -1
- package/dist/setup.service.d.ts +1 -1
- package/dist/setup.service.js +1 -1
- package/dist/translations.service.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/api-version.middleware.ts +1 -1
- package/src/build-info-repository.service.ts +2 -2
- package/src/file-reader-json-bun.adapter.ts +1 -1
- package/src/healthcheck.service.ts +1 -1
- package/src/i18n.service.ts +2 -2
- package/src/prerequisite-verifier-translations.adapter.ts +1 -1
- package/src/setup.service.ts +2 -2
- package/src/translations.service.ts +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { BuildInfoRepository } from "./build-info-repository.service";
|
|
|
3
3
|
import type { ClockPort } from "./clock.port";
|
|
4
4
|
import type { FileReaderJsonPort } from "./file-reader-json.port";
|
|
5
5
|
|
|
6
|
-
type Dependencies = { Clock: ClockPort;
|
|
6
|
+
type Dependencies = { Clock: ClockPort; FileReaderJson: FileReaderJsonPort };
|
|
7
7
|
|
|
8
8
|
export class ApiVersion {
|
|
9
9
|
static readonly HEADER_NAME = "api-version";
|
|
@@ -4,14 +4,14 @@ import type { FileReaderJsonPort } from "./file-reader-json.port";
|
|
|
4
4
|
|
|
5
5
|
export type BuildInfoType = { BUILD_DATE: tools.TimestampValueType; BUILD_VERSION?: string };
|
|
6
6
|
|
|
7
|
-
type Dependencies = { Clock: ClockPort;
|
|
7
|
+
type Dependencies = { Clock: ClockPort; FileReaderJson: FileReaderJsonPort };
|
|
8
8
|
|
|
9
9
|
export class BuildInfoRepository {
|
|
10
10
|
static async extract(deps: Dependencies): Promise<BuildInfoType> {
|
|
11
11
|
const BUILD_DATE = deps.Clock.now().ms;
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
const packageJson = await deps.
|
|
14
|
+
const packageJson = await deps.FileReaderJson.read("package.json");
|
|
15
15
|
|
|
16
16
|
return { BUILD_DATE, BUILD_VERSION: tools.PackageVersion.fromString(packageJson.version).toString() };
|
|
17
17
|
} catch {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as tools from "@bgord/tools";
|
|
2
2
|
import type { FileReaderJsonOutputType, FileReaderJsonPort } from "./file-reader-json.port";
|
|
3
3
|
|
|
4
|
-
export class
|
|
4
|
+
export class FileReaderJsonBunAdapter implements FileReaderJsonPort {
|
|
5
5
|
async read(
|
|
6
6
|
path: tools.FilePathRelative | tools.FilePathAbsolute | string,
|
|
7
7
|
): Promise<FileReaderJsonOutputType> {
|
|
@@ -42,7 +42,7 @@ type HealthcheckResultType = {
|
|
|
42
42
|
timestamp: tools.TimestampValueType;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
type Dependencies = { Clock: ClockPort;
|
|
45
|
+
type Dependencies = { Clock: ClockPort; FileReaderJson: FileReaderJsonPort; Logger: LoggerPort };
|
|
46
46
|
|
|
47
47
|
export class Healthcheck {
|
|
48
48
|
static build = (Env: NodeEnvironmentEnum, _prerequisites: Prerequisite[], deps: Dependencies) =>
|
package/src/i18n.service.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type I18nConfigType = {
|
|
|
17
17
|
defaultLanguage?: string;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
type Dependencies = {
|
|
20
|
+
type Dependencies = { FileReaderJson: FileReaderJsonPort; Logger: LoggerPort };
|
|
21
21
|
|
|
22
22
|
export class I18n {
|
|
23
23
|
private readonly base = { component: "infra", operation: "translations" };
|
|
@@ -30,7 +30,7 @@ export class I18n {
|
|
|
30
30
|
) {}
|
|
31
31
|
|
|
32
32
|
async getTranslations(language: tools.LanguageType): Promise<TranslationsType> {
|
|
33
|
-
return this.deps.
|
|
33
|
+
return this.deps.FileReaderJson.read(this.getTranslationPathForLanguage(language));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
useTranslations(translations: TranslationsType) {
|
|
@@ -13,7 +13,7 @@ type PrerequisiteTranslationsProblemType = {
|
|
|
13
13
|
missingIn: tools.LanguageType;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
type Dependencies = { Logger: LoggerPort;
|
|
16
|
+
type Dependencies = { Logger: LoggerPort; FileReaderJson: FileReaderJsonPort };
|
|
17
17
|
|
|
18
18
|
export class PrerequisiteVerifierTranslationsAdapter implements PrerequisiteVerifierPort {
|
|
19
19
|
constructor(
|
package/src/setup.service.ts
CHANGED
|
@@ -33,7 +33,7 @@ type Dependencies = {
|
|
|
33
33
|
IdProvider: IdProviderPort;
|
|
34
34
|
I18n: I18nConfigType;
|
|
35
35
|
Clock: ClockPort;
|
|
36
|
-
|
|
36
|
+
FileReaderJson: FileReaderJsonPort;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export class Setup {
|
|
@@ -45,7 +45,7 @@ export class Setup {
|
|
|
45
45
|
MaintenanceMode.build(overrides?.maintenanceMode),
|
|
46
46
|
secureHeaders(secureHeadersOptions),
|
|
47
47
|
bodyLimit({ maxSize: BODY_LIMIT_MAX_SIZE }),
|
|
48
|
-
ApiVersion.build({ Clock: deps.Clock,
|
|
48
|
+
ApiVersion.build({ Clock: deps.Clock, FileReaderJson: deps.FileReaderJson }),
|
|
49
49
|
cors(corsOptions),
|
|
50
50
|
languageDetector({
|
|
51
51
|
supportedLanguages: Object.keys(deps.I18n.supportedLanguages),
|
|
@@ -7,7 +7,7 @@ const handler = createFactory();
|
|
|
7
7
|
|
|
8
8
|
type Config = TranslationsSupportedLanguagesType;
|
|
9
9
|
|
|
10
|
-
type Dependencies = {
|
|
10
|
+
type Dependencies = { FileReaderJson: FileReaderJsonPort; Logger: LoggerPort };
|
|
11
11
|
|
|
12
12
|
export class Translations {
|
|
13
13
|
static build = (config: Config, deps: Dependencies) =>
|