diff --git a/package.json b/package.json
index cad782266b5df..3c3f8d2feb3ab 100644
--- a/package.json
+++ b/package.json
@@ -1130,7 +1130,7 @@
"deep-freeze-strict": "^1.1.1",
"deepmerge": "^4.2.2",
"del": "^6.1.0",
- "diff": "^5.1.0",
+ "diff": "^7.0.0",
"dotenv": "^16.4.5",
"elastic-apm-node": "^4.10.0",
"email-addresses": "^5.0.0",
@@ -1141,7 +1141,7 @@
"extract-zip": "^2.0.1",
"fast-deep-equal": "^3.1.1",
"fast-glob": "^3.3.2",
- "fastest-levenshtein": "^1.0.12",
+ "fastest-levenshtein": "^1.0.16",
"fflate": "^0.6.9",
"file-saver": "^1.3.8",
"fnv-plus": "^1.3.1",
@@ -1580,7 +1580,7 @@
"@types/dagre": "^0.7.47",
"@types/dedent": "^0.7.0",
"@types/deep-freeze-strict": "^1.1.0",
- "@types/diff": "^5.0.8",
+ "@types/diff": "^6.0.0",
"@types/ejs": "^3.0.6",
"@types/enzyme": "^3.10.12",
"@types/eslint": "^8.44.2",
diff --git a/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/__snapshots__/use_comparison_cell_value.test.tsx.snap b/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/__snapshots__/use_comparison_cell_value.test.tsx.snap
index d4ab55d98fd68..bb53364085039 100644
--- a/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/__snapshots__/use_comparison_cell_value.test.tsx.snap
+++ b/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/__snapshots__/use_comparison_cell_value.test.tsx.snap
@@ -82,20 +82,25 @@ exports[`useComparisonCellValue should render cells with diff mode "Chars" 2`] =
>
is a
+
+ m
+
- different
+ diff
- m
+ e
- e
+ rent m
{
expect(result).toMatchInlineSnapshot(`
Array [
Object {
+ "added": false,
"count": 5,
+ "removed": false,
"value": "This ",
},
Object {
"added": true,
"count": 4,
- "removed": undefined,
+ "removed": false,
"value": "one ",
},
Object {
+ "added": false,
"count": 5,
+ "removed": false,
"value": "is a ",
},
Object {
- "added": true,
- "count": 10,
- "removed": undefined,
- "value": "different ",
- },
- Object {
+ "added": false,
"count": 1,
+ "removed": true,
"value": "m",
},
Object {
- "added": undefined,
+ "added": true,
+ "count": 4,
+ "removed": false,
+ "value": "diff",
+ },
+ Object {
+ "added": false,
"count": 1,
- "removed": true,
+ "removed": false,
"value": "e",
},
Object {
+ "added": true,
+ "count": 6,
+ "removed": false,
+ "value": "rent m",
+ },
+ Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "s",
},
Object {
- "added": undefined,
+ "added": false,
"count": 2,
"removed": true,
"value": "sa",
},
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "g",
},
Object {
- "added": undefined,
+ "added": false,
"count": 1,
"removed": true,
"value": "e",
},
Object {
+ "added": false,
"count": 4,
+ "removed": false,
"value": " val",
},
Object {
"added": true,
"count": 2,
- "removed": undefined,
+ "removed": false,
"value": "ue",
},
]
@@ -88,21 +106,25 @@ describe('calculateDiff', () => {
expect(result).toMatchInlineSnapshot(`
Array [
Object {
+ "added": false,
"count": 2,
+ "removed": false,
"value": "This ",
},
Object {
"added": true,
"count": 2,
- "removed": undefined,
+ "removed": false,
"value": "one ",
},
Object {
+ "added": false,
"count": 4,
+ "removed": false,
"value": "is a ",
},
Object {
- "added": undefined,
+ "added": false,
"count": 1,
"removed": true,
"value": "message",
@@ -110,15 +132,17 @@ describe('calculateDiff', () => {
Object {
"added": true,
"count": 1,
- "removed": undefined,
+ "removed": false,
"value": "different",
},
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": " ",
},
Object {
- "added": undefined,
+ "added": false,
"count": 1,
"removed": true,
"value": "val",
@@ -126,7 +150,7 @@ describe('calculateDiff', () => {
Object {
"added": true,
"count": 3,
- "removed": undefined,
+ "removed": false,
"value": "msg value",
},
]
@@ -138,7 +162,7 @@ describe('calculateDiff', () => {
expect(result).toMatchInlineSnapshot(`
Array [
Object {
- "added": undefined,
+ "added": false,
"count": 1,
"removed": true,
"value": "This is a message val",
@@ -146,7 +170,7 @@ describe('calculateDiff', () => {
Object {
"added": true,
"count": 1,
- "removed": undefined,
+ "removed": false,
"value": "This one is a different msg value",
},
]
@@ -162,31 +186,37 @@ describe('calculateDiff', () => {
expect(result).toMatchInlineSnapshot(`
Array [
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "[
",
},
Object {
- "added": undefined,
+ "added": false,
"count": 1,
"removed": true,
"value": " \\"gif\\",
",
},
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": " \\"png\\",
",
},
Object {
"added": true,
"count": 1,
- "removed": undefined,
+ "removed": false,
"value": " \\"jpg\\"
",
},
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "]",
},
]
@@ -203,12 +233,14 @@ describe('calculateDiff', () => {
expect(result).toMatchInlineSnapshot(`
Array [
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "[
",
},
Object {
- "added": undefined,
+ "added": false,
"count": 1,
"removed": true,
"value": " \\"single value\\"
@@ -217,13 +249,15 @@ describe('calculateDiff', () => {
Object {
"added": true,
"count": 2,
- "removed": undefined,
+ "removed": false,
"value": " \\"multiple\\",
\\"values\\"
",
},
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "]",
},
]
@@ -236,12 +270,14 @@ describe('calculateDiff', () => {
expect(result2).toMatchInlineSnapshot(`
Array [
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "[
",
},
Object {
- "added": undefined,
+ "added": false,
"count": 2,
"removed": true,
"value": " \\"multiple\\",
@@ -251,12 +287,14 @@ describe('calculateDiff', () => {
Object {
"added": true,
"count": 1,
- "removed": undefined,
+ "removed": false,
"value": " \\"single value\\"
",
},
Object {
+ "added": false,
"count": 1,
+ "removed": false,
"value": "]",
},
]
diff --git a/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/use_comparison_cell_value.test.tsx b/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/use_comparison_cell_value.test.tsx
index bbbf1ddcbb309..35d9044ecb78a 100644
--- a/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/use_comparison_cell_value.test.tsx
+++ b/src/platform/packages/shared/kbn-unified-data-table/src/components/compare_documents/hooks/use_comparison_cell_value.test.tsx
@@ -276,8 +276,8 @@ describe('useComparisonCellValue', () => {
expect(comparisonCell1.getCell()).not.toHaveClass(BASE_CELL_CLASS);
expect(comparisonCell1.getCell()).not.toHaveClass(MATCH_CELL_CLASS);
expect(comparisonCell1.getCell()).not.toHaveClass(DIFF_CELL_CLASS);
- expect(comparisonCell1.getAllSegments()).toHaveLength(12);
- expect(comparisonCell1.getAddedSegments()).toHaveLength(3);
+ expect(comparisonCell1.getAllSegments()).toHaveLength(13);
+ expect(comparisonCell1.getAddedSegments()).toHaveLength(4);
expect(comparisonCell1.getRemovedSegments()).toHaveLength(3);
expect(comparisonCell1.getCell()).toMatchSnapshot();
const comparisonCell2 = renderComparisonCell({
diff --git a/yarn.lock b/yarn.lock
index 14f22dc49b07a..51c8d5dc5e55f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -11500,10 +11500,10 @@
resolved "https://registry.yarnpkg.com/@types/diff-match-patch/-/diff-match-patch-1.0.36.tgz#dcef10a69d357fe9d43ac4ff2eca6b85dbf466af"
integrity sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==
-"@types/diff@^5.0.8":
- version "5.0.8"
- resolved "https://registry.yarnpkg.com/@types/diff/-/diff-5.0.8.tgz#28dc501cc3e7c62d4c5d096afe20755170acf276"
- integrity sha512-kR0gRf0wMwpxQq6ME5s+tWk9zVCfJUl98eRkD05HWWRbhPB/eu4V1IbyZAsvzC1Gn4znBJ0HN01M4DGXdBEV8Q==
+"@types/diff@^6.0.0":
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/@types/diff/-/diff-6.0.0.tgz#031f27cf57564f3cce825f38fb19fdd4349ad07a"
+ integrity sha512-dhVCYGv3ZSbzmQaBSagrv1WJ6rXCdkyTcDyoNu1MD8JohI7pR7k8wdZEm+mvdxRKXyHVwckFzWU1vJc+Z29MlA==
"@types/ejs@^3.0.6":
version "3.0.6"
@@ -17447,6 +17447,11 @@ diff@^5.0.0, diff@^5.1.0, diff@^5.2.0:
resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531"
integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==
+diff@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/diff/-/diff-7.0.0.tgz#3fb34d387cd76d803f6eebea67b921dab0182a9a"
+ integrity sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==
+
diffie-hellman@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e"
@@ -19102,10 +19107,10 @@ fast-xml-parser@4.4.1:
dependencies:
strnum "^1.0.5"
-fastest-levenshtein@^1.0.12:
- version "1.0.12"
- resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz#9990f7d3a88cc5a9ffd1f1745745251700d497e2"
- integrity sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==
+fastest-levenshtein@^1.0.12, fastest-levenshtein@^1.0.16:
+ version "1.0.16"
+ resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5"
+ integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==
fastest-stable-stringify@^1.0.1:
version "1.0.1"