oarepo-runtime 2.0.0.dev36__py3-none-any.whl → 2.0.0.dev37__py3-none-any.whl
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/__init__.py +1 -1
- oarepo_runtime/ext.py +6 -5
- oarepo_runtime/records/pid_providers.py +2 -2
- oarepo_runtime/services/results.py +5 -4
- {oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/METADATA +2 -4
- {oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/RECORD +9 -9
- {oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/WHEEL +0 -0
- {oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/licenses/LICENSE +0 -0
oarepo_runtime/__init__.py
CHANGED
oarepo_runtime/ext.py
CHANGED
@@ -15,6 +15,7 @@ from functools import cached_property
|
|
15
15
|
from typing import TYPE_CHECKING, Any, cast
|
16
16
|
|
17
17
|
from flask import current_app
|
18
|
+
from invenio_db import db
|
18
19
|
from invenio_pidstore.errors import PIDDoesNotExistError
|
19
20
|
from invenio_pidstore.models import PersistentIdentifier
|
20
21
|
from invenio_records.api import Record as RecordBase
|
@@ -146,20 +147,20 @@ class OARepoRuntime:
|
|
146
147
|
|
147
148
|
If the filter matches multiple services, an error is raised.
|
148
149
|
"""
|
149
|
-
pids =
|
150
|
+
pids = db.session.query(PersistentIdentifier).filter_by(**filter_kwargs).all()
|
150
151
|
|
151
152
|
filtered_pids = [pid for pid in pids if pid.pid_type in self.record_class_by_pid_type]
|
152
153
|
if not filtered_pids:
|
153
154
|
raise PIDDoesNotExistError(
|
154
|
-
|
155
|
-
filter_kwargs,
|
155
|
+
"unknown_pid",
|
156
|
+
str(filter_kwargs),
|
156
157
|
"The pid value/record uuid is not associated with any record.",
|
157
158
|
)
|
158
159
|
|
159
160
|
if len(filtered_pids) > 1:
|
160
161
|
raise PIDDoesNotExistError(
|
161
|
-
|
162
|
-
filter_kwargs,
|
162
|
+
"unknown_pid",
|
163
|
+
str(filter_kwargs),
|
163
164
|
f"Multiple records found for pid value/record uuid: {filtered_pids}",
|
164
165
|
)
|
165
166
|
return filtered_pids[0]
|
@@ -28,7 +28,7 @@ class UniversalPIDMixin(RecordIdProviderV2):
|
|
28
28
|
unpid_default_status = PIDStatus.REGISTERED
|
29
29
|
|
30
30
|
@classmethod
|
31
|
-
def create(
|
31
|
+
def create( # type: ignore[override] # as pid type and value are given
|
32
32
|
cls,
|
33
33
|
object_type: str | None = None,
|
34
34
|
object_uuid: str | None = None,
|
@@ -50,7 +50,7 @@ class UniversalPIDMixin(RecordIdProviderV2):
|
|
50
50
|
|
51
51
|
PersistentIdentifier.create(
|
52
52
|
cls.unpid_pid_type,
|
53
|
-
pid.pid.pid_value,
|
53
|
+
cast("str", pid.pid.pid_value),
|
54
54
|
pid_provider=None,
|
55
55
|
object_type=object_type,
|
56
56
|
object_uuid=object_uuid,
|
@@ -15,7 +15,6 @@ import logging
|
|
15
15
|
from typing import TYPE_CHECKING, Any
|
16
16
|
|
17
17
|
from invenio_access.permissions import Identity
|
18
|
-
from invenio_records.api import RecordBase
|
19
18
|
from invenio_records_resources.errors import _iter_errors_dict
|
20
19
|
from invenio_records_resources.services.records.results import (
|
21
20
|
RecordItem as BaseRecordItem,
|
@@ -27,7 +26,7 @@ from invenio_records_resources.services.records.results import (
|
|
27
26
|
if TYPE_CHECKING:
|
28
27
|
from invenio_access.permissions import Identity
|
29
28
|
from invenio_drafts_resources.records.api import Draft
|
30
|
-
from
|
29
|
+
from invenio_records_resources.records.api import Record
|
31
30
|
|
32
31
|
|
33
32
|
log = logging.getLogger(__name__)
|
@@ -45,7 +44,7 @@ class ResultComponent:
|
|
45
44
|
self._record_item = record_item
|
46
45
|
self._record_list = record_list
|
47
46
|
|
48
|
-
def update_data(self, identity: Identity, record:
|
47
|
+
def update_data(self, identity: Identity, record: Record, projection: dict, expand: bool) -> None:
|
49
48
|
"""Update the projection data with additional information.
|
50
49
|
|
51
50
|
:param identity: The identity of the user making the request.
|
@@ -151,7 +150,9 @@ class RecordList(BaseRecordList):
|
|
151
150
|
# Project the record
|
152
151
|
# TODO: check if this logic is correct
|
153
152
|
versions = hit_dict.get("versions", {})
|
154
|
-
if versions.get("is_latest_draft") and not versions.get("is_latest")
|
153
|
+
if (versions.get("is_latest_draft") and not versions.get("is_latest")) or (
|
154
|
+
"publication_status" in hit_dict and hit_dict["publication_status"] == "draft"
|
155
|
+
):
|
155
156
|
draft_class: type[Draft] | None = getattr(self._service, "draft_cls", None)
|
156
157
|
if draft_class is None:
|
157
158
|
raise RuntimeError("Draft class is not defined in the service") # pragma: no cover
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: oarepo-runtime
|
3
|
-
Version: 2.0.0.
|
3
|
+
Version: 2.0.0.dev37
|
4
4
|
Summary: A set of runtime extensions of Invenio repository
|
5
5
|
Project-URL: Homepage, https://github.com/oarepo/oarepo-runtime
|
6
6
|
License-Expression: MIT
|
@@ -8,11 +8,9 @@ License-File: LICENSE
|
|
8
8
|
Requires-Python: <3.14,>=3.13
|
9
9
|
Requires-Dist: langcodes>=3.5.0
|
10
10
|
Requires-Dist: oarepo-invenio-typing-stubs>=0.1.0
|
11
|
-
Requires-Dist: oarepo[rdm,tests]<15,>=
|
11
|
+
Requires-Dist: oarepo[rdm,tests]<15,>=14
|
12
12
|
Provides-Extra: dev
|
13
13
|
Requires-Dist: pytest>=7.1.2; extra == 'dev'
|
14
|
-
Provides-Extra: oarepo13
|
15
|
-
Requires-Dist: oarepo[rdm]<14,>=13; extra == 'oarepo13'
|
16
14
|
Provides-Extra: oarepo14
|
17
15
|
Requires-Dist: oarepo[rdm]<15,>=14; extra == 'oarepo14'
|
18
16
|
Provides-Extra: tests
|
@@ -1,7 +1,7 @@
|
|
1
|
-
oarepo_runtime/__init__.py,sha256=
|
1
|
+
oarepo_runtime/__init__.py,sha256=JR0f1Ihyrg0u3il_AHkGxW24pISnxnXHCilb58xIoWM,686
|
2
2
|
oarepo_runtime/api.py,sha256=6AHyFnf0Cg1nfhGaQFMPjynVvrp1UURo8vX5vb5LvC4,14169
|
3
3
|
oarepo_runtime/config.py,sha256=RUEPFn_5bKp9Wb0OY-Fb3VK30m35vF5IsLjYaQHhP3g,3838
|
4
|
-
oarepo_runtime/ext.py,sha256=
|
4
|
+
oarepo_runtime/ext.py,sha256=hA_OmJJHum6W28iPkjxvFrKHzFwi_Ki_0Fy2Mgzl7UQ,8851
|
5
5
|
oarepo_runtime/proxies.py,sha256=x8Y1iTP8QIzSI67s90VR0_5fvXuT1xlJXtAHsaoXFwg,903
|
6
6
|
oarepo_runtime/py.typed,sha256=RznSCjXReEUI9zkmD25E8XniG_MvPpLBF6MyNZA8MmE,42
|
7
7
|
oarepo_runtime/typing.py,sha256=VtINHm4BZ5OJ4KdRAwnFXPZiAEgPRIYTtPC9fIzK1bU,1876
|
@@ -12,7 +12,7 @@ oarepo_runtime/info/views.py,sha256=JwESs-KVq163OBeqWVwfy0RU4WXR_MBolVR7W-dGtm0,
|
|
12
12
|
oarepo_runtime/records/__init__.py,sha256=AbWzmVCY7MhrpdEeI0e3lKzeugPMUSo8T08-NBVeig4,339
|
13
13
|
oarepo_runtime/records/drafts.py,sha256=b45ROjd9lwy6ratrpAruimcKvQmJradk5JgILoBAHmY,1965
|
14
14
|
oarepo_runtime/records/mapping.py,sha256=fn6M208axxBqHtRV6qKQukwUw1z0hq_KF4qfuB2rr98,2630
|
15
|
-
oarepo_runtime/records/pid_providers.py,sha256=
|
15
|
+
oarepo_runtime/records/pid_providers.py,sha256=B7nzj8nUZ3tut8SSkGWbYN-ON7z-5t3V3uhqiXA2Ifo,1820
|
16
16
|
oarepo_runtime/records/systemfields/__init__.py,sha256=tJzOOQ8dBlCyD8tCAriIUZggZ73UjMyMOp6IlSV-Tb4,594
|
17
17
|
oarepo_runtime/records/systemfields/base.py,sha256=EWSdVsWePkdwksRQ9yaMMk9Mrhicw-ZE0vdApn2EjWQ,1602
|
18
18
|
oarepo_runtime/records/systemfields/custom_fields.py,sha256=PEoaCEnvanysFQAaqTtD9-VwaBmnFkoP2pmpCl9ZFfI,2237
|
@@ -23,7 +23,7 @@ oarepo_runtime/resources/__init__.py,sha256=voynQULXoOEviADkbOpekMphZPTAz4IOTg5B
|
|
23
23
|
oarepo_runtime/resources/config.py,sha256=Lbx1QPWAJ8z1truhYntbnhGGWp2OCcwqKm6BuvPJNT0,1330
|
24
24
|
oarepo_runtime/services/__init__.py,sha256=OGtBgEeaDTyk2RPDNXuKbU9_7egFBZr42SM0gN5FrF4,341
|
25
25
|
oarepo_runtime/services/generators.py,sha256=8Z2QGzob4c2vaaNqhcMZsRybmwtOt30Plgf3EFmcJXw,4622
|
26
|
-
oarepo_runtime/services/results.py,sha256=
|
26
|
+
oarepo_runtime/services/results.py,sha256=EwMW1ed7u6uozgOLZpFa07-NKC89hJlHaVSD8-D5ibU,7211
|
27
27
|
oarepo_runtime/services/config/__init__.py,sha256=SX1kfIGk8HkohdLQrNpRQUTltksEyDcCa-kFXxrX4e8,711
|
28
28
|
oarepo_runtime/services/config/components.py,sha256=cyU-JeMzLuBL-9JkUKbUQuu527WAq0yptGs6806XSho,23039
|
29
29
|
oarepo_runtime/services/config/link_conditions.py,sha256=T1ZZ5SbbvIfujm0oJx73s_ku3WmeFqElAOZJwPFTw2o,4388
|
@@ -42,8 +42,8 @@ oarepo_runtime/services/schema/__init__.py,sha256=jgAPI_uKC6Ug4KQWnwQVg3-aNaw-eH
|
|
42
42
|
oarepo_runtime/services/schema/i18n.py,sha256=9D1zOQaPKAnYzejB0vO-m2BJYnam0N0Lrq4jID7twfE,3174
|
43
43
|
oarepo_runtime/services/schema/i18n_ui.py,sha256=DbusphhGDeaobTt4nuwNgKZ6Houlu4Sv3SuMGkdjRRY,3582
|
44
44
|
oarepo_runtime/services/schema/ui.py,sha256=Y_jBO-fowkpOgceWz8aqJSJAUiAnKLGSIuNpjNLnp8Q,4612
|
45
|
-
oarepo_runtime-2.0.0.
|
46
|
-
oarepo_runtime-2.0.0.
|
47
|
-
oarepo_runtime-2.0.0.
|
48
|
-
oarepo_runtime-2.0.0.
|
49
|
-
oarepo_runtime-2.0.0.
|
45
|
+
oarepo_runtime-2.0.0.dev37.dist-info/METADATA,sha256=6Cl9JNhk5K76z8S6JfwJcPywCOVmedvqjbme6kv7PIc,4626
|
46
|
+
oarepo_runtime-2.0.0.dev37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
47
|
+
oarepo_runtime-2.0.0.dev37.dist-info/entry_points.txt,sha256=rOfs8R1oXFN_dLH9zAZ6ydkvr83mDajegc6NBIRsCMQ,318
|
48
|
+
oarepo_runtime-2.0.0.dev37.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
49
|
+
oarepo_runtime-2.0.0.dev37.dist-info/RECORD,,
|
File without changes
|
{oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/entry_points.txt
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev36.dist-info → oarepo_runtime-2.0.0.dev37.dist-info}/licenses/LICENSE
RENAMED
File without changes
|