jskos-server 2.4.0

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 (112) hide show
  1. package/.dockerignore +20 -0
  2. package/.editorconfig +9 -0
  3. package/.github/workflows/docker.yml +59 -0
  4. package/.github/workflows/gh-pages.yml +23 -0
  5. package/.github/workflows/gh-release.yml +19 -0
  6. package/.github/workflows/test.yml +39 -0
  7. package/.husky/pre-commit +1 -0
  8. package/CHANGELOG.md +18 -0
  9. package/LICENSE +21 -0
  10. package/README.md +2710 -0
  11. package/bin/extra.js +81 -0
  12. package/bin/import.js +438 -0
  13. package/bin/mongodb.js +21 -0
  14. package/bin/reset.js +257 -0
  15. package/bin/upgrade.js +34 -0
  16. package/config/config.default.json +88 -0
  17. package/config/config.schema.json +877 -0
  18. package/config/config.test.json +107 -0
  19. package/config/index.js +77 -0
  20. package/config/setup.js +212 -0
  21. package/depdendencies.png +0 -0
  22. package/docker/.env +1 -0
  23. package/docker/Dockerfile +20 -0
  24. package/docker/README.md +175 -0
  25. package/docker/docker-compose.yml +29 -0
  26. package/docker/docker-entrypoint.sh +8 -0
  27. package/docker/mongo-initdb.d/mongo_setup.sh +22 -0
  28. package/ecosystem.example.json +7 -0
  29. package/errors/index.js +94 -0
  30. package/eslint.config.js +17 -0
  31. package/index.js +10 -0
  32. package/models/annotations.js +13 -0
  33. package/models/concepts.js +12 -0
  34. package/models/concordances.js +12 -0
  35. package/models/index.js +33 -0
  36. package/models/mappings.js +20 -0
  37. package/models/meta.js +21 -0
  38. package/models/registries.js +12 -0
  39. package/models/schemes.js +12 -0
  40. package/package.json +91 -0
  41. package/routes/annotations.js +83 -0
  42. package/routes/common.js +86 -0
  43. package/routes/concepts.js +64 -0
  44. package/routes/concordances.js +86 -0
  45. package/routes/data.js +19 -0
  46. package/routes/mappings.js +108 -0
  47. package/routes/registries.js +24 -0
  48. package/routes/schemes.js +72 -0
  49. package/routes/validate.js +37 -0
  50. package/server.js +190 -0
  51. package/services/abstract.js +328 -0
  52. package/services/annotations.js +237 -0
  53. package/services/concepts.js +459 -0
  54. package/services/concordances.js +264 -0
  55. package/services/data.js +30 -0
  56. package/services/index.js +34 -0
  57. package/services/mappings.js +978 -0
  58. package/services/registries.js +319 -0
  59. package/services/schemes.js +318 -0
  60. package/services/validate.js +39 -0
  61. package/status.schema.json +145 -0
  62. package/test/abstract-service.js +36 -0
  63. package/test/annotations/annotation.json +13 -0
  64. package/test/api.js +2481 -0
  65. package/test/chai.js +14 -0
  66. package/test/changes.js +179 -0
  67. package/test/concepts/conceptNoFileEnding +4 -0
  68. package/test/concepts/concepts-ddc-6-60-61-62.json +123 -0
  69. package/test/concordances/concordances.ndjson +2 -0
  70. package/test/config.js +26 -0
  71. package/test/configs/complex-config.json +90 -0
  72. package/test/configs/empty-object.json +1 -0
  73. package/test/configs/fail-array.json +1 -0
  74. package/test/configs/fail-empty.json +0 -0
  75. package/test/configs/fail-mapping-only-props1.json +5 -0
  76. package/test/configs/fail-mapping-only-props2.json +5 -0
  77. package/test/configs/fail-mapping-only-props3.json +5 -0
  78. package/test/configs/fail-mapping-only-props4.json +5 -0
  79. package/test/configs/fail-nonexisting-prop.json +3 -0
  80. package/test/configs/fail-port-string.json +3 -0
  81. package/test/configs/fail-registry-types.json +16 -0
  82. package/test/configs/registry-types.json +16 -0
  83. package/test/data-write.js +784 -0
  84. package/test/eslint.js +22 -0
  85. package/test/import-reset.js +287 -0
  86. package/test/infer-mappings.js +340 -0
  87. package/test/ipcheck.js +287 -0
  88. package/test/mappings/README.md +1 -0
  89. package/test/mappings/ddc-gnd-1.mapping.json +33 -0
  90. package/test/mappings/ddc-gnd-2.mapping.json +67 -0
  91. package/test/mappings/mapping-ddc-gnd-noScheme.json +145 -0
  92. package/test/mappings/mapping-ddc-gnd.json +175 -0
  93. package/test/mappings/mappings-ddc.json +214 -0
  94. package/test/registries/registries.ndjson +2 -0
  95. package/test/services.js +557 -0
  96. package/test/terminologies/terminologies.json +94 -0
  97. package/test/test-utils.js +182 -0
  98. package/test/utils.js +425 -0
  99. package/test/validate.js +226 -0
  100. package/utils/adjust.js +206 -0
  101. package/utils/auth.js +154 -0
  102. package/utils/changes.js +88 -0
  103. package/utils/db.js +106 -0
  104. package/utils/ipcheck.js +76 -0
  105. package/utils/middleware.js +636 -0
  106. package/utils/searchHelper.js +153 -0
  107. package/utils/status.js +77 -0
  108. package/utils/users.js +7 -0
  109. package/utils/utils.js +114 -0
  110. package/utils/uuid.js +6 -0
  111. package/utils/version.js +324 -0
  112. package/views/base.ejs +172 -0
package/.dockerignore ADDED
@@ -0,0 +1,20 @@
1
+ .DS_Store
2
+ node_modules/
3
+ npm-debug.log*
4
+ yarn-debug.log*
5
+ yarn-error.log*
6
+
7
+ # Editor directories and files
8
+ .idea
9
+ .vscode
10
+ *.suo
11
+ *.ntvs*
12
+ *.njsproj
13
+ *.sln
14
+
15
+ # Private files
16
+ .env
17
+ docker/data/
18
+
19
+ # Static files
20
+ imports/
package/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
@@ -0,0 +1,59 @@
1
+ name: Publish Docker
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ - dev
7
+ - test
8
+ tags:
9
+ - 'v*'
10
+ paths-ignore:
11
+ - '.github/**'
12
+ - '**.md'
13
+ - '.*'
14
+ - 'eslint.config.js'
15
+ - LICENSE
16
+
17
+ # Adapted from:
18
+ # - https://github.com/docker/metadata-action#semver
19
+ # - https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
20
+
21
+ env:
22
+ REGISTRY: ghcr.io
23
+ IMAGE_NAME: ${{ github.repository }}
24
+
25
+ jobs:
26
+ publish:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ -
30
+ name: Checkout
31
+ uses: actions/checkout@v4
32
+ -
33
+ name: Docker Meta
34
+ id: meta
35
+ uses: docker/metadata-action@v5
36
+ with:
37
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38
+ tags: |
39
+ type=ref,event=branch
40
+ type=ref,event=pr
41
+ type=semver,pattern={{version}}
42
+ type=semver,pattern={{major}}.{{minor}}
43
+ type=semver,pattern={{major}}
44
+ -
45
+ name: Login to GitHub Container Registry
46
+ uses: docker/login-action@v3
47
+ with:
48
+ registry: ${{ env.REGISTRY }}
49
+ username: ${{ github.actor }}
50
+ password: ${{ secrets.GITHUB_TOKEN }}
51
+ -
52
+ name: Build and Push
53
+ uses: docker/build-push-action@v6
54
+ with:
55
+ context: .
56
+ file: docker/Dockerfile
57
+ push: true
58
+ tags: ${{ steps.meta.outputs.tags }}
59
+ labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,23 @@
1
+ name: GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - run: mkdir gh-pages
14
+ - run: cp status.schema.json gh-pages/status.schema.json
15
+ - run: cp config/config.schema.json gh-pages/config.schema.json
16
+ - run: cp README.md gh-pages/index.md
17
+ - name: Deploy
18
+ uses: peaceiris/actions-gh-pages@v3
19
+ with:
20
+ github_token: ${{ secrets.GITHUB_TOKEN }}
21
+ publish_dir: ./gh-pages
22
+ allow_empty_commit: true
23
+ keep_files: true
@@ -0,0 +1,19 @@
1
+ name: GitHub Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v[0-9]+.[0-9]+.[0-9]+"
7
+
8
+ jobs:
9
+ github-release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Create GitHub release
13
+ id: create_release
14
+ uses: softprops/action-gh-release@v2
15
+ with:
16
+ name: JSKOS Server ${{ github.ref_name }}
17
+ body: TODO
18
+ draft: true
19
+ prerelease: false
@@ -0,0 +1,39 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ strategy:
11
+ matrix:
12
+ node-version: [ 22.x, 24.x ]
13
+ mongodb-version: [4, 5, 6]
14
+
15
+ steps:
16
+ - name: Git checkout
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+
24
+ - name: Start MongoDB
25
+ uses: supercharge/mongodb-github-action@1.12.1
26
+ with:
27
+ mongodb-version: ${{ matrix.mongodb-version }}
28
+ mongodb-replica-set: test-rs
29
+
30
+ - name: Install dependencies
31
+ run: npm ci
32
+
33
+ - name: Run tests
34
+ run: npm test
35
+
36
+
37
+
38
+
39
+
@@ -0,0 +1 @@
1
+ npm run lint-staged
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ ## 2.4.0 (draft)
2
+
3
+ - update to JSKOS specification 0.7.1
4
+ - extend documentation
5
+
6
+ - support new item type: registry (#204)
7
+ - add import script option --nobulk
8
+ - increase API version to 2.2
9
+
10
+ - don't ignore missing config files
11
+ - change configuration of changes API (**breaking change**)
12
+ - introduce configuration field: identityGroups
13
+
14
+ - refactor to allow use as module (not completed yet)
15
+ - increase requried node version to 22
16
+ - allow to calculate code coverage
17
+
18
+ More release notes can be found at <https://github.com/gbv/jskos-server/releases>
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Verbundzentrale des GBV (VZG)
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.