@natlibfi/marc-record-merge 6.0.0-beta.2 → 6.0.0-beta.6
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.
- package/.github/CODEOWNERS +9 -0
- package/.github/dependabot.yml +41 -0
- package/.github/workflows/melinda-node-tests.yml +60 -0
- package/LICENSE +21 -0
- package/README.md +106 -2
- package/dist/index.js +2 -37
- package/dist/index.js.map +1 -1
- package/dist/reducers/copy.js +310 -109
- package/dist/reducers/copy.js.map +1 -1
- package/dist/reducers/copy.spec.js +52 -99
- package/dist/reducers/copy.spec.js.map +1 -1
- package/dist/reducers/index.js +0 -27
- package/dist/reducers/index.js.map +1 -1
- package/dist/reducers/select.js +12 -50
- package/dist/reducers/select.js.map +1 -1
- package/dist/reducers/select.spec.js +49 -83
- package/dist/reducers/select.spec.js.map +1 -1
- package/package.json +30 -27
- package/src/index.js +1 -33
- package/src/reducers/copy.js +306 -115
- package/src/reducers/copy.spec.js +44 -66
- package/src/reducers/index.js +0 -27
- package/src/reducers/select.js +8 -51
- package/src/reducers/select.spec.js +37 -58
- package/test-fixtures/reducers/copy/{01/base.json → 01 - copy/01/base.json } +1 -1
- package/test-fixtures/reducers/copy/{01 → 01 - copy/01}/merged.json +0 -0
- package/test-fixtures/reducers/copy/01 - copy/01/metadata.json +4 -0
- package/test-fixtures/reducers/copy/{01 → 01 - copy/01}/source.json +0 -0
- package/test-fixtures/reducers/copy/{02/source.json → 01 - copy/02/base.json} +0 -0
- package/test-fixtures/reducers/copy/{02 → 01 - copy/02}/merged.json +0 -0
- package/test-fixtures/reducers/copy/01 - copy/02/metadata.json +4 -0
- package/test-fixtures/reducers/copy/{02/base.json → 01 - copy/02/source.json } +1 -1
- package/test-fixtures/reducers/copy/{03/base.json → 01 - copy/03/base.json } +1 -1
- package/test-fixtures/reducers/copy/{03 → 01 - copy/03}/merged.json +0 -0
- package/test-fixtures/reducers/copy/01 - copy/03/metadata.json +4 -0
- package/test-fixtures/reducers/copy/{03 → 01 - copy/03}/source.json +0 -0
- package/test-fixtures/reducers/copy/{05/base.json → 01 - copy/04/base.json } +1 -1
- package/test-fixtures/reducers/copy/{04/merged.json → 01 - copy/04/merged.json } +1 -1
- package/test-fixtures/reducers/copy/01 - copy/04/metadata.json +4 -0
- package/test-fixtures/reducers/copy/{04/source.json → 01 - copy/04/source.json } +1 -1
- package/test-fixtures/reducers/copy/{04/base.json → 01 - copy/05/base.json } +1 -1
- package/test-fixtures/reducers/copy/{05 → 01 - copy/05}/merged.json +0 -0
- package/test-fixtures/reducers/copy/01 - copy/05/metadata.json +4 -0
- package/test-fixtures/reducers/copy/{05 → 01 - copy/05}/source.json +0 -0
- package/test-fixtures/reducers/copy/01 - copy/06/base.json +24 -0
- package/test-fixtures/reducers/copy/01 - copy/06/merged.json +39 -0
- package/test-fixtures/reducers/copy/01 - copy/06/metadata.json +4 -0
- package/test-fixtures/reducers/copy/01 - copy/06/source.json +24 -0
- package/test-fixtures/reducers/copy/01 - copy/07/base.json +39 -0
- package/test-fixtures/reducers/copy/01 - copy/07/merged.json +39 -0
- package/test-fixtures/reducers/copy/01 - copy/07/metadata.json +5 -0
- package/test-fixtures/reducers/copy/01 - copy/07/source.json +24 -0
- package/test-fixtures/reducers/copy/01 - copy/08/base.json +28 -0
- package/test-fixtures/reducers/copy/01 - copy/08/merged.json +28 -0
- package/test-fixtures/reducers/copy/01 - copy/08/metadata.json +4 -0
- package/test-fixtures/reducers/copy/01 - copy/08/source.json +24 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/base.json +17 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/merged.json +20 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/metadata.json +6 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/01/source.json +20 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/base.json +9 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/merged.json +20 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/metadata.json +6 -0
- package/test-fixtures/reducers/copy/02 - doNotCopyIfFieldPresent/02/source.json +20 -0
- package/test-fixtures/reducers/copy/{06 → 03 - compareTagsOnly/01}/base.json +0 -0
- package/test-fixtures/reducers/copy/{06 → 03 - compareTagsOnly/01}/merged.json +0 -0
- package/test-fixtures/reducers/copy/03 - compareTagsOnly/01/metadata.json +5 -0
- package/test-fixtures/reducers/copy/{06 → 03 - compareTagsOnly/01}/source.json +0 -0
- package/test-fixtures/reducers/copy/{09 → 03 - compareTagsOnly/02}/base.json +0 -0
- package/test-fixtures/reducers/copy/{09 → 03 - compareTagsOnly/02}/merged.json +0 -0
- package/test-fixtures/reducers/copy/03 - compareTagsOnly/02/metadata.json +5 -0
- package/test-fixtures/reducers/copy/{09 → 03 - compareTagsOnly/02}/source.json +0 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/base.json +24 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/merged.json +24 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/metadata.json +5 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/01/source.json +24 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/base.json +24 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/merged.json +39 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/metadata.json +5 -0
- package/test-fixtures/reducers/copy/04 - compareWithoutIndicators/02/source.json +24 -0
- package/test-fixtures/reducers/copy/05 - copyUnless/01/base.json +9 -0
- package/test-fixtures/reducers/copy/05 - copyUnless/01/merged.json +24 -0
- package/test-fixtures/reducers/copy/05 - copyUnless/01/metadata.json +5 -0
- package/test-fixtures/reducers/copy/05 - copyUnless/01/source.json +47 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/base.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/merged.json +39 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/metadata.json +5 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/01/source.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/base.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/merged.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/metadata.json +5 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/02/source.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/base.json +28 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/merged.json +43 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/metadata.json +5 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/03/source.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/base.json +28 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/merged.json +28 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/metadata.json +5 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/04/source.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/base.json +20 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/merged.json +35 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/metadata.json +5 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/05/source.json +24 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/base.json +20 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/merged.json +35 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/metadata.json +5 -0
- package/test-fixtures/reducers/copy/06 - subfieldsMustBeIdentical/06/source.json +24 -0
- package/test-fixtures/reducers/copy/{07 → 07 - excludeSubfields/01}/base.json +0 -0
- package/test-fixtures/reducers/copy/{07 → 07 - excludeSubfields/01}/merged.json +0 -0
- package/test-fixtures/reducers/copy/07 - excludeSubfields/01/metadata.json +8 -0
- package/test-fixtures/reducers/copy/{07 → 07 - excludeSubfields/01}/source.json +0 -0
- package/test-fixtures/reducers/copy/07 - excludeSubfields/02/base.json +39 -0
- package/test-fixtures/reducers/copy/07 - excludeSubfields/02/merged.json +58 -0
- package/test-fixtures/reducers/copy/07 - excludeSubfields/02/metadata.json +5 -0
- package/test-fixtures/reducers/copy/07 - excludeSubfields/02/source.json +43 -0
- package/test-fixtures/reducers/copy/{08 → 08 - dropSubfields/01}/base.json +0 -0
- package/test-fixtures/reducers/copy/{08/merged.json → 08 - dropSubfields/01/merged.json } +8 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/01/metadata.json +5 -0
- package/test-fixtures/reducers/copy/{08 → 08 - dropSubfields/01}/source.json +0 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/02/base.json +43 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/02/merged.json +58 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/02/metadata.json +5 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/02/source.json +32 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/03/base.json +43 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/03/merged.json +58 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/03/metadata.json +5 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/03/source.json +32 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/04/base.json +43 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/04/merged.json +43 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/04/metadata.json +5 -0
- package/test-fixtures/reducers/copy/08 - dropSubfields/04/source.json +32 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/base.json +9 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/merged.json +20 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/metadata.json +6 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/01/source.json +20 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/base.json +9 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/merged.json +20 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/metadata.json +6 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/02/source.json +20 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/base.json +9 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/merged.json +31 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/metadata.json +6 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/03/source.json +31 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/base.json +9 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/merged.json +42 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/metadata.json +6 -0
- package/test-fixtures/reducers/copy/09 - swapSubfieldCode/04/source.json +42 -0
- package/test-fixtures/reducers/copy/10 - swapTag/01/base.json +17 -0
- package/test-fixtures/reducers/copy/10 - swapTag/01/merged.json +28 -0
- package/test-fixtures/reducers/copy/10 - swapTag/01/metadata.json +6 -0
- package/test-fixtures/reducers/copy/10 - swapTag/01/source.json +20 -0
- package/test-fixtures/reducers/metadata.json +4 -0
- package/test-fixtures/reducers/select/01/metadata.json +5 -0
- package/test-fixtures/reducers/select/02/metadata.json +4 -0
- package/test-fixtures/reducers/select/03/metadata.json +4 -0
- package/test-fixtures/reducers/select/04/metadata.json +5 -0
- package/test-fixtures/reducers/select/05/metadata.json +4 -0
- package/test-fixtures/reducers/select/06/metadata.json +4 -0
- package/test-fixtures/reducers/select/07/metadata.json +5 -0
- package/test-fixtures/reducers/select/08/metadata.json +4 -0
- package/test-fixtures/reducers/select/09/metadata.json +4 -0
- package/test-fixtures/reducers/select/10/metadata.json +5 -0
- package/test-fixtures/reducers/select/11/metadata.json +4 -0
- package/test-fixtures/reducers/select/12/metadata.json +5 -0
- package/test-fixtures/reducers/select/13/metadata.json +4 -0
- package/test-fixtures/reducers/select/14/metadata.json +4 -0
- package/.drone.yml +0 -92
- package/.nyc_output/72717fff-b4ac-4aef-a145-37cae88e07f8.json +0 -1
- package/.nyc_output/processinfo/72717fff-b4ac-4aef-a145-37cae88e07f8.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/LICENSE.txt +0 -165
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -79
- package/coverage/copy.js.html +0 -500
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -126
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/copy.js.html +0 -500
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -126
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/select.js.html +0 -539
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov.info +0 -274
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/select.js.html +0 -539
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -170
- package/test-fixtures/reducers/copy/01/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/02/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/03/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/04/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/05/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/06/compareTagsOnly.txt +0 -1
- package/test-fixtures/reducers/copy/06/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/07/excludeSubfields.json +0 -1
- package/test-fixtures/reducers/copy/07/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/08/dropSubfields.json +0 -1
- package/test-fixtures/reducers/copy/08/tagPattern.txt +0 -1
- package/test-fixtures/reducers/copy/09/compareTagsOnly.txt +0 -1
- package/test-fixtures/reducers/copy/09/tagPattern.txt +0 -1
- package/test-fixtures/reducers/select/01/expected-error.txt +0 -1
- package/test-fixtures/reducers/select/01/pattern.txt +0 -1
- package/test-fixtures/reducers/select/02/pattern.txt +0 -1
- package/test-fixtures/reducers/select/03/pattern.txt +0 -1
- package/test-fixtures/reducers/select/04/pattern.txt +0 -1
- package/test-fixtures/reducers/select/05/pattern.txt +0 -1
- package/test-fixtures/reducers/select/06/pattern.txt +0 -1
- package/test-fixtures/reducers/select/07/equalityFunction.txt +0 -1
- package/test-fixtures/reducers/select/07/pattern.txt +0 -1
- package/test-fixtures/reducers/select/08/pattern.txt +0 -1
- package/test-fixtures/reducers/select/09/pattern.txt +0 -1
- package/test-fixtures/reducers/select/10/equalityFunction.txt +0 -1
- package/test-fixtures/reducers/select/10/pattern.txt +0 -1
- package/test-fixtures/reducers/select/11/pattern.txt +0 -1
- package/test-fixtures/reducers/select/12/equalityFunction.txt +0 -1
- package/test-fixtures/reducers/select/12/pattern.txt +0 -1
- package/test-fixtures/reducers/select/13/pattern.txt +0 -1
- package/test-fixtures/reducers/select/14/pattern.txt +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# With this line @NatLibFi/melinda-js-lead owns any files in the /.github/
|
|
2
|
+
# directory at the root of the repository and any of its
|
|
3
|
+
# subdirectories.
|
|
4
|
+
/.github/ @NatLibFi/melinda-js-lead
|
|
5
|
+
|
|
6
|
+
# With this line @NatLibFi/melinda-js-lead owns any files in the /src/
|
|
7
|
+
# directory at the root of the repository and any of its
|
|
8
|
+
# subdirectories.
|
|
9
|
+
/src/ @NatLibFi/melinda-js-lead
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# NatLibFi/Melinda maintenance strategy
|
|
2
|
+
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
# Maintain dependencies for GitHub Actions
|
|
7
|
+
- package-ecosystem: "github-actions"
|
|
8
|
+
directory: "/"
|
|
9
|
+
schedule:
|
|
10
|
+
interval: "daily"
|
|
11
|
+
time: "06:30"
|
|
12
|
+
timezone: "Europe/Helsinki"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Minor updates to npm production dependencies daily
|
|
16
|
+
- package-ecosystem: "npm"
|
|
17
|
+
directory: "/"
|
|
18
|
+
schedule:
|
|
19
|
+
interval: "daily"
|
|
20
|
+
time: "06:45"
|
|
21
|
+
timezone: "Europe/Helsinki"
|
|
22
|
+
versioning-strategy: lockfile-only
|
|
23
|
+
labels:
|
|
24
|
+
- "npm minor dependencies"
|
|
25
|
+
allow:
|
|
26
|
+
- dependency-type: "production"
|
|
27
|
+
|
|
28
|
+
# Major updates to npm dependencies weekly @tuesday
|
|
29
|
+
# Not possible yet https://github.com/dependabot/dependabot-core/issues/1778
|
|
30
|
+
# - package-ecosystem: "npm"
|
|
31
|
+
# directory: "/"
|
|
32
|
+
# schedule:
|
|
33
|
+
# interval: "weekly"
|
|
34
|
+
# day: "tuesday"
|
|
35
|
+
# time: "07:00"
|
|
36
|
+
# timezone: "Europe/Helsinki"
|
|
37
|
+
# versioning-strategy: increase-if-necessary
|
|
38
|
+
# labels:
|
|
39
|
+
# - "npm major dependencies"
|
|
40
|
+
# reviewers:
|
|
41
|
+
# - "natlibfi/melinda-js-lead"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Melinda node tests
|
|
2
|
+
|
|
3
|
+
name: Melinda node tests
|
|
4
|
+
|
|
5
|
+
on: push
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-node-versions:
|
|
9
|
+
name: Node version matrix
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [14.x, 16.x, 18.x]
|
|
15
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout the code
|
|
19
|
+
uses: actions/checkout@v3
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v2
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
env:
|
|
26
|
+
NPM_CONFIG_IGNORE_SCRIPTS: true
|
|
27
|
+
- run: npm audit --package-lock-only --production --audit-level=moderate
|
|
28
|
+
- run: npm ci
|
|
29
|
+
- run: npm test
|
|
30
|
+
- run: npm run build --if-present
|
|
31
|
+
|
|
32
|
+
njsscan:
|
|
33
|
+
name: Njsscan check
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- name: Checkout the code
|
|
38
|
+
uses: actions/checkout@v3
|
|
39
|
+
- name: nodejsscan scan
|
|
40
|
+
id: njsscan
|
|
41
|
+
uses: ajinabraham/njsscan-action@master
|
|
42
|
+
with:
|
|
43
|
+
args: '.'
|
|
44
|
+
|
|
45
|
+
publish:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
needs: [build-node-versions, njsscan]
|
|
48
|
+
if: contains(github.ref, 'refs/tags/')
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v3
|
|
52
|
+
# Setup .npmrc file to publish to npm
|
|
53
|
+
- uses: actions/setup-node@v3
|
|
54
|
+
with:
|
|
55
|
+
node-version: '14.x'
|
|
56
|
+
registry-url: 'https://registry.npmjs.org'
|
|
57
|
+
- run: npm ci
|
|
58
|
+
- run: npm publish
|
|
59
|
+
env:
|
|
60
|
+
NODE_AUTH_TOKEN: ${{ secrets.MARC_RECORD_MERGE_JS_NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-current University of Helsinki (National Library of Finland)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -3,9 +3,113 @@
|
|
|
3
3
|
Merge MARC records
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
|
+
### COPY
|
|
7
|
+
|
|
8
|
+
Chosing fields for reducer:
|
|
9
|
+
```
|
|
10
|
+
const copyReducerConfigs = [
|
|
11
|
+
{tagPattern: /010/u},
|
|
12
|
+
{tagPattern: /010|020/u},
|
|
13
|
+
{tagPattern: new RegExp('010', 'u')},
|
|
14
|
+
{tagPattern: new RegExp(String((/^(?<tags1>010|020$)/u').source))},
|
|
15
|
+
]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### compareTagsOnly (Defaults false)
|
|
19
|
+
```
|
|
20
|
+
{tagPattern: /010/u, compareTagsOnly: false}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If base has field with that tag source field is ignored
|
|
24
|
+
|
|
25
|
+
### doNotCopyIfFieldPresent (Defaults false)
|
|
26
|
+
```
|
|
27
|
+
{tagPattern: /010/u, doNotCopyIfFieldPresent: "^011$"}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If base has field with that tag 011 source field is ignored
|
|
31
|
+
|
|
32
|
+
### compareWithoutIndicators (Defaults false)
|
|
33
|
+
```
|
|
34
|
+
{tagPattern: /010/u, compareWithoutIndicators: false}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
When base and source fields are compared, indicator differences are ignored
|
|
38
|
+
|
|
39
|
+
### subfieldsMustBeIdentical (Defaults true)
|
|
40
|
+
```
|
|
41
|
+
{tagPattern: /010/u, subfieldsMustBeIdentical: true}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If source subfields are subset of base subfields this option says if it is copied
|
|
45
|
+
| subfieldsMustBeIdentical | base | source | copy |
|
|
46
|
+
|--------------------------|---------------|---------------|-------|
|
|
47
|
+
| true or false | $a foo | $a foo | false |
|
|
48
|
+
| true or false | $a foo | $b bar | true |
|
|
49
|
+
| true | $a foo | $a foo,$b bar | true |
|
|
50
|
+
| false | $a foo | $a foo,$b bar | true |
|
|
51
|
+
| true | $a foo,$b bar | $a foo | true |
|
|
52
|
+
| false | $a foo,$b bar | $a foo | false |
|
|
53
|
+
|
|
54
|
+
### excludeSubfields (Defaults [ ])
|
|
55
|
+
```
|
|
56
|
+
{tagPattern: /010/u, excludeSubfields: ['a']}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
When base and source fields are compared, excluded subfields are ignored
|
|
60
|
+
|
|
61
|
+
### swapSubfieldCode (Defaults [ ])
|
|
62
|
+
```
|
|
63
|
+
{tagPattern: /010/u, swapSubfieldCode: [{"from": "a", "to": "b"}]}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
When source fields are copied, subfields are checkked and if subfield.code match to 'from' value is that code swapped to 'to' value
|
|
67
|
+
|
|
68
|
+
### dropSubfields (Defaults [ ])
|
|
69
|
+
```
|
|
70
|
+
{tagPattern: /010/u, dropSubfields: [{"code": "9"}]}
|
|
71
|
+
```
|
|
72
|
+
Drops subfields 9's from all fields tagged 010
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
{tagPattern: /010/u, dropSubfields: [{"code": "9", "value": "FENNI<KEEP>"}]}
|
|
76
|
+
```
|
|
77
|
+
Drops subfields 9's that have "FENNI<KEEP>" from all fields tagged 010
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
{tagPattern: /010/u, dropSubfields: [{"code": "9", "condition": "unless", "value": "^FENNI<(?<option>KEEP|DROP)>$"}]}
|
|
82
|
+
```
|
|
83
|
+
Drops all subfield 9's unless they have "FENNI<KEEP>" or "FENNI<DROP>" from all fields tagged 010
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
When comparing or copying field dropped fields are ignored
|
|
87
|
+
|
|
88
|
+
### copyUnless (Defaults [ ])
|
|
89
|
+
```
|
|
90
|
+
{tagPattern: /010/u, copyUnless: [{"code": "9", "value": "FENNI<KEEP>"}]}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
When field is otherwise ok to be copied, if it contains given subfield whole field is ignored
|
|
94
|
+
|
|
95
|
+
### baseValidators (Defaults {subfieldValues: false})
|
|
96
|
+
```
|
|
97
|
+
{tagPattern: /010/u, baseValidators: {fields: true, subfields: true, subfieldValues: true}}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Marc record validators for base record while reducer is working.
|
|
101
|
+
More info can be read here: https://github.com/NatLibFi/marc-record-js
|
|
102
|
+
|
|
103
|
+
### sourceValidators (Defaults {subfieldValues: false})
|
|
104
|
+
```
|
|
105
|
+
{tagPattern: /010/u, sourceValidators: {fields: true, subfields: true, subfieldValues: true}}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Marc record validators for source record while reducer is working.
|
|
109
|
+
More info can be read here: https://github.com/NatLibFi/marc-record-js
|
|
6
110
|
|
|
7
111
|
## License and copyright
|
|
8
112
|
|
|
9
|
-
Copyright (c)
|
|
113
|
+
Copyright (c) 2020-2022 **University Of Helsinki (The National Library Of Finland)**
|
|
10
114
|
|
|
11
|
-
This project's source code is licensed under the terms of **
|
|
115
|
+
This project's source code is licensed under the terms of **MIT** or any later version.
|
package/dist/index.js
CHANGED
|
@@ -11,50 +11,15 @@ Object.defineProperty(exports, "Reducers", {
|
|
|
11
11
|
});
|
|
12
12
|
exports.default = void 0;
|
|
13
13
|
|
|
14
|
-
var _marcRecord = require("@natlibfi/marc-record");
|
|
15
|
-
|
|
16
14
|
var _reducers = _interopRequireDefault(require("./reducers"));
|
|
17
15
|
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
23
|
-
*
|
|
24
|
-
* Merge MARC records
|
|
25
|
-
*
|
|
26
|
-
* Copyright (C) 2015-2019 University Of Helsinki (The National Library Of Finland)
|
|
27
|
-
*
|
|
28
|
-
* This file is part of marc-record-merge-js
|
|
29
|
-
|
|
30
|
-
* marc-record-merge-js program is free software: you can redistribute it and/or modify
|
|
31
|
-
* it under the terms of the GNU Lesser General Public License as
|
|
32
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
33
|
-
* License, or (at your option) any later version.
|
|
34
|
-
*
|
|
35
|
-
* marc-record-merge-js is distributed in the hope that it will be useful,
|
|
36
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
37
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
38
|
-
* GNU Lesser General Public License for more details.
|
|
39
|
-
*
|
|
40
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
41
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
42
|
-
*
|
|
43
|
-
* @licend The above is the entire license notice
|
|
44
|
-
* for the JavaScript code in this file.
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
18
|
var _default = ({
|
|
48
19
|
base,
|
|
49
20
|
source,
|
|
50
|
-
reducers
|
|
51
|
-
|
|
52
|
-
sourceValidators = {}
|
|
53
|
-
}) => {
|
|
54
|
-
const sourceRecord = _marcRecord.MarcRecord.clone(source, sourceValidators);
|
|
55
|
-
|
|
56
|
-
return reducers.reduce((baseRecord, reducer) => reducer(baseRecord, sourceRecord), _marcRecord.MarcRecord.clone(base, baseValidators));
|
|
57
|
-
};
|
|
21
|
+
reducers
|
|
22
|
+
}) => reducers.reduce((base, reducer) => reducer(base, source), base);
|
|
58
23
|
|
|
59
24
|
exports.default = _default;
|
|
60
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["base","source","reducers","reduce","reducer"],"sources":["../src/index.js"],"sourcesContent":["import Reducers from './reducers';\n\nexport {Reducers};\nexport default ({base, source, reducers}) => reducers.reduce((base, reducer) => reducer(base, source), base);\n"],"mappings":";;;;;;;;;;;;;AAAA;;;;eAGe,CAAC;EAACA,IAAD;EAAOC,MAAP;EAAeC;AAAf,CAAD,KAA8BA,QAAQ,CAACC,MAAT,CAAgB,CAACH,IAAD,EAAOI,OAAP,KAAmBA,OAAO,CAACJ,IAAD,EAAOC,MAAP,CAA1C,EAA0DD,IAA1D,C"}
|