contextbase-plugin-imessage-local 0.2.9__py3-none-any.whl

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.
@@ -0,0 +1,321 @@
1
+ from __future__ import annotations
2
+
3
+ from datetime import datetime
4
+
5
+ from sqlalchemy import LargeBinary, String
6
+ from sqlalchemy.orm import Mapped, mapped_column
7
+ from shared_plugins.sqlalchemy_types import AppleMessageTimestamp
8
+
9
+ from .base import Base
10
+
11
+
12
+ class IMessageHandle(Base):
13
+ """Row from handle in chat.db."""
14
+
15
+ __tablename__ = "handle"
16
+
17
+ rowid: Mapped[int] = mapped_column("ROWID", primary_key=True)
18
+ id: Mapped[str] = mapped_column("id", String)
19
+ country: Mapped[str | None] = mapped_column("country", String)
20
+ service: Mapped[str] = mapped_column("service", String)
21
+ uncanonicalized_id: Mapped[str | None] = mapped_column("uncanonicalized_id", String)
22
+ person_centric_id: Mapped[str | None] = mapped_column("person_centric_id", String)
23
+
24
+
25
+ class IMessageChat(Base):
26
+ """Row from chat in chat.db."""
27
+
28
+ __tablename__ = "chat"
29
+
30
+ rowid: Mapped[int] = mapped_column("ROWID", primary_key=True)
31
+ guid: Mapped[str] = mapped_column("guid", String)
32
+ style: Mapped[int | None] = mapped_column("style")
33
+ state: Mapped[int | None] = mapped_column("state")
34
+ account_id: Mapped[str | None] = mapped_column("account_id", String)
35
+ properties: Mapped[bytes | None] = mapped_column("properties", LargeBinary)
36
+ chat_identifier: Mapped[str | None] = mapped_column("chat_identifier", String)
37
+ service_name: Mapped[str | None] = mapped_column("service_name", String)
38
+ room_name: Mapped[str | None] = mapped_column("room_name", String)
39
+ account_login: Mapped[str | None] = mapped_column("account_login", String)
40
+ is_archived: Mapped[int | None] = mapped_column("is_archived")
41
+ last_addressed_handle: Mapped[str | None] = mapped_column(
42
+ "last_addressed_handle", String
43
+ )
44
+ display_name: Mapped[str | None] = mapped_column("display_name", String)
45
+ group_id: Mapped[str | None] = mapped_column("group_id", String)
46
+ is_filtered: Mapped[int | None] = mapped_column("is_filtered")
47
+ successful_query: Mapped[int | None] = mapped_column("successful_query")
48
+ engram_id: Mapped[str | None] = mapped_column("engram_id", String)
49
+ server_change_token: Mapped[str | None] = mapped_column(
50
+ "server_change_token", String
51
+ )
52
+ ck_sync_state: Mapped[int | None] = mapped_column("ck_sync_state")
53
+ original_group_id: Mapped[str | None] = mapped_column("original_group_id", String)
54
+ last_read_message_timestamp: Mapped[datetime | None] = mapped_column(
55
+ "last_read_message_timestamp",
56
+ AppleMessageTimestamp(null_sentinels=(0,)),
57
+ )
58
+ sr_server_change_token: Mapped[str | None] = mapped_column(
59
+ "sr_server_change_token", String
60
+ )
61
+ sr_ck_sync_state: Mapped[int | None] = mapped_column("sr_ck_sync_state")
62
+ cloudkit_record_id: Mapped[str | None] = mapped_column("cloudkit_record_id", String)
63
+ sr_cloudkit_record_id: Mapped[str | None] = mapped_column(
64
+ "sr_cloudkit_record_id", String
65
+ )
66
+ last_addressed_sim_id: Mapped[str | None] = mapped_column(
67
+ "last_addressed_sim_id", String
68
+ )
69
+ is_blackholed: Mapped[int | None] = mapped_column("is_blackholed")
70
+ syndication_date: Mapped[datetime | None] = mapped_column(
71
+ "syndication_date",
72
+ AppleMessageTimestamp(null_sentinels=(0,)),
73
+ )
74
+ syndication_type: Mapped[int | None] = mapped_column("syndication_type")
75
+ is_recovered: Mapped[int | None] = mapped_column("is_recovered")
76
+ is_deleting_incoming_messages: Mapped[int | None] = mapped_column(
77
+ "is_deleting_incoming_messages"
78
+ )
79
+
80
+
81
+ class IMessageAttachment(Base):
82
+ """Row from attachment in chat.db."""
83
+
84
+ __tablename__ = "attachment"
85
+
86
+ rowid: Mapped[int] = mapped_column("ROWID", primary_key=True)
87
+ guid: Mapped[str] = mapped_column("guid", String)
88
+ created_date: Mapped[datetime | None] = mapped_column(
89
+ "created_date",
90
+ AppleMessageTimestamp(null_sentinels=(0,)),
91
+ )
92
+ start_date: Mapped[datetime | None] = mapped_column(
93
+ "start_date",
94
+ AppleMessageTimestamp(null_sentinels=(0,)),
95
+ )
96
+ filename: Mapped[str | None] = mapped_column("filename", String)
97
+ uti: Mapped[str | None] = mapped_column("uti", String)
98
+ mime_type: Mapped[str | None] = mapped_column("mime_type", String)
99
+ transfer_state: Mapped[int | None] = mapped_column("transfer_state")
100
+ is_outgoing: Mapped[int | None] = mapped_column("is_outgoing")
101
+ user_info: Mapped[bytes | None] = mapped_column("user_info", LargeBinary)
102
+ transfer_name: Mapped[str | None] = mapped_column("transfer_name", String)
103
+ total_bytes: Mapped[int | None] = mapped_column("total_bytes")
104
+ is_sticker: Mapped[int | None] = mapped_column("is_sticker")
105
+ sticker_user_info: Mapped[bytes | None] = mapped_column(
106
+ "sticker_user_info", LargeBinary
107
+ )
108
+ attribution_info: Mapped[bytes | None] = mapped_column(
109
+ "attribution_info", LargeBinary
110
+ )
111
+ hide_attachment: Mapped[int | None] = mapped_column("hide_attachment")
112
+ ck_sync_state: Mapped[int | None] = mapped_column("ck_sync_state")
113
+ ck_server_change_token_blob: Mapped[bytes | None] = mapped_column(
114
+ "ck_server_change_token_blob", LargeBinary
115
+ )
116
+ ck_record_id: Mapped[str | None] = mapped_column("ck_record_id", String)
117
+ original_guid: Mapped[str] = mapped_column("original_guid", String)
118
+ sr_ck_sync_state: Mapped[int | None] = mapped_column("sr_ck_sync_state")
119
+ sr_ck_server_change_token_blob: Mapped[bytes | None] = mapped_column(
120
+ "sr_ck_server_change_token_blob", LargeBinary
121
+ )
122
+ sr_ck_record_id: Mapped[str | None] = mapped_column("sr_ck_record_id", String)
123
+ is_commsafety_sensitive: Mapped[int | None] = mapped_column(
124
+ "is_commsafety_sensitive"
125
+ )
126
+ emoji_image_content_identifier: Mapped[str | None] = mapped_column(
127
+ "emoji_image_content_identifier", String
128
+ )
129
+ emoji_image_short_description: Mapped[str | None] = mapped_column(
130
+ "emoji_image_short_description", String
131
+ )
132
+ preview_generation_state: Mapped[int | None] = mapped_column(
133
+ "preview_generation_state"
134
+ )
135
+
136
+
137
+ class IMessageMessage(Base):
138
+ """Row from message in chat.db."""
139
+
140
+ __tablename__ = "message"
141
+
142
+ rowid: Mapped[int] = mapped_column("ROWID", primary_key=True)
143
+ guid: Mapped[str] = mapped_column("guid", String)
144
+ text: Mapped[str | None] = mapped_column("text", String)
145
+ replace: Mapped[int | None] = mapped_column("replace")
146
+ service_center: Mapped[str | None] = mapped_column("service_center", String)
147
+ handle_id: Mapped[int | None] = mapped_column("handle_id")
148
+ subject: Mapped[str | None] = mapped_column("subject", String)
149
+ country: Mapped[str | None] = mapped_column("country", String)
150
+ attributed_body: Mapped[bytes | None] = mapped_column("attributedBody", LargeBinary)
151
+ version: Mapped[int | None] = mapped_column("version")
152
+ type: Mapped[int | None] = mapped_column("type")
153
+ service: Mapped[str | None] = mapped_column("service", String)
154
+ account: Mapped[str | None] = mapped_column("account", String)
155
+ account_guid: Mapped[str | None] = mapped_column("account_guid", String)
156
+ error: Mapped[int | None] = mapped_column("error")
157
+ date: Mapped[datetime | None] = mapped_column(
158
+ "date",
159
+ AppleMessageTimestamp(null_sentinels=(0,)),
160
+ )
161
+ date_read: Mapped[datetime | None] = mapped_column(
162
+ "date_read",
163
+ AppleMessageTimestamp(null_sentinels=(0,)),
164
+ )
165
+ date_delivered: Mapped[datetime | None] = mapped_column(
166
+ "date_delivered",
167
+ AppleMessageTimestamp(null_sentinels=(0,)),
168
+ )
169
+ is_delivered: Mapped[int | None] = mapped_column("is_delivered")
170
+ is_finished: Mapped[int | None] = mapped_column("is_finished")
171
+ is_emote: Mapped[int | None] = mapped_column("is_emote")
172
+ is_from_me: Mapped[int | None] = mapped_column("is_from_me")
173
+ is_empty: Mapped[int | None] = mapped_column("is_empty")
174
+ is_delayed: Mapped[int | None] = mapped_column("is_delayed")
175
+ is_auto_reply: Mapped[int | None] = mapped_column("is_auto_reply")
176
+ is_prepared: Mapped[int | None] = mapped_column("is_prepared")
177
+ is_read: Mapped[int | None] = mapped_column("is_read")
178
+ is_system_message: Mapped[int | None] = mapped_column("is_system_message")
179
+ is_sent: Mapped[int | None] = mapped_column("is_sent")
180
+ has_dd_results: Mapped[int | None] = mapped_column("has_dd_results")
181
+ is_service_message: Mapped[int | None] = mapped_column("is_service_message")
182
+ is_forward: Mapped[int | None] = mapped_column("is_forward")
183
+ was_downgraded: Mapped[int | None] = mapped_column("was_downgraded")
184
+ is_archive: Mapped[int | None] = mapped_column("is_archive")
185
+ cache_has_attachments: Mapped[int | None] = mapped_column("cache_has_attachments")
186
+ cache_roomnames: Mapped[str | None] = mapped_column("cache_roomnames", String)
187
+ was_data_detected: Mapped[int | None] = mapped_column("was_data_detected")
188
+ was_deduplicated: Mapped[int | None] = mapped_column("was_deduplicated")
189
+ is_audio_message: Mapped[int | None] = mapped_column("is_audio_message")
190
+ is_played: Mapped[int | None] = mapped_column("is_played")
191
+ date_played: Mapped[datetime | None] = mapped_column(
192
+ "date_played",
193
+ AppleMessageTimestamp(null_sentinels=(0,)),
194
+ )
195
+ item_type: Mapped[int | None] = mapped_column("item_type")
196
+ other_handle: Mapped[int | None] = mapped_column("other_handle")
197
+ group_title: Mapped[str | None] = mapped_column("group_title", String)
198
+ group_action_type: Mapped[int | None] = mapped_column("group_action_type")
199
+ share_status: Mapped[int | None] = mapped_column("share_status")
200
+ share_direction: Mapped[int | None] = mapped_column("share_direction")
201
+ is_expirable: Mapped[int | None] = mapped_column("is_expirable")
202
+ expire_state: Mapped[int | None] = mapped_column("expire_state")
203
+ message_action_type: Mapped[int | None] = mapped_column("message_action_type")
204
+ message_source: Mapped[int | None] = mapped_column("message_source")
205
+ associated_message_guid: Mapped[str | None] = mapped_column(
206
+ "associated_message_guid", String
207
+ )
208
+ associated_message_type: Mapped[int | None] = mapped_column(
209
+ "associated_message_type"
210
+ )
211
+ balloon_bundle_id: Mapped[str | None] = mapped_column("balloon_bundle_id", String)
212
+ payload_data: Mapped[bytes | None] = mapped_column("payload_data", LargeBinary)
213
+ expressive_send_style_id: Mapped[str | None] = mapped_column(
214
+ "expressive_send_style_id", String
215
+ )
216
+ associated_message_range_location: Mapped[int | None] = mapped_column(
217
+ "associated_message_range_location"
218
+ )
219
+ associated_message_range_length: Mapped[int | None] = mapped_column(
220
+ "associated_message_range_length"
221
+ )
222
+ time_expressive_send_played: Mapped[datetime | None] = mapped_column(
223
+ "time_expressive_send_played",
224
+ AppleMessageTimestamp(null_sentinels=(0,)),
225
+ )
226
+ message_summary_info: Mapped[bytes | None] = mapped_column(
227
+ "message_summary_info", LargeBinary
228
+ )
229
+ ck_sync_state: Mapped[int | None] = mapped_column("ck_sync_state")
230
+ ck_record_id: Mapped[str | None] = mapped_column("ck_record_id", String)
231
+ ck_record_change_tag: Mapped[str | None] = mapped_column(
232
+ "ck_record_change_tag", String
233
+ )
234
+ destination_caller_id: Mapped[str | None] = mapped_column(
235
+ "destination_caller_id", String
236
+ )
237
+ sr_ck_sync_state: Mapped[int | None] = mapped_column("sr_ck_sync_state")
238
+ sr_ck_record_id: Mapped[str | None] = mapped_column("sr_ck_record_id", String)
239
+ sr_ck_record_change_tag: Mapped[str | None] = mapped_column(
240
+ "sr_ck_record_change_tag", String
241
+ )
242
+ is_corrupt: Mapped[int | None] = mapped_column("is_corrupt")
243
+ reply_to_guid: Mapped[str | None] = mapped_column("reply_to_guid", String)
244
+ sort_id: Mapped[int | None] = mapped_column("sort_id")
245
+ is_spam: Mapped[int | None] = mapped_column("is_spam")
246
+ has_unseen_mention: Mapped[int | None] = mapped_column("has_unseen_mention")
247
+ thread_originator_guid: Mapped[str | None] = mapped_column(
248
+ "thread_originator_guid", String
249
+ )
250
+ thread_originator_part: Mapped[str | None] = mapped_column(
251
+ "thread_originator_part", String
252
+ )
253
+ syndication_ranges: Mapped[str | None] = mapped_column("syndication_ranges", String)
254
+ was_delivered_quietly: Mapped[int | None] = mapped_column("was_delivered_quietly")
255
+ did_notify_recipient: Mapped[int | None] = mapped_column("did_notify_recipient")
256
+ synced_syndication_ranges: Mapped[str | None] = mapped_column(
257
+ "synced_syndication_ranges", String
258
+ )
259
+ date_retracted: Mapped[datetime | None] = mapped_column(
260
+ "date_retracted",
261
+ AppleMessageTimestamp(null_sentinels=(0,)),
262
+ )
263
+ date_edited: Mapped[datetime | None] = mapped_column(
264
+ "date_edited",
265
+ AppleMessageTimestamp(null_sentinels=(0,)),
266
+ )
267
+ was_detonated: Mapped[int | None] = mapped_column("was_detonated")
268
+ part_count: Mapped[int | None] = mapped_column("part_count")
269
+ is_stewie: Mapped[int | None] = mapped_column("is_stewie")
270
+ is_kt_verified: Mapped[int | None] = mapped_column("is_kt_verified")
271
+ is_sos: Mapped[int | None] = mapped_column("is_sos")
272
+ is_critical: Mapped[int | None] = mapped_column("is_critical")
273
+ bia_reference_id: Mapped[str | None] = mapped_column("bia_reference_id", String)
274
+ fallback_hash: Mapped[str | None] = mapped_column("fallback_hash", String)
275
+ associated_message_emoji: Mapped[str | None] = mapped_column(
276
+ "associated_message_emoji", String
277
+ )
278
+ is_pending_satellite_send: Mapped[int | None] = mapped_column(
279
+ "is_pending_satellite_send"
280
+ )
281
+ needs_relay: Mapped[int | None] = mapped_column("needs_relay")
282
+ schedule_type: Mapped[int | None] = mapped_column("schedule_type")
283
+ schedule_state: Mapped[int | None] = mapped_column("schedule_state")
284
+ sent_or_received_off_grid: Mapped[int | None] = mapped_column(
285
+ "sent_or_received_off_grid"
286
+ )
287
+ date_recovered: Mapped[datetime | None] = mapped_column(
288
+ "date_recovered",
289
+ AppleMessageTimestamp(null_sentinels=(0,)),
290
+ )
291
+
292
+
293
+ class IMessageChatHandleJoin(Base):
294
+ """Row from chat_handle_join in chat.db."""
295
+
296
+ __tablename__ = "chat_handle_join"
297
+
298
+ chat_id: Mapped[int] = mapped_column("chat_id", primary_key=True)
299
+ handle_id: Mapped[int] = mapped_column("handle_id", primary_key=True)
300
+
301
+
302
+ class IMessageChatMessageJoin(Base):
303
+ """Row from chat_message_join in chat.db."""
304
+
305
+ __tablename__ = "chat_message_join"
306
+
307
+ chat_id: Mapped[int] = mapped_column("chat_id", primary_key=True)
308
+ message_id: Mapped[int] = mapped_column("message_id", primary_key=True)
309
+ message_date: Mapped[datetime | None] = mapped_column(
310
+ "message_date",
311
+ AppleMessageTimestamp(null_sentinels=(0,)),
312
+ )
313
+
314
+
315
+ class IMessageMessageAttachmentJoin(Base):
316
+ """Row from message_attachment_join in chat.db."""
317
+
318
+ __tablename__ = "message_attachment_join"
319
+
320
+ message_id: Mapped[int] = mapped_column("message_id", primary_key=True)
321
+ attachment_id: Mapped[int] = mapped_column("attachment_id", primary_key=True)