diff --git a/destinations/airbyte-faros-destination/src/converters/wolken/incidents.ts b/destinations/airbyte-faros-destination/src/converters/wolken/incidents.ts index f58074986..4ac06bafe 100644 --- a/destinations/airbyte-faros-destination/src/converters/wolken/incidents.ts +++ b/destinations/airbyte-faros-destination/src/converters/wolken/incidents.ts @@ -51,7 +51,7 @@ export class Incidents extends WolkenConverter { record: { ...incidentKey, title: incident.subject, - description: Utils.cleanAndTruncate(incident.description), + description: typeof incident.description === 'string' ? Utils.cleanAndTruncate(incident.description) : null, // TODO: Add severity priority: this.getPriority(incident.priorityName) ?? null, status: this.getStatus(incident.statusName) ?? null, @@ -75,10 +75,11 @@ export class Incidents extends WolkenConverter { }); } + if (!this.incidentCI.has(incidentKey.uid)) { + this.incidentCI.set(incidentKey.uid, new Set()); + } + for (const ci of incident.ciRequestList ?? []) { - if (!this.incidentCI.has(incidentKey.uid)) { - this.incidentCI.set(incidentKey.uid, new Set()); - } this.incidentCI.get(incidentKey.uid).add(ci.ciId); } diff --git a/destinations/airbyte-faros-destination/test/converters/__snapshots__/wolken.test.ts.snap b/destinations/airbyte-faros-destination/test/converters/__snapshots__/wolken.test.ts.snap index 0ffe41b33..78ad0d5a9 100644 --- a/destinations/airbyte-faros-destination/test/converters/__snapshots__/wolken.test.ts.snap +++ b/destinations/airbyte-faros-destination/test/converters/__snapshots__/wolken.test.ts.snap @@ -101,10 +101,10 @@ Array [ exports[`wolken incidents incident application impact 1`] = ` Array [ - "Processed 2 records", - "Processed records by stream: {\\\\\\"mytestsource__wolken__configuration_items\\\\\\":1,\\\\\\"mytestsource__wolken__incidents\\\\\\":1}\\"},\\"type\\":\\"LOG\\"}", - "Would write 6 records", - "Would write records by model: {\\\\\\"__Flush\\\\\\":1,\\\\\\"compute_Application\\\\\\":1,\\\\\\"ims_Incident\\\\\\":1,\\\\\\"ims_IncidentApplicationImpact\\\\\\":1,\\\\\\"ims_IncidentApplicationImpact__Deletion\\\\\\":1,\\\\\\"ims_IncidentAssignment\\\\\\":1}\\"},\\"type\\":\\"LOG\\"}", + "Processed 3 records", + "Processed records by stream: {\\\\\\"mytestsource__wolken__configuration_items\\\\\\":1,\\\\\\"mytestsource__wolken__incidents\\\\\\":2}\\"},\\"type\\":\\"LOG\\"}", + "Would write 8 records", + "Would write records by model: {\\\\\\"__Flush\\\\\\":1,\\\\\\"compute_Application\\\\\\":1,\\\\\\"ims_Incident\\\\\\":2,\\\\\\"ims_IncidentApplicationImpact\\\\\\":1,\\\\\\"ims_IncidentApplicationImpact__Deletion\\\\\\":2,\\\\\\"ims_IncidentAssignment\\\\\\":1}\\"},\\"type\\":\\"LOG\\"}", "Skipped 0 records", "Errored 0 records", ] @@ -120,6 +120,25 @@ Array [ "uid": "Test App_unknown", }, }, + Object { + "ims_Incident": Object { + "createdAt": "2025-01-08T09:54:48.000Z", + "description": "Support notification incident requiring investigation", + "priority": Object { + "category": "Low", + "detail": "Low - P4", + }, + "resolvedAt": "2025-01-23T09:02:12.000Z", + "source": "Wolken", + "status": Object { + "category": "Resolved", + "detail": "Closed", + }, + "title": "Inc_Support_Notification", + "uid": "123457", + "updatedAt": "2025-01-23T09:02:39.000Z", + }, + }, Object { "ims_Incident": Object { "createdAt": "2025-01-08T09:54:48.000Z", @@ -152,6 +171,18 @@ Array [ "source": "Wolken", }, }, + Object { + "ims_IncidentApplicationImpact__Deletion": Object { + "flushRequired": false, + "source": "Wolken", + "where": Object { + "incident": Object { + "source": "Wolken", + "uid": "123457", + }, + }, + }, + }, Object { "ims_IncidentApplicationImpact__Deletion": Object { "flushRequired": false, diff --git a/destinations/airbyte-faros-destination/test/resources/wolken/incidents_configuration_items.log b/destinations/airbyte-faros-destination/test/resources/wolken/incidents_configuration_items.log index 0b238e07a..af252714c 100644 --- a/destinations/airbyte-faros-destination/test/resources/wolken/incidents_configuration_items.log +++ b/destinations/airbyte-faros-destination/test/resources/wolken/incidents_configuration_items.log @@ -1,2 +1,3 @@ {"record":{"stream":"mytestsource__wolken__incidents","emitted_at":1737738990250,"data":{"ticketId":123456,"ticketFormattedId":"INC123456","originId":100,"originName":"Virtual Agent","subject":"Inc_Support_Notification","createdTime":"2025-01-08T09:54:48.000Z","requesterId":10001,"requesterName":"John Smith","creatorId":10001,"creatorName":"John Smith","unitId":1,"unitName":"IT Service Management","categoryId":1,"categoryName":"N/A","subCategoryId":1,"subCategoryName":"N/A","itemId":1,"itemName":"Generic Ticket Creation","teamId":20001,"teamName":"Cloud Support Team","priorityId":4,"priorityName":"Low - P4","impactId":2,"impactName":"Medium","urgencyId":3,"urgencyName":"Low","assignedUserId":10002,"assignedUserName":"Jane Doe","assignedUserPsNo":"jane.doe@example.com","updatedTimestamp":"2025-01-23T09:02:39.000Z","statusName":"Closed","subStatusName":"Closed","statusId":3,"subStatusId":3,"lastUpdatedByUser":"Bob Wilson","lastUpdatedByUserId":10003,"plannedStartDate":"","plannedEndDate":"","closedByUserID":10003,"closureTimeStamp":"2025-01-23 09:02:39","resolvedByUserID":10003,"resolvedByUserEmail":"bob.wilson@example.com","resolvedByUserName":"Bob Wilson","resolutionTimeStamp":"2025-01-23T09:02:12.000Z","description":"Support notification incident requiring investigation","attachments":[],"flexFields":[{"flexId":12,"flexName":"Building","flexValue":"100 Main Street"}],"internalWatchers":[],"externalWatchers":[],"ciRequestList":[{"pkey":10000,"ciId":100,"ciName":"Mobile Platform","ciTypeId":1,"ciTypeName":"Applications"}],"teamMapping":{}}},"type":"RECORD"} {"record":{"stream":"mytestsource__wolken__configuration_items","emitted_at":1738253745786,"data":{"ciId":100,"flexFields":[{"flexId":1,"flexName":"Service ID","flexValue":"A3F91B6D"},{"flexId":2,"flexName":"JIRA Key","flexValue":"FAROS"},{"flexId":3,"flexName":"Environment","flexValue":"Production"},{"flexId":4,"flexName":"Engineering Owner","flexValue":"john.doe@example.com"}],"urgency":{"urgencyId":3}}},"type":"RECORD"} +{"record":{"stream":"mytestsource__wolken__incidents","emitted_at":1737738990250,"data":{"ticketId":123457,"ticketFormattedId":"INC123457","originId":100,"originName":"Virtual Agent","subject":"Inc_Support_Notification","createdTime":"2025-01-08T09:54:48.000Z","requesterId":10001,"requesterName":"John Smith","creatorId":10001,"creatorName":"John Smith","unitId":1,"unitName":"IT Service Management","categoryId":1,"categoryName":"N/A","subCategoryId":1,"subCategoryName":"N/A","itemId":1,"itemName":"Generic Ticket Creation","teamId":20001,"teamName":"Cloud Support Team","priorityId":4,"priorityName":"Low - P4","impactId":2,"impactName":"Medium","urgencyId":3,"urgencyName":"Low","updatedTimestamp":"2025-01-23T09:02:39.000Z","statusName":"Closed","subStatusName":"Closed","statusId":3,"subStatusId":3,"lastUpdatedByUser":"Bob Wilson","lastUpdatedByUserId":10003,"plannedStartDate":"","plannedEndDate":"","closedByUserID":10003,"closureTimeStamp":"2025-01-23 09:02:39","resolvedByUserID":10003,"resolvedByUserEmail":"bob.wilson@example.com","resolvedByUserName":"Bob Wilson","resolutionTimeStamp":"2025-01-23T09:02:12.000Z","description":"Support notification incident requiring investigation","attachments":[],"flexFields":[{"flexId":12,"flexName":"Building","flexValue":"100 Main Street"}],"internalWatchers":[],"externalWatchers":[],"ciRequestList":[],"teamMapping":{}}},"type":"RECORD"}