whatsapp_notifier 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 554f8799b1a8ce9c71c59f4b801d3ea5f614a313f2ce22df8f93a6983ba06780
4
- data.tar.gz: 0015b28a62c3471d63fbaa13060faec05084ede1acd6df72018d6e7fee38ca4a
3
+ metadata.gz: e65ad0d6844d9762bccd0a929a9d70613a0e9fb145564b75c35f196fc87e4088
4
+ data.tar.gz: 109a415b4a618aac44d5ce9da4f886590a600e8bdb9168ada01e740e9b5add9f
5
5
  SHA512:
6
- metadata.gz: 5c8eed1d767807dfbd1de97daa5f3f017f5a853acc7c008a66f99523d135c12b3f420e8866b03e0523e53d45b2df4efdc29036b527dc359918b99b23b19e279e
7
- data.tar.gz: 0a065dd16263cba9b7f4f8c27f5b4d5b0aae1ba2b0e0b55f8d1a767b61e08804fbdbd432998532298aa33ce2c5cefe2e9b6841c3a2e35c59dda0752e4a86a255
6
+ metadata.gz: 45cbd20b37120dd2b533db5fa28b31dddbbbb00a06538c5a8c75cccd458d2f598c9d2089b898ed890b8cb88693613849d8ca036743d96bbba0d482cf121c70b4
7
+ data.tar.gz: e63080fe514ff18d3f225baebeefef3856b10f83d80087c7c7a33e3b50cc5a150cdc4a964646520a5f866685c13dd08c14f0a8888bed93fc2df5403676eab93a
@@ -12,10 +12,12 @@ module WhatsAppNotifier
12
12
  # host app. The app rebuilds deps with `bun install`.
13
13
  SERVICE_FILES = %w[
14
14
  index.ts
15
+ history.ts
15
16
  inbound.ts
16
17
  init_gate.ts
17
18
  media.ts
18
19
  metrics.ts
20
+ send.ts
19
21
  sessions.ts
20
22
  package.json
21
23
  bun.lock
@@ -39,6 +39,18 @@ module WhatsAppNotifier
39
39
  provider_for(provider || @configuration.provider).delete_media(message_id: message_id, metadata: metadata)
40
40
  end
41
41
 
42
+ def refetch_media(message_id:, chat_id:, metadata: {}, provider: nil)
43
+ provider_for(provider || @configuration.provider).refetch_media(message_id: message_id, chat_id: chat_id, metadata: metadata)
44
+ end
45
+
46
+ def list_chats(metadata: {}, provider: nil)
47
+ provider_for(provider || @configuration.provider).list_chats(metadata: metadata)
48
+ end
49
+
50
+ def fetch_history(chat_id:, limit: 50, metadata: {}, provider: nil)
51
+ provider_for(provider || @configuration.provider).fetch_history(chat_id: chat_id, limit: limit, metadata: metadata)
52
+ end
53
+
42
54
  def logout(metadata: {}, provider: nil)
43
55
  provider_for(provider || @configuration.provider).logout(metadata: metadata)
44
56
  end
@@ -82,6 +82,39 @@ module WhatsAppNotifier
82
82
  adapter.delete_media(message_id: message_id, metadata: metadata)
83
83
  end
84
84
 
85
+ # On-demand media re-download (added in v0.8.0) — same guard idiom as
86
+ # fetch_media so older adapters fail with a clear ConfigurationError
87
+ # rather than NoMethodError.
88
+ def refetch_media(message_id:, chat_id:, metadata: {})
89
+ raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
90
+
91
+ adapter = configuration.web_adapter
92
+ raise ConfigurationError, "web_adapter does not support media refetch (upgrade to a refetch_media-capable adapter)" unless adapter.respond_to?(:refetch_media)
93
+
94
+ adapter.refetch_media(message_id: message_id, chat_id: chat_id, metadata: metadata)
95
+ end
96
+
97
+ # Chat-history helpers are optional adapter capabilities (added in
98
+ # v0.8.0) — same guard idiom as fetch_media so older adapters fail with
99
+ # a clear ConfigurationError rather than NoMethodError.
100
+ def list_chats(metadata: {})
101
+ raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
102
+
103
+ adapter = configuration.web_adapter
104
+ raise ConfigurationError, "web_adapter does not support chat listing (upgrade to a list_chats-capable adapter)" unless adapter.respond_to?(:list_chats)
105
+
106
+ adapter.list_chats(metadata: metadata)
107
+ end
108
+
109
+ def fetch_history(chat_id:, limit: 50, metadata: {})
110
+ raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
111
+
112
+ adapter = configuration.web_adapter
113
+ raise ConfigurationError, "web_adapter does not support history replay (upgrade to a fetch_history-capable adapter)" unless adapter.respond_to?(:fetch_history)
114
+
115
+ adapter.fetch_history(chat_id: chat_id, limit: limit, metadata: metadata)
116
+ end
117
+
85
118
  def logout(metadata: {})
86
119
  raise ConfigurationError, "web automation provider is disabled" unless configuration.web_automation_enabled
87
120