eoapi-cdk 11.4.1 → 11.6.0
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.
- package/.jsii +38 -23
- package/README.md +2 -0
- package/lib/bastion-host/index.js +1 -1
- package/lib/database/index.js +1 -1
- package/lib/ingestor-api/index.d.ts +4 -0
- package/lib/ingestor-api/index.js +8 -3
- package/lib/ingestor-api/runtime/Dockerfile +13 -9
- package/lib/ingestor-api/runtime/pyproject.toml +37 -0
- package/lib/ingestor-api/runtime/src/config.py +9 -0
- package/lib/ingestor-api/runtime/src/handler.py +27 -4
- package/lib/ingestor-api/runtime/src/ingestor.py +1 -1
- package/lib/ingestor-api/runtime/src/schemas.py +11 -19
- package/lib/ingestor-api/runtime/src/services.py +4 -2
- package/lib/ingestor-api/runtime/uv.lock +1313 -0
- package/lib/lambda-api-gateway/index.js +1 -1
- package/lib/lambda-api-gateway-private/index.js +1 -1
- package/lib/stac-api/index.js +2 -2
- package/lib/stac-api/runtime/README.md +36 -0
- package/lib/stac-api/runtime/pyproject.toml +2 -2
- package/lib/stac-api/runtime/src/stac_api/handler.py +82 -86
- package/lib/stac-api/runtime/uv.lock +206 -182
- package/lib/stac-auth-proxy/index.js +2 -2
- package/lib/stac-auth-proxy/runtime/pyproject.toml +2 -2
- package/lib/stac-auth-proxy/runtime/src/stac_auth_proxy_api/handler.py +25 -2
- package/lib/stac-auth-proxy/runtime/uv.lock +174 -248
- package/lib/stac-browser/index.js +1 -1
- package/lib/stac-loader/index.js +2 -2
- package/lib/stac-loader/runtime/Dockerfile +1 -0
- package/lib/stac-loader/runtime/src/stac_loader/handler.py +2 -25
- package/lib/stac-loader/runtime/uv.lock +251 -252
- package/lib/stactools-item-generator/index.js +1 -1
- package/lib/stactools-item-generator/runtime/uv.lock +79 -75
- package/lib/tipg-api/index.js +2 -2
- package/lib/tipg-api/runtime/pyproject.toml +1 -1
- package/lib/tipg-api/runtime/src/tipg_api/handler.py +85 -75
- package/lib/tipg-api/runtime/uv.lock +248 -243
- package/lib/titiler-pgstac-api/index.js +2 -2
- package/lib/titiler-pgstac-api/runtime/pyproject.toml +2 -2
- package/lib/titiler-pgstac-api/runtime/src/titiler_pgstac_api/handler.py +79 -50
- package/lib/titiler-pgstac-api/runtime/uv.lock +319 -280
- package/lib/utils/utils.py +49 -15
- package/package.json +4 -4
- package/pyproject.toml +4 -0
- package/uv.lock +475 -73
- package/lib/ingestor-api/runtime/dev_requirements.txt +0 -4
- package/lib/ingestor-api/runtime/requirements.txt +0 -10
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"""Entrypoint for Lambda execution."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
from typing import Any
|
|
4
5
|
|
|
5
6
|
from mangum import Mangum
|
|
6
7
|
|
|
7
8
|
from .main import app
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
def _ensure_event_loop() -> asyncio.AbstractEventLoop:
|
|
12
|
+
"""Return the current event loop, creating and installing one if needed."""
|
|
13
|
+
try:
|
|
14
|
+
return asyncio.get_running_loop()
|
|
15
|
+
except RuntimeError:
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
return asyncio.get_event_loop()
|
|
20
|
+
except RuntimeError:
|
|
21
|
+
loop = asyncio.new_event_loop()
|
|
22
|
+
asyncio.set_event_loop(loop)
|
|
23
|
+
return loop
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
_asgi_handler = Mangum(app, lifespan="off", api_gateway_base_path=app.root_path)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def handler(event: Any, context: Any) -> dict[str, Any]:
|
|
30
|
+
"""Handle AWS Lambda events with a guaranteed current event loop."""
|
|
31
|
+
_ensure_event_loop()
|
|
32
|
+
return _asgi_handler(event, context)
|
|
@@ -3,17 +3,15 @@ import binascii
|
|
|
3
3
|
import enum
|
|
4
4
|
import json
|
|
5
5
|
from datetime import datetime
|
|
6
|
-
from typing import TYPE_CHECKING, Dict, List, Optional, Union
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
|
7
7
|
from urllib.parse import urlparse
|
|
8
8
|
|
|
9
9
|
from fastapi.encoders import jsonable_encoder
|
|
10
|
-
from fastapi.exceptions import RequestValidationError
|
|
11
10
|
from pydantic import (
|
|
12
11
|
BaseModel,
|
|
13
12
|
Json,
|
|
14
13
|
PositiveInt,
|
|
15
14
|
dataclasses,
|
|
16
|
-
error_wrappers,
|
|
17
15
|
field_validator,
|
|
18
16
|
)
|
|
19
17
|
from stac_pydantic import Collection, Item, shared
|
|
@@ -107,25 +105,19 @@ class Ingestion(BaseModel):
|
|
|
107
105
|
class ListIngestionRequest:
|
|
108
106
|
status: Status = Status.queued
|
|
109
107
|
limit: Optional[PositiveInt] = None
|
|
110
|
-
next: Optional[
|
|
111
|
-
|
|
112
|
-
def __post_init_post_parse__(self) -> None:
|
|
113
|
-
# https://github.com/tiangolo/fastapi/issues/1474#issuecomment-1049987786
|
|
114
|
-
if self.next is None:
|
|
115
|
-
return
|
|
108
|
+
next: Optional[Any] = None
|
|
116
109
|
|
|
110
|
+
@field_validator("next", mode="before")
|
|
111
|
+
@classmethod
|
|
112
|
+
def decode_next_token(cls, v: Optional[str]) -> Optional[Any]:
|
|
113
|
+
"""Decode the base64-encoded JSON pagination token supplied as a query param."""
|
|
114
|
+
if v is None:
|
|
115
|
+
return None
|
|
117
116
|
try:
|
|
118
|
-
|
|
117
|
+
return json.loads(base64.b64decode(v))
|
|
119
118
|
except (UnicodeDecodeError, binascii.Error) as e:
|
|
120
|
-
raise
|
|
121
|
-
|
|
122
|
-
error_wrappers.ErrorWrapper(
|
|
123
|
-
ValueError(
|
|
124
|
-
"Unable to decode next token. Should be base64 encoded JSON"
|
|
125
|
-
),
|
|
126
|
-
"query.next",
|
|
127
|
-
)
|
|
128
|
-
]
|
|
119
|
+
raise ValueError(
|
|
120
|
+
"Unable to decode next token. Should be base64 encoded JSON"
|
|
129
121
|
) from e
|
|
130
122
|
|
|
131
123
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import TYPE_CHECKING, List
|
|
2
2
|
|
|
3
3
|
from boto3.dynamodb import conditions
|
|
4
|
-
from pydantic import
|
|
4
|
+
from pydantic import TypeAdapter
|
|
5
5
|
|
|
6
6
|
from . import schemas
|
|
7
7
|
|
|
@@ -35,7 +35,9 @@ class Database:
|
|
|
35
35
|
**{"ExclusiveStartKey": next} if next else {},
|
|
36
36
|
)
|
|
37
37
|
return {
|
|
38
|
-
"items":
|
|
38
|
+
"items": TypeAdapter(List[schemas.Ingestion]).validate_python(
|
|
39
|
+
response["Items"]
|
|
40
|
+
),
|
|
39
41
|
"next": response.get("LastEvaluatedKey"),
|
|
40
42
|
}
|
|
41
43
|
|