@medusajs/translation 2.12.4-preview-20251219090724 → 2.12.4-preview-20251219150145

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 (37) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +3 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/loaders/config.d.ts +2 -1
  6. package/dist/loaders/config.d.ts.map +1 -1
  7. package/dist/loaders/config.js +26 -2
  8. package/dist/loaders/config.js.map +1 -1
  9. package/dist/loaders/defaults.d.ts.map +1 -1
  10. package/dist/loaders/defaults.js +1 -0
  11. package/dist/loaders/defaults.js.map +1 -1
  12. package/dist/migrations/Migration20251218140235.d.ts +6 -0
  13. package/dist/migrations/Migration20251218140235.d.ts.map +1 -0
  14. package/dist/migrations/Migration20251218140235.js +17 -0
  15. package/dist/migrations/Migration20251218140235.js.map +1 -0
  16. package/dist/models/index.d.ts +1 -0
  17. package/dist/models/index.d.ts.map +1 -1
  18. package/dist/models/index.js +3 -1
  19. package/dist/models/index.js.map +1 -1
  20. package/dist/models/settings.d.ts +17 -0
  21. package/dist/models/settings.d.ts.map +1 -0
  22. package/dist/models/settings.js +27 -0
  23. package/dist/models/settings.js.map +1 -0
  24. package/dist/services/translation-module.d.ts +14 -3
  25. package/dist/services/translation-module.d.ts.map +1 -1
  26. package/dist/services/translation-module.js +68 -16
  27. package/dist/services/translation-module.js.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/types/index.d.ts +37 -0
  30. package/dist/types/index.d.ts.map +1 -0
  31. package/dist/types/index.js +3 -0
  32. package/dist/types/index.js.map +1 -0
  33. package/dist/utils/filter-translation-fields.d.ts +3 -0
  34. package/dist/utils/filter-translation-fields.d.ts.map +1 -0
  35. package/dist/utils/filter-translation-fields.js +22 -0
  36. package/dist/utils/filter-translation-fields.js.map +1 -0
  37. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "./types";
1
2
  import TranslationModuleService from "./services/translation-module";
2
3
  export declare const TRANSLATION_MODULE = "translation";
3
4
  declare const _default: import("@medusajs/types").ModuleExports<typeof TranslationModuleService> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,8BAA8B,CAAA;AAKnE,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;;;;AAE/C,wBAGE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAEhB,OAAO,wBAAwB,MAAM,8BAA8B,CAAA;AAInE,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;;;;AAE/C,wBAGE"}
package/dist/index.js CHANGED
@@ -4,10 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TRANSLATION_MODULE = void 0;
7
+ require("./types");
8
+ const utils_1 = require("@medusajs/framework/utils");
7
9
  const translation_module_1 = __importDefault(require("./services/translation-module"));
8
- const defaults_1 = __importDefault(require("./loaders/defaults"));
9
10
  const config_1 = __importDefault(require("./loaders/config"));
10
- const utils_1 = require("@medusajs/framework/utils");
11
+ const defaults_1 = __importDefault(require("./loaders/defaults"));
11
12
  exports.TRANSLATION_MODULE = "translation";
12
13
  exports.default = (0, utils_1.Module)(exports.TRANSLATION_MODULE, {
13
14
  service: translation_module_1.default,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sFAAmE;AACnE,kEAA6C;AAC7C,8DAAyC;AACzC,qDAAkD;AAErC,QAAA,kBAAkB,GAAG,aAAa,CAAA;AAE/C,kBAAe,IAAA,cAAM,EAAC,0BAAkB,EAAE;IACxC,OAAO,EAAE,4BAAwB;IACjC,OAAO,EAAE,CAAC,kBAAY,EAAE,gBAAU,CAAC;CACpC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mBAAgB;AAChB,qDAAkD;AAClD,sFAAmE;AACnE,8DAAyC;AACzC,kEAA6C;AAEhC,QAAA,kBAAkB,GAAG,aAAa,CAAA;AAE/C,kBAAe,IAAA,cAAM,EAAC,0BAAkB,EAAE;IACxC,OAAO,EAAE,4BAAwB;IACjC,OAAO,EAAE,CAAC,kBAAY,EAAE,gBAAU,CAAC;CACpC,CAAC,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { LoaderOptions } from "@medusajs/framework/types";
2
- declare const _default: ({ container }: LoaderOptions) => Promise<void>;
2
+ import type { TranslationModuleOptions } from "../types";
3
+ declare const _default: ({ container, options, }: LoaderOptions<TranslationModuleOptions>) => Promise<void>;
3
4
  export default _default;
4
5
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/loaders/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;yBAKnC,eAAe,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAAlE,wBAKC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/loaders/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGd,MAAM,2BAA2B,CAAA;AAMlC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;yBAElC,yBAGnB,aAAa,CAAC,wBAAwB,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC;AAH1D,wBA+CC"}
@@ -1,9 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@medusajs/framework/utils");
3
4
  const constants_1 = require("../utils/constants");
4
5
  const awilix_1 = require("awilix");
5
6
  const translatable_fields_1 = require("../utils/translatable-fields");
6
- exports.default = async ({ container }) => {
7
- container.register(constants_1.TRANSLATABLE_FIELDS_CONFIG_KEY, (0, awilix_1.asValue)(translatable_fields_1.translatableFieldsConfig));
7
+ exports.default = async ({ container, options, }) => {
8
+ const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER) ?? console;
9
+ const settingsService = container.resolve("translationSettingsService");
10
+ const mergedConfig = translatable_fields_1.translatableFieldsConfig;
11
+ const userProvidedFields = options?.entities ?? [];
12
+ for (const field of userProvidedFields) {
13
+ mergedConfig[field.type] ??= [];
14
+ mergedConfig[field.type] = Array.from(new Set([...(mergedConfig[field.type] ?? []), ...field.fields]));
15
+ }
16
+ try {
17
+ const existingSettings = await settingsService.list({}, { select: ["id", "entity_type"] });
18
+ const existingByEntityType = new Map(existingSettings.map((s) => [s.entity_type, s.id]));
19
+ const settingsToUpsert = Object.entries(mergedConfig).map(([entityType, fields]) => {
20
+ const existingId = existingByEntityType.get(entityType);
21
+ return existingId
22
+ ? { id: existingId, entity_type: entityType, fields }
23
+ : { entity_type: entityType, fields };
24
+ });
25
+ const resp = await settingsService.upsert(settingsToUpsert);
26
+ logger.debug(`Loaded ${resp.length} translation settings`);
27
+ }
28
+ catch (error) {
29
+ logger.warn(`Failed to load translation settings, skipping loader. Original error: ${error.message}`);
30
+ }
31
+ container.register(constants_1.TRANSLATABLE_FIELDS_CONFIG_KEY, (0, awilix_1.asValue)(mergedConfig));
8
32
  };
9
33
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/loaders/config.ts"],"names":[],"mappings":";;AACA,gDAAiE;AACjE,mCAAgC;AAChC,sEAAuE;AAEvE,kBAAe,KAAK,EAAE,EAAE,SAAS,EAAiB,EAAiB,EAAE;IACnE,SAAS,CAAC,QAAQ,CAChB,0CAA8B,EAC9B,IAAA,gBAAO,EAAC,8CAAw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AAG,CACvD,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE;YACvB,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YACvD,OAAO,UAAU;gBACf,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE;gBACrD,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;QACzC,CAAC,CACF,CAAA;QAED,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;QAC3D,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,MAAM,uBAAuB,CAAC,CAAA;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CACT,yEAAyE,KAAK,CAAC,OAAO,EAAE,CACzF,CAAA;IACH,CAAC;IAED,SAAS,CAAC,QAAQ,CAAC,0CAA8B,EAAE,IAAA,gBAAO,EAAC,YAAY,CAAC,CAAC,CAAA;AAC3E,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/loaders/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGd,MAAM,2BAA2B,CAAA;yBAgEZ,eAAe,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAAlE,wBA+BC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/loaders/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGd,MAAM,2BAA2B,CAAA;yBAiEZ,eAAe,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAAlE,wBA+BC"}
@@ -56,6 +56,7 @@ const defaultLocales = [
56
56
  { code: "zh-HK", name: "Chinese Traditional (Hong Kong)" },
57
57
  { code: "ja-JP", name: "Japanese (Japan)" },
58
58
  { code: "ko-KR", name: "Korean (South Korea)" },
59
+ { code: "ka-GE", name: "Georgian (Georgia)" },
59
60
  ];
60
61
  exports.default = async ({ container }) => {
61
62
  const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER) ?? console;
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/loaders/defaults.ts"],"names":[],"mappings":";;AAKA,qDAGkC;AAGlC;;;;;GAKG;AACH,MAAM,cAAc,GAAG;IACrB,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,yBAAyB,EAAE;IAClD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,0BAA0B,EAAE;IACnD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC9C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC3C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC1C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC3C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE;IAC9C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC1C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC1C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC3C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC3C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC3C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAC/C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC1C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,qBA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AC,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 "@medusajs/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,0CAA0C,CAAA;AAEpE,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("@medusajs/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,yEAAoE;AAEpE,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"}
@@ -1,3 +1,4 @@
1
1
  export { default as Translation } from "./translation";
2
2
  export { default as Locale } from "./locale";
3
+ export { default as Settings } from "./settings";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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"}
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Locale = exports.Translation = void 0;
6
+ exports.Settings = exports.Locale = exports.Translation = void 0;
7
7
  var translation_1 = require("./translation");
8
8
  Object.defineProperty(exports, "Translation", { enumerable: true, get: function () { return __importDefault(translation_1).default; } });
9
9
  var locale_1 = require("./locale");
10
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; } });
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
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,17 @@
1
+ declare const Settings: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
2
+ id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
3
+ /**
4
+ * The entity type that these settings apply to (e.g., "product", "product_variant").
5
+ */
6
+ entity_type: import("@medusajs/framework/utils").TextProperty;
7
+ /**
8
+ * The translatable fields for this entity type.
9
+ * Array of field names that can be translated.
10
+ *
11
+ * @example
12
+ * ["title", "description", "material"]
13
+ */
14
+ fields: import("@medusajs/framework/utils").JSONProperty;
15
+ }>, "translation_settings">;
16
+ export default Settings;
17
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/models/settings.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,QAAQ;;IAGV;;OAEG;;IAEH;;;;;;OAMG;;2BAQH,CAAA;AAEJ,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@medusajs/framework/utils");
4
+ const Settings = utils_1.model
5
+ .define("translation_settings", {
6
+ id: utils_1.model.id({ prefix: "trset" }).primaryKey(),
7
+ /**
8
+ * The entity type that these settings apply to (e.g., "product", "product_variant").
9
+ */
10
+ entity_type: utils_1.model.text().searchable(),
11
+ /**
12
+ * The translatable fields for this entity type.
13
+ * Array of field names that can be translated.
14
+ *
15
+ * @example
16
+ * ["title", "description", "material"]
17
+ */
18
+ fields: utils_1.model.json(),
19
+ })
20
+ .indexes([
21
+ {
22
+ on: ["entity_type"],
23
+ unique: true,
24
+ },
25
+ ]);
26
+ exports.default = Settings;
27
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/models/settings.ts"],"names":[],"mappings":";;AAAA,qDAAiD;AAEjD,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;CACrB,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,aAAa,CAAC;QACnB,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAA;AAEJ,kBAAe,QAAQ,CAAA"}
@@ -1,11 +1,13 @@
1
1
  import { Context, CreateTranslationDTO, DAL, FilterableTranslationProps, FindConfig, ITranslationModuleService, ModulesSdkTypes, TranslationTypes } from "@medusajs/framework/types";
2
2
  import Locale from "../models/locale";
3
3
  import Translation from "../models/translation";
4
+ import Settings from "../models/settings";
4
5
  import { TRANSLATABLE_FIELDS_CONFIG_KEY } from "../utils/constants";
5
6
  type InjectedDependencies = {
6
7
  baseRepository: DAL.RepositoryService;
7
8
  translationService: ModulesSdkTypes.IMedusaInternalService<typeof Translation>;
8
9
  localeService: ModulesSdkTypes.IMedusaInternalService<typeof Locale>;
10
+ translationSettingsService: ModulesSdkTypes.IMedusaInternalService<typeof Settings>;
9
11
  [TRANSLATABLE_FIELDS_CONFIG_KEY]: Record<string, string[]>;
10
12
  };
11
13
  declare const TranslationModuleService_base: import("@medusajs/framework/utils").MedusaServiceReturnType<{
@@ -15,14 +17,24 @@ declare const TranslationModuleService_base: import("@medusajs/framework/utils")
15
17
  Translation: {
16
18
  dto: TranslationTypes.TranslationDTO;
17
19
  };
20
+ TranslationSettings: {
21
+ dto: TranslationTypes.TranslationSettingsDTO;
22
+ };
18
23
  }>;
19
24
  export default class TranslationModuleService extends TranslationModuleService_base implements ITranslationModuleService {
20
25
  protected baseRepository_: DAL.RepositoryService;
21
26
  protected translationService_: ModulesSdkTypes.IMedusaInternalService<typeof Translation>;
22
27
  protected localeService_: ModulesSdkTypes.IMedusaInternalService<typeof Locale>;
23
- private readonly translatableFieldsConfig_;
24
- constructor({ baseRepository, translationService, localeService, translatableFieldsConfig, }: InjectedDependencies);
28
+ protected settingsService_: ModulesSdkTypes.IMedusaInternalService<typeof Settings>;
29
+ constructor({ baseRepository, translationService, localeService, translationSettingsService, }: InjectedDependencies);
30
+ getTranslatableFields(entityType?: string, sharedContext?: Context): Promise<Record<string, string[]>>;
25
31
  static prepareFilters(filters: FilterableTranslationProps): FilterableTranslationProps;
32
+ retrieveTranslation(id: string, config?: FindConfig<TranslationTypes.TranslationDTO>, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO>;
33
+ /**
34
+ * Ensures the 'reference' field is included in the select config.
35
+ * This is needed for filtering translations by translatable fields.
36
+ */
37
+ static ensureReferenceFieldInConfig(config: FindConfig<TranslationTypes.TranslationDTO>): FindConfig<TranslationTypes.TranslationDTO>;
26
38
  listTranslations(filters?: FilterableTranslationProps, config?: FindConfig<TranslationTypes.TranslationDTO>, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO[]>;
27
39
  listAndCountTranslations(filters?: FilterableTranslationProps, config?: FindConfig<TranslationTypes.TranslationDTO>, sharedContext?: Context): Promise<[TranslationTypes.TranslationDTO[], number]>;
28
40
  createLocales(data: TranslationTypes.CreateLocaleDTO[], sharedContext?: Context): Promise<TranslationTypes.LocaleDTO[]>;
@@ -31,7 +43,6 @@ export default class TranslationModuleService extends TranslationModuleService_b
31
43
  createTranslations(data: CreateTranslationDTO[], sharedContext?: Context): Promise<TranslationTypes.TranslationDTO[]>;
32
44
  updateTranslations(data: TranslationTypes.UpdateTranslationDTO, sharedContext?: Context): Promise<TranslationTypes.TranslationDTO>;
33
45
  updateTranslations(data: TranslationTypes.UpdateTranslationDTO[], sharedContext?: Context): Promise<TranslationTypes.TranslationDTO[]>;
34
- getTranslatableFields(entityType?: string): Record<string, string[]>;
35
46
  getStatistics(input: TranslationTypes.TranslationStatisticsInput, sharedContext?: Context): Promise<TranslationTypes.TranslationStatisticsOutput>;
36
47
  }
37
48
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"translation-module.d.ts","sourceRoot":"","sources":["../../src/services/translation-module.ts"],"names":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AAE,gBAAgB,CAAC,0BAA0B,EACjC,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,gBAAgB,CAAC,2BAA2B,CAAC;CA0GzD"}
1
+ {"version":3,"file":"translation-module.d.ts","sourceRoot":"","sources":["../../src/services/translation-module.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,GAAG,EACH,0BAA0B,EAC1B,UAAU,EACV,yBAAyB,EAEzB,eAAe,EACf,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAUlC,OAAO,MAAM,MAAM,gBAAgB,CAAA;AACnC,OAAO,WAAW,MAAM,qBAAqB,CAAA;AAC7C,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AAGjE,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,kBAAkB,EAAE,eAAe,CAAC,sBAAsB,CAAC,OAAO,WAAW,CAAC,CAAA;IAC9E,aAAa,EAAE,eAAe,CAAC,sBAAsB,CAAC,OAAO,MAAM,CAAC,CAAA;IACpE,0BAA0B,EAAE,eAAe,CAAC,sBAAsB,CAChE,OAAO,QAAQ,CAChB,CAAA;IACD,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAC3D,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,sBAAsB,CAC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AAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;IAExC,aAAa,CACX,IAAI,EAAE,gBAAgB,CAAC,eAAe,EACtC,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC;IA2BtC,kBAAkB,CAChB,IAAI,EAAE,oBAAoB,EAC1B,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC;IAG3C,kBAAkB,CAChB,IAAI,EAAE,oBAAoB,EAAE,EAC5B,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC;IAsC7C,kBAAkB,CAChB,IAAI,EAAE,gBAAgB,CAAC,oBAAoB,EAC3C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC;IAE3C,kBAAkB,CAChB,IAAI,EAAE,gBAAgB,CAAC,oBAAoB,EAAE,EAC7C,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC;IAoEvC,aAAa,CACjB,KAAK,EAAE,gBAAgB,CAAC,0BAA0B,EACjC,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,gBAAgB,CAAC,2BAA2B,CAAC;CA+GzD"}
@@ -20,18 +20,29 @@ const types_1 = require("@medusajs/framework/types");
20
20
  const utils_1 = require("@medusajs/framework/utils");
21
21
  const locale_1 = __importDefault(require("../models/locale"));
22
22
  const translation_1 = __importDefault(require("../models/translation"));
23
+ const settings_1 = __importDefault(require("../models/settings"));
23
24
  const compute_translated_field_count_1 = require("../utils/compute-translated-field-count");
24
25
  const constants_1 = require("../utils/constants");
26
+ const filter_translation_fields_1 = require("../utils/filter-translation-fields");
25
27
  class TranslationModuleService extends (0, utils_1.MedusaService)({
26
28
  Locale: locale_1.default,
27
29
  Translation: translation_1.default,
30
+ TranslationSettings: settings_1.default,
28
31
  }) {
29
- constructor({ baseRepository, translationService, localeService, translatableFieldsConfig, }) {
32
+ constructor({ baseRepository, translationService, localeService, translationSettingsService, }) {
30
33
  super(...arguments);
31
34
  this.baseRepository_ = baseRepository;
32
35
  this.translationService_ = translationService;
33
36
  this.localeService_ = localeService;
34
- this.translatableFieldsConfig_ = translatableFieldsConfig;
37
+ this.settingsService_ = translationSettingsService;
38
+ }
39
+ async getTranslatableFields(entityType, sharedContext = {}) {
40
+ const filters = entityType ? { entity_type: entityType } : {};
41
+ const settings = await this.settingsService_.list(filters, {}, sharedContext);
42
+ return settings.reduce((acc, setting) => {
43
+ acc[setting.entity_type] = setting.fields;
44
+ return acc;
45
+ }, {});
35
46
  }
36
47
  static prepareFilters(filters) {
37
48
  let { q, ...restFilters } = filters;
@@ -44,17 +55,45 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
44
55
  return restFilters;
45
56
  }
46
57
  // @ts-expect-error
58
+ async retrieveTranslation(id, config = {}, sharedContext = {}) {
59
+ const configWithReference = TranslationModuleService.ensureReferenceFieldInConfig(config);
60
+ const result = await this.translationService_.retrieve(id, configWithReference, sharedContext);
61
+ const serialized = await this.baseRepository_.serialize(result);
62
+ const translatableFieldsConfig = await this.getTranslatableFields(undefined, sharedContext);
63
+ return (0, filter_translation_fields_1.filterTranslationFields)([serialized], translatableFieldsConfig)[0];
64
+ }
65
+ /**
66
+ * Ensures the 'reference' field is included in the select config.
67
+ * This is needed for filtering translations by translatable fields.
68
+ */
69
+ static ensureReferenceFieldInConfig(config) {
70
+ if (!config?.select?.length) {
71
+ return config;
72
+ }
73
+ const select = config.select;
74
+ if (!select.includes("reference")) {
75
+ return { ...config, select: [...select, "reference"] };
76
+ }
77
+ return config;
78
+ }
79
+ // @ts-expect-error
47
80
  async listTranslations(filters = {}, config = {}, sharedContext = {}) {
48
81
  const preparedFilters = TranslationModuleService.prepareFilters(filters);
49
- const results = await this.translationService_.list(preparedFilters, config, sharedContext);
50
- return await this.baseRepository_.serialize(results);
82
+ const configWithReference = TranslationModuleService.ensureReferenceFieldInConfig(config);
83
+ const results = await this.translationService_.list(preparedFilters, configWithReference, sharedContext);
84
+ const serialized = await this.baseRepository_.serialize(results);
85
+ const translatableFieldsConfig = await this.getTranslatableFields(undefined, sharedContext);
86
+ return (0, filter_translation_fields_1.filterTranslationFields)(serialized, translatableFieldsConfig);
51
87
  }
52
88
  // @ts-expect-error
53
89
  async listAndCountTranslations(filters = {}, config = {}, sharedContext = {}) {
54
90
  const preparedFilters = TranslationModuleService.prepareFilters(filters);
55
- const [results, count] = await this.translationService_.listAndCount(preparedFilters, config, sharedContext);
91
+ const configWithReference = TranslationModuleService.ensureReferenceFieldInConfig(config);
92
+ const [results, count] = await this.translationService_.listAndCount(preparedFilters, configWithReference, sharedContext);
93
+ const serialized = await this.baseRepository_.serialize(results);
94
+ const translatableFieldsConfig = await this.getTranslatableFields(undefined, sharedContext);
56
95
  return [
57
- await this.baseRepository_.serialize(results),
96
+ (0, filter_translation_fields_1.filterTranslationFields)(serialized, translatableFieldsConfig),
58
97
  count,
59
98
  ];
60
99
  }
@@ -72,10 +111,11 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
72
111
  // @ts-expect-error
73
112
  async createTranslations(data, sharedContext = {}) {
74
113
  const dataArray = Array.isArray(data) ? data : [data];
114
+ const translatableFieldsConfig = await this.getTranslatableFields(undefined, sharedContext);
75
115
  const normalizedData = dataArray.map((translation) => ({
76
116
  ...translation,
77
117
  locale_code: (0, utils_1.normalizeLocale)(translation.locale_code),
78
- translated_field_count: (0, compute_translated_field_count_1.computeTranslatedFieldCount)(translation.translations, this.translatableFieldsConfig_[translation.reference]),
118
+ translated_field_count: (0, compute_translated_field_count_1.computeTranslatedFieldCount)(translation.translations, translatableFieldsConfig[translation.reference]),
79
119
  }));
80
120
  const createdTranslations = await this.translationService_.create(normalizedData, sharedContext);
81
121
  const serialized = await this.baseRepository_.serialize(createdTranslations);
@@ -94,10 +134,11 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
94
134
  const existingTranslations = await this.translationService_.list({ id: idsNeedingReference }, { select: ["id", "reference"] }, sharedContext);
95
135
  referenceMap = Object.fromEntries(existingTranslations.map((t) => [t.id, t.reference]));
96
136
  }
137
+ const translatableFieldsConfig = await this.getTranslatableFields(undefined, sharedContext);
97
138
  for (const update of dataArray) {
98
139
  if (update.translations) {
99
140
  const reference = update.reference || referenceMap[update.id];
100
- update.translated_field_count = (0, compute_translated_field_count_1.computeTranslatedFieldCount)(update.translations, this.translatableFieldsConfig_[reference] || []);
141
+ update.translated_field_count = (0, compute_translated_field_count_1.computeTranslatedFieldCount)(update.translations, translatableFieldsConfig[reference] || []);
101
142
  }
102
143
  }
103
144
  }
@@ -105,12 +146,6 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
105
146
  const serialized = await this.baseRepository_.serialize(updatedTranslations);
106
147
  return Array.isArray(data) ? serialized : serialized[0];
107
148
  }
108
- getTranslatableFields(entityType) {
109
- if (entityType) {
110
- return { [entityType]: this.translatableFieldsConfig_[entityType] };
111
- }
112
- return this.translatableFieldsConfig_;
113
- }
114
149
  async getStatistics(input, sharedContext = {}) {
115
150
  const { locales, entities } = input;
116
151
  if (!locales || !locales.length) {
@@ -123,10 +158,11 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
123
158
  const manager = (sharedContext.transactionManager ??
124
159
  sharedContext.manager);
125
160
  const knex = manager.getKnex();
161
+ const translatableFieldsConfig = await this.getTranslatableFields(undefined, sharedContext);
126
162
  const result = {};
127
163
  const entityTypes = [];
128
164
  for (const entityType of Object.keys(entities)) {
129
- const translatableFields = this.translatableFieldsConfig_[entityType];
165
+ const translatableFields = translatableFieldsConfig[entityType];
130
166
  if (!translatableFields || translatableFields.length === 0) {
131
167
  result[entityType] = {
132
168
  expected: 0,
@@ -157,7 +193,7 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
157
193
  GROUP BY reference, locale_code
158
194
  `, [entityTypes, normalizedLocales]);
159
195
  for (const entityType of entityTypes) {
160
- const translatableFields = this.translatableFieldsConfig_[entityType];
196
+ const translatableFields = translatableFieldsConfig[entityType];
161
197
  const fieldsPerEntity = translatableFields.length;
162
198
  const entityCount = entities[entityType].count;
163
199
  const expectedPerLocale = entityCount * fieldsPerEntity;
@@ -192,6 +228,22 @@ class TranslationModuleService extends (0, utils_1.MedusaService)({
192
228
  }
193
229
  }
194
230
  exports.default = TranslationModuleService;
231
+ __decorate([
232
+ (0, utils_1.InjectManager)(),
233
+ __param(1, (0, utils_1.MedusaContext)()),
234
+ __metadata("design:type", Function),
235
+ __metadata("design:paramtypes", [String, Object]),
236
+ __metadata("design:returntype", Promise)
237
+ ], TranslationModuleService.prototype, "getTranslatableFields", null);
238
+ __decorate([
239
+ (0, utils_1.InjectManager)()
240
+ // @ts-expect-error
241
+ ,
242
+ __param(2, (0, utils_1.MedusaContext)()),
243
+ __metadata("design:type", Function),
244
+ __metadata("design:paramtypes", [String, Object, Object]),
245
+ __metadata("design:returntype", Promise)
246
+ ], TranslationModuleService.prototype, "retrieveTranslation", null);
195
247
  __decorate([
196
248
  (0, utils_1.InjectManager)()
197
249
  // @ts-expect-error
@@ -1 +1 @@
1
- {"version":3,"file":"translation-module.js","sourceRoot":"","sources":["../../src/services/translation-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6DAAwD;AACxD,qDAUkC;AAElC,qDAOkC;AAClC,4DAAmC;AACnC,sEAA6C;AAC7C,0FAAmF;AACnF,gDAAiE;AASjE,MAAqB,wBACnB,SAAQ,IAAA,qBAAa,EAOlB;IACD,MAAM,EAAN,gBAAM;IACN,WAAW,EAAX,qBAAW;CACZ,CAAC;IAaF,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,wBAAwB,GACH;QACrB,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QACnB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;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config.ts","../src/loaders/defaults.ts","../src/migrations/Migration20251208124155.ts","../src/migrations/Migration20251215083927.ts","../src/models/index.ts","../src/models/locale.ts","../src/models/translation.ts","../src/services/translation-module.ts","../src/utils/compute-translated-field-count.ts","../src/utils/constants.ts","../src/utils/translatable-fields.ts"],"version":"5.9.3"}
1
+ {"root":["../src/index.ts","../src/loaders/config.ts","../src/loaders/defaults.ts","../src/migrations/Migration20251208124155.ts","../src/migrations/Migration20251215083927.ts","../src/migrations/Migration20251218140235.ts","../src/models/index.ts","../src/models/locale.ts","../src/models/settings.ts","../src/models/translation.ts","../src/services/translation-module.ts","../src/types/index.ts","../src/utils/compute-translated-field-count.ts","../src/utils/constants.ts","../src/utils/filter-translation-fields.ts","../src/utils/translatable-fields.ts"],"version":"5.9.3"}
@@ -0,0 +1,37 @@
1
+ import { RemoteQueryEntryPoints } from "@medusajs/framework/types";
2
+ /**
3
+ * Extracts only the keys of T where the value is a string (or nullable string), the key
4
+ * is not __typename or id.
5
+ * This filters out relations and other non-string fields.
6
+ */
7
+ type StringValuedKeys<T> = {
8
+ [K in keyof T]: K extends `${string}_id` ? never : "__typename" extends K ? never : "id" extends keyof K ? never : NonNullable<T[K]> extends string ? K : never;
9
+ }[keyof T];
10
+ /**
11
+ * A discriminated union of all possible entity configurations.
12
+ * When you specify a `type`, TypeScript will narrow `fields` to only
13
+ * the string-valued keys of that specific entity type.
14
+ */
15
+ export type TranslatableEntityConfig = {
16
+ [K in keyof RemoteQueryEntryPoints]: {
17
+ type: K;
18
+ fields: StringValuedKeys<RemoteQueryEntryPoints[K]>[];
19
+ };
20
+ }[keyof RemoteQueryEntryPoints] | {
21
+ type: string;
22
+ fields: string[];
23
+ };
24
+ /**
25
+ * Options for configuring the translation module.
26
+ */
27
+ export type TranslationModuleOptions = {
28
+ entities?: TranslatableEntityConfig[];
29
+ };
30
+ declare module "@medusajs/types" {
31
+ interface ModuleOptions {
32
+ "@medusajs/translation": TranslationModuleOptions;
33
+ "@medusajs/medusa/translation": TranslationModuleOptions;
34
+ }
35
+ }
36
+ export {};
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAElE;;;;GAIG;AACH,KAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,GAAG,MAAM,KAAK,GACpC,KAAK,GACL,YAAY,SAAS,CAAC,GACtB,KAAK,GACL,IAAI,SAAS,MAAM,CAAC,GACpB,KAAK,GACL,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAChC,CAAC,GACD,KAAK;CACV,CAAC,MAAM,CAAC,CAAC,CAAA;AAEV;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAChC;KACG,CAAC,IAAI,MAAM,sBAAsB,GAAG;QACnC,IAAI,EAAE,CAAC,CAAA;QACP,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;KACtD;CACF,CAAC,MAAM,sBAAsB,CAAC,GAC/B;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAEL;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,EAAE,wBAAwB,EAAE,CAAA;CACtC,CAAA;AAGD,OAAO,QAAQ,iBAAiB,CAAC;IAC/B,UAAU,aAAa;QACrB,uBAAuB,EAAE,wBAAwB,CAAA;QACjD,8BAA8B,EAAE,wBAAwB,CAAA;KACzD;CACF"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { TranslationTypes } from "@medusajs/framework/types";
2
+ export declare function filterTranslationFields(translations: TranslationTypes.TranslationDTO[], translatableFieldsConfig: Record<string, string[]>): TranslationTypes.TranslationDTO[];
3
+ //# sourceMappingURL=filter-translation-fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-translation-fields.d.ts","sourceRoot":"","sources":["../../src/utils/filter-translation-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,gBAAgB,CAAC,cAAc,EAAE,EAC/C,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACjD,gBAAgB,CAAC,cAAc,EAAE,CAuBnC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterTranslationFields = filterTranslationFields;
4
+ function filterTranslationFields(translations, translatableFieldsConfig) {
5
+ return translations.map((translation) => {
6
+ const allowedFields = translatableFieldsConfig[translation.reference];
7
+ if (!allowedFields?.length) {
8
+ translation.translations = {};
9
+ return translation;
10
+ }
11
+ const filteredTranslations = {};
12
+ for (const field of allowedFields) {
13
+ if (translation.translations &&
14
+ field in translation.translations) {
15
+ filteredTranslations[field] = translation.translations[field];
16
+ }
17
+ }
18
+ translation.translations = filteredTranslations;
19
+ return translation;
20
+ });
21
+ }
22
+ //# sourceMappingURL=filter-translation-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-translation-fields.js","sourceRoot":"","sources":["../../src/utils/filter-translation-fields.ts"],"names":[],"mappings":";;AAEA,0DA0BC;AA1BD,SAAgB,uBAAuB,CACrC,YAA+C,EAC/C,wBAAkD;IAElD,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QACtC,MAAM,aAAa,GAAG,wBAAwB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;QACrE,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;YAC3B,WAAW,CAAC,YAAY,GAAG,EAAE,CAAA;YAC7B,OAAO,WAAW,CAAA;QACpB,CAAC;QAED,MAAM,oBAAoB,GAA4B,EAAE,CAAA;QACxD,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;YAClC,IACE,WAAW,CAAC,YAAY;gBACxB,KAAK,IAAK,WAAW,CAAC,YAAwC,EAC9D,CAAC;gBACD,oBAAoB,CAAC,KAAK,CAAC,GACzB,WAAW,CAAC,YACb,CAAC,KAAK,CAAC,CAAA;YACV,CAAC;QACH,CAAC;QAED,WAAW,CAAC,YAAY,GAAG,oBAAoB,CAAA;QAC/C,OAAO,WAAW,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/translation",
3
- "version": "2.12.4-preview-20251219090724",
3
+ "version": "2.12.4-preview-20251219150145",
4
4
  "description": "Medusa Translation module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,10 +36,10 @@
36
36
  "orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm cache:clear"
37
37
  },
38
38
  "devDependencies": {
39
- "@medusajs/framework": "2.12.4-preview-20251219090724",
40
- "@medusajs/test-utils": "2.12.4-preview-20251219090724"
39
+ "@medusajs/framework": "2.12.4-preview-20251219150145",
40
+ "@medusajs/test-utils": "2.12.4-preview-20251219150145"
41
41
  },
42
42
  "peerDependencies": {
43
- "@medusajs/framework": "2.12.4-preview-20251219090724"
43
+ "@medusajs/framework": "2.12.4-preview-20251219150145"
44
44
  }
45
45
  }