oarepo-runtime 2.0.0.dev13__tar.gz → 2.0.0.dev14__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.
Files changed (38) hide show
  1. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/PKG-INFO +1 -1
  2. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/__init__.py +1 -1
  3. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/config/components.py +1 -1
  4. oarepo_runtime-2.0.0.dev14/oarepo_runtime/services/generators.py +77 -0
  5. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/records/__init__.py +2 -2
  6. oarepo_runtime-2.0.0.dev14/oarepo_runtime/services/records/links.py +35 -0
  7. oarepo_runtime-2.0.0.dev13/oarepo_runtime/services/records/links.py +0 -31
  8. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/.gitignore +0 -0
  9. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/LICENSE +0 -0
  10. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/README.md +0 -0
  11. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/api.py +0 -0
  12. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/cli/__init__.py +0 -0
  13. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/cli/search.py +0 -0
  14. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/config.py +0 -0
  15. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/ext.py +0 -0
  16. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/proxies.py +0 -0
  17. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/py.typed +0 -0
  18. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/__init__.py +0 -0
  19. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/drafts.py +0 -0
  20. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/mapping.py +0 -0
  21. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/pid_providers.py +0 -0
  22. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/systemfields/__init__.py +0 -0
  23. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/systemfields/mapping.py +0 -0
  24. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/records/systemfields/publication_status.py +0 -0
  25. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/resources/__init__.py +0 -0
  26. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/resources/config.py +0 -0
  27. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/__init__.py +0 -0
  28. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/config/__init__.py +0 -0
  29. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/config/link_conditions.py +0 -0
  30. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/config/permissions.py +0 -0
  31. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/facets/__init__.py +0 -0
  32. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/facets/params.py +0 -0
  33. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/records/mapping.py +0 -0
  34. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/results.py +0 -0
  35. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/schema/__init__.py +0 -0
  36. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/schema/i18n.py +0 -0
  37. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/oarepo_runtime/services/schema/i18n_ui.py +0 -0
  38. {oarepo_runtime-2.0.0.dev13 → oarepo_runtime-2.0.0.dev14}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oarepo-runtime
3
- Version: 2.0.0.dev13
3
+ Version: 2.0.0.dev14
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
@@ -19,6 +19,6 @@ from .api import Model
19
19
  from .ext import OARepoRuntime
20
20
  from .proxies import current_runtime
21
21
 
22
- __version__ = "2.0.0dev13"
22
+ __version__ = "2.0.0dev14"
23
23
 
24
24
  __all__ = ("Model", "OARepoRuntime", "__version__", "current_runtime")
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Copyright (c) 2025 CESNET z.s.p.o.
3
3
  #
4
- # This file is a part of oarepo-runtime (see http://github.com/oarepo/oarepo-runtime).
4
+ # This file is a part of oarepo-runtime (see https://github.com/oarepo/oarepo-runtime).
5
5
  #
6
6
  # oarepo-runtime is free software; you can redistribute it and/or modify it
7
7
  # under the terms of the MIT License; see LICENSE file for more details.
@@ -0,0 +1,77 @@
1
+ #
2
+ # Copyright (c) 2025 CESNET z.s.p.o.
3
+ #
4
+ # This file is a part of oarepo-runtime (see https://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
+ """Typed invenio generators."""
10
+
11
+ from __future__ import annotations
12
+
13
+ from abc import abstractmethod
14
+ from typing import TYPE_CHECKING, Any, override
15
+
16
+ from invenio_records_permissions.generators import (
17
+ ConditionalGenerator as InvenioConditionalGenerator,
18
+ )
19
+ from invenio_records_permissions.generators import Generator as InvenioGenerator
20
+
21
+ if TYPE_CHECKING:
22
+ from collections.abc import Sequence
23
+
24
+ from flask_principal import Need
25
+ from invenio_records_resources.records.api import Record
26
+ from invenio_search.engine import dsl
27
+
28
+
29
+ class Generator(InvenioGenerator):
30
+ """Custom generator for the service.
31
+
32
+ This class will be removed when invenio has proper type stubs.
33
+ """
34
+
35
+ @override
36
+ def needs(self, **kwargs: Any) -> Sequence[Need]: # type: ignore[reportIncompatibleMethodOverride]
37
+ return super().needs(**kwargs) # type: ignore[no-any-return]
38
+
39
+ @override
40
+ def excludes(self, **kwargs: Any) -> Sequence[Need]: # type: ignore[reportIncompatibleMethodOverride]
41
+ return super().excludes(**kwargs) # type: ignore[no-any-return]
42
+
43
+ @override
44
+ def query_filter(self, **kwargs: Any) -> dsl.query.Query: # type: ignore[reportIncompatibleMethodOverride]
45
+ return super().query_filter(**kwargs) # type: ignore[no-any-return]
46
+
47
+
48
+ class ConditionalGenerator(InvenioConditionalGenerator):
49
+ """Typed conditional generator.
50
+
51
+ This class will be removed when invenio has proper type stubs.
52
+ """
53
+
54
+ def __init__(self, then_: Sequence[InvenioGenerator], else_: Sequence[InvenioGenerator]) -> None:
55
+ """Initialize the conditional generator."""
56
+ super().__init__(then_=then_, else_=else_)
57
+
58
+ @abstractmethod
59
+ def _condition(self, **kwargs: Any) -> bool:
60
+ """Condition to choose generators set."""
61
+ raise NotImplementedError # pragma: nocover
62
+
63
+ def _generators(self, record: Record, **kwargs: Any) -> Sequence[InvenioGenerator]:
64
+ """Get the "then" or "else" generators."""
65
+ return super()._generators(record=record, **kwargs) # type: ignore[no-any-return]
66
+
67
+ @override
68
+ def needs(self, **kwargs: Any) -> Sequence[Need]: # type: ignore[override]
69
+ return super().needs(**kwargs) # type: ignore[no-any-return]
70
+
71
+ @override
72
+ def excludes(self, **kwargs: Any) -> Sequence[Need]: # type: ignore[override]
73
+ return super().excludes(**kwargs) # type: ignore[no-any-return]
74
+
75
+ @override
76
+ def query_filter(self, **kwargs: Any) -> dsl.query.Query: # type: ignore[reportIncompatibleMethodOverride]
77
+ return super().query_filter(**kwargs) # type: ignore[no-any-return]
@@ -11,6 +11,6 @@
11
11
 
12
12
  from __future__ import annotations
13
13
 
14
- from .links import pagination_links_html
14
+ from .links import pagination_endpoint_links_html
15
15
 
16
- __all__ = ("pagination_links_html",)
16
+ __all__ = ("pagination_endpoint_links_html",)
@@ -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
+ """Utility for rendering URI template links."""
11
+
12
+ from __future__ import annotations
13
+
14
+ from typing import Any
15
+
16
+ from invenio_records_resources.services.base.links import EndpointLink
17
+
18
+
19
+ def pagination_endpoint_links_html(endpoint: str, params: dict[str, Any] | None = None) -> dict[str, EndpointLink]:
20
+ """Create pagination links (prev/self/next) from the same endpoint."""
21
+ return {
22
+ "prev_html": EndpointLink(
23
+ endpoint,
24
+ when=lambda pagination, _ctx: pagination.has_prev,
25
+ vars=lambda pagination, _vars: _vars["args"].update({"page": pagination.prev_page.page}),
26
+ params=params,
27
+ ),
28
+ "self_html": EndpointLink(endpoint, params=params),
29
+ "next_html": EndpointLink(
30
+ endpoint,
31
+ when=lambda pagination, _ctx: pagination.has_next,
32
+ vars=lambda pagination, _vars: _vars["args"].update({"page": pagination.next_page.page}),
33
+ params=params,
34
+ ),
35
+ }
@@ -1,31 +0,0 @@
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
- """Utility for rendering URI template links."""
11
-
12
- from __future__ import annotations
13
-
14
- from invenio_records_resources.services.base.links import Link
15
-
16
-
17
- def pagination_links_html(tpl: str) -> dict[str, Link]:
18
- """Create pagination links (prev/self/next) from the same template."""
19
- return {
20
- "prev_html": Link(
21
- tpl,
22
- when=lambda pagination, _context: pagination.has_prev,
23
- vars=lambda pagination, variables: variables["args"].update({"page": pagination.prev_page.page}),
24
- ),
25
- "self_html": Link(tpl),
26
- "next_html": Link(
27
- tpl,
28
- when=lambda pagination, _context: pagination.has_next,
29
- vars=lambda pagination, variables: variables["args"].update({"page": pagination.next_page.page}),
30
- ),
31
- }