oarepo-runtime 1.5.61__py3-none-any.whl → 1.5.63__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- oarepo_runtime/info/views.py +22 -13
- oarepo_runtime/services/facets/params.py +10 -3
- {oarepo_runtime-1.5.61.dist-info → oarepo_runtime-1.5.63.dist-info}/METADATA +1 -1
- {oarepo_runtime-1.5.61.dist-info → oarepo_runtime-1.5.63.dist-info}/RECORD +8 -8
- {oarepo_runtime-1.5.61.dist-info → oarepo_runtime-1.5.63.dist-info}/LICENSE +0 -0
- {oarepo_runtime-1.5.61.dist-info → oarepo_runtime-1.5.63.dist-info}/WHEEL +0 -0
- {oarepo_runtime-1.5.61.dist-info → oarepo_runtime-1.5.63.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-1.5.61.dist-info → oarepo_runtime-1.5.63.dist-info}/top_level.txt +0 -0
oarepo_runtime/info/views.py
CHANGED
@@ -25,7 +25,6 @@ from invenio_base.utils import obj_or_import_string
|
|
25
25
|
from invenio_jsonschemas import current_jsonschemas
|
26
26
|
from invenio_records_resources.proxies import current_service_registry
|
27
27
|
|
28
|
-
|
29
28
|
logger = logging.getLogger("oarepo_runtime.info")
|
30
29
|
|
31
30
|
|
@@ -72,7 +71,7 @@ class InfoResource(Resource):
|
|
72
71
|
"models": url_for("oarepo_runtime_info.models", _external=True),
|
73
72
|
}
|
74
73
|
try:
|
75
|
-
import invenio_requests
|
74
|
+
import invenio_requests # noqa
|
76
75
|
links["requests"] = api_url_for("requests.search", _external=True)
|
77
76
|
except ImportError:
|
78
77
|
pass
|
@@ -111,19 +110,27 @@ class InfoResource(Resource):
|
|
111
110
|
if not service or type(service) != service_class:
|
112
111
|
continue
|
113
112
|
|
113
|
+
# check if the service class is inside OAREPO_GLOBAL_SEARCH and if not, skip it
|
114
|
+
global_search_models = current_app.config.get('GLOBAL_SEARCH_MODELS', [])
|
115
|
+
for global_model in global_search_models:
|
116
|
+
if global_model['model_service'] == model_data["service"]["class"]:
|
117
|
+
break
|
118
|
+
else:
|
119
|
+
continue
|
120
|
+
|
114
121
|
model_features = self._get_model_features(model_data)
|
115
122
|
|
116
123
|
links = {
|
117
124
|
"api": self._get_model_api_endpoint(model_data),
|
118
125
|
"html": self._get_model_html_endpoint(model_data),
|
119
|
-
"
|
126
|
+
"schemas": self._get_model_schema_endpoints(model_data),
|
120
127
|
"model": self._get_model_model_endpoint(model.name),
|
121
128
|
# "openapi": url_for(self._get_model_openapi_endpoint(model_data), _external=True)
|
122
129
|
}
|
123
130
|
|
124
131
|
links["published"] = links["api"]
|
125
132
|
if "drafts" in model_features:
|
126
|
-
links["
|
133
|
+
links["user_records"] = self._get_model_draft_endpoint(model_data)
|
127
134
|
|
128
135
|
data.append(
|
129
136
|
{
|
@@ -153,7 +160,7 @@ class InfoResource(Resource):
|
|
153
160
|
def model(self):
|
154
161
|
model = resource_requestctx.view_args["model"]
|
155
162
|
for _model in importlib_metadata.entry_points().select(
|
156
|
-
|
163
|
+
group="oarepo.models", name=model
|
157
164
|
):
|
158
165
|
package_name, file_name = _model.value.split(":")
|
159
166
|
model_data = json.loads(
|
@@ -246,13 +253,15 @@ class InfoResource(Resource):
|
|
246
253
|
logger.exception("Failed to get model html endpoint")
|
247
254
|
return None
|
248
255
|
|
249
|
-
def
|
256
|
+
def _get_model_schema_endpoints(self, model):
|
250
257
|
try:
|
251
|
-
return
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
258
|
+
return {
|
259
|
+
'application/json': url_for(
|
260
|
+
"oarepo_runtime_info.schema",
|
261
|
+
schema=model["json-schema-settings"]["name"],
|
262
|
+
_external=True,
|
263
|
+
)
|
264
|
+
}
|
256
265
|
except: # NOSONAR noqa
|
257
266
|
logger.exception("Failed to get model schema endpoint")
|
258
267
|
return None
|
@@ -269,10 +278,10 @@ class InfoResource(Resource):
|
|
269
278
|
record_cls = service.config.record_cls
|
270
279
|
schema = getattr(record_cls, "schema", None)
|
271
280
|
if schema is not None:
|
272
|
-
return
|
281
|
+
return {"application/json": schema.value}
|
273
282
|
except: # NOSONAR noqa
|
274
283
|
logger.exception("Failed to get model schemas")
|
275
|
-
return
|
284
|
+
return {}
|
276
285
|
|
277
286
|
def _get_service(self, model_data):
|
278
287
|
service_id = model_data["service-config"]["service-id"]
|
@@ -55,10 +55,17 @@ class GroupedFacetsParam(FacetsParam):
|
|
55
55
|
return None
|
56
56
|
|
57
57
|
def identity_facets(self, identity: Identity):
|
58
|
+
global_search_model = False
|
59
|
+
for model in current_app.config.get("GLOBAL_SEARCH_MODELS", []):
|
60
|
+
service_config = obj_or_import_string(model["service_config"])
|
61
|
+
if service_config == self.config:
|
62
|
+
global_search_model = True
|
63
|
+
|
58
64
|
if not self.facet_groups:
|
59
|
-
|
60
|
-
|
61
|
-
|
65
|
+
if global_search_model:
|
66
|
+
log.warning(
|
67
|
+
"No facet groups defined on the service config %s", type(self.config)
|
68
|
+
)
|
62
69
|
return self.facets
|
63
70
|
|
64
71
|
has_system_user_id = identity.id == system_user_id
|
@@ -41,7 +41,7 @@ oarepo_runtime/datastreams/writers/validation_errors.py,sha256=wOCXdniR6so_4Expd
|
|
41
41
|
oarepo_runtime/datastreams/writers/yaml.py,sha256=XchUJHQ58E2Mfgs8elImXbL38jFtI8Hfoye6yaR0gKI,1482
|
42
42
|
oarepo_runtime/i18n/__init__.py,sha256=h0knW_HwiyIt5TBHfdGqN7_BBYfpz1Fw6zhVy0C28fM,111
|
43
43
|
oarepo_runtime/info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
|
-
oarepo_runtime/info/views.py,sha256=
|
44
|
+
oarepo_runtime/info/views.py,sha256=UkLGzf6Vo8GLutfzJW3IAyq9sdPexICUFAvz903autY,11829
|
45
45
|
oarepo_runtime/records/__init__.py,sha256=3vzRsAPxl4d5QOnGyls-vUg4E6PunmR4ACObtacMAIQ,1038
|
46
46
|
oarepo_runtime/records/dumpers/__init__.py,sha256=OmzNhLdMNKibmCksnj9eTX9xPBG30dziiK3j3bAAp3k,233
|
47
47
|
oarepo_runtime/records/dumpers/edtf_interval.py,sha256=YCShZAoqBQYaxVilEVotS-jXZsxxoXO67yu2urhkaMA,1198
|
@@ -87,7 +87,7 @@ oarepo_runtime/services/facets/enum.py,sha256=3LrShQIt9Vt5mkqUkc6FNxXCW5JEFdPwtG
|
|
87
87
|
oarepo_runtime/services/facets/facet_groups_names.py,sha256=RR8eeUmD8d9t966JqfhslZnILn_xDSfYlL0hjyJT92Y,468
|
88
88
|
oarepo_runtime/services/facets/max_facet.py,sha256=TZ4KMKKVJHzyU1KgNne4V7IMQPu1ALRpkz61Y0labrc,407
|
89
89
|
oarepo_runtime/services/facets/nested_facet.py,sha256=y0xgjx37HsSj2xW7URxNemYTksD8hpPs7kOEfIBw22k,971
|
90
|
-
oarepo_runtime/services/facets/params.py,sha256=
|
90
|
+
oarepo_runtime/services/facets/params.py,sha256=IiRKbR0jIm67hucj3fINosUAysZQSSKqhusEXXub-hA,4194
|
91
91
|
oarepo_runtime/services/facets/year_histogram.py,sha256=kdfwx1lgw4UmfjdaqqeElJCB8rAduMH2hy42aZjY37w,6257
|
92
92
|
oarepo_runtime/services/files/__init__.py,sha256=K8MStrEQf_BUhvzhwPTF93Hkhwrd1dtv35LDo7iZeTM,268
|
93
93
|
oarepo_runtime/services/files/components.py,sha256=x6Wd-vvkqTqB1phj2a6h42DNQksN8PuR2XKaOGoNHfw,2400
|
@@ -119,9 +119,9 @@ oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
119
119
|
oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
|
120
120
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
121
121
|
tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
122
|
-
oarepo_runtime-1.5.
|
123
|
-
oarepo_runtime-1.5.
|
124
|
-
oarepo_runtime-1.5.
|
125
|
-
oarepo_runtime-1.5.
|
126
|
-
oarepo_runtime-1.5.
|
127
|
-
oarepo_runtime-1.5.
|
122
|
+
oarepo_runtime-1.5.63.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
123
|
+
oarepo_runtime-1.5.63.dist-info/METADATA,sha256=TV0lhUeUd9damNPoZn3toGutnxNfZQWh85kh--8Ur50,4720
|
124
|
+
oarepo_runtime-1.5.63.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
125
|
+
oarepo_runtime-1.5.63.dist-info/entry_points.txt,sha256=QrlXAKuPDVBinaSh_v3yO9_Nb9ZNmJCJ0VFcCW-z0Jg,327
|
126
|
+
oarepo_runtime-1.5.63.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
|
127
|
+
oarepo_runtime-1.5.63.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|