oarepo-runtime 1.5.90__tar.gz → 1.5.91__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 (150) hide show
  1. {oarepo_runtime-1.5.90/oarepo_runtime.egg-info → oarepo_runtime-1.5.91}/PKG-INFO +1 -1
  2. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/info/views.py +273 -39
  3. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/components.py +19 -8
  4. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91/oarepo_runtime.egg-info}/PKG-INFO +1 -1
  5. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/setup.cfg +1 -1
  6. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/LICENSE +0 -0
  7. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/MANIFEST.in +0 -0
  8. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/README.md +0 -0
  9. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/__init__.py +0 -0
  10. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/__init__.py +0 -0
  11. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/assets.py +0 -0
  12. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/base.py +0 -0
  13. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/cf.py +0 -0
  14. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/check.py +0 -0
  15. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/configuration.py +0 -0
  16. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/fixtures.py +0 -0
  17. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/index.py +0 -0
  18. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/cli/validate.py +0 -0
  19. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/__init__.py +0 -0
  20. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/asynchronous.py +0 -0
  21. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/catalogue.py +0 -0
  22. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/datastreams.py +0 -0
  23. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/errors.py +0 -0
  24. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/ext.py +0 -0
  25. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/fixtures.py +0 -0
  26. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/json.py +0 -0
  27. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
  28. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/readers/attachments.py +0 -0
  29. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/readers/excel.py +0 -0
  30. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/readers/json.py +0 -0
  31. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/readers/service.py +0 -0
  32. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
  33. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/semi_asynchronous.py +0 -0
  34. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/synchronous.py +0 -0
  35. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/transformers.py +0 -0
  36. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/types.py +0 -0
  37. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/utils.py +0 -0
  38. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
  39. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/attachments_file.py +0 -0
  40. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/attachments_service.py +0 -0
  41. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/service.py +0 -0
  42. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/utils.py +0 -0
  43. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/validation_errors.py +0 -0
  44. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
  45. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/ext.py +0 -0
  46. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/ext_config.py +0 -0
  47. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/i18n/__init__.py +0 -0
  48. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/info/__init__.py +0 -0
  49. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/info/check.py +0 -0
  50. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/profile.py +0 -0
  51. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/proxies.py +0 -0
  52. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/__init__.py +0 -0
  53. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/dumpers/__init__.py +0 -0
  54. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/dumpers/edtf_interval.py +0 -0
  55. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/dumpers/multilingual_dumper.py +0 -0
  56. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/entity_resolvers/__init__.py +0 -0
  57. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/entity_resolvers/proxies.py +0 -0
  58. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/mappings/__init__.py +0 -0
  59. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/mappings/rdm_parent_mapping.json +0 -0
  60. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/owners/__init__.py +0 -0
  61. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/owners/registry.py +0 -0
  62. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/relations/__init__.py +0 -0
  63. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/relations/base.py +0 -0
  64. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/relations/internal.py +0 -0
  65. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/relations/lookup.py +0 -0
  66. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/relations/pid_relation.py +0 -0
  67. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/__init__.py +0 -0
  68. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/featured_file.py +0 -0
  69. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/has_draftcheck.py +0 -0
  70. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/icu.py +0 -0
  71. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/mapping.py +0 -0
  72. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/owner.py +0 -0
  73. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/record_status.py +0 -0
  74. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/selectors.py +0 -0
  75. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/records/systemfields/synthetic.py +0 -0
  76. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/resources/__init__.py +0 -0
  77. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/resources/file_resource.py +0 -0
  78. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/resources/json_serializer.py +0 -0
  79. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/resources/localized_ui_json_serializer.py +0 -0
  80. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/__init__.py +0 -0
  81. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/config/__init__.py +0 -0
  82. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/config/link_conditions.py +0 -0
  83. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/config/permissions_presets.py +0 -0
  84. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/config/service.py +0 -0
  85. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/custom_fields/__init__.py +0 -0
  86. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/custom_fields/mappings.py +0 -0
  87. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/entity/__init__.py +0 -0
  88. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/entity/config.py +0 -0
  89. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/entity/schema.py +0 -0
  90. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/entity/service.py +0 -0
  91. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/expansions/__init__.py +0 -0
  92. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/expansions/expandable_fields.py +0 -0
  93. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/expansions/service.py +0 -0
  94. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/__init__.py +0 -0
  95. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/base.py +0 -0
  96. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/date.py +0 -0
  97. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/enum.py +0 -0
  98. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/facet_groups_names.py +0 -0
  99. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/max_facet.py +0 -0
  100. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/nested_facet.py +0 -0
  101. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/params.py +0 -0
  102. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/facets/year_histogram.py +0 -0
  103. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/files/__init__.py +0 -0
  104. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/files/components.py +0 -0
  105. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/files/service.py +0 -0
  106. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/generators.py +0 -0
  107. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/permissions/__init__.py +0 -0
  108. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/permissions/generators.py +0 -0
  109. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/records/__init__.py +0 -0
  110. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/records/links.py +0 -0
  111. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/relations/__init__.py +0 -0
  112. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/relations/components.py +0 -0
  113. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/relations/errors.py +0 -0
  114. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/relations/mapping.py +0 -0
  115. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/results.py +0 -0
  116. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/__init__.py +0 -0
  117. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/cf.py +0 -0
  118. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/i18n.py +0 -0
  119. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/i18n_ui.py +0 -0
  120. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/i18n_validation.py +0 -0
  121. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/marshmallow.py +0 -0
  122. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/marshmallow_to_json_schema.py +0 -0
  123. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/oneofschema.py +0 -0
  124. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/polymorphic.py +0 -0
  125. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/rdm.py +0 -0
  126. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/ui.py +0 -0
  127. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/schema/validation.py +0 -0
  128. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/services/search.py +0 -0
  129. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/tasks.py +0 -0
  130. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
  131. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +0 -0
  132. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/translations/default_translations.py +0 -0
  133. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/translations/en/LC_MESSAGES/messages.mo +0 -0
  134. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/translations/en/LC_MESSAGES/messages.po +0 -0
  135. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/translations/messages.pot +0 -0
  136. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/uow.py +0 -0
  137. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/utils/__init__.py +0 -0
  138. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/utils/functools.py +0 -0
  139. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime/utils/path.py +0 -0
  140. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime.egg-info/SOURCES.txt +0 -0
  141. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
  142. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime.egg-info/entry_points.txt +0 -0
  143. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime.egg-info/requires.txt +0 -0
  144. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/oarepo_runtime.egg-info/top_level.txt +0 -0
  145. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/pyproject.toml +0 -0
  146. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/setup.py +0 -0
  147. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/tests/marshmallow_to_json/__init__.py +0 -0
  148. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/tests/marshmallow_to_json/test_datacite_ui_schema.py +0 -0
  149. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/tests/marshmallow_to_json/test_simple_schema.py +0 -0
  150. {oarepo_runtime-1.5.90 → oarepo_runtime-1.5.91}/tests/pkg_data/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oarepo-runtime
3
- Version: 1.5.90
3
+ Version: 1.5.91
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,9 +1,10 @@
1
+ import importlib
1
2
  import json
2
3
  import logging
3
4
  import os
4
5
  import re
5
6
  from functools import cached_property
6
- from urllib.parse import urljoin
7
+ from urllib.parse import urljoin, urlparse, urlunparse
7
8
 
8
9
  import importlib_metadata
9
10
  import importlib_resources
@@ -23,7 +24,11 @@ from flask_resources import (
23
24
  from flask_restful import abort
24
25
  from invenio_base.utils import obj_or_import_string
25
26
  from invenio_jsonschemas import current_jsonschemas
26
- from invenio_records_resources.proxies import current_service_registry
27
+ from invenio_records_resources.proxies import (
28
+ current_service_registry,
29
+ current_transfer_registry,
30
+ )
31
+ from invenio_records_resources.records.api import Record
27
32
 
28
33
  logger = logging.getLogger("oarepo_runtime.info")
29
34
 
@@ -68,32 +73,42 @@ class InfoResource(Resource):
68
73
  """Repository endpoint."""
69
74
  links = {
70
75
  "self": url_for(request.endpoint, _external=True),
76
+ "api": replace_path_in_url(
77
+ url_for(request.endpoint, _external=True), "/api"
78
+ ),
71
79
  "models": url_for("oarepo_runtime_info.models", _external=True),
72
80
  }
73
81
  try:
74
82
  import invenio_requests # noqa
83
+
75
84
  links["requests"] = api_url_for("requests.search", _external=True)
76
85
  except ImportError:
77
86
  pass
78
87
 
79
88
  ret = {
89
+ "schema": "local://introspection-v1.0.0",
80
90
  "name": current_app.config.get("THEME_SITENAME", ""),
81
91
  "description": current_app.config.get("REPOSITORY_DESCRIPTION", ""),
82
92
  "version": os.environ.get("DEPLOYMENT_VERSION", "local development"),
83
93
  "invenio_version": get_package_version("oarepo"),
84
- "transfers": [
85
- "local-file",
86
- "url-fetch",
87
- # TODO: where to get these? (permissions?)
88
- # "direct-s3",
89
- ],
94
+ "transfers": list(current_transfer_registry.get_transfer_types()),
90
95
  "links": links,
96
+ "features": [
97
+ *_add_feature_if_can_import("drafts", "invenio_drafts_resources"),
98
+ *_add_feature_if_can_import("workflows", "oarepo_workflows"),
99
+ *_add_feature_if_can_import("requests", "invenio_requests"),
100
+ *_add_feature_if_can_import("communities", "invenio_communities"),
101
+ *_add_feature_if_can_import("request_types", "oarepo_requests"),
102
+ ],
91
103
  }
104
+ if len(self.model_data) == 1:
105
+ ret["default_model"] = self.model_data[0]["name"]
106
+
92
107
  self.call_components("repository", data=ret)
93
108
  return ret, 200
94
109
 
95
- @response_handler(many=True)
96
- def models(self):
110
+ @cached_property
111
+ def model_data(self):
97
112
  data = []
98
113
  # iterate entrypoint oarepo.models
99
114
  for model in importlib_metadata.entry_points().select(group="oarepo.models"):
@@ -112,9 +127,9 @@ class InfoResource(Resource):
112
127
  continue
113
128
 
114
129
  # check if the service class is inside OAREPO_GLOBAL_SEARCH and if not, skip it
115
- global_search_models = current_app.config.get('GLOBAL_SEARCH_MODELS', [])
130
+ global_search_models = current_app.config.get("GLOBAL_SEARCH_MODELS", [])
116
131
  for global_model in global_search_models:
117
- if global_model['model_service'] == model_data["service"]["class"]:
132
+ if global_model["model_service"] == model_data["service"]["class"]:
118
133
  break
119
134
  else:
120
135
  continue
@@ -122,19 +137,22 @@ class InfoResource(Resource):
122
137
  model_features = self._get_model_features(model_data)
123
138
 
124
139
  links = {
125
- "api": self._get_model_api_endpoint(model_data),
126
140
  "html": self._get_model_html_endpoint(model_data),
127
- "schemas": self._get_model_schema_endpoints(model_data),
128
141
  "model": self._get_model_model_endpoint(model.name),
129
142
  # "openapi": url_for(self._get_model_openapi_endpoint(model_data), _external=True)
130
143
  }
131
144
 
132
- links["published"] = links["api"]
145
+ links["records"] = self._get_model_api_endpoint(model_data)
133
146
  if "drafts" in model_features:
134
- links["user_records"] = self._get_model_draft_endpoint(model_data)
147
+ links["drafts"] = self._get_model_draft_endpoint(model_data)
148
+ links["deposit"] = links["records"]
135
149
 
136
150
  data.append(
137
151
  {
152
+ "schema": "local://" + model_data["json-schema-settings"]["name"],
153
+ "type": model_data.get(
154
+ "model-name", model_data.get("module", {}).get("base", "")
155
+ ).lower(),
138
156
  "name": model_data.get(
139
157
  "model-name", model_data.get("module", {}).get("base", "")
140
158
  ).lower(),
@@ -144,11 +162,163 @@ class InfoResource(Resource):
144
162
  "links": links,
145
163
  # TODO: we also need to get previous schema versions here if we support
146
164
  # multiple version of the same schema at the same time
147
- "accept": self._get_model_accept_types(service, resource_config_class),
165
+ "content_types": self._get_model_content_types(
166
+ service, resource_config_class, model_data
167
+ ),
168
+ "metadata": model_data.get("properties", {}).get("metadata", None)
169
+ is not None,
148
170
  }
149
171
  )
150
172
  self.call_components("model", data=data)
151
- return data, 200
173
+ data.sort(key=lambda x: x["type"])
174
+ return data
175
+
176
+ @cached_property
177
+ def vocabulary_data(self):
178
+ ret = []
179
+ try:
180
+ from invenio_vocabularies.contrib.affiliations.api import Affiliation
181
+ from invenio_vocabularies.contrib.awards.api import Award
182
+ from invenio_vocabularies.contrib.funders.api import Funder
183
+ from invenio_vocabularies.contrib.names.api import Name
184
+ from invenio_vocabularies.contrib.subjects.api import Subject
185
+ from invenio_vocabularies.records.api import Vocabulary
186
+ from invenio_vocabularies.records.models import VocabularyType
187
+ except ImportError:
188
+ return ret
189
+
190
+ def _generate_rdm_vocabulary(
191
+ base_url: str,
192
+ record: type[Record],
193
+ vocabulary_type: str,
194
+ vocabulary_name: str,
195
+ vocabulary_description: str,
196
+ special: bool,
197
+ can_export: bool = True,
198
+ can_deposit: bool = False,
199
+ ) -> dict:
200
+ if not base_url.endswith("/"):
201
+ base_url += "/"
202
+ url_prefix = base_url + "api" if special else base_url + "api/vocabularies"
203
+ schema_path = base_url + record.schema.value.replace("local://", "schemas/")
204
+ links = dict(
205
+ records=f"{url_prefix}/{vocabulary_type}",
206
+ )
207
+ if can_deposit:
208
+ links["deposit"] = f"{url_prefix}/{vocabulary_type}"
209
+
210
+ return dict(
211
+ schema=record.schema.value,
212
+ type=vocabulary_type,
213
+ name=vocabulary_name,
214
+ description="Vocabulary for " + vocabulary_name,
215
+ version="unknown",
216
+ features=["rdm", "vocabulary"],
217
+ links=links,
218
+ content_types=[
219
+ dict(
220
+ content_type="application/json",
221
+ name="Invenio RDM JSON",
222
+ description="Vocabulary JSON",
223
+ schema=schema_path,
224
+ can_export=can_export,
225
+ can_deposit=can_deposit,
226
+ )
227
+ ],
228
+ metadata=False,
229
+ )
230
+
231
+ base_url = api_url_for("vocabularies.search", type="languages", _external=True)
232
+ base_url = replace_path_in_url(base_url, "/")
233
+ ret = [
234
+ _generate_rdm_vocabulary(
235
+ base_url, Affiliation, "affiliations", "Affiliations", "", special=True
236
+ ),
237
+ _generate_rdm_vocabulary(
238
+ base_url, Award, "awards", "Awards", "", special=True
239
+ ),
240
+ _generate_rdm_vocabulary(
241
+ base_url, Funder, "funders", "Funders", "", special=True
242
+ ),
243
+ _generate_rdm_vocabulary(
244
+ base_url, Subject, "subjects", "Subjects", "", special=True
245
+ ),
246
+ _generate_rdm_vocabulary(
247
+ base_url, Name, "names", "Names", "", special=True
248
+ ),
249
+ _generate_rdm_vocabulary(
250
+ base_url,
251
+ Affiliation,
252
+ "affiliations-vocab",
253
+ "Writable Affiliations",
254
+ "Write endpoint for affiliations",
255
+ special=False,
256
+ can_deposit=True,
257
+ ),
258
+ _generate_rdm_vocabulary(
259
+ base_url,
260
+ Award,
261
+ "awards-vocab",
262
+ "Writable Awards",
263
+ "Write endpoint for awards",
264
+ special=False,
265
+ can_deposit=True,
266
+ ),
267
+ _generate_rdm_vocabulary(
268
+ base_url,
269
+ Funder,
270
+ "funders-vocab",
271
+ "Writable Funders",
272
+ "Write endpoint for funders",
273
+ special=False,
274
+ can_deposit=True,
275
+ ),
276
+ _generate_rdm_vocabulary(
277
+ base_url,
278
+ Subject,
279
+ "subjects-vocab",
280
+ "Writable Subjects",
281
+ "Write endpoint for subjects",
282
+ special=False,
283
+ can_deposit=True,
284
+ ),
285
+ _generate_rdm_vocabulary(
286
+ base_url,
287
+ Name,
288
+ "names-vocab",
289
+ "Writable Names",
290
+ "Write endpoint for names",
291
+ special=False,
292
+ can_deposit=True,
293
+ ),
294
+ ]
295
+
296
+ vc_types = {vc.id for vc in VocabularyType.query.all()}
297
+ vocab_type_metadata = current_app.config.get(
298
+ "INVENIO_VOCABULARY_TYPE_METADATA", {}
299
+ )
300
+ vc_types.update(vocab_type_metadata.keys())
301
+
302
+ for vc in sorted(vc_types):
303
+ vc_metadata = vocab_type_metadata.get(vc, {})
304
+ ret.append(
305
+ _generate_rdm_vocabulary(
306
+ base_url,
307
+ Vocabulary,
308
+ vc,
309
+ to_current_language(vc_metadata.get("name")) or vc,
310
+ to_current_language(vc_metadata.get("description")) or "",
311
+ special=False,
312
+ can_export=True,
313
+ can_deposit=True,
314
+ )
315
+ )
316
+
317
+ return ret
318
+
319
+ @response_handler(many=True)
320
+ def models(self):
321
+ return self.model_data + self.vocabulary_data, 200
152
322
 
153
323
  @schema_view_args
154
324
  @response_handler()
@@ -161,7 +331,7 @@ class InfoResource(Resource):
161
331
  def model(self):
162
332
  model = resource_requestctx.view_args["model"]
163
333
  for _model in importlib_metadata.entry_points().select(
164
- group="oarepo.models", name=model
334
+ group="oarepo.models", name=model
165
335
  ):
166
336
  package_name, file_name = _model.value.split(":")
167
337
  model_data = json.loads(
@@ -254,10 +424,17 @@ class InfoResource(Resource):
254
424
  logger.exception("Failed to get model html endpoint")
255
425
  return None
256
426
 
427
+ def _get_model_model_endpoint(self, model):
428
+ try:
429
+ return url_for("oarepo_runtime_info.model", model=model, _external=True)
430
+ except: # NOSONAR noqa
431
+ logger.exception("Failed to get model model endpoint")
432
+ return None
433
+
257
434
  def _get_model_schema_endpoints(self, model):
258
435
  try:
259
436
  return {
260
- 'application/json': url_for(
437
+ "application/json": url_for(
261
438
  "oarepo_runtime_info.schema",
262
439
  schema=model["json-schema-settings"]["name"],
263
440
  _external=True,
@@ -267,32 +444,60 @@ class InfoResource(Resource):
267
444
  logger.exception("Failed to get model schema endpoint")
268
445
  return None
269
446
 
270
- def _get_model_model_endpoint(self, model):
271
- try:
272
- return url_for("oarepo_runtime_info.model", model=model, _external=True)
273
- except: # NOSONAR noqa
274
- logger.exception("Failed to get model model endpoint")
275
- return None
447
+ def _get_model_content_types(self, service, resource_config, model):
448
+ """Get the content types supported by the model. Returns a list of:
449
+
450
+ content_type="application/json",
451
+ name="Invenio RDM JSON",
452
+ description="Invenio RDM JSON as described in",
453
+ schema=url / "schemas" / "records" / "record-v6.0.0.json",
454
+ can_export=True,
455
+ can_deposit=True,
456
+ """
457
+
458
+ content_types = []
459
+ # implicit content type
460
+ content_types.append(
461
+ {
462
+ "content_type": "application/json",
463
+ "name": f"Internal json serialization of {model['model-name']}",
464
+ "description": "This content type is serving this model's native format as described on model link.",
465
+ "schema": url_for(
466
+ "oarepo_runtime_info.schema",
467
+ schema=model["json-schema-settings"]["name"],
468
+ _external=True,
469
+ ),
470
+ "can_export": True,
471
+ "can_deposit": True,
472
+ }
473
+ )
276
474
 
277
- def _get_model_accept_types(self, service, resource_config):
475
+ # export content types
278
476
  try:
279
- record_cls = service.config.record_cls
280
- schema = getattr(record_cls, "schema", None)
281
- accept_types = []
282
477
  for accept_type, handler in resource_config.response_handlers.items():
283
- curr_item = {'accept': accept_type}
284
- if handler.serializer is not None and hasattr(handler.serializer, "info"):
285
- curr_item.update(handler.serializer.info(service))
286
- accept_types.append(curr_item)
287
-
288
- return accept_types
478
+ if accept_type == "application/json":
479
+ continue
480
+ curr_item = {
481
+ "content_type": accept_type,
482
+ "name": getattr(handler, "name", accept_type),
483
+ "description": getattr(handler, "description", ""),
484
+ "can_export": True,
485
+ "can_deposit": False,
486
+ }
487
+ if handler.serializer is not None:
488
+ if hasattr(handler.serializer, "name"):
489
+ curr_item["name"] = handler.serializer.name
490
+ if hasattr(handler.serializer, "description"):
491
+ curr_item["description"] = handler.serializer.description
492
+ if hasattr(handler.serializer, "info"):
493
+ curr_item.update(handler.serializer.info(service))
494
+ content_types.append(curr_item)
289
495
  except: # NOSONAR noqa
290
496
  logger.exception("Failed to get model schemas")
291
- return {}
292
-
497
+ return content_types
293
498
 
294
499
  def _get_resource_config_class(self, model_data):
295
- model_class = model_data['resource-config']['class']
500
+ model_class = model_data["resource-config"]["class"]
296
501
  return obj_or_import_string(model_class)()
297
502
 
298
503
  def _get_service(self, model_data):
@@ -350,3 +555,32 @@ def api_url_for(endpoint, _external=True, **values):
350
555
  )
351
556
  finally:
352
557
  _cv_request.set(current_request_context)
558
+
559
+
560
+ def replace_path_in_url(url, path):
561
+ # Parse the URL into its components
562
+ parsed_url = urlparse(url)
563
+
564
+ # Replace the path with '/api'
565
+ new_parsed_url = parsed_url._replace(path=path)
566
+
567
+ # Reconstruct the URL with the new path
568
+ new_url = urlunparse(new_parsed_url)
569
+
570
+ return new_url
571
+
572
+
573
+ def _add_feature_if_can_import(feature, module):
574
+ try:
575
+ importlib.import_module(module)
576
+ return [feature]
577
+ except ImportError:
578
+ return []
579
+
580
+
581
+ def to_current_language(data):
582
+ if isinstance(data, dict):
583
+ from flask_babel import get_locale
584
+
585
+ return data.get(get_locale().language)
586
+ return data
@@ -7,6 +7,7 @@ from typing import Type
7
7
 
8
8
  from flask import current_app
9
9
  from invenio_accounts.models import User
10
+ from invenio_base.utils import obj_or_import_string
10
11
  from invenio_drafts_resources.services.records.config import (
11
12
  RecordServiceConfig as DraftsRecordServiceConfig,
12
13
  )
@@ -219,16 +220,22 @@ def _prepare_component_placement(components) -> list[ComponentPlacement]:
219
220
  for dep in getattr(placement.component, "depends_on", []):
220
221
  if dep == "*":
221
222
  continue
223
+ dep = obj_or_import_string(dep)
222
224
  for pl in _matching_placements(placements_without_this, dep):
223
- placement.depends_on.append(pl)
224
- pl.affects.append(placement)
225
+ if pl not in placement.depends_on:
226
+ placement.depends_on.append(pl)
227
+ if placement not in pl.affects:
228
+ pl.affects.append(placement)
225
229
 
226
230
  for dep in getattr(placement.component, "affects", []):
227
231
  if dep == "*":
228
232
  continue
233
+ dep = obj_or_import_string(dep)
229
234
  for pl in _matching_placements(placements_without_this, dep):
230
- placement.affects.append(pl)
231
- pl.depends_on.append(placement)
235
+ if pl not in placement.affects:
236
+ placement.affects.append(pl)
237
+ if placement not in pl.depends_on:
238
+ pl.depends_on.append(placement)
232
239
 
233
240
  # star dependencies
234
241
  for idx, placement in enumerate(placements):
@@ -238,16 +245,20 @@ def _prepare_component_placement(components) -> list[ComponentPlacement]:
238
245
  # if this placement is not in placements that pl depends on
239
246
  # (added via direct dependencies above), add it
240
247
  if placement not in pl.depends_on:
241
- placement.depends_on.append(pl)
242
- pl.affects.append(placement)
248
+ if pl not in placement.depends_on:
249
+ placement.depends_on.append(pl)
250
+ if placement not in pl.affects:
251
+ pl.affects.append(placement)
243
252
 
244
253
  if "*" in getattr(placement.component, "affects", []):
245
254
  for pl in placements_without_this:
246
255
  # if this placement is not in placements that pl affects
247
256
  # (added via direct dependencies above), add it
248
257
  if placement not in pl.affects:
249
- placement.affects.append(pl)
250
- pl.depends_on.append(placement)
258
+ if pl not in placement.affects:
259
+ placement.affects.append(pl)
260
+ if placement not in pl.depends_on:
261
+ pl.depends_on.append(placement)
251
262
  return placements
252
263
 
253
264
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oarepo-runtime
3
- Version: 1.5.90
3
+ Version: 1.5.91
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = oarepo-runtime
3
- version = 1.5.90
3
+ version = 1.5.91
4
4
  description = A set of runtime extensions of Invenio repository
5
5
  authors = Alzbeta Pokorna
6
6
  readme = README.md
File without changes