oarepo-runtime 2.0.0.dev5__tar.gz → 2.0.0.dev7__tar.gz
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.
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/PKG-INFO +1 -1
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/__init__.py +1 -1
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/api.py +78 -23
- oarepo_runtime-2.0.0.dev7/oarepo_runtime/resources/__init__.py +16 -0
- oarepo_runtime-2.0.0.dev7/oarepo_runtime/resources/config.py +35 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/facets/params.py +1 -1
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/.gitignore +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/LICENSE +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/README.md +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/cli/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/cli/search.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/config.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/ext.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/proxies.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/drafts.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/mapping.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/pid_providers.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/systemfields/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/systemfields/mapping.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/systemfields/publication_status.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/config/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/config/link_conditions.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/config/permissions.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/facets/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/records/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/records/links.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/records/mapping.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/results.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/schema/__init__.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/schema/i18n.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/schema/i18n_ui.py +0 -0
- {oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/pyproject.toml +0 -0
@@ -21,6 +21,8 @@ from invenio_base.utils import obj_or_import_string
|
|
21
21
|
from invenio_records_resources.proxies import current_service_registry
|
22
22
|
|
23
23
|
if TYPE_CHECKING:
|
24
|
+
from collections.abc import Mapping
|
25
|
+
|
24
26
|
from flask_babel.speaklater import LazyString
|
25
27
|
from flask_resources.responses import ResponseHandler
|
26
28
|
from flask_resources.serializers import BaseSerializer
|
@@ -28,7 +30,11 @@ if TYPE_CHECKING:
|
|
28
30
|
from invenio_records_resources.records.api import RecordBase
|
29
31
|
from invenio_records_resources.resources.records.config import RecordResourceConfig
|
30
32
|
from invenio_records_resources.resources.records.resource import RecordResource
|
31
|
-
from invenio_records_resources.services import
|
33
|
+
from invenio_records_resources.services import (
|
34
|
+
FileService,
|
35
|
+
RecordService,
|
36
|
+
RecordServiceConfig,
|
37
|
+
)
|
32
38
|
|
33
39
|
|
34
40
|
@dataclasses.dataclass
|
@@ -79,22 +85,6 @@ class Model[
|
|
79
85
|
variable.
|
80
86
|
"""
|
81
87
|
|
82
|
-
code: str
|
83
|
-
"""Code of the model, used to identify the model"""
|
84
|
-
|
85
|
-
name: str | LazyString
|
86
|
-
"""Name of the model, human readable."""
|
87
|
-
|
88
|
-
version: str
|
89
|
-
"""Version of the model, should be a valid semantic version."""
|
90
|
-
|
91
|
-
description: str | LazyString | None = None
|
92
|
-
"""Description of the model, human readable."""
|
93
|
-
|
94
|
-
records_alias_enabled: bool = False
|
95
|
-
"""Whether the records alias is enabled for this model. Such models will be searchable
|
96
|
-
via the `/api/records` endpoint."""
|
97
|
-
|
98
88
|
def __init__( # noqa: PLR0913 more attributes as we are creating a config
|
99
89
|
self,
|
100
90
|
*,
|
@@ -103,12 +93,17 @@ class Model[
|
|
103
93
|
version: str,
|
104
94
|
service: str | S,
|
105
95
|
resource_config: RC | str,
|
96
|
+
ui_model: Mapping[str, Any] | None = None,
|
106
97
|
# params with default values
|
107
98
|
service_config: C | None = None,
|
108
99
|
description: str | LazyString | None = None,
|
109
100
|
record: type[R] | None = None,
|
110
101
|
draft: type[D] | None = None,
|
111
|
-
resource: str | RR = "invenio_records_resources.resources.records.resource.RecordResource",
|
102
|
+
resource: (str | RR) = "invenio_records_resources.resources.records.resource.RecordResource",
|
103
|
+
file_service: FileService | None = None,
|
104
|
+
draft_file_service: FileService | None = None,
|
105
|
+
media_file_service: FileService | None = None,
|
106
|
+
media_draft_file_service: FileService | None = None,
|
112
107
|
exports: list[Export] | None = None,
|
113
108
|
records_alias_enabled: bool = True,
|
114
109
|
):
|
@@ -134,11 +129,17 @@ class Model[
|
|
134
129
|
:param records_alias_enabled: Whether the records alias is enabled for this model.
|
135
130
|
Such models will be searchable via the `/api/records` endpoint.
|
136
131
|
"""
|
137
|
-
self.
|
138
|
-
self.
|
139
|
-
self.
|
140
|
-
self.
|
141
|
-
self.
|
132
|
+
self._code = code
|
133
|
+
self._name = name
|
134
|
+
self._version = version
|
135
|
+
self._description = description
|
136
|
+
self._records_alias_enabled = records_alias_enabled
|
137
|
+
self._ui_model = ui_model or {}
|
138
|
+
|
139
|
+
self._file_service = file_service
|
140
|
+
self._draft_file_service = draft_file_service
|
141
|
+
self._media_file_service = media_file_service
|
142
|
+
self._media_draft_file_service = media_draft_file_service
|
142
143
|
|
143
144
|
# lazy getters ...
|
144
145
|
self._record = record
|
@@ -149,6 +150,40 @@ class Model[
|
|
149
150
|
self._resource_config = resource_config
|
150
151
|
self._exports = exports or []
|
151
152
|
|
153
|
+
@property
|
154
|
+
def code(self) -> str:
|
155
|
+
"""Return the machine-understandable code of the model."""
|
156
|
+
return self._code
|
157
|
+
|
158
|
+
@property
|
159
|
+
def name(self) -> str | LazyString:
|
160
|
+
"""Get the human-readable name of the model."""
|
161
|
+
return self._name
|
162
|
+
|
163
|
+
@property
|
164
|
+
def version(self) -> str:
|
165
|
+
"""Get the model's version."""
|
166
|
+
return self._version
|
167
|
+
|
168
|
+
@property
|
169
|
+
def description(self) -> str | LazyString | None:
|
170
|
+
"""Get the model's description."""
|
171
|
+
return self._description
|
172
|
+
|
173
|
+
@property
|
174
|
+
def records_alias_enabled(self) -> bool:
|
175
|
+
"""Get the records alias enabled flag.
|
176
|
+
|
177
|
+
This switch determines whether the records alias (/api/records)
|
178
|
+
is enabled for this model and whether the model is indexed in global search.
|
179
|
+
"""
|
180
|
+
return self._records_alias_enabled
|
181
|
+
|
182
|
+
@property
|
183
|
+
def ui_model(self) -> Mapping[str, Any]:
|
184
|
+
"""Get the UI model."""
|
185
|
+
return self._ui_model
|
186
|
+
|
152
187
|
@property
|
153
188
|
def service(self) -> S:
|
154
189
|
"""Get the service."""
|
@@ -182,6 +217,26 @@ class Model[
|
|
182
217
|
return None
|
183
218
|
return self._draft
|
184
219
|
|
220
|
+
@property
|
221
|
+
def file_service(self) -> FileService | None:
|
222
|
+
"""Get the file service."""
|
223
|
+
return self._file_service
|
224
|
+
|
225
|
+
@property
|
226
|
+
def draft_file_service(self) -> FileService | None:
|
227
|
+
"""Get the draft file service."""
|
228
|
+
return self._draft_file_service
|
229
|
+
|
230
|
+
@property
|
231
|
+
def media_file_service(self) -> FileService | None:
|
232
|
+
"""Get the media file service."""
|
233
|
+
return self._media_file_service
|
234
|
+
|
235
|
+
@property
|
236
|
+
def media_draft_file_service(self) -> FileService | None:
|
237
|
+
"""Get the media draft file service."""
|
238
|
+
return self._media_draft_file_service
|
239
|
+
|
185
240
|
@property
|
186
241
|
def api_blueprint_name(self) -> str:
|
187
242
|
"""Get the API blueprint name for the model."""
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2025 CESNET z.s.p.o.
|
3
|
+
#
|
4
|
+
# This file is a part of oarepo-runtime (see http://github.com/oarepo/oarepo-runtime).
|
5
|
+
#
|
6
|
+
# oarepo-runtime is free software; you can redistribute it and/or modify it
|
7
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
8
|
+
#
|
9
|
+
|
10
|
+
"""Extensions for RDM API resources."""
|
11
|
+
|
12
|
+
from __future__ import annotations
|
13
|
+
|
14
|
+
from .config import exports_to_response_handlers
|
15
|
+
|
16
|
+
__all__ = ("exports_to_response_handlers",)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2025 CESNET z.s.p.o.
|
3
|
+
#
|
4
|
+
# This file is a part of oarepo-runtime (see http://github.com/oarepo/oarepo-runtime).
|
5
|
+
#
|
6
|
+
# oarepo-runtime is free software; you can redistribute it and/or modify it
|
7
|
+
# under the terms of the MIT License; see LICENSE file for more details.
|
8
|
+
#
|
9
|
+
|
10
|
+
"""Extensions for RDM API resources."""
|
11
|
+
|
12
|
+
from __future__ import annotations
|
13
|
+
|
14
|
+
from typing import TYPE_CHECKING
|
15
|
+
|
16
|
+
from flask_resources.responses import ResponseHandler
|
17
|
+
from invenio_records_resources.resources.records.headers import etag_headers
|
18
|
+
|
19
|
+
if TYPE_CHECKING:
|
20
|
+
from collections.abc import Iterable
|
21
|
+
|
22
|
+
from oarepo_runtime.api import Export
|
23
|
+
|
24
|
+
|
25
|
+
def exports_to_response_handlers(
|
26
|
+
exports: Iterable[Export],
|
27
|
+
) -> dict[str, ResponseHandler]:
|
28
|
+
"""Convert exports to a dictionary of mimetype -> response handlers."""
|
29
|
+
return {
|
30
|
+
export.mimetype: ResponseHandler(
|
31
|
+
serializer=export.serializer,
|
32
|
+
headers=etag_headers,
|
33
|
+
)
|
34
|
+
for export in exports
|
35
|
+
}
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/facets/params.py
RENAMED
@@ -32,7 +32,7 @@ log = logging.getLogger(__name__)
|
|
32
32
|
class GroupedFacetsParam(FacetsParam):
|
33
33
|
"""Facet parameter class that supports grouping of facets."""
|
34
34
|
|
35
|
-
def __init__(self, config: SearchOptions):
|
35
|
+
def __init__(self, config: type[SearchOptions]):
|
36
36
|
"""Initialize the facets parameter with the given config."""
|
37
37
|
super().__init__(config)
|
38
38
|
self._facets = {**config.facets}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/records/pid_providers.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/config/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/facets/__init__.py
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/records/__init__.py
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/records/links.py
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/records/mapping.py
RENAMED
File without changes
|
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/schema/__init__.py
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/schema/i18n.py
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev5 → oarepo_runtime-2.0.0.dev7}/oarepo_runtime/services/schema/i18n_ui.py
RENAMED
File without changes
|
File without changes
|