@aneuhold/be-ts-lib 3.1.14 → 3.1.16
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 +15 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/index.ts +2 -2
- package/lib/services/ConfigService/{ConfigService.d.ts → Config.service.d.ts} +2 -2
- package/lib/services/ConfigService/Config.service.d.ts.map +1 -0
- package/lib/services/ConfigService/{ConfigService.js → Config.service.js} +7 -7
- package/lib/services/ConfigService/Config.service.js.map +1 -0
- package/lib/services/ConfigService/{ConfigService.ts → Config.service.ts} +6 -6
- package/lib/services/{GitHubService.d.ts → GitHub.service.d.ts} +2 -9
- package/lib/services/GitHub.service.d.ts.map +1 -0
- package/lib/services/{GitHubService.js → GitHub.service.js} +6 -6
- package/lib/services/GitHub.service.js.map +1 -0
- package/lib/services/{GitHubService.ts → GitHub.service.ts} +5 -5
- package/lib/services/TranslationService/{TranslationService.d.ts → Translation.service.d.ts} +1 -1
- package/lib/services/TranslationService/Translation.service.d.ts.map +1 -0
- package/lib/services/TranslationService/{TranslationService.js → Translation.service.js} +2 -2
- package/lib/services/TranslationService/Translation.service.js.map +1 -0
- package/lib/services/TranslationService/{TranslationService.ts → Translation.service.ts} +1 -1
- package/package.json +5 -5
- package/lib/services/ConfigService/ConfigService.d.ts.map +0 -1
- package/lib/services/ConfigService/ConfigService.js.map +0 -1
- package/lib/services/GitHubService.d.ts.map +0 -1
- package/lib/services/GitHubService.js.map +0 -1
- package/lib/services/TranslationService/TranslationService.d.ts.map +0 -1
- package/lib/services/TranslationService/TranslationService.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ 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.16] (2026-06-12)
|
|
9
|
+
|
|
10
|
+
### 🏗️ Changed
|
|
11
|
+
|
|
12
|
+
- Renamed service files to use the `.service.ts` naming convention (`ConfigService.ts` → `Config.service.ts`, `GitHubService.ts` → `GitHub.service.ts`, `TranslationService.ts` → `Translation.service.ts`).
|
|
13
|
+
- Converted `private static` methods and properties to native `#` private class fields in `ConfigService` and `GitHubService`.
|
|
14
|
+
|
|
15
|
+
## 🔖 [3.1.15] (2026-05-10)
|
|
16
|
+
|
|
17
|
+
### 🏗️ Changed
|
|
18
|
+
|
|
19
|
+
- Updated `@aneuhold/core-ts-api-lib` to `^3.0.38`.
|
|
20
|
+
|
|
8
21
|
## 🔖 [3.1.14] (2026-05-10)
|
|
9
22
|
|
|
10
23
|
### 🏗️ Changed
|
|
@@ -326,6 +339,8 @@ No direct code changes; version bump for compatibility with new major versions o
|
|
|
326
339
|
- Updated workflow permissions to allow repository write access
|
|
327
340
|
|
|
328
341
|
<!-- Link References -->
|
|
342
|
+
[3.1.16]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.15...be-ts-lib-v3.1.16
|
|
343
|
+
[3.1.15]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.14...be-ts-lib-v3.1.15
|
|
329
344
|
[3.1.14]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.13...be-ts-lib-v3.1.14
|
|
330
345
|
[3.1.13]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.12...be-ts-lib-v3.1.13
|
|
331
346
|
[3.1.12]: https://github.com/aneuhold/ts-libs/compare/be-ts-lib-v3.1.11...be-ts-lib-v3.1.12
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type Config from './services/ConfigService/ConfigDefinition.js';
|
|
2
|
-
import ConfigService from './services/ConfigService/
|
|
3
|
-
import TranslationService, { TranslationSource } from './services/TranslationService/
|
|
2
|
+
import ConfigService from './services/ConfigService/Config.service.js';
|
|
3
|
+
import TranslationService, { TranslationSource } from './services/TranslationService/Translation.service.js';
|
|
4
4
|
export { ConfigService, TranslationService, TranslationSource };
|
|
5
5
|
export type { Config };
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,8CAA8C,CAAC;AACvE,OAAO,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,8CAA8C,CAAC;AACvE,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,kBAAkB,EAAE,EACzB,iBAAiB,EAClB,MAAM,sDAAsD,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;AAGhE,YAAY,EAAE,MAAM,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ConfigService from './services/ConfigService/
|
|
2
|
-
import TranslationService, { TranslationSource } from './services/TranslationService/
|
|
1
|
+
import ConfigService from './services/ConfigService/Config.service.js';
|
|
2
|
+
import TranslationService, { TranslationSource } from './services/TranslationService/Translation.service.js';
|
|
3
3
|
// Export all the functions and classes from this library
|
|
4
4
|
export { ConfigService, TranslationService, TranslationSource };
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,kBAAkB,EAAE,EACzB,iBAAiB,EAClB,MAAM,sDAAsD,CAAC;AAE9D,yDAAyD;AACzD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
|
package/lib/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type Config from './services/ConfigService/ConfigDefinition.js';
|
|
2
|
-
import ConfigService from './services/ConfigService/
|
|
2
|
+
import ConfigService from './services/ConfigService/Config.service.js';
|
|
3
3
|
import TranslationService, {
|
|
4
4
|
TranslationSource
|
|
5
|
-
} from './services/TranslationService/
|
|
5
|
+
} from './services/TranslationService/Translation.service.js';
|
|
6
6
|
|
|
7
7
|
// Export all the functions and classes from this library
|
|
8
8
|
export { ConfigService, TranslationService, TranslationSource };
|
|
@@ -12,11 +12,11 @@ export type ConfigEnv = 'local' | 'dev' | 'prod';
|
|
|
12
12
|
* root of the project / machine with a `CONFIG_GITHUB_TOKEN` variable set.
|
|
13
13
|
*/
|
|
14
14
|
export default class ConfigService {
|
|
15
|
+
#private;
|
|
15
16
|
/**
|
|
16
17
|
* The current environment configuration.
|
|
17
18
|
*/
|
|
18
19
|
static env: ConfigEnv | null;
|
|
19
|
-
private static configObject;
|
|
20
20
|
/**
|
|
21
21
|
* Returns the configuration object that has been loaded in for the current
|
|
22
22
|
* environment.
|
|
@@ -39,4 +39,4 @@ export default class ConfigService {
|
|
|
39
39
|
*/
|
|
40
40
|
static useConfig(env: ConfigEnv): Promise<void>;
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=Config.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.service.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/Config.service.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;IAIpC;;;;;;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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DR } from '@aneuhold/core-ts-lib';
|
|
2
2
|
import 'dotenv/config';
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
|
-
import GitHubService from '../
|
|
4
|
+
import GitHubService from '../GitHub.service.js';
|
|
5
5
|
import { ConfigSchema } from './ConfigDefinition.js';
|
|
6
6
|
/**
|
|
7
7
|
* Service for managing configuration settings.
|
|
@@ -18,7 +18,7 @@ export default class ConfigService {
|
|
|
18
18
|
* The current environment configuration.
|
|
19
19
|
*/
|
|
20
20
|
static env = null;
|
|
21
|
-
static configObject = null;
|
|
21
|
+
static #configObject = null;
|
|
22
22
|
/**
|
|
23
23
|
* Returns the configuration object that has been loaded in for the current
|
|
24
24
|
* environment.
|
|
@@ -27,10 +27,10 @@ export default class ConfigService {
|
|
|
27
27
|
* @returns The configuration object for the current environment.
|
|
28
28
|
*/
|
|
29
29
|
static get config() {
|
|
30
|
-
if (!ConfigService
|
|
30
|
+
if (!ConfigService.#configObject) {
|
|
31
31
|
throw new Error('ConfigService has not been initialized yet. Use ConfigService.useConfig() to initialize it.');
|
|
32
32
|
}
|
|
33
|
-
return ConfigService
|
|
33
|
+
return ConfigService.#configObject;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Checks if the {@link ConfigService} has been initialized.
|
|
@@ -38,7 +38,7 @@ export default class ConfigService {
|
|
|
38
38
|
* @returns True if the {@link ConfigService} has been initialized, false otherwise.
|
|
39
39
|
*/
|
|
40
40
|
static get isInitialized() {
|
|
41
|
-
return !!ConfigService
|
|
41
|
+
return !!ConfigService.#configObject;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Loads configuration from the GitHub repository into the {@link ConfigService}.
|
|
@@ -50,7 +50,7 @@ export default class ConfigService {
|
|
|
50
50
|
ConfigService.env = env;
|
|
51
51
|
try {
|
|
52
52
|
const jsonString = await GitHubService.getContentFromRepo('config', `${env}.jsonc`);
|
|
53
|
-
ConfigService
|
|
53
|
+
ConfigService.#configObject = ConfigSchema.parse(parse(jsonString));
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
56
|
DR.logger.error(`Failed to load ${env}.json, error: ${String(error)}`);
|
|
@@ -58,4 +58,4 @@ export default class ConfigService {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
//# sourceMappingURL=
|
|
61
|
+
//# sourceMappingURL=Config.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.service.js","sourceRoot":"","sources":["../../../src/services/ConfigService/Config.service.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,sBAAsB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC;;OAEG;IACH,MAAM,CAAC,GAAG,GAAqB,IAAI,CAAC;IAEpC,MAAM,CAAC,aAAa,GAAkB,IAAI,CAAC;IAE3C;;;;;;OAMG;IACH,MAAM,KAAK,MAAM;QACf,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC,aAAa,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,MAAM,KAAK,aAAa;QACtB,OAAO,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC;IACvC,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,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QACtE,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DR } from '@aneuhold/core-ts-lib';
|
|
2
2
|
import 'dotenv/config';
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
|
-
import GitHubService from '../
|
|
4
|
+
import GitHubService from '../GitHub.service.js';
|
|
5
5
|
import type Config from './ConfigDefinition.js';
|
|
6
6
|
import { ConfigSchema } from './ConfigDefinition.js';
|
|
7
7
|
|
|
@@ -23,7 +23,7 @@ export default class ConfigService {
|
|
|
23
23
|
*/
|
|
24
24
|
static env: ConfigEnv | null = null;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
static #configObject: Config | null = null;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Returns the configuration object that has been loaded in for the current
|
|
@@ -33,12 +33,12 @@ export default class ConfigService {
|
|
|
33
33
|
* @returns The configuration object for the current environment.
|
|
34
34
|
*/
|
|
35
35
|
static get config(): Config {
|
|
36
|
-
if (!ConfigService
|
|
36
|
+
if (!ConfigService.#configObject) {
|
|
37
37
|
throw new Error(
|
|
38
38
|
'ConfigService has not been initialized yet. Use ConfigService.useConfig() to initialize it.'
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
-
return ConfigService
|
|
41
|
+
return ConfigService.#configObject;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -47,7 +47,7 @@ export default class ConfigService {
|
|
|
47
47
|
* @returns True if the {@link ConfigService} has been initialized, false otherwise.
|
|
48
48
|
*/
|
|
49
49
|
static get isInitialized(): boolean {
|
|
50
|
-
return !!ConfigService
|
|
50
|
+
return !!ConfigService.#configObject;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -60,7 +60,7 @@ export default class ConfigService {
|
|
|
60
60
|
ConfigService.env = env;
|
|
61
61
|
try {
|
|
62
62
|
const jsonString = await GitHubService.getContentFromRepo('config', `${env}.jsonc`);
|
|
63
|
-
ConfigService
|
|
63
|
+
ConfigService.#configObject = ConfigSchema.parse(parse(jsonString));
|
|
64
64
|
} catch (error) {
|
|
65
65
|
DR.logger.error(`Failed to load ${env}.json, error: ${String(error)}`);
|
|
66
66
|
throw error;
|
|
@@ -4,7 +4,7 @@ export type ConfigEnv = 'local' | 'dev' | 'prod';
|
|
|
4
4
|
* A class which can be used to interact with GitHub.
|
|
5
5
|
*/
|
|
6
6
|
export default class GitHubService {
|
|
7
|
-
private
|
|
7
|
+
#private;
|
|
8
8
|
/**
|
|
9
9
|
* Retrieves the content of a file from a specified GitHub repository.
|
|
10
10
|
*
|
|
@@ -14,12 +14,5 @@ export default class GitHubService {
|
|
|
14
14
|
* @throws {Error} Will throw an error if the content cannot be retrieved.
|
|
15
15
|
*/
|
|
16
16
|
static getContentFromRepo(repoName: string, filePath: string): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new GitHub client using `CONFIG_GITHUB_TOKEN` from the
|
|
19
|
-
* local environment or .env file.
|
|
20
|
-
*
|
|
21
|
-
* @returns A new GitHub client.
|
|
22
|
-
*/
|
|
23
|
-
private static getGitHubClient;
|
|
24
17
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=GitHub.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHub.service.d.ts","sourceRoot":"","sources":["../../src/services/GitHub.service.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;;IAGhC;;;;;;;OAOG;WACU,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA0CrF"}
|
|
@@ -5,7 +5,7 @@ import { Octokit } from 'octokit';
|
|
|
5
5
|
* A class which can be used to interact with GitHub.
|
|
6
6
|
*/
|
|
7
7
|
export default class GitHubService {
|
|
8
|
-
static gitHub = null;
|
|
8
|
+
static #gitHub = null;
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves the content of a file from a specified GitHub repository.
|
|
11
11
|
*
|
|
@@ -15,11 +15,11 @@ export default class GitHubService {
|
|
|
15
15
|
* @throws {Error} Will throw an error if the content cannot be retrieved.
|
|
16
16
|
*/
|
|
17
17
|
static async getContentFromRepo(repoName, filePath) {
|
|
18
|
-
if (!GitHubService
|
|
19
|
-
GitHubService
|
|
18
|
+
if (!GitHubService.#gitHub) {
|
|
19
|
+
GitHubService.#gitHub = GitHubService.#getGitHubClient();
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
|
-
const result = await GitHubService
|
|
22
|
+
const result = await GitHubService.#gitHub.rest.repos.getContent({
|
|
23
23
|
mediaType: {
|
|
24
24
|
format: 'raw'
|
|
25
25
|
},
|
|
@@ -47,7 +47,7 @@ export default class GitHubService {
|
|
|
47
47
|
*
|
|
48
48
|
* @returns A new GitHub client.
|
|
49
49
|
*/
|
|
50
|
-
static getGitHubClient() {
|
|
50
|
+
static #getGitHubClient() {
|
|
51
51
|
const authToken = process.env['CONFIG_GITHUB_TOKEN'];
|
|
52
52
|
if (!authToken) {
|
|
53
53
|
throw new Error('No CONFIG_GITHUB_TOKEN key found in environment variables.');
|
|
@@ -57,4 +57,4 @@ export default class GitHubService {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
//# sourceMappingURL=
|
|
60
|
+
//# sourceMappingURL=GitHub.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHub.service.js","sourceRoot":"","sources":["../../src/services/GitHub.service.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;IAChC,MAAM,CAAC,OAAO,GAAmB,IAAI,CAAC;IAEtC;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,QAAgB;QAChE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC3B,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;QAC3D,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;gBAC/D,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;IACH,MAAM,CAAC,gBAAgB;QACrB,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"}
|
|
@@ -8,7 +8,7 @@ export type ConfigEnv = 'local' | 'dev' | 'prod';
|
|
|
8
8
|
* A class which can be used to interact with GitHub.
|
|
9
9
|
*/
|
|
10
10
|
export default class GitHubService {
|
|
11
|
-
|
|
11
|
+
static #gitHub: Octokit | null = null;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Retrieves the content of a file from a specified GitHub repository.
|
|
@@ -19,11 +19,11 @@ export default class GitHubService {
|
|
|
19
19
|
* @throws {Error} Will throw an error if the content cannot be retrieved.
|
|
20
20
|
*/
|
|
21
21
|
static async getContentFromRepo(repoName: string, filePath: string): Promise<string> {
|
|
22
|
-
if (!GitHubService
|
|
23
|
-
GitHubService
|
|
22
|
+
if (!GitHubService.#gitHub) {
|
|
23
|
+
GitHubService.#gitHub = GitHubService.#getGitHubClient();
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
|
-
const result = await GitHubService
|
|
26
|
+
const result = await GitHubService.#gitHub.rest.repos.getContent({
|
|
27
27
|
mediaType: {
|
|
28
28
|
format: 'raw'
|
|
29
29
|
},
|
|
@@ -51,7 +51,7 @@ export default class GitHubService {
|
|
|
51
51
|
*
|
|
52
52
|
* @returns A new GitHub client.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
static #getGitHubClient(): Octokit {
|
|
55
55
|
const authToken = process.env['CONFIG_GITHUB_TOKEN'];
|
|
56
56
|
if (!authToken) {
|
|
57
57
|
throw new Error('No CONFIG_GITHUB_TOKEN key found in environment variables.');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Translation.service.d.ts","sourceRoot":"","sources":["../../../src/services/TranslationService/Translation.service.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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DR } from '@aneuhold/core-ts-lib';
|
|
2
2
|
import 'dotenv/config';
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
|
-
import GitHubService from '../
|
|
4
|
+
import GitHubService from '../GitHub.service.js';
|
|
5
5
|
/**
|
|
6
6
|
* Defines the available sources for translation files.
|
|
7
7
|
*
|
|
@@ -40,4 +40,4 @@ export default class TranslationService {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
//# sourceMappingURL=
|
|
43
|
+
//# sourceMappingURL=Translation.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Translation.service.js","sourceRoot":"","sources":["../../../src/services/TranslationService/Translation.service.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,sBAAsB,CAAC;AAEjD;;;;;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"}
|
|
@@ -2,7 +2,7 @@ import type { Translations } from '@aneuhold/core-ts-api-lib';
|
|
|
2
2
|
import { DR } from '@aneuhold/core-ts-lib';
|
|
3
3
|
import 'dotenv/config';
|
|
4
4
|
import { parse } from 'jsonc-parser';
|
|
5
|
-
import GitHubService from '../
|
|
5
|
+
import GitHubService from '../GitHub.service.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Defines the available sources for translation files.
|
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.16",
|
|
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",
|
|
@@ -54,8 +54,8 @@
|
|
|
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.39",
|
|
58
|
+
"@aneuhold/core-ts-lib": "^2.4.5",
|
|
59
59
|
"dotenv": "^17.2.3",
|
|
60
60
|
"jsonc-parser": "^3.3.1",
|
|
61
61
|
"node-fetch": "^3.3.2",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"zod": "^4.1.13"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@aneuhold/local-npm-registry": "^0.2.
|
|
67
|
-
"@aneuhold/main-scripts": "^2.9.
|
|
66
|
+
"@aneuhold/local-npm-registry": "^0.2.33",
|
|
67
|
+
"@aneuhold/main-scripts": "^2.9.5",
|
|
68
68
|
"@types/node": "^25.0.2",
|
|
69
69
|
"@types/node-fetch": "^2.6.13",
|
|
70
70
|
"eslint": "^9.39.2",
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|