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
package/lib/utils/utils.py
CHANGED
|
@@ -1,30 +1,64 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import base64
|
|
2
3
|
import json
|
|
3
4
|
import os
|
|
5
|
+
from typing import Any
|
|
4
6
|
|
|
5
7
|
import boto3
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
def
|
|
9
|
-
"""Retrieve
|
|
10
|
+
def get_secret_dict_by_name(secret_name: str) -> dict[str, Any]:
|
|
11
|
+
"""Retrieve a JSON secret from AWS Secrets Manager by secret name or ARN."""
|
|
12
|
+
session = boto3.session.Session()
|
|
13
|
+
client = session.client(service_name="secretsmanager")
|
|
14
|
+
response = client.get_secret_value(SecretId=secret_name)
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
if "SecretString" in response:
|
|
17
|
+
return json.loads(response["SecretString"])
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
return json.loads(base64.b64decode(response["SecretBinary"]))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_secret_dict(secret_arn_env_var: str) -> dict[str, Any]:
|
|
23
|
+
"""Retrieve a JSON secret from AWS Secrets Manager using an env var name."""
|
|
17
24
|
secret_arn = os.environ.get(secret_arn_env_var)
|
|
18
25
|
if not secret_arn:
|
|
19
26
|
raise ValueError(f"{secret_arn_env_var} is not set!")
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
client = session.client(service_name="secretsmanager")
|
|
28
|
+
return get_secret_dict_by_name(secret_arn)
|
|
29
|
+
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
def ensure_event_loop() -> asyncio.AbstractEventLoop:
|
|
32
|
+
"""Return the current event loop, creating and installing one if needed.
|
|
33
|
+
|
|
34
|
+
Lambda request handling may enter synchronous code paths that need a current
|
|
35
|
+
loop for container-scoped async initialization before control reaches the
|
|
36
|
+
ASGI adapter.
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
return asyncio.get_running_loop()
|
|
40
|
+
except RuntimeError:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
return asyncio.get_event_loop()
|
|
45
|
+
except RuntimeError:
|
|
46
|
+
loop = asyncio.new_event_loop()
|
|
47
|
+
asyncio.set_event_loop(loop)
|
|
48
|
+
return loop
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def run_async(coro: Any) -> Any:
|
|
52
|
+
"""Run an async coroutine from synchronous Lambda setup code.
|
|
53
|
+
|
|
54
|
+
This uses the installed reusable loop instead of ``asyncio.run(...)`` so
|
|
55
|
+
long-lived async resources are not created on a temporary loop that is then
|
|
56
|
+
closed immediately.
|
|
57
|
+
"""
|
|
58
|
+
try:
|
|
59
|
+
asyncio.get_running_loop()
|
|
60
|
+
except RuntimeError:
|
|
61
|
+
loop = ensure_event_loop()
|
|
62
|
+
return loop.run_until_complete(coro)
|
|
26
63
|
|
|
27
|
-
|
|
28
|
-
return json.loads(get_secret_value_response["SecretString"])
|
|
29
|
-
else:
|
|
30
|
-
return json.loads(base64.b64decode(get_secret_value_response["SecretBinary"]))
|
|
64
|
+
raise RuntimeError("Cannot run Lambda initialization inside an active event loop")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eoapi-cdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.0",
|
|
4
4
|
"description": "A set of constructs deploying pgSTAC with CDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@types/node": "^25.5.0",
|
|
46
46
|
"aws-cdk-lib": "2.220.0",
|
|
47
47
|
"constructs": "10.4.2",
|
|
48
|
-
"jsii": "5.9.
|
|
49
|
-
"jsii-docgen": "10.11.
|
|
50
|
-
"jsii-pacmak": "1.
|
|
48
|
+
"jsii": "5.9.40",
|
|
49
|
+
"jsii-docgen": "10.11.19",
|
|
50
|
+
"jsii-pacmak": "1.129.0",
|
|
51
51
|
"nodemon": "^3.1.10",
|
|
52
52
|
"npm-run-all": "^4.1.5",
|
|
53
53
|
"prettier": "^3.6.2",
|
package/pyproject.toml
CHANGED
|
@@ -8,11 +8,13 @@ dependencies = [
|
|
|
8
8
|
"titiler-pgstac-api",
|
|
9
9
|
"stac-loader",
|
|
10
10
|
"stactools-item-generator",
|
|
11
|
+
"ingestor-api",
|
|
11
12
|
]
|
|
12
13
|
|
|
13
14
|
[tool.uv.sources]
|
|
14
15
|
stactools-item-generator = { path = "lib/stactools-item-generator/runtime" }
|
|
15
16
|
stac-loader = { path = "lib/stac-loader/runtime" }
|
|
17
|
+
ingestor-api = { path = "lib/ingestor-api/runtime" }
|
|
16
18
|
tipg-api = { path = "lib/tipg-api/runtime" }
|
|
17
19
|
titiler-pgstac-api = { path = "lib/titiler-pgstac-api/runtime" }
|
|
18
20
|
stac-api = { path = "lib/stac-api/runtime" }
|
|
@@ -31,6 +33,7 @@ deploy = [
|
|
|
31
33
|
dev = [
|
|
32
34
|
"aws-lambda-typing>=2.20.0",
|
|
33
35
|
"httpx>=0.28.1",
|
|
36
|
+
"moto[dynamodb,ssm]>=4.0,<5.0",
|
|
34
37
|
"pytest>=8.3.5",
|
|
35
38
|
"pytest-mock>=3.14.0",
|
|
36
39
|
"pytest-postgresql>=7.0.1",
|
|
@@ -42,6 +45,7 @@ pythonpath = "."
|
|
|
42
45
|
testpaths = [
|
|
43
46
|
"lib/stactools-item-generator/runtime/tests",
|
|
44
47
|
"lib/stac-loader/runtime/tests",
|
|
48
|
+
"lib/ingestor-api/runtime/tests",
|
|
45
49
|
]
|
|
46
50
|
|
|
47
51
|
|