mesh-sandbox 1.0.12__py3-none-any.whl → 1.0.14__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.
- mesh_sandbox/__init__.py +1 -1
- mesh_sandbox/common/constants.py +1 -0
- mesh_sandbox/common/mex_headers.py +14 -0
- mesh_sandbox/handlers/inbox.py +6 -1
- mesh_sandbox/handlers/outbox.py +1 -1
- {mesh_sandbox-1.0.12.dist-info → mesh_sandbox-1.0.14.dist-info}/METADATA +2 -2
- {mesh_sandbox-1.0.12.dist-info → mesh_sandbox-1.0.14.dist-info}/RECORD +9 -9
- {mesh_sandbox-1.0.12.dist-info → mesh_sandbox-1.0.14.dist-info}/LICENSE +0 -0
- {mesh_sandbox-1.0.12.dist-info → mesh_sandbox-1.0.14.dist-info}/WHEEL +0 -0
mesh_sandbox/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.0.
|
|
1
|
+
__version__ = "1.0.14"
|
mesh_sandbox/common/constants.py
CHANGED
|
@@ -28,6 +28,7 @@ class Headers:
|
|
|
28
28
|
Mex_Content_Encrypted: Final[str] = "mex-Content-Encrypted"
|
|
29
29
|
Mex_Content_Compressed: Final[str] = "mex-Content-Compressed"
|
|
30
30
|
Mex_Content_Checksum: Final[str] = "mex-Content-Checksum"
|
|
31
|
+
Mex_Content_Type: Final[str] = "mex-Content-Type"
|
|
31
32
|
Mex_MessageType: Final[str] = "mex-MessageType"
|
|
32
33
|
Mex_MessageID: Final[str] = "mex-MessageID"
|
|
33
34
|
Mex_LocalID: Final[str] = "mex-LocalID"
|
|
@@ -37,6 +37,7 @@ class MexHeaders(NamedTuple):
|
|
|
37
37
|
mex_content_encrypted: bool
|
|
38
38
|
mex_content_compressed: bool
|
|
39
39
|
mex_content_checksum: Optional[str]
|
|
40
|
+
mex_content_type: Optional[str]
|
|
40
41
|
|
|
41
42
|
def update(self, **kwargs):
|
|
42
43
|
if not kwargs:
|
|
@@ -58,6 +59,7 @@ class MexHeaders(NamedTuple):
|
|
|
58
59
|
"mex_content_encrypted": message.metadata.encrypted,
|
|
59
60
|
"mex_content_compressed": message.metadata.compressed,
|
|
60
61
|
"mex_content_checksum": message.metadata.checksum,
|
|
62
|
+
"mex_content_type": message.metadata.content_type,
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
if kwargs:
|
|
@@ -151,6 +153,17 @@ def send_message_mex_headers(
|
|
|
151
153
|
example="b10a8db164e0754105b7a99be72e3fe5",
|
|
152
154
|
max_length=100,
|
|
153
155
|
),
|
|
156
|
+
mex_content_type: str = Header(
|
|
157
|
+
title=Headers.Mex_Content_Type,
|
|
158
|
+
default="",
|
|
159
|
+
description=(
|
|
160
|
+
"Content Type of the overall message, overrides Content-Type and "
|
|
161
|
+
"is passed through to recipient, for chunked messages Content-Type will "
|
|
162
|
+
"always be application/octet-stream but Mex-Content-Type will be preserved"
|
|
163
|
+
),
|
|
164
|
+
example="application/json",
|
|
165
|
+
max_length=100,
|
|
166
|
+
),
|
|
154
167
|
) -> MexHeaders:
|
|
155
168
|
mex_headers = MexHeaders(
|
|
156
169
|
mex_to=(mex_to or "").upper().strip(),
|
|
@@ -163,6 +176,7 @@ def send_message_mex_headers(
|
|
|
163
176
|
mex_content_encrypted=strtobool(mex_content_encrypted) or False,
|
|
164
177
|
mex_content_compressed=strtobool(mex_content_compressed) or False,
|
|
165
178
|
mex_content_checksum=mex_content_checksum,
|
|
179
|
+
mex_content_type=mex_content_type,
|
|
166
180
|
)
|
|
167
181
|
_validate_headers(mex_headers=mex_headers)
|
|
168
182
|
return mex_headers
|
mesh_sandbox/handlers/inbox.py
CHANGED
|
@@ -93,6 +93,7 @@ class InboxHandler:
|
|
|
93
93
|
Headers.Mex_Content_Compressed: "Y" if message.metadata.compressed else None,
|
|
94
94
|
Headers.Mex_Content_Encrypted: "Y" if message.metadata.encrypted else None,
|
|
95
95
|
Headers.Mex_Content_Checksum: message.metadata.checksum,
|
|
96
|
+
Headers.Mex_Content_Type: message.metadata.content_type,
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
if message.message_type == MessageType.REPORT:
|
|
@@ -197,11 +198,15 @@ class InboxHandler:
|
|
|
197
198
|
if headers.get(Headers.Content_Encoding) == "gzip":
|
|
198
199
|
headers[Headers.Mex_Content_Compressed] = "Y"
|
|
199
200
|
|
|
201
|
+
media_type = "application/octet-stream"
|
|
202
|
+
if accepts_api_version > 1 and message.total_chunks < 2 and message.metadata.content_type:
|
|
203
|
+
media_type = message.metadata.content_type
|
|
204
|
+
|
|
200
205
|
return Response(
|
|
201
206
|
status_code=status_code,
|
|
202
207
|
content=chunk,
|
|
203
208
|
headers=headers,
|
|
204
|
-
media_type=
|
|
209
|
+
media_type=media_type,
|
|
205
210
|
)
|
|
206
211
|
|
|
207
212
|
async def acknowledge_message(
|
mesh_sandbox/handlers/outbox.py
CHANGED
|
@@ -127,7 +127,7 @@ class OutboxHandler:
|
|
|
127
127
|
workflow_id=mex_headers.mex_workflow_id,
|
|
128
128
|
metadata=MessageMetadata(
|
|
129
129
|
subject=mex_headers.mex_subject,
|
|
130
|
-
content_type=content_type,
|
|
130
|
+
content_type=mex_headers.mex_content_type or content_type,
|
|
131
131
|
content_encoding=content_encoding,
|
|
132
132
|
file_name=mex_headers.mex_filename or f"{message_id}.dat",
|
|
133
133
|
local_id=mex_headers.mex_localid,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mesh-sandbox
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.14
|
|
4
4
|
Summary: NHSDigital mesh sandbox, a locally testable version of the MESH api
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: spinecore
|
|
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Requires-Dist: cryptography (>=41.0.4,<42.0.0)
|
|
14
|
-
Requires-Dist: fastapi (>=0.
|
|
14
|
+
Requires-Dist: fastapi (>=0.104.1,<0.105.0)
|
|
15
15
|
Requires-Dist: gunicorn (>=21.2.0,<22.0.0)
|
|
16
16
|
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
|
|
17
17
|
Requires-Dist: types-python-dateutil (>=2.8.9,<3.0.0)
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
mesh_sandbox/__init__.py,sha256=
|
|
1
|
+
mesh_sandbox/__init__.py,sha256=tmJFcbWnlgNwXFCrgJHkNSJZmxR67rAjso_lz91m_vc,23
|
|
2
2
|
mesh_sandbox/api.py,sha256=N6k5RH6C9nXkVU4VqK9Cb4Zm0y0btCkzY7vgf4aM-Vg,3924
|
|
3
3
|
mesh_sandbox/common/__init__.py,sha256=r_QcbsmkiCFrE04QVputqAF2TPIlixiXBcGKgWR4SvE,3430
|
|
4
|
-
mesh_sandbox/common/constants.py,sha256=
|
|
4
|
+
mesh_sandbox/common/constants.py,sha256=ADa23j-2FL-u4618N5s9IjerXVoGHSVav4S4k-UTpCs,6612
|
|
5
5
|
mesh_sandbox/common/exceptions.py,sha256=YQII8w6DQQoKuW0cukEr6PIE9j0rwrqDpCn5lapgmkQ,1481
|
|
6
6
|
mesh_sandbox/common/fernet.py,sha256=f8yygkVnK1cmQLBgcPifoB4PwGpgiOrG8Yk-6OMDy8o,551
|
|
7
7
|
mesh_sandbox/common/handler_helpers.py,sha256=Eg00Tide2mL87EoMFw83fDuxiTL5DgIwxHs2RaJasgE,392
|
|
8
8
|
mesh_sandbox/common/messaging.py,sha256=XY7yd7C-DubKsTfmBMmYVppPfmiycswC43oxywNR-Yo,14756
|
|
9
|
-
mesh_sandbox/common/mex_headers.py,sha256=
|
|
9
|
+
mesh_sandbox/common/mex_headers.py,sha256=DGtbS2Xd010JKLw4W3f1qAhKfXBJ2BsauStleGV8BjE,6678
|
|
10
10
|
mesh_sandbox/conftest.py,sha256=nNCRnGABKSByhUVmozHOUE_pRM8Ay30drxsehljGdbw,2193
|
|
11
11
|
mesh_sandbox/dependencies.py,sha256=GXbb9DMaHcbgGg8v-XCTEQU8wxIaXEDmo1o-xvMPoBE,4078
|
|
12
12
|
mesh_sandbox/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
mesh_sandbox/handlers/admin.py,sha256=uATzpRCnEW4_FEsF1kV0HJ-Ukb1-lUkzyqxY_YcX_8U,4141
|
|
14
14
|
mesh_sandbox/handlers/handshake.py,sha256=XSSWLfjs2lCVQCaEou8k3yMUI1X_YmsesF-WECYJUls,603
|
|
15
|
-
mesh_sandbox/handlers/inbox.py,sha256=
|
|
15
|
+
mesh_sandbox/handlers/inbox.py,sha256=KFEo3E-y66CErwxxw8W1DYbBJdCQp9psVbQo7be4vek,15913
|
|
16
16
|
mesh_sandbox/handlers/lookup.py,sha256=wDbcI_uKFPNE6udkAvWYOVyR7FOMfLwTh8It924PcqQ,1390
|
|
17
|
-
mesh_sandbox/handlers/outbox.py,sha256=
|
|
17
|
+
mesh_sandbox/handlers/outbox.py,sha256=DRWkZR5FOJJo_xYea4kig5CED2naIxH6jn8xtnaonF0,10035
|
|
18
18
|
mesh_sandbox/handlers/tracking.py,sha256=HGBbO9-RczN6uD7QO7eZtadCJz8y_45sK4aLaOm0wJc,2354
|
|
19
19
|
mesh_sandbox/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
mesh_sandbox/models/mailbox.py,sha256=2mfKro7zBaVx1DpsgnU5Y8_CnnEbq3epHjMR_G9Jhuk,1030
|
|
@@ -70,7 +70,7 @@ mesh_sandbox/views/inbox.py,sha256=zdKB2ulJaDRVnhnagyBYF2nFmN88wslAx3bq7d7feLo,5
|
|
|
70
70
|
mesh_sandbox/views/lookup.py,sha256=c_UtaJMCfBacsV692FQs4_AyDKjPNxIQKu2wgluDSGw,2815
|
|
71
71
|
mesh_sandbox/views/outbox.py,sha256=JrJk-R3fTjjcfVFW5Q_Fvxj8oasNRuH7HNJiMiTiD80,4907
|
|
72
72
|
mesh_sandbox/views/tracking.py,sha256=WEswJT_wLJPieN5CgJ-CGXjDSRF5BdUzVy5XHqzGHAE,8914
|
|
73
|
-
mesh_sandbox-1.0.
|
|
74
|
-
mesh_sandbox-1.0.
|
|
75
|
-
mesh_sandbox-1.0.
|
|
76
|
-
mesh_sandbox-1.0.
|
|
73
|
+
mesh_sandbox-1.0.14.dist-info/LICENSE,sha256=usgzIvDUpVX5pYZepJTRXQJqIaz0mdd32GuS5a3PFlY,1051
|
|
74
|
+
mesh_sandbox-1.0.14.dist-info/METADATA,sha256=jR76s9cq3DoJPeCZGa0Mjmh-76PM37JmbZmjT_vDpMQ,2373
|
|
75
|
+
mesh_sandbox-1.0.14.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
76
|
+
mesh_sandbox-1.0.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|