update meilis

This commit is contained in:
2025-07-05 15:08:06 -03:00
parent 0df4d7aa71
commit d002828afa
17 changed files with 430 additions and 45 deletions

View File

@@ -19,7 +19,7 @@ def lambda_handler(event: DynamoDBStreamEvent, context: LambdaContext):
with Op(meili_client) as op:
for record in event.records:
pk = record.dynamodb.keys['id'] # type: ignore
new_image = record.dynamodb.new_image # type: ignore
new_image = sanitize(record.dynamodb.new_image) # type: ignore
index = table_from_arn(record.event_source_arn) # type: ignore
op.append(
@@ -32,3 +32,13 @@ def lambda_handler(event: DynamoDBStreamEvent, context: LambdaContext):
def table_from_arn(arn: str) -> str:
arn_ = arnparse(arn)
return arn_.resource.split('/')[0]
# Post-migration: remove the following line
def sanitize(obj):
if isinstance(obj, dict):
return {k.replace(':', '__'): sanitize(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [sanitize(item) for item in obj]
else:
return obj