Skip to content

Commit

Permalink
Merge pull request #244 from ds-wizard/release/4.11.2
Browse files Browse the repository at this point in the history
Release 4.11.2
  • Loading branch information
vknaisl authored Oct 22, 2024
2 parents cddefe4 + 73bb954 commit 7359072
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 34 deletions.
2 changes: 1 addition & 1 deletion registry-public/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: registry-public
version: '4.11.1'
version: '4.11.2'
synopsis: Registry Public
description: Registry Public
category: Web
Expand Down
2 changes: 1 addition & 1 deletion registry-server/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: registry-server
version: '4.11.1'
version: '4.11.2'
synopsis: Engine Registry
description: Engine Registry
category: Web
Expand Down
2 changes: 1 addition & 1 deletion registry-server/src/Registry/Api/Handler/Swagger/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ swagger =
s._swaggerInfo
{ _infoTitle = "Registry API"
, _infoDescription = Just "API specification for Registry"
, _infoVersion = "4.11.1"
, _infoVersion = "4.11.2"
, _infoLicense =
Just $
License
Expand Down
2 changes: 1 addition & 1 deletion shared-common/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: shared-common
version: '4.11.1'
version: '4.11.2'
synopsis: Engine Shared
description: Engine Shared
category: Web
Expand Down
2 changes: 1 addition & 1 deletion wizard-common/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wizard-common
version: '4.11.1'
version: '4.11.2'
synopsis: Wizard Engine
description: Wizard Engine
category: Web
Expand Down
2 changes: 1 addition & 1 deletion wizard-public/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wizard-public
version: '4.11.1'
version: '4.11.2'
synopsis: Wizard Public
description: Wizard Public
category: Web
Expand Down
2 changes: 1 addition & 1 deletion wizard-server/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wizard-server
version: '4.11.1'
version: '4.11.2'
synopsis: Engine Wizard
description: Engine Wizard
category: Web
Expand Down
2 changes: 1 addition & 1 deletion wizard-server/src/Wizard/Api/Handler/Swagger/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ swagger =
s._swaggerInfo
{ _infoTitle = "Wizard API"
, _infoDescription = Just "API specification for Wizard"
, _infoVersion = "4.11.1"
, _infoVersion = "4.11.2"
, _infoLicense =
Just $
License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data ClientConfigDTO = ClientConfigDTO
, locales :: [ClientConfigLocaleDTO]
, owl :: TenantConfigOwl
, admin :: ClientConfigAdminDTO
, aiAssistant :: ClientConfigAiAssistantDTO
, signalBridge :: ClientConfigSignalBridgeDTO
, modules :: [ClientConfigModuleDTO]
}
Expand Down Expand Up @@ -81,6 +82,11 @@ data ClientConfigAdminDTO = ClientConfigAdminDTO
}
deriving (Generic, Eq, Show)

data ClientConfigAiAssistantDTO = ClientConfigAiAssistantDTO
{ enabled :: Bool
}
deriving (Generic, Eq, Show)

data ClientConfigSignalBridgeDTO = ClientConfigSignalBridgeDTO
{ webSocketUrl :: Maybe String
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ instance FromJSON ClientConfigAdminDTO where
instance ToJSON ClientConfigAdminDTO where
toJSON = genericToJSON jsonOptions

instance FromJSON ClientConfigAiAssistantDTO where
parseJSON = genericParseJSON jsonOptions

instance ToJSON ClientConfigAiAssistantDTO where
toJSON = genericToJSON jsonOptions

instance FromJSON ClientConfigSignalBridgeDTO where
parseJSON = genericParseJSON jsonOptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ instance ToSchema ClientConfigLocaleDTO where
instance ToSchema ClientConfigAdminDTO where
declareNamedSchema = toSwagger (toClientConfigAdminDTO S.defaultAdmin defaultTenant)

instance ToSchema ClientConfigAiAssistantDTO where
declareNamedSchema = toSwagger (toClientConfigAiAssistantDTO S.defaultAdmin defaultTenant)

instance ToSchema ClientConfigSignalBridgeDTO where
declareNamedSchema = toSwagger (toClientConfigSignalBridgeDTO defaultTenant)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Wizard.Service.Config.Client.ClientConfigMapper where

import Data.Maybe
import qualified Data.UUID as U

import Shared.Common.Model.Config.ServerConfig
import Shared.Common.Model.Config.SimpleFeature
Expand All @@ -27,6 +28,7 @@ toClientConfigDTO serverConfig tenantConfig mUserProfile tenant locales =
, locales = fmap toClientConfigLocaleDTO locales
, owl = tenantConfig.owl
, admin = toClientConfigAdminDTO serverConfig.admin tenant
, aiAssistant = toClientConfigAiAssistantDTO serverConfig.admin tenant
, signalBridge = toClientConfigSignalBridgeDTO tenant
, modules =
if serverConfig.admin.enabled
Expand Down Expand Up @@ -111,6 +113,12 @@ toClientConfigAdminDTO :: ServerConfigAdmin -> Tenant -> ClientConfigAdminDTO
toClientConfigAdminDTO serverConfig tenant =
ClientConfigAdminDTO {enabled = serverConfig.enabled, clientUrl = tenant.adminClientUrl}

toClientConfigAiAssistantDTO :: ServerConfigAdmin -> Tenant -> ClientConfigAiAssistantDTO
toClientConfigAiAssistantDTO serverConfig tenant =
ClientConfigAiAssistantDTO
{ enabled = serverConfig.enabled && not (U.toString tenant.uuid == "731ccc18-b833-4927-9458-2dea090e26cc" || U.toString tenant.uuid == "61a65ac9-e055-49eb-89ae-f4a4b6410208")
}

toClientConfigSignalBridgeDTO :: Tenant -> ClientConfigSignalBridgeDTO
toClientConfigSignalBridgeDTO tenant =
ClientConfigSignalBridgeDTO {webSocketUrl = tenant.signalBridgeUrl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ instance SimpleEventSquash EditQuestionEvent where
, tagUuids = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.tagUuids)
, expertUuids = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.expertUuids)
, referenceUuids = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.referenceUuids)
, integrationUuid = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.integrationUuid)
, integrationUuid = applyValue oldEvent newEvent (.integrationUuid)
, props = applyValue oldEvent newEvent (.props)
, createdAt = oldEvent.createdAt
}
Expand All @@ -154,6 +154,6 @@ instance SimpleEventSquash EditQuestionEvent where
, tagUuids = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.tagUuids)
, expertUuids = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.expertUuids)
, referenceUuids = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.referenceUuids)
, listQuestionUuid = applyValueIfSameEntity mPreviousEvent oldEvent newEvent (.listQuestionUuid)
, listQuestionUuid = applyValue oldEvent newEvent (.listQuestionUuid)
, createdAt = oldEvent.createdAt
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ squashReorderEvents events =
let squashedEvent = simpleSquashEvent mPreviousEvent previousEvent newEvent
eventsToDeleted' = previousEvent : eventsToDeleted
events' = squashedEvent : events
in (eventsToDeleted', events', Just newEvent)
in (eventsToDeleted', events', Just squashedEvent)
Nothing ->
let eventsToDeleted' = eventsToDeleted
events' = newEvent : events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import qualified Data.List as L
import qualified Data.Map.Strict as M
import Data.Maybe (mapMaybe)

import Shared.Common.Model.Common.MapEntry
import WizardLib.KnowledgeModel.Model.Event.EventField
import WizardLib.KnowledgeModel.Model.KnowledgeModel.KnowledgeModelLenses

Expand All @@ -30,7 +31,9 @@ getExistingEntities oldEntities newEntities =
oldEntities

isSameEntity :: HasAnnotations' entity => entity -> entity -> Bool
isSameEntity entity1 entity2 = getAnnotations entity1 == getAnnotations entity2
isSameEntity entity1 entity2 =
let sortAnnotations = L.sortBy (\a1 a2 -> a1.key `compare` a2.key)
in (sortAnnotations . getAnnotations $ entity1) == (sortAnnotations . getAnnotations $ entity2)

diffListField (oldKm, newKm) oldList newList getEntitiesMFn =
let accessorFn km uuid = M.lookup uuid (getEntitiesMFn km)
Expand Down
23 changes: 13 additions & 10 deletions wizard-server/src/Wizard/Service/Owl/Diff/Differ.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ diffChapter (oldKm, newKm) (oldCh, newCh) = do
let oldQuestions = getQuestionsForChapterUuid oldKm oldCh.uuid
let newQuestions = getQuestionsForChapterUuid newKm newCh.uuid
existingQuestionsDiff <- traverse (diffQuestion (oldKm, newKm)) (getExistingEntities oldQuestions newQuestions)
newQuestionEvents <- traverse (createAddEvent newCh.uuid) (getDiffEntities newQuestions oldQuestions)
deletedQuestionEvents <- traverse (createDeleteEvent newCh.uuid) (getDiffEntities oldQuestions newQuestions)
newQuestionEvents <- traverse (createAddEvent newCh.uuid) (getDiffEntities oldQuestions newQuestions)
deletedQuestionEvents <- traverse (createDeleteEvent newCh.uuid) (getDiffEntities newQuestions oldQuestions)
return $ catMaybes [editChapterEvent] ++ concat existingQuestionsDiff ++ newQuestionEvents ++ deletedQuestionEvents

diffQuestion :: MonadIO m => (KnowledgeModel, KnowledgeModel) -> (Question, Question) -> m [Event]
Expand All @@ -41,25 +41,28 @@ diffQuestion (oldKm, newKm) (OptionsQuestion' oldQ, OptionsQuestion' newQ) = do
let oldAnswers = getAnswersForQuestionUuid oldKm oldQ.uuid
let newAnswers = getAnswersForQuestionUuid newKm newQ.uuid
existingAnswersDiff <- traverse (diffAnswer (oldKm, newKm)) (getExistingEntities oldAnswers newAnswers)
newAnswerEvents <- traverse (createAddEvent newQ.uuid) (getDiffEntities newAnswers oldAnswers)
deletedAnswerEvents <- traverse (createDeleteEvent oldQ.uuid) (getDiffEntities oldAnswers newAnswers)
newAnswerEvents <- traverse (createAddEvent newQ.uuid) (getDiffEntities oldAnswers newAnswers)
deletedAnswerEvents <- traverse (createDeleteEvent oldQ.uuid) (getDiffEntities newAnswers oldAnswers)
return $ catMaybes [editQuestionEvent] ++ concat existingAnswersDiff ++ newAnswerEvents ++ deletedAnswerEvents
diffQuestion (oldKm, newKm) (MultiChoiceQuestion' oldQ, MultiChoiceQuestion' newQ) = do
editQuestionEvent <- createEditEvent (oldKm, newKm) U.nil (MultiChoiceQuestion' oldQ) (MultiChoiceQuestion' newQ)
let oldChoices = getChoicesForQuestionUuid oldKm oldQ.uuid
let newChoices = getChoicesForQuestionUuid newKm newQ.uuid
existingChoicesDiff <- traverse (diffChoice (oldKm, newKm)) (getExistingEntities oldChoices newChoices)
newChoiceEvents <- traverse (createAddEvent newQ.uuid) (getDiffEntities newChoices oldChoices)
deletedChoiceEvents <- traverse (createDeleteEvent oldQ.uuid) (getDiffEntities oldChoices newChoices)
newChoiceEvents <- traverse (createAddEvent newQ.uuid) (getDiffEntities oldChoices newChoices)
deletedChoiceEvents <- traverse (createDeleteEvent oldQ.uuid) (getDiffEntities newChoices oldChoices)
return $ catMaybes [editQuestionEvent] ++ concat existingChoicesDiff ++ newChoiceEvents ++ deletedChoiceEvents
diffQuestion (oldKm, newKm) (ListQuestion' oldQ, ListQuestion' newQ) = do
editQuestionEvent <- createEditEvent (oldKm, newKm) U.nil (ListQuestion' oldQ) (ListQuestion' newQ)
let oldQuestions = getItemTemplateQuestionsForQuestionUuid oldKm oldQ.uuid
let newQuestions = getItemTemplateQuestionsForQuestionUuid newKm newQ.uuid
existingQuestionsDiff <- traverse (diffQuestion (oldKm, newKm)) (getExistingEntities oldQuestions newQuestions)
newQuestionEvents <- traverse (createAddEvent newQ.uuid) (getDiffEntities newQuestions oldQuestions)
deletedQuestionEvents <- traverse (createDeleteEvent oldQ.uuid) (getDiffEntities oldQuestions newQuestions)
newQuestionEvents <- traverse (createAddEvent newQ.uuid) (getDiffEntities oldQuestions newQuestions)
deletedQuestionEvents <- traverse (createDeleteEvent oldQ.uuid) (getDiffEntities newQuestions oldQuestions)
return $ catMaybes [editQuestionEvent] ++ concat existingQuestionsDiff ++ newQuestionEvents ++ deletedQuestionEvents
diffQuestion (oldKm, newKm) (ValueQuestion' oldQ, ValueQuestion' newQ) = do
editQuestionEvent <- createEditEvent (oldKm, newKm) U.nil (ValueQuestion' oldQ) (ValueQuestion' newQ)
return $ catMaybes [editQuestionEvent]
diffQuestion (oldKm, newKm) _ = return []

diffAnswer :: MonadIO m => (KnowledgeModel, KnowledgeModel) -> (Answer, Answer) -> m [Event]
Expand All @@ -68,8 +71,8 @@ diffAnswer (oldKm, newKm) (oldAnswer, newAnswer) = do
let oldQuestions = getQuestionsForAnswerUuid oldKm oldAnswer.uuid
let newQuestions = getQuestionsForAnswerUuid newKm newAnswer.uuid
existingQuestionsDiff <- traverse (diffQuestion (oldKm, newKm)) (getExistingEntities oldQuestions newQuestions)
newQuestionEvents <- traverse (createAddEvent newAnswer.uuid) (getDiffEntities newQuestions oldQuestions)
deletedQuestionEvents <- traverse (createDeleteEvent oldAnswer.uuid) (getDiffEntities oldQuestions newQuestions)
newQuestionEvents <- traverse (createAddEvent newAnswer.uuid) (getDiffEntities oldQuestions newQuestions)
deletedQuestionEvents <- traverse (createDeleteEvent oldAnswer.uuid) (getDiffEntities newQuestions oldQuestions)
return $ catMaybes [editAnswerEvent] ++ concat existingQuestionsDiff ++ newQuestionEvents ++ deletedQuestionEvents

diffChoice :: MonadIO m => (KnowledgeModel, KnowledgeModel) -> (Choice, Choice) -> m [Event]
Expand Down
20 changes: 10 additions & 10 deletions wizard-server/src/Wizard/Service/Owl/Diff/EventFactory/Question.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ instance EventFactory Question where
, props = entity.props
, createdAt = now
}
createEditEvent (oldKm, newKm) parentUuid (OptionsQuestion' oldEntity) (OptionsQuestion' newEntity) = do
createEditEvent (oldKm, newKm) parentUuid (OptionsQuestion' newEntity) (OptionsQuestion' oldEntity) = do
eventUuid <- liftIO generateUuid
now <- liftIO getCurrentTime
let event =
EditOptionsQuestionEvent
{ uuid = eventUuid
, parentUuid = parentUuid
, entityUuid = newEntity.uuid
, entityUuid = oldEntity.uuid
, title = diffField oldEntity.title newEntity.title
, text = diffField oldEntity.text newEntity.text
, requiredPhaseUuid =
Expand All @@ -127,14 +127,14 @@ instance EventFactory Question where
if isEmptyEvent event
then return . Just . EditQuestionEvent' . EditOptionsQuestionEvent' $ event
else return Nothing
createEditEvent (oldKm, newKm) parentUuid (MultiChoiceQuestion' oldEntity) (MultiChoiceQuestion' newEntity) = do
createEditEvent (oldKm, newKm) parentUuid (MultiChoiceQuestion' newEntity) (MultiChoiceQuestion' oldEntity) = do
eventUuid <- liftIO generateUuid
now <- liftIO getCurrentTime
let event =
EditMultiChoiceQuestionEvent
{ uuid = eventUuid
, parentUuid = parentUuid
, entityUuid = newEntity.uuid
, entityUuid = oldEntity.uuid
, title = diffField oldEntity.title newEntity.title
, text = diffField oldEntity.text newEntity.text
, requiredPhaseUuid =
Expand All @@ -151,14 +151,14 @@ instance EventFactory Question where
if isEmptyEvent event
then return . Just . EditQuestionEvent' . EditMultiChoiceQuestionEvent' $ event
else return Nothing
createEditEvent (oldKm, newKm) parentUuid (ListQuestion' oldEntity) (ListQuestion' newEntity) = do
createEditEvent (oldKm, newKm) parentUuid (ListQuestion' newEntity) (ListQuestion' oldEntity) = do
eventUuid <- liftIO generateUuid
now <- liftIO getCurrentTime
let event =
EditListQuestionEvent
{ uuid = eventUuid
, parentUuid = parentUuid
, entityUuid = newEntity.uuid
, entityUuid = oldEntity.uuid
, title = diffField oldEntity.title newEntity.title
, text = diffField oldEntity.text newEntity.text
, requiredPhaseUuid =
Expand All @@ -179,14 +179,14 @@ instance EventFactory Question where
if isEmptyEvent event
then return . Just . EditQuestionEvent' . EditListQuestionEvent' $ event
else return Nothing
createEditEvent (oldKm, newKm) parentUuid (ValueQuestion' oldEntity) (ValueQuestion' newEntity) = do
createEditEvent (oldKm, newKm) parentUuid (ValueQuestion' newEntity) (ValueQuestion' oldEntity) = do
eventUuid <- liftIO generateUuid
now <- liftIO getCurrentTime
let event =
EditValueQuestionEvent
{ uuid = eventUuid
, parentUuid = parentUuid
, entityUuid = newEntity.uuid
, entityUuid = oldEntity.uuid
, title = diffField oldEntity.title newEntity.title
, text = diffField oldEntity.text newEntity.text
, requiredPhaseUuid =
Expand All @@ -202,14 +202,14 @@ instance EventFactory Question where
if isEmptyEvent event
then return . Just . EditQuestionEvent' . EditValueQuestionEvent' $ event
else return Nothing
createEditEvent (oldKm, newKm) parentUuid (IntegrationQuestion' oldEntity) (IntegrationQuestion' newEntity) = do
createEditEvent (oldKm, newKm) parentUuid (IntegrationQuestion' newEntity) (IntegrationQuestion' oldEntity) = do
eventUuid <- liftIO generateUuid
now <- liftIO getCurrentTime
let event =
EditIntegrationQuestionEvent
{ uuid = eventUuid
, parentUuid = parentUuid
, entityUuid = newEntity.uuid
, entityUuid = oldEntity.uuid
, title = diffField oldEntity.title newEntity.title
, text = diffField oldEntity.text newEntity.text
, requiredPhaseUuid =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ squasherSpec =
, a_q2'
, e_q2_title'
, a_q3'
, EditQuestionEvent' . EditOptionsQuestionEvent' $ e_q1_title_2 {answerUuids = e_q1_answerUuids_title.answerUuids, createdAt = e_q1_answerUuids_title.createdAt}
, EditQuestionEvent' . EditOptionsQuestionEvent' $ e_q1_title_2 {answerUuids = e_q1_answerUuids_title.answerUuids, createdAt = e_q1_answerUuids.createdAt}
, e_q1_type'
, EditReferenceEvent' . EditURLReferenceEvent' $ e_ref1_url {createdAt = e_ref1_type.createdAt}
, e_ch1_label_3_day2'
Expand Down Expand Up @@ -113,7 +113,7 @@ squasherSpec =
let expEvents =
[ e_q1_text'
, a_q3'
, EditQuestionEvent' . EditOptionsQuestionEvent' $ e_q1_title_2 {answerUuids = e_q1_answerUuids_title.answerUuids, createdAt = e_q1_answerUuids_title.createdAt}
, EditQuestionEvent' . EditOptionsQuestionEvent' $ e_q1_title_2 {answerUuids = e_q1_answerUuids_title.answerUuids, createdAt = e_q1_answerUuids.createdAt}
, e_q1_type'
]
-- WHEN:
Expand Down

0 comments on commit 7359072

Please sign in to comment.