eoapi-cdk 8.1.0 → 8.2.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.
Files changed (64) hide show
  1. package/.jsii +594 -26
  2. package/lib/bastion-host/index.js +1 -1
  3. package/lib/database/PgBouncer.js +2 -2
  4. package/lib/database/index.d.ts +1 -0
  5. package/lib/database/index.js +5 -5
  6. package/lib/database/pgbouncer-setup.sh +6 -2
  7. package/lib/index.d.ts +2 -0
  8. package/lib/index.js +3 -1
  9. package/lib/ingestor-api/index.js +1 -1
  10. package/lib/stac-api/index.js +1 -1
  11. package/lib/stac-browser/index.js +1 -1
  12. package/lib/stac-item-loader/index.d.ts +322 -0
  13. package/lib/stac-item-loader/index.js +251 -0
  14. package/lib/stac-item-loader/runtime/Dockerfile +18 -0
  15. package/lib/stac-item-loader/runtime/pyproject.toml +17 -0
  16. package/lib/stac-item-loader/runtime/src/stac_item_loader/handler.py +241 -0
  17. package/lib/stactools-item-generator/index.d.ts +243 -0
  18. package/lib/stactools-item-generator/index.js +204 -0
  19. package/lib/stactools-item-generator/runtime/Dockerfile +20 -0
  20. package/lib/stactools-item-generator/runtime/pyproject.toml +16 -0
  21. package/lib/stactools-item-generator/runtime/src/stactools_item_generator/__init__.py +2 -0
  22. package/lib/stactools-item-generator/runtime/src/stactools_item_generator/handler.py +176 -0
  23. package/lib/stactools-item-generator/runtime/src/stactools_item_generator/item.py +77 -0
  24. package/lib/tipg-api/index.js +1 -1
  25. package/lib/titiler-pgstac-api/index.js +1 -1
  26. package/package.json +1 -1
  27. package/pyproject.toml +45 -0
  28. package/uv.lock +1065 -0
  29. package/.devcontainer/devcontainer.json +0 -4
  30. package/.github/pull_request_template.md +0 -4
  31. package/.github/workflows/build.yaml +0 -73
  32. package/.github/workflows/build_and_release.yaml +0 -13
  33. package/.github/workflows/conventional-pr.yaml +0 -26
  34. package/.github/workflows/deploy.yaml +0 -84
  35. package/.github/workflows/distribute.yaml +0 -46
  36. package/.github/workflows/docs.yaml +0 -26
  37. package/.github/workflows/lint.yaml +0 -26
  38. package/.github/workflows/tox.yaml +0 -26
  39. package/.nvmrc +0 -1
  40. package/.pre-commit-config.yaml +0 -23
  41. package/CHANGELOG.md +0 -464
  42. package/diagrams/bastion_diagram.excalidraw +0 -1416
  43. package/diagrams/bastion_diagram.png +0 -0
  44. package/diagrams/ingestor_diagram.excalidraw +0 -2274
  45. package/diagrams/ingestor_diagram.png +0 -0
  46. package/integration_tests/cdk/README.md +0 -55
  47. package/integration_tests/cdk/app.py +0 -186
  48. package/integration_tests/cdk/cdk.json +0 -32
  49. package/integration_tests/cdk/config.py +0 -52
  50. package/integration_tests/cdk/package-lock.json +0 -42
  51. package/integration_tests/cdk/package.json +0 -7
  52. package/integration_tests/cdk/requirements.txt +0 -7
  53. package/lib/database/lambda/package-lock.json +0 -1324
  54. package/lib/ingestor-api/runtime/tests/conftest.py +0 -270
  55. package/lib/ingestor-api/runtime/tests/test_collection.py +0 -87
  56. package/lib/ingestor-api/runtime/tests/test_collection_endpoint.py +0 -41
  57. package/lib/ingestor-api/runtime/tests/test_ingestor.py +0 -60
  58. package/lib/ingestor-api/runtime/tests/test_registration.py +0 -207
  59. package/lib/ingestor-api/runtime/tests/test_utils.py +0 -35
  60. package/lib/ingestor-api/runtime/tests/test_validators.py +0 -164
  61. package/ruff.toml +0 -23
  62. package/tox.ini +0 -16
  63. package/tsconfig.tsbuildinfo +0 -1
  64. /package/lib/{ingestor-api/runtime/tests → stac-item-loader/runtime/src/stac_item_loader}/__init__.py +0 -0
@@ -1,164 +0,0 @@
1
- from unittest.mock import MagicMock, patch
2
-
3
- import pytest
4
- import requests
5
- from pydantic import AnyHttpUrl
6
- from src import validators
7
-
8
-
9
- @pytest.fixture
10
- def mock_settings():
11
- """Fixture to instantiate and patch settings with proper types."""
12
- from src.config import Settings
13
-
14
- mock_settings = Settings(
15
- dynamodb_table="test-table",
16
- stac_url=AnyHttpUrl("https://test-stac.url"),
17
- data_access_role="arn:aws:iam::123456789012:role/test-role",
18
- requester_pays=False,
19
- jwks_url=AnyHttpUrl("https://test-jwks.url"),
20
- root_path="testing",
21
- )
22
-
23
- with patch("src.config.settings", mock_settings):
24
- yield mock_settings
25
-
26
-
27
- @pytest.fixture
28
- def mock_requests():
29
- """Fixture to mock requests library."""
30
- with patch("src.validators.requests") as mock_requests:
31
- mock_response = MagicMock()
32
- mock_response.ok = True
33
- mock_response.raise_for_status.return_value = None
34
- mock_requests.get.return_value = mock_response
35
- mock_requests.head.return_value = mock_response
36
-
37
- mock_requests.exceptions = requests.exceptions
38
-
39
- yield mock_requests
40
-
41
-
42
- @pytest.fixture
43
- def mock_boto3():
44
- """Fixture to mock boto3 library."""
45
- with patch("src.validators.boto3") as mock_boto3:
46
- mock_client = MagicMock()
47
- mock_client.exceptions.ClientError = Exception
48
-
49
- mock_sts_client = MagicMock()
50
- mock_sts_client.assume_role.return_value = {
51
- "Credentials": {
52
- "AccessKeyId": "test_access_key",
53
- "SecretAccessKey": "test_secret_key",
54
- "SessionToken": "test_session_token",
55
- }
56
- }
57
-
58
- def mock_client_factory(service_name, **kwargs):
59
- if service_name == "sts":
60
- return mock_sts_client
61
- return mock_client
62
-
63
- mock_boto3.client.side_effect = mock_client_factory
64
-
65
- yield mock_boto3, mock_client
66
-
67
-
68
- class TestValidators:
69
- def test_collection_exists_success(self, mock_settings, mock_requests):
70
- """Test collection_exists when the collection exists."""
71
- validators.collection_exists.cache_clear()
72
-
73
- result = validators.collection_exists("test-collection")
74
-
75
- assert result
76
-
77
- expected_url = f"{mock_settings.stac_url}collections/test-collection"
78
- mock_requests.get.assert_called_once_with(expected_url)
79
-
80
- def test_collection_exists_failure(self, mock_settings, mock_requests):
81
- """Test collection_exists when the collection doesn't exist."""
82
- validators.collection_exists.cache_clear()
83
-
84
- mock_response = MagicMock()
85
- mock_response.ok = False
86
- mock_response.status_code = 404
87
- mock_requests.get.return_value = mock_response
88
-
89
- with pytest.raises(ValueError) as excinfo:
90
- validators.collection_exists("nonexistent-collection")
91
-
92
- assert "Invalid collection 'nonexistent-collection'" in str(excinfo.value)
93
- assert "404 response code" in str(excinfo.value)
94
-
95
- def test_url_is_accessible_success(self, mock_requests):
96
- """Test url_is_accessible when the URL is accessible."""
97
- validators.url_is_accessible("https://example.com/asset.tif")
98
-
99
- mock_requests.head.assert_called_once_with("https://example.com/asset.tif")
100
-
101
- def test_url_is_accessible_failure(self, mock_requests):
102
- """Test url_is_accessible when the URL is not accessible."""
103
- mock_response = MagicMock()
104
- mock_response.raise_for_status.side_effect = requests.exceptions.HTTPError(
105
- response=MagicMock(status_code=403, reason="Forbidden")
106
- )
107
- mock_requests.head.return_value = mock_response
108
-
109
- with pytest.raises(ValueError) as excinfo:
110
- validators.url_is_accessible("https://example.com/private.tif")
111
-
112
- assert "Asset not accessible" in str(excinfo.value)
113
-
114
- def test_s3_object_is_accessible_success(self, mock_settings, mock_boto3):
115
- """Test s3_object_is_accessible when the object is accessible."""
116
- _, mock_s3_client = mock_boto3
117
-
118
- validators.s3_object_is_accessible("test-bucket", "test-key")
119
-
120
- mock_s3_client.head_object.assert_called_once_with(
121
- Bucket="test-bucket", Key="test-key"
122
- )
123
-
124
- def test_s3_object_is_accessible_with_requester_pays(self, mock_settings, mock_boto3):
125
- """Test s3_object_is_accessible with requester pays enabled."""
126
- _, mock_s3_client = mock_boto3
127
-
128
- mock_settings.requester_pays = True
129
-
130
- validators.s3_object_is_accessible("test-bucket", "test-key")
131
-
132
- mock_s3_client.head_object.assert_called_once_with(
133
- Bucket="test-bucket", Key="test-key", RequestPayer="requester"
134
- )
135
-
136
- def test_s3_object_is_accessible_failure(self, mock_settings, mock_boto3):
137
- """Test s3_object_is_accessible when the object is not accessible."""
138
- _, mock_s3_client = mock_boto3
139
-
140
- _ = {"Error": {"Message": "Access Denied"}}
141
- mock_s3_client.head_object.side_effect = Exception()
142
- mock_s3_client.head_object.side_effect.__dict__["response"] = {
143
- "Error": {"Message": "Access Denied"}
144
- }
145
-
146
- with pytest.raises(ValueError) as excinfo:
147
- validators.s3_object_is_accessible("test-bucket", "private-key")
148
-
149
- assert "Asset not accessible" in str(excinfo.value)
150
-
151
- def test_get_s3_credentials(self, mock_boto3):
152
- """Test get_s3_credentials returns the expected credentials."""
153
- _, _ = mock_boto3
154
-
155
- validators.get_s3_credentials.cache_clear()
156
-
157
- credentials = validators.get_s3_credentials()
158
-
159
- expected_credentials = {
160
- "aws_access_key_id": "test_access_key",
161
- "aws_secret_access_key": "test_secret_key",
162
- "aws_session_token": "test_session_token",
163
- }
164
- assert credentials == expected_credentials
package/ruff.toml DELETED
@@ -1,23 +0,0 @@
1
- line-length = 90
2
-
3
- [lint]
4
- select = [
5
- "F", # flake8
6
- "C", # flake8-comprehensions
7
- "B", # flake8-bugbear
8
- "I001", # isort
9
- ]
10
-
11
- ignore = [
12
- "E203",
13
- "E266",
14
- "F403",
15
- "E231",
16
- "E501", # line too long, handled by black
17
- "B008", # do not perform function calls in argument defaults
18
- "B905", # ignore zip() without an explicit strict= parameter, only support with python >3.10
19
- ]
20
-
21
-
22
- [lint.mccabe]
23
- max-complexity = 18
package/tox.ini DELETED
@@ -1,16 +0,0 @@
1
- [tox]
2
- skipsdist = True
3
- envlist = py39
4
-
5
- [testenv]
6
- extras = test
7
- envdir = toxenv
8
- passenv = AWS_DEFAULT_REGION
9
- commands =
10
- pip install -r ./lib/ingestor-api/runtime/requirements.txt
11
- pip install -r ./lib/ingestor-api/runtime/dev_requirements.txt
12
- python -m pytest -s -vv
13
-
14
- [pytest]
15
- addopts = -ra -q
16
- testpaths = lib/ingestor-api