@natlibfi/marc-record-merge 6.0.0-beta.9 → 7.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.github/CODEOWNERS +2 -9
  2. package/.github/dependabot.yml +2 -3
  3. package/.github/workflows/melinda-node-tests.yml +2 -2
  4. package/dist/index.js +49 -4
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.spec.js +59 -0
  7. package/dist/index.spec.js.map +1 -0
  8. package/dist/reducers/copy.js +52 -62
  9. package/dist/reducers/copy.js.map +1 -1
  10. package/dist/reducers/copy.spec.js +6 -8
  11. package/dist/reducers/copy.spec.js.map +1 -1
  12. package/dist/reducers/copy2.spec.js +66 -0
  13. package/dist/reducers/copy2.spec.js.map +1 -0
  14. package/dist/reducers/index.js +0 -6
  15. package/dist/reducers/index.js.map +1 -1
  16. package/dist/reducers/select.js +43 -40
  17. package/dist/reducers/select.js.map +1 -1
  18. package/dist/reducers/select.spec.js +4 -15
  19. package/dist/reducers/select.spec.js.map +1 -1
  20. package/dist/reducers/select2.spec.js +58 -0
  21. package/dist/reducers/select2.spec.js.map +1 -0
  22. package/package.json +18 -18
  23. package/src/index.js +51 -1
  24. package/src/index.spec.js +45 -0
  25. package/src/reducers/copy.js +34 -8
  26. package/src/reducers/copy.spec.js +3 -1
  27. package/src/reducers/copy2.spec.js +55 -0
  28. package/src/reducers/select.js +31 -10
  29. package/src/reducers/select2.spec.js +49 -0
  30. package/test-fixtures/index/01/base.json +24 -0
  31. package/test-fixtures/index/01/merged.json +24 -0
  32. package/test-fixtures/index/01/metadata.json +8 -0
  33. package/test-fixtures/index/01/source.json +40 -0
  34. package/test-fixtures/index/02/base.json +24 -0
  35. package/test-fixtures/index/02/merged.json +24 -0
  36. package/test-fixtures/index/02/metadata.json +7 -0
  37. package/test-fixtures/index/02/source.json +40 -0
  38. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/03/metadata.json +6 -0
  39. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/base.json +20 -0
  40. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/merged.json +31 -0
  41. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/metadata.json +5 -0
  42. package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/04/source.json +20 -0
  43. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/base.json +11 -0
  44. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/metadata.json +1 -2
  45. package/test-fixtures/reducers/copy/11 - compareWithoutTag/01/source.json +0 -11
  46. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/merged.json +11 -0
  47. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/metadata.json +1 -2
  48. package/test-fixtures/reducers/copy/11 - compareWithoutTag/02/source.json +6 -3
  49. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/base.json +17 -0
  50. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/merged.json +28 -0
  51. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/metadata.json +7 -0
  52. package/test-fixtures/reducers/copy/11 - compareWithoutTag/04/source.json +31 -0
  53. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/base.json +28 -0
  54. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/merged.json +28 -0
  55. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/metadata.json +7 -0
  56. package/test-fixtures/reducers/copy/11 - compareWithoutTag/05/source.json +28 -0
@@ -0,0 +1,6 @@
1
+ {
2
+ "description": "Copy fields 730: omit ind 1 from comparison - same field no copy",
3
+ "tagPatternRegExp": "^730$",
4
+ "compareWithoutIndicator1": true,
5
+ "skip": true
6
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "730",
10
+ "ind1": "4",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {
14
+ "code": "a",
15
+ "value": "The End"
16
+ }
17
+ ]
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "730",
10
+ "ind1": "4",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {
14
+ "code": "a",
15
+ "value": "The End"
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "tag": "730",
21
+ "ind1": "0",
22
+ "ind2": " ",
23
+ "subfields": [
24
+ {
25
+ "code": "a",
26
+ "value": "The End"
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "description": "Copy fields 730: omit ind 2 from comparison - different field -> copy",
3
+ "tagPatternRegExp": "^730$",
4
+ "compareWithoutIndicator2foo": true
5
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "730",
10
+ "ind1": "0",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {
14
+ "code": "a",
15
+ "value": "The End"
16
+ }
17
+ ]
18
+ }
19
+ ]
20
+ }
@@ -12,6 +12,17 @@
12
12
  "subfields": [
13
13
  {"code": "a", "value": "original"}
14
14
  ]
15
+ },
16
+ {
17
+ "tag": "700",
18
+ "ind1": " ",
19
+ "ind2": " ",
20
+ "subfields": [
21
+ {
22
+ "code": "a",
23
+ "value": "test"
24
+ }
25
+ ]
15
26
  }
16
27
  ]
17
28
  }
@@ -1,7 +1,6 @@
1
1
  {
2
- "description": "compare fields 100 and 700, compareWithoutTag, if copied: swapTag 700: copy source 700 just once",
2
+ "description": "compare fields 100 and 700, compareWithoutTag, source 100 found as 700 in base: no copy",
3
3
  "tagPatternRegExp": "^(?<tags>100|700)$",
4
4
  "compareWithoutTag": true,
5
- "swapTag": [{"from": "^100$", "to": "700"}],
6
5
  "only": false
7
6
  }
@@ -15,17 +15,6 @@
15
15
  "value": "test"
16
16
  }
17
17
  ]
18
- },
19
- {
20
- "tag": "700",
21
- "ind1": " ",
22
- "ind2": " ",
23
- "subfields": [
24
- {
25
- "code": "a",
26
- "value": "test"
27
- }
28
- ]
29
18
  }
30
19
  ]
31
20
  }
@@ -23,6 +23,17 @@
23
23
  "value": "test"
24
24
  }
25
25
  ]
26
+ },
27
+ {
28
+ "tag": "700",
29
+ "ind1": " ",
30
+ "ind2": " ",
31
+ "subfields": [
32
+ {
33
+ "code": "a",
34
+ "value": "test2"
35
+ }
36
+ ]
26
37
  }
27
38
  ]
28
39
  }
@@ -1,7 +1,6 @@
1
1
  {
2
- "description": "compare fields 100 and 700, compareWithoutTag, if copied: swapTag 700: base has 700 allready",
2
+ "description": "compare fields 100 and 700, compareWithoutTag, adds missing 700 from source to base",
3
3
  "tagPatternRegExp": "^(?<tags>100|700)$",
4
4
  "compareWithoutTag": true,
5
- "swapTag": [{"from": "^100$", "to": "700"}],
6
5
  "only": false
7
6
  }
@@ -10,17 +10,20 @@
10
10
  "ind1": " ",
11
11
  "ind2": " ",
12
12
  "subfields": [
13
- {"code": "a", "value": "original"}
13
+ {
14
+ "code": "a",
15
+ "value": "test"
16
+ }
14
17
  ]
15
18
  },
16
19
  {
17
- "tag": "100",
20
+ "tag": "700",
18
21
  "ind1": " ",
19
22
  "ind2": " ",
20
23
  "subfields": [
21
24
  {
22
25
  "code": "a",
23
- "value": "test"
26
+ "value": "test2"
24
27
  }
25
28
  ]
26
29
  }
@@ -0,0 +1,17 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "100",
10
+ "ind1": " ",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {"code": "a", "value": "original"}
14
+ ]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "100",
10
+ "ind1": " ",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {"code": "a", "value": "original"}
14
+ ]
15
+ },
16
+ {
17
+ "tag": "700",
18
+ "ind1": " ",
19
+ "ind2": " ",
20
+ "subfields": [
21
+ {
22
+ "code": "a",
23
+ "value": "test"
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "description": "compare fields 100 and 700, compareWithoutTag, if copied: swapTag 700: copy source 700 just once",
3
+ "tagPatternRegExp": "^(?<tags>100|700)$",
4
+ "compareWithoutTag": true,
5
+ "swapTag": [{"from": "^100$", "to": "700"}],
6
+ "only": false
7
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "100",
10
+ "ind1": " ",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {
14
+ "code": "a",
15
+ "value": "test"
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "tag": "700",
21
+ "ind1": " ",
22
+ "ind2": " ",
23
+ "subfields": [
24
+ {
25
+ "code": "a",
26
+ "value": "test"
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "100",
10
+ "ind1": " ",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {"code": "a", "value": "original"}
14
+ ]
15
+ },
16
+ {
17
+ "tag": "700",
18
+ "ind1": " ",
19
+ "ind2": " ",
20
+ "subfields": [
21
+ {
22
+ "code": "a",
23
+ "value": "test"
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "100",
10
+ "ind1": " ",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {"code": "a", "value": "original"}
14
+ ]
15
+ },
16
+ {
17
+ "tag": "700",
18
+ "ind1": " ",
19
+ "ind2": " ",
20
+ "subfields": [
21
+ {
22
+ "code": "a",
23
+ "value": "test"
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "description": "compare fields 100 and 700, compareWithoutTag, if copied: swapTag 700: base has 700 allready",
3
+ "tagPatternRegExp": "^(?<tags>100|700)$",
4
+ "compareWithoutTag": true,
5
+ "swapTag": [{"from": "^100$", "to": "700"}],
6
+ "only": false
7
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "leader": "01331cam a22003494i 4500",
3
+ "fields": [
4
+ {
5
+ "tag": "001",
6
+ "value": "007346734"
7
+ },
8
+ {
9
+ "tag": "100",
10
+ "ind1": " ",
11
+ "ind2": " ",
12
+ "subfields": [
13
+ {"code": "a", "value": "original"}
14
+ ]
15
+ },
16
+ {
17
+ "tag": "100",
18
+ "ind1": " ",
19
+ "ind2": " ",
20
+ "subfields": [
21
+ {
22
+ "code": "a",
23
+ "value": "test"
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }