destiny_sdk 0.1.1__py3-none-any.whl → 0.1.2__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.
destiny_sdk/references.py CHANGED
@@ -1,12 +1,16 @@
1
1
  """Reference classes for the Destiny SDK."""
2
2
 
3
- from pydantic import UUID4, BaseModel, Field
3
+ from typing import Self
4
+
5
+ from pydantic import UUID4, BaseModel, Field, TypeAdapter
4
6
 
5
7
  from destiny_sdk.core import _JsonlFileInputMixIn
6
8
  from destiny_sdk.enhancements import Enhancement, EnhancementFileInput
7
9
  from destiny_sdk.identifiers import ExternalIdentifier
8
10
  from destiny_sdk.visibility import Visibility
9
11
 
12
+ external_identifier_adapter = TypeAdapter(ExternalIdentifier)
13
+
10
14
 
11
15
  class Reference(_JsonlFileInputMixIn, BaseModel):
12
16
  """Core reference class."""
@@ -27,6 +31,24 @@ class Reference(_JsonlFileInputMixIn, BaseModel):
27
31
  description="A list of enhancements for the reference",
28
32
  )
29
33
 
34
+ @classmethod
35
+ def from_es(cls, es_reference: dict) -> Self:
36
+ """Create a Reference from an Elasticsearch document."""
37
+ return cls(
38
+ id=es_reference["_id"],
39
+ visibility=Visibility(es_reference["_source"]["visibility"]),
40
+ identifiers=[
41
+ external_identifier_adapter.validate_python(identifier)
42
+ for identifier in es_reference["_source"].get("identifiers", [])
43
+ ],
44
+ enhancements=[
45
+ Enhancement.model_validate(
46
+ enhancement | {"reference_id": es_reference["_id"]},
47
+ )
48
+ for enhancement in es_reference["_source"].get("enhancements", [])
49
+ ],
50
+ )
51
+
30
52
 
31
53
  class ReferenceFileInput(_JsonlFileInputMixIn, BaseModel):
32
54
  """Enhancement model used to marshall a file input."""
destiny_sdk/robots.py CHANGED
@@ -212,6 +212,8 @@ class BatchEnhancementRequestStatus(StrEnum):
212
212
  - `partial_failed`: Some enhancements failed to create.
213
213
  - `failed`: All enhancements failed to create.
214
214
  - `importing`: Enhancements have been received by the repo and are being imported.
215
+ - `indexing`: Enhancements have been imported and are being indexed.
216
+ - `indexing_failed`: Enhancements have been imported but indexing failed.
215
217
  - `completed`: All enhancements have been created.
216
218
  """
217
219
 
@@ -221,6 +223,8 @@ class BatchEnhancementRequestStatus(StrEnum):
221
223
  PARTIAL_FAILED = auto()
222
224
  FAILED = auto()
223
225
  IMPORTING = auto()
226
+ INDEXING = auto()
227
+ INDEXING_FAILED = auto()
224
228
  COMPLETED = auto()
225
229
 
226
230
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: destiny_sdk
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: A software development kit (sdk) to support interaction with the DESTINY repository
5
5
  License: Apache 2.0
6
6
  Author: Adam Hamilton
@@ -6,10 +6,10 @@ destiny_sdk/enhancements.py,sha256=wFaphXYEHEU6yRijsP4tBY7BC6V9O2MPnOisfvE5EfE,1
6
6
  destiny_sdk/identifiers.py,sha256=JHxu-wM3T8kKtAYuk5dMec35Ay73KxYP7gthbSvOhuI,3480
7
7
  destiny_sdk/imports.py,sha256=mfC1QXbAU27iD3hO9OFTRQes352F6DS1U4fSMw26-8w,8243
8
8
  destiny_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- destiny_sdk/references.py,sha256=Tt9sVgw6WIXIhXGrlgGdRgIrIgQL0yr3Aqb0nr0WfK0,1493
10
- destiny_sdk/robots.py,sha256=B38KYXz_YJkZZ5RKBt17sh8yPD88dNCJvISw7V4km5k,12490
9
+ destiny_sdk/references.py,sha256=Dx-WKcv9gNJkKU9n52AYoEey7siTHR5_wBVBKSHND6Q,2321
10
+ destiny_sdk/robots.py,sha256=3VztlZJv2l1qQWRSNrZdKyJHCCteNil0w7lSYmV_Fpg,12692
11
11
  destiny_sdk/visibility.py,sha256=nDLqnWuSZSk0vG3ynzDpHAvaALsbk8cuEZujTsqf6no,684
12
- destiny_sdk-0.1.1.dist-info/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
13
- destiny_sdk-0.1.1.dist-info/METADATA,sha256=A4yKwHYOWseLSeHCVT8VoJ45ZC9w9EyX3R_WtU9M9Bo,2543
14
- destiny_sdk-0.1.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
15
- destiny_sdk-0.1.1.dist-info/RECORD,,
12
+ destiny_sdk-0.1.2.dist-info/LICENSE,sha256=6QURU4gvvTjVZ5rfp5amZ6FtFvcpPhAGUjxF5WSZAHI,9138
13
+ destiny_sdk-0.1.2.dist-info/METADATA,sha256=U-n5n9vDusuzXWJpDI5-67L7AY8ocPkJlJKGRlIXTqQ,2543
14
+ destiny_sdk-0.1.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
15
+ destiny_sdk-0.1.2.dist-info/RECORD,,