@lokalise/maestro-expert-tenant-lib 2.5.0 → 2.6.0

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/dist/index.cjs CHANGED
@@ -258,6 +258,7 @@ var DEFAULT_SCHEDULED_TRIGGER_STEP_SETTINGS = {
258
258
  };
259
259
 
260
260
  // src/workflow/steps/aiMtTranslationStep.ts
261
+ var import_maestro_common4 = require("@lokalise/maestro-common");
261
262
  var import_zod4 = require("zod");
262
263
 
263
264
  // src/workflow/messages.ts
@@ -372,7 +373,9 @@ var AI_MT_TRANSLATION_STEP_FORM_SCHEMA = import_zod4.z.object({
372
373
  });
373
374
  }
374
375
  });
375
- var AI_MT_TRANSLATION_STEP_SETTINGS_SCHEMA = import_zod4.z.object({
376
+ var AI_MT_TRANSLATION_STEP_SETTINGS_SCHEMA = import_maestro_common4.WORKFLOW_LAYOUT_STEP_SETTINGS.merge(
377
+ import_zod4.z.object(AI_MT_TRANSLATION_STEP_FORM_SCHEMA._def.schema._def.schema.shape)
378
+ ).extend({
376
379
  stepType: import_zod4.z.literal("ai_mt_translation_step"),
377
380
  taskType: import_zod4.z.literal("translation"),
378
381
  stepTitle: import_zod4.z.string().min(1),
@@ -516,10 +519,10 @@ var DEFAULT_REVIEW_TASK_STEP_SETTINGS = {
516
519
  };
517
520
 
518
521
  // src/workflow/steps/clearTranslationsStep.ts
519
- var import_maestro_common4 = require("@lokalise/maestro-common");
522
+ var import_maestro_common5 = require("@lokalise/maestro-common");
520
523
  var import_zod7 = require("zod");
521
524
  var CLEAR_TRANSLATIONS_STEP_FORM_SCHEMA = import_zod7.z.object({});
522
- var CLEAR_TRANSLATIONS_STEP_SETTINGS_SCHEMA = import_maestro_common4.WORKFLOW_LAYOUT_STEP_SETTINGS.merge(
525
+ var CLEAR_TRANSLATIONS_STEP_SETTINGS_SCHEMA = import_maestro_common5.WORKFLOW_LAYOUT_STEP_SETTINGS.merge(
523
526
  CLEAR_TRANSLATIONS_STEP_FORM_SCHEMA
524
527
  ).extend({
525
528
  stepType: import_zod7.z.literal("clear_translations_step")
@@ -529,10 +532,10 @@ var DEFAULT_CLEAR_TRANSLATIONS_STEP_SETTINGS = {
529
532
  };
530
533
 
531
534
  // src/workflow/steps/endStep.ts
532
- var import_maestro_common5 = require("@lokalise/maestro-common");
535
+ var import_maestro_common6 = require("@lokalise/maestro-common");
533
536
  var import_zod8 = require("zod");
534
537
  var END_STEP_FORM_SCHEMA = import_zod8.z.object({});
535
- var END_STEP_SETTINGS_SCHEMA = import_maestro_common5.WORKFLOW_LAYOUT_STEP_SETTINGS.merge(
538
+ var END_STEP_SETTINGS_SCHEMA = import_maestro_common6.WORKFLOW_LAYOUT_STEP_SETTINGS.merge(
536
539
  END_STEP_FORM_SCHEMA
537
540
  ).extend({
538
541
  stepType: import_zod8.z.literal("end_step")
@@ -552,33 +555,225 @@ var STEP_TYPES = [
552
555
  "ai_mt_translation_step"
553
556
  ];
554
557
 
555
- // src/templates/resources/ai-mt-translation-task.template.ts
556
- var AI_MT_TRANSLATION_TASK_TEMPLATE = {
557
- id: "aiMtTranslationTask",
558
- title: "AI/MT Translation Task",
559
- summary: "A workflow for automatic translation using AI",
560
- description: "A workflow for automatic translation using AI",
558
+ // src/templates/resources/clear-translations-mt-ai-review-task.template.ts
559
+ var CLEAR_TRANSLATIONS_MT_AI_REVIEW_TASK_TEMPLATE = {
560
+ id: "clearTranslationsMtAiReviewTask",
561
+ title: "Clear translations \u2192 MT/AI translation \u2192 review task",
562
+ summary: "Clear translations, apply MT/AI translation, and create a review task",
563
+ description: "This template sets up a workflow that clears existing translations, applies MT/AI translation, and creates a review task for human verification.",
564
+ layout: {
565
+ initial: "TriggerStep",
566
+ states: {
567
+ TriggerStep: {
568
+ on: {
569
+ WorkflowTriggerEvent: {
570
+ target: "ClearTranslationsStep",
571
+ actions: [{ type: "storeWorkflowTriggerEventScope" }]
572
+ }
573
+ }
574
+ },
575
+ ClearTranslationsStep: {
576
+ entry: [
577
+ {
578
+ type: "clearTranslationsAction"
579
+ }
580
+ ],
581
+ on: {
582
+ TranslationsClearedEvent: {
583
+ target: "AiMtTranslationStep"
584
+ }
585
+ }
586
+ },
587
+ AiMtTranslationStep: {
588
+ entry: [
589
+ {
590
+ type: "createTaskAction",
591
+ params: {
592
+ type: "translation"
593
+ }
594
+ }
595
+ ],
596
+ on: {
597
+ TaskCreatedEvent: {
598
+ actions: [{ type: "storeCreatedTaskId" }]
599
+ },
600
+ TaskClosedEvent: {
601
+ target: "ReviewTaskStep"
602
+ }
603
+ }
604
+ },
605
+ ReviewTaskStep: {
606
+ entry: [
607
+ {
608
+ type: "createTaskAction",
609
+ params: {
610
+ type: "review"
611
+ }
612
+ }
613
+ ],
614
+ on: {
615
+ TaskCreatedEvent: {
616
+ actions: [{ type: "storeCreatedTaskId" }]
617
+ },
618
+ TaskClosedEvent: {
619
+ target: "EndStep"
620
+ }
621
+ }
622
+ },
623
+ EndStep: {
624
+ type: "final"
625
+ }
626
+ }
627
+ },
628
+ settings: {
629
+ TriggerStep: DEFAULT_SCHEDULED_TRIGGER_STEP_SETTINGS,
630
+ ClearTranslationsStep: DEFAULT_CLEAR_TRANSLATIONS_STEP_SETTINGS,
631
+ AiMtTranslationStep: DEFAULT_AI_MT_TRANSLATION_STEP_SETTINGS,
632
+ ReviewTaskStep: DEFAULT_REVIEW_TASK_STEP_SETTINGS,
633
+ EndStep: DEFAULT_END_STEP_SETTINGS
634
+ },
635
+ sort: [
636
+ "TriggerStep",
637
+ "ClearTranslationsStep",
638
+ "AiMtTranslationStep",
639
+ "ReviewTaskStep",
640
+ "EndStep"
641
+ ]
642
+ };
643
+
644
+ // src/templates/resources/clear-translations-mt-ai-task.template.ts
645
+ var CLEAR_TRANSLATIONS_MT_AI_TASK_TEMPLATE = {
646
+ id: "clearTranslationsMtAiTask",
647
+ title: "Clear translations \u2192 MT/AI translation",
648
+ summary: "Clear existing translations before applying MT/AI translation",
649
+ description: "This template sets up a workflow that first clears existing translations and then applies MT/AI translation.",
650
+ layout: {
651
+ initial: "TriggerStep",
652
+ states: {
653
+ TriggerStep: {
654
+ on: {
655
+ WorkflowTriggerEvent: {
656
+ target: "ClearTranslationsStep",
657
+ actions: [{ type: "storeWorkflowTriggerEventScope" }]
658
+ }
659
+ }
660
+ },
661
+ ClearTranslationsStep: {
662
+ entry: [
663
+ {
664
+ type: "clearTranslationsAction"
665
+ }
666
+ ],
667
+ on: {
668
+ TranslationsClearedEvent: {
669
+ target: "AiMtTranslationStep"
670
+ }
671
+ }
672
+ },
673
+ AiMtTranslationStep: {
674
+ entry: [
675
+ {
676
+ type: "createTaskAction",
677
+ params: {
678
+ type: "translation"
679
+ }
680
+ }
681
+ ],
682
+ on: {
683
+ TaskCreatedEvent: {
684
+ actions: [{ type: "storeCreatedTaskId" }]
685
+ },
686
+ TaskClosedEvent: {
687
+ target: "EndStep"
688
+ }
689
+ }
690
+ },
691
+ EndStep: {
692
+ type: "final"
693
+ }
694
+ }
695
+ },
696
+ settings: {
697
+ TriggerStep: DEFAULT_SCHEDULED_TRIGGER_STEP_SETTINGS,
698
+ ClearTranslationsStep: DEFAULT_CLEAR_TRANSLATIONS_STEP_SETTINGS,
699
+ AiMtTranslationStep: DEFAULT_AI_MT_TRANSLATION_STEP_SETTINGS,
700
+ EndStep: DEFAULT_END_STEP_SETTINGS
701
+ },
702
+ sort: ["TriggerStep", "ClearTranslationsStep", "AiMtTranslationStep", "EndStep"]
703
+ };
704
+
705
+ // src/templates/resources/clear-translations-tm-mt-ai-review-task.template.ts
706
+ var CLEAR_TRANSLATIONS_TM_MT_AI_REVIEW_TASK_TEMPLATE = {
707
+ id: "clearTranslationsTmMtAiReviewTask",
708
+ title: "Clear translations \u2192 TM \u2192 MT/AI translation \u2192 review task",
709
+ summary: "Clear translations, apply TM and MT/AI translation, followed by a review task",
710
+ description: "This template sets up a workflow that clears existing translations, applies Translation Memory, then MT/AI translation, and creates a review task for human verification.",
561
711
  layout: {
562
712
  initial: "TriggerStep",
563
713
  states: {
564
714
  TriggerStep: {
565
715
  on: {
566
716
  WorkflowTriggerEvent: {
567
- target: "AiMtTranslationStep",
717
+ target: "ClearTranslationsStep",
568
718
  actions: [{ type: "storeWorkflowTriggerEventScope" }]
569
719
  }
570
720
  }
571
721
  },
722
+ ClearTranslationsStep: {
723
+ entry: [
724
+ {
725
+ type: "clearTranslationsAction"
726
+ }
727
+ ],
728
+ on: {
729
+ TranslationsClearedEvent: {
730
+ target: "ApplyTmStep"
731
+ }
732
+ }
733
+ },
734
+ ApplyTmStep: {
735
+ entry: [
736
+ {
737
+ type: "applyTmAction"
738
+ }
739
+ ],
740
+ on: {
741
+ TmAppliedEvent: {
742
+ target: "AiMtTranslationStep"
743
+ }
744
+ }
745
+ },
572
746
  AiMtTranslationStep: {
573
747
  entry: [
574
748
  {
575
749
  type: "createTaskAction",
576
750
  params: {
577
- type: "ai_mt_translation"
751
+ type: "translation"
752
+ }
753
+ }
754
+ ],
755
+ on: {
756
+ TaskCreatedEvent: {
757
+ actions: [{ type: "storeCreatedTaskId" }]
758
+ },
759
+ TaskClosedEvent: {
760
+ target: "ReviewTaskStep"
761
+ }
762
+ }
763
+ },
764
+ ReviewTaskStep: {
765
+ entry: [
766
+ {
767
+ type: "createTaskAction",
768
+ params: {
769
+ type: "review"
578
770
  }
579
771
  }
580
772
  ],
581
773
  on: {
774
+ TaskCreatedEvent: {
775
+ actions: [{ type: "storeCreatedTaskId" }]
776
+ },
582
777
  TaskClosedEvent: {
583
778
  target: "EndStep"
584
779
  }
@@ -591,10 +786,20 @@ var AI_MT_TRANSLATION_TASK_TEMPLATE = {
591
786
  },
592
787
  settings: {
593
788
  TriggerStep: DEFAULT_SCHEDULED_TRIGGER_STEP_SETTINGS,
789
+ ClearTranslationsStep: DEFAULT_CLEAR_TRANSLATIONS_STEP_SETTINGS,
790
+ ApplyTmStep: DEFAULT_APPLY_TM_STEP_SETTINGS,
594
791
  AiMtTranslationStep: DEFAULT_AI_MT_TRANSLATION_STEP_SETTINGS,
792
+ ReviewTaskStep: DEFAULT_REVIEW_TASK_STEP_SETTINGS,
595
793
  EndStep: DEFAULT_END_STEP_SETTINGS
596
794
  },
597
- sort: ["TriggerStep", "AiMtTranslationStep", "EndStep"]
795
+ sort: [
796
+ "TriggerStep",
797
+ "ClearTranslationsStep",
798
+ "ApplyTmStep",
799
+ "AiMtTranslationStep",
800
+ "ReviewTaskStep",
801
+ "EndStep"
802
+ ]
598
803
  };
599
804
 
600
805
  // src/templates/resources/clear-translations-tm-templates.ts
@@ -1237,10 +1442,12 @@ var TEMPLATE_IDS = [
1237
1442
  "reviewTranslateTask",
1238
1443
  "translateReviewReviewTask",
1239
1444
  "reviewTranslateReviewTask",
1240
- "aiMtTranslationTask",
1241
1445
  "clearTranslationsTm",
1242
1446
  "clearTranslationsTmTranslateTask",
1243
- "clearTranslationsTmTranslateReviewTask"
1447
+ "clearTranslationsTmTranslateReviewTask",
1448
+ "clearTranslationsMtAiTask",
1449
+ "clearTranslationsMtAiReviewTask",
1450
+ "clearTranslationsTmMtAiReviewTask"
1244
1451
  ];
1245
1452
  var buildTemplate = /* @__PURE__ */ __name((internalTemplate) => {
1246
1453
  const layoutTranslator = new LayoutTranslator();
@@ -1262,7 +1469,11 @@ var TEMPLATES = {
1262
1469
  translateReviewReviewTask: buildTemplate(TRANSLATE_REVIEW_REVIEW_TASK_TEMPLATE),
1263
1470
  reviewTranslateTask: buildTemplate(REVIEW_TRANSLATE_TASK_TEMPLATE),
1264
1471
  reviewTranslateReviewTask: buildTemplate(REVIEW_TRANSLATE_REVIEW_TASK_TEMPLATE),
1265
- aiMtTranslationTask: buildTemplate(AI_MT_TRANSLATION_TASK_TEMPLATE)
1472
+ clearTranslationsMtAiTask: buildTemplate(CLEAR_TRANSLATIONS_MT_AI_TASK_TEMPLATE),
1473
+ clearTranslationsMtAiReviewTask: buildTemplate(CLEAR_TRANSLATIONS_MT_AI_REVIEW_TASK_TEMPLATE),
1474
+ clearTranslationsTmMtAiReviewTask: buildTemplate(
1475
+ CLEAR_TRANSLATIONS_TM_MT_AI_REVIEW_TASK_TEMPLATE
1476
+ )
1266
1477
  };
1267
1478
 
1268
1479
  // src/apiContract/schemas.ts