diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html index 563f7d03f..86b651106 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html @@ -1,34 +1,38 @@
-
+

-
-
{{ 'rss-dialog.table-header.component' | translate }}
-
{{ 'rss-dialog.table-header.value' | translate }}
-
{{ 'rss-dialog.table-header.transformation-rule' | translate }}
-
{{ 'rss-dialog.table-header.annotation-references' | translate }}
+
+
{{ 'component-log-dialog.table-header.component' | translate }}
+
{{ 'component-log-dialog.table-header.value' | translate }}
+
{{ 'component-log-dialog.table-header.transformation-rule' | translate }}
+
{{ 'component-log-dialog.table-header.annotation-references' | translate }}
- -
{{ entry.key }}
+ +
{{ entry.name.replaceAll('_', ' ').toLowerCase() }}
-
{{ entry.value.transformation }}
+
{{ entry.componentValues[0].valueDescription }}
-
    +
    - - + -
@@ -64,7 +67,7 @@
@@ -84,9 +87,9 @@ label="Export All" > -
+
{{ 'rss-dialog.actions.display-by-default' | translate }} + >{{ 'component-log-dialog.actions.display-by-default' | translate }}
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.ts index d65d765e2..20772b20f 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.ts @@ -5,11 +5,11 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia import { ReplaceNbspPipe } from '@common-ui/pipes/replace-nbsp.pipe'; import { BaseDialogComponent, CircleButtonComponent, EditableInputComponent, IconButtonComponent } from '@iqser/common-ui'; import { TranslateModule } from '@ngx-translate/core'; -import { IFile, RssEntry, WorkflowFileStatuses } from '@red/domain'; +import { ComponentLogEntry, IFile, WorkflowFileStatuses } from '@red/domain'; import { FilesMapService } from '@services/files/files-map.service'; -import { RssService } from '@services/files/rss.service'; import { UserPreferenceService } from '@users/user-preference.service'; import { firstValueFrom } from 'rxjs'; +import { ComponentLogService } from '@services/files/component-log.service'; interface ScmData { file: IFile; @@ -34,12 +34,12 @@ interface ScmData { ], }) export class StructuredComponentManagementDialogComponent extends BaseDialogComponent implements OnInit { - readonly scmData = signal(undefined); + readonly componentLogData = signal(undefined); readonly openScmDialogByDefault = signal(this.userPreferences.getOpenScmDialogByDefault()); constructor( protected readonly _dialogRef: MatDialogRef, - private readonly _rssService: RssService, + private readonly _componentLogService: ComponentLogService, readonly userPreferences: UserPreferenceService, private readonly _filesMapService: FilesMapService, @Inject(MAT_DIALOG_DATA) readonly data: ScmData, @@ -62,18 +62,36 @@ export class StructuredComponentManagementDialogComponent extends BaseDialogComp originalOrder = (): number => 0; exportJSON() { - return firstValueFrom(this._rssService.exportJSON(this.data.file.dossierId, this.data.file.fileId, this.data.file.filename)); + return firstValueFrom( + this._componentLogService.exportJSON( + this.data.file.dossierTemplateId, + this.data.file.dossierId, + this.data.file.fileId, + this.data.file.filename, + ), + ); } exportXML() { - return firstValueFrom(this._rssService.exportXML(this.data.file.dossierId, this.data.file.fileId, this.data.file.filename)); + return firstValueFrom( + this._componentLogService.exportXML( + this.data.file.dossierTemplateId, + this.data.file.dossierId, + this.data.file.fileId, + this.data.file.filename, + ), + ); } async exportAllInDossier() { const allFilesInDossier = this._filesMapService.get(this.data.file.dossierId); for (const file of allFilesInDossier) { - await firstValueFrom(this._rssService.exportJSON(file.dossierId, file.fileId, file.filename)); - await firstValueFrom(this._rssService.exportXML(file.dossierId, file.fileId, file.filename)); + await firstValueFrom( + this._componentLogService.exportJSON(this.data.file.dossierTemplateId, file.dossierId, file.fileId, file.filename), + ); + await firstValueFrom( + this._componentLogService.exportXML(this.data.file.dossierTemplateId, file.dossierId, file.fileId, file.filename), + ); } } @@ -89,20 +107,26 @@ export class StructuredComponentManagementDialogComponent extends BaseDialogComp async undo(originalKey: string) { this._loadingService.start(); - await firstValueFrom(this._rssService.revertOverride(this.data.file.dossierId, this.data.file.fileId, [originalKey])); + await firstValueFrom(this._componentLogService.revertOverride(this.data.file.dossierId, this.data.file.fileId, [originalKey])); await this.#loadData(); } async saveEdit(event: string, originalKey: string) { this._loadingService.start(); - await firstValueFrom(this._rssService.override(this.data.file.dossierId, this.data.file.fileId, { [originalKey]: event })); + await firstValueFrom(this._componentLogService.override(this.data.file.dossierId, this.data.file.fileId, { [originalKey]: event })); await this.#loadData(); } async #loadData(): Promise { this._loadingService.start(); - const rssData = await firstValueFrom(this._rssService.getRSSData(this.data.file.dossierId, this.data.file.fileId)); - this.scmData.set(rssData); + const componentLogData = await firstValueFrom( + this._componentLogService.getComponentLogData( + this.data.file.dossierTemplateId, + this.data.file.dossierId, + this.data.file.fileId, + ), + ); + this.componentLogData.set(componentLogData); this._loadingService.stop(); } } diff --git a/apps/red-ui/src/app/services/files/component-log.service.ts b/apps/red-ui/src/app/services/files/component-log.service.ts new file mode 100644 index 000000000..9299c9373 --- /dev/null +++ b/apps/red-ui/src/app/services/files/component-log.service.ts @@ -0,0 +1,72 @@ +import { Injectable } from '@angular/core'; +import { GenericService } from '@iqser/common-ui'; +import { catchError, map, tap } from 'rxjs/operators'; +import { Observable, of } from 'rxjs'; +import { HttpHeaders } from '@angular/common/http'; +import { saveAs } from 'file-saver'; +import { ComponentDetails, ComponentLogEntry, IComponentLogData, IComponentLogEntry } from '@red/domain'; +import { mapEach } from '@common-ui/utils'; + +@Injectable({ providedIn: 'root' }) +export class ComponentLogService extends GenericService { + protected readonly _defaultModelPath = ''; + + getComponentLogData(dossierTemplateId: string, dossierId: string, fileId: string): Observable { + return this._http + .get(`/api/dossier-templates/${dossierTemplateId}/dossiers/${dossierId}/files/${fileId}/components`, { + params: { includeDetails: true }, + }) + .pipe( + map(data => data.componentDetails), + catchError(() => of({} as ComponentDetails)), + map(componentDetails => this.#filterComponentDetails(componentDetails)), + mapEach(log => new ComponentLogEntry(log)), + ); + } + + override(dossierId: string, fileId: string, componentOverrides: Record): Observable { + return this._post({ componentOverrides }, `componentLog/override/${dossierId}/${fileId}`); + } + + revertOverride(dossierId: string, fileId: string, components: string[]): Observable { + return this._post({ components }, `componentLog/override/revert/${dossierId}/${fileId}`); + } + + exportJSON(dossierTemplateId: string, dossierId: string, fileId: string, name: string): Observable { + return this.getComponentLogData(dossierTemplateId, dossierId, fileId).pipe( + tap(data => { + const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' }); + saveAs(blob, name + '.component_log.json'); + }), + ); + } + + exportXML(dossierTemplateId, dossierId: string, fileId: string, name: string): Observable { + return this.#getComponentLogDataAsXML(dossierTemplateId, dossierId, fileId).pipe( + tap(data => { + const blob = new Blob([data], { type: 'application/xml' }); + saveAs(blob, name + '.component_log.xml'); + }), + ); + } + + #getComponentLogDataAsXML(dossierTemplateId: string, dossierId: string, fileId: string) { + let headers = new HttpHeaders(); + headers = headers.set('accept', 'application/xml'); + + return this._http.get(`/api/dossier-templates/${dossierTemplateId}/dossiers/${dossierId}/files/${fileId}/components`, { + headers: headers, + responseType: 'text', + observe: 'body', + }); + } + + #filterComponentDetails(componentDetails: ComponentDetails): IComponentLogEntry[] { + return Object.keys(componentDetails) + .filter(function (key) { + const component = componentDetails[key]; + return !!component.componentValues[0].entityReferences.length; + }) + .reduce((res, key) => (res.push(componentDetails[key]), res), []); + } +} diff --git a/apps/red-ui/src/app/services/files/rss.service.ts b/apps/red-ui/src/app/services/files/rss.service.ts deleted file mode 100644 index 9fa3d8e61..000000000 --- a/apps/red-ui/src/app/services/files/rss.service.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Injectable } from '@angular/core'; -import { GenericService, QueryParam } from '@iqser/common-ui'; -import { IRssData, IRssEntry, RssEntry } from '@red/domain'; -import { catchError, map, tap } from 'rxjs/operators'; -import { Observable, of } from 'rxjs'; -import { HttpHeaders } from '@angular/common/http'; -import { saveAs } from 'file-saver'; - -@Injectable({ providedIn: 'root' }) -export class RssService extends GenericService { - protected readonly _defaultModelPath = 'import-redactions'; - - getRSSData(dossierId: string, fileId: string): Observable { - const queryParams: QueryParam[] = []; - queryParams.push({ key: 'fileId', value: fileId }); - - return this._getOne([dossierId], 'rss/detailed', queryParams).pipe( - map(data => data.files[0]), - catchError(() => of({} as IRssEntry)), - map(data => new RssEntry(data)), - ); - } - - getRSSExportData(dossierId: string, fileId: string): Observable { - const queryParams: QueryParam[] = []; - queryParams.push({ key: 'fileId', value: fileId }); - - return this._getOne([dossierId], 'rss', queryParams).pipe( - map(data => data.files[0]), - catchError(() => of({} as IRssEntry)), - ); - } - - override(dossierId: string, fileId: string, componentOverrides: Record): Observable { - return this._post({ componentOverrides }, `rss/override/${dossierId}/${fileId}`); - } - - revertOverride(dossierId: string, fileId: string, components: string[]): Observable { - return this._post({ components }, `rss/override/revert/${dossierId}/${fileId}`); - } - - exportJSON(dossierId: string, fileId: string, name: string): Observable { - return this.getRSSExportData(dossierId, fileId).pipe( - tap(data => { - const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' }); - saveAs(blob, name + '.rss.json'); - }), - ); - } - - exportXML(dossierId: string, fileId: string, name: string): Observable { - return this._getRSSDataAsXML(dossierId, fileId).pipe( - tap(data => { - const blob = new Blob([data], { type: 'application/xml' }); - saveAs(blob, name + '.rss.xml'); - }), - ); - } - - private _getRSSDataAsXML(dossierId: string, fileId: string) { - const queryParams: QueryParam[] = []; - queryParams.push({ key: 'fileId', value: fileId }); - - const entityPath = [dossierId].map(item => encodeURIComponent(item)).join('/'); - - let headers = new HttpHeaders(); - headers = headers.set('accept', 'application/xml'); - - return this._http.get(`/${this._serviceName}/${encodeURI('rss')}/${entityPath}`, { - headers: headers, - params: this._queryParams(queryParams), - responseType: 'text', - observe: 'body', - }); - } -} diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 42bf5941f..441ade243 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,9 +1,9 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dan.iqser.cloud", + "API_URL": "https://dan1.iqser.cloud", "APP_NAME": "RedactManager", - "IS_DOCUMINE": false, + "IS_DOCUMINE": true, "RULE_EDITOR_DEV_ONLY": false, "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -13,13 +13,13 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dan.iqser.cloud/auth", + "OAUTH_URL": "https://dan1.iqser.cloud/auth", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", "ANNOTATIONS_THRESHOLD": 1000, - "THEME": "redact", - "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/redact/", + "THEME": "scm", + "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/scm/", "AVAILABLE_NOTIFICATIONS_DAYS": 30, "AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60, "NOTIFICATIONS_THRESHOLD": 1000, diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index b5fba93d1..9a9499e91 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -558,6 +558,26 @@ "title": "Aktion bestätigen" } }, + "component-log-dialog": { + "actions": { + "cancel-edit": "Cancel", + "close": "Close", + "display-by-default": "", + "edit": "Edit", + "export-json": "Export JSON", + "export-xml": "Export XML", + "save": "Save", + "undo": "Undo" + }, + "annotations": "{type} found on page {page} by rule #{ruleNumber}", + "table-header": { + "annotation-references": "Annotation references", + "component": "Component", + "transformation-rule": "Transformation rule", + "value": "Value" + }, + "title": "Structured Component Management" + }, "component-rules-screen": { "error": { "generic": "" @@ -2232,26 +2252,6 @@ "red-user-admin": "Benutzer-Admin", "regular": "Regulär" }, - "rss-dialog": { - "actions": { - "cancel-edit": "Cancel", - "close": "Close", - "display-by-default": "", - "edit": "Edit", - "export-json": "Export JSON", - "export-xml": "Export XML", - "save": "Save", - "undo": "Undo" - }, - "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}", - "table-header": { - "annotation-references": "Annotation references", - "component": "Component", - "transformation-rule": "Transformation rule", - "value": "Value" - }, - "title": "Structured Component Management" - }, "search": { "active-dossiers": "ganze Plattform", "all-dossiers": "all documents", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 098bbce5c..e7025a1f4 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -558,6 +558,26 @@ "title": "Confirm Action" } }, + "component-log-dialog": { + "actions": { + "cancel-edit": "Cancel", + "close": "Close", + "display-by-default": "Display by default when opening documents", + "edit": "Edit", + "export-json": "Export JSON", + "export-xml": "Export XML", + "save": "Save", + "undo": "Undo to: {value}" + }, + "annotations": "{type} found on page {page} by rule #{ruleNumber}", + "table-header": { + "annotation-references": "Annotation references", + "component": "Component", + "transformation-rule": "Transformation rule", + "value": "Value" + }, + "title": "Component View" + }, "component-rules-screen": { "error": { "generic": "" @@ -1778,8 +1798,8 @@ "licensed-page-count": "Licensed Pages", "licensed-retention-capacity": "Licensed Retention Capacity", "licensed-to": "Licensed to", - "section-title": "Licensing Details", - "licensing-period": "Licensing Period" + "licensing-period": "Licensing Period", + "section-title": "Licensing Details" }, "page-usage": { "cumulative-pages": "Cumulative Pages", @@ -2237,26 +2257,6 @@ "red-user-admin": "Users Admin", "regular": "Regular" }, - "rss-dialog": { - "actions": { - "cancel-edit": "Cancel", - "close": "Close", - "display-by-default": "", - "edit": "Edit", - "export-json": "Export JSON", - "export-xml": "Export XML", - "save": "Save", - "undo": "Undo" - }, - "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}", - "table-header": { - "annotation-references": "Annotation references", - "component": "Component", - "transformation-rule": "Transformation rule", - "value": "Value" - }, - "title": "Structured Component Management" - }, "search-screen": { "cols": { "assignee": "Assignee", diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index d54e790c0..b152a4888 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -558,6 +558,26 @@ "title": "Aktion bestätigen" } }, + "component-log-dialog": { + "actions": { + "cancel-edit": "Cancel", + "close": "Close", + "display-by-default": "", + "edit": "Edit", + "export-json": "Export JSON", + "export-xml": "Export XML", + "save": "Save", + "undo": "Undo" + }, + "annotations": "{type} found on page {page} by rule #{ruleNumber}", + "table-header": { + "annotation-references": "Annotation references", + "component": "Component", + "transformation-rule": "Transformation rule", + "value": "Value" + }, + "title": "Structured Component Management" + }, "component-rules-screen": { "error": { "generic": "" @@ -2237,26 +2257,6 @@ "red-user-admin": "Benutzer-Admin", "regular": "Regulär" }, - "rss-dialog": { - "actions": { - "cancel-edit": "", - "close": "", - "display-by-default": "", - "edit": "", - "export-json": "", - "export-xml": "", - "save": "", - "undo": "" - }, - "annotations": "", - "table-header": { - "annotation-references": "", - "component": "", - "transformation-rule": "", - "value": "" - }, - "title": "" - }, "search-screen": { "cols": { "assignee": "Bevollmächtigter", diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index d5f97525b..90476cf5a 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -558,6 +558,26 @@ "title": "Confirm Action" } }, + "component-log-dialog": { + "actions": { + "cancel-edit": "Cancel", + "close": "Close", + "display-by-default": "Display by default when opening documents", + "edit": "Edit", + "export-json": "Export JSON", + "export-xml": "Export XML", + "save": "Save", + "undo": "Undo to: {value}" + }, + "annotations": "{type} found on page {page} by rule #{ruleNumber}", + "table-header": { + "annotation-references": "Annotation references", + "component": "Component", + "transformation-rule": "Transformation rule", + "value": "Value" + }, + "title": "Component View" + }, "component-rules-screen": { "error": { "generic": "Something went wrong... Component rules update failed!" @@ -1778,8 +1798,8 @@ "licensed-page-count": "Licensed Pages", "licensed-retention-capacity": "Licensed Retention Capacity", "licensed-to": "Licensed to", - "section-title": "Licensing Details", - "licensing-period": "Licensing Period" + "licensing-period": "Licensing Period", + "section-title": "Licensing Details" }, "page-usage": { "cumulative-pages": "Cumulative Pages", @@ -2237,26 +2257,6 @@ "red-user-admin": "Users Admin", "regular": "Regular" }, - "rss-dialog": { - "actions": { - "cancel-edit": "Cancel", - "close": "Close", - "display-by-default": "Display by default when opening documents", - "edit": "Edit", - "export-json": "Export JSON", - "export-xml": "Export XML", - "save": "Save", - "undo": "Undo to: {value}" - }, - "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}", - "table-header": { - "annotation-references": "Annotation references", - "component": "Component", - "transformation-rule": "Transformation rule", - "value": "Value" - }, - "title": "Component View" - }, "search-screen": { "cols": { "assignee": "Assignee", diff --git a/libs/red-domain/src/index.ts b/libs/red-domain/src/index.ts index dd4b6515d..e324c83a5 100644 --- a/libs/red-domain/src/index.ts +++ b/libs/red-domain/src/index.ts @@ -28,4 +28,4 @@ export * from './lib/license'; export * from './lib/digital-signature'; export * from './lib/watermarks'; export * from './lib/colors'; -export * from './lib/rss'; +export * from './lib/component-log'; diff --git a/libs/red-domain/src/lib/component-log/component-log-data.ts b/libs/red-domain/src/lib/component-log/component-log-data.ts new file mode 100644 index 000000000..691b4e742 --- /dev/null +++ b/libs/red-domain/src/lib/component-log/component-log-data.ts @@ -0,0 +1,10 @@ +import { ComponentDetails } from './component-log-entry'; + +export interface IComponentLogData { + filename: string | null; + fileId: string; + dossierId: string; + dossierTemplateId: string; + components: Record>; + componentDetails: ComponentDetails; +} diff --git a/libs/red-domain/src/lib/component-log/component-log-entry.ts b/libs/red-domain/src/lib/component-log/component-log-entry.ts new file mode 100644 index 000000000..1504948e3 --- /dev/null +++ b/libs/red-domain/src/lib/component-log/component-log-entry.ts @@ -0,0 +1,18 @@ +import { ComponentValue, IComponentValue } from './component-value'; + +export type ComponentDetails = Record>; + +export interface IComponentLogEntry { + name: string; + componentValues: IComponentValue[]; +} + +export class ComponentLogEntry implements IComponentLogEntry { + readonly name: string; + readonly componentValues: ComponentValue[]; + + constructor(entry: IComponentLogEntry) { + this.name = entry.name; + this.componentValues = entry.componentValues; + } +} diff --git a/libs/red-domain/src/lib/component-log/component-value.ts b/libs/red-domain/src/lib/component-log/component-value.ts new file mode 100644 index 000000000..ec00cf67f --- /dev/null +++ b/libs/red-domain/src/lib/component-log/component-value.ts @@ -0,0 +1,30 @@ +export interface EntityReference { + readonly id: string; + readonly type: string; + readonly entityRuleId: string; + readonly page: number; +} + +export interface IComponentValue { + readonly value: string; + readonly originalValue: string; + readonly valueDescription: string; + readonly componentRuleId: string; + readonly entityReferences: EntityReference[]; +} + +export class ComponentValue implements IComponentValue { + readonly value: string; + readonly originalValue: string; + readonly valueDescription: string; + readonly componentRuleId: string; + readonly entityReferences: EntityReference[]; + + constructor(value: IComponentValue) { + this.value = value.value; + this.originalValue = value.originalValue; + this.valueDescription = value.valueDescription; + this.componentRuleId = value.componentRuleId; + this.entityReferences = value.entityReferences ?? []; + } +} diff --git a/libs/red-domain/src/lib/component-log/index.ts b/libs/red-domain/src/lib/component-log/index.ts new file mode 100644 index 000000000..ea8f97269 --- /dev/null +++ b/libs/red-domain/src/lib/component-log/index.ts @@ -0,0 +1,3 @@ +export * from './component-log-data'; +export * from './component-log-entry'; +export * from './component-value'; diff --git a/libs/red-domain/src/lib/rss/index.ts b/libs/red-domain/src/lib/rss/index.ts deleted file mode 100644 index b39f0579d..000000000 --- a/libs/red-domain/src/lib/rss/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './rss-data'; -export * from './rss-entry'; -export * from './rss-result'; diff --git a/libs/red-domain/src/lib/rss/rss-data.ts b/libs/red-domain/src/lib/rss/rss-data.ts deleted file mode 100644 index 8e0ff7334..000000000 --- a/libs/red-domain/src/lib/rss/rss-data.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { IRssEntry } from './rss-entry'; - -export interface IRssData { - files: Array; -} diff --git a/libs/red-domain/src/lib/rss/rss-entry.ts b/libs/red-domain/src/lib/rss/rss-entry.ts deleted file mode 100644 index 71dcf6d5d..000000000 --- a/libs/red-domain/src/lib/rss/rss-entry.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { IRssResult, RssResult } from './rss-result'; - -export interface IRssEntry { - filename: string; - result: Record; -} - -export class RssEntry implements IRssEntry { - readonly filename: string; - readonly result: Record; - - constructor(entry: IRssEntry) { - this.filename = entry.filename; - - const mappedResult: Record = {}; - for (const key of Object.keys(entry.result)) { - const newKey = key.replace(new RegExp('_', 'g'), ' '); - mappedResult[newKey] = new RssResult(entry.result[key], key); - } - this.result = mappedResult; - } -} diff --git a/libs/red-domain/src/lib/rss/rss-result.ts b/libs/red-domain/src/lib/rss/rss-result.ts deleted file mode 100644 index 64b3282ca..000000000 --- a/libs/red-domain/src/lib/rss/rss-result.ts +++ /dev/null @@ -1,33 +0,0 @@ -export interface IScmAnnotation { - readonly type: string; - readonly pages: number[]; - readonly ruleIdentifier: string; - readonly reason: string; -} - -export interface IRssResult { - readonly value: string; - readonly originalValue: string; - readonly scmAnnotations: IScmAnnotation[]; - readonly transformation: string; -} - -export type RssResultAnnotation = IScmAnnotation & { readonly displayName: string }; - -export class RssResult implements IRssResult { - readonly value: string; - readonly originalValue: string; - readonly scmAnnotations: RssResultAnnotation[]; - readonly transformation: string; - - constructor(result: IRssResult, readonly originalKey: string) { - this.value = result.value; - this.originalValue = result.originalValue; - const scmAnnotations = result.scmAnnotations ?? []; - this.scmAnnotations = scmAnnotations.map(annotation => ({ - ...annotation, - displayName: annotation.reason.split('found')?.[0]?.trim(), - })); - this.transformation = result.transformation; - } -}