From a5cd58adb5b7dcd55728185d1ca17c6418d3067b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=B2=D1=8B=D0=B4=D1=8C=D1=8F=D0=BD=20=D0=94?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BB=20=D0=90=D0=BD=D0=B4=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=D0=B8=D1=87?= <19140612@cab-wsm-0603635.sigma.sbrf.ru> Date: Wed, 4 Oct 2023 14:18:56 +0300 Subject: [PATCH] add masking_white_list to SmartAppToMessage --- smart_kit/message/smartapp_to_message.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/smart_kit/message/smartapp_to_message.py b/smart_kit/message/smartapp_to_message.py index b777de94..3ab1a35d 100644 --- a/smart_kit/message/smartapp_to_message.py +++ b/smart_kit/message/smartapp_to_message.py @@ -1,8 +1,9 @@ from functools import cached_property -from typing import Iterable +from typing import Iterable, Optional, List import json from copy import copy +from core.basic_models.actions.command import Command from core.utils.masking_message import masking from core.message.msg_validator import MessageValidator from smart_kit.request.kafka_request import SmartKitKafkaRequest @@ -13,8 +14,9 @@ class SmartAppToMessage: ROOT_NODES_KEY = "root_nodes" PAYLOAD = "payload" - def __init__(self, command, message, request: SmartKitKafkaRequest, forward_fields=None, masking_fields=None, - validators: Iterable[MessageValidator] = (), **kwargs): + def __init__(self, command: Command, message, request: SmartKitKafkaRequest, + forward_fields=None, masking_fields=None, validators: Iterable[MessageValidator] = (), + masking_white_list: Optional[List[str]] = None, **kwargs): root_nodes = command.payload.pop(self.ROOT_NODES_KEY, None) self.command = command self.root_nodes = root_nodes or {} @@ -22,6 +24,7 @@ def __init__(self, command, message, request: SmartKitKafkaRequest, forward_fiel self.request = request self.forward_fields = forward_fields or () self.masking_fields = masking_fields + self.masking_white_list = masking_white_list self.validators = validators self._kwargs = kwargs