letschatty 0.6.45__tar.gz → 0.6.46__tar.gz

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 (501) hide show
  1. {letschatty-0.6.45 → letschatty-0.6.46}/PKG-INFO +1 -1
  2. {letschatty-0.6.45 → letschatty-0.6.46}/pyproject.toml +1 -1
  3. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/ai/filter_criteria.py +2 -2
  4. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/company/notifications.py +0 -5
  5. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/crm/__init__.py +2 -1
  6. letschatty-0.6.46/src/letschatty/domain/crm/funnels.py +109 -0
  7. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/crm/products.py +2 -2
  8. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/crm/sales.py +2 -2
  9. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/crm/tags.py +2 -2
  10. letschatty-0.6.46/src/letschatty/domain/sources/__init__.py +3 -0
  11. letschatty-0.6.46/src/letschatty/domain/sources/topics.py +58 -0
  12. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/ai/filter_criteria_repository.py +1 -1
  13. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/crm/__init__.py +2 -1
  14. letschatty-0.6.46/src/letschatty/mongo/crm/funnel_repository.py +77 -0
  15. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/crm/product_repository.py +1 -1
  16. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/crm/sale_repository.py +1 -1
  17. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/crm/tag_repository.py +1 -1
  18. letschatty-0.6.46/src/letschatty/mongo/sources/__init__.py +3 -0
  19. letschatty-0.6.46/src/letschatty/mongo/sources/topic_repository.py +49 -0
  20. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/crm/__init__.py +2 -1
  21. letschatty-0.6.46/src/letschatty/redis/crm/cached_funnel_repository.py +80 -0
  22. letschatty-0.6.46/src/letschatty/redis/sources/__init__.py +3 -0
  23. letschatty-0.6.46/src/letschatty/redis/sources/cached_topic_repository.py +61 -0
  24. {letschatty-0.6.45 → letschatty-0.6.46}/LICENSE +0 -0
  25. {letschatty-0.6.45 → letschatty-0.6.46}/README.md +0 -0
  26. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/__init__.py +0 -0
  27. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/__init__.py +0 -0
  28. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/ai/__init__.py +0 -0
  29. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/company/__init__.py +0 -0
  30. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/crm/form_fields.py +0 -0
  31. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/crm/reminder_categories.py +0 -0
  32. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/messaging/__init__.py +0 -0
  33. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/messaging/fast_answers.py +0 -0
  34. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/domain/whatsapp_accounts.py +0 -0
  35. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/__init__.py +0 -0
  36. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/ai_microservices/__init__.py +0 -0
  37. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/ai_microservices/expected_output.py +0 -0
  38. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/ai_microservices/lambda_events.py +0 -0
  39. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/ai_microservices/lambda_invokation_types.py +0 -0
  40. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/ai_microservices/n8n_ai_agents_payload.py +0 -0
  41. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/ai_microservices/openai_payloads.py +0 -0
  42. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/__init__.py +0 -0
  43. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/__init__.py +0 -0
  44. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/base.py +0 -0
  45. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/ai_agent_chat.py +0 -0
  46. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/ai_agent_escalate_event.py +0 -0
  47. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/ai_agent_execution_event.py +0 -0
  48. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/business_area.py +0 -0
  49. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/chat_based_event.py +0 -0
  50. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/chat_client.py +0 -0
  51. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/chat_context.py +0 -0
  52. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/chat_funnel.py +0 -0
  53. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/chat_reset.py +0 -0
  54. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/chat_status.py +0 -0
  55. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/contact_point.py +0 -0
  56. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/continuous_conversation.py +0 -0
  57. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/highlight.py +0 -0
  58. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/inferred_ad.py +0 -0
  59. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/message.py +0 -0
  60. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/messages_intent_context.py +0 -0
  61. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/product_chat.py +0 -0
  62. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/quality_scoring.py +0 -0
  63. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/sale.py +0 -0
  64. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/tag_chat.py +0 -0
  65. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/chat_based_events/workflow.py +0 -0
  66. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/company_based_events/asset_events.py +0 -0
  67. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/company_based_events/company_events.py +0 -0
  68. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/company_based_events/user_events.py +0 -0
  69. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/event_type_to_classes.py +0 -0
  70. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/event_types.py +0 -0
  71. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/user_notification_intent/HOW-TO-ADD.md +0 -0
  72. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/user_notification_intent/__init__.py +0 -0
  73. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/user_notification_intent/builders.py +0 -0
  74. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/user_notification_intent/event.py +0 -0
  75. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/events/user_notification_intent/metadata.py +0 -0
  76. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/metrics/__init_.py +0 -0
  77. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/metrics/daily_contact_points.py +0 -0
  78. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/metrics/daily_new_chats.py +0 -0
  79. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/metrics/daily_sent_templates_grouped.py +0 -0
  80. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/metrics/sales_roadmap.py +0 -0
  81. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/metrics/sent_templates.py +0 -0
  82. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/smart_messages/friendly_code_for_source.py +0 -0
  83. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/smart_messages/topic.py +0 -0
  84. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/smart_messages/topic_message.py +0 -0
  85. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/__init__.py +0 -0
  86. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/ad_creative.py +0 -0
  87. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/coexistence_echo_source.py +0 -0
  88. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/contact_import_source.py +0 -0
  89. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/google_ad_utm_source.py +0 -0
  90. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/helpers.py +0 -0
  91. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/mapeo_motivo.py +0 -0
  92. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/meta_ad_inferred.py +0 -0
  93. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/meta_post.py +0 -0
  94. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/other_source.py +0 -0
  95. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/pure_ad.py +0 -0
  96. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/pure_ad_utm_source.py +0 -0
  97. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/source_base.py +0 -0
  98. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/template_source.py +0 -0
  99. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/topic_default_source.py +0 -0
  100. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/utm_source.py +0 -0
  101. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/utms/pixel_attribution.py +0 -0
  102. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/utms/referer_info.py +0 -0
  103. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/utms/utm_query_params.py +0 -0
  104. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/analytics/sources/whatsapp_default_source.py +0 -0
  105. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/auth/jwt.py +0 -0
  106. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/__init__.py +0 -0
  107. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/ai_agent_component.py +0 -0
  108. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/chatty_asset_model.py +0 -0
  109. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/helpers.py +0 -0
  110. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/related_asset_usage_example.py +0 -0
  111. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/singleton.py +0 -0
  112. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/update_model_interface.py +0 -0
  113. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/base_models/validate_timestamps_and_id.py +0 -0
  114. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/cache/README.md +0 -0
  115. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/cache/__init__.py +0 -0
  116. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/cache/cache_protocol.py +0 -0
  117. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/cache/no_cache.py +0 -0
  118. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/cache/redis_cache.py +0 -0
  119. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/cache/redis_connection.py +0 -0
  120. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/channels/channel.py +0 -0
  121. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/assets_assigned_to_chat.py +0 -0
  122. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/chat.py +0 -0
  123. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/chat_client_preview.py +0 -0
  124. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/chat_messages_bucket.py +0 -0
  125. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/chat_status_modifications.py +0 -0
  126. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/chat_summary.py +0 -0
  127. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/chat_with_assets.py +0 -0
  128. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/client.py +0 -0
  129. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/coexistence_import_sync.py +0 -0
  130. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/continuous_conversation.py +0 -0
  131. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/executive_followup.py +0 -0
  132. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/filter_parameters.py +0 -0
  133. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/flow_link_state.py +0 -0
  134. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/group_participant.py +0 -0
  135. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/highlight.py +0 -0
  136. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/marcas_de_meta.py +0 -0
  137. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/message_summary.py +0 -0
  138. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/motivo_en_chat.py +0 -0
  139. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/no_contactar.py +0 -0
  140. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/preview.py +0 -0
  141. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/quality_scoring.py +0 -0
  142. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/query_builder.py +0 -0
  143. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/scheduled_messages.py +0 -0
  144. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/seguimiento.py +0 -0
  145. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/seguimiento_estado.py +0 -0
  146. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/temporary_chat.py +0 -0
  147. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/chat/time_left.py +0 -0
  148. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/CRM/business_area.py +0 -0
  149. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/CRM/funnel.py +0 -0
  150. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/__init__.py +0 -0
  151. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/__init__.py +0 -0
  152. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/cintia_execution.py +0 -0
  153. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/events/__init__.py +0 -0
  154. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/events/cintia_event_type.py +0 -0
  155. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/__init__.py +0 -0
  156. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/chat_vector.py +0 -0
  157. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/chatty_asset_embedding.py +0 -0
  158. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/chatty_trigger.py +0 -0
  159. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/cintia_feedback.py +0 -0
  160. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/cintia_trigger.py +0 -0
  161. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/lambda_trigger_events.py +0 -0
  162. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/__init__.py +0 -0
  163. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_assistant_output.py +0 -0
  164. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_audio_transcriber_output.py +0 -0
  165. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_customer_success_output.py +0 -0
  166. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_decision_output.py +0 -0
  167. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_human_capture_output.py +0 -0
  168. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_responder_output.py +0 -0
  169. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_smart_follow_output.py +0 -0
  170. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/cintia_tagger_output.py +0 -0
  171. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/CINTIA/models/outputs/executive_decision_output.py +0 -0
  172. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/__init__.py +0 -0
  173. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/account_scope.py +0 -0
  174. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/ai_agent_message_draft.py +0 -0
  175. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/ai_agents_decision_output.py +0 -0
  176. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/ai_specific_instruction.py +0 -0
  177. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chain_of_thought_in_chat.py +0 -0
  178. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chat_example.py +0 -0
  179. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chat_example_test.py +0 -0
  180. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chatty_ai_agent.py +0 -0
  181. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chatty_ai_agent_config_for_automation.py +0 -0
  182. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chatty_ai_agent_in_chat.py +0 -0
  183. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/chatty_ai_mode.py +0 -0
  184. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/context_item.py +0 -0
  185. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/cs_scenario.py +0 -0
  186. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/data_collection_config.py +0 -0
  187. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/faq.py +0 -0
  188. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/fast_answer_reference.py +0 -0
  189. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/follow_up_strategy.py +0 -0
  190. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/get_chat_with_prompt_response.py +0 -0
  191. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/instruction.py +0 -0
  192. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/knowleadge_base_components.py +0 -0
  193. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/n8n_agents_info.py +0 -0
  194. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/n8n_schema_incoming_message_output.json +0 -0
  195. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/n8n_schema_smart_follow_up_output.json +0 -0
  196. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/pre_qualify_config.py +0 -0
  197. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/ai_agents_v2/tag_reference.py +0 -0
  198. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/asset_model_registry.py +0 -0
  199. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/assignment/__init__.py +0 -0
  200. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/assignment/assignment_assets.py +0 -0
  201. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/__init__.py +0 -0
  202. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/accion.py +0 -0
  203. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/acciones_basicas.py +0 -0
  204. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/acciones_fijas.py +0 -0
  205. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/al_responder.py +0 -0
  206. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/capacidad.py +0 -0
  207. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/entradas.py +0 -0
  208. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/herencia.py +0 -0
  209. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/precalificacion.py +0 -0
  210. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/recetas.py +0 -0
  211. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/atencion/seguimientos.py +0 -0
  212. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/automation.py +0 -0
  213. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/chat_assets.py +0 -0
  214. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/chatty_fast_answers/__init__.py +0 -0
  215. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/chatty_fast_answers/chatty_fast_answer.py +0 -0
  216. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/company_assets.py +0 -0
  217. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/contact_point.py +0 -0
  218. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/embeddable.py +0 -0
  219. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/filter_criteria.py +0 -0
  220. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/flow.py +0 -0
  221. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/inferred_attribution.py +0 -0
  222. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/launch/__init__.py +0 -0
  223. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/launch/launch.py +0 -0
  224. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/launch/scheduled_communication.py +0 -0
  225. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/launch/subscription.py +0 -0
  226. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/media/__init__.py +0 -0
  227. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/media/file.py +0 -0
  228. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/media/media_asset.py +0 -0
  229. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/motivo.py +0 -0
  230. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/notification.py +0 -0
  231. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/product.py +0 -0
  232. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/product_parameter_embed_config.py +0 -0
  233. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/recepcion.py +0 -0
  234. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/recordatorio.py +0 -0
  235. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/recordatorio_categoria.py +0 -0
  236. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/sale.py +0 -0
  237. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/sin_producto.py +0 -0
  238. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/tag.py +0 -0
  239. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/users/agent_chats_snapshot.py +0 -0
  240. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/users/permissions.py +0 -0
  241. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/users/user.py +0 -0
  242. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/users/user_asset_permission.py +0 -0
  243. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/assets/workflow_execution.py +0 -0
  244. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/company_chats_snapshot.py +0 -0
  245. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/company_messaging_settgins.py +0 -0
  246. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/conversation_topic.py +0 -0
  247. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/empresa.py +0 -0
  248. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/form_field.py +0 -0
  249. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/home_widget.py +0 -0
  250. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/insight.py +0 -0
  251. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/product_sync_status.py +0 -0
  252. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/shopify/company_shopify_integration.py +0 -0
  253. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/shopify/shopify_product_sync_status.py +0 -0
  254. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/shopify/shopify_webhook_topics.py +0 -0
  255. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/sync_status_enum.py +0 -0
  256. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/tienda_nube/company_tienda_nube_integration.py +0 -0
  257. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/tienda_nube/tienda_nube_product_sync_status.py +0 -0
  258. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/integrations/tienda_nube/tienda_nube_webhook_topics.py +0 -0
  259. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/company/notifications/notification.py +0 -0
  260. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/copilot/links.py +0 -0
  261. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/data_base/README.md +0 -0
  262. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/data_base/__init__.py +0 -0
  263. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/data_base/collection_interface.py +0 -0
  264. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/data_base/mongo_connection.py +0 -0
  265. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/execution/__init__.py +0 -0
  266. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/execution/execution.py +0 -0
  267. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/execution/executor.py +0 -0
  268. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/forms/company/auth0_company_registration_form.py +0 -0
  269. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/forms/company/meta_register.py +0 -0
  270. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/__init__.py +0 -0
  271. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/__init__.py +0 -0
  272. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/audio.py +0 -0
  273. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/base/__init__.py +0 -0
  274. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/base/chatty_message_json.py +0 -0
  275. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/base/message_base.py +0 -0
  276. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/base/message_draft.py +0 -0
  277. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/button.py +0 -0
  278. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/central_notification.py +0 -0
  279. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/contact.py +0 -0
  280. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/document.py +0 -0
  281. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/image.py +0 -0
  282. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/interactive.py +0 -0
  283. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/location.py +0 -0
  284. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/reaction.py +0 -0
  285. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/__init__.py +0 -0
  286. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_audio.py +0 -0
  287. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_button.py +0 -0
  288. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_central.py +0 -0
  289. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_contacts.py +0 -0
  290. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_document.py +0 -0
  291. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_image.py +0 -0
  292. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_interactive.py +0 -0
  293. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_location.py +0 -0
  294. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_media.py +0 -0
  295. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_reaction.py +0 -0
  296. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_sticker.py +0 -0
  297. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_text.py +0 -0
  298. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_content/content_video.py +0 -0
  299. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_context/__init__.py +0 -0
  300. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_context/chatty_context.py +0 -0
  301. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_context/template_rendering.py +0 -0
  302. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_referal/__init__.py +0 -0
  303. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/schema/chatty_referal/chatty_referal.py +0 -0
  304. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/sticker.py +0 -0
  305. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/text.py +0 -0
  306. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/chatty_messages/video.py +0 -0
  307. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/__init__.py +0 -0
  308. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/chatty_template_campaign.py +0 -0
  309. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/filled_data_from_frontend.py +0 -0
  310. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/header_media.py +0 -0
  311. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/meta_template.py +0 -0
  312. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/payload_for_sending_template.py +0 -0
  313. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/raw_meta_template.py +0 -0
  314. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/recipient_of_template_campaign.py +0 -0
  315. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/message_templates/required_for_frontend_templates.py +0 -0
  316. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_base_notification_json.py +0 -0
  317. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_echo_json.py +0 -0
  318. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_error_json.py +0 -0
  319. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_group_json.py +0 -0
  320. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_history_json.py +0 -0
  321. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_inexistent_json.py +0 -0
  322. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_message_json.py +0 -0
  323. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_state_sync_json.py +0 -0
  324. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_status_json.py +0 -0
  325. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_template_webhook_json.py +0 -0
  326. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/meta_unknown_json.py +0 -0
  327. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/__init__.py +0 -0
  328. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/button_content.py +0 -0
  329. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/contacts_content.py +0 -0
  330. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/interactive_content.py +0 -0
  331. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/location_content.py +0 -0
  332. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/multimedia_content.py +0 -0
  333. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/order_content.py +0 -0
  334. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/reaction_content.py +0 -0
  335. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/system_content.py +0 -0
  336. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/content_messages/text_content.py +0 -0
  337. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/values/__init__.py +0 -0
  338. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/values/motivos_de_no_entrega.py +0 -0
  339. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/values/value_errors.py +0 -0
  340. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/values/value_messages.py +0 -0
  341. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/messages/meta_message_model/schema/values/value_statuses.py +0 -0
  342. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/push_notifications/__init__.py +0 -0
  343. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/push_notifications/enums.py +0 -0
  344. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/push_notifications/user_device.py +0 -0
  345. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/__init__.py +0 -0
  346. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/custom_exceptions/__init__.py +0 -0
  347. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/custom_exceptions/custom_exceptions.py +0 -0
  348. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/definitions.py +0 -0
  349. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/CRUD_operations.py +0 -0
  350. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/__init__.py +0 -0
  351. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/channel_types.py +0 -0
  352. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/chats_actions.py +0 -0
  353. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/country.py +0 -0
  354. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/deletion_type.py +0 -0
  355. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/executor_types.py +0 -0
  356. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/identifier.py +0 -0
  357. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/message_status_types.py +0 -0
  358. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/message_types.py +0 -0
  359. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/phone_number.py +0 -0
  360. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/serializer_type.py +0 -0
  361. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/source_types.py +0 -0
  362. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/utils/types/typealiases.py +0 -0
  363. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/__init__.py +0 -0
  364. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/account_context.py +0 -0
  365. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/exceptions.py +0 -0
  366. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/ownership.py +0 -0
  367. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/portfolio_bsuid.py +0 -0
  368. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/time.py +0 -0
  369. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/whatsapp_account.py +0 -0
  370. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/whatsapp_business_account.py +0 -0
  371. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/models/whatsapp/whatsapp_number.py +0 -0
  372. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/__init__.py +0 -0
  373. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/ai/__init__.py +0 -0
  374. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/company/__init__.py +0 -0
  375. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/company/notification_repository.py +0 -0
  376. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/crm/form_field_repository.py +0 -0
  377. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/crm/reminder_category_repository.py +0 -0
  378. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/messaging/__init__.py +0 -0
  379. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/mongo/messaging/fast_answer_repository.py +0 -0
  380. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/package_version.py +0 -0
  381. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/__init__.py +0 -0
  382. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/ai/__init__.py +0 -0
  383. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/ai/cached_filter_criteria_repository.py +0 -0
  384. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/asset_cache.py +0 -0
  385. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/company/__init__.py +0 -0
  386. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/company/cached_notification_repository.py +0 -0
  387. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/crm/cached_form_field_repository.py +0 -0
  388. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/crm/cached_product_repository.py +0 -0
  389. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/crm/cached_reminder_category_repository.py +0 -0
  390. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/crm/cached_sale_repository.py +0 -0
  391. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/crm/cached_tag_repository.py +0 -0
  392. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/messaging/__init__.py +0 -0
  393. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/redis/messaging/cached_fast_answer_repository.py +0 -0
  394. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/__init__.py +0 -0
  395. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/context_builder_v2.py +0 -0
  396. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/cot_follow_up_examples.py +0 -0
  397. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/followup_schema.json +0 -0
  398. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/smart_follow_up_context_builder_v2.py +0 -0
  399. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/smart_follow_up_service_v2.py +0 -0
  400. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/tool_descriptions/assign_chat_to_ai_agent_itself.json +0 -0
  401. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/tool_descriptions/human_handover.json +0 -0
  402. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_agents/tool_descriptions.py +0 -0
  403. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/ai_components_service.py +0 -0
  404. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chat/chat_service.py +0 -0
  405. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chat/client_service.py +0 -0
  406. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chat/conversation_topics_service.py +0 -0
  407. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chat/whatsapp_apb_mode_service.py +0 -0
  408. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/__init__.py +0 -0
  409. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/asset_service.py +0 -0
  410. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/assets_collections.py +0 -0
  411. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/base_container_with_collection.py +0 -0
  412. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/__init__.py +0 -0
  413. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/ai_agent_collection.py +0 -0
  414. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/ai_agent_in_chat_collection.py +0 -0
  415. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/ai_component_collection.py +0 -0
  416. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/chain_of_thought_collection.py +0 -0
  417. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/chat_collection.py +0 -0
  418. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/chat_flow_state_collection.py +0 -0
  419. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/chat_messages_collection.py +0 -0
  420. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/chat_summary_pipeline.py +0 -0
  421. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/client_collection.py +0 -0
  422. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/contact_point_collection.py +0 -0
  423. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/fast_answer_collection.py +0 -0
  424. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/filter_criteria_collection.py +0 -0
  425. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/flow_collection.py +0 -0
  426. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/form_field_collection.py +0 -0
  427. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/media_asset_collection.py +0 -0
  428. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/product_collection.py +0 -0
  429. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/sale_collection.py +0 -0
  430. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/source_collection.py +0 -0
  431. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/tag_collection.py +0 -0
  432. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/topic_collection.py +0 -0
  433. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/collections/user_collection.py +0 -0
  434. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/documentation_diagram.png +0 -0
  435. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/example_usage.py +0 -0
  436. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/readme.md +0 -0
  437. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/__init__.py +0 -0
  438. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/ai_agent_in_chat_service.py +0 -0
  439. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/ai_agent_service.py +0 -0
  440. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/chain_of_thought_service.py +0 -0
  441. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/chat_loader.py +0 -0
  442. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/chat_service.py +0 -0
  443. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/contact_point_service.py +0 -0
  444. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/fast_answer_service.py +0 -0
  445. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/filter_criteria_service.py +0 -0
  446. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/flow_service.py +0 -0
  447. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/product_service.py +0 -0
  448. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/sale_service.py +0 -0
  449. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/source_service.py +0 -0
  450. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/tag_service.py +0 -0
  451. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/topic_service.py +0 -0
  452. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/chatty_assets/services/user_service.py +0 -0
  453. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/concurrent/concurrent.py +0 -0
  454. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/contact_points/contact_point_service.py +0 -0
  455. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/continuous_conversation_service/continuous_conversation_helper.py +0 -0
  456. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/events/__init__.py +0 -0
  457. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/events/events_manager.py +0 -0
  458. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/__init__.py +0 -0
  459. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/analytics/ai_agent_event_factory.py +0 -0
  460. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/analytics/contact_point_factory.py +0 -0
  461. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/analytics/events_factory.py +0 -0
  462. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/analytics/smart_messages/topics_factory.py +0 -0
  463. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/analytics/sources/helpers.py +0 -0
  464. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/analytics/sources/source_factory.py +0 -0
  465. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/chats/chat_factory.py +0 -0
  466. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/chatty_fast_answers/__init__.py +0 -0
  467. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/chatty_fast_answers/chatty_fast_answers_factory.py +0 -0
  468. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/clients/client_factory.py +0 -0
  469. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/company/__init__.py +0 -0
  470. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/company/empresa_factory.py +0 -0
  471. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/lambda_ai_orchestrartor/lambda_events_factory.py +0 -0
  472. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/__init__.py +0 -0
  473. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/central_notification_factory.py +0 -0
  474. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/chatty_message_factory.py +0 -0
  475. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/child_db_message_factory.py +0 -0
  476. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/child_request_message.py +0 -0
  477. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/from_template_hot_fix.py +0 -0
  478. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/message_templates/component_builders.py +0 -0
  479. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/message_templates/template_factory.py +0 -0
  480. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/messages/message_templates/test.py +0 -0
  481. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/meta_notifications/__init__.py +0 -0
  482. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/meta_notifications/meta_notification_factory.py +0 -0
  483. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/factories/product_factory.py +0 -0
  484. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/filter_criteria_service.py +0 -0
  485. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/messages_helpers/__init__.py +0 -0
  486. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/messages_helpers/get_caption_or_body_or_preview.py +0 -0
  487. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/scheduled_messages_service/scheduled_messages_helpers.py +0 -0
  488. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/template_campaigns/template_campaign_service.py +0 -0
  489. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/users/agent_service.py +0 -0
  490. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/users/user_factory.py +0 -0
  491. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/validators/analytics_validator.py +0 -0
  492. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/__init__.py +0 -0
  493. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/account_floor.py +0 -0
  494. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/chat_scope.py +0 -0
  495. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/connect_number.py +0 -0
  496. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/directory.py +0 -0
  497. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/in_memory.py +0 -0
  498. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/indexes.py +0 -0
  499. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/mongo_repositories.py +0 -0
  500. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/repositories.py +0 -0
  501. {letschatty-0.6.45 → letschatty-0.6.46}/src/letschatty/services/whatsapp_accounts/source_scope.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: letschatty
3
- Version: 0.6.45
3
+ Version: 0.6.46
4
4
  Summary: Models and custom classes to work across the Chattyverse
5
5
  License: MIT
6
6
  Author: Axel
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "letschatty"
3
3
 
4
- version = "0.6.45"
4
+ version = "0.6.46"
5
5
 
6
6
  description = "Models and custom classes to work across the Chattyverse"
7
7
  authors = ["Axel <axel@letschatty.com>"]
@@ -3,8 +3,8 @@
3
3
  The entity is `letschatty.models.company.assets.filter_criteria.FilterCriteria`, unchanged: CINTIA writes the
4
4
  same documents straight to Mongo. Matching a chat against criteria is `services.filter_criteria_service`.
5
5
 
6
- Every method takes the company. Today the stores do not filter by it yet (ENG-10): the fix is in the adapters,
7
- and callers already pass the right company.
6
+ Every method takes the company; the repository does not filter by it. Per ADR-007, the use case checks
7
+ the company with a shared helper (`of_the_company` in api-chatty), and ENG-10 will be fixed there.
8
8
  """
9
9
  from __future__ import annotations
10
10
 
@@ -50,11 +50,6 @@ def is_global(notification: Notification) -> bool:
50
50
  return notification.company_id == GLOBAL_COMPANY_ID
51
51
 
52
52
 
53
- def readable_by(notification: Notification, company_id: StrObjectId) -> bool:
54
- """A company reads its own notifications and the global ones, never another company's."""
55
- return notification.company_id == company_id or is_global(notification)
56
-
57
-
58
53
  def is_dismiss_only(changes: Any) -> bool:
59
54
  """The body of closing a banner: only `dismissed`/`dismissed_at` (a body that is not a dict never is)."""
60
55
  return isinstance(changes, dict) and set(changes.keys()).issubset(DISMISS_FIELDS)
@@ -1,7 +1,8 @@
1
+ from .funnels import FunnelRepository
1
2
  from .form_fields import FormFieldRepository
2
3
  from .products import ProductRepository
3
4
  from .reminder_categories import ReminderCategoryRepository
4
5
  from .tags import TagRepository
5
6
  from .sales import SaleRepository
6
7
 
7
- __all__ = ["FormFieldRepository", "ProductRepository", "ReminderCategoryRepository", "SaleRepository", "TagRepository"]
8
+ __all__ = ["FunnelRepository", "FormFieldRepository", "ProductRepository", "ReminderCategoryRepository", "SaleRepository", "TagRepository"]
@@ -0,0 +1,109 @@
1
+ """Funnels of a company («embudos»): the port of the aggregate and the rules of its stages.
2
+
3
+ A funnel and its stages are one aggregate: a stage does not exist without its funnel, and the rules about the order
4
+ of the stages are the funnel's. They are stored in two collections (`funnels`, `funnel_stages`) that other services
5
+ read directly, so the documents keep their shape; one repository reads and writes both. The entities are
6
+ `letschatty.models.company.CRM.funnel.Funnel` and `FunnelStage`, unchanged.
7
+
8
+ The chat in a funnel (`chat_funnels`, `chats.active_funnel`) is another module.
9
+ """
10
+ from __future__ import annotations
11
+
12
+ from typing import Any, Dict, List, Protocol, Sequence
13
+
14
+ from ...models.company.CRM.funnel import Funnel, FunnelStage
15
+ from ...models.utils.types import StrObjectId
16
+
17
+
18
+ class StageOrderRejected(Exception):
19
+ """An edit gives a stage an order out of range or taken by a sibling."""
20
+
21
+
22
+ class ReorderRejected(Exception):
23
+ """A reorder that is not every stage of the funnel exactly once."""
24
+
25
+
26
+ class StageHasChats(Exception):
27
+ """A stage with chats in it cannot be deleted."""
28
+
29
+
30
+ def next_stage_order(stage_previews: Sequence[Dict[str, Any]]) -> int:
31
+ """Where a new stage goes when the request does not say: after the last one (0 in an empty funnel)."""
32
+ if not stage_previews:
33
+ return 0
34
+ return max(s.get("order", 0) for s in stage_previews) + 1
35
+
36
+
37
+ def check_stage_order(stage_id: StrObjectId, new_order: int, stages: Sequence[FunnelStage]) -> None:
38
+ """`new_order` has to be a position of the funnel (0…N-1) that no other stage holds."""
39
+ total = len(stages)
40
+ if new_order < 0 or new_order >= total:
41
+ raise StageOrderRejected(f"Order must be between 0 and {total - 1} (inclusive). Got {new_order}.")
42
+ for stage in stages:
43
+ if stage.id != stage_id and stage.order == new_order:
44
+ raise StageOrderRejected(
45
+ f"Order {new_order} is already assigned to stage '{stage.name}' (ID: {stage.id}). "
46
+ f"Each stage must have a unique order.")
47
+
48
+
49
+ def check_reorder(stage_ids: Sequence[StrObjectId], stages: Sequence[FunnelStage]) -> None:
50
+ """A reorder lists every live stage of the funnel, each once."""
51
+ if len(stage_ids) != len(set(stage_ids)):
52
+ raise ReorderRejected("Duplicate stage IDs found in reorder request. Each stage can only appear once.")
53
+ expected, provided = {stage.id for stage in stages}, set(stage_ids)
54
+ if provided != expected:
55
+ missing, extra = expected - provided, provided - expected
56
+ message = "All stages in the funnel must be included in the reorder request."
57
+ if missing:
58
+ message += f" Missing stages: {missing}"
59
+ if extra:
60
+ message += f" Extra stages (not in funnel): {extra}"
61
+ raise ReorderRejected(message)
62
+
63
+
64
+ def refuse_deleting_a_stage_with_chats(stage: FunnelStage, chats_in_stage: int) -> None:
65
+ if chats_in_stage:
66
+ raise StageHasChats(
67
+ f"No se puede eliminar la etapa '{stage.name}' porque tiene {chats_in_stage} chat(s). "
68
+ f"Mové los chats a otra etapa antes de eliminarla.")
69
+
70
+
71
+ class FunnelRepository(Protocol):
72
+ """Gets bring a funnel or a stage by id, of any company and also deleted; a missing one raises `NotFoundError`
73
+ (and `InvalidId` for a malformed id). Lists are the company's live ones."""
74
+
75
+ async def get(self, funnel_id: StrObjectId) -> Funnel: ...
76
+
77
+ async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
78
+ """Live funnels of the company, newest first, as JSON-ready preview dicts."""
79
+ ...
80
+
81
+ async def add(self, funnel: Funnel) -> Funnel: ...
82
+
83
+ async def update(self, funnel_id: StrObjectId, changes: Funnel) -> Funnel:
84
+ """Writes only the fields `changes` was built with, on top of what is stored now."""
85
+ ...
86
+
87
+ async def delete(self, funnel_id: StrObjectId) -> Funnel:
88
+ """Marks it deleted (the document stays) and returns it as it was before."""
89
+ ...
90
+
91
+ async def get_stage(self, stage_id: StrObjectId) -> FunnelStage: ...
92
+
93
+ async def list_stage_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
94
+ """Live stages of every funnel of the company, newest first, as JSON-ready preview dicts."""
95
+ ...
96
+
97
+ async def list_stages(self, company_id: StrObjectId) -> List[FunnelStage]:
98
+ """Live stages of every funnel of the company."""
99
+ ...
100
+
101
+ async def add_stage(self, stage: FunnelStage) -> FunnelStage: ...
102
+
103
+ async def update_stage(self, stage_id: StrObjectId, changes: FunnelStage) -> FunnelStage:
104
+ """Writes only the fields `changes` was built with, on top of what is stored now."""
105
+ ...
106
+
107
+ async def delete_stage(self, stage_id: StrObjectId) -> FunnelStage:
108
+ """Marks it deleted (the document stays) and returns it as it was before."""
109
+ ...
@@ -4,8 +4,8 @@ The entity is `letschatty.models.company.assets.product.Product`, unchanged: oth
4
4
  copilot, products-lambda) import it. Putting a product on a chat is a rule of the chat
5
5
  (`ChatService.add_product`), not of the catalog.
6
6
 
7
- Every method takes the company. Today the stores do not filter by it yet (ENG-10): the fix is in the
8
- adapters, and callers already pass the right company.
7
+ Every method takes the company; the repository does not filter by it. Per ADR-007, the use case checks
8
+ the company with a shared helper (`of_the_company` in api-chatty), and ENG-10 will be fixed there.
9
9
  """
10
10
  from __future__ import annotations
11
11
 
@@ -4,8 +4,8 @@ The entity is `letschatty.models.company.assets.sale.Sale`, unchanged: other ser
4
4
  analytics, campaigns) import it, and its rules (lines, derived `product_id`, editing with `con_cambios`)
5
5
  already are pure. Putting a sale on a chat is a rule of the chat (`ChatService.create_sale`).
6
6
 
7
- Every method takes the company. The stores do not filter by it yet (ENG-10): callers already pass the
8
- right one, and the fix goes in the adapters.
7
+ Every method takes the company; the repository does not filter by it. Per ADR-007, the use case checks
8
+ the company with a shared helper (`of_the_company` in api-chatty), and ENG-10 will be fixed there.
9
9
  """
10
10
  from __future__ import annotations
11
11
 
@@ -4,8 +4,8 @@ The entity is `letschatty.models.company.assets.tag.Tag`, unchanged: other servi
4
4
  campaigns) import it. Assigning a tag to a chat is a rule of the chat (`ChatService.add_tag`), not of
5
5
  the catalog.
6
6
 
7
- Every method takes the company. Today the stores do not filter by it yet (ENG-10): the fix is in the
8
- adapters, and callers already pass the right company.
7
+ Every method takes the company; the repository does not filter by it. Per ADR-007, the use case checks
8
+ the company with a shared helper (`of_the_company` in api-chatty), and ENG-10 will be fixed there.
9
9
  """
10
10
  from __future__ import annotations
11
11
 
@@ -0,0 +1,3 @@
1
+ from .topics import TopicRepository, has_locked_messages, message_status
2
+
3
+ __all__ = ["TopicRepository", "has_locked_messages", "message_status"]
@@ -0,0 +1,58 @@
1
+ """Smart-message topics («temas»): the port every topic store implements, and the lock rules of a topic.
2
+
3
+ A topic is its own aggregate: its `messages` (the texts a click reserves, «slots») are part of it. The entity is
4
+ `letschatty.models.analytics.smart_messages.topic.Topic`, unchanged. A read by id is NOT scoped to a company: the use
5
+ case checks the company (ADR-007). A deleted topic is still returned by id.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ from typing import Any, Dict, List, Protocol
10
+
11
+ from ...models.analytics.smart_messages.topic import Topic
12
+ from ...models.analytics.smart_messages.topic_message import MessageTopic, MessageTopicStatus
13
+ from ...models.utils.types import StrObjectId
14
+
15
+
16
+ class TopicRepository(Protocol):
17
+ """Raises `NotFoundError` when no topic has that id."""
18
+
19
+ async def get(self, topic_id: StrObjectId) -> Topic:
20
+ """By id, whatever its company, also a deleted one."""
21
+ ...
22
+
23
+ async def list(self, company_id: StrObjectId) -> List[Topic]:
24
+ """Live topics of the company, whole (the texts are checked against them)."""
25
+ ...
26
+
27
+ async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
28
+ """Live topics of the company, newest first, as JSON-ready preview dicts (with `account_id`, no `messages`)."""
29
+ ...
30
+
31
+ async def add(self, topic: Topic) -> Topic: ...
32
+
33
+ async def update(self, topic_id: StrObjectId, changes: Topic) -> Topic:
34
+ """Writes only the fields `changes` was built with, merged onto what is in the store now."""
35
+ ...
36
+
37
+ async def save_messages(self, topic: Topic) -> None:
38
+ """Writes only `messages` (and `updated_at`): the lock state of a click or an incoming message. The copy may
39
+ be a cached one, so the rest of the document is never rewritten from it."""
40
+ ...
41
+
42
+ async def delete(self, topic_id: StrObjectId) -> Topic:
43
+ """Marks it deleted (the document stays) and returns it as it was before."""
44
+ ...
45
+
46
+
47
+ def message_status(topic: Topic, message: MessageTopic) -> MessageTopicStatus:
48
+ """Not locked = available; locked for longer than the topic's `lock_duration` = expired; else locked. A message
49
+ marked locked without `lock_time` raises `TypeError` (comparing None), as it always did."""
50
+ if message.is_locked:
51
+ if message.time_locked > topic.lock_duration:
52
+ return MessageTopicStatus.EXPIRED
53
+ return MessageTopicStatus.LOCKED
54
+ return MessageTopicStatus.AVAILABLE
55
+
56
+
57
+ def has_locked_messages(topic: Topic) -> bool:
58
+ return any(message_status(topic, m) == MessageTopicStatus.LOCKED for m in topic.messages)
@@ -15,7 +15,7 @@ class MongoFilterCriteriaRepository:
15
15
  self.collection = collection
16
16
 
17
17
  async def get(self, company_id: StrObjectId, filter_criteria_id: StrObjectId) -> FilterCriteria:
18
- # ENG-10: not filtered by company yet; another company's filter criteria is returned.
18
+ # Not filtered by company: the use case checks it (ADR-007, ENG-10).
19
19
  return await self.collection.get_by_id(filter_criteria_id)
20
20
 
21
21
  async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
@@ -1,7 +1,8 @@
1
+ from .funnel_repository import MongoFunnelRepository
1
2
  from .form_field_repository import MongoFormFieldRepository
2
3
  from .product_repository import MongoProductRepository
3
4
  from .reminder_category_repository import MongoReminderCategoryRepository
4
5
  from .tag_repository import MongoTagRepository
5
6
  from .sale_repository import MongoSaleRepository
6
7
 
7
- __all__ = ["MongoFormFieldRepository", "MongoProductRepository", "MongoReminderCategoryRepository", "MongoSaleRepository", "MongoTagRepository"]
8
+ __all__ = ["MongoFunnelRepository", "MongoFormFieldRepository", "MongoProductRepository", "MongoReminderCategoryRepository", "MongoSaleRepository", "MongoTagRepository"]
@@ -0,0 +1,77 @@
1
+ """`FunnelRepository` on the `funnels` and `funnel_stages` collections. Only Mongo: the cache is a decorator
2
+ (ADR-001)."""
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, List
6
+
7
+ from ...models.company.CRM.funnel import Funnel, FunnelStage
8
+ from ...models.data_base.collection_interface import ChattyAssetCollectionInterface
9
+ from ...models.utils.types import StrObjectId
10
+
11
+
12
+ class MongoFunnelRepository:
13
+ """Reuses the collections the asset services were built on, so the stored documents keep their shape."""
14
+
15
+ def __init__(self, funnels: ChattyAssetCollectionInterface, stages: ChattyAssetCollectionInterface):
16
+ self.funnels, self.stages = funnels, stages
17
+
18
+ async def get(self, funnel_id: StrObjectId) -> Funnel:
19
+ return await self.funnels.get_by_id(funnel_id)
20
+
21
+ async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
22
+ return await _previews(self.funnels, Funnel, company_id)
23
+
24
+ async def add(self, funnel: Funnel) -> Funnel:
25
+ await self.funnels.insert(funnel)
26
+ return funnel
27
+
28
+ async def update(self, funnel_id: StrObjectId, changes: Funnel) -> Funnel:
29
+ return await _update(self.funnels, funnel_id, changes)
30
+
31
+ async def delete(self, funnel_id: StrObjectId) -> Funnel:
32
+ existing = await self.get(funnel_id)
33
+ await self.mark_deleted(funnel_id)
34
+ return existing
35
+
36
+ async def mark_deleted(self, funnel_id: StrObjectId) -> None:
37
+ """Only the write: for the cache decorator, which already read it through the cache."""
38
+ await self.funnels.delete(funnel_id)
39
+
40
+ async def get_stage(self, stage_id: StrObjectId) -> FunnelStage:
41
+ return await self.stages.get_by_id(stage_id)
42
+
43
+ async def list_stage_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
44
+ return await _previews(self.stages, FunnelStage, company_id)
45
+
46
+ async def list_stages(self, company_id: StrObjectId) -> List[FunnelStage]:
47
+ return await self.stages.get_docs(company_id=company_id, query={"deleted_at": None})
48
+
49
+ async def add_stage(self, stage: FunnelStage) -> FunnelStage:
50
+ await self.stages.insert(stage)
51
+ return stage
52
+
53
+ async def update_stage(self, stage_id: StrObjectId, changes: FunnelStage) -> FunnelStage:
54
+ return await _update(self.stages, stage_id, changes)
55
+
56
+ async def delete_stage(self, stage_id: StrObjectId) -> FunnelStage:
57
+ existing = await self.get_stage(stage_id)
58
+ await self.mark_stage_deleted(stage_id)
59
+ return existing
60
+
61
+ async def mark_stage_deleted(self, stage_id: StrObjectId) -> None:
62
+ """Only the write: for the cache decorator, which already read it through the cache."""
63
+ await self.stages.delete(stage_id)
64
+
65
+
66
+ async def _previews(collection, model, company_id) -> List[Dict[str, Any]]:
67
+ previews = await collection.get_preview_docs(
68
+ projection=model.preview_class.get_projection(), all=False, company_id=company_id)
69
+ return [preview.model_dump(mode="json") for preview in previews]
70
+
71
+
72
+ async def _update(collection, item_id, changes):
73
+ """Merged onto what is in Mongo now, writing only what was sent (the asset service's `update`)."""
74
+ existing = await collection.get_by_id(item_id)
75
+ merged, sent_fields = existing.merge(changes)
76
+ await collection.update_fields(merged, sent_fields)
77
+ return merged
@@ -16,7 +16,7 @@ class MongoProductRepository:
16
16
  self.collection = collection
17
17
 
18
18
  async def get(self, company_id: StrObjectId, product_id: StrObjectId) -> Product:
19
- # ENG-10: not filtered by company yet; another company's product is returned.
19
+ # Not filtered by company: the use case checks it (ADR-007, ENG-10).
20
20
  return await self.collection.get_by_id(product_id)
21
21
 
22
22
  async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
@@ -16,7 +16,7 @@ class MongoSaleRepository:
16
16
  self.collection = collection
17
17
 
18
18
  async def get(self, company_id: StrObjectId, sale_id: StrObjectId) -> Sale:
19
- # ENG-10: not filtered by company yet.
19
+ # Not filtered by company: the use case checks it (ADR-007, ENG-10).
20
20
  return await self.collection.get_by_id(sale_id)
21
21
 
22
22
  async def find_live_by_crm_id(self, company_id: StrObjectId, crm_id: str, limit: int) -> List[Sale]:
@@ -15,7 +15,7 @@ class MongoTagRepository:
15
15
  self.collection = collection
16
16
 
17
17
  async def get(self, company_id: StrObjectId, tag_id: StrObjectId) -> Tag:
18
- # ENG-10: not filtered by company yet; another company's tag is returned.
18
+ # Not filtered by company: the use case checks it (ADR-007, ENG-10).
19
19
  return await self.collection.get_by_id(tag_id)
20
20
 
21
21
  async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
@@ -0,0 +1,3 @@
1
+ from .topic_repository import MongoTopicRepository
2
+
3
+ __all__ = ["MongoTopicRepository"]
@@ -0,0 +1,49 @@
1
+ """`TopicRepository` on the `topics` collection. Only Mongo: the cache is a decorator (ADR-001)."""
2
+ from __future__ import annotations
3
+
4
+ from typing import Any, Dict, List
5
+
6
+ from ...models.analytics.smart_messages.topic import Topic
7
+ from ...models.utils.types import StrObjectId
8
+ from ...services.chatty_assets.collections.topic_collection import TopicCollection
9
+
10
+
11
+ class MongoTopicRepository:
12
+ """Reuses `TopicCollection`, so the stored document keeps exactly the shape the smart messages read."""
13
+
14
+ def __init__(self, collection: TopicCollection):
15
+ self.collection = collection
16
+
17
+ async def get(self, topic_id: StrObjectId) -> Topic:
18
+ return await self.collection.get_by_id(topic_id)
19
+
20
+ async def list(self, company_id: StrObjectId) -> List[Topic]:
21
+ return await self.collection.get_docs(company_id=company_id, query={"deleted_at": None})
22
+
23
+ async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
24
+ previews = await self.collection.get_preview_docs(
25
+ projection=Topic.preview_class.get_projection(), all=False, company_id=company_id
26
+ )
27
+ return [preview.model_dump(mode="json") for preview in previews]
28
+
29
+ async def add(self, topic: Topic) -> Topic:
30
+ await self.collection.insert(topic)
31
+ return topic
32
+
33
+ async def update(self, topic_id: StrObjectId, changes: Topic) -> Topic:
34
+ existing = await self.collection.get_by_id(topic_id)
35
+ merged, sent_fields = existing.merge(changes)
36
+ await self.collection.update_fields(merged, sent_fields)
37
+ return merged
38
+
39
+ async def save_messages(self, topic: Topic) -> None:
40
+ await self.collection.update_fields(topic, {"messages"})
41
+
42
+ async def delete(self, topic_id: StrObjectId) -> Topic:
43
+ existing = await self.get(topic_id)
44
+ await self.mark_deleted(topic_id)
45
+ return existing
46
+
47
+ async def mark_deleted(self, topic_id: StrObjectId) -> None:
48
+ """Only the write: for the cache decorator, which already read it through the cache."""
49
+ await self.collection.delete(topic_id)
@@ -1,7 +1,8 @@
1
+ from .cached_funnel_repository import CachedFunnelRepository
1
2
  from .cached_form_field_repository import CachedFormFieldRepository
2
3
  from .cached_product_repository import CachedProductRepository
3
4
  from .cached_reminder_category_repository import CachedReminderCategoryRepository
4
5
  from .cached_tag_repository import CachedTagRepository
5
6
  from .cached_sale_repository import CachedSaleRepository
6
7
 
7
- __all__ = ["CachedFormFieldRepository", "CachedProductRepository", "CachedReminderCategoryRepository", "CachedSaleRepository", "CachedTagRepository"]
8
+ __all__ = ["CachedFunnelRepository", "CachedFormFieldRepository", "CachedProductRepository", "CachedReminderCategoryRepository", "CachedSaleRepository", "CachedTagRepository"]
@@ -0,0 +1,80 @@
1
+ """Redis cache in front of any `FunnelRepository` (ADR-001: the cache is a decorator, not part of Mongo).
2
+
3
+ Keys are the ones the generic asset service has always used, one set per collection, because the chat-in-a-funnel
4
+ code still reads them through the old services: `funnels:item:{id}`, `funnels:previews:{company}`,
5
+ `funnels:all:{company}` and the same with `funnel_stages:` (plus the global `…:all` lists). Every write invalidates
6
+ them; a cache failure never fails the request (ADR-006).
7
+ """
8
+ from __future__ import annotations
9
+
10
+ from typing import Any, Dict, List, Optional, Protocol
11
+
12
+ from ...domain.crm.funnels import FunnelRepository
13
+ from ...models.cache import CacheProtocol
14
+ from ...models.company.CRM.funnel import Funnel, FunnelStage
15
+ from ...models.utils.types import StrObjectId
16
+ from ...services.chatty_assets.base_container_with_collection import CacheConfig
17
+ from ..asset_cache import AssetCache
18
+
19
+
20
+ class FunnelStore(FunnelRepository, Protocol):
21
+ """The store this decorator wraps: also marks a funnel or stage deleted without reading it, which only the
22
+ decorator needs (it already read it through the cache, as the asset service did). Not part of the port."""
23
+
24
+ async def mark_deleted(self, funnel_id: StrObjectId) -> None: ...
25
+
26
+ async def mark_stage_deleted(self, stage_id: StrObjectId) -> None: ...
27
+
28
+
29
+ class CachedFunnelRepository:
30
+ def __init__(self, inner: FunnelStore, cache: CacheProtocol, config: Optional[CacheConfig] = None):
31
+ self.inner = inner
32
+ self.funnels = AssetCache("funnels", Funnel, cache, config)
33
+ self.stages = AssetCache("funnel_stages", FunnelStage, cache, config)
34
+
35
+ async def get(self, funnel_id: StrObjectId) -> Funnel:
36
+ return await self.funnels.item(funnel_id, lambda: self.inner.get(funnel_id))
37
+
38
+ async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
39
+ return await self.funnels.previews(company_id, lambda: self.inner.list_previews(company_id))
40
+
41
+ async def add(self, funnel: Funnel) -> Funnel:
42
+ added = await self.inner.add(funnel)
43
+ await self.funnels.invalidate(added.id, added.company_id)
44
+ return added
45
+
46
+ async def update(self, funnel_id: StrObjectId, changes: Funnel) -> Funnel:
47
+ updated = await self.inner.update(funnel_id, changes)
48
+ await self.funnels.invalidate(updated.id, updated.company_id)
49
+ return updated
50
+
51
+ async def delete(self, funnel_id: StrObjectId) -> Funnel:
52
+ before = await self.get(funnel_id)
53
+ await self.inner.mark_deleted(funnel_id)
54
+ await self.funnels.invalidate(before.id, before.company_id)
55
+ return before
56
+
57
+ async def get_stage(self, stage_id: StrObjectId) -> FunnelStage:
58
+ return await self.stages.item(stage_id, lambda: self.inner.get_stage(stage_id))
59
+
60
+ async def list_stage_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
61
+ return await self.stages.previews(company_id, lambda: self.inner.list_stage_previews(company_id))
62
+
63
+ async def list_stages(self, company_id: StrObjectId) -> List[FunnelStage]:
64
+ return await self.stages.all(company_id, lambda: self.inner.list_stages(company_id))
65
+
66
+ async def add_stage(self, stage: FunnelStage) -> FunnelStage:
67
+ added = await self.inner.add_stage(stage)
68
+ await self.stages.invalidate(added.id, added.company_id)
69
+ return added
70
+
71
+ async def update_stage(self, stage_id: StrObjectId, changes: FunnelStage) -> FunnelStage:
72
+ updated = await self.inner.update_stage(stage_id, changes)
73
+ await self.stages.invalidate(updated.id, updated.company_id)
74
+ return updated
75
+
76
+ async def delete_stage(self, stage_id: StrObjectId) -> FunnelStage:
77
+ before = await self.get_stage(stage_id)
78
+ await self.inner.mark_stage_deleted(stage_id)
79
+ await self.stages.invalidate(before.id, before.company_id)
80
+ return before
@@ -0,0 +1,3 @@
1
+ from .cached_topic_repository import CachedTopicRepository
2
+
3
+ __all__ = ["CachedTopicRepository"]
@@ -0,0 +1,61 @@
1
+ """Redis cache in front of any `TopicRepository` (ADR-001: the cache is a decorator, not part of Mongo).
2
+
3
+ Keys are the ones the generic asset service has always used, because the legacy `Topics` service still serves the
4
+ smart-message readers on the same keys: `topics:item:{id}`, `topics:previews:{company}`, `topics:all:{company}` (and the
5
+ global `…:all` lists). The item key uses the id as it was asked for, as before. Adding, editing, saving the lock state
6
+ and deleting invalidate them (ADR-006, `AssetCache`). A cache failure never fails the request.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ from typing import Any, Dict, List, Optional, Protocol
11
+
12
+ from ...domain.sources.topics import TopicRepository
13
+ from ...models.analytics.smart_messages.topic import Topic
14
+ from ...models.cache import CacheProtocol
15
+ from ...models.utils.types import StrObjectId
16
+ from ...services.chatty_assets.base_container_with_collection import CacheConfig
17
+ from ..asset_cache import AssetCache
18
+
19
+
20
+ class TopicStore(TopicRepository, Protocol):
21
+ """The store this decorator wraps: also marks one deleted without reading it, which only the decorator needs (it
22
+ reads once through the cache before a delete, as the asset service did). Not part of the use cases' port."""
23
+
24
+ async def mark_deleted(self, topic_id: StrObjectId) -> None: ...
25
+
26
+
27
+ class CachedTopicRepository:
28
+ def __init__(self, inner: TopicStore, cache: CacheProtocol, config: Optional[CacheConfig] = None):
29
+ self.inner = inner
30
+ self.assets = AssetCache("topics", Topic, cache, config)
31
+
32
+ async def get(self, topic_id: StrObjectId) -> Topic:
33
+ return await self.assets.item(topic_id, lambda: self.inner.get(topic_id))
34
+
35
+ async def list(self, company_id: StrObjectId) -> List[Topic]:
36
+ return await self.assets.all(company_id, lambda: self.inner.list(company_id))
37
+
38
+ async def list_previews(self, company_id: StrObjectId) -> List[Dict[str, Any]]:
39
+ return await self.assets.previews(company_id, lambda: self.inner.list_previews(company_id))
40
+
41
+ async def add(self, topic: Topic) -> Topic:
42
+ added = await self.inner.add(topic)
43
+ await self.assets.invalidate(added.id, added.company_id)
44
+ return added
45
+
46
+ async def update(self, topic_id: StrObjectId, changes: Topic) -> Topic:
47
+ # The merge reads Mongo NOW, never the cached copy (24 h old at worst), as the asset service did.
48
+ updated = await self.inner.update(topic_id, changes)
49
+ await self.assets.invalidate(updated.id, updated.company_id)
50
+ return updated
51
+
52
+ async def save_messages(self, topic: Topic) -> None:
53
+ await self.inner.save_messages(topic)
54
+ await self.assets.invalidate(topic.id, topic.company_id)
55
+
56
+ async def delete(self, topic_id: StrObjectId) -> Topic:
57
+ # The topic as it was is read through the cache, as the asset service always did, and only once.
58
+ before = await self.get(topic_id)
59
+ await self.inner.mark_deleted(topic_id)
60
+ await self.assets.invalidate(before.id, before.company_id)
61
+ return before
File without changes
File without changes