fix(types,translations): fix types for translation and locale updates (#14278)

* fix(types,translations): fix types for translation and locale updates

* remove array type
This commit is contained in:
Shahed Nasser
2025-12-12 11:11:01 +02:00
committed by GitHub
parent a4ca4ef170
commit 31a057558c
5 changed files with 38 additions and 18 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/core-flows": patch
"@medusajs/types": patch
---
fix(types,translations): fix types for translation and locale updates

View File

@@ -1,6 +1,7 @@
import {
FilterableTranslationProps,
ITranslationModuleService,
UpdateTranslationDataDTO,
UpdateTranslationDTO,
} from "@medusajs/framework/types"
import {
@@ -22,7 +23,7 @@ export type UpdateTranslationsStepInput =
/**
* The data to update in the translations.
*/
update: UpdateTranslationDTO
update: UpdateTranslationDataDTO
}
| {
translations: UpdateTranslationDTO[]

View File

@@ -4,7 +4,7 @@ import {
MedusaErrorTypes,
} from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { CreateTranslationDTO, UpdateTranslationDTO } from "@medusajs/types"
import { CreateTranslationDTO, UpdateTranslationDataDTO, UpdateTranslationDTO } from "@medusajs/types"
export const validateTranslationsStepId = "validate-translations"
@@ -13,6 +13,7 @@ export type ValidateTranslationsStepInput =
| CreateTranslationDTO
| UpdateTranslationDTO[]
| UpdateTranslationDTO
| UpdateTranslationDataDTO
// TODO: Do we want to validate anything else here?
export const validateTranslationsStep = createStep(

View File

@@ -19,14 +19,9 @@ export interface CreateLocaleDTO {
}
/**
* The attributes to update in the locale.
* The data to update in the locale.
*/
export interface UpdateLocaleDTO {
/**
* The ID of the locale to update.
*/
id: string
export interface UpdateLocaleDataDTO {
/**
* The BCP 47 language tag code of the locale.
*/
@@ -38,6 +33,16 @@ export interface UpdateLocaleDTO {
name?: string
}
/**
* The attributes to update in the locale.
*/
export interface UpdateLocaleDTO extends UpdateLocaleDataDTO {
/**
* The ID of the locale to update.
*/
id: string
}
/**
* The attributes in the locale to be created or updated.
*/
@@ -84,14 +89,9 @@ export interface CreateTranslationDTO {
}
/**
* The attributes to update in the translation.
* The attributes to update in translations matching a selector.
*/
export interface UpdateTranslationDTO {
/**
* The ID of the translation to update.
*/
id: string
export interface UpdateTranslationDataDTO {
/**
* The ID of the entity being translated.
*/
@@ -113,6 +113,16 @@ export interface UpdateTranslationDTO {
translations?: Record<string, unknown>
}
/**
* The attributes to update in the translation.
*/
export interface UpdateTranslationDTO extends UpdateTranslationDataDTO {
/**
* The ID of the translation to update.
*/
id: string
}
/**
* The attributes in the translation to be created or updated.
*/

View File

@@ -12,7 +12,9 @@ import {
CreateLocaleDTO,
CreateTranslationDTO,
UpdateLocaleDTO,
UpdateLocaleDataDTO,
UpdateTranslationDTO,
UpdateTranslationDataDTO,
} from "./mutations"
/**
@@ -110,7 +112,7 @@ export interface ITranslationModuleService extends IModuleService {
| UpdateLocaleDTO[]
| {
selector: Record<string, any>
data: UpdateLocaleDTO | UpdateLocaleDTO[]
data: UpdateLocaleDataDTO | UpdateLocaleDataDTO[]
},
sharedContext?: Context
): Promise<LocaleDTO[]>
@@ -245,7 +247,7 @@ export interface ITranslationModuleService extends IModuleService {
| UpdateTranslationDTO[]
| {
selector: Record<string, any>
data: UpdateTranslationDTO | UpdateTranslationDTO[]
data: UpdateTranslationDataDTO | UpdateTranslationDataDTO[]
},
sharedContext?: Context
): Promise<TranslationDTO[]>