@aneuhold/be-ts-lib 3.1.10 → 3.1.12
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/CHANGELOG.md +21 -0
- package/lib/services/ConfigService/ConfigDefinition.d.ts +18 -13
- package/lib/services/ConfigService/ConfigDefinition.d.ts.map +1 -1
- package/lib/services/ConfigService/ConfigDefinition.js +18 -1
- package/lib/services/ConfigService/ConfigDefinition.js.map +1 -1
- package/lib/services/ConfigService/ConfigDefinition.ts +23 -13
- package/lib/services/ConfigService/ConfigService.d.ts +0 -8
- package/lib/services/ConfigService/ConfigService.d.ts.map +1 -1
- package/lib/services/ConfigService/ConfigService.js +3 -19
- package/lib/services/ConfigService/ConfigService.js.map +1 -1
- package/lib/services/ConfigService/ConfigService.ts +3 -19
- package/lib/services/GitHubService.d.ts.map +1 -1
- package/lib/services/GitHubService.js +9 -2
- package/lib/services/GitHubService.js.map +1 -1
- package/lib/services/GitHubService.ts +9 -2
- package/lib/services/TranslationService/TranslationService.d.ts.map +1 -1
- package/lib/services/TranslationService/TranslationService.js +5 -1
- package/lib/services/TranslationService/TranslationService.js.map +1 -1
- package/lib/services/TranslationService/TranslationService.ts +5 -1
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 🔖 [3.1.12] (2026-04-21)
|
|
9
|
+
|
|
10
|
+
### ✅ Added
|
|
11
|
+
|
|
12
|
+
- Added `zod` as a direct dependency.
|
|
13
|
+
- `ConfigDefinition` now exports a `ConfigSchema` alongside the `Config` type, with the type inferred from the schema.
|
|
14
|
+
|
|
15
|
+
### 🏗️ Changed
|
|
16
|
+
|
|
17
|
+
- `GitHubService.getContentFromRepo` now validates the Octokit response is a string at runtime instead of using an unsafe cast.
|
|
18
|
+
- `ConfigService.useConfig` now validates the parsed JSONC config against `ConfigSchema` (Zod) instead of casting; removed the unused `insertPropertiesIntoEnv` private method.
|
|
19
|
+
- `TranslationService.getTranslations` documents why it does not validate (arbitrary-key JSON) and uses an explicit cast rather than a structural guard that accepts any object.
|
|
20
|
+
|
|
21
|
+
## 🔖 [3.1.11] (2026-04-17)
|
|
22
|
+
|
|
23
|
+
### 🏗️ Changed
|
|
24
|
+
|
|
25
|
+
- Updated dependency on `@aneuhold/core-ts-api-lib` to `^3.0.34`.
|
|
26
|
+
|
|
8
27
|
## 🔖 [3.1.10] (2026-04-15)
|
|
9
28
|
|
|
10
29
|
### 🏗️ Changed
|
|
@@ -295,6 +314,8 @@ No direct code changes; version bump for compatibility with new major versions o
|
|
|
295
314
|
- Updated workflow permissions to allow repository write access
|
|
296
315
|
|
|
297
316
|
<!-- Link References -->
|
|
317
|
+
[3.1.12]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.11...be-ts-lib-v3.1.12
|
|
318
|
+
[3.1.11]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.10...be-ts-lib-v3.1.11
|
|
298
319
|
[3.1.10]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.9...be-ts-lib-v3.1.10
|
|
299
320
|
[3.1.9]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.8...be-ts-lib-v3.1.9
|
|
300
321
|
[3.1.8]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.7...be-ts-lib-v3.1.8
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for the environment configuration pulled in for the current
|
|
4
|
+
* environment from the GitHub repository.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ConfigSchema: z.ZodObject<{
|
|
7
|
+
someKey: z.ZodString;
|
|
8
|
+
mongoRootUsername: z.ZodString;
|
|
9
|
+
mongoRootPassword: z.ZodString;
|
|
10
|
+
mongoUrl: z.ZodString;
|
|
11
|
+
jwtAccessSecret: z.ZodString;
|
|
12
|
+
testUserInfo: z.ZodObject<{
|
|
13
|
+
userName: z.ZodString;
|
|
14
|
+
password: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
}, z.core.$strip>;
|
|
1
17
|
/**
|
|
2
18
|
* The environment configuration that is pulled in for the current environment
|
|
3
19
|
* from the GitHub repository.
|
|
4
20
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
mongoRootUsername: string;
|
|
8
|
-
mongoRootPassword: string;
|
|
9
|
-
mongoUrl: string;
|
|
10
|
-
/** Secret used to sign JWT access tokens. */
|
|
11
|
-
jwtAccessSecret: string;
|
|
12
|
-
/** Test user credentials for e2e tests. */
|
|
13
|
-
testUserInfo: {
|
|
14
|
-
userName: string;
|
|
15
|
-
password: string;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
21
|
+
type Config = z.infer<typeof ConfigSchema>;
|
|
22
|
+
export type { Config as default };
|
|
18
23
|
//# sourceMappingURL=ConfigDefinition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigDefinition.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigDefinition.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ConfigDefinition.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;iBAYvB,CAAC;AAEH;;;GAGG;AACH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3C,YAAY,EAAE,MAAM,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for the environment configuration pulled in for the current
|
|
4
|
+
* environment from the GitHub repository.
|
|
5
|
+
*/
|
|
6
|
+
export const ConfigSchema = z.object({
|
|
7
|
+
someKey: z.string(),
|
|
8
|
+
mongoRootUsername: z.string(),
|
|
9
|
+
mongoRootPassword: z.string(),
|
|
10
|
+
mongoUrl: z.string(),
|
|
11
|
+
/** Secret used to sign JWT access tokens. */
|
|
12
|
+
jwtAccessSecret: z.string(),
|
|
13
|
+
/** Test user credentials for e2e tests. */
|
|
14
|
+
testUserInfo: z.object({
|
|
15
|
+
userName: z.string(),
|
|
16
|
+
password: z.string()
|
|
17
|
+
})
|
|
18
|
+
});
|
|
2
19
|
//# sourceMappingURL=ConfigDefinition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigDefinition.js","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigDefinition.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ConfigDefinition.js","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,6CAA6C;IAC7C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,2CAA2C;IAC3C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC;QACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACrB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
* from the GitHub repository.
|
|
4
|
+
* Zod schema for the environment configuration pulled in for the current
|
|
5
|
+
* environment from the GitHub repository.
|
|
4
6
|
*/
|
|
5
|
-
export
|
|
6
|
-
someKey: string
|
|
7
|
-
mongoRootUsername: string
|
|
8
|
-
mongoRootPassword: string
|
|
9
|
-
mongoUrl: string
|
|
7
|
+
export const ConfigSchema = z.object({
|
|
8
|
+
someKey: z.string(),
|
|
9
|
+
mongoRootUsername: z.string(),
|
|
10
|
+
mongoRootPassword: z.string(),
|
|
11
|
+
mongoUrl: z.string(),
|
|
10
12
|
/** Secret used to sign JWT access tokens. */
|
|
11
|
-
jwtAccessSecret: string
|
|
13
|
+
jwtAccessSecret: z.string(),
|
|
12
14
|
/** Test user credentials for e2e tests. */
|
|
13
|
-
testUserInfo: {
|
|
14
|
-
userName: string
|
|
15
|
-
password: string
|
|
16
|
-
}
|
|
17
|
-
}
|
|
15
|
+
testUserInfo: z.object({
|
|
16
|
+
userName: z.string(),
|
|
17
|
+
password: z.string()
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The environment configuration that is pulled in for the current environment
|
|
23
|
+
* from the GitHub repository.
|
|
24
|
+
*/
|
|
25
|
+
type Config = z.infer<typeof ConfigSchema>;
|
|
26
|
+
|
|
27
|
+
export type { Config as default };
|
|
@@ -38,13 +38,5 @@ export default class ConfigService {
|
|
|
38
38
|
* @throws {Error} If the configuration fails to load.
|
|
39
39
|
*/
|
|
40
40
|
static useConfig(env: ConfigEnv): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Inserts the provided configuration into the local environment.
|
|
43
|
-
*
|
|
44
|
-
* This may not actually need to happen.
|
|
45
|
-
*
|
|
46
|
-
* @param config - The configuration object to insert into the environment.
|
|
47
|
-
*/
|
|
48
|
-
private static insertPropertiesIntoEnv;
|
|
49
41
|
}
|
|
50
42
|
//# sourceMappingURL=ConfigService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigService.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAGvB,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigService.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAGvB,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAQ;IAEpC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAuB;IAElD;;;;;;OAMG;IACH,MAAM,KAAK,MAAM,IAAI,MAAM,CAO1B;IAED;;;;OAIG;IACH,MAAM,KAAK,aAAa,IAAI,OAAO,CAElC;IAED;;;;;OAKG;WACU,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAUtD"}
|
|
@@ -2,6 +2,7 @@ import { DR } from '@aneuhold/core-ts-lib';
|
|
|
2
2
|
import 'dotenv/config';
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
4
|
import GitHubService from '../GitHubService.js';
|
|
5
|
+
import { ConfigSchema } from './ConfigDefinition.js';
|
|
5
6
|
/**
|
|
6
7
|
* Service for managing configuration settings.
|
|
7
8
|
*
|
|
@@ -49,29 +50,12 @@ export default class ConfigService {
|
|
|
49
50
|
ConfigService.env = env;
|
|
50
51
|
try {
|
|
51
52
|
const jsonString = await GitHubService.getContentFromRepo('config', `${env}.jsonc`);
|
|
52
|
-
ConfigService.configObject = parse(jsonString);
|
|
53
|
+
ConfigService.configObject = ConfigSchema.parse(parse(jsonString));
|
|
53
54
|
}
|
|
54
55
|
catch (error) {
|
|
55
|
-
DR.logger.error(`Failed to load ${env}.json, error: ${error}`);
|
|
56
|
+
DR.logger.error(`Failed to load ${env}.json, error: ${String(error)}`);
|
|
56
57
|
throw error;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Inserts the provided configuration into the local environment.
|
|
61
|
-
*
|
|
62
|
-
* This may not actually need to happen.
|
|
63
|
-
*
|
|
64
|
-
* @param config - The configuration object to insert into the environment.
|
|
65
|
-
*/
|
|
66
|
-
static insertPropertiesIntoEnv(config) {
|
|
67
|
-
Object.entries(config).forEach(([key, value]) => {
|
|
68
|
-
if (typeof value === 'object') {
|
|
69
|
-
ConfigService.insertPropertiesIntoEnv(value);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
process.env[key] = value;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
60
|
}
|
|
77
61
|
//# sourceMappingURL=ConfigService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigService.js","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,aAAa,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigService.js","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC;;OAEG;IACH,MAAM,CAAC,GAAG,GAAqB,IAAI,CAAC;IAE5B,MAAM,CAAC,YAAY,GAAkB,IAAI,CAAC;IAElD;;;;;;OAMG;IACH,MAAM,KAAK,MAAM;QACf,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC,YAAY,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,MAAM,KAAK,aAAa;QACtB,OAAO,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAc;QACnC,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;QACxB,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,kBAAkB,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,CAAC,CAAC;YACpF,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,GAAG,iBAAiB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACvE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC"}
|
|
@@ -3,6 +3,7 @@ import 'dotenv/config';
|
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
4
|
import GitHubService from '../GitHubService.js';
|
|
5
5
|
import type Config from './ConfigDefinition.js';
|
|
6
|
+
import { ConfigSchema } from './ConfigDefinition.js';
|
|
6
7
|
|
|
7
8
|
export type ConfigEnv = 'local' | 'dev' | 'prod';
|
|
8
9
|
|
|
@@ -59,27 +60,10 @@ export default class ConfigService {
|
|
|
59
60
|
ConfigService.env = env;
|
|
60
61
|
try {
|
|
61
62
|
const jsonString = await GitHubService.getContentFromRepo('config', `${env}.jsonc`);
|
|
62
|
-
ConfigService.configObject = parse(jsonString)
|
|
63
|
+
ConfigService.configObject = ConfigSchema.parse(parse(jsonString));
|
|
63
64
|
} catch (error) {
|
|
64
|
-
DR.logger.error(`Failed to load ${env}.json, error: ${error
|
|
65
|
+
DR.logger.error(`Failed to load ${env}.json, error: ${String(error)}`);
|
|
65
66
|
throw error;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Inserts the provided configuration into the local environment.
|
|
71
|
-
*
|
|
72
|
-
* This may not actually need to happen.
|
|
73
|
-
*
|
|
74
|
-
* @param config - The configuration object to insert into the environment.
|
|
75
|
-
*/
|
|
76
|
-
private static insertPropertiesIntoEnv(config: object) {
|
|
77
|
-
Object.entries(config).forEach(([key, value]) => {
|
|
78
|
-
if (typeof value === 'object') {
|
|
79
|
-
ConfigService.insertPropertiesIntoEnv(value as object);
|
|
80
|
-
} else {
|
|
81
|
-
process.env[key] = value as string;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubService.d.ts","sourceRoot":"","sources":["../../src/services/GitHubService.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAGvB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAwB;IAE7C;;;;;;;OAOG;WACU,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"GitHubService.d.ts","sourceRoot":"","sources":["../../src/services/GitHubService.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAGvB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAwB;IAE7C;;;;;;;OAOG;WACU,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA2BpF;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;CAS/B"}
|
|
@@ -27,10 +27,17 @@ export default class GitHubService {
|
|
|
27
27
|
repo: repoName,
|
|
28
28
|
path: filePath
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
// When `mediaType.format === 'raw'`, the Octokit runtime returns the raw
|
|
31
|
+
// file contents as a string even though the published types don't
|
|
32
|
+
// narrow to that case. Verify at runtime.
|
|
33
|
+
const data = result.data;
|
|
34
|
+
if (typeof data !== 'string') {
|
|
35
|
+
throw new Error(`Expected raw content from ${repoName}/${filePath} to be a string.`);
|
|
36
|
+
}
|
|
37
|
+
return data;
|
|
31
38
|
}
|
|
32
39
|
catch (error) {
|
|
33
|
-
DR.logger.error(`Failed to load ${filePath} from ${repoName}, error: ${error}`);
|
|
40
|
+
DR.logger.error(`Failed to load ${filePath} from ${repoName}, error: ${String(error)}`);
|
|
34
41
|
throw error;
|
|
35
42
|
}
|
|
36
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubService.js","sourceRoot":"","sources":["../../src/services/GitHubService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IACxB,MAAM,CAAC,MAAM,GAAmB,IAAI,CAAC;IAE7C;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,QAAgB;QAChE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YAC1B,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,eAAe,EAAE,CAAC;QACzD,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;gBAC9D,SAAS,EAAE;oBACT,MAAM,EAAE,KAAK;iBACd;gBACD,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"GitHubService.js","sourceRoot":"","sources":["../../src/services/GitHubService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IACxB,MAAM,CAAC,MAAM,GAAmB,IAAI,CAAC;IAE7C;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,QAAgB;QAChE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YAC1B,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,eAAe,EAAE,CAAC;QACzD,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;gBAC9D,SAAS,EAAE;oBACT,MAAM,EAAE,KAAK;iBACd;gBACD,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH,yEAAyE;YACzE,kEAAkE;YAClE,0CAA0C;YAC1C,MAAM,IAAI,GAAY,MAAM,CAAC,IAAI,CAAC;YAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,IAAI,QAAQ,kBAAkB,CAAC,CAAC;YACvF,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,QAAQ,SAAS,QAAQ,YAAY,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACxF,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,eAAe;QAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,IAAI,OAAO,CAAC;YACjB,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -31,9 +31,16 @@ export default class GitHubService {
|
|
|
31
31
|
repo: repoName,
|
|
32
32
|
path: filePath
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
// When `mediaType.format === 'raw'`, the Octokit runtime returns the raw
|
|
35
|
+
// file contents as a string even though the published types don't
|
|
36
|
+
// narrow to that case. Verify at runtime.
|
|
37
|
+
const data: unknown = result.data;
|
|
38
|
+
if (typeof data !== 'string') {
|
|
39
|
+
throw new Error(`Expected raw content from ${repoName}/${filePath} to be a string.`);
|
|
40
|
+
}
|
|
41
|
+
return data;
|
|
35
42
|
} catch (error) {
|
|
36
|
-
DR.logger.error(`Failed to load ${filePath} from ${repoName}, error: ${error
|
|
43
|
+
DR.logger.error(`Failed to load ${filePath} from ${repoName}, error: ${String(error)}`);
|
|
37
44
|
throw error;
|
|
38
45
|
}
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationService.d.ts","sourceRoot":"","sources":["../../../src/services/TranslationService/TranslationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,eAAe,CAAC;AAIvB;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,6CAA6C;IAC7C,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;OAKG;WACU,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"TranslationService.d.ts","sourceRoot":"","sources":["../../../src/services/TranslationService/TranslationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,eAAe,CAAC;AAIvB;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,6CAA6C;IAC7C,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;OAKG;WACU,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;CAa/E"}
|
|
@@ -28,10 +28,14 @@ export default class TranslationService {
|
|
|
28
28
|
static async getTranslations(source) {
|
|
29
29
|
try {
|
|
30
30
|
const jsonString = await GitHubService.getContentFromRepo('translations', `${source}.jsonc`);
|
|
31
|
+
// The translations file has arbitrary string keys by design (including
|
|
32
|
+
// `$schema` metadata), so a structural type guard would accept any
|
|
33
|
+
// object anyway. Trust the source and cast.
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
31
35
|
return parse(jsonString);
|
|
32
36
|
}
|
|
33
37
|
catch (error) {
|
|
34
|
-
DR.logger.error(`Failed to load ${source}.json, error: ${error}`);
|
|
38
|
+
DR.logger.error(`Failed to load ${source}.json, error: ${String(error)}`);
|
|
35
39
|
throw error;
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationService.js","sourceRoot":"","sources":["../../../src/services/TranslationService/TranslationService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,6CAA6C;IAC7C,4CAAuB,CAAA;AACzB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAyB;QACpD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,kBAAkB,CAAC,cAAc,EAAE,GAAG,MAAM,QAAQ,CAAC,CAAC;YAC7F,OAAO,KAAK,CAAC,UAAU,CAAiB,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"TranslationService.js","sourceRoot":"","sources":["../../../src/services/TranslationService/TranslationService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,6CAA6C;IAC7C,4CAAuB,CAAA;AACzB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAyB;QACpD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,kBAAkB,CAAC,cAAc,EAAE,GAAG,MAAM,QAAQ,CAAC,CAAC;YAC7F,uEAAuE;YACvE,mEAAmE;YACnE,4CAA4C;YAC5C,yEAAyE;YACzE,OAAO,KAAK,CAAC,UAAU,CAAiB,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,MAAM,iBAAiB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC1E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -30,9 +30,13 @@ export default class TranslationService {
|
|
|
30
30
|
static async getTranslations(source: TranslationSource): Promise<Translations> {
|
|
31
31
|
try {
|
|
32
32
|
const jsonString = await GitHubService.getContentFromRepo('translations', `${source}.jsonc`);
|
|
33
|
+
// The translations file has arbitrary string keys by design (including
|
|
34
|
+
// `$schema` metadata), so a structural type guard would accept any
|
|
35
|
+
// object anyway. Trust the source and cast.
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
33
37
|
return parse(jsonString) as Translations;
|
|
34
38
|
} catch (error) {
|
|
35
|
-
DR.logger.error(`Failed to load ${source}.json, error: ${error
|
|
39
|
+
DR.logger.error(`Failed to load ${source}.json, error: ${String(error)}`);
|
|
36
40
|
throw error;
|
|
37
41
|
}
|
|
38
42
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aneuhold/be-ts-lib",
|
|
3
3
|
"author": "Anton G. Neuhold Jr.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.12",
|
|
6
6
|
"description": "A backend TypeScript library used for common functionality in personal backend projects.",
|
|
7
7
|
"packageManager": "pnpm@10.25.0",
|
|
8
8
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"check": "tsc --noEmit",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"preparePkg": "tb pkg prepare",
|
|
19
|
-
"jsr:validate": "tb pkg validateJsr",
|
|
19
|
+
"jsr:validate": "tb pkg validateJsr --allow-slow-types",
|
|
20
20
|
"npm:validate": "tb pkg validateNpm",
|
|
21
21
|
"versionPropagation:validate": "tsx ../../scripts/validatePackageVersions.ts",
|
|
22
22
|
"checkAll": "pnpm build && pnpm lint && pnpm test && pnpm jsr:validate",
|
|
@@ -54,16 +54,17 @@
|
|
|
54
54
|
"TypeScript"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@aneuhold/core-ts-api-lib": "^3.0.
|
|
58
|
-
"@aneuhold/core-ts-lib": "^2.4.
|
|
57
|
+
"@aneuhold/core-ts-api-lib": "^3.0.35",
|
|
58
|
+
"@aneuhold/core-ts-lib": "^2.4.4",
|
|
59
59
|
"dotenv": "^17.2.3",
|
|
60
60
|
"jsonc-parser": "^3.3.1",
|
|
61
61
|
"node-fetch": "^3.3.2",
|
|
62
|
-
"octokit": "^5.0.5"
|
|
62
|
+
"octokit": "^5.0.5",
|
|
63
|
+
"zod": "^4.1.13"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
|
-
"@aneuhold/local-npm-registry": "^0.2.
|
|
66
|
-
"@aneuhold/main-scripts": "^2.
|
|
66
|
+
"@aneuhold/local-npm-registry": "^0.2.31",
|
|
67
|
+
"@aneuhold/main-scripts": "^2.9.3",
|
|
67
68
|
"@types/node": "^25.0.2",
|
|
68
69
|
"@types/node-fetch": "^2.6.13",
|
|
69
70
|
"eslint": "^9.39.2",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"prettier": "^3.7.4",
|
|
72
73
|
"rimraf": "^6.1.2",
|
|
73
74
|
"tsx": "^4.21.0",
|
|
74
|
-
"typescript": "^
|
|
75
|
+
"typescript": "^6.0.3",
|
|
75
76
|
"vitest": "^4.0.15"
|
|
76
77
|
}
|
|
77
78
|
}
|