@acmekit/translation 2.13.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.
Files changed (58) hide show
  1. package/dist/index.d.ts +8 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +16 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/loaders/defaults.d.ts +4 -0
  6. package/dist/loaders/defaults.d.ts.map +1 -0
  7. package/dist/loaders/defaults.js +84 -0
  8. package/dist/loaders/defaults.js.map +1 -0
  9. package/dist/migrations/Migration20251208124155.d.ts +6 -0
  10. package/dist/migrations/Migration20251208124155.d.ts.map +1 -0
  11. package/dist/migrations/Migration20251208124155.js +26 -0
  12. package/dist/migrations/Migration20251208124155.js.map +1 -0
  13. package/dist/migrations/Migration20251215083927.d.ts +6 -0
  14. package/dist/migrations/Migration20251215083927.d.ts.map +1 -0
  15. package/dist/migrations/Migration20251215083927.js +14 -0
  16. package/dist/migrations/Migration20251215083927.js.map +1 -0
  17. package/dist/migrations/Migration20251218140235.d.ts +6 -0
  18. package/dist/migrations/Migration20251218140235.d.ts.map +1 -0
  19. package/dist/migrations/Migration20251218140235.js +17 -0
  20. package/dist/migrations/Migration20251218140235.js.map +1 -0
  21. package/dist/migrations/Migration20260108122757.d.ts +6 -0
  22. package/dist/migrations/Migration20260108122757.d.ts.map +1 -0
  23. package/dist/migrations/Migration20260108122757.js +14 -0
  24. package/dist/migrations/Migration20260108122757.js.map +1 -0
  25. package/dist/models/index.d.ts +4 -0
  26. package/dist/models/index.d.ts.map +1 -0
  27. package/dist/models/index.js +13 -0
  28. package/dist/models/index.js.map +1 -0
  29. package/dist/models/locale.d.ts +13 -0
  30. package/dist/models/locale.d.ts.map +1 -0
  31. package/dist/models/locale.js +23 -0
  32. package/dist/models/locale.js.map +1 -0
  33. package/dist/models/settings.d.ts +26 -0
  34. package/dist/models/settings.d.ts.map +1 -0
  35. package/dist/models/settings.js +36 -0
  36. package/dist/models/settings.js.map +1 -0
  37. package/dist/models/translation.d.ts +36 -0
  38. package/dist/models/translation.d.ts.map +1 -0
  39. package/dist/models/translation.js +58 -0
  40. package/dist/models/translation.js.map +1 -0
  41. package/dist/services/translation-module.d.ts +70 -0
  42. package/dist/services/translation-module.d.ts.map +1 -0
  43. package/dist/services/translation-module.js +468 -0
  44. package/dist/services/translation-module.js.map +1 -0
  45. package/dist/tsconfig.tsbuildinfo +1 -0
  46. package/dist/types/index.d.ts +37 -0
  47. package/dist/types/index.d.ts.map +1 -0
  48. package/dist/types/index.js +3 -0
  49. package/dist/types/index.js.map +1 -0
  50. package/dist/utils/compute-translated-field-count.d.ts +12 -0
  51. package/dist/utils/compute-translated-field-count.d.ts.map +1 -0
  52. package/dist/utils/compute-translated-field-count.js +23 -0
  53. package/dist/utils/compute-translated-field-count.js.map +1 -0
  54. package/dist/utils/filter-translation-fields.d.ts +3 -0
  55. package/dist/utils/filter-translation-fields.d.ts.map +1 -0
  56. package/dist/utils/filter-translation-fields.js +22 -0
  57. package/dist/utils/filter-translation-fields.js.map +1 -0
  58. package/package.json +45 -0
@@ -0,0 +1,8 @@
1
+ import "./types";
2
+ import TranslationModuleService from "./services/translation-module";
3
+ export declare const TRANSLATION_MODULE = "translation";
4
+ declare const _default: import("@acmekit/types").ModuleExports<typeof TranslationModuleService> & {
5
+ linkable: Record<string, any>;
6
+ };
7
+ export default _default;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAEhB,OAAO,wBAAwB,MAAM,8BAA8B,CAAA;AAGnE,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;;;;AAE/C,wBAGE"}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TRANSLATION_MODULE = void 0;
7
+ require("./types");
8
+ const utils_1 = require("@acmekit/framework/utils");
9
+ const translation_module_1 = __importDefault(require("./services/translation-module"));
10
+ const defaults_1 = __importDefault(require("./loaders/defaults"));
11
+ exports.TRANSLATION_MODULE = "translation";
12
+ exports.default = (0, utils_1.Module)(exports.TRANSLATION_MODULE, {
13
+ service: translation_module_1.default,
14
+ loaders: [defaults_1.default],
15
+ });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mBAAgB;AAChB,oDAAiD;AACjD,sFAAmE;AACnE,kEAA6C;AAEhC,QAAA,kBAAkB,GAAG,aAAa,CAAA;AAE/C,kBAAe,IAAA,cAAM,EAAC,0BAAkB,EAAE;IACxC,OAAO,EAAE,4BAAwB;IACjC,OAAO,EAAE,CAAC,kBAAY,CAAC;CACxB,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { LoaderOptions } from "@acmekit/framework/types";
2
+ declare const _default: ({ container }: LoaderOptions) => Promise<void>;
3
+ export default _default;
4
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/loaders/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGd,MAAM,0BAA0B,CAAA;yBAmEX,eAAe,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAAlE,wBA+BC"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@acmekit/framework/utils");
4
+ /**
5
+ * BCP 47 Language Tags
6
+ * Common language-region codes following the IETF BCP 47 standard.
7
+ * Format: language[-script][-region]
8
+ * Examples: "en-US" (English, United States), "zh-Hans-CN" (Chinese Simplified, China)
9
+ */
10
+ const defaultLocales = [
11
+ { code: "en-US", name: "English (United States)" },
12
+ { code: "en-GB", name: "English (United Kingdom)" },
13
+ { code: "en-AU", name: "English (Australia)" },
14
+ { code: "en-CA", name: "English (Canada)" },
15
+ { code: "es-ES", name: "Spanish (Spain)" },
16
+ { code: "es-MX", name: "Spanish (Mexico)" },
17
+ { code: "es-AR", name: "Spanish (Argentina)" },
18
+ { code: "fr-FR", name: "French (France)" },
19
+ { code: "fr-CA", name: "French (Canada)" },
20
+ { code: "fr-BE", name: "French (Belgium)" },
21
+ { code: "de-DE", name: "German (Germany)" },
22
+ { code: "de-AT", name: "German (Austria)" },
23
+ { code: "de-CH", name: "German (Switzerland)" },
24
+ { code: "it-IT", name: "Italian (Italy)" },
25
+ { code: "pt-BR", name: "Portuguese (Brazil)" },
26
+ { code: "pt-PT", name: "Portuguese (Portugal)" },
27
+ { code: "nl-NL", name: "Dutch (Netherlands)" },
28
+ { code: "nl-BE", name: "Dutch (Belgium)" },
29
+ { code: "da-DK", name: "Danish (Denmark)" },
30
+ { code: "sv-SE", name: "Swedish (Sweden)" },
31
+ { code: "nb-NO", name: "Norwegian Bokmål (Norway)" },
32
+ { code: "fi-FI", name: "Finnish (Finland)" },
33
+ { code: "pl-PL", name: "Polish (Poland)" },
34
+ { code: "lt-LT", name: "Lithuanian (Lithuania)" },
35
+ { code: "cs-CZ", name: "Czech (Czech Republic)" },
36
+ { code: "sk-SK", name: "Slovak (Slovakia)" },
37
+ { code: "hu-HU", name: "Hungarian (Hungary)" },
38
+ { code: "ro-RO", name: "Romanian (Romania)" },
39
+ { code: "bg-BG", name: "Bulgarian (Bulgaria)" },
40
+ { code: "el-GR", name: "Greek (Greece)" },
41
+ { code: "tr-TR", name: "Turkish (Turkey)" },
42
+ { code: "ru-RU", name: "Russian (Russia)" },
43
+ { code: "uk-UA", name: "Ukrainian (Ukraine)" },
44
+ { code: "ar-SA", name: "Arabic (Saudi Arabia)" },
45
+ { code: "ar-AE", name: "Arabic (United Arab Emirates)" },
46
+ { code: "ar-EG", name: "Arabic (Egypt)" },
47
+ { code: "he-IL", name: "Hebrew (Israel)" },
48
+ { code: "hi-IN", name: "Hindi (India)" },
49
+ { code: "bn-BD", name: "Bengali (Bangladesh)" },
50
+ { code: "th-TH", name: "Thai (Thailand)" },
51
+ { code: "vi-VN", name: "Vietnamese (Vietnam)" },
52
+ { code: "id-ID", name: "Indonesian (Indonesia)" },
53
+ { code: "ms-MY", name: "Malay (Malaysia)" },
54
+ { code: "tl-PH", name: "Tagalog (Philippines)" },
55
+ { code: "zh-CN", name: "Chinese Simplified (China)" },
56
+ { code: "zh-TW", name: "Chinese Traditional (Taiwan)" },
57
+ { code: "zh-HK", name: "Chinese Traditional (Hong Kong)" },
58
+ { code: "ja-JP", name: "Japanese (Japan)" },
59
+ { code: "ko-KR", name: "Korean (South Korea)" },
60
+ { code: "ka-GE", name: "Georgian (Georgia)" },
61
+ { code: "mn-MN", name: "Mongolian (Mongolia)" },
62
+ ];
63
+ exports.default = async ({ container }) => {
64
+ const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER) ?? console;
65
+ const localeService_ = container.resolve("localeService");
66
+ try {
67
+ // Fetch existing locales to map their IDs for upsert
68
+ // The upsert method uses `id` as the key, so we need to include IDs for existing locales
69
+ const existingLocales = await localeService_.list({}, { select: ["id", "code"] });
70
+ const existingByCode = new Map(existingLocales.map((l) => [l.code, l.id]));
71
+ // Map default locales to include IDs for existing ones
72
+ const localesToUpsert = defaultLocales.map((locale) => {
73
+ const normalizedCode = (0, utils_1.normalizeLocale)(locale.code);
74
+ const existingId = existingByCode.get(normalizedCode);
75
+ return existingId ? { ...locale, id: existingId } : locale;
76
+ });
77
+ const resp = await localeService_.upsert(localesToUpsert);
78
+ logger.debug(`Loaded ${resp.length} locales`);
79
+ }
80
+ catch (error) {
81
+ logger.warn(`Failed to load locales, skipping loader. Original error: ${error.message}`);
82
+ }
83
+ };
84
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version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MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAC3B,CAAA;QACD,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAC3C,CAAA;QAED,uDAAuD;QACvD,MAAM,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACpD,MAAM,cAAc,GAAG,IAAA,uBAAe,EAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACnD,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;YACrD,OAAO,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;QAC5D,CAAC,CAAC,CAAA;QAEF,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;QACzD,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,MAAM,UAAU,CAAC,CAAA;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CACT,4DAA4D,KAAK,CAAC,OAAO,EAAE,CAC5E,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Migration } from "@acmekit/framework/mikro-orm/migrations";
2
+ export declare class Migration20251208124155 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20251208124155.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20251208124155.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20251208124155.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAEnE,qBAAa,uBAAwB,SAAQ,SAAS;IACrC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAwCnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAKrC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20251208124155 = void 0;
4
+ const migrations_1 = require("@acmekit/framework/mikro-orm/migrations");
5
+ class Migration20251208124155 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql(`alter table if exists "translation" drop constraint if exists "translation_reference_id_locale_code_unique";`);
8
+ this.addSql(`alter table if exists "locale" drop constraint if exists "locale_code_unique";`);
9
+ this.addSql(`create table if not exists "locale" ("id" text not null, "code" text not null, "name" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "locale_pkey" primary key ("id"));`);
10
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_locale_deleted_at" ON "locale" ("deleted_at") WHERE deleted_at IS NULL;`);
11
+ this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_locale_code_unique" ON "locale" ("code") WHERE deleted_at IS NULL;`);
12
+ this.addSql(`create table if not exists "translation" ("id" text not null, "reference_id" text not null, "reference" text not null, "locale_code" text not null, "translations" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "translation_pkey" primary key ("id"));`);
13
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_translation_deleted_at" ON "translation" ("deleted_at") WHERE deleted_at IS NULL;`);
14
+ this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_translation_reference_id_locale_code_unique" ON "translation" ("reference_id", "locale_code") WHERE deleted_at IS NULL;`);
15
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_translation_reference_id_reference_locale_code" ON "translation" ("reference_id", "reference", "locale_code") WHERE deleted_at IS NULL;`);
16
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_translation_reference_locale_code" ON "translation" ("reference", "locale_code") WHERE deleted_at IS NULL;`);
17
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_translation_reference_id_reference" ON "translation" ("reference_id", "reference") WHERE deleted_at IS NULL;`);
18
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_translation_locale_code" ON "translation" ("locale_code") WHERE deleted_at IS NULL;`);
19
+ }
20
+ async down() {
21
+ this.addSql(`drop table if exists "locale" cascade;`);
22
+ this.addSql(`drop table if exists "translation" cascade;`);
23
+ }
24
+ }
25
+ exports.Migration20251208124155 = Migration20251208124155;
26
+ //# sourceMappingURL=Migration20251208124155.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20251208124155.js","sourceRoot":"","sources":["../../src/migrations/Migration20251208124155.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEnE,MAAa,uBAAwB,SAAQ,sBAAS;IAC3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CACT,8GAA8G,CAC/G,CAAA;QACD,IAAI,CAAC,MAAM,CACT,gFAAgF,CACjF,CAAA;QACD,IAAI,CAAC,MAAM,CACT,qRAAqR,CACtR,CAAA;QACD,IAAI,CAAC,MAAM,CACT,yGAAyG,CAC1G,CAAA;QACD,IAAI,CAAC,MAAM,CACT,2GAA2G,CAC5G,CAAA;QAED,IAAI,CAAC,MAAM,CACT,wWAAwW,CACzW,CAAA;QACD,IAAI,CAAC,MAAM,CACT,mHAAmH,CACpH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,gKAAgK,CACjK,CAAA;QACD,IAAI,CAAC,MAAM,CACT,yKAAyK,CAC1K,CAAA;QACD,IAAI,CAAC,MAAM,CACT,4IAA4I,CAC7I,CAAA;QACD,IAAI,CAAC,MAAM,CACT,8IAA8I,CAC/I,CAAA;QACD,IAAI,CAAC,MAAM,CACT,qHAAqH,CACtH,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAA;QAErD,IAAI,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAA;IAC5D,CAAC;CACF;AA9CD,0DA8CC"}
@@ -0,0 +1,6 @@
1
+ import { Migration } from "@acmekit/framework/mikro-orm/migrations";
2
+ export declare class Migration20251215083927 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20251215083927.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20251215083927.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20251215083927.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAEnE,qBAAa,uBAAwB,SAAQ,SAAS;IACrC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAMnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAKrC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20251215083927 = void 0;
4
+ const migrations_1 = require("@acmekit/framework/mikro-orm/migrations");
5
+ class Migration20251215083927 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql(`alter table if exists "translation" add column if not exists "translated_field_count" integer not null default 0;`);
8
+ }
9
+ async down() {
10
+ this.addSql(`alter table if exists "translation" drop column if exists "translated_field_count";`);
11
+ }
12
+ }
13
+ exports.Migration20251215083927 = Migration20251215083927;
14
+ //# sourceMappingURL=Migration20251215083927.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20251215083927.js","sourceRoot":"","sources":["../../src/migrations/Migration20251215083927.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEnE,MAAa,uBAAwB,SAAQ,sBAAS;IAC3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CACT,mHAAmH,CACpH,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CACT,qFAAqF,CACtF,CAAA;IACH,CAAC;CACF;AAZD,0DAYC"}
@@ -0,0 +1,6 @@
1
+ import { Migration } from "@acmekit/framework/mikro-orm/migrations";
2
+ export declare class Migration20251218140235 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20251218140235.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20251218140235.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20251218140235.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAEnE,qBAAa,uBAAwB,SAAQ,SAAS;IACrC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAenB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20251218140235 = void 0;
4
+ const migrations_1 = require("@acmekit/framework/mikro-orm/migrations");
5
+ class Migration20251218140235 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql(`alter table if exists "translation_settings" drop constraint if exists "translation_settings_entity_type_unique";`);
8
+ this.addSql(`create table if not exists "translation_settings" ("id" text not null, "entity_type" text not null, "fields" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "translation_settings_pkey" primary key ("id"));`);
9
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_translation_settings_deleted_at" ON "translation_settings" ("deleted_at") WHERE deleted_at IS NULL;`);
10
+ this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_translation_settings_entity_type_unique" ON "translation_settings" ("entity_type") WHERE deleted_at IS NULL;`);
11
+ }
12
+ async down() {
13
+ this.addSql(`drop table if exists "translation_settings" cascade;`);
14
+ }
15
+ }
16
+ exports.Migration20251218140235 = Migration20251218140235;
17
+ //# sourceMappingURL=Migration20251218140235.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20251218140235.js","sourceRoot":"","sources":["../../src/migrations/Migration20251218140235.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEnE,MAAa,uBAAwB,SAAQ,sBAAS;IAC3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CACT,mHAAmH,CACpH,CAAA;QACD,IAAI,CAAC,MAAM,CACT,2TAA2T,CAC5T,CAAA;QACD,IAAI,CAAC,MAAM,CACT,qIAAqI,CACtI,CAAA;QACD,IAAI,CAAC,MAAM,CACT,qJAAqJ,CACtJ,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,sDAAsD,CAAC,CAAA;IACrE,CAAC;CACF;AAnBD,0DAmBC"}
@@ -0,0 +1,6 @@
1
+ import { Migration } from "@acmekit/framework/mikro-orm/migrations";
2
+ export declare class Migration20260108122757 extends Migration {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=Migration20260108122757.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20260108122757.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20260108122757.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,qBAAa,uBAAwB,SAAQ,SAAS;IAErC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAInB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAIrC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20260108122757 = void 0;
4
+ const migrations_1 = require("@acmekit/framework/mikro-orm/migrations");
5
+ class Migration20260108122757 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql(`alter table if exists "translation_settings" add column if not exists "is_active" boolean not null default true;`);
8
+ }
9
+ async down() {
10
+ this.addSql(`alter table if exists "translation_settings" drop column if exists "is_active";`);
11
+ }
12
+ }
13
+ exports.Migration20260108122757 = Migration20260108122757;
14
+ //# sourceMappingURL=Migration20260108122757.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20260108122757.js","sourceRoot":"","sources":["../../src/migrations/Migration20260108122757.ts"],"names":[],"mappings":";;;AAAA,wEAAoE;AAEpE,MAAa,uBAAwB,SAAQ,sBAAS;IAE3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC,kHAAkH,CAAC,CAAC;IAClI,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,iFAAiF,CAAC,CAAC;IACjG,CAAC;CAEF;AAVD,0DAUC"}
@@ -0,0 +1,4 @@
1
+ export { default as Translation } from "./translation";
2
+ export { default as Locale } from "./locale";
3
+ export { default as Settings } from "./settings";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Settings = exports.Locale = exports.Translation = void 0;
7
+ var translation_1 = require("./translation");
8
+ Object.defineProperty(exports, "Translation", { enumerable: true, get: function () { return __importDefault(translation_1).default; } });
9
+ var locale_1 = require("./locale");
10
+ Object.defineProperty(exports, "Locale", { enumerable: true, get: function () { return __importDefault(locale_1).default; } });
11
+ var settings_1 = require("./settings");
12
+ Object.defineProperty(exports, "Settings", { enumerable: true, get: function () { return __importDefault(settings_1).default; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,mCAA4C;AAAnC,iHAAA,OAAO,OAAU;AAC1B,uCAAgD;AAAvC,qHAAA,OAAO,OAAY"}
@@ -0,0 +1,13 @@
1
+ declare const Locale: import("@acmekit/framework/utils").DmlEntity<import("@acmekit/framework/utils").DMLEntitySchemaBuilder<{
2
+ id: import("@acmekit/framework/utils").PrimaryKeyModifier<string, import("@acmekit/framework/utils").IdProperty>;
3
+ /**
4
+ * The BCP 47 language tag code of the locale (e.g., "en-US", "da-DK").
5
+ */
6
+ code: import("@acmekit/framework/utils").TextProperty;
7
+ /**
8
+ * The human-readable name of the locale (e.g., "English (US)", "Danish").
9
+ */
10
+ name: import("@acmekit/framework/utils").TextProperty;
11
+ }>, "locale">;
12
+ export default Locale;
13
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/models/locale.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;IAGR;;OAEG;;IAEH;;OAEG;;aAQH,CAAA;AAEJ,eAAe,MAAM,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@acmekit/framework/utils");
4
+ const Locale = utils_1.model
5
+ .define("locale", {
6
+ id: utils_1.model.id({ prefix: "loc" }).primaryKey(),
7
+ /**
8
+ * The BCP 47 language tag code of the locale (e.g., "en-US", "da-DK").
9
+ */
10
+ code: utils_1.model.text().searchable(),
11
+ /**
12
+ * The human-readable name of the locale (e.g., "English (US)", "Danish").
13
+ */
14
+ name: utils_1.model.text().searchable(),
15
+ })
16
+ .indexes([
17
+ {
18
+ on: ["code"],
19
+ unique: true,
20
+ },
21
+ ]);
22
+ exports.default = Locale;
23
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/models/locale.ts"],"names":[],"mappings":";;AAAA,oDAAgD;AAEhD,MAAM,MAAM,GAAG,aAAK;KACjB,MAAM,CAAC,QAAQ,EAAE;IAChB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE;IAC5C;;OAEG;IACH,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC/B;;OAEG;IACH,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;CAChC,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,MAAM,CAAC;QACZ,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAA;AAEJ,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @since 2.12.4
3
+ */
4
+ declare const Settings: import("@acmekit/framework/utils").DmlEntity<import("@acmekit/framework/utils").DMLEntitySchemaBuilder<{
5
+ id: import("@acmekit/framework/utils").PrimaryKeyModifier<string, import("@acmekit/framework/utils").IdProperty>;
6
+ /**
7
+ * The entity type that these settings apply to (e.g., "product", "product_variant").
8
+ */
9
+ entity_type: import("@acmekit/framework/utils").TextProperty;
10
+ /**
11
+ * The translatable fields for this entity type.
12
+ * Array of field names that can be translated.
13
+ *
14
+ * @example
15
+ * ["title", "description", "material"]
16
+ */
17
+ fields: import("@acmekit/framework/utils").JSONProperty;
18
+ /**
19
+ * Wether the entity translatable status is enabled.
20
+ *
21
+ * @since 2.13.0
22
+ */
23
+ is_active: import("@acmekit/framework/utils").BooleanProperty;
24
+ }>, "translation_settings">;
25
+ export default Settings;
26
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/models/settings.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,QAAA,MAAM,QAAQ;;IAGV;;OAEG;;IAEH;;;;;;OAMG;;IAEH;;;;OAIG;;2BAQH,CAAA;AAEJ,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@acmekit/framework/utils");
4
+ /**
5
+ * @since 2.12.4
6
+ */
7
+ const Settings = utils_1.model
8
+ .define("translation_settings", {
9
+ id: utils_1.model.id({ prefix: "trset" }).primaryKey(),
10
+ /**
11
+ * The entity type that these settings apply to (e.g., "product", "product_variant").
12
+ */
13
+ entity_type: utils_1.model.text().searchable(),
14
+ /**
15
+ * The translatable fields for this entity type.
16
+ * Array of field names that can be translated.
17
+ *
18
+ * @example
19
+ * ["title", "description", "material"]
20
+ */
21
+ fields: utils_1.model.json(),
22
+ /**
23
+ * Wether the entity translatable status is enabled.
24
+ *
25
+ * @since 2.13.0
26
+ */
27
+ is_active: utils_1.model.boolean().default(true),
28
+ })
29
+ .indexes([
30
+ {
31
+ on: ["entity_type"],
32
+ unique: true,
33
+ },
34
+ ]);
35
+ exports.default = Settings;
36
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/models/settings.ts"],"names":[],"mappings":";;AAAA,oDAAgD;AAEhD;;GAEG;AACH,MAAM,QAAQ,GAAG,aAAK;KACnB,MAAM,CAAC,sBAAsB,EAAE;IAC9B,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C;;OAEG;IACH,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACtC;;;;;;OAMG;IACH,MAAM,EAAE,aAAK,CAAC,IAAI,EAAE;IACpB;;;;OAIG;IACH,SAAS,EAAE,aAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACzC,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,aAAa,CAAC;QACnB,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAA;AAEJ,kBAAe,QAAQ,CAAA"}
@@ -0,0 +1,36 @@
1
+ declare const Translation: import("@acmekit/framework/utils").DmlEntity<import("@acmekit/framework/utils").DMLEntitySchemaBuilder<{
2
+ id: import("@acmekit/framework/utils").PrimaryKeyModifier<string, import("@acmekit/framework/utils").IdProperty>;
3
+ /**
4
+ * The ID of the entity that the translation belongs to. For example, the ID of a product or a product variant.
5
+ */
6
+ reference_id: import("@acmekit/framework/utils").TextProperty;
7
+ /**
8
+ * The name of the table that the translation belongs to. For example, "product" or "product_variant".
9
+ */
10
+ reference: import("@acmekit/framework/utils").TextProperty;
11
+ /**
12
+ * The BCP 47 language tag code of the locale
13
+ *
14
+ * @example
15
+ * "en-US"
16
+ */
17
+ locale_code: import("@acmekit/framework/utils").TextProperty;
18
+ /**
19
+ * The translations of the entity.
20
+ * The object's keys are the field names of the entity, and its value is the translated value.
21
+ *
22
+ * @example
23
+ * {
24
+ * "title": "Product Title",
25
+ * "description": "Product Description",
26
+ * }
27
+ */
28
+ translations: import("@acmekit/framework/utils").JSONProperty;
29
+ /**
30
+ * Precomputed count of translated fields of a resource.
31
+ * Useful for optimization purposes.
32
+ */
33
+ translated_field_count: import("@acmekit/framework/utils").NumberProperty;
34
+ }>, "translation">;
35
+ export default Translation;
36
+ //# sourceMappingURL=translation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../src/models/translation.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW;;IAGb;;OAEG;;IAEH;;OAEG;;IAEH;;;;;OAKG;;IAEH;;;;;;;;;OASG;;IAEH;;;OAGG;;kBAoBH,CAAA;AAEJ,eAAe,WAAW,CAAA"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@acmekit/framework/utils");
4
+ const Translation = utils_1.model
5
+ .define("translation", {
6
+ id: utils_1.model.id({ prefix: "trans" }).primaryKey(),
7
+ /**
8
+ * The ID of the entity that the translation belongs to. For example, the ID of a product or a product variant.
9
+ */
10
+ reference_id: utils_1.model.text().searchable(),
11
+ /**
12
+ * The name of the table that the translation belongs to. For example, "product" or "product_variant".
13
+ */
14
+ reference: utils_1.model.text().searchable(),
15
+ /**
16
+ * The BCP 47 language tag code of the locale
17
+ *
18
+ * @example
19
+ * "en-US"
20
+ */
21
+ locale_code: utils_1.model.text().searchable(),
22
+ /**
23
+ * The translations of the entity.
24
+ * The object's keys are the field names of the entity, and its value is the translated value.
25
+ *
26
+ * @example
27
+ * {
28
+ * "title": "Product Title",
29
+ * "description": "Product Description",
30
+ * }
31
+ */
32
+ translations: utils_1.model.json(),
33
+ /**
34
+ * Precomputed count of translated fields of a resource.
35
+ * Useful for optimization purposes.
36
+ */
37
+ translated_field_count: utils_1.model.number().default(0),
38
+ })
39
+ .indexes([
40
+ {
41
+ on: ["reference_id", "locale_code"],
42
+ unique: true,
43
+ },
44
+ {
45
+ on: ["reference_id", "reference", "locale_code"],
46
+ },
47
+ {
48
+ on: ["reference", "locale_code"],
49
+ },
50
+ {
51
+ on: ["reference_id", "reference"],
52
+ },
53
+ {
54
+ on: ["locale_code"],
55
+ },
56
+ ]);
57
+ exports.default = Translation;
58
+ //# sourceMappingURL=translation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation.js","sourceRoot":"","sources":["../../src/models/translation.ts"],"names":[],"mappings":";;AAAA,oDAAgD;AAEhD,MAAM,WAAW,GAAG,aAAK;KACtB,MAAM,CAAC,aAAa,EAAE;IACrB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C;;OAEG;IACH,YAAY,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACvC;;OAEG;IACH,SAAS,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACpC;;;;;OAKG;IACH,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACtC;;;;;;;;;OASG;IACH,YAAY,EAAE,aAAK,CAAC,IAAI,EAAE;IAC1B;;;OAGG;IACH,sBAAsB,EAAE,aAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAClD,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,cAAc,EAAE,aAAa,CAAC;QACnC,MAAM,EAAE,IAAI;KACb;IACD;QACE,EAAE,EAAE,CAAC,cAAc,EAAE,WAAW,EAAE,aAAa,CAAC;KACjD;IACD;QACE,EAAE,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC;KACjC;IACD;QACE,EAAE,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC;KAClC;IACD;QACE,EAAE,EAAE,CAAC,aAAa,CAAC;KACpB;CACF,CAAC,CAAA;AAEJ,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { Context, CreateTranslationDTO, CreateTranslationSettingsDTO, DAL, FilterableTranslationProps, FindConfig, ITranslationModuleService, ModulesSdkTypes, TranslationTypes, UpdateTranslationSettingsDTO } from "@acmekit/framework/types";
2
+ import Locale from "../models/locale";
3
+ import Translation from "../models/translation";
4
+ import Settings from "../models/settings";
5
+ type InjectedDependencies = {
6
+ baseRepository: DAL.RepositoryService;
7
+ translationService: ModulesSdkTypes.IAcmeKitInternalService<typeof Translation>;
8
+ localeService: ModulesSdkTypes.IAcmeKitInternalService<typeof Locale>;
9
+ translationSettingsService: ModulesSdkTypes.IAcmeKitInternalService<typeof Settings>;
10
+ };
11
+ declare const TranslationModuleService_base: import("@acmekit/framework/utils").AcmeKitServiceReturnType<{
12
+ Locale: {
13
+ dto: TranslationTypes.LocaleDTO;
14
+ };
15
+ Translation: {
16
+ dto: TranslationTypes.TranslationDTO;
17
+ };
18
+ TranslationSettings: {
19
+ dto: TranslationTypes.TranslationSettingsDTO;
20
+ };
21
+ }>;
22
+ export default class TranslationModuleService extends TranslationModuleService_base implements ITranslationModuleService {
23
+ protected baseRepository_: DAL.RepositoryService;
24
+ protected translationService_: ModulesSdkTypes.IAcmeKitInternalService<typeof Translation>;
25
+ protected localeService_: ModulesSdkTypes.IAcmeKitInternalService<typeof Locale>;
26
+ protected settingsService_: ModulesSdkTypes.IAcmeKitInternalService<typeof Settings>;
27
+ constructor({ baseRepository, translationService, localeService, translationSettingsService, }: InjectedDependencies);
28
+ __hooks: {
29
+ onApplicationStart: () => Promise<void>;
30
+ };
31
+ protected onApplicationStart_(): Promise<void>;
32
+ getTranslatableFields(entityType?: string, sharedContext?: Context): Promise<Record<string, string[]>>;
33
+ getInactiveTranslatableFields(entityType?: string, sharedContext?: Context): Promise<Record<string, string[]>>;
34
+ static prepareFilters(filters: FilterableTranslationProps): FilterableTranslationProps;
35
+ retrieveTranslation(id: string, config?: FindConfig<TranslationTypes.TranslationDTO>, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO>;
36
+ /**
37
+ * Ensures the 'reference' field is included in the select config.
38
+ * This is needed for filtering translations by translatable fields.
39
+ */
40
+ static ensureReferenceFieldInConfig(config: FindConfig<TranslationTypes.TranslationDTO>): FindConfig<TranslationTypes.TranslationDTO>;
41
+ listTranslations(filters?: FilterableTranslationProps, config?: FindConfig<TranslationTypes.TranslationDTO>, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO[]>;
42
+ listAndCountTranslations(filters?: FilterableTranslationProps, config?: FindConfig<TranslationTypes.TranslationDTO>, sharedContext?: Context): Promise<[TranslationTypes.TranslationDTO[], number]>;
43
+ createLocales(data: TranslationTypes.CreateLocaleDTO[], sharedContext?: Context): Promise<TranslationTypes.LocaleDTO[]>;
44
+ createLocales(data: TranslationTypes.CreateLocaleDTO, sharedContext?: Context): Promise<TranslationTypes.LocaleDTO>;
45
+ createTranslations(data: CreateTranslationDTO, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO>;
46
+ createTranslations(data: CreateTranslationDTO[], sharedContext?: Context): Promise<TranslationTypes.TranslationDTO[]>;
47
+ updateTranslations(data: TranslationTypes.UpdateTranslationDTO, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO>;
48
+ updateTranslations(data: TranslationTypes.UpdateTranslationDTO[], sharedContext?: Context): Promise<TranslationTypes.TranslationDTO[]>;
49
+ createTranslationSettings(data: CreateTranslationSettingsDTO[] | CreateTranslationSettingsDTO, sharedContext?: Context): Promise<TranslationTypes.TranslationSettingsDTO | TranslationTypes.TranslationSettingsDTO[]>;
50
+ updateTranslationSettings(data: UpdateTranslationSettingsDTO | UpdateTranslationSettingsDTO[], sharedContext?: Context): Promise<TranslationTypes.TranslationSettingsDTO[] | TranslationTypes.TranslationSettingsDTO>;
51
+ getStatistics(input: TranslationTypes.TranslationStatisticsInput, sharedContext?: Context): Promise<TranslationTypes.TranslationStatisticsOutput>;
52
+ /**
53
+ * Validates the translation settings to create or update against the translatable entities and their translatable fields configuration.
54
+ * @param dataToValidate - The data to validate.
55
+ */
56
+ static validateSettings(dataToValidate: (CreateTranslationSettingsDTO | (UpdateTranslationSettingsDTO & {
57
+ entity_type: string;
58
+ }))[]): void;
59
+ /**
60
+ * Ensures the entity type is set for the settings to be created or updated. This is useful for validation purposes and recomputing the translated field count.
61
+ * @param settings - The settings to ensure the entity type for.
62
+ * @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
63
+ * @returns The settings with the entity type set.
64
+ */
65
+ protected ensureEntityType_(settings: (CreateTranslationSettingsDTO | UpdateTranslationSettingsDTO)[], sharedContext?: Context): Promise<(CreateTranslationSettingsDTO | (UpdateTranslationSettingsDTO & {
66
+ entity_type: string;
67
+ }))[]>;
68
+ }
69
+ export {};
70
+ //# sourceMappingURL=translation-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-module.d.ts","sourceRoot":"","sources":["../../src/services/translation-module.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,4BAA4B,EAC5B,GAAG,EACH,0BAA0B,EAC1B,UAAU,EACV,yBAAyB,EAEzB,eAAe,EACf,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,0BAA0B,CAAA;AAcjC,OAAO,MAAM,MAAM,gBAAgB,CAAA;AACnC,OAAO,WAAW,MAAM,qBAAqB,CAAA;AAC7C,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AAIvC,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,kBAAkB,EAAE,eAAe,CAAC,uBAAuB,CAAC,OAAO,WAAW,CAAC,CAAA;IAC/E,aAAa,EAAE,eAAe,CAAC,uBAAuB,CAAC,OAAO,MAAM,CAAC,CAAA;IACrE,0BAA0B,EAAE,eAAe,CAAC,uBAAuB,CACjE,OAAO,QAAQ,CAChB,CAAA;CACF,CAAA;;YAIW;QACN,GAAG,EAAE,gBAAgB,CAAC,SAAS,CAAA;KAChC;iBACY;QACX,GAAG,EAAE,gBAAgB,CAAC,cAAc,CAAA;KACrC;yBACoB;QACnB,GAAG,EAAE,gBAAgB,CAAC,sBAAsB,CAAA;KAC7C;;AAVL,MAAM,CAAC,OAAO,OAAO,wBACnB,SAAQ,6BAeR,YAAW,yBAAyB;IAEpC,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,iBAAiB,CAAA;IAChD,SAAS,CAAC,mBAAmB,EAAE,eAAe,CAAC,uBAAuB,CACpE,OAAO,WAAW,CACnB,CAAA;IACD,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC,uBAAuB,CAC/D,OAAO,MAAM,CACd,CAAA;IACD,SAAS,CAAC,gBAAgB,EAAE,eAAe,CAAC,uBAAuB,CACjE,OAAO,QAAQ,CAChB,C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