File tree Expand file tree Collapse file tree 5 files changed +58
-3
lines changed
core-flows/src/translation/workflows Expand file tree Collapse file tree 5 files changed +58
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @medusajs/core-flows " : patch
3+ " @medusajs/utils " : patch
4+ ---
5+
6+ fix(utils,core-flows): add events constant for translations and use it in workflows
Original file line number Diff line number Diff line change 88import { emitEventStep } from "../../common/steps/emit-event"
99import { createTranslationsStep } from "../steps"
1010import { validateTranslationsStep } from "../steps"
11+ import { TranslationWorkflowEvents } from "@medusajs/framework/utils"
1112
1213export type CreateTranslationsWorkflowInput = {
1314 translations : CreateTranslationDTO [ ]
@@ -57,7 +58,7 @@ export const createTranslationsWorkflow = createWorkflow(
5758 )
5859
5960 emitEventStep ( {
60- eventName : "translation.created" ,
61+ eventName : TranslationWorkflowEvents . CREATED ,
6162 data : translationIdEvents ,
6263 } )
6364
Original file line number Diff line number Diff line change 55} from "@medusajs/framework/workflows-sdk"
66import { emitEventStep } from "../../common/steps/emit-event"
77import { deleteTranslationsStep } from "../steps"
8+ import { TranslationWorkflowEvents } from "@medusajs/framework/utils"
89
910export type DeleteTranslationsWorkflowInput = { ids : string [ ] }
1011
@@ -41,7 +42,7 @@ export const deleteTranslationsWorkflow = createWorkflow(
4142 } )
4243
4344 emitEventStep ( {
44- eventName : "translation.deleted" ,
45+ eventName : TranslationWorkflowEvents . DELETED ,
4546 data : translationIdEvents ,
4647 } )
4748 }
Original file line number Diff line number Diff line change 88import { emitEventStep } from "../../common/steps/emit-event"
99import { updateTranslationsStep , UpdateTranslationsStepInput } from "../steps"
1010import { validateTranslationsStep } from "../steps"
11+ import { TranslationWorkflowEvents } from "@medusajs/framework/utils"
1112
1213export type UpdateTranslationsWorkflowInput = UpdateTranslationsStepInput
1314
@@ -58,7 +59,7 @@ export const updateTranslationsWorkflow = createWorkflow(
5859 )
5960
6061 emitEventStep ( {
61- eventName : "translation.updated" ,
62+ eventName : TranslationWorkflowEvents . UPDATED ,
6263 data : translationIdEvents ,
6364 } )
6465
Original file line number Diff line number Diff line change @@ -889,3 +889,49 @@ export const PaymentEvents = {
889889 */
890890 REFUNDED : "payment.refunded" ,
891891}
892+
893+ /**
894+ * @category Translation
895+ * @customNamespace Translation
896+ */
897+ export const TranslationWorkflowEvents = {
898+ /**
899+ * Emitted when translations are created.
900+ *
901+ * @since 2.13.0
902+ * @featureFlag translation
903+ * @eventPayload
904+ * ```ts
905+ * {
906+ * id, // The ID of the translation
907+ * }
908+ * ```
909+ */
910+ CREATED : "translation.created" ,
911+ /**
912+ * Emitted when translations are updated.
913+ *
914+ * @since 2.13.0
915+ * @featureFlag translation
916+ * @eventPayload
917+ * ```ts
918+ * {
919+ * id, // The ID of the translation
920+ * }
921+ * ```
922+ */
923+ UPDATED : "translation.updated" ,
924+ /**
925+ * Emitted when translations are deleted.
926+ *
927+ * @since 2.13.0
928+ * @featureFlag translation
929+ * @eventPayload
930+ * ```ts
931+ * {
932+ * id, // The ID of the translation
933+ * }
934+ * ```
935+ */
936+ DELETED : "translation.deleted" ,
937+ }
You can’t perform that action at this time.
0 commit comments