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.
- package/.dockerignore +20 -0
- package/.editorconfig +9 -0
- package/.github/workflows/docker.yml +59 -0
- package/.github/workflows/gh-pages.yml +23 -0
- package/.github/workflows/gh-release.yml +19 -0
- package/.github/workflows/test.yml +39 -0
- package/.husky/pre-commit +1 -0
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +2710 -0
- package/bin/extra.js +81 -0
- package/bin/import.js +438 -0
- package/bin/mongodb.js +21 -0
- package/bin/reset.js +257 -0
- package/bin/upgrade.js +34 -0
- package/config/config.default.json +88 -0
- package/config/config.schema.json +877 -0
- package/config/config.test.json +107 -0
- package/config/index.js +77 -0
- package/config/setup.js +212 -0
- package/depdendencies.png +0 -0
- package/docker/.env +1 -0
- package/docker/Dockerfile +20 -0
- package/docker/README.md +175 -0
- package/docker/docker-compose.yml +29 -0
- package/docker/docker-entrypoint.sh +8 -0
- package/docker/mongo-initdb.d/mongo_setup.sh +22 -0
- package/ecosystem.example.json +7 -0
- package/errors/index.js +94 -0
- package/eslint.config.js +17 -0
- package/index.js +10 -0
- package/models/annotations.js +13 -0
- package/models/concepts.js +12 -0
- package/models/concordances.js +12 -0
- package/models/index.js +33 -0
- package/models/mappings.js +20 -0
- package/models/meta.js +21 -0
- package/models/registries.js +12 -0
- package/models/schemes.js +12 -0
- package/package.json +91 -0
- package/routes/annotations.js +83 -0
- package/routes/common.js +86 -0
- package/routes/concepts.js +64 -0
- package/routes/concordances.js +86 -0
- package/routes/data.js +19 -0
- package/routes/mappings.js +108 -0
- package/routes/registries.js +24 -0
- package/routes/schemes.js +72 -0
- package/routes/validate.js +37 -0
- package/server.js +190 -0
- package/services/abstract.js +328 -0
- package/services/annotations.js +237 -0
- package/services/concepts.js +459 -0
- package/services/concordances.js +264 -0
- package/services/data.js +30 -0
- package/services/index.js +34 -0
- package/services/mappings.js +978 -0
- package/services/registries.js +319 -0
- package/services/schemes.js +318 -0
- package/services/validate.js +39 -0
- package/status.schema.json +145 -0
- package/test/abstract-service.js +36 -0
- package/test/annotations/annotation.json +13 -0
- package/test/api.js +2481 -0
- package/test/chai.js +14 -0
- package/test/changes.js +179 -0
- package/test/concepts/conceptNoFileEnding +4 -0
- package/test/concepts/concepts-ddc-6-60-61-62.json +123 -0
- package/test/concordances/concordances.ndjson +2 -0
- package/test/config.js +26 -0
- package/test/configs/complex-config.json +90 -0
- package/test/configs/empty-object.json +1 -0
- package/test/configs/fail-array.json +1 -0
- package/test/configs/fail-empty.json +0 -0
- package/test/configs/fail-mapping-only-props1.json +5 -0
- package/test/configs/fail-mapping-only-props2.json +5 -0
- package/test/configs/fail-mapping-only-props3.json +5 -0
- package/test/configs/fail-mapping-only-props4.json +5 -0
- package/test/configs/fail-nonexisting-prop.json +3 -0
- package/test/configs/fail-port-string.json +3 -0
- package/test/configs/fail-registry-types.json +16 -0
- package/test/configs/registry-types.json +16 -0
- package/test/data-write.js +784 -0
- package/test/eslint.js +22 -0
- package/test/import-reset.js +287 -0
- package/test/infer-mappings.js +340 -0
- package/test/ipcheck.js +287 -0
- package/test/mappings/README.md +1 -0
- package/test/mappings/ddc-gnd-1.mapping.json +33 -0
- package/test/mappings/ddc-gnd-2.mapping.json +67 -0
- package/test/mappings/mapping-ddc-gnd-noScheme.json +145 -0
- package/test/mappings/mapping-ddc-gnd.json +175 -0
- package/test/mappings/mappings-ddc.json +214 -0
- package/test/registries/registries.ndjson +2 -0
- package/test/services.js +557 -0
- package/test/terminologies/terminologies.json +94 -0
- package/test/test-utils.js +182 -0
- package/test/utils.js +425 -0
- package/test/validate.js +226 -0
- package/utils/adjust.js +206 -0
- package/utils/auth.js +154 -0
- package/utils/changes.js +88 -0
- package/utils/db.js +106 -0
- package/utils/ipcheck.js +76 -0
- package/utils/middleware.js +636 -0
- package/utils/searchHelper.js +153 -0
- package/utils/status.js +77 -0
- package/utils/users.js +7 -0
- package/utils/utils.js +114 -0
- package/utils/uuid.js +6 -0
- package/utils/version.js +324 -0
- package/views/base.ejs +172 -0
package/views/base.ejs
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title><%= config.title %></title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<style type="text/css">
|
|
8
|
+
body {
|
|
9
|
+
margin: 20px;
|
|
10
|
+
}
|
|
11
|
+
a:link, a:visited {
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
color: rgb(96, 143, 219);
|
|
14
|
+
}
|
|
15
|
+
a:hover, a:active {
|
|
16
|
+
text-decoration: underline;
|
|
17
|
+
}
|
|
18
|
+
.badge {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
background-color:#29517C ;
|
|
21
|
+
color: white;
|
|
22
|
+
font-size: 0.75em;
|
|
23
|
+
padding: 2px 6px;
|
|
24
|
+
border-radius: 4px;
|
|
25
|
+
margin-left: 6px;
|
|
26
|
+
vertical-align: middle;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<h1><%= config.title %></h1>
|
|
32
|
+
<h2>Available Endpoints</h2>
|
|
33
|
+
<p>
|
|
34
|
+
This service provides a subset of JSKOS API <%= config.version %>. All the following endpoints are available on this instance of jskos-server. See documentation <a href="https://github.com/gbv/jskos-server" target="_blank">on GitHub</a> for details.
|
|
35
|
+
</p>
|
|
36
|
+
<h3>General</h3>
|
|
37
|
+
<ul>
|
|
38
|
+
<li>GET <a href="status">/status</a> - Returns a status object (<a href="status.schema.json">JSON Schema</a>, <a href="https://github.com/gbv/jskos-server#get-status" target="_blank">documentation</a>)</li>
|
|
39
|
+
<li>GET <a href="checkAuth">/checkAuth</a> - Endpoint to check whether a user is authorized (<a href="https://github.com/gbv/jskos-server#get-checkauth" target="_blank">documentation</a>)</li>
|
|
40
|
+
<li>POST/GET <a href="validate">/validate</a> - Endpoint to validate JSKOS data (<a href="https://github.com/gbv/jskos-server#post-validate" target="_blank">documentation</a>)</li>
|
|
41
|
+
<li>GET <a href="data">/data</a> - Returns data for a certain URI or URIs (concept schemes, concepts, concordances, mappings, annotations, registries) (<a href="https://github.com/gbv/jskos-server#get-data" target="_blank">documentation</a>)</li>
|
|
42
|
+
</ul>
|
|
43
|
+
<% if (config.concordances) { %>
|
|
44
|
+
<h3>Concordances</h3>
|
|
45
|
+
<ul>
|
|
46
|
+
<li>GET <a href="concordances">/concordances</a> - Returns a list of concordances for mappings (<a href="https://github.com/gbv/jskos-server#get-concordances" target="_blank">documentation</a>)</li>
|
|
47
|
+
<li>GET /concordances/:_id - Returns a specific concordance (<a href="https://github.com/gbv/jskos-server#get-concordances_id" target="_blank">documentation</a>)</li>
|
|
48
|
+
<% if (config.concordances.create) { %>
|
|
49
|
+
<li>POST /concordances - Saves a concordance in the database (<% if (config.concordances.create.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#post-concordances" target="_blank">documentation</a>)</li>
|
|
50
|
+
<% } %>
|
|
51
|
+
<% if (config.concordances.update) { %>
|
|
52
|
+
<li>PUT /concordances/:_id - Updates a concordance in the database (<% if (config.concordances.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#put-concordances_id" target="_blank">documentation</a>)</li>
|
|
53
|
+
<li>PATCH /concordances/:_id - Adjusts a mapping in the database (<% if (config.concordances.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#patch-concordances_id" target="_blank">documentation</a>)</li>
|
|
54
|
+
<% } %>
|
|
55
|
+
<% if (config.concordances.delete) { %>
|
|
56
|
+
<li>DELETE /concordances/:_id - Deletes a mapping from the database (<% if (config.concordances.delete.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#delete-concordances_id" target="_blank">documentation</a>)</li>
|
|
57
|
+
<% } %>
|
|
58
|
+
<% if (config.changes) { %>
|
|
59
|
+
<li>WS /concordances/changes - Real-time updates for concordances via WebSocket (<a href="https://github.com/gbv/jskos-server#change-stream-endpoints" target="_blank">documentation</a>)</li>
|
|
60
|
+
<% } %>
|
|
61
|
+
</ul>
|
|
62
|
+
<% } %>
|
|
63
|
+
<% if (config.mappings) { %>
|
|
64
|
+
<h3>Mappings</h3>
|
|
65
|
+
<ul>
|
|
66
|
+
<li>GET <a href="mappings">/mappings</a> - Returns a list of mappings (<a href="https://github.com/gbv/jskos-server#get-mappings" target="_blank">documentation</a>)</li>
|
|
67
|
+
<li>GET /mappings/:_id - Returns a specific mapping (<a href="https://github.com/gbv/jskos-server#get-mappings_id" target="_blank">documentation</a>)</li>
|
|
68
|
+
<% if (config.mappings.create) { %>
|
|
69
|
+
<li>POST /mappings - Saves a mapping in the database (<% if (config.mappings.create.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#post-mappings" target="_blank">documentation</a>)</li>
|
|
70
|
+
<% } %>
|
|
71
|
+
<% if (config.mappings.update) { %>
|
|
72
|
+
<li>PUT /mappings/:_id - Updates a mapping in the database (<% if (config.mappings.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#put-mappings_id" target="_blank">documentation</a>)</li>
|
|
73
|
+
<li>PATCH /mappings/:_id - Adjusts a mapping in the database (<% if (config.mappings.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#patch-mappings_id" target="_blank">documentation</a>)</li>
|
|
74
|
+
<% } %>
|
|
75
|
+
<% if (config.mappings.delete) { %>
|
|
76
|
+
<li>DELETE /mappings/:_id - Deletes a mapping from the database (<% if (config.mappings.delete.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#delete-mappings_id" target="_blank">documentation</a>)</li>
|
|
77
|
+
<% } %>
|
|
78
|
+
<li>GET <a href="mappings/infer">/mappings/infer</a> - Returns mappings based on stored mappings and mappings derived by inference (<a href="https://github.com/gbv/jskos-server#get-mappingsinfer" target="_blank">documentation</a>)</li>
|
|
79
|
+
<li>GET <a href="mappings/suggest">/mappings/suggest</a> - Suggests notations used in mappings (<a href="https://github.com/gbv/jskos-server#get-mappingssuggest" target="_blank">documentation</a>)</li>
|
|
80
|
+
<li>GET <a href="mappings/voc">/mappings/voc</a> - Returns a list of concept schemes used in mappings (<a href="https://github.com/gbv/jskos-server#get-mappingsvoc" target="_blank">documentation</a>)</li>
|
|
81
|
+
<% if (config.changes) { %>
|
|
82
|
+
<li>WS /mappings/changes - Real-time updates for mappings via WebSocket (<a href="https://github.com/gbv/jskos-server#change-stream-endpoints" target="_blank">documentation</a>)</li>
|
|
83
|
+
<% } %>
|
|
84
|
+
</ul>
|
|
85
|
+
<% } %>
|
|
86
|
+
<% if (config.schemes) { %>
|
|
87
|
+
<h3>Concept Schemes</h3>
|
|
88
|
+
<ul>
|
|
89
|
+
<li>GET <a href="voc">/voc</a> - Returns a list of vocabularies (concept schemes) (<a href="https://github.com/gbv/jskos-server#get-voc" target="_blank">documentation</a>)</li>
|
|
90
|
+
<li>GET <a href="voc/top">/voc/top</a> - Lists top concepts for a concept scheme (<a href="https://github.com/gbv/jskos-server#get-voctop" target="_blank">documentation</a>)</li>
|
|
91
|
+
<li>GET <a href="voc/concepts">/voc/concepts</a> - Lists concepts for a concept scheme
|
|
92
|
+
(<a href="https://github.com/gbv/jskos-server#get-vocconcepts" target="_blank">documentation</a>)</li>
|
|
93
|
+
<li>GET <a href="voc/suggest">/voc/suggest</a> - Returns concept scheme suggestions in OpenSearch Suggest Format
|
|
94
|
+
(<a href="https://github.com/gbv/jskos-server#get-vocsuggest" target="_blank">documentation</a>)</li>
|
|
95
|
+
<li>GET <a href="voc/search">/voc/search</a> - Concept scheme search
|
|
96
|
+
(<a href="https://github.com/gbv/jskos-server#get-vocsearch" target="_blank">documentation</a>)</li>
|
|
97
|
+
|
|
98
|
+
<% if (config.changes) { %>
|
|
99
|
+
<li>WS /voc/changes - Real-time updates for concept schemes via WebSocket (<a href="https://github.com/gbv/jskos-server#change-stream-endpoints" target="_blank">documentation</a>)</li>
|
|
100
|
+
<% } %>
|
|
101
|
+
|
|
102
|
+
<% if (config.schemes.create) { %>
|
|
103
|
+
<li>POST /voc - Saves a concept scheme or multiple concept schemes in the database (<% if (config.schemes.create.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#post-voc" target="_blank">documentation</a>)</li>
|
|
104
|
+
<% } %>
|
|
105
|
+
<% if (config.schemes.update) { %>
|
|
106
|
+
<li>PUT /voc - Updates a concept scheme in the database (<% if (config.schemes.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#put-voc" target="_blank">documentation</a>)</li>
|
|
107
|
+
<% } %>
|
|
108
|
+
<% if (config.schemes.delete) { %>
|
|
109
|
+
<li>DELETE /voc - Deletes a concept scheme from the database (<% if (config.schemes.delete.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#delete-voc" target="_blank">documentation</a>)</li>
|
|
110
|
+
<% } %>
|
|
111
|
+
</ul>
|
|
112
|
+
<% } %>
|
|
113
|
+
<% if (config.concepts) { %>
|
|
114
|
+
<h3>Concepts</h3>
|
|
115
|
+
<ul>
|
|
116
|
+
<li>GET <a href="concepts">/concepts</a> - Returns detailed data for concepts or concept schemes (<a href="https://github.com/gbv/jskos-server#get-concepts" target="_blank">documentation</a>)</li>
|
|
117
|
+
<li>GET <a href="concepts/narrower">/concepts/narrower</a> - Returns narrower concepts for a concept (<a href="https://github.com/gbv/jskos-server#get-conceptsnarrower" target="_blank">documentation</a>)</li>
|
|
118
|
+
<li>GET <a href="ancestors">/concepts/ancestors</a> - Returns ancestor concepts for a concept (<a href="https://github.com/gbv/jskos-server#get-conceptsancestors" target="_blank">documentation</a>)</li>
|
|
119
|
+
<li>GET <a href="suggest">/concepts/suggest</a> - Returns concept suggestions (<a href="https://github.com/gbv/jskos-server#get-conceptssuggest" target="_blank">documentation</a>)</li>
|
|
120
|
+
<li>GET <a href="search">/concepts/search</a> - Concept search (<a href="https://github.com/gbv/jskos-server#get-conceptssearch" target="_blank">documentation</a>)</li>
|
|
121
|
+
<% if (config.concepts.create) { %>
|
|
122
|
+
<li>POST /concepts - Saves a concept or multiple concepts in the database (<% if (config.concepts.create.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#post-concepts" target="_blank">documentation</a>)</li>
|
|
123
|
+
<% } %>
|
|
124
|
+
<% if (config.concepts.update) { %>
|
|
125
|
+
<li>PUT /concepts - Updates a concept in the database (<% if (config.concepts.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#put-concepts" target="_blank">documentation</a>)</li>
|
|
126
|
+
<% } %>
|
|
127
|
+
<% if (config.concepts.delete) { %>
|
|
128
|
+
<li>DELETE /concepts - Deletes a concept from the database (<% if (config.concepts.delete.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#delete-concepts" target="_blank">documentation</a>)</li>
|
|
129
|
+
<% } %>
|
|
130
|
+
<% if (config.changes) { %>
|
|
131
|
+
<li>WS /concepts/changes - Real-time updates for concepts via WebSocket (<a href="https://github.com/gbv/jskos-server#change-stream-endpoints" target="_blank">documentation</a>) </li>
|
|
132
|
+
<% } %>
|
|
133
|
+
</ul>
|
|
134
|
+
<% } %>
|
|
135
|
+
<% if (config.annotations) { %>
|
|
136
|
+
<h3>Annotations</h3>
|
|
137
|
+
<ul>
|
|
138
|
+
<% if (config.annotations.read) { %>
|
|
139
|
+
<li>GET <a href="annotations">/annotations</a> - Returns a list of annotations (<a href="https://github.com/gbv/jskos-server#get-annotations" target="_blank">documentation</a>)</li>
|
|
140
|
+
<li>GET /annotations/:_id - Returns a specific annotation (<a href="https://github.com/gbv/jskos-server#get-annotations_id" target="_blank">documentation</a>)</li>
|
|
141
|
+
<% } %>
|
|
142
|
+
<% if (config.annotations.create) { %>
|
|
143
|
+
<li>POST /annotations - Saves an annotation in the database (<% if (config.annotations.create.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#post-annotations" target="_blank">documentation</a>)</li>
|
|
144
|
+
<% } %>
|
|
145
|
+
<% if (config.annotations.update) { %>
|
|
146
|
+
<li>PUT /annotations/:_id - Updates an annotation in the database (<% if (config.annotations.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#put-annotations_id" target="_blank">documentation</a>)</li>
|
|
147
|
+
<li>PATCH /annotations/:_id - Adjusts an annotation in the database (<% if (config.annotations.update.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#patch-annotations_id" target="_blank">documentation</a>)</li>
|
|
148
|
+
<% } %>
|
|
149
|
+
<% if (config.annotations.delete) { %>
|
|
150
|
+
<li>DELETE /annotations/:_id - Deletes an annotation from the database (<% if (config.annotations.delete.auth) { %>authentication needed, <% } %><a href="https://github.com/gbv/jskos-server#put-annotations_id" target="_blank">documentation</a>)</li>
|
|
151
|
+
<% } %>
|
|
152
|
+
<% if (config.changes) { %>
|
|
153
|
+
<li>WS /annotations/changes - Real-time updates for annotations via WebSocket (<a href="https://github.com/gbv/jskos-server#change-stream-endpoints" target="_blank">documentation</a>)</li>
|
|
154
|
+
<% } %>
|
|
155
|
+
</ul>
|
|
156
|
+
<% } %>
|
|
157
|
+
<% if (config.registries) { %>
|
|
158
|
+
<h3>Registries</h3>
|
|
159
|
+
<ul>
|
|
160
|
+
<li>GET <a href="registries">/registries</a> - Returns a list of registries (<a href="https://github.com/gbv/jskos-server#get-registries" target="_blank">documentation</a>)</li>
|
|
161
|
+
<li>GET <a href="registries/suggest">/registries/suggest</a> - Returns registry suggestions (<a href="https://github.com/gbv/jskos-server#get-registriessuggest" target="_blank">documentation</a>)</li>
|
|
162
|
+
<li>POST /registries - Saves registries in the database (<a href="https://github.com/gbv/jskos-server#post-registries" target="_blank">documentation</a>)</li>
|
|
163
|
+
<li>PUT /registries - Updates a registry in the database (<a href="https://github.com/gbv/jskos-server#put-registries" target="_blank">documentation</a>)</li>
|
|
164
|
+
<!--li>PATCH /registries/:_id - Adjusts a registry in the database (<a href="https://github.com/gbv/jskos-server#patch-registries_id" target="_blank">documentation</a>)</li-->
|
|
165
|
+
<li>DELETE /registries - Deletes registries from the database (<a href="https://github.com/gbv/jskos-server#delete-registries" target="_blank">documentation</a>)</li>
|
|
166
|
+
<% if (config.changes) { %>
|
|
167
|
+
<li>WS /registries/changes - Real-time updates for registries via WebSocket (<a href="https://github.com/gbv/jskos-server#change-stream-endpoints" target="_blank">documentation</a>) </li>
|
|
168
|
+
<% } %>
|
|
169
|
+
</ul>
|
|
170
|
+
<% } %>
|
|
171
|
+
</body>
|
|
172
|
+
</html>
|