oarepo-runtime 1.5.80__py3-none-any.whl → 1.5.82__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -0,0 +1,39 @@
1
+ {
2
+ "is_verified": {
3
+ "type": "boolean"
4
+ },
5
+ "access": {
6
+ "properties": {
7
+ "owned_by": {
8
+ "properties": {
9
+ "user": {
10
+ "type": "keyword"
11
+ }
12
+ }
13
+ },
14
+ "grants": {
15
+ "properties": {
16
+ "subject": {
17
+ "type": "keyword"
18
+ },
19
+ "id": {
20
+ "type": "keyword"
21
+ },
22
+ "level": {
23
+ "type": "keyword"
24
+ }
25
+ }
26
+ },
27
+ "grant_tokens": {
28
+ "type": "keyword"
29
+ },
30
+ "links": {
31
+ "properties": {
32
+ "id": {
33
+ "type": "keyword"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
@@ -13,8 +13,12 @@ from invenio_search import current_search_client
13
13
  from invenio_search.engine import dsl, search
14
14
  from invenio_search.utils import build_alias_name
15
15
 
16
+ from deepmerge import always_merger
16
17
  from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
18
+ import json
19
+ import os
17
20
 
21
+ from pathlib import Path
18
22
 
19
23
  class Mapping(InvenioMapping):
20
24
  @classmethod
@@ -116,6 +120,16 @@ def prepare_cf_index(record_class, config, path=[]):
116
120
  def prepare_parent_mapping(parent_class, config):
117
121
  if not parent_class:
118
122
  return
123
+
124
+ script_dir = str(Path(__file__).resolve().parent)
125
+ path_parts = script_dir.split('/')
126
+ path_parts = path_parts[:-2]
127
+ base_path = '/'.join(path_parts)
128
+ mapping_path = f"{base_path}/records/mappings/rdm_parent_mapping.json"
129
+
130
+ with open(mapping_path, 'r') as f:
131
+ rdm_parent = json.load(f)
132
+
119
133
  parent_mapping = {
120
134
  "parent": {
121
135
  "type": "object",
@@ -142,7 +156,11 @@ def prepare_parent_mapping(parent_class, config):
142
156
  },
143
157
  }
144
158
  }
145
-
159
+ parent_mapping_merged = always_merger.merge(parent_mapping, {
160
+ "parent": {
161
+ "properties": rdm_parent
162
+ }
163
+ })
146
164
  # upload mapping
147
165
  try:
148
166
  record_index = dsl.Index(
@@ -151,7 +169,7 @@ def prepare_parent_mapping(parent_class, config):
151
169
  ),
152
170
  using=current_search_client,
153
171
  )
154
- update_index(record_index, {}, parent_mapping)
172
+ update_index(record_index, {}, parent_mapping_merged)
155
173
 
156
174
  if hasattr(config, "draft_cls"):
157
175
  draft_index = dsl.Index(
@@ -160,7 +178,7 @@ def prepare_parent_mapping(parent_class, config):
160
178
  ),
161
179
  using=current_search_client,
162
180
  )
163
- update_index(draft_index, {}, parent_mapping)
181
+ update_index(record_index, {}, parent_mapping_merged)
164
182
 
165
183
  except search.RequestError as e:
166
184
  click.secho("An error occurred while creating parent mapping.", fg="red")
@@ -10,5 +10,4 @@ from invenio_rdm_records.services.schemas.access import AccessSchema
10
10
  class RDMRecordMixin(ma.Schema):
11
11
 
12
12
  versions = NestedAttribute(VersionsSchema, dump_only=True)
13
- deletion_status = ma_fields.Nested(DeletionStatusSchema, dump_only=True)
14
- access = NestedAttribute(AccessSchema)
13
+ deletion_status = ma_fields.Nested(DeletionStatusSchema, dump_only=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.5.80
3
+ Version: 1.5.82
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -50,6 +50,8 @@ oarepo_runtime/records/dumpers/edtf_interval.py,sha256=YCShZAoqBQYaxVilEVotS-jXZ
50
50
  oarepo_runtime/records/dumpers/multilingual_dumper.py,sha256=PbNFCLsiH4XV3E1v8xga_fzlcEImHy8OXn_UKh_8VBU,1090
51
51
  oarepo_runtime/records/entity_resolvers/__init__.py,sha256=UiiIT54pUu9j7qPAPfqVp4UTnXnppp0c_LtKbFnyt6Y,383
52
52
  oarepo_runtime/records/entity_resolvers/proxies.py,sha256=R92Cil_sTgX-sHJtdNv82yd-F3SUfsGSNCHdwI9Zfq8,1516
53
+ oarepo_runtime/records/mappings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
+ oarepo_runtime/records/mappings/rdm_parent_mapping.json,sha256=9yRjlGs8-TZZiKN9MtAzNhRzYq9AEJFY9E80FN0wYoM,647
53
55
  oarepo_runtime/records/owners/__init__.py,sha256=R4hudCBqLRRzgCnkEjXIL7hSp068z-s6YOwYSkWyuaw,93
54
56
  oarepo_runtime/records/owners/registry.py,sha256=fYgBuW5nBKn6pyz2OBgfNlynk64_yhQ9J7FzPk8QU1U,795
55
57
  oarepo_runtime/records/relations/__init__.py,sha256=bDAgxl_LdKsqpGG3qluxAkQnn5u2ItJngnHQKkqzlkE,373
@@ -80,7 +82,7 @@ oarepo_runtime/services/config/link_conditions.py,sha256=evPRd5XU76Ok4J-08bBfplb
80
82
  oarepo_runtime/services/config/permissions_presets.py,sha256=V0dMrikzTzTiM2NRtdGgTML7AtXlrlYZ_vm3btzbJd4,6472
81
83
  oarepo_runtime/services/config/service.py,sha256=s-dVbGkLICpsce6jgu7b5kzYFz9opWjSQFDBgbIhKio,4002
82
84
  oarepo_runtime/services/custom_fields/__init__.py,sha256=_gqMcA_I3rdEZcBtCuDjO4wdVCqFML5NzaccuPx5a3o,2565
83
- oarepo_runtime/services/custom_fields/mappings.py,sha256=tg9CAdxGOkd_n6RB5Z2_wSwo_A0wqEey8RMcZ79AHo0,6906
85
+ oarepo_runtime/services/custom_fields/mappings.py,sha256=Y1d0s9lG_VThkzSNlxAS94_9eOFZe9N2C1hpYDZvnvI,7457
84
86
  oarepo_runtime/services/entity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
87
  oarepo_runtime/services/entity/config.py,sha256=1jfdPrxSbMuKj7eOUNKRWTCPbBPyRV6MrWE4Vgf9rX0,399
86
88
  oarepo_runtime/services/entity/schema.py,sha256=8TBpUFRITaBO7qCMz36cly1Hj4I1nLa9PeSAfWSa2YM,157
@@ -117,7 +119,7 @@ oarepo_runtime/services/schema/marshmallow.py,sha256=LmcSxvbZ9jIhkNHCqqxt1SA2UNi
117
119
  oarepo_runtime/services/schema/marshmallow_to_json_schema.py,sha256=VYLnVWHOoaxWCD_gqJO8-8u1SbaPEFBjDZ5HGgGr0Ow,2027
118
120
  oarepo_runtime/services/schema/oneofschema.py,sha256=GnWH4Or_G5M0NgSmCoqMI6PBrJg5AC9RHrcB5QDKRq0,6661
119
121
  oarepo_runtime/services/schema/polymorphic.py,sha256=bAbUoTIeDBiJPYPhpLEKKZekEdkHlpqkmNxk1hN3PDw,564
120
- oarepo_runtime/services/schema/rdm.py,sha256=XQ5p72Q_WVRTQkFeJvDiave8F5YSXU05IduTuYFO4gA,574
122
+ oarepo_runtime/services/schema/rdm.py,sha256=4gi44LIMWS9kWcZfEoHaJSq585qfZfMuUYM5IvL1nQo,531
121
123
  oarepo_runtime/services/schema/ui.py,sha256=xQgW-zLyZoHldGw47uVtXQj-5LexVNKTholyq4MiBZo,3777
122
124
  oarepo_runtime/services/schema/validation.py,sha256=g2lpFwgQygWdLgq5bRvLAjVqXVOJpfVJ7umDp5xEGRU,1849
123
125
  oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
@@ -133,9 +135,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
133
135
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
134
136
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
135
137
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
136
- oarepo_runtime-1.5.80.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
137
- oarepo_runtime-1.5.80.dist-info/METADATA,sha256=qJ58orVlLavE7lvAQCY0eQtGoEBlwdx71Zu4m4M7Ex8,4720
138
- oarepo_runtime-1.5.80.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
139
- oarepo_runtime-1.5.80.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
140
- oarepo_runtime-1.5.80.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
141
- oarepo_runtime-1.5.80.dist-info/RECORD,,
138
+ oarepo_runtime-1.5.82.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
139
+ oarepo_runtime-1.5.82.dist-info/METADATA,sha256=voTGOQaZq3xVELAst8XE670JICBfFvaE6WsM0UKyvcU,4720
140
+ oarepo_runtime-1.5.82.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
141
+ oarepo_runtime-1.5.82.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
142
+ oarepo_runtime-1.5.82.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
143
+ oarepo_runtime-1.5.82.dist-info/RECORD,,