Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions DSL/DMapper/rag-search/hbs/bot_responses_to_messages.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{{#each data.botMessages}}
{
"chatId": "{{../data.chatId}}",
"content": "{{filterControlCharacters result}}",
"buttons": "[{{#each ../data.buttons}}{\"title\": \"{{#if (eq title true)}}Yes{{else if (eq title false)}}No{{else}}{{{title}}}{{/if}}\",\"payload\": \"{{{payload}}}\"}{{#unless @last}},{{/unless}}{{/each}}]",
"authorTimestamp": "{{../data.authorTimestamp}}",
"authorId": "{{../data.authorId}}",
"authorFirstName": "{{../data.authorFirstName}}",
"authorLastName": "{{../data.authorLastName}}",
"created": "{{../data.created}}"
}{{#unless @last}},{{/unless}}
{{/each}}
]
29 changes: 29 additions & 0 deletions DSL/DMapper/rag-search/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ export function getAgencyDataAvailable(agencyId) {
return (combinedValue % 2) === 0;
}

export function filterControlCharacters(str) {
if (typeof str !== "string") return str;
return str.replace(/[\x00-\x1F\x7F]/g, " ");
}

export function json(context) {
return JSON.stringify(context);
}
Expand Down Expand Up @@ -269,3 +274,27 @@ export function filterDataByAgency(aggregatedData, startIndex, agencyId, pageSiz
return JSON.stringify(result);

}

export function calculateDateDifference(value) {
const { startDate, endDate, outputType } = value;
const sDate = new Date(startDate);
const eDate = new Date(endDate);
const timeDifferenceInSeconds = (eDate.getTime() - sDate.getTime()) / 1000;

switch (outputType?.toLowerCase()) {
case 'years':
return eDate.getFullYear() - sDate.getFullYear();
case 'months':
return eDate.getMonth() - sDate.getMonth() +
(12 * (eDate.getFullYear() - sDate.getFullYear()))
case 'hours':
return Math.round(Math.abs(eDate - sDate) / 36e5);
case 'minutes':
return Math.floor(timeDifferenceInSeconds / 60);
case 'seconds':
return timeDifferenceInSeconds;
default:
return Math.round(timeDifferenceInSeconds / (3600 * 24));
}
}

28 changes: 28 additions & 0 deletions DSL/Ruuter.public/services/GET/.guard
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
check_for_cookie:
switch:
- condition: ${incoming.headers == null || incoming.headers.cookie == null}
next: guard_fail
next: authenticate

authenticate:
template: "[#SERVICE_PROJECT_LAYER]/check-user-authority"
requestType: templates
headers:
cookie: ${incoming.headers.cookie}
result: authority_result

check_authority_result:
switch:
- condition: ${authority_result !== "false"}
next: guard_success
next: guard_fail

guard_success:
return: "success"
status: 200
next: end

guard_fail:
return: "unauthorized"
status: 401
next: end
27 changes: 27 additions & 0 deletions DSL/Ruuter.public/services/GET/account/user-profile-settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'USER-PROFILE-SETTINGS'"
method: get
accepts: json
returns: json
namespace: service

step_1:
call: reflect.mock
args:
response:
response:
- userId: EE30303039914
forwardedChatPopupNotifications: false
forwardedChatSoundNotifications: false
forwardedChatEmailNotifications: false
newChatPopupNotifications: false
newChatSoundNotifications: false
newChatEmailNotifications: false
useAutocorrect: true
result: reflected_request

step_2:
wrapper: false
return: ${reflected_request.response.body}
20 changes: 20 additions & 0 deletions DSL/Ruuter.public/services/GET/active-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'ACTIVE-SERVICES'"
method: get
accepts: json
returns: json
namespace: service

get_services_list:
call: http.post
args:
url: "[#SERVICE_RESQL]/get-active-services-list"
result: results

return_ok:
status: 200
wrapper: false
return: ${results.response.body}
next: end
4 changes: 4 additions & 0 deletions DSL/Ruuter.public/services/GET/generic/.guard
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
guard_allow_all:
return: "success"
status: 200
next: end
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'CUSTOMER-SUPPORT-ACTIVITY'"
method: get
accepts: json
returns: json
namespace: service

step_1:
call: reflect.mock
args:
response:
response:
- idCode: 'EE49902216518'
active: 'true'
status: 'idle'
result: reflected_request

step_2:
wrapper: true
return: ${reflected_request.response.body}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'USER-PROFILE-SETTINGS'"
method: get
accepts: json
returns: json
namespace: service

step_1:
call: reflect.mock
args:
response:
data:
- userId: EE30303039914
forwardedChatPopupNotifications: false
forwardedChatSoundNotifications: false
forwardedChatEmailNotifications: false
newChatPopupNotifications: false
newChatSoundNotifications: false
newChatEmailNotifications: false
useAutocorrect: true
result: reflected_request

step_2:
return: ${reflected_request.response.body}
19 changes: 19 additions & 0 deletions DSL/Ruuter.public/services/GET/generic/accounts/user-role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'USER-ROLE'"
method: get
accepts: json
returns: json
namespace: service

step_1:
call: reflect.mock
args:
response:
response:
- "ROLE_ADMINISTRATOR"
result: reflected_request

step_2:
return: ${reflected_request.response.body}
76 changes: 76 additions & 0 deletions DSL/Ruuter.public/services/GET/generic/csa/active-chats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'ACTIVE-CHATS'"
method: get
accepts: json
returns: json
namespace: service

step_1:
call: reflect.mock
args:
response:
response:
- id: '22fa5630-6f92-4d50-92ba-685c872383af'
customerSupportId: ''
customerSupportDisplayName: ''
endUserId: ''
endUserFirstName: ''
endUserLastName: ''
status: 'OPEN'
created: '2023-01-17T13:18:38.808+00:00'
updated: '2023-01-17T13:19:26.348+00:00'
ended: null
endUserOs: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
endUserUrl: 'https://test.buerokratt.ee/'
forwardedToName: null
forwardedByUser: ''
forwardedFromCsa: ''
forwardedToCsa: ''
lastMessage: 'Suunan teid klienditeenindajale. Varuge natukene kannatust.'
contactsMessage: null
lastMessageTimestamp: '2023-01-17T13:19:26.316+00:00'
- id: '5206b7bd-0812-40a8-ae1d-3774f07f06f0'
customerSupportId: ''
customerSupportDisplayName: ''
endUserId: ''
endUserFirstName: ''
endUserLastName: ''
status: 'OPEN'
created: '2023-01-19T13:38:32.421+00:00'
updated: '2023-01-19T13:38:32.430+00:00'
ended: null
endUserOs: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
endUserUrl: 'https://test.buerokratt.ee/'
forwardedToName: null
forwardedByUser: ''
forwardedFromCsa: ''
forwardedToCsa: ''
lastMessage: 'aitäh'
contactsMessage: null
lastMessageTimestamp: '2022-11-23T09:33:56.803+00:00'
- id: 'b7bba1c2-b7ab-4b17-825a-2d66a7d16fc4'
customerSupportId: ''
customerSupportDisplayName: ''
endUserId: ''
endUserFirstName: ''
endUserLastName: ''
status: 'OPEN'
created: '2023-01-19T13:38:32.421+00:00'
updated: '2023-01-19T13:38:32.430+00:00'
ended: null
endUserOs: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'
endUserUrl: 'https://test.buerokratt.ee/'
forwardedToName: null
forwardedByUser: ''
forwardedFromCsa: ''
forwardedToCsa: ''
lastMessage: 'dasnhpwa'
contactsMessage: null
lastMessageTimestamp: '2023-01-18T12:24:54.557+00:00'
result: reflected_request

step_2:
wrapper: true
return: ${reflected_request.response.body}
29 changes: 29 additions & 0 deletions DSL/Ruuter.public/services/GET/generic/userinfo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'USERINFO'"
method: get
accepts: json
returns: json
namespace: service

step_1:
call: reflect.mock
args:
response:
data:
firstName: OK
lastName: TESTNUMBER
idCode: EE30303039914
displayName: OK
JWTCreated: 1704724715000
login: EE30303039914
csaEmail: mail@mail.ee
authorities:
- ROLE_ADMINISTRATOR
csaTitle: OG
JWTExpirationTimestamp: 1704739715000
result: reflected_request

step_2:
return: ${reflected_request.response.body}
40 changes: 40 additions & 0 deletions DSL/Ruuter.public/services/GET/get-sticky.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'GET-STICKY'"
method: get
accepts: json
returns: json
namespace: service
allowlist:
params:
- field: name
type: string
description: "Parameter 'name'"

check_for_parameters:
switch:
- condition: ${incoming.params == null || incoming.params.name == null}
next: get_all_sticky_services
next: get_single_sticky_service

get_single_sticky_service:
call: http.post
args:
url: "[#SERVICE_DMAPPER]/ruuter/sticky/steps"
query:
name: ${incoming.params.name}
result: results
next: return_ok

get_all_sticky_services:
call: http.get
args:
url: "[#SERVICE_DMAPPER]/ruuter/sticky"
result: results
next: return_ok

return_ok:
status: 200
return: ${results.response.body}
next: end
40 changes: 40 additions & 0 deletions DSL/Ruuter.public/services/GET/internal/domain-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'DOMAIN-FILE'"
method: get
accepts: json
returns: json
namespace: service
allowlist:
headers:
- field: cookie
type: string
description: "Cookie field"

getFileLocations:
call: http.get
args:
url: "[#SERVICE_RUUTER]/internal/return-file-locations"
headers:
cookie: ${incoming.headers.cookie}
result: fileLocations

getDomainFile:
call: http.post
args:
url: "[#SERVICE_DMAPPER]/file-manager/read-file"
body:
file_path: ${fileLocations.response.body.response.domain_location}
result: domainFile

convertYamlToJson:
call: http.post
args:
url: "[#SERVICE_DMAPPER]/conversion/yaml_to_json"
body:
file: ${domainFile.response.body.file}
result: domainData

return_value:
return: ${domainData.response.body}
Loading
Loading