From ac440494e879d026622d09cec83739a0db2b7a54 Mon Sep 17 00:00:00 2001 From: Lina Date: Tue, 20 May 2025 15:14:43 +0200 Subject: [PATCH 1/4] Added integration type as enum --- enums/enums.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/enums/enums.ts b/enums/enums.ts index 76f58c1..e3e013e 100644 --- a/enums/enums.ts +++ b/enums/enums.ts @@ -52,4 +52,10 @@ export enum ModelsDownloadedStatus { DOWNLOADING = 'downloading', INITIALIZING = 'initializing', FAILED = 'failed', +} + +export enum IntegrationType { + GITHUB_ISSUE = 'GITHUB_ISSUE', + GITHUB_FILE = 'GITHUB_FILE', + SQL = 'SQL', } \ No newline at end of file From 33e7244aa99dd6d8dd5ceac8804bc18d0733cde3 Mon Sep 17 00:00:00 2001 From: Lina Date: Tue, 20 May 2025 16:07:44 +0200 Subject: [PATCH 2/4] Display for integration types --- enums/enum-functions.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/enums/enum-functions.ts b/enums/enum-functions.ts index f2a11e1..8796b9c 100644 --- a/enums/enum-functions.ts +++ b/enums/enum-functions.ts @@ -1,4 +1,4 @@ -import { InformationSourceType, LabelSource, SearchGroup, Slice, StaticOrderByKeys } from "./enums"; +import { InformationSourceType, IntegrationType, LabelSource, SearchGroup, Slice, StaticOrderByKeys } from "./enums"; export function informationSourceTypeToString(source: InformationSourceType, short: boolean, forDisplay: boolean = true) { if (forDisplay) { @@ -58,4 +58,10 @@ export function getOrderByDisplayName(orderByKey: string) { case StaticOrderByKeys.WEAK_SUPERVISION_CONFIDENCE: return "Weak Supervision Confidence"; default: return orderByKey; //attributes } +} + +export const INTEGRATIONS_DISPLAY = { + [IntegrationType.GITHUB_FILE]: "GitHub File", + [IntegrationType.GITHUB_ISSUE]: "GitHub Issue", + [IntegrationType.SQL]: "SQL", } \ No newline at end of file From 1d8bba96d0e4a86f568c1d0da68f5dd7e9804a0c Mon Sep 17 00:00:00 2001 From: Lina Date: Wed, 28 May 2025 10:16:55 +0200 Subject: [PATCH 3/4] Added sharepoint integration --- enums/enum-functions.ts | 2 +- enums/enums.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/enums/enum-functions.ts b/enums/enum-functions.ts index 8796b9c..e65d6bd 100644 --- a/enums/enum-functions.ts +++ b/enums/enum-functions.ts @@ -63,5 +63,5 @@ export function getOrderByDisplayName(orderByKey: string) { export const INTEGRATIONS_DISPLAY = { [IntegrationType.GITHUB_FILE]: "GitHub File", [IntegrationType.GITHUB_ISSUE]: "GitHub Issue", - [IntegrationType.SQL]: "SQL", + [IntegrationType.SHAREPOINT]: "SharePoint", } \ No newline at end of file diff --git a/enums/enums.ts b/enums/enums.ts index e3e013e..937d473 100644 --- a/enums/enums.ts +++ b/enums/enums.ts @@ -57,5 +57,5 @@ export enum ModelsDownloadedStatus { export enum IntegrationType { GITHUB_ISSUE = 'GITHUB_ISSUE', GITHUB_FILE = 'GITHUB_FILE', - SQL = 'SQL', + SHAREPOINT = 'SHAREPOINT', } \ No newline at end of file From 05f2851ac39f1be632fd15bfd016be9b0a24babe Mon Sep 17 00:00:00 2001 From: lumburovskalina <104008550+lumburovskalina@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:26:28 +0200 Subject: [PATCH 4/4] Post processing functions in submodules (#16) --- post-process-functions.ts | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 post-process-functions.ts diff --git a/post-process-functions.ts b/post-process-functions.ts new file mode 100644 index 0000000..96fafd8 --- /dev/null +++ b/post-process-functions.ts @@ -0,0 +1,48 @@ +import { jsonCopy } from "./general"; + +export function postProcessRecord(record: any, attributes: any[]) { + const prepareRecord = jsonCopy(record); + if (!prepareRecord.hasOwnProperty('data')) { + if (prepareRecord.hasOwnProperty('fullRecordData')) { + prepareRecord.data = prepareRecord.fullRecordData; + } + else if (prepareRecord.hasOwnProperty('recordData')) { + prepareRecord.data = prepareRecord.recordData; + } else { + throw new Error("Cant find record data in record object"); + } + } + attributes.forEach((attribute, index) => { + if (typeof prepareRecord.data[attribute.name] === 'boolean') { + prepareRecord.data[attribute.name] = prepareRecord.data[attribute.name].toString(); + } + }); + return prepareRecord; +} + +export function postProcessAttributes(attributes: any[]) { + const prepareAttributes = jsonCopy(attributes); + if (attributes && attributes.length > 0) { + if (!attributes[0].hasOwnProperty('key')) { + prepareAttributes.forEach((attribute, index) => { + if (attribute.id !== null) { + attribute.key = attribute.id; + } else { + throw new Error("Cant find attribute id in attribute object"); + } + }); + } + } + return prepareAttributes; +} + +export function postProcessUpdateAndSortRecords(prev: any[], newRecords: any[]) { + const merged = [...prev, ...newRecords]; + const uniqueRecords = Array.from( + new Map(merged.map((item) => [item.data?.running_id, item])).values() + ); + uniqueRecords.sort( + (a, b) => (a.data?.running_id || 0) - (b.data?.running_id || 0) + ); + return uniqueRecords; +} \ No newline at end of file