Skip to content

Commit

Permalink
Api v1.17.0 (openreplay#1799)
Browse files Browse the repository at this point in the history
* refactor(crons): upgraded dependencies (openreplay#1781)

refactor(alerts): upgraded dependencies
refactor(chalice): upgraded dependencies

* Api v1.17.0 (openreplay#1798)

* fix(chalice): support list of errors in response

* refactor(chalice): global support of missing filter attribute isEvent
  • Loading branch information
tahayk authored Dec 21, 2023
1 parent 2cbcdbb commit ca374a1
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 31 deletions.
3 changes: 2 additions & 1 deletion api/or_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ async def custom_route_handler(request: Request) -> Response:
response: Response = await original_route_handler(request)
except HTTPException as e:
if e.status_code // 100 == 4:
return JSONResponse(content={"errors": [e.detail]}, status_code=e.status_code)
return JSONResponse(content={"errors": e.detail if isinstance(e.detail, list) else [e.detail]},
status_code=e.status_code)
else:
raise e

Expand Down
8 changes: 4 additions & 4 deletions api/requirements-alerts.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Keep this version to not have conflicts between requests and boto3
urllib3==1.26.16
requests==2.31.0
boto3==1.33.8
boto3==1.34.1
pyjwt==2.8.0
psycopg2-binary==2.9.9
psycopg[pool,binary]==3.1.14
elasticsearch==8.11.0
psycopg[pool,binary]==3.1.15
elasticsearch==8.11.1
jira==3.5.2



fastapi==0.104.1
fastapi==0.105.0
uvicorn[standard]==0.23.2
python-decouple==3.8
pydantic[email]==2.3.0
Expand Down
8 changes: 4 additions & 4 deletions api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Keep this version to not have conflicts between requests and boto3
urllib3==1.26.16
requests==2.31.0
boto3==1.33.8
boto3==1.34.1
pyjwt==2.8.0
psycopg2-binary==2.9.9
psycopg[pool,binary]==3.1.14
elasticsearch==8.11.0
psycopg[pool,binary]==3.1.15
elasticsearch==8.11.1
jira==3.5.2



fastapi==0.104.1
fastapi==0.105.0
uvicorn[standard]==0.23.2
python-decouple==3.8
pydantic[email]==2.3.0
Expand Down
24 changes: 13 additions & 11 deletions api/schemas/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .overrides import BaseModel, Enum, ORUnion
from .transformers_validators import transform_email, remove_whitespace, remove_duplicate_values, single_to_list, \
force_is_event, NAME_PATTERN, int_to_string
from pydantic.functional_validators import BeforeValidator


def transform_old_filter_type(cls, values):
Expand Down Expand Up @@ -700,9 +701,17 @@ class SortOrderType(str, Enum):
desc = "DESC"


def add_missing_is_event(values: dict):
if values.get("isEvent") is None:
values["isEvent"] = (EventType.has_value(values["type"])
or PerformanceEventType.has_value(values["type"])
or ProductAnalyticsSelectedEventType.has_value(values["type"]))
return values


# this type is created to allow mixing events&filters and specifying a discriminator
GroupedFilterType = Annotated[Union[SessionSearchFilterSchema, SessionSearchEventSchema2], \
Field(discriminator='is_event')]
Field(discriminator='is_event'), BeforeValidator(add_missing_is_event)]


class SessionsSearchPayloadSchema(_TimedSchema, _PaginatedSchema):
Expand Down Expand Up @@ -732,9 +741,9 @@ def add_missing_attributes(cls, values):
for v in values["events"]:
v["isEvent"] = True

for v in values.get("filters", []):
if v.get("isEvent") is None:
v["isEvent"] = False
# for v in values.get("filters", []):
# if v.get("isEvent") is None:
# v["isEvent"] = False
return values

@model_validator(mode="before")
Expand Down Expand Up @@ -1016,13 +1025,6 @@ def remove_wrong_filter_values(cls, values):
f["value"] = vals
return values

@model_validator(mode="before")
def __force_is_event(cls, values):
for v in values.get("filters", []):
if v.get("isEvent") is None:
v["isEvent"] = ProductAnalyticsSelectedEventType.has_value(v["type"])
return values

@model_validator(mode="before")
def __enforce_default(cls, values):
if values.get("startTimestamp") is None:
Expand Down
3 changes: 2 additions & 1 deletion ee/api/or_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ async def custom_route_handler(request: Request) -> Response:
response: Response = await original_route_handler(request)
except HTTPException as e:
if e.status_code // 100 == 4:
response = JSONResponse(content={"errors": [e.detail]}, status_code=e.status_code)
return JSONResponse(content={"errors": e.detail if isinstance(e.detail, list) else [e.detail]},
status_code=e.status_code)
else:
raise e

Expand Down
6 changes: 3 additions & 3 deletions ee/api/requirements-alerts.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Keep this version to not have conflicts between requests and boto3
urllib3==1.26.16
requests==2.31.0
boto3==1.29.7
boto3==1.34.1
pyjwt==2.8.0
psycopg2-binary==2.9.9
psycopg[pool,binary]==3.1.14
psycopg[pool,binary]==3.1.15
elasticsearch==8.11.0
jira==3.5.2



fastapi==0.104.1
fastapi==0.105.0
uvicorn[standard]==0.23.2
python-decouple==3.8
pydantic[email]==2.3.0
Expand Down
6 changes: 3 additions & 3 deletions ee/api/requirements-crons.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Keep this version to not have conflicts between requests and boto3
urllib3==1.26.16
requests==2.31.0
boto3==1.29.7
boto3==1.34.1
pyjwt==2.8.0
psycopg2-binary==2.9.9
psycopg[pool,binary]==3.1.14
psycopg[pool,binary]==3.1.15
elasticsearch==8.11.0
jira==3.5.2



fastapi==0.104.1
fastapi==0.105.0
python-decouple==3.8
pydantic[email]==2.3.0
apscheduler==3.10.4
Expand Down
8 changes: 4 additions & 4 deletions ee/api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Keep this version to not have conflicts between requests and boto3
urllib3==1.26.16
requests==2.31.0
boto3==1.29.7
boto3==1.34.1
pyjwt==2.8.0
psycopg2-binary==2.9.9
psycopg[pool,binary]==3.1.14
elasticsearch==8.11.0
psycopg[pool,binary]==3.1.15
elasticsearch==8.11.1
jira==3.5.2



fastapi==0.104.1
fastapi==0.105.0
uvicorn[standard]==0.23.2
gunicorn==21.2.0
python-decouple==3.8
Expand Down

0 comments on commit ca374a1

Please sign in to comment.